@momentum-design/components 0.131.4 → 0.131.6

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.
@@ -214,5 +214,13 @@ declare class Input extends Input_base implements AssociatedFormControl {
214
214
  protected renderInputElement(type: InputType, hidePlaceholder?: boolean): import("lit-html").TemplateResult<1>;
215
215
  render(): import("lit-html").TemplateResult<1>;
216
216
  static styles: Array<CSSResult>;
217
+ static shadowRootOptions: {
218
+ delegatesFocus: boolean;
219
+ clonable?: boolean;
220
+ customElementRegistry?: CustomElementRegistry;
221
+ mode: ShadowRootMode;
222
+ serializable?: boolean;
223
+ slotAssignment?: SlotAssignmentMode;
224
+ };
217
225
  }
218
226
  export default Input;
@@ -351,6 +351,7 @@ class Input extends KeyToActionMixin(AutoFocusOnMountMixin(FormInternalsMixin(Da
351
351
  }
352
352
  }
353
353
  Input.styles = [...FormfieldWrapper.styles, ...styles];
354
+ Input.shadowRootOptions = { ...FormfieldWrapper.shadowRootOptions, delegatesFocus: true };
354
355
  __decorate([
355
356
  property({ type: String }),
356
357
  __metadata("design:type", Object)
@@ -6,6 +6,9 @@ import { AriaLive } from './screenreaderannouncer.types';
6
6
  *
7
7
  * To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.
8
8
  *
9
+ * Consumers can also use the public `announce` function to trigger announcements programmatically
10
+ * by passing an options object where `announcement` is required and all other fields are optional.
11
+ *
9
12
  * **Internal logic**
10
13
  *
11
14
  * When the screenreader announcer is connected to the DOM, if the `identity` attribute is not
@@ -13,9 +16,25 @@ import { AriaLive } from './screenreaderannouncer.types';
13
16
  * in the DOM. If the `identity` attribute is provided, the identity element is used and no new element
14
17
  * is created in the DOM.
15
18
  *
19
+ * If you provide a custom `identity`, you must ensure that the element exists and is visually hidden.
20
+ *
21
+ * Example CSS:
22
+ *
23
+ * ```css
24
+ * #your-custom-announcer-id {
25
+ * clip: rect(0 0 0 0);
26
+ * clip-path: inset(50%);
27
+ * height: 1px;
28
+ * overflow: hidden;
29
+ * position: absolute;
30
+ * white-space: nowrap;
31
+ * width: 1px;
32
+ * }
33
+ * ```
34
+ *
16
35
  * When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with
17
36
  * `aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.
18
- * After delay of `delay` milliseconds, a <p> element with the announcement text is appended to the `<div>` element.
37
+ * After delay of `delay` milliseconds, a `<p>` element with the announcement text is appended to the `<div>` element.
19
38
  *
20
39
  * The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.
21
40
  *
@@ -25,6 +44,10 @@ import { AriaLive } from './screenreaderannouncer.types';
25
44
  * **Note**
26
45
  * 1. The default delay of 150 miliseconds is used as we dynamically generate the
27
46
  * aria-live region in the DOM and add the announcement text to it.
47
+ * 2. If multiple `mdc-screenreaderannouncer` instances use the same `identity`, `data-aria-live`
48
+ * for that identity is effectively determined by the first instance that creates announcements for it.
49
+ * Changing `data-aria-live` in later instances for the same identity will not update already-created
50
+ * live-region containers.
28
51
  * 3. If no `identity` is provided, all the screen reader components will create and use only one
29
52
  * `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.
30
53
  *
@@ -50,6 +73,10 @@ declare class ScreenreaderAnnouncer extends Component {
50
73
  /**
51
74
  * Aria live value for announcement.
52
75
  *
76
+ * For a shared `identity`, this value should be treated as immutable after initial usage.
77
+ * The first `mdc-screenreaderannouncer` instance that creates announcements for that
78
+ * identity determines the `aria-live` value for the created live-region containers.
79
+ *
53
80
  * @default 'polite'
54
81
  */
55
82
  dataAriaLive: AriaLive;
@@ -93,12 +120,18 @@ declare class ScreenreaderAnnouncer extends Component {
93
120
  * The div element is appended to the element in the DOM identified with id as
94
121
  * identity attribute.
95
122
  *
96
- * @param announcement - The announcement to be made.
97
- * @param delay - The delay in milliseconds before announcing the message.
98
- * @param timeout - The timeout in milliseconds before removing the announcement.
99
- * @param ariaLive - The aria live value for the announcement.
123
+ * @param options - Announcement configuration object with the following fields:
124
+ * - `announcement` (required): The announcement to be made.
125
+ * - `delay` (optional): The delay in milliseconds before announcing the message.
126
+ * - `timeout` (optional): The timeout in milliseconds before removing the announcement.
127
+ * - `ariaLive` (optional): The aria live value for the announcement.
100
128
  */
101
- announce(announcement: string, delay: number, timeout: number, ariaLive: AriaLive): void;
129
+ announce({ announcement, delay, timeout, ariaLive, }: {
130
+ announcement: string;
131
+ delay?: number;
132
+ timeout?: number;
133
+ ariaLive?: AriaLive;
134
+ }): void;
102
135
  /**
103
136
  * Clears all timeouts and removes all announcements from the screen reader.
104
137
  */
@@ -18,6 +18,9 @@ import styles from './screenreaderannouncer.styles';
18
18
  *
19
19
  * To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.
20
20
  *
21
+ * Consumers can also use the public `announce` function to trigger announcements programmatically
22
+ * by passing an options object where `announcement` is required and all other fields are optional.
23
+ *
21
24
  * **Internal logic**
22
25
  *
23
26
  * When the screenreader announcer is connected to the DOM, if the `identity` attribute is not
@@ -25,9 +28,25 @@ import styles from './screenreaderannouncer.styles';
25
28
  * in the DOM. If the `identity` attribute is provided, the identity element is used and no new element
26
29
  * is created in the DOM.
27
30
  *
31
+ * If you provide a custom `identity`, you must ensure that the element exists and is visually hidden.
32
+ *
33
+ * Example CSS:
34
+ *
35
+ * ```css
36
+ * #your-custom-announcer-id {
37
+ * clip: rect(0 0 0 0);
38
+ * clip-path: inset(50%);
39
+ * height: 1px;
40
+ * overflow: hidden;
41
+ * position: absolute;
42
+ * white-space: nowrap;
43
+ * width: 1px;
44
+ * }
45
+ * ```
46
+ *
28
47
  * When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with
29
48
  * `aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.
30
- * After delay of `delay` milliseconds, a <p> element with the announcement text is appended to the `<div>` element.
49
+ * After delay of `delay` milliseconds, a `<p>` element with the announcement text is appended to the `<div>` element.
31
50
  *
32
51
  * The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.
33
52
  *
@@ -37,6 +56,10 @@ import styles from './screenreaderannouncer.styles';
37
56
  * **Note**
38
57
  * 1. The default delay of 150 miliseconds is used as we dynamically generate the
39
58
  * aria-live region in the DOM and add the announcement text to it.
59
+ * 2. If multiple `mdc-screenreaderannouncer` instances use the same `identity`, `data-aria-live`
60
+ * for that identity is effectively determined by the first instance that creates announcements for it.
61
+ * Changing `data-aria-live` in later instances for the same identity will not update already-created
62
+ * live-region containers.
40
63
  * 3. If no `identity` is provided, all the screen reader components will create and use only one
41
64
  * `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.
42
65
  *
@@ -64,6 +87,10 @@ class ScreenreaderAnnouncer extends Component {
64
87
  /**
65
88
  * Aria live value for announcement.
66
89
  *
90
+ * For a shared `identity`, this value should be treated as immutable after initial usage.
91
+ * The first `mdc-screenreaderannouncer` instance that creates announcements for that
92
+ * identity determines the `aria-live` value for the created live-region containers.
93
+ *
67
94
  * @default 'polite'
68
95
  */
69
96
  this.dataAriaLive = DEFAULTS.ARIA_LIVE;
@@ -106,18 +133,19 @@ class ScreenreaderAnnouncer extends Component {
106
133
  * The div element is appended to the element in the DOM identified with id as
107
134
  * identity attribute.
108
135
  *
109
- * @param announcement - The announcement to be made.
110
- * @param delay - The delay in milliseconds before announcing the message.
111
- * @param timeout - The timeout in milliseconds before removing the announcement.
112
- * @param ariaLive - The aria live value for the announcement.
136
+ * @param options - Announcement configuration object with the following fields:
137
+ * - `announcement` (required): The announcement to be made.
138
+ * - `delay` (optional): The delay in milliseconds before announcing the message.
139
+ * - `timeout` (optional): The timeout in milliseconds before removing the announcement.
140
+ * - `ariaLive` (optional): The aria live value for the announcement.
113
141
  */
114
- announce(announcement, delay, timeout, ariaLive) {
142
+ announce({ announcement, delay, timeout, ariaLive, }) {
115
143
  var _a;
116
144
  if (announcement.length > 0) {
117
145
  const announcementId = `mdc-screenreaderannouncer-announcement-${uuidv4()}`;
118
146
  const announcementContainer = document.createElement('div');
119
147
  announcementContainer.setAttribute('id', announcementId);
120
- announcementContainer.setAttribute('aria-live', ariaLive);
148
+ announcementContainer.setAttribute('aria-live', ariaLive !== null && ariaLive !== void 0 ? ariaLive : this.dataAriaLive);
121
149
  (_a = this.getElementByIdAcrossShadowRoot(this.identity)) === null || _a === void 0 ? void 0 : _a.appendChild(announcementContainer);
122
150
  const timeOutId = window.setTimeout(() => {
123
151
  const announcementElement = document.createElement('p');
@@ -126,9 +154,9 @@ class ScreenreaderAnnouncer extends Component {
126
154
  this.ariaLiveAnnouncementIds.push(announcementId);
127
155
  const timeOutId = window.setTimeout(() => {
128
156
  announcementContainer.remove();
129
- }, timeout);
157
+ }, timeout !== null && timeout !== void 0 ? timeout : this.timeout);
130
158
  this.timeOutIds.push(timeOutId);
131
- }, delay);
159
+ }, delay !== null && delay !== void 0 ? delay : this.delay);
132
160
  this.timeOutIds.push(timeOutId);
133
161
  }
134
162
  }
@@ -224,7 +252,12 @@ class ScreenreaderAnnouncer extends Component {
224
252
  // create single debounced function that will read latest this.announcement when executed
225
253
  this.debouncedAnnounce = debounce(() => {
226
254
  if (this.announcement && this.announcement.length > 0) {
227
- this.announce(this.announcement, this.delay, this.timeout, this.dataAriaLive);
255
+ this.announce({
256
+ announcement: this.announcement,
257
+ delay: this.delay,
258
+ timeout: this.timeout,
259
+ ariaLive: this.dataAriaLive,
260
+ });
228
261
  this.announcement = '';
229
262
  }
230
263
  }, this.debounceTime);
@@ -18089,6 +18089,15 @@
18089
18089
  "module": "utils/mixins/FormInternalsMixin.js"
18090
18090
  }
18091
18091
  },
18092
+ {
18093
+ "kind": "field",
18094
+ "name": "shadowRootOptions",
18095
+ "type": {
18096
+ "text": "object"
18097
+ },
18098
+ "static": true,
18099
+ "default": "{ ...FormfieldWrapper.shadowRootOptions, delegatesFocus: true }"
18100
+ },
18092
18101
  {
18093
18102
  "kind": "field",
18094
18103
  "name": "size",
@@ -30551,6 +30560,19 @@
30551
30560
  "module": "utils/mixins/FormInternalsMixin.js"
30552
30561
  }
30553
30562
  },
30563
+ {
30564
+ "kind": "field",
30565
+ "name": "shadowRootOptions",
30566
+ "type": {
30567
+ "text": "object"
30568
+ },
30569
+ "static": true,
30570
+ "default": "{ ...FormfieldWrapper.shadowRootOptions, delegatesFocus: true }",
30571
+ "inheritedFrom": {
30572
+ "name": "Input",
30573
+ "module": "components/input/input.component.js"
30574
+ }
30575
+ },
30554
30576
  {
30555
30577
  "kind": "field",
30556
30578
  "name": "showButtonAriaLabel",
@@ -35565,40 +35587,23 @@
35565
35587
  "declarations": [
35566
35588
  {
35567
35589
  "kind": "class",
35568
- "description": "`mdc-screenreaderannouncer` can be used to announce messages with the screen reader.\n\nTo make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.\n\n**Internal logic**\n\nWhen the screenreader announcer is connected to the DOM, if the `identity` attribute is not\nprovided, it is set to `mdc-screenreaderannouncer-identity` and a `<div>` element with this id is created\nin the DOM. If the `identity` attribute is provided, the identity element is used and no new element\nis created in the DOM.\n\nWhen the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with\n`aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.\nAfter delay of `delay` milliseconds, a <p> element with the announcement text is appended to the `<div>` element.\n\nThe announcement `<div>` element is removed from the DOM after `timeout` milliseconds.\n\nWhen the screen announcer component is disconnected from the DOM, all the timeouts are cleared and\nall the announcement elements added are removed from the DOM and timeouts cleared.\n\n**Note**\n1. The default delay of 150 miliseconds is used as we dynamically generate the\naria-live region in the DOM and add the announcement text to it.\n3. If no `identity` is provided, all the screen reader components will create and use only one\n`<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.\n\nReference: https://patrickhlauke.github.io/aria/tests/live-regions/",
35590
+ "description": "`mdc-screenreaderannouncer` can be used to announce messages with the screen reader.\n\nTo make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.\n\nConsumers can also use the public `announce` function to trigger announcements programmatically\nby passing an options object where `announcement` is required and all other fields are optional.\n\n**Internal logic**\n\nWhen the screenreader announcer is connected to the DOM, if the `identity` attribute is not\nprovided, it is set to `mdc-screenreaderannouncer-identity` and a `<div>` element with this id is created\nin the DOM. If the `identity` attribute is provided, the identity element is used and no new element\nis created in the DOM.\n\nIf you provide a custom `identity`, you must ensure that the element exists and is visually hidden.\n\nExample CSS:\n\n```css\n#your-custom-announcer-id {\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n```\n\nWhen the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with\n`aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.\nAfter delay of `delay` milliseconds, a `<p>` element with the announcement text is appended to the `<div>` element.\n\nThe announcement `<div>` element is removed from the DOM after `timeout` milliseconds.\n\nWhen the screen announcer component is disconnected from the DOM, all the timeouts are cleared and\nall the announcement elements added are removed from the DOM and timeouts cleared.\n\n**Note**\n1. The default delay of 150 miliseconds is used as we dynamically generate the\naria-live region in the DOM and add the announcement text to it.\n2. If multiple `mdc-screenreaderannouncer` instances use the same `identity`, `data-aria-live`\nfor that identity is effectively determined by the first instance that creates announcements for it.\nChanging `data-aria-live` in later instances for the same identity will not update already-created\nlive-region containers.\n3. If no `identity` is provided, all the screen reader components will create and use only one\n`<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.\n\nReference: https://patrickhlauke.github.io/aria/tests/live-regions/",
35569
35591
  "name": "ScreenreaderAnnouncer",
35570
35592
  "members": [
35571
35593
  {
35572
35594
  "kind": "method",
35573
35595
  "name": "announce",
35596
+ "privacy": "public",
35574
35597
  "parameters": [
35575
35598
  {
35576
- "name": "announcement",
35577
- "type": {
35578
- "text": "string"
35579
- },
35580
- "description": "The announcement to be made."
35581
- },
35582
- {
35583
- "name": "delay",
35584
- "type": {
35585
- "text": "number"
35586
- },
35587
- "description": "The delay in milliseconds before announcing the message."
35588
- },
35589
- {
35590
- "name": "timeout",
35599
+ "name": "{\n announcement,\n delay,\n timeout,\n ariaLive,\n }",
35591
35600
  "type": {
35592
- "text": "number"
35593
- },
35594
- "description": "The timeout in milliseconds before removing the announcement."
35601
+ "text": "{\n announcement: string;\n delay?: number;\n timeout?: number;\n ariaLive?: AriaLive;\n }"
35602
+ }
35595
35603
  },
35596
35604
  {
35597
- "name": "ariaLive",
35598
- "type": {
35599
- "text": "AriaLive"
35600
- },
35601
- "description": "The aria live value for the announcement."
35605
+ "description": "Announcement configuration object with the following fields:\n- `announcement` (required): The announcement to be made.\n- `delay` (optional): The delay in milliseconds before announcing the message.\n- `timeout` (optional): The timeout in milliseconds before removing the announcement.\n- `ariaLive` (optional): The aria live value for the announcement.",
35606
+ "name": "options"
35602
35607
  }
35603
35608
  ],
35604
35609
  "description": "Announces the given announcement to the screen reader.\n\nA div element with aria-live attribute set to the given ariaLive value is created\nand a p element with the announcement text is appended to it.\n\nThe div element is appended to the element in the DOM identified with id as\nidentity attribute."
@@ -35632,7 +35637,7 @@
35632
35637
  "type": {
35633
35638
  "text": "AriaLive"
35634
35639
  },
35635
- "description": "Aria live value for announcement.",
35640
+ "description": "Aria live value for announcement.\n\nFor a shared `identity`, this value should be treated as immutable after initial usage.\nThe first `mdc-screenreaderannouncer` instance that creates announcements for that\nidentity determines the `aria-live` value for the created live-region containers.",
35636
35641
  "default": "'polite'",
35637
35642
  "attribute": "data-aria-live",
35638
35643
  "reflects": true
@@ -35712,7 +35717,7 @@
35712
35717
  "type": {
35713
35718
  "text": "AriaLive"
35714
35719
  },
35715
- "description": "Aria live value for announcement.",
35720
+ "description": "Aria live value for announcement.\n\nFor a shared `identity`, this value should be treated as immutable after initial usage.\nThe first `mdc-screenreaderannouncer` instance that creates announcements for that\nidentity determines the `aria-live` value for the created live-region containers.",
35716
35721
  "default": "'polite'",
35717
35722
  "fieldName": "dataAriaLive"
35718
35723
  },
@@ -35749,7 +35754,7 @@
35749
35754
  "module": "/src/models"
35750
35755
  },
35751
35756
  "tagName": "mdc-screenreaderannouncer",
35752
- "jsDoc": "/**\n * `mdc-screenreaderannouncer` can be used to announce messages with the screen reader.\n *\n * To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.\n *\n * **Internal logic**\n *\n * When the screenreader announcer is connected to the DOM, if the `identity` attribute is not\n * provided, it is set to `mdc-screenreaderannouncer-identity` and a `<div>` element with this id is created\n * in the DOM. If the `identity` attribute is provided, the identity element is used and no new element\n * is created in the DOM.\n *\n * When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with\n * `aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.\n * After delay of `delay` milliseconds, a <p> element with the announcement text is appended to the `<div>` element.\n *\n * The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.\n *\n * When the screen announcer component is disconnected from the DOM, all the timeouts are cleared and\n * all the announcement elements added are removed from the DOM and timeouts cleared.\n *\n * **Note**\n * 1. The default delay of 150 miliseconds is used as we dynamically generate the\n * aria-live region in the DOM and add the announcement text to it.\n * 3. If no `identity` is provided, all the screen reader components will create and use only one\n * `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.\n *\n * Reference: https://patrickhlauke.github.io/aria/tests/live-regions/\n *\n * @tagname mdc-screenreaderannouncer\n */",
35757
+ "jsDoc": "/**\n * `mdc-screenreaderannouncer` can be used to announce messages with the screen reader.\n *\n * To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.\n *\n * Consumers can also use the public `announce` function to trigger announcements programmatically\n * by passing an options object where `announcement` is required and all other fields are optional.\n *\n * **Internal logic**\n *\n * When the screenreader announcer is connected to the DOM, if the `identity` attribute is not\n * provided, it is set to `mdc-screenreaderannouncer-identity` and a `<div>` element with this id is created\n * in the DOM. If the `identity` attribute is provided, the identity element is used and no new element\n * is created in the DOM.\n *\n * If you provide a custom `identity`, you must ensure that the element exists and is visually hidden.\n *\n * Example CSS:\n *\n * ```css\n * #your-custom-announcer-id {\n * clip: rect(0 0 0 0);\n * clip-path: inset(50%);\n * height: 1px;\n * overflow: hidden;\n * position: absolute;\n * white-space: nowrap;\n * width: 1px;\n * }\n * ```\n *\n * When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with\n * `aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.\n * After delay of `delay` milliseconds, a `<p>` element with the announcement text is appended to the `<div>` element.\n *\n * The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.\n *\n * When the screen announcer component is disconnected from the DOM, all the timeouts are cleared and\n * all the announcement elements added are removed from the DOM and timeouts cleared.\n *\n * **Note**\n * 1. The default delay of 150 miliseconds is used as we dynamically generate the\n * aria-live region in the DOM and add the announcement text to it.\n * 2. If multiple `mdc-screenreaderannouncer` instances use the same `identity`, `data-aria-live`\n * for that identity is effectively determined by the first instance that creates announcements for it.\n * Changing `data-aria-live` in later instances for the same identity will not update already-created\n * live-region containers.\n * 3. If no `identity` is provided, all the screen reader components will create and use only one\n * `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.\n *\n * Reference: https://patrickhlauke.github.io/aria/tests/live-regions/\n *\n * @tagname mdc-screenreaderannouncer\n */",
35753
35758
  "customElement": true
35754
35759
  }
35755
35760
  ],
@@ -36629,6 +36634,19 @@
36629
36634
  "module": "utils/mixins/FormInternalsMixin.js"
36630
36635
  }
36631
36636
  },
36637
+ {
36638
+ "kind": "field",
36639
+ "name": "shadowRootOptions",
36640
+ "type": {
36641
+ "text": "object"
36642
+ },
36643
+ "static": true,
36644
+ "default": "{ ...FormfieldWrapper.shadowRootOptions, delegatesFocus: true }",
36645
+ "inheritedFrom": {
36646
+ "name": "Input",
36647
+ "module": "components/input/input.component.js"
36648
+ }
36649
+ },
36632
36650
  {
36633
36651
  "kind": "field",
36634
36652
  "name": "size",
@@ -38195,6 +38213,19 @@
38195
38213
  "module": "utils/mixins/FormInternalsMixin.js"
38196
38214
  }
38197
38215
  },
