@skf-design-system/ui-components 1.0.2-beta.3 → 1.0.2-beta.4

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.
Files changed (39) hide show
  1. package/dist/components/alert/alert.component.d.ts +5 -1
  2. package/dist/components/alert/alert.component.js +57 -54
  3. package/dist/components/alert/alert.styles.js +51 -47
  4. package/dist/components/breadcrumb/breadcrumb-item.component.js +24 -25
  5. package/dist/components/breadcrumb/breadcrumb-item.styles.js +16 -15
  6. package/dist/components/breadcrumb/breadcrumb.component.d.ts +5 -2
  7. package/dist/components/breadcrumb/breadcrumb.component.js +51 -46
  8. package/dist/components/breadcrumb/breadcrumb.styles.js +13 -10
  9. package/dist/components/button/button.component.js +39 -39
  10. package/dist/components/button/button.styles.js +2 -1
  11. package/dist/components/card/card.component.d.ts +5 -0
  12. package/dist/components/card/card.component.js +46 -24
  13. package/dist/components/card/card.styles.js +5 -4
  14. package/dist/components/heading/heading.component.d.ts +5 -1
  15. package/dist/components/heading/heading.component.js +46 -33
  16. package/dist/components/heading/heading.styles.js +34 -36
  17. package/dist/components/icon/icon.component.d.ts +4 -0
  18. package/dist/components/icon/icon.component.js +52 -43
  19. package/dist/components/icon/icon.styles.js +60 -60
  20. package/dist/components/logo/logo.component.d.ts +4 -1
  21. package/dist/components/logo/logo.component.js +55 -51
  22. package/dist/components/logo/logo.styles.js +26 -16
  23. package/dist/components/select/select-option.component.js +8 -8
  24. package/dist/components/select/select.component.js +1 -2
  25. package/dist/components/tag/tag.component.d.ts +6 -1
  26. package/dist/components/tag/tag.component.js +66 -45
  27. package/dist/components/tag/tag.styles.js +6 -6
  28. package/dist/custom-elements.json +173 -33
  29. package/dist/internal/helpers/stateMap.d.ts +14 -0
  30. package/dist/internal/helpers/stateMap.js +68 -0
  31. package/dist/internal/helpers/watch.d.ts +1 -1
  32. package/dist/internal/helpers/watch.js +12 -12
  33. package/dist/styles/component.styles.js +37 -36
  34. package/dist/styles/global.css +1 -1
  35. package/dist/types/jsx/custom-element-jsx.d.ts +8 -5
  36. package/dist/types/vue/index.d.ts +8 -5
  37. package/dist/vscode.html-custom-data.json +6 -6
  38. package/dist/web-types.json +12 -10
  39. package/package.json +7 -7
@@ -1,84 +1,84 @@
1
1
  import { css as o } from "lit";
2
- const i = o`
3
- /* stylelint-disable selector-class-pattern */
2
+ const r = o`
4
3
  @layer components {
5
- :host {
6
- display: inline-flex;
7
- }
4
+ @layer base {
5
+ :host {
6
+ display: inline-flex;
7
+ }
8
8
 
9
- :host-context(.skf-icon-host) {
10
- color: inherit;
11
- }
9
+ #root {
10
+ --_skf-icon-color: var(--skf-icon-color-primary);
11
+ --_skf-icon-size: var(--skf-icon-size-md);
12
12
 
13
- .icon {
14
- block-size: var(--_skf-icon-size);
15
- display: inline-flex;
16
- flex-shrink: 0; /* Prevents shrink when flex-child */
17
- inline-size: var(--_skf-icon-size);
18
- pointer-events: none;
19
- user-select: none;
13
+ block-size: var(--_skf-icon-size);
14
+ flex-shrink: 0; /* Prevents shrink when flex-child */
15
+ inline-size: var(--_skf-icon-size);
16
+ pointer-events: none;
17
+ user-select: none;
20
18
 
21
- :not(:host-context(.skf-icon-host)) & {
22
- color: var(--_skf-icon-color, var(--skf-icon-color-primary));
19
+ :host(:not([data-color='custom'])) & {
20
+ color: var(--_skf-icon-color);
21
+ }
23
22
  }
24
23
  }
25
24
 
26
- /**
27
- * Colors
28
- */
29
- .icon--color-secondary {
30
- --_skf-icon-color: var(--skf-icon-color-secondary);
31
- }
25
+ @layer mods {
26
+ /**
27
+ * Color
28
+ */
29
+ :host([data-color='custom']) {
30
+ color: inherit;
31
+ }
32
32
 
33
- .icon--color-inverse {
34
- --_skf-icon-color: var(--skf-icon-color-inverse);
35
- }
33
+ :host(:state(secondary)) #root {
34
+ --_skf-icon-color: var(--skf-icon-color-secondary);
35
+ }
36
36
 
37
- .icon--color-emphasised {
38
- --_skf-icon-color: var(--skf-icon-color-emphasised);
39
- }
37
+ :host(:state(inverse)) #root {
38
+ --_skf-icon-color: var(--skf-icon-color-inverse);
39
+ }
40
40
 
41
- /* Severity */
42
- .icon--color-alert {
43
- --_skf-icon-color: var(--skf-severity-fg-color-alert);
44
- }
41
+ :host(:state(emphasised)) #root {
42
+ --_skf-icon-color: var(--skf-icon-color-emphasised);
43
+ }
45
44
 
