@stokr/components-library 3.2.0 → 4.0.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.
Files changed (244) hide show
  1. package/dist/components/AdminDashboard/Table/Table.styles.js +7 -13
  2. package/dist/components/BasicTable/BasicTable.js +1 -3
  3. package/dist/components/BlogPost/BlogPost.styles.js +2 -2
  4. package/dist/components/Button/Button.styles.d.ts +28 -0
  5. package/dist/components/Button/Button.styles.js +27 -38
  6. package/dist/components/Button/GlareButton.js +2 -2
  7. package/dist/components/CardTabs/CardTabs.d.ts +41 -0
  8. package/dist/components/CardTabs/CardTabs.js +130 -0
  9. package/dist/components/CardTabs/CardTabs.styles.d.ts +56 -0
  10. package/dist/components/CardTabs/CardTabs.styles.js +171 -0
  11. package/dist/components/Chips/Chip.js +32 -8
  12. package/dist/components/Chips/Chip.styles.js +24 -28
  13. package/dist/components/Collapsible/Collapsible.d.ts +18 -0
  14. package/dist/components/Collapsible/Collapsible.js +44 -0
  15. package/dist/components/Collapsible/Collapsible.styles.d.ts +18 -0
  16. package/dist/components/Collapsible/Collapsible.styles.js +94 -0
  17. package/dist/components/ComponentWrapper/ComponentWrapper.styles.d.ts +31 -0
  18. package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +107 -109
  19. package/dist/components/Copy/Copy.d.ts +20 -0
  20. package/dist/components/Copy/Copy.js +0 -9
  21. package/dist/components/Copy/copySource.d.ts +20 -0
  22. package/dist/components/Copy/flatten.d.ts +3 -0
  23. package/dist/components/CopyToClipboardTooltip/CopyToClipboardTooltip.d.ts +15 -0
  24. package/dist/components/CopyToClipboardTooltip/CopyToClipboardTooltip.styles.d.ts +6 -0
  25. package/dist/components/CryptoAddress/CryptoAddress.js +3 -3
  26. package/dist/components/InfoIcon/InfoIcon.d.ts +33 -0
  27. package/dist/components/InfoIcon/InfoIcon.styles.d.ts +12 -0
  28. package/dist/components/Input/Input.d.ts +23 -0
  29. package/dist/components/Input/Input.js +17 -27
  30. package/dist/components/Input/Input.styles.d.ts +15 -0
  31. package/dist/components/Input/InputPassword.js +1 -0
  32. package/dist/components/Input/InputPassword.styles.js +4 -1
  33. package/dist/components/Input/MultiSelect.js +1 -0
  34. package/dist/components/Input/RangeInput.js +49 -53
  35. package/dist/components/Input/Textarea.styles.js +1 -1
  36. package/dist/components/MaterialIcon/MaterialIcon.d.ts +43 -0
  37. package/dist/components/MaterialIcon/MaterialIcon.js +56 -0
  38. package/dist/components/MaterialIcon/MaterialIcon.styles.d.ts +9 -0
  39. package/dist/components/MaterialIcon/MaterialIcon.styles.js +25 -0
  40. package/dist/components/MaterialIcon/iconConfig.d.ts +3 -0
  41. package/dist/components/MaterialIcon/iconConfig.js +11 -0
  42. package/dist/components/Modal/Modal.d.ts +26 -0
  43. package/dist/components/Modal/Modal.js +1 -18
  44. package/dist/components/Modal/Modal.styles.d.ts +59 -0
  45. package/dist/components/Modal/Modal.styles.js +18 -3
  46. package/dist/components/Modal/PaymentModal.js +16 -19
  47. package/dist/components/Modal/SideModal.d.ts +47 -0
  48. package/dist/components/Modal/SideModal.js +197 -73
  49. package/dist/components/Modal/SideModal.styles.d.ts +28 -0
  50. package/dist/components/Modal/SideModal.styles.js +56 -16
  51. package/dist/components/Modal/SideModalContext.d.ts +12 -0
  52. package/dist/components/Modal/SideModalContext.js +10 -0
  53. package/dist/components/Modal/SideModalParts.d.ts +20 -0
  54. package/dist/components/Modal/SideModalParts.js +95 -0
  55. package/dist/components/Pagination/Pagination.js +2 -2
  56. package/dist/components/Pagination/PaginationControls.js +2 -2
  57. package/dist/components/Payment/TimerComponent.js +1 -2
  58. package/dist/components/RefreshButton/RefreshButton.styles.js +2 -2
  59. package/dist/components/RequestDataBox/RequestDataBox.js +2 -2
  60. package/dist/components/Section/Section.d.ts +32 -0
  61. package/dist/components/Section/Section.js +80 -0
  62. package/dist/components/Section/Section.styles.d.ts +34 -0
  63. package/dist/components/Section/Section.styles.js +143 -0
  64. package/dist/components/Skeleton/Skeleton.d.ts +44 -0
  65. package/dist/components/Skeleton/Skeleton.js +48 -0
  66. package/dist/components/Skeleton/Skeleton.styles.d.ts +14 -0
  67. package/dist/components/Skeleton/Skeleton.styles.js +51 -0
  68. package/dist/components/StokrLoader/StokrLoader.d.ts +20 -0
  69. package/dist/components/StokrLoader/StokrLoader.js +21 -22
  70. package/dist/components/Tabs/Tabs.styles.js +3 -1
  71. package/dist/components/TabsNav/TabsNav.js +1 -1
  72. package/dist/components/TabsNav/TabsNav.styles.js +1 -1
  73. package/dist/components/Text/Text.styles.d.ts +20 -0
  74. package/dist/components/Text/Text.styles.js +2 -2
  75. package/dist/components/TextLink/TextLink.styles.js +1 -2
  76. package/dist/components/Tooltip/Tooltip.d.ts +42 -0
  77. package/dist/components/Tooltip/Tooltip.styles.d.ts +10 -0
  78. package/dist/constants/globalVariables.js +1 -39
  79. package/dist/hooks/useMediaQuery.d.ts +7 -0
  80. package/dist/hooks/useMediaQuery.js +19 -0
  81. package/dist/index.d.ts +299 -0
  82. package/dist/index.js +97 -224
  83. package/dist/styles/colors.d.ts +68 -0
  84. package/dist/styles/colors.js +13 -1
  85. package/dist/styles/elevation.d.ts +13 -0
  86. package/dist/styles/elevation.js +15 -0
  87. package/dist/styles/fonts.js +0 -65
  88. package/dist/styles/global.js +0 -2
  89. package/dist/styles/grid.d.ts +27 -0
  90. package/dist/styles/grid.js +8 -1
  91. package/dist/styles/rwd.d.ts +48 -0
  92. package/dist/styles/rwd.js +33 -17
  93. package/dist/styles/spacing.d.ts +36 -0
  94. package/dist/styles/spacing.js +30 -0
  95. package/dist/styles/theme.d.ts +92 -0
  96. package/dist/styles/theme.js +2 -0
  97. package/dist/styles/typography.d.ts +42 -0
  98. package/dist/styles/typography.js +56 -0
  99. package/dist/utils/capitalize.d.ts +2 -0
  100. package/dist/utils/capitalize.js +4 -0
  101. package/dist/utils/copy-text-to-clipboard.d.ts +10 -0
  102. package/dist/utils/copyToClipboard.d.ts +27 -0
  103. package/dist/utils/csv.d.ts +14 -0
  104. package/dist/utils/csv.js +25 -0
  105. package/dist/utils/customHooks.d.ts +20 -0
  106. package/dist/utils/customHooks.js +16 -11
  107. package/dist/utils/fix-decimals.d.ts +14 -0
  108. package/dist/utils/formatAmount.d.ts +109 -0
  109. package/dist/utils/formatAmount.js +170 -0
  110. package/dist/utils/formatCurrencyValue.d.ts +46 -0
  111. package/dist/utils/formatCurrencyValue.js +6 -21
  112. package/dist/utils/formatDate.d.ts +19 -0
  113. package/dist/utils/formatDate.js +44 -0
  114. package/dist/utils/get-short-address.d.ts +13 -0
  115. package/dist/utils/get-short-address.js +9 -2
  116. package/dist/utils/inertProp.d.ts +5 -0
  117. package/dist/utils/inertProp.js +6 -0
  118. package/dist/utils/isUSInvestor.d.ts +4 -0
  119. package/dist/utils/km_ify.d.ts +5 -0
  120. package/dist/utils/km_ify.js +19 -18
  121. package/dist/utils/password-validation.d.ts +16 -0
  122. package/dist/utils/saveAs.d.ts +2 -0
  123. package/dist/utils/saveAs.js +5 -2
  124. package/dist/utils/scrollUtils.d.ts +25 -0
  125. package/dist/utils/scrollUtils.js +13 -10
  126. package/dist/utils/transition.d.ts +45 -0
  127. package/dist/utils/transition.js +0 -28
  128. package/package.json +11 -13
  129. package/dist/analytics/index.js +0 -185
  130. package/dist/components/AccountBalance/AccountBalance.js +0 -35
  131. package/dist/components/AccountBalance/AccountBalance.styles.js +0 -48
  132. package/dist/components/AdminDashboard/Table/Table.js +0 -123
  133. package/dist/components/ButtonContainer/ButtonContainer.styles.js +0 -51
  134. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.js +0 -34
  135. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.styles.js +0 -125
  136. package/dist/components/DoubleButton/DoubleButton.styles.js +0 -27
  137. package/dist/components/ErrorMessage/ErrorMessage.styles.js +0 -9
  138. package/dist/components/Icon/Icon2.js +0 -12
  139. package/dist/components/Input/InputUsername.js +0 -92
  140. package/dist/components/Input/RangeInput.styles.js +0 -129
  141. package/dist/components/InvestmentStat/InvestmentStat.js +0 -24
  142. package/dist/components/InvestmentStat/InvestmentStat.styles.js +0 -62
  143. package/dist/components/LatestUpdate/LatestUpdate.js +0 -24
  144. package/dist/components/LatestUpdate/LatestUpdate.styles.js +0 -90
  145. package/dist/components/MultiProgressBar/MultiProgressBar.js +0 -28
  146. package/dist/components/MultiProgressBar/MultiProgressBar.styles.js +0 -105
  147. package/dist/components/PageTransition/PageTransition.js +0 -51
  148. package/dist/components/ProfileStat/ProfileStat.js +0 -29
  149. package/dist/components/ProfileStat/ProfileStat.styles.js +0 -90
  150. package/dist/components/SEO/SEO.js +0 -66
  151. package/dist/components/SideLine/SideLine.js +0 -7
  152. package/dist/components/SideLine/SideLine.styles.js +0 -33
  153. package/dist/components/Slider/Slider.js +0 -31
  154. package/dist/components/Slider/Slider.styles.js +0 -120
  155. package/dist/components/StatusBadge/StatusBadge.styles.js +0 -18
  156. package/dist/components/StokrLoader/media.js +0 -23
  157. package/dist/components/SvgIcons/CameraSvg.js +0 -31
  158. package/dist/components/SvgIcons/DocumentBackSvg.js +0 -20
  159. package/dist/components/SvgIcons/DocumentSmallSvg.js +0 -41
  160. package/dist/components/SvgIcons/DocumentSvg.js +0 -39
  161. package/dist/components/SvgIcons/EthSvg.js +0 -28
  162. package/dist/components/SvgIcons/EurSvg.js +0 -27
  163. package/dist/components/SvgIcons/FaceScanIconSvg.js +0 -17
  164. package/dist/components/SvgIcons/FourSvg.js +0 -7
  165. package/dist/components/SvgIcons/Glassess.js +0 -26
  166. package/dist/components/SvgIcons/OneSvg.js +0 -10
  167. package/dist/components/SvgIcons/PassportSvg.js +0 -37
  168. package/dist/components/SvgIcons/SocialInstagram.js +0 -13
  169. package/dist/components/SvgIcons/SocialMedium.js +0 -21
  170. package/dist/components/SvgIcons/SocialReddit.js +0 -21
  171. package/dist/components/SvgIcons/SocialYoutube.js +0 -22
  172. package/dist/components/SvgIcons/ThreeSvg.js +0 -7
  173. package/dist/components/SvgIcons/TwoSidedDocumentSvg.js +0 -48
  174. package/dist/components/SvgIcons/TwoSvg.js +0 -10
  175. package/dist/components/SvgIcons/UpdateDefaultSvg.js +0 -12
  176. package/dist/components/SvgIcons/UpdateHardSvg.js +0 -10
  177. package/dist/components/SvgIcons/UpdateSoftSvg.js +0 -11
  178. package/dist/components/SvgIcons/UploadSvg.js +0 -12
  179. package/dist/components/TeamOverview/TeamOverview.js +0 -79
  180. package/dist/components/TeamOverview/TeamOverview.styles.js +0 -167
  181. package/dist/components/TransactionDetails/TransactionDetails.js +0 -27
  182. package/dist/components/TransactionDetails/TransactionDetails.styles.js +0 -38
  183. package/dist/components/TransactionInfo/TransactionInfo.js +0 -41
  184. package/dist/components/TransactionInfo/TransactionInfo.styles.js +0 -75
  185. package/dist/components/icons/Arrow.js +0 -38
  186. package/dist/components/icons/Check.js +0 -16
  187. package/dist/components/icons/Facebook.js +0 -10
  188. package/dist/components/icons/Info.js +0 -27
  189. package/dist/components/icons/Instagram.js +0 -10
  190. package/dist/components/icons/LinkIcon.js +0 -49
  191. package/dist/components/icons/LinkedIn.js +0 -13
  192. package/dist/components/icons/Medium.js +0 -13
  193. package/dist/components/icons/Reddit.js +0 -16
  194. package/dist/components/icons/Share.js +0 -31
  195. package/dist/components/icons/Telegram.js +0 -13
  196. package/dist/components/icons/Twitter.js +0 -10
  197. package/dist/components/icons/X.js +0 -10
  198. package/dist/components/icons/Youtube.js +0 -10
  199. package/dist/components/icons/index.js +0 -32
  200. package/dist/components/landing-page/List.js +0 -51
  201. package/dist/components/landing-page/PageContent.js +0 -65
  202. package/dist/components/landing-page/PageText.js +0 -171
  203. package/dist/components/landing-page/PageTitle.js +0 -259
  204. package/dist/constants/style.js +0 -48
  205. package/dist/favicon.ico +0 -0
  206. package/dist/logo192.png +0 -0
  207. package/dist/logo512.png +0 -0
  208. package/dist/manifest.json +0 -25
  209. package/dist/robots.txt +0 -3
  210. package/dist/static/fonts/OpenSans/OpenSans-Bold.ttf +0 -0
  211. package/dist/static/fonts/OpenSans/OpenSans-Bold.ttf.js +0 -4
  212. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff +0 -0
  213. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff.js +0 -4
  214. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff2 +0 -0
  215. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff2.js +0 -4
  216. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.ttf +0 -0
  217. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.ttf.js +0 -4
  218. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff +0 -0
  219. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff.js +0 -4
  220. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff2 +0 -0
  221. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff2.js +0 -4
  222. package/dist/static/fonts/OpenSans/OpenSans-Light.ttf +0 -0
  223. package/dist/static/fonts/OpenSans/OpenSans-Light.ttf.js +0 -4
  224. package/dist/static/fonts/OpenSans/OpenSans-Light.woff +0 -0
  225. package/dist/static/fonts/OpenSans/OpenSans-Light.woff.js +0 -4
  226. package/dist/static/fonts/OpenSans/OpenSans-Light.woff2 +0 -0
  227. package/dist/static/fonts/OpenSans/OpenSans-Light.woff2.js +0 -4
  228. package/dist/static/fonts/OpenSans/OpenSans-Regular.ttf +0 -0
  229. package/dist/static/fonts/OpenSans/OpenSans-Regular.ttf.js +0 -4
  230. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff +0 -0
  231. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff.js +0 -4
  232. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff2 +0 -0
  233. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff2.js +0 -4
  234. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.ttf +0 -0
  235. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.ttf.js +0 -4
  236. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff +0 -0
  237. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff.js +0 -4
  238. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff2 +0 -0
  239. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff2.js +0 -4
  240. package/dist/static/images/avatar-placeholder.png.js +0 -4
  241. package/dist/styles/reactTippy.js +0 -5
  242. package/dist/styles/semanticUi.js +0 -84
  243. package/dist/utils/check-sale-time-left.js +0 -85
  244. package/dist/utils/moment.js +0 -26