38216
+ {
38217
+ "kind": "field",
38218
+ "name": "shadowRootOptions",
38219
+ "type": {
38220
+ "text": "object"
38221
+ },
38222
+ "static": true,
38223
+ "default": "{ ...FormfieldWrapper.shadowRootOptions, delegatesFocus: true }",
38224
+ "inheritedFrom": {
38225
+ "name": "Input",
38226
+ "module": "components/input/input.component.js"
38227
+ }
38228
+ },
38198
38229
  {
38199
38230
  "kind": "field",
38200
38231
  "name": "size",
@@ -4,6 +4,9 @@ import Component from '../../components/screenreaderannouncer';
4
4
  *
5
5
  * To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.
6
6
  *
7
+ * Consumers can also use the public `announce` function to trigger announcements programmatically
8
+ * by passing an options object where `announcement` is required and all other fields are optional.
9
+ *
7
10
  * **Internal logic**
8
11
  *
9
12
  * When the screenreader announcer is connected to the DOM, if the `identity` attribute is not
@@ -11,9 +14,25 @@ import Component from '../../components/screenreaderannouncer';
11
14
  * in the DOM. If the `identity` attribute is provided, the identity element is used and no new element
12
15
  * is created in the DOM.
13
16
  *
17
+ * If you provide a custom `identity`, you must ensure that the element exists and is visually hidden.
18
+ *
19
+ * Example CSS:
20
+ *
21
+ * ```css
22
+ * #your-custom-announcer-id {
23
+ * clip: rect(0 0 0 0);
24
+ * clip-path: inset(50%);
25
+ * height: 1px;
26
+ * overflow: hidden;
27
+ * position: absolute;
28
+ * white-space: nowrap;
29
+ * width: 1px;
30
+ * }
31
+ * ```
32
+ *
14
33
  * When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with
15
34
  * `aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.
16
- * After delay of `delay` milliseconds, a <p> element with the announcement text is appended to the `<div>` element.
35
+ * After delay of `delay` milliseconds, a `<p>` element with the announcement text is appended to the `<div>` element.
17
36
  *
18
37
  * The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.
19
38
  *
@@ -23,6 +42,10 @@ import Component from '../../components/screenreaderannouncer';
23
42
  * **Note**
24
43
  * 1. The default delay of 150 miliseconds is used as we dynamically generate the
25
44
  * aria-live region in the DOM and add the announcement text to it.
45
+ * 2. If multiple `mdc-screenreaderannouncer` instances use the same `identity`, `data-aria-live`
46
+ * for that identity is effectively determined by the first instance that creates announcements for it.
47
+ * Changing `data-aria-live` in later instances for the same identity will not update already-created
48
+ * live-region containers.
26
49
  * 3. If no `identity` is provided, all the screen reader components will create and use only one
27
50
  * `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.
28
51
  *
@@ -7,6 +7,9 @@ import { TAG_NAME } from '../../components/screenreaderannouncer/screenreaderann
7
7
  *
8
8
  * To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.
9
9
  *
10
+ * Consumers can also use the public `announce` function to trigger announcements programmatically
11
+ * by passing an options object where `announcement` is required and all other fields are optional.
12
+ *
10
13
  * **Internal logic**
11
14
  *
12
15
  * When the screenreader announcer is connected to the DOM, if the `identity` attribute is not
@@ -14,9 +17,25 @@ import { TAG_NAME } from '../../components/screenreaderannouncer/screenreaderann
14
17
  * in the DOM. If the `identity` attribute is provided, the identity element is used and no new element
15
18
  * is created in the DOM.
16
19
  *
20
+ * If you provide a custom `identity`, you must ensure that the element exists and is visually hidden.
21
+ *
22
+ * Example CSS:
23
+ *
24
+ * ```css
25
+ * #your-custom-announcer-id {
26
+ * clip: rect(0 0 0 0);
27
+ * clip-path: inset(50%);
28
+ * height: 1px;
29
+ * overflow: hidden;
30
+ * position: absolute;
31
+ * white-space: nowrap;
32
+ * width: 1px;
33
+ * }
34
+ * ```
35
+ *
17
36
  * When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with
18
37
  * `aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.
19
- * After delay of `delay` milliseconds, a <p> element with the announcement text is appended to the `<div>` element.
38
+ * After delay of `delay` milliseconds, a `<p>` element with the announcement text is appended to the `<div>` element.
20
39
  *
21
40
  * The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.
22
41
  *
@@ -26,6 +45,10 @@ import { TAG_NAME } from '../../components/screenreaderannouncer/screenreaderann
26
45
  * **Note**
27
46
  * 1. The default delay of 150 miliseconds is used as we dynamically generate the
28
47
  * aria-live region in the DOM and add the announcement text to it.
48
+ * 2. If multiple `mdc-screenreaderannouncer` instances use the same `identity`, `data-aria-live`
49
+ * for that identity is effectively determined by the first instance that creates announcements for it.
50
+ * Changing `data-aria-live` in later instances for the same identity will not update already-created
51
+ * live-region containers.
29
52
  * 3. If no `identity` is provided, all the screen reader components will create and use only one
30
53
  * `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.
31
54
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.131.4",
4
+ "version": "0.131.6",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"