46
- .icon--color-error {
47
- --_skf-icon-color: var(--skf-severity-fg-color-error);
48
- }
45
+ :host(:state(alert)) #root {
46
+ --_skf-icon-color: var(--skf-severity-fg-color-alert);
47
+ }
49
48
 
50
- .icon--color-info {
51
- --_skf-icon-color: var(--skf-severity-fg-color-info);
52
- }
49
+ :host(:state(error)) #root {
50
+ --_skf-icon-color: var(--skf-severity-fg-color-error);
51
+ }
53
52
 
54
- .icon--color-success {
55
- --_skf-icon-color: var(--skf-severity-fg-color-success);
56
- }
53
+ :host(:state(info)) #root {
54
+ --_skf-icon-color: var(--skf-severity-fg-color-info);
55
+ }
57
56
 
58
- .icon--color-warning {
59
- --_skf-icon-color: var(--skf-severity-fg-color-warning);
60
- }
57
+ :host(:state(success)) #root {
58
+ --_skf-icon-color: var(--skf-severity-fg-color-success);
59
+ }
61
60
 
62
- /**
63
- * Sizes
64
- */
65
- .icon--size-xs {
66
- --_skf-icon-size: var(--skf-icon-size-xs);
67
- }
61
+ :host(:state(warning)) #root {
62
+ --_skf-icon-color: var(--skf-severity-fg-color-warning);
63
+ }
68
64
 
69
- .icon--size-sm {
70
- --_skf-icon-size: var(--skf-icon-size-sm);
71
- }
65
+ /**
66
+ * Size
67
+ */
68
+ :host(:state(xs)) #root {
69
+ --_skf-icon-size: var(--skf-icon-size-xs);
70
+ }
72
71
 
73
- .icon--size-md {
74
- --_skf-icon-size: var(--skf-icon-size-md);
75
- }
72
+ :host(:state(sm)) #root {
73
+ --_skf-icon-size: var(--skf-icon-size-sm);
74
+ }
76
75
 
77
- .icon--size-lg {
78
- --_skf-icon-size: var(--skf-icon-size-lg);
76
+ :host(:state(lg)) #root {
77
+ --_skf-icon-size: var(--skf-icon-size-lg);
78
+ }
79
79
  }
80
80
  }
