@skf-design-system/ui-components 1.0.0-beta.7 → 1.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert/alert.component.d.ts +2 -2
- package/dist/components/alert/alert.component.js +34 -34
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +29 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb/breadcrumb.styles.d.ts +1 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.d.ts +25 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +8 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.styles.d.ts +1 -0
- package/dist/components/button/button.component.d.ts +6 -4
- package/dist/components/button/button.component.js +87 -70
- package/dist/components/button/button.styles.js +64 -45
- package/dist/components/checkbox/checkbox.component.d.ts +3 -1
- package/dist/components/checkbox/checkbox.component.js +71 -58
- package/dist/components/date-picker/datepicker.calendar.component.d.ts +72 -0
- package/dist/components/date-picker/datepicker.calendar.component.js +382 -0
- package/dist/components/date-picker/datepicker.calendar.styles.d.ts +1 -0
- package/dist/components/date-picker/datepicker.calendar.styles.js +192 -0
- package/dist/components/date-picker/datepicker.component.d.ts +74 -0
- package/dist/components/date-picker/datepicker.component.js +241 -0
- package/dist/components/date-picker/datepicker.d.ts +10 -0
- package/dist/components/date-picker/datepicker.helpers.d.ts +40 -0
- package/dist/components/date-picker/datepicker.helpers.js +69 -0
- package/dist/components/date-picker/datepicker.js +8 -0
- package/dist/components/date-picker/datepicker.styles.d.ts +1 -0
- package/dist/components/date-picker/datepicker.styles.js +99 -0
- package/dist/components/date-picker-input/datepicker-input.component.d.ts +107 -0
- package/dist/components/date-picker-input/datepicker-input.component.js +397 -0
- package/dist/components/date-picker-input/datepicker-input.d.ts +8 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.d.ts +4 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.js +29 -0
- package/dist/components/date-picker-input/datepicker-input.js +6 -0
- package/dist/components/date-picker-input/datepicker-input.styles.d.ts +1 -0
- package/dist/components/date-picker-input/datepicker-input.styles.js +22 -0
- package/dist/components/dialog/dialog.component.d.ts +0 -1
- package/dist/components/dialog/dialog.component.js +2 -4
- package/dist/components/icon/icon.component.d.ts +1 -4
- package/dist/components/icon/icon.component.js +28 -19
- package/dist/components/icon/icon.styles.js +53 -47
- package/dist/components/input/input.component.d.ts +1 -0
- package/dist/components/input/input.component.js +87 -80
- package/dist/components/link/link.component.d.ts +1 -0
- package/dist/components/link/link.component.js +21 -21
- package/dist/components/menu/menu.component.d.ts +24 -0
- package/dist/components/menu/menu.component.js +18 -0
- package/dist/components/menu/menu.d.ts +8 -0
- package/dist/components/menu/menu.js +6 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +11 -0
- package/dist/components/menu-item/menu-item.component.d.ts +25 -0
- package/dist/components/menu-item/menu-item.component.js +13 -0
- package/dist/components/menu-item/menu-item.d.ts +8 -0
- package/dist/components/menu-item/menu-item.js +6 -0
- package/dist/components/menu-item/menu-item.styles.d.ts +1 -0
- package/dist/components/menu-item/menu-item.styles.js +19 -0
- package/dist/components/popover/popover.component.d.ts +29 -0
- package/dist/components/popover/popover.component.js +37 -0
- package/dist/components/popover/popover.d.ts +8 -0
- package/dist/components/popover/popover.js +6 -0
- package/dist/components/popover/popover.styles.d.ts +1 -0
- package/dist/components/popover/popover.styles.js +12 -0
- package/dist/components/select/select.component.d.ts +8 -10
- package/dist/components/select/select.component.js +115 -118
- package/dist/components/select/select.controllers.d.ts +0 -25
- package/dist/components/select/select.controllers.js +35 -95
- package/dist/components/stepper/stepper.component.d.ts +38 -0
- package/dist/components/stepper/stepper.component.js +91 -0
- package/dist/components/stepper/stepper.d.ts +8 -0
- package/dist/components/stepper/stepper.helpers.d.ts +16 -0
- package/dist/components/stepper/stepper.helpers.js +18 -0
- package/dist/components/stepper/stepper.js +6 -0
- package/dist/components/stepper/stepper.styles.d.ts +1 -0
- package/dist/components/stepper/stepper.styles.js +15 -0
- package/dist/components/stepper-item/stepper-item.component.d.ts +47 -0
- package/dist/components/stepper-item/stepper-item.component.js +113 -0
- package/dist/components/stepper-item/stepper-item.d.ts +8 -0
- package/dist/components/stepper-item/stepper-item.js +6 -0
- package/dist/components/stepper-item/stepper-item.styles.d.ts +1 -0
- package/dist/components/stepper-item/stepper-item.styles.js +98 -0
- package/dist/components/toast/toast.component.d.ts +7 -4
- package/dist/components/toast/toast.component.js +24 -20
- package/dist/components/toast/toast.singleton.d.ts +2 -7
- package/dist/components/toast/toast.singleton.js +25 -25
- package/dist/components/toast-item/toast-item.component.js +15 -15
- package/dist/components/toast-item/toast-item.styles.js +13 -11
- package/dist/components/tooltip/tooltip.component.d.ts +24 -0
- package/dist/components/tooltip/tooltip.component.js +18 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +6 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.styles.js +12 -0
- package/dist/custom-elements.json +3278 -1321
- package/dist/index.d.ts +8 -0
- package/dist/index.js +78 -54
- package/dist/internal/base-classes/popover/popover.base.d.ts +29 -0
- package/dist/internal/base-classes/popover/popover.base.js +116 -0
- package/dist/internal/base-classes/popover/popover.styles.d.ts +1 -0
- package/dist/internal/base-classes/popover/popover.styles.js +29 -0
- package/dist/internal/controllers/popover.controller.d.ts +17 -0
- package/dist/internal/controllers/popover.controller.js +44 -0
- package/dist/internal/helpers/dateFormatter.d.ts +2 -0
- package/dist/internal/helpers/hintSeverity.d.ts +1 -1
- package/dist/internal/helpers/utilityTypes.d.ts +22 -0
- package/dist/react/index.d.ts +11 -2
- package/dist/react/index.js +11 -2
- package/dist/react/skf-breadcrumb/index.d.ts +9 -0
- package/dist/react/skf-breadcrumb/index.js +17 -0
- package/dist/react/skf-breadcrumb-item/index.d.ts +3 -0
- package/dist/react/skf-breadcrumb-item/index.js +13 -0
- package/dist/react/skf-datepicker/index.d.ts +12 -0
- package/dist/react/skf-datepicker/index.js +18 -0
- package/dist/react/skf-menu/index.d.ts +12 -0
- package/dist/react/skf-menu/index.js +18 -0
- package/dist/react/skf-menu-item/index.d.ts +27 -0
- package/dist/react/skf-menu-item/index.js +23 -0
- package/dist/react/skf-popover/index.d.ts +12 -0
- package/dist/react/skf-popover/index.js +18 -0
- package/dist/react/skf-stepper/index.d.ts +9 -0
- package/dist/react/skf-stepper/index.js +17 -0
- package/dist/react/skf-stepper-item/index.d.ts +9 -0
- package/dist/react/skf-stepper-item/index.js +17 -0
- package/dist/react/skf-tooltip/index.d.ts +12 -0
- package/dist/react/skf-tooltip/index.js +18 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +628 -155
- package/dist/types/vue/index.d.ts +369 -74
- package/dist/vscode.html-custom-data.json +761 -391
- package/dist/web-types.json +936 -293
- package/package.json +34 -33
@@ -1,67 +1,9 @@
|
|
1
|
-
import { raiseError as
|
1
|
+
import { raiseError as l } from "../../internal/helpers/raiseError.js";
|
2
2
|
class d {
|
3
|
-
constructor(
|
4
|
-
this.
|
5
|
-
|
6
|
-
|
7
|
-
this.disableScrollDetection();
|
8
|
-
}
|
9
|
-
hostUpdated() {
|
10
|
-
var e, t, s;
|
11
|
-
((e = this.host) == null ? void 0 : e._expanded) !== this.localExpanded && (this.localExpanded = !!((t = this.host) != null && t._expanded), (s = this.host) != null && s._expanded ? this.enableScrollDetection() : this.disableScrollDetection());
|
12
|
-
}
|
13
|
-
enableScrollDetection() {
|
14
|
-
if (this._scrollHandler = () => {
|
15
|
-
if (!this.host) return;
|
16
|
-
this.host._expanded = !1;
|
17
|
-
const t = this.host.getBoundingClientRect();
|
18
|
-
t.top < 0 || t.bottom > window.innerHeight || t.left < 0 || t.right > window.innerWidth ? this._onScrollOutOfView() : this._onScrollIntoView();
|
19
|
-
}, window.addEventListener("scroll", this._scrollHandler, !0), !this.host) return;
|
20
|
-
let e = this.host.parentElement;
|
21
|
-
for (; e; )
|
22
|
-
(e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth) && e.addEventListener("scroll", this._scrollHandler, !0), e = e.parentElement;
|
23
|
-
}
|
24
|
-
disableScrollDetection() {
|
25
|
-
if (!this._scrollHandler || (window.removeEventListener("scroll", this._scrollHandler, !0), !this.host)) return;
|
26
|
-
let e = this.host.parentElement;
|
27
|
-
for (; e; )
|
28
|
-
(e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth) && e.removeEventListener("scroll", this._scrollHandler, !0), e = e.parentElement;
|
29
|
-
}
|
30
|
-
/** @internal */
|
31
|
-
_onScrollOutOfView() {
|
32
|
-
this.host && (this.host._expanded = !1);
|
33
|
-
}
|
34
|
-
/** @internal */
|
35
|
-
_onScrollIntoView() {
|
36
|
-
}
|
37
|
-
}
|
38
|
-
class b {
|
39
|
-
constructor(e) {
|
40
|
-
this._onResize = () => {
|
41
|
-
this.host._expanded = !1;
|
42
|
-
}, this.host = e, e.addController(this);
|
43
|
-
}
|
44
|
-
hostConnected() {
|
45
|
-
this.enableResizeObserver();
|
46
|
-
}
|
47
|
-
hostDisconnected() {
|
48
|
-
this.disableResizeObserver();
|
49
|
-
}
|
50
|
-
enableResizeObserver() {
|
51
|
-
this._resizeObserver = new ResizeObserver(() => {
|
52
|
-
this.host._expanded = !1, this.host._updateWidth();
|
53
|
-
}), this._resizeObserver.observe(document.body), this._resizeObserver.observe(this.host);
|
54
|
-
}
|
55
|
-
disableResizeObserver() {
|
56
|
-
var e;
|
57
|
-
(e = this._resizeObserver) == null || e.disconnect();
|
58
|
-
}
|
59
|
-
}
|
60
|
-
class p {
|
61
|
-
constructor(e) {
|
62
|
-
this._globalClickHandler = (t) => {
|
63
|
-
t.target.closest(this.host.localName) || (this.host._expanded = !1);
|
64
|
-
}, this.host = e, e.addController(this);
|
3
|
+
constructor(t) {
|
4
|
+
this._globalClickHandler = (e) => {
|
5
|
+
e.target.closest(this.host.localName) || (this.host._expanded = !1);
|
6
|
+
}, this.host = t, t.addController(this);
|
65
7
|
}
|
66
8
|
// hostConnected() {
|
67
9
|
// this.enableGlobalClickDetection();
|
@@ -79,26 +21,26 @@ class p {
|
|
79
21
|
document.removeEventListener("click", this._globalClickHandler);
|
80
22
|
}
|
81
23
|
}
|
82
|
-
class
|
83
|
-
constructor(
|
84
|
-
this._handleKeyDown = (
|
85
|
-
switch (
|
24
|
+
class p {
|
25
|
+
constructor(t) {
|
26
|
+
this._handleKeyDown = (e) => {
|
27
|
+
switch (e.key) {
|
86
28
|
case "ArrowDown":
|
87
|
-
|
29
|
+
e.preventDefault(), this._focusSiblingOption("next");
|
88
30
|
break;
|
89
31
|
case "ArrowUp":
|
90
|
-
|
32
|
+
e.preventDefault(), this._focusSiblingOption("prev");
|
91
33
|
break;
|
92
34
|
case "Enter":
|
93
|
-
|
35
|
+
e.preventDefault(), this._selectFocusedOption(e.target);
|
94
36
|
break;
|
95
37
|
case "Escape":
|
96
|
-
|
38
|
+
e.preventDefault(), this.host._expanded = !1, setTimeout(() => {
|
97
39
|
this.host.focus();
|
98
40
|
});
|
99
41
|
break;
|
100
42
|
}
|
101
|
-
}, this.host =
|
43
|
+
}, this.host = t, t.addController(this), this._listenerActivated = !1;
|
102
44
|
}
|
103
45
|
hostDisconnected() {
|
104
46
|
this.removeKeyboardListener();
|
@@ -113,50 +55,50 @@ class u {
|
|
113
55
|
this.host.removeEventListener("keydown", this._handleKeyDown), this._listenerActivated = !1;
|
114
56
|
}
|
115
57
|
_focusFirstOption() {
|
116
|
-
const
|
58
|
+
const t = this._selectableOptions[0];
|
117
59
|
setTimeout(() => {
|
118
|
-
|
60
|
+
t.focus();
|
119
61
|
});
|
120
62
|
}
|
121
|
-
_focusSiblingOption(
|
122
|
-
const
|
63
|
+
_focusSiblingOption(t) {
|
64
|
+
const e = (n) => n === document.activeElement, s = this._selectableOptions.find((n) => e(n));
|
123
65
|
if (!s) {
|
124
66
|
this._focusFirstOption();
|
125
67
|
return;
|
126
68
|
}
|
127
|
-
const
|
128
|
-
let
|
129
|
-
|
130
|
-
const
|
131
|
-
s.blur(),
|
69
|
+
const r = this._selectableOptions.indexOf(s);
|
70
|
+
let i = r - 1, o = r + 1;
|
71
|
+
i < 0 && (i = this._selectableOptions.length - 1), o >= this._selectableOptions.length && (o = 0);
|
72
|
+
const h = this._selectableOptions[t === "next" ? o : i];
|
73
|
+
s.blur(), h.focus();
|
132
74
|
}
|
133
|
-
_selectFocusedOption(
|
134
|
-
|
75
|
+
_selectFocusedOption(t) {
|
76
|
+
t.selected = !0;
|
135
77
|
}
|
136
78
|
get _selectableOptions() {
|
137
|
-
return this.host._optionsList.filter((
|
79
|
+
return this.host._optionsList.filter((t) => !t.disabled);
|
138
80
|
}
|
139
81
|
}
|
140
|
-
class
|
141
|
-
constructor(
|
142
|
-
this.host =
|
82
|
+
class b {
|
83
|
+
constructor(t) {
|
84
|
+
this.host = t, t.addController(this);
|
143
85
|
}
|
144
86
|
hostConnected() {
|
145
87
|
this._badAttributeCombinationWarning();
|
146
88
|
}
|
147
89
|
_badAttributeCombinationWarning() {
|
148
|
-
|
90
|
+
l({
|
149
91
|
assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
|
150
92
|
reason: "attribute-mismatch",
|
151
93
|
replaceStrings: [this.host.localName, "min", "smaller than max"]
|
152
|
-
}),
|
94
|
+
}), l({
|
153
95
|
assert: (
|
154
96
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
155
97
|
(this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
|
156
98
|
),
|
157
99
|
reason: "attribute-mismatch",
|
158
100
|
replaceStrings: [this.host.localName, "min or max", "together with multiple"]
|
159
|
-
}),
|
101
|
+
}), l({
|
160
102
|
assert: (this.host.hideTags && this.host.multiple) ?? !this.host.hideTags,
|
161
103
|
reason: "attribute-mismatch",
|
162
104
|
replaceStrings: [this.host.localName, "hide-tags", "together with multiple"]
|
@@ -164,9 +106,7 @@ class _ {
|
|
164
106
|
}
|
165
107
|
}
|
166
108
|
export {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
b as ResizeController,
|
171
|
-
d as ScrollController
|
109
|
+
b as DeveloperFeedbackController,
|
110
|
+
d as GlobalClickController,
|
111
|
+
p as KeyboardNavigationController
|
172
112
|
};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { SkfStepperItem } from '../stepper-item/stepper-item.component.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
3
|
+
import { type CSSResultGroup } from 'lit';
|
4
|
+
/**
|
5
|
+
* The `<skf-stepper>` is a component that displays a list of actions or options.
|
6
|
+
*
|
7
|
+
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
8
|
+
*
|
9
|
+
* @slot - One or more `<skf-stepper-item>`
|
10
|
+
*
|
11
|
+
* @event skf-stepper-item-select - Dispatched when the stepper item is selected
|
12
|
+
*
|
13
|
+
* @tagname skf-stepper
|
14
|
+
*/
|
15
|
+
export declare class SkfStepper extends SkfElement {
|
16
|
+
#private;
|
17
|
+
static styles: CSSResultGroup;
|
18
|
+
/** Sets the active item */
|
19
|
+
activeIndex: number;
|
20
|
+
/** If true, sets linear mode (user can't go back to completed steps due to dependencies) */
|
21
|
+
linear: boolean;
|
22
|
+
/** @internal */
|
23
|
+
_items?: NodeListOf<SkfStepperItem>;
|
24
|
+
constructor();
|
25
|
+
firstUpdated(): void;
|
26
|
+
/** @internal activeIndex is the source of truth. Once updated all stepper states are recalculated. */
|
27
|
+
_handleActiveIndexChanged(): void;
|
28
|
+
/** @internal */
|
29
|
+
_handleLinearMode(): void;
|
30
|
+
private _handleSelected;
|
31
|
+
/** @internal */
|
32
|
+
private _resetActive;
|
33
|
+
/** @internal */
|
34
|
+
private _getCurrentActiveIndex;
|
35
|
+
/** @internal Not much can be handled before this kick off */
|
36
|
+
private _handleSlotChanged;
|
37
|
+
render(): import("lit").TemplateResult<1>;
|
38
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
var p = (t) => {
|
2
|
+
throw TypeError(t);
|
3
|
+
};
|
4
|
+
var m = (t, i, e) => i.has(t) || p("Cannot " + e);
|
5
|
+
var _ = (t, i, e) => (m(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ? p("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), l = (t, i, e, s) => (m(t, i, "write to private field"), s ? s.call(t, e) : i.set(t, e), e);
|
6
|
+
import { SkfElement as I } from "../../internal/components/skf-element.js";
|
7
|
+
import { watch as v } from "../../internal/helpers/watch.js";
|
8
|
+
import u from "../../styles/component.styles.js";
|
9
|
+
import { html as g } from "lit";
|
10
|
+
import { property as x, queryAssignedElements as y } from "lit/decorators.js";
|
11
|
+
import { classMap as A } from "lit/directives/class-map.js";
|
12
|
+
import { stepperState as C } from "./stepper.helpers.js";
|
13
|
+
import { styles as b } from "./stepper.styles.js";
|
14
|
+
var E = Object.defineProperty, S = Object.getOwnPropertyDescriptor, h = (t, i, e, s) => {
|
15
|
+
for (var n = s > 1 ? void 0 : s ? S(i, e) : i, r = t.length - 1, d; r >= 0; r--)
|
16
|
+
(d = t[r]) && (n = (s ? d(i, e, n) : d(n)) || n);
|
17
|
+
return s && n && E(i, e, n), n;
|
18
|
+
}, o;
|
19
|
+
const c = class c extends I {
|
20
|
+
constructor() {
|
21
|
+
super();
|
22
|
+
f(this, o);
|
23
|
+
l(this, o, !1), this.activeIndex = -1, this.linear = !1, this._handleSelected = (e) => {
|
24
|
+
if (!_(this, o)) return;
|
25
|
+
const { item: s, triggerActiveIndexUpdate: n } = e.detail, r = [...this._items ?? []].findIndex((d) => d === s);
|
26
|
+
r === this.activeIndex ? this._handleActiveIndexChanged() : (n && this._resetActive(r), this.activeIndex = r);
|
27
|
+
}, this._handleSlotChanged = () => {
|
28
|
+
l(this, o, !0), this.activeIndex = this._getCurrentActiveIndex();
|
29
|
+
}, this.addEventListener("skf-stepper-item-select", this._handleSelected);
|
30
|
+
}
|
31
|
+
firstUpdated() {
|
32
|
+
this._handleLinearMode();
|
33
|
+
}
|
34
|
+
_handleActiveIndexChanged() {
|
35
|
+
!this._items || this.activeIndex < 0 || this._items.forEach((e, s) => {
|
36
|
+
const { isDisabled: n, stateLabel: r } = C({
|
37
|
+
activeIndex: this.activeIndex,
|
38
|
+
items: [...this._items ?? []],
|
39
|
+
linear: this.linear,
|
40
|
+
state: e.state,
|
41
|
+
index: s
|
42
|
+
});
|
43
|
+
e._setInternalState = r, e._index = s + 1, e._disabled = n;
|
44
|
+
});
|
45
|
+
}
|
46
|
+
_handleLinearMode() {
|
47
|
+
var e;
|
48
|
+
(e = this._items) == null || e.forEach((s) => {
|
49
|
+
this.linear && (s._linear = !0);
|
50
|
+
});
|
51
|
+
}
|
52
|
+
/** @internal */
|
53
|
+
_resetActive(e) {
|
54
|
+
this._items && this._items.forEach((s, n) => {
|
55
|
+
n !== e && (s._setInternalState = void 0);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
/** @internal */
|
59
|
+
_getCurrentActiveIndex() {
|
60
|
+
if (!this._items) return -1;
|
61
|
+
const e = [...this._items], s = e.reverse().findIndex((r) => ["active", "completed"].includes(String(r.state))) || e.length - 1;
|
62
|
+
return e.length - s - 1;
|
63
|
+
}
|
64
|
+
render() {
|
65
|
+
return g`
|
66
|
+
<ol class=${A({ stepper: !0 })}>
|
67
|
+
<slot @slotchange=${this._handleSlotChanged}></slot>
|
68
|
+
</ol>
|
69
|
+
`;
|
70
|
+
}
|
71
|
+
};
|
72
|
+
o = new WeakMap(), c.styles = [u, b];
|
73
|
+
let a = c;
|
74
|
+
h([
|
75
|
+
x({ type: Number })
|
76
|
+
], a.prototype, "activeIndex", 2);
|
77
|
+
h([
|
78
|
+
x({ type: Boolean })
|
79
|
+
], a.prototype, "linear", 2);
|
80
|
+
h([
|
81
|
+
y()
|
82
|
+
], a.prototype, "_items", 2);
|
83
|
+
h([
|
84
|
+
v("activeIndex")
|
85
|
+
], a.prototype, "_handleActiveIndexChanged", 1);
|
86
|
+
h([
|
87
|
+
v("linear")
|
88
|
+
], a.prototype, "_handleLinearMode", 1);
|
89
|
+
export {
|
90
|
+
a as SkfStepper
|
91
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { SkfStepperItem, SkfStepperItemState } from '../stepper-item/stepper-item.component.js';
|
2
|
+
import type { SkfStepper } from './stepper.component.js';
|
3
|
+
interface StepperStateProps extends Pick<SkfStepper, '_items' | 'linear'>, Pick<SkfStepperItem, 'state'> {
|
4
|
+
items: SkfStepperItem[];
|
5
|
+
activeIndex: number;
|
6
|
+
index: number;
|
7
|
+
}
|
8
|
+
interface StepperReturns {
|
9
|
+
isCurrentStep: boolean;
|
10
|
+
isDisabled: boolean;
|
11
|
+
isSpan: boolean;
|
12
|
+
stateLabel?: SkfStepperItemState;
|
13
|
+
}
|
14
|
+
/** Calculate each step state while iterating all */
|
15
|
+
export declare const stepperState: ({ activeIndex, items, linear, state, index, }: StepperStateProps) => StepperReturns;
|
16
|
+
export {};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
const A = ({
|
2
|
+
activeIndex: c,
|
3
|
+
items: r,
|
4
|
+
linear: i,
|
5
|
+
state: o,
|
6
|
+
index: e
|
7
|
+
}) => {
|
8
|
+
var l;
|
9
|
+
const n = (l = r[e - 1]) == null ? void 0 : l.state, p = e > c + 1, b = n === "active", a = ["active", "completed"].includes(o ?? ""), s = !i && a, d = i && !s ? !1 : (p || b || a) && !s, v = o === "active", f = e < c, m = o === "completed", u = !s && n === "completed" && e === c + 1, t = {
|
10
|
+
isCurrentStep: a,
|
11
|
+
isDisabled: d,
|
12
|
+
isSpan: s
|
13
|
+
};
|
14
|
+
return u ? { stateLabel: "enabled", ...t } : v ? { stateLabel: "active", ...t } : m ? { stateLabel: "activeCompleted", ...t } : f ? { stateLabel: "completed", ...t } : { stateLabel: void 0, ...t };
|
15
|
+
};
|
16
|
+
export {
|
17
|
+
A as stepperState
|
18
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import '../icon/icon.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
3
|
+
import { type CSSResultGroup } from 'lit';
|
4
|
+
export interface SkfStepperItemEvent {
|
5
|
+
item: SkfStepperItem;
|
6
|
+
triggerActiveIndexUpdate: boolean;
|
7
|
+
}
|
8
|
+
export type SkfStepperItemState = 'active' | 'activeCompleted' | 'completed' | 'enabled';
|
9
|
+
/**
|
10
|
+
* The `<skf-stepper-item>` is used in conjunction with the `<skf-stepper>` component
|
11
|
+
*
|
12
|
+
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
13
|
+
*
|
14
|
+
* @slot - Label of the stepper item
|
15
|
+
*
|
16
|
+
* @event skf-stepper-item-select - Dispatched when the stepper item is selected
|
17
|
+
*
|
18
|
+
* @tagname skf-stepper-item
|
19
|
+
*/
|
20
|
+
export declare class SkfStepperItem extends SkfElement {
|
21
|
+
#private;
|
22
|
+
static styles: CSSResultGroup;
|
23
|
+
/** If defined, gives the supplied appearance */
|
24
|
+
state?: Extract<SkfStepperItemState, 'active' | 'completed'>;
|
25
|
+
/** If true, item marked as completed */
|
26
|
+
completed: boolean;
|
27
|
+
/** @internal */
|
28
|
+
_disabled?: boolean;
|
29
|
+
/** @internal */
|
30
|
+
_index: number;
|
31
|
+
/** @internal */
|
32
|
+
_linear: boolean;
|
33
|
+
/** @internal */
|
34
|
+
_uiState?: SkfStepperItemState;
|
35
|
+
/** @internal */
|
36
|
+
set _setInternalState(state: typeof this._uiState);
|
37
|
+
get _setInternalState(): typeof this._uiState;
|
38
|
+
constructor();
|
39
|
+
protected firstUpdated(): void;
|
40
|
+
/** @internal */
|
41
|
+
_handleState(): void;
|
42
|
+
/** @internal */
|
43
|
+
private _emitUpdate;
|
44
|
+
/** @internal */
|
45
|
+
private _handleClick;
|
46
|
+
render(): import("lit").TemplateResult;
|
47
|
+
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
var v = (e) => {
|
2
|
+
throw TypeError(e);
|
3
|
+
};
|
4
|
+
var u = (e, i, t) => i.has(e) || v("Cannot " + t);
|
5
|
+
var d = (e, i, t) => (u(e, i, "read from private field"), t ? t.call(e) : i.get(e)), _ = (e, i, t) => i.has(e) ? v("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), r = (e, i, t, s) => (u(e, i, "write to private field"), s ? s.call(e, t) : i.set(e, t), t);
|
6
|
+
import "../icon/icon.js";
|
7
|
+
import { SkfElement as b } from "../../internal/components/skf-element.js";
|
8
|
+
import { watch as g } from "../../internal/helpers/watch.js";
|
9
|
+
import C from "../../styles/component.styles.js";
|
10
|
+
import "lit";
|
11
|
+
import { property as y, state as c } from "lit/decorators.js";
|
12
|
+
import { classMap as $ } from "lit/directives/class-map.js";
|
13
|
+
import { ifDefined as x } from "lit/directives/if-defined.js";
|
14
|
+
import { literal as w, unsafeStatic as U, html as S } from "lit/static-html.js";
|
15
|
+
import { styles as I } from "./stepper-item.styles.js";
|
16
|
+
var O = Object.defineProperty, P = Object.getOwnPropertyDescriptor, l = (e, i, t, s) => {
|
17
|
+
for (var p = s > 1 ? void 0 : s ? P(i, t) : i, h = e.length - 1, m; h >= 0; h--)
|
18
|
+
(m = e[h]) && (p = (s ? m(i, t, p) : m(p)) || p);
|
19
|
+
return s && p && O(i, t, p), p;
|
20
|
+
}, o, n;
|
21
|
+
const f = class f extends b {
|
22
|
+
constructor() {
|
23
|
+
super();
|
24
|
+
_(this, o);
|
25
|
+
_(this, n);
|
26
|
+
r(this, o, !1), r(this, n, !1), this.completed = !1, this._index = 0, this._linear = !1, this._handleClick = () => {
|
27
|
+
this._linear || (this.state = "active");
|
28
|
+
}, this.role = "listitem";
|
29
|
+
}
|
30
|
+
set _setInternalState(t) {
|
31
|
+
r(this, o, !0), this._uiState = t, t === "active" || t === "activeCompleted" ? this.state = t === "active" ? "active" : "completed" : this.state = void 0, setTimeout(() => {
|
32
|
+
r(this, o, !1);
|
33
|
+
});
|
34
|
+
}
|
35
|
+
get _setInternalState() {
|
36
|
+
return this.state;
|
37
|
+
}
|
38
|
+
firstUpdated() {
|
39
|
+
this._handleState();
|
40
|
+
}
|
41
|
+
_handleState() {
|
42
|
+
const t = this._uiState;
|
43
|
+
if (this.state === "completed" && t !== "active") {
|
44
|
+
this._setInternalState = "activeCompleted";
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
if (d(this, o)) {
|
48
|
+
r(this, o, !1);
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
r(this, n, ["active", "completed"].includes(String(this.state)) && !["active", "activeCompleted"].includes(String(this._uiState))), this._emitUpdate();
|
52
|
+
}
|
53
|
+
/** @internal */
|
54
|
+
_emitUpdate() {
|
55
|
+
this.emit("skf-stepper-item-select", {
|
56
|
+
detail: {
|
57
|
+
item: this,
|
58
|
+
triggerActiveIndexUpdate: d(this, n)
|
59
|
+
}
|
60
|
+
}), r(this, n, !1);
|
61
|
+
}
|
62
|
+
render() {
|
63
|
+
const t = this._linear ? "div" : "button", s = w`${U(t)}`;
|
64
|
+
return S`
|
65
|
+
<${s}
|
66
|
+
@click=${this._handleClick}
|
67
|
+
?disabled=${this._disabled}
|
68
|
+
class=${$({
|
69
|
+
"stepper-item": !0,
|
70
|
+
"stepper-item--active": this._uiState === "active",
|
71
|
+
"stepper-item--active-completed": this._uiState === "activeCompleted",
|
72
|
+
"stepper-item--completed": this._uiState === "completed",
|
73
|
+
"stepper-item--enabled": this._uiState === "enabled"
|
74
|
+
})}
|
75
|
+
type=${x(t == "button" ? "button" : void 0)}
|
76
|
+
>
|
77
|
+
<div class="stepper-item__circle">
|
78
|
+
${this._uiState === "activeCompleted" ? S`<skf-icon color="inverse" name="check"></skf-icon>` : this._index}
|
79
|
+
</div>
|
80
|
+
<slot class="stepper-item__label"></slot>
|
81
|
+
</${s}>
|
82
|
+
`;
|
83
|
+
}
|
84
|
+
};
|
85
|
+
o = new WeakMap(), n = new WeakMap(), f.styles = [C, I];
|
86
|
+
let a = f;
|
87
|
+
l([
|
88
|
+
y({ reflect: !0 })
|
89
|
+
], a.prototype, "state", 2);
|
90
|
+
l([
|
91
|
+
y({ type: Boolean })
|
92
|
+
], a.prototype, "completed", 2);
|
93
|
+
l([
|
94
|
+
c()
|
95
|
+
], a.prototype, "_disabled", 2);
|
96
|
+
l([
|
97
|
+
c()
|
98
|
+
], a.prototype, "_index", 2);
|
99
|
+
l([
|
100
|
+
c()
|
101
|
+
], a.prototype, "_linear", 2);
|
102
|
+
l([
|
103
|
+
c()
|
104
|
+
], a.prototype, "_uiState", 2);
|
105
|
+
l([
|
106
|
+
c()
|
107
|
+
], a.prototype, "_setInternalState", 1);
|
108
|
+
l([
|
109
|
+
g("state")
|
110
|
+
], a.prototype, "_handleState", 1);
|
111
|
+
export {
|
112
|
+
a as SkfStepperItem
|
113
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import { css as e } from "lit";
|
2
|
+
const s = e`
|
3
|
+
/* stylelint-disable selector-class-pattern */
|
4
|
+
@layer components {
|
5
|
+
:host {
|
6
|
+
contain: layout;
|
7
|
+
flex: 1;
|
8
|
+
min-width: 0;
|
9
|
+
}
|
10
|
+
|
11
|
+
.stepper-item {
|
12
|
+
--_skf-stepper-circle-size: var(--skf-size-32);
|
13
|
+
--_skf-stepper-gap: inherit;
|
14
|
+
--_skf-stepper-line-offset: var(--skf-spacing-50);
|
15
|
+
|
16
|
+
align-items: center;
|
17
|
+
color: var(--_skf-stepper-color, var(--skf-text-color-tertiary));
|
18
|
+
display: flex;
|
19
|
+
flex-direction: column;
|
20
|
+
font-size: var(--skf-font-size-75);
|
21
|
+
font-weight: var(--skf-font-weight-bold);
|
22
|
+
gap: var(--skf-spacing-50);
|
23
|
+
inline-size: 100%;
|
24
|
+
position: relative;
|
25
|
+
|
26
|
+
&::before,
|
27
|
+
&::after {
|
28
|
+
border: var(--skf-border-width-sm) solid var(--skf-border-color-primary);
|
29
|
+
inset-block-start: calc(var(--_skf-stepper-circle-size) / 2);
|
30
|
+
position: absolute;
|
31
|
+
translate: 0 -50%;
|
32
|
+
}
|
33
|
+
|
34
|
+
&::before {
|
35
|
+
inset-inline: calc(-1 * var(--_skf-stepper-gap) / 2)
|
36
|
+
calc(50% + (var(--_skf-stepper-circle-size) / 2) + var(--_skf-stepper-line-offset));
|
37
|
+
}
|
38
|
+
|
39
|
+
&::after {
|
40
|
+
inset-inline: calc(
|
41
|
+
50% + (var(--_skf-stepper-circle-size) / 2) + var(--_skf-stepper-line-offset)
|
42
|
+
)
|
43
|
+
calc(-1 * var(--_skf-stepper-gap) / 2);
|
44
|
+
}
|
45
|
+
|
46
|
+
:host(:not(:first-of-type)) &::before,
|
47
|
+
:host(:not(:last-of-type)) &::after {
|
48
|
+
content: '';
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
:is(.stepper-item--active, .stepper-item--completed) {
|
53
|
+
--_skf-stepper-color: var(--skf-text-color-emphasised);
|
54
|
+
}
|
55
|
+
|
56
|
+
.stepper-item--enabled {
|
57
|
+
--_skf-stepper-color: #6292e4; /* Missing token */
|
58
|
+
}
|
59
|
+
|
60
|
+
.stepper-item__circle {
|
61
|
+
background-color: var(--_skf-stepper-circle-bg-color, var(--skf-bg-color-neutral-1));
|
62
|
+
block-size: var(--_skf-stepper-circle-size);
|
63
|
+
border: var(--skf-border-width-md) solid
|
64
|
+
var(--_skf-stepper-circle-border-color, var(--skf-border-color-primary));
|
65
|
+
border-radius: 50%;
|
66
|
+
color: var(--_skf-stepper-circle-color, inherit);
|
67
|
+
display: grid;
|
68
|
+
inline-size: var(--_skf-stepper-circle-size);
|
69
|
+
place-content: center;
|
70
|
+
user-select: none;
|
71
|
+
|
72
|
+
:is(.stepper-item--active, .stepper-item--active-completed, .stepper-item--completed) & {
|
73
|
+
--_skf-stepper-circle-border-color: var(--skf-border-color-emphasised);
|
74
|
+
}
|
75
|
+
|
76
|
+
:is(.stepper-item--active, .stepper-item--active-completed) & {
|
77
|
+
--_skf-stepper-circle-color: var(--skf-text-color-inverse);
|
78
|
+
--_skf-stepper-circle-bg-color: var(--skf-bg-color-emphasised);
|
79
|
+
}
|
80
|
+
|
81
|
+
.stepper-item--enabled & {
|
82
|
+
--_skf-stepper-circle-border-color: #6292e4; /* Missing token */
|
83
|
+
--_skf-stepper-circle-color: var(--skf-text-color-emphasised);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
.stepper-item__label {
|
88
|
+
display: block;
|
89
|
+
max-inline-size: 100%;
|
90
|
+
overflow: hidden;
|
91
|
+
text-overflow: ellipsis;
|
92
|
+
white-space: nowrap;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
`;
|
96
|
+
export {
|
97
|
+
s as styles
|
98
|
+
};
|