@politiet/sheriff-web-components 1.0.0-beta.12 → 1.0.0-beta.14
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/sds-icon/sds-icon-loader.d.ts +5 -6
- package/dist/sds-icon/sds-icon-loader.d.ts.map +1 -1
- package/dist/sds-icon/sds-icon-loader.js +25 -26
- package/dist/sds-icon/sds-icon-loader.js.map +1 -1
- package/dist/sds-icon/sds-icon.d.ts +9 -16
- package/dist/sds-icon/sds-icon.d.ts.map +1 -1
- package/dist/sds-icon/sds-icon.js +21 -21
- package/dist/sds-icon/sds-icon.js.map +1 -1
- package/dist/sds-loader/sds-loader.d.ts +2 -3
- package/dist/sds-loader/sds-loader.d.ts.map +1 -1
- package/dist/sds-loader/sds-loader.js.map +1 -1
- package/dist/sds-notification/sds-notification.d.ts.map +1 -1
- package/dist/sds-notification/sds-notification.js.map +1 -1
- package/dist/sheriff-web-components.js +3696 -0
- package/package.json +4 -5
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export type IconPromise = (iconName: string) => Promise<string>;
|
|
2
|
-
export declare const loadCdnIcons: IconPromise;
|
|
3
|
-
export declare const loadLocalIcons: IconPromise;
|
|
4
2
|
export declare class SDSIconLoader {
|
|
5
|
-
private
|
|
6
|
-
|
|
3
|
+
private cache;
|
|
4
|
+
private _loadLocal;
|
|
5
|
+
get loadLocal(): boolean;
|
|
6
|
+
set loadLocal(value: boolean);
|
|
7
7
|
resolver: IconPromise;
|
|
8
|
-
constructor();
|
|
9
8
|
resolve(name: string, onResolved: (svg: string) => void): void;
|
|
10
|
-
|
|
9
|
+
clear(): void;
|
|
11
10
|
get currentLoader(): IconPromise;
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=sds-icon-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-icon-loader.d.ts","sourceRoot":"","sources":["../../src/sds-icon/sds-icon-loader.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-icon-loader.d.ts","sourceRoot":"","sources":["../../src/sds-icon/sds-icon-loader.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAahE,qBAAa,aAAa;IACzB,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,UAAU,CAAiB;IAEnC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAG3B;IAED,QAAQ,EAAE,WAAW,CAAmD;IAExE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAsB9D,KAAK,IAAI,IAAI;IAIb,IAAI,aAAa,IAAI,WAAW,CAE/B;CACD"}
|
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
const loadLocalIcons = (name) => import(`@politiet/sheriff-icons/dist/assets/${name}.js`).then(({ default: svg }) => svg);
|
|
2
|
+
const loadCdnIcons = (name) => fetch(`https://unpkg.com/@politiet/sheriff-icons/dist/assets/${name}.svg`).then((response) => {
|
|
2
3
|
if (!response.ok) {
|
|
3
4
|
throw new TypeError(`Sheriff: unknown icon: '${name}'`);
|
|
4
5
|
}
|
|
5
6
|
return response.text();
|
|
6
7
|
});
|
|
7
|
-
export const loadLocalIcons = async (name) => {
|
|
8
|
-
try {
|
|
9
|
-
const { default: svg } = await import(`@politiet/sheriff-icons/dist/${name}.js`);
|
|
10
|
-
return svg;
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
console.warn(`Local icon '${name}' could not be loaded. Falling back to CDN.`);
|
|
14
|
-
return loadCdnIcons(name);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
8
|
export class SDSIconLoader {
|
|
18
9
|
constructor() {
|
|
19
10
|
this.cache = new Map();
|
|
20
|
-
this.
|
|
11
|
+
this._loadLocal = true;
|
|
12
|
+
this.resolver = this._loadLocal ? loadLocalIcons : loadCdnIcons;
|
|
13
|
+
}
|
|
14
|
+
get loadLocal() {
|
|
15
|
+
return this._loadLocal;
|
|
16
|
+
}
|
|
17
|
+
set loadLocal(value) {
|
|
18
|
+
this._loadLocal = value;
|
|
19
|
+
this.resolver = value ? loadLocalIcons : loadCdnIcons;
|
|
21
20
|
}
|
|
22
21
|
resolve(name, onResolved) {
|
|
23
|
-
|
|
24
|
-
if (cached
|
|
22
|
+
let cached = this.cache.get(name);
|
|
23
|
+
if (typeof cached === 'string') {
|
|
25
24
|
onResolved(cached);
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
27
|
+
if (!cached) {
|
|
28
|
+
cached = this.resolver(name)
|
|
29
|
+
.catch(() => '')
|
|
30
|
+
.then((svg) => {
|
|
31
|
+
this.cache.set(name, svg);
|
|
32
|
+
return svg;
|
|
33
|
+
});
|
|
34
|
+
this.cache.set(name, cached);
|
|
35
|
+
}
|
|
36
|
+
cached.then(onResolved);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
clear() {
|
|
39
|
+
this.cache.clear();
|
|
40
40
|
}
|
|
41
41
|
get currentLoader() {
|
|
42
42
|
return this.resolver;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
SDSIconLoader.defaultResolver = loadCdnIcons;
|
|
46
45
|
//# sourceMappingURL=sds-icon-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-icon-loader.js","sourceRoot":"","sources":["../../src/sds-icon/sds-icon-loader.ts"],"names":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AAM,KAAK,QAAQ,EAAE,CAAC;YAChC,UAAU,CAAC,MAAM,CAAC,CAAC;YACnB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;iBAC1B,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;iBACf,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO,GAAG,CAAC;YACZ,CAAC,CAAC,CAAC;YAEJ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED,IAAI,aAAa;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD","sourcesContent":["export type IconPromise = (iconName: string) => Promise<string>;\n\nconst loadLocalIcons: IconPromise = (name: string) =>\n\timport(`@politiet/sheriff-icons/dist/assets/${name}.js`).then(({ default: svg }) => svg);\n\nconst loadCdnIcons: IconPromise = (name: string) =>\n\tfetch(`https://unpkg.com/@politiet/sheriff-icons/dist/assets/${name}.svg`).then((response) => {\n\t\tif (!response.ok) {\n\t\t\tthrow new TypeError(`Sheriff: unknown icon: '${name}'`);\n\t\t}\n\t\treturn response.text();\n\t});\n\nexport class SDSIconLoader {\n\tprivate cache = new Map<string, string | Promise<string>>();\n\tprivate _loadLocal: boolean = true;\n\n\tget loadLocal(): boolean {\n\t\treturn this._loadLocal;\n\t}\n\n\tset loadLocal(value: boolean) {\n\t\tthis._loadLocal = value;\n\t\tthis.resolver = value ? loadLocalIcons : loadCdnIcons;\n\t}\n\n\tresolver: IconPromise = this._loadLocal ? loadLocalIcons : loadCdnIcons;\n\n\tresolve(name: string, onResolved: (svg: string) => void): void {\n\t\tlet cached = this.cache.get(name);\n\n\t\tif (typeof cached === 'string') {\n\t\t\tonResolved(cached);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!cached) {\n\t\t\tcached = this.resolver(name)\n\t\t\t\t.catch(() => '')\n\t\t\t\t.then((svg) => {\n\t\t\t\t\tthis.cache.set(name, svg);\n\t\t\t\t\treturn svg;\n\t\t\t\t});\n\n\t\t\tthis.cache.set(name, cached);\n\t\t}\n\n\t\tcached.then(onResolved);\n\t}\n\n\tclear(): void {\n\t\tthis.cache.clear();\n\t}\n\n\tget currentLoader(): IconPromise {\n\t\treturn this.resolver;\n\t}\n}\n"]}
|
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { type IconPromise } from './sds-icon-loader';
|
|
3
|
-
import { type IconType } from './sds-icon.icon-types';
|
|
4
|
-
import { type ColorType } from './sds-icon.color-types';
|
|
5
|
-
type IconSize = 's' | 'm';
|
|
6
|
-
type IconTypes = IconType | '';
|
|
7
|
-
type IconColors = ColorType | '';
|
|
8
|
-
export interface SDSIconProps {
|
|
9
|
-
name?: IconTypes;
|
|
10
|
-
size?: IconSize;
|
|
11
|
-
color?: IconColors;
|
|
12
|
-
label?: string;
|
|
13
|
-
}
|
|
14
3
|
export declare class SDSIcon extends LitElement {
|
|
15
4
|
static styles: import("lit").CSSResult[];
|
|
16
5
|
private static readonly iconLoader;
|
|
6
|
+
static registerLoadLocal(loadLocal: boolean): void;
|
|
17
7
|
static registerResolver(resolver: IconPromise): void;
|
|
18
|
-
name:
|
|
19
|
-
size:
|
|
20
|
-
color:
|
|
8
|
+
name: string;
|
|
9
|
+
size: 's' | 'm';
|
|
10
|
+
color: string;
|
|
21
11
|
label: string;
|
|
22
12
|
private svg;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
/**
|
|
15
|
+
* The updated callback is used to observe the name prop for changes
|
|
16
|
+
* and update the svg accordingly with the fetchIcon function
|
|
17
|
+
*/
|
|
23
18
|
private fetchIcon;
|
|
24
19
|
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
25
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
26
20
|
}
|
|
27
21
|
declare global {
|
|
28
22
|
interface HTMLElementTagNameMap {
|
|
29
23
|
'sds-icon': SDSIcon;
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
|
-
export {};
|
|
33
26
|
//# sourceMappingURL=sds-icon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-icon.d.ts","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-icon.d.ts","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGpE,qBACa,OAAQ,SAAQ,UAAU;IAEtC,OAAgB,MAAM,4BAAY;IAElC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAuB;IAEzD,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAIlD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;IAIT,IAAI,EAAE,MAAM,CAAM;IAClB,IAAI,EAAE,GAAG,GAAG,GAAG,CAAO;IACtB,KAAK,EAAE,MAAM,CAAM;IACnB,KAAK,EAAE,MAAM,CAAM;IAErD,OAAO,CAAC,GAAG,CAAc;IAEzB,MAAM;IAaf;;;OAGG;YACW,SAAS;IAWd,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAOjF;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,UAAU,EAAE,OAAO,CAAC;KACpB;CACD"}
|
|
@@ -20,24 +20,36 @@ let SDSIcon = SDSIcon_1 = class SDSIcon extends LitElement {
|
|
|
20
20
|
this.label = '';
|
|
21
21
|
this.svg = '';
|
|
22
22
|
}
|
|
23
|
+
static registerLoadLocal(loadLocal) {
|
|
24
|
+
this.iconLoader.loadLocal = loadLocal;
|
|
25
|
+
}
|
|
23
26
|
static registerResolver(resolver) {
|
|
24
27
|
this.iconLoader.resolver = resolver;
|
|
25
28
|
}
|
|
29
|
+
render() {
|
|
30
|
+
return html `<div
|
|
31
|
+
class="sds-icon"
|
|
32
|
+
role="${ifDefined(this.label ? 'img' : undefined)}"
|
|
33
|
+
style="${ifDefined(this.color ? `color:${this.color}` : undefined)}"
|
|
34
|
+
aria-label="${ifDefined(this.label)}"
|
|
35
|
+
>
|
|
36
|
+
${this.name
|
|
37
|
+
? html `<slot aria-hidden="true">${unsafeSVG(this.svg)}</slot>`
|
|
38
|
+
: html `<slot aria-hidden="true"></slot>`}
|
|
39
|
+
</div>`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The updated callback is used to observe the name prop for changes
|
|
43
|
+
* and update the svg accordingly with the fetchIcon function
|
|
44
|
+
*/
|
|
26
45
|
async fetchIcon() {
|
|
27
46
|
if (!this.name) {
|
|
28
47
|
this.svg = '';
|
|
29
48
|
return;
|
|
30
49
|
}
|
|
31
|
-
|
|
32
|
-
const svg = await new Promise((resolve) => {
|
|
33
|
-
SDSIcon_1.iconLoader.resolve(this.name, resolve);
|
|
34
|
-
});
|
|
50
|
+
SDSIcon_1.iconLoader.resolve(this.name, (svg) => {
|
|
35
51
|
this.svg = svg;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error(`Failed to fetch SVG for icon '${this.name}':`, error);
|
|
39
|
-
this.svg = '';
|
|
40
|
-
}
|
|
52
|
+
});
|
|
41
53
|
}
|
|
42
54
|
updated(changedProperties) {
|
|
43
55
|
super.updated(changedProperties);
|
|
@@ -45,18 +57,6 @@ let SDSIcon = SDSIcon_1 = class SDSIcon extends LitElement {
|
|
|
45
57
|
void this.fetchIcon();
|
|
46
58
|
}
|
|
47
59
|
}
|
|
48
|
-
render() {
|
|
49
|
-
return html `<div
|
|
50
|
-
class="sds-icon"
|
|
51
|
-
role="${ifDefined(this.label ? 'img' : undefined)}"
|
|
52
|
-
style="${ifDefined(this.color ? `color:${this.color}` : undefined)}"
|
|
53
|
-
aria-label="${ifDefined(this.label)}"
|
|
54
|
-
>
|
|
55
|
-
${this.name
|
|
56
|
-
? html `<slot aria-hidden="true">${unsafeSVG(this.svg)}</slot>`
|
|
57
|
-
: html `<slot aria-hidden="true"></slot>`}
|
|
58
|
-
</div>`;
|
|
59
|
-
}
|
|
60
60
|
};
|
|
61
61
|
// Styling
|
|
62
62
|
SDSIcon.styles = [styles];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-icon.js","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAoB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-icon.js","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.ts"],"names":[],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,CAAC;IACT,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,SAAS;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;YACd,OAAO;QACR,CAAC;QAED,SAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC;IAEQ,OAAO,CAAC,iBAAyD;QACzE,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAEjC,IAAI,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAChD,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;;AAtDD,UAAU;AACM,cAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAEV,kBAAU,GAAG,IAAI,aAAa,EAAE,AAAtB,CAAuB;AAUd;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCAAmB;AAClB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCAAuB;AACtB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAoB;AACnB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAoB;AAE7C;IAAhB,KAAK,EAAE;oCAA0B;AAnBtB,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAwDnB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js';\nimport { SDSIconLoader, type IconPromise } from './sds-icon-loader';\nimport { styles } from './sds-icon.styles';\n\n@customElement('sds-icon')\nexport class SDSIcon extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\tprivate static readonly iconLoader = new SDSIconLoader();\n\n\tstatic registerLoadLocal(loadLocal: boolean): void {\n\t\tthis.iconLoader.loadLocal = loadLocal;\n\t}\n\n\tstatic registerResolver(resolver: IconPromise): void {\n\t\tthis.iconLoader.resolver = resolver;\n\t}\n\n\t@property({ type: String, reflect: true }) name: string = '';\n\t@property({ type: String, reflect: true }) size: 's' | 'm' = 'm';\n\t@property({ type: String, reflect: true }) color: string = '';\n\t@property({ type: String, reflect: true }) label: string = '';\n\n\t@state() private svg: string = '';\n\n\toverride render() {\n\t\treturn html`<div\n\t\t\tclass=\"sds-icon\"\n\t\t\trole=\"${ifDefined(this.label ? 'img' : undefined)}\"\n\t\t\tstyle=\"${ifDefined(this.color ? `color:${this.color}` : undefined)}\"\n\t\t\taria-label=\"${ifDefined(this.label)}\"\n\t\t>\n\t\t\t${this.name\n\t\t\t\t? html`<slot aria-hidden=\"true\">${unsafeSVG(this.svg)}</slot>`\n\t\t\t\t: html`<slot aria-hidden=\"true\"></slot>`}\n\t\t</div>`;\n\t}\n\n\t/**\n\t * The updated callback is used to observe the name prop for changes\n\t * and update the svg accordingly with the fetchIcon function\n\t */\n\tprivate async fetchIcon() {\n\t\tif (!this.name) {\n\t\t\tthis.svg = '';\n\t\t\treturn;\n\t\t}\n\n\t\tSDSIcon.iconLoader.resolve(this.name, (svg) => {\n\t\t\tthis.svg = svg;\n\t\t});\n\t}\n\n\toverride updated(changedProperties: Map<string | number | symbol, unknown>): void {\n\t\tsuper.updated(changedProperties);\n\n\t\tif (changedProperties.has('name') && this.name) {\n\t\t\tvoid this.fetchIcon();\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-icon': SDSIcon;\n\t}\n}\n"]}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { type ColorType } from '../sds-icon/sds-icon.color-types';
|
|
3
2
|
type LoaderSize = 'large' | 'medium' | 'small';
|
|
4
3
|
export interface SDSLoaderProps {
|
|
5
4
|
size?: LoaderSize;
|
|
6
|
-
color?:
|
|
5
|
+
color?: string;
|
|
7
6
|
}
|
|
8
7
|
export declare class SDSLoader extends LitElement {
|
|
9
8
|
static styles: import("lit").CSSResult[];
|
|
10
9
|
size: LoaderSize;
|
|
11
|
-
color:
|
|
10
|
+
color: string;
|
|
12
11
|
render(): import("lit-html").TemplateResult<1>;
|
|
13
12
|
}
|
|
14
13
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-loader.d.ts","sourceRoot":"","sources":["../../src/sds-loader/sds-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-loader.d.ts","sourceRoot":"","sources":["../../src/sds-loader/sds-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,KAAK,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBACa,SAAU,SAAQ,UAAU;IAExC,OAAgB,MAAM,4BAAY;IAGS,IAAI,EAAE,UAAU,CAAW;IAC3B,KAAK,EAAE,MAAM,CAAkB;IAEjE,MAAM;CASf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,YAAY,EAAE,SAAS,CAAC;KACxB;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-loader.js","sourceRoot":"","sources":["../../src/sds-loader/sds-loader.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-loader.js","sourceRoot":"","sources":["../../src/sds-loader/sds-loader.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAUtC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAIN,iBAAiB;QAC0B,SAAI,GAAe,OAAO,CAAC;QAC3B,UAAK,GAAW,cAAc,CAAC;IAW3E,CAAC;IATS,MAAM;QACd,MAAM,aAAa,GAAG;YACrB,YAAY,EAAE,IAAI;YAClB,oBAAoB,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC5C,mBAAmB,EAAE,IAAI,CAAC,IAAI,KAAK,OAAO;SAC1C,CAAC;QAEF,OAAO,IAAI,CAAA,gBAAgB,QAAQ,CAAC,aAAa,CAAC,YAAY,SAAS,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC;IAChG,CAAC;;AAfD,UAAU;AACM,gBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAGS;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAA4B;AAC3B;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAgC;AAN9D,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAiBrB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './sds-loader.styles';\n\ntype LoaderSize = 'large' | 'medium' | 'small';\n\nexport interface SDSLoaderProps {\n\tsize?: LoaderSize;\n\tcolor?: string;\n}\n\n@customElement('sds-loader')\nexport class SDSLoader extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String, reflect: true }) size: LoaderSize = 'large';\n\t@property({ type: String, reflect: true }) color: string = 'currentColor';\n\n\toverride render() {\n\t\tconst loaderClasses = {\n\t\t\t'sds-loader': true,\n\t\t\t'sds-loader--medium': this.size === 'medium',\n\t\t\t'sds-loader--small': this.size === 'small',\n\t\t};\n\n\t\treturn html`<span class=\"${classMap(loaderClasses)}\" style=\"${`color:${this.color}`}\"></span>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-loader': SDSLoader;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-notification.d.ts","sourceRoot":"","sources":["../../src/sds-notification/sds-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-notification.d.ts","sourceRoot":"","sources":["../../src/sds-notification/sds-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAKhD,OAAO,sBAAsB,CAAC;AAE9B,KAAK,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAUrF,MAAM,WAAW,oBAAoB;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CAC3C;AAED,qBACa,eAAgB,SAAQ,UAAU;IAE9C,OAAgB,MAAM,4BAAY;IAGS,OAAO,EAAE,mBAAmB,CAAU;IACR,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAOtB;IAEO,MAAM;CA2Bf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,kBAAkB,EAAE,eAAe,CAAC;KACpC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-notification.js","sourceRoot":"","sources":["../../src/sds-notification/sds-notification.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-notification.js","sourceRoot":"","sources":["../../src/sds-notification/sds-notification.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,sBAAsB,CAAC;AAI9B,MAAM,iBAAiB,GAAwC;IAC9D,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,8BAA8B;IACvC,SAAS,EAAE,uBAAuB;IAClC,OAAO,EAAE,yBAAyB;IAClC,QAAQ,EAAE,2BAA2B;CACrC,CAAC;AASK,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAIN,iBAAiB;QAC0B,YAAO,GAAwB,MAAM,CAAC;QAGhE,YAAO,GAAG,GAAG,EAAE;YAC/B,IAAI,CAAC,aAAa,CACjB,IAAI,WAAW,CAAC,YAAY,EAAE;gBAC7B,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACd,CAAC,CACF,CAAC;QACH,CAAC,CAAC;IA6BH,CAAC;IA3BS,MAAM;QACd,MAAM,mBAAmB,GAAG;YAC3B,kBAAkB,EAAE,IAAI;YACxB,CAAC,qBAAqB,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI;SAC3C,CAAC;QAEF,OAAO,IAAI,CAAA,eAAe,QAAQ,CAAC,mBAAmB,CAAC;;qDAEJ,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;;;;;;;MAO9E,IAAI,CAAC,cAAc;YACpB,CAAC,CAAC,IAAI,CAAA;;gBAEK,IAAI,CAAC,OAAO;qBACP,IAAI,CAAC,cAAc;;;gBAGxB;YACX,CAAC,CAAC,OAAO;;SAEL,CAAC;IACT,CAAC;;AA1CD,UAAU;AACM,sBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAGS;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAuC;AACR;IAAxE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDAAyB;AANrF,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CA4C3B","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './sds-notification.styles';\n\nimport '../sds-icon/sds-icon';\n\ntype NotificationVariant = 'info' | 'success' | 'attention' | 'warning' | 'critical';\n\nconst notificationIcons: Record<NotificationVariant, string> = {\n\tinfo: 'info-material-filled',\n\tsuccess: 'check_circle-material-filled',\n\tattention: 'error-material-filled',\n\twarning: 'warning-material-filled',\n\tcritical: 'dangerous-material-filled',\n};\n\nexport interface SDSNotificationProps {\n\tvariant?: NotificationVariant;\n\t'removable-label'?: string;\n\tonSdsRemove?: (event: CustomEvent) => void;\n}\n\n@customElement('sds-notification')\nexport class SDSNotification extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String, reflect: true }) variant: NotificationVariant = 'info';\n\t@property({ type: String, attribute: 'removable-label', reflect: true }) removableLabel?: string;\n\n\tprivate readonly _remove = () => {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('sds-remove', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t})\n\t\t);\n\t};\n\n\toverride render() {\n\t\tconst notificationClasses = {\n\t\t\t'sds-notification': true,\n\t\t\t[`sds-notification--${this.variant}`]: true,\n\t\t};\n\n\t\treturn html`<div class=\"${classMap(notificationClasses)}\">\n\t\t\t<div class=\"sds-notification__type\">\n\t\t\t\t<sds-icon class=\"sds-notification__icon\" name=\"${notificationIcons[this.variant]}\" size=\"m\"></sds-icon>\n\t\t\t</div>\n\t\t\t<div class=\"sds-notification__content\">\n\t\t\t\t<div class=\"sds-notification__content-text\">\n\t\t\t\t\t<slot name=\"title\"></slot>\n\t\t\t\t\t<slot name=\"message\"></slot>\n\t\t\t\t</div>\n\t\t\t\t${this.removableLabel\n\t\t\t\t\t? html`<button\n\t\t\t\t\t\t\tclass=\"sds-notification__remove-btn\"\n\t\t\t\t\t\t\t@click=${this._remove}\n\t\t\t\t\t\t\taria-label=\"${this.removableLabel}\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<sds-icon name=\"close-material-outlined\" size=\"s\"></sds-icon>\n\t\t\t\t\t\t</button>`\n\t\t\t\t\t: nothing}\n\t\t\t</div>\n\t\t</div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-notification': SDSNotification;\n\t}\n}\n"]}
|