@momentum-design/components 0.46.1 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +156 -141
- package/dist/browser/index.js.map +4 -4
- package/dist/components/screenreaderannouncer/index.d.ts +7 -0
- package/dist/components/screenreaderannouncer/index.js +4 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.d.ts +110 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +212 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.constants.d.ts +13 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.constants.js +14 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.d.ts +2 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.js +8 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.types.d.ts +3 -0
- package/dist/components/screenreaderannouncer/screenreaderannouncer.types.js +1 -0
- package/dist/custom-elements.json +484 -305
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +4 -3
- package/dist/react/screenreaderannouncer/index.d.ts +34 -0
- package/dist/react/screenreaderannouncer/index.js +43 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -36,6 +36,7 @@ import Textarea from './components/textarea';
|
|
36
36
|
import Searchfield from './components/searchfield';
|
37
37
|
import Brandvisual from './components/brandvisual';
|
38
38
|
import Appheader from './components/appheader';
|
39
|
+
import ScreenreaderAnnouncer from './components/screenreaderannouncer';
|
39
40
|
import type { SpinnerSize, SpinnerVariant } from './components/spinner/spinner.types';
|
40
41
|
import type { TextType } from './components/text/text.types';
|
41
42
|
import type { PopoverPlacement } from './components/popover/popover.types';
|
@@ -43,6 +44,6 @@ import type { BadgeType } from './components/badge/badge.types';
|
|
43
44
|
import type { IconButtonSize, PillButtonSize, ButtonVariant, ButtonColor } from './components/button/button.types';
|
44
45
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES } from './components/button/button.constants';
|
45
46
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
46
|
-
export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker, Popover, Presence, Radio, RadioGroup, Spinner, Tab, Text, ThemeProvider, Toggle, VirtualizedList, Option, OptGroup, Progressbar, Textarea, Tooltip, Searchfield, Brandvisual, Appheader, };
|
47
|
+
export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker, Popover, Presence, Radio, RadioGroup, Spinner, Tab, Text, ThemeProvider, Toggle, VirtualizedList, Option, OptGroup, Progressbar, ScreenreaderAnnouncer, Textarea, Tooltip, Searchfield, Brandvisual, Appheader, };
|
47
48
|
export type { TextType, SpinnerSize, SpinnerVariant, PopoverPlacement, BadgeType, IconButtonSize, PillButtonSize, ButtonVariant, ButtonColor, };
|
48
49
|
export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
|
package/dist/index.js
CHANGED
@@ -37,10 +37,11 @@ import Textarea from './components/textarea';
|
|
37
37
|
import Searchfield from './components/searchfield';
|
38
38
|
import Brandvisual from './components/brandvisual';
|
39
39
|
import Appheader from './components/appheader';
|
40
|
+
import ScreenreaderAnnouncer from './components/screenreaderannouncer';
|
40
41
|
// Constants / Utils Imports
|
41
42
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './components/button/button.constants';
|
42
43
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
43
44
|
// Components Exports
|
44
|
-
export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker, Popover, Presence, Radio, RadioGroup, Spinner, Tab, Text, ThemeProvider, Toggle, VirtualizedList, Option, OptGroup, Progressbar, Textarea, Tooltip, Searchfield, Brandvisual, Appheader, };
|
45
|
+
export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker, Popover, Presence, Radio, RadioGroup, Spinner, Tab, Text, ThemeProvider, Toggle, VirtualizedList, Option, OptGroup, Progressbar, ScreenreaderAnnouncer, Textarea, Tooltip, Searchfield, Brandvisual, Appheader, };
|
45
46
|
// Constants / Utils Exports
|
46
47
|
export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
|
package/dist/react/index.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
export { default as AlertChip } from './alertchip';
|
2
|
-
export { default as Avatar } from './avatar';
|
3
2
|
export { default as Appheader } from './appheader';
|
3
|
+
export { default as Avatar } from './avatar';
|
4
4
|
export { default as AvatarButton } from './avatarbutton';
|
5
5
|
export { default as Badge } from './badge';
|
6
|
-
export { default as Button } from './button';
|
7
|
-
export { default as Buttonsimple } from './buttonsimple';
|
8
6
|
export { default as Brandvisual } from './brandvisual';
|
9
7
|
export { default as Bullet } from './bullet';
|
8
|
+
export { default as Button } from './button';
|
9
|
+
export { default as Buttonsimple } from './buttonsimple';
|
10
10
|
export { default as Checkbox } from './checkbox';
|
11
11
|
export { default as Chip } from './chip';
|
12
12
|
export { default as Coachmark } from './coachmark';
|
@@ -29,6 +29,7 @@ export { default as Presence } from './presence';
|
|
29
29
|
export { default as Progressbar } from './progressbar';
|
30
30
|
export { default as Radio } from './radio';
|
31
31
|
export { default as RadioGroup } from './radiogroup';
|
32
|
+
export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
|
32
33
|
export { default as Searchfield } from './searchfield';
|
33
34
|
export { default as Spinner } from './spinner';
|
34
35
|
export { default as Tab } from './tab';
|
package/dist/react/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
export { default as AlertChip } from './alertchip';
|
2
|
-
export { default as Avatar } from './avatar';
|
3
2
|
export { default as Appheader } from './appheader';
|
3
|
+
export { default as Avatar } from './avatar';
|
4
4
|
export { default as AvatarButton } from './avatarbutton';
|
5
5
|
export { default as Badge } from './badge';
|
6
|
-
export { default as Button } from './button';
|
7
|
-
export { default as Buttonsimple } from './buttonsimple';
|
8
6
|
export { default as Brandvisual } from './brandvisual';
|
9
7
|
export { default as Bullet } from './bullet';
|
8
|
+
export { default as Button } from './button';
|
9
|
+
export { default as Buttonsimple } from './buttonsimple';
|
10
10
|
export { default as Checkbox } from './checkbox';
|
11
11
|
export { default as Chip } from './chip';
|
12
12
|
export { default as Coachmark } from './coachmark';
|
@@ -29,6 +29,7 @@ export { default as Presence } from './presence';
|
|
29
29
|
export { default as Progressbar } from './progressbar';
|
30
30
|
export { default as Radio } from './radio';
|
31
31
|
export { default as RadioGroup } from './radiogroup';
|
32
|
+
export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
|
32
33
|
export { default as Searchfield } from './searchfield';
|
33
34
|
export { default as Spinner } from './spinner';
|
34
35
|
export { default as Tab } from './tab';
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import Component from '../../components/screenreaderannouncer';
|
2
|
+
/**
|
3
|
+
* `mdc-screenreaderannouncer` can be used to announce messages with the screen reader.
|
4
|
+
*
|
5
|
+
* To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.
|
6
|
+
*
|
7
|
+
* **Internal logic**
|
8
|
+
*
|
9
|
+
* When the screenreader announcer is connected to the DOM, if the `identity` attribute is not
|
10
|
+
* provided, it is set to `mdc-screenreaderannouncer-identity` and a `<div>` element with this id is created
|
11
|
+
* in the DOM. If the `identity` attribute is provided, the identity element is used and no new element
|
12
|
+
* is created in the DOM.
|
13
|
+
*
|
14
|
+
* When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with
|
15
|
+
* `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.
|
17
|
+
*
|
18
|
+
* The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.
|
19
|
+
*
|
20
|
+
* When the screen announcer component is disconnected from the DOM, all the timeouts are cleared and
|
21
|
+
* all the announcement elements added are removed from the DOM and timeouts cleared.
|
22
|
+
*
|
23
|
+
* **Note**
|
24
|
+
* 1. The default delay of 150 miliseconds is used as we dynamically generate the
|
25
|
+
* aria-live region in the DOM and add the announcement text to it.
|
26
|
+
* 3. If no `identity` is provided, all the screen reader components will create and use only one
|
27
|
+
* `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.
|
28
|
+
*
|
29
|
+
* Reference: https://patrickhlauke.github.io/aria/tests/live-regions/
|
30
|
+
*
|
31
|
+
* @tagname mdc-screenreaderannouncer
|
32
|
+
*/
|
33
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
34
|
+
export default reactWrapper;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createComponent } from '@lit/react';
|
3
|
+
import Component from '../../components/screenreaderannouncer';
|
4
|
+
import { TAG_NAME } from '../../components/screenreaderannouncer/screenreaderannouncer.constants';
|
5
|
+
/**
|
6
|
+
* `mdc-screenreaderannouncer` can be used to announce messages with the screen reader.
|
7
|
+
*
|
8
|
+
* To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.
|
9
|
+
*
|
10
|
+
* **Internal logic**
|
11
|
+
*
|
12
|
+
* When the screenreader announcer is connected to the DOM, if the `identity` attribute is not
|
13
|
+
* provided, it is set to `mdc-screenreaderannouncer-identity` and a `<div>` element with this id is created
|
14
|
+
* in the DOM. If the `identity` attribute is provided, the identity element is used and no new element
|
15
|
+
* is created in the DOM.
|
16
|
+
*
|
17
|
+
* When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with
|
18
|
+
* `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.
|
20
|
+
*
|
21
|
+
* The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.
|
22
|
+
*
|
23
|
+
* When the screen announcer component is disconnected from the DOM, all the timeouts are cleared and
|
24
|
+
* all the announcement elements added are removed from the DOM and timeouts cleared.
|
25
|
+
*
|
26
|
+
* **Note**
|
27
|
+
* 1. The default delay of 150 miliseconds is used as we dynamically generate the
|
28
|
+
* aria-live region in the DOM and add the announcement text to it.
|
29
|
+
* 3. If no `identity` is provided, all the screen reader components will create and use only one
|
30
|
+
* `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.
|
31
|
+
*
|
32
|
+
* Reference: https://patrickhlauke.github.io/aria/tests/live-regions/
|
33
|
+
*
|
34
|
+
* @tagname mdc-screenreaderannouncer
|
35
|
+
*/
|
36
|
+
const reactWrapper = createComponent({
|
37
|
+
tagName: TAG_NAME,
|
38
|
+
elementClass: Component,
|
39
|
+
react: React,
|
40
|
+
events: {},
|
41
|
+
displayName: 'ScreenreaderAnnouncer',
|
42
|
+
});
|
43
|
+
export default reactWrapper;
|
package/package.json
CHANGED