@politiet/sheriff-web-components 0.0.1 → 0.1.1
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/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/sds-button/sds-button.d.ts +20 -0
- package/dist/sds-button/sds-button.d.ts.map +1 -0
- package/dist/{s-button/s-button.js → sds-button/sds-button.js} +9 -8
- package/dist/sds-button/sds-button.js.map +1 -0
- package/dist/sds-button/sds-button.styles.d.ts +2 -0
- package/dist/sds-button/sds-button.styles.d.ts.map +1 -0
- package/dist/{s-button/s-button.styles.js → sds-button/sds-button.styles.js} +7 -6
- package/dist/sds-button/sds-button.styles.js.map +1 -0
- package/dist/sds-chip/sds-chip.d.ts +21 -0
- package/dist/sds-chip/sds-chip.d.ts.map +1 -0
- package/dist/sds-chip/sds-chip.js +106 -0
- package/dist/sds-chip/sds-chip.js.map +1 -0
- package/dist/{s-button/s-button.styles.d.ts → sds-chip/sds-chip.styles.d.ts} +1 -1
- package/dist/sds-chip/sds-chip.styles.d.ts.map +1 -0
- package/dist/sds-chip/sds-chip.styles.js +109 -0
- package/dist/sds-chip/sds-chip.styles.js.map +1 -0
- package/dist/sds-nav-card/sds-nav-card.d.ts +32 -0
- package/dist/sds-nav-card/sds-nav-card.d.ts.map +1 -0
- package/dist/sds-nav-card/sds-nav-card.js +116 -0
- package/dist/sds-nav-card/sds-nav-card.js.map +1 -0
- package/dist/sds-nav-card/sds-nav-card.styles.d.ts +2 -0
- package/dist/sds-nav-card/sds-nav-card.styles.d.ts.map +1 -0
- package/dist/sds-nav-card/sds-nav-card.styles.js +158 -0
- package/dist/sds-nav-card/sds-nav-card.styles.js.map +1 -0
- package/package.json +17 -12
- package/dist/s-button/s-button.d.ts +0 -16
- package/dist/s-button/s-button.d.ts.map +0 -1
- package/dist/s-button/s-button.js.map +0 -1
- package/dist/s-button/s-button.styles.d.ts.map +0 -1
- package/dist/s-button/s-button.styles.js.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './sds-button/sds-button';\nexport * from './sds-chip/sds-chip';\nexport * from './sds-nav-card/sds-nav-card';\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
type ButtonType = 'button' | 'submit' | 'reset';
|
|
3
|
+
type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
4
|
+
type ButtonSize = 'large' | 'medium' | 'small';
|
|
5
|
+
export declare class SButton extends LitElement {
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
name: string;
|
|
8
|
+
type: ButtonType;
|
|
9
|
+
variant: ButtonVariant;
|
|
10
|
+
size: ButtonSize;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
}
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
'sds-button': SButton;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=sds-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-button.d.ts","sourceRoot":"","sources":["../../src/sds-button/sds-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,KAAK,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAChD,KAAK,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAC1D,KAAK,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/C,qBACa,OAAQ,SAAQ,UAAU;IAEtC,OAAgB,MAAM,4BAAY;IAIlC,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAE,UAAU,CAAY;IAG5B,OAAO,EAAE,aAAa,CAAa;IAGnC,IAAI,EAAE,UAAU,CAAW;IAG3B,QAAQ,EAAE,OAAO,CAAS;IAEjB,MAAM;CAoBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,YAAY,EAAE,OAAO,CAAC;KACtB;CACD"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { LitElement, html } from 'lit';
|
|
8
8
|
import { customElement, property } from 'lit/decorators.js';
|
|
9
9
|
import { classMap } from 'lit/directives/class-map.js';
|
|
10
|
-
import { styles } from './
|
|
10
|
+
import { styles } from './sds-button.styles';
|
|
11
11
|
let SButton = class SButton extends LitElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
@@ -18,14 +18,15 @@ let SButton = class SButton extends LitElement {
|
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
20
|
const buttonClasses = {
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
21
|
+
'sds-button': true,
|
|
22
|
+
'sds-button--secondary': this.variant === 'secondary',
|
|
23
|
+
'sds-button--tertiary': this.variant === 'tertiary',
|
|
24
|
+
'sds-button--medium': this.size === 'medium',
|
|
25
|
+
'sds-button--small': this.size === 'small',
|
|
25
26
|
};
|
|
26
27
|
return html `
|
|
27
28
|
<button
|
|
28
|
-
class="
|
|
29
|
+
class="${classMap(buttonClasses)}"
|
|
29
30
|
type="${this.type}"
|
|
30
31
|
name="${this.name}"
|
|
31
32
|
?disabled="${this.disabled}"
|
|
@@ -53,7 +54,7 @@ __decorate([
|
|
|
53
54
|
property({ type: Boolean })
|
|
54
55
|
], SButton.prototype, "disabled", void 0);
|
|
55
56
|
SButton = __decorate([
|
|
56
|
-
customElement('
|
|
57
|
+
customElement('sds-button')
|
|
57
58
|
], SButton);
|
|
58
59
|
export { SButton };
|
|
59
|
-
//# sourceMappingURL=
|
|
60
|
+
//# sourceMappingURL=sds-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-button.js","sourceRoot":"","sources":["../../src/sds-button/sds-button.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;AAOtC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QASN,SAAI,GAAe,QAAQ,CAAC;QAG5B,YAAO,GAAkB,SAAS,CAAC;QAGnC,SAAI,GAAe,OAAO,CAAC;QAG3B,aAAQ,GAAY,KAAK,CAAC;IAsB3B,CAAC;IApBS,MAAM;QACd,MAAM,aAAa,GAAG;YACrB,YAAY,EAAE,IAAI;YAClB,uBAAuB,EAAE,IAAI,CAAC,OAAO,KAAK,WAAW;YACrD,sBAAsB,EAAE,IAAI,CAAC,OAAO,KAAK,UAAU;YACnD,oBAAoB,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC5C,mBAAmB,EAAE,IAAI,CAAC,IAAI,KAAK,OAAO;SAC1C,CAAC;QAEF,OAAO,IAAI,CAAA;;aAEA,QAAQ,CAAC,aAAa,CAAC;YACxB,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,IAAI;iBACJ,IAAI,CAAC,QAAQ;;;;GAI3B,CAAC;IACH,CAAC;;AAtCD,UAAU;AACM,cAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAIlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACC;AAG5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACQ;AAGnC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACA;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACF;AAlBd,OAAO;IADnB,aAAa,CAAC,YAAY,CAAC;GACf,OAAO,CAwCnB","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-button.styles';\n\ntype ButtonType = 'button' | 'submit' | 'reset';\ntype ButtonVariant = 'primary' | 'secondary' | 'tertiary';\ntype ButtonSize = 'large' | 'medium' | 'small';\n\n@customElement('sds-button')\nexport class SButton extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String })\n\tname!: string;\n\n\t@property({ type: String })\n\ttype: ButtonType = 'button';\n\n\t@property({ type: String })\n\tvariant: ButtonVariant = 'primary';\n\n\t@property({ type: String })\n\tsize: ButtonSize = 'large';\n\n\t@property({ type: Boolean })\n\tdisabled: boolean = false;\n\n\toverride render() {\n\t\tconst buttonClasses = {\n\t\t\t'sds-button': true,\n\t\t\t'sds-button--secondary': this.variant === 'secondary',\n\t\t\t'sds-button--tertiary': this.variant === 'tertiary',\n\t\t\t'sds-button--medium': this.size === 'medium',\n\t\t\t'sds-button--small': this.size === 'small',\n\t\t};\n\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tclass=\"${classMap(buttonClasses)}\"\n\t\t\t\ttype=\"${this.type}\"\n\t\t\t\tname=\"${this.name}\"\n\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t>\n\t\t\t\t<slot></slot>\n\t\t\t</button>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-button': SButton;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-button.styles.d.ts","sourceRoot":"","sources":["../../src/sds-button/sds-button.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAiHlB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
export const styles = css `
|
|
3
|
-
.
|
|
3
|
+
.sds-button {
|
|
4
4
|
align-items: center;
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
gap: var(--sds-spacing-3, 8px);
|
|
@@ -39,11 +39,12 @@ export const styles = css `
|
|
|
39
39
|
&:disabled {
|
|
40
40
|
background-color: var(--sds-color-semantic-surface-disabled);
|
|
41
41
|
border: 2px solid var(--sds-color-semantic-surface-disabled);
|
|
42
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
42
43
|
cursor: not-allowed;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
.
|
|
47
|
+
.sds-button--secondary {
|
|
47
48
|
background-color: var(--sds-color-semantic-surface-action-inverted);
|
|
48
49
|
border: 2px solid var(--sds-color-semantic-border-action);
|
|
49
50
|
color: var(--sds-color-semantic-text-default);
|
|
@@ -71,7 +72,7 @@ export const styles = css `
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
.
|
|
75
|
+
.sds-button--tertiary {
|
|
75
76
|
background-color: transparent;
|
|
76
77
|
border: 2px solid transparent;
|
|
77
78
|
color: var(--sds-color-semantic-text-action-default);
|
|
@@ -103,13 +104,13 @@ export const styles = css `
|
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
.
|
|
107
|
+
.sds-button--medium {
|
|
107
108
|
padding: var(--sds-spacing-1) var(--sds-spacing-3);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
.
|
|
111
|
+
.sds-button--small {
|
|
111
112
|
font-size: 0.875rem;
|
|
112
113
|
padding: 0 var(--sds-spacing-3);
|
|
113
114
|
}
|
|
114
115
|
`;
|
|
115
|
-
//# sourceMappingURL=
|
|
116
|
+
//# sourceMappingURL=sds-button.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-button.styles.js","sourceRoot":"","sources":["../../src/sds-button/sds-button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t.sds-button {\n\t\talign-items: center;\n\t\tdisplay: inline-flex;\n\t\tgap: var(--sds-spacing-3, 8px);\n\t\tjustify-content: center;\n\t\tpadding: var(--sds-spacing-3) var(--sds-spacing-4);\n\n\t\tbackground-color: var(--sds-color-semantic-surface-action-default);\n\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\tborder-radius: var(--sds-radius-4);\n\t\tcursor: pointer;\n\n\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\tfont-family: 'Roboto';\n\t\tfont-size: 1rem;\n\t\tfont-weight: 500;\n\t\tline-height: 1.5;\n\t\ttext-align: center;\n\n\t\t&:focus {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-default);\n\t\t\toutline: 2px solid var(--sds-color-semantic-surface-action-default);\n\t\t\toutline-offset: 1px;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-hover);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-hover);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\toutline: 0;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-disabled);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-disabled);\n\t\t\tcolor: var(--sds-color-semantic-text-subtle);\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n\n\t.sds-button--secondary {\n\t\tbackground-color: var(--sds-color-semantic-surface-action-inverted);\n\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\tcolor: var(--sds-color-semantic-text-default);\n\n\t\t&:focus {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-inverted);\n\t\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-subtle);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t\toutline: 0;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tborder: 2px solid var(--sds-color-semantic-border-disabled);\n\t\t\tbackground: var(--sds-color-semantic-surface-action-inverted);\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t}\n\t}\n\n\t.sds-button--tertiary {\n\t\tbackground-color: transparent;\n\t\tborder: 2px solid transparent;\n\t\tcolor: var(--sds-color-semantic-text-action-default);\n\n\t\t&:focus {\n\t\t\tbackground-color: transparent;\n\t\t\tborder: 2px solid transparent;\n\t\t\ttext-decoration: underline;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-subtle);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t\toutline: 0;\n\t\t\tposition: relative;\n\t\t\ttext-decoration: underline;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tborder: 2px solid transparent;\n\t\t\tbackground: transparent;\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t\ttext-decoration: underline;\n\t\t}\n\t}\n\n\t.sds-button--medium {\n\t\tpadding: var(--sds-spacing-1) var(--sds-spacing-3);\n\t}\n\n\t.sds-button--small {\n\t\tfont-size: 0.875rem;\n\t\tpadding: 0 var(--sds-spacing-3);\n\t}\n`;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class SChip extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
size: 'large' | 'medium' | 'small';
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
selectable: boolean;
|
|
7
|
+
selected: boolean;
|
|
8
|
+
removable: boolean;
|
|
9
|
+
onSelect: () => void;
|
|
10
|
+
onUnselect: () => void;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
_unselect(): void;
|
|
13
|
+
_select(): void;
|
|
14
|
+
_toggle(): void;
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLElementTagNameMap {
|
|
18
|
+
'sds-chip': SChip;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sds-chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-chip.d.ts","sourceRoot":"","sources":["../../src/sds-chip/sds-chip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,qBACa,KAAM,SAAQ,UAAU;IAEpC,OAAgB,MAAM,4BAAY;IAIlC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAW;IAG7C,QAAQ,UAAS;IAGjB,UAAU,UAAS;IAGnB,QAAQ,UAAS;IAGjB,SAAS,UAAS;IAGlB,QAAQ,aAAY;IAGpB,UAAU,aAAY;IAEb,MAAM;IA+Bf,SAAS;IAWT,OAAO;IAWP,OAAO;CASP;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,UAAU,EAAE,KAAK,CAAC;KAClB;CACD"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
8
|
+
import { LitElement, html } from 'lit';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
11
|
+
import { styles } from './sds-chip.styles';
|
|
12
|
+
let SChip = class SChip extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
// Reactive Props
|
|
16
|
+
this.size = 'large';
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
this.selectable = false;
|
|
19
|
+
this.selected = false;
|
|
20
|
+
this.removable = false;
|
|
21
|
+
this.onSelect = () => { };
|
|
22
|
+
this.onUnselect = () => { };
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
const buttonClasses = {
|
|
26
|
+
'sds-chip--medium': this.size === 'medium',
|
|
27
|
+
'sds-chip--small': this.size === 'small',
|
|
28
|
+
'sds-chip--selectable': this.selectable,
|
|
29
|
+
'sds-chip--selected': this.selected,
|
|
30
|
+
};
|
|
31
|
+
return html `
|
|
32
|
+
<button
|
|
33
|
+
class="sds-chip${classMap(buttonClasses)}"
|
|
34
|
+
data-size=${this.size}
|
|
35
|
+
?disabled=${this.disabled}
|
|
36
|
+
?data-removable=${this.removable}
|
|
37
|
+
?data-selectable=${this.selectable}
|
|
38
|
+
?data-selected=${this.selected}
|
|
39
|
+
@click=${this._toggle}
|
|
40
|
+
>
|
|
41
|
+
<slot></slot>
|
|
42
|
+
${this.removable
|
|
43
|
+
? html `<button
|
|
44
|
+
class="sds-chip-remove-button"
|
|
45
|
+
@click=${this._unselect}
|
|
46
|
+
>
|
|
47
|
+
<span>X</span>
|
|
48
|
+
</button>`
|
|
49
|
+
: ''}
|
|
50
|
+
</button>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
_unselect() {
|
|
54
|
+
this.onUnselect();
|
|
55
|
+
this.dispatchEvent(new CustomEvent('chip-unselect', {
|
|
56
|
+
detail: { node: this },
|
|
57
|
+
bubbles: true,
|
|
58
|
+
composed: true,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
_select() {
|
|
62
|
+
this.onSelect();
|
|
63
|
+
this.dispatchEvent(new CustomEvent('chip-select', {
|
|
64
|
+
detail: { node: this },
|
|
65
|
+
bubbles: true,
|
|
66
|
+
composed: true,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
_toggle() {
|
|
70
|
+
if (!this.selectable)
|
|
71
|
+
return;
|
|
72
|
+
if (this.selected) {
|
|
73
|
+
this._unselect();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this._select();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
// Styling
|
|
80
|
+
SChip.styles = [styles];
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: String })
|
|
83
|
+
], SChip.prototype, "size", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
property({ type: Boolean })
|
|
86
|
+
], SChip.prototype, "disabled", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: Boolean })
|
|
89
|
+
], SChip.prototype, "selectable", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: Boolean })
|
|
92
|
+
], SChip.prototype, "selected", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: Boolean })
|
|
95
|
+
], SChip.prototype, "removable", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ attribute: false })
|
|
98
|
+
], SChip.prototype, "onSelect", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ attribute: false })
|
|
101
|
+
], SChip.prototype, "onUnselect", void 0);
|
|
102
|
+
SChip = __decorate([
|
|
103
|
+
customElement('sds-chip')
|
|
104
|
+
], SChip);
|
|
105
|
+
export { SChip };
|
|
106
|
+
//# sourceMappingURL=sds-chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-chip.js","sourceRoot":"","sources":["../../src/sds-chip/sds-chip.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAsD;AACtD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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YACb,QAAQ,EAAE,IAAI;SACd,CAAC,CACF,CAAC;IACH,CAAC;IAED,OAAO;QACN,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,aAAa,CACjB,IAAI,WAAW,CAAC,aAAa,EAAE;YAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;YACtB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACd,CAAC,CACF,CAAC;IACH,CAAC;IAED,OAAO;QACN,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAE7B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,OAAO;QACR,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;;AAtFD,UAAU;AACM,YAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAIlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mCACkB;AAG7C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACT;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACX;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACV;AAGlB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uCACX;AAGpB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCACT;AAxBV,KAAK;IADjB,aAAa,CAAC,UAAU,CAAC;GACb,KAAK,CAwFjB","sourcesContent":["/* eslint-disable @typescript-eslint/unbound-method */\nimport { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './sds-chip.styles';\n\n@customElement('sds-chip')\nexport class SChip extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String })\n\tsize: 'large' | 'medium' | 'small' = 'large';\n\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t@property({ type: Boolean })\n\tselectable = false;\n\n\t@property({ type: Boolean })\n\tselected = false;\n\n\t@property({ type: Boolean })\n\tremovable = false;\n\n\t@property({ attribute: false })\n\tonSelect = () => {};\n\n\t@property({ attribute: false })\n\tonUnselect = () => {};\n\n\toverride render() {\n\t\tconst buttonClasses = {\n\t\t\t'sds-chip--medium': this.size === 'medium',\n\t\t\t'sds-chip--small': this.size === 'small',\n\t\t\t'sds-chip--selectable': this.selectable,\n\t\t\t'sds-chip--selected': this.selected,\n\t\t};\n\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tclass=\"sds-chip${classMap(buttonClasses)}\"\n\t\t\t\tdata-size=${this.size}\n\t\t\t\t?disabled=${this.disabled}\n\t\t\t\t?data-removable=${this.removable}\n\t\t\t\t?data-selectable=${this.selectable}\n\t\t\t\t?data-selected=${this.selected}\n\t\t\t\t@click=${this._toggle}\n\t\t\t>\n\t\t\t\t<slot></slot>\n\t\t\t\t${this.removable\n\t\t\t\t\t? html`<button\n\t\t\t\t\t\t\tclass=\"sds-chip-remove-button\"\n\t\t\t\t\t\t\t@click=${this._unselect}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>X</span>\n\t\t\t\t\t\t</button>`\n\t\t\t\t\t: ''}\n\t\t\t</button>\n\t\t`;\n\t}\n\n\t_unselect() {\n\t\tthis.onUnselect();\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('chip-unselect', {\n\t\t\t\tdetail: { node: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t})\n\t\t);\n\t}\n\n\t_select() {\n\t\tthis.onSelect();\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('chip-select', {\n\t\t\t\tdetail: { node: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t})\n\t\t);\n\t}\n\n\t_toggle() {\n\t\tif (!this.selectable) return;\n\n\t\tif (this.selected) {\n\t\t\tthis._unselect();\n\t\t\treturn;\n\t\t}\n\t\tthis._select();\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-chip': SChip;\n\t}\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const styles: import("lit").CSSResult;
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=sds-chip.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-chip.styles.d.ts","sourceRoot":"","sources":["../../src/sds-chip/sds-chip.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA0GlB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
.sds-chip {
|
|
4
|
+
align-items: center;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
gap: var(--sds-spacing-3, 8px);
|
|
7
|
+
justify-content: center;
|
|
8
|
+
padding: var(--sds-spacing-3) var(--sds-spacing-4);
|
|
9
|
+
|
|
10
|
+
background-color: var(--sds-color-semantic-surface-action-inverted);
|
|
11
|
+
border: 2px solid var(--sds-color-semantic-border-action);
|
|
12
|
+
border-radius: 5rem;
|
|
13
|
+
|
|
14
|
+
font-family: 'Roboto';
|
|
15
|
+
font-size: 1rem;
|
|
16
|
+
line-height: 1.5;
|
|
17
|
+
text-align: center;
|
|
18
|
+
|
|
19
|
+
&[data-selectable] {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
|
|
22
|
+
&:focus {
|
|
23
|
+
background-color: var(
|
|
24
|
+
--sds-color-semantic-surface-action-subtle
|
|
25
|
+
);
|
|
26
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
background-color: var(
|
|
31
|
+
--sds-color-semantic-surface-action-hover
|
|
32
|
+
);
|
|
33
|
+
border-color: var(--sds-color-semantic-surface-action-hover);
|
|
34
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:active {
|
|
38
|
+
background-color: var(
|
|
39
|
+
--sds-color-semantic-surface-action-active
|
|
40
|
+
);
|
|
41
|
+
border: 2px solid
|
|
42
|
+
var(--sds-color-semantic-surface-action-active);
|
|
43
|
+
outline: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&[data-selected] {
|
|
48
|
+
background-color: var(--sds-color-semantic-surface-action-selected);
|
|
49
|
+
border-color: var(--sds-color-semantic-surface-action-selected);
|
|
50
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:disabled {
|
|
54
|
+
background-color: var(--sds-color-semantic-surface-disabled);
|
|
55
|
+
border: 2px solid var(--sds-color-semantic-surface-disabled);
|
|
56
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&[data-size='medium'] {
|
|
61
|
+
padding: var(--sds-spacing-1) var(--sds-spacing-3);
|
|
62
|
+
|
|
63
|
+
.sds-chip-remove-button {
|
|
64
|
+
width: var(--sds-spacing-6);
|
|
65
|
+
height: var(--sds-spacing-6);
|
|
66
|
+
font-size: 0.8rem;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&[data-size='small'] {
|
|
71
|
+
font-size: 0.875rem;
|
|
72
|
+
padding: 0 var(--sds-spacing-3);
|
|
73
|
+
|
|
74
|
+
.sds-chip-remove-button {
|
|
75
|
+
width: var(--sds-spacing-5);
|
|
76
|
+
height: var(--sds-spacing-5);
|
|
77
|
+
font-size: 0.7rem;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&[data-size='large'],
|
|
82
|
+
&[data-size=''] {
|
|
83
|
+
.sds-chip-remove-button span {
|
|
84
|
+
position: relative;
|
|
85
|
+
top: 1px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.sds-chip-remove-button {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
border: 0;
|
|
95
|
+
background: 0;
|
|
96
|
+
width: var(--sds-spacing-7);
|
|
97
|
+
height: var(--sds-spacing-7);
|
|
98
|
+
border-radius: 50%;
|
|
99
|
+
font-size: 1rem;
|
|
100
|
+
color: inherit;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
|
|
103
|
+
&:hover {
|
|
104
|
+
background-color: var(--sds-color-semantic-surface-action-hover);
|
|
105
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
//# sourceMappingURL=sds-chip.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-chip.styles.js","sourceRoot":"","sources":["../../src/sds-chip/sds-chip.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t.sds-chip {\n\t\talign-items: center;\n\t\tdisplay: inline-flex;\n\t\tgap: var(--sds-spacing-3, 8px);\n\t\tjustify-content: center;\n\t\tpadding: var(--sds-spacing-3) var(--sds-spacing-4);\n\n\t\tbackground-color: var(--sds-color-semantic-surface-action-inverted);\n\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\tborder-radius: 5rem;\n\n\t\tfont-family: 'Roboto';\n\t\tfont-size: 1rem;\n\t\tline-height: 1.5;\n\t\ttext-align: center;\n\n\t\t&[data-selectable] {\n\t\t\tcursor: pointer;\n\n\t\t\t&:focus {\n\t\t\t\tbackground-color: var(\n\t\t\t\t\t--sds-color-semantic-surface-action-subtle\n\t\t\t\t);\n\t\t\t\tcolor: var(--sds-color-semantic-text-subtle);\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\tbackground-color: var(\n\t\t\t\t\t--sds-color-semantic-surface-action-hover\n\t\t\t\t);\n\t\t\t\tborder-color: var(--sds-color-semantic-surface-action-hover);\n\t\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t\t}\n\n\t\t\t&:active {\n\t\t\t\tbackground-color: var(\n\t\t\t\t\t--sds-color-semantic-surface-action-active\n\t\t\t\t);\n\t\t\t\tborder: 2px solid\n\t\t\t\t\tvar(--sds-color-semantic-surface-action-active);\n\t\t\t\toutline: 0;\n\t\t\t}\n\t\t}\n\n\t\t&[data-selected] {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-selected);\n\t\t\tborder-color: var(--sds-color-semantic-surface-action-selected);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t}\n\n\t\t&:disabled {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-disabled);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-disabled);\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t\tcursor: not-allowed;\n\t\t}\n\n\t\t&[data-size='medium'] {\n\t\t\tpadding: var(--sds-spacing-1) var(--sds-spacing-3);\n\n\t\t\t.sds-chip-remove-button {\n\t\t\t\twidth: var(--sds-spacing-6);\n\t\t\t\theight: var(--sds-spacing-6);\n\t\t\t\tfont-size: 0.8rem;\n\t\t\t}\n\t\t}\n\n\t\t&[data-size='small'] {\n\t\t\tfont-size: 0.875rem;\n\t\t\tpadding: 0 var(--sds-spacing-3);\n\n\t\t\t.sds-chip-remove-button {\n\t\t\t\twidth: var(--sds-spacing-5);\n\t\t\t\theight: var(--sds-spacing-5);\n\t\t\t\tfont-size: 0.7rem;\n\t\t\t}\n\t\t}\n\n\t\t&[data-size='large'],\n\t\t&[data-size=''] {\n\t\t\t.sds-chip-remove-button span {\n\t\t\t\tposition: relative;\n\t\t\t\ttop: 1px;\n\t\t\t}\n\t\t}\n\t}\n\n\t.sds-chip-remove-button {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tborder: 0;\n\t\tbackground: 0;\n\t\twidth: var(--sds-spacing-7);\n\t\theight: var(--sds-spacing-7);\n\t\tborder-radius: 50%;\n\t\tfont-size: 1rem;\n\t\tcolor: inherit;\n\t\tcursor: pointer;\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-hover);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t}\n\t}\n`;\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class SNavCard extends LitElement {
|
|
3
|
+
/**
|
|
4
|
+
* This is the navigation card component
|
|
5
|
+
*
|
|
6
|
+
* @remarks The way the icon is handled now, causes a double update/side effect when loading the webpage.
|
|
7
|
+
* The svg that should be placed inside the slot, currently needs have its stroke attribute manually removed,
|
|
8
|
+
* in order for the components CSS to insert its own stroke color.
|
|
9
|
+
* This should be looked more into.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
size: 'large' | 'medium' | 'small';
|
|
14
|
+
heading: string;
|
|
15
|
+
level: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
16
|
+
text: string;
|
|
17
|
+
link: string;
|
|
18
|
+
private hasIcon;
|
|
19
|
+
private iconSlot;
|
|
20
|
+
firstUpdated(): void;
|
|
21
|
+
private _handleSlotChange;
|
|
22
|
+
private _filterToMeaningfulNodes;
|
|
23
|
+
private _checkSlotContent;
|
|
24
|
+
private _renderHeading;
|
|
25
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
'sds-nav-card': SNavCard;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=sds-nav-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-nav-card.d.ts","sourceRoot":"","sources":["../../src/sds-nav-card/sds-nav-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,qBACa,QAAS,SAAQ,UAAU;IACvC;;;;;;;;OAQG;IAGH,OAAgB,MAAM,4BAAY;IAIlC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAW;IAG7C,OAAO,EAAG,MAAM,CAAC;IAGjB,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAG/C,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAG,MAAM,CAAC;IAId,OAAO,CAAC,OAAO,CAAkB;IAGjC,OAAO,CAAC,QAAQ,CAAmB;IAE1B,YAAY;IAIrB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,cAAc;IAmBb,MAAM;CAqBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,cAAc,EAAE,QAAQ,CAAC;KACzB;CACD"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html } from 'lit';
|
|
8
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
10
|
+
import { styles } from './sds-nav-card.styles';
|
|
11
|
+
let SNavCard = class SNavCard extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
/**
|
|
14
|
+
* This is the navigation card component
|
|
15
|
+
*
|
|
16
|
+
* @remarks The way the icon is handled now, causes a double update/side effect when loading the webpage.
|
|
17
|
+
* The svg that should be placed inside the slot, currently needs have its stroke attribute manually removed,
|
|
18
|
+
* in order for the components CSS to insert its own stroke color.
|
|
19
|
+
* This should be looked more into.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
super(...arguments);
|
|
23
|
+
// Reactive Props
|
|
24
|
+
this.size = 'large';
|
|
25
|
+
this.level = 'h2';
|
|
26
|
+
// Managing the icon slot
|
|
27
|
+
this.hasIcon = false;
|
|
28
|
+
}
|
|
29
|
+
firstUpdated() {
|
|
30
|
+
this._checkSlotContent();
|
|
31
|
+
}
|
|
32
|
+
_handleSlotChange() {
|
|
33
|
+
this._checkSlotContent();
|
|
34
|
+
}
|
|
35
|
+
// Filters out text nodes that only contain whitespace
|
|
36
|
+
_filterToMeaningfulNodes(nodes) {
|
|
37
|
+
return nodes.filter((node) => {
|
|
38
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
39
|
+
const textContent = node.textContent;
|
|
40
|
+
return textContent !== null && textContent.trim().length > 0;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// Checks if the icon slot has content and updates the state variable
|
|
46
|
+
_checkSlotContent() {
|
|
47
|
+
const assignedNodes = this.iconSlot.assignedNodes({ flatten: true });
|
|
48
|
+
const meaningfulNodes = this._filterToMeaningfulNodes(assignedNodes);
|
|
49
|
+
this.hasIcon = meaningfulNodes.length !== 0;
|
|
50
|
+
}
|
|
51
|
+
_renderHeading() {
|
|
52
|
+
const headingClass = 'sds-nav-card__heading';
|
|
53
|
+
switch (this.level) {
|
|
54
|
+
case 'h2':
|
|
55
|
+
return html `<h2 class="${headingClass}">${this.heading}</h2>`;
|
|
56
|
+
case 'h3':
|
|
57
|
+
return html `<h3 class="${headingClass}">${this.heading}</h3>`;
|
|
58
|
+
case 'h4':
|
|
59
|
+
return html `<h4 class="${headingClass}">${this.heading}</h4>`;
|
|
60
|
+
case 'h5':
|
|
61
|
+
return html `<h5 class="${headingClass}">${this.heading}</h5>`;
|
|
62
|
+
case 'h6':
|
|
63
|
+
return html `<h6 class="${headingClass}">${this.heading}</h6>`;
|
|
64
|
+
default:
|
|
65
|
+
return html `<h2 class="${headingClass}">${this.heading}</h2>`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
const navCardClasses = {
|
|
70
|
+
'sds-nav-card': true,
|
|
71
|
+
'sds-nav-card--hasIcon': this.hasIcon,
|
|
72
|
+
'sds-nav-card--small': this.size === 'small',
|
|
73
|
+
'sds-nav-card--medium': this.size === 'medium',
|
|
74
|
+
'sds-nav-card--large': this.size === 'large',
|
|
75
|
+
};
|
|
76
|
+
return html `
|
|
77
|
+
<a class="${classMap(navCardClasses)}" href="${this.link}">
|
|
78
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
79
|
+
<div class="sds-nav-card__content">
|
|
80
|
+
${this._renderHeading()}
|
|
81
|
+
${this.size === 'small'
|
|
82
|
+
? ''
|
|
83
|
+
: html `<p class="sds-nav-card__text">${this.text}</p>`}
|
|
84
|
+
</div>
|
|
85
|
+
</a>
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// Styling
|
|
90
|
+
SNavCard.styles = [styles];
|
|
91
|
+
__decorate([
|
|
92
|
+
property({ type: String })
|
|
93
|
+
], SNavCard.prototype, "size", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
property({ type: String })
|
|
96
|
+
], SNavCard.prototype, "heading", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
property({ type: String })
|
|
99
|
+
], SNavCard.prototype, "level", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
property({ type: String })
|
|
102
|
+
], SNavCard.prototype, "text", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
property({ type: String })
|
|
105
|
+
], SNavCard.prototype, "link", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
state()
|
|
108
|
+
], SNavCard.prototype, "hasIcon", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
query('slot')
|
|
111
|
+
], SNavCard.prototype, "iconSlot", void 0);
|
|
112
|
+
SNavCard = __decorate([
|
|
113
|
+
customElement('sds-nav-card')
|
|
114
|
+
], SNavCard);
|
|
115
|
+
export { SNavCard };
|
|
116
|
+
//# sourceMappingURL=sds-nav-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-nav-card.js","sourceRoot":"","sources":["../../src/sds-nav-card/sds-nav-card.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGxC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;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I,EAAE,MAAM,EAAE,CAAC;sCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCACb;AAIN;IADP,KAAK,EAAE;yCACyB;AAGzB;IADP,KAAK,CAAC,MAAM,CAAC;0CACqB;AAnCvB,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CAuGpB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './sds-nav-card.styles';\n\n@customElement('sds-nav-card')\nexport class SNavCard extends LitElement {\n\t/**\n\t * This is the navigation card component\n\t *\n\t * @remarks The way the icon is handled now, causes a double update/side effect when loading the webpage.\n\t * The svg that should be placed inside the slot, currently needs have its stroke attribute manually removed,\n\t * in order for the components CSS to insert its own stroke color.\n\t * This should be looked more into.\n\t *\n\t */\n\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String })\n\tsize: 'large' | 'medium' | 'small' = 'large';\n\n\t@property({ type: String })\n\theading!: string;\n\n\t@property({ type: String })\n\tlevel: 'h2' | 'h3' | 'h4' | 'h5' | 'h6' = 'h2';\n\n\t@property({ type: String })\n\ttext!: string;\n\n\t@property({ type: String })\n\tlink!: string;\n\n\t// Managing the icon slot\n\t@state()\n\tprivate hasIcon: boolean = false;\n\n\t@query('slot')\n\tprivate iconSlot!: HTMLSlotElement;\n\n\toverride firstUpdated() {\n\t\tthis._checkSlotContent();\n\t}\n\n\tprivate _handleSlotChange() {\n\t\tthis._checkSlotContent();\n\t}\n\n\t// Filters out text nodes that only contain whitespace\n\tprivate _filterToMeaningfulNodes(nodes: Node[]) {\n\t\treturn nodes.filter((node) => {\n\t\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\t\tconst textContent = (node as Text).textContent;\n\t\t\t\treturn textContent !== null && textContent.trim().length > 0;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t}\n\n\t// Checks if the icon slot has content and updates the state variable\n\tprivate _checkSlotContent() {\n\t\tconst assignedNodes = this.iconSlot.assignedNodes({ flatten: true });\n\t\tconst meaningfulNodes = this._filterToMeaningfulNodes(assignedNodes);\n\t\tthis.hasIcon = meaningfulNodes.length !== 0;\n\t}\n\n\tprivate _renderHeading() {\n\t\tconst headingClass = 'sds-nav-card__heading';\n\n\t\tswitch (this.level) {\n\t\t\tcase 'h2':\n\t\t\t\treturn html`<h2 class=\"${headingClass}\">${this.heading}</h2>`;\n\t\t\tcase 'h3':\n\t\t\t\treturn html`<h3 class=\"${headingClass}\">${this.heading}</h3>`;\n\t\t\tcase 'h4':\n\t\t\t\treturn html`<h4 class=\"${headingClass}\">${this.heading}</h4>`;\n\t\t\tcase 'h5':\n\t\t\t\treturn html`<h5 class=\"${headingClass}\">${this.heading}</h5>`;\n\t\t\tcase 'h6':\n\t\t\t\treturn html`<h6 class=\"${headingClass}\">${this.heading}</h6>`;\n\t\t\tdefault:\n\t\t\t\treturn html`<h2 class=\"${headingClass}\">${this.heading}</h2>`;\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst navCardClasses = {\n\t\t\t'sds-nav-card': true,\n\t\t\t'sds-nav-card--hasIcon': this.hasIcon,\n\t\t\t'sds-nav-card--small': this.size === 'small',\n\t\t\t'sds-nav-card--medium': this.size === 'medium',\n\t\t\t'sds-nav-card--large': this.size === 'large',\n\t\t};\n\n\t\treturn html`\n\t\t\t<a class=\"${classMap(navCardClasses)}\" href=\"${this.link}\">\n\t\t\t\t<slot @slotchange=${this._handleSlotChange}></slot>\n\t\t\t\t<div class=\"sds-nav-card__content\">\n\t\t\t\t\t${this._renderHeading()}\n\t\t\t\t\t${this.size === 'small'\n\t\t\t\t\t\t? ''\n\t\t\t\t\t\t: html`<p class=\"sds-nav-card__text\">${this.text}</p>`}\n\t\t\t\t</div>\n\t\t\t</a>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-nav-card': SNavCard;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-nav-card.styles.d.ts","sourceRoot":"","sources":["../../src/sds-nav-card/sds-nav-card.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA2JlB,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
.sds-nav-card {
|
|
4
|
+
color: var(--sds-color-semantic-text-default);
|
|
5
|
+
background-color: var(
|
|
6
|
+
--sds-color-global-lightblue-100
|
|
7
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
8
|
+
|
|
9
|
+
font-size: var(--sds-typography-base-font-size);
|
|
10
|
+
line-height: var(--sds-typography-base-line-height);
|
|
11
|
+
font-weight: var(--sds-typography-base-font-weight);
|
|
12
|
+
font-family: var(--sds-typography-font-family);
|
|
13
|
+
|
|
14
|
+
display: flex;
|
|
15
|
+
min-height: 10.25rem;
|
|
16
|
+
height: 100%;
|
|
17
|
+
width: 100%;
|
|
18
|
+
max-width: 50rem;
|
|
19
|
+
min-width: 20rem;
|
|
20
|
+
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
padding: var(--sds-spacing-7) var(--sds-spacing-9) var(--sds-spacing-8);
|
|
23
|
+
gap: var(--sds-spacing-5);
|
|
24
|
+
text-align: left;
|
|
25
|
+
|
|
26
|
+
border-radius: var(--sds-radius-card);
|
|
27
|
+
border: 1px solid transparent;
|
|
28
|
+
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
|
|
31
|
+
& p {
|
|
32
|
+
padding: 0;
|
|
33
|
+
margin: 0;
|
|
34
|
+
hyphens: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:link {
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
background-color: var(
|
|
43
|
+
--sds-color-global-lightblue-300
|
|
44
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
45
|
+
|
|
46
|
+
.sds-nav-card__heading {
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:active,
|
|
52
|
+
&:focus:active {
|
|
53
|
+
background-color: var(--sds-color-semantic-surface-action-selected);
|
|
54
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
55
|
+
|
|
56
|
+
.sds-nav-card__heading {
|
|
57
|
+
text-decoration: underline;
|
|
58
|
+
text-decoration-thickness: 0.075rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
::slotted(*) {
|
|
62
|
+
stroke: var(--sds-color-semantic-icon-on-action);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus {
|
|
67
|
+
border: 1px solid var(--sds-color-semantic-border-focus);
|
|
68
|
+
background: var(
|
|
69
|
+
--sds-color-global-lightblue-100
|
|
70
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:disabled {
|
|
74
|
+
background-color: var(--sds-color-semantic-surface-disabled);
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.sds-nav-card--hasIcon {
|
|
80
|
+
padding: var(--sds-spacing-7) var(--sds-spacing-7) var(--sds-spacing-8);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.sds-nav-card__content {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
width: 100%;
|
|
87
|
+
gap: var(--sds-spacing-3);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.sds-nav-card__text {
|
|
91
|
+
display: -webkit-box;
|
|
92
|
+
-webkit-line-clamp: 3;
|
|
93
|
+
-webkit-box-orient: vertical;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
::slotted(*) {
|
|
98
|
+
height: 4.5rem;
|
|
99
|
+
min-width: 4.5rem;
|
|
100
|
+
width: 4.5rem;
|
|
101
|
+
align-self: center;
|
|
102
|
+
stroke: var(
|
|
103
|
+
--sds-color-global-black
|
|
104
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.sds-nav-card__heading {
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
font-size: 1.5rem;
|
|
110
|
+
margin: 0;
|
|
111
|
+
text-decoration: underline;
|
|
112
|
+
text-decoration-thickness: 0.075rem;
|
|
113
|
+
text-underline-offset: 0.146rem;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.sds-nav-card--medium {
|
|
117
|
+
min-height: 7rem;
|
|
118
|
+
|
|
119
|
+
.sds-nav-card__text {
|
|
120
|
+
display: -webkit-box;
|
|
121
|
+
display: flex;
|
|
122
|
+
|
|
123
|
+
-webkit-line-clamp: 1;
|
|
124
|
+
-webkit-box-orient: vertical;
|
|
125
|
+
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
text-overflow: ellipsis;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
::slotted(*) {
|
|
131
|
+
height: 3rem;
|
|
132
|
+
min-width: 3rem;
|
|
133
|
+
width: 3rem;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.sds-nav-card--small {
|
|
138
|
+
min-height: 4.5rem;
|
|
139
|
+
padding: var(--sds-spacing-5) var(--sds-spacing-8) var(--sds-spacing-6);
|
|
140
|
+
|
|
141
|
+
.sds-nav-card--hasIcon {
|
|
142
|
+
padding: var(--sds-spacing-5) var(--sds-spacing-7)
|
|
143
|
+
var(--sds-spacing-6);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.sds-nav-card__content {
|
|
147
|
+
gap: 0;
|
|
148
|
+
align-self: center;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
::slotted(*) {
|
|
152
|
+
height: 2.5rem;
|
|
153
|
+
min-width: 2.5rem;
|
|
154
|
+
width: 2.5rem;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
//# sourceMappingURL=sds-nav-card.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-nav-card.styles.js","sourceRoot":"","sources":["../../src/sds-nav-card/sds-nav-card.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2JxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t.sds-nav-card {\n\t\tcolor: var(--sds-color-semantic-text-default);\n\t\tbackground-color: var(\n\t\t\t--sds-color-global-lightblue-100\n\t\t); // TODO: Global variable used, should be replaced by a more spesific one\n\n\t\tfont-size: var(--sds-typography-base-font-size);\n\t\tline-height: var(--sds-typography-base-line-height);\n\t\tfont-weight: var(--sds-typography-base-font-weight);\n\t\tfont-family: var(--sds-typography-font-family);\n\n\t\tdisplay: flex;\n\t\tmin-height: 10.25rem;\n\t\theight: 100%;\n\t\twidth: 100%;\n\t\tmax-width: 50rem;\n\t\tmin-width: 20rem;\n\n\t\tbox-sizing: border-box;\n\t\tpadding: var(--sds-spacing-7) var(--sds-spacing-9) var(--sds-spacing-8);\n\t\tgap: var(--sds-spacing-5);\n\t\ttext-align: left;\n\n\t\tborder-radius: var(--sds-radius-card);\n\t\tborder: 1px solid transparent;\n\n\t\tcursor: pointer;\n\n\t\t& p {\n\t\t\tpadding: 0;\n\t\t\tmargin: 0;\n\t\t\thyphens: auto;\n\t\t}\n\n\t\t&:link {\n\t\t\ttext-decoration: none;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(\n\t\t\t\t--sds-color-global-lightblue-300\n\t\t\t); // TODO: Global variable used, should be replaced by a more spesific one\n\n\t\t\t.sds-nav-card__heading {\n\t\t\t\ttext-decoration: none;\n\t\t\t}\n\t\t}\n\n\t\t&:active,\n\t\t&:focus:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-selected);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\n\t\t\t.sds-nav-card__heading {\n\t\t\t\ttext-decoration: underline;\n\t\t\t\ttext-decoration-thickness: 0.075rem;\n\t\t\t}\n\n\t\t\t::slotted(*) {\n\t\t\t\tstroke: var(--sds-color-semantic-icon-on-action);\n\t\t\t}\n\t\t}\n\n\t\t&:focus {\n\t\t\tborder: 1px solid var(--sds-color-semantic-border-focus);\n\t\t\tbackground: var(\n\t\t\t\t--sds-color-global-lightblue-100\n\t\t\t); // TODO: Global variable used, should be replaced by a more spesific one\n\t\t}\n\n\t\t&:disabled {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-disabled);\n\t\t\tpointer-events: none;\n\t\t}\n\t}\n\n\t.sds-nav-card--hasIcon {\n\t\tpadding: var(--sds-spacing-7) var(--sds-spacing-7) var(--sds-spacing-8);\n\t}\n\n\t.sds-nav-card__content {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\twidth: 100%;\n\t\tgap: var(--sds-spacing-3);\n\t}\n\n\t.sds-nav-card__text {\n\t\tdisplay: -webkit-box;\n\t\t-webkit-line-clamp: 3;\n\t\t-webkit-box-orient: vertical;\n\t\toverflow: hidden;\n\t}\n\n\t::slotted(*) {\n\t\theight: 4.5rem;\n\t\tmin-width: 4.5rem;\n\t\twidth: 4.5rem;\n\t\talign-self: center;\n\t\tstroke: var(\n\t\t\t--sds-color-global-black\n\t\t); // TODO: Global variable used, should be replaced by a more spesific one\n\t}\n\n\t.sds-nav-card__heading {\n\t\tfont-weight: 600;\n\t\tfont-size: 1.5rem;\n\t\tmargin: 0;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-thickness: 0.075rem;\n\t\ttext-underline-offset: 0.146rem;\n\t}\n\n\t.sds-nav-card--medium {\n\t\tmin-height: 7rem;\n\n\t\t.sds-nav-card__text {\n\t\t\tdisplay: -webkit-box;\n\t\t\tdisplay: flex;\n\n\t\t\t-webkit-line-clamp: 1;\n\t\t\t-webkit-box-orient: vertical;\n\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\n\t\t::slotted(*) {\n\t\t\theight: 3rem;\n\t\t\tmin-width: 3rem;\n\t\t\twidth: 3rem;\n\t\t}\n\t}\n\n\t.sds-nav-card--small {\n\t\tmin-height: 4.5rem;\n\t\tpadding: var(--sds-spacing-5) var(--sds-spacing-8) var(--sds-spacing-6);\n\n\t\t.sds-nav-card--hasIcon {\n\t\t\tpadding: var(--sds-spacing-5) var(--sds-spacing-7)\n\t\t\t\tvar(--sds-spacing-6);\n\t\t}\n\n\t\t.sds-nav-card__content {\n\t\t\tgap: 0;\n\t\t\talign-self: center;\n\t\t}\n\n\t\t::slotted(*) {\n\t\t\theight: 2.5rem;\n\t\t\tmin-width: 2.5rem;\n\t\t\twidth: 2.5rem;\n\t\t}\n\t}\n`;\n"]}
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"name": "@politiet/sheriff-web-components",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Sheriff Design System Web Components Library",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"./dist/",
|
|
11
|
+
"./README.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build-components": "tsc",
|
|
15
|
+
"version-bump": "node ../../../scripts/bump-version.js"
|
|
16
|
+
},
|
|
17
|
+
"author": "Politiets IT-enhet",
|
|
18
|
+
"license": "ISC"
|
|
14
19
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
export declare class SButton extends LitElement {
|
|
3
|
-
static styles: import("lit").CSSResult[];
|
|
4
|
-
name: string;
|
|
5
|
-
type: 'button' | 'submit' | 'reset';
|
|
6
|
-
variant: 'primary' | 'secondary' | 'tertiary';
|
|
7
|
-
size: 'large' | 'medium' | 'small';
|
|
8
|
-
disabled: boolean;
|
|
9
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
-
}
|
|
11
|
-
declare global {
|
|
12
|
-
interface HTMLElementTagNameMap {
|
|
13
|
-
's-button': SButton;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=s-button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"s-button.d.ts","sourceRoot":"","sources":["../../src/s-button/s-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,qBACa,OAAQ,SAAQ,UAAU;IAEtC,OAAgB,MAAM,4BAAY;IAIlC,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG/C,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAa;IAG1D,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAW;IAG7C,QAAQ,UAAS;IAER,MAAM;CAmBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,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M,EAAE,CAAC;wCAC+B;AAG1D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACkB;AAG7C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACX;AAlBL,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAuCnB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './s-button.styles';\n\n@customElement('s-button')\nexport class SButton extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String })\n\tname!: string;\n\n\t@property({ type: String })\n\ttype: 'button' | 'submit' | 'reset' = 'button';\n\n\t@property({ type: String })\n\tvariant: 'primary' | 'secondary' | 'tertiary' = 'primary';\n\n\t@property({ type: String })\n\tsize: 'large' | 'medium' | 'small' = 'large';\n\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\toverride render() {\n\t\tconst buttonClasses = {\n\t\t\t's-button--secondary': this.variant === 'secondary',\n\t\t\t's-button--tertiary': this.variant === 'tertiary',\n\t\t\t's-button--medium': this.size === 'medium',\n\t\t\t's-button--small': this.size === 'small',\n\t\t};\n\n\t\treturn html`\n\t\t\t<button\n\t\t\t\tclass=\"s-button${classMap(buttonClasses)}\"\n\t\t\t\ttype=\"${this.type}\"\n\t\t\t\tname=\"${this.name}\"\n\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t>\n\t\t\t\t<slot></slot>\n\t\t\t</button>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t's-button': SButton;\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"s-button.styles.d.ts","sourceRoot":"","sources":["../../src/s-button/s-button.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgHlB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"s-button.styles.js","sourceRoot":"","sources":["../../src/s-button/s-button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgHxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t.s-button {\n\t\talign-items: center;\n\t\tdisplay: inline-flex;\n\t\tgap: var(--sds-spacing-3, 8px);\n\t\tjustify-content: center;\n\t\tpadding: var(--sds-spacing-3) var(--sds-spacing-4);\n\n\t\tbackground-color: var(--sds-color-semantic-surface-action-default);\n\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\tborder-radius: var(--sds-radius-4);\n\t\tcursor: pointer;\n\n\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\tfont-family: 'Roboto';\n\t\tfont-size: 1rem;\n\t\tfont-weight: 500;\n\t\tline-height: 1.5;\n\t\ttext-align: center;\n\n\t\t&:focus {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-default);\n\t\t\toutline: 2px solid var(--sds-color-semantic-surface-action-default);\n\t\t\toutline-offset: 1px;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-hover);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-hover);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\toutline: 0;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-disabled);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-disabled);\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n\n\t.s-button--secondary {\n\t\tbackground-color: var(--sds-color-semantic-surface-action-inverted);\n\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\tcolor: var(--sds-color-semantic-text-default);\n\n\t\t&:focus {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-inverted);\n\t\t\tborder: 2px solid var(--sds-color-semantic-border-action);\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-subtle);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t\toutline: 0;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tborder: 2px solid var(--sds-color-semantic-border-disabled);\n\t\t\tbackground: var(--sds-color-semantic-surface-action-inverted);\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t}\n\t}\n\n\t.s-button--tertiary {\n\t\tbackground-color: transparent;\n\t\tborder: 2px solid transparent;\n\t\tcolor: var(--sds-color-semantic-text-action-default);\n\n\t\t&:focus {\n\t\t\tbackground-color: transparent;\n\t\t\tborder: 2px solid transparent;\n\t\t\ttext-decoration: underline;\n\t\t}\n\n\t\t&:hover {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-subtle);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground-color: var(--sds-color-semantic-surface-action-active);\n\t\t\tborder: 2px solid var(--sds-color-semantic-surface-action-active);\n\t\t\tcolor: var(--sds-color-semantic-text-on-action);\n\t\t\toutline: 0;\n\t\t\tposition: relative;\n\t\t\ttext-decoration: underline;\n\t\t}\n\n\t\t&:disabled {\n\t\t\tborder: 2px solid transparent;\n\t\t\tbackground: transparent;\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t\ttext-decoration: underline;\n\t\t}\n\t}\n\n\t.s-button--medium {\n\t\tpadding: var(--sds-spacing-1) var(--sds-spacing-3);\n\t}\n\n\t.s-button--small {\n\t\tfont-size: 0.875rem;\n\t\tpadding: 0 var(--sds-spacing-3);\n\t}\n`;\n"]}
|