@skf-design-system/ui-components 1.0.0-alpha.41 → 1.0.0-alpha.42
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 +1 -1
- package/dist/components/button/button.component.js +70 -66
- package/dist/components/button/button.styles.d.ts +1 -1
- package/dist/components/button/button.styles.js +117 -113
- package/dist/components/datepicker/datepicker-popup.component.js +13 -11
- package/dist/components/switch/switch.component.d.ts +2 -0
- package/dist/components/switch/switch.component.js +44 -37
- package/dist/internal/base-classes/popover/popover.base.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<a href="https://teams.microsoft.com/l/team/19%3A15d8521717e14c419998b0fed71289a5%40thread.tacv2/conversations?groupId=286b39ed-ed94-43da-8a3f-383319f6c9dc&tenantId=41875f2b-33e8-4670-92a8-f643afbb243a">
|
|
23
23
|
<img alt="MS Teams" src="https://img.shields.io/badge/MS Teams-4E5FBF?style=for-the-badge&logo=windows&logoColor=white">
|
|
24
24
|
</a>
|
|
25
|
-
<a href="https://
|
|
25
|
+
<a href="https://v1--661e8ae0ef9b24dadeea9b18.chromatic.com/?path=/docs/introduction-welcome--overview">
|
|
26
26
|
<img alt="Storybook - Stable" src="https://img.shields.io/badge/Stable-FF4785?style=for-the-badge&logo=storybook&logoColor=white">
|
|
27
27
|
</a>
|
|
28
28
|
<a href="https://zeroheight.com/853e936c9/p/07d378-component-overview">
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var f = (i, e, t) => e.has(i) || m("Cannot " + t);
|
|
5
|
+
var d = (i, e, t) => (f(i, e, "read from private field"), t ? t.call(i) : e.get(i)), u = (i, e, t) => e.has(i) ? m("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), _ = (i, e, t, a) => (f(i, e, "write to private field"), a ? a.call(i, t) : e.set(i, t), t);
|
|
6
6
|
import "../icon/icon.js";
|
|
7
7
|
import "../loader/loader.js";
|
|
8
|
-
import { SkfElement as
|
|
9
|
-
import { watch as
|
|
10
|
-
import { componentStyles as
|
|
11
|
-
import { html as
|
|
12
|
-
import { property as r, state as
|
|
13
|
-
import { classMap as
|
|
14
|
-
import { ifDefined as
|
|
15
|
-
import { styles as
|
|
16
|
-
var
|
|
17
|
-
for (var n = a > 1 ? void 0 : a ? F(e, t) : e,
|
|
18
|
-
(
|
|
19
|
-
return a && n &&
|
|
8
|
+
import { SkfElement as O } from "../../internal/components/skf-element.js";
|
|
9
|
+
import { watch as V } from "../../internal/helpers/watch.js";
|
|
10
|
+
import { componentStyles as w } from "../../styles/component.styles.js";
|
|
11
|
+
import { html as y, LitElement as z, nothing as v } from "lit";
|
|
12
|
+
import { property as r, state as P, query as b } from "lit/decorators.js";
|
|
13
|
+
import { classMap as $ } from "lit/directives/class-map.js";
|
|
14
|
+
import { ifDefined as g } from "lit/directives/if-defined.js";
|
|
15
|
+
import { styles as C } from "./button.styles.js";
|
|
16
|
+
var L = Object.defineProperty, F = Object.getOwnPropertyDescriptor, o = (i, e, t, a) => {
|
|
17
|
+
for (var n = a > 1 ? void 0 : a ? F(e, t) : e, p = i.length - 1, c; p >= 0; p--)
|
|
18
|
+
(c = i[p]) && (n = (a ? c(e, t, n) : c(n)) || n);
|
|
19
|
+
return a && n && L(e, t, n), n;
|
|
20
20
|
}, l;
|
|
21
|
-
const
|
|
21
|
+
const h = class h extends O {
|
|
22
22
|
constructor() {
|
|
23
23
|
super();
|
|
24
|
-
|
|
24
|
+
u(this, l);
|
|
25
25
|
this._transitionOptions = {
|
|
26
26
|
duration: 200,
|
|
27
27
|
fill: "forwards"
|
|
28
28
|
}, this.destructive = !1, this.disabled = !1, this.iconOnly = !1, this.iconPosition = "left", this.loading = !1, this.noValidate = !1, this.size = "md", this.type = "button", this.variant = "primary", this._loaderVisible = !1, this._handleClick = (t) => {
|
|
29
29
|
t.preventDefault(), t.stopPropagation(), !(this.disabled || this.loading) && (this.dispatchEvent(new CustomEvent("click", { bubbles: !0, composed: !0, detail: t })), this.type === "submit" && this._submitForm(), this.type === "reset" && this._resetForm());
|
|
30
30
|
}, this._submitForm = () => {
|
|
31
|
-
const t = !
|
|
32
|
-
(a || n) && t ||
|
|
31
|
+
const t = !d(this, l).form?.reportValidity(), a = !this.noValidate, n = !d(this, l).form?.hasAttribute("no-validate");
|
|
32
|
+
(a || n) && t || d(this, l).form?.requestSubmit();
|
|
33
33
|
}, this._resetForm = () => {
|
|
34
|
-
|
|
35
|
-
}, this._renderIcon = () =>
|
|
34
|
+
d(this, l).form?.reset();
|
|
35
|
+
}, this._renderIcon = () => y`<skf-icon data-color="custom" name=${g(this.icon)}></skf-icon>`, _(this, l, this.attachInternals());
|
|
36
36
|
}
|
|
37
37
|
firstUpdated(t) {
|
|
38
38
|
if (t.has("loading") && this.loading) {
|
|
@@ -56,12 +56,16 @@ const d = class d extends g {
|
|
|
56
56
|
!this.$body || !this.$loader || (await this.$loader.animate({ opacity: 0 }, this._transitionOptions).finished, this._loaderVisible = !1, this.$body.animate({ opacity: 1 }, this._transitionOptions));
|
|
57
57
|
}
|
|
58
58
|
render() {
|
|
59
|
-
|
|
59
|
+
const t = {
|
|
60
|
+
btn__label: !0,
|
|
61
|
+
"visually-hidden": this.iconOnly
|
|
62
|
+
};
|
|
63
|
+
return y`
|
|
60
64
|
<button
|
|
61
65
|
?disabled=${this.disabled || this.loading}
|
|
62
66
|
@click=${this._handleClick}
|
|
63
67
|
aria-busy=${this.loading}
|
|
64
|
-
class=${
|
|
68
|
+
class=${$({
|
|
65
69
|
btn: !0,
|
|
66
70
|
"btn--destructive": this.destructive,
|
|
67
71
|
"btn--icon-only": this.iconOnly,
|
|
@@ -72,67 +76,67 @@ const d = class d extends g {
|
|
|
72
76
|
"btn--variant-secondary": this.variant === "secondary",
|
|
73
77
|
"btn--variant-tertiary": this.variant === "tertiary"
|
|
74
78
|
})}
|
|
75
|
-
type=${
|
|
79
|
+
type=${g(this.type)}
|
|
76
80
|
title=${/* An empty title prevents browser validation tooltips from appearing on hover */
|
|
77
81
|
this.title}
|
|
78
82
|
>
|
|
79
|
-
${this.variant === "primary" && this._loaderVisible ?
|
|
83
|
+
${this.variant === "primary" && this._loaderVisible ? y`<skf-loader class="btn__loader" invert size="sm"></skf-loader>` : ""}
|
|
80
84
|
<div class="btn__body" id="body">
|
|
81
|
-
${this.icon && this.iconPosition === "left" ? this._renderIcon() :
|
|
82
|
-
|
|
83
|
-
${this.icon && this.iconPosition === "right" ? this._renderIcon() :
|
|
85
|
+
${this.icon && this.iconPosition === "left" ? this._renderIcon() : v}
|
|
86
|
+
<slot class=${$(t)}></slot>
|
|
87
|
+
${this.icon && this.iconPosition === "right" ? this._renderIcon() : v}
|
|
84
88
|
</div>
|
|
85
89
|
</button>
|
|
86
90
|
`;
|
|
87
91
|
}
|
|
88
92
|
};
|
|
89
|
-
l = new WeakMap(),
|
|
90
|
-
let
|
|
91
|
-
|
|
93
|
+
l = new WeakMap(), h.styles = [w, C], h.formAssociated = !0, h.shadowRootOptions = { ...z.shadowRootOptions, delegatesFocus: !0 };
|
|
94
|
+
let s = h;
|
|
95
|
+
o([
|
|
92
96
|
r({ type: Boolean })
|
|
93
|
-
],
|
|
94
|
-
|
|
97
|
+
], s.prototype, "destructive", 2);
|
|
98
|
+
o([
|
|
95
99
|
r({ type: Boolean })
|
|
96
|
-
],
|
|
97
|
-
|
|
100
|
+
], s.prototype, "disabled", 2);
|
|
101
|
+
o([
|
|
98
102
|
r()
|
|
99
|
-
],
|
|
100
|
-
|
|
103
|
+
], s.prototype, "icon", 2);
|
|
104
|
+
o([
|
|
101
105
|
r({ type: Boolean, attribute: "icon-only" })
|
|
102
|
-
],
|
|
103
|
-
|
|
106
|
+
], s.prototype, "iconOnly", 2);
|
|
107
|
+
o([
|
|
104
108
|
r({ attribute: "icon-position" })
|
|
105
|
-
],
|
|
106
|
-
|
|
109
|
+
], s.prototype, "iconPosition", 2);
|
|
110
|
+
o([
|
|
107
111
|
r({ type: Boolean, reflect: !0 })
|
|
108
|
-
],
|
|
109
|
-
|
|
112
|
+
], s.prototype, "loading", 2);
|
|
113
|
+
o([
|
|
110
114
|
r({ type: Boolean, attribute: "no-validate" })
|
|
111
|
-
],
|
|
112
|
-
|
|
115
|
+
], s.prototype, "noValidate", 2);
|
|
116
|
+
o([
|
|
113
117
|
r({ reflect: !0 })
|
|
114
|
-
],
|
|
115
|
-
|
|
118
|
+
], s.prototype, "size", 2);
|
|
119
|
+
o([
|
|
116
120
|
r()
|
|
117
|
-
],
|
|
118
|
-
|
|
121
|
+
], s.prototype, "type", 2);
|
|
122
|
+
o([
|
|
119
123
|
r({ reflect: !0 })
|
|
120
|
-
],
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
],
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
],
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
],
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
],
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
],
|
|
124
|
+
], s.prototype, "variant", 2);
|
|
125
|
+
o([
|
|
126
|
+
P()
|
|
127
|
+
], s.prototype, "_loaderVisible", 2);
|
|
128
|
+
o([
|
|
129
|
+
b("skf-loader")
|
|
130
|
+
], s.prototype, "$loader", 2);
|
|
131
|
+
o([
|
|
132
|
+
b("#body")
|
|
133
|
+
], s.prototype, "$body", 2);
|
|
134
|
+
o([
|
|
135
|
+
b("button")
|
|
136
|
+
], s.prototype, "$button", 2);
|
|
137
|
+
o([
|
|
138
|
+
V("loading", { afterUpdate: !0 })
|
|
139
|
+
], s.prototype, "_handleLoadingChange", 1);
|
|
136
140
|
export {
|
|
137
|
-
|
|
141
|
+
s as SkfButton
|
|
138
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const styles: import("lit").CSSResult;
|
|
1
|
+
export declare const styles: import("lit").CSSResult[];
|
|
@@ -1,138 +1,142 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
min-inline-size: 64px;
|
|
13
|
-
}
|
|
1
|
+
import { visuallyHidden as o } from "../../styles/util.styles.js";
|
|
2
|
+
import { css as t } from "lit";
|
|
3
|
+
const s = [
|
|
4
|
+
o,
|
|
5
|
+
t`
|
|
6
|
+
/* stylelint-disable selector-class-pattern */
|
|
7
|
+
@layer components {
|
|
8
|
+
:host {
|
|
9
|
+
contain: initial;
|
|
10
|
+
display: inline-block;
|
|
11
|
+
}
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
border: var(--skf-border-width-sm) solid
|
|
19
|
-
var(--_skf-button-state-border-color, var(--_skf-button-border-color));
|
|
20
|
-
border-radius: var(--skf-border-radius-sm);
|
|
21
|
-
color: var(--_skf-button-state-color, var(--_skf-button-color));
|
|
22
|
-
display: inline-flex;
|
|
23
|
-
font-size: var(--_skf-button-font-size, var(--skf-font-size-100));
|
|
24
|
-
font-weight: var(--skf-font-weight-bold);
|
|
25
|
-
position: relative;
|
|
26
|
-
|
|
27
|
-
&:not(.btn--icon-only) {
|
|
28
|
-
inline-size: 100%;
|
|
29
|
-
padding-inline: var(--skf-spacing-100);
|
|
13
|
+
:host(:not([icon-only])) {
|
|
14
|
+
max-inline-size: min(100%, 23ch);
|
|
15
|
+
min-inline-size: 64px;
|
|
30
16
|
}
|
|
31
17
|
|
|
32
|
-
|
|
18
|
+
.btn {
|
|
19
|
+
background-color: var(--_skf-button-state-bg-color, var(--_skf-button-bg-color));
|
|
20
|
+
block-size: var(--_skf-button-block-size);
|
|
21
|
+
border: var(--skf-border-width-sm) solid
|
|
22
|
+
var(--_skf-button-state-border-color, var(--_skf-button-border-color));
|
|
23
|
+
border-radius: var(--skf-border-radius-sm);
|
|
24
|
+
color: var(--_skf-button-state-color, var(--_skf-button-color));
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
font-size: var(--_skf-button-font-size, var(--skf-font-size-100));
|
|
27
|
+
font-weight: var(--skf-font-weight-bold);
|
|
28
|
+
position: relative;
|
|
29
|
+
|
|
30
|
+
&:not(.btn--icon-only) {
|
|
31
|
+
inline-size: 100%;
|
|
32
|
+
padding-inline: var(--skf-spacing-100);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
33
36
|
* State
|
|
34
37
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
&:focus-visible {
|
|
39
|
+
outline: var(--skf-border-width-md) solid var(--skf-interactive-border-color-focus);
|
|
40
|
+
outline-offset: var(--skf-size-2);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:disabled:not([aria-busy='true']) {
|
|
44
|
+
--_skf-button-state-bg-color: var(--_skf-button-bg-color-disabled);
|
|
45
|
+
--_skf-button-state-border-color: var(--_skf-button-border-color-disabled);
|
|
46
|
+
--_skf-button-state-color: var(--_skf-button-color-disabled);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:hover:not(:disabled) {
|
|
50
|
+
--_skf-button-state-bg-color: var(--_skf-button-bg-color-hover);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:active:not(:disabled) {
|
|
54
|
+
--_skf-button-state-bg-color: var(--_skf-button-bg-color-active);
|
|
55
|
+
}
|
|
38
56
|
}
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
--_skf-button-state-color: var(--_skf-button-color-disabled);
|
|
58
|
+
.btn--icon-only {
|
|
59
|
+
aspect-ratio: 1;
|
|
60
|
+
place-content: center;
|
|
44
61
|
}
|
|
45
62
|
|
|
46
|
-
|
|
47
|
-
--_skf-button-state-bg-color: var(--_skf-button-bg-color-hover);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&:active:not(:disabled) {
|
|
51
|
-
--_skf-button-state-bg-color: var(--_skf-button-bg-color-active);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.btn--icon-only {
|
|
56
|
-
aspect-ratio: 1;
|
|
57
|
-
place-content: center;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
63
|
+
/**
|
|
61
64
|
* Size
|
|
62
65
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
.btn--size-sm {
|
|
67
|
+
--_skf-button-block-size: var(--skf-size-32);
|
|
68
|
+
--_skf-button-font-size: var(--skf-font-size-75);
|
|
69
|
+
}
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
.btn--size-md {
|
|
72
|
+
--_skf-button-block-size: var(--skf-size-44);
|
|
73
|
+
}
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
.btn--size-lg {
|
|
76
|
+
--_skf-button-block-size: var(--skf-size-56);
|
|
77
|
+
}
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
/**
|
|
77
80
|
* Variants
|
|
78
81
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
.btn--variant-primary {
|
|
83
|
+
--_skf-button-bg-color: var(--skf-interactive-bg-color-primary);
|
|
84
|
+
--_skf-button-bg-color-disabled: var(--skf-interactive-bg-color-disabled);
|
|
85
|
+
--_skf-button-bg-color-active: var(--skf-interactive-bg-color-primary-active);
|
|
86
|
+
--_skf-button-bg-color-hover: var(--skf-interactive-bg-color-primary-hover);
|
|
87
|
+
--_skf-button-border-color: transparent;
|
|
88
|
+
--_skf-button-color: var(--skf-text-color-inverse);
|
|
89
|
+
--_skf-button-color-disabled: var(--skf-interactive-text-color-disabled);
|
|
90
|
+
}
|
|
88
91
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
.btn--variant-secondary {
|
|
93
|
+
--_skf-button-bg-color: var(--skf-interactive-bg-color-secondary);
|
|
94
|
+
--_skf-button-bg-color-active: var(--skf-interactive-bg-color-secondary-active);
|
|
95
|
+
--_skf-button-bg-color-hover: var(--skf-interactive-bg-color-secondary-hover);
|
|
96
|
+
--_skf-button-border-color: var(--skf-border-color-emphasized);
|
|
97
|
+
--_skf-button-border-color-disabled: var(--skf-interactive-border-color-disabled);
|
|
98
|
+
--_skf-button-color: var(--skf-text-color-emphasized);
|
|
99
|
+
--_skf-button-color-disabled: var(--skf-interactive-text-color-disabled);
|
|
100
|
+
}
|
|
98
101
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
.btn--variant-tertiary {
|
|
103
|
+
--_skf-button-bg-color: transparent;
|
|
104
|
+
--_skf-button-bg-color-active: var(--skf-interactive-bg-color-secondary-active);
|
|
105
|
+
--_skf-button-bg-color-hover: var(--skf-interactive-bg-color-secondary-hover);
|
|
106
|
+
--_skf-button-border-color: transparent;
|
|
107
|
+
--_skf-button-color: var(--skf-text-color-emphasized);
|
|
108
|
+
--_skf-button-color-disabled: var(--skf-interactive-text-color-disabled);
|
|
109
|
+
}
|
|
107
110
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
.btn--destructive:not(.btn--variant-secondary, .btn--variant-tertiary) {
|
|
112
|
+
--_skf-button-bg-color: var(--skf-interactive-bg-color-destructive);
|
|
113
|
+
--_skf-button-bg-color-active: var(--skf-interactive-bg-color-destructive-active);
|
|
114
|
+
--_skf-button-bg-color-hover: var(--skf-interactive-bg-color-destructive-hover);
|
|
115
|
+
}
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
.btn__loader {
|
|
118
|
+
inset: 50% auto auto 50%;
|
|
119
|
+
opacity: 0;
|
|
120
|
+
position: absolute;
|
|
121
|
+
transform: translate(-50%, -50%);
|
|
122
|
+
}
|
|
120
123
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
.btn__body {
|
|
125
|
+
align-items: center;
|
|
126
|
+
display: flex;
|
|
127
|
+
gap: var(--skf-spacing-50);
|
|
128
|
+
min-inline-size: 0;
|
|
129
|
+
}
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
.btn__label {
|
|
132
|
+
display: block;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
}
|
|
133
137
|
}
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
`
|
|
139
|
+
];
|
|
136
140
|
export {
|
|
137
|
-
|
|
141
|
+
s as styles
|
|
138
142
|
};
|
|
@@ -11,7 +11,7 @@ import { LocalizeController as M } from "../../utilities/localize.js";
|
|
|
11
11
|
import { html as m } from "lit";
|
|
12
12
|
import { property as o, state as u } from "lit/decorators.js";
|
|
13
13
|
import "./datepicker-calendar.js";
|
|
14
|
-
import { getDateParts as f, assertISODate as O, earliestDate as V, latestDate as P, compareDates as D, doAnimate as
|
|
14
|
+
import { getDateParts as f, assertISODate as O, earliestDate as V, latestDate as P, compareDates as D, doAnimate as T } from "./datepicker-popup.helpers.js";
|
|
15
15
|
import { styles as L } from "./datepicker-popup.styles.js";
|
|
16
16
|
import { dateFormatter as d, is as Y } from "./datepicker.helpers.js";
|
|
17
17
|
var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (s, i, e, a) => {
|
|
@@ -94,12 +94,14 @@ const _ = class _ extends E {
|
|
|
94
94
|
const e = Math.abs(
|
|
95
95
|
this.selectedDateRange.end.getTime() - this.selectedDateRange.start.getTime()
|
|
96
96
|
), a = Math.ceil(e / (1e3 * 60 * 60 * 24)) + 1;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
this.emit("skf-datepicker-selected-date-range-changed", {
|
|
99
|
+
detail: {
|
|
100
|
+
...this.selectedDateRange,
|
|
101
|
+
days: a,
|
|
102
|
+
id: this.id
|
|
103
|
+
}
|
|
104
|
+
});
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
_handleRangeChange() {
|
|
@@ -176,8 +178,8 @@ const _ = class _ extends E {
|
|
|
176
178
|
return m``;
|
|
177
179
|
if (this.selectableFrom && D(this.selectableFrom, d(/* @__PURE__ */ new Date())) === 1)
|
|
178
180
|
return m``;
|
|
179
|
-
const { month: a, year: t } = f(), { month: r, year: h } = f(this.date), c = this.selectedDate ?? this.selectedDateRange.start, p = a === r && t === h,
|
|
180
|
-
return (p && !c ||
|
|
181
|
+
const { month: a, year: t } = f(), { month: r, year: h } = f(this.date), c = this.selectedDate ?? this.selectedDateRange.start, p = a === r && t === h, C = c && D(d(/* @__PURE__ */ new Date()), d(c), "months") === 0;
|
|
182
|
+
return (p && !c || C && p) && (e = !0), m`
|
|
181
183
|
<div class="today">
|
|
182
184
|
<skf-button
|
|
183
185
|
@click=${this._handleTodayClick}
|
|
@@ -207,11 +209,11 @@ const _ = class _ extends E {
|
|
|
207
209
|
async _animateView(e, a) {
|
|
208
210
|
if (!this.shadowRoot) return;
|
|
209
211
|
const t = [...this.shadowRoot.querySelectorAll("skf-datepicker-calendar")];
|
|
210
|
-
return t.length ? (await
|
|
212
|
+
return t.length ? (await T(
|
|
211
213
|
t,
|
|
212
214
|
[{ opacity: 0, transform: `translateX(calc(16px * ${e.toString()}))` }],
|
|
213
215
|
{ duration: 100, easing: "ease-in", fill: "backwards" }
|
|
214
|
-
), a(), await
|
|
216
|
+
), a(), await T(
|
|
215
217
|
t,
|
|
216
218
|
[
|
|
217
219
|
{ opacity: 0, transform: `translateX(${(-16 * e).toString()}px)` },
|
|
@@ -50,6 +50,8 @@ export declare class SkfSwitch extends FormBase implements FormFieldBaseProps {
|
|
|
50
50
|
/** @internal */
|
|
51
51
|
private _handleChange;
|
|
52
52
|
/** @internal */
|
|
53
|
+
_handleCheckedChange(): void;
|
|
54
|
+
/** @internal */
|
|
53
55
|
private _handleInvalid;
|
|
54
56
|
/** @internal */
|
|
55
57
|
private _resetValue;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u = (t) => {
|
|
2
2
|
throw TypeError(t);
|
|
3
3
|
};
|
|
4
|
-
var c = (t, i, e) => i.has(t) ||
|
|
5
|
-
var v = (t, i, e) => (c(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ?
|
|
4
|
+
var c = (t, i, e) => i.has(t) || u("Cannot " + e);
|
|
5
|
+
var v = (t, i, e) => (c(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ? u("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), m = (t, i, e, h) => (c(t, i, "write to private field"), h ? h.call(t, e) : i.set(t, e), e);
|
|
6
6
|
import { FormBase as _ } from "../../internal/components/formBase.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
import { watch as y } from "../../internal/helpers/watch.js";
|
|
8
|
+
import { Asterisk as b } from "../../internal/templates/asterisk.js";
|
|
9
|
+
import { componentStyles as g } from "../../styles/component.styles.js";
|
|
10
|
+
import { LocalizeController as k } from "../../utilities/localize.js";
|
|
11
|
+
import { nothing as $, html as C } from "lit";
|
|
12
|
+
import { property as l, state as w, query as V } from "lit/decorators.js";
|
|
13
|
+
import { classMap as q } from "lit/directives/class-map.js";
|
|
14
|
+
import { ifDefined as I } from "lit/directives/if-defined.js";
|
|
15
|
+
import { styles as O } from "./switch.styles.js";
|
|
16
|
+
var P = Object.defineProperty, z = Object.getOwnPropertyDescriptor, a = (t, i, e, h) => {
|
|
17
|
+
for (var r = h > 1 ? void 0 : h ? z(i, e) : i, d = t.length - 1, o; d >= 0; d--)
|
|
18
|
+
(o = t[d]) && (r = (h ? o(i, e, r) : o(r)) || r);
|
|
19
|
+
return h && r && P(i, e, r), r;
|
|
20
|
+
}, n;
|
|
21
|
+
const p = class p extends _ {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
23
|
-
f(this,
|
|
24
|
-
m(this,
|
|
24
|
+
f(this, n);
|
|
25
|
+
m(this, n, new k(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.lang = "en", this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
|
|
25
26
|
e.stopPropagation(), this.pristine = !1, this.checked = this.$input?.checked ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.emit("change");
|
|
26
27
|
}, this._handleInvalid = (e) => {
|
|
27
28
|
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && e.preventDefault();
|
|
@@ -56,10 +57,13 @@ const o = class o extends _ {
|
|
|
56
57
|
} else
|
|
57
58
|
this.setValidity({});
|
|
58
59
|
}
|
|
60
|
+
_handleCheckedChange() {
|
|
61
|
+
this.setFormValue(this.checked ? this.value : null), this._validateInput(), this.$input && (this.$input.checked = this.checked);
|
|
62
|
+
}
|
|
59
63
|
render() {
|
|
60
|
-
return
|
|
64
|
+
return C`
|
|
61
65
|
<label
|
|
62
|
-
class=${
|
|
66
|
+
class=${q({
|
|
63
67
|
switch: !0,
|
|
64
68
|
"switch--small": this.size === "sm"
|
|
65
69
|
})}
|
|
@@ -73,50 +77,53 @@ const o = class o extends _ {
|
|
|
73
77
|
@reset=${this._resetValue}
|
|
74
78
|
aria-invalid=${!!this._invalid}
|
|
75
79
|
class="switch__input"
|
|
76
|
-
name=${
|
|
80
|
+
name=${I(this.name)}
|
|
77
81
|
type="checkbox"
|
|
78
82
|
value=${this.value}
|
|
79
83
|
/>
|
|
80
|
-
<div class="switch__label ${this.hideLabel ? "visually-hidden" :
|
|
84
|
+
<div class="switch__label ${this.hideLabel ? "visually-hidden" : $}">
|
|
81
85
|
<slot>${this.label}</slot>
|
|
82
|
-
${this.required ?
|
|
86
|
+
${this.required ? b(v(this, n).term("required"), "switch__asterisk") : null}
|
|
83
87
|
</div>
|
|
84
88
|
</label>
|
|
85
89
|
`;
|
|
86
90
|
}
|
|
87
91
|
};
|
|
88
|
-
|
|
89
|
-
let s =
|
|
92
|
+
n = new WeakMap(), p.styles = [g, O];
|
|
93
|
+
let s = p;
|
|
90
94
|
a([
|
|
91
95
|
l({ type: Boolean })
|
|
92
|
-
], s.prototype, "debug");
|
|
96
|
+
], s.prototype, "debug", 2);
|
|
93
97
|
a([
|
|
94
98
|
l({ type: Boolean, reflect: !0 })
|
|
95
|
-
], s.prototype, "checked");
|
|
99
|
+
], s.prototype, "checked", 2);
|
|
96
100
|
a([
|
|
97
101
|
l({ type: Boolean, attribute: "hide-label", reflect: !0 })
|
|
98
|
-
], s.prototype, "hideLabel");
|
|
102
|
+
], s.prototype, "hideLabel", 2);
|
|
99
103
|
a([
|
|
100
104
|
l()
|
|
101
|
-
], s.prototype, "label");
|
|
105
|
+
], s.prototype, "label", 2);
|
|
102
106
|
a([
|
|
103
107
|
l({ type: String })
|
|
104
|
-
], s.prototype, "lang");
|
|
108
|
+
], s.prototype, "lang", 2);
|
|
105
109
|
a([
|
|
106
110
|
l()
|
|
107
|
-
], s.prototype, "name");
|
|
111
|
+
], s.prototype, "name", 2);
|
|
108
112
|
a([
|
|
109
113
|
l({ reflect: !0 })
|
|
110
|
-
], s.prototype, "size");
|
|
114
|
+
], s.prototype, "size", 2);
|
|
111
115
|
a([
|
|
112
116
|
l()
|
|
113
|
-
], s.prototype, "value");
|
|
117
|
+
], s.prototype, "value", 2);
|
|
114
118
|
a([
|
|
115
|
-
|
|
116
|
-
], s.prototype, "_invalid");
|
|
119
|
+
w()
|
|
120
|
+
], s.prototype, "_invalid", 2);
|
|
117
121
|
a([
|
|
118
122
|
V("input")
|
|
119
|
-
], s.prototype, "$input");
|
|
123
|
+
], s.prototype, "$input", 2);
|
|
124
|
+
a([
|
|
125
|
+
y("checked")
|
|
126
|
+
], s.prototype, "_handleCheckedChange", 1);
|
|
120
127
|
export {
|
|
121
128
|
s as SkfSwitch
|
|
122
129
|
};
|
|
@@ -21,7 +21,10 @@ const s = (l = class extends C {
|
|
|
21
21
|
const r = t.newState === "open";
|
|
22
22
|
this.isOpen = r, this.emit(r ? "skf-opened" : "skf-closed");
|
|
23
23
|
}, this.handleToggleOpen = async () => {
|
|
24
|
-
this.$anchor && (this.isOpen ? (this.$popover.togglePopover(!0), this.$popover.animate([{ opacity: 0 }, { opacity: 1 }], {
|
|
24
|
+
this.$anchor && this.$popover.isConnected && (this.isOpen ? (this.$popover.togglePopover(!0), this.$popover.animate([{ opacity: 0 }, { opacity: 1 }], {
|
|
25
|
+
duration: 250,
|
|
26
|
+
fill: "forwards"
|
|
27
|
+
})) : (await this.$popover.animate([{ opacity: 0 }], { duration: 150, fill: "forwards" }).finished, this.$popover && this.$popover.togglePopover(this.isOpen)));
|
|
25
28
|
}, this.handleAnchorChange = async () => {
|
|
26
29
|
if (!this.anchor) return;
|
|
27
30
|
await this.popoverController.stop(), this.$anchor && this.removeEventListeners();
|
package/package.json
CHANGED