@skf-design-system/ui-components 1.0.2-beta.6 → 1.0.2-beta.9
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 +18 -0
- package/dist/components/alert/alert.component.d.ts +3 -2
- package/dist/components/alert/alert.component.js +39 -33
- package/dist/components/button/button.styles.js +3 -3
- package/dist/components/checkbox/checkbox.component.d.ts +6 -5
- package/dist/components/checkbox/checkbox.component.js +77 -76
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/datepicker/datepicker-calendar.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-calendar.component.js +134 -127
- package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-popup.component.js +100 -88
- package/dist/components/datepicker/datepicker.component.d.ts +4 -2
- package/dist/components/datepicker/datepicker.component.js +150 -140
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +39 -37
- package/dist/components/divider/divider.component.js +13 -13
- package/dist/components/divider/divider.styles.js +2 -2
- package/dist/components/drawer/drawer.component.d.ts +3 -2
- package/dist/components/drawer/drawer.component.js +37 -35
- package/dist/components/drawer/drawer.styles.js +1 -1
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +66 -57
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/icon/icon.component.js +26 -16
- package/dist/components/icon/icon.styles.js +4 -4
- package/dist/components/input/input.component.d.ts +4 -8
- package/dist/components/input/input.component.js +146 -147
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +12 -12
- package/dist/components/link/link.component.js +19 -12
- package/dist/components/link/link.styles.js +11 -3
- package/dist/components/loader/loader.component.d.ts +0 -2
- package/dist/components/loader/loader.component.js +27 -30
- package/dist/components/loader/loader.styles.js +1 -1
- package/dist/components/menu/menu-item.styles.js +8 -7
- package/dist/components/menu/menu.component.d.ts +4 -1
- package/dist/components/nav/nav.component.d.ts +3 -0
- package/dist/components/nav/nav.component.js +38 -33
- package/dist/components/popover/popover.component.d.ts +6 -3
- package/dist/components/progress/progress.styles.js +3 -3
- package/dist/components/radio/radio.component.d.ts +4 -2
- package/dist/components/radio/radio.component.js +91 -83
- 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.styles.js +1 -1
- package/dist/components/select/select-option.component.d.ts +2 -2
- package/dist/components/select/select-option.component.js +16 -19
- package/dist/components/select/select.component.d.ts +13 -9
- package/dist/components/select/select.component.js +169 -144
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -56
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/tag/tag.component.d.ts +3 -0
- package/dist/components/tag/tag.component.js +50 -41
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +126 -118
- package/dist/components/tooltip/tooltip.component.d.ts +8 -2
- package/dist/components/tooltip/tooltip.component.js +3 -0
- package/dist/custom-elements.json +734 -372
- package/dist/internal/base-classes/popover/popover.base.d.ts +21 -2
- package/dist/internal/base-classes/popover/popover.base.js +10 -12
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -19
- package/dist/internal/controllers/popover.controller.d.ts +2 -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/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +4 -4
- package/dist/styles/global-alt.css +1 -1
- 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 +1823 -846
- package/dist/types/vue/index.d.ts +59 -47
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +75 -80
- package/dist/web-types.json +205 -169
- package/package.json +27 -34
- package/custom-elements.json +0 -25490
@@ -1,21 +1,29 @@
|
|
1
|
+
var R = (s) => {
|
2
|
+
throw TypeError(s);
|
3
|
+
};
|
4
|
+
var S = (s, i, e) => i.has(s) || R("Cannot " + e);
|
5
|
+
var _ = (s, i, e) => (S(s, i, "read from private field"), e ? e.call(s) : i.get(s)), $ = (s, i, e) => i.has(s) ? R("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), C = (s, i, e, t) => (S(s, i, "write to private field"), t ? t.call(s, e) : i.set(s, e), e);
|
1
6
|
import "../button/button.js";
|
2
|
-
import { SkfElement as
|
3
|
-
import { watch as
|
4
|
-
import { componentStyles as
|
5
|
-
import {
|
6
|
-
import {
|
7
|
+
import { SkfElement as F } from "../../internal/components/skf-element.js";
|
8
|
+
import { watch as y } from "../../internal/helpers/watch.js";
|
9
|
+
import { componentStyles as E } from "../../styles/component.styles.js";
|
10
|
+
import { LocalizeController as M } from "../../utilities/localize.js";
|
11
|
+
import { html as m } from "lit";
|
12
|
+
import { property as o, state as u } from "lit/decorators.js";
|
7
13
|
import "./datepicker-calendar.js";
|
8
|
-
import { getDateParts as
|
9
|
-
import { styles as
|
10
|
-
import { dateFormatter as
|
11
|
-
var
|
12
|
-
for (var
|
13
|
-
(
|
14
|
-
return
|
15
|
-
};
|
16
|
-
const
|
14
|
+
import { getDateParts as f, assertISODate as O, earliestDate as V, latestDate as P, compareDates as g, doAnimate as T } from "./datepicker-popup.helpers.js";
|
15
|
+
import { styles as L } from "./datepicker-popup.styles.js";
|
16
|
+
import { dateFormatter as r, is as Y } from "./datepicker.helpers.js";
|
17
|
+
var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (s, i, e, t) => {
|
18
|
+
for (var a = t > 1 ? void 0 : t ? A(i, e) : i, d = s.length - 1, h; d >= 0; d--)
|
19
|
+
(h = s[d]) && (a = (t ? h(i, e, a) : h(a)) || a);
|
20
|
+
return t && a && x(i, e, a), a;
|
21
|
+
}, c;
|
22
|
+
const v = class v extends F {
|
17
23
|
constructor() {
|
18
|
-
super(...arguments)
|
24
|
+
super(...arguments);
|
25
|
+
$(this, c);
|
26
|
+
C(this, c, 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 = {
|
19
27
|
start: null,
|
20
28
|
end: null
|
21
29
|
}, this._datePlusOneMonth = new Date(
|
@@ -27,45 +35,45 @@ const y = class y extends v {
|
|
27
35
|
}, this._handleSelectedDate = (e) => {
|
28
36
|
var t;
|
29
37
|
if (this.selectedDate = e.detail.date, console.log("selectedDate", this.selectedDate), this.range) {
|
30
|
-
const a = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("skf-datepicker-calendar"),
|
31
|
-
if (!!(
|
38
|
+
const a = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("skf-datepicker-calendar"), d = this.selectedDateRange, h = d.start && this.selectedDate < d.start;
|
39
|
+
if (!!(d.start && d.end) || h)
|
32
40
|
this.selectedDateRange = {
|
33
41
|
start: this.selectedDate,
|
34
42
|
end: null
|
35
43
|
};
|
36
44
|
else {
|
37
|
-
const
|
45
|
+
const w = !!d.start ? { end: e.detail.date } : { start: e.detail.date };
|
38
46
|
this.selectedDateRange = {
|
39
|
-
...
|
40
|
-
...
|
47
|
+
...d,
|
48
|
+
...w
|
41
49
|
};
|
42
50
|
}
|
43
|
-
this._onRangeCompleteEmitEvent(), a != null && a.length && [...a].forEach((
|
44
|
-
|
51
|
+
this._onRangeCompleteEmitEvent(), a != null && a.length && [...a].forEach((D) => {
|
52
|
+
D.selectedDateRange = this.selectedDateRange;
|
45
53
|
});
|
46
54
|
}
|
47
55
|
this.emit("skf-datepicker-selected", {
|
48
56
|
detail: { date: this.range ? this.selectedDateRange : this.selectedDate }
|
49
57
|
}), this.requestUpdate();
|
50
58
|
}, this._handleTodayClick = () => {
|
51
|
-
const { month: e, year: t } =
|
52
|
-
if (a === e &&
|
53
|
-
this.date =
|
59
|
+
const { month: e, year: t } = f(), { month: a, year: d } = f(this.date);
|
60
|
+
if (a === e && d === t && (this.selectedDateRange.start || this.selectedDate)) {
|
61
|
+
this.date = r(this.selectedDateRange.start ?? this.selectedDate), this.emit("skf-update-calendar-view", {
|
54
62
|
detail: this.date
|
55
63
|
});
|
56
64
|
return;
|
57
65
|
}
|
58
66
|
if (this.range) {
|
59
|
-
this.emit("update-calendar-view", {
|
60
|
-
detail:
|
67
|
+
this.emit("skf-update-calendar-view", {
|
68
|
+
detail: r(/* @__PURE__ */ new Date())
|
61
69
|
});
|
62
70
|
return;
|
63
71
|
}
|
64
|
-
this.date =
|
72
|
+
this.date = r(/* @__PURE__ */ new Date());
|
65
73
|
};
|
66
74
|
}
|
67
75
|
connectedCallback() {
|
68
|
-
super.connectedCallback(), this.addEventListener("update-calendar-view", this._handleCalendarView), this.addEventListener("selected-date-changed", this._handleSelectedDate);
|
76
|
+
super.connectedCallback(), this.addEventListener("skf-update-calendar-view", this._handleCalendarView), this.addEventListener("selected-date-changed", this._handleSelectedDate);
|
69
77
|
}
|
70
78
|
firstUpdated() {
|
71
79
|
(this.selectedDateRange.start ?? this.selectedDate) && this._onRangeCompleteEmitEvent();
|
@@ -96,8 +104,8 @@ const y = class y extends v {
|
|
96
104
|
this.style.setProperty("--max-width", this.range ? "43em" : "21em");
|
97
105
|
}
|
98
106
|
_handleDateChange() {
|
99
|
-
console.log("%cdate changed", "color:red", this.date), this.date = this.date &&
|
100
|
-
|
107
|
+
console.log("%cdate changed", "color:red", this.date), this.date = this.date && O(this.date) ? this.date : r(/* @__PURE__ */ new Date()), this.date = V(
|
108
|
+
P(this.date, this.selectableFrom ?? this.date),
|
101
109
|
this.selectableTo ?? this.date
|
102
110
|
), this._date = new Date(this.date), this._datePlusOneMonth = new Date(this._date.getFullYear(), this._date.getMonth() + 1, 1);
|
103
111
|
}
|
@@ -112,17 +120,17 @@ const y = class y extends v {
|
|
112
120
|
*/
|
113
121
|
gotoDate(e) {
|
114
122
|
if (e instanceof Date)
|
115
|
-
this.date =
|
116
|
-
else if (
|
123
|
+
this.date = r(e);
|
124
|
+
else if (Y(e).dateISO())
|
117
125
|
this.date = e;
|
118
126
|
else
|
119
127
|
throw new Error("Invalid date format");
|
120
|
-
this.emit("update-calendar-view", {
|
128
|
+
this.emit("skf-update-calendar-view", {
|
121
129
|
detail: e
|
122
130
|
});
|
123
131
|
}
|
124
132
|
render() {
|
125
|
-
return
|
133
|
+
return m`
|
126
134
|
<div class="calendar-container">
|
127
135
|
<skf-datepicker-calendar
|
128
136
|
.date=${this._date ?? /* @__PURE__ */ new Date()}
|
@@ -135,6 +143,7 @@ const y = class y extends v {
|
|
135
143
|
.invalidDates=${this.invalidDates}
|
136
144
|
class="start"
|
137
145
|
id=${this.id}
|
146
|
+
lang="${this.lang}"
|
138
147
|
locale="${this.locale}"
|
139
148
|
></skf-datepicker-calendar>
|
140
149
|
<skf-datepicker-calendar
|
@@ -160,12 +169,12 @@ const y = class y extends v {
|
|
160
169
|
/** @internal */
|
161
170
|
_renderTodayBtn() {
|
162
171
|
let e = !1;
|
163
|
-
if (this.selectableTo &&
|
164
|
-
return
|
165
|
-
if (this.selectableFrom &&
|
166
|
-
return
|
167
|
-
const { month: t, year: a } =
|
168
|
-
return (
|
172
|
+
if (this.selectableTo && g(this.selectableTo, r(/* @__PURE__ */ new Date())) === -1)
|
173
|
+
return m``;
|
174
|
+
if (this.selectableFrom && g(this.selectableFrom, r(/* @__PURE__ */ new Date())) === 1)
|
175
|
+
return m``;
|
176
|
+
const { month: t, year: a } = f(), { month: d, year: h } = f(this.date), p = this.selectedDate ?? this.selectedDateRange.start, D = t === d && a === h, w = p && g(r(/* @__PURE__ */ new Date()), r(p), "months") === 0;
|
177
|
+
return (D && !p || w && D) && (e = !0), m`
|
169
178
|
<div class="today">
|
170
179
|
<skf-button
|
171
180
|
@click=${this._handleTodayClick}
|
@@ -173,17 +182,17 @@ const y = class y extends v {
|
|
173
182
|
variant="tertiary"
|
174
183
|
size="sm"
|
175
184
|
>
|
176
|
-
${
|
185
|
+
${k(this.date) && (this.selectedDate || this.selectedDateRange.start) && !e ? _(this, c).term("selectedDay") : _(this, c).term("today")}
|
177
186
|
</skf-button>
|
178
187
|
</div>
|
179
188
|
`;
|
180
|
-
function
|
181
|
-
return
|
189
|
+
function k(b) {
|
190
|
+
return g(b, r(/* @__PURE__ */ new Date()), "months") === 0;
|
182
191
|
}
|
183
192
|
}
|
184
193
|
/** @internal */
|
185
194
|
_handleChangeCalendarView(e) {
|
186
|
-
const t =
|
195
|
+
const t = g(this.date, e);
|
187
196
|
this._animateView(t, () => {
|
188
197
|
this.date = e;
|
189
198
|
}).then(() => {
|
@@ -195,11 +204,11 @@ const y = class y extends v {
|
|
195
204
|
async _animateView(e, t) {
|
196
205
|
if (!this.shadowRoot) return;
|
197
206
|
const a = [...this.shadowRoot.querySelectorAll("skf-datepicker-calendar")];
|
198
|
-
return a.length ? (await
|
207
|
+
return a.length ? (await T(
|
199
208
|
a,
|
200
209
|
[{ opacity: 0, transform: `translateX(calc(16px * ${e.toString()}))` }],
|
201
210
|
{ duration: 100, easing: "ease-in", fill: "backwards" }
|
202
|
-
), t(), await
|
211
|
+
), t(), await T(
|
203
212
|
a,
|
204
213
|
[
|
205
214
|
{ opacity: 0, transform: `translateX(${(-16 * e).toString()}px)` },
|
@@ -209,53 +218,56 @@ const y = class y extends v {
|
|
209
218
|
)) : Promise.resolve();
|
210
219
|
}
|
211
220
|
};
|
212
|
-
|
213
|
-
let
|
214
|
-
|
221
|
+
c = new WeakMap(), v.styles = [E, L];
|
222
|
+
let n = v;
|
223
|
+
l([
|
215
224
|
o({ reflect: !0 })
|
216
|
-
],
|
217
|
-
|
225
|
+
], n.prototype, "locale", 2);
|
226
|
+
l([
|
218
227
|
o({ type: String, reflect: !0 })
|
219
|
-
],
|
220
|
-
|
228
|
+
], n.prototype, "date", 2);
|
229
|
+
l([
|
221
230
|
o({ type: String })
|
222
|
-
],
|
223
|
-
|
231
|
+
], n.prototype, "id", 2);
|
232
|
+
l([
|
224
233
|
o({ attribute: "invalid-dates" })
|
225
|
-
],
|
226
|
-
|
234
|
+
], n.prototype, "invalidDates", 2);
|
235
|
+
l([
|
236
|
+
o({ type: String })
|
237
|
+
], n.prototype, "lang", 2);
|
238
|
+
l([
|
227
239
|
o({ type: Boolean })
|
228
|
-
],
|
229
|
-
|
230
|
-
|
231
|
-
],
|
232
|
-
|
240
|
+
], n.prototype, "range", 2);
|
241
|
+
l([
|
242
|
+
u()
|
243
|
+
], n.prototype, "selectedDate", 2);
|
244
|
+
l([
|
233
245
|
o({ attribute: "selectable-from" })
|
234
|
-
],
|
235
|
-
|
246
|
+
], n.prototype, "selectableFrom", 2);
|
247
|
+
l([
|
236
248
|
o({ attribute: "selectable-to" })
|
237
|
-
],
|
238
|
-
|
239
|
-
|
240
|
-
],
|
241
|
-
|
242
|
-
|
243
|
-
],
|
244
|
-
|
245
|
-
|
246
|
-
],
|
247
|
-
|
248
|
-
|
249
|
-
],
|
250
|
-
|
251
|
-
|
252
|
-
],
|
253
|
-
|
254
|
-
|
255
|
-
],
|
256
|
-
|
257
|
-
|
258
|
-
],
|
249
|
+
], n.prototype, "selectableTo", 2);
|
250
|
+
l([
|
251
|
+
u()
|
252
|
+
], n.prototype, "selectedDateRange", 2);
|
253
|
+
l([
|
254
|
+
u()
|
255
|
+
], n.prototype, "_date", 2);
|
256
|
+
l([
|
257
|
+
u()
|
258
|
+
], n.prototype, "_datePlusOneMonth", 2);
|
259
|
+
l([
|
260
|
+
y("range")
|
261
|
+
], n.prototype, "_handleRangeChange", 1);
|
262
|
+
l([
|
263
|
+
y("date")
|
264
|
+
], n.prototype, "_handleDateChange", 1);
|
265
|
+
l([
|
266
|
+
y("selectedDateRange")
|
267
|
+
], n.prototype, "_handleSelectedDateRangeChange", 1);
|
268
|
+
l([
|
269
|
+
y("selectedDate")
|
270
|
+
], n.prototype, "_handleSelectedDateChange", 1);
|
259
271
|
export {
|
260
|
-
|
272
|
+
n as SkfDatepickerPopup
|
261
273
|
};
|
@@ -3,6 +3,7 @@ import { FormBase } from '../../internal/components/formBase.js';
|
|
3
3
|
import '../../internal/components/hint/hint.js';
|
4
4
|
import { PopoverController } from '../../internal/controllers/popover.controller.js';
|
5
5
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
6
|
+
import { type Language } from '../../utilities/localize.js';
|
6
7
|
import { type CSSResultGroup } from 'lit';
|
7
8
|
import type { SkfDatepickerPopup, SkfDatepickerPopupDateRange } from './datepicker-popup.component.js';
|
8
9
|
import './datepicker-popup.js';
|
@@ -10,6 +11,7 @@ import './datepicker-popup.js';
|
|
10
11
|
* @tagname skf-datepicker
|
11
12
|
*/
|
12
13
|
export declare class SkfDatepicker extends FormBase {
|
14
|
+
#private;
|
13
15
|
/** @internal */
|
14
16
|
static styles: CSSResultGroup;
|
15
17
|
/** @inernal */
|
@@ -24,6 +26,8 @@ export declare class SkfDatepicker extends FormBase {
|
|
24
26
|
id: string;
|
25
27
|
/** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
|
26
28
|
label?: string;
|
29
|
+
/** Sets the internal language of the component */
|
30
|
+
lang: Language;
|
27
31
|
/** If true, hides the label visually */
|
28
32
|
hideLabel?: boolean;
|
29
33
|
/** If defined, displays informational text below the field */
|
@@ -38,8 +42,6 @@ export declare class SkfDatepicker extends FormBase {
|
|
38
42
|
range: boolean;
|
39
43
|
/** If true, makes the element not mutable, meaning the user can not edit the control */
|
40
44
|
readonly?: boolean;
|
41
|
-
/** If defined, renders an alternative A11y text for the asterisk */
|
42
|
-
requiredLabel?: string;
|
43
45
|
/**
|
44
46
|
* Earliest selectable date. (yyyy-mm-dd format)
|
45
47
|
*/
|