@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
@@ -26,7 +26,9 @@ const SEPARATOR_SELECTOR = 'wc-divider, hr, [role="separator"]';
26
26
  *
27
27
  * <p>The toolbar follows the WAI-ARIA toolbar pattern: it is a single tab stop, and the arrow
28
28
  * keys along its orientation move focus between actions (Home and End jump to the first and last).
29
- * Disabled actions and dividers are skipped. Give the toolbar an <code>aria-label</code>.</p>
29
+ * Disabled actions and dividers are skipped, and when the action that holds the tab stop becomes
30
+ * disabled or hidden, the next enabled action (else the previous one) takes it over. Give the
31
+ * toolbar an <code>aria-label</code>.</p>
30
32
  *
31
33
  * @cssprop --toolbar-container-color - Background color of the toolbar.
32
34
  * @cssprop --toolbar-container-shape - Border radius of the floating toolbar.
@@ -104,12 +106,30 @@ export class Toolbar extends LitElement {
104
106
  orientation: () => this.orientation,
105
107
  });
106
108
 
109
+ /**
110
+ * Re-applies the tab stop when an action becomes disabled, aria-disabled or hidden, so it moves
111
+ * to the next enabled action instead of leaving the toolbar out of the Tab order.
112
+ */
113
+ private readonly __actionStateObserver = new MutationObserver(() => {
114
+ this.roving.sync();
115
+ });
116
+
107
117
  // ── Lifecycle
108
118
 
109
119
  override connectedCallback() {
110
120
  super.connectedCallback();
111
121
  // The role lives on the host so the host's aria-label names the toolbar.
112
122
  this.setAttribute('role', 'toolbar');
123
+ this.__actionStateObserver.observe(this, {
124
+ subtree: true,
125
+ attributes: true,
126
+ attributeFilter: ['disabled', 'aria-disabled', 'hidden'],
127
+ });
128
+ }
129
+
130
+ override disconnectedCallback() {
131
+ super.disconnectedCallback();
132
+ this.__actionStateObserver.disconnect();
113
133
  }
114
134
 
