@redvars/peacock 4.5.1 → 4.6.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 (256) hide show
  1. package/dist/{BaseField-BbOj212R.js → BaseField-DOCmylob.js} +16 -3
  2. package/dist/BaseField-DOCmylob.js.map +1 -0
  3. package/dist/accordion.js +1 -1
  4. package/dist/activation-gate-D4IpmwyD.js +23 -0
  5. package/dist/activation-gate-D4IpmwyD.js.map +1 -0
  6. package/dist/avatar-group.js +2 -1
  7. package/dist/avatar-group.js.map +1 -1
  8. package/dist/avatar.js +3 -0
  9. package/dist/avatar.js.map +1 -1
  10. package/dist/{base-button-BJMGMcMv.js → base-button-9tGu5RSC.js} +30 -10
  11. package/dist/base-button-9tGu5RSC.js.map +1 -0
  12. package/dist/button-group.js +5 -3
  13. package/dist/button-group.js.map +1 -1
  14. package/dist/button.js +12 -16
  15. package/dist/button.js.map +1 -1
  16. package/dist/calendar-column-view.js +4 -4
  17. package/dist/{calendar-drag-IXMPZrTN.js → calendar-drag-DdJwSpEz.js} +2 -2
  18. package/dist/{calendar-drag-IXMPZrTN.js.map → calendar-drag-DdJwSpEz.js.map} +1 -1
  19. package/dist/{calendar-event-BQChlMXy.js → calendar-event-BvbYZHx1.js} +2 -2
  20. package/dist/{calendar-event-BQChlMXy.js.map → calendar-event-BvbYZHx1.js.map} +1 -1
  21. package/dist/calendar-month-view.js +65 -14
  22. package/dist/calendar-month-view.js.map +1 -1
  23. package/dist/calendar-timeline.js +9 -4
  24. package/dist/calendar-timeline.js.map +1 -1
  25. package/dist/calendar.js +21 -6
  26. package/dist/calendar.js.map +1 -1
  27. package/dist/card.js +29 -16
  28. package/dist/card.js.map +1 -1
  29. package/dist/chart-doughnut.js +3 -1
  30. package/dist/chart-doughnut.js.map +1 -1
  31. package/dist/chart-pie.js +9 -1
  32. package/dist/chart-pie.js.map +1 -1
  33. package/dist/chip-set.js +1 -1
  34. package/dist/chip.js +10 -19
  35. package/dist/chip.js.map +1 -1
  36. package/dist/code-editor.js +56 -5
  37. package/dist/code-editor.js.map +1 -1
  38. package/dist/color-field.js +4 -1
  39. package/dist/color-field.js.map +1 -1
  40. package/dist/currency-field.js +4 -1
  41. package/dist/currency-field.js.map +1 -1
  42. package/dist/custom-elements-jsdocs.json +29 -23
  43. package/dist/custom-elements.json +758 -93
  44. package/dist/{datasource-OwvH7SVq.js → datasource-DxEA6jHW.js} +6 -4
  45. package/dist/datasource-DxEA6jHW.js.map +1 -0
  46. package/dist/{date-cfPx3alz.js → date-DPQOY8Zd.js} +2 -2
  47. package/dist/{date-cfPx3alz.js.map → date-DPQOY8Zd.js.map} +1 -1
  48. package/dist/date-field.js +8 -5
  49. package/dist/date-field.js.map +1 -1
  50. package/dist/date-picker.js +2 -2
  51. package/dist/date-range-field.js +8 -5
  52. package/dist/date-range-field.js.map +1 -1
  53. package/dist/datetime-field.js +7 -4
  54. package/dist/datetime-field.js.map +1 -1
  55. package/dist/diagram-controls.js +1 -1
  56. package/dist/{throttle-SQ9t-HL7.js → dispatch-event-utils-DfgqVBK8.js} +2 -24
  57. package/dist/dispatch-event-utils-DfgqVBK8.js.map +1 -0
  58. package/dist/{form-submitter-beG1CXAn.js → dispatch-hooks-J_godlHh.js} +2 -87
  59. package/dist/dispatch-hooks-J_godlHh.js.map +1 -0
  60. package/dist/dropdown-button.js +11 -7
  61. package/dist/dropdown-button.js.map +1 -1
  62. package/dist/{event-manager-KGMT2x2Q.js → event-manager-DYfeN3VE.js} +3 -3
  63. package/dist/{event-manager-KGMT2x2Q.js.map → event-manager-DYfeN3VE.js.map} +1 -1
  64. package/dist/fab.js +15 -19
  65. package/dist/fab.js.map +1 -1
  66. package/dist/filter-bar.js +3 -3
  67. package/dist/form-submission-h40coUI8.js +13 -0
  68. package/dist/form-submission-h40coUI8.js.map +1 -0
  69. package/dist/form-submitter-BIFqZ0wq.js +88 -0
  70. package/dist/form-submitter-BIFqZ0wq.js.map +1 -0
  71. package/dist/form.js +1 -9
  72. package/dist/form.js.map +1 -1
  73. package/dist/icon-button.js +15 -19
  74. package/dist/icon-button.js.map +1 -1
  75. package/dist/icon.js +1 -1
  76. package/dist/implicit-submission-ChLdbxaR.js +100 -0
  77. package/dist/implicit-submission-ChLdbxaR.js.map +1 -0
  78. package/dist/index.js +20 -15
  79. package/dist/index.js.map +1 -1
  80. package/dist/{indicator-navigation-item-CmyhsOmy.js → indicator-navigation-item-BsQE3kUr.js} +2 -2
  81. package/dist/{indicator-navigation-item-CmyhsOmy.js.map → indicator-navigation-item-BsQE3kUr.js.map} +1 -1
  82. package/dist/input.js +13 -4
  83. package/dist/input.js.map +1 -1
  84. package/dist/json-viewer.js +1 -1
  85. package/dist/kanban.js +8 -7
  86. package/dist/kanban.js.map +1 -1
  87. package/dist/link-button.js +13 -14
  88. package/dist/link-button.js.map +1 -1
  89. package/dist/list-item.js +52 -16
  90. package/dist/list-item.js.map +1 -1
  91. package/dist/list.js +5 -3
  92. package/dist/list.js.map +1 -1
  93. package/dist/listbox.js +1 -1
  94. package/dist/loader-full.js +17 -12
  95. package/dist/loader-full.js.map +1 -1
  96. package/dist/loader.js +17 -12
  97. package/dist/loader.js.map +1 -1
  98. package/dist/locale-DEsJZCQG.js.map +1 -1
  99. package/dist/mention-input.js +8 -1
  100. package/dist/mention-input.js.map +1 -1
  101. package/dist/menu-item.js +12 -12
  102. package/dist/menu-item.js.map +1 -1
  103. package/dist/menu.js +7 -3
  104. package/dist/menu.js.map +1 -1
  105. package/dist/navigation-bar-item.js +4 -3
  106. package/dist/navigation-bar-item.js.map +1 -1
  107. package/dist/navigation-bar.js +4 -3
  108. package/dist/navigation-bar.js.map +1 -1
  109. package/dist/navigation-drawer-item.js +3 -2
  110. package/dist/navigation-drawer-item.js.map +1 -1
  111. package/dist/navigation-drawer.js +3 -2
  112. package/dist/navigation-drawer.js.map +1 -1
  113. package/dist/{navigation-item-base-kUrvJgCx.js → navigation-item-base-5ljwtLG_.js} +3 -2
  114. package/dist/{navigation-item-base-kUrvJgCx.js.map → navigation-item-base-5ljwtLG_.js.map} +1 -1
  115. package/dist/navigation-rail-item.js +4 -3
  116. package/dist/navigation-rail-item.js.map +1 -1
  117. package/dist/navigation-rail.js +6 -5
  118. package/dist/navigation-rail.js.map +1 -1
  119. package/dist/number-field.js +4 -1
  120. package/dist/number-field.js.map +1 -1
  121. package/dist/option.js +3 -2
  122. package/dist/option.js.map +1 -1
  123. package/dist/password-field.js +11 -4
  124. package/dist/password-field.js.map +1 -1
  125. package/dist/phone-field.js +4 -1
  126. package/dist/phone-field.js.map +1 -1
  127. package/dist/{picker-field-DmXYPvbF.js → picker-field-BiM3iXAQ.js} +2 -2
  128. package/dist/{picker-field-DmXYPvbF.js.map → picker-field-BiM3iXAQ.js.map} +1 -1
  129. package/dist/pin-input.js +4 -1
  130. package/dist/pin-input.js.map +1 -1
  131. package/dist/{range-utils-DZe96GnO.js → range-utils-vgG1SJ2o.js} +2 -2
  132. package/dist/{range-utils-DZe96GnO.js.map → range-utils-vgG1SJ2o.js.map} +1 -1
  133. package/dist/{roving-focus-controller-fm95JkZJ.js → roving-focus-controller-YtNbxH95.js} +30 -7
  134. package/dist/roving-focus-controller-YtNbxH95.js.map +1 -0
  135. package/dist/search.js +12 -6
  136. package/dist/search.js.map +1 -1
  137. package/dist/select.js +11 -3
  138. package/dist/select.js.map +1 -1
  139. package/dist/shipped-icons.js +1 -1
  140. package/dist/split-button.js +9 -1
  141. package/dist/split-button.js.map +1 -1
  142. package/dist/src/__internal/controllers/roving-focus-controller.d.ts +14 -2
  143. package/dist/src/__internal/implicit-submission.d.ts +25 -0
  144. package/dist/src/__internal/utils/activation-gate.d.ts +8 -0
  145. package/dist/src/__internal/utils/form-submission.d.ts +2 -0
  146. package/dist/src/avatar-group/avatar-group.d.ts +1 -1
  147. package/dist/src/button/base-button/base-button.d.ts +1 -1
  148. package/dist/src/button/button/button.d.ts +2 -1
  149. package/dist/src/button/fab/fab.d.ts +2 -1
  150. package/dist/src/button/icon-button/icon-button.d.ts +2 -1
  151. package/dist/src/button/link-button/link-button.d.ts +5 -1
  152. package/dist/src/calendar/calendar-month-view.d.ts +5 -1
  153. package/dist/src/calendar/calendar.d.ts +6 -1
  154. package/dist/src/card/card.d.ts +19 -9
  155. package/dist/src/chart-pie/chart-pie.d.ts +5 -0
  156. package/dist/src/chip/chip/chip.d.ts +4 -4
  157. package/dist/src/code-editor/code-editor.d.ts +3 -3
  158. package/dist/src/dropdown-button/dropdown-button.d.ts +5 -1
  159. package/dist/src/input/BaseField.d.ts +7 -0
  160. package/dist/src/input/input.d.ts +5 -1
  161. package/dist/src/list/list-item.d.ts +2 -1
  162. package/dist/src/mention-input/mention-input.d.ts +2 -0
  163. package/dist/src/menu/menu-item/menu-item.d.ts +6 -4
  164. package/dist/src/password-field/password-field.d.ts +3 -1
  165. package/dist/src/search/search.d.ts +1 -0
  166. package/dist/src/select/select.d.ts +2 -0
  167. package/dist/src/split-button/split-button.d.ts +6 -1
  168. package/dist/src/stepper/step.d.ts +3 -1
  169. package/dist/src/tabs/tab.d.ts +12 -2
  170. package/dist/src/textarea/textarea.d.ts +2 -0
  171. package/dist/src/toolbar/toolbar.d.ts +13 -2
  172. package/dist/step.js +7 -1
  173. package/dist/step.js.map +1 -1
  174. package/dist/stepper.js +10 -1
  175. package/dist/stepper.js.map +1 -1
  176. package/dist/sub-menu.js +3 -2
  177. package/dist/sub-menu.js.map +1 -1
  178. package/dist/svg.js +1 -1
  179. package/dist/tab-group.js +3 -2
  180. package/dist/tab-group.js.map +1 -1
  181. package/dist/tab.js +17 -12
  182. package/dist/tab.js.map +1 -1
  183. package/dist/tabs.js +3 -2
  184. package/dist/tabs.js.map +1 -1
  185. package/dist/test/accessible-name.test.d.ts +1 -0
  186. package/dist/test/helpers/count-activations.d.ts +9 -0
  187. package/dist/test/navigation-rail.test.d.ts +1 -0
  188. package/dist/test/throttle-delay.test.d.ts +1 -0
  189. package/dist/textarea.js +8 -1
  190. package/dist/textarea.js.map +1 -1
  191. package/dist/throttle-C7ZAPqtu.js +24 -0
  192. package/dist/throttle-C7ZAPqtu.js.map +1 -0
  193. package/dist/time-field.js +7 -4
  194. package/dist/time-field.js.map +1 -1
  195. package/dist/time-picker.js +2 -2
  196. package/dist/toolbar.js +25 -8
  197. package/dist/toolbar.js.map +1 -1
  198. package/dist/tree.js +1 -1
  199. package/dist/tsconfig.tsbuildinfo +1 -1
  200. package/dist/url-field.js +4 -1
  201. package/dist/url-field.js.map +1 -1
  202. package/dist/{utils-DcvLgexs.js → utils-CQzycr9J.js} +2 -1
  203. package/dist/utils-CQzycr9J.js.map +1 -0
  204. package/package.json +2 -1
  205. package/src/__internal/controllers/roving-focus-controller.ts +35 -7
  206. package/src/__internal/i18n/locale.ts +1 -1
  207. package/src/__internal/implicit-submission.ts +102 -0
  208. package/src/__internal/utils/activation-gate.ts +20 -0
  209. package/src/__internal/utils/cache-fetch.ts +6 -3
  210. package/src/__internal/utils/form-submission.ts +11 -0
  211. package/src/avatar/avatar.scss +5 -0
  212. package/src/avatar-group/avatar-group.scss +3 -0
  213. package/src/avatar-group/avatar-group.ts +1 -1
  214. package/src/button/base-button/base-button.ts +41 -16
  215. package/src/button/button/button.ts +5 -16
  216. package/src/button/fab/fab.ts +7 -18
  217. package/src/button/icon-button/icon-button.ts +7 -18
  218. package/src/button/link-button/link-button.ts +8 -15
  219. package/src/calendar/_calendar-header.scss +7 -1
  220. package/src/calendar/calendar-month-view.scss +36 -2
  221. package/src/calendar/calendar-month-view.ts +33 -8
  222. package/src/calendar/calendar.ts +17 -2
  223. package/src/calendar/utils.ts +1 -0
  224. package/src/card/card.ts +27 -16
  225. package/src/chart-doughnut/chart-doughnut.ts +6 -1
  226. package/src/chart-pie/chart-pie.ts +10 -1
  227. package/src/chip/chip/chip.ts +6 -26
  228. package/src/code-editor/code-editor.scss +70 -1
  229. package/src/code-editor/code-editor.ts +12 -4
  230. package/src/dropdown-button/dropdown-button.ts +7 -2
  231. package/src/form/form.ts +1 -9
  232. package/src/input/BaseField.ts +17 -0
  233. package/src/input/input.ts +13 -1
  234. package/src/kanban/kanban.scss +11 -7
  235. package/src/list/list-item.scss +5 -0
  236. package/src/list/list-item.ts +44 -16
  237. package/src/mention-input/mention-input.ts +5 -0
  238. package/src/menu/menu/menu.ts +4 -1
  239. package/src/menu/menu-item/menu-item.ts +9 -14
  240. package/src/navigation-rail/navigation-rail.scss +3 -2
  241. package/src/password-field/password-field.ts +11 -1
  242. package/src/search/search.ts +9 -0
  243. package/src/select/select.ts +5 -0
  244. package/src/split-button/split-button.ts +10 -1
  245. package/src/stepper/step.ts +7 -1
  246. package/src/stepper/stepper.scss +13 -0
  247. package/src/tabs/tab.ts +21 -17
  248. package/src/textarea/textarea.ts +5 -0
  249. package/src/toolbar/toolbar.ts +26 -7
  250. package/dist/BaseField-BbOj212R.js.map +0 -1
  251. package/dist/base-button-BJMGMcMv.js.map +0 -1
  252. package/dist/datasource-OwvH7SVq.js.map +0 -1
  253. package/dist/form-submitter-beG1CXAn.js.map +0 -1
  254. package/dist/roving-focus-controller-fm95JkZJ.js.map +0 -1
  255. package/dist/throttle-SQ9t-HL7.js.map +0 -1
  256. package/dist/utils-DcvLgexs.js.map +0 -1