81
81
  `;
82
82
  export {
83
- i as styles
83
+ r as styles
84
84
  };
@@ -5,16 +5,19 @@ type SkfLogoColor = Logo;
5
5
  /**
6
6
  * The `<skf-logo>` component is used to display the SKF logo.
7
7
  *
8
- * @cssproperty --skf-logo-height - The height of the logo
8
+ * @cssproperty --mod-logo-height - The height of the logo
9
9
  *
10
10
  * @tagname skf-logo
11
11
  */
12
12
  export declare class SkfLogo extends SkfElement {
13
+ #private;
13
14
  static styles: CSSResultGroup;
14
15
  /** Defines the title of the logo */
15
16
  title: string;
16
17
  /** Defines the color of the logo */
17
18
  color: SkfLogoColor;
19
+ /** @internal */
20
+ _handleStateChange(): void;
18
21
  render(): import("lit").TemplateResult<1>;
19
22
  }
20
23
  export {};
@@ -1,79 +1,83 @@
1
- import { SkfElement as i } from "../../internal/components/skf-element.js";
2
- import { componentStyles as m } from "../../styles/component.styles.js";
3
- import { html as n } from "lit";
4
- import { property as p } from "lit/decorators.js";
5
- import { classMap as a } from "lit/directives/class-map.js";
6
- import { styles as d } from "./logo.styles.js";
7
- var g = Object.defineProperty, v = (e, l, s, y) => {
8
- for (var c = void 0, r = e.length - 1, h; r >= 0; r--)
9
- (h = e[r]) && (c = h(l, s, c) || c);
10
- return c && g(l, s, c), c;
1
+ var f = (c) => {
2
+ throw TypeError(c);
11
3
  };
12
- const o = class o extends i {
4
+ var g = (c, t, r) => t.has(c) || f("Cannot " + r);
5
+ var a = (c, t, r) => (g(c, t, "read from private field"), r ? r.call(c) : t.get(c)), v = (c, t, r) => t.has(c) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(c) : t.set(c, r), n = (c, t, r, e) => (g(c, t, "write to private field"), e ? e.call(c, r) : t.set(c, r), r);
6
+ import { SkfElement as w } from "../../internal/components/skf-element.js";
7
+ import { stateMap as H } from "../../internal/helpers/stateMap.js";
8
+ import { watch as M } from "../../internal/helpers/watch.js";
9
+ import { componentStyles as V } from "../../styles/component.styles.js";
10
+ import { html as x } from "lit";
11
+ import { property as d } from "lit/decorators.js";
12
+ import { styles as z } from "./logo.styles.js";
13
+ var C = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, m = (c, t, r, e) => {
14
+ for (var s = e > 1 ? void 0 : e ? _(t, r) : t, i = c.length - 1, l; i >= 0; i--)
15
+ (l = c[i]) && (s = (e ? l(t, r, s) : l(s)) || s);
16
+ return e && s && C(t, r, s), s;
17
+ }, h, p;
18
+ const y = class y extends w {
13
19
  constructor() {
14
- super(...arguments), this.title = "SKF logotype", this.color = "primary";
20
+ super(...arguments);
21
+ v(this, h);
22
+ v(this, p);
23
+ n(this, h, this.attachInternals()), n(this, p, a(this, h).states), this.title = "SKF logotype", this.color = "primary";
24
+ }
25
+ _handleStateChange() {
26
+ const r = ["inverse", "primary", "secondary"];
27
+ H(a(this, p), r).set(this.color);
15
28
  }
16
29
  render() {
17
- return n`
18
- <svg
19
- class=${a({
20
- logo: !0,
21
- "logo--color-inverse": this.color === "inverse",
22
- "logo--color-secondary": this.color === "secondary"
23
- })}
24
- viewBox="0 0 1300 300"
25
- xmlns="http://www.w3.org/2000/svg"
26
- x="0px"
27
- y="0px"
28
- >
30
+ return x`
31
+ <svg id="root" viewBox="0 0 1300 300" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px">
29
32
  <title>${this.title}</title>
30
33
  <g>
31
- <g>
32
- <path
33
- d="M363.7,300c6.2,0,11.2-5,11.2-11.3v-165c0-6.2-5-11.3-11.3-11.2H157.5c-4.1,0-7.5-3.4-7.5-7.5V45
34
+ <path
35
+ d="M363.7,300c6.2,0,11.2-5,11.2-11.3v-165c0-6.2-5-11.3-11.3-11.2H157.5c-4.1,0-7.5-3.4-7.5-7.5V45
34
36
  c0-4.1,3.4-7.5,7.5-7.5l60,0c4.1,0,7.5,3.4,7.5,7.5v18.8c0,6.2,5,11.2,11.2,11.2h90c6.2,0,11.3-5,11.3-11.2V11.2
35
37
  c0-6.2-5-11.2-11.3-11.2L48.7,0c-6.2,0-11.2,5-11.2,11.3v127.5c0,6.2,5,11.2,11.3,11.2H255c4.1,0,7.5,3.4,7.5,7.5V255
36
38
  c0,4.1-3.4,7.5-7.5,7.5H120c-4.1,0-7.5-3.4-7.5-7.5v-56.2c0-6.2-5-11.2-11.3-11.2h-90c-6.2,0-11.3,5-11.3,11.2v90
37
39
  C0,295,5,300,11.3,300H363.7z"
38
- />
39
- <path
40
- d="M562.5,192.3c0-1,0.8-1.9,1.9-1.9c0.5,0,1,0.2,1.3,0.5c0.3,0.3,104.9,105,105.8,105.9
40
+ />
41
+ <path
42
+ d="M562.5,192.3c0-1,0.8-1.9,1.9-1.9c0.5,0,1,0.2,1.3,0.5c0.3,0.3,104.9,105,105.8,105.9
41
43
  c0.6,0.6,3.4,3.2,7.9,3.2h134.4c6.2,0,11.2-5,11.2-11.2v-90c0-6.2-5-11.2-11.2-11.2h-97c-4.3,0-7.1-2.4-7.8-3.1
42
44
  c-1.4-1.4-70.2-70.3-70.6-70.6c-0.3-0.3-0.6-0.8-0.6-1.3c0-0.5,0.2-1,0.6-1.3c0.3-0.3,32.3-32.4,32.8-32.9
43
45
  c1.8-1.8,4.6-3.2,7.9-3.2c2.8,0,97.1,0,97.1,0c6.2,0,11.3-5,11.3-11.2l0-52.5c0-6.2-5-11.2-11.2-11.2h-96.9
44
46
  c-4.5,0-7.2,2.6-7.9,3.2C670.9,3.8,566,108.8,565.7,109.1c-0.3,0.3-0.8,0.5-1.3,0.5c-1,0-1.9-0.8-1.9-1.9l0-96.5
45
47
  c0-6.2-5-11.2-11.3-11.2H442.5c-6.2,0-11.2,5-11.2,11.2v90c0,6.2,5,11.3,11.2,11.3c4.1,0,7.5,3.4,7.5,7.5v60
46
48
  c0,4.1-3.4,7.5-7.5,7.5c-6.2,0-11.2,5-11.2,11.2v90c0,6.2,5,11.3,11.2,11.3h108.7c6.2,0,11.3-5,11.3-11.3L562.5,192.3z"
47
- />
48
- <path
49
- d="M1001.2,300c6.2,0,11.3-5,11.3-11.3v-90c0-6.2-5-11.2-11.3-11.2c-4.1,0-7.5-3.4-7.5-7.5v-22.5
49
+ />
50
+ <path
51
+ d="M1001.2,300c6.2,0,11.3-5,11.3-11.3v-90c0-6.2-5-11.2-11.3-11.2c-4.1,0-7.5-3.4-7.5-7.5v-22.5
50
52
  c0-4.2,3.4-7.5,7.5-7.5h41.2c4.1,0,7.5,3.4,7.5,7.5c0,6.2,5,11.2,11.3,11.2h90.1c6.2,0,11.2-5,11.2-11.2V105
51
53
  c0-6.2-5-11.2-11.2-11.2h-90.1c-6.2,0-11.3,5-11.3,11.2c0,4.1-3.4,7.5-7.5,7.5l-41.2,0c-4.1,0-7.5-3.4-7.5-7.5V45
52
54
  c0-4.1,3.4-7.5,7.5-7.5h116.3c4.1,0,7.5,3.4,7.5,7.5v18.8c0,6.2,5,11.2,11.3,11.2h127.5c6.2,0,11.3-5,11.3-11.2V11.2
53
55
  c0-6.2-5-11.2-11.3-11.2H892.5c-6.2,0-11.2,5-11.2,11.2v90c0,6.2,5,11.3,11.2,11.3c4.1,0,7.5,3.4,7.5,7.5v60
54
56
  c0,4.1-3.4,7.5-7.5,7.5c-6.2,0-11.2,5-11.2,11.2v90c0,6.2,5,11.3,11.2,11.3H1001.2z"
55
- />
56
- </g>
57
+ />
58
+ <path
59
+ d="M1207.4,262.9c0-17.5,13.2-30.7,30.1-30.7c16.7,0,30,13.2,30,30.7c0,17.8-13.2,30.9-30,30.9
60
+ C1220.7,293.8,1207.4,280.7,1207.4,262.9z M1237.6,300c20.2,0,37.4-15.7,37.4-37.1c0-21.2-17.2-36.9-37.4-36.9
61
+ c-20.4,0-37.6,15.7-37.6,36.9C1200,284.3,1217.2,300,1237.6,300z M1230.9,265.5h6.5l9.9,16.3h6.4l-10.7-16.5
62
+ c5.5-0.7,9.7-3.6,9.7-10.3c0-7.4-4.4-10.7-13.3-10.7h-14.3v37.6h5.7V265.5z M1230.9,260.7V249h7.7c4,0,8.2,0.9,8.2,5.5
63
+ c0,5.8-4.3,6.1-9.1,6.1H1230.9z"
64
+ />
57
65
  </g>
58
- <path
59
- d="M1207.4,262.9c0-17.5,13.2-30.7,30.1-30.7c16.7,0,30,13.2,30,30.7c0,17.8-13.2,30.9-30,30.9
60
- C1220.7,293.8,1207.4,280.7,1207.4,262.9z M1237.6,300c20.2,0,37.4-15.7,37.4-37.1c0-21.2-17.2-36.9-37.4-36.9
61
- c-20.4,0-37.6,15.7-37.6,36.9C1200,284.3,1217.2,300,1237.6,300z M1230.9,265.5h6.5l9.9,16.3h6.4l-10.7-16.5
62
- c5.5-0.7,9.7-3.6,9.7-10.3c0-7.4-4.4-10.7-13.3-10.7h-14.3v37.6h5.7V265.5z M1230.9,260.7V249h7.7c4,0,8.2,0.9,8.2,5.5
63
- c0,5.8-4.3,6.1-9.1,6.1H1230.9z"
64
- />
65
66
  </svg>
66
67
  `;
