@payfit/unity-components 2.46.29 → 2.46.30
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/esm/components/stepper/Stepper.context.js +22 -0
- package/dist/esm/components/stepper/Stepper.js +19 -0
- package/dist/esm/components/stepper/hooks/useStepper.js +26 -0
- package/dist/esm/components/stepper/parts/Step.js +56 -0
- package/dist/esm/index.d.ts +8 -5
- package/dist/esm/index.js +494 -488
- package/package.json +7 -7
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as n, useContext as p } from "react";
|
|
3
|
+
const t = n({
|
|
4
|
+
currentStep: 0
|
|
5
|
+
});
|
|
6
|
+
function s({
|
|
7
|
+
children: e,
|
|
8
|
+
currentStep: r
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ o(t.Provider, { value: { currentStep: r }, children: e });
|
|
11
|
+
}
|
|
12
|
+
function x() {
|
|
13
|
+
const e = p(t);
|
|
14
|
+
if (!e)
|
|
15
|
+
throw new Error("useStepperContext must be used within an StepperProvider");
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
t as StepperContext,
|
|
20
|
+
s as StepperProvider,
|
|
21
|
+
x as useStepperContext
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { StepperProvider as m } from "./Stepper.context.js";
|
|
4
|
+
const d = t(
|
|
5
|
+
({ children: e, currentStep: p, ...o }, a) => /* @__PURE__ */ r(m, { currentStep: p, children: /* @__PURE__ */ r(
|
|
6
|
+
"ol",
|
|
7
|
+
{
|
|
8
|
+
"data-dd-privacy": "allow",
|
|
9
|
+
ref: a,
|
|
10
|
+
className: "uy:flex uy:gap-200",
|
|
11
|
+
...o,
|
|
12
|
+
children: e
|
|
13
|
+
}
|
|
14
|
+
) })
|
|
15
|
+
);
|
|
16
|
+
d.displayName = "Stepper";
|
|
17
|
+
export {
|
|
18
|
+
d as Stepper
|
|
19
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState as n } from "react";
|
|
2
|
+
const v = ({
|
|
3
|
+
initialStep: e,
|
|
4
|
+
totalSteps: s
|
|
5
|
+
}) => {
|
|
6
|
+
const [t, c] = n(e), [u, p] = n(e <= 1), [x, S] = n(
|
|
7
|
+
e >= s
|
|
8
|
+
), f = () => {
|
|
9
|
+
t >= s || o("next");
|
|
10
|
+
}, g = () => {
|
|
11
|
+
t <= 1 || o("previous");
|
|
12
|
+
}, o = (i) => {
|
|
13
|
+
const r = i === "next" ? t + 1 : t - 1;
|
|
14
|
+
p(r <= 1), S(r >= s), c(r);
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
currentStep: t,
|
|
18
|
+
goNext: f,
|
|
19
|
+
goPrevious: g,
|
|
20
|
+
isLastStep: x,
|
|
21
|
+
isFirstStep: u
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
v as useStepper
|
|
26
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { Icon as d } from "@payfit/unity-icons";
|
|
4
|
+
import { uyTv as f } from "@payfit/unity-themes";
|
|
5
|
+
import { Text as x } from "../../text/Text.js";
|
|
6
|
+
import { useStepperContext as b } from "../Stepper.context.js";
|
|
7
|
+
const g = f({
|
|
8
|
+
slots: {
|
|
9
|
+
base: "uy:flex uy:flex-1 uy:flex-col uy:gap-75",
|
|
10
|
+
bar: "uy:h-50 uy:w-full uy:rounded-full uy:transition-all",
|
|
11
|
+
labelRow: "uy:flex uy:flex-row uy:items-center uy:gap-50",
|
|
12
|
+
text: "uy:typography-body-strong",
|
|
13
|
+
statusIcon: "uy:starting:scale-0 uy:scale-100 uy:transition-transform uy:duration-150"
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
stepStatus: {
|
|
17
|
+
current: { bar: "uy:bg-surface-primary" },
|
|
18
|
+
completed: { bar: "uy:bg-surface-primary" },
|
|
19
|
+
uncompleted: { bar: "uy:bg-surface-neutral-lowest" }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}), h = m(
|
|
23
|
+
({ label: o, stepNumber: e, ...u }, c) => {
|
|
24
|
+
const { currentStep: a } = b(), t = a === e ? "current" : a > e ? "completed" : "uncompleted", { base: l, bar: n, labelRow: i, text: y, statusIcon: p } = g({
|
|
25
|
+
stepStatus: t
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ s(
|
|
28
|
+
"li",
|
|
29
|
+
{
|
|
30
|
+
ref: c,
|
|
31
|
+
className: l(),
|
|
32
|
+
"aria-current": t === "current" ? "step" : void 0,
|
|
33
|
+
...u,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ r("div", { className: n(), "aria-hidden": "true" }),
|
|
36
|
+
/* @__PURE__ */ s("div", { className: i(), children: [
|
|
37
|
+
/* @__PURE__ */ r(x, { className: y(), children: `${e}. ${o}` }),
|
|
38
|
+
t === "completed" && /* @__PURE__ */ r(
|
|
39
|
+
d,
|
|
40
|
+
{
|
|
41
|
+
src: "CheckCircleOutlined",
|
|
42
|
+
color: "content.success",
|
|
43
|
+
size: 20,
|
|
44
|
+
className: p()
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
h.displayName = "Step";
|
|
54
|
+
export {
|
|
55
|
+
h as Step
|
|
56
|
+
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -33,6 +33,11 @@ export * from './components/breadcrumbs/Breadcrumbs.js';
|
|
|
33
33
|
export * from './components/breadcrumbs/parts/Breadcrumb.js';
|
|
34
34
|
export * from './components/breadcrumbs/parts/RawBreadcrumbLink.js';
|
|
35
35
|
export * from './components/button/Button.js';
|
|
36
|
+
export * from './components/carousel/Carousel.js';
|
|
37
|
+
export * from './components/carousel/parts/CarouselHeader.js';
|
|
38
|
+
export * from './components/carousel/parts/CarouselNav.js';
|
|
39
|
+
export * from './components/carousel/parts/CarouselContent.js';
|
|
40
|
+
export * from './components/carousel/parts/CarouselSlide.js';
|
|
36
41
|
export * from './components/card/Card.js';
|
|
37
42
|
export * from './components/card/parts/CardTitle.js';
|
|
38
43
|
export * from './components/card/parts/CardContent.js';
|
|
@@ -167,6 +172,9 @@ export * from './components/side-panel/parts/SidePanelFooter.js';
|
|
|
167
172
|
export * from './components/side-panel/parts/SidePanelHeader.js';
|
|
168
173
|
export * from './components/skip-links/SkipLinks.js';
|
|
169
174
|
export * from './components/spinner/Spinner.js';
|
|
175
|
+
export * from './components/stepper/Stepper.js';
|
|
176
|
+
export * from './components/stepper/parts/Step.js';
|
|
177
|
+
export * from './components/stepper/hooks/useStepper.js';
|
|
170
178
|
export * from './components/table/Table.js';
|
|
171
179
|
export * from './components/table/parts/TableBody.js';
|
|
172
180
|
export * from './components/table/parts/TableCell.js';
|
|
@@ -226,8 +234,3 @@ export { useFieldA11yContext } from './components/form-field/TanstackFormField.c
|
|
|
226
234
|
export { fieldRevalidateLogic } from './utils/field-revalidate-logic.js';
|
|
227
235
|
export type { FieldRevalidateLogicProps } from './utils/field-revalidate-logic.js';
|
|
228
236
|
export * from './providers/router/RouterProvider.js';
|
|
229
|
-
export * from './components/carousel/Carousel.js';
|
|
230
|
-
export * from './components/carousel/parts/CarouselHeader.js';
|
|
231
|
-
export * from './components/carousel/parts/CarouselNav.js';
|
|
232
|
-
export * from './components/carousel/parts/CarouselContent.js';
|
|
233
|
-
export * from './components/carousel/parts/CarouselSlide.js';
|