@stokr/components-library 3.0.72-beta.6 → 3.0.72

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.
@@ -4,7 +4,7 @@ import styled from "styled-components";
4
4
  import { colors } from "../../styles/colors.js";
5
5
  import { InfoIcon } from "../InfoIcon/InfoIcon.js";
6
6
  import { ArrowSimple } from "../icons/ArrowSimple.js";
7
- import { getCurrencyConfig, getCurrencyIcon } from "../../utils/formatCurrencyValue.js";
7
+ import { getCurrencyConfig, getCurrencyIcon, formatAmountForDisplay } from "../../utils/formatCurrencyValue.js";
8
8
  import externalLinkIcon from "../../static/images/external-link-icon.svg.js";
9
9
  const CardContainer = styled.div`
10
10
  background: ${colors.white};
@@ -48,11 +48,13 @@ const AmountSubtitle = styled.div`
48
48
  const AmountDisplay = styled.div`
49
49
  display: flex;
50
50
  align-items: center;
51
+ flex-wrap: wrap;
51
52
  gap: 16px;
52
53
  `;
53
54
  const AmountLeft = styled.div`
54
55
  display: flex;
55
56
  align-items: center;
57
+ flex-wrap: wrap;
56
58
  gap: 12px;
57
59
  flex: 1;
58
60
  min-width: 0;
@@ -94,7 +96,9 @@ const AmountValue = styled.div`
94
96
  text-transform: uppercase;
95
97
  line-height: 40px;
96
98
  letter-spacing: 1.5px;
97
- word-wrap: break-word;
99
+ max-width: 100%;
100
+ overflow-wrap: break-word;
101
+ word-break: break-word;
98
102
  color: ${colors.futureBlack};
99
103
  `;
100
104
  const Separator = styled.hr`
