@skf-design-system/ui-components 1.0.0-alpha.40 → 1.0.0-alpha.42

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.
@@ -1,8 +1,8 @@
1
- var P = (o) => {
2
- throw TypeError(o);
1
+ var F = (l) => {
2
+ throw TypeError(l);
3
3
  };
4
- var S = (o, l, e) => l.has(o) || P("Cannot " + e);
5
- var k = (o, l, e) => (S(o, l, "read from private field"), e ? e.call(o) : l.get(o)), E = (o, l, e) => l.has(o) ? P("Cannot add the same private member more than once") : l instanceof WeakSet ? l.add(o) : l.set(o, e), C = (o, l, e, t) => (S(o, l, "write to private field"), t ? t.call(o, e) : l.set(o, e), e);
4
+ var S = (l, d, e) => d.has(l) || F("Cannot " + e);
5
+ var k = (l, d, e) => (S(l, d, "read from private field"), e ? e.call(l) : d.get(l)), E = (l, d, e) => d.has(l) ? F("Cannot add the same private member more than once") : d instanceof WeakSet ? d.add(l) : d.set(l, e), C = (l, d, e, t) => (S(l, d, "write to private field"), t ? t.call(l, e) : d.set(l, e), e);
6
6
  import "../icon/icon.js";
7
7
  import { computePosition as T, flip as B, offset as x } from "@floating-ui/dom";
8
8
  import { FormBase as R } from "../../internal/components/formBase.js";
@@ -15,30 +15,32 @@ import { Temporal as I } from "@js-temporal/polyfill";
15
15
  import { componentStyles as q } from "../../styles/component.styles.js";
16
16
  import { LocalizeController as U } from "../../utilities/localize.js";
17
17
  import { nothing as f, html as b } from "lit";
18
- import { property as d, state as D, query as $, queryAssignedNodes as N } from "lit/decorators.js";
18
+ import { property as o, state as D, query as $, queryAssignedNodes as N } from "lit/decorators.js";
19
19
  import { ifDefined as u } from "lit/directives/if-defined.js";
20
20
  import { live as O } from "lit/directives/live.js";
21
21
  import "./datepicker-popup.js";
22
22
  import { dateFormatter as v, is as m, isPopoverOpen as Y, debounce as z } from "./datepicker.helpers.js";
23
23
  import { styles as W } from "./datepicker.styles.js";
24
- var H = Object.defineProperty, K = Object.getOwnPropertyDescriptor, r = (o, l, e, t) => {
25
- for (var i = t > 1 ? void 0 : t ? K(l, e) : l, h = o.length - 1, p; h >= 0; h--)
26
- (p = o[h]) && (i = (t ? p(l, e, i) : p(i)) || i);
27
- return t && i && H(l, e, i), i;
24
+ var H = Object.defineProperty, K = Object.getOwnPropertyDescriptor, r = (l, d, e, t) => {
25
+ for (var i = t > 1 ? void 0 : t ? K(d, e) : d, h = l.length - 1, p; h >= 0; h--)
26
+ (p = l[h]) && (i = (t ? p(d, e, i) : p(i)) || i);
27
+ return t && i && H(d, e, i), i;
28
28
  }, g;
29
29
  const w = class w extends R {
30
30
  constructor() {
31
31
  super();
32
32
  E(this, g);
33
- C(this, g, new U(this)), this.popoverController = new A(this), this.id = "skf-datepicker-input", this.lang = "en", this.placeholder = "YYYY-MM-DD", this.range = !1, this.size = "md", this.validateOn = "change", this.invalid = !1, this.selectedRangeDates = { start: null, end: null }, this.showClearbutton = !1, this.abortController = new AbortController(), this.abortSignal = this.abortController.signal, this._handleSelectedDate = () => {
33
+ C(this, g, new U(this)), this.popoverController = new A(this), this.id = "skf-datepicker-input", this.lang = "en", this.placeholder = "YYYY-MM-DD", this.placeholderEnd = "", this.range = !1, this.size = "md", this.validateOn = "change", this.invalid = !1, this.selectedRangeDates = { start: null, end: null }, this.showClearbutton = !1, this.abortController = new AbortController(), this.abortSignal = this.abortController.signal, this._handleSelectedDate = () => {
34
34
  this.pristine = !1, this._internals.setFormValue(this.value ?? ""), this.validateInput();
35
35
  }, this._handleDateSelected = (e) => {
36
36
  if (this.range && "start" in e.detail.date && "end" in e.detail.date) {
37
37
  const t = e.detail.date.start, i = e.detail.date.end;
38
- this.value = `${v(t)},${v(i)}`, this.selectedRangeDates = { start: t, end: i };
39
- } else !this.range && e.detail.date instanceof Date && (this.value = v(e.detail.date), this._animatePopover({ el: this.$popover, show: !1 }).then(() => {
38
+ this.value = `${v(t)},${v(i)}`, this.selectedRangeDates = { start: t, end: i }, t && i && this._handleDatepickerClose();
39
+ } else !this.range && e.detail.date instanceof Date && (this.value = v(e.detail.date), this._handleDatepickerClose());
40
+ }, this._handleDatepickerClose = () => {
41
+ this._animatePopover({ el: this.$popover, show: !1 }).then(() => {
40
42
  this.$popover.hidePopover();
41
- }));
43
+ });
42
44
  }, this._handleKeyboardEvents = (e) => {
43
45
  const t = e.target.closest("input");
44
46
  if (t) {
@@ -47,14 +49,17 @@ const w = class w extends R {
47
49
  t.value = p.join("");
48
50
  }
49
51
  if (t.name.endsWith("-end") && (e.key === "Backspace" && t.value.length === 0 || t.selectionStart === 0 && e.key === "ArrowLeft") && (e.preventDefault(), this.$input.focus()), e.key === "Tab" && !e.shiftKey && t.name.endsWith("-end") && (e.preventDefault(), this.$popover.childNodes[1].shadowRoot?.querySelector("skf-datepicker-calendar")?.shadowRoot?.querySelector("button")?.focus()), (t.value.length === 4 || t.value.length === 7) && /[[0-9]/.test(e.key) && (t.value = `${t.value}-${e.key}`, e.preventDefault()), e.key === "Escape")
50
- if (t.blur(), this.$popover.hidePopover(), this.range) {
52
+ if (e.stopPropagation(), t.blur(), this.$popover.hidePopover(), this.range) {
51
53
  const i = this.$input.value, h = this.$input_range_end.value;
52
54
  if (!m(i, h).date()) return;
53
55
  this.$datepickerPopup.selectedDateRange = {
54
56
  start: new Date(i),
55
57
  end: new Date(h)
56
- }, this.$datepickerPopup.emit("skf-datepicker-selected-date-changed", {
57
- detail: { date: new Date(i) }
58
+ }, this.$datepickerPopup.emit("skf-datepicker-selected-date-range-changed", {
59
+ detail: {
60
+ ...this.$datepickerPopup.selectedDateRange,
61
+ id: this.id
62
+ }
58
63
  });
59
64
  } else {
60
65
  if (!t.value || !m(t.value).date()) return;
@@ -323,7 +328,7 @@ const w = class w extends R {
323
328
  inputmode=${u(this.inputMode)}
324
329
  maxlength="10"
325
330
  name=${(this.name ?? "calendar") + "-end"}
326
- placeholder=${u(this.placeholder)}
331
+ placeholder=${this.placeholderEnd || this.placeholder}
327
332
  type="text"
328
333
  />
329
334
  ` : f}
@@ -370,61 +375,64 @@ const w = class w extends R {
370
375
  g = new WeakMap(), w.styles = [q, W];
371
376
  let s = w;
372
377
  r([
373
- d({ attribute: "custom-invalid", reflect: !0 })
378
+ o({ attribute: "custom-invalid", reflect: !0 })
374
379
  ], s.prototype, "customInvalid", 1);
375
380
  r([
376
- d({ type: String })
381
+ o({ type: String })
377
382
  ], s.prototype, "id", 2);
378
383
  r([
379
- d()
384
+ o()
380
385
  ], s.prototype, "label", 2);
381
386
  r([
382
- d({ type: String })
387
+ o({ type: String })
383
388
  ], s.prototype, "lang", 2);
384
389
  r([
385
- d({ type: Boolean, attribute: "hide-label" })
390
+ o({ type: Boolean, attribute: "hide-label" })
386
391
  ], s.prototype, "hideLabel", 2);
387
392
  r([
388
- d()
393
+ o()
389
394
  ], s.prototype, "hint", 2);
390
395
  r([
391
- d({ attribute: "invalid-dates" })
396
+ o({ attribute: "invalid-dates" })
392
397
  ], s.prototype, "invalidDates", 2);
393
398
  r([
394
- d({ reflect: !0 })
399
+ o({ reflect: !0 })
395
400
  ], s.prototype, "name", 2);
396
401
  r([
397
- d()
402
+ o()
398
403
  ], s.prototype, "placeholder", 2);
399
404
  r([
400
- d({ type: Boolean })
405
+ o({ attribute: "placeholder-end" })
406
+ ], s.prototype, "placeholderEnd", 2);
407
+ r([
408
+ o({ type: Boolean })
401
409
  ], s.prototype, "range", 2);
402
410
  r([
403
- d({ type: Boolean })
411
+ o({ type: Boolean })
404
412
  ], s.prototype, "readonly", 2);
405
413
  r([
406
- d({ attribute: "selectable-from" })
414
+ o({ attribute: "selectable-from" })
407
415
  ], s.prototype, "selectableFrom", 2);
408
416
  r([
409
- d({ attribute: "selectable-to" })
417
+ o({ attribute: "selectable-to" })
410
418
  ], s.prototype, "selectableTo", 2);
411
419
  r([
412
- d({ reflect: !0 })
420
+ o({ reflect: !0 })
413
421
  ], s.prototype, "severity", 2);
414
422
  r([
415
- d({ reflect: !0 })
423
+ o({ reflect: !0 })
416
424
  ], s.prototype, "size", 2);
417
425
  r([
418
- d({ type: String, attribute: "validate-on" })
426
+ o({ type: String, attribute: "validate-on" })
419
427
  ], s.prototype, "validateOn", 2);
420
428
  r([
421
- d()
429
+ o()
422
430
  ], s.prototype, "value", 2);
423
431
  r([
424
432
  D()
425
433
  ], s.prototype, "_init_date", 2);
426
434
  r([
427
- d({ type: Boolean, reflect: !0 })
435
+ o({ type: Boolean, reflect: !0 })
428
436
  ], s.prototype, "invalid", 2);
429
437
  r([
430
438
  D()
@@ -101,8 +101,6 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
101
101
  _invalidChanged(): void;
102
102
  _valueChanged(): void;
103
103
  _hintChanged(): void;
104
- /** @internal Used to check maxLength on input and paste functions */
105
- _validateMaxLength: () => void;
106
104
  /** @internal */
107
105
  _handleInput: () => void;
108
106
  /** @internal */
@@ -2,38 +2,35 @@ var $ = (r) => {
2
2
  throw TypeError(r);
3
3
  };
4
4
  var w = (r, n, t) => n.has(r) || $("Cannot " + t);
5
- var d = (r, n, t) => (w(r, n, "read from private field"), t ? t.call(r) : n.get(r)), g = (r, n, t) => n.has(r) ? $("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, t), y = (r, n, t, a) => (w(r, n, "write to private field"), a ? a.call(r, t) : n.set(r, t), t);
5
+ var d = (r, n, t) => (w(r, n, "read from private field"), t ? t.call(r) : n.get(r)), b = (r, n, t) => n.has(r) ? $("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, t), v = (r, n, t, a) => (w(r, n, "write to private field"), a ? a.call(r, t) : n.set(r, t), t);
6
6
  import "../icon/icon.js";
7
7
  import { FormBase as E } from "../../internal/components/formBase.js";
8
8
  import "../../internal/components/hint/hint.js";
9
9
  import { hintSeverity as S } from "../../internal/helpers/hintSeverity.js";
10
- import { watch as b } from "../../internal/helpers/watch.js";
10
+ import { watch as _ } from "../../internal/helpers/watch.js";
11
11
  import { Asterisk as C } from "../../internal/templates/asterisk.js";
12
- import { componentStyles as x } from "../../styles/component.styles.js";
13
- import { LocalizeController as P } from "../../utilities/localize.js";
14
- import { html as m, nothing as c } from "lit";
15
- import { property as s, state as L, query as k, queryAssignedNodes as B } from "lit/decorators.js";
12
+ import { componentStyles as P } from "../../styles/component.styles.js";
13
+ import { LocalizeController as k } from "../../utilities/localize.js";
14
+ import { html as c, nothing as m } from "lit";
15
+ import { property as s, state as B, query as x, queryAssignedNodes as V } from "lit/decorators.js";
16
16
  import { ifDefined as l } from "lit/directives/if-defined.js";
17
- import { live as V } from "lit/directives/live.js";
18
- import { InputNumberController as I, InputPasswordController as D } from "./input.controllers.js";
17
+ import { live as L } from "lit/directives/live.js";
18
+ import { InputNumberController as D, InputPasswordController as I } from "./input.controllers.js";
19
19
  import A from "./input.styles.js";
20
- var M = Object.defineProperty, N = Object.getOwnPropertyDescriptor, e = (r, n, t, a) => {
21
- for (var o = a > 1 ? void 0 : a ? N(n, t) : n, h = r.length - 1, p; h >= 0; h--)
20
+ var N = Object.defineProperty, O = Object.getOwnPropertyDescriptor, e = (r, n, t, a) => {
21
+ for (var o = a > 1 ? void 0 : a ? O(n, t) : n, h = r.length - 1, p; h >= 0; h--)
22
22
  (p = r[h]) && (o = (a ? p(n, t, o) : p(o)) || o);
23
- return a && o && M(n, t, o), o;
24
- }, u, f, v;
25
- const _ = class _ extends E {
23
+ return a && o && N(n, t, o), o;
24
+ }, u, f, y;
25
+ const g = class g extends E {
26
26
  constructor() {
27
27
  super(...arguments);
28
- g(this, u);
28
+ b(this, u);
29
29
  /** @internal intermediary value for reset to function, e.g value attribute act as default value */
30
- g(this, f);
30
+ b(this, f);
31
31
  /** @internal */
32
- g(this, v);
33
- y(this, u, new P(this)), this.autofocus = !1, this.debug = !1, this.hideLabel = !1, this.invalid = !1, this.inputmode = "text", this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.value = "", this._buttonDown = !1, this._numberController = new I(this), this._passwordController = new D(this), this._validateMaxLength = () => {
34
- if (!this.maxLength) return;
35
- this.value.length > this.maxLength && (this.value = this.value.slice(0, this.maxLength));
36
- }, this._handleInput = () => {
32
+ b(this, y);
33
+ v(this, u, new k(this)), this.autofocus = !1, this.debug = !1, this.hideLabel = !1, this.invalid = !1, this.inputmode = "text", this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.value = "", this._buttonDown = !1, this._numberController = new D(this), this._passwordController = new I(this), this._handleInput = () => {
37
34
  this.value = this.$input?.value ?? "", this.validateOn === "input" && (this._pristine = !1, this.validateInput());
38
35
  }, this._resetValue = (t) => {
39
36
  t.stopPropagation(), this.value = d(this, f) ?? "", this._internals.setFormValue(this.value), this.emit("skf-input-cleared");
@@ -41,7 +38,7 @@ const _ = class _ extends E {
41
38
  this._buttonDown = !0, this.type === "number" && this._numberController.handleActionBtnLongPressStart(t);
42
39
  }, this._handlePressEnd = () => {
43
40
  this._buttonDown = !1, this.type === "number" && this._numberController.handleActionBtnLongPressEnd();
44
- }, this._renderNumberButton = (t) => m`
41
+ }, this._renderNumberButton = (t) => c`
45
42
  <button
46
43
  ?disabled=${this.disabled}
47
44
  @click=${(a) => {
@@ -56,7 +53,7 @@ const _ = class _ extends E {
56
53
  >
57
54
  <skf-icon name="${t === "inc" ? "chevronUp" : "chevronDown"}" size="sm"></skf-icon>
58
55
  </button>
59
- `, this._renderPasswordButton = () => m`
56
+ `, this._renderPasswordButton = () => c`
60
57
  <button
61
58
  @click=${this._passwordController.toggleVisibility}
62
59
  aria-label=${this._passwordController._type === "password" ? d(this, u).term("showPassword") : d(this, u).term("hidePassword")}
@@ -68,7 +65,7 @@ const _ = class _ extends E {
68
65
  >
69
66
  <skf-icon name=${this._passwordController._icon} size="sm"></skf-icon>
70
67
  </button>
71
- `, this._renderSearchButton = () => m`
68
+ `, this._renderSearchButton = () => c`
72
69
  <button
73
70
  @click=${this._resetValue}
74
71
  @mousedown=${this._handlePressStart}
@@ -91,7 +88,7 @@ const _ = class _ extends E {
91
88
  return this.customError;
92
89
  }
93
90
  firstUpdated() {
94
- this._validateMaxLength(), this.$input?.addEventListener("change", () => {
91
+ this.$input?.addEventListener("change", () => {
95
92
  this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input?.value ?? ""), this.emit("change"), this.validateInput();
96
93
  }), this.addEventListener("invalid", (t) => {
97
94
  this._pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
@@ -104,7 +101,7 @@ const _ = class _ extends E {
104
101
  this._pristine = !1, this._internals.setValidity({ customError: !0 }, p), this.invalid = !0, this.hint = p, this.checkValidity();
105
102
  } else
106
103
  this._internals.setValidity({}), this.validateInput();
107
- t === "hint" && y(this, v, this.getAttribute("hint") ?? "");
104
+ t === "hint" && v(this, y, this.getAttribute("hint") ?? "");
108
105
  }
109
106
  _invalidChanged() {
110
107
  if (this.invalid) {
@@ -112,13 +109,13 @@ const _ = class _ extends E {
112
109
  const t = this._internals.validationMessage;
113
110
  this.hint = t !== "" ? this._internals.validationMessage : "", this.checkValidity();
114
111
  } else
115
- !this._pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = d(this, v) ?? "";
112
+ !this._pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = d(this, y) ?? "";
116
113
  }
117
114
  _valueChanged() {
118
- this._validateMaxLength(), d(this, f) ?? y(this, f, this.value), this._internals.setFormValue(this.value), this.validateInput();
115
+ d(this, f) ?? v(this, f, this.value), this._internals.setFormValue(this.value), this.validateInput();
119
116
  }
120
117
  _hintChanged() {
121
- d(this, v) ?? y(this, v, this.hint);
118
+ d(this, y) ?? v(this, y, this.hint);
122
119
  }
123
120
  focus() {
124
121
  this.$input?.focus();
@@ -155,15 +152,15 @@ const _ = class _ extends E {
155
152
  }
156
153
  render() {
157
154
  const t = (this._defaultSlot.length === 0 || !this._defaultSlot[0]?.textContent?.trim()) && !this.label;
158
- return m`
155
+ return c`
159
156
  <div id="root">
160
157
  <label>
161
158
  <div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${t} id="label">
162
159
  <slot>${this.label}</slot>
163
- ${this.required ? C(d(this, u).term("required")) : c}
160
+ ${this.required ? C(d(this, u).term("required")) : m}
164
161
  </div>
165
162
  <div id="input">
166
- ${this.type === "search" ? m`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : c}
163
+ ${this.type === "search" ? c`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : m}
167
164
  <div
168
165
  data-leading=${l(this.leading)}
169
166
  data-trailing=${l(this.trailing)}
@@ -174,11 +171,11 @@ const _ = class _ extends E {
174
171
  ?readonly=${this.readonly}
175
172
  ?required=${this.required}
176
173
  .autocomplete=${this.autocomplete ?? "off"}
177
- .value=${V(this.value)}
174
+ .value=${L(this.value)}
178
175
  @blur=${this._onBlur}
179
176
  @input=${this._handleInput}
180
- aria-describedby=${l(this.hint?.trim() ? "hint" : c)}
181
- aria-errormessage=${l(this.hint?.trim() ? "hint" : c)}
177
+ aria-describedby=${l(this.hint?.trim() ? "hint" : m)}
178
+ aria-errormessage=${l(this.hint?.trim() ? "hint" : m)}
182
179
  aria-invalid=${!!this.invalid}
183
180
  data-testid="field-input"
184
181
  inputmode=${l(this.inputMode)}
@@ -194,16 +191,16 @@ const _ = class _ extends E {
194
191
  )}
195
192
  />
196
193
  </div>
197
- ${this.type === "number" ? m`
194
+ ${this.type === "number" ? c`
198
195
  <div id="action">
199
196
  ${this._renderNumberButton("inc")} ${this._renderNumberButton("dec")}
200
197
  </div>
201
- ` : c}
202
- ${this.type === "password" ? this._renderPasswordButton() : c}
203
- ${this.type === "search" && this.value.length > 0 ? this._renderSearchButton() : c}
198
+ ` : m}
199
+ ${this.type === "password" ? this._renderPasswordButton() : m}
200
+ ${this.type === "search" && this.value.length > 0 ? this._renderSearchButton() : m}
204
201
  </div>
205
202
  </label>
206
- ${this.hint && m`
203
+ ${this.hint && c`
207
204
  <skf-hint
208
205
  ?disabled=${this.disabled}
209
206
  aria-live=${this.invalid ? "assertive" : "polite"}
@@ -216,8 +213,8 @@ const _ = class _ extends E {
216
213
  `;
217
214
  }
218
215
  };
219
- u = new WeakMap(), f = new WeakMap(), v = new WeakMap(), _.styles = [x, A];
220
- let i = _;
216
+ u = new WeakMap(), f = new WeakMap(), y = new WeakMap(), g.styles = [P, A];
217
+ let i = g;
221
218
  e([
222
219
  s()
223
220
  ], i.prototype, "autocomplete", 2);
@@ -297,22 +294,22 @@ e([
297
294
  s({ type: String, reflect: !1 })
298
295
  ], i.prototype, "value", 2);
299
296
  e([
300
- L()
297
+ B()
301
298
  ], i.prototype, "_buttonDown", 2);
302
299
  e([
303
- k("input")
300
+ x("input")
304
301
  ], i.prototype, "$input", 2);
305
302
  e([
306
- B({ flatten: !0 })
303
+ V({ flatten: !0 })
307
304
  ], i.prototype, "_defaultSlot", 2);
308
305
  e([
309
- b("invalid")
306
+ _("invalid")
310
307
  ], i.prototype, "_invalidChanged", 1);
311
308
  e([
312
- b("value", { waitUntilFirstUpdate: !0 })
309
+ _("value", { waitUntilFirstUpdate: !0 })
313
310
  ], i.prototype, "_valueChanged", 1);
314
311
  e([
315
- b("hint")
312
+ _("hint")
316
313
  ], i.prototype, "_hintChanged", 1);
317
314
  export {
318
315
  i as SkfInput
@@ -35,7 +35,7 @@ class p {
35
35
  e.preventDefault(), this._selectFocusedOption(e.target);
36
36
  break;
37
37
  case "Escape":
38
- e.preventDefault(), this.host && (this.host._expanded = !1), setTimeout(() => {
38
+ e.stopPropagation(), e.preventDefault(), this.host && (this.host._expanded = !1), setTimeout(() => {
39
39
  this.host.focus();
40
40
  });
41
41
  break;
@@ -50,6 +50,8 @@ export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
50
50
  /** @internal */
51
51
  private _handleChange;
52
52
  /** @internal */
53
+ _handleCheckedChange(): void;
54
+ /** @internal */
53
55
  private _handleInvalid;
54
56
  /** @internal */
55
57
  private _resetValue;
@@ -1,27 +1,28 @@
1
- var p = (t) => {
1
+ var u = (t) => {
2
2
  throw TypeError(t);
3
3
  };
4
- var c = (t, i, e) => i.has(t) || p("Cannot " + e);
5
- var v = (t, i, e) => (c(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ? p("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), m = (t, i, e, n) => (c(t, i, "write to private field"), n ? n.call(t, e) : i.set(t, e), e);
4
+ var c = (t, i, e) => i.has(t) || u("Cannot " + e);
5
+ var v = (t, i, e) => (c(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ? u("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), m = (t, i, e, h) => (c(t, i, "write to private field"), h ? h.call(t, e) : i.set(t, e), e);
6
6
  import { FormBase as _ } from "../../internal/components/formBase.js";
7
- import { Asterisk as y } from "../../internal/templates/asterisk.js";
8
- import { componentStyles as b } from "../../styles/component.styles.js";
9
- import { LocalizeController as g } from "../../utilities/localize.js";
10
- import { nothing as k, html as $ } from "lit";
11
- import { property as l, state as C, query as V } from "lit/decorators.js";
12
- import { classMap as w } from "lit/directives/class-map.js";
13
- import { ifDefined as q } from "lit/directives/if-defined.js";
14
- import { styles as z } from "./switch.styles.js";
15
- var A = Object.defineProperty, a = (t, i, e, n) => {
16
- for (var h = void 0, d = t.length - 1, u; d >= 0; d--)
17
- (u = t[d]) && (h = u(i, e, h) || h);
18
- return h && A(i, e, h), h;
19
- }, r;
20
- const o = class o extends _ {
7
+ import { watch as y } from "../../internal/helpers/watch.js";
8
+ import { Asterisk as b } from "../../internal/templates/asterisk.js";
9
+ import { componentStyles as g } from "../../styles/component.styles.js";
10
+ import { LocalizeController as k } from "../../utilities/localize.js";
11
+ import { nothing as $, html as C } from "lit";
12
+ import { property as l, state as w, query as V } from "lit/decorators.js";
13
+ import { classMap as q } from "lit/directives/class-map.js";
14
+ import { ifDefined as I } from "lit/directives/if-defined.js";
15
+ import { styles as O } from "./switch.styles.js";
16
+ var P = Object.defineProperty, z = Object.getOwnPropertyDescriptor, a = (t, i, e, h) => {
17
+ for (var r = h > 1 ? void 0 : h ? z(i, e) : i, d = t.length - 1, o; d >= 0; d--)
18
+ (o = t[d]) && (r = (h ? o(i, e, r) : o(r)) || r);
19
+ return h && r && P(i, e, r), r;
20
+ }, n;
21
+ const p = class p extends _ {
21
22
  constructor() {
22
23
  super(...arguments);
23
- f(this, r);
24
- m(this, r, new g(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.lang = "en", this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
24
+ f(this, n);
25
+ m(this, n, new k(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.lang = "en", this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
25
26
  e.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.emit("change");
26
27
  }, this._handleInvalid = (e) => {
27
28
  this.pristine = !1, this._invalid = !0, this.customErrorDisplay && e.preventDefault();
@@ -56,10 +57,13 @@ const o = class o extends _ {
56
57
  } else
57
58
  this.setValidity({});
58
59
  }
60
+ _handleCheckedChange() {
61
+ this.setFormValue(this.checked ? this.value : null), this._validateInput(), this.$input && (this.$input.checked = this.checked);
62
+ }
59
63
  render() {
60
- return $`
64
+ return C`
61
65
  <label
62
- class=${w({
66
+ class=${q({
63
67
  switch: !0,
64
68
  "switch--small": this.size === "sm"
65
69
  })}
@@ -73,50 +77,53 @@ const o = class o extends _ {
73
77
  @reset=${this._resetValue}
74
78
  aria-invalid=${!!this._invalid}
75
79
  class="switch__input"
76
- name=${q(this.name)}
80
+ name=${I(this.name)}
77
81
  type="checkbox"
78
82
  value=${this.value}
79
83
  />
80
- <div class="switch__label ${this.hideLabel ? "visually-hidden" : k}">
84
+ <div class="switch__label ${this.hideLabel ? "visually-hidden" : $}">
81
85
  <slot>${this.label}</slot>
82
- ${this.required ? y(v(this, r).term("required"), "switch__asterisk") : null}
86
+ ${this.required ? b(v(this, n).term("required"), "switch__asterisk") : null}
83
87
  </div>
84
88
  </label>
85
89
  `;
86
90
  }
87
91
  };
88
- r = new WeakMap(), o.styles = [b, z];
89
- let s = o;
92
+ n = new WeakMap(), p.styles = [g, O];
93
+ let s = p;
90
94
  a([
91
95
  l({ type: Boolean })
92
- ], s.prototype, "debug");
96
+ ], s.prototype, "debug", 2);
93
97
  a([
94
98
  l({ type: Boolean, reflect: !0 })
95
- ], s.prototype, "checked");
99
+ ], s.prototype, "checked", 2);
96
100
  a([
97
101
  l({ type: Boolean, attribute: "hide-label", reflect: !0 })
98
- ], s.prototype, "hideLabel");
102
+ ], s.prototype, "hideLabel", 2);
99
103
  a([
100
104
  l()
101
- ], s.prototype, "label");
105
+ ], s.prototype, "label", 2);
102
106
  a([
103
107
  l({ type: String })
104
- ], s.prototype, "lang");
108
+ ], s.prototype, "lang", 2);
105
109
  a([
106
110
  l()
107
- ], s.prototype, "name");
111
+ ], s.prototype, "name", 2);
108
112
  a([
109
113
  l({ reflect: !0 })
110
- ], s.prototype, "size");
114
+ ], s.prototype, "size", 2);
111
115
  a([
112
116
  l()
113
- ], s.prototype, "value");
117
+ ], s.prototype, "value", 2);
114
118
  a([
115
- C()
116
- ], s.prototype, "_invalid");
119
+ w()
120
+ ], s.prototype, "_invalid", 2);
117
121
  a([
118
122
  V("input")
119
- ], s.prototype, "$input");
123
+ ], s.prototype, "$input", 2);
124
+ a([
125
+ y("checked")
126
+ ], s.prototype, "_handleCheckedChange", 1);
120
127
  export {
121
128
  s as SkfSwitch
122
129
  };
@@ -12,13 +12,13 @@ const e = class e extends t {
12
12
  s.addEventListener(
13
13
  "blur",
14
14
  () => {
15
- this.close("blur");
15
+ this.close();
16
16
  },
17
17
  { signal: this._signal }
18
18
  ), s.addEventListener("focus", this.open, { signal: this._signal }), s.addEventListener("mouseenter", this.open, { signal: this._signal }), s.addEventListener(
19
19
  "mouseleave",
20
20
  () => {
21
- this.close("mouseleave");
21
+ this.close();
22
22
  },
23
23
  { signal: this._signal }
24
24
  );
@@ -2181,6 +2181,16 @@
2181
2181
  "default": "'YYYY-MM-DD'",
2182
2182
  "attribute": "placeholder"
2183
2183
  },
2184
+ {
2185
+ "kind": "field",
2186
+ "name": "placeholderEnd",
2187
+ "type": {
2188
+ "text": "string"
2189
+ },
2190
+ "default": "''",
2191
+ "description": "Placeholder for the end date input in range mode",
2192
+ "attribute": "placeholder-end"
2193
+ },
2184
2194
  {
2185
2195
  "kind": "field",
2186
2196
  "name": "range",
@@ -2409,6 +2419,15 @@
2409
2419
  "default": "'YYYY-MM-DD'",
2410
2420
  "fieldName": "placeholder"
2411
2421
  },
2422
+ {
2423
+ "name": "placeholder-end",
2424
+ "type": {
2425
+ "text": "string"
2426
+ },
2427
+ "default": "''",
2428
+ "description": "Placeholder for the end date input in range mode",
2429
+ "fieldName": "placeholderEnd"
2430
+ },
2412
2431
  {
2413
2432
  "name": "range",
2414
2433
  "type": {
@@ -53,7 +53,7 @@ export declare class SkfPopoverBase extends SkfElement {
53
53
  reposition: () => Promise<void>;
54
54
  handleEscapeKey: (e: KeyboardEvent) => void;
55
55
  open: (e: Event) => void;
56
- close: (reason?: string) => void;
56
+ close: () => void;
57
57
  /** @internal eventlisteners here should implement abort signal */
58
58
  addEventListeners($element: HTMLElement | Element): void;
59
59
  /** @internal */