@@ -131,13 +131,6 @@ export class IconButton extends mixinButtonLevel(
131
131
 
132
132
  @query('.button') readonly buttonElement!: HTMLElement | null;
133
133
 
134
- // ── Constructor ───────────────────────────────────────────────────────────
135
-
136
- constructor() {
137
- super();
138
- this.addEventListener('click', this.__dispatchClickWithThrottle);
139
- }
140
-
141
134
  // ── Lifecycle ─────────────────────────────────────────────────────────────
142
135
 
143
136
  override firstUpdated(changedProperties: PropertyValues<this>) {
@@ -157,21 +150,17 @@ export class IconButton extends mixinButtonLevel(
157
150
 
158
151
  // ── Private methods ───────────────────────────────────────────────────────
159
152
 
160
- __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
161
- // If the button is soft-disabled, loading or a disabled link, we need to
162
- // explicitly prevent the click from propagating to other event listeners
163
- // as well as prevent the default action.
164
- if (
153
+ /** A soft-disabled, loading or skeleton button, or a disabled link, swallows clicks. */
154
+ override __isClickBlocked() {
155
+ return (
165
156
  this.softDisabled ||
166
157
  this.loading ||
167
- (this.disabled && this.href) ||
158
+ (this.disabled && !!this.href) ||
168
159
  this.skeleton
169
- ) {
170
- event.stopImmediatePropagation();
171
- event.preventDefault();
172
- return;
173
- }
160
+ );
161
+ }
174
162
 
163
+ __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
175
164
  // Each activation reaches this listener once: either the inner button's
176
165
  // click bubbling out, or a click fired at the host and forwarded below.
177
166
  if (!isLink(this)) toggleButtonSelected(this);
@@ -95,13 +95,6 @@ export class LinkButton extends mixinButtonLevel(
95
95
 
96
96
  private __labelSlotCleanup: (() => void) | null = null;
97
97
 
98
- // ── Constructor ───────────────────────────────────────────────────────────
99
-
100
- constructor() {
101
- super();
102
- this.addEventListener('click', this.__dispatchClickWithThrottle);
103
- }
104
-
105
98
  // ── Lifecycle ─────────────────────────────────────────────────────────────
106
99
 
107
100
  override disconnectedCallback() {
@@ -143,15 +136,15 @@ export class LinkButton extends mixinButtonLevel(
143
136
 
144
137
  // ── Private methods ───────────────────────────────────────────────────────
145
138
 
146
- __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
147
- // A link has no native disabled state, so a disabled, soft-disabled or
148
- // skeleton link swallows the click and stops the navigation.
149
- if (this.disabled || this.softDisabled || this.skeleton) {
150
- event.stopImmediatePropagation();
151
- event.preventDefault();
152
- return;
153
- }
139
+ /**
140
+ * A link has no native disabled state, so a disabled, soft-disabled or skeleton link swallows
141
+ * the click and stops the navigation.
142
+ */
143
+ override __isClickBlocked() {
144
+ return this.disabled || this.softDisabled || this.skeleton;
145
+ }
154
146
 
147
+ __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
155
148
  if (!isActivationClick(event) || !this.linkElement) {
156
149
  return;
157
150
  }
@@ -3,17 +3,22 @@
3
3
  // holds the header.
4
4
 
5
5
  @mixin styles {
6
+ // When the calendar is narrow the views wrap onto a second line instead of overflowing.
6
7
  .calendar-header-classic {
7
8
  display: flex;
9
+ flex-wrap: wrap;
8
10
  align-items: center;
11
+ justify-content: space-between;
9
12
  padding: 0.75rem 1rem;
10
13
  gap: 0.5rem;
11
14
 
12
15
  .header-left {
13
16
  display: flex;
17
+ flex-wrap: wrap;
14
18
  gap: 0.5rem;
15
19
  align-items: center;
16
- flex: 1;
20
+ flex: 1 1 auto;
21
+ min-width: 0;
17
22
 
18
23
  .title {
19
24
  display: flex;
@@ -28,6 +33,7 @@
28
33
  .header-right {
29
34
  display: flex;
30
35
  align-items: center;
36
+ max-width: 100%;
31
37
  }
32
38
  }
33
39
  }
@@ -103,11 +103,45 @@
103
103
  .column-header {
104
104
  font-size: 0.75rem;
105
105
  color: var(--color-on-surface-variant);
106
- padding-inline-start: 0.5rem;
107
- padding-top: 0.375rem;
106
+ padding-inline-start: 0.25rem;
107
+ padding-top: 0.25rem;
108
108
  border-top: 3px solid transparent;
109
109
  }
110
110
 
111
+ // The day number: a button that selects the day.
112
+ .date {
113
+ display: inline-flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ min-width: 1.5rem;
117
+ height: 1.5rem;
118
+ margin: 0;
119
+ padding: 0 0.25rem;
120
+ box-sizing: border-box;
121
+ border: 0;
122
+ border-radius: var(--shape-corner-full);
123
+ background: transparent;
124
+ color: inherit;
125
+ font: inherit;
126
+ cursor: pointer;
127
+ transition: background 200ms ease;
128
+
129
+ &:hover {
130
+ background: var(--color-surface-container-highest);
131
+ }
132
+
133
+ &:focus-visible {
134
+ outline: 2px solid var(--color-primary);
135
+ outline-offset: 1px;
136
+ }
137
+ }
138
+
139
+ &.selected .date {
140
+ background: var(--color-primary);
141
+ color: var(--color-on-primary);
142
+ font-weight: 500;
143
+ }
144
+
111
145
  &.today {
112
146
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
113
147
 
@@ -68,11 +68,14 @@ interface MonthPreview {
68
68
  * <p>The month is a read-only ARIA grid labelled with the month and year: one row per week, one
69
69
  * gridcell per day labelled with its full date. Each event is owned (<code>aria-owns</code>) by the
70
70
  * cell of the day it starts on in that week. Events are buttons labelled with their title and
71
- * time, or notes that cannot be focused when <code>events-readonly</code> is set.</p>
71
+ * time, or notes that cannot be focused when <code>events-readonly</code> is set. Each day number is
72
+ * a button that fires <code>date-click</code>; the day of <code>contextDate</code> is marked
73
+ * selected. Pressing a day number never starts a drag or adds an event.</p>
72
74
  * <p>With <code>editable</code>, events are dragged to other days and all-day events resized by
73
75
  * their edges; with <code>addable</code>, dragging across days or clicking one asks for an
74
76
  * all-day event. The days a drag covers are highlighted.</p>
75
77
  *
78
+ * @fires date-click - Internal, does not bubble; a day number was chosen and `wc-calendar` selects that day. Detail contains `{ date }`.
76
79
  * @fires event-click - Internal, does not bubble; `wc-calendar` re-fires it. Detail contains `{ event }`.
77
80
  * @fires event-change - Internal, does not bubble; an event was dropped on new days. `wc-calendar` re-fires it.
78
81
  * @fires event-add - Internal, does not bubble; days were drawn across or a day clicked. `wc-calendar` re-fires it.
@@ -253,6 +256,12 @@ export class CalendarMonthView extends LitElement {
253
256
  };
254
257
  }
255
258
 
259
+ private _emitDateClick(date: Date) {
260
+ this.dispatchEvent(
261
+ new CustomEvent<{ date: Date }>('date-click', { detail: { date } }),
262
+ );
263
+ }
264
+
256
265
  private _emitEventClick(event: unknown) {
257
266
  this.dispatchEvent(new CustomEvent('event-click', { detail: { event } }));
258
267
  }
@@ -325,14 +334,17 @@ export class CalendarMonthView extends LitElement {
325
334
 
326
335
  private _onAreaPointerDown(event: PointerEvent) {
327
336
  if (!this.addable || this._drag.pressing) return;
328
- // Presses on events are theirs, even on events that cannot be dragged.
329
- const onEvent = event
337
+ // Presses on events are theirs, even on events that cannot be dragged, and presses on a day
338
+ // number choose that day: neither starts a drag or adds an event.
339
+ const onOwnTarget = event
330
340
  .composedPath()
331
341
  .some(
332
342
  target =>
333
- target instanceof HTMLElement && target.classList.contains('event'),
343
+ target instanceof HTMLElement &&
344
+ (target.classList.contains('event') ||
345
+ target.classList.contains('date')),
334
346
  );
335
- if (onEvent) return;
347
+ if (onOwnTarget) return;
336
348
  const day = this._dayAt(event.clientX, event.clientY);
337
349
  if (!day) return;
338
350
  this._drag.start(event, { action: 'add', day });
@@ -454,6 +466,7 @@ export class CalendarMonthView extends LitElement {
454
466
  const target = this._target();
455
467
  const first = target ? startOfDay(target.start).valueOf() : 0;
456
468
  const last = target ? lastDayOf(target.start, target.end).valueOf() : -1;
469
+ const selectedDay = startOfDay(this.contextDate).valueOf();
457
470
  const columns = [];
458
471
  for (let i = new Date(sd), j = 0; j < 7; i = addDays(i, 1), j += 1) {
459
472
  const owned = placed
@@ -463,17 +476,29 @@ export class CalendarMonthView extends LitElement {
463
476
  const today = this._getDayClass(i).includes('today');
464
477
  const day = startOfDay(i).valueOf();
465
478
  const covered = day >= first && day <= last;
479
+ const selected = day === selectedDay;
480
+ const date = startOfDay(i);
466
481
  columns.push(html`
467
482
  <div
468
- class="${this._getDayClass(i)}${covered ? ' drop-target' : ''}"
483
+ class="${this._getDayClass(i)}${covered
484
+ ? ' drop-target'
485
+ : ''}${selected ? ' selected' : ''}"
469
486
  role="gridcell"
470
487
  aria-label=${long.format(i)}
471
488
  aria-current=${today ? 'date' : nothing}
489
+ aria-selected=${selected ? 'true' : 'false'}
472
490
  aria-owns=${owned || nothing}
473
491
  >
474
492
  <div class="column-content">
475
- <div class="column-header" aria-hidden="true">
476
- <div class="day">${formatDate(i, 'd', locale)}</div>
493
+ <div class="column-header">
494
+ <button
495
+ type="button"
496
+ class="date"
497
+ aria-label=${long.format(i)}
498
+ @click=${() => this._emitDateClick(date)}
499
+ >
500
+ ${formatDate(i, 'd', locale)}
501
+ </button>
477
502
  </div>
478
503
  </div>
479
504
  </div>
@@ -81,7 +81,10 @@ export function applyCalendarChange<T extends EventType>(
81
81
  * same from code; each fires <code>date-change</code>. The date shown is <code>date</code> (an ISO
82
82
  * string) or <code>contextDate</code> (a <code>Date</code>), kept in step. Choosing a day number
83
83
  * in a column view switches to the day view and fires <code>view-change</code> and
84
- * <code>date-change</code>.</p>
84
+ * <code>date-change</code>. In the month view, choosing a day number selects that day (it is
85
+ * highlighted and becomes <code>contextDate</code>) and fires <code>date-change</code>, staying on
86
+ * the month. The header shows the month and year in the month view and the full date otherwise,
87
+ * and wraps onto two lines when the calendar is narrow.</p>
85
88
  * <p>Events are buttons, chosen with a click, Enter or Space, which fire <code>event-click</code>.
86
89
  * With <code>events-readonly</code> they are shown but cannot be focused or clicked.
87
90
  * <code>loading</code> shows a progress bar and marks the calendar busy. <code>first-day</code>
@@ -424,6 +427,12 @@ export class Calendar extends LitElement {
424
427
  this._setContextDate(evt.detail.date);
425
428
  }
426
429
 
430
+ /** A day chosen in the month view becomes the selected day; the view stays on the month. */
431
+ private _onMonthDateClick(evt: CustomEvent<{ date: Date }>) {
432
+ evt.stopPropagation();
433
+ this._setContextDate(evt.detail.date);
434
+ }
435
+
427
436
  private _onViewEventClick(evt: CustomEvent<{ event: unknown }>) {
428
437
  evt.stopPropagation();
429
438
  if (!this._eventsInteractive()) return;
@@ -514,8 +523,13 @@ export class Calendar extends LitElement {
514
523
 
515
524
  private _renderHeader() {
516
525
  return renderCalendarHeader({
526
+ // "November 2026" in the month view, the full date in the others.
517
527
  title: this.contextDate
518
- ? formatDate(this.contextDate, 'MMMM d, yyyy', this._i18n.locale)
528
+ ? formatDate(
529
+ this.contextDate,
530
+ this._currentView?.type === 'month' ? 'MMMM yyyy' : 'MMMM d, yyyy',
531
+ this._i18n.locale,
532
+ )
519
533
  : '',
520
534
  views: this.availableViews.map(view => ({
521
535
  value: view.value,
@@ -594,6 +608,7 @@ export class Calendar extends LitElement {
594
608
  .placeholder=${this._placeholder}
595
609
  .untitledLabel=${untitled}
596
610
  ?events-readonly=${readonly}
611
+ @date-click=${this._onMonthDateClick}
597
612
  @event-click=${this._onViewEventClick}
598
613
  @event-change=${this._onViewEventChange}
599
614
  @event-add=${this._onViewEventAdd}
@@ -289,6 +289,7 @@ export function toZonedWallClock(date: Date, timeZone: string): Date {
289
289
  /** `Intl` options for each display pattern; the output matches the pattern in `en-US`. */
290
290
  const DISPLAY_FORMATS: Record<string, Intl.DateTimeFormatOptions> = {
291
291
  'MMMM d, yyyy': { month: 'long', day: 'numeric', year: 'numeric' },
292
+ 'MMMM yyyy': { month: 'long', year: 'numeric' },
292
293
  EEEE: { weekday: 'long' },
293
294
  E: { weekday: 'short' },
294
295
  d: { day: 'numeric' },
package/src/card/card.ts CHANGED
@@ -30,11 +30,12 @@ const DISABLED_REASON_ID = 'disabled-reason';
30
30
  * edge-to-edge media.</p>
31
31
  * <p>Set <code>actionable</code> to make the whole card a single button that fires
32
32
  * <code>click</code>, or <code>href</code> (with <code>target</code>, <code>rel</code> and
33
- * <code>download</code>) to make it a link. The content of an actionable or link card is inert, so
34
- * don't put buttons or links inside one; use a plain card with its own actions instead.
33
+ * <code>download</code>) to make it a link. The content of an actionable or link card names the
34
+ * button or link, and anything focusable or clickable inside it stops responding, so don't put
35
+ * buttons or links inside one; use a plain card with its own actions instead.
35
36
  * <code>throttle-delay</code> throttles activation.</p>
36
- * <p><code>disabled</code> dims the card and makes its content inert; an actionable or link card
37
- * also stops responding to clicks and leaves the tab order. With <code>disabled-reason</code> it
37
+ * <p><code>disabled</code> dims the card. A static card's content becomes inert; an actionable or
38
+ * link card stops responding to clicks and leaves the tab order. With <code>disabled-reason</code> it
38
39
  * stays focusable and screen readers read the reason with it.</p>
39
40
  *
40
41
  * @cssprop --card-container-shape - Corner radius of the card. Defaults to `--shape-corner-large`.
@@ -67,15 +68,16 @@ export class Card extends NativeHyperlinkMixin(LitElement) {
67
68
  variant: CardVariant = 'elevated';
68
69
 
69
70
  /**
70
- * Dims the card and makes its content inert. An actionable or link card also stops responding
71
- * to clicks and leaves the tab order, unless `disabled-reason` is set.
71
+ * Dims the card. A static card's content becomes inert. An actionable or link card stops
72
+ * responding to clicks and leaves the tab order, unless `disabled-reason` is set.
72
73
  */
73
74
  @property({ type: Boolean, reflect: true })
74
75
  disabled: boolean = false;
75
76
 
76
77
  /**
77
- * Makes the whole card a single button that fires `click`. Its content becomes inert, so don't
78
- * put buttons or links inside an actionable card.
78
+ * Makes the whole card a single button that fires `click`. Its content names the button, and
79
+ * anything focusable or clickable inside it stops responding, so don't put buttons or links
80
+ * inside an actionable card.
79
81
  */
80
82
  @property({ type: Boolean, reflect: true })
81
83
  actionable: boolean = false;
@@ -167,8 +169,11 @@ export class Card extends NativeHyperlinkMixin(LitElement) {
167
169
 
168
170
  renderDisabledReason() {
169
171
  if (!this.__isSoftDisabled()) return nothing;
172
+ // aria-hidden keeps the reason out of the control's name (it sits inside the button or link);
173
+ // aria-describedby still reads it as the description.
170
174
  return html`<div
171
175
  id=${DISABLED_REASON_ID}
176
+ aria-hidden="true"
172
177
  role="tooltip"
173
178
  aria-label=${this.disabledReason}
174
179
  class="screen-reader-only"
@@ -187,11 +192,9 @@ export class Card extends NativeHyperlinkMixin(LitElement) {
187
192
  disabled: this.disabled,
188
193
  'has-content': this.slotHasContent,
189
194
  };
190
- const inertContent = interactive || this.disabled;
191
-
192
195
  if (!interactive) {
193
196
  return html`<div class=${classMap(cssClasses)} id="card">
194
- ${this.renderCardContent(inertContent)}
197
+ ${this.renderCardContent(false)}
195
198
  </div>`;
196
199
  }
197
200
 
@@ -207,7 +210,7 @@ export class Card extends NativeHyperlinkMixin(LitElement) {
207
210
  aria-disabled=${ifDefined(this.disabled ? 'true' : undefined)}
208
211
  ?disabled=${removedFromTabOrder}
209
212
  >
210
- ${this.renderCardContent(inertContent)} ${this.renderDisabledReason()}
213
+ ${this.renderCardContent(true)} ${this.renderDisabledReason()}
211
214
  </button>`;
212
215
  }
213
216
 
@@ -223,15 +226,23 @@ export class Card extends NativeHyperlinkMixin(LitElement) {
223
226
  aria-describedby=${ifDefined(this.__getDisabledReasonID())}
224
227
  aria-disabled=${ifDefined(this.disabled ? 'true' : undefined)}
225
228
  >
226
- ${this.renderCardContent(inertContent)} ${this.renderDisabledReason()}
229
+ ${this.renderCardContent(true)} ${this.renderDisabledReason()}
227
230
  </a>`;
228
231
  }
229
232
 
230
- renderCardContent(inertContent: boolean) {
233
+ /**
234
+ * Renders the slotted content. Inside the button or link of an actionable or link card the
235
+ * content stays in the accessibility tree, because it gives the control its name: `inert` would
236
+ * remove it and leave screen readers announcing just "button" or "link". Instead, a slot with a
237
+ * negative tabindex takes everything assigned to it out of sequential focus navigation, and
238
+ * `.card-content` ignores the pointer (see card.scss). A disabled static card has no control to
239
+ * name, so its content is simply inert.
240
+ */
241
+ renderCardContent(interactive: boolean) {
231
242
  return html`
232
243
  <div class="card-content">
233
- <div class="slot-container" ?inert=${inertContent}>
234
- <slot></slot>
244
+ <div class="slot-container" ?inert=${!interactive && this.disabled}>
245
+ <slot tabindex=${ifDefined(interactive ? '-1' : undefined)}></slot>
235
246
  </div>
236
247
  </div>
237
248
  `;
@@ -107,7 +107,12 @@ export class ChartDoughnut extends ChartPie {
107
107
  const caption = active
108
108
  ? (active.label ?? active.name)
109
109
  : this.centerLabel || this.i18n.t('total');
110
- const hole = Math.max(this.radius * this.innerFraction() * 2 - 16, 0);
110
+ // From the current size, not the last draw: the draw runs after this render, so its radius
111
+ // would leave the caption 0px wide until something else re-rendered.
112
+ const hole = Math.max(
113
+ this.outerRadius() * this.innerFraction() * 2 - 16,
114
+ 0,
115
+ );
111
116
  return html`<div
112
117
  class="center"
113
118
  part="center"
@@ -178,10 +178,19 @@ export class ChartPie extends ChartBase {
178
178
  return 0;
179
179
  }
180
180
 
181
+ /**
182
+ * The outer radius for the current size. It depends only on reactive properties, so a render
183
+ * (the doughnut's centre) can read it before the chart is drawn at that size.
184
+ */
185
+ protected outerRadius(): number {
186
+ const { width, height } = this.svgSize();
187
+ return Math.max(Math.min(width, height) / 2 - PADDING, 0);
188
+ }
189
+
181
190
  protected draw(animate: boolean): void {
182
191
  if (!this.svgElement) return;
183
192
  const { width, height } = this.svgSize();
184
- const radius = Math.max(Math.min(width, height) / 2 - PADDING, 0);
193
+ const radius = this.outerRadius();
185
194
  this.radius = radius;
186
195
  this.center = { x: width / 2, y: height / 2 };
187
196
  const inner = radius * this.innerFraction();
@@ -1,4 +1,4 @@
1
- import { html, LitElement, nothing } from 'lit';
1
+ import { html, LitElement, nothing, PropertyValues } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -8,7 +8,6 @@ import {
8
8
  isActivationClick,
9
9
  } from '@/__internal/utils/dispatch-event-utils.js';
10
10
  import { isLink } from '@/__internal/utils/is-link.js';
11
- import { throttle } from '@/__internal/utils/throttle.js';
12
11
  import styles from './chip.scss';
13
12
  import sizeStyles from './chip-sizes.scss';
14
13
  import { spread } from '@/__internal/directive/spread.js';
@@ -114,26 +113,12 @@ export class Chip extends mixinBaseButton(
114
113
  /** Peacock's strings for the dismiss button label. */
115
114
  private readonly i18n = new I18nController(this);
116
115
 
117
- constructor() {
118
- super();
119
- this.addEventListener('click', this.__dispatchClickWithThrottle);
116
+ /** A soft-disabled or skeleton chip, or a disabled link, swallows clicks. */
117
+ override __isClickBlocked() {
118
+ return this.softDisabled || (this.disabled && !!this.href) || this.skeleton;
120
119
  }
121
120
 
122
- __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
123
- event => {
124
- this.__dispatchClick(event);
125
- };
126
-
127
121
  __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
128
- // If the button is soft-disabled or a disabled link, we need to explicitly
129
- // prevent the click from propagating to other event listeners as well as
130
- // prevent the default action.
131
- if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
132
- event.stopImmediatePropagation();
133
- event.preventDefault();
134
- return;
135
- }
136
-
137
122
  if (!isActivationClick(event) || !this.buttonElement) {
138
123
  return;
139
124
  }
@@ -172,13 +157,8 @@ export class Chip extends mixinBaseButton(
172
157
  this.buttonElement?.blur();
173
158
  }
174
159
 
175
- override firstUpdated() {
176
- if (typeof this.throttleDelay === 'number') {
177
- this.__dispatchClickWithThrottle = throttle(
178
- this.__dispatchClick,
179
- this.throttleDelay,
180
- );
181
- }
160
+ override firstUpdated(changedProperties: PropertyValues) {
161
+ super.firstUpdated(changedProperties);
182
162
  observerSlotChangesWithCallback(
183
163
  this.renderRoot.querySelector('slot[name="icon"]'),
184
164
  hasContent => {
@@ -18,10 +18,23 @@
18
18
 
19
19
  .field-label {
20
20
  margin-block-end: var(--spacing-100);
21
- color: var(--color-on-surface-variant);
21
+ overflow: hidden;
22
+ color: var(--field-label-text-color, var(--color-primary));
23
+ text-overflow: ellipsis;
24
+ white-space: nowrap;
22
25
 
23
26
  @include mixin.get-typography(body-small);
24
27
 
28
+ &.has-error {
29
+ color: var(--color-error);
30
+ }
31
+
32
+ // Disabled, as on wc-field: on-surface at 38%.
33
+ &.disabled {
34
+ color: var(--color-on-surface);
35
+ opacity: var(--state-disabled-content-opacity, 0.38);
36
+ }
37
+
25
38
  .required {
26
39
  padding-inline-start: var(--spacing-025);
27
40
  color: var(--color-error);
@@ -53,6 +66,17 @@
53
66
  .code-block {
54
67
  // Where the code starts below the header or frame edge; Monaco reads it from the probe.
55
68
  --_pad-top: var(--_pad-block);
69
+ // Filled like the other input fields (wc-field): surface-container-lowest by default, and
70
+ // `--field-container-color` themes it alongside them.
71
+ --_background: var(
72
+ --code-editor-background,
73
+ var(--field-container-color, var(--color-surface-container-lowest))
74
+ );
75
+ // Outlined like wc-field too: `--field-outline-color`, then `--color-outline`.
76
+ --_border-color: var(
77
+ --code-editor-border-color,
78
+ var(--field-outline-color, var(--color-outline))
79
+ );
56
80
 
57
81
  height: auto;
58
82
 
@@ -67,7 +91,30 @@
67
91
  outline-offset: -2px;
68
92
  }
69
93
 
94
+ // Read-only, as on wc-field: a faint on-surface box, with the text at full contrast.
95
+ &.readonly:not(.disabled) {
96
+ --_background: var(
97
+ --code-editor-background,
98
+ color-mix(in srgb, var(--color-on-surface) 4%, transparent)
99
+ );
100
+
101
+ // A lighter outline at rest, full again on focus.
102
+ &:not(.focused) {
103
+ --_border-color: color-mix(
104
+ in srgb,
105
+ var(--code-editor-border-color, var(--field-outline-color, var(--color-outline))) 38%,
106
+ transparent
107
+ );
108
+ }
109
+ }
110
+
70
111
  &.disabled {
112
+ // Disabled, as on wc-field: the container in on-surface at 4%.
113
+ --_background: var(
114
+ --code-editor-background,
115
+ color-mix(in srgb, var(--color-on-surface) 4%, transparent)
116
+ );
117
+
71
118
  border-color: color-mix(
72
119
  in srgb,
73
120
  var(--color-on-surface) calc(var(--state-disabled-container-opacity) * 100%),
@@ -81,6 +128,28 @@
81
128
  }
82
129
  }
83
130
 
131
+ // The corners of wc-field, which follow its `--field-container-shape-*` properties, at every
132
+ // size (the shared chrome rounds the small size differently).
133
+ .code-block,
134
+ :host([size='sm']) .code-block {
135
+ border-start-start-radius: var(
136
+ --code-editor-shape,
137
+ var(--field-container-shape-start-start, var(--shape-corner-extra-small))
138
+ );
139
+ border-start-end-radius: var(
140
+ --code-editor-shape,
141
+ var(--field-container-shape-start-end, var(--shape-corner-extra-small))
142
+ );
143
+ border-end-start-radius: var(
144
+ --code-editor-shape,
145
+ var(--field-container-shape-end-start, var(--shape-corner-extra-small))
146
+ );
147
+ border-end-end-radius: var(
148
+ --code-editor-shape,
149
+ var(--field-container-shape-end-end, var(--shape-corner-extra-small))
150
+ );
151
+ }
152
+
84
153
  // The floating toolbar stays visible while it shows the read-only badge.
85
154
  .actions.floating {
86
155
  inset-inline-end: var(--spacing-300);
@@ -156,9 +156,9 @@ function loadMonaco(): Promise<Monaco> {
156
156
  * @csspart editor - The area Monaco renders into.
157
157
  *
158
158
  * @cssprop --code-editor-height - Height of the editing area. Defaults to 300px. Ignored with `fill`.
159
- * @cssprop --code-editor-background - Frame background. Defaults to `--color-surface-container-low`.
160
- * @cssprop --code-editor-border-color - Frame border color. Defaults to `--color-outline-variant`.
161
- * @cssprop --code-editor-shape - Frame corner radius. Defaults to `--shape-corner-medium`.
159
+ * @cssprop --code-editor-background - Frame background. Defaults to `--field-container-color`, then `--color-surface-container-lowest`, like the other input fields.
160
+ * @cssprop --code-editor-border-color - Frame border color. Defaults to `--field-outline-color`, then `--color-outline`, like the other input fields.
161
+ * @cssprop --code-editor-shape - Frame corner radius. Defaults to the `--field-container-shape-*` corners, then `--shape-corner-extra-small`, like the other input fields.
162
162
  * @cssprop --code-highlighter-token-keyword - Keyword color, shared with `wc-code-highlighter`, like the other `--code-highlighter-token-*` colors.
163
163
  *
164
164
  * @fires {CustomEvent<{value: string}>} input - Dispatched on each edit.
@@ -871,7 +871,14 @@ export class CodeEditor extends BaseInput {
871
871
 
872
872
  private renderFieldLabel() {
873
873
  if (!this.label) return nothing;
874
- return html`<div class="field-label" part="label">
874
+ return html`<div
875
+ class=${classMap({
876
+ 'field-label': true,
877
+ disabled: this.disabled,
878
+ 'has-error': this.error || !!this.validationText,
879
+ })}
880
+ part="label"
881
+ >
875
882
  ${this.label}${this.required
876
883
  ? html`<span class="required" aria-hidden="true">*</span>`
877
884
  : nothing}
@@ -907,6 +914,7 @@ export class CodeEditor extends BaseInput {
907
914
  'has-header': hasHeader,
908
915
  focused: this.hasFocus,
909
916
  disabled: this.disabled,
917
+ readonly: this.readonly,
910
918
  'has-error': invalid,
911
919
  numbered: this.lineNumbers,
912
920
  'breakpoint-gutter': this.breakpointGutter,