@@ -282,7 +286,7 @@ const AmountBlock = ({ config }) => {
282
286
  /* @__PURE__ */ jsxs(AmountDisplay, { children: [
283
287
  /* @__PURE__ */ jsxs(AmountLeft, { children: [
284
288
  renderCurrencyLogo(),
285
- /* @__PURE__ */ jsx(AmountValue, { children: displayValue !== null ? displayValue : "-" })
289
+ /* @__PURE__ */ jsx(AmountValue, { children: displayValue !== null ? formatAmountForDisplay(displayValue) : "-" })
286
290
  ] }),
287
291
  ticker && /* @__PURE__ */ jsx(CurrencyTicker, { children: ticker })
288
292
  ] }),
@@ -9,7 +9,7 @@ import { CopyToClipboardButton } from "../CryptoAddress/CryptoAddress.styles.js"
9
9
  import stdin_default from "../QRCode/QRCode.js";
10
10
  import { SectionTitle } from "../SectionTitle/SectionTitle.styles.js";
11
11
  import { StatusDot } from "../StatusDot/StatusDot.js";
12
- import { getCurrencyIcon } from "../../utils/formatCurrencyValue.js";
12
+ import { getCurrencyIcon, formatAmountForDisplay } from "../../utils/formatCurrencyValue.js";
13
13
  const CodeWrapper = styled.div.withConfig({
14
14
  shouldForwardProp: (props) => !["maxWidth"].includes(props)
15
15
  })`
@@ -35,12 +35,18 @@ const AmountBlock = styled.div`
35
35
  const AmountRow = styled.div`
36
36
  display: flex;
37
37
  align-items: center;
38
+ justify-content: center;
39
+ flex-wrap: wrap;
38
40
  gap: 10px;
41
+ width: 100%;
39
42
  `;
40
43
  const AmountValueGroup = styled.div`
41
44
  display: flex;
42
45
  align-items: center;
46
+ flex-wrap: wrap;
47
+ justify-content: center;
43
48
  gap: 8px;
49
+ min-width: 0;
44
50
  `;
45
51
  const AmountValue = styled.p`
46
52
  margin: 0;
@@ -50,7 +56,9 @@ const AmountValue = styled.p`
50
56
  line-height: 40px;
51
57
  letter-spacing: 1.5px;
52
58
  color: ${colors.black};
53
- word-wrap: break-word;
59
+ max-width: 100%;
60
+ overflow-wrap: break-word;
61
+ word-break: break-word;
54
62
  `;
55
63
  const AmountCurrency = styled.p`
56
64
  margin: 0;
@@ -169,7 +177,7 @@ const PaymentDisplay = ({
169
177
  /* @__PURE__ */ jsxs(AmountRow, { style: amountSectionStyle, children: [
170
178
  /* @__PURE__ */ jsxs(AmountValueGroup, { children: [
171
179
  /* @__PURE__ */ jsx(AmountIcon, { src: getCurrencyIcon(currency, customCurrencyIcon), style: amountIconStyle, alt: currency }),
172
- /* @__PURE__ */ jsx(AmountValue, { style: amountTextStyle, children: amount }),
180
+ /* @__PURE__ */ jsx(AmountValue, { style: amountTextStyle, children: formatAmountForDisplay(amount) }),
173
181
  /* @__PURE__ */ jsx(AmountCurrency, { style: amountTextStyle, children: currency })
174
182
  ] }),
175
183
  showCopyIcons && /* @__PURE__ */ jsx(
@@ -28,6 +28,7 @@ const TextBlock = styled.div`
28
28
  `;
29
29
  const Title = styled.h2`
30
30
  margin: 0;
31
+ font-family: 'Open Sans', sans-serif;
31
32
  font-size: 22px;
32
33
  font-weight: 800;
33
34
  line-height: 28px;
@@ -37,6 +38,7 @@ const Title = styled.h2`
37
38
  `;
38
39
  const Description = styled.p`
39
40
  margin: 0;
41
+ font-family: 'Open Sans', sans-serif;
40
42
  font-size: 16px;
41
43
  font-weight: 300;
42
44
  line-height: 24px;
@@ -45,6 +47,7 @@ const Description = styled.p`
45
47
  `;
46
48
  const FooterNote = styled.p`
47
49
  margin: 0;
50
+ font-family: 'Open Sans', sans-serif;
48
51
  font-size: 12px;
49
52
  font-weight: 400;
50
53
  line-height: 18px;
@@ -7,7 +7,7 @@ import { Button } from "../Button/Button.styles.js";
7
7
  import { CodeWrapper, AmountIcon, AmountValue, AmountCurrency } from "./PaymentDisplay.js";
8
8
  import { DetailsToggle } from "./DetailsToggle.js";
9
9
  import { LottieAnimation } from "../Lottie/LottieAnimation.js";
10
- import { getCurrencyIcon } from "../../utils/formatCurrencyValue.js";
10
+ import { getCurrencyIcon, formatAmountForDisplay } from "../../utils/formatCurrencyValue.js";
11
11
  import externalLinkIcon from "../../static/images/external-link-icon.svg.js";
12
12
  const IconCircle = styled.div`
13
13
  flex-shrink: 0;
@@ -29,6 +29,7 @@ const TextBlock = styled.div`
29
29
  `;
30
30
  const Title = styled.h2`
31
31
  margin: 0;
32
+ font-family: 'Open Sans';
32
33
  font-size: 22px;
33
34
  font-weight: 800;
34
35
  line-height: 28px;
@@ -47,7 +48,10 @@ const Description = styled.p`
47
48
  const AmountRow = styled.div`
48
49
  display: flex;
49
50
  align-items: center;
51
+ justify-content: center;
52
+ flex-wrap: wrap;
50
53
  gap: 8px;
54
+ max-width: 100%;
51
55
  `;
52
56
  const ActionsRow = styled.div`
53
57
  display: flex;
@@ -102,7 +106,7 @@ const PaymentSuccessCard = ({
102
106
  ] }),
103
107
  hasAmount && /* @__PURE__ */ jsxs(AmountRow, { children: [
104
108
  currency && /* @__PURE__ */ jsx(AmountIcon, { src: getCurrencyIcon(currency, customCurrencyIcon), alt: currency }),
105
- /* @__PURE__ */ jsx(AmountValue, { children: amount }),
109
+ /* @__PURE__ */ jsx(AmountValue, { children: formatAmountForDisplay(amount) }),
106
110
  currency && /* @__PURE__ */ jsx(AmountCurrency, { children: currency })
107
111
  ] }),
108
112
  rows.length > 0 && /* @__PURE__ */ jsx(DetailsToggle, { rows, defaultOpen: detailsDefaultOpen, showLabel: showDetailsLabel, hideLabel: hideDetailsLabel }),
package/dist/index.js CHANGED
@@ -131,7 +131,7 @@ import { generateCoreChecklistTasks, getVerifyIdentityChecklist } from "./utils/
131
131
  import { CopyToClipBoardTooltip, copyTextToClipboard, useCopyToClipboard, withCopyToClipboard } from "./utils/copyToClipboard.js";
132
132
  import { cooldownHOC, useComponentVisible, useContainerSize, useCooldown, useMobileView, usePrevious } from "./utils/customHooks.js";
133
133
  import { fixDecimals, formatDisplayNumber } from "./utils/fix-decimals.js";
134
- import { CURRENCY_CONFIG, formatCurrencyValue, getCurrencyConfig, getCurrencyIcon, getCurrencySymbol, getLiquidAssetIcon, getProjectCurrencySign } from "./utils/formatCurrencyValue.js";
134
+ import { CURRENCY_CONFIG, formatAmountForDisplay, formatCurrencyValue, getCurrencyConfig, getCurrencyIcon, getCurrencySymbol, getLiquidAssetIcon, getProjectCurrencySign } from "./utils/formatCurrencyValue.js";
135
135
  import { isUSInvestor, usCountries } from "./utils/isUSInvestor.js";
136
136
  import { ENTROPY_MEDIUM, ENTROPY_WEAK, PASSWORD_MIN_LENGTH, PASSWORD_REQUIREMENTS_MESSAGE, getPasswordCriteria, getPasswordEntropy, isPasswordValid } from "./utils/password-validation.js";
137
137
  import { km_ify } from "./utils/km_ify.js";
@@ -614,6 +614,7 @@ export {
614
614
  flatten,
615
615
  default2 as fontFaces,
616
616
  format,
617
+ formatAmountForDisplay,
617
618
  formatCurrencyValue,
618
619
  formatDisplayNumber,
619
620
  generateCoreChecklistTasks,
@@ -1,3 +1,4 @@
1
- <svg width="8" height="10" version="1.1" viewBox="0 0 8 10" xmlns="http://www.w3.org/2000/svg">
2
- <path transform="translate(0)" d="M3.45,5.385h3.1L6.375,6.538H3.45v.313a1.451,1.451,0,0,0,.412,1.166,2.523,2.523,0,0,0,1.563.349A15.75,15.75,0,0,0,7.75,8.149L8,9.712A11.974,11.974,0,0,1,5.35,10q-4.1,0-4.1-2.812V6.538H0V5.385H1.25V4.231H0V3.077H1.25V2.813Q1.25,0,5.35,0A11.974,11.974,0,0,1,8,.288L7.75,1.851a15.75,15.75,0,0,0-2.325-.216,2.53,2.53,0,0,0-1.55.349A1.273,1.273,0,0,0,3.45,3.029v.048H6.9L6.725,4.231H3.45Z"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
2
+ <circle cx="16" cy="16" r="16" fill="#202020"/>
3
+ <text x="16" y="21.5" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="16" font-weight="700" fill="#ffffff">&#8364;</text>
3
4
  </svg>
@@ -0,0 +1,4 @@
1
+ const EURLogo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzIwMjAyMCIvPgogIDx0ZXh0IHg9IjE2IiB5PSIyMS41IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9IjcwMCIgZmlsbD0iI2ZmZmZmZiI+JiM4MzY0OzwvdGV4dD4KPC9zdmc+Cg==";
2
+ export {
3
+ EURLogo as default
4
+ };
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
2
+ <circle cx="16" cy="16" r="16" fill="#202020"/>
3
+ <text x="16" y="22" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="17" font-weight="700" fill="#ffffff">$</text>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ const USDLogo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzIwMjAyMCIvPgogIDx0ZXh0IHg9IjE2IiB5PSIyMiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTciIGZvbnQtd2VpZ2h0PSI3MDAiIGZpbGw9IiNmZmZmZmYiPiQ8L3RleHQ+Cjwvc3ZnPgo=";
2
+ export {
3
+ USDLogo as default
4
+ };
@@ -4,6 +4,9 @@ import BitcoinLogo from "../static/images/currency/bitcoin-logo.png.js";
4
4
  import BMN2Logo from "../static/images/currency/bmn2-logo.png.js";
5
5
  import ETHLogo from "../static/images/currency/eth_logo.svg.js";
6
6
  import USDTLogo from "../static/images/currency/usdt-logo.png.js";
7
+ import USDLogo from "../static/images/currency/usd.svg.js";
8
+ import EURLogo from "../static/images/currency/eur.svg.js";
9
+ import { formatDisplayNumber } from "./fix-decimals.js";
7
10
  const CURRENCY_CONFIG = {
8
11
  tether: ["USDT", 2],
9
12
  gemini: ["GUSD", 2],
@@ -46,6 +49,14 @@ const formatCurrencyValue = (currency, value, tokenDecimals = 2, options = {}) =
46
49
  const formattedValue = parseFloat(Math.abs(value)).toFixed(decimals);
47
50
  return valueFirst ? `${formattedValue} ${symbol}` : `${symbol} ${formattedValue}`;
48
51
  };
52
+ const formatAmountForDisplay = (amount) => {
53
+ if (amount === void 0 || amount === null || amount === "") return amount;
54
+ const plain = String(amount).replace(/,/g, "");
55
+ const decimalPart = plain.split(".")[1];
56
+ const digits = decimalPart ? decimalPart.length : 0;
57
+ const formatted = formatDisplayNumber(plain, { minimumFractionDigits: digits, maximumFractionDigits: digits });
58
+ return formatted || amount;
59
+ };
49
60
  const getCurrencySymbol = (currencySelected) => {
50
61
  const config = CURRENCY_CONFIG[currencySelected];
51
62
  if (config) {
@@ -79,6 +90,12 @@ const getCurrencyIcon = (currency, customIcon) => {
79
90
  case "eth":
80
91
  case "eth-fb":
81
92
  return ETHLogo;
93
+ case "usd":
94
+ case "usd-in-kind":
95
+ return USDLogo;
96
+ case "euro":
97
+ case "eur":
98
+ return EURLogo;
82
99
  default:
83
100
  return null;
84
101
  }
@@ -94,6 +111,7 @@ const getLiquidAssetIcon = async (assetId) => {
94
111
  };
95
112
  export {
96
113
  CURRENCY_CONFIG,
114
+ formatAmountForDisplay,
97
115
  formatCurrencyValue,
98
116
  getCurrencyConfig,
99
117
  getCurrencyIcon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.0.72-beta.6",
3
+ "version": "3.0.72",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",