@skf-design-system/ui-components 1.0.0-beta.3 → 1.0.0-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 (65) hide show
  1. package/dist/components/accordion/accordion.component.d.ts +5 -9
  2. package/dist/components/accordion/accordion.component.js +19 -22
  3. package/dist/components/accordion/accordion.d.ts +1 -1
  4. package/dist/components/accordion/accordion.styles.js +3 -3
  5. package/dist/components/alert/alert.component.d.ts +4 -7
  6. package/dist/components/alert/alert.component.js +1 -1
  7. package/dist/components/alert/alert.styles.js +1 -1
  8. package/dist/components/button/button.component.js +1 -1
  9. package/dist/components/button/button.styles.js +1 -1
  10. package/dist/components/card/card.component.d.ts +3 -3
  11. package/dist/components/card/card.component.js +19 -16
  12. package/dist/components/card/card.styles.js +3 -11
  13. package/dist/components/checkbox/checkbox.component.d.ts +6 -9
  14. package/dist/components/checkbox/checkbox.component.js +7 -7
  15. package/dist/components/checkbox/checkbox.styles.js +1 -1
  16. package/dist/components/collapse/collapse.component.d.ts +6 -9
  17. package/dist/components/collapse/collapse.component.js +36 -39
  18. package/dist/components/collapse/collapse.styles.js +3 -3
  19. package/dist/components/divider/divider.component.d.ts +10 -13
  20. package/dist/components/divider/divider.component.js +29 -34
  21. package/dist/components/divider/divider.styles.js +5 -1
  22. package/dist/components/heading/heading.component.d.ts +2 -12
  23. package/dist/components/heading/heading.component.js +14 -14
  24. package/dist/components/heading/heading.styles.js +1 -1
  25. package/dist/components/icon/icon.component.d.ts +8 -14
  26. package/dist/components/icon/icon.component.js +6 -6
  27. package/dist/components/icon/icon.styles.js +1 -1
  28. package/dist/components/input/input.component.d.ts +29 -34
  29. package/dist/components/input/input.component.js +16 -18
  30. package/dist/components/link/link.component.d.ts +12 -15
  31. package/dist/components/link/link.component.js +7 -7
  32. package/dist/components/link/link.styles.js +1 -1
  33. package/dist/components/loader/loader.component.d.ts +7 -7
  34. package/dist/components/loader/loader.component.js +61 -35
  35. package/dist/components/loader/loader.styles.js +10 -42
  36. package/dist/components/logo/logo.component.d.ts +3 -5
  37. package/dist/components/logo/logo.component.js +8 -8
  38. package/dist/components/logo/logo.styles.js +2 -2
  39. package/dist/components/radio/radio.component.d.ts +13 -15
  40. package/dist/components/radio/radio.component.js +3 -3
  41. package/dist/components/radio/radio.styles.js +3 -3
  42. package/dist/components/select/select.component.d.ts +8 -7
  43. package/dist/components/select/select.component.js +20 -20
  44. package/dist/components/select/select.styles.js +3 -3
  45. package/dist/components/switch/switch.component.d.ts +3 -2
  46. package/dist/components/switch/switch.component.js +1 -1
  47. package/dist/components/switch/switch.styles.js +1 -1
  48. package/dist/components/tag/tag.component.d.ts +7 -12
  49. package/dist/components/tag/tag.component.js +24 -24
  50. package/dist/components/tag/tag.styles.js +1 -6
  51. package/dist/components/textarea/textarea.component.d.ts +23 -26
  52. package/dist/components/textarea/textarea.component.js +12 -15
  53. package/dist/custom-elements.json +221 -221
  54. package/dist/internal/storybook/shadowRootTraverser.d.ts +8 -16
  55. package/dist/react/index.d.ts +3 -3
  56. package/dist/react/index.js +3 -3
  57. package/dist/styles/form-field.styles.js +1 -1
  58. package/dist/types/jsx/custom-element-jsx.d.ts +47 -47
  59. package/dist/types/vue/index.d.ts +49 -49
  60. package/dist/vscode.html-custom-data.json +61 -61
  61. package/dist/web-types.json +118 -118
  62. package/package.json +1 -1
  63. package/dist/components/checkbox/checkbox.test.d.ts +0 -1
  64. package/dist/components/collapse/collapse.test.d.ts +0 -1
  65. package/dist/components/switch/switch.test.d.ts +0 -1
