@redvars/peacock 4.5.1 → 4.6.0

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 (251) 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/color-field.js +4 -1
  37. package/dist/color-field.js.map +1 -1
  38. package/dist/currency-field.js +4 -1
  39. package/dist/currency-field.js.map +1 -1
  40. package/dist/custom-elements-jsdocs.json +26 -20
  41. package/dist/custom-elements.json +755 -90
  42. package/dist/{datasource-OwvH7SVq.js → datasource-DxEA6jHW.js} +6 -4
  43. package/dist/datasource-DxEA6jHW.js.map +1 -0
  44. package/dist/{date-cfPx3alz.js → date-DPQOY8Zd.js} +2 -2
  45. package/dist/{date-cfPx3alz.js.map → date-DPQOY8Zd.js.map} +1 -1
  46. package/dist/date-field.js +8 -5
  47. package/dist/date-field.js.map +1 -1
  48. package/dist/date-picker.js +2 -2
  49. package/dist/date-range-field.js +8 -5
  50. package/dist/date-range-field.js.map +1 -1
  51. package/dist/datetime-field.js +7 -4
  52. package/dist/datetime-field.js.map +1 -1
  53. package/dist/diagram-controls.js +1 -1
  54. package/dist/{throttle-SQ9t-HL7.js → dispatch-event-utils-DfgqVBK8.js} +2 -24
  55. package/dist/dispatch-event-utils-DfgqVBK8.js.map +1 -0
  56. package/dist/{form-submitter-beG1CXAn.js → dispatch-hooks-J_godlHh.js} +2 -87
  57. package/dist/dispatch-hooks-J_godlHh.js.map +1 -0
  58. package/dist/dropdown-button.js +11 -7
  59. package/dist/dropdown-button.js.map +1 -1
  60. package/dist/{event-manager-KGMT2x2Q.js → event-manager-DYfeN3VE.js} +3 -3
  61. package/dist/{event-manager-KGMT2x2Q.js.map → event-manager-DYfeN3VE.js.map} +1 -1
  62. package/dist/fab.js +15 -19
  63. package/dist/fab.js.map +1 -1
  64. package/dist/filter-bar.js +3 -3
  65. package/dist/form-submission-h40coUI8.js +13 -0
  66. package/dist/form-submission-h40coUI8.js.map +1 -0
  67. package/dist/form-submitter-BIFqZ0wq.js +88 -0
  68. package/dist/form-submitter-BIFqZ0wq.js.map +1 -0
  69. package/dist/form.js +1 -9
  70. package/dist/form.js.map +1 -1
  71. package/dist/icon-button.js +15 -19
  72. package/dist/icon-button.js.map +1 -1
  73. package/dist/icon.js +1 -1
  74. package/dist/implicit-submission-ChLdbxaR.js +100 -0
  75. package/dist/implicit-submission-ChLdbxaR.js.map +1 -0
  76. package/dist/index.js +20 -15
  77. package/dist/index.js.map +1 -1
  78. package/dist/{indicator-navigation-item-CmyhsOmy.js → indicator-navigation-item-BsQE3kUr.js} +2 -2
  79. package/dist/{indicator-navigation-item-CmyhsOmy.js.map → indicator-navigation-item-BsQE3kUr.js.map} +1 -1
  80. package/dist/input.js +13 -4
  81. package/dist/input.js.map +1 -1
  82. package/dist/json-viewer.js +1 -1
  83. package/dist/kanban.js +8 -7
  84. package/dist/kanban.js.map +1 -1
  85. package/dist/link-button.js +13 -14
  86. package/dist/link-button.js.map +1 -1
  87. package/dist/list-item.js +52 -16
  88. package/dist/list-item.js.map +1 -1
  89. package/dist/list.js +5 -3
  90. package/dist/list.js.map +1 -1
  91. package/dist/listbox.js +1 -1
  92. package/dist/loader-full.js +17 -12
  93. package/dist/loader-full.js.map +1 -1
  94. package/dist/loader.js +17 -12
  95. package/dist/loader.js.map +1 -1
  96. package/dist/locale-DEsJZCQG.js.map +1 -1
  97. package/dist/mention-input.js +8 -1
  98. package/dist/mention-input.js.map +1 -1
  99. package/dist/menu-item.js +12 -12
  100. package/dist/menu-item.js.map +1 -1
  101. package/dist/menu.js +7 -3
  102. package/dist/menu.js.map +1 -1
  103. package/dist/navigation-bar-item.js +4 -3
  104. package/dist/navigation-bar-item.js.map +1 -1
  105. package/dist/navigation-bar.js +4 -3
  106. package/dist/navigation-bar.js.map +1 -1
  107. package/dist/navigation-drawer-item.js +3 -2
  108. package/dist/navigation-drawer-item.js.map +1 -1
  109. package/dist/navigation-drawer.js +3 -2
  110. package/dist/navigation-drawer.js.map +1 -1
  111. package/dist/{navigation-item-base-kUrvJgCx.js → navigation-item-base-5ljwtLG_.js} +3 -2
  112. package/dist/{navigation-item-base-kUrvJgCx.js.map → navigation-item-base-5ljwtLG_.js.map} +1 -1
  113. package/dist/navigation-rail-item.js +4 -3
  114. package/dist/navigation-rail-item.js.map +1 -1
  115. package/dist/navigation-rail.js +6 -5
  116. package/dist/navigation-rail.js.map +1 -1
  117. package/dist/number-field.js +4 -1
  118. package/dist/number-field.js.map +1 -1
  119. package/dist/option.js +3 -2
  120. package/dist/option.js.map +1 -1
  121. package/dist/password-field.js +11 -4
  122. package/dist/password-field.js.map +1 -1
  123. package/dist/phone-field.js +4 -1
  124. package/dist/phone-field.js.map +1 -1
  125. package/dist/{picker-field-DmXYPvbF.js → picker-field-BiM3iXAQ.js} +2 -2
  126. package/dist/{picker-field-DmXYPvbF.js.map → picker-field-BiM3iXAQ.js.map} +1 -1
  127. package/dist/pin-input.js +4 -1
  128. package/dist/pin-input.js.map +1 -1
  129. package/dist/{range-utils-DZe96GnO.js → range-utils-vgG1SJ2o.js} +2 -2
  130. package/dist/{range-utils-DZe96GnO.js.map → range-utils-vgG1SJ2o.js.map} +1 -1
  131. package/dist/{roving-focus-controller-fm95JkZJ.js → roving-focus-controller-YtNbxH95.js} +30 -7
  132. package/dist/roving-focus-controller-YtNbxH95.js.map +1 -0
  133. package/dist/search.js +12 -6
  134. package/dist/search.js.map +1 -1
  135. package/dist/select.js +11 -3
  136. package/dist/select.js.map +1 -1
  137. package/dist/shipped-icons.js +1 -1
  138. package/dist/split-button.js +9 -1
  139. package/dist/split-button.js.map +1 -1
  140. package/dist/src/__internal/controllers/roving-focus-controller.d.ts +14 -2
  141. package/dist/src/__internal/implicit-submission.d.ts +25 -0
  142. package/dist/src/__internal/utils/activation-gate.d.ts +8 -0
  143. package/dist/src/__internal/utils/form-submission.d.ts +2 -0
  144. package/dist/src/avatar-group/avatar-group.d.ts +1 -1
  145. package/dist/src/button/base-button/base-button.d.ts +1 -1
  146. package/dist/src/button/button/button.d.ts +2 -1
  147. package/dist/src/button/fab/fab.d.ts +2 -1
  148. package/dist/src/button/icon-button/icon-button.d.ts +2 -1
  149. package/dist/src/button/link-button/link-button.d.ts +5 -1
  150. package/dist/src/calendar/calendar-month-view.d.ts +5 -1
  151. package/dist/src/calendar/calendar.d.ts +6 -1
  152. package/dist/src/card/card.d.ts +19 -9
  153. package/dist/src/chart-pie/chart-pie.d.ts +5 -0
  154. package/dist/src/chip/chip/chip.d.ts +4 -4
  155. package/dist/src/dropdown-button/dropdown-button.d.ts +5 -1
  156. package/dist/src/input/BaseField.d.ts +7 -0
  157. package/dist/src/input/input.d.ts +5 -1
  158. package/dist/src/list/list-item.d.ts +2 -1
  159. package/dist/src/mention-input/mention-input.d.ts +2 -0
  160. package/dist/src/menu/menu-item/menu-item.d.ts +6 -4
  161. package/dist/src/password-field/password-field.d.ts +3 -1
  162. package/dist/src/search/search.d.ts +1 -0
  163. package/dist/src/select/select.d.ts +2 -0
  164. package/dist/src/split-button/split-button.d.ts +6 -1
  165. package/dist/src/stepper/step.d.ts +3 -1
  166. package/dist/src/tabs/tab.d.ts +12 -2
  167. package/dist/src/textarea/textarea.d.ts +2 -0
  168. package/dist/src/toolbar/toolbar.d.ts +13 -2
  169. package/dist/step.js +7 -1
  170. package/dist/step.js.map +1 -1
  171. package/dist/stepper.js +10 -1
  172. package/dist/stepper.js.map +1 -1
  173. package/dist/sub-menu.js +3 -2
  174. package/dist/sub-menu.js.map +1 -1
  175. package/dist/svg.js +1 -1
  176. package/dist/tab-group.js +3 -2
  177. package/dist/tab-group.js.map +1 -1
  178. package/dist/tab.js +17 -12
  179. package/dist/tab.js.map +1 -1
  180. package/dist/tabs.js +3 -2
  181. package/dist/tabs.js.map +1 -1
  182. package/dist/test/accessible-name.test.d.ts +1 -0
  183. package/dist/test/helpers/count-activations.d.ts +9 -0
  184. package/dist/test/navigation-rail.test.d.ts +1 -0
  185. package/dist/test/throttle-delay.test.d.ts +1 -0
  186. package/dist/textarea.js +8 -1
  187. package/dist/textarea.js.map +1 -1
  188. package/dist/throttle-C7ZAPqtu.js +24 -0
  189. package/dist/throttle-C7ZAPqtu.js.map +1 -0
  190. package/dist/time-field.js +7 -4
  191. package/dist/time-field.js.map +1 -1
  192. package/dist/time-picker.js +2 -2
  193. package/dist/toolbar.js +25 -8
  194. package/dist/toolbar.js.map +1 -1
  195. package/dist/tree.js +1 -1
  196. package/dist/tsconfig.tsbuildinfo +1 -1
  197. package/dist/url-field.js +4 -1
  198. package/dist/url-field.js.map +1 -1
  199. package/dist/{utils-DcvLgexs.js → utils-CQzycr9J.js} +2 -1
  200. package/dist/utils-CQzycr9J.js.map +1 -0
  201. package/package.json +2 -1
  202. package/src/__internal/controllers/roving-focus-controller.ts +35 -7
  203. package/src/__internal/i18n/locale.ts +1 -1
  204. package/src/__internal/implicit-submission.ts +102 -0
  205. package/src/__internal/utils/activation-gate.ts +20 -0
  206. package/src/__internal/utils/cache-fetch.ts +6 -3
  207. package/src/__internal/utils/form-submission.ts +11 -0
  208. package/src/avatar/avatar.scss +5 -0
  209. package/src/avatar-group/avatar-group.scss +3 -0
  210. package/src/avatar-group/avatar-group.ts +1 -1
  211. package/src/button/base-button/base-button.ts +41 -16
  212. package/src/button/button/button.ts +5 -16
  213. package/src/button/fab/fab.ts +7 -18
  214. package/src/button/icon-button/icon-button.ts +7 -18
  215. package/src/button/link-button/link-button.ts +8 -15
  216. package/src/calendar/_calendar-header.scss +7 -1
  217. package/src/calendar/calendar-month-view.scss +36 -2
  218. package/src/calendar/calendar-month-view.ts +33 -8
  219. package/src/calendar/calendar.ts +17 -2
  220. package/src/calendar/utils.ts +1 -0
  221. package/src/card/card.ts +27 -16
  222. package/src/chart-doughnut/chart-doughnut.ts +6 -1
  223. package/src/chart-pie/chart-pie.ts +10 -1
  224. package/src/chip/chip/chip.ts +6 -26
  225. package/src/dropdown-button/dropdown-button.ts +7 -2
  226. package/src/form/form.ts +1 -9
  227. package/src/input/BaseField.ts +17 -0
  228. package/src/input/input.ts +13 -1
  229. package/src/kanban/kanban.scss +11 -7
  230. package/src/list/list-item.scss +5 -0
  231. package/src/list/list-item.ts +44 -16
  232. package/src/mention-input/mention-input.ts +5 -0
  233. package/src/menu/menu/menu.ts +4 -1
  234. package/src/menu/menu-item/menu-item.ts +9 -14
  235. package/src/navigation-rail/navigation-rail.scss +3 -2
  236. package/src/password-field/password-field.ts +11 -1
  237. package/src/search/search.ts +9 -0
  238. package/src/select/select.ts +5 -0
  239. package/src/split-button/split-button.ts +10 -1
  240. package/src/stepper/step.ts +7 -1
  241. package/src/stepper/stepper.scss +13 -0
  242. package/src/tabs/tab.ts +21 -17
  243. package/src/textarea/textarea.ts +5 -0
  244. package/src/toolbar/toolbar.ts +26 -7
  245. package/dist/BaseField-BbOj212R.js.map +0 -1
  246. package/dist/base-button-BJMGMcMv.js.map +0 -1
  247. package/dist/datasource-OwvH7SVq.js.map +0 -1
  248. package/dist/form-submitter-beG1CXAn.js.map +0 -1
  249. package/dist/roving-focus-controller-fm95JkZJ.js.map +0 -1
  250. package/dist/throttle-SQ9t-HL7.js.map +0 -1
  251. 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 => {
@@ -1,7 +1,9 @@
1
- import { html, LitElement } from 'lit';
1
+ import { html, LitElement, nothing } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import IndividualComponent from '@/IndividualComponent.js';
5
+ import type { ARIAMixinStrict } from '@/__internal/aria/aria.js';
6
+ import { mixinDelegatesAria } from '@/__internal/aria/delegate.js';
5
7
  import { MenuTriggerController } from '@/__internal/menu-trigger-controller.js';
6
8
  import type { OverlayPlacement } from '@/__internal/utils/placement.js';
7
9
  import styles from './dropdown-button.scss';
@@ -15,6 +17,8 @@ import type { Menu, MenuFocusTarget } from '../menu/menu/menu.js';
15
17
  * @summary A button that opens a menu of actions or options.
16
18
  * @overview
17
19
  * <p>Clicking the button opens its menu, and clicking it again closes it.</p>
20
+ * <p>An <code>aria-label</code> on the dropdown button names its button. Give one to a dropdown
21
+ * button that shows only an icon.</p>
18
22
  *
19
23
  * @cssprop --dropdown-button-container-shape: Defines the border radius of the dropdown button container shape.
20
24
  *
@@ -32,7 +36,7 @@ import type { Menu, MenuFocusTarget } from '../menu/menu/menu.js';
32
36
  * @tags controls
33
37
  */
34
38
  @IndividualComponent
35
- export class DropdownButton extends LitElement {
39
+ export class DropdownButton extends mixinDelegatesAria(LitElement) {
36
40
  static override styles = [styles];
37
41
 
38
42
  /**
@@ -128,6 +132,7 @@ export class DropdownButton extends LitElement {
128
132
  color=${this.color}
129
133
  trailing-icon
130
134
  ?disabled=${this.disabled}
135
+ aria-label=${(this as ARIAMixinStrict).ariaLabel || nothing}
131
136
  aria-haspopup="menu"
132
137
  aria-expanded=${String(this._trigger.open)}
133
138
  @click=${this._trigger.handleTriggerClick}
package/src/form/form.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  } from '@/__internal/ai/suggestion-controller.js';
10
10
  import type { AiSuggestion } from '@/__internal/ai/types.js';
11
11
  import { I18nController } from '@/__internal/i18n/i18n-controller.js';
12
+ import { isSubmitButton } from '@/__internal/utils/form-submission.js';
12
13
  import IndividualComponent from '@/IndividualComponent.js';
13
14
  import styles from './form.scss';
14
15
 
@@ -124,15 +125,6 @@ function isNativeControl(
124
125
  );
125
126
  }
126
127
 
127
- /** Whether `el` is a submit button of the form: native, or a Peacock button with `type="submit"`. */
128
- function isSubmitButton(el: FormControl): boolean {
129
- if (el instanceof HTMLButtonElement) return el.type === 'submit';
130
- if (el instanceof HTMLInputElement) {
131
- return el.type === 'submit' || el.type === 'image';
132
- }
133
- return el.localName.includes('-') && el.type === 'submit';
134
- }
135
-
136
128
  let formCount = 0;
137
129
 
138
130
  /**
@@ -2,6 +2,7 @@ import { html, nothing, type PropertyValues, type TemplateResult } from 'lit';
2
2
  import { property, state } from 'lit/decorators.js';
3
3
 
4
4
  import { peacockString } from '@/__internal/i18n/strings.js';
5
+ import { registerTextField } from '@/__internal/implicit-submission.js';
5
6
  import type { Size } from '@/__internal/utils/size.js';
6
7
  import BaseInput from './BaseInput.js';
7
8
 
@@ -97,6 +98,13 @@ export default abstract class BaseField extends BaseInput {
97
98
 
98
99
  // ── Lifecycle ────────────────────────────────────────────────────────────
99
100
 
101
+ constructor() {
102
+ super();
103
+ // A single-line field keeps Enter in another field from submitting a form without a
104
+ // submit button, as a second native text input would.
105
+ if (this.singleLineTextField) registerTextField(this);
106
+ }
107
+
100
108
  override connectedCallback() {
101
109
  super.connectedCallback();
102
110
  // `aria-*` and `tabindex` set on the host belong to the inner control; move them there.
@@ -142,6 +150,15 @@ export default abstract class BaseField extends BaseInput {
142
150
  return false;
143
151
  }
144
152
 
153
+ /**
154
+ * Whether the field is a single-line text field, which counts like a native text input when
155
+ * Enter decides whether to submit a form that has no submit button. Multi-line fields and
156
+ * selects turn it off. Read in the constructor, so an override must not use instance fields.
157
+ */
158
+ protected get singleLineTextField(): boolean {
159
+ return true;
160
+ }
161
+
145
162
  /**
146
163
  * The error text the field shows: the consumer's `error-text` while `error` is set, else an
147
164
  * error the control found itself, else the validation message once it should show.
@@ -2,6 +2,7 @@ import { html, nothing } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
3
 
4
4
  import { spread } from '@/__internal/directive/spread.js';
5
+ import { setupImplicitSubmission } from '@/__internal/implicit-submission.js';
5
6
  import IndividualComponent from '@/IndividualComponent.js';
6
7
 
7
8
  import BaseField from './BaseField.js';
@@ -16,7 +17,10 @@ import styles from './input.scss';
16
17
  * @summary A single-line text field for plain text, an email address or a phone number.
17
18
  * @overview
18
19
  * <p>Input is form-associated: inside a <code>&lt;form&gt;</code> its <code>value</code> is submitted
19
- * under its <code>name</code>, and <code>form.reset()</code> restores the starting value.</p>
20
+ * under its <code>name</code>, and <code>form.reset()</code> restores the starting value. Enter
21
+ * submits the form as in a native text input: it clicks the form's first submit button, or,
22
+ * without one, submits a form that has no other text field. A disabled default button blocks it,
23
+ * and <code>preventDefault()</code> on the <code>keydown</code> stops it.</p>
20
24
  * <p>It validates like a native input: <code>required</code> and an invalid <code>type="email"</code>
21
25
  * block form submission, and the message shows under the field once the value is committed or the
22
26
  * form is submitted. <code>checkValidity()</code>, <code>reportValidity()</code> and
@@ -87,6 +91,14 @@ export class Input extends BaseField {
87
91
  @query('.input-element')
88
92
  private inputElement?: HTMLInputElement;
89
93
 
94
+ // ── Lifecycle ────────────────────────────────────────────────────────────
95
+
96
+ constructor() {
97
+ super();
98
+ // Enter submits the surrounding form, as in a native text input.
99
+ setupImplicitSubmission(this, () => this.inputElement);
100
+ }
101
+
90
102
  // ── Public methods ───────────────────────────────────────────────────────
91
103
 
92
104
  override focus() {