@momentum-design/components 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/index.js +14 -11
- package/dist/browser/index.js.map +2 -2
- package/dist/components/icon/icon.component.d.ts +29 -16
- package/dist/components/icon/icon.component.js +37 -31
- package/dist/components/icon/icon.styles.js +4 -1
- package/dist/components/icon/icon.utils.d.ts +10 -0
- package/dist/components/icon/icon.utils.js +15 -5
- package/dist/components/themeprovider/themeprovider.component.d.ts +1 -0
- package/dist/components/themeprovider/themeprovider.component.js +5 -1
- package/dist/custom-elements.json +126 -134
- package/dist/react/icon/index.d.ts +28 -12
- package/dist/react/icon/index.js +28 -12
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +3 -3
- package/package.json +1 -1
@@ -116,45 +116,27 @@
|
|
116
116
|
},
|
117
117
|
{
|
118
118
|
"kind": "javascript-module",
|
119
|
-
"path": "components/
|
119
|
+
"path": "components/badge/badge.component.js",
|
120
120
|
"declarations": [
|
121
121
|
{
|
122
122
|
"kind": "class",
|
123
|
-
"description": "
|
124
|
-
"name": "
|
125
|
-
"
|
126
|
-
{
|
127
|
-
"kind": "field",
|
128
|
-
"name": "iconData",
|
129
|
-
"type": {
|
130
|
-
"text": "HTMLElement | undefined"
|
131
|
-
},
|
132
|
-
"privacy": "private"
|
133
|
-
},
|
134
|
-
{
|
135
|
-
"kind": "field",
|
136
|
-
"name": "lengthUnitFromContext",
|
137
|
-
"type": {
|
138
|
-
"text": "string | undefined"
|
139
|
-
},
|
140
|
-
"privacy": "private"
|
141
|
-
},
|
123
|
+
"description": "",
|
124
|
+
"name": "Badge",
|
125
|
+
"slots": [
|
142
126
|
{
|
143
|
-
"
|
144
|
-
"name": "
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
"privacy": "private"
|
149
|
-
},
|
127
|
+
"description": "This is a default/unnamed slot",
|
128
|
+
"name": ""
|
129
|
+
}
|
130
|
+
],
|
131
|
+
"members": [
|
150
132
|
{
|
151
133
|
"kind": "field",
|
152
|
-
"name": "
|
134
|
+
"name": "type",
|
153
135
|
"type": {
|
154
|
-
"text": "
|
136
|
+
"text": "BadgeType | undefined"
|
155
137
|
},
|
156
|
-
"description": "
|
157
|
-
"attribute": "
|
138
|
+
"description": "Type of the badge\nCan be `regular`, `icon`, `text` or `warning`\n\nDefault: `regular`",
|
139
|
+
"attribute": "type",
|
158
140
|
"reflects": true
|
159
141
|
},
|
160
142
|
{
|
@@ -163,7 +145,7 @@
|
|
163
145
|
"type": {
|
164
146
|
"text": "number | undefined"
|
165
147
|
},
|
166
|
-
"description": "
|
148
|
+
"description": "Scale of the badge (works in combination with length unit)\n\nDefault: `1`",
|
167
149
|
"attribute": "size"
|
168
150
|
},
|
169
151
|
{
|
@@ -172,79 +154,60 @@
|
|
172
154
|
"type": {
|
173
155
|
"text": "string | undefined"
|
174
156
|
},
|
175
|
-
"description": "Length unit attribute for
|
157
|
+
"description": "Length unit attribute for scale\n\nDefault: `rem`",
|
176
158
|
"attribute": "length-unit"
|
177
159
|
},
|
178
160
|
{
|
179
161
|
"kind": "field",
|
180
|
-
"name": "
|
162
|
+
"name": "iconName",
|
181
163
|
"type": {
|
182
|
-
"text": "string |
|
164
|
+
"text": "string | undefined"
|
183
165
|
},
|
184
|
-
"
|
185
|
-
"
|
186
|
-
"attribute": "role"
|
166
|
+
"description": "If `type` is set to `icon`, attribute `iconName` can\nbe used to choose which icon should be shown\n\nIf no `iconName` is provided, no icon will be rendered.",
|
167
|
+
"attribute": "icon-name"
|
187
168
|
},
|
188
169
|
{
|
189
170
|
"kind": "field",
|
190
|
-
"name": "
|
171
|
+
"name": "text",
|
191
172
|
"type": {
|
192
|
-
"text": "string |
|
173
|
+
"text": "string | undefined"
|
193
174
|
},
|
194
|
-
"
|
195
|
-
"
|
196
|
-
"attribute": "aria-label"
|
197
|
-
},
|
198
|
-
{
|
199
|
-
"kind": "field",
|
200
|
-
"name": "iconProviderContext",
|
201
|
-
"privacy": "private",
|
202
|
-
"readonly": true
|
203
|
-
},
|
204
|
-
{
|
205
|
-
"kind": "method",
|
206
|
-
"name": "getIconData",
|
207
|
-
"privacy": "private",
|
208
|
-
"description": "Get Icon Data function which will fetch the icon (currently only svg)\nand sets state and attributes once fetched successfully"
|
175
|
+
"description": "If `type` is set to `text`, attribute `text` can\nbe used to pass in any text to be displayed in the badge.",
|
176
|
+
"attribute": "text"
|
209
177
|
},
|
210
178
|
{
|
211
179
|
"kind": "method",
|
212
180
|
"name": "updateSize",
|
213
|
-
"privacy": "private"
|
214
|
-
"description": "Updates the size by setting the width and height"
|
181
|
+
"privacy": "private"
|
215
182
|
},
|
216
183
|
{
|
217
184
|
"kind": "method",
|
218
|
-
"name": "
|
219
|
-
"privacy": "private"
|
185
|
+
"name": "iconTemplate"
|
220
186
|
},
|
221
187
|
{
|
222
188
|
"kind": "method",
|
223
|
-
"name": "
|
224
|
-
"privacy": "private"
|
189
|
+
"name": "textTemplate"
|
225
190
|
},
|
226
191
|
{
|
227
|
-
"kind": "
|
228
|
-
"name": "
|
229
|
-
"privacy": "private",
|
230
|
-
"readonly": true
|
192
|
+
"kind": "method",
|
193
|
+
"name": "warningTemplate"
|
231
194
|
}
|
232
195
|
],
|
233
196
|
"attributes": [
|
234
197
|
{
|
235
|
-
"name": "
|
198
|
+
"name": "type",
|
236
199
|
"type": {
|
237
|
-
"text": "
|
200
|
+
"text": "BadgeType | undefined"
|
238
201
|
},
|
239
|
-
"description": "
|
240
|
-
"fieldName": "
|
202
|
+
"description": "Type of the badge\nCan be `regular`, `icon`, `text` or `warning`\n\nDefault: `regular`",
|
203
|
+
"fieldName": "type"
|
241
204
|
},
|
242
205
|
{
|
243
206
|
"name": "size",
|
244
207
|
"type": {
|
245
208
|
"text": "number | undefined"
|
246
209
|
},
|
247
|
-
"description": "
|
210
|
+
"description": "Scale of the badge (works in combination with length unit)\n\nDefault: `1`",
|
248
211
|
"fieldName": "size"
|
249
212
|
},
|
250
213
|
{
|
@@ -252,34 +215,33 @@
|
|
252
215
|
"type": {
|
253
216
|
"text": "string | undefined"
|
254
217
|
},
|
255
|
-
"description": "Length unit attribute for
|
218
|
+
"description": "Length unit attribute for scale\n\nDefault: `rem`",
|
256
219
|
"fieldName": "lengthUnit"
|
257
220
|
},
|
258
221
|
{
|
259
|
-
"name": "
|
222
|
+
"name": "icon-name",
|
260
223
|
"type": {
|
261
|
-
"text": "string |
|
224
|
+
"text": "string | undefined"
|
262
225
|
},
|
263
|
-
"
|
264
|
-
"
|
265
|
-
"fieldName": "role"
|
226
|
+
"description": "If `type` is set to `icon`, attribute `iconName` can\nbe used to choose which icon should be shown\n\nIf no `iconName` is provided, no icon will be rendered.",
|
227
|
+
"fieldName": "iconName"
|
266
228
|
},
|
267
229
|
{
|
268
|
-
"name": "
|
230
|
+
"name": "text",
|
269
231
|
"type": {
|
270
|
-
"text": "string |
|
232
|
+
"text": "string | undefined"
|
271
233
|
},
|
272
|
-
"
|
273
|
-
"
|
274
|
-
"fieldName": "ariaLabel"
|
234
|
+
"description": "If `type` is set to `text`, attribute `text` can\nbe used to pass in any text to be displayed in the badge.",
|
235
|
+
"fieldName": "text"
|
275
236
|
}
|
276
237
|
],
|
277
238
|
"superclass": {
|
278
239
|
"name": "Component",
|
279
240
|
"module": "/src/models"
|
280
241
|
},
|
281
|
-
"tagName": "mdc-
|
282
|
-
"
|
242
|
+
"tagName": "mdc-badge",
|
243
|
+
"summary": "This is MyElement",
|
244
|
+
"jsDoc": "/**\n * @slot - This is a default/unnamed slot\n *\n * @summary This is MyElement\n *\n * @tagname mdc-badge\n */",
|
283
245
|
"customElement": true
|
284
246
|
}
|
285
247
|
],
|
@@ -288,35 +250,59 @@
|
|
288
250
|
"kind": "js",
|
289
251
|
"name": "default",
|
290
252
|
"declaration": {
|
291
|
-
"name": "
|
292
|
-
"module": "components/
|
253
|
+
"name": "Badge",
|
254
|
+
"module": "components/badge/badge.component.js"
|
293
255
|
}
|
294
256
|
}
|
295
257
|
]
|
296
258
|
},
|
297
259
|
{
|
298
260
|
"kind": "javascript-module",
|
299
|
-
"path": "components/
|
261
|
+
"path": "components/icon/icon.component.js",
|
300
262
|
"declarations": [
|
301
263
|
{
|
302
264
|
"kind": "class",
|
303
|
-
"description": "",
|
304
|
-
"name": "
|
305
|
-
"
|
265
|
+
"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 two types of icons: decorative and informative.\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\".\n- If an `aria-label` is provided, the role will be set to 'img'; if it is absent,\n the role will be unset.",
|
266
|
+
"name": "Icon",
|
267
|
+
"cssProperties": [
|
306
268
|
{
|
307
|
-
"description": "
|
308
|
-
"name": ""
|
269
|
+
"description": "Allows customization of the default fill color.",
|
270
|
+
"name": "--mdc-icon-fill-color"
|
309
271
|
}
|
310
272
|
],
|
311
273
|
"members": [
|
312
274
|
{
|
313
275
|
"kind": "field",
|
314
|
-
"name": "
|
276
|
+
"name": "iconData",
|
315
277
|
"type": {
|
316
|
-
"text": "
|
278
|
+
"text": "HTMLElement | undefined"
|
317
279
|
},
|
318
|
-
"
|
319
|
-
|
280
|
+
"privacy": "private"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
"kind": "field",
|
284
|
+
"name": "lengthUnitFromContext",
|
285
|
+
"type": {
|
286
|
+
"text": "string | undefined"
|
287
|
+
},
|
288
|
+
"privacy": "private"
|
289
|
+
},
|
290
|
+
{
|
291
|
+
"kind": "field",
|
292
|
+
"name": "sizeFromContext",
|
293
|
+
"type": {
|
294
|
+
"text": "number | undefined"
|
295
|
+
},
|
296
|
+
"privacy": "private"
|
297
|
+
},
|
298
|
+
{
|
299
|
+
"kind": "field",
|
300
|
+
"name": "name",
|
301
|
+
"type": {
|
302
|
+
"text": "string | undefined"
|
303
|
+
},
|
304
|
+
"description": "Name of the icon (= filename)",
|
305
|
+
"attribute": "name",
|
320
306
|
"reflects": true
|
321
307
|
},
|
322
308
|
{
|
@@ -325,7 +311,7 @@
|
|
325
311
|
"type": {
|
326
312
|
"text": "number | undefined"
|
327
313
|
},
|
328
|
-
"description": "
|
314
|
+
"description": "Size of the icon (works in combination with length unit)",
|
329
315
|
"attribute": "size"
|
330
316
|
},
|
331
317
|
{
|
@@ -334,60 +320,74 @@
|
|
334
320
|
"type": {
|
335
321
|
"text": "string | undefined"
|
336
322
|
},
|
337
|
-
"description": "Length unit attribute for
|
323
|
+
"description": "Length unit attribute for overriding length-unit from `IconProvider`",
|
338
324
|
"attribute": "length-unit"
|
339
325
|
},
|
340
326
|
{
|
341
327
|
"kind": "field",
|
342
|
-
"name": "
|
328
|
+
"name": "ariaLabel",
|
343
329
|
"type": {
|
344
|
-
"text": "string |
|
330
|
+
"text": "string | null"
|
345
331
|
},
|
346
|
-
"
|
347
|
-
"
|
332
|
+
"default": "null",
|
333
|
+
"description": "Aria-label attribute to be set for accessibility",
|
334
|
+
"attribute": "aria-label"
|
348
335
|
},
|
349
336
|
{
|
350
337
|
"kind": "field",
|
351
|
-
"name": "
|
352
|
-
"
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
"
|
338
|
+
"name": "iconProviderContext",
|
339
|
+
"privacy": "private",
|
340
|
+
"readonly": true
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"kind": "method",
|
344
|
+
"name": "getIconData",
|
345
|
+
"privacy": "private",
|
346
|
+
"description": "Get Icon Data function which will fetch the icon (currently only svg)\nand sets state and attributes once fetched successfully"
|
357
347
|
},
|
358
348
|
{
|
359
349
|
"kind": "method",
|
360
350
|
"name": "updateSize",
|
361
|
-
"privacy": "private"
|
351
|
+
"privacy": "private",
|
352
|
+
"description": "Updates the size by setting the width and height"
|
362
353
|
},
|
363
354
|
{
|
364
355
|
"kind": "method",
|
365
|
-
"name": "
|
356
|
+
"name": "setRoleOnIcon",
|
357
|
+
"privacy": "private"
|
366
358
|
},
|
367
359
|
{
|
368
360
|
"kind": "method",
|
369
|
-
"name": "
|
361
|
+
"name": "setAriaHiddenOnIcon",
|
362
|
+
"privacy": "private"
|
370
363
|
},
|
371
364
|
{
|
372
365
|
"kind": "method",
|
373
|
-
"name": "
|
366
|
+
"name": "setAriaLabelOnIcon",
|
367
|
+
"privacy": "private"
|
368
|
+
},
|
369
|
+
{
|
370
|
+
"kind": "field",
|
371
|
+
"name": "computedIconSize",
|
372
|
+
"privacy": "private",
|
373
|
+
"readonly": true
|
374
374
|
}
|
375
375
|
],
|
376
376
|
"attributes": [
|
377
377
|
{
|
378
|
-
"name": "
|
378
|
+
"name": "name",
|
379
379
|
"type": {
|
380
|
-
"text": "
|
380
|
+
"text": "string | undefined"
|
381
381
|
},
|
382
|
-
"description": "
|
383
|
-
"fieldName": "
|
382
|
+
"description": "Name of the icon (= filename)",
|
383
|
+
"fieldName": "name"
|
384
384
|
},
|
385
385
|
{
|
386
386
|
"name": "size",
|
387
387
|
"type": {
|
388
388
|
"text": "number | undefined"
|
389
389
|
},
|
390
|
-
"description": "
|
390
|
+
"description": "Size of the icon (works in combination with length unit)",
|
391
391
|
"fieldName": "size"
|
392
392
|
},
|
393
393
|
{
|
@@ -395,33 +395,25 @@
|
|
395
395
|
"type": {
|
396
396
|
"text": "string | undefined"
|
397
397
|
},
|
398
|
-
"description": "Length unit attribute for
|
398
|
+
"description": "Length unit attribute for overriding length-unit from `IconProvider`",
|
399
399
|
"fieldName": "lengthUnit"
|
400
400
|
},
|
401
401
|
{
|
402
|
-
"name": "
|
403
|
-
"type": {
|
404
|
-
"text": "string | undefined"
|
405
|
-
},
|
406
|
-
"description": "If `type` is set to `icon`, attribute `iconName` can\nbe used to choose which icon should be shown\n\nIf no `iconName` is provided, no icon will be rendered.",
|
407
|
-
"fieldName": "iconName"
|
408
|
-
},
|
409
|
-
{
|
410
|
-
"name": "text",
|
402
|
+
"name": "aria-label",
|
411
403
|
"type": {
|
412
|
-
"text": "string |
|
404
|
+
"text": "string | null"
|
413
405
|
},
|
414
|
-
"
|
415
|
-
"
|
406
|
+
"default": "null",
|
407
|
+
"description": "Aria-label attribute to be set for accessibility",
|
408
|
+
"fieldName": "ariaLabel"
|
416
409
|
}
|
417
410
|
],
|
418
411
|
"superclass": {
|
419
412
|
"name": "Component",
|
420
413
|
"module": "/src/models"
|
421
414
|
},
|
422
|
-
"tagName": "mdc-
|
423
|
-
"
|
424
|
-
"jsDoc": "/**\n * @slot - This is a default/unnamed slot\n *\n * @summary This is MyElement\n *\n * @tagname mdc-badge\n */",
|
415
|
+
"tagName": "mdc-icon",
|
416
|
+
"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 two types of icons: decorative and informative.\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\".\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 * @tagname mdc-icon\n *\n * @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.\n */",
|
425
417
|
"customElement": true
|
426
418
|
}
|
427
419
|
],
|
@@ -430,8 +422,8 @@
|
|
430
422
|
"kind": "js",
|
431
423
|
"name": "default",
|
432
424
|
"declaration": {
|
433
|
-
"name": "
|
434
|
-
"module": "components/
|
425
|
+
"name": "Icon",
|
426
|
+
"module": "components/icon/icon.component.js"
|
435
427
|
}
|
436
428
|
}
|
437
429
|
]
|
@@ -1,24 +1,40 @@
|
|
1
1
|
import Component from '../../components/icon';
|
2
2
|
/**
|
3
|
-
* Icon component
|
4
|
-
* component.
|
3
|
+
* Icon component that dynamically displays SVG icons based on a valid name.
|
5
4
|
*
|
6
|
-
*
|
7
|
-
* This `Icon` component accepts the `name` attribute, which will be
|
8
|
-
* the file name of the icon to be loaded from the given `url`.
|
5
|
+
* This component must be mounted within an `IconProvider` component.
|
9
6
|
*
|
10
|
-
*
|
11
|
-
*
|
7
|
+
* The `IconProvider` defines the source URL from which icons are consumed.
|
8
|
+
* The `Icon` component accepts a `name` attribute, which corresponds to
|
9
|
+
* the file name of the icon to be loaded from the specified URL.
|
12
10
|
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
11
|
+
* Once fetched, the icon will be rendered. If the fetching process is unsuccessful,
|
12
|
+
* no icon will be displayed.
|
13
|
+
*
|
14
|
+
* The `size` attribute allows for dynamic sizing of the icon based on the provided
|
15
|
+
* `length-unit` attribute. This unit can either come from the `IconProvider`
|
16
|
+
* or can be overridden for each individual icon. For example:
|
17
|
+
* if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be
|
17
18
|
* `width: 1em; height: 1em`.
|
18
19
|
*
|
19
|
-
*
|
20
|
+
* Regarding accessibility, there are two types of icons: decorative and informative.
|
21
|
+
*
|
22
|
+
* ### Decorative Icons
|
23
|
+
* - Decorative icons do not convey any essential information to the content of a page.
|
24
|
+
* - They should be hidden from screen readers (SR) to prevent confusion for users.
|
25
|
+
* - For decorative icons, an `aria-label` is not required, and the `role` will be set to null.
|
26
|
+
*
|
27
|
+
* ### Informative Icons
|
28
|
+
* - Informative icons convey important information that is not adequately represented
|
29
|
+
* by surrounding text or components.
|
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".
|
32
|
+
* - If an `aria-label` is provided, the role will be set to 'img'; if it is absent,
|
33
|
+
* the role will be unset.
|
20
34
|
*
|
21
35
|
* @tagname mdc-icon
|
36
|
+
*
|
37
|
+
* @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.
|
22
38
|
*/
|
23
39
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
24
40
|
export default reactWrapper;
|
package/dist/react/icon/index.js
CHANGED
@@ -6,25 +6,41 @@ const react_1 = require("@lit/react");
|
|
6
6
|
const icon_1 = tslib_1.__importDefault(require("../../components/icon"));
|
7
7
|
const icon_constants_1 = require("../../components/icon/icon.constants");
|
8
8
|
/**
|
9
|
-
* Icon component
|
10
|
-
* component.
|
9
|
+
* Icon component that dynamically displays SVG icons based on a valid name.
|
11
10
|
*
|
12
|
-
*
|
13
|
-
* This `Icon` component accepts the `name` attribute, which will be
|
14
|
-
* the file name of the icon to be loaded from the given `url`.
|
11
|
+
* This component must be mounted within an `IconProvider` component.
|
15
12
|
*
|
16
|
-
*
|
17
|
-
*
|
13
|
+
* The `IconProvider` defines the source URL from which icons are consumed.
|
14
|
+
* The `Icon` component accepts a `name` attribute, which corresponds to
|
15
|
+
* the file name of the icon to be loaded from the specified URL.
|
18
16
|
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*
|
17
|
+
* Once fetched, the icon will be rendered. If the fetching process is unsuccessful,
|
18
|
+
* no icon will be displayed.
|
19
|
+
*
|
20
|
+
* The `size` attribute allows for dynamic sizing of the icon based on the provided
|
21
|
+
* `length-unit` attribute. This unit can either come from the `IconProvider`
|
22
|
+
* or can be overridden for each individual icon. For example:
|
23
|
+
* if `size = 1` and `length-unit = 'em'`, the dimensions of the icon will be
|
23
24
|
* `width: 1em; height: 1em`.
|
24
25
|
*
|
25
|
-
*
|
26
|
+
* Regarding accessibility, there are two types of icons: decorative and informative.
|
27
|
+
*
|
28
|
+
* ### Decorative Icons
|
29
|
+
* - Decorative icons do not convey any essential information to the content of a page.
|
30
|
+
* - They should be hidden from screen readers (SR) to prevent confusion for users.
|
31
|
+
* - For decorative icons, an `aria-label` is not required, and the `role` will be set to null.
|
32
|
+
*
|
33
|
+
* ### Informative Icons
|
34
|
+
* - Informative icons convey important information that is not adequately represented
|
35
|
+
* by surrounding text or components.
|
36
|
+
* - They provide valuable context and must be announced by assistive technologies.
|
37
|
+
* - For informative icons, an `aria-label` is required, and the `role` will be set to "img".
|
38
|
+
* - If an `aria-label` is provided, the role will be set to 'img'; if it is absent,
|
39
|
+
* the role will be unset.
|
26
40
|
*
|
27
41
|
* @tagname mdc-icon
|
42
|
+
*
|
43
|
+
* @cssproperty --mdc-icon-fill-color - Allows customization of the default fill color.
|
28
44
|
*/
|
29
45
|
const reactWrapper = (0, react_1.createComponent)({
|
30
46
|
tagName: icon_constants_1.TAG_NAME,
|
package/dist/react/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { default as Avatar } from './avatar';
|
2
|
-
export { default as Icon } from './icon';
|
3
2
|
export { default as Badge } from './badge';
|
3
|
+
export { default as Icon } from './icon';
|
4
4
|
export { default as IconProvider } from './iconprovider';
|
5
5
|
export { default as Text } from './text';
|
6
6
|
export { default as ThemeProvider } from './themeprovider';
|
package/dist/react/index.js
CHANGED
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.ThemeProvider = exports.Text = exports.IconProvider = exports.
|
6
|
+
exports.ThemeProvider = exports.Text = exports.IconProvider = exports.Icon = exports.Badge = exports.Avatar = void 0;
|
7
7
|
var avatar_1 = require("./avatar");
|
8
8
|
Object.defineProperty(exports, "Avatar", { enumerable: true, get: function () { return __importDefault(avatar_1).default; } });
|
9
|
-
var icon_1 = require("./icon");
|
10
|
-
Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return __importDefault(icon_1).default; } });
|
11
9
|
var badge_1 = require("./badge");
|
12
10
|
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return __importDefault(badge_1).default; } });
|
11
|
+
var icon_1 = require("./icon");
|
12
|
+
Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return __importDefault(icon_1).default; } });
|
13
13
|
var iconprovider_1 = require("./iconprovider");
|
14
14
|
Object.defineProperty(exports, "IconProvider", { enumerable: true, get: function () { return __importDefault(iconprovider_1).default; } });
|
15
15
|
var text_1 = require("./text");
|
package/package.json
CHANGED