@skf-design-system/ui-components 1.0.2-beta.1 → 1.0.2-beta.11
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.
- package/README.md +25 -1
- package/dist/components/accordion/accordion-item.component.js +49 -38
- package/dist/components/accordion/accordion.component.d.ts +2 -2
- package/dist/components/accordion/accordion.component.js +12 -12
- package/dist/components/alert/alert.component.d.ts +8 -3
- package/dist/components/alert/alert.component.js +59 -50
- package/dist/components/alert/alert.styles.js +51 -47
- package/dist/components/breadcrumb/breadcrumb-item.component.js +30 -32
- package/dist/components/breadcrumb/breadcrumb-item.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.styles.js +16 -15
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +5 -2
- package/dist/components/breadcrumb/breadcrumb.component.js +51 -46
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.styles.js +13 -10
- package/dist/components/button/button.component.js +63 -67
- package/dist/components/button/button.styles.js +5 -4
- package/dist/components/card/card.component.d.ts +5 -0
- package/dist/components/card/card.component.js +46 -24
- package/dist/components/card/card.styles.js +31 -14
- package/dist/components/checkbox/checkbox.component.d.ts +6 -5
- package/dist/components/checkbox/checkbox.component.js +67 -69
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/{date-picker/datepicker.calendar.component.d.ts → datepicker/datepicker-calendar.component.d.ts} +8 -1
- package/dist/components/{date-picker/datepicker.calendar.component.js → datepicker/datepicker-calendar.component.js} +109 -115
- package/dist/components/datepicker/datepicker-calendar.d.ts +8 -0
- package/dist/components/datepicker/datepicker-calendar.js +6 -0
- package/dist/components/{date-picker/datepicker.component.d.ts → datepicker/datepicker-popup.component.d.ts} +9 -20
- package/dist/components/datepicker/datepicker-popup.component.js +272 -0
- package/dist/components/datepicker/datepicker-popup.d.ts +8 -0
- package/dist/components/{date-picker/datepicker.helpers.d.ts → datepicker/datepicker-popup.helpers.d.ts} +3 -3
- package/dist/components/datepicker/datepicker-popup.helpers.js +83 -0
- package/dist/components/datepicker/datepicker-popup.js +6 -0
- package/dist/components/{date-picker/datepicker.styles.js → datepicker/datepicker-popup.styles.js} +3 -3
- package/dist/components/{date-picker-input/datepicker-input.component.d.ts → datepicker/datepicker.component.d.ts} +21 -14
- package/dist/components/datepicker/datepicker.component.js +455 -0
- package/dist/components/datepicker/datepicker.d.ts +8 -0
- package/dist/components/datepicker/datepicker.js +6 -0
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +49 -49
- package/dist/components/dialog/dialog.d.ts +2 -2
- package/dist/components/divider/divider.component.d.ts +3 -0
- package/dist/components/divider/divider.component.js +43 -22
- package/dist/components/divider/divider.styles.js +9 -9
- package/dist/components/drawer/drawer.component.d.ts +12 -4
- package/dist/components/drawer/drawer.component.js +84 -61
- package/dist/components/drawer/drawer.d.ts +2 -2
- package/dist/components/drawer/drawer.styles.js +47 -40
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +64 -57
- package/dist/components/header/header.d.ts +2 -2
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/heading/heading.component.d.ts +5 -1
- package/dist/components/heading/heading.component.js +54 -27
- package/dist/components/heading/heading.styles.js +34 -36
- package/dist/components/icon/icon.component.d.ts +4 -0
- package/dist/components/icon/icon.component.js +62 -43
- package/dist/components/icon/icon.styles.js +60 -60
- package/dist/components/input/input.component.d.ts +4 -8
- package/dist/components/input/input.component.js +90 -97
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +14 -19
- package/dist/components/link/link.component.d.ts +16 -18
- package/dist/components/link/link.component.js +109 -106
- package/dist/components/link/link.styles.js +49 -45
- package/dist/components/loader/loader.component.d.ts +5 -3
- package/dist/components/loader/loader.component.js +39 -28
- package/dist/components/loader/loader.styles.js +6 -10
- package/dist/components/logo/logo.component.d.ts +4 -1
- package/dist/components/logo/logo.component.js +55 -51
- package/dist/components/logo/logo.styles.js +26 -16
- package/dist/components/menu/menu-item.component.d.ts +1 -1
- package/dist/components/menu/menu-item.component.js +8 -8
- package/dist/components/menu/menu-item.d.ts +2 -2
- package/dist/components/menu/menu-item.styles.js +13 -9
- package/dist/components/menu/menu.component.d.ts +5 -2
- package/dist/components/menu/menu.component.js +8 -8
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/nav/nav-item.component.d.ts +6 -2
- package/dist/components/nav/nav-item.component.js +44 -25
- package/dist/components/nav/nav-item.styles.js +29 -25
- package/dist/components/nav/nav.component.d.ts +9 -0
- package/dist/components/nav/nav.component.js +47 -21
- package/dist/components/nav/nav.d.ts +2 -2
- package/dist/components/nav/nav.styles.js +15 -9
- package/dist/components/popover/popover.component.d.ts +10 -3
- package/dist/components/popover/popover.component.js +30 -22
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/progress/progress.component.d.ts +2 -0
- package/dist/components/progress/progress.component.js +38 -29
- package/dist/components/progress/progress.d.ts +2 -2
- package/dist/components/progress/progress.styles.js +10 -8
- package/dist/components/radio/radio.component.d.ts +4 -2
- package/dist/components/radio/radio.component.js +96 -91
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.d.ts +2 -2
- package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button.component.js +22 -24
- package/dist/components/segmented-button/segmented-button.d.ts +2 -2
- package/dist/components/select/select-option-group.component.d.ts +4 -0
- package/dist/components/select/select-option-group.component.js +37 -18
- package/dist/components/select/select-option-group.d.ts +2 -2
- package/dist/components/select/select-option-group.style.js +12 -6
- package/dist/components/select/select-option.component.d.ts +9 -4
- package/dist/components/select/select-option.component.js +70 -58
- package/dist/components/select/select-option.styles.js +43 -31
- package/dist/components/select/select.component.d.ts +21 -12
- package/dist/components/select/select.component.js +125 -87
- package/dist/components/select/select.controllers.js +15 -20
- package/dist/components/select/select.styles.js +8 -2
- package/dist/components/stepper/stepper-item.component.d.ts +1 -1
- package/dist/components/stepper/stepper-item.component.js +59 -56
- package/dist/components/stepper/stepper-item.d.ts +2 -2
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/stepper/stepper.component.js +2 -3
- package/dist/components/stepper/stepper.d.ts +2 -2
- package/dist/components/stepper/stepper.helpers.js +6 -7
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -58
- package/dist/components/switch/switch.d.ts +2 -2
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/{tab-panel → tabs}/tab-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +39 -0
- package/dist/components/{tab-panel → tabs}/tab-panel.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.component.d.ts +3 -3
- package/dist/components/{tab → tabs}/tab.component.js +17 -14
- package/dist/components/{tab → tabs}/tab.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.styles.js +2 -2
- package/dist/components/{tab-group/tab-group.component.d.ts → tabs/tabs.component.d.ts} +3 -4
- package/dist/components/{tab-group/tab-group.component.js → tabs/tabs.component.js} +35 -36
- package/dist/components/tabs/tabs.d.ts +8 -0
- package/dist/components/tabs/tabs.js +6 -0
- package/dist/components/{tab-group/tab-group.styles.js → tabs/tabs.styles.js} +16 -16
- package/dist/components/tag/tag.component.d.ts +10 -2
- package/dist/components/tag/tag.component.js +77 -65
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.styles.js +63 -50
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +102 -95
- package/dist/components/toast/toast-item.styles.js +13 -10
- package/dist/components/toast/toast.component.js +9 -9
- package/dist/components/toast/toast.singleton.d.ts +1 -1
- package/dist/components/toast/toast.singleton.js +19 -20
- package/dist/components/tooltip/tooltip.component.d.ts +9 -2
- package/dist/components/tooltip/tooltip.component.js +15 -11
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/custom-elements.json +1699 -1112
- package/dist/index.d.ts +8 -7
- package/dist/index.js +96 -93
- package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
- package/dist/internal/base-classes/popover/popover.base.js +41 -44
- package/dist/internal/base-classes/popover/popover.styles.js +4 -5
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -19
- package/dist/internal/components/hint/hint.component.d.ts +4 -0
- package/dist/internal/components/hint/hint.component.js +47 -20
- package/dist/internal/components/hint/hint.styles.js +29 -25
- package/dist/internal/components/skf-element.d.ts +1 -3
- package/dist/internal/components/skf-element.js +4 -9
- package/dist/internal/controllers/popover.controller.d.ts +2 -0
- package/dist/internal/controllers/popover.controller.js +11 -14
- package/dist/internal/helpers/stateMap.d.ts +14 -0
- package/dist/internal/helpers/stateMap.js +68 -0
- package/dist/internal/helpers/uuid.d.ts +8 -10
- package/dist/internal/helpers/uuid.js +4 -11
- package/dist/internal/helpers/watch.d.ts +1 -1
- package/dist/internal/helpers/watch.js +12 -12
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +4 -4
- package/dist/internal/types.d.ts +4 -0
- package/dist/styles/component.styles.js +37 -36
- package/dist/styles/global-alt.css +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +27 -0
- package/dist/translations/es.d.ts +3 -0
- package/dist/translations/es.js +27 -0
- package/dist/translations/index.d.ts +4 -0
- package/dist/translations/pt.d.ts +3 -0
- package/dist/translations/pt.js +27 -0
- package/dist/translations/sv.d.ts +3 -0
- package/dist/translations/sv.js +27 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +1990 -866
- package/dist/types/vue/index.d.ts +220 -169
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +265 -188
- package/dist/web-types.json +731 -548
- package/package.json +39 -51
- package/dist/components/accordion/accordion-item.test.d.ts +0 -1
- package/dist/components/accordion/accordion.test.d.ts +0 -1
- package/dist/components/checkbox/checkbox.test.d.ts +0 -1
- package/dist/components/date-picker/datepicker.component.js +0 -261
- package/dist/components/date-picker/datepicker.d.ts +0 -10
- package/dist/components/date-picker/datepicker.helpers.js +0 -76
- package/dist/components/date-picker/datepicker.js +0 -8
- package/dist/components/date-picker-input/datepicker-input.component.js +0 -442
- package/dist/components/date-picker-input/datepicker-input.d.ts +0 -8
- package/dist/components/date-picker-input/datepicker-input.js +0 -6
- package/dist/components/input/input.test.d.ts +0 -1
- package/dist/components/radio/radio.test.d.ts +0 -1
- package/dist/components/switch/switch.test.d.ts +0 -1
- package/dist/components/tab-group/tab-group.d.ts +0 -8
- package/dist/components/tab-group/tab-group.js +0 -6
- package/dist/components/tab-panel/tab-panel.component.js +0 -36
- package/dist/internal/playwright/index.d.ts +0 -1
- /package/dist/components/{date-picker/datepicker.calendar.styles.d.ts → datepicker/datepicker-calendar.styles.d.ts} +0 -0
- /package/dist/components/{date-picker/datepicker.calendar.styles.js → datepicker/datepicker-calendar.styles.js} +0 -0
- /package/dist/components/{date-picker/datepicker.styles.d.ts → datepicker/datepicker-popup.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.d.ts → datepicker/datepicker.helpers.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.js → datepicker/datepicker.helpers.js} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.d.ts → datepicker/datepicker.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.js → datepicker/datepicker.styles.js} +0 -0
- /package/dist/components/select/{select.stories.icons.d.ts → stories/select.stories.icons.d.ts} +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.js +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.d.ts +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.js +0 -0
- /package/dist/components/{tab → tabs}/tab.js +0 -0
- /package/dist/components/{tab → tabs}/tab.styles.d.ts +0 -0
- /package/dist/components/{tab-group/tab-group.styles.d.ts → tabs/tabs.styles.d.ts} +0 -0
@@ -1,442 +0,0 @@
|
|
1
|
-
import { dateFormatter as v, is as f, isPopoverOpen as S, debounce as E } from "./datepicker-input.helpers.js";
|
2
|
-
import "../icon/icon.js";
|
3
|
-
import { computePosition as C, flip as I, offset as O } from "@floating-ui/dom";
|
4
|
-
import { FormBase as M } from "../../internal/components/formBase.js";
|
5
|
-
import "../../internal/components/hint/hint.js";
|
6
|
-
import { PopoverController as P } from "../../internal/controllers/popover.controller.js";
|
7
|
-
import { hintSeverity as T } from "../../internal/helpers/hintSeverity.js";
|
8
|
-
import { watch as B } from "../../internal/helpers/watch.js";
|
9
|
-
import { Asterisk as x } from "../../internal/templates/asterisk.js";
|
10
|
-
import { Temporal as w } from "@js-temporal/polyfill";
|
11
|
-
import { componentStyles as L } from "../../styles/component.styles.js";
|
12
|
-
import { nothing as g, html as y } from "lit";
|
13
|
-
import { property as h, state as $, query as b, queryAssignedNodes as R } from "lit/decorators.js";
|
14
|
-
import { ifDefined as p } from "lit/directives/if-defined.js";
|
15
|
-
import { live as F } from "lit/directives/live.js";
|
16
|
-
import "../date-picker/datepicker.js";
|
17
|
-
import { styles as A } from "./datepicker-input.styles.js";
|
18
|
-
var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, r = (D, e, t, a) => {
|
19
|
-
for (var l = a > 1 ? void 0 : a ? q(e, t) : e, n = D.length - 1, d; n >= 0; n--)
|
20
|
-
(d = D[n]) && (l = (a ? d(e, t, l) : d(l)) || l);
|
21
|
-
return a && l && j(e, t, l), l;
|
22
|
-
};
|
23
|
-
const _ = class _ extends M {
|
24
|
-
constructor() {
|
25
|
-
super(), this.popoverController = new P(this), this.id = "skf-datepicker-input", this.placeholder = "YYYY-MM-DD", this.range = !1, this.size = "md", this.validateOn = "change", this.invalid = !1, this.selectedRangeDates = { start: null, end: null }, this.showClearbutton = !1, this.abortController = new AbortController(), this.abortSignal = this.abortController.signal, this._handleSelectedDate = () => {
|
26
|
-
this.pristine = !1, this._internals.setFormValue(this.value ?? ""), this.validateInput();
|
27
|
-
}, this._handleDateSelected = (e) => {
|
28
|
-
if (this.range && "start" in e.detail.date && "end" in e.detail.date) {
|
29
|
-
const t = e.detail.date.start, a = e.detail.date.end;
|
30
|
-
this.value = `${v(t)},${v(a)}`, this.selectedRangeDates = { start: t, end: a };
|
31
|
-
} else !this.range && e.detail.date instanceof Date && (this.value = v(e.detail.date), this._animatePopover({ el: this.$popover, show: !1 }).then(() => {
|
32
|
-
this.$popover.hidePopover();
|
33
|
-
}));
|
34
|
-
}, this._handleKeyboardEvents = (e) => {
|
35
|
-
var a, l;
|
36
|
-
const t = e.target.closest("input");
|
37
|
-
if (t) {
|
38
|
-
if ((t.selectionStart ?? 0) < t.value.length && /[[0-9-]/.test(e.key)) {
|
39
|
-
const n = t.selectionStart ?? 0, u = t.value.split("").slice(0, n);
|
40
|
-
t.value = u.join("");
|
41
|
-
}
|
42
|
-
if (t.name.endsWith("-end") && (e.key === "Backspace" && t.value.length === 0 || t.selectionStart === 0 && e.key === "ArrowLeft") && (e.preventDefault(), this.$input.focus()), e.key === "Tab" && !e.shiftKey && t.name.endsWith("-end")) {
|
43
|
-
e.preventDefault();
|
44
|
-
const d = (a = this.$popover.childNodes[1].shadowRoot) == null ? void 0 : a.querySelector("skf-datepicker-calendar"), u = (l = d == null ? void 0 : d.shadowRoot) == null ? void 0 : l.querySelector("button");
|
45
|
-
u == null || u.focus();
|
46
|
-
}
|
47
|
-
if ((t.value.length === 4 || t.value.length === 7) && /[[0-9]/.test(e.key) && (t.value = `${t.value}-${e.key}`, e.preventDefault()), e.key === "Escape")
|
48
|
-
if (t.blur(), this.$popover.hidePopover(), this.range) {
|
49
|
-
const n = this.$input.value, d = this.$input_range_end.value;
|
50
|
-
if (!f(n, d).date()) return;
|
51
|
-
this.$datepicker.selectedDateRange = {
|
52
|
-
start: new Date(n),
|
53
|
-
end: new Date(d)
|
54
|
-
}, this.$datepicker.emit("selected-date-changed", {
|
55
|
-
detail: { date: new Date(n) }
|
56
|
-
});
|
57
|
-
} else {
|
58
|
-
if (!t.value || !f(t.value).date()) return;
|
59
|
-
this.$datepicker.emit("selected-date-changed", {
|
60
|
-
detail: { date: new Date(t.value) }
|
61
|
-
});
|
62
|
-
}
|
63
|
-
e.key === "Enter" && (t.blur(), this.$popover.hidePopover());
|
64
|
-
}
|
65
|
-
}, this._handleFocus = () => {
|
66
|
-
this.showPopover();
|
67
|
-
}, this.showPopover = () => {
|
68
|
-
if (S(this.$popover)) return;
|
69
|
-
E(() => {
|
70
|
-
this.$popover.showPopover(), this._animatePopover({ show: !0 });
|
71
|
-
}, 200)(), this.addEventListener("focusout", this.hidePopover, { once: !0, signal: this.abortSignal });
|
72
|
-
}, this.hidePopover = () => {
|
73
|
-
var t;
|
74
|
-
this.removeEventListener("focusout", this.hidePopover), ((t = document.activeElement) == null ? void 0 : t.closest("skf-datepicker-input")) !== this && this.$popover.hidePopover();
|
75
|
-
}, this._handleBlur = (e) => {
|
76
|
-
!e.target.name.endsWith("-end") && this.range;
|
77
|
-
}, this._handleClose = () => {
|
78
|
-
this.$anchor.blur();
|
79
|
-
}, this.clearInput = () => {
|
80
|
-
this.value = "", this.$datepicker.clearSelection();
|
81
|
-
}, this.clear = () => {
|
82
|
-
this.clearInput(), this._toggleClearButton(!1);
|
83
|
-
}, this._handleInput = (e) => {
|
84
|
-
const t = e.target, a = String(t.value).replace(/[^0-9-]/g, "");
|
85
|
-
if (t.value = a, t.setCustomValidity(this.customError ?? ""), !!f(t.value).ISO()) {
|
86
|
-
if (this.focusTimeoutId && clearTimeout(this.focusTimeoutId), this.$datepicker.date = t.value, this.range) {
|
87
|
-
this.$datepicker.selectedDateRange = {
|
88
|
-
start: f(this.$input.value).ISO() ? new Date(this.$input.value) : null,
|
89
|
-
end: f(this.$input_range_end.value).ISO() ? new Date(this.$input_range_end.value) : null
|
90
|
-
};
|
91
|
-
const l = Object.values(this.$datepicker.selectedDateRange).filter(Boolean).map((n) => new Date(n).toLocaleDateString("en-CA")).join();
|
92
|
-
this.value = l, f(this.$input.value).ISO() && (this.focusTimeoutId = setTimeout(() => {
|
93
|
-
this.$input_range_end.focus();
|
94
|
-
}, 200));
|
95
|
-
} else
|
96
|
-
this.$datepicker.selectedDate = new Date(t.value), this.$datepicker.emit("selected-date-changed", {
|
97
|
-
detail: { date: new Date(t.value) }
|
98
|
-
});
|
99
|
-
this.validateOn === "input" && (this._pristine = !1, this.validateInput());
|
100
|
-
}
|
101
|
-
}, this._toggleClearButton = (e = !1) => {
|
102
|
-
this.showClearbutton = e;
|
103
|
-
}, this.reposition = async () => {
|
104
|
-
const { x: e, y: t } = await C(this.$anchor, this.$popover, {
|
105
|
-
placement: "bottom-start",
|
106
|
-
middleware: [I(), O(0)],
|
107
|
-
strategy: "fixed"
|
108
|
-
});
|
109
|
-
Object.assign(this.$popover.style, {
|
110
|
-
left: `${String(e)}px`,
|
111
|
-
top: `${String(t)}px`
|
112
|
-
});
|
113
|
-
}, this.addEventListener("skf-datepicker-selected", this._handleDateSelected), this.addEventListener("reset", () => {
|
114
|
-
this.clearInput(), this.validateInput();
|
115
|
-
});
|
116
|
-
}
|
117
|
-
set customInvalid(e) {
|
118
|
-
this.customError = e ?? "";
|
119
|
-
}
|
120
|
-
get customInvalid() {
|
121
|
-
return this.customError;
|
122
|
-
}
|
123
|
-
connectedCallback() {
|
124
|
-
var e;
|
125
|
-
super.connectedCallback(), this._init_date = (e = this.value) == null ? void 0 : e.split(",")[0], this.addEventListener("selected-date-changed", this._handleSelectedDate);
|
126
|
-
}
|
127
|
-
disconnectedCallback() {
|
128
|
-
super.disconnectedCallback(), this.abortController.abort();
|
129
|
-
}
|
130
|
-
firstUpdated() {
|
131
|
-
var e;
|
132
|
-
this.$datepicker.date = this._init_date ? w.PlainDate.from(this._init_date).toString() : w.Now.plainDateISO().toString(), this.range ? this.$datepicker.selectedDateRange = {
|
133
|
-
start: this._init_date ? new Date(this._init_date) : null,
|
134
|
-
end: (e = this.value) != null && e.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
135
|
-
} : this.$datepicker.selectedDate = this._init_date ? new Date(this._init_date) : void 0, this.hint && !this.hasAttribute("hint") && this.setAttribute("hint", this.hint), this.validateInput();
|
136
|
-
}
|
137
|
-
attributeChangedCallback(e, t, a) {
|
138
|
-
if (super.attributeChangedCallback(e, t, a), e === "custom-invalid")
|
139
|
-
if (typeof a == "string") {
|
140
|
-
const n = this.withFallback(a);
|
141
|
-
this._pristine = !1, this._internals.setValidity({ customError: !0 }, n), this.invalid = !0, this.hint = n, this.checkValidity();
|
142
|
-
} else
|
143
|
-
this._internals.setValidity({}), this.validateInput();
|
144
|
-
}
|
145
|
-
_handleValueChange() {
|
146
|
-
var e, t, a, l, n, d, u, i;
|
147
|
-
(e = this.value) != null && e.trim() || this.$datepicker.clearSelection(), this._internals.setFormValue(this.value ?? ""), this.validateInput(), this._pristine = !1, this.$input.value = v((t = this.value) == null ? void 0 : t.split(",")[0]), this.range ? (this.$datepicker.selectedDateRange = {
|
148
|
-
start: (n = this.value) != null && n.split(",")[0] ? new Date(this.value.split(",")[0]) : null,
|
149
|
-
end: (d = this.value) != null && d.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
150
|
-
}, this.$input_range_end.value = v((u = this.value) == null ? void 0 : u.split(",")[1]), this.$datepicker.date = ((i = this.value) == null ? void 0 : i.split(",")[0]) ?? "") : (this.$datepicker.selectedDate = (a = this.value) != null && a.split(",")[0] ? new Date(this.value.split(",")[0]) : void 0, this.$datepicker.date = ((l = this.value) == null ? void 0 : l.split(",")[0]) ?? ""), this.validateInput();
|
151
|
-
}
|
152
|
-
/** @internal */
|
153
|
-
async _animatePopover({ el: e = this.$popover, show: t }) {
|
154
|
-
return t && (e.style.opacity = "0", e.style.transform = "scaleY(0.5)"), new Promise((a) => {
|
155
|
-
const l = [
|
156
|
-
{ opacity: 0, transform: "scaleY(0.5)" },
|
157
|
-
{ opacity: 1, transform: "scaleY(1)" }
|
158
|
-
], n = t ? l : l.reverse();
|
159
|
-
setTimeout(
|
160
|
-
() => {
|
161
|
-
e.style.transformOrigin = "top";
|
162
|
-
const d = this.$popover.animate(n, {
|
163
|
-
duration: 100,
|
164
|
-
easing: "linear",
|
165
|
-
fill: "both"
|
166
|
-
});
|
167
|
-
d.onfinish = () => {
|
168
|
-
a();
|
169
|
-
};
|
170
|
-
},
|
171
|
-
t ? 0 : 50
|
172
|
-
);
|
173
|
-
});
|
174
|
-
}
|
175
|
-
/** @internal consider sharing this functionality with input */
|
176
|
-
validateInput() {
|
177
|
-
if (this._internals.validity.customError) return;
|
178
|
-
let t = JSON.parse(JSON.stringify(this._internals.validity)), a = {};
|
179
|
-
if (this.selectableFrom) {
|
180
|
-
const { validityFragment: i, errorMessageFragment: o } = l(this);
|
181
|
-
t = { ...t, ...i }, a = { ...a, ...o };
|
182
|
-
}
|
183
|
-
if (this.selectableTo) {
|
184
|
-
const { validityFragment: i, errorMessageFragment: o } = n(this);
|
185
|
-
t = { ...t, ...i }, a = { ...a, ...o };
|
186
|
-
}
|
187
|
-
if (this.range) {
|
188
|
-
const { validityFragment: i, errorMessageFragment: o } = d(this);
|
189
|
-
t = { ...t, ...i }, a = { ...a, ...o };
|
190
|
-
}
|
191
|
-
if (this.required) {
|
192
|
-
const { validityFragment: i, errorMessageFragment: o } = u(this);
|
193
|
-
t = { ...t, ...i }, a = { ...a, ...o };
|
194
|
-
}
|
195
|
-
if (t.valid = !Object.values(t).some((i) => i), this.invalid = !1, t.valid)
|
196
|
-
this._internals.setValidity({ customError: this._internals.validity.customError }), this.hint = this.getAttribute("hint") ?? "";
|
197
|
-
else {
|
198
|
-
this.invalid = !this._pristine && !t.valid;
|
199
|
-
let i;
|
200
|
-
for (i in t) {
|
201
|
-
const o = `data-${i.toString()}`;
|
202
|
-
if (t[i]) {
|
203
|
-
this.validationError = i.toString();
|
204
|
-
const c = this.hasAttribute(o) ? this.getAttribute(o) : a[i];
|
205
|
-
this._internals.setValidity(
|
206
|
-
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
207
|
-
this.withFallback(c)
|
208
|
-
), c && !this._pristine && (this.hint = c), this.invalid && this.customErrorDisplay && this.checkValidity();
|
209
|
-
}
|
210
|
-
}
|
211
|
-
}
|
212
|
-
function l(i) {
|
213
|
-
const o = { validityFragment: {}, errorMessageFragment: {} };
|
214
|
-
if (!i.selectableFrom) return o;
|
215
|
-
const c = new Date(i.selectableFrom);
|
216
|
-
if (new Date(i.$input.value) < c) {
|
217
|
-
const m = i.getAttribute("data-rangeunderflow") ?? `Date is out of range. Earliest selectable date is ${i.selectableFrom}.`;
|
218
|
-
return {
|
219
|
-
validityFragment: { rangeUnderflow: !0, valid: !1 },
|
220
|
-
errorMessageFragment: { rangeUnderflow: m }
|
221
|
-
};
|
222
|
-
}
|
223
|
-
return o;
|
224
|
-
}
|
225
|
-
function n(i) {
|
226
|
-
const o = { validityFragment: {}, errorMessageFragment: {} };
|
227
|
-
if (!i.selectableTo) return o;
|
228
|
-
const c = new Date(i.selectableTo);
|
229
|
-
if (new Date(i.$input.value) > c) {
|
230
|
-
const m = i.getAttribute("data-rangeoverflow") ?? `Date is out of range. Latest selectable date is ${i.selectableTo}.`;
|
231
|
-
return {
|
232
|
-
validityFragment: { rangeOverflow: !0, valid: !1 },
|
233
|
-
errorMessageFragment: { rangeOverflow: m }
|
234
|
-
};
|
235
|
-
}
|
236
|
-
return o;
|
237
|
-
}
|
238
|
-
function d(i) {
|
239
|
-
const o = { validityFragment: {}, errorMessageFragment: {} }, c = new Date(i.$input.value);
|
240
|
-
if (new Date(i.$input_range_end.value) < c) {
|
241
|
-
const m = i.getAttribute("data-rangeunderflow") ?? "End date cannot be before start date";
|
242
|
-
return {
|
243
|
-
validityFragment: { rangeUnderflow: !0, valid: !1 },
|
244
|
-
errorMessageFragment: { rangeUnderflow: m }
|
245
|
-
};
|
246
|
-
}
|
247
|
-
return o;
|
248
|
-
}
|
249
|
-
function u(i) {
|
250
|
-
const o = { validityFragment: {}, errorMessageFragment: {} };
|
251
|
-
return !i.$input.value || i.range && !i.$input_range_end.value ? {
|
252
|
-
validityFragment: { valueMissing: !0, valid: !1 },
|
253
|
-
errorMessageFragment: { valueMissing: "This field is required" }
|
254
|
-
} : o;
|
255
|
-
}
|
256
|
-
}
|
257
|
-
render() {
|
258
|
-
var t, a, l, n, d, u, i, o;
|
259
|
-
const e = (this._defaultSlot.length === 0 || !((a = (t = this._defaultSlot[0]) == null ? void 0 : t.textContent) != null && a.trim())) && !this.label;
|
260
|
-
return y`
|
261
|
-
<div
|
262
|
-
id="root"
|
263
|
-
@mouseenter=${() => {
|
264
|
-
this.value && this._toggleClearButton(!0);
|
265
|
-
}}
|
266
|
-
@mouseleave=${() => {
|
267
|
-
this._toggleClearButton(!1);
|
268
|
-
}}
|
269
|
-
>
|
270
|
-
<label>
|
271
|
-
<div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${e} id="label">
|
272
|
-
<slot>${this.label}</slot>
|
273
|
-
${this.required ? x(this.requiredLabel) : null}
|
274
|
-
</div>
|
275
|
-
<div id="input">
|
276
|
-
<input
|
277
|
-
?disabled=${this.disabled}
|
278
|
-
?readonly=${this.readonly}
|
279
|
-
.value=${F(
|
280
|
-
this.range ? v((l = this.value) == null ? void 0 : l.split(",")[0]) : v(this.value)
|
281
|
-
)}
|
282
|
-
@blur=${this._handleBlur}
|
283
|
-
@click=${this._handleFocus}
|
284
|
-
@focus=${this._handleFocus}
|
285
|
-
@input=${this._handleInput}
|
286
|
-
@keydown=${this._handleKeyboardEvents}
|
287
|
-
aria-describedby=${p((n = this.hint) != null && n.trim() ? "hint" : g)}
|
288
|
-
aria-errormessage=${p((d = this.hint) != null && d.trim() ? "hint" : g)}
|
289
|
-
aria-invalid=${!!this.invalid}
|
290
|
-
autocomplete="off"
|
291
|
-
data-testid="field-input"
|
292
|
-
inputmode=${p(this.inputMode)}
|
293
|
-
maxlength="10"
|
294
|
-
name=${this.name ?? "calendar"}
|
295
|
-
placeholder=${p(this.placeholder)}
|
296
|
-
type="text"
|
297
|
-
/>
|
298
|
-
${this.range ? y`
|
299
|
-
<skf-icon name="arrowRight"></skf-icon>
|
300
|
-
<input
|
301
|
-
?disabled=${this.disabled}
|
302
|
-
?readonly=${this.readonly}
|
303
|
-
.value=${F(v((u = this.value) == null ? void 0 : u.split(",")[1]))}
|
304
|
-
@blur=${this._handleBlur}
|
305
|
-
@click=${this._handleFocus}
|
306
|
-
@focus=${this._handleFocus}
|
307
|
-
@input=${this._handleInput}
|
308
|
-
@keydown=${this._handleKeyboardEvents}
|
309
|
-
aria-describedby=${p((i = this.hint) != null && i.trim() ? "hint" : g)}
|
310
|
-
aria-errormessage=${p((o = this.hint) != null && o.trim() ? "hint" : g)}
|
311
|
-
aria-invalid=${!!this.invalid}
|
312
|
-
autocomplete="off"
|
313
|
-
data-testid="field-input-range-end"
|
314
|
-
inputmode=${p(this.inputMode)}
|
315
|
-
maxlength="10"
|
316
|
-
name=${(this.name ?? "calendar") + "-end"}
|
317
|
-
placeholder=${p(this.placeholder)}
|
318
|
-
type="text"
|
319
|
-
/>
|
320
|
-
` : g}
|
321
|
-
${this.showClearbutton ? y`
|
322
|
-
<button class="password skf-icon-host" type="button" @click=${this.clear}>
|
323
|
-
<skf-icon name="close" size="sm"></skf-icon>
|
324
|
-
</button>
|
325
|
-
` : y`
|
326
|
-
<button class="password skf-icon-host" type="button">
|
327
|
-
<skf-icon name="calendarMonth" size="sm"></skf-icon>
|
328
|
-
</button>
|
329
|
-
`}
|
330
|
-
</div>
|
331
|
-
</label>
|
332
|
-
${this.hint && y`
|
333
|
-
<skf-hint
|
334
|
-
aria-live=${this.invalid ? "assertive" : "polite"}
|
335
|
-
id="hint"
|
336
|
-
severity=${p(T(this.invalid, this.severity))}
|
337
|
-
>${this.customInvalid ?? this.hint}
|
338
|
-
</skf-hint>
|
339
|
-
`}
|
340
|
-
</div>
|
341
|
-
|
342
|
-
<div id="popover" popover @close=${this._handleClose}>
|
343
|
-
<skf-datepicker
|
344
|
-
?range=${this.range}
|
345
|
-
id=${this.id}
|
346
|
-
invalid-dates=${p(this.invalidDates)}
|
347
|
-
selectable-from=${p(this.selectableFrom)}
|
348
|
-
selectable-to=${p(this.selectableTo)}
|
349
|
-
></skf-datepicker>
|
350
|
-
</div>
|
351
|
-
`;
|
352
|
-
}
|
353
|
-
};
|
354
|
-
_.styles = [L, A];
|
355
|
-
let s = _;
|
356
|
-
r([
|
357
|
-
h({ attribute: "custom-invalid", reflect: !0 })
|
358
|
-
], s.prototype, "customInvalid", 1);
|
359
|
-
r([
|
360
|
-
h({ type: String })
|
361
|
-
], s.prototype, "id", 2);
|
362
|
-
r([
|
363
|
-
h()
|
364
|
-
], s.prototype, "label", 2);
|
365
|
-
r([
|
366
|
-
h({ type: Boolean, attribute: "hide-label" })
|
367
|
-
], s.prototype, "hideLabel", 2);
|
368
|
-
r([
|
369
|
-
h()
|
370
|
-
], s.prototype, "hint", 2);
|
371
|
-
r([
|
372
|
-
h({ attribute: "invalid-dates" })
|
373
|
-
], s.prototype, "invalidDates", 2);
|
374
|
-
r([
|
375
|
-
h({ reflect: !0 })
|
376
|
-
], s.prototype, "name", 2);
|
377
|
-
r([
|
378
|
-
h()
|
379
|
-
], s.prototype, "placeholder", 2);
|
380
|
-
r([
|
381
|
-
h({ type: Boolean })
|
382
|
-
], s.prototype, "range", 2);
|
383
|
-
r([
|
384
|
-
h({ type: Boolean })
|
385
|
-
], s.prototype, "readonly", 2);
|
386
|
-
r([
|
387
|
-
h({ attribute: "required-label" })
|
388
|
-
], s.prototype, "requiredLabel", 2);
|
389
|
-
r([
|
390
|
-
h({ attribute: "selectable-from" })
|
391
|
-
], s.prototype, "selectableFrom", 2);
|
392
|
-
r([
|
393
|
-
h({ attribute: "selectable-to" })
|
394
|
-
], s.prototype, "selectableTo", 2);
|
395
|
-
r([
|
396
|
-
h({ reflect: !0 })
|
397
|
-
], s.prototype, "severity", 2);
|
398
|
-
r([
|
399
|
-
h({ reflect: !0 })
|
400
|
-
], s.prototype, "size", 2);
|
401
|
-
r([
|
402
|
-
h({ type: String, attribute: "validate-on" })
|
403
|
-
], s.prototype, "validateOn", 2);
|
404
|
-
r([
|
405
|
-
h()
|
406
|
-
], s.prototype, "value", 2);
|
407
|
-
r([
|
408
|
-
$()
|
409
|
-
], s.prototype, "_init_date", 2);
|
410
|
-
r([
|
411
|
-
h({ type: Boolean, reflect: !0 })
|
412
|
-
], s.prototype, "invalid", 2);
|
413
|
-
r([
|
414
|
-
$()
|
415
|
-
], s.prototype, "selectedRangeDates", 2);
|
416
|
-
r([
|
417
|
-
$()
|
418
|
-
], s.prototype, "showClearbutton", 2);
|
419
|
-
r([
|
420
|
-
b("#popover")
|
421
|
-
], s.prototype, "$popover", 2);
|
422
|
-
r([
|
423
|
-
b("#input")
|
424
|
-
], s.prototype, "$anchor", 2);
|
425
|
-
r([
|
426
|
-
b('input[data-testid="field-input"]')
|
427
|
-
], s.prototype, "$input", 2);
|
428
|
-
r([
|
429
|
-
b('input[data-testid="field-input-range-end"]')
|
430
|
-
], s.prototype, "$input_range_end", 2);
|
431
|
-
r([
|
432
|
-
b("skf-datepicker")
|
433
|
-
], s.prototype, "$datepicker", 2);
|
434
|
-
r([
|
435
|
-
R({ flatten: !0 })
|
436
|
-
], s.prototype, "_defaultSlot", 2);
|
437
|
-
r([
|
438
|
-
B("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
439
|
-
], s.prototype, "_handleValueChange", 1);
|
440
|
-
export {
|
441
|
-
s as SkfDatePickerInput
|
442
|
-
};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { SkfDatePickerInput } from './datepicker-input.component.js';
|
2
|
-
export * from './datepicker-input.component.js';
|
3
|
-
export default SkfDatePickerInput;
|
4
|
-
declare global {
|
5
|
-
interface HTMLElementTagNameMap {
|
6
|
-
'skf-datepicker-input': SkfDatePickerInput;
|
7
|
-
}
|
8
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { SkfElement as c } from "../../internal/components/skf-element.js";
|
2
|
-
import { watch as h } from "../../internal/helpers/watch.js";
|
3
|
-
import { componentStyles as l } from "../../styles/component.styles.js";
|
4
|
-
import { html as v } from "lit";
|
5
|
-
import { property as f, state as d } from "lit/decorators.js";
|
6
|
-
import { styles as y } from "./tab-panel.styles.js";
|
7
|
-
var u = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, a = (n, r, s, o) => {
|
8
|
-
for (var t = o > 1 ? void 0 : o ? _(r, s) : r, i = n.length - 1, p; i >= 0; i--)
|
9
|
-
(p = n[i]) && (t = (o ? p(r, s, t) : p(t)) || t);
|
10
|
-
return o && t && u(r, s, t), t;
|
11
|
-
};
|
12
|
-
const m = class m extends c {
|
13
|
-
constructor() {
|
14
|
-
super(), this.name = "", this.active = !1, this.role = "tabpanel";
|
15
|
-
}
|
16
|
-
handleActiveChanged() {
|
17
|
-
this.ariaHidden = this.active ? "false" : "true", this.tabIndex = this.active ? 0 : -1;
|
18
|
-
}
|
19
|
-
render() {
|
20
|
-
return v`<slot></slot>`;
|
21
|
-
}
|
22
|
-
};
|
23
|
-
m.styles = [l, y];
|
24
|
-
let e = m;
|
25
|
-
a([
|
26
|
-
f()
|
27
|
-
], e.prototype, "name", 2);
|
28
|
-
a([
|
29
|
-
d()
|
30
|
-
], e.prototype, "active", 2);
|
31
|
-
a([
|
32
|
-
h("active")
|
33
|
-
], e.prototype, "handleActiveChanged", 1);
|
34
|
-
export {
|
35
|
-
e as SkfTabPanel
|
36
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function fixture(id: string, name: string): string;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/dist/components/select/{select.stories.icons.d.ts → stories/select.stories.icons.d.ts}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|