@@ -1,4 +1,11 @@
1
- const getShortAddress = (address) => `${address.slice(0, 6)}[...]${address.slice(-4)}`;
1
+ const shortenAddress = (value, options = {}) => {
2
+ const { head = 6, tail = 4, separator = "[...]" } = options;
3
+ const text = value ?? "";
4
+ const minLength = Math.max(options.minLength ?? 0, head + separator.length + tail);
5
+ if (text.length <= minLength) return text;
6
+ return `${text.slice(0, head)}${separator}${tail > 0 ? text.slice(-tail) : ""}`;
7
+ };
2
8
  export {
3
- getShortAddress as default
9
+ shortenAddress as default,
10
+ shortenAddress
4
11
  };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `inert` value that works on React 18 (unknown attribute: '' sets it) and 19 (boolean prop: '' is false).
3
+ * <div inert={inertProp(!isOpen)} />
4
+ */
5
+ export declare const inertProp: (inert: boolean) => boolean | undefined;
@@ -0,0 +1,6 @@
1
+ import { version } from "react";
2
+ const isReact18 = version.startsWith("18");
3
+ const inertProp = (inert) => isReact18 ? inert ? "" : void 0 : inert || void 0;
4
+ export {
5
+ inertProp
6
+ };
@@ -0,0 +1,4 @@
1
+ export declare const usCountries: string[];
2
+ export declare const isUSInvestor: (user: {
3
+ country?: string | null;
4
+ }) => boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shortens large numbers: 1220 -> "1.2K", 1500000 -> "1.5M", 2e9 -> "2B".
3
+ * Below 1000 it returns `input.toFixed(decimals)` when `decimals` is set, otherwise `input` unchanged.
4
+ */
5
+ export declare const km_ify: (input: number | string, decimals?: number, convertBillion?: boolean) => string | number;
@@ -1,32 +1,33 @@
1
1
  const truncateDecimals = (number, digits) => {
2
- var re = new RegExp("(\\d+\\.\\d{" + digits + "})(\\d)"), m = number.toString().match(re);
2
+ const re = new RegExp("(\\d+\\.\\d{" + digits + "})(\\d)"), m = number.toString().match(re);
3
3
  return m ? parseFloat(m[1]) : number.valueOf();
4
4
  };
