@momentum-design/components 0.18.1 → 0.18.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/index.js +30 -25
- package/dist/browser/index.js.map +3 -3
- package/dist/components/formfieldwrapper/formfieldwrapper.component.d.ts +2 -2
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +7 -13
- package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +6 -2
- package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.d.ts +1 -0
- package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.js +15 -0
- package/dist/components/icon/icon.component.d.ts +10 -12
- package/dist/components/icon/icon.component.js +17 -40
- package/dist/components/icon/icon.styles.js +7 -4
- package/dist/components/icon/icon.utils.js +2 -0
- package/dist/custom-elements.json +37 -29
- package/dist/react/icon/index.d.ts +9 -2
- package/dist/react/icon/index.js +9 -2
- package/dist/utils/styles/index.js +3 -0
- package/package.json +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import { CSSResult, nothing } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
3
|
import type { ValidationType } from './formfieldwrapper.types';
|
4
|
+
declare const FormfieldWrapper_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
4
5
|
/**
|
5
6
|
* formfieldwrapper is a component that contains the label and helper/validation text
|
6
7
|
* that can be configured in various ways to suit different use cases (most of the input related components).
|
@@ -11,7 +12,7 @@ import type { ValidationType } from './formfieldwrapper.types';
|
|
11
12
|
* @slot label-info - slot to add the label info icon
|
12
13
|
*
|
13
14
|
*/
|
14
|
-
declare class FormfieldWrapper extends
|
15
|
+
declare class FormfieldWrapper extends FormfieldWrapper_base {
|
15
16
|
/**
|
16
17
|
* The label of the input field. It is linked to the input field using the `for` attribute.
|
17
18
|
*/
|
@@ -57,7 +58,6 @@ declare class FormfieldWrapper extends Component {
|
|
57
58
|
* @returns void
|
58
59
|
*/
|
59
60
|
protected renderHelperText(): import("lit-html").TemplateResult<1>;
|
60
|
-
render(): import("lit-html").TemplateResult<1>;
|
61
61
|
static styles: Array<CSSResult>;
|
62
62
|
}
|
63
63
|
export default FormfieldWrapper;
|
@@ -14,6 +14,7 @@ import styles from './formfieldwrapper.styles';
|
|
14
14
|
import { Component } from '../../models';
|
15
15
|
import { DEFAULTS, MDC_TEXT_OPTIONS } from './formfieldwrapper.constants';
|
16
16
|
import { getHelperIcon } from './formfieldwrapper.utils';
|
17
|
+
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
17
18
|
/**
|
18
19
|
* formfieldwrapper is a component that contains the label and helper/validation text
|
19
20
|
* that can be configured in various ways to suit different use cases (most of the input related components).
|
@@ -24,7 +25,7 @@ import { getHelperIcon } from './formfieldwrapper.utils';
|
|
24
25
|
* @slot label-info - slot to add the label info icon
|
25
26
|
*
|
26
27
|
*/
|
27
|
-
class FormfieldWrapper extends Component {
|
28
|
+
class FormfieldWrapper extends DisabledMixin(Component) {
|
28
29
|
constructor() {
|
29
30
|
super(...arguments);
|
30
31
|
/**
|
@@ -46,7 +47,7 @@ class FormfieldWrapper extends Component {
|
|
46
47
|
if (!this.label) {
|
47
48
|
return nothing;
|
48
49
|
}
|
49
|
-
return html `<label for="${this.id}" class="mdc-label" part="
|
50
|
+
return html `<label for="${this.id}" class="mdc-label" part="label">${this.label}</label>`;
|
50
51
|
}
|
51
52
|
/**
|
52
53
|
* creates the helpertext icon based on the helpTextType for validation.
|
@@ -58,8 +59,8 @@ class FormfieldWrapper extends Component {
|
|
58
59
|
return nothing;
|
59
60
|
}
|
60
61
|
const helperIcon = getHelperIcon(this.helpTextType || DEFAULTS.VALIDATION);
|
61
|
-
if (helperIcon) {
|
62
|
-
return html `<mdc-icon part="
|
62
|
+
if (helperIcon && !this.disabled) {
|
63
|
+
return html `<mdc-icon part="helper-icon" size="1" length-unit="rem" name=${helperIcon}></mdc-icon>`;
|
63
64
|
}
|
64
65
|
return nothing;
|
65
66
|
}
|
@@ -74,7 +75,7 @@ class FormfieldWrapper extends Component {
|
|
74
75
|
}
|
75
76
|
return html `
|
76
77
|
<mdc-text
|
77
|
-
part="
|
78
|
+
part="help-text"
|
78
79
|
tagname=${MDC_TEXT_OPTIONS.TAGNAME}
|
79
80
|
type=${MDC_TEXT_OPTIONS.TYPE}
|
80
81
|
>
|
@@ -87,7 +88,7 @@ class FormfieldWrapper extends Component {
|
|
87
88
|
* @returns void
|
88
89
|
*/
|
89
90
|
renderLabel() {
|
90
|
-
return html `<div class="mdc-label-text" part="
|
91
|
+
return html `<div class="mdc-label-text" part="label-text">
|
91
92
|
<slot name="label">${this.renderLabelElement()}</slot>
|
92
93
|
<slot name="label-info"></slot>
|
93
94
|
</div>`;
|
@@ -102,13 +103,6 @@ class FormfieldWrapper extends Component {
|
|
102
103
|
<slot name="help-text">${this.renderHelpText()}</slot>
|
103
104
|
</div>`;
|
104
105
|
}
|
105
|
-
render() {
|
106
|
-
return html `
|
107
|
-
${this.renderLabel()}
|
108
|
-
<slot></slot>
|
109
|
-
${this.renderHelperText()}
|
110
|
-
`;
|
111
|
-
}
|
112
106
|
}
|
113
107
|
FormfieldWrapper.styles = [...Component.styles, ...styles];
|
114
108
|
__decorate([
|
@@ -8,9 +8,13 @@ const styles = [
|
|
8
8
|
align-items: flex-start;
|
9
9
|
gap: 0.5rem;
|
10
10
|
}
|
11
|
-
|
11
|
+
:host([disabled]),
|
12
12
|
:host([disabled]) .mdc-label,
|
13
|
-
:host([disabled]) .mdc-help-text
|
13
|
+
:host([disabled]) .mdc-help-text,
|
14
|
+
:host([disabled][help-text-type='error']) .mdc-help-text,
|
15
|
+
:host([disabled][help-text-type='success']) .mdc-help-text,
|
16
|
+
:host([disabled][help-text-type='warning']) .mdc-help-text,
|
17
|
+
:host([disabled][help-text-type='priority']) .mdc-help-text {
|
14
18
|
color: var(--mds-color-theme-text-primary-disabled);
|
15
19
|
}
|
16
20
|
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { html } from 'lit';
|
2
|
+
import FormfieldWrapper from './formfieldwrapper.component';
|
3
|
+
// Subcomponent to be rendered in E2E Tests, to showcase that the
|
4
|
+
// theme can be consumed as a subcomponent
|
5
|
+
// (this file is imported in the esbuild config for e2e tests ('/config/esbuild/esbuild-e2e.config.js'))
|
6
|
+
class SubComponentFormFieldWrapper extends FormfieldWrapper {
|
7
|
+
render() {
|
8
|
+
return html `
|
9
|
+
${this.renderLabel()}
|
10
|
+
<slot></slot>
|
11
|
+
${this.renderHelperText()}
|
12
|
+
`;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
SubComponentFormFieldWrapper.register('mdc-subcomponent-formfieldwrapper');
|
@@ -19,7 +19,7 @@ import type { IconNames } from './icon.types';
|
|
19
19
|
* if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be
|
20
20
|
* `width: 1em; height: 1em`.
|
21
21
|
*
|
22
|
-
* Regarding accessibility, there are
|
22
|
+
* Regarding accessibility, there are three types of icons: decorative, informative and informative standalone.
|
23
23
|
*
|
24
24
|
* ### Decorative Icons
|
25
25
|
* - Decorative icons do not convey any essential information to the content of a page.
|
@@ -30,10 +30,17 @@ import type { IconNames } from './icon.types';
|
|
30
30
|
* - Informative icons convey important information that is not adequately represented
|
31
31
|
* by surrounding text or components.
|
32
32
|
* - They provide valuable context and must be announced by assistive technologies.
|
33
|
-
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img".
|
33
|
+
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img" automatically.
|
34
34
|
* - If an `aria-label` is provided, the role will be set to 'img'; if it is absent,
|
35
35
|
* the role will be unset.
|
36
36
|
*
|
37
|
+
* ### Informative Standalone Icons
|
38
|
+
* - If an icon is informative (as mentioned above) and does not belong to a button (=standalone), it must
|
39
|
+
* have a Tooltip that describes what it means.
|
40
|
+
* - For informative standalone icons, an `aria-label` & `tabindex="0"` is required,
|
41
|
+
* and the `role` will be set to "img" automatically.
|
42
|
+
* - **Only use this when a Icon is standalone and is not part of a button or other interactive elements.**
|
43
|
+
*
|
37
44
|
* @tagname mdc-icon
|
38
45
|
*
|
39
46
|
* @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.
|
@@ -61,11 +68,6 @@ declare class Icon extends Component {
|
|
61
68
|
private readonly iconProviderContext;
|
62
69
|
private abortController;
|
63
70
|
constructor();
|
64
|
-
/**
|
65
|
-
* Dispatches a 'load' event on the component once the icon has been successfully loaded.
|
66
|
-
* This event bubbles and is cancelable.
|
67
|
-
*/
|
68
|
-
private triggerIconLoaded;
|
69
71
|
/**
|
70
72
|
* Get Icon Data function which will fetch the icon (currently only svg)
|
71
73
|
* and sets state and attributes once fetched successfully
|
@@ -76,8 +78,7 @@ declare class Icon extends Component {
|
|
76
78
|
*/
|
77
79
|
private getIconData;
|
78
80
|
/**
|
79
|
-
* Sets the iconData state to the fetched icon
|
80
|
-
* and calls functions to set role, aria-label and aria-hidden attributes on the icon.
|
81
|
+
* Sets the iconData state to the fetched icon.
|
81
82
|
* Dispatches a 'load' event on the component once the icon has been successfully loaded.
|
82
83
|
* @param iconHtml - The icon html element which has been fetched from the icon provider.
|
83
84
|
*/
|
@@ -92,9 +93,6 @@ declare class Icon extends Component {
|
|
92
93
|
* Updates the size by setting the width and height
|
93
94
|
*/
|
94
95
|
private updateSize;
|
95
|
-
private setRoleOnIcon;
|
96
|
-
private setAriaHiddenOnIcon;
|
97
|
-
private setAriaLabelOnIcon;
|
98
96
|
private get computedIconSize();
|
99
97
|
updated(changedProperties: Map<string, any>): void;
|
100
98
|
render(): import("lit-html").TemplateResult<1>;
|
@@ -33,7 +33,7 @@ import { DEFAULTS } from './icon.constants';
|
|
33
33
|
* if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be
|
34
34
|
* `width: 1em; height: 1em`.
|
35
35
|
*
|
36
|
-
* Regarding accessibility, there are
|
36
|
+
* Regarding accessibility, there are three types of icons: decorative, informative and informative standalone.
|
37
37
|
*
|
38
38
|
* ### Decorative Icons
|
39
39
|
* - Decorative icons do not convey any essential information to the content of a page.
|
@@ -44,10 +44,17 @@ import { DEFAULTS } from './icon.constants';
|
|
44
44
|
* - Informative icons convey important information that is not adequately represented
|
45
45
|
* by surrounding text or components.
|
46
46
|
* - They provide valuable context and must be announced by assistive technologies.
|
47
|
-
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img".
|
47
|
+
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img" automatically.
|
48
48
|
* - If an `aria-label` is provided, the role will be set to 'img'; if it is absent,
|
49
49
|
* the role will be unset.
|
50
50
|
*
|
51
|
+
* ### Informative Standalone Icons
|
52
|
+
* - If an icon is informative (as mentioned above) and does not belong to a button (=standalone), it must
|
53
|
+
* have a Tooltip that describes what it means.
|
54
|
+
* - For informative standalone icons, an `aria-label` & `tabindex="0"` is required,
|
55
|
+
* and the `role` will be set to "img" automatically.
|
56
|
+
* - **Only use this when a Icon is standalone and is not part of a button or other interactive elements.**
|
57
|
+
*
|
51
58
|
* @tagname mdc-icon
|
52
59
|
*
|
53
60
|
* @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.
|
@@ -66,17 +73,6 @@ class Icon extends Component {
|
|
66
73
|
this.iconProviderContext = providerUtils.consume({ host: this, context: IconProvider.Context });
|
67
74
|
this.abortController = new AbortController(); // Initialize AbortController
|
68
75
|
}
|
69
|
-
/**
|
70
|
-
* Dispatches a 'load' event on the component once the icon has been successfully loaded.
|
71
|
-
* This event bubbles and is cancelable.
|
72
|
-
*/
|
73
|
-
triggerIconLoaded() {
|
74
|
-
const loadEvent = new Event('load', {
|
75
|
-
bubbles: true,
|
76
|
-
cancelable: true,
|
77
|
-
});
|
78
|
-
this.dispatchEvent(loadEvent);
|
79
|
-
}
|
80
76
|
/**
|
81
77
|
* Get Icon Data function which will fetch the icon (currently only svg)
|
82
78
|
* and sets state and attributes once fetched successfully
|
@@ -102,19 +98,19 @@ class Icon extends Component {
|
|
102
98
|
}
|
103
99
|
}
|
104
100
|
/**
|
105
|
-
* Sets the iconData state to the fetched icon
|
106
|
-
* and calls functions to set role, aria-label and aria-hidden attributes on the icon.
|
101
|
+
* Sets the iconData state to the fetched icon.
|
107
102
|
* Dispatches a 'load' event on the component once the icon has been successfully loaded.
|
108
103
|
* @param iconHtml - The icon html element which has been fetched from the icon provider.
|
109
104
|
*/
|
110
105
|
handleIconLoadedSuccess(iconHtml) {
|
111
106
|
// update iconData state once fetched:
|
112
107
|
this.iconData = iconHtml;
|
113
|
-
// when icon is fetched successfully,
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
108
|
+
// when icon is fetched successfully, trigger icon load event.
|
109
|
+
const loadEvent = new Event('load', {
|
110
|
+
bubbles: true,
|
111
|
+
cancelable: true,
|
112
|
+
});
|
113
|
+
this.dispatchEvent(loadEvent);
|
118
114
|
}
|
119
115
|
/**
|
120
116
|
* Dispatches an 'error' event on the component when the icon fetching has failed.
|
@@ -140,24 +136,6 @@ class Icon extends Component {
|
|
140
136
|
this.style.setProperty('--computed-icon-size', value);
|
141
137
|
}
|
142
138
|
}
|
143
|
-
setRoleOnIcon() {
|
144
|
-
this.role = this.ariaLabel ? 'img' : null;
|
145
|
-
}
|
146
|
-
setAriaHiddenOnIcon() {
|
147
|
-
var _a;
|
148
|
-
// set aria-hidden=true for SVG to avoid screen readers
|
149
|
-
(_a = this.iconData) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-hidden', 'true');
|
150
|
-
}
|
151
|
-
setAriaLabelOnIcon() {
|
152
|
-
var _a, _b;
|
153
|
-
if (this.ariaLabel) {
|
154
|
-
// pass through aria-label attribute to svg if set on mdc-icon
|
155
|
-
(_a = this.iconData) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-label', this.ariaLabel);
|
156
|
-
}
|
157
|
-
else {
|
158
|
-
(_b = this.iconData) === null || _b === void 0 ? void 0 : _b.removeAttribute('aria-label');
|
159
|
-
}
|
160
|
-
}
|
161
139
|
get computedIconSize() {
|
162
140
|
var _a, _b;
|
163
141
|
return (_b = (_a = this.size) !== null && _a !== void 0 ? _a : this.sizeFromContext) !== null && _b !== void 0 ? _b : DEFAULTS.SIZE;
|
@@ -174,8 +152,7 @@ class Icon extends Component {
|
|
174
152
|
});
|
175
153
|
}
|
176
154
|
if (changedProperties.has('ariaLabel')) {
|
177
|
-
this.
|
178
|
-
this.setAriaLabelOnIcon();
|
155
|
+
this.role = this.ariaLabel ? 'img' : null;
|
179
156
|
}
|
180
157
|
if (changedProperties.has('size') || changedProperties.has('lengthUnit')) {
|
181
158
|
this.updateSize();
|
@@ -1,14 +1,16 @@
|
|
1
1
|
import { css } from 'lit';
|
2
|
-
import { hostFitContentStyles } from '../../utils/styles';
|
2
|
+
import { hostFitContentStyles, hostFocusRingStyles } from '../../utils/styles';
|
3
3
|
const styles = [
|
4
4
|
hostFitContentStyles,
|
5
5
|
css `
|
6
6
|
:host {
|
7
7
|
--mdc-icon-fill-color: currentColor;
|
8
|
-
--mdc-icon-
|
8
|
+
--mdc-icon-size: var(--computed-icon-size);
|
9
|
+
--mdc-icon-border-radius: 0.25rem;
|
9
10
|
|
10
|
-
height: var(--mdc-icon-
|
11
|
-
width: var(--mdc-icon-
|
11
|
+
height: var(--mdc-icon-size);
|
12
|
+
width: var(--mdc-icon-size);
|
13
|
+
border-radius: var(--mdc-icon-border-radius);
|
12
14
|
}
|
13
15
|
:host::part(icon) {
|
14
16
|
height: 100%;
|
@@ -16,5 +18,6 @@ const styles = [
|
|
16
18
|
fill: var(--mdc-icon-fill-color);
|
17
19
|
}
|
18
20
|
`,
|
21
|
+
...hostFocusRingStyles(),
|
19
22
|
];
|
20
23
|
export default styles;
|
@@ -20,6 +20,8 @@ const dynamicSVGImport = async (url, name, fileExtension, signal) => {
|
|
20
20
|
const returnValue = new DOMParser().parseFromString(iconResponse, 'text/html').body.children[0];
|
21
21
|
returnValue.setAttribute('data-name', name);
|
22
22
|
returnValue.setAttribute('part', 'icon');
|
23
|
+
// set aria-hidden=true for SVG to avoid screen readers
|
24
|
+
returnValue.setAttribute('aria-hidden', 'true');
|
23
25
|
return returnValue;
|
24
26
|
};
|
25
27
|
export { dynamicSVGImport };
|
@@ -2265,6 +2265,21 @@
|
|
2265
2265
|
"text": ""
|
2266
2266
|
}
|
2267
2267
|
}
|
2268
|
+
},
|
2269
|
+
{
|
2270
|
+
"kind": "field",
|
2271
|
+
"name": "disabled",
|
2272
|
+
"type": {
|
2273
|
+
"text": "boolean"
|
2274
|
+
},
|
2275
|
+
"default": "false",
|
2276
|
+
"description": "Indicates whether the component is disabled.\nWhen the component is disabled for user interaction; it is not focusable or clickable.",
|
2277
|
+
"attribute": "disabled",
|
2278
|
+
"reflects": true,
|
2279
|
+
"inheritedFrom": {
|
2280
|
+
"name": "DisabledMixin",
|
2281
|
+
"module": "utils/mixins/DisabledMixin.js"
|
2282
|
+
}
|
2268
2283
|
}
|
2269
2284
|
],
|
2270
2285
|
"attributes": [
|
@@ -2297,6 +2312,25 @@
|
|
2297
2312
|
},
|
2298
2313
|
"description": "The help text that is displayed below the input field.",
|
2299
2314
|
"fieldName": "helpText"
|
2315
|
+
},
|
2316
|
+
{
|
2317
|
+
"name": "disabled",
|
2318
|
+
"type": {
|
2319
|
+
"text": "boolean"
|
2320
|
+
},
|
2321
|
+
"default": "false",
|
2322
|
+
"description": "Indicates whether the component is disabled.\nWhen the component is disabled for user interaction; it is not focusable or clickable.",
|
2323
|
+
"fieldName": "disabled",
|
2324
|
+
"inheritedFrom": {
|
2325
|
+
"name": "DisabledMixin",
|
2326
|
+
"module": "src/utils/mixins/DisabledMixin.ts"
|
2327
|
+
}
|
2328
|
+
}
|
2329
|
+
],
|
2330
|
+
"mixins": [
|
2331
|
+
{
|
2332
|
+
"name": "DisabledMixin",
|
2333
|
+
"module": "/src/utils/mixins/DisabledMixin"
|
2300
2334
|
}
|
2301
2335
|
],
|
2302
2336
|
"superclass": {
|
@@ -2325,7 +2359,7 @@
|
|
2325
2359
|
"declarations": [
|
2326
2360
|
{
|
2327
2361
|
"kind": "class",
|
2328
|
-
"description": "Icon component that dynamically displays SVG icons based on a valid name.\n\nThis component must be mounted within an `IconProvider` component.\n\nThe `IconProvider` defines the source URL from which icons are consumed.\nThe `Icon` component accepts a `name` attribute, which corresponds to\nthe file name of the icon to be loaded from the specified URL.\n\nOnce fetched, the icon will be rendered. If the fetching process is unsuccessful,\nno icon will be displayed.\n\nThe `size` attribute allows for dynamic sizing of the icon based on the provided\n`length-unit` attribute. This unit can either come from the `IconProvider`\nor can be overridden for each individual icon. For example:\nif `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be\n`width: 1em; height: 1em`.\n\nRegarding accessibility, there are
|
2362
|
+
"description": "Icon component that dynamically displays SVG icons based on a valid name.\n\nThis component must be mounted within an `IconProvider` component.\n\nThe `IconProvider` defines the source URL from which icons are consumed.\nThe `Icon` component accepts a `name` attribute, which corresponds to\nthe file name of the icon to be loaded from the specified URL.\n\nOnce fetched, the icon will be rendered. If the fetching process is unsuccessful,\nno icon will be displayed.\n\nThe `size` attribute allows for dynamic sizing of the icon based on the provided\n`length-unit` attribute. This unit can either come from the `IconProvider`\nor can be overridden for each individual icon. For example:\nif `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be\n`width: 1em; height: 1em`.\n\nRegarding accessibility, there are three types of icons: decorative, informative and informative standalone.\n\n### Decorative Icons\n- Decorative icons do not convey any essential information to the content of a page.\n- They should be hidden from screen readers (SR) to prevent confusion for users.\n- For decorative icons, an `aria-label` is not required, and the `role` will be set to null.\n\n### Informative Icons\n- Informative icons convey important information that is not adequately represented\n by surrounding text or components.\n- They provide valuable context and must be announced by assistive technologies.\n- For informative icons, an `aria-label` is required, and the `role` will be set to \"img\" automatically.\n- If an `aria-label` is provided, the role will be set to 'img'; if it is absent,\n the role will be unset.\n\n### Informative Standalone Icons\n- If an icon is informative (as mentioned above) and does not belong to a button (=standalone), it must\nhave a Tooltip that describes what it means.\n- For informative standalone icons, an `aria-label` & `tabindex=\"0\"` is required,\nand the `role` will be set to \"img\" automatically.\n- **Only use this when a Icon is standalone and is not part of a button or other interactive elements.**",
|
2329
2363
|
"name": "Icon",
|
2330
2364
|
"cssProperties": [
|
2331
2365
|
{
|
@@ -2411,17 +2445,6 @@
|
|
2411
2445
|
"privacy": "private",
|
2412
2446
|
"default": "new AbortController()"
|
2413
2447
|
},
|
2414
|
-
{
|
2415
|
-
"kind": "method",
|
2416
|
-
"name": "triggerIconLoaded",
|
2417
|
-
"privacy": "private",
|
2418
|
-
"return": {
|
2419
|
-
"type": {
|
2420
|
-
"text": "void"
|
2421
|
-
}
|
2422
|
-
},
|
2423
|
-
"description": "Dispatches a 'load' event on the component once the icon has been successfully loaded.\nThis event bubbles and is cancelable."
|
2424
|
-
},
|
2425
2448
|
{
|
2426
2449
|
"kind": "method",
|
2427
2450
|
"name": "getIconData",
|
@@ -2441,7 +2464,7 @@
|
|
2441
2464
|
"description": "The icon html element which has been fetched from the icon provider."
|
2442
2465
|
}
|
2443
2466
|
],
|
2444
|
-
"description": "Sets the iconData state to the fetched icon
|
2467
|
+
"description": "Sets the iconData state to the fetched icon.\nDispatches a 'load' event on the component once the icon has been successfully loaded."
|
2445
2468
|
},
|
2446
2469
|
{
|
2447
2470
|
"kind": "method",
|
@@ -2463,21 +2486,6 @@
|
|
2463
2486
|
"privacy": "private",
|
2464
2487
|
"description": "Updates the size by setting the width and height"
|
2465
2488
|
},
|
2466
|
-
{
|
2467
|
-
"kind": "method",
|
2468
|
-
"name": "setRoleOnIcon",
|
2469
|
-
"privacy": "private"
|
2470
|
-
},
|
2471
|
-
{
|
2472
|
-
"kind": "method",
|
2473
|
-
"name": "setAriaHiddenOnIcon",
|
2474
|
-
"privacy": "private"
|
2475
|
-
},
|
2476
|
-
{
|
2477
|
-
"kind": "method",
|
2478
|
-
"name": "setAriaLabelOnIcon",
|
2479
|
-
"privacy": "private"
|
2480
|
-
},
|
2481
2489
|
{
|
2482
2490
|
"kind": "field",
|
2483
2491
|
"name": "computedIconSize",
|
@@ -2525,7 +2533,7 @@
|
|
2525
2533
|
"module": "/src/models"
|
2526
2534
|
},
|
2527
2535
|
"tagName": "mdc-icon",
|
2528
|
-
"jsDoc": "/**\n * Icon component that dynamically displays SVG icons based on a valid name.\n *\n * This component must be mounted within an `IconProvider` component.\n *\n * The `IconProvider` defines the source URL from which icons are consumed.\n * The `Icon` component accepts a `name` attribute, which corresponds to\n * the file name of the icon to be loaded from the specified URL.\n *\n * Once fetched, the icon will be rendered. If the fetching process is unsuccessful,\n * no icon will be displayed.\n *\n * The `size` attribute allows for dynamic sizing of the icon based on the provided\n * `length-unit` attribute. This unit can either come from the `IconProvider`\n * or can be overridden for each individual icon. For example:\n * if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be\n * `width: 1em; height: 1em`.\n *\n * Regarding accessibility, there are
|
2536
|
+
"jsDoc": "/**\n * Icon component that dynamically displays SVG icons based on a valid name.\n *\n * This component must be mounted within an `IconProvider` component.\n *\n * The `IconProvider` defines the source URL from which icons are consumed.\n * The `Icon` component accepts a `name` attribute, which corresponds to\n * the file name of the icon to be loaded from the specified URL.\n *\n * Once fetched, the icon will be rendered. If the fetching process is unsuccessful,\n * no icon will be displayed.\n *\n * The `size` attribute allows for dynamic sizing of the icon based on the provided\n * `length-unit` attribute. This unit can either come from the `IconProvider`\n * or can be overridden for each individual icon. For example:\n * if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be\n * `width: 1em; height: 1em`.\n *\n * Regarding accessibility, there are three types of icons: decorative, informative and informative standalone.\n *\n * ### Decorative Icons\n * - Decorative icons do not convey any essential information to the content of a page.\n * - They should be hidden from screen readers (SR) to prevent confusion for users.\n * - For decorative icons, an `aria-label` is not required, and the `role` will be set to null.\n *\n * ### Informative Icons\n * - Informative icons convey important information that is not adequately represented\n * by surrounding text or components.\n * - They provide valuable context and must be announced by assistive technologies.\n * - For informative icons, an `aria-label` is required, and the `role` will be set to \"img\" automatically.\n * - If an `aria-label` is provided, the role will be set to 'img'; if it is absent,\n * the role will be unset.\n *\n * ### Informative Standalone Icons\n * - If an icon is informative (as mentioned above) and does not belong to a button (=standalone), it must\n * have a Tooltip that describes what it means.\n * - For informative standalone icons, an `aria-label` & `tabindex=\"0\"` is required,\n * and the `role` will be set to \"img\" automatically.\n * - **Only use this when a Icon is standalone and is not part of a button or other interactive elements.**\n *\n * @tagname mdc-icon\n *\n * @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.\n */",
|
2529
2537
|
"customElement": true
|
2530
2538
|
}
|
2531
2539
|
],
|
@@ -17,7 +17,7 @@ import Component from '../../components/icon';
|
|
17
17
|
* if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be
|
18
18
|
* `width: 1em; height: 1em`.
|
19
19
|
*
|
20
|
-
* Regarding accessibility, there are
|
20
|
+
* Regarding accessibility, there are three types of icons: decorative, informative and informative standalone.
|
21
21
|
*
|
22
22
|
* ### Decorative Icons
|
23
23
|
* - Decorative icons do not convey any essential information to the content of a page.
|
@@ -28,10 +28,17 @@ import Component from '../../components/icon';
|
|
28
28
|
* - Informative icons convey important information that is not adequately represented
|
29
29
|
* by surrounding text or components.
|
30
30
|
* - They provide valuable context and must be announced by assistive technologies.
|
31
|
-
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img".
|
31
|
+
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img" automatically.
|
32
32
|
* - If an `aria-label` is provided, the role will be set to 'img'; if it is absent,
|
33
33
|
* the role will be unset.
|
34
34
|
*
|
35
|
+
* ### Informative Standalone Icons
|
36
|
+
* - If an icon is informative (as mentioned above) and does not belong to a button (=standalone), it must
|
37
|
+
* have a Tooltip that describes what it means.
|
38
|
+
* - For informative standalone icons, an `aria-label` & `tabindex="0"` is required,
|
39
|
+
* and the `role` will be set to "img" automatically.
|
40
|
+
* - **Only use this when a Icon is standalone and is not part of a button or other interactive elements.**
|
41
|
+
*
|
35
42
|
* @tagname mdc-icon
|
36
43
|
*
|
37
44
|
* @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.
|
package/dist/react/icon/index.js
CHANGED
@@ -20,7 +20,7 @@ import { TAG_NAME } from '../../components/icon/icon.constants';
|
|
20
20
|
* if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be
|
21
21
|
* `width: 1em; height: 1em`.
|
22
22
|
*
|
23
|
-
* Regarding accessibility, there are
|
23
|
+
* Regarding accessibility, there are three types of icons: decorative, informative and informative standalone.
|
24
24
|
*
|
25
25
|
* ### Decorative Icons
|
26
26
|
* - Decorative icons do not convey any essential information to the content of a page.
|
@@ -31,10 +31,17 @@ import { TAG_NAME } from '../../components/icon/icon.constants';
|
|
31
31
|
* - Informative icons convey important information that is not adequately represented
|
32
32
|
* by surrounding text or components.
|
33
33
|
* - They provide valuable context and must be announced by assistive technologies.
|
34
|
-
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img".
|
34
|
+
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img" automatically.
|
35
35
|
* - If an `aria-label` is provided, the role will be set to 'img'; if it is absent,
|
36
36
|
* the role will be unset.
|
37
37
|
*
|
38
|
+
* ### Informative Standalone Icons
|
39
|
+
* - If an icon is informative (as mentioned above) and does not belong to a button (=standalone), it must
|
40
|
+
* have a Tooltip that describes what it means.
|
41
|
+
* - For informative standalone icons, an `aria-label` & `tabindex="0"` is required,
|
42
|
+
* and the `role` will be set to "img" automatically.
|
43
|
+
* - **Only use this when a Icon is standalone and is not part of a button or other interactive elements.**
|
44
|
+
*
|
38
45
|
* @tagname mdc-icon
|
39
46
|
*
|
40
47
|
* @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.
|
package/package.json
CHANGED