@@ -1,16 +1,16 @@
1
1
  import "../icon/icon.js";
2
- import { SkfElement as u } from "../../internal/components/skf-element.js";
3
- import d from "../../styles/component.styles.js";
2
+ import { SkfElement as d } from "../../internal/components/skf-element.js";
3
+ import u from "../../styles/component.styles.js";
4
4
  import { html as a, nothing as m } from "lit";
5
- import { property as s, query as f } from "lit/decorators.js";
5
+ import { property as r, query as f } from "lit/decorators.js";
6
6
  import { ifDefined as v } from "lit/directives/if-defined.js";
7
7
  import { styles as k } from "./tag.styles.js";
8
- var y = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (p, e, i, n) => {
9
- for (var t = n > 1 ? void 0 : n ? C(e, i) : e, l = p.length - 1, c; l >= 0; l--)
8
+ var b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, s = (p, e, i, n) => {
9
+ for (var t = n > 1 ? void 0 : n ? y(e, i) : e, l = p.length - 1, c; l >= 0; l--)
10
10
  (c = p[l]) && (t = (n ? c(e, i, t) : c(t)) || t);
11
- return n && t && y(e, i, t), t;
11
+ return n && t && b(e, i, t), t;
12
12
  };
13
- const h = class h extends u {
13
+ const h = class h extends d {
14
14
  constructor() {
15
15
  super(...arguments), this.size = "md", this._handleKeyDown = (e) => {
16
16
  (e.key === "Enter" || e.key === " ") && this.$removeButton.click();
@@ -20,7 +20,7 @@ const h = class h extends u {
20
20
  var t;
21
21
  e.stopPropagation();
22
22
  const i = e.composedPath()[0];
23
- console.log("$clickTarget", i), i.localName === "button" ? this.remove() : (t = this.onClick) == null || t.call(this, e);
23
+ i.localName === "skf-icon" && i.getAttribute("name") === "close" ? this.remove() : (t = this.onClick) == null || t.call(this, e);
24
24
  };
25
25
  }
26
26
  set onClick(e) {
@@ -42,11 +42,11 @@ const h = class h extends u {
42
42
  super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
43
43
  }
44
44
  attributeChangedCallback(e, i, n) {
45
- super.attributeChangedCallback(e, i, n), e === "removable" && n !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
45
+ super.attributeChangedCallback(e, i, n), e === "removable" && n !== null ? (this.tabIndex = 0, this.addEventListener("keydown", this._handleKeyDown)) : (this.tabIndex = -1, this.removeEventListener("keydown", this._handleKeyDown));
46
46
  }
47
47
  render() {
48
48
  return a`
49
- <div id="root">
49
+ <div id="tag">
50
50
  ${this.icon ? a`<skf-icon color=${v(this.color)} name=${this.icon} size="sm"></skf-icon>` : m}
51
51
  <span>
52
52
  <slot></slot>
@@ -60,27 +60,27 @@ const h = class h extends u {
60
60
  `;
61
61
  }
62
62
  };
63
- h.styles = [d, k];
63
+ h.styles = [u, k];
64
64
  let o = h;
65
- r([
66
- s({ reflect: !0 })
65
+ s([
66
+ r({ reflect: !0 })
67
67
  ], o.prototype, "size", 2);
68
- r([
69
- s()
68
+ s([
69
+ r()
70
70
  ], o.prototype, "icon", 2);
71
- r([
72
- s({ reflect: !0 })
71
+ s([
72
+ r({ reflect: !0 })
73
73
  ], o.prototype, "color", 2);
74
- r([
75
- s({ attribute: !1 })
74
+ s([
75
+ r({ attribute: !1 })
76
76
  ], o.prototype, "onClick", 1);
77
- r([
78
- s({ attribute: !1 })
77
+ s([
78
+ r({ attribute: !1 })
79
79
  ], o.prototype, "onRemove", 1);
80
- r([
81
- s({ type: Boolean, reflect: !0 })
80
+ s([
81
+ r({ type: Boolean, reflect: !0 })
82
82
  ], o.prototype, "removable", 2);
83
- r([
83
+ s([
84
84
  f("button")
85
85
  ], o.prototype, "$removeButton", 2);
86
86
  export {
@@ -1,7 +1,7 @@
1
1
  import { css as r } from "lit";
2
2
  const s = r`
3
3
  @layer components {
4
- #root {
4
+ #tag {
5
5
  align-items: center;
6
6
  background-color: var(--_skf-tag-bg-color, var(--skf-bg-color-neutral-1));
7
7
  block-size: var(--_skf-tag-height, var(--skf-size-32));
@@ -55,11 +55,6 @@ const s = r`
55
55
 
56
56
  button {
57
57
  display: flex;
58
-
59
- &:focus-visible {
60
- border-radius: var(--skf-border-radius-sm);
61
- outline: var(--skf-border-width-md) solid var(--skf-interactive-border-color-focus);
62
- }
63
58
  }
64
59
  }
65
60
  `;
@@ -12,7 +12,7 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
12
12
  /**
13
13
  * The skf-textarea is used to create a textarea. Use it inside a form element or wherever you like.
14
14
  *
15
- * @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/143f9d-text-area) for design principles.
15
+ * @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/619e4125b3d2147c0c584b11) for design principles.
16
16
  *
17
17
  * @attribute {boolean} disabled - If true, sets disabled state
18
18
  * @attribute {boolean} required - If true, value is required or must be checked for the form to be submittable
@@ -20,51 +20,48 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
20
20
  * @event change - Fires when the value of the input changes
21
21
  * @event invalid - Fires when the input is invalid
22
22
  *
23
- * @slot - The textareas label. Alternatively, you can use the `label` attribute.
23
+ * @slot The textareas label. Alternatively, you can use the `label` attribute.
24
24
  *
25
25
  * @tagname skf-textarea
26
26
  */
27
27
  export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
28
28
  static styles: CSSResultGroup;
29
29
  private customError;
30
- /** If defined, sets the cols of the textarea */
31
- cols?: number;
32
- /** If defined, forces component to invalid state until removed. Its value is used as hint text. */
30
+ /** If provided, sets the cols of the textarea */
31
+ cols?: number | undefined;
32
+ /** If provided, forces component to invalid state until removed. Its value is used as hint text. */
33
33
  set customInvalid(value: string | undefined);
34
34
  get customInvalid(): string | undefined;
35
- /** If true, outputs helping hints in console */
36
- debug?: boolean;
37
- /** If true, hides the label visually */
38
- hideLabel?: boolean;
39
- /** If defined, displays informational text below the field */
35
+ /** If provided, outputs helping hints in console */
36
+ debug: boolean;
37
+ /** hide-label - If true, hides the label visually */
38
+ hideLabel: boolean;
39
+ /** If provided, displays informational text below the field */
40
40
  hint?: string;
41
- /** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
42
- label?: string;
43
- /** If defined, adds name to the input-element */
41
+ /** The input's label. Alternatively, you can use the component slot. */
42
+ label: string;
43
+ /** If provided, adds name to the input-element */
44
44
  name?: string;
45
- /** If defined, sets the maximum character length to accept for this input */
45
+ /** If provided, sets the maximum character length to accept for this input */
46
46
  maxLength?: number;
47
- /** If defined, sets the minimum character length to accept for this input */
47
+ /** If provided, sets the minimum character length to accept for this input */
48
48
  minLength?: number;
49
- /** If defined, displays placeholder text */
49
+ /** If provided, displays placeholder text */
50
50
  placeholder?: string;
51
51
  /** If true, makes the element not mutable, meaning the user can not edit the control */
52
52
  readonly?: boolean;
53
- /** If defined, renders an alternative A11y text for the asterisk */
53
+ /** If provided, renders an alternative A11y text for the asterisk */
54
54
  requiredLabel?: string;
55
- /** If defined, sets the rows of the textarea */
56
- rows?: number;
57
- /**
58
- * If defined, displays provided severity state
59
- * @type {"success" | "info" | "warning" | "alert"}
60
- */
55
+ /** If provided, sets the rows of the textarea */
56
+ rows?: number | undefined;
57
+ /** @type { "success" | "error" } - If provided, displays provided severity state */
61
58
  severity?: SkfTextAreaProps['severity'];
62
59
  /** If true, displays valid state after interaction */
63
60
  showValid?: boolean;
64
- /** Size of the Textarea */
61
+ /** If provided, displays an alternative size */
65
62
  size?: 'sm' | 'md';
66
- /** Sets validation start */
67
- validateOn: 'input' | 'change' | 'submit';
63
+ /** If provided, sets validation start, "input", "change" or "submit" */
64
+ validateOn?: 'input' | 'change' | 'submit';
68
65
  /** The current value of the text area */
69
66
  value: string;
70
67
  /** @internal */
@@ -14,7 +14,7 @@ var $ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, e = (h, t, s
14
14
  };
15
15
  const u = class u extends m {
16
16
  constructor() {
17
- super(...arguments), this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (t) => {
17
+ super(...arguments), this.cols = 20, this.debug = !1, this.hideLabel = !1, this.label = "Default label", this.rows = 2, this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (t) => {
18
18
  var s;
19
19
  t.stopPropagation(), this.value = ((s = this.getAttribute("value")) == null ? void 0 : s.trim()) ?? "", this._internals.setFormValue(this.value), this.$input.focus();
20
20
  }, this._handleInput = () => {
@@ -22,7 +22,7 @@ const u = class u extends m {
22
22
  };
23
23
  }
24
24
  set customInvalid(t) {
25
- this.customError = t || "";
25
+ this.customError = String(t);
26
26
  }
27
27
  get customInvalid() {
28
28
  return this.customError;
@@ -78,15 +78,14 @@ const u = class u extends m {
78
78
  render() {
79
79
  var t, s;
80
80
  return p`
81
- <div id="root">
81
+ <div id="field">
82
82
  <label>
83
83
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
84
- <slot>${this.label}</slot> ${this.required ? c(this.requiredLabel) : null}
84
+ ${this.label} ${this.required ? c(this.requiredLabel) : null}
85
85
  </div>
86
86
  <div id="input">
87
87
  <textarea
88
88
  ?disabled=${this.disabled}
89
- ?readonly=${this.readonly}
90
89
  ?required=${this.required}
91
90
  .value=${this.value}
92
91
  @input=${this._handleInput}
@@ -94,24 +93,22 @@ const u = class u extends m {
94
93
  aria-errormessage=${n((s = this.hint) != null && s.trim() ? "hint" : v)}
95
94
  aria-invalid=${!!this.invalid}
96
95
  cols=${n(this.cols)}
96
+ name=${n(this.name)}
97
97
  maxlength=${n(this.maxLength)}
98
98
  minlength=${n(this.minLength)}
99
- name=${n(this.name)}
100
99
  placeholder=${n(this.placeholder)}
100
+ ?readonly=${this.readonly}
101
101
  rows=${n(this.rows)}
102
102
  >
103
103
  </textarea>
104
104
  </div>
105
105
  </label>
106
- ${this.hint && p`
107
- <skf-hint
108
- aria-live=${this.invalid ? "assertive" : "polite"}
109
- id="hint"
110
- severity=${n(_(this.severity, this.invalid))}
111
- >
112
- ${this.customInvalid ? this.customInvalid : this.hint}
113
- </skf-hint>
114
- `}
106
+ ${this.hint && p`<skf-hint
107
+ aria-live=${this.invalid ? "assertive" : "polite"}
108
+ id="hint"
109
+ severity=${n(_(this.severity, this.invalid))}
110
+ >${this.hint}</skf-hint
111
+ >`}
115
112
  </div>
116
113
  `;
117
114
  }