@stokr/components-library 3.3.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 (243) 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 -211
  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 -12
  129. package/dist/components/AccountBalance/AccountBalance.js +0 -35
  130. package/dist/components/AccountBalance/AccountBalance.styles.js +0 -48
  131. package/dist/components/AdminDashboard/Table/Table.js +0 -123
  132. package/dist/components/ButtonContainer/ButtonContainer.styles.js +0 -51
  133. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.js +0 -34
  134. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.styles.js +0 -125
  135. package/dist/components/DoubleButton/DoubleButton.styles.js +0 -27
  136. package/dist/components/ErrorMessage/ErrorMessage.styles.js +0 -9
  137. package/dist/components/Icon/Icon2.js +0 -12
  138. package/dist/components/Input/InputUsername.js +0 -92
  139. package/dist/components/Input/RangeInput.styles.js +0 -129
  140. package/dist/components/InvestmentStat/InvestmentStat.js +0 -24
  141. package/dist/components/InvestmentStat/InvestmentStat.styles.js +0 -62
  142. package/dist/components/LatestUpdate/LatestUpdate.js +0 -24
  143. package/dist/components/LatestUpdate/LatestUpdate.styles.js +0 -90
  144. package/dist/components/MultiProgressBar/MultiProgressBar.js +0 -28
  145. package/dist/components/MultiProgressBar/MultiProgressBar.styles.js +0 -105
  146. package/dist/components/PageTransition/PageTransition.js +0 -51
  147. package/dist/components/ProfileStat/ProfileStat.js +0 -29
  148. package/dist/components/ProfileStat/ProfileStat.styles.js +0 -90
  149. package/dist/components/SEO/SEO.js +0 -66
  150. package/dist/components/SideLine/SideLine.js +0 -7
  151. package/dist/components/SideLine/SideLine.styles.js +0 -33
  152. package/dist/components/Slider/Slider.js +0 -31
  153. package/dist/components/Slider/Slider.styles.js +0 -120
  154. package/dist/components/StatusBadge/StatusBadge.styles.js +0 -18
  155. package/dist/components/StokrLoader/media.js +0 -23
  156. package/dist/components/SvgIcons/CameraSvg.js +0 -31
  157. package/dist/components/SvgIcons/DocumentBackSvg.js +0 -20
  158. package/dist/components/SvgIcons/DocumentSmallSvg.js +0 -41
  159. package/dist/components/SvgIcons/DocumentSvg.js +0 -39
  160. package/dist/components/SvgIcons/EthSvg.js +0 -28
  161. package/dist/components/SvgIcons/EurSvg.js +0 -27
  162. package/dist/components/SvgIcons/FaceScanIconSvg.js +0 -17
  163. package/dist/components/SvgIcons/FourSvg.js +0 -7
  164. package/dist/components/SvgIcons/Glassess.js +0 -26
  165. package/dist/components/SvgIcons/OneSvg.js +0 -10
  166. package/dist/components/SvgIcons/PassportSvg.js +0 -37
  167. package/dist/components/SvgIcons/SocialInstagram.js +0 -13
  168. package/dist/components/SvgIcons/SocialMedium.js +0 -21
  169. package/dist/components/SvgIcons/SocialReddit.js +0 -21
  170. package/dist/components/SvgIcons/SocialYoutube.js +0 -22
  171. package/dist/components/SvgIcons/ThreeSvg.js +0 -7
  172. package/dist/components/SvgIcons/TwoSidedDocumentSvg.js +0 -48
  173. package/dist/components/SvgIcons/TwoSvg.js +0 -10
  174. package/dist/components/SvgIcons/UpdateDefaultSvg.js +0 -12
  175. package/dist/components/SvgIcons/UpdateHardSvg.js +0 -10
  176. package/dist/components/SvgIcons/UpdateSoftSvg.js +0 -11
  177. package/dist/components/SvgIcons/UploadSvg.js +0 -12
  178. package/dist/components/TeamOverview/TeamOverview.js +0 -79
  179. package/dist/components/TeamOverview/TeamOverview.styles.js +0 -167
  180. package/dist/components/TransactionDetails/TransactionDetails.js +0 -27
  181. package/dist/components/TransactionDetails/TransactionDetails.styles.js +0 -38
  182. package/dist/components/TransactionInfo/TransactionInfo.js +0 -41
  183. package/dist/components/TransactionInfo/TransactionInfo.styles.js +0 -75
  184. package/dist/components/icons/Arrow.js +0 -38
  185. package/dist/components/icons/Check.js +0 -16
  186. package/dist/components/icons/Facebook.js +0 -10
  187. package/dist/components/icons/Info.js +0 -27
  188. package/dist/components/icons/Instagram.js +0 -10
  189. package/dist/components/icons/LinkIcon.js +0 -49
  190. package/dist/components/icons/LinkedIn.js +0 -13
  191. package/dist/components/icons/Medium.js +0 -13
  192. package/dist/components/icons/Reddit.js +0 -16
  193. package/dist/components/icons/Share.js +0 -31
  194. package/dist/components/icons/Telegram.js +0 -13
  195. package/dist/components/icons/Twitter.js +0 -10
  196. package/dist/components/icons/X.js +0 -10
  197. package/dist/components/icons/Youtube.js +0 -10
  198. package/dist/components/icons/index.js +0 -32
  199. package/dist/components/landing-page/List.js +0 -51
  200. package/dist/components/landing-page/PageContent.js +0 -65
  201. package/dist/components/landing-page/PageText.js +0 -171
  202. package/dist/components/landing-page/PageTitle.js +0 -259
  203. package/dist/constants/style.js +0 -48
  204. package/dist/favicon.ico +0 -0
  205. package/dist/logo192.png +0 -0
  206. package/dist/logo512.png +0 -0
  207. package/dist/manifest.json +0 -25
  208. package/dist/robots.txt +0 -3
  209. package/dist/static/fonts/OpenSans/OpenSans-Bold.ttf +0 -0
  210. package/dist/static/fonts/OpenSans/OpenSans-Bold.ttf.js +0 -4
  211. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff +0 -0
  212. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff.js +0 -4
  213. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff2 +0 -0
  214. package/dist/static/fonts/OpenSans/OpenSans-Bold.woff2.js +0 -4
  215. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.ttf +0 -0
  216. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.ttf.js +0 -4
  217. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff +0 -0
  218. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff.js +0 -4
  219. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff2 +0 -0
  220. package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff2.js +0 -4
  221. package/dist/static/fonts/OpenSans/OpenSans-Light.ttf +0 -0
  222. package/dist/static/fonts/OpenSans/OpenSans-Light.ttf.js +0 -4
  223. package/dist/static/fonts/OpenSans/OpenSans-Light.woff +0 -0
  224. package/dist/static/fonts/OpenSans/OpenSans-Light.woff.js +0 -4
  225. package/dist/static/fonts/OpenSans/OpenSans-Light.woff2 +0 -0
  226. package/dist/static/fonts/OpenSans/OpenSans-Light.woff2.js +0 -4
  227. package/dist/static/fonts/OpenSans/OpenSans-Regular.ttf +0 -0
  228. package/dist/static/fonts/OpenSans/OpenSans-Regular.ttf.js +0 -4
  229. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff +0 -0
  230. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff.js +0 -4
  231. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff2 +0 -0
  232. package/dist/static/fonts/OpenSans/OpenSans-Regular.woff2.js +0 -4
  233. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.ttf +0 -0
  234. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.ttf.js +0 -4
  235. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff +0 -0
  236. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff.js +0 -4
  237. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff2 +0 -0
  238. package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff2.js +0 -4
  239. package/dist/static/images/avatar-placeholder.png.js +0 -4
  240. package/dist/styles/reactTippy.js +0 -5
  241. package/dist/styles/semanticUi.js +0 -84
  242. package/dist/utils/check-sale-time-left.js +0 -85
  243. 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.3.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",