5
5
  const km_ify = (input, decimals, convertBillion = true) => {
6
- if (input >= 1e9 && convertBillion) {
7
- input /= 1e9;
8
- if (input % 10 !== 0) {
9
- input = truncateDecimals(input, 1);
6
+ let value = input;
7
+ if (value >= 1e9 && convertBillion) {
8
+ value /= 1e9;
9
+ if (value % 10 !== 0) {
10
+ value = truncateDecimals(value, 1);
10
11
  }
11
- return input += "B";
12
+ return value + "B";
12
13
  }
13
- if (input >= 1e6) {
14
- input /= 1e6;
15
- if (input % 10 !== 0) {
16
- input = truncateDecimals(input, 1);
14
+ if (value >= 1e6) {
15
+ value /= 1e6;
16
+ if (value % 10 !== 0) {
17
+ value = truncateDecimals(value, 1);
17
18
  }
18
- return input += "M";
19
+ return value + "M";
19
20
  }
20
- if (input >= 1e3) {
21
- input /= 1e3;
22
- if (input % 10 !== 0) {
23
- input = truncateDecimals(input, 1);
21
+ if (value >= 1e3) {
22
+ value /= 1e3;
23
+ if (value % 10 !== 0) {
24
+ value = truncateDecimals(value, 1);
24
25
  }
25
- return input += "K";
26
+ return value + "K";
26
27
  }
27
28
  if (decimals) {
28
- return input.toFixed(decimals);
29
- } else return input;
29
+ return value.toFixed(decimals);
30
+ } else return value;
30
31
  };
31
32
  export {
32
33
  km_ify
@@ -0,0 +1,16 @@
1
+ export declare const PASSWORD_MIN_LENGTH = 8;
2
+ export declare const PASSWORD_REQUIREMENTS_MESSAGE = "Use at least 8 characters with a mix of letters, numbers, and symbols.";
3
+ export declare const ENTROPY_WEAK = 50;
4
+ export declare const ENTROPY_MEDIUM = 80;
5
+ export declare const getPasswordEntropy: (value?: string | null) => number;
6
+ export type PasswordCriteria = {
7
+ length: number;
8
+ hasLength: boolean;
9
+ hasLowercase: boolean;
10
+ hasUppercase: boolean;
11
+ hasNumber: boolean;
12
+ hasSpecial: boolean;
13
+ classesMet: number;
14
+ };
15
+ export declare const getPasswordCriteria: (value?: string | null) => PasswordCriteria;
16
+ export declare const isPasswordValid: (value?: string | null) => boolean;
@@ -0,0 +1,2 @@
1
+ export declare const saveAs: (file: Blob, fileName?: string) => void;
2
+ export declare const openFile: (file: Blob) => void;
@@ -1,3 +1,4 @@
1
+ const revokeLater = (url, delayMs) => setTimeout(() => window.URL.revokeObjectURL(url), delayMs);
1
2
  const saveAs = (file, fileName = "fileName") => {
2
3
  const url = window.URL.createObjectURL(file);
3
4
  const link = document.createElement("a");
@@ -5,11 +6,13 @@ const saveAs = (file, fileName = "fileName") => {
5
6
  link.setAttribute("download", fileName);
6
7
  document.body.appendChild(link);
7
8
  link.click();
8
- link.parentNode.removeChild(link);
9
+ link.remove();
10
+ revokeLater(url, 1e4);
9
11
  };
10
12
  const openFile = (file) => {
11
- var url = window.URL.createObjectURL(file);
13
+ const url = window.URL.createObjectURL(file);
12
14
  window.open(url);
15
+ revokeLater(url, 6e4);
13
16
  };
14
17
  export {
15
18
  openFile,
@@ -0,0 +1,25 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Scrolls to an element with cross-platform compatibility
4
+ * Works reliably on iOS, iPadOS, macOS, and other platforms
5
+ *
6
+ */
7
+ export type ScrollToElementOptions = {
8
+ behavior?: 'auto' | 'smooth' | 'instant';
9
+ block?: 'start' | 'center' | 'end' | 'nearest';
10
+ /** Delay in ms before scrolling. */
11
+ delay?: number;
12
+ /** Pixels to keep above the element. */
13
+ offset?: number;
14
+ };
15
+ export declare const scrollToElement: (elementOrRef: HTMLElement | RefObject<HTMLElement | null> | null | undefined, options?: ScrollToElementOptions) => void;
16
+ /**
17
+ * A custom hook that provides various scrolling utilities.
18
+ */
19
+ export declare const useScrollActions: () => {
20
+ scrollToTop: () => void;
21
+ scrollToElement: (elementOrRef: HTMLElement | RefObject<HTMLElement | null> | null | undefined, options?: ScrollToElementOptions) => void;
22
+ scrollToElementWithOffset: (elementRef: RefObject<HTMLElement | null>, desiredOffsetFromBottom?: number) => void;
23
+ };
24
+ export declare const ScrollToTop: () => any;
25
+ export default useScrollActions;
@@ -33,16 +33,19 @@ const useScrollActions = () => {
33
33
  const scrollToTop = useCallback(() => {
34
34
  window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
35
35
  }, []);
36
- const scrollToElementWithOffset = useCallback((elementRef, desiredOffsetFromBottom = 0) => {
37
- if (elementRef && elementRef.current) {
38
- const targetElement = elementRef.current;
39
- const scrollNeeded = targetElement.getBoundingClientRect().bottom - (window.innerHeight - desiredOffsetFromBottom);
40
- window.scrollBy({
41
- top: scrollNeeded,
42
- behavior: "smooth"
43
- });
44
- }
45
- }, []);
36
+ const scrollToElementWithOffset = useCallback(
37
+ (elementRef, desiredOffsetFromBottom = 0) => {
38
+ if (elementRef && elementRef.current) {
39
+ const targetElement = elementRef.current;
40
+ const scrollNeeded = targetElement.getBoundingClientRect().bottom - (window.innerHeight - desiredOffsetFromBottom);
41
+ window.scrollBy({
42
+ top: scrollNeeded,
43
+ behavior: "smooth"
44
+ });
45
+ }
46
+ },
47
+ []
48
+ );
46
49
  return {
47
50
  scrollToTop,
48
51
  scrollToElement,
@@ -0,0 +1,45 @@
1
+ import { default as React, ElementType, HTMLAttributes, ReactElement, ReactNode, RefObject } from 'react';
2
+ export type TransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited' | 'unmounted';
3
+ export type TransitionTimeout = number | {
4
+ enter?: number;
5
+ exit?: number;
6
+ };
7
+ export type TransitionProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
8
+ in?: boolean;
9
+ timeout?: TransitionTimeout;
10
+ children: ReactNode | ((status: TransitionStatus) => ReactNode);
11
+ nodeRef?: RefObject<HTMLElement | null>;
12
+ unmountOnExit?: boolean;
13
+ onEntered?: (node: HTMLElement | null) => void;
14
+ onExited?: (node: HTMLElement | null) => void;
15
+ };
16
+ /**
17
+ * Transition - drives enter/exit status via callback. Uses refs only (React 19 safe).
18
+ */
19
+ export declare function Transition({ in: inProp, timeout, children, nodeRef: nodeRefProp, unmountOnExit, onEntered, onExited, ...rest }: TransitionProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>> | import("react/jsx-runtime").JSX.Element;
20
+ /**
21
+ * TransitionGroup - simple wrapper (no findDOMNode). Use for layout only; key-based
22
+ * enter is handled by Transition children.
23
+ */
24
+ export type TransitionGroupProps = HTMLAttributes<HTMLElement> & {
25
+ component?: ElementType;
26
+ children?: ReactNode;
27
+ };
28
+ export declare function TransitionGroup({ component: Component, children, ...rest }: TransitionGroupProps): import("react/jsx-runtime").JSX.Element;
29
+ /**
30
+ * CSSTransition - applies classNames based on status (prefix-enter, prefix-enter-active, etc.).
31
+ * Uses ref on wrapper div; React 19 safe.
32
+ */
33
+ export type CSSTransitionProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
34
+ in: boolean;
35
+ timeout?: TransitionTimeout;
36
+ classNames?: string;
37
+ children: ReactElement<{
38
+ className?: string;
39
+ }> | ReactElement<{
40
+ className?: string;
41
+ }>[];
42
+ unmountOnExit?: boolean;
43
+ nodeRef?: RefObject<HTMLElement | null>;
44
+ };
45
+ export declare function CSSTransition({ in: inProp, timeout, classNames, children, unmountOnExit, nodeRef: nodeRefProp, ...rest }: CSSTransitionProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import React__default, { useState, useRef, useEffect } from "react";
3
- import PropTypes from "prop-types";
4
3
  const getTimeout = (timeout, phase) => {
5
4
  if (typeof timeout === "number") return timeout;
6
5
  return timeout?.[phase] ?? 0;
@@ -65,36 +64,9 @@ function Transition({
65
64
  const content = React__default.isValidElement(child) && child.type !== React__default.Fragment ? React__default.createElement(child.type, child.props) : child;
66
65
  return /* @__PURE__ */ jsx("div", { ref: nodeRef, ...rest, children: content });
67
66
  }
68
- Transition.propTypes = {
69
- in: PropTypes.bool,
70
- timeout: PropTypes.oneOfType([
71
- PropTypes.number,
72
- PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number })
73
- ]),
74
- children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
75
- nodeRef: PropTypes.object,
76
- unmountOnExit: PropTypes.bool,
77
- onEntered: PropTypes.func,
78
- onExited: PropTypes.func
79
- };
80
67
  function TransitionGroup({ component: Component = "div", children, ...rest }) {
81
68
  return /* @__PURE__ */ jsx(Component, { ...rest, children });
82
69
  }
83
- TransitionGroup.propTypes = {
84
- component: PropTypes.elementType,
85
- children: PropTypes.node
86
- };
87
- ({
88
- in: PropTypes.bool.isRequired,
89
- timeout: PropTypes.oneOfType([
90
- PropTypes.number,
91
- PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number })
92
- ]),
93
- classNames: PropTypes.string,
94
- children: PropTypes.element.isRequired,
95
- unmountOnExit: PropTypes.bool,
96
- nodeRef: PropTypes.object
97
- });
98
70
  export {
99
71
  Transition,
100
72
  TransitionGroup
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.2.0",
3
+ "version": "4.0.0",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
10
11
  "files": [
11
12
  "dist",
12
13
  "README.md"
13
14
  ],
14
15
  "exports": {
15
16
  ".": {
17
+ "types": "./dist/index.d.ts",
16
18
  "import": "./dist/index.js",
17
19
  "default": "./dist/index.js"
18
20
  },
@@ -22,9 +24,7 @@
22
24
  "sideEffects": [
23
25
  "**/*.css",
24
26
  "./dist/styles/global.js",
25
- "./dist/styles/ioniconsStyles.js",
26
- "./dist/components/Slider/Slider.js",
27
- "./dist/components/LearnMoreCarousel/LearnMoreCarousel.js"
27
+ "./dist/styles/ioniconsStyles.js"
28
28
  ],
29
29
  "repository": {
30
30
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "scripts": {
34
34
  "build": "vite build",
35
35
  "build-storybook": "storybook build",
36
- "build-storybook-docs": "storybook build -s public --docs",
36
+ "build-storybook-docs": "storybook build --docs",
37
37
  "copy:static": "node -e \"require('fs').cpSync('src/static', 'dist/static', {recursive: true})\"",
38
38
  "build:dist": "vite build && npm run copy:static",
39
39
  "prepare": "npm run build:dist",
@@ -45,8 +45,9 @@
45
45
  "release": "auto shipit",
46
46
  "pub": "npm run publish:build && npm publish --access public",
47
47
  "publish:build": "npm run build:dist",
48
- "dev": "vite dev",
49
- "serve": "npx http-server ./storybook-static -p 9009"
48
+ "serve": "npx http-server ./storybook-static -p 9009",
49
+ "test": "vitest run",
50
+ "test:watch": "vitest"
50
51
  },
51
52
  "dependencies": {
52
53
  "@floating-ui/react": "^0.27.20",
@@ -57,24 +58,19 @@
57
58
  "dompurify": "^3.2.4",
58
59
  "formik": "^2.2.9",
59
60
  "html-react-parser": "^5.0.6",
60
- "mixpanel-browser": "^2.74.0",
61
61
  "moment": "^2.30.1",
62
- "moment-timezone": "^0.6.0",
63
62
  "prop-types": "^15.8.1",
64
63
  "qrcode.react": "^4.2.0",
65
64
  "react-collapse": "^5.1.1",
66
65
  "react-copy-to-clipboard": "^5.1.0",
67
66
  "react-custom-scrollbars-4": "^4.5.1",
68
67
  "react-day-picker": "^9.11.1",
69
- "react-helmet": "^6.1.0",
70
68
  "react-intersection-observer": "^10.0.2",
71
69
  "react-otp-input": "^3.1.0",
72
70
  "react-portal": "^4.2.2",
73
71
  "react-range": "^1.8.14",
74
72
  "react-select": "^5.7.0",
75
- "react-slick": "^0.31.0",
76
73
  "react-table": "^7.8.0",
77
- "slick-carousel": "^1.8.1",
78
74
  "yup": "^1.0.0"
79
75
  },
80
76
  "peerDependencies": {
@@ -107,6 +103,7 @@
107
103
  "eslint-plugin-react-refresh": "^0.4.26",
108
104
  "eslint-plugin-storybook": "10.6.0",
109
105
  "http-server": "^14.1.1",
106
+ "jsdom": "^26.1.0",
110
107
  "prettier": "^3.8.1",
111
108
  "react": "^19.2.3",
112
109
  "react-dom": "^19.2.3",
@@ -118,7 +115,8 @@
118
115
  "vite": "^7.3.1",
119
116
  "vite-plugin-dts": "^4.5.4",
120
117
  "vite-plugin-lottie": "^1.0.1",
121
- "vite-plugin-svgr": "4.5.0"
118
+ "vite-plugin-svgr": "4.5.0",
119
+ "vitest": "^4.1.12"
122
120
  },
123
121
  "overrides": {
124
122
  "minimatch": "^10.2.1"
@@ -1,185 +0,0 @@
1
- import mixpanel from "mixpanel-browser";
2
- const BLOCKED_FIELDS = /* @__PURE__ */ new Set([
3
- // PII
4
- "email",
5
- "first_name",
6
- "last_name",
7
- "full_name",
8
- "name",
9
- "phone",
10
- "date_of_birth",
11
- "address",
12
- "nationality",
13
- "passport_number",
14
- // Blockchain
15
- "wallet_address",
16
- "tx_hash",
17
- "transaction_hash",
18
- "block_hash",
19
- "contract_address",
20
- "signing_address",
21
- // Financial precision — server sends bucketed values only
22
- "amount",
23
- "exact_amount",
24
- "investment_amount",
25
- "token_quantity",
26
- "token_price",
27
- "token_value",
28
- "price",
29
- "value",
30
- "balance",
31
- "nav",
32
- "net_asset_value",
33
- // Banking
34
- "iban",
35
- "bic",
36
- "swift",
37
- "bank_account",
38
- "routing_number",
39
- // KYC
40
- "kyc_data",
41
- "kyb_data",
42
- "document_id",
43
- "tax_id",
44
- "ssn"
45
- ]);
46
- const BLOCKED_PATTERNS = [
47
- /address$/i,
48
- // wallet_address, contract_address, billing_address
49
- /hash$/i,
50
- // tx_hash, block_hash
51
- /^raw_/i,
52
- /password/i,
53
- /secret/i,
54
- /private.*key/i,
55
- /\bprice\b/i,
56
- /exact/i
57
- ];
58
- function sanitize(props) {
59
- if (!props || typeof props !== "object" || Array.isArray(props)) {
60
- return props ?? {};
61
- }
62
- const cleaned = {};
63
- for (const [key, val] of Object.entries(props)) {
64
- const isBlocked = BLOCKED_FIELDS.has(key.toLowerCase()) || BLOCKED_PATTERNS.some((re) => re.test(key));
65
- if (isBlocked) {
66
- continue;
67
- }
68
- cleaned[key] = val && typeof val === "object" && !Array.isArray(val) ? sanitize(val) : val;
69
- }
70
- return cleaned;
71
- }
72
- let initialized = false;
73
- function initAnalytics({
74
- token,
75
- app,
76
- requireConsent = false,
77
- scroll = true,
78
- apiHost: apiHostArg
79
- } = {}) {
80
- const apiHost = apiHostArg ?? "https://api-eu.mixpanel.com";
81
- if (initialized) return;
82
- if (!token) return;
83
- if (typeof navigator !== "undefined" && /Ghost Inspector/i.test(navigator.userAgent)) {
84
- return;
85
- }
86
- mixpanel.init(token, {
87
- api_host: apiHost,
88
- autocapture: {
89
- pageview: "full-url",
90
- click: false,
91
- dead_click: false,
92
- input: false,
93
- rage_click: true,
94
- scroll,
95
- submit: true,
96
- capture_text_content: false,
97
- capture_extra_attrs: ["data-cy"]
98
- },
99
- record_sessions_percent: 100,
100
- record_heatmap_data: true,
101
- opt_out_tracking_by_default: requireConsent,
102
- persistence: "localStorage",
103
- debug: false
104
- });
105
- if (app) {
106
- mixpanel.register({ app });
107
- }
108
- mixpanel.register({ source: "frontend" });
109
- initialized = true;
110
- }
111
- function optIn() {
112
- if (!initialized) return;
113
- mixpanel.opt_in_tracking();
114
- }
115
- function optOut() {
116
- if (!initialized) return;
117
- mixpanel.opt_out_tracking();
118
- }
119
- function hasOptedIn() {
120
- if (!initialized) return false;
121
- return mixpanel.has_opted_in_tracking();
122
- }
123
- function track(eventName, props = {}) {
124
- if (!initialized) return;
125
- mixpanel.track(eventName, sanitize(props));
126
- }
127
- function timeEvent(eventName) {
128
- if (!initialized) return;
129
- mixpanel.time_event(eventName);
130
- }
131
- function identify(userId, traits = {}) {
132
- if (!initialized) return;
133
- mixpanel.identify(userId);
134
- const sanitizedTraits = sanitize(traits);
135
- if (Object.keys(sanitizedTraits).length > 0) {
136
- mixpanel.people.set(sanitizedTraits);
137
- }
138
- }
139
- function setUserProperties(props = {}) {
140
- if (!initialized) return;
141
- const sanitized = sanitize(props);
142
- if (Object.keys(sanitized).length > 0) {
143
- mixpanel.people.set(sanitized);
144
- }
145
- }
146
- function alias(userId) {
147
- if (!initialized) return;
148
- mixpanel.alias(userId);
149
- }
150
- function reset() {
151
- if (!initialized) return;
152
- mixpanel.reset();
153
- }
154
- function getAmountBucket(amount) {
155
- if (amount < 125e3) return "<125k";
156
- if (amount < 25e4) return "125k-250k";
157
- if (amount < 5e5) return "250k-500k";
158
- if (amount < 1e6) return "500k-1M";
159
- if (amount < 5e6) return "1M-5M";
160
- return "5M+";
161
- }
162
- function getTokenBucket(qty) {
163
- if (qty <= 1) return "0-1";
164
- if (qty <= 10) return "2-10";
165
- if (qty <= 100) return "11-100";
166
- if (qty <= 1e3) return "101-1k";
167
- if (qty <= 1e4) return "1k-10k";
168
- if (qty <= 1e5) return "10k-100k";
169
- if (qty <= 1e6) return "100k-1M";
170
- return "1M+";
171
- }
172
- export {
173
- alias,
174
- getAmountBucket,
175
- getTokenBucket,
176
- hasOptedIn,
177
- identify,
178
- initAnalytics,
179
- optIn,
180
- optOut,
181
- reset,
182
- setUserProperties,
183
- timeEvent,
184
- track
185
- };
@@ -1,35 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import "react";
3
- import PropTypes from "prop-types";
4
- import { InfoIcon } from "../InfoIcon/InfoIcon.js";
5
- import { Container, Head, Title, Body, Value, Equal } from "./AccountBalance.styles.js";
6
- const AccountBalance = ({ title, value, unit, info = "", eqValue = "", eqUnit = "", right = false }) => /* @__PURE__ */ jsxs(Container, { right, children: [
7
- /* @__PURE__ */ jsx(Head, { children: /* @__PURE__ */ jsxs(Title, { children: [
8
- title,
9
- info && /* @__PURE__ */ jsx(InfoIcon, { position: "top", title: info })
10
- ] }) }),
11
- /* @__PURE__ */ jsxs(Body, { children: [
12
- /* @__PURE__ */ jsxs(Value, { children: [
13
- unit && `${unit} `,
14
- value
15
- ] }),
16
- eqValue && /* @__PURE__ */ jsxs(Equal, { children: [
17
- "= ",
18
- eqUnit && `${eqUnit}`,
19
- eqValue
20
- ] })
21
- ] })
22
- ] });
23
- AccountBalance.propTypes = {
24
- title: PropTypes.string.isRequired,
25
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
26
- unit: PropTypes.string.isRequired,
27
- eqValue: PropTypes.string,
28
- eqUnit: PropTypes.string,
29
- info: PropTypes.string,
30
- right: PropTypes.bool,
31
- fontSizeSmall: PropTypes.bool
32
- };
33
- export {
34
- AccountBalance
35
- };
@@ -1,48 +0,0 @@
1
- import styled from "styled-components";
2
- const Container = styled.div.withConfig({
3
- shouldForwardProp: (props) => !["right"].includes(props)
4
- })`
5
- position: relative;
6
- margin-right: -20px;
7
-
8
- ${(props) => props.right && `
9
- text-align: right;
10
- `}
11
- `;
12
- const Head = styled.div`
13
- position: relative;
14
- margin-bottom: 4px;
15
- `;
16
- const Body = styled.div`
17
- position: relative;
18
- `;
19
- const Title = styled.div`
20
- font-weight: bold;
21
- font-size: 11px;
22
- line-height: 24px;
23
- letter-spacing: 2.04px;
24
- text-transform: uppercase;
25
- `;
26
- const Value = styled.div`
27
- position: relative;
28
- font-weight: 300;
29
- font-size: 22px;
30
- line-height: 28px;
31
- letter-spacing: 0.8px;
32
- `;
33
- const Equal = styled.div`
34
- position: relative;
35
- line-height: 16px;
36
- letter-spacing: 0.4px;
37
- font-size: 11px;
38
- font-style: italic;
39
- margin-top: 8px;
40
- `;
41
- export {
42
- Body,
43
- Container,
44
- Equal,
45
- Head,
46
- Title,
47
- Value
48
- };