67
68
  }
68
69
  };
69
- o.styles = [m, d];
70
- let t = o;
71
- v([
72
- p()
73
- ], t.prototype, "title");
74
- v([
75
- p()
76
- ], t.prototype, "color");
70
+ h = new WeakMap(), p = new WeakMap(), y.styles = [V, z];
71
+ let o = y;
72
+ m([
73
+ d({ type: String })
74
+ ], o.prototype, "title", 2);
75
+ m([
76
+ d({ type: String })
77
+ ], o.prototype, "color", 2);
78
+ m([
79
+ M("color")
80
+ ], o.prototype, "_handleStateChange", 1);
77
81
  export {
78
- t as SkfLogo
82
+ o as SkfLogo
79
83
  };
@@ -1,25 +1,35 @@
1
1
  import { css as o } from "lit";
2
- const s = o`
3
- /* stylelint-disable selector-class-pattern */
2
+ const r = o`
3
+ @layer components {
4
+ @layer base {
5
+ :host {
6
+ display: inline-flex;
7
+ }
4
8
 
5
- :host {
6
- display: inline-flex;
7
- }
9
+ #root {
10
+ --_skf-logo-color: var(--skf-logo-primary);
8
11
 
9
- .logo {
10
- aspect-ratio: 13 / 3;
11
- block-size: var(--skf-logo-height, var(--skf-size-32));
12
- fill: var(--_skf-logo-color, var(--skf-logo-primary));
13
- }
12
+ aspect-ratio: 13 / 3;
13
+ block-size: var(--mod-logo-height, var(--skf-size-32));
14
+ fill: var(--_skf-logo-color);
15
+ }
16
+ }
14
17
 
