@hortiview/shared-components 2.16.1 → 2.17.0
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/CHANGELOG.md +12 -0
- package/dist/assets/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +22 -22
- package/dist/components/Stepper/Stepper.js +51 -63
- package/dist/components/Stepper/Stepper.test.js +52 -54
- package/dist/components/Stepper/components/StepperButton.d.ts +4 -2
- package/dist/components/Stepper/components/StepperButton.js +36 -33
- package/dist/components/Stepper/stepperTypes.d.ts +4 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [2.17.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.16.2...v2.17.0) (2026-02-27)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* made Step buttons optional and added variant support to stepperButtonProps ([bf876f1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/bf876f1435d54562c42166778ab7c326ec31b10b)), closes [#18954](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/issues/18954)
|
|
6
|
+
|
|
7
|
+
## [2.16.2](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.16.1...v2.16.2) (2026-02-24)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* adjust modal border radius to exclude fullscreen mode ([88981ad](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/88981adcde776e88f76abda8a90b1e91b4f9557b))
|
|
12
|
+
|
|
1
13
|
## [2.16.1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.16.0...v2.16.1) (2026-02-23)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
package/dist/assets/Modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._modal_mu9y6_1 div[class*=lmnt-modal__surface]{max-height:100svh!important;max-width:100svw!important}._modal_mu9y6_1 div:not([class*=mdc-dialog--fullscreen]) div[class*=lmnt-modal__surface]{border-radius:1rem!important}._modal_mu9y6_1 footer{margin-bottom:0!important}._gap_mu9y6_14{gap:4px!important}._title_mu9y6_18{header{display:flex;justify-content:start;padding-left:.5rem!important;>div{width:100%;margin-left:0!important}}}._titleWithoutCloseIcon_mu9y6_31{margin-left:1rem!important}._closeButton_mu9y6_35{color:var(--lmnt-theme-on-surface-inactive)}._closeButton_mu9y6_35:before{display:none!important}._closeButton_mu9y6_35:hover{background-color:var(--lmnt-theme-surface-variant)!important}
|
|
@@ -8,8 +8,8 @@ import { w as Mt, r as ne, c as D, a as oe } from "../../index.es-Da7ok-B-.js";
|
|
|
8
8
|
import { b as xt, c as Pt, d as ie } from "../../tslib.es6-BDCynO9F.js";
|
|
9
9
|
import { M as ae, a as re } from "../../component-Bz_dtX1r.js";
|
|
10
10
|
import { M as se, c as le, m as ce } from "../../component-DEJuY56h.js";
|
|
11
|
-
import { A as
|
|
12
|
-
import { P as
|
|
11
|
+
import { A as ue } from "../../animationframe-BVKDmEXe.js";
|
|
12
|
+
import { P as de } from "../../index.es-BanVdXEd.js";
|
|
13
13
|
import { b as me } from "../../index.es-SjZ_-d7U.js";
|
|
14
14
|
import { Iconify as fe } from "../Iconify/Iconify.js";
|
|
15
15
|
import { O as pe } from "../../OfflineView-CIwV08EQ.js";
|
|
@@ -105,12 +105,12 @@ var X = "mdc-dom-focus-sentinel", ve = (
|
|
|
105
105
|
}, o.prototype.getFocusableElements = function(e) {
|
|
106
106
|
var t = [].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button"));
|
|
107
107
|
return t.filter(function(n) {
|
|
108
|
-
var i = n.getAttribute("aria-disabled") === "true" || n.getAttribute("disabled") != null || n.getAttribute("hidden") != null || n.getAttribute("aria-hidden") === "true", a = n.tabIndex >= 0 && n.getBoundingClientRect().width > 0 && !n.classList.contains(X) && !i,
|
|
108
|
+
var i = n.getAttribute("aria-disabled") === "true" || n.getAttribute("disabled") != null || n.getAttribute("hidden") != null || n.getAttribute("aria-hidden") === "true", a = n.tabIndex >= 0 && n.getBoundingClientRect().width > 0 && !n.classList.contains(X) && !i, d = !1;
|
|
109
109
|
if (a) {
|
|
110
110
|
var h = getComputedStyle(n);
|
|
111
|
-
|
|
111
|
+
d = h.display === "none" || h.visibility === "hidden";
|
|
112
112
|
}
|
|
113
|
-
return a && !
|
|
113
|
+
return a && !d;
|
|
114
114
|
});
|
|
115
115
|
}, o.prototype.createSentinel = function() {
|
|
116
116
|
var e = document.createElement("div");
|
|
@@ -229,7 +229,7 @@ var $t = (
|
|
|
229
229
|
xt(e, o);
|
|
230
230
|
function e(t) {
|
|
231
231
|
var n = o.call(this, Pt(Pt({}, e.defaultAdapter), t)) || this;
|
|
232
|
-
return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction = O.CLOSE_ACTION, n.scrimClickAction = O.CLOSE_ACTION, n.autoStackButtons = !0, n.areButtonsStacked = !1, n.suppressDefaultPressSelector = O.SUPPRESS_DEFAULT_PRESS_SELECTOR, n.animFrame = new
|
|
232
|
+
return n.dialogOpen = !1, n.isFullscreen = !1, n.animationFrame = 0, n.animationTimer = 0, n.escapeKeyAction = O.CLOSE_ACTION, n.scrimClickAction = O.CLOSE_ACTION, n.autoStackButtons = !0, n.areButtonsStacked = !1, n.suppressDefaultPressSelector = O.SUPPRESS_DEFAULT_PRESS_SELECTOR, n.animFrame = new ue(), n.contentScrollHandler = function() {
|
|
233
233
|
n.handleScrollEvent();
|
|
234
234
|
}, n.windowResizeHandler = function() {
|
|
235
235
|
n.layout();
|
|
@@ -379,8 +379,8 @@ var $t = (
|
|
|
379
379
|
if (n) {
|
|
380
380
|
var i = this.adapter.getActionFromEvent(t);
|
|
381
381
|
if (!i) {
|
|
382
|
-
var a = t.composedPath ? t.composedPath()[0] : t.target,
|
|
383
|
-
n &&
|
|
382
|
+
var a = t.composedPath ? t.composedPath()[0] : t.target, d = this.suppressDefaultPressSelector ? !this.adapter.eventTargetMatches(a, this.suppressDefaultPressSelector) : !0;
|
|
383
|
+
n && d && this.adapter.clickDefaultButton();
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
}, e.prototype.handleDocumentKeydown = function(t) {
|
|
@@ -487,7 +487,7 @@ var f = $t.strings, Se = (
|
|
|
487
487
|
throw new Error("Dialog component requires a " + f.CONTAINER_SELECTOR + " container element");
|
|
488
488
|
this.container = a, this.content = this.root.querySelector(f.CONTENT_SELECTOR), this.buttons = [].slice.call(this.root.querySelectorAll(f.BUTTON_SELECTOR)), this.defaultButton = this.root.querySelector("[" + f.BUTTON_DEFAULT_ATTRIBUTE + "]"), this.focusTrapFactory = t, this.buttonRipples = [];
|
|
489
489
|
try {
|
|
490
|
-
for (var
|
|
490
|
+
for (var d = ie(this.buttons), h = d.next(); !h.done; h = d.next()) {
|
|
491
491
|
var y = h.value;
|
|
492
492
|
this.buttonRipples.push(new se(y));
|
|
493
493
|
}
|
|
@@ -495,7 +495,7 @@ var f = $t.strings, Se = (
|
|
|
495
495
|
n = { error: g };
|
|
496
496
|
} finally {
|
|
497
497
|
try {
|
|
498
|
-
h && !h.done && (i =
|
|
498
|
+
h && !h.done && (i = d.return) && i.call(d);
|
|
499
499
|
} finally {
|
|
500
500
|
if (n) throw n.error;
|
|
501
501
|
}
|
|
@@ -794,7 +794,7 @@ var f = $t.strings, Se = (
|
|
|
794
794
|
scrollable: !1,
|
|
795
795
|
title: null
|
|
796
796
|
}, Ae = ["actionButton", "actionIcons", "badge", "backButton", "children", "className", "content", "defaultButton", "dismissiveButton", "footerSupplemental", "headerActions", "hideCloseIcon", "indicator", "initialFocus", "mobileStackedButtons", "modalSize", "nextButton", "noActions", "onClose", "onClosed", "onOpen", "onOpened", "open", "preventClose", "preventPrimaryAccept", "primaryButton", "returnFocusSelector", "scrollable", "title"], r = Oe, et = /* @__PURE__ */ Zt(function(o, e) {
|
|
797
|
-
var t = o.actionButton, n = t === void 0 ? r.actionButton : t, i = o.actionIcons, a = i === void 0 ? r.actionIcons : i,
|
|
797
|
+
var t = o.actionButton, n = t === void 0 ? r.actionButton : t, i = o.actionIcons, a = i === void 0 ? r.actionIcons : i, d = o.badge, h = d === void 0 ? r.badge : d, y = o.backButton, g = y === void 0 ? r.backButton : y, S = o.children, B = S === void 0 ? r.children : S, v = o.className, U = v === void 0 ? r.className : v, nt = o.content, ot = nt === void 0 ? r.content : nt, it = o.defaultButton, T = it === void 0 ? r.defaultButton : it, at = o.dismissiveButton, F = at === void 0 ? r.dismissiveButton : at, rt = o.footerSupplemental, L = rt === void 0 ? r.footerSupplemental : rt, st = o.headerActions, lt = st === void 0 ? r.headerActions : st, ct = o.hideCloseIcon, G = ct === void 0 ? r.hideCloseIcon : ct, ut = o.indicator, Ut = ut === void 0 ? r.indicator : ut, dt = o.initialFocus, b = dt === void 0 ? r.initialFocus : dt, mt = o.mobileStackedButtons, K = mt === void 0 ? r.mobileStackedButtons : mt, ft = o.modalSize, C = ft === void 0 ? r.modalSize : ft, pt = o.nextButton, I = pt === void 0 ? r.nextButton : pt, ht = o.noActions, N = ht === void 0 ? r.noActions : ht, gt = o.onClose, W = gt === void 0 ? r.onClose : gt, Ct = o.onClosed, V = Ct === void 0 ? r.onClosed : Ct, _t = o.onOpen, R = _t === void 0 ? r.onOpen : _t, Et = o.onOpened, w = Et === void 0 ? r.onOpened : Et, vt = o.open, St = vt === void 0 ? r.open : vt, yt = o.preventClose, z = yt === void 0 ? r.preventClose : yt, Ot = o.preventPrimaryAccept, At = Ot === void 0 ? r.preventPrimaryAccept : Ot, Tt = o.primaryButton, u = Tt === void 0 ? r.primaryButton : Tt, bt = o.returnFocusSelector, j = bt === void 0 ? r.returnFocusSelector : bt, It = o.scrollable, Nt = It === void 0 ? r.scrollable : It, Dt = o.title, Bt = Dt === void 0 ? r.title : Dt, Gt = Qt(o, Ae), k = wt(), c = wt();
|
|
798
798
|
te(e, function() {
|
|
799
799
|
return k.current;
|
|
800
800
|
}, []);
|
|
@@ -862,12 +862,12 @@ var f = $t.strings, Se = (
|
|
|
862
862
|
var p = {
|
|
863
863
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
864
864
|
"data-mdc-dialog-action": At ? "" : "accept",
|
|
865
|
-
elevation:
|
|
866
|
-
variant:
|
|
865
|
+
elevation: u?.props.elevation !== "default" ? u?.props.elevation : "flat",
|
|
866
|
+
variant: u?.props.variant || "filled"
|
|
867
867
|
};
|
|
868
868
|
return T === "primary" && (p["data-mdc-dialog-button-default"] = !0), b === "primary" && (p["data-mdc-dialog-initial-focus"] = !0), p;
|
|
869
869
|
};
|
|
870
|
-
}, [At, T, b,
|
|
870
|
+
}, [At, T, b, u?.props.elevation, u?.props.variant]);
|
|
871
871
|
return /* @__PURE__ */ m.createElement("aside", Xt({
|
|
872
872
|
ref: k,
|
|
873
873
|
className: x("lmnt", "lmnt-modal", "mdc-dialog", Nt && "lmnt-modal--scrollable mdc-dialog--scrollable", U),
|
|
@@ -891,20 +891,20 @@ var f = $t.strings, Se = (
|
|
|
891
891
|
}
|
|
892
892
|
}, h)), (ot || B) && /* @__PURE__ */ m.createElement("section", {
|
|
893
893
|
className: "lmnt-modal__content mdc-dialog__content"
|
|
894
|
-
}, ot || B), Ut, (n || g || F || I ||
|
|
894
|
+
}, ot || B), Ut, (n || g || F || I || u || L) && /* @__PURE__ */ m.createElement("footer", {
|
|
895
895
|
className: x("lmnt-modal__actions", "mdc-dialog__actions", q && "lmnt-dialog__actions__mobile", L && "lmnt-modal__actions--supplemental-btn", q && K && "lmnt-modal_actions-mobile-stacked")
|
|
896
896
|
}, !Y && L && /* @__PURE__ */ m.createElement("div", {
|
|
897
897
|
className: "lmnt-dialog__actions__supplemental"
|
|
898
898
|
}, D(L, function() {
|
|
899
899
|
var p = {};
|
|
900
900
|
return T === "footerSupplemental" && (p["data-mdc-dialog-button-default"] = !0), b === "footerSupplemental" && (p["data-mdc-dialog-initial-focus"] = !0), p;
|
|
901
|
-
})), !Y && (n || F ||
|
|
901
|
+
})), !Y && (n || F || u) && /* @__PURE__ */ m.createElement("div", {
|
|
902
902
|
className: "lmnt-dialog__actions__right-align lmnt-modal_actions_button"
|
|
903
903
|
}, F && D(F, {
|
|
904
904
|
variant: "text",
|
|
905
905
|
className: "lmnt-modal__button mdc-dialog__button",
|
|
906
906
|
"data-mdc-dialog-action": "close"
|
|
907
|
-
}), n && !
|
|
907
|
+
}), n && !u && D(n, jt), u && D(u, qt)), Y && /* @__PURE__ */ m.createElement("div", {
|
|
908
908
|
className: "lmnt-modal_actions_button lmnt-dialog__actions__directional"
|
|
909
909
|
}, /* @__PURE__ */ m.createElement("div", null, oe(g, "lmnt-modal__button")), /* @__PURE__ */ m.createElement("div", null, D(I, {
|
|
910
910
|
className: "lmnt-modal__button",
|
|
@@ -915,7 +915,7 @@ var f = $t.strings, Se = (
|
|
|
915
915
|
});
|
|
916
916
|
et.displayName = "Modal";
|
|
917
917
|
et.propTypes = ye;
|
|
918
|
-
const Te = "
|
|
918
|
+
const Te = "_modal_mu9y6_1", be = "_gap_mu9y6_14", Ie = "_title_mu9y6_18", Ne = "_titleWithoutCloseIcon_mu9y6_31", De = "_closeButton_mu9y6_35", A = {
|
|
919
919
|
modal: Te,
|
|
920
920
|
gap: be,
|
|
921
921
|
title: Ie,
|
|
@@ -928,7 +928,7 @@ const Te = "_modal_95xon_1", be = "_gap_95xon_11", Ie = "_title_95xon_15", Ne =
|
|
|
928
928
|
actionButton: n,
|
|
929
929
|
hideCloseIcon: i,
|
|
930
930
|
closeIcon: a = "close",
|
|
931
|
-
leadingIcon:
|
|
931
|
+
leadingIcon: d,
|
|
932
932
|
isOnline: h = !0,
|
|
933
933
|
offlineViewProps: y,
|
|
934
934
|
children: g,
|
|
@@ -953,12 +953,12 @@ const Te = "_modal_95xon_1", be = "_gap_95xon_11", Ie = "_title_95xon_15", Ne =
|
|
|
953
953
|
className: A.closeButton
|
|
954
954
|
}
|
|
955
955
|
),
|
|
956
|
-
|
|
956
|
+
d ? /* @__PURE__ */ E(de, { customPadding: "0.25rem 0 0 0.75rem", children: /* @__PURE__ */ E(fe, { icon: d }) }) : /* @__PURE__ */ E(Jt, {}),
|
|
957
957
|
/* @__PURE__ */ E(
|
|
958
958
|
me,
|
|
959
959
|
{
|
|
960
960
|
level: 6,
|
|
961
|
-
className: i && !
|
|
961
|
+
className: i && !d ? A.titleWithoutCloseIcon : "",
|
|
962
962
|
children: e
|
|
963
963
|
}
|
|
964
964
|
)
|
|
@@ -974,7 +974,7 @@ const Te = "_modal_95xon_1", be = "_gap_95xon_11", Ie = "_title_95xon_15", Ne =
|
|
|
974
974
|
action: /* @__PURE__ */ E(J, { className: A.gap, children: t }, "action-group")
|
|
975
975
|
};
|
|
976
976
|
return [v, U];
|
|
977
|
-
}, [t, i, a,
|
|
977
|
+
}, [t, i, a, d, o, e]);
|
|
978
978
|
return /* @__PURE__ */ E(
|
|
979
979
|
et,
|
|
980
980
|
{
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { G as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { StepperPreviousButton as
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { G as d } from "../../index.es-oxil0uFe.js";
|
|
3
|
+
import { useMemo as f } from "react";
|
|
4
|
+
import { StepperPreviousButton as C, StepperNextButton as S } from "./components/StepperButton.js";
|
|
5
5
|
import { StepperHeader as k } from "./components/StepperHeader.js";
|
|
6
|
-
import { s as
|
|
6
|
+
import { s as b } from "../../stepper.module-DR_FbENS.js";
|
|
7
7
|
import { StepperStyle as D } from "./stepperStyles.js";
|
|
8
|
-
const
|
|
9
|
-
stepperStyle:
|
|
10
|
-
steps:
|
|
11
|
-
currentStepId:
|
|
12
|
-
overwriteTotalSteps:
|
|
13
|
-
isStepLoading:
|
|
14
|
-
showStepperHeader:
|
|
15
|
-
showStepperButtons:
|
|
16
|
-
stepperButtonAlignment:
|
|
17
|
-
showPreviousButtonOnFirstStep:
|
|
18
|
-
children:
|
|
8
|
+
const G = ({
|
|
9
|
+
stepperStyle: m = D.DESKTOP,
|
|
10
|
+
steps: o,
|
|
11
|
+
currentStepId: s,
|
|
12
|
+
overwriteTotalSteps: v,
|
|
13
|
+
isStepLoading: P,
|
|
14
|
+
showStepperHeader: h = !0,
|
|
15
|
+
showStepperButtons: y = !0,
|
|
16
|
+
stepperButtonAlignment: g,
|
|
17
|
+
showPreviousButtonOnFirstStep: x = !1,
|
|
18
|
+
children: A
|
|
19
19
|
}) => {
|
|
20
|
-
const p =
|
|
21
|
-
const
|
|
20
|
+
const p = f(() => {
|
|
21
|
+
const i = o.map((r, e) => (e === 0 && r.excludeFromHeader && console.error(
|
|
22
22
|
"The first step is excluded from the header. Please check your configuration."
|
|
23
23
|
), {
|
|
24
24
|
step: r,
|
|
@@ -26,45 +26,31 @@ const W = ({
|
|
|
26
26
|
isCompleted: !1,
|
|
27
27
|
isRendered: !r.excludeFromHeader,
|
|
28
28
|
isFirst: e === 0,
|
|
29
|
-
isLast: e ===
|
|
30
|
-
})), l =
|
|
29
|
+
isLast: e === o.length - 1
|
|
30
|
+
})), l = o.findIndex((r) => r.id === s);
|
|
31
31
|
l === -1 && console.error(
|
|
32
|
-
`Current step with id ${
|
|
32
|
+
`Current step with id ${s} not found in steps array. Bad configuration?`
|
|
33
33
|
);
|
|
34
|
-
let
|
|
35
|
-
for (let r = 0; r <
|
|
36
|
-
const e =
|
|
34
|
+
let u = s;
|
|
35
|
+
for (let r = 0; r < i.length; r++) {
|
|
36
|
+
const e = i[r];
|
|
37
37
|
if (r > l) {
|
|
38
38
|
e.isActive = !1, e.isCompleted = !1;
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
-
if (e.step.id ===
|
|
41
|
+
if (e.step.id === s)
|
|
42
42
|
if (e.isRendered)
|
|
43
43
|
e.isActive = !0, e.isCompleted = !1;
|
|
44
44
|
else {
|
|
45
|
-
const a =
|
|
45
|
+
const a = i.find((B) => B.step.id === u);
|
|
46
46
|
a && (a.isActive = !0, a.isCompleted = e.step.excludedStepCompletesPreviousStep ?? !1);
|
|
47
47
|
}
|
|
48
|
-
r < l && (e.isActive = !1, e.isCompleted = !0, e.isRendered && (
|
|
48
|
+
r < l && (e.isActive = !1, e.isCompleted = !0, e.isRendered && (u = e.step.id));
|
|
49
49
|
}
|
|
50
|
-
return
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
`No active step found for currentStepId ${o}. Please check your configuration.`
|
|
55
|
-
), null;
|
|
56
|
-
if (c) {
|
|
57
|
-
if (!t.step.nextButtonProps?.onClick || !t.step.nextButtonProps?.label)
|
|
58
|
-
return console.error(
|
|
59
|
-
`Next button props not found for current step with id ${o}. If you want to use the stepper buttons, make sure to provide nextButtonProps for each step.`
|
|
60
|
-
), null;
|
|
61
|
-
if ((!t.isFirst || d) && (!t.step.prevButtonProps?.onClick || !t.step.prevButtonProps?.label))
|
|
62
|
-
return console.error(
|
|
63
|
-
`Previous button props not found for current step with id ${o}. If you want to use the stepper buttons, make sure to provide prevButtonProps for each applicable step.`
|
|
64
|
-
), null;
|
|
65
|
-
}
|
|
66
|
-
return /* @__PURE__ */ m(
|
|
67
|
-
u,
|
|
50
|
+
return i;
|
|
51
|
+
}, [o, s]), t = f(() => p.find((i) => i.isActive), [p]);
|
|
52
|
+
return t ? /* @__PURE__ */ c(
|
|
53
|
+
d,
|
|
68
54
|
{
|
|
69
55
|
"data-testid": "stepper",
|
|
70
56
|
fullWidth: !0,
|
|
@@ -73,59 +59,61 @@ const W = ({
|
|
|
73
59
|
primaryAlign: "center",
|
|
74
60
|
secondaryAlign: "center",
|
|
75
61
|
children: [
|
|
76
|
-
|
|
62
|
+
h ? /* @__PURE__ */ n(
|
|
77
63
|
k,
|
|
78
64
|
{
|
|
79
|
-
stepperStyle:
|
|
65
|
+
stepperStyle: m,
|
|
80
66
|
stepsData: p,
|
|
81
|
-
overwriteTotalSteps:
|
|
67
|
+
overwriteTotalSteps: v
|
|
82
68
|
}
|
|
83
69
|
) : null,
|
|
84
70
|
/* @__PURE__ */ n(
|
|
85
|
-
|
|
71
|
+
d,
|
|
86
72
|
{
|
|
87
73
|
"data-testid": "stepper-content",
|
|
88
74
|
fullWidth: !0,
|
|
89
|
-
className:
|
|
75
|
+
className: b.stepperContent,
|
|
90
76
|
gap: "airy",
|
|
91
77
|
secondaryAlign: "center",
|
|
92
78
|
direction: "vertical",
|
|
93
|
-
children:
|
|
79
|
+
children: A
|
|
94
80
|
}
|
|
95
81
|
),
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
y ? /* @__PURE__ */ c(
|
|
83
|
+
d,
|
|
98
84
|
{
|
|
99
85
|
"data-testid": "stepper-buttons",
|
|
100
86
|
fullWidth: !0,
|
|
101
87
|
secondaryAlign: "center",
|
|
102
|
-
primaryAlign:
|
|
88
|
+
primaryAlign: t.step.prevButtonProps ? g : "end",
|
|
103
89
|
children: [
|
|
104
|
-
(!t.isFirst ||
|
|
105
|
-
|
|
90
|
+
(!t.isFirst || x) && t.step.prevButtonProps ? /* @__PURE__ */ n(
|
|
91
|
+
C,
|
|
106
92
|
{
|
|
107
93
|
...t.step.prevButtonProps,
|
|
108
94
|
onClick: t.step.prevButtonProps.onClick,
|
|
109
95
|
label: t.step.prevButtonProps.label
|
|
110
96
|
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ n(
|
|
113
|
-
|
|
97
|
+
) : null,
|
|
98
|
+
t.step.nextButtonProps ? /* @__PURE__ */ n(
|
|
99
|
+
S,
|
|
114
100
|
{
|
|
115
101
|
...t.step.nextButtonProps,
|
|
116
102
|
onClick: t.step.nextButtonProps.onClick,
|
|
117
103
|
label: t.step.nextButtonProps.label,
|
|
118
|
-
isStepLoading:
|
|
104
|
+
isStepLoading: P,
|
|
119
105
|
isLastStep: t.isLast
|
|
120
106
|
}
|
|
121
|
-
)
|
|
107
|
+
) : null
|
|
122
108
|
]
|
|
123
109
|
}
|
|
124
110
|
) : null
|
|
125
111
|
]
|
|
126
112
|
}
|
|
127
|
-
)
|
|
113
|
+
) : (console.error(
|
|
114
|
+
`No active step found for currentStepId ${s}. Please check your configuration.`
|
|
115
|
+
), null);
|
|
128
116
|
};
|
|
129
117
|
export {
|
|
130
|
-
|
|
118
|
+
G as Stepper
|
|
131
119
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { a as p, s as t, f as
|
|
3
|
-
import { a as
|
|
2
|
+
import { a as p, s as t, f as y, c as C } from "../../react.esm-Bm0cAgpZ.js";
|
|
3
|
+
import { a as S } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
4
4
|
import { Stepper as s } from "./Stepper.js";
|
|
5
5
|
import { StepperStyle as i } from "./stepperStyles.js";
|
|
6
|
-
import { d as B, b as
|
|
7
|
-
const
|
|
6
|
+
import { d as B, b as T, t as c, g as e, v as l } from "../../vi.bdSIJ99Y-B308Q-4w.js";
|
|
7
|
+
const u = () => [
|
|
8
8
|
{
|
|
9
9
|
id: "step1",
|
|
10
10
|
stepNumber: 1,
|
|
11
11
|
text: "Description 1",
|
|
12
12
|
secondaryText: "Secondary Description 1",
|
|
13
13
|
optional: !1,
|
|
14
|
-
nextButtonProps: { onClick:
|
|
15
|
-
prevButtonProps: { onClick:
|
|
14
|
+
nextButtonProps: { onClick: l.fn(), label: "Next" },
|
|
15
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
id: "step2",
|
|
@@ -20,8 +20,8 @@ const m = () => [
|
|
|
20
20
|
text: "Description 2",
|
|
21
21
|
secondaryText: "Secondary Description 2",
|
|
22
22
|
optional: !1,
|
|
23
|
-
nextButtonProps: { onClick:
|
|
24
|
-
prevButtonProps: { onClick:
|
|
23
|
+
nextButtonProps: { onClick: l.fn(), label: "Next" },
|
|
24
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
id: "step3",
|
|
@@ -29,14 +29,14 @@ const m = () => [
|
|
|
29
29
|
text: "Description 3",
|
|
30
30
|
secondaryText: "Secondary Description 3",
|
|
31
31
|
optional: !0,
|
|
32
|
-
nextButtonProps: { onClick:
|
|
33
|
-
prevButtonProps: { onClick:
|
|
32
|
+
nextButtonProps: { onClick: l.fn(), label: "Finish" },
|
|
33
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
34
34
|
}
|
|
35
35
|
];
|
|
36
36
|
B("Generic Stepper Tests (StepperStyle.DESKTOP)", () => {
|
|
37
37
|
let o;
|
|
38
|
-
|
|
39
|
-
o =
|
|
38
|
+
T(() => {
|
|
39
|
+
o = u();
|
|
40
40
|
}), c("Default Render", () => {
|
|
41
41
|
p(
|
|
42
42
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -66,15 +66,15 @@ B("Generic Stepper Tests (StepperStyle.DESKTOP)", () => {
|
|
|
66
66
|
const r = t.getByText("Next").closest("button");
|
|
67
67
|
e(r).toBeDisabled();
|
|
68
68
|
}), c("calls nextButtonProps.onClick when next button is clicked", () => {
|
|
69
|
-
const r =
|
|
69
|
+
const r = l.fn();
|
|
70
70
|
o[1].nextButtonProps.onClick = r, p(
|
|
71
71
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
72
|
-
),
|
|
72
|
+
), y.click(t.getByText("Next")), e(r).toHaveBeenCalled();
|
|
73
73
|
}), c("calls prevButtonProps.onClick when prev button is clicked", () => {
|
|
74
|
-
const r =
|
|
74
|
+
const r = l.fn();
|
|
75
75
|
o[1].prevButtonProps.onClick = r, p(
|
|
76
76
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
77
|
-
),
|
|
77
|
+
), y.click(t.getByText("Back")), e(r).toHaveBeenCalled();
|
|
78
78
|
}), c("does not render the prev button on the first step", () => {
|
|
79
79
|
p(
|
|
80
80
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step1", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -116,31 +116,29 @@ B("Generic Stepper Tests (StepperStyle.DESKTOP)", () => {
|
|
|
116
116
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
117
117
|
), e(t.queryByText("arrow_forward")).not.toBeInTheDocument(), e(t.queryByText("arrow_back")).not.toBeInTheDocument();
|
|
118
118
|
}), c("prints an error when current step is not found", () => {
|
|
119
|
-
const r =
|
|
119
|
+
const r = l.spyOn(console, "error").mockImplementation(() => {
|
|
120
120
|
});
|
|
121
121
|
p(
|
|
122
122
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "unknownId", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
123
123
|
), e(r).toHaveBeenCalledWith(
|
|
124
124
|
"Current step with id unknownId not found in steps array. Bad configuration?"
|
|
125
125
|
), r.mockRestore(), e(t.queryByTestId("description-stepper-header")).not.toBeInTheDocument();
|
|
126
|
-
}), c("
|
|
127
|
-
const r =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/* @__PURE__ */ n(s, { steps:
|
|
135
|
-
), e(
|
|
136
|
-
"Previous button props not found for current step with id step2. If you want to use the stepper buttons, make sure to provide prevButtonProps for each applicable step."
|
|
137
|
-
), r.mockRestore();
|
|
126
|
+
}), c("does not render buttons when props are not provided", () => {
|
|
127
|
+
const r = u();
|
|
128
|
+
r[0].nextButtonProps = void 0, r[0].prevButtonProps = void 0, p(
|
|
129
|
+
/* @__PURE__ */ n(s, { steps: r, currentStepId: "step1", showPreviousButtonOnFirstStep: !0, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
130
|
+
), e(t.queryByText("Next")).not.toBeInTheDocument(), e(t.queryByText("Back")).not.toBeInTheDocument();
|
|
131
|
+
}), c("renders only one button if the other is missing", () => {
|
|
132
|
+
const r = u();
|
|
133
|
+
r[1].prevButtonProps = void 0, p(
|
|
134
|
+
/* @__PURE__ */ n(s, { steps: r, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
135
|
+
), e(t.getByText("Next")).toBeInTheDocument(), e(t.queryByText("Back")).not.toBeInTheDocument();
|
|
138
136
|
});
|
|
139
137
|
});
|
|
140
138
|
B("Stepper Type DESKTOP Tests", () => {
|
|
141
139
|
let o;
|
|
142
|
-
|
|
143
|
-
o =
|
|
140
|
+
T(() => {
|
|
141
|
+
o = u();
|
|
144
142
|
}), c("renders numbers, text and secondary text", () => {
|
|
145
143
|
p(
|
|
146
144
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -203,23 +201,23 @@ B("Stepper Type DESKTOP Tests", () => {
|
|
|
203
201
|
);
|
|
204
202
|
const r = t.getByTestId("stepper-item-circle-for-step1"), d = t.getByTestId(
|
|
205
203
|
"stepper-connector-before-step2"
|
|
206
|
-
),
|
|
207
|
-
e(r.className).toContain("stepperItemNumberActive"), e(d.className).toContain("stepperItemConnectorCompleted"), e(
|
|
204
|
+
), a = t.getByTestId("stepper-item-circle-for-step2"), m = t.getByTestId("stepper-connector-before-step3"), I = t.getByTestId("stepper-item-circle-for-step3");
|
|
205
|
+
e(r.className).toContain("stepperItemNumberActive"), e(d.className).toContain("stepperItemConnectorCompleted"), e(a.className).toContain("stepperItemNumberActive"), e(m.className).not.toContain("stepperItemConnectorCompleted"), e(I.className).not.toContain("stepperItemNumberActive");
|
|
208
206
|
}), c("advancing step changes number to checkmark and adjusts color", () => {
|
|
209
207
|
const { rerender: r } = p(
|
|
210
208
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
211
|
-
), d = t.getByTestId("stepper-item-circle-for-step1"),
|
|
212
|
-
e(d.className).toContain("stepperItemNumberActive"), e(
|
|
209
|
+
), d = t.getByTestId("stepper-item-circle-for-step1"), a = t.getByTestId("stepper-connector-before-step2"), m = t.getByTestId("stepper-item-circle-for-step2"), I = t.getByTestId("stepper-connector-before-step3"), h = t.getByTestId("stepper-item-circle-for-step3");
|
|
210
|
+
e(d.className).toContain("stepperItemNumberActive"), e(a.className).not.toContain("stepperItemConnectorCompleted"), e(m.className).not.toContain("stepperItemNumberActive"), e(I.className).not.toContain("stepperItemConnectorCompleted"), e(h.className).not.toContain("stepperItemNumberActive"), r(
|
|
213
211
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
214
|
-
), e(d.className).toContain("stepperItemNumberActive"), e(
|
|
212
|
+
), e(d.className).toContain("stepperItemNumberActive"), e(a.className).toContain("stepperItemConnectorCompleted"), e(m.className).toContain("stepperItemNumberActive"), e(I.className).not.toContain("stepperItemConnectorCompleted"), e(h.className).not.toContain("stepperItemNumberActive"), r(
|
|
215
213
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
216
|
-
), e(d.className).toContain("stepperItemNumberActive"), e(
|
|
214
|
+
), e(d.className).toContain("stepperItemNumberActive"), e(a.className).toContain("stepperItemConnectorCompleted"), e(m.className).toContain("stepperItemNumberActive"), e(I.className).toContain("stepperItemConnectorCompleted"), e(h.className).toContain("stepperItemNumberActive");
|
|
217
215
|
}), c("custom button icons are shown as expected", () => {
|
|
218
216
|
o[1].nextButtonProps.showArrowIcon = !1, o[1].nextButtonProps.trailingIcon = "flag", o[1].prevButtonProps.showArrowIcon = !1, o[1].prevButtonProps.leadingIcon = "wifi", p(
|
|
219
217
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
220
218
|
), e(t.getByText("flag")).toBeInTheDocument(), e(t.getByText("wifi")).toBeInTheDocument();
|
|
221
219
|
}), c("handles excludeFromHeader and excludedStepCompletesPreviousStep correctly", () => {
|
|
222
|
-
const r =
|
|
220
|
+
const r = u();
|
|
223
221
|
r.push({
|
|
224
222
|
id: "step4",
|
|
225
223
|
stepNumber: 4,
|
|
@@ -227,8 +225,8 @@ B("Stepper Type DESKTOP Tests", () => {
|
|
|
227
225
|
excludeFromHeader: !0,
|
|
228
226
|
excludedStepCompletesPreviousStep: !1,
|
|
229
227
|
secondaryText: "Secondary Description 4",
|
|
230
|
-
nextButtonProps: { onClick:
|
|
231
|
-
prevButtonProps: { onClick:
|
|
228
|
+
nextButtonProps: { onClick: l.fn(), label: "Next" },
|
|
229
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
232
230
|
}), r[1].excludedStepCompletesPreviousStep = !0, r[1].excludeFromHeader = !0, p(
|
|
233
231
|
/* @__PURE__ */ n(
|
|
234
232
|
s,
|
|
@@ -252,25 +250,25 @@ B("Stepper Type DESKTOP Tests", () => {
|
|
|
252
250
|
}
|
|
253
251
|
)
|
|
254
252
|
);
|
|
255
|
-
const
|
|
256
|
-
e(
|
|
253
|
+
const a = t.getByTestId("stepper-connector-before-step3");
|
|
254
|
+
e(a.className).toContain("stepperItemConnectorCompleted"), e(
|
|
257
255
|
t.queryByTestId("stepper-item-check-for-step3")
|
|
258
256
|
).not.toBeInTheDocument();
|
|
259
257
|
}), c("shows mobile view breakpoint is triggered (<600px)", () => {
|
|
260
|
-
|
|
258
|
+
l.spyOn(S, "useBreakpoints").mockReturnValue({
|
|
261
259
|
isMobile: !0,
|
|
262
260
|
isDesktop: !1,
|
|
263
261
|
isDesktopNavbar: !1,
|
|
264
262
|
isTablet: !1
|
|
265
263
|
}), p(
|
|
266
264
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
267
|
-
), e(t.getByTestId("desktop-stepper-header")).toBeInTheDocument(), e(t.getByTestId("stepper-item-step2")).toBeInTheDocument(), e(t.queryByTestId("stepper-item-step1")).not.toBeInTheDocument(), e(t.queryByTestId("stepper-item-step3")).not.toBeInTheDocument(),
|
|
265
|
+
), e(t.getByTestId("desktop-stepper-header")).toBeInTheDocument(), e(t.getByTestId("stepper-item-step2")).toBeInTheDocument(), e(t.queryByTestId("stepper-item-step1")).not.toBeInTheDocument(), e(t.queryByTestId("stepper-item-step3")).not.toBeInTheDocument(), l.spyOn(S, "useBreakpoints").mockRestore();
|
|
268
266
|
});
|
|
269
267
|
});
|
|
270
268
|
B("Stepper Type DOTS Tests", () => {
|
|
271
269
|
let o;
|
|
272
|
-
|
|
273
|
-
o =
|
|
270
|
+
T(() => {
|
|
271
|
+
o = u();
|
|
274
272
|
}), c("renders dots and text", () => {
|
|
275
273
|
p(
|
|
276
274
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -288,8 +286,8 @@ B("Stepper Type DOTS Tests", () => {
|
|
|
288
286
|
p(
|
|
289
287
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
290
288
|
);
|
|
291
|
-
const r = t.getByTestId("stepper-indicator-step1"), d = t.getByTestId("stepper-indicator-step2"),
|
|
292
|
-
e(r.className).toContain("stepperIndicatorItemActive"), e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
289
|
+
const r = t.getByTestId("stepper-indicator-step1"), d = t.getByTestId("stepper-indicator-step2"), a = t.getByTestId("stepper-indicator-step3");
|
|
290
|
+
e(r.className).toContain("stepperIndicatorItemActive"), e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).not.toContain("stepperIndicatorItemActive");
|
|
293
291
|
}), c("show optional style", () => {
|
|
294
292
|
p(
|
|
295
293
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -299,18 +297,18 @@ B("Stepper Type DOTS Tests", () => {
|
|
|
299
297
|
}), c("advancing step adjusts styles accordingly", () => {
|
|
300
298
|
const { rerender: r } = p(
|
|
301
299
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
302
|
-
), d = t.getByTestId("stepper-indicator-step1"),
|
|
303
|
-
e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
300
|
+
), d = t.getByTestId("stepper-indicator-step1"), a = t.getByTestId("stepper-indicator-step2"), m = t.getByTestId("stepper-indicator-step3");
|
|
301
|
+
e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).not.toContain("stepperIndicatorItemActive"), e(m.className).not.toContain("stepperIndicatorItemActive"), r(
|
|
304
302
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
305
|
-
), e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
303
|
+
), e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).toContain("stepperIndicatorItemActive"), e(m.className).not.toContain("stepperIndicatorItemActive"), r(
|
|
306
304
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
307
|
-
), e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
305
|
+
), e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).toContain("stepperIndicatorItemActive"), e(m.className).toContain("stepperIndicatorItemActive");
|
|
308
306
|
});
|
|
309
307
|
});
|
|
310
308
|
B("Stepper Type SMALL Tests", () => {
|
|
311
309
|
let o;
|
|
312
|
-
|
|
313
|
-
o =
|
|
310
|
+
T(() => {
|
|
311
|
+
o = u();
|
|
314
312
|
}), c("renders step number, total steps and text", () => {
|
|
315
313
|
p(
|
|
316
314
|
/* @__PURE__ */ n(s, { stepperStyle: i.SMALL, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -3,6 +3,7 @@ import { StepperButtonProps } from '../stepperTypes';
|
|
|
3
3
|
/**
|
|
4
4
|
* A button component for the stepper that is used to go to the previous step.
|
|
5
5
|
* @param label - The label of the button.
|
|
6
|
+
* @param variant - The element variant of the button. Defaults to 'outlined'.
|
|
6
7
|
* @param onClick - The function to be called when the button is clicked.
|
|
7
8
|
* @param disabled - Whether the button is disabled or not.
|
|
8
9
|
* @param className - Additional class names to apply to the button.
|
|
@@ -13,10 +14,11 @@ import { StepperButtonProps } from '../stepperTypes';
|
|
|
13
14
|
* @param fullWidth - Whether the button should take the full width of its container. Defaults to true.
|
|
14
15
|
* @returns
|
|
15
16
|
*/
|
|
16
|
-
export declare const StepperPreviousButton: ({ label, onClick, disabled, className, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const StepperPreviousButton: ({ label, variant, onClick, disabled, className, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
/**
|
|
18
19
|
* A button component for the stepper that is used to go to the next step.
|
|
19
20
|
* @param label - The label of the button.
|
|
21
|
+
* @param variant - The element variant of the button. Defaults to the element standard variant.
|
|
20
22
|
* @param onClick - The function to be called when the button is clicked.
|
|
21
23
|
* @param disabled - Whether the button is disabled or not.
|
|
22
24
|
* @param className - Additional class names to apply to the button.
|
|
@@ -29,7 +31,7 @@ export declare const StepperPreviousButton: ({ label, onClick, disabled, classNa
|
|
|
29
31
|
* @param fullWidth - Whether the button should take the full width of its container. Defaults to true.
|
|
30
32
|
* @returns
|
|
31
33
|
*/
|
|
32
|
-
export declare const StepperNextButton: ({ label, onClick, disabled, className, isStepLoading, isLastStep, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps & {
|
|
34
|
+
export declare const StepperNextButton: ({ label, variant, onClick, disabled, className, isStepLoading, isLastStep, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps & {
|
|
33
35
|
isStepLoading?: boolean;
|
|
34
36
|
isLastStep?: boolean;
|
|
35
37
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,74 +1,77 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { B as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { s as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { B as v } from "../../../index.es-B8p8KCdj.js";
|
|
3
|
+
import { useMemo as b } from "react";
|
|
4
|
+
import { s as i } from "../../../stepper.module-DR_FbENS.js";
|
|
5
|
+
const N = ({
|
|
6
6
|
label: p,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
variant: s = "outlined",
|
|
8
|
+
onClick: m,
|
|
9
|
+
disabled: n,
|
|
10
|
+
className: d,
|
|
10
11
|
showArrowIcon: t = !0,
|
|
11
12
|
leadingIcon: e,
|
|
12
13
|
trailingIcon: r,
|
|
13
14
|
buttonSize: u = "themeDefault",
|
|
14
15
|
fullWidth: o = !0
|
|
15
16
|
}) => {
|
|
16
|
-
const
|
|
17
|
+
const f = b(() => {
|
|
17
18
|
if (e) return e;
|
|
18
19
|
if (!r)
|
|
19
20
|
return t ? "arrow_back" : void 0;
|
|
20
21
|
}, [e, r, t]);
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
22
|
+
return /* @__PURE__ */ a(
|
|
23
|
+
v,
|
|
23
24
|
{
|
|
24
25
|
"data-testid": "stepper-previous-button",
|
|
25
|
-
className: `${
|
|
26
|
-
onClick:
|
|
27
|
-
disabled:
|
|
26
|
+
className: `${i.stepperButton} ${d ?? ""}`,
|
|
27
|
+
onClick: m,
|
|
28
|
+
disabled: n,
|
|
28
29
|
fullWidth: o,
|
|
29
30
|
buttonSize: u,
|
|
30
|
-
variant:
|
|
31
|
-
leadingIcon:
|
|
31
|
+
variant: s,
|
|
32
|
+
leadingIcon: f,
|
|
32
33
|
trailingIcon: r,
|
|
33
34
|
type: "button",
|
|
34
35
|
children: p
|
|
35
36
|
}
|
|
36
37
|
);
|
|
37
|
-
},
|
|
38
|
+
}, h = ({
|
|
38
39
|
label: p,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
variant: s,
|
|
41
|
+
onClick: m,
|
|
42
|
+
disabled: n,
|
|
43
|
+
className: d,
|
|
42
44
|
isStepLoading: t,
|
|
43
45
|
isLastStep: e,
|
|
44
46
|
showArrowIcon: r = !0,
|
|
45
47
|
leadingIcon: u,
|
|
46
48
|
trailingIcon: o,
|
|
47
|
-
buttonSize:
|
|
48
|
-
fullWidth:
|
|
49
|
+
buttonSize: f = "themeDefault",
|
|
50
|
+
fullWidth: B = !0
|
|
49
51
|
}) => {
|
|
50
|
-
const
|
|
52
|
+
const c = b(() => {
|
|
51
53
|
if (o) return o;
|
|
52
54
|
if (!u && !t && !e)
|
|
53
55
|
return r ? "arrow_forward" : void 0;
|
|
54
56
|
}, [e, t, r, u, o]);
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
|
|
57
|
+
return /* @__PURE__ */ a(
|
|
58
|
+
v,
|
|
57
59
|
{
|
|
58
60
|
"data-testid": "stepper-next-button",
|
|
59
|
-
className: `${
|
|
60
|
-
onClick:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
className: `${i.stepperButton} ${t ? i.stepperButtonLoading : ""} ${d ?? ""}`,
|
|
62
|
+
onClick: m,
|
|
63
|
+
variant: s,
|
|
64
|
+
disabled: t || n,
|
|
65
|
+
fullWidth: B,
|
|
66
|
+
trailingIcon: c,
|
|
64
67
|
leadingIcon: u,
|
|
65
68
|
type: e ? "submit" : "button",
|
|
66
|
-
buttonSize:
|
|
69
|
+
buttonSize: f,
|
|
67
70
|
children: p
|
|
68
71
|
}
|
|
69
72
|
);
|
|
70
73
|
};
|
|
71
74
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
h as StepperNextButton,
|
|
76
|
+
N as StepperPreviousButton
|
|
74
77
|
};
|
|
@@ -47,23 +47,21 @@ export type Step = {
|
|
|
47
47
|
optional?: boolean;
|
|
48
48
|
/**
|
|
49
49
|
* The props for the next button, including onClick, label, className and disabled state.
|
|
50
|
-
* Will print a console error if the button is embedded but no props are provided and return null for the entire stepper.
|
|
51
50
|
*
|
|
52
51
|
* See {@link StepperButtonProps} for details.
|
|
53
52
|
*/
|
|
54
|
-
nextButtonProps
|
|
53
|
+
nextButtonProps?: StepperButtonProps;
|
|
55
54
|
/**
|
|
56
55
|
* The props for the previous button, including onClick, label, className and disabled state.
|
|
57
|
-
* Will print a console error if the button is embedded but no props are provided and return null for the entire stepper.
|
|
58
56
|
*
|
|
59
57
|
* See {@link StepperButtonProps} for details.
|
|
60
58
|
*/
|
|
61
|
-
prevButtonProps
|
|
59
|
+
prevButtonProps?: StepperButtonProps;
|
|
62
60
|
};
|
|
63
61
|
/**
|
|
64
62
|
* Defines the props for the stepper buttons, including onClick, label, className and disabled state.
|
|
65
63
|
*/
|
|
66
|
-
export type StepperButtonProps = Pick<ButtonProps, 'className' | 'disabled' | 'fullWidth'> & {
|
|
64
|
+
export type StepperButtonProps = Pick<ButtonProps, 'className' | 'disabled' | 'fullWidth' | 'variant'> & {
|
|
67
65
|
/**
|
|
68
66
|
* The function to be called when the button is clicked.
|
|
69
67
|
*/
|
|
@@ -140,9 +138,8 @@ export type StepperProps = {
|
|
|
140
138
|
showStepperButtons?: boolean;
|
|
141
139
|
/**
|
|
142
140
|
* The alignment of the stepper button group.
|
|
143
|
-
* @default 'center'
|
|
144
141
|
*/
|
|
145
|
-
stepperButtonAlignment?: Extract<CSSProperties['justifyContent'], 'center' | 'space-between'>;
|
|
142
|
+
stepperButtonAlignment?: Extract<CSSProperties['justifyContent'], 'start' | 'end' | 'center' | 'space-between'>;
|
|
146
143
|
/**
|
|
147
144
|
* A flag which indicates if the previous button should be shown on the first step.
|
|
148
145
|
* This can be useful for canceling the stepper.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.17.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|