@skf-design-system/ui-components 1.0.1-beta.0 → 1.0.1-beta.1
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/dist/components/accordion/accordion.component.js +3 -3
- package/dist/components/alert/alert.component.js +8 -8
- package/dist/components/button/button.component.d.ts +3 -3
- package/dist/components/button/button.component.js +59 -55
- package/dist/components/card/card.component.js +4 -4
- package/dist/components/checkbox/checkbox.component.d.ts +3 -1
- package/dist/components/checkbox/checkbox.component.js +69 -56
- package/dist/components/date-picker/datepicker.calendar.component.d.ts +72 -0
- package/dist/components/date-picker/datepicker.calendar.component.js +382 -0
- package/dist/components/date-picker/datepicker.calendar.styles.d.ts +1 -0
- package/dist/components/date-picker/datepicker.calendar.styles.js +192 -0
- package/dist/components/date-picker/datepicker.component.d.ts +74 -0
- package/dist/components/date-picker/datepicker.component.js +241 -0
- package/dist/components/date-picker/datepicker.d.ts +10 -0
- package/dist/components/date-picker/datepicker.helpers.d.ts +40 -0
- package/dist/components/date-picker/datepicker.helpers.js +69 -0
- package/dist/components/date-picker/datepicker.js +8 -0
- package/dist/components/date-picker/datepicker.styles.d.ts +1 -0
- package/dist/components/date-picker/datepicker.styles.js +99 -0
- package/dist/components/date-picker-input/datepicker-input.component.d.ts +107 -0
- package/dist/components/date-picker-input/datepicker-input.component.js +397 -0
- package/dist/components/date-picker-input/datepicker-input.d.ts +8 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.d.ts +4 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.js +29 -0
- package/dist/components/date-picker-input/datepicker-input.js +6 -0
- package/dist/components/date-picker-input/datepicker-input.styles.d.ts +1 -0
- package/dist/components/date-picker-input/datepicker-input.styles.js +22 -0
- package/dist/components/dialog/dialog.component.js +19 -19
- package/dist/components/divider/divider.component.js +12 -12
- package/dist/components/heading/heading.component.js +13 -13
- package/dist/components/icon/icon.component.js +19 -19
- package/dist/components/input/input.component.d.ts +1 -0
- package/dist/components/input/input.component.js +87 -80
- package/dist/components/link/link.component.js +28 -28
- package/dist/components/loader/loader.component.js +19 -19
- package/dist/components/logo/logo.component.js +6 -6
- package/dist/components/popover/popover.component.js +12 -12
- package/dist/components/progress/progress.component.js +7 -7
- package/dist/components/radio/radio.component.js +4 -4
- package/dist/components/select-option-group/select-option-group.component.js +9 -9
- package/dist/components/stepper/stepper.component.js +9 -9
- package/dist/components/stepper/stepper.helpers.js +5 -5
- package/dist/components/stepper-item/stepper-item.component.js +23 -23
- package/dist/components/tab/tab.component.js +4 -4
- package/dist/components/tab-panel/tab-panel.component.js +12 -12
- package/dist/components/tag/tag.component.js +9 -9
- package/dist/components/textarea/textarea.component.js +3 -3
- package/dist/components/toast/toast.component.js +13 -13
- package/dist/components/toast-wrapper/toast-wrapper.component.js +10 -10
- package/dist/components/tooltip/tooltip.component.js +2 -2
- package/dist/custom-elements.json +941 -161
- package/dist/index.d.ts +2 -0
- package/dist/index.js +72 -66
- package/dist/internal/components/hint/hint.component.js +13 -13
- package/dist/internal/controllers/popover.controller.d.ts +2 -1
- package/dist/internal/controllers/popover.controller.js +2 -2
- package/dist/internal/helpers/dateFormatter.d.ts +2 -0
- package/dist/internal/helpers/utilityTypes.d.ts +22 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/skf-datepicker/index.d.ts +12 -0
- package/dist/react/skf-datepicker/index.js +18 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +45 -3
- package/dist/types/vue/index.d.ts +44 -1
- package/dist/vscode.html-custom-data.json +39 -1
- package/dist/web-types.json +107 -10
- package/package.json +3 -2
@@ -0,0 +1,397 @@
|
|
1
|
+
import { dateFormatter as v, isPopoverOpen as S, debounce as E, isDate as $ } from "./datepicker-input.helpers.js";
|
2
|
+
import { computePosition as C, flip as I, offset as M } from "@floating-ui/dom";
|
3
|
+
import { FormBase as O } from "../../internal/components/formBase.js";
|
4
|
+
import { PopoverController as T } from "../../internal/controllers/popover.controller.js";
|
5
|
+
import { hintSeverity as B } from "../../internal/helpers/hintSeverity.js";
|
6
|
+
import { watch as P } from "../../internal/helpers/watch.js";
|
7
|
+
import { Asterisk as x } from "../../internal/templates/asterisk.js";
|
8
|
+
import { Temporal as F } from "@js-temporal/polyfill";
|
9
|
+
import q from "../../styles/component.styles.js";
|
10
|
+
import { html as m, nothing as g } from "lit";
|
11
|
+
import { property as d, state as b, query as y, queryAssignedNodes as R } from "lit/decorators.js";
|
12
|
+
import { ifDefined as u } from "lit/directives/if-defined.js";
|
13
|
+
import { live as k } from "lit/directives/live.js";
|
14
|
+
import "../date-picker/datepicker.js";
|
15
|
+
import { styles as j } from "./datepicker-input.styles.js";
|
16
|
+
var L = Object.defineProperty, V = Object.getOwnPropertyDescriptor, n = (D, t, e, a) => {
|
17
|
+
for (var l = a > 1 ? void 0 : a ? V(t, e) : t, o = D.length - 1, h; o >= 0; o--)
|
18
|
+
(h = D[o]) && (l = (a ? h(t, e, l) : h(l)) || l);
|
19
|
+
return a && l && L(t, e, l), l;
|
20
|
+
};
|
21
|
+
const _ = class _ extends O {
|
22
|
+
constructor() {
|
23
|
+
super(), this.popoverController = new T(this), this.id = "skf-datepicker-input", this.placeholder = "Select date", this.range = !1, this.validateOn = "change", this.invalid = !1, this.selectedRangeDates = { start: null, end: null }, this.showClearbutton = !1, this._handleSelectedDate = (t) => {
|
24
|
+
console.log("selected-date-changed event fired", this.value || "no value", t.detail), this.pristine = !1, this._internals.setFormValue(this.value ?? ""), this.validateInput();
|
25
|
+
}, this._handleDateSelected = (t) => {
|
26
|
+
if (this.range && "start" in t.detail.date && "end" in t.detail.date) {
|
27
|
+
const e = t.detail.date.start, a = t.detail.date.end;
|
28
|
+
this.value = `${v(e)},${v(a)}`, this.selectedRangeDates = { start: e, end: a };
|
29
|
+
} else !this.range && t.detail.date instanceof Date && (this.value = v(t.detail.date), this._animatePopover({ el: this.$popover, show: !1 }).then(() => {
|
30
|
+
this.$popover.hidePopover();
|
31
|
+
}));
|
32
|
+
}, this._handleFocus = () => {
|
33
|
+
if (S(this.$popover)) return;
|
34
|
+
E(() => {
|
35
|
+
this.$popover.showPopover(), this._animatePopover({ show: !0 });
|
36
|
+
}, 200)();
|
37
|
+
}, this._handleBlur = (t) => {
|
38
|
+
const e = t.target;
|
39
|
+
if (!e.name.endsWith("-end") && !this.range) return;
|
40
|
+
if ($(e.value) && this.$datepicker.emit("selected-date-changed", {
|
41
|
+
detail: { date: new Date(e.value) }
|
42
|
+
}), e.name.endsWith("-end") || !this.range) {
|
43
|
+
const l = t.relatedTarget;
|
44
|
+
a(this, l);
|
45
|
+
}
|
46
|
+
function a(l, o) {
|
47
|
+
var h, c;
|
48
|
+
if (o && !l.contains(o)) {
|
49
|
+
console.log("Tab out detected");
|
50
|
+
const r = (h = l.$popover.childNodes[1].shadowRoot) == null ? void 0 : h.querySelector("skf-datepicker-calendar"), p = (c = r == null ? void 0 : r.shadowRoot) == null ? void 0 : c.querySelector("button");
|
51
|
+
p == null || p.focus();
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}, this._handleClose = () => {
|
55
|
+
this.$anchor.blur();
|
56
|
+
}, this.clearInput = () => {
|
57
|
+
this.value = "", this.$datepicker.clearSelection();
|
58
|
+
}, this.clear = () => {
|
59
|
+
this.clearInput(), this._toggleClearButton(!1);
|
60
|
+
}, this._handleInput = (t) => {
|
61
|
+
const e = t.target;
|
62
|
+
e.setCustomValidity(this.customError ?? ""), this.focusTomeoutId && clearTimeout(this.focusTomeoutId), this.$datepicker.date = e.value, this.range ? (this.$datepicker.selectedDateRange = {
|
63
|
+
start: $(this.$input.value) ? new Date(this.$input.value) : null,
|
64
|
+
end: $(this.$input_range_end.value) ? new Date(this.$input_range_end.value) : null
|
65
|
+
}, $(this.$input.value) && (this.focusTomeoutId = setTimeout(() => {
|
66
|
+
this.$input_range_end.focus();
|
67
|
+
}, 2e3))) : this.$datepicker.selectedDate = new Date(e.value), this.validateOn === "input" && (this._pristine = !1, this.validateInput());
|
68
|
+
}, this._toggleClearButton = (t = !1) => {
|
69
|
+
this.showClearbutton = t;
|
70
|
+
}, this.reposition = async () => {
|
71
|
+
const { x: t, y: e } = await C(this.$anchor, this.$popover, {
|
72
|
+
placement: "bottom-start",
|
73
|
+
middleware: [I(), M(0)],
|
74
|
+
strategy: "fixed"
|
75
|
+
});
|
76
|
+
Object.assign(this.$popover.style, {
|
77
|
+
left: `${String(t)}px`,
|
78
|
+
top: `${String(e)}px`
|
79
|
+
});
|
80
|
+
}, this.addEventListener("skf-datepicker-selected", this._handleDateSelected), this.addEventListener("reset", () => {
|
81
|
+
this.clearInput(), this.validateInput();
|
82
|
+
});
|
83
|
+
}
|
84
|
+
set customInvalid(t) {
|
85
|
+
this.customError = t || "";
|
86
|
+
}
|
87
|
+
get customInvalid() {
|
88
|
+
return this.customError;
|
89
|
+
}
|
90
|
+
connectedCallback() {
|
91
|
+
var t;
|
92
|
+
super.connectedCallback(), this._init_date = (t = this.value) == null ? void 0 : t.split(",")[0], this.addEventListener("selected-date-changed", this._handleSelectedDate);
|
93
|
+
}
|
94
|
+
firstUpdated() {
|
95
|
+
var t;
|
96
|
+
this.$datepicker.date = this._init_date ? F.PlainDate.from(this._init_date).toString() : F.Now.plainDateISO().toString(), this.range ? this.$datepicker.selectedDateRange = {
|
97
|
+
start: this._init_date ? new Date(this._init_date) : null,
|
98
|
+
end: (t = this.value) != null && t.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
99
|
+
} : this.$datepicker.selectedDate = this._init_date ? new Date(this._init_date) : void 0, this.validateInput();
|
100
|
+
}
|
101
|
+
attributeChangedCallback(t, e, a) {
|
102
|
+
if (super.attributeChangedCallback(t, e, a), t === "custom-invalid")
|
103
|
+
if (typeof a == "string") {
|
104
|
+
const o = this.withFallback(a);
|
105
|
+
this._pristine = !1, this._internals.setValidity({ customError: !0 }, o), this.invalid = !0, this.hint = o, this.checkValidity();
|
106
|
+
} else
|
107
|
+
this._internals.setValidity({}), this.validateInput();
|
108
|
+
}
|
109
|
+
_handleValueChange() {
|
110
|
+
var t, e, a, l, o, h, c, i;
|
111
|
+
(t = this.value) != null && t.trim() || this.$datepicker.clearSelection(), this._internals.setFormValue(this.value ?? ""), this.validateInput(), this._pristine = !1, this.$input.value = v((e = this.value) == null ? void 0 : e.split(",")[0]), this.range ? (this.$datepicker.selectedDateRange = {
|
112
|
+
start: (o = this.value) != null && o.split(",")[0] ? new Date(this.value.split(",")[0]) : null,
|
113
|
+
end: (h = this.value) != null && h.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
114
|
+
}, this.$input_range_end.value = v((c = this.value) == null ? void 0 : c.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();
|
115
|
+
}
|
116
|
+
/** @internal */
|
117
|
+
async _animatePopover({ el: t = this.$popover, show: e }) {
|
118
|
+
return e && (t.style.opacity = "0", t.style.transform = "scaleY(0.5)"), new Promise((a) => {
|
119
|
+
const l = [
|
120
|
+
{ opacity: 0, transform: "scaleY(0.5)" },
|
121
|
+
{ opacity: 1, transform: "scaleY(1)" }
|
122
|
+
], o = e ? l : l.reverse();
|
123
|
+
setTimeout(
|
124
|
+
() => {
|
125
|
+
t.style.transformOrigin = "top";
|
126
|
+
const h = this.$popover.animate(o, {
|
127
|
+
duration: 100,
|
128
|
+
easing: "linear",
|
129
|
+
fill: "both"
|
130
|
+
});
|
131
|
+
h.onfinish = () => {
|
132
|
+
a();
|
133
|
+
};
|
134
|
+
},
|
135
|
+
e ? 0 : 50
|
136
|
+
);
|
137
|
+
});
|
138
|
+
}
|
139
|
+
/** @internal consider sharing this functionality with input */
|
140
|
+
validateInput() {
|
141
|
+
if (this._internals.validity.customError) return;
|
142
|
+
let e = JSON.parse(JSON.stringify(this._internals.validity)), a = {};
|
143
|
+
if (this.selectableFrom) {
|
144
|
+
const { validityFragment: i, errorMessageFragment: r } = l(this);
|
145
|
+
e = { ...e, ...i }, a = { ...a, ...r };
|
146
|
+
}
|
147
|
+
if (this.selectableTo) {
|
148
|
+
const { validityFragment: i, errorMessageFragment: r } = o(this);
|
149
|
+
e = { ...e, ...i }, a = { ...a, ...r };
|
150
|
+
}
|
151
|
+
if (this.range) {
|
152
|
+
const { validityFragment: i, errorMessageFragment: r } = h(this);
|
153
|
+
e = { ...e, ...i }, a = { ...a, ...r };
|
154
|
+
}
|
155
|
+
if (this.required) {
|
156
|
+
const { validityFragment: i, errorMessageFragment: r } = c(this);
|
157
|
+
e = { ...e, ...i }, a = { ...a, ...r };
|
158
|
+
}
|
159
|
+
if (e.valid = !Object.values(e).some((i) => i), this.invalid = !1, e.valid)
|
160
|
+
this._internals.setValidity({ customError: this._internals.validity.customError });
|
161
|
+
else {
|
162
|
+
this.invalid = !this._pristine && !e.valid;
|
163
|
+
let i;
|
164
|
+
for (i in e) {
|
165
|
+
const r = `data-${i.toString()}`;
|
166
|
+
if (e[i]) {
|
167
|
+
this.validationError = i.toString();
|
168
|
+
const p = this.hasAttribute(r) ? this.getAttribute(r) : a[i];
|
169
|
+
this._internals.setValidity(
|
170
|
+
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
171
|
+
this.withFallback(p)
|
172
|
+
), this.invalid && this.customErrorDisplay && this.checkValidity();
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
function l(i) {
|
177
|
+
const r = { validityFragment: {}, errorMessageFragment: {} };
|
178
|
+
if (!i.selectableFrom) return r;
|
179
|
+
const p = new Date(i.selectableFrom);
|
180
|
+
if (new Date(i.$input.value) < p) {
|
181
|
+
const f = i.getAttribute("data-rangeunderflow") ?? "Date is out of range";
|
182
|
+
return {
|
183
|
+
validityFragment: { rangeUnderflow: !0, valid: !1 },
|
184
|
+
errorMessageFragment: { rangeUnderflow: f }
|
185
|
+
};
|
186
|
+
}
|
187
|
+
return r;
|
188
|
+
}
|
189
|
+
function o(i) {
|
190
|
+
const r = { validityFragment: {}, errorMessageFragment: {} };
|
191
|
+
if (!i.selectableTo) return r;
|
192
|
+
const p = new Date(i.selectableTo);
|
193
|
+
if (new Date(i.$input.value) > p) {
|
194
|
+
const f = i.getAttribute("data-rangeoverflow") ?? "Date is out of range";
|
195
|
+
return {
|
196
|
+
validityFragment: { rangeOverflow: !0, valid: !1 },
|
197
|
+
errorMessageFragment: { rangeOverflow: f }
|
198
|
+
};
|
199
|
+
}
|
200
|
+
return r;
|
201
|
+
}
|
202
|
+
function h(i) {
|
203
|
+
const r = { validityFragment: {}, errorMessageFragment: {} }, p = new Date(i.$input.value);
|
204
|
+
if (new Date(i.$input_range_end.value) < p) {
|
205
|
+
const f = i.getAttribute("data-rangeunderflow") ?? "Date is out of range";
|
206
|
+
return {
|
207
|
+
validityFragment: { rangeUnderflow: !0, valid: !1 },
|
208
|
+
errorMessageFragment: { rangeUnderflow: f }
|
209
|
+
};
|
210
|
+
}
|
211
|
+
return r;
|
212
|
+
}
|
213
|
+
function c(i) {
|
214
|
+
const r = { validityFragment: {}, errorMessageFragment: {} };
|
215
|
+
return !i.$input.value || i.range && !i.$input_range_end.value ? {
|
216
|
+
validityFragment: { valueMissing: !0, valid: !1 },
|
217
|
+
errorMessageFragment: { valueMissing: "This field is required" }
|
218
|
+
} : r;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
render() {
|
222
|
+
var e, a, l, o, h, c, i, r;
|
223
|
+
const t = (this._defaultSlot.length === 0 || !((a = (e = this._defaultSlot[0]) == null ? void 0 : e.textContent) != null && a.trim())) && !this.label;
|
224
|
+
return m`
|
225
|
+
<div
|
226
|
+
id="root"
|
227
|
+
@mouseenter=${() => {
|
228
|
+
this.value && this._toggleClearButton(!0);
|
229
|
+
}}
|
230
|
+
@mouseleave=${() => {
|
231
|
+
this._toggleClearButton(!1);
|
232
|
+
}}
|
233
|
+
>
|
234
|
+
<label>
|
235
|
+
<div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${t} id="label">
|
236
|
+
<slot>${this.label}</slot>
|
237
|
+
${this.required ? x(this.requiredLabel) : null}
|
238
|
+
</div>
|
239
|
+
<div id="input">
|
240
|
+
<div id="affix">
|
241
|
+
<input
|
242
|
+
?disabled=${this.disabled}
|
243
|
+
?readonly=${this.readonly}
|
244
|
+
.value=${k(
|
245
|
+
this.range ? v((l = this.value) == null ? void 0 : l.split(",")[0]) : v(this.value)
|
246
|
+
)}
|
247
|
+
@blur=${this._handleBlur}
|
248
|
+
@click=${this._handleFocus}
|
249
|
+
@focus=${this._handleFocus}
|
250
|
+
@input=${this._handleInput}
|
251
|
+
aria-describedby=${u((o = this.hint) != null && o.trim() ? "hint" : g)}
|
252
|
+
aria-errormessage=${u((h = this.hint) != null && h.trim() ? "hint" : g)}
|
253
|
+
aria-invalid=${!!this.invalid}
|
254
|
+
autocomplete="off"
|
255
|
+
data-testid="field-input"
|
256
|
+
inputmode=${u(this.inputMode)}
|
257
|
+
name=${u(this.name)}
|
258
|
+
placeholder=${u(this.placeholder)}
|
259
|
+
type="date"
|
260
|
+
/>
|
261
|
+
</div>
|
262
|
+
${this.range ? m`<div style="align-content:center">→</div>
|
263
|
+
<input
|
264
|
+
?disabled=${this.disabled}
|
265
|
+
?readonly=${this.readonly}
|
266
|
+
.value=${k(v((c = this.value) == null ? void 0 : c.split(",")[1]))}
|
267
|
+
@blur=${this._handleBlur}
|
268
|
+
@click=${this._handleFocus}
|
269
|
+
@focus=${this._handleFocus}
|
270
|
+
@input=${this._handleInput}
|
271
|
+
aria-describedby=${u((i = this.hint) != null && i.trim() ? "hint" : g)}
|
272
|
+
aria-errormessage=${u((r = this.hint) != null && r.trim() ? "hint" : g)}
|
273
|
+
aria-invalid=${!!this.invalid}
|
274
|
+
autocomplete="off"
|
275
|
+
data-testid="field-input-range-end"
|
276
|
+
inputmode=${u(this.inputMode)}
|
277
|
+
name=${u(String(this.name) + "-end")}
|
278
|
+
placeholder=${u(this.placeholder)}
|
279
|
+
type="date"
|
280
|
+
/>` : g}
|
281
|
+
${this.showClearbutton ? m`<button class="password skf-icon-host" type="button" @click=${this.clear}>
|
282
|
+
<skf-icon name="close" size="sm"></skf-icon>
|
283
|
+
</button>` : m`
|
284
|
+
<button class="password skf-icon-host" type="button">
|
285
|
+
<skf-icon name="calendarMonth" size="sm"></skf-icon>
|
286
|
+
</button>
|
287
|
+
`}
|
288
|
+
</div>
|
289
|
+
</label>
|
290
|
+
${this.hint && m`
|
291
|
+
<skf-hint
|
292
|
+
aria-live=${this.invalid ? "assertive" : "polite"}
|
293
|
+
id="hint"
|
294
|
+
severity=${u(B(this.severity, this.invalid))}
|
295
|
+
>${this.customInvalid ? this.customInvalid : this.hint}
|
296
|
+
</skf-hint>
|
297
|
+
`}
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div id="popover" popover @close=${this._handleClose}>
|
301
|
+
<skf-datepicker
|
302
|
+
?range=${this.range}
|
303
|
+
id=${this.id}
|
304
|
+
invalid-dates=${u(this.invalidDates)}
|
305
|
+
selectable-from=${u(this.selectableFrom)}
|
306
|
+
selectable-to=${u(this.selectableTo)}
|
307
|
+
></skf-datepicker>
|
308
|
+
</div>
|
309
|
+
`;
|
310
|
+
}
|
311
|
+
};
|
312
|
+
_.styles = [q, j];
|
313
|
+
let s = _;
|
314
|
+
n([
|
315
|
+
d({ attribute: "custom-invalid", reflect: !0 })
|
316
|
+
], s.prototype, "customInvalid", 1);
|
317
|
+
n([
|
318
|
+
d({ type: String })
|
319
|
+
], s.prototype, "id", 2);
|
320
|
+
n([
|
321
|
+
d()
|
322
|
+
], s.prototype, "label", 2);
|
323
|
+
n([
|
324
|
+
d({ type: Boolean, attribute: "hide-label" })
|
325
|
+
], s.prototype, "hideLabel", 2);
|
326
|
+
n([
|
327
|
+
d()
|
328
|
+
], s.prototype, "hint", 2);
|
329
|
+
n([
|
330
|
+
d({ attribute: "invalid-dates" })
|
331
|
+
], s.prototype, "invalidDates", 2);
|
332
|
+
n([
|
333
|
+
d({ reflect: !0 })
|
334
|
+
], s.prototype, "name", 2);
|
335
|
+
n([
|
336
|
+
d()
|
337
|
+
], s.prototype, "placeholder", 2);
|
338
|
+
n([
|
339
|
+
d({ type: Boolean })
|
340
|
+
], s.prototype, "range", 2);
|
341
|
+
n([
|
342
|
+
d({ type: Boolean })
|
343
|
+
], s.prototype, "readonly", 2);
|
344
|
+
n([
|
345
|
+
d({ attribute: "required-label" })
|
346
|
+
], s.prototype, "requiredLabel", 2);
|
347
|
+
n([
|
348
|
+
d({ attribute: "selectable-from" })
|
349
|
+
], s.prototype, "selectableFrom", 2);
|
350
|
+
n([
|
351
|
+
d({ attribute: "selectable-to" })
|
352
|
+
], s.prototype, "selectableTo", 2);
|
353
|
+
n([
|
354
|
+
d({ reflect: !0 })
|
355
|
+
], s.prototype, "severity", 2);
|
356
|
+
n([
|
357
|
+
d({ type: String, attribute: "validate-on" })
|
358
|
+
], s.prototype, "validateOn", 2);
|
359
|
+
n([
|
360
|
+
d()
|
361
|
+
], s.prototype, "value", 2);
|
362
|
+
n([
|
363
|
+
b()
|
364
|
+
], s.prototype, "_init_date", 2);
|
365
|
+
n([
|
366
|
+
d({ type: Boolean, reflect: !0 })
|
367
|
+
], s.prototype, "invalid", 2);
|
368
|
+
n([
|
369
|
+
b()
|
370
|
+
], s.prototype, "selectedRangeDates", 2);
|
371
|
+
n([
|
372
|
+
b()
|
373
|
+
], s.prototype, "showClearbutton", 2);
|
374
|
+
n([
|
375
|
+
y("#popover")
|
376
|
+
], s.prototype, "$popover", 2);
|
377
|
+
n([
|
378
|
+
y("#input")
|
379
|
+
], s.prototype, "$anchor", 2);
|
380
|
+
n([
|
381
|
+
y('input[data-testid="field-input"]')
|
382
|
+
], s.prototype, "$input", 2);
|
383
|
+
n([
|
384
|
+
y('input[data-testid="field-input-range-end"]')
|
385
|
+
], s.prototype, "$input_range_end", 2);
|
386
|
+
n([
|
387
|
+
y("skf-datepicker")
|
388
|
+
], s.prototype, "$datepicker", 2);
|
389
|
+
n([
|
390
|
+
R({ flatten: !0 })
|
391
|
+
], s.prototype, "_defaultSlot", 2);
|
392
|
+
n([
|
393
|
+
P("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
394
|
+
], s.prototype, "_handleValueChange", 1);
|
395
|
+
export {
|
396
|
+
s as SkfDatePickerInput
|
397
|
+
};
|
@@ -0,0 +1,8 @@
|
|
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
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export declare function dateFormatter(date?: string | Date | null, locale?: string): string;
|
2
|
+
export declare function isPopoverOpen(element: HTMLElement): boolean;
|
3
|
+
export declare function debounce<T extends (...args: unknown[]) => void>(func: T, delay: number): (...args: Parameters<T>) => void;
|
4
|
+
export declare const isDate: (date?: Date | string | null) => boolean;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
function r(e, n = "en-CA") {
|
2
|
+
return e ? (typeof e == "string" && (e = new Date(e)), e.toLocaleDateString(n)) : "";
|
3
|
+
}
|
4
|
+
function i(e) {
|
5
|
+
return console.dir("element", e), e.matches(":popover-open");
|
6
|
+
}
|
7
|
+
let o = null;
|
8
|
+
function c(e, n) {
|
9
|
+
return (...t) => {
|
10
|
+
console.log("Debounced function called"), o && (clearTimeout(o), console.log("Existing timer cleared")), o = setTimeout(() => {
|
11
|
+
console.log("Function executed after delay"), e(...t);
|
12
|
+
}, n);
|
13
|
+
};
|
14
|
+
}
|
15
|
+
const l = (e) => {
|
16
|
+
if (!e) return !1;
|
17
|
+
if (typeof e != "string")
|
18
|
+
return e instanceof Date && !isNaN(e.valueOf());
|
19
|
+
{
|
20
|
+
const n = new Date(e);
|
21
|
+
return !isNaN(n);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
export {
|
25
|
+
r as dateFormatter,
|
26
|
+
c as debounce,
|
27
|
+
l as isDate,
|
28
|
+
i as isPopoverOpen
|
29
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult[];
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import o from "../../styles/form-field.styles.js";
|
2
|
+
import { visuallyHidden as e } from "../../styles/util.styles.js";
|
3
|
+
import { css as r } from "lit";
|
4
|
+
const l = [
|
5
|
+
e,
|
6
|
+
o,
|
7
|
+
r`
|
8
|
+
@layer components {
|
9
|
+
#popover {
|
10
|
+
border: none;
|
11
|
+
overflow: visible;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
input::-webkit-calendar-picker-indicator {
|
16
|
+
display: none;
|
17
|
+
}
|
18
|
+
`
|
19
|
+
];
|
20
|
+
export {
|
21
|
+
l as styles
|
22
|
+
};
|
@@ -1,8 +1,8 @@
|
|
1
|
-
var _ = (
|
2
|
-
throw TypeError(
|
1
|
+
var _ = (t) => {
|
2
|
+
throw TypeError(t);
|
3
3
|
};
|
4
|
-
var w = (
|
5
|
-
var f = (
|
4
|
+
var w = (t, e, o) => e.has(t) || _("Cannot " + o);
|
5
|
+
var f = (t, e, o) => (w(t, e, "read from private field"), o ? o.call(t) : e.get(t)), g = (t, e, o) => e.has(t) ? _("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, o), h = (t, e, o, a) => (w(t, e, "write to private field"), a ? a.call(t, o) : e.set(t, o), o);
|
6
6
|
import "../button/button.js";
|
7
7
|
import "../heading/heading.js";
|
8
8
|
import "../icon/icon.js";
|
@@ -13,10 +13,10 @@ import { html as b, nothing as k } from "lit";
|
|
13
13
|
import { property as c, state as m, query as P, queryAssignedElements as M } from "lit/decorators.js";
|
14
14
|
import { classMap as $ } from "lit/directives/class-map.js";
|
15
15
|
import { styles as O } from "./dialog.styles.js";
|
16
|
-
var A = Object.defineProperty, E = Object.getOwnPropertyDescriptor, i = (
|
17
|
-
for (var n = a > 1 ? void 0 : a ? E(e,
|
18
|
-
(r =
|
19
|
-
return a && n && A(e,
|
16
|
+
var A = Object.defineProperty, E = Object.getOwnPropertyDescriptor, i = (t, e, o, a) => {
|
17
|
+
for (var n = a > 1 ? void 0 : a ? E(e, o) : e, l = t.length - 1, r; l >= 0; l--)
|
18
|
+
(r = t[l]) && (n = (a ? r(e, o, n) : r(n)) || n);
|
19
|
+
return a && n && A(e, o, n), n;
|
20
20
|
}, p, u, d;
|
21
21
|
const y = class y extends v {
|
22
22
|
constructor() {
|
@@ -24,19 +24,19 @@ const y = class y extends v {
|
|
24
24
|
g(this, p);
|
25
25
|
g(this, u);
|
26
26
|
g(this, d);
|
27
|
-
h(this, p, 0), h(this, u, 20), h(this, d, !1), this.fullscreen = !1, this.noCloseButton = !1, this.noPadding = !1, this.onClose = null, this.modal = !0, this.renderFoot = !1, this.show = async () => await this.showModal(), this._handleBackdropClick = (
|
28
|
-
this._isModal ||
|
29
|
-
}, this._handleClose = (
|
30
|
-
console.log("Handle close reached"), this.onClose && this.onClose(
|
27
|
+
h(this, p, 0), h(this, u, 20), h(this, d, !1), this.fullscreen = !1, this.noCloseButton = !1, this.noPadding = !1, this.onClose = null, this.modal = !0, this.renderFoot = !1, this.show = async () => await this.showModal(), this._handleBackdropClick = (o) => {
|
28
|
+
this._isModal || o.target !== this.$dialog || this.close();
|
29
|
+
}, this._handleClose = (o) => {
|
30
|
+
console.log("Handle close reached"), this.onClose && this.onClose(o), this.close();
|
31
31
|
}, this.showModal = async () => await (async () => (console.log("%cmodal ->", "color: red", this.modal), this.$dialog.showModal(), await this._transition().entry(), this.emit("skf-dialog-open"), !0))(), this.close = async () => (console.log("close reached"), f(this, d) ? void 0 : (h(this, d, !0), await (async () => (this.emit("skf-dialog-close"), await this._transition().exit(), this.$dialog.close(), this.open = !1, h(this, d, !1), !0))()));
|
32
32
|
}
|
33
33
|
firstUpdated() {
|
34
|
-
this.$dialog.addEventListener("close", (
|
35
|
-
|
34
|
+
this.$dialog.addEventListener("close", (o) => {
|
35
|
+
o.stopPropagation(), console.log("close event detected 1", o), this.emit("close");
|
36
36
|
});
|
37
37
|
}
|
38
38
|
handleOpenChange() {
|
39
|
-
var
|
39
|
+
var o;
|
40
40
|
switch (!0) {
|
41
41
|
case (this.open === !0 && !!this.modal):
|
42
42
|
this.showModal();
|
@@ -48,11 +48,11 @@ const y = class y extends v {
|
|
48
48
|
this.close();
|
49
49
|
break;
|
50
50
|
}
|
51
|
-
this.open && (this.renderFoot = !!((
|
51
|
+
this.open && (this.renderFoot = !!((o = this.footerEls) != null && o.length));
|
52
52
|
}
|
53
53
|
/** @internal */
|
54
54
|
_transition() {
|
55
|
-
const
|
55
|
+
const o = this.fullscreen ? {} : {
|
56
56
|
translate: `${String(f(this, p))} ${String(f(this, u))}px`
|
57
57
|
};
|
58
58
|
return { entry: () => new Promise((l) => {
|
@@ -60,7 +60,7 @@ const y = class y extends v {
|
|
60
60
|
[
|
61
61
|
{
|
62
62
|
opacity: 0,
|
63
|
-
...
|
63
|
+
...o
|
64
64
|
},
|
65
65
|
{ opacity: 1, translate: "0 0" }
|
66
66
|
],
|
@@ -83,7 +83,7 @@ const y = class y extends v {
|
|
83
83
|
{ opacity: 1, translate: "0 0" },
|
84
84
|
{
|
85
85
|
opacity: 0,
|
86
|
-
...
|
86
|
+
...o
|
87
87
|
}
|
88
88
|
],
|
89
89
|
{
|
@@ -1,20 +1,20 @@
|
|
1
|
-
var
|
1
|
+
var h = (r) => {
|
2
2
|
throw TypeError(r);
|
3
3
|
};
|
4
|
-
var m = (r, e, t) => e.has(r) ||
|
5
|
-
var c = (r, e, t) => (m(r, e, "read from private field"), t ? t.call(r) : e.get(r)), f = (r, e, t) => e.has(r) ?
|
4
|
+
var m = (r, e, t) => e.has(r) || h("Cannot " + t);
|
5
|
+
var c = (r, e, t) => (m(r, e, "read from private field"), t ? t.call(r) : e.get(r)), f = (r, e, t) => e.has(r) ? h("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), y = (r, e, t, a) => (m(r, e, "write to private field"), a ? a.call(r, t) : e.set(r, t), t);
|
6
6
|
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
7
7
|
import b from "../../styles/component.styles.js";
|
8
8
|
import { html as C } from "lit";
|
9
9
|
import { property as n } from "lit/decorators.js";
|
10
10
|
import { classMap as _ } from "lit/directives/class-map.js";
|
11
11
|
import { styles as x } from "./divider.styles.js";
|
12
|
-
var B = Object.defineProperty,
|
13
|
-
for (var o = void 0, l = r.length - 1,
|
14
|
-
(
|
12
|
+
var B = Object.defineProperty, p = (r, e, t, a) => {
|
13
|
+
for (var o = void 0, l = r.length - 1, v; l >= 0; l--)
|
14
|
+
(v = r[l]) && (o = v(e, t, o) || o);
|
15
15
|
return o && B(e, t, o), o;
|
16
16
|
}, i;
|
17
|
-
const
|
17
|
+
const d = class d extends u {
|
18
18
|
constructor() {
|
19
19
|
super();
|
20
20
|
f(this, i);
|
@@ -38,15 +38,15 @@ const p = class p extends u {
|
|
38
38
|
`;
|
39
39
|
}
|
40
40
|
};
|
41
|
-
i = new WeakMap(),
|
42
|
-
let s =
|
43
|
-
|
41
|
+
i = new WeakMap(), d.styles = [b, x];
|
42
|
+
let s = d;
|
43
|
+
p([
|
44
44
|
n({ reflect: !0 })
|
45
45
|
], s.prototype, "color");
|
46
|
-
|
46
|
+
p([
|
47
47
|
n({ type: Boolean })
|
48
48
|
], s.prototype, "decorative");
|
49
|
-
|
49
|
+
p([
|
50
50
|
n({ type: Boolean, reflect: !0 })
|
51
51
|
], s.prototype, "vertical");
|
52
52
|
export {
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { SkfElement as
|
1
|
+
import { SkfElement as n } from "../../internal/components/skf-element.js";
|
2
2
|
import u from "../../styles/component.styles.js";
|
3
3
|
import "lit";
|
4
|
-
import { property as
|
4
|
+
import { property as a } from "lit/decorators.js";
|
5
5
|
import { html as y, unsafeStatic as l } from "lit/static-html.js";
|
6
6
|
import c from "./heading.styles.js";
|
7
|
-
var
|
8
|
-
for (var t = void 0,
|
9
|
-
(m = o[
|
10
|
-
return t &&
|
7
|
+
var h = Object.defineProperty, f = (o, p, i, d) => {
|
8
|
+
for (var t = void 0, s = o.length - 1, m; s >= 0; s--)
|
9
|
+
(m = o[s]) && (t = m(p, i, t) || t);
|
10
|
+
return t && h(p, i, t), t;
|
11
11
|
};
|
12
|
-
const
|
12
|
+
const e = class e extends n {
|
13
13
|
constructor() {
|
14
14
|
super(...arguments), this.as = "h1";
|
15
15
|
}
|
@@ -21,13 +21,13 @@ const s = class s extends f {
|
|
21
21
|
`;
|
22
22
|
}
|
23
23
|
};
|
24
|
-
|
25
|
-
let r =
|
26
|
-
|
27
|
-
|
24
|
+
e.styles = [u, c];
|
25
|
+
let r = e;
|
26
|
+
f([
|
27
|
+
a({ reflect: !0 })
|
28
28
|
], r.prototype, "as");
|
29
|
-
|
30
|
-
|
29
|
+
f([
|
30
|
+
a({ attribute: "styled-as" })
|
31
31
|
], r.prototype, "styledAs");
|
32
32
|
export {
|
33
33
|
r as SkfHeading
|