15
- .logo--color-secondary {
16
- --_skf-logo-color: var(--skf-logo-secondary);
17
- }
18
+ @layer mods {
19
+ :host(:state(secondary)) {
20
+ #root {
21
+ --_skf-logo-color: var(--skf-logo-secondary);
22
+ }
23
+ }
18
24
 
19
- .logo--color-inverse {
20
- --_skf-logo-color: var(--skf-logo-inverse);
25
+ :host(:state(inverse)) {
26
+ #root {
27
+ --_skf-logo-color: var(--skf-logo-inverse);
28
+ }
29
+ }
30
+ }
21
31
  }
22
32
  `;
23
33
  export {
24
- s as styles
34
+ r as styles
25
35
  };
@@ -1,13 +1,13 @@
1
1
  import "../icon/icon.js";
2
2
  import { SkfElement as u } from "../../internal/components/skf-element.js";
3
3
  import { componentStyles as f } from "../../styles/component.styles.js";
4
- import { LitElement as m, html as h } from "lit";
4
+ import { LitElement as m, html as d } from "lit";
5
5
  import { property as l, queryAssignedNodes as _ } from "lit/decorators.js";
6
6
  import { ifDefined as p } from "lit/directives/if-defined.js";
7
7
  import { styles as y } from "./select-option.styles.js";
8
- var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (d, t, s, i) => {
9
- for (var r = i > 1 ? void 0 : i ? b(t, s) : t, a = d.length - 1, c; a >= 0; a--)
10
- (c = d[a]) && (r = (i ? c(t, s, r) : c(r)) || r);
8
+ var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (h, t, s, i) => {
9
+ for (var r = i > 1 ? void 0 : i ? b(t, s) : t, a = h.length - 1, c; a >= 0; a--)
10
+ (c = h[a]) && (r = (i ? c(t, s, r) : c(r)) || r);
11
11
  return i && r && v(t, s, r), r;
12
12
  };
13
13
  const n = class n extends u {
@@ -67,7 +67,7 @@ const n = class n extends u {
67
67
  ) : "";
68
68
  }
69
69
  render() {
70
- return h`
70
+ return d`
71
71
  <button
72
72
  ?disabled=${this.disabled}
73
73
  @click=${this._handleClick}
@@ -78,15 +78,15 @@ const n = class n extends u {
78
78
  <slot>${this.text}</slot>
79
79
  <div id="adornments">
80
80
  <slot name="icon">
81
- ${this.icon && h`
81
+ ${this.icon && d`
82
82
  <skf-icon
83
- class=${p((this.disabled || !this.iconColor) && "skf-icon-host")}
84
83
  color=${p(this.iconColor)}
84
+ data-color=${p((this.disabled || !this.iconColor) && "custom")}
85
85
  name=${this.icon}
86
86
  ></skf-icon>
87
87
  `}
