@phillips/seldon 1.207.0 → 1.209.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/dist/components/ProgressIndicator/ProgressIndicator.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.js +35 -34
- package/dist/patterns/CountryPicker/CountryPicker.js +40 -38
- package/dist/patterns/CountryPicker/CountryPickerTrigger.d.ts +4 -0
- package/dist/patterns/CountryPicker/CountryPickerTrigger.js +34 -23
- package/dist/patterns/PhoneNumberInput/PhoneNumberInput.js +37 -36
- package/dist/patterns/ProgressWizard/ProgressWizard.d.ts +1 -1
- package/dist/patterns/ProgressWizard/ProgressWizard.js +35 -27
- package/dist/patterns/ProgressWizard/ProgressWizard.stories.d.ts +18 -443
- package/dist/patterns/ProgressWizard/types.d.ts +4 -4
- package/dist/patterns/ProgressWizard/utils.js +6 -12
- package/dist/scss/_sharedClasses.scss +3 -3
- package/dist/scss/_vars.scss +11 -0
- package/dist/scss/_vars.scss.js +11 -0
- package/dist/scss/components/AddToCalendar/_addToCalendar.scss +1 -1
- package/dist/scss/components/Breadcrumb/_breadcrumb.scss +1 -1
- package/dist/scss/components/Button/_button.scss +2 -3
- package/dist/scss/components/Carousel/_carousel.scss +3 -3
- package/dist/scss/components/ComboBox/_combobox.scss +2 -2
- package/dist/scss/components/ComposedModal/_composedModal.scss +1 -1
- package/dist/scss/components/DatePicker/_datePicker.scss +1 -1
- package/dist/scss/components/DescriptiveRadioButton/_descriptiveRadioButton.scss +1 -1
- package/dist/scss/components/Drawer/_drawer.scss +2 -2
- package/dist/scss/components/IconButton/_iconButton.scss +2 -2
- package/dist/scss/components/Input/_input.scss +2 -2
- package/dist/scss/components/Loader/_loader.scss +1 -1
- package/dist/scss/components/ProgressIndicator/_progressIndicator.scss +1 -1
- package/dist/scss/components/Select/_select.scss +0 -1
- package/dist/scss/components/Tags/_tags.scss +2 -2
- package/dist/scss/components/TextArea/_textArea.scss +1 -1
- package/dist/scss/components/Toast/_toast.scss +1 -1
- package/dist/scss/components/Toggle/_toggle.scss +2 -2
- package/dist/scss/patterns/CountryPicker/_countryPickerOption.scss +1 -1
- package/dist/scss/patterns/CountryPicker/_countryPickerTrigger.scss +1 -1
- package/dist/scss/patterns/FavoritesCollectionTile/_favoritesCollectionTile.scss +2 -2
- package/dist/scss/patterns/FiltersInline/_filterButton.scss +2 -2
- package/dist/scss/patterns/FiltersInline/_filterDropdownMenu.scss +2 -2
- package/dist/scss/patterns/ProgressWizard/_progressWizard.scss +4 -0
- package/dist/scss/patterns/SaleCard/_saleCard.scss +1 -1
- package/dist/scss/patterns/Social/_social.scss +0 -1
- package/package.json +1 -1
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { Root as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { getCommonProps as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { TextVariants as
|
|
1
|
+
import { jsx as r, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { Root as P } from "../../node_modules/@radix-ui/react-progress/dist/index.js";
|
|
3
|
+
import { forwardRef as $, Fragment as C } from "react";
|
|
4
|
+
import { getCommonProps as I } from "../../utils/index.js";
|
|
5
|
+
import h from "../../node_modules/classnames/index.js";
|
|
6
|
+
import S from "../Icon/Icon.js";
|
|
7
|
+
import { TextVariants as p } from "../Text/types.js";
|
|
8
8
|
import _ from "../Text/Text.js";
|
|
9
|
-
const
|
|
9
|
+
const T = $(
|
|
10
10
|
({
|
|
11
|
-
totalSteps:
|
|
11
|
+
totalSteps: i,
|
|
12
12
|
currentStep: f,
|
|
13
13
|
className: u,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
stepLabels: e,
|
|
15
|
+
progressIndicatorAriaLabel: g = "Progress Indicator",
|
|
16
|
+
completedIconAriaLabel: N = "Completed Icon",
|
|
17
|
+
...n
|
|
18
|
+
}, v) => {
|
|
19
|
+
const { className: a, ...M } = I(n, "ProgressIndicator");
|
|
20
|
+
if (i <= 0) return null;
|
|
21
|
+
const t = Math.max(1, Math.min(10, Math.floor(i))), c = Math.max(1, Math.min(t, Math.floor(f)));
|
|
22
|
+
return /* @__PURE__ */ r("div", { ...M, className: h(a, u), ...n, ref: v, children: /* @__PURE__ */ r(P, { value: c, max: t, "aria-label": g, children: /* @__PURE__ */ r("div", { className: `${a}__steps`, children: Array.from({ length: t }).map((x, o) => {
|
|
23
|
+
const s = o + 1, m = c > s, l = c === s;
|
|
24
|
+
return /* @__PURE__ */ d(C, { children: [
|
|
25
|
+
/* @__PURE__ */ d(
|
|
25
26
|
"div",
|
|
26
27
|
{
|
|
27
28
|
className: `${a}__item`,
|
|
28
|
-
"aria-current":
|
|
29
|
-
"data-testid": `progress-step-${
|
|
29
|
+
"aria-current": l ? "step" : void 0,
|
|
30
|
+
"data-testid": `progress-step-${s}`,
|
|
30
31
|
children: [
|
|
31
32
|
/* @__PURE__ */ r(
|
|
32
33
|
"span",
|
|
33
34
|
{
|
|
34
|
-
className:
|
|
35
|
-
[`${a}__circle--active`]:
|
|
36
|
-
[`${a}__circle--current`]:
|
|
35
|
+
className: h(`${a}__circle`, {
|
|
36
|
+
[`${a}__circle--active`]: m,
|
|
37
|
+
[`${a}__circle--current`]: l
|
|
37
38
|
}),
|
|
38
|
-
children:
|
|
39
|
-
|
|
39
|
+
children: m ? /* @__PURE__ */ r(
|
|
40
|
+
S,
|
|
40
41
|
{
|
|
41
42
|
icon: "Success",
|
|
42
|
-
"aria-label":
|
|
43
|
+
"aria-label": N,
|
|
43
44
|
color: "currentColor",
|
|
44
45
|
width: 20,
|
|
45
46
|
height: 20
|
|
46
47
|
}
|
|
47
|
-
) : /* @__PURE__ */ r(_, { variant:
|
|
48
|
+
) : /* @__PURE__ */ r(_, { variant: p.badge, children: s })
|
|
48
49
|
}
|
|
49
50
|
),
|
|
50
|
-
e
|
|
51
|
+
e && e[o] && /* @__PURE__ */ r("span", { className: `${a}__label`, children: /* @__PURE__ */ r(_, { variant: p.string2, children: e[o] }) })
|
|
51
52
|
]
|
|
52
53
|
}
|
|
53
54
|
),
|
|
54
|
-
|
|
55
|
-
] }, e
|
|
55
|
+
o < t - 1 ? /* @__PURE__ */ r("div", { className: `${a}__connector`, "aria-hidden": "true" }) : null
|
|
56
|
+
] }, e?.[o] || o);
|
|
56
57
|
}) }) }) });
|
|
57
58
|
}
|
|
58
59
|
);
|
|
59
|
-
|
|
60
|
+
T.displayName = "ProgressIndicator";
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
T as default
|
|
62
63
|
};
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { getCommonProps as
|
|
6
|
-
import { toConfig as
|
|
7
|
-
const
|
|
1
|
+
import { jsxs as v, Fragment as N, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as j, useState as M } from "react";
|
|
3
|
+
import O from "./CountryPickerTrigger.js";
|
|
4
|
+
import T from "./CountryPickerModal.js";
|
|
5
|
+
import { getCommonProps as w } from "../../utils/index.js";
|
|
6
|
+
import { toConfig as l } from "./types.js";
|
|
7
|
+
const E = j(
|
|
8
8
|
({
|
|
9
|
-
triggerLabelText:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
triggerLabelText: m,
|
|
10
|
+
triggerAriaLabel: c,
|
|
11
|
+
hasTriggerError: u,
|
|
12
|
+
triggerErrorMsg: f,
|
|
13
|
+
triggerDisplayValue: p,
|
|
14
|
+
modalTitle: d,
|
|
15
|
+
searchInputLabel: C,
|
|
16
|
+
searchInputPlaceholder: y,
|
|
17
|
+
selectButtonLabel: k,
|
|
17
18
|
inputName: o,
|
|
18
|
-
baseClassName:
|
|
19
|
+
baseClassName: P = "CountryPicker",
|
|
19
20
|
value: t,
|
|
20
|
-
onChange:
|
|
21
|
-
isPhone:
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
const [x, i] =
|
|
25
|
-
modalTitle:
|
|
26
|
-
searchInputLabel:
|
|
27
|
-
searchInputPlaceholder:
|
|
28
|
-
selectButtonLabel:
|
|
21
|
+
onChange: a,
|
|
22
|
+
isPhone: g,
|
|
23
|
+
...s
|
|
24
|
+
}, b) => {
|
|
25
|
+
const [x, i] = M(!1), { className: n } = w(s, P), h = {
|
|
26
|
+
modalTitle: d,
|
|
27
|
+
searchInputLabel: C,
|
|
28
|
+
searchInputPlaceholder: y,
|
|
29
|
+
selectButtonLabel: k,
|
|
29
30
|
inputName: o,
|
|
30
|
-
...
|
|
31
|
-
}, r =
|
|
32
|
-
return /* @__PURE__ */
|
|
31
|
+
...s
|
|
32
|
+
}, r = g ? l(!0, t, a) : l(!1, t, a);
|
|
33
|
+
return /* @__PURE__ */ v(N, { children: [
|
|
33
34
|
/* @__PURE__ */ e(
|
|
34
|
-
|
|
35
|
+
O,
|
|
35
36
|
{
|
|
36
|
-
ref:
|
|
37
|
-
labelText:
|
|
38
|
-
|
|
37
|
+
ref: b,
|
|
38
|
+
labelText: m,
|
|
39
|
+
ariaLabel: c,
|
|
40
|
+
displayValue: p,
|
|
39
41
|
onClick: () => i(!0),
|
|
40
|
-
hasError:
|
|
41
|
-
errorMsg:
|
|
42
|
+
hasError: u,
|
|
43
|
+
errorMsg: f,
|
|
42
44
|
variantConfig: r,
|
|
43
45
|
baseClassName: n
|
|
44
46
|
}
|
|
45
47
|
),
|
|
46
48
|
/* @__PURE__ */ e(
|
|
47
|
-
|
|
49
|
+
T,
|
|
48
50
|
{
|
|
49
|
-
...
|
|
51
|
+
...h,
|
|
50
52
|
isOpen: x,
|
|
51
53
|
onClose: () => i(!1),
|
|
52
54
|
variantConfig: r,
|
|
@@ -65,7 +67,7 @@ const w = N(
|
|
|
65
67
|
] });
|
|
66
68
|
}
|
|
67
69
|
);
|
|
68
|
-
|
|
70
|
+
E.displayName = "CountryPicker";
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
E as default
|
|
71
73
|
};
|
|
@@ -4,6 +4,10 @@ export type CountryPickerTriggerProps = {
|
|
|
4
4
|
* The label text displayed above the button.
|
|
5
5
|
*/
|
|
6
6
|
labelText: string;
|
|
7
|
+
/**
|
|
8
|
+
* The aria-label attribute for the button, defaults to labelText if not provided.
|
|
9
|
+
*/
|
|
10
|
+
ariaLabel?: string;
|
|
7
11
|
/**
|
|
8
12
|
* The value displayed inside the button (e.g., selected country name or phone code).
|
|
9
13
|
*/
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { TextVariants as
|
|
4
|
-
import
|
|
2
|
+
import y from "../../components/Icon/Icon.js";
|
|
3
|
+
import { TextVariants as k } from "../../components/Text/types.js";
|
|
4
|
+
import P from "../../components/Text/Text.js";
|
|
5
5
|
import t from "../../node_modules/classnames/index.js";
|
|
6
|
-
import { countries as
|
|
7
|
-
import { forwardRef as
|
|
8
|
-
import { useNormalizedInputProps as
|
|
9
|
-
const
|
|
10
|
-
({
|
|
11
|
-
|
|
6
|
+
import { countries as w } from "./constants.js";
|
|
7
|
+
import { forwardRef as I } from "react";
|
|
8
|
+
import { useNormalizedInputProps as T, px as b } from "../../utils/index.js";
|
|
9
|
+
const j = I(
|
|
10
|
+
({
|
|
11
|
+
labelText: l,
|
|
12
|
+
ariaLabel: p = l,
|
|
13
|
+
displayValue: m,
|
|
14
|
+
onClick: _,
|
|
15
|
+
hasError: o = !1,
|
|
16
|
+
errorMsg: s,
|
|
17
|
+
id: e,
|
|
18
|
+
className: f,
|
|
19
|
+
baseClassName: r,
|
|
20
|
+
variantConfig: u
|
|
21
|
+
}, v) => {
|
|
22
|
+
const { isPhone: a, value: c } = u, n = T({
|
|
12
23
|
id: "country-picker-trigger-input",
|
|
13
24
|
invalid: o,
|
|
14
|
-
invalidText:
|
|
25
|
+
invalidText: s,
|
|
15
26
|
type: "text"
|
|
16
|
-
}),
|
|
17
|
-
return /* @__PURE__ */ d("div", { className: t(`${r}__trigger`,
|
|
27
|
+
}), $ = n.invalidId, g = a ? c : w.filter((x) => x.name === c)?.[0]?.code, h = () => n.validation ? n.validation : /* @__PURE__ */ i("p", { className: `${b}-input__validation`, children: " " });
|
|
28
|
+
return /* @__PURE__ */ d("div", { className: t(`${r}__trigger`, f), children: [
|
|
18
29
|
/* @__PURE__ */ i(
|
|
19
|
-
|
|
30
|
+
P,
|
|
20
31
|
{
|
|
21
|
-
variant:
|
|
32
|
+
variant: k.string2,
|
|
22
33
|
className: t(`${r}__trigger-label`, {
|
|
23
34
|
[`${r}__trigger-label--error`]: o
|
|
24
35
|
}),
|
|
@@ -29,16 +40,16 @@ const b = w(
|
|
|
29
40
|
/* @__PURE__ */ d(
|
|
30
41
|
"button",
|
|
31
42
|
{
|
|
32
|
-
ref:
|
|
43
|
+
ref: v,
|
|
33
44
|
type: "button",
|
|
34
|
-
"aria-label":
|
|
45
|
+
"aria-label": p,
|
|
35
46
|
"aria-invalid": n.invalid,
|
|
36
|
-
"aria-describedby":
|
|
47
|
+
"aria-describedby": $,
|
|
37
48
|
className: t(`${r}__trigger-btn`, {
|
|
38
49
|
[`${r}__trigger-btn--error`]: o,
|
|
39
50
|
[`${r}__trigger-btn--is-phone`]: a
|
|
40
51
|
}),
|
|
41
|
-
onClick:
|
|
52
|
+
onClick: _,
|
|
42
53
|
"data-testid": "country-picker-trigger",
|
|
43
54
|
id: e,
|
|
44
55
|
children: [
|
|
@@ -50,16 +61,16 @@ const b = w(
|
|
|
50
61
|
className: `${r}__trigger-flag`
|
|
51
62
|
}
|
|
52
63
|
),
|
|
53
|
-
/* @__PURE__ */ i("span", { className: t(`${r}__trigger-text`), children:
|
|
54
|
-
/* @__PURE__ */ i("span", { className: t(`${r}__trigger-icon`), children: /* @__PURE__ */ i(
|
|
64
|
+
/* @__PURE__ */ i("span", { className: t(`${r}__trigger-text`), children: m }),
|
|
65
|
+
/* @__PURE__ */ i("span", { className: t(`${r}__trigger-icon`), children: /* @__PURE__ */ i(y, { icon: "ChevronDown", color: "black-100", width: 16, height: 16 }) })
|
|
55
66
|
]
|
|
56
67
|
}
|
|
57
68
|
),
|
|
58
|
-
!a &&
|
|
69
|
+
!a && h()
|
|
59
70
|
] });
|
|
60
71
|
}
|
|
61
72
|
);
|
|
62
|
-
|
|
73
|
+
j.displayName = "CountryPickerTrigger";
|
|
63
74
|
export {
|
|
64
|
-
|
|
75
|
+
j as default
|
|
65
76
|
};
|
|
@@ -1,79 +1,80 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import b, { forwardRef as P } from "react";
|
|
3
3
|
import { getCommonProps as _, px as x, useNormalizedInputProps as I } from "../../utils/index.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import $ from "../../node_modules/classnames/index.js";
|
|
5
|
+
import S from "../CountryPicker/CountryPicker.js";
|
|
6
|
+
import T from "../../components/Input/Input.js";
|
|
7
7
|
import { getSafeCountryCallingCode as L } from "../CountryPicker/utils.js";
|
|
8
8
|
import { countries as j } from "../CountryPicker/constants.js";
|
|
9
9
|
const k = P(
|
|
10
10
|
({
|
|
11
|
-
className:
|
|
12
|
-
value:
|
|
13
|
-
countryCode:
|
|
11
|
+
className: l,
|
|
12
|
+
value: s = "",
|
|
13
|
+
countryCode: c = "",
|
|
14
14
|
handleValueChange: u,
|
|
15
|
-
label:
|
|
15
|
+
label: n = "Phone",
|
|
16
16
|
required: m = !1,
|
|
17
|
-
error:
|
|
17
|
+
error: a,
|
|
18
18
|
errorText: h,
|
|
19
|
-
disabled:
|
|
20
|
-
...
|
|
21
|
-
},
|
|
22
|
-
const { className: t, ...
|
|
23
|
-
u?.(
|
|
24
|
-
},
|
|
19
|
+
disabled: y = !1,
|
|
20
|
+
...f
|
|
21
|
+
}, g) => {
|
|
22
|
+
const { className: t, ...v } = _(f, "PhoneNumberInput"), [o, C] = b.useState(c || void 0), i = j.find((d) => d.code === o), N = (d) => {
|
|
23
|
+
u?.(d.target.value, o || "");
|
|
24
|
+
}, r = I({
|
|
25
25
|
id: "phone-input",
|
|
26
|
-
invalid:
|
|
26
|
+
invalid: a,
|
|
27
27
|
invalidText: h,
|
|
28
28
|
type: "text"
|
|
29
29
|
});
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */ e("input", { type: "hidden", name: "phoneNumber", value:
|
|
30
|
+
return /* @__PURE__ */ p("div", { ref: g, className: $(`${t}`, l), ...v, children: [
|
|
31
|
+
/* @__PURE__ */ p("div", { className: `${t}__wrapper`, children: [
|
|
32
|
+
/* @__PURE__ */ p("div", { className: `${t}__country-picker`, children: [
|
|
33
|
+
/* @__PURE__ */ e("input", { type: "hidden", name: "phoneNumber", value: s, "data-testid": "phone-number-hidden-input" }),
|
|
34
34
|
/* @__PURE__ */ e(
|
|
35
35
|
"input",
|
|
36
36
|
{
|
|
37
37
|
type: "hidden",
|
|
38
38
|
name: "phoneCountryCode",
|
|
39
|
-
value:
|
|
39
|
+
value: o || "",
|
|
40
40
|
"data-testid": "phone-country-code-hidden-input"
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
43
|
/* @__PURE__ */ e(
|
|
44
|
-
|
|
44
|
+
S,
|
|
45
45
|
{
|
|
46
|
-
triggerLabelText:
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
triggerLabelText: n,
|
|
47
|
+
triggerAriaLabel: `${n.replace("*", "")} country`,
|
|
48
|
+
triggerDisplayValue: i ? `+${L(i.code)}` : "",
|
|
49
|
+
hasTriggerError: !!a,
|
|
49
50
|
modalTitle: "Country code",
|
|
50
51
|
searchInputLabel: "Search country",
|
|
51
52
|
searchInputPlaceholder: "Search country",
|
|
52
53
|
selectButtonLabel: "Select",
|
|
53
54
|
isPhone: !0,
|
|
54
|
-
value:
|
|
55
|
-
onChange:
|
|
55
|
+
value: i?.code,
|
|
56
|
+
onChange: C
|
|
56
57
|
}
|
|
57
58
|
)
|
|
58
59
|
] }),
|
|
59
60
|
/* @__PURE__ */ e("div", { className: `${t}__input`, children: /* @__PURE__ */ e(
|
|
60
|
-
|
|
61
|
+
T,
|
|
61
62
|
{
|
|
62
63
|
id: "phone-input",
|
|
63
64
|
type: "tel",
|
|
64
|
-
labelText:
|
|
65
|
+
labelText: `${n.replace("*", "")} phone`,
|
|
65
66
|
hideLabel: !0,
|
|
66
|
-
value:
|
|
67
|
-
onChange:
|
|
67
|
+
value: s,
|
|
68
|
+
onChange: N,
|
|
68
69
|
required: m,
|
|
69
|
-
invalid: !!
|
|
70
|
-
disabled:
|
|
70
|
+
invalid: !!a,
|
|
71
|
+
disabled: y,
|
|
71
72
|
invalidText: "",
|
|
72
|
-
"aria-describedby":
|
|
73
|
+
"aria-describedby": r.invalidId
|
|
73
74
|
}
|
|
74
75
|
) })
|
|
75
76
|
] }),
|
|
76
|
-
|
|
77
|
+
r.validation ? r.validation : /* @__PURE__ */ e("p", { className: `${x}-input__validation`, children: " " })
|
|
77
78
|
] });
|
|
78
79
|
}
|
|
79
80
|
);
|
|
@@ -2,7 +2,7 @@ import { CallbackProps, ProgressWizardBaseProps } from './types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Props for the main ProgressWizard component.
|
|
4
4
|
*
|
|
5
|
-
* @property
|
|
5
|
+
* @property isFullHeight - Sets the wizard component to take up all available height of its container. Defaults true.
|
|
6
6
|
* @property hideNavigation - If true, hides the default footer navigation. When hidden you must manage step index changes yourself (e.g. via currentStepIndex prop)
|
|
7
7
|
* @property hideProgressIndicator - If true, hides the progress indicator bar.
|
|
8
8
|
* @property isEnableHistoryManagement - If true step advances push a history state so the browser back/forward buttons navigate between steps. Default is false and if you want this behavior you should use the useHistoryManagement hook directly in your controlling component.
|
|
@@ -5,13 +5,13 @@ import { useHistoryManagement as T } from "./hooks/useHistoryManagement.js";
|
|
|
5
5
|
import { getCommonProps as Y } from "../../utils/index.js";
|
|
6
6
|
import { ProgressWizardFooter as D } from "./components/ProgressWizardFooter.js";
|
|
7
7
|
import G from "../../components/ProgressIndicator/ProgressIndicator.js";
|
|
8
|
-
import { isControlled as
|
|
8
|
+
import { isControlled as p, getLabelsFromChildren as J, wrapChildren as K } from "./utils.js";
|
|
9
9
|
const O = B((g, f) => {
|
|
10
10
|
const {
|
|
11
|
-
|
|
11
|
+
isFullHeight: S = !0,
|
|
12
12
|
hideNavigation: a,
|
|
13
13
|
hideProgressIndicator: h,
|
|
14
|
-
isEnableHistoryManagement:
|
|
14
|
+
isEnableHistoryManagement: c = !1,
|
|
15
15
|
currentStepIndex: r,
|
|
16
16
|
defaultStepIndex: I,
|
|
17
17
|
shouldAllowContinue: x = !0,
|
|
@@ -23,40 +23,40 @@ const O = B((g, f) => {
|
|
|
23
23
|
onFormSubmit: y,
|
|
24
24
|
children: z,
|
|
25
25
|
...W
|
|
26
|
-
} = g, { className:
|
|
26
|
+
} = g, { className: t, ...N } = Y(W, "ProgressWizard");
|
|
27
27
|
let i = I;
|
|
28
28
|
i !== void 0 && r !== void 0 && (console.warn(
|
|
29
29
|
"ProgressWizard: Both defaultStepIndex and currentStepIndex props are provided. defaultStepIndex will be ignored."
|
|
30
30
|
), i = void 0);
|
|
31
|
-
const [
|
|
31
|
+
const [u, L] = q(i ?? 0), m = E(
|
|
32
32
|
(A) => {
|
|
33
|
-
!a && !
|
|
33
|
+
!a && !p(r) && L(A);
|
|
34
34
|
},
|
|
35
35
|
[a, r]
|
|
36
36
|
), e = d(
|
|
37
|
-
() => r ??
|
|
38
|
-
[r,
|
|
37
|
+
() => r ?? u,
|
|
38
|
+
[r, u]
|
|
39
39
|
);
|
|
40
|
-
|
|
40
|
+
c && p(r) && console.warn(
|
|
41
41
|
"ProgressWizard: History management is disabled in controlled mode (currentStepIndex prop). To enable history management, remove the currentStepIndex prop. You may also import and use the useHistoryManagement hook directly in your controlling component."
|
|
42
42
|
);
|
|
43
|
-
const
|
|
44
|
-
() => K(
|
|
45
|
-
[
|
|
46
|
-
), n =
|
|
47
|
-
(!
|
|
43
|
+
const o = R.toArray(z), $ = d(() => J(o), [o]), H = d(
|
|
44
|
+
() => K(o, e, t),
|
|
45
|
+
[o, e, t]
|
|
46
|
+
), n = o.length;
|
|
47
|
+
(!o || n === 0) && console.warn(
|
|
48
48
|
"ProgressWizard: No children provided. At least one child is required to render steps, two for normal behavior."
|
|
49
|
-
),
|
|
50
|
-
enabled: !
|
|
49
|
+
), o[e] || console.warn(`ProgressWizard: currentStepIndex ${e} is out of bounds (0 to ${n - 1})`), T({
|
|
50
|
+
enabled: !p(r) && c,
|
|
51
51
|
currentStepIndex: e,
|
|
52
52
|
stepCount: n,
|
|
53
|
-
setCurrentStepIndex:
|
|
53
|
+
setCurrentStepIndex: m
|
|
54
54
|
});
|
|
55
|
-
const F = e === 0,
|
|
56
|
-
setCurrentStepIndex:
|
|
55
|
+
const F = e === 0, _ = e === n - 1, M = H, k = {
|
|
56
|
+
setCurrentStepIndex: m,
|
|
57
57
|
isFirstStep: F,
|
|
58
|
-
isLastStep:
|
|
59
|
-
baseClassName:
|
|
58
|
+
isLastStep: _,
|
|
59
|
+
baseClassName: t,
|
|
60
60
|
shouldAllowContinue: x,
|
|
61
61
|
isLoading: [l.Loading, l.Submitting].includes(C),
|
|
62
62
|
labels: b,
|
|
@@ -65,12 +65,20 @@ const O = B((g, f) => {
|
|
|
65
65
|
onCancel: w,
|
|
66
66
|
onFormSubmit: y
|
|
67
67
|
};
|
|
68
|
-
return /* @__PURE__ */ j(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
return /* @__PURE__ */ j(
|
|
69
|
+
"section",
|
|
70
|
+
{
|
|
71
|
+
...N,
|
|
72
|
+
className: `${t}${S ? ` ${t}--full-height` : ""}`,
|
|
73
|
+
ref: f,
|
|
74
|
+
"aria-label": "Progress Wizard",
|
|
75
|
+
children: [
|
|
76
|
+
h ? null : /* @__PURE__ */ s(G, { totalSteps: n, currentStep: e + 1, stepLabels: $ }),
|
|
77
|
+
/* @__PURE__ */ s("div", { className: `${t}__content`, children: M }),
|
|
78
|
+
a ? null : /* @__PURE__ */ s("div", { className: `${t}__footer`, children: /* @__PURE__ */ s(D, { ...k }) })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
74
82
|
});
|
|
75
83
|
O.displayName = "ProgressWizard";
|
|
76
84
|
export {
|