@stokr/components-library 3.0.72-beta.3 → 3.0.72-beta.5
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/Lottie/LottieAnimation.js +1 -3
- package/dist/components/Payment/DetailRows.js +3 -1
- package/dist/components/Payment/DetailsToggle.js +12 -2
- package/dist/components/Payment/PaymentDetailsCard.js +17 -5
- package/dist/components/Payment/PaymentDisplay.js +4 -0
- package/dist/components/Payment/PaymentPendingCard.js +14 -20
- package/package.json +1 -2
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useCallback, useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { DotLottieReact
|
|
4
|
+
import { DotLottieReact } from "@lottiefiles/dotlottie-react";
|
|
5
5
|
import { AnimationWrapper } from "./LottieAnimation.styles.js";
|
|
6
6
|
import progressAnimation from "../../static/animations/progress.lottie.js";
|
|
7
7
|
import uploadAnimation from "../../static/animations/upload.lottie.js";
|
|
8
8
|
import successAnimation from "../../static/animations/checked.lottie.js";
|
|
9
|
-
import dotLottiePlayerWasm from "@lottiefiles/dotlottie-web/dotlottie-player.wasm?url";
|
|
10
|
-
setWasmUrl(dotLottiePlayerWasm);
|
|
11
9
|
const LOTTIE_ANIMATIONS = {
|
|
12
10
|
progress: { src: progressAnimation, segment: null, loop: false },
|
|
13
11
|
upload: { src: uploadAnimation, segment: null, loop: false },
|
|
@@ -28,7 +28,9 @@ const DetailRows = ({ rows = [] }) => {
|
|
|
28
28
|
target: row.target,
|
|
29
29
|
tooltip: row.tooltip,
|
|
30
30
|
placeholder: row.placeholder,
|
|
31
|
-
isCustom: row.isCustom
|
|
31
|
+
isCustom: row.isCustom,
|
|
32
|
+
labelIcon: row.labelIcon,
|
|
33
|
+
valueIcon: row.valueIcon
|
|
32
34
|
}
|
|
33
35
|
),
|
|
34
36
|
index < rows.length - 1 && /* @__PURE__ */ jsx(RowDivider, {})
|
|
@@ -27,6 +27,16 @@ const Chevron = styled.svg`
|
|
|
27
27
|
transform: ${(props) => props.$expanded ? "rotate(180deg)" : "none"};
|
|
28
28
|
transition: transform 0.2s;
|
|
29
29
|
`;
|
|
30
|
+
const AnimatedRows = styled.div.withConfig({
|
|
31
|
+
shouldForwardProp: (prop) => !["$open"].includes(prop)
|
|
32
|
+
})`
|
|
33
|
+
width: 100%;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
36
|
+
opacity: ${(props) => props.$open ? 1 : 0};
|
|
37
|
+
transform: ${(props) => props.$open ? "translateY(0)" : "translateY(-10px)"};
|
|
38
|
+
max-height: ${(props) => props.$open ? "1000px" : "0"};
|
|
39
|
+
`;
|
|
30
40
|
const DetailsToggle = ({
|
|
31
41
|
rows = [],
|
|
32
42
|
defaultOpen = false,
|
|
@@ -44,6 +54,7 @@ const DetailsToggle = ({
|
|
|
44
54
|
if (!isControlled) setUncontrolledOpen(next);
|
|
45
55
|
};
|
|
46
56
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx(AnimatedRows, { $open: open, "aria-hidden": !open, children: /* @__PURE__ */ jsx(DetailRows, { rows }) }),
|
|
47
58
|
/* @__PURE__ */ jsxs(ToggleButton, { type: "button", onClick: handleClick, "aria-expanded": open, children: [
|
|
48
59
|
open ? hideLabel : showLabel,
|
|
49
60
|
/* @__PURE__ */ jsx(
|
|
@@ -59,8 +70,7 @@ const DetailsToggle = ({
|
|
|
59
70
|
children: /* @__PURE__ */ jsx("path", { d: "M1 2L7 8L13 2", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
60
71
|
}
|
|
61
72
|
)
|
|
62
|
-
] })
|
|
63
|
-
open && /* @__PURE__ */ jsx(DetailRows, { rows })
|
|
73
|
+
] })
|
|
64
74
|
] });
|
|
65
75
|
};
|
|
66
76
|
export {
|
|
@@ -168,6 +168,10 @@ const DetailLabel = styled.div`
|
|
|
168
168
|
}
|
|
169
169
|
`;
|
|
170
170
|
const DetailValue = styled.div`
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: flex-end;
|
|
174
|
+
gap: 6px;
|
|
171
175
|
font-size: 14px;
|
|
172
176
|
font-weight: 600;
|
|
173
177
|
line-height: 20px;
|
|
@@ -214,7 +218,7 @@ const ExternalLinkIconImg = styled.img`
|
|
|
214
218
|
height: 12px;
|
|
215
219
|
flex-shrink: 0;
|
|
216
220
|
`;
|
|
217
|
-
const DetailItem = ({ label, value, tooltip, placeholder, isCustom, href, target }) => {
|
|
221
|
+
const DetailItem = ({ label, value, tooltip, placeholder, isCustom, href, target, labelIcon, valueIcon }) => {
|
|
218
222
|
const renderValue = () => {
|
|
219
223
|
if (isCustom && value) {
|
|
220
224
|
return value;
|
|
@@ -236,9 +240,13 @@ const DetailItem = ({ label, value, tooltip, placeholder, isCustom, href, target
|
|
|
236
240
|
return /* @__PURE__ */ jsxs(DetailRow, { children: [
|
|
237
241
|
/* @__PURE__ */ jsxs(DetailLabel, { children: [
|
|
238
242
|
label,
|
|
239
|
-
tooltip && /* @__PURE__ */ jsx(InfoIcon, { containerStyle: { width: 14, height: 14 }, title: tooltip, noMargin: true })
|
|
243
|
+
tooltip && /* @__PURE__ */ jsx(InfoIcon, { containerStyle: { width: 14, height: 14 }, title: tooltip, noMargin: true }),
|
|
244
|
+
labelIcon
|
|
240
245
|
] }),
|
|
241
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ jsxs(DetailValue, { children: [
|
|
247
|
+
valueIcon,
|
|
248
|
+
renderValue()
|
|
249
|
+
] })
|
|
242
250
|
] });
|
|
243
251
|
};
|
|
244
252
|
const AmountBlock = ({ config }) => {
|
|
@@ -295,7 +303,9 @@ const DetailGroup = ({ group, isLast }) => {
|
|
|
295
303
|
placeholder: detail.placeholder,
|
|
296
304
|
isCustom: detail.isCustom,
|
|
297
305
|
href: detail.href,
|
|
298
|
-
target: detail.target
|
|
306
|
+
target: detail.target,
|
|
307
|
+
labelIcon: detail.labelIcon,
|
|
308
|
+
valueIcon: detail.valueIcon
|
|
299
309
|
},
|
|
300
310
|
detail.key || index
|
|
301
311
|
))
|
|
@@ -342,7 +352,9 @@ const PaymentDetailsCard = ({
|
|
|
342
352
|
placeholder: detail.placeholder,
|
|
343
353
|
isCustom: detail.isCustom,
|
|
344
354
|
href: detail.href,
|
|
345
|
-
target: detail.target
|
|
355
|
+
target: detail.target,
|
|
356
|
+
labelIcon: detail.labelIcon,
|
|
357
|
+
valueIcon: detail.valueIcon
|
|
346
358
|
},
|
|
347
359
|
detail.key || index
|
|
348
360
|
)) });
|
|
@@ -155,11 +155,15 @@ const PaymentDisplay = ({
|
|
|
155
155
|
onAmountCopy,
|
|
156
156
|
onAddressCopy,
|
|
157
157
|
copyButtonStyle,
|
|
158
|
+
// Optional chip rendered at the top of the card (e.g. an expiry countdown
|
|
159
|
+
// pill) — a plain slot, the card has no opinion on what it contains.
|
|
160
|
+
chip,
|
|
158
161
|
// Arbitrary extra content (e.g. a "show details" toggle + table, extra
|
|
159
162
|
// buttons) — rendered last, inside the card.
|
|
160
163
|
children
|
|
161
164
|
}) => {
|
|
162
165
|
return /* @__PURE__ */ jsx(ComponentWrapper, { noPadding: true, center: true, style: containerStyle, className, children: /* @__PURE__ */ jsxs(CodeWrapper, { style: codeWrapperStyle, maxWidth, className: codeWrapperClassName, children: [
|
|
166
|
+
chip,
|
|
163
167
|
/* @__PURE__ */ jsxs(AmountBlock, { children: [
|
|
164
168
|
/* @__PURE__ */ jsx(SectionTitle, { children: amountTitle }),
|
|
165
169
|
/* @__PURE__ */ jsxs(AmountRow, { style: amountSectionStyle, children: [
|
|
@@ -6,7 +6,6 @@ import { colors } from "../../styles/colors.js";
|
|
|
6
6
|
import { Button } from "../Button/Button.styles.js";
|
|
7
7
|
import { DetailRows } from "./DetailRows.js";
|
|
8
8
|
import { CodeWrapper } from "./PaymentDisplay.js";
|
|
9
|
-
import externalLinkIcon from "../../static/images/external-link-icon.svg.js";
|
|
10
9
|
const spin = keyframes`
|
|
11
10
|
to { transform: rotate(360deg); }
|
|
12
11
|
`;
|
|
@@ -44,12 +43,6 @@ const Description = styled.p`
|
|
|
44
43
|
letter-spacing: 0.6px;
|
|
45
44
|
color: ${colors.black};
|
|
46
45
|
`;
|
|
47
|
-
const ButtonIcon = styled.img`
|
|
48
|
-
width: 12px;
|
|
49
|
-
height: 12px;
|
|
50
|
-
margin-left: 8px;
|
|
51
|
-
vertical-align: -1px;
|
|
52
|
-
`;
|
|
53
46
|
const FooterNote = styled.p`
|
|
54
47
|
margin: 0;
|
|
55
48
|
font-size: 12px;
|
|
@@ -63,10 +56,13 @@ const PaymentPendingCard = ({
|
|
|
63
56
|
title,
|
|
64
57
|
description,
|
|
65
58
|
rows = [],
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
actionLabel,
|
|
60
|
+
actionHref,
|
|
61
|
+
onActionClick,
|
|
69
62
|
footerNote,
|
|
63
|
+
// Optional chip rendered at the top of the card (e.g. an expiry countdown
|
|
64
|
+
// pill) — a plain slot, the card has no opinion on what it contains.
|
|
65
|
+
chip,
|
|
70
66
|
maxWidth,
|
|
71
67
|
containerStyle,
|
|
72
68
|
codeWrapperStyle,
|
|
@@ -75,26 +71,24 @@ const PaymentPendingCard = ({
|
|
|
75
71
|
children
|
|
76
72
|
}) => {
|
|
77
73
|
return /* @__PURE__ */ jsx(ComponentWrapper, { noPadding: true, center: true, style: containerStyle, className, children: /* @__PURE__ */ jsxs(CodeWrapper, { style: { gap: "40px", ...codeWrapperStyle }, maxWidth, className: codeWrapperClassName, children: [
|
|
74
|
+
chip,
|
|
78
75
|
/* @__PURE__ */ jsx(Spinner, {}),
|
|
79
76
|
(title || description) && /* @__PURE__ */ jsxs(TextBlock, { children: [
|
|
80
77
|
title && /* @__PURE__ */ jsx(Title, { children: title }),
|
|
81
78
|
description && /* @__PURE__ */ jsx(Description, { children: description })
|
|
82
79
|
] }),
|
|
83
80
|
/* @__PURE__ */ jsx(DetailRows, { rows }),
|
|
84
|
-
(
|
|
81
|
+
(actionHref || onActionClick) && actionLabel && /* @__PURE__ */ jsx(
|
|
85
82
|
Button,
|
|
86
83
|
{
|
|
87
|
-
as:
|
|
88
|
-
href:
|
|
89
|
-
target:
|
|
90
|
-
rel:
|
|
91
|
-
onClick:
|
|
84
|
+
as: actionHref ? "a" : "button",
|
|
85
|
+
href: actionHref,
|
|
86
|
+
target: actionHref ? "_blank" : void 0,
|
|
87
|
+
rel: actionHref ? "noopener noreferrer" : void 0,
|
|
88
|
+
onClick: onActionClick,
|
|
92
89
|
outlineBlack: true,
|
|
93
90
|
fluid: true,
|
|
94
|
-
children:
|
|
95
|
-
explorerLabel,
|
|
96
|
-
/* @__PURE__ */ jsx(ButtonIcon, { src: externalLinkIcon, alt: "" })
|
|
97
|
-
]
|
|
91
|
+
children: actionLabel
|
|
98
92
|
}
|
|
99
93
|
),
|
|
100
94
|
footerNote && /* @__PURE__ */ jsx(FooterNote, { children: footerNote }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stokr/components-library",
|
|
3
|
-
"version": "3.0.72-beta.
|
|
3
|
+
"version": "3.0.72-beta.5",
|
|
4
4
|
"description": "STOKR - Components Library",
|
|
5
5
|
"author": "Bilal Hodzic <bilal@stokr.io>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@lottiefiles/dotlottie-react": "^0.19.4",
|
|
58
|
-
"@lottiefiles/dotlottie-web": "^0.74.0",
|
|
59
58
|
"axios": "^1.13.5",
|
|
60
59
|
"country-flag-icons": "^1.6.17",
|
|
61
60
|
"date-fns": "^4.1.0",
|