@skf-design-system/ui-components 1.0.0-alpha.38 → 1.0.0-alpha.39
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/breadcrumb/breadcrumb-item.component.js +11 -12
- package/dist/components/button/button.component.js +32 -36
- 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 +67 -69
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
- package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
- package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-popup.component.js +112 -100
- package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
- package/dist/components/datepicker/datepicker.component.d.ts +4 -2
- package/dist/components/datepicker/datepicker.component.js +159 -160
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +48 -48
- 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.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.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 +11 -10
- package/dist/components/input/input.component.js +115 -111
- 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 +1 -0
- package/dist/components/link/link.component.js +86 -74
- package/dist/components/link/link.styles.js +7 -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 +5 -2
- package/dist/components/menu/menu.component.js +7 -7
- 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 -7
- package/dist/components/popover/popover.component.js +23 -31
- 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 +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.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button.component.js +22 -24
- package/dist/components/select/select-option.component.d.ts +2 -1
- package/dist/components/select/select-option.component.js +31 -36
- package/dist/components/select/select.component.d.ts +20 -10
- package/dist/components/select/select.component.js +139 -104
- package/dist/components/select/select.controllers.js +14 -17
- package/dist/components/select/select.styles.js +8 -3
- package/dist/components/stepper/stepper-item.component.d.ts +1 -1
- package/dist/components/stepper/stepper-item.component.js +26 -23
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/stepper/stepper.component.js +2 -3
- 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.styles.js +1 -1
- package/dist/components/tabs/tab-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +19 -16
- package/dist/components/tabs/tab.component.d.ts +1 -1
- package/dist/components/tabs/tab.component.js +17 -14
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/tabs/tabs.component.js +6 -6
- package/dist/components/tag/tag.component.d.ts +9 -6
- package/dist/components/tag/tag.component.js +78 -72
- package/dist/components/tag/tag.styles.js +5 -0
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +101 -95
- package/dist/components/toast/toast-item.styles.js +13 -10
- package/dist/components/toast/toast.singleton.js +6 -7
- package/dist/components/tooltip/tooltip.component.d.ts +7 -4
- package/dist/components/tooltip/tooltip.component.js +22 -14
- package/dist/custom-elements.json +835 -422
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -20
- package/dist/internal/base-classes/popover/popover.base.d.ts +28 -8
- package/dist/internal/base-classes/popover/popover.base.js +78 -74
- 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/controllers/popover.controller.js +11 -14
- package/dist/internal/helpers/stateMap.js +3 -3
- 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/internal/types.d.ts +4 -0
- 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 +1840 -858
- package/dist/types/vue/index.d.ts +69 -64
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +75 -83
- package/dist/web-types.json +229 -190
- package/package.json +29 -35
- package/custom-elements.json +0 -25490
@@ -1,50 +1,51 @@
|
|
1
|
-
var
|
1
|
+
var _ = (e) => {
|
2
2
|
throw TypeError(e);
|
3
3
|
};
|
4
|
-
var
|
5
|
-
var
|
4
|
+
var $ = (e, i, t) => i.has(e) || _("Cannot " + t);
|
5
|
+
var c = (e, i, t) => ($(e, i, "read from private field"), t ? t.call(e) : i.get(e)), f = (e, i, t) => i.has(e) ? _("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), d = (e, i, t, o) => ($(e, i, "write to private field"), o ? o.call(e, t) : i.set(e, t), t);
|
6
6
|
import "../button/button.js";
|
7
7
|
import "../heading/heading.js";
|
8
8
|
import "../icon/icon.js";
|
9
|
-
import { SkfElement as
|
10
|
-
import { watch as
|
9
|
+
import { SkfElement as b } from "../../internal/components/skf-element.js";
|
10
|
+
import { watch as k } from "../../internal/helpers/watch.js";
|
11
11
|
import { componentStyles as B } from "../../styles/component.styles.js";
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
|
17
|
-
|
12
|
+
import { LocalizeController as P } from "../../utilities/localize.js";
|
13
|
+
import { nothing as E, html as w } from "lit";
|
14
|
+
import { property as h, state as v, query as O, queryAssignedElements as x } from "lit/decorators.js";
|
15
|
+
import { classMap as C } from "lit/directives/class-map.js";
|
16
|
+
import { styles as D } from "./dialog.styles.js";
|
17
|
+
var F = Object.defineProperty, M = Object.getOwnPropertyDescriptor, n = (e, i, t, o) => {
|
18
|
+
for (var l = o > 1 ? void 0 : o ? M(i, t) : i, a = e.length - 1, r; a >= 0; a--)
|
18
19
|
(r = e[a]) && (l = (o ? r(i, t, l) : r(l)) || l);
|
19
|
-
return o && l &&
|
20
|
-
},
|
21
|
-
const
|
20
|
+
return o && l && F(i, t, l), l;
|
21
|
+
}, g, u, y, p;
|
22
|
+
const m = class m extends b {
|
22
23
|
constructor() {
|
23
24
|
super(...arguments);
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
f(this, g);
|
26
|
+
f(this, u);
|
27
|
+
f(this, y);
|
28
|
+
f(this, p);
|
29
|
+
d(this, g, new P(this)), d(this, u, 0), d(this, y, 20), d(this, p, !1), this.fullscreen = !1, this.lang = "en", this.noCloseButton = !1, this.noPadding = !1, this.open = !1, this.onClose = null, this.renderFoot = !1, this._handleBackdropClick = (t) => {
|
28
30
|
t.target === this.$dialog && this.close();
|
29
31
|
}, this._handleClose = (t) => {
|
30
32
|
this.onClose && this.onClose(t), this.close();
|
31
33
|
}, this._handleKeyDown = (t) => {
|
32
|
-
t.
|
34
|
+
t.key === "Escape" && (t.preventDefault(), this.close());
|
33
35
|
};
|
34
36
|
}
|
35
37
|
handleOpenChange() {
|
36
|
-
|
37
|
-
this.open ? this.showModal() : this.close(), this.open && (this.renderFoot = !!((t = this.footerEls) != null && t.length));
|
38
|
+
this.open ? this.showModal() : this.close(), this.open && (this.renderFoot = !!this.footerEls?.length);
|
38
39
|
}
|
39
40
|
firstUpdated() {
|
40
|
-
this.$dialog && this.$dialog.addEventListener("close", (t) => {
|
41
|
+
this.$dialog && (this.open && this.handleOpenChange(), this.$dialog.addEventListener("close", (t) => {
|
41
42
|
t.stopPropagation(), this.emit("skf-dialog-closed");
|
42
|
-
});
|
43
|
+
}));
|
43
44
|
}
|
44
45
|
/** @internal */
|
45
46
|
_transition() {
|
46
47
|
const t = this.fullscreen ? {} : {
|
47
|
-
translate: `${String(
|
48
|
+
translate: `${String(c(this, u))} ${String(c(this, y))}px`
|
48
49
|
};
|
49
50
|
return { entry: () => new Promise((a) => {
|
50
51
|
if (!this.$dialog) {
|
@@ -109,23 +110,22 @@ const y = class y extends C {
|
|
109
110
|
}
|
110
111
|
/** Method that closes the dialog */
|
111
112
|
async close() {
|
112
|
-
if (
|
113
|
-
|
113
|
+
if (c(this, p) || !this.$dialog?.open) return;
|
114
|
+
d(this, p, !0);
|
114
115
|
async function t(o) {
|
115
|
-
return o.$dialog ? (o.emit("skf-dialog-closing"), await o._transition().exit(), o.$dialog.close(), o.open = !1,
|
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;
|
116
117
|
}
|
117
118
|
return await t(this);
|
118
119
|
}
|
119
120
|
render() {
|
120
|
-
return
|
121
|
+
return w`
|
121
122
|
<dialog
|
122
123
|
@close=${this._handleClose}
|
123
124
|
@mousedown=${this._handleBackdropClick}
|
124
125
|
@touchstart=${this._handleBackdropClick}
|
125
126
|
@keydown=${this._handleKeyDown}
|
126
127
|
aria-modal="true"
|
127
|
-
|
128
|
-
class=${w({
|
128
|
+
class=${C({
|
129
129
|
dialog: !0,
|
130
130
|
"dialog--fullscreen": this.fullscreen,
|
131
131
|
"dialog--no-padding": this.noPadding
|
@@ -133,10 +133,10 @@ const y = class y extends C {
|
|
133
133
|
>
|
134
134
|
<div class="dialog__head">
|
135
135
|
<h2 class="dialog__heading">${this.heading}</h2>
|
136
|
-
${this.noCloseButton ?
|
136
|
+
${this.noCloseButton ? E : w`
|
137
137
|
<button
|
138
138
|
@click=${this._handleClose}
|
139
|
-
aria-label=${this.
|
139
|
+
aria-label=${c(this, g).term("close")}
|
140
140
|
class="dialog__close-btn"
|
141
141
|
>
|
142
142
|
<skf-icon name="close" color="inverse"></skf-icon>
|
@@ -146,7 +146,7 @@ const y = class y extends C {
|
|
146
146
|
<div class="dialog__body">
|
147
147
|
<slot class="dialog__main"></slot>
|
148
148
|
<slot
|
149
|
-
class=${
|
149
|
+
class=${C({
|
150
150
|
dialog__foot: !0,
|
151
151
|
"dialog__foot--hidden": !this.renderFoot
|
152
152
|
})}
|
@@ -157,40 +157,40 @@ const y = class y extends C {
|
|
157
157
|
`;
|
158
158
|
}
|
159
159
|
};
|
160
|
-
|
161
|
-
let s =
|
160
|
+
g = new WeakMap(), u = new WeakMap(), y = new WeakMap(), p = new WeakMap(), m.styles = [B, D];
|
161
|
+
let s = m;
|
162
162
|
n([
|
163
|
-
|
164
|
-
], s.prototype, "closeButtonAriaLabel", 2);
|
165
|
-
n([
|
166
|
-
c()
|
163
|
+
h()
|
167
164
|
], s.prototype, "heading", 2);
|
168
165
|
n([
|
169
|
-
|
166
|
+
h({ type: Boolean })
|
170
167
|
], s.prototype, "fullscreen", 2);
|
171
168
|
n([
|
172
|
-
|
169
|
+
h({ type: String })
|
170
|
+
], s.prototype, "lang", 2);
|
171
|
+
n([
|
172
|
+
h({ type: Boolean, attribute: "no-close-button" })
|
173
173
|
], s.prototype, "noCloseButton", 2);
|
174
174
|
n([
|
175
|
-
|
175
|
+
h({ type: Boolean, attribute: "no-padding" })
|
176
176
|
], s.prototype, "noPadding", 2);
|
177
177
|
n([
|
178
|
-
|
178
|
+
h({ type: Boolean, reflect: !0 })
|
179
179
|
], s.prototype, "open", 2);
|
180
180
|
n([
|
181
|
-
|
181
|
+
v()
|
182
182
|
], s.prototype, "onClose", 2);
|
183
183
|
n([
|
184
|
-
|
184
|
+
v()
|
185
185
|
], s.prototype, "renderFoot", 2);
|
186
186
|
n([
|
187
|
-
|
187
|
+
O("dialog")
|
188
188
|
], s.prototype, "$dialog", 2);
|
189
189
|
n([
|
190
|
-
|
190
|
+
x({ slot: "footer" })
|
191
191
|
], s.prototype, "footerEls", 2);
|
192
192
|
n([
|
193
|
-
|
193
|
+
k("open", { waitUntilFirstUpdate: !0 })
|
194
194
|
], s.prototype, "handleOpenChange", 1);
|
195
195
|
export {
|
196
196
|
s as SkfDialog
|
@@ -13,6 +13,7 @@ type SkfDividerColor = BorderColor;
|
|
13
13
|
* @tagname skf-divider
|
14
14
|
*/
|
15
15
|
export declare class SkfDivider extends SkfElement {
|
16
|
+
#private;
|
16
17
|
static styles: CSSResultGroup;
|
17
18
|
/** Defines the Divider color */
|
18
19
|
color: SkfDividerColor;
|
@@ -21,5 +22,7 @@ export declare class SkfDivider extends SkfElement {
|
|
21
22
|
/** If true, renders the divider vertically */
|
22
23
|
vertical: boolean;
|
23
24
|
connectedCallback(): void;
|
25
|
+
/** @internal */
|
26
|
+
_handleStateChange(property: string, _prev: unknown, next: unknown): void;
|
24
27
|
}
|
25
28
|
export {};
|
@@ -1,32 +1,53 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
var _ = (t) => {
|
2
|
+
throw TypeError(t);
|
3
|
+
};
|
4
|
+
var d = (t, e, r) => e.has(t) || _("Cannot " + r);
|
5
|
+
var h = (t, e, r) => (d(t, e, "read from private field"), r ? r.call(t) : e.get(t)), m = (t, e, r) => e.has(t) ? _("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), y = (t, e, r, a) => (d(t, e, "write to private field"), a ? a.call(t, r) : e.set(t, r), r);
|
6
|
+
import { SkfElement as O } from "../../internal/components/skf-element.js";
|
7
|
+
import { stateMap as b } from "../../internal/helpers/stateMap.js";
|
8
|
+
import { watch as g } from "../../internal/helpers/watch.js";
|
9
|
+
import { componentStyles as C } from "../../styles/component.styles.js";
|
3
10
|
import "lit";
|
4
|
-
import { property as
|
5
|
-
import { styles as
|
6
|
-
var
|
7
|
-
for (var
|
8
|
-
(
|
9
|
-
return
|
11
|
+
import { property as v } from "lit/decorators.js";
|
12
|
+
import { styles as P } from "./divider.styles.js";
|
13
|
+
var j = Object.defineProperty, w = Object.getOwnPropertyDescriptor, c = (t, e, r, a) => {
|
14
|
+
for (var o = a > 1 ? void 0 : a ? w(e, r) : e, l = t.length - 1, n; l >= 0; l--)
|
15
|
+
(n = t[l]) && (o = (a ? n(e, r, o) : n(o)) || o);
|
16
|
+
return a && o && j(e, r, o), o;
|
17
|
+
};
|
18
|
+
const u = {
|
19
|
+
color: ["emphasized", "inverse", "primary", "secondary", "tertiary"],
|
20
|
+
vertical: "vertical"
|
10
21
|
};
|
11
|
-
|
22
|
+
var i, p;
|
23
|
+
const f = class f extends O {
|
12
24
|
constructor() {
|
13
|
-
super(...arguments)
|
25
|
+
super(...arguments);
|
26
|
+
m(this, i);
|
27
|
+
m(this, p);
|
28
|
+
y(this, i, this.attachInternals()), y(this, p, h(this, i).states), this.color = "primary", this.decorative = !1, this.vertical = !1;
|
14
29
|
}
|
15
30
|
connectedCallback() {
|
16
31
|
super.connectedCallback(), this.role = this.decorative ? "generic" : "separator", this.ariaOrientation = this.vertical ? "vertical" : "horizontal";
|
17
32
|
}
|
33
|
+
_handleStateChange(r, a, o) {
|
34
|
+
b(h(this, p), u[r]).set(o);
|
35
|
+
}
|
18
36
|
};
|
19
|
-
i.styles = [
|
20
|
-
let
|
21
|
-
|
22
|
-
|
23
|
-
],
|
24
|
-
|
25
|
-
|
26
|
-
],
|
27
|
-
|
28
|
-
|
29
|
-
],
|
37
|
+
i = new WeakMap(), p = new WeakMap(), f.styles = [C, P];
|
38
|
+
let s = f;
|
39
|
+
c([
|
40
|
+
v({ type: String })
|
41
|
+
], s.prototype, "color", 2);
|
42
|
+
c([
|
43
|
+
v({ type: Boolean })
|
44
|
+
], s.prototype, "decorative", 2);
|
45
|
+
c([
|
46
|
+
v({ type: Boolean })
|
47
|
+
], s.prototype, "vertical", 2);
|
48
|
+
c([
|
49
|
+
g(Object.keys(u))
|
50
|
+
], s.prototype, "_handleStateChange", 1);
|
30
51
|
export {
|
31
|
-
|
52
|
+
s as SkfDivider
|
32
53
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
|
-
const
|
2
|
+
const o = r`
|
3
3
|
@layer components {
|
4
4
|
@layer base {
|
5
5
|
:host {
|
@@ -9,7 +9,7 @@ const e = r`
|
|
9
9
|
display: block;
|
10
10
|
}
|
11
11
|
|
12
|
-
:host(:not(
|
12
|
+
:host(:not(:state(vertical))) {
|
13
13
|
border-top: var(--_skf-divider-border);
|
14
14
|
margin-block: var(--skf-divider-spacing, var(--skf-spacing-100));
|
15
15
|
margin-inline: var(--skf-divider-inset, 0);
|
@@ -17,31 +17,31 @@ const e = r`
|
|
17
17
|
}
|
18
18
|
|
19
19
|
@layer mods {
|
20
|
-
:host(
|
20
|
+
:host(:state(vertical)) {
|
21
21
|
block-size: 100%;
|
22
22
|
border-left: var(--_skf-divider-border);
|
23
23
|
margin-block: var(--skf-divider-inset, 0);
|
24
24
|
margin-inline: var(--skf-divider-spacing, var(--skf-spacing-100));
|
25
25
|
}
|
26
26
|
|
27
|
-
:host(
|
28
|
-
--_skf-divider-border-color: var(--skf-border-color-
|
27
|
+
:host(:state(emphasized)) {
|
28
|
+
--_skf-divider-border-color: var(--skf-border-color-emphasized);
|
29
29
|
}
|
30
30
|
|
31
|
-
:host(
|
31
|
+
:host(:state(inverse)) {
|
32
32
|
--_skf-divider-border-color: var(--skf-border-color-inverse);
|
33
33
|
}
|
34
34
|
|
35
|
-
:host(
|
35
|
+
:host(:state(secondary)) {
|
36
36
|
--_skf-divider-border-color: var(--skf-border-color-secondary);
|
37
37
|
}
|
38
38
|
|
39
|
-
:host(
|
39
|
+
:host(:state(tertiary)) {
|
40
40
|
--_skf-divider-border-color: var(--skf-border-color-tertiary);
|
41
41
|
}
|
42
42
|
}
|
43
43
|
}
|
44
44
|
`;
|
45
45
|
export {
|
46
|
-
|
46
|
+
o as styles
|
47
47
|
};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import '../icon/icon.js';
|
2
2
|
import { SkfElement } from '../../internal/components/skf-element';
|
3
|
+
import { type Language } from '../../utilities/localize.js';
|
3
4
|
import { type CSSResultGroup } from 'lit';
|
4
5
|
/**
|
5
6
|
* TODO:
|
@@ -8,6 +9,8 @@ import { type CSSResultGroup } from 'lit';
|
|
8
9
|
* - add tests
|
9
10
|
* - add documentation
|
10
11
|
*/
|
12
|
+
type Placement = 'left' | 'right';
|
13
|
+
type Size = 'sm' | 'md' | 'lg';
|
11
14
|
/**
|
12
15
|
* The `<skf-drawer>` is a modal component that displays content and toggle by sliding from left/right viewport edge
|
13
16
|
*
|
@@ -22,25 +25,29 @@ import { type CSSResultGroup } from 'lit';
|
|
22
25
|
* @tagname skf-drawer
|
23
26
|
*/
|
24
27
|
export declare class SkfDrawer extends SkfElement {
|
28
|
+
#private;
|
25
29
|
static styles: CSSResultGroup;
|
26
30
|
/** @internal */
|
27
31
|
private _abortController?;
|
28
32
|
/** @internal */
|
29
33
|
private _signal?;
|
30
|
-
/** If defined, sets the aria-label for the close button */
|
31
|
-
closeButtonAriaLabel: string;
|
32
34
|
/** Heading for the Drawer */
|
33
35
|
heading?: string;
|
36
|
+
/** Sets the internal language of the component */
|
37
|
+
lang: Language;
|
34
38
|
/** Sets the max-width */
|
35
|
-
size:
|
39
|
+
size: Size;
|
36
40
|
/** If true, Drawer is open */
|
37
41
|
open: boolean;
|
38
42
|
/** Placement of the Drawer */
|
39
|
-
placement:
|
43
|
+
placement: Placement;
|
40
44
|
/** @internal */
|
41
45
|
$dialog: HTMLDialogElement;
|
46
|
+
protected firstUpdated(): void;
|
42
47
|
disconnectedCallback(): void;
|
43
48
|
/** @internal */
|
49
|
+
_handleStateChange(property: string, _prev: unknown, next: unknown): void;
|
50
|
+
/** @internal */
|
44
51
|
_placementChanged: () => void;
|
45
52
|
/** @internal */
|
46
53
|
_openChanged(): Promise<void>;
|
@@ -59,3 +66,4 @@ export declare class SkfDrawer extends SkfElement {
|
|
59
66
|
close(): void;
|
60
67
|
render(): import("lit").TemplateResult<1>;
|
61
68
|
}
|
69
|
+
export {};
|
@@ -1,21 +1,37 @@
|
|
1
|
+
var y = (e) => {
|
2
|
+
throw TypeError(e);
|
3
|
+
};
|
4
|
+
var w = (e, i, t) => i.has(e) || y("Cannot " + t);
|
5
|
+
var m = (e, i, t) => (w(e, i, "read from private field"), t ? t.call(e) : i.get(e)), g = (e, i, t) => i.has(e) ? y("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), f = (e, i, t, o) => (w(e, i, "write to private field"), o ? o.call(e, t) : i.set(e, t), t);
|
1
6
|
import "../icon/icon.js";
|
2
|
-
import { SkfElement as
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
import { SkfElement as D } from "../../internal/components/skf-element.js";
|
8
|
+
import { stateMap as k } from "../../internal/helpers/stateMap.js";
|
9
|
+
import { watch as u } from "../../internal/helpers/watch.js";
|
10
|
+
import { MOTION_DURATIONS as b } from "@skf-design-system/ui-assets";
|
11
|
+
import { componentStyles as C } from "../../styles/component.styles.js";
|
12
|
+
import { LocalizeController as $ } from "../../utilities/localize.js";
|
13
|
+
import { html as E } from "lit";
|
14
|
+
import { property as d, query as v } from "lit/decorators.js";
|
15
|
+
import { styles as U } from "./drawer.styles.js";
|
16
|
+
var O = Object.defineProperty, P = Object.getOwnPropertyDescriptor, n = (e, i, t, o) => {
|
17
|
+
for (var s = o > 1 ? void 0 : o ? P(i, t) : i, r = e.length - 1, l; r >= 0; r--)
|
18
|
+
(l = e[r]) && (s = (o ? l(i, t, s) : l(s)) || s);
|
19
|
+
return o && s && O(i, t, s), s;
|
20
|
+
};
|
21
|
+
const I = {
|
22
|
+
placement: ["left", "right"],
|
23
|
+
size: ["sm", "md", "lg"]
|
13
24
|
};
|
14
|
-
|
25
|
+
var h, c, p;
|
26
|
+
const _ = class _ extends D {
|
15
27
|
constructor() {
|
16
|
-
super(...arguments)
|
17
|
-
|
18
|
-
|
28
|
+
super(...arguments);
|
29
|
+
g(this, h);
|
30
|
+
g(this, c);
|
31
|
+
g(this, p);
|
32
|
+
f(this, h, new $(this)), f(this, c, this.attachInternals()), f(this, p, m(this, c).states), this.lang = "en", this.size = "md", this.open = !1, this.placement = "right", this._placementChanged = () => {
|
33
|
+
this.$dialog.getAnimations().forEach((o) => {
|
34
|
+
o.cancel();
|
19
35
|
});
|
20
36
|
}, this._clickstartInDialog = !1, this._handleMouseDown = (t) => {
|
21
37
|
this._clickIsInsideElement(t, this.$dialog) && (this._clickstartInDialog = !0);
|
@@ -26,13 +42,17 @@ const c = class c extends m {
|
|
26
42
|
}
|
27
43
|
};
|
28
44
|
}
|
45
|
+
firstUpdated() {
|
46
|
+
this.open && this._openChanged();
|
47
|
+
}
|
29
48
|
disconnectedCallback() {
|
30
|
-
|
31
|
-
|
49
|
+
super.disconnectedCallback(), this._abortController?.abort();
|
50
|
+
}
|
51
|
+
_handleStateChange(t, o, s) {
|
52
|
+
k(m(this, p), I[t]).set(s);
|
32
53
|
}
|
33
54
|
async _openChanged() {
|
34
|
-
|
35
|
-
this.open ? (this._abortController = new AbortController(), this._signal = this._abortController.signal, this.$dialog.showModal(), this._startListeners(), await this._animateDrawer(), this.emit("skf-drawer-opened")) : ((t = this._abortController) == null || t.abort(), this.emit("skf-drawer-closing"), await this._animateDrawer(), this.emit("skf-drawer-closed"), this.$dialog.close());
|
55
|
+
this.open ? (this._abortController = new AbortController(), this._signal = this._abortController.signal, this.$dialog.showModal(), this._startListeners(), await this._animateDrawer(), this.emit("skf-drawer-opened")) : (this._abortController?.abort(), this.emit("skf-drawer-closing"), await this._animateDrawer(), this.emit("skf-drawer-closed"), this.$dialog.close());
|
36
56
|
}
|
37
57
|
/** @internal */
|
38
58
|
_startListeners() {
|
@@ -47,26 +67,26 @@ const c = class c extends m {
|
|
47
67
|
});
|
48
68
|
}
|
49
69
|
/** @internal */
|
50
|
-
_clickIsInsideElement(t,
|
51
|
-
const
|
52
|
-
return
|
70
|
+
_clickIsInsideElement(t, o) {
|
71
|
+
const s = o.getBoundingClientRect();
|
72
|
+
return s.top <= t.clientY && t.clientY <= s.top + s.height && s.left <= t.clientX && t.clientX <= s.left + s.width;
|
53
73
|
}
|
54
74
|
/** @internal */
|
55
75
|
_animateDrawer() {
|
56
|
-
const t = this.open ? [{ opacity: 0 }, { opacity: 0.4 }] : [{ opacity: 0 }],
|
57
|
-
return new Promise((
|
76
|
+
const t = this.open ? [{ opacity: 0 }, { opacity: 0.4 }] : [{ opacity: 0 }], o = this.open ? [{ translate: "0" }] : [{ translate: this.placement === "right" ? "100%" : "-100%" }];
|
77
|
+
return new Promise((s) => {
|
58
78
|
requestAnimationFrame(() => {
|
59
|
-
const
|
60
|
-
duration:
|
79
|
+
const r = this.$dialog.animate(t, {
|
80
|
+
duration: b.normal,
|
61
81
|
fill: "forwards",
|
62
82
|
pseudoElement: "::backdrop"
|
63
|
-
}),
|
64
|
-
duration:
|
83
|
+
}), l = this.$dialog.animate(o, {
|
84
|
+
duration: b.normal,
|
65
85
|
easing: "ease-out",
|
66
86
|
fill: "forwards"
|
67
87
|
});
|
68
|
-
Promise.all([
|
69
|
-
|
88
|
+
Promise.all([r.finished, l.finished]).then(() => {
|
89
|
+
s("Animations finished");
|
70
90
|
}).catch(() => {
|
71
91
|
throw new Error("Animation failed");
|
72
92
|
});
|
@@ -77,14 +97,14 @@ const c = class c extends m {
|
|
77
97
|
this.open = !1;
|
78
98
|
}
|
79
99
|
render() {
|
80
|
-
return
|
81
|
-
<dialog @mousedown
|
100
|
+
return E`
|
101
|
+
<dialog @mousedown=${this._handleMouseDown} @mouseup=${this._handleMouseUp} aria-modal="true">
|
82
102
|
<header>
|
83
103
|
<h2>${this.heading}</h2>
|
84
104
|
<button
|
85
|
-
|
105
|
+
@click=${() => this.open = !1}
|
106
|
+
aria-label=${m(this, h).term("close")}
|
86
107
|
id="close-button"
|
87
|
-
@click="${() => this.open = !1}"
|
88
108
|
>
|
89
109
|
<skf-icon name="close" color="inverse"></skf-icon>
|
90
110
|
</button>
|
@@ -94,32 +114,35 @@ const c = class c extends m {
|
|
94
114
|
`;
|
95
115
|
}
|
96
116
|
};
|
97
|
-
c.styles = [
|
98
|
-
let
|
99
|
-
|
100
|
-
|
101
|
-
],
|
102
|
-
|
103
|
-
|
104
|
-
],
|
105
|
-
|
106
|
-
|
107
|
-
],
|
108
|
-
|
109
|
-
|
110
|
-
],
|
111
|
-
|
112
|
-
|
113
|
-
],
|
114
|
-
|
115
|
-
|
116
|
-
],
|
117
|
-
|
118
|
-
|
119
|
-
],
|
120
|
-
|
121
|
-
|
122
|
-
],
|
117
|
+
h = new WeakMap(), c = new WeakMap(), p = new WeakMap(), _.styles = [C, U];
|
118
|
+
let a = _;
|
119
|
+
n([
|
120
|
+
d({ type: String })
|
121
|
+
], a.prototype, "heading", 2);
|
122
|
+
n([
|
123
|
+
d({ type: String })
|
124
|
+
], a.prototype, "lang", 2);
|
125
|
+
n([
|
126
|
+
d({ type: String })
|
127
|
+
], a.prototype, "size", 2);
|
128
|
+
n([
|
129
|
+
d({ type: Boolean, reflect: !0, useDefault: !0 })
|
130
|
+
], a.prototype, "open", 2);
|
131
|
+
n([
|
132
|
+
d({ type: String })
|
133
|
+
], a.prototype, "placement", 2);
|
134
|
+
n([
|
135
|
+
v("dialog")
|
136
|
+
], a.prototype, "$dialog", 2);
|
137
|
+
n([
|
138
|
+
u(Object.keys(I))
|
139
|
+
], a.prototype, "_handleStateChange", 1);
|
140
|
+
n([
|
141
|
+
u("placement", { waitUntilFirstUpdate: !0 })
|
142
|
+
], a.prototype, "_placementChanged", 2);
|
143
|
+
n([
|
144
|
+
u("open", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
145
|
+
], a.prototype, "_openChanged", 1);
|
123
146
|
export {
|
124
|
-
|
147
|
+
a as SkfDrawer
|
125
148
|
};
|