@momentum-design/components 0.27.1 → 0.27.3
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 +54 -54
- package/dist/browser/index.js.map +3 -3
- package/dist/components/icon/icon.component.js +29 -16
- package/dist/components/icon/icon.utils.d.ts +2 -2
- package/dist/components/icon/icon.utils.js +2 -2
- package/dist/components/iconprovider/iconprovider.component.d.ts +33 -29
- package/dist/components/iconprovider/iconprovider.component.js +33 -5
- package/dist/components/iconprovider/iconprovider.constants.d.ts +1 -0
- package/dist/components/iconprovider/iconprovider.constants.js +1 -0
- package/dist/components/iconprovider/iconprovider.context.d.ts +3 -1
- package/dist/components/iconprovider/iconprovider.types.d.ts +3 -0
- package/dist/components/iconprovider/iconprovider.types.js +1 -0
- package/dist/components/spinner/spinner.component.js +1 -1
- package/dist/custom-elements.json +34 -13
- package/dist/index.d.ts +2 -1
- package/dist/react/iconprovider/index.d.ts +11 -5
- package/dist/react/iconprovider/index.js +11 -5
- package/package.json +1 -1
@@ -13,7 +13,7 @@ import styles from './icon.styles';
|
|
13
13
|
import { Component } from '../../models';
|
14
14
|
import providerUtils from '../../utils/provider';
|
15
15
|
import IconProvider from '../iconprovider/iconprovider.component';
|
16
|
-
import {
|
16
|
+
import { svgFetch } from './icon.utils';
|
17
17
|
import { DEFAULTS } from './icon.constants';
|
18
18
|
/**
|
19
19
|
* Icon component that dynamically displays SVG icons based on a valid name.
|
@@ -101,8 +101,8 @@ class Icon extends Component {
|
|
101
101
|
*/
|
102
102
|
async getIconData() {
|
103
103
|
if (this.iconProviderContext.value) {
|
104
|
-
const { fileExtension, url, cacheName, cacheStrategy } = this.iconProviderContext.value;
|
105
|
-
if (url && fileExtension && this.name) {
|
104
|
+
const { fileExtension, url, cacheName, iconSet, cacheStrategy } = this.iconProviderContext.value;
|
105
|
+
if (iconSet === 'custom-icons' && url && fileExtension && this.name) {
|
106
106
|
// function to abort the fetch request and create a new signal
|
107
107
|
// (directly passing the abortcontroller to the fetch request per reference
|
108
108
|
// will not work due to JS call-by-sharing behavior)
|
@@ -111,25 +111,38 @@ class Icon extends Component {
|
|
111
111
|
this.abortController = new AbortController();
|
112
112
|
return this.abortController.signal;
|
113
113
|
};
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
114
|
+
// fetch icon data (including caching logic)
|
115
|
+
return svgFetch({
|
116
|
+
url,
|
117
|
+
name: this.name,
|
118
|
+
fileExtension,
|
119
|
+
cacheName,
|
120
|
+
cacheStrategy,
|
121
|
+
renewSignal,
|
122
|
+
})
|
123
|
+
.then((iconData) => {
|
124
124
|
// parse the fetched icon string to an html element and set the attributes
|
125
125
|
const iconElement = this.prepareIconElement(iconData);
|
126
126
|
this.handleIconLoadedSuccess(iconElement);
|
127
|
-
}
|
128
|
-
|
127
|
+
})
|
128
|
+
.catch((error) => {
|
129
129
|
this.handleIconLoadedFailure(error);
|
130
|
-
}
|
130
|
+
});
|
131
|
+
}
|
132
|
+
if (iconSet === 'momentum-icons' && this.name) {
|
133
|
+
// dynamic import of the lit template from the momentum icons package
|
134
|
+
return import(`@momentum-design/icons/dist/ts/${this.name}.ts`)
|
135
|
+
.then((module) => {
|
136
|
+
this.handleIconLoadedSuccess(module.default());
|
137
|
+
})
|
138
|
+
.catch((error) => {
|
139
|
+
this.handleIconLoadedFailure(error);
|
140
|
+
});
|
131
141
|
}
|
132
142
|
}
|
143
|
+
const noIconProviderError = new Error('IconProvider not found or not properly set up.');
|
144
|
+
this.handleIconLoadedFailure(noIconProviderError);
|
145
|
+
return Promise.reject(noIconProviderError);
|
133
146
|
}
|
134
147
|
/**
|
135
148
|
* Sets the iconData state to the fetched icon.
|
@@ -28,5 +28,5 @@ interface Args {
|
|
28
28
|
* @returns Response string from the fetch
|
29
29
|
* @throws Error if the response is not ok
|
30
30
|
*/
|
31
|
-
declare const
|
32
|
-
export {
|
31
|
+
declare const svgFetch: ({ url, name, fileExtension, cacheStrategy, cacheName, renewSignal, }: Args) => Promise<string>;
|
32
|
+
export { svgFetch };
|
@@ -33,7 +33,7 @@ const fetchIcon = async (request) => fetch(request).then((response) => {
|
|
33
33
|
* @returns Response string from the fetch
|
34
34
|
* @throws Error if the response is not ok
|
35
35
|
*/
|
36
|
-
const
|
36
|
+
const svgFetch = async ({ url, name, fileExtension, cacheStrategy, cacheName, renewSignal, }) => {
|
37
37
|
// abort the previous fetch request if it is still pending
|
38
38
|
// and create a new signal
|
39
39
|
const signal = renewSignal();
|
@@ -76,4 +76,4 @@ const dynamicSVGImport = async ({ url, name, fileExtension, cacheStrategy, cache
|
|
76
76
|
throw new Error(`Error in caching the Icon ${name}, ${error}`);
|
77
77
|
}));
|
78
78
|
};
|
79
|
-
export {
|
79
|
+
export { svgFetch };
|
@@ -1,15 +1,22 @@
|
|
1
1
|
import { Provider } from '../../models';
|
2
2
|
import IconProviderContext from './iconprovider.context';
|
3
|
+
import type { CacheStrategy, IconSet } from './iconprovider.types';
|
3
4
|
/**
|
4
5
|
* IconProvider component, which allows to be consumed from sub components
|
5
6
|
* (see `providerUtils.consume` for how to consume)
|
6
7
|
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
8
|
+
* Attribute `iconSet` can be set to either `momentum-icons` or `custom-icons`.
|
9
|
+
* If `momentum-icons` is selected, the icons will be fetched from the
|
10
|
+
* Momentum Design System icon set per a dynamic JS Import (no need to provide a URL).
|
11
|
+
* This requires the consumer to have the `@momentum-designs` package installed and the
|
12
|
+
* build tooling needs to support dynamic imports.
|
10
13
|
*
|
11
|
-
* If `
|
12
|
-
*
|
14
|
+
* If `custom-icons` is selected, the icons will be fetched from the provided URL.
|
15
|
+
* This requires the consumer to provide a URL from which the icons will be fetched and
|
16
|
+
* the consumer needs to make sure to bundle the icons in the application.
|
17
|
+
*
|
18
|
+
* If `cacheStrategy` is provided (only works with iconSet = `custom-icons`), the
|
19
|
+
* IconProvider will cache the icons in the selected cache (either web-api-cache or in-memory-cache),
|
13
20
|
* to avoid fetching the same icon multiple times over the network.
|
14
21
|
* This is useful when the same icon is used multiple times in the application.
|
15
22
|
* To consider:
|
@@ -28,36 +35,31 @@ declare class IconProvider extends Provider<IconProviderContext> {
|
|
28
35
|
* Context object of the IconProvider, to be consumed by child components
|
29
36
|
*/
|
30
37
|
static get Context(): {
|
31
|
-
/**
|
32
|
-
* IconProvider component, which allows to be consumed from sub components
|
33
|
-
* (see `providerUtils.consume` for how to consume)
|
34
|
-
*
|
35
|
-
* Bundling icons will be up to the consumer of this component, such
|
36
|
-
* that only a url has to be passed in from which the icons will be
|
37
|
-
* fetched.
|
38
|
-
*
|
39
|
-
* If `cacheStrategy` is provided, the IconProvider will cache the icons
|
40
|
-
* in the selected cache (either web-api-cache or in-memory-cache),
|
41
|
-
* to avoid fetching the same icon multiple times over the network.
|
42
|
-
* This is useful when the same icon is used multiple times in the application.
|
43
|
-
* To consider:
|
44
|
-
* - The `in-memory-cache` is not persisted and will be lost when the
|
45
|
-
* IconProvider is removed from the DOM.
|
46
|
-
* - The `web-api-cache` is persisted, but only works in https environments
|
47
|
-
* (https://developer.mozilla.org/en-US/docs/Web/API/Cache).
|
48
|
-
*
|
49
|
-
* @tagname mdc-iconprovider
|
50
|
-
*
|
51
|
-
* @slot - children
|
52
|
-
*/
|
53
38
|
__context__: IconProviderContext;
|
54
39
|
};
|
40
|
+
/**
|
41
|
+
* Icon set to be used
|
42
|
+
*
|
43
|
+
* If `momentum-icons` is selected, the icons will be fetched from the
|
44
|
+
* Momentum Design System icon set per a dynamic JS Import (no need to provide a URL).
|
45
|
+
* This requires the consumer to have the `@momentum-designs` package installed and the
|
46
|
+
* build tooling needs to support dynamic imports.
|
47
|
+
*
|
48
|
+
* If `custom-icons` is selected, the icons will be fetched from the provided URL.
|
49
|
+
* This requires the consumer to provide a URL from which the icons will be fetched and
|
50
|
+
* the consumer needs to make sure to bundle the icons in the application.
|
51
|
+
*
|
52
|
+
* @default momentum-icons
|
53
|
+
*/
|
54
|
+
iconSet?: IconSet;
|
55
55
|
/**
|
56
56
|
* Url of where icons will be fetched from
|
57
|
+
* (if Icon set is `custom-icons`, this will be the base url)
|
57
58
|
*/
|
58
59
|
url?: string;
|
59
60
|
/**
|
60
61
|
* File extension of icons
|
62
|
+
* (if Icon set is `custom-icons`, this will be the file extension for icons)
|
61
63
|
* @default svg
|
62
64
|
*/
|
63
65
|
fileExtension?: string;
|
@@ -75,6 +77,8 @@ declare class IconProvider extends Provider<IconProviderContext> {
|
|
75
77
|
/**
|
76
78
|
* Icons Cache Strategy to use
|
77
79
|
*
|
80
|
+
* **Can only be used if Icon set is `custom-icons`**
|
81
|
+
*
|
78
82
|
* Choose `in-memory-cache` to cache icons in a JS cache (in-memory cache).
|
79
83
|
* Choose `web-cache-api` to cache icons using the Web Cache API.
|
80
84
|
*
|
@@ -83,9 +87,9 @@ declare class IconProvider extends Provider<IconProviderContext> {
|
|
83
87
|
* If not provided or invalid value provided, the icons will not be cached.
|
84
88
|
* @default undefined
|
85
89
|
*/
|
86
|
-
cacheStrategy?:
|
90
|
+
cacheStrategy?: CacheStrategy;
|
87
91
|
/**
|
88
|
-
* Icons Cache Name to use
|
92
|
+
* Icons Cache Name to use (cache strategy must be provided)
|
89
93
|
*
|
90
94
|
* If provided, Icons inside the provider will be cached in the
|
91
95
|
* cache (determined by `cache-strategy`) with the provided name.
|
@@ -15,12 +15,18 @@ import { ALLOWED_FILE_EXTENSIONS, DEFAULTS, ALLOWED_LENGTH_UNITS } from './iconp
|
|
15
15
|
* IconProvider component, which allows to be consumed from sub components
|
16
16
|
* (see `providerUtils.consume` for how to consume)
|
17
17
|
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
18
|
+
* Attribute `iconSet` can be set to either `momentum-icons` or `custom-icons`.
|
19
|
+
* If `momentum-icons` is selected, the icons will be fetched from the
|
20
|
+
* Momentum Design System icon set per a dynamic JS Import (no need to provide a URL).
|
21
|
+
* This requires the consumer to have the `@momentum-designs` package installed and the
|
22
|
+
* build tooling needs to support dynamic imports.
|
21
23
|
*
|
22
|
-
* If `
|
23
|
-
*
|
24
|
+
* If `custom-icons` is selected, the icons will be fetched from the provided URL.
|
25
|
+
* This requires the consumer to provide a URL from which the icons will be fetched and
|
26
|
+
* the consumer needs to make sure to bundle the icons in the application.
|
27
|
+
*
|
28
|
+
* If `cacheStrategy` is provided (only works with iconSet = `custom-icons`), the
|
29
|
+
* IconProvider will cache the icons in the selected cache (either web-api-cache or in-memory-cache),
|
24
30
|
* to avoid fetching the same icon multiple times over the network.
|
25
31
|
* This is useful when the same icon is used multiple times in the application.
|
26
32
|
* To consider:
|
@@ -40,8 +46,24 @@ class IconProvider extends Provider {
|
|
40
46
|
context: IconProviderContext.context,
|
41
47
|
initialValue: new IconProviderContext(),
|
42
48
|
});
|
49
|
+
/**
|
50
|
+
* Icon set to be used
|
51
|
+
*
|
52
|
+
* If `momentum-icons` is selected, the icons will be fetched from the
|
53
|
+
* Momentum Design System icon set per a dynamic JS Import (no need to provide a URL).
|
54
|
+
* This requires the consumer to have the `@momentum-designs` package installed and the
|
55
|
+
* build tooling needs to support dynamic imports.
|
56
|
+
*
|
57
|
+
* If `custom-icons` is selected, the icons will be fetched from the provided URL.
|
58
|
+
* This requires the consumer to provide a URL from which the icons will be fetched and
|
59
|
+
* the consumer needs to make sure to bundle the icons in the application.
|
60
|
+
*
|
61
|
+
* @default momentum-icons
|
62
|
+
*/
|
63
|
+
this.iconSet = DEFAULTS.ICON_SET;
|
43
64
|
/**
|
44
65
|
* File extension of icons
|
66
|
+
* (if Icon set is `custom-icons`, this will be the file extension for icons)
|
45
67
|
* @default svg
|
46
68
|
*/
|
47
69
|
this.fileExtension = DEFAULTS.FILE_EXTENSION;
|
@@ -73,6 +95,7 @@ class IconProvider extends Provider {
|
|
73
95
|
this.fileExtension = DEFAULTS.FILE_EXTENSION;
|
74
96
|
this.context.value.fileExtension = DEFAULTS.FILE_EXTENSION;
|
75
97
|
}
|
98
|
+
this.context.value.iconSet = this.iconSet;
|
76
99
|
this.context.value.url = this.url;
|
77
100
|
this.context.value.size = this.size;
|
78
101
|
this.context.value.cacheName = this.cacheName;
|
@@ -88,6 +111,7 @@ class IconProvider extends Provider {
|
|
88
111
|
}
|
89
112
|
updateContext() {
|
90
113
|
if (this.context.value.fileExtension !== this.fileExtension
|
114
|
+
|| this.context.value.iconSet !== this.iconSet
|
91
115
|
|| this.context.value.url !== this.url
|
92
116
|
|| this.context.value.lengthUnit !== this.lengthUnit
|
93
117
|
|| this.context.value.size !== this.size
|
@@ -98,6 +122,10 @@ class IconProvider extends Provider {
|
|
98
122
|
}
|
99
123
|
}
|
100
124
|
}
|
125
|
+
__decorate([
|
126
|
+
property({ type: String, attribute: 'icon-set', reflect: true }),
|
127
|
+
__metadata("design:type", String)
|
128
|
+
], IconProvider.prototype, "iconSet", void 0);
|
101
129
|
__decorate([
|
102
130
|
property({ type: String }),
|
103
131
|
__metadata("design:type", String)
|
@@ -1,10 +1,12 @@
|
|
1
|
+
import type { IconSet, CacheStrategy } from './iconprovider.types';
|
1
2
|
declare class IconProviderContext {
|
3
|
+
iconSet?: IconSet;
|
2
4
|
fileExtension?: string;
|
3
5
|
url?: string;
|
4
6
|
lengthUnit?: string;
|
5
7
|
size?: number;
|
6
8
|
cacheName?: string;
|
7
|
-
cacheStrategy?:
|
9
|
+
cacheStrategy?: CacheStrategy;
|
8
10
|
static readonly context: {
|
9
11
|
__context__: IconProviderContext;
|
10
12
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -111,7 +111,7 @@ __decorate([
|
|
111
111
|
__metadata("design:type", Object)
|
112
112
|
], Spinner.prototype, "ariaLabel", void 0);
|
113
113
|
__decorate([
|
114
|
-
property({ type: String }),
|
114
|
+
property({ type: String, reflect: true }),
|
115
115
|
__metadata("design:type", String)
|
116
116
|
], Spinner.prototype, "variant", void 0);
|
117
117
|
export default Spinner;
|
@@ -3549,7 +3549,7 @@
|
|
3549
3549
|
"declarations": [
|
3550
3550
|
{
|
3551
3551
|
"kind": "class",
|
3552
|
-
"description": "IconProvider component, which allows to be consumed from sub components\n(see `providerUtils.consume` for how to consume)\n\
|
3552
|
+
"description": "IconProvider component, which allows to be consumed from sub components\n(see `providerUtils.consume` for how to consume)\n\nAttribute `iconSet` can be set to either `momentum-icons` or `custom-icons`.\nIf `momentum-icons` is selected, the icons will be fetched from the\nMomentum Design System icon set per a dynamic JS Import (no need to provide a URL).\nThis requires the consumer to have the `@momentum-designs` package installed and the\nbuild tooling needs to support dynamic imports.\n\nIf `custom-icons` is selected, the icons will be fetched from the provided URL.\nThis requires the consumer to provide a URL from which the icons will be fetched and\nthe consumer needs to make sure to bundle the icons in the application.\n\nIf `cacheStrategy` is provided (only works with iconSet = `custom-icons`), the\nIconProvider will cache the icons in the selected cache (either web-api-cache or in-memory-cache),\nto avoid fetching the same icon multiple times over the network.\nThis is useful when the same icon is used multiple times in the application.\nTo consider:\n- The `in-memory-cache` is not persisted and will be lost when the\nIconProvider is removed from the DOM.\n- The `web-api-cache` is persisted, but only works in https environments\n(https://developer.mozilla.org/en-US/docs/Web/API/Cache).",
|
3553
3553
|
"name": "IconProvider",
|
3554
3554
|
"slots": [
|
3555
3555
|
{
|
@@ -3566,13 +3566,24 @@
|
|
3566
3566
|
"description": "Context object of the IconProvider, to be consumed by child components",
|
3567
3567
|
"readonly": true
|
3568
3568
|
},
|
3569
|
+
{
|
3570
|
+
"kind": "field",
|
3571
|
+
"name": "iconSet",
|
3572
|
+
"type": {
|
3573
|
+
"text": "IconSet | undefined"
|
3574
|
+
},
|
3575
|
+
"description": "Icon set to be used\n\nIf `momentum-icons` is selected, the icons will be fetched from the\nMomentum Design System icon set per a dynamic JS Import (no need to provide a URL).\nThis requires the consumer to have the `@momentum-designs` package installed and the\nbuild tooling needs to support dynamic imports.\n\nIf `custom-icons` is selected, the icons will be fetched from the provided URL.\nThis requires the consumer to provide a URL from which the icons will be fetched and\nthe consumer needs to make sure to bundle the icons in the application.",
|
3576
|
+
"default": "momentum-icons",
|
3577
|
+
"attribute": "icon-set",
|
3578
|
+
"reflects": true
|
3579
|
+
},
|
3569
3580
|
{
|
3570
3581
|
"kind": "field",
|
3571
3582
|
"name": "url",
|
3572
3583
|
"type": {
|
3573
3584
|
"text": "string | undefined"
|
3574
3585
|
},
|
3575
|
-
"description": "Url of where icons will be fetched from",
|
3586
|
+
"description": "Url of where icons will be fetched from\n(if Icon set is `custom-icons`, this will be the base url)",
|
3576
3587
|
"attribute": "url"
|
3577
3588
|
},
|
3578
3589
|
{
|
@@ -3581,7 +3592,7 @@
|
|
3581
3592
|
"type": {
|
3582
3593
|
"text": "string | undefined"
|
3583
3594
|
},
|
3584
|
-
"description": "File extension of icons",
|
3595
|
+
"description": "File extension of icons\n(if Icon set is `custom-icons`, this will be the file extension for icons)",
|
3585
3596
|
"default": "svg",
|
3586
3597
|
"attribute": "file-extension",
|
3587
3598
|
"reflects": true
|
@@ -3612,9 +3623,9 @@
|
|
3612
3623
|
"kind": "field",
|
3613
3624
|
"name": "cacheStrategy",
|
3614
3625
|
"type": {
|
3615
|
-
"text": "
|
3626
|
+
"text": "CacheStrategy | undefined"
|
3616
3627
|
},
|
3617
|
-
"description": "Icons Cache Strategy to use\n\nChoose `in-memory-cache` to cache icons in a JS cache (in-memory cache).\nChoose `web-cache-api` to cache icons using the Web Cache API.\n\nNOTE: `cache-name` must be provided if `cache-strategy` is provided.\n\nIf not provided or invalid value provided, the icons will not be cached.",
|
3628
|
+
"description": "Icons Cache Strategy to use\n\n**Can only be used if Icon set is `custom-icons`**\n\nChoose `in-memory-cache` to cache icons in a JS cache (in-memory cache).\nChoose `web-cache-api` to cache icons using the Web Cache API.\n\nNOTE: `cache-name` must be provided if `cache-strategy` is provided.\n\nIf not provided or invalid value provided, the icons will not be cached.",
|
3618
3629
|
"default": "undefined",
|
3619
3630
|
"attribute": "cache-strategy"
|
3620
3631
|
},
|
@@ -3624,7 +3635,7 @@
|
|
3624
3635
|
"type": {
|
3625
3636
|
"text": "string | undefined"
|
3626
3637
|
},
|
3627
|
-
"description": "Icons Cache Name to use\n\nIf provided, Icons inside the provider will be cached in the\ncache (determined by `cache-strategy`) with the provided name.\n\nNOTE: `cache-name` requires `cache-strategy` to be set.\n\nIf not provided, the icons will not be cached.",
|
3638
|
+
"description": "Icons Cache Name to use (cache strategy must be provided)\n\nIf provided, Icons inside the provider will be cached in the\ncache (determined by `cache-strategy`) with the provided name.\n\nNOTE: `cache-name` requires `cache-strategy` to be set.\n\nIf not provided, the icons will not be cached.",
|
3628
3639
|
"default": "undefined",
|
3629
3640
|
"attribute": "cache-name"
|
3630
3641
|
},
|
@@ -3645,12 +3656,21 @@
|
|
3645
3656
|
}
|
3646
3657
|
],
|
3647
3658
|
"attributes": [
|
3659
|
+
{
|
3660
|
+
"name": "icon-set",
|
3661
|
+
"type": {
|
3662
|
+
"text": "IconSet | undefined"
|
3663
|
+
},
|
3664
|
+
"description": "Icon set to be used\n\nIf `momentum-icons` is selected, the icons will be fetched from the\nMomentum Design System icon set per a dynamic JS Import (no need to provide a URL).\nThis requires the consumer to have the `@momentum-designs` package installed and the\nbuild tooling needs to support dynamic imports.\n\nIf `custom-icons` is selected, the icons will be fetched from the provided URL.\nThis requires the consumer to provide a URL from which the icons will be fetched and\nthe consumer needs to make sure to bundle the icons in the application.",
|
3665
|
+
"default": "momentum-icons",
|
3666
|
+
"fieldName": "iconSet"
|
3667
|
+
},
|
3648
3668
|
{
|
3649
3669
|
"name": "url",
|
3650
3670
|
"type": {
|
3651
3671
|
"text": "string | undefined"
|
3652
3672
|
},
|
3653
|
-
"description": "Url of where icons will be fetched from",
|
3673
|
+
"description": "Url of where icons will be fetched from\n(if Icon set is `custom-icons`, this will be the base url)",
|
3654
3674
|
"fieldName": "url"
|
3655
3675
|
},
|
3656
3676
|
{
|
@@ -3658,7 +3678,7 @@
|
|
3658
3678
|
"type": {
|
3659
3679
|
"text": "string | undefined"
|
3660
3680
|
},
|
3661
|
-
"description": "File extension of icons",
|
3681
|
+
"description": "File extension of icons\n(if Icon set is `custom-icons`, this will be the file extension for icons)",
|
3662
3682
|
"default": "svg",
|
3663
3683
|
"fieldName": "fileExtension"
|
3664
3684
|
},
|
@@ -3683,9 +3703,9 @@
|
|
3683
3703
|
{
|
3684
3704
|
"name": "cache-strategy",
|
3685
3705
|
"type": {
|
3686
|
-
"text": "
|
3706
|
+
"text": "CacheStrategy | undefined"
|
3687
3707
|
},
|
3688
|
-
"description": "Icons Cache Strategy to use\n\nChoose `in-memory-cache` to cache icons in a JS cache (in-memory cache).\nChoose `web-cache-api` to cache icons using the Web Cache API.\n\nNOTE: `cache-name` must be provided if `cache-strategy` is provided.\n\nIf not provided or invalid value provided, the icons will not be cached.",
|
3708
|
+
"description": "Icons Cache Strategy to use\n\n**Can only be used if Icon set is `custom-icons`**\n\nChoose `in-memory-cache` to cache icons in a JS cache (in-memory cache).\nChoose `web-cache-api` to cache icons using the Web Cache API.\n\nNOTE: `cache-name` must be provided if `cache-strategy` is provided.\n\nIf not provided or invalid value provided, the icons will not be cached.",
|
3689
3709
|
"default": "undefined",
|
3690
3710
|
"fieldName": "cacheStrategy"
|
3691
3711
|
},
|
@@ -3694,7 +3714,7 @@
|
|
3694
3714
|
"type": {
|
3695
3715
|
"text": "string | undefined"
|
3696
3716
|
},
|
3697
|
-
"description": "Icons Cache Name to use\n\nIf provided, Icons inside the provider will be cached in the\ncache (determined by `cache-strategy`) with the provided name.\n\nNOTE: `cache-name` requires `cache-strategy` to be set.\n\nIf not provided, the icons will not be cached.",
|
3717
|
+
"description": "Icons Cache Name to use (cache strategy must be provided)\n\nIf provided, Icons inside the provider will be cached in the\ncache (determined by `cache-strategy`) with the provided name.\n\nNOTE: `cache-name` requires `cache-strategy` to be set.\n\nIf not provided, the icons will not be cached.",
|
3698
3718
|
"default": "undefined",
|
3699
3719
|
"fieldName": "cacheName"
|
3700
3720
|
}
|
@@ -3704,7 +3724,7 @@
|
|
3704
3724
|
"module": "/src/models"
|
3705
3725
|
},
|
3706
3726
|
"tagName": "mdc-iconprovider",
|
3707
|
-
"jsDoc": "/**\n * IconProvider component, which allows to be consumed from sub components\n * (see `providerUtils.consume` for how to consume)\n *\n *
|
3727
|
+
"jsDoc": "/**\n * IconProvider component, which allows to be consumed from sub components\n * (see `providerUtils.consume` for how to consume)\n *\n * Attribute `iconSet` can be set to either `momentum-icons` or `custom-icons`.\n * If `momentum-icons` is selected, the icons will be fetched from the\n * Momentum Design System icon set per a dynamic JS Import (no need to provide a URL).\n * This requires the consumer to have the `@momentum-designs` package installed and the\n * build tooling needs to support dynamic imports.\n *\n * If `custom-icons` is selected, the icons will be fetched from the provided URL.\n * This requires the consumer to provide a URL from which the icons will be fetched and\n * the consumer needs to make sure to bundle the icons in the application.\n *\n * If `cacheStrategy` is provided (only works with iconSet = `custom-icons`), the\n * IconProvider will cache the icons in the selected cache (either web-api-cache or in-memory-cache),\n * to avoid fetching the same icon multiple times over the network.\n * This is useful when the same icon is used multiple times in the application.\n * To consider:\n * - The `in-memory-cache` is not persisted and will be lost when the\n * IconProvider is removed from the DOM.\n * - The `web-api-cache` is persisted, but only works in https environments\n * (https://developer.mozilla.org/en-US/docs/Web/API/Cache).\n *\n * @tagname mdc-iconprovider\n *\n * @slot - children\n */",
|
3708
3728
|
"customElement": true
|
3709
3729
|
}
|
3710
3730
|
],
|
@@ -5823,7 +5843,8 @@
|
|
5823
5843
|
},
|
5824
5844
|
"description": "There are 2 variants of spinner: default and button. Their coloring is different.\n- **Standalone (Default)**: Track has a blue color.\n- **Button**: To be used when placed in a button to show that the button’s action is currently in progress.\nTo ensure a minimum 3:1 contrast ratio, change the active indicator color to be the same color as the button’s\nicon or label text.",
|
5825
5845
|
"default": "standalone",
|
5826
|
-
"attribute": "variant"
|
5846
|
+
"attribute": "variant",
|
5847
|
+
"reflects": true
|
5827
5848
|
}
|
5828
5849
|
],
|
5829
5850
|
"attributes": [
|
package/dist/index.d.ts
CHANGED
@@ -21,6 +21,7 @@ import FormfieldGroup from './components/formfieldgroup';
|
|
21
21
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
22
22
|
import Spinner from './components/spinner';
|
23
23
|
import type { TextType } from './components/text/text.types';
|
24
|
+
import type { SpinnerSize, SpinnerVariant } from './components/spinner/spinner.types';
|
24
25
|
export { ThemeProvider, Icon, IconProvider, Avatar, Badge, Presence, Text, Button, Bullet, Marker, Divider, AvatarButton, Input, Link, Toggle, Checkbox, Radio, VirtualizedList, Tab, FormfieldGroup, Spinner, };
|
25
|
-
export type { TextType, };
|
26
|
+
export type { TextType, SpinnerSize, SpinnerVariant, };
|
26
27
|
export { inMemoryCache, webAPIIconsCache };
|
@@ -3,12 +3,18 @@ import Component from '../../components/iconprovider';
|
|
3
3
|
* IconProvider component, which allows to be consumed from sub components
|
4
4
|
* (see `providerUtils.consume` for how to consume)
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
6
|
+
* Attribute `iconSet` can be set to either `momentum-icons` or `custom-icons`.
|
7
|
+
* If `momentum-icons` is selected, the icons will be fetched from the
|
8
|
+
* Momentum Design System icon set per a dynamic JS Import (no need to provide a URL).
|
9
|
+
* This requires the consumer to have the `@momentum-designs` package installed and the
|
10
|
+
* build tooling needs to support dynamic imports.
|
9
11
|
*
|
10
|
-
* If `
|
11
|
-
*
|
12
|
+
* If `custom-icons` is selected, the icons will be fetched from the provided URL.
|
13
|
+
* This requires the consumer to provide a URL from which the icons will be fetched and
|
14
|
+
* the consumer needs to make sure to bundle the icons in the application.
|
15
|
+
*
|
16
|
+
* If `cacheStrategy` is provided (only works with iconSet = `custom-icons`), the
|
17
|
+
* IconProvider will cache the icons in the selected cache (either web-api-cache or in-memory-cache),
|
12
18
|
* to avoid fetching the same icon multiple times over the network.
|
13
19
|
* This is useful when the same icon is used multiple times in the application.
|
14
20
|
* To consider:
|
@@ -6,12 +6,18 @@ import { TAG_NAME } from '../../components/iconprovider/iconprovider.constants';
|
|
6
6
|
* IconProvider component, which allows to be consumed from sub components
|
7
7
|
* (see `providerUtils.consume` for how to consume)
|
8
8
|
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
9
|
+
* Attribute `iconSet` can be set to either `momentum-icons` or `custom-icons`.
|
10
|
+
* If `momentum-icons` is selected, the icons will be fetched from the
|
11
|
+
* Momentum Design System icon set per a dynamic JS Import (no need to provide a URL).
|
12
|
+
* This requires the consumer to have the `@momentum-designs` package installed and the
|
13
|
+
* build tooling needs to support dynamic imports.
|
12
14
|
*
|
13
|
-
* If `
|
14
|
-
*
|
15
|
+
* If `custom-icons` is selected, the icons will be fetched from the provided URL.
|
16
|
+
* This requires the consumer to provide a URL from which the icons will be fetched and
|
17
|
+
* the consumer needs to make sure to bundle the icons in the application.
|
18
|
+
*
|
19
|
+
* If `cacheStrategy` is provided (only works with iconSet = `custom-icons`), the
|
20
|
+
* IconProvider will cache the icons in the selected cache (either web-api-cache or in-memory-cache),
|
15
21
|
* to avoid fetching the same icon multiple times over the network.
|
16
22
|
* This is useful when the same icon is used multiple times in the application.
|
17
23
|
* To consider:
|
package/package.json
CHANGED