@@ -58,22 +59,18 @@
58
59
  "formik": "^2.2.9",
59
60
  "html-react-parser": "^5.0.6",
60
61
  "moment": "^2.30.1",
61
- "moment-timezone": "^0.6.0",
62
62
  "prop-types": "^15.8.1",
63
63
  "qrcode.react": "^4.2.0",
64
64
  "react-collapse": "^5.1.1",
65
65
  "react-copy-to-clipboard": "^5.1.0",
66
66
  "react-custom-scrollbars-4": "^4.5.1",
67
67
  "react-day-picker": "^9.11.1",
68
- "react-helmet": "^6.1.0",
69
68
  "react-intersection-observer": "^10.0.2",
70
69
  "react-otp-input": "^3.1.0",
71
70
  "react-portal": "^4.2.2",
72
71
  "react-range": "^1.8.14",
73
72
  "react-select": "^5.7.0",
74
- "react-slick": "^0.31.0",
75
73
  "react-table": "^7.8.0",
76
- "slick-carousel": "^1.8.1",
77
74
  "yup": "^1.0.0"
78
75
  },
79
76
  "peerDependencies": {
@@ -106,6 +103,7 @@
106
103
  "eslint-plugin-react-refresh": "^0.4.26",
107
104
  "eslint-plugin-storybook": "10.6.0",
108
105
  "http-server": "^14.1.1",
106
+ "jsdom": "^26.1.0",
109
107
  "prettier": "^3.8.1",
110
108
  "react": "^19.2.3",
111
109
  "react-dom": "^19.2.3",
@@ -117,7 +115,8 @@
117
115
  "vite": "^7.3.1",
118
116
  "vite-plugin-dts": "^4.5.4",
119
117
  "vite-plugin-lottie": "^1.0.1",
120
- "vite-plugin-svgr": "4.5.0"
118
+ "vite-plugin-svgr": "4.5.0",
119
+ "vitest": "^4.1.12"
121
120
  },