88
88
  </slot>
89
- ${this.shortLabel && h`<div id="short-label">${this.shortLabel}</div>`}
89
+ ${this.shortLabel && d`<div id="short-label">${this.shortLabel}</div>`}
90
90
  </div>
91
91
  </button>
92
92
  `;
@@ -199,7 +199,6 @@ const c = class c extends b {
199
199
  aria-expanded=${this._expanded}
200
200
  aria-invalid=${this._invalid}
201
201
  aria-haspopup="listbox"
202
- class="skf-icon-host"
203
202
  id="select-button"
204
203
  role="combobox"
205
204
  >
@@ -208,7 +207,7 @@ const c = class c extends b {
208
207
  class=${E({ "selected-value": !0, "contains-meta-info": !this.value })}>
209
208
  ${this._computeVisibleValue()}
210
209
  </span>
211
- <skf-icon class="arrow" name="chevronDown"></skf-icon>
210
+ <skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
212
211
  </button>
213
212
  </label>
214
213
  <div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
@@ -2,6 +2,7 @@ import '../icon/icon.js';
2
2
  import { SkfElement } from '../../internal/components/skf-element';
3
3
  import type { Icon, Severity } from '../../internal/types.js';
4
4
  import { type CSSResultGroup } from 'lit';
5
+ type Size = 'sm' | 'md';
5
6
  /**
6
7
  * The `<skf-tag>` is a component that displays a list of actions or options
7
8
  *
@@ -12,13 +13,14 @@ import { type CSSResultGroup } from 'lit';
12
13
  * @tagname skf-tag
13
14
  */
14
15
  export declare class SkfTag extends SkfElement {
16
+ #private;
15
17
  static styles: CSSResultGroup;
16
18
  /** @internal */
17
19
  private _onClick?;
18
20
  /** @internal */
19
21
  private _onRemove?;
20
22
  /** Specifies Tag size */
21
- size: 'sm' | 'md';
23
+ size: Size;
22
24
  /** If defined, displays leading/provided icon */
23
25
  icon?: Icon;
24
26
  /** If defined, gives the supplied appearance */
@@ -37,6 +39,8 @@ export declare class SkfTag extends SkfElement {
37
39
  disconnectedCallback(): void;
38
40
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
39
41
  /** @internal */
42
+ _handleStateChange(property: string, _prev: unknown, next: unknown): void;
43
+ /** @internal */
40
44
  private _handleKeyDown;
41
45
  /** @internal run externally provided callback (if any) first. Let click propagate to handleClick. */
42
46
  private _handleRemove;
@@ -44,3 +48,4 @@ export declare class SkfTag extends SkfElement {
44
48
  private _handleClick;
45
49
  render(): import("lit").TemplateResult<1>;
46
50
  }
51
+ export {};
@@ -1,34 +1,49 @@
1
+ var y = (e) => {
2
+ throw TypeError(e);
3
+ };
4
+ var k = (e, o, t) => o.has(e) || y("Cannot " + t);
5
+ var m = (e, o, t) => (k(e, o, "read from private field"), t ? t.call(e) : o.get(e)), d = (e, o, t) => o.has(e) ? y("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(e) : o.set(e, t), v = (e, o, t, i) => (k(e, o, "write to private field"), i ? i.call(e, t) : o.set(e, t), t);
1
6
  import "../icon/icon.js";
2
- import { SkfElement as u } from "../../internal/components/skf-element.js";
3
- import { componentStyles as d } from "../../styles/component.styles.js";
4
- import { nothing as m, html as a } from "lit";
5
- import { property as s, query as f } from "lit/decorators.js";
6
- import { ifDefined as v } from "lit/directives/if-defined.js";
7
- import { styles as k } from "./tag.styles.js";
8
- var y = Object.defineProperty, b = Object.getOwnPropertyDescriptor, r = (p, e, n, i) => {
9
- for (var t = i > 1 ? void 0 : i ? b(e, n) : e, l = p.length - 1, c; l >= 0; l--)
10
- (c = p[l]) && (t = (i ? c(e, n, t) : c(t)) || t);
11
- return i && t && y(e, n, t), t;
7
+ import { SkfElement as _ } from "../../internal/components/skf-element.js";
8
+ import { stateMap as g } from "../../internal/helpers/stateMap.js";
9
+ import { watch as w } from "../../internal/helpers/watch.js";
10
+ import { componentStyles as $ } from "../../styles/component.styles.js";
11
+ import { nothing as C, html as f } from "lit";
12
+ import { property as c, query as R } from "lit/decorators.js";
13
+ import { ifDefined as D } from "lit/directives/if-defined.js";
14
+ import { styles as E } from "./tag.styles.js";
15
+ var P = Object.defineProperty, z = Object.getOwnPropertyDescriptor, r = (e, o, t, i) => {
16
+ for (var s = i > 1 ? void 0 : i ? z(o, t) : o, l = e.length - 1, p; l >= 0; l--)
17
+ (p = e[l]) && (s = (i ? p(o, t, s) : p(s)) || s);
18
+ return i && s && P(o, t, s), s;
19
+ };
20
+ const b = {
21
+ size: ["sm", "md"],
22
+ color: ["error", "info", "success", "warning"]
12
23
  };
13
- const h = class h extends u {
24
+ var a, h;
25
+ const u = class u extends _ {
14
26
  constructor() {
15
- super(...arguments), this.size = "md", this.removable = !1, this._handleKeyDown = (e) => {
16
- (e.key === "Enter" || e.key === " ") && this.$removeButton.click();
17
- }, this._handleRemove = (e) => {
18
- this._onRemove && this._onRemove(e);
19
- }, this._handleClick = (e) => {
20
- var t;
21
- e.stopPropagation(), e.composedPath()[0].localName === "button" ? this.remove() : (t = this.onClick) == null || t.call(this, e);
27
+ super(...arguments);
28
+ d(this, a);
29
+ d(this, h);
30
+ v(this, a, this.attachInternals()), v(this, h, m(this, a).states), this.size = "md", this.removable = !1, this._handleKeyDown = (t) => {
31
+ (t.key === "Enter" || t.key === " ") && this.$removeButton.click();
32
+ }, this._handleRemove = (t) => {
33
+ this._onRemove && this._onRemove(t);
34
+ }, this._handleClick = (t) => {
35
+ var l;
36
+ t.stopPropagation(), t.composedPath()[0].localName === "button" ? this.remove() : (l = this.onClick) == null || l.call(this, t);
22
37
  };
23
38
  }
24
- set onClick(e) {
25
- e && (this._onClick = e);
39
+ set onClick(t) {
40
+ t && (this._onClick = t);
26
41
  }
27
42
  get onClick() {
28
43
  return this._onClick;
29
44
  }
30
- set onRemove(e) {
31
- e && (this._onRemove = e);
45
+ set onRemove(t) {
46
+ t && (this._onRemove = t);
32
47
  }
33
48
  get onRemove() {
34
49
  return this._onRemove;
@@ -39,46 +54,52 @@ const h = class h extends u {
39
54
  disconnectedCallback() {
40
55
  super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
41
56
  }
42
- attributeChangedCallback(e, n, i) {
43
- super.attributeChangedCallback(e, n, i), e === "removable" && i !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
57
+ attributeChangedCallback(t, i, s) {
58
+ super.attributeChangedCallback(t, i, s), t === "removable" && s !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
59
+ }
60
+ _handleStateChange(t, i, s) {
61
+ g(m(this, h), b[t]).set(s);
44
62
  }
45
63
  render() {
46
- return a`
64
+ return f`
47
65
  <div id="root">
48
- ${this.icon ? a`<skf-icon color=${v(this.color)} name=${this.icon} size="sm"></skf-icon>` : m}
66
+ ${this.icon ? f`<skf-icon color=${D(this.color)} name=${this.icon} size="sm"></skf-icon>` : C}
49
67
  <slot></slot>
50
- ${this.removable ? a`
68
+ ${this.removable ? f`
51
69
  <button @click=${this._handleRemove} type="button">
52
70
  <skf-icon name="close" size="xs"></skf-icon>
53
71
  </button>
54
- ` : m}
72
+ ` : C}
55
73
  </div>
56
74
  `;
