@skf-design-system/ui-components 1.0.2-beta.11 → 1.0.2-beta.13

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,6 +1,5 @@
1
1
  import { SkfElement } from '../../internal/components/skf-element.js';
2
2
  import { Temporal } from '@js-temporal/polyfill';
3
- import { type Language } from '../../utilities/localize.js';
4
3
  import { type CSSResultGroup } from 'lit';
5
4
  interface DateParts {
6
5
  year?: number;
@@ -23,8 +22,6 @@ export declare class SkfDatepickerCalendar extends SkfElement {
23
22
  * A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.
24
23
  */
25
24
  invalidDates?: string;
26
- /** Sets the internal language of the component */
27
- lang: Language;
28
25
  locale: string;
29
26
  range: boolean;
30
27
  /**
@@ -5,11 +5,11 @@ var w = (n, r, t) => r.has(n) || _("Cannot " + t);
5
5
  var f = (n, r, t) => (w(n, r, "read from private field"), t ? t.call(n) : r.get(n)), S = (n, r, t) => r.has(n) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(n) : r.set(n, t), $ = (n, r, t, e) => (w(n, r, "write to private field"), e ? e.call(n, t) : r.set(n, t), t);
6
6
  import { SkfElement as L } from "../../internal/components/skf-element.js";
7
7
  import { watch as O } from "../../internal/helpers/watch.js";
8
- import { Temporal as c } from "@js-temporal/polyfill";
8
+ import { Temporal as h } from "@js-temporal/polyfill";
9
9
  import { componentStyles as x } from "../../styles/component.styles.js";
10
10
  import { LocalizeController as R } from "../../utilities/localize.js";
11
11
  import { html as g } from "lit";
12
- import { property as d, state as M } from "lit/decorators.js";
12
+ import { property as c, state as M } from "lit/decorators.js";
13
13
  import { repeat as y } from "lit/directives/repeat.js";
14
14
  import { styles as C } from "./datepicker-calendar.styles.js";
15
15
  import { compareDates as E } from "./datepicker-popup.helpers.js";
@@ -23,7 +23,7 @@ const b = class b extends L {
23
23
  constructor() {
24
24
  super(...arguments);
25
25
  S(this, u);
26
- $(this, u, new R(this)), this._secondCalendarOffset = 0, this.date = /* @__PURE__ */ new Date(), this.firstDayOfWeek = 0, this.lang = "en", this.locale = "en-CA", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
26
+ $(this, u, new R(this)), this._secondCalendarOffset = 0, this.date = /* @__PURE__ */ new Date(), this.firstDayOfWeek = 0, this.locale = "en-CA", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
27
27
  start: null,
28
28
  end: null
29
29
  }, this._numberOfDays = 0, this._numberOfDaysLastMonth = 0, this._listenToKeyboard = () => ({
@@ -36,14 +36,14 @@ const b = class b extends L {
36
36
  }), this._handleKeyDown = (t) => {
37
37
  const { key: e } = t;
38
38
  if ((e === "ArrowRight" || e === "ArrowLeft" || e === "ArrowDown" || e === "ArrowUp") && t.preventDefault(), e === "ArrowRight" && this.shadowRoot?.activeElement?.parentElement?.nextElementSibling?.firstElementChild?.focus(), e === "ArrowLeft" && this.shadowRoot?.activeElement?.parentElement?.previousElementSibling?.firstElementChild?.focus(), e === "ArrowDown") {
39
- const h = this.shadowRoot?.activeElement?.parentElement, m = a(h);
40
- h?.parentElement?.children[m + 7]?.firstElementChild?.focus();
39
+ const d = this.shadowRoot?.activeElement?.parentElement, m = a(d);
40
+ d?.parentElement?.children[m + 7]?.firstElementChild?.focus();
41
41
  }
42
42
  if (e === "ArrowUp") {
43
- const h = this.shadowRoot?.activeElement?.parentElement;
44
- if (!h) return;
45
- const m = Array.from(h.parentElement?.children ?? []).indexOf(h);
46
- h.parentElement?.children[m - 7]?.firstElementChild?.focus();
43
+ const d = this.shadowRoot?.activeElement?.parentElement;
44
+ if (!d) return;
45
+ const m = Array.from(d.parentElement?.children ?? []).indexOf(d);
46
+ d.parentElement?.children[m - 7]?.firstElementChild?.focus();
47
47
  }
48
48
  function a(s) {
49
49
  return s ? Array.from(s.parentElement?.children ?? []).indexOf(s) : 0;
@@ -76,7 +76,7 @@ const b = class b extends L {
76
76
  }
77
77
  if (s)
78
78
  try {
79
- return c.PlainDate.from({
79
+ return h.PlainDate.from({
80
80
  year: t,
81
81
  month: e + 1,
82
82
  day: a
@@ -96,7 +96,7 @@ const b = class b extends L {
96
96
  day: t.getDate()
97
97
  };
98
98
  try {
99
- return c.PlainDate.from(e);
99
+ return h.PlainDate.from(e);
100
100
  } catch (a) {
101
101
  return console.log(e), console.error("error", a), null;
102
102
  }
@@ -104,7 +104,7 @@ const b = class b extends L {
104
104
  /** @internal Check if a day is between two dates */
105
105
  _isDateBetween(t, e, a) {
106
106
  if (!e || !a) return !1;
107
- const s = c.PlainDate.compare(t, e) > 0, i = c.PlainDate.compare(t, a) < 0;
107
+ const s = h.PlainDate.compare(t, e) > 0, i = h.PlainDate.compare(t, a) < 0;
108
108
  return s && i;
109
109
  }
110
110
  render() {
@@ -117,7 +117,7 @@ const b = class b extends L {
117
117
  Array.from({ length: 7 }, (t, e) => e),
118
118
  (t) => t,
119
119
  (t) => g`<li>
120
- ${new Intl.DateTimeFormat(this.locale, {
120
+ ${new Intl.DateTimeFormat(this.lang, {
121
121
  weekday: "short"
122
122
  }).format(new Date(2018, 0, t)).slice(0, 2)}
123
123
  </li>`
@@ -171,10 +171,10 @@ const b = class b extends L {
171
171
  this._plainDate(this.selectedDateRange.start) ?? void 0,
172
172
  this._plainDate(this.selectedDateRange.end) ?? void 0
173
173
  ) && e.push("in-range"), this.range && this.selectedDateRange.start && (this.selectedDateRange.start.getFullYear() === this.date.getFullYear() && this.selectedDateRange.start.getMonth() === this.date.getMonth() && this.selectedDateRange.start.getDate() === a && e.push("selected selected-start"), this.selectedDateRange.end?.getFullYear() === this.date.getFullYear() && this.selectedDateRange.end.getMonth() === this.date.getMonth() && this.selectedDateRange.end.getDate() === a && e.push("selected selected-end"));
174
- const { matchesInvalidDates: h, dateWithinRange: m } = this.dateSelectable(
174
+ const { matchesInvalidDates: d, dateWithinRange: m } = this.dateSelectable(
175
175
  this._createDate({ day: t }, !0).toString()
176
176
  );
177
- (h || m) && e.push("invalid");
177
+ (d || m) && e.push("invalid");
178
178
  const p = this.selectedDate?.getDate() === a;
179
179
  return !this.range && p && s && i && (console.log("is single date selected", this.selectedDate), e.push("selected")), this._createDate({ day: t }, !0).equals(String(this._plainDate(/* @__PURE__ */ new Date()))) && e.push("today"), e.join(" ");
180
180
  }
@@ -219,7 +219,7 @@ const b = class b extends L {
219
219
  month: this.date.getMonth() - 1,
220
220
  day: t
221
221
  }), this.emit("skf-update-calendar-view", {
222
- detail: c.PlainDate.from(D(this.date)).subtract({ months: 1 }).toString()
222
+ detail: h.PlainDate.from(D(this.date)).subtract({ months: 1 }).toString()
223
223
  });
224
224
  }}"
225
225
  ?disabled=${e.includes("invalid")}
@@ -262,7 +262,7 @@ const b = class b extends L {
262
262
  month: this.date.getMonth() + 1,
263
263
  day: t + 1
264
264
  }), this.emit("skf-update-calendar-view", {
265
- detail: c.PlainDate.from(D(this.date)).add({ months: 1 }).toString()
265
+ detail: h.PlainDate.from(D(this.date)).add({ months: 1 }).toString()
266
266
  });
267
267
  }}"
268
268
  ?disabled=${e.includes("invalid")}
@@ -299,7 +299,7 @@ const b = class b extends L {
299
299
  title=${f(this, u).term("previousYear")}
300
300
  @click="${() => {
301
301
  this.emit("skf-update-calendar-view", {
302
- detail: c.PlainDate.from(D(this.date)).subtract({ years: 1 }).toString()
302
+ detail: h.PlainDate.from(D(this.date)).subtract({ years: 1 }).toString()
303
303
  });
304
304
  }}"
305
305
  >
@@ -309,7 +309,7 @@ const b = class b extends L {
309
309
  title=${f(this, u).term("previousMonth")}
310
310
  @click="${() => {
311
311
  this.emit("skf-update-calendar-view", {
312
- detail: c.PlainDate.from(D(this.date)).subtract({ months: 1 }).toString()
312
+ detail: h.PlainDate.from(D(this.date)).subtract({ months: 1 }).toString()
313
313
  });
314
314
  }}"
315
315
  >
@@ -317,7 +317,7 @@ const b = class b extends L {
317
317
  </button>
318
318
  </div>
319
319
  <h4>
320
- ${this.date.toLocaleString(this.locale, { month: "short" })}
320
+ ${this.date.toLocaleString(this.lang, { month: "short" })}
321
321
  ${this.range && this.classList.contains("start") ? g` -&nbsp;` : this.date.getFullYear()}
322
322
  </h4>
323
323
  <div
@@ -327,7 +327,7 @@ const b = class b extends L {
327
327
  title=${f(this, u).term("nextMonth")}
328
328
  @click="${() => {
329
329
  this.emit("skf-update-calendar-view", {
330
- detail: c.PlainDate.from(D(this.date)).add({ months: 1 + this._secondCalendarOffset }).toString()
330
+ detail: h.PlainDate.from(D(this.date)).add({ months: 1 + this._secondCalendarOffset }).toString()
331
331
  });
332
332
  }}"
333
333
  >
@@ -337,7 +337,7 @@ const b = class b extends L {
337
337
  title=${f(this, u).term("nextYear")}
338
338
  @click="${() => {
339
339
  this.emit("skf-update-calendar-view", {
340
- detail: c.PlainDate.from(D(this.date)).add({ months: 12 + this._secondCalendarOffset }).toString()
340
+ detail: h.PlainDate.from(D(this.date)).add({ months: 12 + this._secondCalendarOffset }).toString()
341
341
  });
342
342
  }}"
343
343
  >
@@ -350,7 +350,7 @@ const b = class b extends L {
350
350
  u = new WeakMap(), b.styles = [x, C];
351
351
  let o = b;
352
352
  l([
353
- d({
353
+ c({
354
354
  converter: {
355
355
  fromAttribute(n) {
356
356
  return console.log("value", typeof n), new Date(n);
@@ -362,38 +362,35 @@ l([
362
362
  })
363
363
  ], o.prototype, "date", 2);
364
364
  l([
365
- d()
365
+ c()
366
366
  ], o.prototype, "eventid", 2);
367
367
  l([
368
- d({ type: Number })
368
+ c({ type: Number })
369
369
  ], o.prototype, "firstDayOfWeek", 2);
370
370
  l([
371
- d({ reflect: !0, attribute: "invalid-dates" })
371
+ c({ reflect: !0, attribute: "invalid-dates" })
372
372
  ], o.prototype, "invalidDates", 2);
373
373
  l([
374
- d({ type: String })
375
- ], o.prototype, "lang", 2);
376
- l([
377
- d({ reflect: !0 })
374
+ c({ reflect: !0 })
378
375
  ], o.prototype, "locale", 2);
379
376
  l([
380
- d({ type: Boolean })
377
+ c({ type: Boolean })
381
378
  ], o.prototype, "range", 2);
382
379
  l([
383
- d({ attribute: "selectable-from" })
380
+ c({ attribute: "selectable-from" })
384
381
  ], o.prototype, "selectableFrom", 2);
385
382
  l([
386
- d({ attribute: "selectable-to" })
383
+ c({ attribute: "selectable-to" })
387
384
  ], o.prototype, "selectableTo", 2);
388
385
  l([
389
- d({
386
+ c({
390
387
  attribute: "selected-date",
391
388
  converter: { fromAttribute: (n) => new Date(n) },
392
389
  reflect: !0
393
390
  })
394
391
  ], o.prototype, "selectedDate", 2);
395
392
  l([
396
- d({ type: Object })
393
+ c({ type: Object })
397
394
  ], o.prototype, "selectedDateRange", 2);
398
395
  l([
399
396
  M()
@@ -11,19 +11,19 @@ import { LocalizeController as M } from "../../utilities/localize.js";
11
11
  import { html as m } from "lit";
12
12
  import { property as o, state as u } from "lit/decorators.js";
13
13
  import "./datepicker-calendar.js";
14
- import { getDateParts as f, assertISODate as O, earliestDate as V, latestDate as P, compareDates as g, doAnimate as C } from "./datepicker-popup.helpers.js";
14
+ import { getDateParts as f, assertISODate as O, earliestDate as V, latestDate as P, compareDates as D, doAnimate as C } from "./datepicker-popup.helpers.js";
15
15
  import { styles as L } from "./datepicker-popup.styles.js";
16
16
  import { dateFormatter as d, is as Y } from "./datepicker.helpers.js";
17
17
  var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (s, i, e, a) => {
18
18
  for (var t = a > 1 ? void 0 : a ? A(i, e) : i, r = s.length - 1, h; r >= 0; r--)
19
19
  (h = s[r]) && (t = (a ? h(i, e, t) : h(t)) || t);
20
20
  return a && t && x(i, e, t), t;
21
- }, D;
21
+ }, g;
22
22
  const _ = class _ extends E {
23
23
  constructor() {
24
24
  super(...arguments);
25
- S(this, D);
26
- $(this, D, new M(this)), this.locale = "en-CA", this.date = (/* @__PURE__ */ new Date()).toLocaleDateString(this.locale), this.id = "", this.lang = "en", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
25
+ S(this, g);
26
+ $(this, g, new M(this)), this.locale = "en-CA", this.date = (/* @__PURE__ */ new Date()).toLocaleDateString(this.locale), this.id = "", this.lang = "en", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
27
27
  start: null,
28
28
  end: null
29
29
  }, this._datePlusOneMonth = new Date(
@@ -157,6 +157,7 @@ const _ = class _ extends E {
157
157
  .invalidDates=${this.invalidDates}
158
158
  class="end"
159
159
  id=${`${this.id}-range-end`}
160
+ lang="${this.lang}"
160
161
  locale="${this.locale}"
161
162
  ></skf-datepicker-calendar>
162
163
  </div>
@@ -168,11 +169,11 @@ const _ = class _ extends E {
168
169
  /** @internal */
169
170
  _renderTodayBtn() {
170
171
  let e = !1;
171
- if (this.selectableTo && g(this.selectableTo, d(/* @__PURE__ */ new Date())) === -1)
172
+ if (this.selectableTo && D(this.selectableTo, d(/* @__PURE__ */ new Date())) === -1)
172
173
  return m``;
173
- if (this.selectableFrom && g(this.selectableFrom, d(/* @__PURE__ */ new Date())) === 1)
174
+ if (this.selectableFrom && D(this.selectableFrom, d(/* @__PURE__ */ new Date())) === 1)
174
175
  return m``;
175
- const { month: a, year: t } = f(), { month: r, year: h } = f(this.date), c = this.selectedDate ?? this.selectedDateRange.start, p = a === r && t === h, T = c && g(d(/* @__PURE__ */ new Date()), d(c), "months") === 0;
176
+ const { month: a, year: t } = f(), { month: r, year: h } = f(this.date), c = this.selectedDate ?? this.selectedDateRange.start, p = a === r && t === h, T = c && D(d(/* @__PURE__ */ new Date()), d(c), "months") === 0;
176
177
  return (p && !c || T && p) && (e = !0), m`
177
178
  <div class="today">
178
179
  <skf-button
@@ -181,17 +182,17 @@ const _ = class _ extends E {
181
182
  variant="tertiary"
182
183
  size="sm"
183
184
  >
184
- ${k(this.date) && (this.selectedDate || this.selectedDateRange.start) && !e ? b(this, D).term("selectedDay") : b(this, D).term("today")}
185
+ ${k(this.date) && (this.selectedDate || this.selectedDateRange.start) && !e ? b(this, g).term("selectedDay") : b(this, g).term("today")}
185
186
  </skf-button>
186
187
  </div>
187
188
  `;
188
189
  function k(w) {
189
- return g(w, d(/* @__PURE__ */ new Date()), "months") === 0;
190
+ return D(w, d(/* @__PURE__ */ new Date()), "months") === 0;
190
191
  }
191
192
  }
192
193
  /** @internal */
193
194
  _handleChangeCalendarView(e) {
194
- const a = g(this.date, e);
195
+ const a = D(this.date, e);
195
196
  this._animateView(a, () => {
196
197
  this.date = e;
197
198
  }).then(() => {
@@ -217,7 +218,7 @@ const _ = class _ extends E {
217
218
  )) : Promise.resolve();
218
219
  }
219
220
  };
220
- D = new WeakMap(), _.styles = [F, L];
221
+ g = new WeakMap(), _.styles = [F, L];
221
222
  let n = _;
222
223
  l([
223
224
  o({ reflect: !0 })
@@ -110,7 +110,7 @@ const m = class m extends b {
110
110
  }
111
111
  /** Method that closes the dialog */
112
112
  async close() {
113
- if (c(this, p) || !this.open) return;
113
+ if (c(this, p) || !this.$dialog?.open) return;
114
114
  d(this, p, !0);
115
115
  async function t(o) {
116
116
  return o.$dialog ? (o.emit("skf-dialog-closing"), await o._transition().exit(), o.$dialog.close(), o.open = !1, d(o, p, !1), !0) : !1;
@@ -190,7 +190,7 @@ n([
190
190
  x({ slot: "footer" })
191
191
  ], s.prototype, "footerEls", 2);
192
192
  n([
193
- k("open")
193
+ k("open", { waitUntilFirstUpdate: !0 })
194
194
  ], s.prototype, "handleOpenChange", 1);
195
195
  export {
196
196
  s as SkfDialog
@@ -34,6 +34,7 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
34
34
  * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.
35
35
  */
36
36
  autocomplete?: HTMLInputElement['autocomplete'];
37
+ autofocus: boolean;
37
38
  /** If defined, forces component to invalid state until removed. Its value is used as hint text. */
38
39
  set customInvalid(value: string | undefined);
39
40
  get customInvalid(): string | undefined;
@@ -111,6 +112,9 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
111
112
  _handlePressStart: (event: MouseEvent) => void;
112
113
  /** @internal */
113
114
  _handlePressEnd: () => void;
115
+ focus(): void;
116
+ blur(): void;
117
+ select(): void;
114
118
  /** @internal */
115
119
  validateInput(): void;
116
120
  /**
@@ -1,8 +1,8 @@
1
- var f = (a) => {
1
+ var y = (a) => {
2
2
  throw TypeError(a);
3
3
  };
4
- var b = (a, n, t) => n.has(a) || f("Cannot " + t);
5
- var c = (a, n, t) => (b(a, n, "read from private field"), t ? t.call(a) : n.get(a)), _ = (a, n, t) => n.has(a) ? f("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), $ = (a, n, t, r) => (b(a, n, "write to private field"), r ? r.call(a, t) : n.set(a, t), t);
4
+ var b = (a, o, t) => o.has(a) || y("Cannot " + t);
5
+ var c = (a, o, t) => (b(a, o, "read from private field"), t ? t.call(a) : o.get(a)), _ = (a, o, t) => o.has(a) ? y("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(a) : o.set(a, t), $ = (a, o, t, r) => (b(a, o, "write to private field"), r ? r.call(a, t) : o.set(a, t), t);
6
6
  import "../icon/icon.js";
7
7
  import { FormBase as g } from "../../internal/components/formBase.js";
8
8
  import "../../internal/components/hint/hint.js";
@@ -12,21 +12,21 @@ import { Asterisk as P } from "../../internal/templates/asterisk.js";
12
12
  import { componentStyles as C } from "../../styles/component.styles.js";
13
13
  import { LocalizeController as k } from "../../utilities/localize.js";
14
14
  import { html as p, nothing as m } from "lit";
15
- import { state as v, property as s, query as S, queryAssignedNodes as x } from "lit/decorators.js";
15
+ import { state as v, property as s, query as B, queryAssignedNodes as S } from "lit/decorators.js";
16
16
  import { ifDefined as l } from "lit/directives/if-defined.js";
17
- import { live as B } from "lit/directives/live.js";
17
+ import { live as x } from "lit/directives/live.js";
18
18
  import { InputNumberController as A, InputPasswordController as V } from "./input.controllers.js";
19
19
  import I from "./input.styles.js";
20
- var L = Object.defineProperty, D = Object.getOwnPropertyDescriptor, e = (a, n, t, r) => {
21
- for (var o = r > 1 ? void 0 : r ? D(n, t) : n, h = a.length - 1, d; h >= 0; h--)
22
- (d = a[h]) && (o = (r ? d(n, t, o) : d(o)) || o);
23
- return r && o && L(n, t, o), o;
24
- }, u;
25
- const y = class y extends g {
20
+ var L = Object.defineProperty, D = Object.getOwnPropertyDescriptor, e = (a, o, t, r) => {
21
+ for (var n = r > 1 ? void 0 : r ? D(o, t) : o, h = a.length - 1, u; h >= 0; h--)
22
+ (u = a[h]) && (n = (r ? u(o, t, n) : u(n)) || n);
23
+ return r && n && L(o, t, n), n;
24
+ }, d;
25
+ const f = class f extends g {
26
26
  constructor() {
27
27
  super(...arguments);
28
- _(this, u);
29
- $(this, u, new k(this)), this._value = "", this.debug = !1, this.hideLabel = !1, this.inputmode = "text", this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.invalid = !1, this._buttonDown = !1, this._numberController = new A(this), this._passwordController = new V(this), this._handleInput = () => {
28
+ _(this, d);
29
+ $(this, d, new k(this)), this._value = "", this.autofocus = !1, this.debug = !1, this.hideLabel = !1, this.inputmode = "text", this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.invalid = !1, this._buttonDown = !1, this._numberController = new A(this), this._passwordController = new V(this), this._handleInput = () => {
30
30
  this._value = this.$input?.value ?? "", this.validateOn === "input" && (this._pristine = !1, this.validateInput());
31
31
  }, this._resetValue = (t) => {
32
32
  t.stopPropagation(), this.value = this.getAttribute("value")?.trim() ?? "", this._value = this.value, this._internals.setFormValue(this.value), this.$input?.focus();
@@ -52,7 +52,7 @@ const y = class y extends g {
52
52
  `, this._renderPasswordButton = () => p`
53
53
  <button
54
54
  @click=${this._passwordController.toggleVisibility}
55
- aria-label=${this._passwordController._type === "password" ? c(this, u).term("showPassword") : c(this, u).term("hidePassword")}
55
+ aria-label=${this._passwordController._type === "password" ? c(this, d).term("showPassword") : c(this, d).term("hidePassword")}
56
56
  class="password skf-icon-host"
57
57
  type="button"
58
58
  @mousedown="${this._handlePressStart}"
@@ -67,7 +67,7 @@ const y = class y extends g {
67
67
  @mousedown=${this._handlePressStart}
68
68
  @mouseup=${this._handlePressEnd}
69
69
  @mouseleave=${this._handlePressEnd}
70
- aria-label=${c(this, u).term("clearEntry")}
70
+ aria-label=${c(this, d).term("clearEntry")}
71
71
  class="search skf-icon-host"
72
72
  type="button"
73
73
  >
@@ -94,7 +94,7 @@ const y = class y extends g {
94
94
  this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input?.value ?? ""), this.emitEvent("change"), this.validateInput();
95
95
  }), this.addEventListener("invalid", (t) => {
96
96
  this._pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
97
- }), this.addEventListener("reset", this._resetValue), this.validateInput();
97
+ }), this.value = this.getAttribute("value")?.trim() ?? "", this.autofocus && this.$input?.focus(), this.addEventListener("reset", this._resetValue), this.validateInput();
98
98
  }
99
99
  willUpdate(t) {
100
100
  if (t.has("invalid"))
@@ -108,14 +108,23 @@ const y = class y extends g {
108
108
  valueChanged() {
109
109
  this._internals.setFormValue(this.value), this.validateInput();
110
110
  }
111
- attributeChangedCallback(t, r, o) {
112
- if (super.attributeChangedCallback(t, r, o), t === "value" && this._internals.setFormValue(o), t === "custom-invalid")
113
- if (typeof o == "string") {
114
- const d = this.withFallback(o);
115
- this._pristine = !1, this._internals.setValidity({ customError: !0 }, d), this.invalid = !0, this.hint = d, this.checkValidity();
111
+ attributeChangedCallback(t, r, n) {
112
+ if (super.attributeChangedCallback(t, r, n), t === "value" && this._internals.setFormValue(n), t === "custom-invalid")
113
+ if (typeof n == "string") {
114
+ const u = this.withFallback(n);
115
+ this._pristine = !1, this._internals.setValidity({ customError: !0 }, u), this.invalid = !0, this.hint = u, this.checkValidity();
116
116
  } else
117
117
  this._internals.setValidity({}), this.validateInput();
118
118
  }
119
+ focus() {
120
+ this.$input?.focus();
121
+ }
122
+ blur() {
123
+ this.$input?.blur();
124
+ }
125
+ select() {
126
+ this.$input?.select();
127
+ }
119
128
  /** @internal */
120
129
  validateInput() {
121
130
  if (this._internals.validity.customError || !this.$input) return;
@@ -124,17 +133,17 @@ const y = class y extends g {
124
133
  this._internals.setValidity({ customError: this._internals.validity.customError });
125
134
  else {
126
135
  this.invalid = !this._pristine && !r.valid;
127
- let o;
128
- for (o in r) {
129
- const h = `data-${o.toString()}`;
130
- if (r[o] && !this.hasAttribute(h) && this.debug && console.log(
136
+ let n;
137
+ for (n in r) {
138
+ const h = `data-${n.toString()}`;
139
+ if (r[n] && !this.hasAttribute(h) && this.debug && console.log(
131
140
  `Add custom message on ${this.localName} using attribute: ${h.toUpperCase()}="Your custom message"`
132
- ), r[o]) {
133
- this.validationError = o.toString();
134
- const d = this.hasAttribute(h) ? this.getAttribute(h) : this.$input.validationMessage;
141
+ ), r[n]) {
142
+ this.validationError = n.toString();
143
+ const u = this.hasAttribute(h) ? this.getAttribute(h) : this.$input.validationMessage;
135
144
  this._internals.setValidity(
136
145
  { [this.validationError]: !0, customError: this._internals.validity.customError },
137
- this.withFallback(d)
146
+ this.withFallback(u)
138
147
  ), this.invalid && this.customErrorDisplay && this.checkValidity();
139
148
  }
140
149
  }
@@ -147,7 +156,7 @@ const y = class y extends g {
147
156
  <label>
148
157
  <div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${t} id="label">
149
158
  <slot>${this.label}</slot>
150
- ${this.required ? P(c(this, u).term("required")) : m}
159
+ ${this.required ? P(c(this, d).term("required")) : m}
151
160
  </div>
152
161
  <div id="input">
153
162
  ${this.type === "search" ? p`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : m}
@@ -161,7 +170,7 @@ const y = class y extends g {
161
170
  ?readonly=${this.readonly}
162
171
  ?required=${this.required}
163
172
  .autocomplete=${this.autocomplete ?? "off"}
164
- .value=${B(this.value)}
173
+ .value=${x(this.value)}
165
174
  @blur=${this._onBlur}
166
175
  @input=${this._handleInput}
167
176
  aria-describedby=${l(this.hint?.trim() ? "hint" : m)}
@@ -203,14 +212,17 @@ const y = class y extends g {
203
212
  `;
204
213
  }
205
214
  };
206
- u = new WeakMap(), y.styles = [C, I];
207
- let i = y;
215
+ d = new WeakMap(), f.styles = [C, I];
216
+ let i = f;
208
217
  e([
209
218
  v()
210
219
  ], i.prototype, "_value", 2);
211
220
  e([
212
221
  s()
213
222
  ], i.prototype, "autocomplete", 2);
223
+ e([
224
+ s({ type: Boolean })
225
+ ], i.prototype, "autofocus", 2);
214
226
  e([
215
227
  s({ attribute: "custom-invalid", reflect: !0 })
216
228
  ], i.prototype, "customInvalid", 1);
@@ -287,10 +299,10 @@ e([
287
299
  v()
288
300
  ], i.prototype, "_buttonDown", 2);
289
301
  e([
290
- S("input")
302
+ B("input")
291
303
  ], i.prototype, "$input", 2);
292
304
  e([
293
- x({ flatten: !0 })
305
+ S({ flatten: !0 })
294
306
  ], i.prototype, "_defaultSlot", 2);
295
307
  e([
296
308
  E("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
@@ -31,9 +31,5 @@ export declare class SkfPopover extends SkfPopoverBase {
31
31
  /** @internal */
32
32
  hideArrowChanged(): void;
33
33
  /** @internal */
34
- openExtended(): void;
35
- /** @internal */
36
34
  addEventListeners($element: HTMLElement | Element): void;
37
- /** @internal */
38
- _checkClickOutside: (e: Event) => void;
39
35
  }
@@ -1,43 +1,35 @@
1
1
  import { SkfPopoverBase as h } from "../../internal/base-classes/popover/popover.base.js";
2
- import { watch as l } from "../../internal/helpers/watch.js";
3
- import { property as c } from "lit/decorators.js";
2
+ import { watch as d } from "../../internal/helpers/watch.js";
3
+ import { property as f } from "lit/decorators.js";
4
4
  import { styles as w } from "./popover.styles.js";
5
- var f = Object.defineProperty, v = Object.getOwnPropertyDescriptor, n = (d, t, i, s) => {
6
- for (var e = s > 1 ? void 0 : s ? v(t, i) : t, o = d.length - 1, p; o >= 0; o--)
7
- (p = d[o]) && (e = (s ? p(t, i, e) : p(e)) || e);
8
- return s && e && f(t, i, e), e;
5
+ var c = Object.defineProperty, m = Object.getOwnPropertyDescriptor, a = (l, r, o, s) => {
6
+ for (var t = s > 1 ? void 0 : s ? m(r, o) : r, i = l.length - 1, p; i >= 0; i--)
7
+ (p = l[i]) && (t = (s ? p(r, o, t) : p(t)) || t);
8
+ return s && t && c(r, o, t), t;
9
9
  };
10
- const a = class a extends h {
10
+ const n = class n extends h {
11
11
  constructor() {
12
- super(), this.offset = 8, this.hideArrow = !1, this._checkClickOutside = (t) => {
13
- this.isOpen && !this.contains(t.target) && this.close();
14
- }, this.arrow = !this.hideArrow, this.placement = "bottom-start", this.triggerEvent = "click", this.variant = "popup", h.classMap = { popover: !0 };
12
+ super(), this.offset = 8, this.hideArrow = !1, this.arrow = !this.hideArrow, this.placement = "bottom-start", this.triggerEvent = "click", this.variant = "popup", h.classMap = { popover: !0 };
15
13
  }
16
14
  hideArrowChanged() {
17
15
  this.arrow = !this.hideArrow;
18
16
  }
19
17
  /** @internal */
20
- openExtended() {
21
- window.top && window.self !== window.top && window.top.addEventListener("click", this._checkClickOutside, {
22
- signal: this.signal
23
- });
24
- }
25
- /** @internal */
26
- addEventListeners(t) {
27
- t.addEventListener(this.triggerEvent, this.open, { signal: this.signal });
18
+ addEventListeners(r) {
19
+ r.addEventListener(this.triggerEvent, this.open, { signal: this.signal });
28
20
  }
29
21
  };
30
- a.styles = [h.styles, w];
31
- let r = a;
32
- n([
33
- c({ type: Number })
34
- ], r.prototype, "offset", 2);
35
- n([
36
- c({ type: Boolean })
37
- ], r.prototype, "hideArrow", 2);
38
- n([
39
- l("hideArrow")
40
- ], r.prototype, "hideArrowChanged", 1);
22
+ n.styles = [h.styles, w];
23
+ let e = n;
24
+ a([
25
+ f({ type: Number })
26
+ ], e.prototype, "offset", 2);
27
+ a([
28
+ f({ type: Boolean })
29
+ ], e.prototype, "hideArrow", 2);
30
+ a([
31
+ d("hideArrow")
32
+ ], e.prototype, "hideArrowChanged", 1);
41
33
  export {
42
- r as SkfPopover
34
+ e as SkfPopover
43
35
  };
@@ -63,6 +63,7 @@ export declare class SkfSelect extends FormBase {
63
63
  lang: Language;
64
64
  /** If defined, limits the number of selectable options */
65
65
  max?: number;
66
+ maxVisibleItems?: number;
66
67
  /** If defined, sets the minimum number of required options */
67
68
  min?: number;
68
69
  /** If true, allows for multiple options to be selected */
@@ -89,6 +90,7 @@ export declare class SkfSelect extends FormBase {
89
90
  /** @internal */
90
91
  /** True if the internal state is invalid */
91
92
  private _invalid;
93
+ private desiredPopupHeight?;
92
94
  /** @internal */
93
95
  $anchor: HTMLButtonElement;
94
96
  /** @internal */
@@ -109,10 +111,13 @@ export declare class SkfSelect extends FormBase {
109
111
  willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
110
112
  firstUpdated(): void;
111
113
  _handleSizeUpdate(): void;
112
- handleExpandedChange(): void;
114
+ /** @internal */
115
+ _handleExpandedChange(): void;
113
116
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
114
117
  disconnectedCallback(): void;
115
118
  /** @internal */
119
+ _getOptionalDropdownHeight(_skfSelectOption: SkfSelectOption): number | undefined;
120
+ /** @internal */
116
121
  _handleOptionSelected: EventListener;
117
122
  /** @internal */
118
123
  _updateState(event: CustomEvent<SelectOptionEvent>): void;