122
121
  "overrides": {
123
122
  "minimatch": "^10.2.1"
@@ -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
- };
@@ -1,123 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { PureComponent } from "react";
3
- import PropTypes from "prop-types";
4
- import stdin_default from "../../ComponentScroll/ComponentScroll.js";
5
- import { Container, HeadWrapper, StyledTable, Head, Row, Column, TableWrapper, Body } from "./Table.styles.js";
6
- const OptionalScroll = ({ children, maxHeight = 500, noScroll = false, onScroll }) => {
7
- if (noScroll) {
8
- return children;
9
- }
10
- return /* @__PURE__ */ jsx(
11
- stdin_default,
12
- {
13
- autoHeight: maxHeight !== 0,
14
- autoHeightMax: maxHeight || void 0,
15
- offset: 4,
16
- barPadding: 8,
17
- topPadding: 48,
18
- handleScroll: onScroll,
19
- children
20
- }
21
- );
22
- };
23
- OptionalScroll.propTypes = {
24
- children: PropTypes.node.isRequired,
25
- maxHeight: PropTypes.number.isRequired,
26
- noScroll: PropTypes.bool.isRequired,
27
- onScroll: PropTypes.func.isRequired
28
- };
29
- class Table extends PureComponent {
30
- componentDidMount() {
31
- this.setColumnsWidth();
32
- window.addEventListener("resize", this.onResize);
33
- }
34
- componentWillUnmount() {
35
- clearTimeout(this.resizeTimeout);
36
- window.removeEventListener("resize", this.onResize);
37
- }
38
- onResize = () => {
39
- clearTimeout(this.resizeTimeout);
40
- this.resizeTimeout = setTimeout(this.setColumnsWidth, 200);
41
- };
42
- setColumnsWidth = () => {
43
- const headColumns = this.headTableEl.children[0].children[0].children;
44
- const bodyColumns = this.bodyTableEl.children[0].children[0].children;
45
- Array.prototype.forEach.call(bodyColumns, (column, columnKey) => {
46
- bodyColumns[columnKey].style.width = "";
47
- });
48
- this.headTableEl.style.width = "";
49
- Array.prototype.forEach.call(bodyColumns, (column, columnKey) => {
50
- headColumns[columnKey].style.width = `${column.offsetWidth}px`;
51
- bodyColumns[columnKey].style.width = `${column.offsetWidth}px`;
52
- });
53
- this.headTableEl.style.width = `${this.bodyTableEl.offsetWidth}px`;
54
- };
55
- onScroll = (e) => {
56
- if (!e) return;
57
- this.headTableWrapperEl.scrollLeft = e.target.scrollLeft;
58
- };
59
- render() {
60
- const { columns, data, maxHeight, noScroll } = this.props;
61
- const columnsProps = {};
62
- columns.map((column) => {
63
- columnsProps[column.key] = {
64
- width: column.width,
65
- align: column.align,
66
- marginLeft: column.marginLeft
67
- };
68
- return column;
69
- });
70
- return /* @__PURE__ */ jsxs(Container, { children: [
71
- /* @__PURE__ */ jsx(
72
- HeadWrapper,
73
- {
74
- ref: (el) => {
75
- this.headTableWrapperEl = el;
76
- },
77
- children: /* @__PURE__ */ jsx(
78
- StyledTable,
79
- {
80
- ref: (el) => {
81
- this.headTableEl = el;
82
- },
83
- children: /* @__PURE__ */ jsx(Head, { children: /* @__PURE__ */ jsx(Row, { children: columns.map((column) => /* @__PURE__ */ jsx(Column, { align: column.align, children: column.label }, column.key)) }) })
84
- }
85
- )
86
- }
87
- ),
88
- /* @__PURE__ */ jsx(TableWrapper, { children: /* @__PURE__ */ jsx(OptionalScroll, { maxHeight, noScroll, onScroll: this.onScroll, children: /* @__PURE__ */ jsxs(
89
- StyledTable,
90
- {
91
- ref: (el) => {
92
- this.bodyTableEl = el;
93
- },
94
- children: [
95
- /* @__PURE__ */ jsx(Head, { hidden: true, children: /* @__PURE__ */ jsx(Row, { children: columns.map((column) => /* @__PURE__ */ jsx(
96
- Column,
97
- {
98
- colWidth: column.width,
99
- minWidth: column.minWidth,
100
- maxWidth: column.maxWidth,
101
- align: column.align,
102
- children: column.label
103
- },
104
- column.key
105
- )) }) }),
106
- /* @__PURE__ */ jsx(Body, { children: data.map((row) => /* @__PURE__ */ jsx(Row, { children: Object.keys(row).map(
107
- (columnKey) => columnsProps[columnKey] && /* @__PURE__ */ jsx(Column, { align: columnsProps[columnKey].align, children: row[columnKey] }, columnKey)
108
- ) }, row.id)) })
109
- ]
110
- }
111
- ) }) })
112
- ] });
113
- }
114
- }
115
- Table.propTypes = {
116
- columns: PropTypes.arrayOf(Object).isRequired,
117
- data: PropTypes.arrayOf(Object).isRequired,
118
- maxHeight: PropTypes.number,
119
- noScroll: PropTypes.bool
120
- };
121
- export {
122
- Table
123
- };
@@ -1,51 +0,0 @@
1
- import styled from "styled-components";
2
- import stdin_default from "../Button/Button.styles.js";
3
- const ButtonContainer = styled.div.withConfig({
4
- shouldForwardProp: (props) => !["flexColumn"].includes(props)
5
- })`
6
- align-items: center;
7
- display: flex;
8
- justify-content: center;
9
- ${(props) => props.flexColumn && `
10
- flex-direction:column;
11
- `}
12
-
13
- ${stdin_default} {
14
- min-width: 150px;
15
- max-width: 300px;
16
- }
17
-
18
- @media screen and (max-width: 767px) {
19
- flex-direction: column;
20
-
21
- ${stdin_default} {
22
- min-width: 150px;
23
- max-width: 400px;
24
- }
25
- }
26
- `;
27
- const ButtonGridContainer = styled.div`
28
- display: grid;
29
- grid-template-columns: repeat(2, 1fr);
30
- gap: 10px;
31
- justify-items: center;
32
- align-items: center;
33
-
34
- ${stdin_default} {
35
- min-width: 150px;
36
- max-width: 300px;
37
- width: 100%;
38
- }
39
-
40
- @media screen and (max-width: 767px) {
41
- grid-template-columns: repeat(1, 1fr);
42
-
43
- ${stdin_default} {
44
- max-width: 400px;
45
- }
46
- }
47
- `;
48
- export {
49
- ButtonContainer,
50
- ButtonGridContainer
51
- };
@@ -1,34 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import "react";
3
- import PropTypes from "prop-types";
4
- import stdin_default from "../Button/Button.styles.js";
5
- import { Container, Row, Column, Avatar, AvatarImg, Name } from "./CryptoAddressDetails.styles.js";
6
- const CryptoAddressDetails = ({ data }) => /* @__PURE__ */ jsxs(Container, { children: [
7
- /* @__PURE__ */ jsxs(Row, { head: true, children: [
8
- /* @__PURE__ */ jsx(Column, { tokens: true, children: "Tokens" }),
9
- /* @__PURE__ */ jsx(Column, { balance: true, children: "Balance" }),
10
- /* @__PURE__ */ jsx(Column, { transfer: true })
11
- ] }),
12
- data.map((datum, index) => /* @__PURE__ */ jsxs(Row, { children: [
13
- /* @__PURE__ */ jsxs(Column, { tokens: true, nameBox: true, children: [
14
- /* @__PURE__ */ jsx(Avatar, { children: /* @__PURE__ */ jsx(AvatarImg, { src: datum.avatar, alt: "avatar" }) }),
15
- /* @__PURE__ */ jsx(Name, { children: datum.name })
16
- ] }),
17
- /* @__PURE__ */ jsx(Column, { balance: true, balanceText: true, children: datum.balance }),
18
- /* @__PURE__ */ jsx(Column, { transfer: true, children: /* @__PURE__ */ jsx(stdin_default, { outline: true, fluid: true, onClick: datum.transferClick, children: "Transfer" }) })
19
- ] }, `${datum.id}-${index.toString()}`))
20
- ] });
21
- CryptoAddressDetails.propTypes = {
22
- data: PropTypes.arrayOf(
23
- PropTypes.shape({
24
- id: PropTypes.number,
25
- avatar: PropTypes.string,
26
- name: PropTypes.string,
27
- balance: PropTypes.string,
28
- transferClick: PropTypes.func
29
- })
30
- ).isRequired
31
- };
32
- export {
33
- CryptoAddressDetails
34
- };