57
75
  }
58
76
  };
59
- h.styles = [d, k];
60
- let o = h;
77
+ a = new WeakMap(), h = new WeakMap(), u.styles = [$, E];
78
+ let n = u;
79
+ r([
80
+ c({ type: String })
81
+ ], n.prototype, "size", 2);
61
82
  r([
62
- s({ type: String, reflect: !0 })
63
- ], o.prototype, "size", 2);
83
+ c({ type: String })
84
+ ], n.prototype, "icon", 2);
64
85
  r([
65
- s({ type: String })
66
- ], o.prototype, "icon", 2);
86
+ c({ type: String })
87
+ ], n.prototype, "color", 2);
67
88
  r([
68
- s({ type: String, reflect: !0 })
69
- ], o.prototype, "color", 2);
89
+ c({ attribute: !1 })
90
+ ], n.prototype, "onClick", 1);
70
91
  r([
71
- s({ attribute: !1 })
72
- ], o.prototype, "onClick", 1);
92
+ c({ attribute: !1 })
93
+ ], n.prototype, "onRemove", 1);
73
94
  r([
74
- s({ attribute: !1 })
75
- ], o.prototype, "onRemove", 1);
95
+ c({ type: Boolean })
96
+ ], n.prototype, "removable", 2);
76
97
  r([
77
- s({ type: Boolean, reflect: !0 })
78
- ], o.prototype, "removable", 2);
98
+ R("button")
99
+ ], n.prototype, "$removeButton", 2);
79
100
  r([
80
- f("button")
81
- ], o.prototype, "$removeButton", 2);
101
+ w(Object.keys(b))
102
+ ], n.prototype, "_handleStateChange", 1);
82
103
  export {
83
- o as SkfTag
104
+ n as SkfTag
84
105
  };
