@skf-design-system/ui-components 1.0.2-beta.5 → 1.0.2-beta.7
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/accordion/accordion.component.d.ts +1 -1
- package/dist/components/accordion/accordion.component.js +2 -2
- 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 +4 -2
- package/dist/components/checkbox/checkbox.component.js +73 -65
- 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 +151 -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.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 +11 -4
- package/dist/components/drawer/drawer.component.js +77 -55
- 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 +66 -57
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/icon/icon.component.js +7 -7
- package/dist/components/icon/icon.styles.js +2 -2
- package/dist/components/input/input.component.d.ts +4 -8
- package/dist/components/input/input.component.js +147 -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.d.ts +15 -18
- package/dist/components/link/link.component.js +105 -107
- package/dist/components/link/link.styles.js +53 -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/menu/menu-item.component.d.ts +1 -1
- package/dist/components/menu/menu-item.component.js +8 -8
- 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/nav/nav-item.component.d.ts +4 -0
- 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.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/progress/progress.component.d.ts +2 -0
- package/dist/components/progress/progress.component.js +38 -29
- package/dist/components/progress/progress.styles.js +4 -4
- 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-group.component.d.ts +4 -0
- package/dist/components/select/select-option-group.component.js +37 -18
- package/dist/components/select/select-option-group.style.js +12 -6
- package/dist/components/select/select-option.component.d.ts +7 -2
- package/dist/components/select/select-option.component.js +70 -53
- package/dist/components/select/select-option.styles.js +43 -31
- package/dist/components/select/select.component.d.ts +18 -10
- package/dist/components/select/select.component.js +175 -132
- package/dist/components/select/select.controllers.js +2 -1
- 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 +26 -23
- 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-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/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 +127 -118
- 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 +18 -18
- package/dist/components/tooltip/tooltip.component.d.ts +9 -2
- package/dist/components/tooltip/tooltip.component.js +13 -7
- package/dist/custom-elements.json +1305 -946
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -20
- package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
- package/dist/internal/base-classes/popover/popover.base.js +28 -29
- package/dist/internal/base-classes/popover/popover.styles.js +4 -5
- 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/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/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 +243 -128
- package/dist/types/vue/index.d.ts +136 -127
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +168 -177
- package/dist/web-types.json +411 -381
- package/package.json +34 -41
@@ -1,30 +1,32 @@
|
|
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 h = (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 c, 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
|
+
}, u, g, y, p;
|
22
|
+
const m = class m extends b {
|
22
23
|
constructor() {
|
23
24
|
super(...arguments);
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
f(this, u);
|
26
|
+
f(this, g);
|
27
|
+
f(this, y);
|
28
|
+
f(this, p);
|
29
|
+
d(this, u, new P(this)), d(this, g, 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();
|
@@ -44,7 +46,7 @@ const y = class y extends C {
|
|
44
46
|
/** @internal */
|
45
47
|
_transition() {
|
46
48
|
const t = this.fullscreen ? {} : {
|
47
|
-
translate: `${String(
|
49
|
+
translate: `${String(h(this, g))} ${String(h(this, y))}px`
|
48
50
|
};
|
49
51
|
return { entry: () => new Promise((a) => {
|
50
52
|
if (!this.$dialog) {
|
@@ -109,15 +111,15 @@ const y = class y extends C {
|
|
109
111
|
}
|
110
112
|
/** Method that closes the dialog */
|
111
113
|
async close() {
|
112
|
-
if (
|
113
|
-
|
114
|
+
if (h(this, p) || !this.open) return;
|
115
|
+
d(this, p, !0);
|
114
116
|
async function t(o) {
|
115
|
-
return o.$dialog ? (o.emit("skf-dialog-closing"), await o._transition().exit(), o.$dialog.close(), o.open = !1,
|
117
|
+
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
118
|
}
|
117
119
|
return await t(this);
|
118
120
|
}
|
119
121
|
render() {
|
120
|
-
return
|
122
|
+
return w`
|
121
123
|
<dialog
|
122
124
|
@close=${this._handleClose}
|
123
125
|
@mousedown=${this._handleBackdropClick}
|
@@ -125,7 +127,7 @@ const y = class y extends C {
|
|
125
127
|
@keydown=${this._handleKeyDown}
|
126
128
|
aria-modal="true"
|
127
129
|
autofocus
|
128
|
-
class=${
|
130
|
+
class=${C({
|
129
131
|
dialog: !0,
|
130
132
|
"dialog--fullscreen": this.fullscreen,
|
131
133
|
"dialog--no-padding": this.noPadding
|
@@ -133,10 +135,10 @@ const y = class y extends C {
|
|
133
135
|
>
|
134
136
|
<div class="dialog__head">
|
135
137
|
<h2 class="dialog__heading">${this.heading}</h2>
|
136
|
-
${this.noCloseButton ?
|
138
|
+
${this.noCloseButton ? E : w`
|
137
139
|
<button
|
138
140
|
@click=${this._handleClose}
|
139
|
-
aria-label=${this.
|
141
|
+
aria-label=${h(this, u).term("close")}
|
140
142
|
class="dialog__close-btn"
|
141
143
|
>
|
142
144
|
<skf-icon name="close" color="inverse"></skf-icon>
|
@@ -146,7 +148,7 @@ const y = class y extends C {
|
|
146
148
|
<div class="dialog__body">
|
147
149
|
<slot class="dialog__main"></slot>
|
148
150
|
<slot
|
149
|
-
class=${
|
151
|
+
class=${C({
|
150
152
|
dialog__foot: !0,
|
151
153
|
"dialog__foot--hidden": !this.renderFoot
|
152
154
|
})}
|
@@ -157,17 +159,17 @@ const y = class y extends C {
|
|
157
159
|
`;
|
158
160
|
}
|
159
161
|
};
|
160
|
-
|
161
|
-
let s =
|
162
|
-
n([
|
163
|
-
c({ attribute: "close-button-aria-label" })
|
164
|
-
], s.prototype, "closeButtonAriaLabel", 2);
|
162
|
+
u = new WeakMap(), g = new WeakMap(), y = new WeakMap(), p = new WeakMap(), m.styles = [B, D];
|
163
|
+
let s = m;
|
165
164
|
n([
|
166
165
|
c()
|
167
166
|
], s.prototype, "heading", 2);
|
168
167
|
n([
|
169
168
|
c({ type: Boolean })
|
170
169
|
], s.prototype, "fullscreen", 2);
|
170
|
+
n([
|
171
|
+
c({ type: String })
|
172
|
+
], s.prototype, "lang", 2);
|
171
173
|
n([
|
172
174
|
c({ type: Boolean, attribute: "no-close-button" })
|
173
175
|
], s.prototype, "noCloseButton", 2);
|
@@ -178,19 +180,19 @@ n([
|
|
178
180
|
c({ type: Boolean, reflect: !0 })
|
179
181
|
], s.prototype, "open", 2);
|
180
182
|
n([
|
181
|
-
|
183
|
+
v()
|
182
184
|
], s.prototype, "onClose", 2);
|
183
185
|
n([
|
184
|
-
|
186
|
+
v()
|
185
187
|
], s.prototype, "renderFoot", 2);
|
186
188
|
n([
|
187
|
-
|
189
|
+
O("dialog")
|
188
190
|
], s.prototype, "$dialog", 2);
|
189
191
|
n([
|
190
|
-
|
192
|
+
x({ slot: "footer" })
|
191
193
|
], s.prototype, "footerEls", 2);
|
192
194
|
n([
|
193
|
-
|
195
|
+
k("open")
|
194
196
|
], s.prototype, "handleOpenChange", 1);
|
195
197
|
export {
|
196
198
|
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,28 @@ 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;
|
42
46
|
disconnectedCallback(): void;
|
43
47
|
/** @internal */
|
48
|
+
_handleStateChange(property: string, _prev: unknown, next: unknown): void;
|
49
|
+
/** @internal */
|
44
50
|
_placementChanged: () => void;
|
45
51
|
/** @internal */
|
46
52
|
_openChanged(): Promise<void>;
|
@@ -59,3 +65,4 @@ export declare class SkfDrawer extends SkfElement {
|
|
59
65
|
close(): void;
|
60
66
|
render(): import("lit").TemplateResult<1>;
|
61
67
|
}
|
68
|
+
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 O } from "./drawer.styles.js";
|
16
|
+
var P = Object.defineProperty, U = Object.getOwnPropertyDescriptor, n = (e, i, t, o) => {
|
17
|
+
for (var s = o > 1 ? void 0 : o ? U(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 && P(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);
|
@@ -30,6 +46,9 @@ const c = class c extends m {
|
|
30
46
|
var t;
|
31
47
|
super.disconnectedCallback(), (t = this._abortController) == null || t.abort();
|
32
48
|
}
|
49
|
+
_handleStateChange(t, o, s) {
|
50
|
+
k(m(this, p), I[t]).set(s);
|
51
|
+
}
|
33
52
|
async _openChanged() {
|
34
53
|
var t;
|
35
54
|
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());
|
@@ -47,26 +66,26 @@ const c = class c extends m {
|
|
47
66
|
});
|
48
67
|
}
|
49
68
|
/** @internal */
|
50
|
-
_clickIsInsideElement(t,
|
51
|
-
const
|
52
|
-
return
|
69
|
+
_clickIsInsideElement(t, o) {
|
70
|
+
const s = o.getBoundingClientRect();
|
71
|
+
return s.top <= t.clientY && t.clientY <= s.top + s.height && s.left <= t.clientX && t.clientX <= s.left + s.width;
|
53
72
|
}
|
54
73
|
/** @internal */
|
55
74
|
_animateDrawer() {
|
56
|
-
const t = this.open ? [{ opacity: 0 }, { opacity: 0.4 }] : [{ opacity: 0 }],
|
57
|
-
return new Promise((
|
75
|
+
const t = this.open ? [{ opacity: 0 }, { opacity: 0.4 }] : [{ opacity: 0 }], o = this.open ? [{ translate: "0" }] : [{ translate: this.placement === "right" ? "100%" : "-100%" }];
|
76
|
+
return new Promise((s) => {
|
58
77
|
requestAnimationFrame(() => {
|
59
|
-
const
|
60
|
-
duration:
|
78
|
+
const r = this.$dialog.animate(t, {
|
79
|
+
duration: b.normal,
|
61
80
|
fill: "forwards",
|
62
81
|
pseudoElement: "::backdrop"
|
63
|
-
}),
|
64
|
-
duration:
|
82
|
+
}), l = this.$dialog.animate(o, {
|
83
|
+
duration: b.normal,
|
65
84
|
easing: "ease-out",
|
66
85
|
fill: "forwards"
|
67
86
|
});
|
68
|
-
Promise.all([
|
69
|
-
|
87
|
+
Promise.all([r.finished, l.finished]).then(() => {
|
88
|
+
s("Animations finished");
|
70
89
|
}).catch(() => {
|
71
90
|
throw new Error("Animation failed");
|
72
91
|
});
|
@@ -77,12 +96,12 @@ const c = class c extends m {
|
|
77
96
|
this.open = !1;
|
78
97
|
}
|
79
98
|
render() {
|
80
|
-
return
|
99
|
+
return E`
|
81
100
|
<dialog @mousedown="${this._handleMouseDown}" @mouseup="${this._handleMouseUp}">
|
82
101
|
<header>
|
83
102
|
<h2>${this.heading}</h2>
|
84
103
|
<button
|
85
|
-
aria-label=${this.
|
104
|
+
aria-label=${m(this, h).term("close")}
|
86
105
|
id="close-button"
|
87
106
|
@click="${() => this.open = !1}"
|
88
107
|
>
|
@@ -94,32 +113,35 @@ const c = class c extends m {
|
|
94
113
|
`;
|
95
114
|
}
|
96
115
|
};
|
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
|
-
],
|
116
|
+
h = new WeakMap(), c = new WeakMap(), p = new WeakMap(), _.styles = [C, O];
|
117
|
+
let a = _;
|
118
|
+
n([
|
119
|
+
d({ type: String })
|
120
|
+
], a.prototype, "heading", 2);
|
121
|
+
n([
|
122
|
+
d({ type: String })
|
123
|
+
], a.prototype, "lang", 2);
|
124
|
+
n([
|
125
|
+
d({ type: String })
|
126
|
+
], a.prototype, "size", 2);
|
127
|
+
n([
|
128
|
+
d({ type: Boolean, reflect: !0, useDefault: !0 })
|
129
|
+
], a.prototype, "open", 2);
|
130
|
+
n([
|
131
|
+
d({ type: String })
|
132
|
+
], a.prototype, "placement", 2);
|
133
|
+
n([
|
134
|
+
v("dialog")
|
135
|
+
], a.prototype, "$dialog", 2);
|
136
|
+
n([
|
137
|
+
u(Object.keys(I))
|
138
|
+
], a.prototype, "_handleStateChange", 1);
|
139
|
+
n([
|
140
|
+
u("placement", { waitUntilFirstUpdate: !0 })
|
141
|
+
], a.prototype, "_placementChanged", 2);
|
142
|
+
n([
|
143
|
+
u("open", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
144
|
+
], a.prototype, "_openChanged", 1);
|
123
145
|
export {
|
124
|
-
|
146
|
+
a as SkfDrawer
|
125
147
|
};
|
@@ -1,19 +1,20 @@
|
|
1
1
|
import { css as e } from "lit";
|
2
2
|
const o = e`
|
3
3
|
@layer components {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
flex-direction: column;
|
9
|
-
inline-size: min(100%, var(--_skf-drawer-size, 540px));
|
10
|
-
inset-block: 0;
|
11
|
-
inset-inline: var(--_skf-drawer-inset, auto 0);
|
12
|
-
position: fixed;
|
13
|
-
translate: 100% 0;
|
4
|
+
@layer base {
|
5
|
+
dialog {
|
6
|
+
--_skf-drawer-inset: auto 0;
|
7
|
+
--_skf-drawer-size: 540px;
|
14
8
|
|
15
|
-
|
16
|
-
|
9
|
+
all: unset;
|
10
|
+
background-color: var(--skf-bg-color-neutral-1);
|
11
|
+
display: none;
|
12
|
+
flex-direction: column;
|
13
|
+
inline-size: min(100%, var(--_skf-drawer-size));
|
14
|
+
inset-block: 0;
|
15
|
+
inset-inline: var(--_skf-drawer-inset);
|
16
|
+
position: fixed;
|
17
|
+
translate: 100% 0;
|
17
18
|
|
18
19
|
&::backdrop {
|
19
20
|
background-color: var(--skf-bg-color-neutral-7);
|
@@ -21,48 +22,54 @@ const o = e`
|
|
21
22
|
}
|
22
23
|
}
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
header {
|
26
|
+
align-items: center;
|
27
|
+
background-color: var(--skf-bg-color-emphasized);
|
28
|
+
block-size: var(--skf-size-48);
|
29
|
+
color: var(--skf-text-color-inverse);
|
30
|
+
display: flex;
|
31
|
+
justify-content: space-between;
|
32
|
+
padding-inline: var(--skf-box-spacing);
|
33
|
+
}
|
26
34
|
|
27
|
-
|
35
|
+
h2 {
|
36
|
+
font-size: var(--skf-font-size-200);
|
28
37
|
}
|
29
38
|
|
30
|
-
|
31
|
-
|
39
|
+
#close-button {
|
40
|
+
display: inline-flex;
|
32
41
|
}
|
33
42
|
|
34
|
-
|
35
|
-
|
43
|
+
#body {
|
44
|
+
display: block;
|
45
|
+
flex: auto;
|
46
|
+
padding: var(--skf-box-spacing);
|
36
47
|
}
|
37
48
|
}
|
38
49
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
display: flex;
|
45
|
-
justify-content: space-between;
|
46
|
-
padding-inline: var(--skf-box-spacing);
|
50
|
+
@layer states {
|
51
|
+
#close-button:focus-visible {
|
52
|
+
border-radius: var(--skf-border-radius-sm);
|
53
|
+
outline: var(--skf-border-width-sm) solid var(--skf-interactive-text-color-inverse);
|
54
|
+
}
|
47
55
|
}
|
48
56
|
|
49
|
-
|
50
|
-
|
51
|
-
|
57
|
+
@layer mods {
|
58
|
+
dialog[open] {
|
59
|
+
display: flex;
|
60
|
+
}
|
52
61
|
|
53
|
-
|
54
|
-
|
62
|
+
:host(:state(left)) dialog {
|
63
|
+
--_skf-drawer-inset: 0 auto;
|
64
|
+
}
|
55
65
|
|
56
|
-
|
57
|
-
|
58
|
-
outline: var(--skf-border-width-sm) solid var(--skf-interactive-text-color-inverse);
|
66
|
+
:host(:state(sm)) dialog {
|
67
|
+
--_skf-drawer-size: 400px;
|
59
68
|
}
|
60
|
-
}
|
61
69
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
padding: var(--skf-box-spacing);
|
70
|
+
:host(:state(lg)) dialog {
|
71
|
+
--_skf-drawer-size: 680px;
|
72
|
+
}
|
66
73
|
}
|
67
74
|
}
|
68
75
|
`;
|