@skf-design-system/ui-components 1.0.2-beta.7 → 1.0.2-beta.9

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.
@@ -29,8 +29,7 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
29
29
  /** If defined, outputs helping hints in console */
30
30
  debug: boolean;
31
31
  /** If true, outputs helping hints in console */
32
- get checked(): boolean;
33
- set checked(value: boolean);
32
+ checked: boolean;
34
33
  /** If true, forces component to invalid state until removed */
35
34
  customInvalid: boolean;
36
35
  /** If true and the checkbox is unchecked, the checkbox will appear indeterminate */
@@ -55,7 +54,7 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
55
54
  /** @internal */
56
55
  private $input?;
57
56
  /** @internal */
58
- handleCheckedChange(): void;
57
+ _handleCheckedChange(): void;
59
58
  /** @internal */
60
59
  handleInvalidChange(): void;
61
60
  /** @internal */
@@ -1,11 +1,11 @@
1
- var p = (i) => {
1
+ var c = (i) => {
2
2
  throw TypeError(i);
3
3
  };
4
- var v = (i, s, t) => s.has(i) || p("Cannot " + t);
5
- var m = (i, s, t) => (v(i, s, "read from private field"), t ? t.call(i) : s.get(i)), f = (i, s, t) => s.has(i) ? p("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(i) : s.set(i, t), y = (i, s, t, a) => (v(i, s, "write to private field"), a ? a.call(i, t) : s.set(i, t), t);
4
+ var v = (i, s, t) => s.has(i) || c("Cannot " + t);
5
+ var m = (i, s, t) => (v(i, s, "read from private field"), t ? t.call(i) : s.get(i)), f = (i, s, t) => s.has(i) ? c("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(i) : s.set(i, t), y = (i, s, t, r) => (v(i, s, "write to private field"), r ? r.call(i, t) : s.set(i, t), t);
6
6
  import "../icon/icon.js";
7
7
  import { FormBase as _ } from "../../internal/components/formBase.js";
8
- import { watch as o } from "../../internal/helpers/watch.js";
8
+ import { watch as n } from "../../internal/helpers/watch.js";
9
9
  import { Asterisk as b } from "../../internal/templates/asterisk.js";
10
10
  import { componentStyles as k } from "../../styles/component.styles.js";
11
11
  import { LocalizeController as $ } from "../../utilities/localize.js";
@@ -13,30 +13,23 @@ import { html as g, nothing as I } from "lit";
13
13
  import { property as l, state as V, query as C } from "lit/decorators.js";
14
14
  import { ifDefined as E } from "lit/directives/if-defined.js";
15
15
  import { styles as w } from "./checkbox.styles.js";
16
- var A = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (i, s, t, a) => {
17
- for (var h = a > 1 ? void 0 : a ? D(s, t) : s, d = i.length - 1, u; d >= 0; d--)
18
- (u = i[d]) && (h = (a ? u(s, t, h) : u(h)) || h);
19
- return a && h && A(s, t, h), h;
20
- }, n;
21
- const c = class c extends _ {
16
+ var A = Object.defineProperty, D = Object.getOwnPropertyDescriptor, a = (i, s, t, r) => {
17
+ for (var h = r > 1 ? void 0 : r ? D(s, t) : s, d = i.length - 1, u; d >= 0; d--)
18
+ (u = i[d]) && (h = (r ? u(s, t, h) : u(h)) || h);
19
+ return r && h && A(s, t, h), h;
20
+ }, o;
21
+ const p = class p extends _ {
22
22
  constructor() {
23
23
  super(...arguments);
24
- f(this, n);
25
- this._initiallyChecked = !1, y(this, n, new $(this)), this.debug = !1, this.customInvalid = !1, this.indeterminate = !1, this.lang = "en", this.showValid = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
24
+ f(this, o);
25
+ this._initiallyChecked = !1, y(this, o, new $(this)), this.debug = !1, this.checked = !1, this.customInvalid = !1, this.indeterminate = !1, this.lang = "en", this.showValid = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
26
26
  t.stopPropagation(), this.checked = this._initiallyChecked, this.$input && (this.$input.checked = !!this._initiallyChecked), this.setFormValue(this.checked ? this.value : null);
27
27
  }, this._renderIcon = (t) => g`
28
28
  <skf-icon color="inverse" name=${t} size=${this.size === "sm" ? "sm" : "md"}></skf-icon>
29
29
  `;
30
30
  }
31
- get checked() {
32
- var t;
33
- return ((t = this.$input) == null ? void 0 : t.checked) ?? !1;
34
- }
35
- set checked(t) {
36
- this.setAttribute("checked", String(!!t)), this.$input && (this.$input.checked = !!t);
37
- }
38
- handleCheckedChange() {
39
- this.setFormValue(this.checked ? this.value : null), this._validateInput();
31
+ _handleCheckedChange() {
32
+ this.setFormValue(this.checked ? this.value : null), this._validateInput(), this.$input && (this.$input.checked = !!this.checked);
40
33
  }
41
34
  handleInvalidChange() {
42
35
  this._invalid ? (this.setAttribute("invalid", ""), this.showValid && this.removeAttribute("valid"), this.checkValidity()) : (this.removeAttribute("invalid"), !this.pristine && this.showValid && this.setAttribute("valid", "true"));
@@ -46,21 +39,21 @@ const c = class c extends _ {
46
39
  }
47
40
  handleCustomInvalidChange() {
48
41
  if (this.customInvalid) {
49
- const a = (
42
+ const r = (
50
43
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
51
44
  this.getAttribute("data-customerror") || "Set a custom error message using the data-customerror attribute"
52
45
  );
53
- this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, a), this.checkValidity();
46
+ this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, r), this.checkValidity();
54
47
  } else
55
48
  this.setValidity({}), this._validateInput();
56
49
  }
57
50
  firstUpdated() {
58
51
  var t;
59
- (t = this.$input) == null || t.addEventListener("change", (a) => {
52
+ (t = this.$input) == null || t.addEventListener("change", (r) => {
60
53
  var h;
61
- a.stopPropagation(), this.pristine = !1, this.checked = ((h = this.$input) == null ? void 0 : h.checked) ?? !1, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emitEvent("change");
62
- }), this.addEventListener("invalid", (a) => {
63
- this.pristine = !1, this._invalid = !0, this.customErrorDisplay && a.preventDefault();
54
+ r.stopPropagation(), this.pristine = !1, this.checked = ((h = this.$input) == null ? void 0 : h.checked) ?? !1, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emitEvent("change");
55
+ }), this.addEventListener("invalid", (r) => {
56
+ this.pristine = !1, this._invalid = !0, this.customErrorDisplay && r.preventDefault();
64
57
  }), this._initiallyChecked = this.checked, this.addEventListener("reset", this._resetValue), this._validateInput();
65
58
  }
66
59
  /** @internal */
@@ -70,11 +63,11 @@ const c = class c extends _ {
70
63
  this.setValidity({ customError: !0 }, "Custom error"), this._invalid = !0;
71
64
  else if (this.required && !this.checked) {
72
65
  this.pristine || (this._invalid = !0);
73
- const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
66
+ const r = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
74
67
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
75
68
  ((t = this.$input) == null ? void 0 : t.validationMessage) || "Please check this box if you want to proceed"
76
69
  );
77
- this.setValidity({ valueMissing: !0 }, String(a));
70
+ this.setValidity({ valueMissing: !0 }, String(r));
78
71
  } else
79
72
  this.setValidity({});
80
73
  }
@@ -94,64 +87,64 @@ const c = class c extends _ {
94
87
  ${this._renderIcon("check")} ${this._renderIcon("removeMinus")}
95
88
  <div id="label">
96
89
  <slot>${this.label}</slot>
97
- ${this.required ? b(m(this, n).term("required")) : I}
90
+ ${this.required ? b(m(this, o).term("required")) : I}
98
91
  </div>
99
92
  </label>
100
93
  `;
101
94
  }
102
95
  };
103
- n = new WeakMap(), c.styles = [k, w];
104
- let e = c;
105
- r([
96
+ o = new WeakMap(), p.styles = [k, w];
97
+ let e = p;
98
+ a([
106
99
  l({ type: Boolean })
107
100
  ], e.prototype, "debug", 2);
108
- r([
101
+ a([
109
102
  l({ type: Boolean, reflect: !0 })
110
- ], e.prototype, "checked", 1);
111
- r([
103
+ ], e.prototype, "checked", 2);
104
+ a([
112
105
  l({ type: Boolean, attribute: "custom-invalid", reflect: !0 })
113
106
  ], e.prototype, "customInvalid", 2);
114
- r([
107
+ a([
115
108
  l({ type: Boolean, reflect: !0 })
116
109
  ], e.prototype, "indeterminate", 2);
117
- r([
110
+ a([
118
111
  l()
119
112
  ], e.prototype, "label", 2);
120
- r([
113
+ a([
121
114
  l({ type: String })
122
115
  ], e.prototype, "lang", 2);
123
- r([
116
+ a([
124
117
  l()
125
118
  ], e.prototype, "name", 2);
126
- r([
119
+ a([
127
120
  l({ reflect: !0 })
128
121
  ], e.prototype, "severity", 2);
129
- r([
122
+ a([
130
123
  l({ type: Boolean, attribute: "show-valid" })
131
124
  ], e.prototype, "showValid", 2);
132
- r([
125
+ a([
133
126
  l({ reflect: !0 })
134
127
  ], e.prototype, "size", 2);
135
- r([
128
+ a([
136
129
  l()
137
130
  ], e.prototype, "value", 2);
138
- r([
131
+ a([
139
132
  V()
140
133
  ], e.prototype, "_invalid", 2);
141
- r([
134
+ a([
142
135
  C("input")
143
136
  ], e.prototype, "$input", 2);
144
- r([
145
- o("checked", { afterUpdate: !0 })
146
- ], e.prototype, "handleCheckedChange", 1);
147
- r([
148
- o("_invalid")
137
+ a([
138
+ n("checked")
139
+ ], e.prototype, "_handleCheckedChange", 1);
140
+ a([
141
+ n("_invalid")
149
142
  ], e.prototype, "handleInvalidChange", 1);
150
- r([
151
- o("_invalid", { afterUpdate: !0 })
143
+ a([
144
+ n("_invalid", { afterUpdate: !0 })
152
145
  ], e.prototype, "handleDebugInvalid", 1);
153
- r([
154
- o("customInvalid")
146
+ a([
147
+ n("customInvalid")
155
148
  ], e.prototype, "handleCustomInvalidChange", 1);
156
149
  export {
157
150
  e as SkfCheckbox
@@ -11,48 +11,58 @@ import { componentStyles as C } from "../../styles/component.styles.js";
11
11
  import { html as z } from "lit";
12
12
  import { property as n } from "lit/decorators.js";
13
13
  import { styles as O } from "./icon.styles.js";
14
- var w = Object.defineProperty, P = Object.getOwnPropertyDescriptor, p = (t, e, r, o) => {
14
+ var w = Object.defineProperty, P = Object.getOwnPropertyDescriptor, l = (t, e, r, o) => {
15
15
  for (var s = o > 1 ? void 0 : o ? P(e, r) : e, m = t.length - 1, h; m >= 0; m--)
16
16
  (h = t[m]) && (s = (o ? h(e, r, s) : h(s)) || s);
17
17
  return o && s && w(e, r, s), s;
18
18
  };
19
19
  const x = {
20
- color: ["emphasized", "error", "info", "inverse", "primary", "secondary", "success", "warning"],
20
+ color: [
21
+ "emphasized",
22
+ "error",
23
+ "info",
24
+ "inverse",
25
+ "primary",
26
+ "purple",
27
+ "secondary",
28
+ "success",
29
+ "warning"
30
+ ],
21
31
  size: ["lg", "md", "sm", "xs"]
22
32
  };
23
- var a, l;
33
+ var a, p;
24
34
  const f = class f extends v {
25
35
  constructor() {
26
36
  super(...arguments);
27
37
  y(this, a);
28
- y(this, l);
29
- d(this, a, this.attachInternals()), d(this, l, c(this, a).states), this.color = "primary", this.size = "md";
38
+ y(this, p);
39
+ d(this, a, this.attachInternals()), d(this, p, c(this, a).states), this.color = "primary", this.size = "md";
30
40
  }
31
41
  connectedCallback() {
32
42
  super.connectedCallback(), this.ariaHidden = this.label ? null : "true", this.ariaLabel = this.label ?? null, this.role = this.label ? "img" : null;
33
43
  }
34
44
  _handleStateChange(r, o, s) {
35
- b(c(this, l), x[r]).set(s);
45
+ b(c(this, p), x[r]).set(s);
36
46
  }
37
47
  render() {
38
48
  return z`<div id="root">${S[this.name]}</div>`;
39
49
  }
40
50
  };
41
- a = new WeakMap(), l = new WeakMap(), f.styles = [C, O];
51
+ a = new WeakMap(), p = new WeakMap(), f.styles = [C, O];
42
52
  let i = f;
43
- p([
53
+ l([
44
54
  n({ type: String })
45
55
  ], i.prototype, "color", 2);
46
- p([
56
+ l([
47
57
  n({ type: String })
48
58
  ], i.prototype, "label", 2);
49
- p([
59
+ l([
50
60
  n({ type: String })
51
61
  ], i.prototype, "name", 2);
52
- p([
62
+ l([
53
63
  n({ type: String })
54
64
  ], i.prototype, "size", 2);
55
- p([
65
+ l([
56
66
  _(["color", "size"])
57
67
  ], i.prototype, "_handleStateChange", 1);
58
68
  export {
@@ -42,8 +42,8 @@ const r = o`
42
42
  --_skf-icon-color: var(--skf-icon-color-emphasized);
43
43
  }
44
44
 
45
- :host(:state(alert)) #root {
46
- --_skf-icon-color: var(--skf-severity-fg-color-alert);
45
+ :host(:state(purple)) #root {
46
+ --_skf-icon-color: var(--skf-icon-color-purple);
47
47
  }
48
48
 
49
49
  :host(:state(error)) #root {