@@ -45,32 +45,32 @@ const s = r`
45
45
  }
46
46
 
47
47
  @layer mods {
48
- :host([color='alert']) #root {
48
+ :host(:state(alert)) #root {
49
49
  --_skf-tag-bg-color: var(--skf-severity-bg-color-alert);
50
50
  --_skf-tag-border-color: var(--skf-severity-fg-color-alert);
51
51
  }
52
52
 
53
- :host([color='error']) #root {
53
+ :host(:state(error)) #root {
54
54
  --_skf-tag-bg-color: var(--skf-severity-bg-color-error);
55
55
  --_skf-tag-border-color: var(--skf-severity-fg-color-error);
56
56
  }
57
57
 
58
- :host([color='info']) #root {
58
+ :host(:state(info)) #root {
59
59
  --_skf-tag-bg-color: var(--skf-severity-bg-color-info);
60
60
  --_skf-tag-border-color: var(--skf-severity-fg-color-info);
61
61
  }
62
62
 
63
- :host([color='success']) #root {
63
+ :host(:state(success)) #root {
64
64
  --_skf-tag-bg-color: var(--skf-severity-bg-color-success);
65
65
  --_skf-tag-border-color: var(--skf-severity-fg-color-success);
66
66
  }
67
67
 
68
- :host([color='warning']) #root {
68
+ :host(:state(warning)) #root {
69
69
  --_skf-tag-bg-color: var(--skf-severity-bg-color-warning);
70
70
  --_skf-tag-border-color: var(--skf-severity-fg-color-warning);
71
71
  }
72
72
 
73
- :host([size='sm']) #root {
73
+ :host(:state(sm)) #root {
74
74
  --_skf-tag-border-radius: 0.25rem; /* token needed */
75
75
  --_skf-tag-font-size: var(--skf-font-size-25);
76
76
  --_skf-tag-height: var(--skf-size-24);