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

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 })
@@ -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;
@@ -1,38 +1,38 @@
1
- var _ = (o) => {
2
- throw TypeError(o);
1
+ var _ = (l) => {
2
+ throw TypeError(l);
3
3
  };
4
- var v = (o, a, t) => a.has(o) || _("Cannot " + t);
5
- var c = (o, a, t) => (v(o, a, "read from private field"), t ? t.call(o) : a.get(o)), g = (o, a, t) => a.has(o) ? _("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(o) : a.set(o, t), b = (o, a, t, e) => (v(o, a, "write to private field"), e ? e.call(o, t) : a.set(o, t), t);
4
+ var v = (l, r, t) => r.has(l) || _("Cannot " + t);
5
+ var u = (l, r, t) => (v(l, r, "read from private field"), t ? t.call(l) : r.get(l)), g = (l, r, t) => r.has(l) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(l) : r.set(l, t), b = (l, r, t, e) => (v(l, r, "write to private field"), e ? e.call(l, t) : r.set(l, t), t);
6
6
  import { SkfSelectOptionGroup as w } from "./select-option-group.component.js";
7
7
  import "../tag/tag.js";
8
- import { computePosition as C, flip as x, shift as V, offset as $ } from "@floating-ui/dom";
8
+ import { computePosition as x, flip as C, shift as V, offset as $ } from "@floating-ui/dom";
9
9
  import { FormBase as L } from "../../internal/components/formBase.js";
10
10
  import "../../internal/components/hint/hint.js";
11
11
  import { PopoverController as E } from "../../internal/controllers/popover.controller.js";
12
12
  import { findMatchingTags as k } from "../../internal/helpers/findMatchingTags.js";
13
13
  import { hintSeverity as A } from "../../internal/helpers/hintSeverity.js";
14
- import { raiseError as D } from "../../internal/helpers/raiseError.js";
14
+ import { raiseError as I } from "../../internal/helpers/raiseError.js";
15
15
  import { watch as S } from "../../internal/helpers/watch.js";
16
- import { Asterisk as I } from "../../internal/templates/asterisk.js";
16
+ import { Asterisk as D } from "../../internal/templates/asterisk.js";
17
17
  import { componentStyles as P } from "../../styles/component.styles.js";
18
- import { LocalizeController as T } from "../../utilities/localize.js";
18
+ import { LocalizeController as F } from "../../utilities/localize.js";
19
19
  import { nothing as y, html as p } from "lit";
20
- import { property as r, state as u, query as m, queryAssignedElements as F } from "lit/decorators.js";
21
- import { classMap as U } from "lit/directives/class-map.js";
20
+ import { property as n, state as c, query as m, queryAssignedElements as T } from "lit/decorators.js";
21
+ import { classMap as z } from "lit/directives/class-map.js";
22
22
  import { ifDefined as O } from "lit/directives/if-defined.js";
23
- import { SkfSelectOption as z } from "./select-option.component.js";
24
- import { GlobalClickController as M, KeyboardNavigationController as B, DeveloperFeedbackController as q } from "./select.controllers.js";
25
- import { styles as j } from "./select.styles.js";
26
- var N = Object.defineProperty, R = Object.getOwnPropertyDescriptor, s = (o, a, t, e) => {
27
- for (var l = e > 1 ? void 0 : e ? R(a, t) : a, n = o.length - 1, h; n >= 0; n--)
28
- (h = o[n]) && (l = (e ? h(a, t, l) : h(l)) || l);
29
- return e && l && N(a, t, l), l;
23
+ import { SkfSelectOption as U } from "./select-option.component.js";
24
+ import { GlobalClickController as M, KeyboardNavigationController as B, DeveloperFeedbackController as N } from "./select.controllers.js";
25
+ import { styles as H } from "./select.styles.js";
26
+ var q = Object.defineProperty, R = Object.getOwnPropertyDescriptor, s = (l, r, t, e) => {
27
+ for (var o = e > 1 ? void 0 : e ? R(r, t) : r, a = l.length - 1, h; a >= 0; a--)
28
+ (h = l[a]) && (o = (e ? h(r, t, o) : h(o)) || o);
29
+ return e && o && q(r, t, o), o;
30
30
  }, d;
31
31
  const f = class f extends L {
32
32
  constructor() {
33
33
  super();
34
34
  g(this, d);
35
- b(this, d, new T(this)), this._componentIsConnected = !1, this._defaultButtonLabel = "Select an option", this.selectDelay = 200, this._optionsList = [], this.buttonLabel = this._defaultButtonLabel, this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new B(this), this.developerFeedbackController = new q(this), this.popoverController = new E(this), this._handleOptionSelected = (t) => {
35
+ b(this, d, new F(this)), this._componentIsConnected = !1, this._defaultButtonLabel = "Select an option", this.selectDelay = 200, this._optionsList = [], this.buttonLabel = this._defaultButtonLabel, this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new B(this), this.developerFeedbackController = new N(this), this.popoverController = new E(this), this._handleOptionSelected = (t) => {
36
36
  this._pristine = !1;
37
37
  const e = this._selectedOptions.length > 0;
38
38
  this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
@@ -43,9 +43,9 @@ const f = class f extends L {
43
43
  this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
44
44
  }, 50);
45
45
  }, this.reposition = async () => {
46
- const { x: t, y: e } = await C(this.$anchor, this.$popover, {
46
+ const { x: t, y: e } = await x(this.$anchor, this.$popover, {
47
47
  placement: "bottom",
48
- middleware: [x(), V(), $(2)],
48
+ middleware: [C(), V(), $(2)],
49
49
  strategy: "fixed"
50
50
  });
51
51
  Object.assign(this.$popover.style, {
@@ -74,8 +74,8 @@ const f = class f extends L {
74
74
  });
75
75
  }), this._resetSelectedOptions = (t) => {
76
76
  const e = !t;
77
- this._optionsList.forEach((l) => {
78
- (e || l !== t) && l.removeAttribute("selected");
77
+ this._optionsList.forEach((o) => {
78
+ (e || o !== t) && o.removeAttribute("selected");
79
79
  }), this._optionsList = [];
80
80
  }, this._handleSlotChange = () => {
81
81
  this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0, this.emitEvent("skf-select-connected");
@@ -85,18 +85,18 @@ const f = class f extends L {
85
85
  const t = String(this.value).split(",").map((e) => e.toLowerCase().trim());
86
86
  this._optionsList.forEach((e) => {
87
87
  t.includes(e.value.toLowerCase().trim()) ? (e.setSelectedDiscrete = !0, this.selectedOptions = [...this.selectedOptions, e]) : (e.setSelectedDiscrete = !1, this._selectedOptions = this._selectedOptions.filter(
88
- (l) => l.value.toLowerCase().trim() !== e.value.toLowerCase().trim()
88
+ (o) => o.value.toLowerCase().trim() !== e.value.toLowerCase().trim()
89
89
  ));
90
90
  }), this._setValue().catch((e) => {
91
91
  console.error(e);
92
92
  });
93
93
  } else {
94
- const t = this.value.toLowerCase().trim(), e = this._optionsList.find((l) => l.value.toLowerCase().trim() === t);
95
- e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((l) => {
96
- console.error(l);
94
+ const t = this.value.toLowerCase().trim(), e = this._optionsList.find((o) => o.value.toLowerCase().trim() === t);
95
+ e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((o) => {
96
+ console.error(o);
97
97
  }));
98
98
  }
99
- }, this._computeVisibleValue = () => this.buttonLabel !== this._defaultButtonLabel ? this.buttonLabel : (this.$selectedValue?.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${c(this, d).term("itemsSelected", this._selectedOptions.length)})` : this.value ? (this.$selectedValue?.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : (this.$selectedValue?.classList.add("contains-meta-info"), this.buttonLabel)), this._selectedOptions = [];
99
+ }, this._computeVisibleValue = () => this.buttonLabel !== this._defaultButtonLabel ? this.buttonLabel : (this.$selectedValue?.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${u(this, d).term("itemsSelected", this._selectedOptions.length)})` : this.value ? (this.$selectedValue?.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : (this.$selectedValue?.classList.add("contains-meta-info"), this.buttonLabel)), this._selectedOptions = [];
100
100
  }
101
101
  set selectedValues(t) {
102
102
  this._selectedOptions = this._optionsList.filter((e) => t.includes(e.value.trim()));
@@ -114,11 +114,11 @@ const f = class f extends L {
114
114
  }
115
115
  set value(t) {
116
116
  let e = [];
117
- this._componentIsConnected && (this.multiple ? e = String(t).split(",").map((n) => n.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
118
- (n) => e.includes(n.value.toLowerCase().trim())
119
- ), this._optionsList.forEach((n) => {
120
- n.selected && (n.setSelectedDiscrete = !1);
121
- }), this._selectedOptions.forEach((n) => n.setSelectedDiscrete = !0)), this._setValue();
117
+ this._componentIsConnected && (this.multiple ? e = String(t).split(",").map((a) => a.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
118
+ (a) => e.includes(a.value.toLowerCase().trim())
119
+ ), this._optionsList.forEach((a) => {
120
+ a.selected && (a.setSelectedDiscrete = !1);
121
+ }), this._selectedOptions.forEach((a) => a.setSelectedDiscrete = !0)), this._setValue();
122
122
  }
123
123
  get value() {
124
124
  return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
@@ -152,18 +152,20 @@ const f = class f extends L {
152
152
  }
153
153
  _handleSizeUpdate() {
154
154
  this._slottedItems.forEach((t) => {
155
- (t instanceof z || t instanceof w) && (t.small = this.size === "sm");
155
+ (t instanceof U || t instanceof w) && (t.small = this.size === "sm");
156
156
  });
157
157
  }
158
- handleExpandedChange() {
158
+ _handleExpandedChange() {
159
159
  this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
160
160
  console.error(t);
161
- })), this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
161
+ })), this.desiredPopupHeight = this._getOptionalDropdownHeight(
162
+ this._slottedItems[0]
163
+ ), this.desiredPopupHeight ? this.$popover.style.height = `${this.desiredPopupHeight.toString()}px` : this.$popover.style.height = "", this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
162
164
  }
163
- attributeChangedCallback(t, e, l) {
164
- if (super.attributeChangedCallback(t, e, l), t === "custom-invalid")
165
- if (typeof l == "string") {
166
- const h = this.withFallback(l);
165
+ attributeChangedCallback(t, e, o) {
166
+ if (super.attributeChangedCallback(t, e, o), t === "custom-invalid")
167
+ if (typeof o == "string") {
168
+ const h = this.withFallback(o);
167
169
  this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, h), this.checkValidity();
168
170
  } else
169
171
  this.setValidity({}), this._validateInput();
@@ -172,14 +174,20 @@ const f = class f extends L {
172
174
  super.disconnectedCallback(), this._internals.form?.removeEventListener("reset", this._handleReset);
173
175
  }
174
176
  /** @internal */
177
+ _getOptionalDropdownHeight(t) {
178
+ if (!this.maxVisibleItems) return;
179
+ const e = this._slottedItems.length;
180
+ return this.maxVisibleItems >= e ? void 0 : t.getBoundingClientRect().height * this.maxVisibleItems;
181
+ }
182
+ /** @internal */
175
183
  _updateState(t) {
176
184
  if (this.multiple)
177
185
  this._selectedOptions = [], this._optionsList.forEach((e) => {
178
186
  e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
179
187
  });
180
188
  else {
181
- const e = this._selectedOptions.length > 0, l = t.detail.value !== null;
182
- e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), l && (this.selectedOptions = [t.target]);
189
+ const e = this._selectedOptions.length > 0, o = t.detail.value !== null;
190
+ e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), o && (this.selectedOptions = [t.target]);
183
191
  }
184
192
  this._setValue();
185
193
  }
@@ -190,7 +198,7 @@ const f = class f extends L {
190
198
  /** @internal */
191
199
  /** Filter out elements other than skf-select-option and store in this._optionsList */
192
200
  _collectSlotOptionTags() {
193
- this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), D({
201
+ this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), I({
194
202
  assert: this._optionsList.length > 0,
195
203
  reason: "no-children",
196
204
  replaceStrings: [this.localName, "skf-select-option"]
@@ -199,7 +207,7 @@ const f = class f extends L {
199
207
  /** @internal */
200
208
  _validateInput() {
201
209
  this._invalid = !1;
202
- const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), l = !!(this.max && this.selectedValues.length > this.max);
210
+ const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), o = !!(this.max && this.selectedValues.length > this.max);
203
211
  if (this._internals.validity.customError) {
204
212
  this._invalid = !0;
205
213
  return;
@@ -209,7 +217,7 @@ const f = class f extends L {
209
217
  } else if (e) {
210
218
  const h = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
211
219
  this.setValidity({ rangeUnderflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
212
- } else if (l) {
220
+ } else if (o) {
213
221
  const h = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
214
222
  this.setValidity({ rangeOverflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
215
223
  } else
@@ -221,7 +229,7 @@ const f = class f extends L {
221
229
  <label>
222
230
  <div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
223
231
  ${this.label}
224
- ${this.required ? I(c(this, d).term("required")) : y}
232
+ ${this.required ? D(u(this, d).term("required")) : y}
225
233
  </div>
226
234
  <button
227
235
  ?disabled=${this.disabled}
@@ -236,7 +244,7 @@ const f = class f extends L {
236
244
  >
237
245
  <span
238
246
  id="selected-value"
239
- class=${U({ "selected-value": !0, "contains-meta-info": !this.value })}>
247
+ class=${z({ "selected-value": !0, "contains-meta-info": !this.value })}>
240
248
  ${this._computeVisibleValue()}
241
249
  </span>
242
250
  <skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
@@ -277,68 +285,74 @@ const f = class f extends L {
277
285
  `;
278
286
  }
279
287
  };
280
- d = new WeakMap(), f.styles = [P, j];
288
+ d = new WeakMap(), f.styles = [P, H];
281
289
  let i = f;
282
290
  s([
283
- r({ type: String, reflect: !0, attribute: "button-label" })
291
+ n({ type: String, reflect: !0, attribute: "button-label" })
284
292
  ], i.prototype, "buttonLabel", 2);
285
293
  s([
286
- r({ type: String, attribute: "custom-invalid" })
294
+ n({ type: String, attribute: "custom-invalid" })
287
295
  ], i.prototype, "customInvalid", 2);
288
296
  s([
289
- r({ type: Boolean, attribute: "hide-label" })
297
+ n({ type: Boolean, attribute: "hide-label" })
290
298
  ], i.prototype, "hideLabel", 2);
291
299
  s([
292
- r({ type: Boolean, reflect: !0, attribute: "hide-tags" })
300
+ n({ type: Boolean, reflect: !0, attribute: "hide-tags" })
293
301
  ], i.prototype, "hideTags", 2);
294
302
  s([
295
- r({ type: String })
303
+ n({ type: String })
296
304
  ], i.prototype, "hint", 2);
297
305
  s([
298
- r({ type: Array, attribute: !1 })
306
+ n({ type: Array, attribute: !1 })
299
307
  ], i.prototype, "selectedValues", 1);
300
308
  s([
301
- r({ type: Array, attribute: !1 })
309
+ n({ type: Array, attribute: !1 })
302
310
  ], i.prototype, "selectedOptionsText", 1);
303
311
  s([
304
- r({ type: String, reflect: !0 })
312
+ n({ type: String, reflect: !0 })
305
313
  ], i.prototype, "label", 2);
306
314
  s([
307
- r({ type: String })
315
+ n({ type: String })
308
316
  ], i.prototype, "lang", 2);
309
317
  s([
310
- r({ type: Number })
318
+ n({ type: Number })
311
319
  ], i.prototype, "max", 2);
312
320
  s([
313
- r({ type: Number })
321
+ n({ type: Number, attribute: "max-visible-items" })
322
+ ], i.prototype, "maxVisibleItems", 2);
323
+ s([
324
+ n({ type: Number })
314
325
  ], i.prototype, "min", 2);
315
326
  s([
316
- r({ type: Boolean, reflect: !0 })
327
+ n({ type: Boolean, reflect: !0 })
317
328
  ], i.prototype, "multiple", 2);
318
329
  s([
319
- r({ type: String })
330
+ n({ type: String })
320
331
  ], i.prototype, "name", 2);
321
332
  s([
322
- r()
333
+ n()
323
334
  ], i.prototype, "severity", 2);
324
335
  s([
325
- r({ type: Boolean, attribute: "show-valid" })
336
+ n({ type: Boolean, attribute: "show-valid" })
326
337
  ], i.prototype, "showValid", 2);
327
338
  s([
328
- r({ reflect: !0 })
339
+ n({ reflect: !0 })
329
340
  ], i.prototype, "size", 2);
330
341
  s([
331
- r({ type: String, attribute: !1 })
342
+ n({ type: String, attribute: !1 })
332
343
  ], i.prototype, "value", 1);
333
344
  s([
334
- u()
345
+ c()
335
346
  ], i.prototype, "selectedOptions", 1);
336
347
  s([
337
- u()
348
+ c()
338
349
  ], i.prototype, "_expanded", 2);
339
350
  s([
340
- u()
351
+ c()
341
352
  ], i.prototype, "_invalid", 2);
353
+ s([
354
+ c()
355
+ ], i.prototype, "desiredPopupHeight", 2);
342
356
  s([
343
357
  m("#select-button")
344
358
  ], i.prototype, "$anchor", 2);
@@ -349,14 +363,14 @@ s([
349
363
  m("#select-dropdown")
350
364
  ], i.prototype, "$popover", 2);
351
365
  s([
352
- F()
366
+ T()
353
367
  ], i.prototype, "_slottedItems", 2);
354
368
  s([
355
369
  S("size", { waitUntilFirstUpdate: !0 })
356
370
  ], i.prototype, "_handleSizeUpdate", 1);
357
371
  s([
358
372
  S("_expanded", { afterUpdate: !0 })
359
- ], i.prototype, "handleExpandedChange", 1);
373
+ ], i.prototype, "_handleExpandedChange", 1);
360
374
  export {
361
375
  i as SkfSelect
362
376
  };
@@ -1650,19 +1650,6 @@
1650
1650
  "attribute": "invalid-dates",
1651
1651
  "reflects": true
1652
1652
  },
1653
- {
1654
- "kind": "field",
1655
- "name": "lang",
1656
- "type": {
1657
- "text": "Language"
1658
- },
1659
- "default": "'en'",
1660
- "description": "Sets the internal language of the component",
1661
- "attribute": "lang",
1662
- "expandedType": {
1663
- "text": "'en' | 'es' | 'pt' | 'sv'"
1664
- }
1665
- },
1666
1653
  {
1667
1654
  "kind": "field",
1668
1655
  "name": "locale",
@@ -1810,18 +1797,6 @@
1810
1797
  "description": "A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.",
1811
1798
  "fieldName": "invalidDates"
1812
1799
  },
1813
- {
1814
- "name": "lang",
1815
- "type": {
1816
- "text": "Language"
1817
- },
1818
- "default": "'en'",
1819
- "description": "Sets the internal language of the component",
1820
- "fieldName": "lang",
1821
- "expandedType": {
1822
- "text": "'en' | 'es' | 'pt' | 'sv'"
1823
- }
1824
- },
1825
1800
  {
1826
1801
  "name": "locale",
1827
1802
  "type": {
@@ -3878,6 +3853,15 @@
3878
3853
  "description": "Indicates whether the value of the control can be automatically completed by the browser. See\n[MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.",
3879
3854
  "attribute": "autocomplete"
3880
3855
  },
3856
+ {
3857
+ "kind": "field",
3858
+ "name": "autofocus",
3859
+ "type": {
3860
+ "text": "boolean"
3861
+ },
3862
+ "default": "false",
3863
+ "attribute": "autofocus"
3864
+ },
3881
3865
  {
3882
3866
  "kind": "field",
3883
3867
  "name": "customInvalid",
@@ -4094,6 +4078,27 @@
4094
4078
  "name": "value",
4095
4079
  "description": "The current value of the input field",
4096
4080
  "attribute": "value"
4081
+ },
4082
+ {
4083
+ "kind": "method",
4084
+ "name": "focus",
4085
+ "type": {
4086
+ "text": "focus() => void"
4087
+ }
4088
+ },
4089
+ {
4090
+ "kind": "method",
4091
+ "name": "blur",
4092
+ "type": {
4093
+ "text": "blur() => void"
4094
+ }
4095
+ },
4096
+ {
4097
+ "kind": "method",
4098
+ "name": "select",
4099
+ "type": {
4100
+ "text": "select() => void"
4101
+ }
4097
4102
  }
4098
4103
  ],
4099
4104
  "events": [
@@ -4137,6 +4142,14 @@
4137
4142
  "description": "Indicates whether the value of the control can be automatically completed by the browser. See\n[MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.",
4138
4143
  "fieldName": "autocomplete"
4139
4144
  },
4145
+ {
4146
+ "name": "autofocus",
4147
+ "type": {
4148
+ "text": "boolean"
4149
+ },
4150
+ "default": "false",
4151
+ "fieldName": "autofocus"
4152
+ },
4140
4153
  {
4141
4154
  "name": "custom-invalid",
4142
4155
  "description": "If defined, forces component to invalid state until removed. Its value is used as hint text.",
@@ -5909,6 +5922,14 @@
5909
5922
  "description": "If defined, limits the number of selectable options",
5910
5923
  "attribute": "max"
5911
5924
  },
5925
+ {
5926
+ "kind": "field",
5927
+ "name": "maxVisibleItems",
5928
+ "type": {
5929
+ "text": "number | undefined"
5930
+ },
5931
+ "attribute": "max-visible-items"
5932
+ },
5912
5933
  {
5913
5934
  "kind": "field",
5914
5935
  "name": "min",
@@ -5974,17 +5995,18 @@
5974
5995
  "description": "Returns the selected value. (if multiple: in a comma separated string). If set will default set corresponding option."
5975
5996
  },
5976
5997
  {
5977
- "kind": "method",
5978
- "name": "_handleSizeUpdate",
5998
+ "kind": "field",
5999
+ "name": "desiredPopupHeight",
5979
6000
  "type": {
5980
- "text": "_handleSizeUpdate() => void"
5981
- }
6001
+ "text": "number | undefined"
6002
+ },
6003
+ "privacy": "private"
5982
6004
  },
5983
6005
  {
5984
6006
  "kind": "method",
5985
- "name": "handleExpandedChange",
6007
+ "name": "_handleSizeUpdate",
5986
6008
  "type": {
5987
- "text": "handleExpandedChange() => void"
6009
+ "text": "_handleSizeUpdate() => void"
5988
6010
  }
5989
6011
  },
5990
6012
  {
@@ -6124,6 +6146,13 @@
6124
6146
  "description": "If defined, limits the number of selectable options",
6125
6147
  "fieldName": "max"
6126
6148
  },
6149
+ {
6150
+ "name": "max-visible-items",
6151
+ "type": {
6152
+ "text": "number | undefined"
6153
+ },
6154
+ "fieldName": "maxVisibleItems"
6155
+ },
6127
6156
  {
6128
6157
  "name": "min",
6129
6158
  "type": {
@@ -1,4 +1,4 @@
1
- import { flip as w, offset as E, arrow as $, computePosition as O } from "@floating-ui/dom";
1
+ import { flip as w, offset as $, arrow as E, computePosition as O } from "@floating-ui/dom";
2
2
  import { SkfElement as C } from "../../components/skf-element.js";
3
3
  import { PopoverController as x } from "../../controllers/popover.controller.js";
4
4
  import { uuid as A } from "../../helpers/uuid.js";
@@ -21,7 +21,7 @@ const s = (p = class extends C {
21
21
  const o = t.newState === "open";
22
22
  this.isOpen = o, this.emit(o ? "skf-opened" : "skf-closed");
23
23
  }, this.handleToggleOpen = async () => {
24
- this.$anchor && (this.isOpen ? (this.$popover.togglePopover(!0), this.$popover.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 250, fill: "forwards" })) : (await this.$popover.animate([{ opacity: 0 }], { duration: 150, fill: "forwards" }).finished, this.$popover.togglePopover(this.isOpen)));
24
+ this.$anchor && (this.isOpen ? (this.$popover.togglePopover(!0), this.$popover.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 250, fill: "forwards" })) : (await this.$popover.animate([{ opacity: 0 }], { duration: 150, fill: "forwards" }).finished, this.$popover && this.$popover.togglePopover(this.isOpen)));
25
25
  }, this.handleAnchorChange = async () => {
26
26
  if (!this.anchor) return;
27
27
  await this.popoverController.stop(), this.$anchor && this.removeEventListeners();
@@ -29,8 +29,8 @@ const s = (p = class extends C {
29
29
  this.$anchor = t.getElementById(this.anchor), this.$anchor && (this.addEventListeners(this.$anchor), this.popoverController.start());
30
30
  }, this.reposition = async () => {
31
31
  if (!this.$anchor) return;
32
- const t = [w(), E(this.offset)];
33
- this.arrow && t.push($({ element: this.$arrow }));
32
+ const t = [w(), $(this.offset)];
33
+ this.arrow && t.push(E({ element: this.$arrow }));
34
34
  const { x: o, y: i, middlewareData: e } = await O(this.$anchor, this.$popover, {
35
35
  placement: this.placement,
36
36
  middleware: t,
@@ -426,8 +426,6 @@ export type SkfDatepickerCalendarProps = {
426
426
  "invalid-dates"?: SkfDatepickerCalendar['invalidDates'];
427
427
  /** A comma-separated list of dates (yyyy-mm-dd format) that are not selectable. */
428
428
  "invalidDates"?: SkfDatepickerCalendar['invalidDates'];
429
- /** Sets the internal language of the component */
430
- "lang"?: SkfDatepickerCalendar['lang'];
431
429
  /** */
432
430
  "locale"?: SkfDatepickerCalendar['locale'];
433
431
  /** */
@@ -674,6 +672,8 @@ export type SkfInputProps = {
674
672
  /** Indicates whether the value of the control can be automatically completed by the browser. See
675
673
  [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details. */
676
674
  "autocomplete"?: SkfInput['autocomplete'];
675
+ /** */
676
+ "autofocus"?: SkfInput['autofocus'];
677
677
  /** If defined, forces component to invalid state until removed. Its value is used as hint text. */
678
678
  "custom-invalid"?: SkfInput['customInvalid'];
679
679
  /** If defined, forces component to invalid state until removed. Its value is used as hint text. */
@@ -945,6 +945,10 @@ export type SkfSelectProps = {
945
945
  "lang"?: SkfSelect['lang'];
946
946
  /** If defined, limits the number of selectable options */
947
947
  "max"?: SkfSelect['max'];
948
+ /** */
949
+ "max-visible-items"?: SkfSelect['maxVisibleItems'];
950
+ /** */
951
+ "maxVisibleItems"?: SkfSelect['maxVisibleItems'];
948
952
  /** If defined, sets the minimum number of required options */
949
953
  "min"?: SkfSelect['min'];
950
954
  /** If true, allows for multiple options to be selected */
@@ -1509,7 +1513,6 @@ export type SkfTooltipProps = {
1509
1513
  * - `eventid`: undefined
1510
1514
  * - `firstDayOfWeek`: undefined
1511
1515
  * - `invalid-dates`/`invalidDates`: A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.
1512
- * - `lang`: Sets the internal language of the component
1513
1516
  * - `locale`: undefined
1514
1517
  * - `range`: undefined
1515
1518
  * - `selectable-from`/`selectableFrom`: Earliest selectable date. (yyyy-mm-dd format)
@@ -1825,6 +1828,7 @@ export type SkfTooltipProps = {
1825
1828
  * - `required`/`undefined`: If true, value is required or must be checked for the form to be submittable
1826
1829
  * - `autocomplete`: Indicates whether the value of the control can be automatically completed by the browser. See
1827
1830
  * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.
1831
+ * - `autofocus`: undefined
1828
1832
  * - `custom-invalid`/`customInvalid`: If defined, forces component to invalid state until removed. Its value is used as hint text.
1829
1833
  * - `debug`: If true, outputs helping hints in console
1830
1834
  * - `hide-label`/`hideLabel`: If true, hides the label visually
@@ -1862,6 +1866,14 @@ export type SkfTooltipProps = {
1862
1866
  * Areas where markup can be added to the component.
1863
1867
  *
1864
1868
  * - `(default)`: The Inputs label. Alternatively, you can use the `label` attribute.
1869
+ *
1870
+ * #### Methods
1871
+ *
1872
+ * Methods that can be called to access component functionality.
1873
+ *
1874
+ * - `focus() => void`: undefined
1875
+ * - `blur() => void`: undefined
1876
+ * - `select() => void`: undefined
1865
1877
  */
1866
1878
  "skf-input": Partial<SkfInputProps & BaseProps<SkfInput> & BaseEvents>;
1867
1879
 
@@ -2128,6 +2140,7 @@ export type SkfTooltipProps = {
2128
2140
  * - `label`: If defined, displays provided label
2129
2141
  * - `lang`: Sets the internal language of the component
2130
2142
  * - `max`: If defined, limits the number of selectable options
2143
+ * - `max-visible-items`/`maxVisibleItems`: undefined
2131
2144
  * - `min`: If defined, sets the minimum number of required options
2132
2145
  * - `multiple`: If true, allows for multiple options to be selected
2133
2146
  * - `name`: If defined, set name of the component
@@ -2161,7 +2174,6 @@ export type SkfTooltipProps = {
2161
2174
  * Methods that can be called to access component functionality.
2162
2175
  *
2163
2176
  * - `_handleSizeUpdate() => void`: undefined
2164
- * - `handleExpandedChange() => void`: undefined
2165
2177
  */
2166
2178
  "skf-select": Partial<SkfSelectProps & BaseProps<SkfSelect> & BaseEvents>;
2167
2179
 
@@ -203,8 +203,6 @@ type SkfDatepickerCalendarProps = {
203
203
  firstDayOfWeek?: SkfDatepickerCalendar["firstDayOfWeek"];
204
204
  /** A comma-separated list of dates (yyyy-mm-dd format) that are not selectable. */
205
205
  "invalid-dates"?: SkfDatepickerCalendar["invalidDates"];
206
- /** Sets the internal language of the component */
207
- lang?: SkfDatepickerCalendar["lang"];
208
206
  /** */
209
207
  locale?: SkfDatepickerCalendar["locale"];
210
208
  /** */
@@ -392,6 +390,8 @@ type SkfInputProps = {
392
390
  /** Indicates whether the value of the control can be automatically completed by the browser. See
393
391
  [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details. */
394
392
  autocomplete?: SkfInput["autocomplete"];
393
+ /** */
394
+ autofocus?: SkfInput["autofocus"];
395
395
  /** If defined, forces component to invalid state until removed. Its value is used as hint text. */
396
396
  "custom-invalid"?: SkfInput["customInvalid"];
397
397
  /** If true, outputs helping hints in console */
@@ -609,6 +609,8 @@ type SkfSelectProps = {
609
609
  lang?: SkfSelect["lang"];
610
610
  /** If defined, limits the number of selectable options */
611
611
  max?: SkfSelect["max"];
612
+ /** */
613
+ "max-visible-items"?: SkfSelect["maxVisibleItems"];
612
614
  /** If defined, sets the minimum number of required options */
613
615
  min?: SkfSelect["min"];
614
616
  /** If true, allows for multiple options to be selected */
@@ -338,11 +338,6 @@
338
338
  "description": "A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.",
339
339
  "values": []
340
340
  },
341
- {
342
- "name": "lang",
343
- "description": "Sets the internal language of the component",
344
- "values": [{ "name": "Language" }]
345
- },
346
341
  { "name": "locale", "values": [] },
347
342
  { "name": "range", "values": [] },
348
343
  {
@@ -720,6 +715,7 @@
720
715
  "description": "Indicates whether the value of the control can be automatically completed by the browser. See\n[MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.",
721
716
  "values": [{ "name": "HTMLInputElement['autocomplete']" }]
722
717
  },
718
+ { "name": "autofocus", "values": [] },
723
719
  {
724
720
  "name": "custom-invalid",
725
721
  "description": "If defined, forces component to invalid state until removed. Its value is used as hint text.",
@@ -1198,6 +1194,7 @@
1198
1194
  "description": "If defined, limits the number of selectable options",
1199
1195
  "values": []
1200
1196
  },
1197
+ { "name": "max-visible-items", "values": [] },
1201
1198
  {
1202
1199
  "name": "min",
1203
1200
  "description": "If defined, sets the minimum number of required options",
@@ -745,11 +745,6 @@
745
745
  "description": "A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.",
746
746
  "value": { "type": "string | undefined" }
747
747
  },
748
- {
749
- "name": "lang",
750
- "description": "Sets the internal language of the component",
751
- "value": { "type": "Language", "default": "'en'" }
752
- },
753
748
  {
754
749
  "name": "locale",
755
750
  "value": { "type": "string", "default": "'en-CA'" }
@@ -790,11 +785,6 @@
790
785
  "description": "A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.",
791
786
  "type": "string | undefined"
792
787
  },
793
- {
794
- "name": "lang",
795
- "description": "Sets the internal language of the component",
796
- "type": "Language"
797
- },
798
788
  { "name": "locale", "type": "string" },
799
789
  { "name": "range", "type": "boolean" },
800
790
  {
@@ -1583,6 +1573,10 @@
1583
1573
  "type": "HTMLInputElement['autocomplete'] | undefined"
1584
1574
  }
1585
1575
  },
1576
+ {
1577
+ "name": "autofocus",
1578
+ "value": { "type": "boolean", "default": "false" }
1579
+ },
1586
1580
  {
1587
1581
  "name": "custom-invalid",
1588
1582
  "description": "If defined, forces component to invalid state until removed. Its value is used as hint text.",
@@ -1733,6 +1727,7 @@
1733
1727
  "description": "Indicates whether the value of the control can be automatically completed by the browser. See\n[MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.",
1734
1728
  "type": "HTMLInputElement['autocomplete'] | undefined"
1735
1729
  },
1730
+ { "name": "autofocus", "type": "boolean" },
1736
1731
  {
1737
1732
  "name": "customInvalid",
1738
1733
  "description": "If defined, forces component to invalid state until removed. Its value is used as hint text."
@@ -2559,6 +2554,10 @@
2559
2554
  "description": "If defined, limits the number of selectable options",
2560
2555
  "value": { "type": "number | undefined" }
2561
2556
  },
2557
+ {
2558
+ "name": "max-visible-items",
2559
+ "value": { "type": "number | undefined" }
2560
+ },
2562
2561
  {
2563
2562
  "name": "min",
2564
2563
  "description": "If defined, sets the minimum number of required options",
@@ -2674,6 +2673,7 @@
2674
2673
  "description": "If defined, limits the number of selectable options",
2675
2674
  "type": "number | undefined"
2676
2675
  },
2676
+ { "name": "maxVisibleItems", "type": "number | undefined" },
2677
2677
  {
2678
2678
  "name": "min",
2679
2679
  "description": "If defined, sets the minimum number of required options",
package/package.json CHANGED
@@ -35,7 +35,7 @@
35
35
  "sideEffects": true,
36
36
  "type": "module",
37
37
  "types": "./dist/index.d.ts",
38
- "version": "1.0.2-beta.11",
38
+ "version": "1.0.2-beta.12",
39
39
  "dependencies": {
40
40
  "@floating-ui/dom": "^1.7.1",
41
41
  "@js-temporal/polyfill": "^0.5.1",