115
135
  override updated(changed: Map<string, unknown>) {
@@ -120,7 +140,10 @@ export class Toolbar extends LitElement {
120
140
 
121
141
  // ── Private methods
122
142
 
123
- /** Actions that can take focus, in slot order. */
143
+ /**
144
+ * The actions, in slot order. Disabled and hidden ones are included: the roving controller skips
145
+ * them, takes the tab stop off them and hands it to the next enabled action.
146
+ */
124
147
  private __getItems(): HTMLElement[] {
125
148
  const slot = this.shadowRoot?.querySelector('slot');
126
149
  if (!slot) return [];
@@ -128,11 +151,7 @@ export class Toolbar extends LitElement {
128
151
  .assignedElements({ flatten: true })
129
152
  .filter(
130
153
  (el): el is HTMLElement =>
131
- el instanceof HTMLElement &&
132
- !el.matches(SEPARATOR_SELECTOR) &&
133
- !el.hasAttribute('disabled') &&
134
- el.getAttribute('aria-disabled') !== 'true' &&
135
- !el.hidden,
154
+ el instanceof HTMLElement && !el.matches(SEPARATOR_SELECTOR),
136
155
  );
137
156
  }
138
157
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseField-BbOj212R.js","sources":["../../src/input/BaseField.ts"],"sourcesContent":["import { html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { peacockString } from '@/__internal/i18n/strings.js';\nimport type { Size } from '@/__internal/utils/size.js';\nimport BaseInput from './BaseInput.js';\n\n/** Below this width, in pixels, a field's Suggested badge shows just the sparkle. */\nconst NARROW_FIELD_WIDTH = 320;\n\n/** What a field component passes to `renderField()`. */\nexport interface FieldRenderOptions {\n /** Whether the field has a value; outlined fields float their label when it does. */\n populated: boolean;\n /** Overrides the field's own focus state, for fields whose popup keeps them active. */\n focused?: boolean;\n /** An error the control found itself, such as text that does not parse. */\n controlError?: string;\n /** Extra content before the control (after the `start` slot). */\n start?: unknown;\n /** Extra content after the control (after the `end` slot), such as a picker button. */\n end?: unknown;\n /** Character counter shown in the footer, such as `12/100`; empty or unset for none. */\n textCount?: string;\n}\n\nlet fieldCount = 0;\n\n/**\n * Base class for Peacock's text-like fields (input, textarea, number, URL, select, date/time,\n * color). It adds the props every field shares (label, helper/error/warning text, variant, size,\n * clearable, `start`/`end` slots) and renders the `wc-field` frame.\n *\n * It also makes the inner control accessible across the shadow boundary: `fieldAria()` gives it\n * an accessible name from `label`, `aria-invalid` while an error shows, and `aria-describedby`\n * pointing at a hidden copy of the helper or error text in the same shadow root.\n *\n * Subclasses call `renderField(control, options)` in `render()`, spread `fieldAria()` onto the\n * native control, call `emitValue('input' | 'change')` instead of re-dispatching native events\n * (the field event contract: `CustomEvent<{ value }>`, bubbling and composed), and override\n * `clearValue()` if clearing means more than `value = ''`.\n */\nexport default abstract class BaseField extends BaseInput {\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** Label shown above the field; also the control's accessible name. */\n @property({ type: String }) label = '';\n\n /** Hint shown inside the empty control. */\n @property({ type: String }) placeholder = '';\n\n /** Help text shown below the field. */\n @property({ type: String, attribute: 'helper-text' }) helperText = '';\n\n /** Shows the field in its error state with `error-text`. */\n @property({ type: Boolean }) error = false;\n\n /** Error message shown below the field while `error` is set; replaces the help text. */\n @property({ type: String, attribute: 'error-text' }) errorText = '';\n\n /** Shows the field in its warning state with `warning-text`. */\n @property({ type: Boolean }) warning = false;\n\n /** Warning message shown below the field while `warning` is set; replaces the help text. */\n @property({ type: String, attribute: 'warning-text' }) warningText = '';\n\n /** Visual variant of the field. */\n @property({ type: String }) variant: 'default' | 'filled' | 'outlined' =\n 'default';\n\n /** Height of the field: `sm` (2.5rem, default), `md` (3.5rem) or `lg` (4rem). */\n @property({ type: String, reflect: true }) size: Size = 'sm';\n\n /** Shows a button that clears the value while the field has one. */\n @property({ type: Boolean }) clearable = false;\n\n /** ARIA attributes moved from the host onto the inner control. */\n @property({ type: Object }) configAria: Record<string, string> = {};\n\n // ── State ────────────────────────────────────────────────────────────────\n\n @state() protected focused = false;\n\n /** The field is too narrow for the Suggested badge's label; it shows just the sparkle. */\n @state() private __narrow = false;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n /** Id of the hidden description the inner control points at. */\n protected readonly fieldDescriptionId = `wc-field-description-${(fieldCount += 1)}`;\n\n /** A `tabindex` set on the host, moved to the inner control. */\n protected controlTabIndex?: string;\n\n /** Watches the field's width while it holds a suggestion, so the badge can shrink. */\n private __widthObserver?: ResizeObserver;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n override connectedCallback() {\n super.connectedCallback();\n // `aria-*` and `tabindex` set on the host belong to the inner control; move them there.\n for (const attr of Array.from(this.attributes)) {\n if (attr.name.startsWith('aria-')) {\n this.configAria = { ...this.configAria, [attr.name]: attr.value };\n this.removeAttribute(attr.name);\n }\n }\n if (this.hasAttribute('tabindex')) {\n this.controlTabIndex = this.getAttribute('tabindex') ?? undefined;\n this.removeAttribute('tabindex');\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.__widthObserver?.disconnect();\n this.__widthObserver = undefined;\n }\n\n protected override updated(changed: PropertyValues) {\n super.updated(changed);\n // Only a field showing a suggestion pays for an observer.\n if (this.suggestionVisible && !this.__widthObserver) {\n this.__widthObserver = new ResizeObserver(([entry]) => {\n this.__narrow = entry.contentRect.width < NARROW_FIELD_WIDTH;\n });\n this.__widthObserver.observe(this);\n } else if (!this.suggestionVisible && this.__widthObserver) {\n this.__widthObserver.disconnect();\n this.__widthObserver = undefined;\n }\n }\n\n // ── Protected ────────────────────────────────────────────────────────────\n\n /**\n * Whether the Suggested badge always shows just the sparkle, whatever the width. A textarea\n * sets it: a label beside it would narrow every line of the text.\n */\n protected get suggestionBadgeIconOnly(): boolean {\n return false;\n }\n\n /**\n * The error text the field shows: the consumer's `error-text` while `error` is set, else an\n * error the control found itself, else the validation message once it should show.\n */\n protected fieldErrorText(controlError = ''): string {\n if (this.error) return this.errorText;\n return controlError || this.validationText;\n }\n\n /**\n * Attributes for the native control: accessible name, invalid state, description and the\n * host's `tabindex`, plus `configAria`. Spread them onto it with `spread(this.fieldAria())`.\n */\n protected fieldAria(controlError = ''): Record<string, string | undefined> {\n const invalid = this.error || !!this.fieldErrorText(controlError);\n return {\n tabindex: this.controlTabIndex,\n 'aria-label': this.label || undefined,\n 'aria-invalid': invalid ? 'true' : undefined,\n 'aria-describedby': this.fieldDescription(controlError)\n ? this.fieldDescriptionId\n : undefined,\n ...this.configAria,\n };\n }\n\n /** Renders the `wc-field` frame around `control`, plus the hidden description. */\n protected renderField(\n control: unknown,\n options: FieldRenderOptions,\n ): TemplateResult {\n const errorText = this.fieldErrorText(options.controlError);\n const description = this.fieldDescription(options.controlError);\n // While a suggestion shows, its reason takes the helper text's place.\n const helperText = this.suggestionReason || this.helperText;\n return html`\n <wc-field\n label=${this.label}\n size=${this.size}\n variant=${this.variant}\n helper-text=${helperText}\n ?required=${this.required}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?skeleton=${this.skeleton}\n ?error=${this.error || !!errorText}\n error-text=${errorText}\n ?warning=${this.warning}\n warning-text=${this.warningText}\n text-count=${options.textCount ?? ''}\n ?populated=${options.populated}\n ?focused=${options.focused ?? this.focused}\n .host=${this}\n class=\"field\"\n >\n <slot name=\"start\" slot=\"field-start\"></slot>\n ${options.start ?? nothing} ${control}\n <slot name=\"end\" slot=\"field-end\"></slot>\n ${this.suggestionBadge({\n slot: 'field-end',\n iconOnly: this.__narrow || this.suggestionBadgeIconOnly,\n })}\n ${this.renderClearButton(options.populated)} ${options.end ?? nothing}\n </wc-field>\n ${description\n ? html`<span id=${this.fieldDescriptionId} hidden>${description}</span>`\n : nothing}\n `;\n }\n\n /** Dispatches `input` or `change` with the current value: the field event contract. */\n protected emitValue(type: 'input' | 'change') {\n this.dispatchEvent(\n new CustomEvent(type, {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n protected override emitSuggestionValue() {\n this.emitValue('input');\n this.emitValue('change');\n }\n\n /** Clears the value for the clear button. Fields with another empty value override it. */\n protected clearValue() {\n this.value = '';\n this.emitValue('input');\n this.emitValue('change');\n }\n\n /** The counter text for a field with a `maxlength`: `12/100`, or '' when there is no limit. */\n protected characterCount(maxLength: number | null | undefined): string {\n if (typeof maxLength !== 'number' || !Number.isFinite(maxLength)) return '';\n if (maxLength < 0) return '';\n const count = String(this.value ?? '').length;\n return peacockString('characterCount')(count, maxLength);\n }\n\n /** Tracks focus of the inner control; bind it to the control's `focus` and `blur`. */\n protected handleFieldFocus = (event: FocusEvent) => {\n this.focused = event.type === 'focus';\n };\n\n // ── Private ──────────────────────────────────────────────────────────────\n\n /** The text the description carries: the error, else the warning, else the help. */\n private fieldDescription(controlError = ''): string {\n const errorText = this.fieldErrorText(controlError);\n if (errorText) return errorText;\n if (this.warning && this.warningText) return this.warningText;\n if (this.suggestionVisible) {\n return peacockString('aiSuggestedDescription')(this.suggestionReason);\n }\n return this.helperText;\n }\n\n private renderClearButton(populated: boolean) {\n if (!this.clearable || !populated || this.disabled || this.readonly) {\n return nothing;\n }\n return html`<wc-icon-button\n slot=\"field-end\"\n class=\"clear-button\"\n shape=\"round\"\n variant=\"text\"\n size=\"sm\"\n aria-label=${peacockString('clear')}\n @click=${() => {\n this.clearValue();\n this.focus();\n }}\n >\n <wc-icon name=\"close\"></wc-icon>\n </wc-icon-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EAAE,IAAI,EAAE,OAAO,EAAE;AAAoB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGnB,UAAA,CAAA;AAA3B,IAAAA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAA0C,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAIjD,UAAA,CAAA;AAAlB,IAAAC,CAAK;AAA6B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAGlB,UAAA,CAAA;AAAhB,IAAAA,CAAK;AAA4B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-button-BJMGMcMv.js","sources":["../../src/button/base-button/base-button.ts"],"sourcesContent":["import { LitElement, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { WithElementInternals } from '@/__internal/mixins/element-internals.js';\nimport { throttle } from '@/__internal/utils/throttle.js';\nimport { warnOnce } from '@/__internal/utils/warn-once.js';\nimport { MixinBase, MixinReturn } from '@/__internal/mixins/mixin.js';\nimport type {\n ButtonColor,\n ButtonLevel,\n ButtonVariant,\n} from '@/button/ButtonTypes.js';\n\n/**\n * 1. Define an interface for the members the mixin adds.\n * This makes the type annotation much cleaner.\n */\nexport interface BaseButton {\n variant: string;\n\n color: string;\n\n disabled: boolean;\n\n softDisabled: boolean;\n\n disabledReason: string;\n\n throttleDelay?: number;\n\n __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void;\n\n __dispatchClick: (event: MouseEvent | KeyboardEvent) => void;\n}\n\nexport function mixinBaseButton<\n T extends MixinBase<LitElement & WithElementInternals>,\n>(base: T): MixinReturn<T, BaseButton> {\n abstract class BaseButtonElement extends base implements BaseButton {\n /** The visual style of the button, such as `\"filled\"`, `\"tonal\"`, `\"outlined\"` or `\"text\"`. */\n @property({ type: String, reflect: true })\n variant: string = '';\n\n /** The color role of the button, such as `\"primary\"`, `\"surface\"` or `\"danger\"`. */\n @property({ type: String, reflect: true })\n color: string = '';\n\n /**\n * When `true`, the button is disabled and cannot be interacted with. Reflects to the `disabled` attribute. Defaults to `false`.\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n /**\n * When `true`, the button is visually styled as disabled and cannot be interacted with, but remains focusable.\n * Use this in combination with `disabledReason` to communicate why the button is unavailable.\n * Reflects to the `soft-disabled` attribute. Defaults to `false`.\n */\n @property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })\n softDisabled: boolean = false;\n\n /**\n * A human-readable explanation of why the button is disabled or soft-disabled.\n * Rendered as a visually hidden tooltip and linked via `aria-describedby` for accessibility.\n * Maps to the `disabled-reason` attribute.\n */\n @property({ attribute: 'disabled-reason' })\n disabledReason: string = '';\n\n /**\n * Sets the delay for throttle in milliseconds. When undefined (default), no throttle is applied.\n */\n @property({ type: Number, attribute: 'throttle-delay' })\n throttleDelay?: number;\n\n __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =\n event => {\n this.__dispatchClick(event);\n };\n\n abstract __dispatchClick: (event: MouseEvent | KeyboardEvent) => void;\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n if (typeof this.throttleDelay === 'number') {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n }\n }\n }\n\n return BaseButtonElement;\n}\n\n// ── Level ────────────────────────────────────────────────────────────────────\n\n/**\n * What each `level` preset resolves to, shared by `wc-button`, `wc-icon-button` and\n * `wc-link-button`. A `color` or `variant` the consumer sets wins over the preset, one property at\n * a time, so `level=\"danger\" variant=\"outlined\"` is an outlined danger button.\n */\nexport const BUTTON_LEVEL_APPEARANCE: Readonly<\n Record<\n ButtonLevel,\n { readonly color: ButtonColor; readonly variant: ButtonVariant }\n >\n> = {\n primary: { color: 'primary', variant: 'filled' },\n secondary: { color: 'surface', variant: 'tonal' },\n tertiary: { color: 'primary', variant: 'text' },\n danger: { color: 'danger', variant: 'filled' },\n};\n\n/** Variant and color used when neither the consumer nor a `level` sets one. */\nexport const BUTTON_DEFAULT_APPEARANCE = {\n color: 'primary',\n variant: 'filled',\n} as const satisfies { color: ButtonColor; variant: ButtonVariant };\n\n/** The preset for `level`, or `undefined` for no level or an unknown one. */\nexport function levelAppearance(\n level: string | undefined | null,\n):\n | { readonly color: ButtonColor; readonly variant: ButtonVariant }\n | undefined {\n if (\n !level ||\n !Object.prototype.hasOwnProperty.call(BUTTON_LEVEL_APPEARANCE, level)\n )\n return undefined;\n return BUTTON_LEVEL_APPEARANCE[level as ButtonLevel];\n}\n\n/** The members `mixinButtonLevel` adds. */\nexport interface ButtonLevelAppearance {\n /**\n * Preset of `color` and `variant`: `primary` (primary, filled), `secondary` (surface, tonal),\n * `tertiary` (primary, text), `danger` (danger, filled). A `color` or `variant` set on the\n * element wins over the preset.\n */\n level?: ButtonLevel;\n\n /** The visual style. Reads back the resolved value: the one set, else the level's, else `filled`. */\n variant: ButtonVariant;\n\n /** The color role. Reads back the resolved value: the one set, else the level's, else `primary`. */\n color: ButtonColor;\n}\n\n/**\n * Adds `level` and resolves `variant` and `color` from it at render time. The `variant` and\n * `color` attributes reflect the resolved values (the styles key on them), but the level never\n * writes the consumer's own values, so a later change to `level` takes effect and an explicit\n * `color`/`variant` always wins.\n */\nexport function mixinButtonLevel<T extends MixinBase<LitElement & BaseButton>>(\n base: T,\n): MixinReturn<T, ButtonLevelAppearance> {\n abstract class ButtonLevelElement\n extends base\n implements ButtonLevelAppearance\n {\n /**\n * Preset of `color` and `variant`: `primary` (primary, filled), `secondary` (surface, tonal),\n * `tertiary` (primary, text), `danger` (danger, filled). A `color` or `variant` set on the\n * element wins over the preset.\n */\n @property({ type: String }) level?: ButtonLevel;\n\n /**\n * The visual style of the button: `\"filled\"`, `\"tonal\"`, `\"outlined\"`, `\"text\"`,\n * `\"elevated\"` or `\"neo\"`. Unset, it comes from `level`, else `\"filled\"`.\n */\n @property({ type: String, reflect: true })\n get variant(): ButtonVariant {\n return (\n this.__explicitVariant ||\n levelAppearance(this.level)?.variant ||\n BUTTON_DEFAULT_APPEARANCE.variant\n );\n }\n\n set variant(value: ButtonVariant) {\n this.__explicitVariant = value || undefined;\n }\n\n /**\n * The color role of the button. Unset, it comes from `level`, else `\"primary\"`.\n */\n @property({ type: String, reflect: true })\n get color(): ButtonColor {\n return (\n this.__explicitColor ||\n levelAppearance(this.level)?.color ||\n BUTTON_DEFAULT_APPEARANCE.color\n );\n }\n\n set color(value: ButtonColor) {\n this.__explicitColor = value || undefined;\n }\n\n __explicitVariant?: ButtonVariant;\n\n __explicitColor?: ButtonColor;\n\n override willUpdate(changedProperties: PropertyValues) {\n super.willUpdate(changedProperties);\n // The level changes the resolved values without going through their setters, so ask Lit\n // to reflect them (also on the first update, when nothing has set them yet).\n if (!this.hasUpdated || changedProperties.has('level')) {\n this.requestUpdate('variant', undefined);\n this.requestUpdate('color', undefined);\n }\n }\n }\n\n return ButtonLevelElement;\n}\n\n// ── Toggle ───────────────────────────────────────────────────────────────────\n\n/** A button that can act as a toggle: `toggle` turns it on, `selected` is its pressed state. */\nexport interface ToggleableButton extends HTMLElement {\n toggle: boolean;\n selected: boolean;\n disabled: boolean;\n}\n\n/**\n * Flips `selected` on a toggle button and fires `change` with the new state. Does nothing unless\n * `toggle` is set or while the button is disabled; callers block soft-disabled and loading first.\n */\nexport function toggleButtonSelected(host: ToggleableButton): void {\n if (!host.toggle || host.disabled) return;\n host.selected = !host.selected;\n host.dispatchEvent(\n new CustomEvent<{ selected: boolean }>('change', {\n detail: { selected: host.selected },\n bubbles: true,\n composed: true,\n }),\n );\n}\n\n// ── Accessible name ──────────────────────────────────────────────────────────\n\n/**\n * The name an icon-only button falls back to: its `aria-label`, else its tooltip text.\n */\nexport function iconButtonLabel(\n ariaLabel: string | null | undefined,\n tooltip: string | undefined,\n): string | undefined {\n return ariaLabel || tooltip || undefined;\n}\n\n/**\n * Warns once per tag when an icon-only button has nothing to be announced by: no `aria-label`,\n * no `aria-labelledby`, no `tooltip` and no slotted text.\n */\nexport function warnIfUnnamed(\n host: HTMLElement,\n ariaLabel: string | null | undefined,\n ...otherNames: (string | null | undefined)[]\n): void {\n if (ariaLabel || otherNames.some(name => !!name)) return;\n if (host.hasAttribute('aria-labelledby')) return;\n if (host.hasAttribute('data-aria-labelledby')) return;\n if (host.textContent?.trim()) return;\n const tag = host.localName;\n warnOnce(\n `${tag}:accessible-name`,\n `[peacock] ${tag} has no accessible name, so screen readers announce it as just \"button\". Give it an aria-label or a tooltip.`,\n );\n}\n"],"names":["property"],"mappings":";;;;;AAkCM,SAAU,eAAe,CAE7B,IAAO,EAAA;IACP,MAAe,iBAAkB,SAAQ,IAAI,CAAA;AAA7C,QAAA,WAAA,GAAA;;;YAGE,IAAA,CAAA,OAAO,GAAW,EAAE;;YAIpB,IAAA,CAAA,KAAK,GAAW,EAAE;AAElB;;AAEG;YAEH,IAAA,CAAA,QAAQ,GAAY,KAAK;AAEzB;;;;AAIG;YAEH,IAAA,CAAA,YAAY,GAAY,KAAK;AAE7B;;;;AAIG;YAEH,IAAA,CAAA,cAAc,GAAW,EAAE;YAQ3B,IAAA,CAAA,2BAA2B,GACzB,KAAK,IAAG;AACN,gBAAA,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;AAC7B,YAAA,CAAC;QAaL;AATW,QAAA,YAAY,CAAC,iBAAiC,EAAA;AACrD,YAAA,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC;AACrC,YAAA,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE;AAC1C,gBAAA,IAAI,CAAC,2BAA2B,GAAG,QAAQ,CACzC,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,aAAa,CACnB;YACH;QACF;AACD;AAlDC,IAAA,UAAA,CAAA;QADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OA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SAAU,aAAa,CAC3B,IAAiB,EACjB,SAAoC,EACpC,GAAG,UAAyC,EAAA;AAE5C,IAAA,IAAI,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC;QAAE;AAClD,IAAA,IAAI,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC;QAAE;AAC1C,IAAA,IAAI,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC;QAAE;AAC/C,IAAA,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE;QAAE;AAC9B,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS;IAC1B,QAAQ,CACN,GAAG,GAAG,CAAA,gBAAA,CAAkB,EACxB,CAAA,UAAA,EAAa,GAAG,CAAA,4GAAA,CAA8G,CAC/H;AACH;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"datasource-OwvH7SVq.js","sources":["../../src/__internal/utils/cache-fetch.ts","../../src/icon/datasource.ts"],"sourcesContent":["export async function createCacheFetch(name: string) {\n let cache: Cache | null = null;\n // This map tracks requests currently being processed\n const inFlightRequests = new Map<string, Promise<string>>();\n\n try {\n cache = await window.caches.open(name);\n } catch (e) {\n console.warn('window.caches access not allowed');\n }\n\n return async (url: string): Promise<string> => {\n if (inFlightRequests.has(url)) {\n return inFlightRequests.get(url)!;\n }\n\n const fetchPromise = (async () => {\n const request = new Request(url);\n\n if (cache) {\n const cachedResponse = await cache.match(request);\n if (cachedResponse) {\n return cachedResponse.text();\n }\n }\n\n const urlObj = new URL(request.url);\n const isSameOrigin = urlObj.origin === window.location.origin;\n\n const response = await fetch(request.url, {\n method: 'GET',\n mode: isSameOrigin ? 'no-cors' : 'cors',\n credentials: isSameOrigin ? 'same-origin' : 'omit',\n });\n\n if (response.status === 404) {\n console.error(`[Fetch Error] Resource not found (404): ${url}`);\n return '';\n }\n\n const result = await response.text();\n\n if (cache && response.status === 200) {\n await cache.put(\n request,\n new Response(result, {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n }),\n );\n }\n\n return result;\n })();\n\n inFlightRequests.set(url, fetchPromise);\n\n try {\n return await fetchPromise;\n } finally {\n inFlightRequests.delete(url);\n }\n };\n}\n","import { createCacheFetch } from '@/__internal/utils/cache-fetch.js';\n\n/** Where each provider's icons are loaded from by default: `<base><name>.svg`. */\nconst CDN: Record<string, string> = {\n // Keep the version in step with the @material-symbols/svg-500 dev dependency, which the build\n // copies into dist/icons/ for loader-full.js.\n 'material-symbols':\n 'https://cdn.jsdelivr.net/npm/@material-symbols/svg-500@0.40.1/outlined/',\n carbon: 'https://cdn.jsdelivr.net/npm/@carbon/icons@11.41.0/svg/32/',\n};\n\nconst bases: Record<string, string> = { ...CDN };\n\nconst cacheFetch = await createCacheFetch('svg-cache');\n\n/**\n * Loads a provider's icons from `base`, a folder holding `<name>.svg`, instead of cdn.jsdelivr.net:\n * for pages that must not leave their own origin, such as an intranet or a page whose content\n * security policy allows only `connect-src 'self'`. A relative `base` resolves against the page.\n * `loader-full.js` does this for Material Symbols with the icons it ships in `icons/`.\n */\nexport function setIconBase(provider: string, base: string | URL) {\n const href = new URL(base, document.baseURI).href;\n bases[provider] = href.endsWith('/') ? href : `${href}/`;\n}\n\nexport async function fetchSVG(url: string) {\n if (!url) return '';\n return cacheFetch(url);\n}\n\nexport async function fetchIcon(\n name: string,\n provider: string = 'material-symbols',\n) {\n if (!name) return '';\n\n if (!bases[provider]) {\n throw new Error(`Provider '${provider}' not found`);\n }\n\n return fetchSVG(`${bases[provider]}${encodeURIComponent(name)}.svg`);\n}\n"],"names":[],"mappings":"AAAO,eAAe,gBAAgB,CAAC,IAAY,EAAA;IACjD,IAAI,KAAK,GAAiB,IAAI;;AAE9B,IAAA,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA2B;AAE3D,IAAA,IAAI;QACF,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IACxC;IAAE,OAAO,CAAC,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Aa,QAAQ,CAAA,WAAA,CAAa,CAAC;IACrD;AAEA,IAAA,OAAO,QAAQ,CAAC,CAAA,EAAG,KAAK,CAAC,QAAQ,CAAC,CAAA,EAAG,kBAAkB,CAAC,IAAI,CAAC,CAAA,IAAA,CAAM,CAAC;AACtE;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"form-submitter-beG1CXAn.js","sources":["../../src/__internal/events/dispatch-hooks.ts","../../src/__internal/mixins/form-submitter.ts"],"sourcesContent":["/**\n * A symbol used to access dispatch hooks on an event.\n */\nconst dispatchHooks = Symbol('dispatchHooks');\n\n/**\n * An `Event` with additional symbols for dispatch hooks.\n */\ninterface EventWithDispatchHooks extends Event {\n [dispatchHooks]: EventTarget;\n}\n\n/**\n * Add a hook for an event that is called after the event is dispatched and\n * propagates to other event listeners.\n *\n * This is useful for behaviors that need to check if an event is canceled.\n *\n * The callback is invoked synchronously, which allows for better integration\n * with synchronous platform APIs (like `<form>` or `<label>` clicking).\n *\n * Note: `setupDispatchHooks()` must be called on the element before adding any\n * other event listeners. Call it in the constructor of an element or\n * controller.\n *\n * @example\n * ```ts\n * class MyControl extends LitElement {\n * constructor() {\n * super();\n * setupDispatchHooks(this, 'click');\n * this.addEventListener('click', event => {\n * afterDispatch(event, () => {\n * if (event.defaultPrevented) {\n * return\n * }\n *\n * // ... perform logic\n * });\n * });\n * }\n * }\n * ```\n *\n * @example\n * ```ts\n * class MyController implements ReactiveController {\n * constructor(host: ReactiveElement) {\n * // setupDispatchHooks() may be called multiple times for the same\n * // element and events, making it safe for multiple controllers to use it.\n * setupDispatchHooks(host, 'click');\n * host.addEventListener('click', event => {\n * afterDispatch(event, () => {\n * if (event.defaultPrevented) {\n * return;\n * }\n *\n * // ... perform logic\n * });\n * });\n * }\n * }\n * ```\n *\n * @param event The event to add a hook to.\n * @param callback A hook that is called after the event finishes dispatching.\n */\nexport function afterDispatch(event: Event, callback: () => void) {\n const hooks = (event as EventWithDispatchHooks)[dispatchHooks];\n if (!hooks) {\n throw new Error(`'${event.type}' event needs setupDispatchHooks().`);\n }\n\n hooks.addEventListener('after', callback, { once: true });\n}\n\n/**\n * A lookup map of elements and event types that have a dispatch hook listener\n * set up. Used to ensure we don't set up multiple hook listeners on the same\n * element for the same event.\n */\nconst ELEMENT_DISPATCH_HOOK_TYPES = new WeakMap<Element, Set<string>>();\n\n/**\n * Sets up an element to add dispatch hooks to given event types. This must be\n * called before adding any event listeners that need to use dispatch hooks\n * like `afterDispatch()`.\n *\n * This function is safe to call multiple times with the same element or event\n * types. Call it in the constructor of elements, mixins, and controllers to\n * ensure it is set up before external listeners.\n *\n * @example\n * ```ts\n * class MyControl extends LitElement {\n * constructor() {\n * super();\n * setupDispatchHooks(this, 'click');\n * this.addEventListener('click', this.listenerUsingAfterDispatch);\n * }\n * }\n * ```\n *\n * @param element The element to set up event dispatch hooks for.\n * @param eventTypes The event types to add dispatch hooks to.\n */\nexport function setupDispatchHooks(\n element: Element,\n ...eventTypes: [string, ...string[]]\n) {\n let typesAlreadySetUp = ELEMENT_DISPATCH_HOOK_TYPES.get(element);\n if (!typesAlreadySetUp) {\n typesAlreadySetUp = new Set();\n ELEMENT_DISPATCH_HOOK_TYPES.set(element, typesAlreadySetUp);\n }\n\n for (const eventType of eventTypes) {\n // Don't register multiple dispatch hook listeners. A second registration\n // would lead to the second listener calling `afterDispatch()` hooks twice.\n if (typesAlreadySetUp.has(eventType)) {\n continue;\n }\n\n element.addEventListener(\n eventType,\n (event: Event) => {\n // Add hooks onto the event.\n const hooks = new EventTarget();\n (event as EventWithDispatchHooks)[dispatchHooks] = hooks;\n\n const cleanupLastNodeListener = new AbortController();\n const callAfterDispatch = () => {\n cleanupLastNodeListener.abort();\n hooks.dispatchEvent(new Event('after'));\n };\n\n const patchStopPropagation = (\n superMethod: Event['stopPropagation'],\n ) => {\n return function (this: Event) {\n superMethod.call(this);\n // Synchronously call afterDispatch() hooks when interrupted.\n callAfterDispatch();\n };\n };\n\n event.stopPropagation = patchStopPropagation(event.stopPropagation);\n event.stopImmediatePropagation = patchStopPropagation(\n event.stopImmediatePropagation,\n );\n\n // Add an event listener to detect the end of the event's propagation.\n const composedPath = event.composedPath();\n let lastNodeForEvent: EventTarget;\n if (event.composed && event.bubbles) {\n lastNodeForEvent = composedPath[composedPath.length - 1];\n } else if (!event.bubbles) {\n lastNodeForEvent = composedPath[0];\n } else {\n lastNodeForEvent = (composedPath[0] as Element).getRootNode();\n }\n\n lastNodeForEvent.addEventListener(\n eventType,\n () => {\n // Synchronously call afterDispatch() hooks.\n callAfterDispatch();\n },\n { once: true, signal: cleanupLastNodeListener.signal },\n );\n },\n {\n // Ensure this listener runs before other listeners.\n // `setupDispatchHooks()` should be called in constructors to also\n // ensure they run before any other externally-added capture listeners.\n capture: true,\n },\n );\n\n typesAlreadySetUp.add(eventType);\n }\n}\n","import { isServer, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { afterDispatch, setupDispatchHooks } from '../events/dispatch-hooks.js';\nimport { internals, WithElementInternals } from './element-internals.js';\nimport { MixinBase, MixinReturn } from './mixin.js';\n\n/**\n * A string indicating the form submission behavior of the element.\n *\n * - submit: The element submits the form. This is the default value if the\n * attribute is not specified, or if it is dynamically changed to an empty or\n * invalid value.\n * - reset: The element resets the form.\n * - button: The element does nothing.\n */\nexport type FormSubmitterType = 'button' | 'submit' | 'reset';\n\n/**\n * An element that can submit or reset a `<form>`, similar to\n * `<button type=\"submit\">`.\n */\nexport interface FormSubmitter {\n /**\n * A string indicating the form submission behavior of the element.\n *\n * - submit: The element submits the form. This is the default value if the\n * attribute is not specified, or if it is dynamically changed to an empty or\n * invalid value.\n * - reset: The element resets the form.\n * - button: The element does nothing.\n */\n type: string;\n\n /**\n * The HTML name to use in form submission. When combined with a `value`, the\n * submitting button's name/value will be added to the form.\n *\n * Names must reflect to a `name` attribute for form integration.\n */\n name: string;\n\n /**\n * The value of the button. When combined with a `name`, the submitting\n * button's name/value will be added to the form.\n */\n value: string;\n}\n\n/**\n * Mixes in form submitter behavior for a class.\n *\n * A click listener is added to each element instance. If the click is not\n * default prevented, it will submit the element's form, if any.\n *\n * @example\n * ```ts\n * const base = mixinFormSubmitter(mixinElementInternals(LitElement));\n * class MyButton extends base {\n * static formAssociated = true;\n * }\n * ```\n *\n * @param base The class to mix functionality into.\n * @return The provided class with `FormSubmitter` mixed in.\n */\nexport function mixinFormSubmitter<\n T extends MixinBase<LitElement & WithElementInternals>,\n>(base: T): MixinReturn<T, FormSubmitter> {\n abstract class FormSubmitterElement extends base implements FormSubmitter {\n /**\n * What activating the element does in a form: `\"submit\"` (default) submits it, `\"reset\"`\n * resets it and `\"button\"` does nothing.\n */\n @property() type = 'submit';\n\n /** The value sent with the form, paired with `name`, when this element submits it. */\n @property({ reflect: true }) value = '';\n\n // Name attribute must reflect synchronously for form integration.\n /** The name sent with the form, paired with `value`, when this element submits it. */\n get name() {\n return this.getAttribute('name') ?? '';\n }\n\n set name(name: string) {\n this.setAttribute('name', name);\n }\n\n // Mixins must have a constructor with `...args: any[]`\n // tslint:disable-next-line:no-any\n constructor(...args: any[]) {\n super(...args);\n if (isServer) return;\n setupDispatchHooks(this, 'click');\n this.addEventListener('click', async (event: Event) => {\n const isReset = this.type === 'reset';\n const isSubmit = this.type === 'submit';\n const elementInternals = this[internals];\n const { form } = elementInternals;\n if (!form || !(isSubmit || isReset)) {\n return;\n }\n\n afterDispatch(event, () => {\n if (event.defaultPrevented) {\n return;\n }\n\n if (isReset) {\n form.reset();\n return;\n }\n\n // form.requestSubmit(submitter) does not work with form associated custom\n // elements. This patches the dispatched submit event to add the correct\n // `submitter`.\n // See https://github.com/WICG/webcomponents/issues/814\n form.addEventListener(\n 'submit',\n (submitEvent: Event) => {\n Object.defineProperty(submitEvent, 'submitter', {\n configurable: true,\n enumerable: true,\n get: () => this,\n });\n },\n { capture: true, once: true },\n );\n\n elementInternals.setFormValue(this.value);\n form.requestSubmit();\n });\n });\n }\n }\n\n return FormSubmitterElement;\n}\n"],"names":["property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A,GAAG,EAAE,MAAM,IAAI;AAChB,yBAAA,CAAC;oBACJ,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAC9B;AAED,oBAAA,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;oBACzC,IAAI,CAAC,aAAa,EAAE;AACtB,gBAAA,CAAC,CAAC;AACJ,YAAA,CAAC,CAAC;QACJ;AACD;AA7Da,IAAA,UAAA,CAAA;AAAX,QAAAA,CAAQ;AAAmB,KAAA,EAAA,oBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAGC,IAAA,UAAA,CAAA;AAA5B,QAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAAa,KAAA,EAAA,oBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AA4D1C,IAAA,OAAO,oBAAoB;AAC7B;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"roving-focus-controller-fm95JkZJ.js","sources":["../../src/__internal/controllers/roving-focus-controller.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nexport interface RovingFocusOptions {\n /** The items, in order. Disabled or hidden ones are skipped automatically. */\n items: () => HTMLElement[];\n /** `horizontal` uses Left/Right (mirrored in right-to-left), `vertical` Up/Down, `both` all four. */\n orientation?: () => 'horizontal' | 'vertical' | 'both';\n /** Whether moving past the last item goes to the first. Default true. */\n wrap?: () => boolean;\n /** Whether typing a character moves to the next item whose text starts with it. Default false. */\n typeahead?: () => boolean;\n /** The text typeahead matches for an item. Default: its `textContent`. */\n itemText?: (item: HTMLElement) => string;\n /** The item that should hold the tab stop when none has it yet (default: the first). */\n initialItem?: (items: HTMLElement[]) => HTMLElement | null | undefined;\n /** Called after focus moved to `item` by keyboard, for components that select on focus (tabs). */\n onMove?: (item: HTMLElement, event: KeyboardEvent) => void;\n /** Whether an item can take focus; default: not `disabled`, not `aria-disabled=\"true\"`, not hidden. */\n isFocusable?: (item: HTMLElement) => boolean;\n /**\n * Whether to manage `tabindex` (one tab stop for the set). Default true. Set it to false when\n * every item stays in the Tab order and the arrow keys are only a shortcut, as for accordion\n * headers in the WAI-ARIA pattern.\n */\n manageTabIndex?: () => boolean;\n}\n\nconst TYPEAHEAD_RESET_MS = 500;\n\nfunction defaultFocusable(item: HTMLElement) {\n return (\n !item.hidden &&\n !item.hasAttribute('disabled') &&\n item.getAttribute('aria-disabled') !== 'true'\n );\n}\n\n/**\n * Roving tabindex for a set of items (toolbar actions, tabs, list items, accordion headers):\n * one item is the tab stop (`tabindex=\"0\"`), the others `-1`; arrow keys, Home and End move focus\n * between them, mirroring Left/Right in right-to-left layouts.\n *\n * The host attaches `handleKeyDown` and `handleFocusIn` to the element that contains the items\n * (or its host), and calls `sync()` when the items change (on `slotchange` and after updates).\n *\n * @example\n * private readonly roving = new RovingFocusController(this, {\n * items: () => this.slottedTabs(),\n * orientation: () => 'horizontal',\n * });\n * // render: <div role=\"tablist\" @keydown=${this.roving.handleKeyDown}\n * // @focusin=${this.roving.handleFocusIn}><slot @slotchange=${() => this.roving.sync()}>\n */\nexport class RovingFocusController implements ReactiveController {\n private readonly host: ReactiveControllerHost & HTMLElement;\n\n private readonly options: RovingFocusOptions;\n\n private active: HTMLElement | null = null;\n\n private typed = '';\n\n private typedAt = 0;\n\n constructor(\n host: ReactiveControllerHost & HTMLElement,\n options: RovingFocusOptions,\n ) {\n this.host = host;\n this.options = options;\n host.addController(this);\n }\n\n hostUpdated() {\n this.sync();\n }\n\n /** The item that holds the tab stop. */\n get activeItem(): HTMLElement | null {\n return this.active;\n }\n\n /** Re-applies the tab stops; call after the items change. */\n sync() {\n const items = this.focusableItems();\n if (!this.active || !items.includes(this.active)) {\n this.active = this.options.initialItem?.(items) ?? items[0] ?? null;\n }\n if (!(this.options.manageTabIndex?.() ?? true)) return;\n for (const item of this.options.items()) {\n const stop = item === this.active;\n if (item.tabIndex !== (stop ? 0 : -1)) item.tabIndex = stop ? 0 : -1;\n }\n }\n\n /** Makes `item` the tab stop, and focuses it unless `focus` is false. */\n setActive(item: HTMLElement, focus = true) {\n this.active = item;\n this.sync();\n if (focus) item.focus();\n }\n\n /** Keeps the tab stop on the item that got focus by click or Tab. */\n handleFocusIn = (event: FocusEvent) => {\n const item = this.itemFromEvent(event);\n if (item && item !== this.active) {\n this.active = item;\n this.sync();\n }\n };\n\n handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey\n ) {\n return;\n }\n const items = this.focusableItems();\n const current = this.itemFromEvent(event);\n if (items.length === 0 || !current) return;\n\n const target = this.targetFor(event, items, current);\n if (!target) return;\n event.preventDefault();\n this.setActive(target);\n this.options.onMove?.(target, event);\n };\n\n // ── Private ──────────────────────────────────────────────────────────────\n\n private focusableItems() {\n const focusable = this.options.isFocusable ?? defaultFocusable;\n return this.options.items().filter(item => focusable(item));\n }\n\n private itemFromEvent(event: Event): HTMLElement | null {\n const items = this.options.items();\n return (\n (event\n .composedPath()\n .find(node => items.includes(node as HTMLElement)) as\n | HTMLElement\n | undefined) ?? null\n );\n }\n\n private targetFor(\n event: KeyboardEvent,\n items: HTMLElement[],\n current: HTMLElement,\n ): HTMLElement | undefined {\n const orientation = this.options.orientation?.() ?? 'horizontal';\n const rtl = getComputedStyle(this.host).direction === 'rtl';\n const wrap = this.options.wrap?.() ?? true;\n const index = Math.max(0, items.indexOf(current));\n\n const next: string[] = [];\n const previous: string[] = [];\n if (orientation !== 'vertical') {\n next.push(rtl ? 'ArrowLeft' : 'ArrowRight');\n previous.push(rtl ? 'ArrowRight' : 'ArrowLeft');\n }\n if (orientation !== 'horizontal') {\n next.push('ArrowDown');\n previous.push('ArrowUp');\n }\n\n const step = (delta: number) => {\n const to = index + delta;\n if (wrap) return items[(to + items.length) % items.length];\n return items[Math.min(items.length - 1, Math.max(0, to))];\n };\n\n if (next.includes(event.key)) return step(1);\n if (previous.includes(event.key)) return step(-1);\n if (event.key === 'Home') return items[0];\n if (event.key === 'End') return items[items.length - 1];\n\n if (\n this.options.typeahead?.() &&\n event.key.length === 1 &&\n event.key !== ' '\n ) {\n return this.typeaheadTarget(event.key, items, index);\n }\n return undefined;\n }\n\n /** The next item whose text starts with the typed characters (a 500 ms buffer, like native). */\n private typeaheadTarget(key: string, items: HTMLElement[], index: number) {\n const now = Date.now();\n this.typed =\n now - this.typedAt > TYPEAHEAD_RESET_MS ? key : this.typed + key;\n this.typedAt = now;\n // The same letter typed again (\"bb\") cycles through the items starting with it, like a\n // native select; other buffers match as a prefix.\n const typed = this.typed.toLowerCase();\n const repeated = [...typed].every(char => char === typed[0]);\n const query = repeated ? typed[0] : typed;\n const start = query.length === 1 ? index + 1 : index;\n for (let offset = 0; offset < items.length; offset += 1) {\n const item = items[(start + offset) % items.length];\n const text = this.options.itemText?.(item) ?? item.textContent ?? '';\n if (text.trim().toLowerCase().startsWith(query)) {\n return item;\n }\n }\n return undefined;\n }\n}\n"],"names":[],"mappings":"AA2BA,MAAM,kBAAkB,GAAG,GAAG;AAE9B,SAAS,gBAAgB,CAAC,IAAiB,EAAA;AACzC,IAAA,QACE,CAAC,IAAI,CAAC,MAAM;AACZ,QAAA,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;QAC9B,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,MAAM;AAEjD;AAEA;;;;;;;;;;;;;;;AAeG;MACU,qBAAqB,CAAA;IAWhC,WAAA,CACE,IAA0C,EAC1C,OAA2B,EAAA;QARrB,IAAA,CAAA,MAAM,GAAuB,IAAI;QAEjC,IAAA,CAAA,KAAK,GAAG,EAAE;QAEV,IAAA,CAAA,OAAO,GAAG,CAAC;;AAyCnB,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,KAAiB,KAAI;YACpC,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YACtC,IAAI,IAAI,IAAI,IAAI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;AACpD,QAAA,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE;AACvD,YAAA,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,KAAK,GAAG,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;AACnD,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,IAAI,EAAE;AACpE,YAAA,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;AAC/C,gBAAA,OAAO,IAAI;YACb;QACF;AACA,QAAA,OAAO,SAAS;IAClB;AACD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"throttle-SQ9t-HL7.js","sources":["../../src/__internal/utils/dispatch-event-utils.ts","../../src/__internal/utils/throttle.ts"],"sourcesContent":["/**\n * Dispatches a click event to the given element that triggers a native action,\n * but is not composed and therefore is not seen outside the element.\n *\n * This is useful for responding to an external click event on the host element\n * that should trigger an internal action like a button click.\n *\n * Note, a helper is provided because setting this up correctly is a bit tricky.\n * In particular, calling `click` on an element creates a composed event, which\n * is not desirable, and a manually dispatched event must specifically be a\n * `MouseEvent` to trigger a native action.\n *\n * @example\n * hostClickListener = (event: MouseEvent) {\n * if (isActivationClick(event)) {\n * this.dispatchActivationClick(this.buttonElement);\n * }\n * }\n *\n */\nexport function dispatchActivationClick(element: HTMLElement) {\n const event = new MouseEvent('click', { bubbles: true });\n element.dispatchEvent(event);\n return event;\n}\n\n// Ignore events for one microtask only.\nlet isSquelchingEvents = false;\nasync function __squelchEventsForMicrotask() {\n isSquelchingEvents = true;\n // Need to pause for just one microtask.\n // tslint:disable-next-line\n await null;\n isSquelchingEvents = false;\n}\n\n// TODO(https://bugzilla.mozilla.org/show_bug.cgi?id=1804576)\n// Remove when Firefox bug is addressed.\nfunction __squelchEvent(event: Event) {\n const squelched = isSquelchingEvents;\n if (squelched) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n __squelchEventsForMicrotask();\n return squelched;\n}\n\n/**\n * Returns true if the click event should trigger an activation behavior. The\n * behavior is defined by the element and is whatever it should do when\n * clicked.\n *\n * Typically when an element needs to handle a click, the click is generated\n * from within the element and an event listener within the element implements\n * the needed behavior; however, it's possible to fire a click directly\n * at the element that the element should handle. This method helps\n * distinguish these \"external\" clicks.\n *\n * An \"external\" click can be triggered in a number of ways: via a click\n * on an associated label for a form associated element, calling\n * `element.click()`, or calling\n * `element.dispatchEvent(new MouseEvent('click', ...))`.\n *\n * Also works around Firefox issue\n * https://bugzilla.mozilla.org/show_bug.cgi?id=1804576 by squelching\n * events for a microtask after called.\n *\n * @example\n * hostClickListener = (event: MouseEvent) {\n * if (isActivationClick(event)) {\n * this.dispatchActivationClick(this.buttonElement);\n * }\n * }\n *\n */\nexport function isActivationClick(event: Event) {\n // Event must start at the event target.\n if (event.currentTarget !== event.target) {\n return false;\n }\n // Event must not be retargeted from shadowRoot.\n if (event.composedPath()[0] !== event.target) {\n return false;\n }\n\n // Target must not be disabled; this should only occur for a synthetically\n // dispatched click.\n if ((event.target as EventTarget & { disabled: boolean }).disabled) {\n return false;\n }\n // This is an activation if the event should not be squelched.\n return !__squelchEvent(event);\n}\n\n/**\n * Re-dispatches an event from the provided element.\n *\n * This function is useful for forwarding non-composed events, such as `change`\n * events.\n *\n * @example\n * class MyInput extends LitElement {\n * render() {\n * return html`<input @change=${this.redispatchEvent}>`;\n * }\n *\n * protected redispatchEvent(event: Event) {\n * redispatchEvent(this, event);\n * }\n * }\n *\n * @param element The element to dispatch the event from.\n * @param event The event to re-dispatch.\n * @return Whether or not the event was dispatched (if cancelable).\n */\nexport function redispatchEvent(element: Element, event: Event) {\n // For bubbling events in SSR light DOM (or composed), stop their propagation\n // and dispatch the copy.\n if (event.bubbles && (!element.shadowRoot || event.composed)) {\n event.stopPropagation();\n }\n\n const copy = Reflect.construct(event.constructor, [event.type, event]);\n const dispatched = element.dispatchEvent(copy);\n if (!dispatched) {\n event.preventDefault();\n }\n\n return dispatched;\n}\n","export function throttle(\n func: Function,\n delay: number,\n options = { leading: true, trailing: true },\n) {\n let timerId: any;\n let lastExec = 0;\n\n return function (...args: any[]) {\n // @ts-ignore\n const context = this;\n const now = Date.now();\n\n const shouldCallNow = options.leading && now - lastExec >= delay;\n\n if (shouldCallNow) {\n func.apply(context, args);\n lastExec = now;\n } else if (options.trailing && !timerId) {\n timerId = setTimeout(() => {\n func.apply(context, args);\n lastExec = Date.now();\n timerId = null;\n }, delay);\n }\n };\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,uBAAuB,CAAC,OAAoB,EAAA;AAC1D,IAAA,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACxD,IAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC;AAC5B,IAAA,OAAO,KAAK;AACd;AAEA;AACA,IAAI,kBAAkB,GAAG,KAAK;AAC9B,eAAe,2BAA2B,GAAA;IACxC,kBAAkB,GAAG,IAAI;;;AAGzB,IAAA,MAAM,IAAI;IACV,kBAAkB,GAAG,KAAK;AAC5B;AAEA;AACA;AACA,SAAS,cAAc,CAAC,KAAY,EAAA;IAClC,MAAM,SAAS,GAAG,kBAAkB;IACpC,IAAI,SAAS,EAAE;QACb,KAAK,CAAC,cAAc,EAAE;QACtB,KAAK,CAAC,wBAAwB,EAAE;IAClC;AACA,IAAA,2BAA2B,EAAE;AAC7B,IAAA,OAAO,SAAS;AAClB;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,iBAAiB,CAAC,KAAY,EAAA;;IAE5C,IAAI,KAAK,CAAC,aAAa,KAAK,KAAK,CAAC,MAAM,EAAE;AACxC,QAAA,OAAO,KAAK;IACd;;AAEA,IAAA,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,EAAE;AAC5C,QAAA,OAAO,KAAK;IACd;;;AAIA,IAAA,IAAK,KAAK,CAAC,MAA8C,CAAC,QAAQ,EAAE;AAClE,QAAA,OAAO,KAAK;IACd;;AAEA,IAAA,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC;AAC/B;;SC7FgB,QAAQ,CACtB,IAAc,EACd,KAAa,EACb,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAA;AAE3C,IAAA,IAAI,OAAY;IAChB,IAAI,QAAQ,GAAG,CAAC;IAEhB,OAAO,UAAU,GAAG,IAAW,EAAA;;QAE7B,MAAM,OAAO,GAAG,IAAI;AACpB,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;QAEtB,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI,GAAG,GAAG,QAAQ,IAAI,KAAK;QAEhE,IAAI,aAAa,EAAE;AACjB,YAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;YACzB,QAAQ,GAAG,GAAG;QAChB;AAAO,aAAA,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE;AACvC,YAAA,OAAO,GAAG,UAAU,CAAC,MAAK;AACxB,gBAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;AACzB,gBAAA,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE;gBACrB,OAAO,GAAG,IAAI;YAChB,CAAC,EAAE,KAAK,CAAC;QACX;AACF,IAAA,CAAC;AACH;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-DcvLgexs.js","sources":["../../src/calendar/utils.ts"],"sourcesContent":["/**\n * Pure date utility functions (no external dependencies).\n */\n\nimport { resolveLocale } from '@/__internal/i18n/locale.js';\n\nexport function startOfDay(date: Date): Date {\n const d = new Date(date);\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nexport function endOfDay(date: Date): Date {\n const d = new Date(date);\n d.setHours(23, 59, 59, 999);\n return d;\n}\n\nexport function addDays(date: Date, days: number): Date {\n const d = new Date(date);\n d.setDate(d.getDate() + days);\n return d;\n}\n\nexport function addMonths(date: Date, months: number): Date {\n const d = new Date(date);\n d.setMonth(d.getMonth() + months);\n return d;\n}\n\nexport function addHours(date: Date, hours: number): Date {\n const d = new Date(date);\n d.setHours(d.getHours() + hours);\n return d;\n}\n\nexport function differenceInDays(dateA: Date, dateB: Date): number {\n const a = startOfDay(dateA);\n const b = startOfDay(dateB);\n return Math.round((a.valueOf() - b.valueOf()) / 86400000);\n}\n\nexport function startOfWeek(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n): Date {\n const d = startOfDay(date);\n const day = d.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n d.setDate(d.getDate() - diff);\n return d;\n}\n\nexport function endOfWeek(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n): Date {\n const d = startOfWeek(date, weekStartsOn);\n d.setDate(d.getDate() + 6);\n return endOfDay(d);\n}\n\nexport function startOfMonth(date: Date): Date {\n const d = new Date(date);\n d.setDate(1);\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nexport function endOfMonth(date: Date): Date {\n const d = new Date(date);\n d.setMonth(d.getMonth() + 1, 0);\n d.setHours(23, 59, 59, 999);\n return d;\n}\n\nexport function calculateMonthRange(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n) {\n const sd = startOfWeek(startOfMonth(date), weekStartsOn);\n const ed = endOfWeek(endOfMonth(date), weekStartsOn);\n return { startDate: sd, endDate: ed, totalDays: 42 };\n}\n\nexport function calculateWeekRange(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n) {\n const sd = startOfWeek(date, weekStartsOn);\n const ed = endOfWeek(date, weekStartsOn);\n return { startDate: sd, endDate: ed, totalDays: 7 };\n}\n\nexport function calculateDateRange(\n view: string,\n contextDate: Date,\n days: number,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n) {\n if (view === 'week') {\n return calculateWeekRange(contextDate, weekStartsOn);\n }\n return {\n startDate: startOfDay(contextDate),\n endDate: endOfDay(addDays(contextDate, days - 1)),\n totalDays: days,\n };\n}\n\nexport const LONG_EVENT_PADDING = 0.25;\n\n/** Milliseconds in a day of 24 hours. */\nexport const DAY_MS = 86400000;\n\n/** Milliseconds in a minute. */\nexport const MINUTE_MS = 60000;\n\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n\n/** Whether `date` is at local midnight. */\nexport function isMidnight(date: Date): boolean {\n return (\n date.getHours() === 0 &&\n date.getMinutes() === 0 &&\n date.getSeconds() === 0 &&\n date.getMilliseconds() === 0\n );\n}\n\n/**\n * Whether a range belongs in the all-day row: it lasts a day or more, or runs from one midnight to\n * a later one (a day the clocks go forward on has only 23 hours).\n */\nexport function isAllDayRange(start: Date, end: Date): boolean {\n const length = end.valueOf() - start.valueOf();\n return (\n length >= DAY_MS || (length > 0 && isMidnight(start) && isMidnight(end))\n );\n}\n\n/**\n * The last day a range covers. `end` is exclusive, so a range that ends at midnight ends the day\n * before. Never earlier than the day of `start`.\n */\nexport function lastDayOf(start: Date, end: Date): Date {\n const first = startOfDay(start);\n const last = startOfDay(new Date(end.valueOf() - 1));\n return last.valueOf() < first.valueOf() ? first : last;\n}\n\n/**\n * Whether the range `start`–`end` (end exclusive) shares time with `from`–`to`. A range without\n * length counts when its instant falls inside.\n */\nexport function rangesOverlap(\n start: Date,\n end: Date,\n from: Date,\n to: Date,\n): boolean {\n if (start.valueOf() >= end.valueOf()) {\n return start.valueOf() >= from.valueOf() && start.valueOf() < to.valueOf();\n }\n return start.valueOf() < to.valueOf() && end.valueOf() > from.valueOf();\n}\n\n/**\n * The start of the day after `date`'s. Unlike `addDays(day, 1)`, it lands on midnight even after a\n * day whose midnight the clocks skipped, where `startOfDay` gives 01:00.\n */\nexport function nextDay(date: Date): Date {\n return startOfDay(addDays(startOfDay(date), 1));\n}\n\n/** Minutes in a day on the wall clock, which the day and week views draw. */\nconst DAY_MINUTES = 1440;\n\n/**\n * Wall-clock minutes from the start of `day` to `date`: negative before it, 1440 or more after\n * it. The day and week views draw 24 equal hours, also on the days the clocks change.\n */\nexport function wallMinutes(date: Date, day: Date): number {\n return (\n differenceInDays(date, day) * DAY_MINUTES +\n date.getHours() * 60 +\n date.getMinutes() +\n date.getSeconds() / 60 +\n date.getMilliseconds() / MINUTE_MS\n );\n}\n\n/** The time `minutes` after the start of `day` on the wall clock; 1440 is the next midnight. */\nexport function atWallMinutes(day: Date, minutes: number): Date {\n const date = startOfDay(day);\n date.setHours(0, 0, 0, Math.round(minutes * MINUTE_MS));\n return date;\n}\n\n/** The time at `fraction` (0 to 1) down `day`'s column: the inverse of `getTimePercent`. */\nexport function timeAtFraction(day: Date, fraction: number): Date {\n return atWallMinutes(day, clamp(fraction, 0, 1) * DAY_MINUTES);\n}\n\n/**\n * `date` moved to a multiple of `minutes` on the wall clock after the start of `day` (by default\n * its own day): the nearest one, or the one before or after. The result stays within `day`, whose\n * end is the next midnight.\n */\nexport function snapTime(\n date: Date,\n minutes: number,\n mode: 'round' | 'floor' | 'ceil' = 'round',\n day: Date = date,\n): Date {\n const step = Math.max(1, minutes);\n const steps = Math[mode](wallMinutes(date, day) / step);\n return atWallMinutes(day, clamp(steps * step, 0, DAY_MINUTES));\n}\n\n/** Wall-clock date and time fields; `month` is 1–12. */\nexport type WallClockParts = {\n year: number;\n month: number;\n day: number;\n hour: number;\n minute: number;\n second: number;\n};\n\n/**\n * The wall-clock fields `date` shows in `timeZone` (an IANA name such as `America/New_York`),\n * read from `Intl.DateTimeFormat#formatToParts`. Throws a `RangeError` for an unknown zone.\n */\nexport function zonedParts(date: Date, timeZone: string): WallClockParts {\n const parts = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hourCycle: 'h23',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n }).formatToParts(date);\n const field = (type: Intl.DateTimeFormatPartTypes) =>\n Number(parts.find(part => part.type === type)?.value ?? 0);\n return {\n year: field('year'),\n month: field('month'),\n day: field('day'),\n // Some engines print midnight as 24 even with `h23`.\n hour: field('hour') % 24,\n minute: field('minute'),\n second: field('second'),\n };\n}\n\n/**\n * A `Date` whose local fields show the wall-clock time `date` has in `timeZone`, so the views can\n * lay it out with local getters. An empty or unknown zone returns a copy of `date`.\n */\nexport function toZonedWallClock(date: Date, timeZone: string): Date {\n if (!timeZone) return new Date(date);\n try {\n const { year, month, day, hour, minute, second } = zonedParts(\n date,\n timeZone,\n );\n const wall = new Date(\n year,\n month - 1,\n day,\n hour,\n minute,\n second,\n date.getMilliseconds(),\n );\n // Two-digit years would otherwise land in the 1900s.\n wall.setFullYear(year);\n return wall;\n } catch {\n return new Date(date);\n }\n}\n\n/** `Intl` options for each display pattern; the output matches the pattern in `en-US`. */\nconst DISPLAY_FORMATS: Record<string, Intl.DateTimeFormatOptions> = {\n 'MMMM d, yyyy': { month: 'long', day: 'numeric', year: 'numeric' },\n EEEE: { weekday: 'long' },\n E: { weekday: 'short' },\n d: { day: 'numeric' },\n dd: { day: '2-digit' },\n 'hh a': { hour: '2-digit' },\n 'hh:mm a': { hour: '2-digit', minute: '2-digit' },\n};\n\n/**\n * Formats a date for display in `locale`. The patterns name the `en-US` output; other locales get\n * their own month and day names, order and clock. `dd-MM-yyyy` is a fixed key, not display text.\n */\nexport function formatDate(\n date: Date,\n pattern: string,\n locale: string = resolveLocale(),\n): string {\n if (pattern === 'dd-MM-yyyy') {\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n return `${day}-${month}-${date.getFullYear()}`;\n }\n const options = DISPLAY_FORMATS[pattern];\n if (!options) return date.toLocaleDateString(locale);\n return new Intl.DateTimeFormat(locale, options).format(date);\n}\n\n/** `format.formatRange`, or both dates joined by a dash where it is missing or throws. */\nfunction formatRange(\n format: Intl.DateTimeFormat,\n start: Date,\n end: Date,\n): string {\n try {\n return format.formatRange(start, end);\n } catch {\n return `${format.format(start)} – ${format.format(end)}`;\n }\n}\n\n/**\n * When an event happens, for example `Nov 6, 2026, 9:00 – 9:30 AM`. An all-day event shows its\n * days only, through the day before an `end` at midnight.\n */\nexport function formatEventWhen(\n start: Date,\n end: Date,\n locale: string,\n allDay = false,\n): string {\n if (allDay) {\n const format = new Intl.DateTimeFormat(locale, { dateStyle: 'medium' });\n return formatRange(format, start, lastDayOf(start, end));\n }\n const format = new Intl.DateTimeFormat(locale, {\n dateStyle: 'medium',\n timeStyle: 'short',\n });\n return formatRange(format, start, end);\n}\n\n/** The times of a range without its date, for example `9:00 – 10:30 AM`. */\nexport function formatTimeRange(\n start: Date,\n end: Date,\n locale: string,\n): string {\n const format = new Intl.DateTimeFormat(locale, { timeStyle: 'short' });\n return formatRange(format, start, end);\n}\n\n/** Accessible name of an event: its title and when it happens, for example `Standup, Nov 6, 2026, 9:00 – 9:30 AM`. */\nexport function formatEventLabel(\n title: string,\n start: Date,\n end: Date,\n locale: string,\n allDay = false,\n): string {\n const when = formatEventWhen(start, end, locale, allDay);\n return title ? `${title}, ${when}` : when;\n}\n\n/** Runs `action` on Enter or Space, the keys that activate a button. */\nexport function onActivateKey(action: () => void) {\n return (event: KeyboardEvent) => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n action();\n };\n}\n\n/**\n * How far down `forDay`'s column (by default `date`'s own day) `date` falls, in percent, on a\n * 24-hour wall clock: a 9:00 event sits at the 9 AM row also on the days the clocks change.\n */\nexport function getTimePercent(date: Date, forDay?: Date): number {\n return clamp((wallMinutes(date, forDay || date) / DAY_MINUTES) * 100, 0, 100);\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