@onepercentio/one-ui 0.29.2 → 0.29.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.
Files changed (289) hide show
  1. package/dist/components/Switch/Switch.d.ts +1 -1
  2. package/dist/components/Switch/Switch.js +1 -1
  3. package/dist/hooks/useHero.js +3 -2
  4. package/dist-ts/components/Switch/Switch.d.ts +1 -1
  5. package/dist-ts/hooks/useHero.js +5 -4
  6. package/dist-ts/hooks/useHero.js.map +1 -1
  7. package/package.json +5 -1
  8. package/src/assets/img/svg/checkbox.svg +0 -3
  9. package/src/assets/styles/index.scss +0 -2
  10. package/src/assets/styles/mixins.scss +0 -12
  11. package/src/assets/styles/variables.scss +0 -49
  12. package/src/components/AdaptiveButton/AdaptiveButton.module.scss +0 -7
  13. package/src/components/AdaptiveButton/AdaptiveButton.tsx +0 -26
  14. package/src/components/AdaptiveButton/index.tsx +0 -2
  15. package/src/components/AdaptiveContainer/AdaptiveContainer.module.scss +0 -53
  16. package/src/components/AdaptiveContainer/AdaptiveContainer.tsx +0 -200
  17. package/src/components/AdaptiveContainer/index.tsx +0 -2
  18. package/src/components/AdaptiveDialog/AdaptiveDialog.module.scss +0 -147
  19. package/src/components/AdaptiveDialog/AdaptiveDialog.tsx +0 -97
  20. package/src/components/AdaptiveDialog/index.tsx +0 -2
  21. package/src/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +0 -49
  22. package/src/components/AdaptiveSidebar/AdaptiveSidebar.sample.tsx +0 -10
  23. package/src/components/AdaptiveSidebar/AdaptiveSidebar.tsx +0 -123
  24. package/src/components/AdaptiveSidebar/index.tsx +0 -2
  25. package/src/components/AnchoredTooltip/AnchoredTooltip.module.scss +0 -64
  26. package/src/components/AnchoredTooltip/AnchoredTooltip.tsx +0 -250
  27. package/src/components/AnchoredTooltip/index.tsx +0 -2
  28. package/src/components/AnimatedEntrance/AnimatedEntrance.module.scss +0 -108
  29. package/src/components/AnimatedEntrance/AnimatedEntrance.tsx +0 -227
  30. package/src/components/AnimatedEntrance/index.tsx +0 -2
  31. package/src/components/AsyncWrapper/AsyncWrapper.tsx +0 -38
  32. package/src/components/AsyncWrapper/index.tsx +0 -2
  33. package/src/components/Avatar/Avatar.module.scss +0 -22
  34. package/src/components/Avatar/Avatar.tsx +0 -31
  35. package/src/components/Avatar/index.tsx +0 -2
  36. package/src/components/BucketFill/BucketFill.module.scss +0 -36
  37. package/src/components/BucketFill/BucketFill.tsx +0 -65
  38. package/src/components/BucketFill/index.tsx +0 -2
  39. package/src/components/Button/Button.module.scss +0 -45
  40. package/src/components/Button/Button.tsx +0 -40
  41. package/src/components/Button/index.tsx +0 -2
  42. package/src/components/Card/Card.module.scss +0 -12
  43. package/src/components/Card/Card.tsx +0 -9
  44. package/src/components/Card/index.tsx +0 -2
  45. package/src/components/Chart/Chart.e2e.ts +0 -4
  46. package/src/components/Chart/Chart.logic.tsx +0 -8
  47. package/src/components/Chart/Chart.module.scss +0 -58
  48. package/src/components/Chart/Chart.tsx +0 -2
  49. package/src/components/Chart/Chart.types.ts +0 -35
  50. package/src/components/Chart/Chart.view.tsx +0 -241
  51. package/src/components/Chart/index.tsx +0 -2
  52. package/src/components/CheckBox/CheckBox.module.scss +0 -36
  53. package/src/components/CheckBox/CheckBox.tsx +0 -63
  54. package/src/components/CheckBox/index.tsx +0 -2
  55. package/src/components/CodeInput/CodeInput.module.scss +0 -5
  56. package/src/components/CodeInput/CodeInput.tsx +0 -84
  57. package/src/components/CodeInput/index.tsx +0 -2
  58. package/src/components/Collapsable/Collapsable.module.scss +0 -42
  59. package/src/components/Collapsable/Collapsable.tsx +0 -253
  60. package/src/components/Collapsable/index.tsx +0 -2
  61. package/src/components/Countdown/Countdown.tsx +0 -130
  62. package/src/components/Countdown/index.tsx +0 -2
  63. package/src/components/CurrencyInput/CurrencyInput.hook.ts +0 -37
  64. package/src/components/CurrencyInput/CurrencyInput.tsx +0 -25
  65. package/src/components/CurrencyInput/index.tsx +0 -2
  66. package/src/components/Divider/Divider.module.scss +0 -7
  67. package/src/components/Divider/Divider.tsx +0 -13
  68. package/src/components/Divider/index.tsx +0 -2
  69. package/src/components/EmailInput/EmailInput.module.scss +0 -0
  70. package/src/components/EmailInput/EmailInput.tsx +0 -51
  71. package/src/components/EmailInput/index.tsx +0 -2
  72. package/src/components/FadeIn/FadeIn.module.scss +0 -9
  73. package/src/components/FadeIn/FadeIn.tsx +0 -77
  74. package/src/components/FadeIn/index.tsx +0 -2
  75. package/src/components/FileInput/FileInput.module.scss +0 -6
  76. package/src/components/FileInput/FileInput.tsx +0 -75
  77. package/src/components/FileInput/View/BigFactory/BigFactory.module.scss +0 -20
  78. package/src/components/FileInput/View/BigFactory/BigFactory.tsx +0 -48
  79. package/src/components/FileInput/View/BigFactory/index.tsx +0 -2
  80. package/src/components/FileInput/View/Compact/Compact.module.scss +0 -68
  81. package/src/components/FileInput/View/Compact/Compact.tsx +0 -151
  82. package/src/components/FileInput/View/Compact/index.tsx +0 -2
  83. package/src/components/FileInput/View/View.types.ts +0 -12
  84. package/src/components/FileInput/index.tsx +0 -2
  85. package/src/components/FlowController/FlowController.module.scss +0 -47
  86. package/src/components/FlowController/FlowController.tsx +0 -93
  87. package/src/components/FlowController/index.tsx +0 -2
  88. package/src/components/Form/Form.tsx +0 -243
  89. package/src/components/Form/index.ts +0 -2
  90. package/src/components/Form/v2/Form.hook.ts +0 -341
  91. package/src/components/Form/v2/Form.module.scss +0 -0
  92. package/src/components/Form/v2/Form.tsx +0 -78
  93. package/src/components/Form/v2/Form.types.ts +0 -118
  94. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
  95. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.tsx +0 -73
  96. package/src/components/Form/v2/FormField/Extensions/DateField/index.tsx +0 -2
  97. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
  98. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.tsx +0 -91
  99. package/src/components/Form/v2/FormField/Extensions/PhoneField/index.tsx +0 -2
  100. package/src/components/Form/v2/FormField/FormField.module.scss +0 -0
  101. package/src/components/Form/v2/FormField/FormField.tsx +0 -378
  102. package/src/components/Form/v2/FormField/FormField.types.ts +0 -129
  103. package/src/components/Form/v2/FormField/index.tsx +0 -2
  104. package/src/components/Form/v2/index.tsx +0 -2
  105. package/src/components/Freeze/Freeze.tsx +0 -9
  106. package/src/components/Freeze/index.tsx +0 -2
  107. package/src/components/HSForms/HSForms.tsx +0 -57
  108. package/src/components/HSForms/index.tsx +0 -2
  109. package/src/components/Header/Header.module.scss +0 -119
  110. package/src/components/Header/Header.tsx +0 -138
  111. package/src/components/Header/index.tsx +0 -2
  112. package/src/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +0 -44
  113. package/src/components/HeaderCloseBtn/HeaderCloseBtn.tsx +0 -28
  114. package/src/components/HeaderCloseBtn/index.tsx +0 -2
  115. package/src/components/InfinityScroll/InfinityScroll.module.scss +0 -30
  116. package/src/components/InfinityScroll/InfinityScroll.tsx +0 -187
  117. package/src/components/InfinityScroll/index.tsx +0 -2
  118. package/src/components/Input/Input.module.scss +0 -71
  119. package/src/components/Input/Input.tsx +0 -134
  120. package/src/components/Input/index.tsx +0 -2
  121. package/src/components/InstantCounter/InstantCounter.tsx +0 -77
  122. package/src/components/InstantCounter/index.tsx +0 -2
  123. package/src/components/LavaLamp/LavaLamp.data.tsx +0 -114
  124. package/src/components/LavaLamp/LavaLamp.module.scss +0 -26
  125. package/src/components/LavaLamp/LavaLamp.tsx +0 -131
  126. package/src/components/LavaLamp/index.tsx +0 -2
  127. package/src/components/LavaLamp/v2/LavaLamp.module.scss +0 -23
  128. package/src/components/LavaLamp/v2/LavaLamp.tsx +0 -197
  129. package/src/components/LinkToId/LinkToId.module.scss +0 -4
  130. package/src/components/LinkToId/LinkToId.tsx +0 -51
  131. package/src/components/LinkToId/index.tsx +0 -2
  132. package/src/components/Loader/Loader.module.scss +0 -40
  133. package/src/components/Loader/Loader.tsx +0 -18
  134. package/src/components/Loader/index.tsx +0 -2
  135. package/src/components/LoaderDotsIndicator/LoaderDotsIndicator.tsx +0 -34
  136. package/src/components/LoaderDotsIndicator/index.tsx +0 -2
  137. package/src/components/LoopableVideo/LoopableVideo.tsx +0 -37
  138. package/src/components/LoopableVideo/index.tsx +0 -2
  139. package/src/components/MainGrid/MainGrid.module.scss +0 -28
  140. package/src/components/MainGrid/MainGrid.tsx +0 -68
  141. package/src/components/MainGrid/index.tsx +0 -2
  142. package/src/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +0 -220
  143. package/src/components/MutableHamburgerButton/MutableHamburgerButton.tsx +0 -38
  144. package/src/components/MutableHamburgerButton/index.tsx +0 -2
  145. package/src/components/Notification/Notification.module.scss +0 -25
  146. package/src/components/Notification/Notification.tsx +0 -13
  147. package/src/components/Notification/index.tsx +0 -2
  148. package/src/components/OrderableList/OrderableList.module.scss +0 -98
  149. package/src/components/OrderableList/OrderableList.tsx +0 -564
  150. package/src/components/OrderableList/index.tsx +0 -2
  151. package/src/components/PaginationIndicator/PaginationIndicator.tsx +0 -365
  152. package/src/components/PaginationIndicator/index.tsx +0 -2
  153. package/src/components/Parallax/Parallax.module.scss +0 -28
  154. package/src/components/Parallax/Parallax.tsx +0 -225
  155. package/src/components/Parallax/index.tsx +0 -2
  156. package/src/components/Parallax/math/helpers.ts +0 -289
  157. package/src/components/PasswordInput/PasswordInput.module.scss +0 -17
  158. package/src/components/PasswordInput/PasswordInput.tsx +0 -154
  159. package/src/components/PasswordInput/index.tsx +0 -2
  160. package/src/components/PingPongText/PingPongText.module.scss +0 -4
  161. package/src/components/PingPongText/PingPongText.tsx +0 -83
  162. package/src/components/PingPongText/index.tsx +0 -2
  163. package/src/components/PixelatedScan/PixelatedScan.module.scss +0 -86
  164. package/src/components/PixelatedScan/PixelatedScan.tsx +0 -175
  165. package/src/components/PixelatedScan/index.tsx +0 -2
  166. package/src/components/Portal/Portal.module.scss +0 -3
  167. package/src/components/Portal/Portal.tsx +0 -68
  168. package/src/components/Portal/index.tsx +0 -2
  169. package/src/components/ProgressBar/ProgressBar.module.scss +0 -44
  170. package/src/components/ProgressBar/ProgressBar.tsx +0 -124
  171. package/src/components/ProgressBar/index.tsx +0 -2
  172. package/src/components/ProgressTexts/ProgressTexts.module.scss +0 -37
  173. package/src/components/ProgressTexts/ProgressTexts.tsx +0 -85
  174. package/src/components/ProgressTexts/index.tsx +0 -2
  175. package/src/components/Radio/Radio.module.scss +0 -36
  176. package/src/components/Radio/Radio.tsx +0 -53
  177. package/src/components/Radio/index.tsx +0 -2
  178. package/src/components/SectionContainer/SectionContainer.module.scss +0 -30
  179. package/src/components/SectionContainer/SectionContainer.tsx +0 -49
  180. package/src/components/SectionContainer/index.tsx +0 -2
  181. package/src/components/Select/Select.module.scss +0 -58
  182. package/src/components/Select/Select.tsx +0 -192
  183. package/src/components/Select/index.tsx +0 -2
  184. package/src/components/Skeleton/Skeleton.module.scss +0 -21
  185. package/src/components/Skeleton/Skeleton.tsx +0 -29
  186. package/src/components/Skeleton/index.tsx +0 -2
  187. package/src/components/Spacing/Spacing.module.scss +0 -13
  188. package/src/components/Spacing/Spacing.tsx +0 -24
  189. package/src/components/Spacing/index.tsx +0 -2
  190. package/src/components/StaticScroller/StaticScroller.module.scss +0 -14
  191. package/src/components/StaticScroller/StaticScroller.tsx +0 -83
  192. package/src/components/StaticScroller/index.tsx +0 -2
  193. package/src/components/Switch/Switch.module.scss +0 -43
  194. package/src/components/Switch/Switch.tsx +0 -41
  195. package/src/components/Switch/index.tsx +0 -2
  196. package/src/components/Table/Table.module.scss +0 -76
  197. package/src/components/Table/Table.tsx +0 -152
  198. package/src/components/Table/index.tsx +0 -2
  199. package/src/components/Tabs/Tabs.module.scss +0 -40
  200. package/src/components/Tabs/Tabs.tsx +0 -104
  201. package/src/components/Tabs/index.tsx +0 -2
  202. package/src/components/Text/Text.module.scss +0 -81
  203. package/src/components/Text/Text.tsx +0 -42
  204. package/src/components/Text/index.tsx +0 -2
  205. package/src/components/Transition/MasksFactory/DiagonalReveal.tsx +0 -47
  206. package/src/components/Transition/MasksFactory/DiagonalSquareToBalls.tsx +0 -78
  207. package/src/components/Transition/MasksFactory/PhysicsSquares.tsx +0 -106
  208. package/src/components/Transition/MasksFactory/SquareToBalls.tsx +0 -66
  209. package/src/components/Transition/MasksFactory/utils.ts +0 -35
  210. package/src/components/Transition/Transition.module.scss +0 -211
  211. package/src/components/Transition/Transition.tsx +0 -495
  212. package/src/components/Transition/index.tsx +0 -2
  213. package/src/components/UncontrolledTransition/UncontrolledTransition.ai.md +0 -9
  214. package/src/components/UncontrolledTransition/UncontrolledTransition.sample.tsx +0 -34
  215. package/src/components/UncontrolledTransition/UncontrolledTransition.tsx +0 -143
  216. package/src/components/UncontrolledTransition/index.tsx +0 -2
  217. package/src/components/WalletConnectionWrapper/WalletConnectionWrapper.tsx +0 -212
  218. package/src/components/WalletConnectionWrapper/index.tsx +0 -2
  219. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +0 -5
  220. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.tsx +0 -52
  221. package/src/components/utilitary/ScrollAndFocusLock/index.tsx +0 -2
  222. package/src/context/AsyncProcess.tsx +0 -107
  223. package/src/context/ContextAsyncControl.tsx +0 -89
  224. package/src/context/CustomBrowserRouter.tsx +0 -55
  225. package/src/context/OneUIProvider.tsx +0 -308
  226. package/src/hooks/logs/useDependencyChangeDetection.ts +0 -25
  227. package/src/hooks/logs/useIsMounting.ts +0 -7
  228. package/src/hooks/persistence/useLocalStorage.ts +0 -45
  229. package/src/hooks/shims/ObjectWatchShim.ts +0 -56
  230. package/src/hooks/ui/useAdaptiveImage.tsx +0 -36
  231. package/src/hooks/ui/useAlternating.tsx +0 -22
  232. package/src/hooks/ui/useBreakpoint.tsx +0 -21
  233. package/src/hooks/ui/useCustomScrollbar.module.scss +0 -20
  234. package/src/hooks/ui/useCustomScrollbar.tsx +0 -22
  235. package/src/hooks/ui/useEffectIf.ts +0 -11
  236. package/src/hooks/ui/useMouseHover.tsx +0 -26
  237. package/src/hooks/ui/usePaginationControls.module.scss +0 -16
  238. package/src/hooks/ui/usePaginationControls.tsx +0 -176
  239. package/src/hooks/ui/useSnapToViewport.module.scss +0 -6
  240. package/src/hooks/ui/useSnapToViewport.ts +0 -28
  241. package/src/hooks/ui/useTilt.tsx +0 -219
  242. package/src/hooks/ui/useZoomable.module.scss +0 -34
  243. package/src/hooks/ui/useZoomable.tsx +0 -144
  244. package/src/hooks/useAsyncControl.ai.md +0 -25
  245. package/src/hooks/useAsyncControl.ts +0 -101
  246. package/src/hooks/useContainedRepositioning.ts +0 -110
  247. package/src/hooks/useCustomHistory.ts +0 -14
  248. package/src/hooks/useElementFit.ts +0 -82
  249. package/src/hooks/useFirestoreWatch.ts +0 -54
  250. package/src/hooks/useForm.ts +0 -49
  251. package/src/hooks/useFreeze.ts +0 -12
  252. package/src/hooks/useHero.module.scss +0 -41
  253. package/src/hooks/useHero.ts +0 -512
  254. package/src/hooks/useIntersection.ts +0 -32
  255. package/src/hooks/useMergeRefs.ts +0 -29
  256. package/src/hooks/useObserve.ts +0 -24
  257. package/src/hooks/usePagination.ts +0 -228
  258. package/src/hooks/usePooledOperation.ts +0 -54
  259. package/src/hooks/usePooling.ts +0 -46
  260. package/src/hooks/useRebound.ts +0 -23
  261. package/src/hooks/useShortIntl.ai.md +0 -5
  262. package/src/hooks/useShortIntl.ts +0 -97
  263. package/src/hooks/utility/useAsyncMemo.ts +0 -43
  264. package/src/hooks/utility/useDepChange.ts +0 -11
  265. package/src/hooks/utility/useEvents.ts +0 -33
  266. package/src/hooks/utility/useImmediate.ts +0 -8
  267. package/src/hooks/utility/useManualInit.ts +0 -24
  268. package/src/hooks/utility/useModule.ts +0 -15
  269. package/src/hooks/utility/useQuery.ts +0 -15
  270. package/src/hooks/utility/useUniqueEffect.ts +0 -22
  271. package/src/index.preprocess.ts +0 -82
  272. package/src/index.ts +0 -229
  273. package/src/models/DebugLogger.ts +0 -7
  274. package/src/models/GenericContract.ts +0 -169
  275. package/src/models/Orbs.ts +0 -97
  276. package/src/reac-app-env.d.ts +0 -6
  277. package/src/storybook/assets/video/txt-reversed.mp4 +0 -0
  278. package/src/storybookUtils/index.tsx +0 -53
  279. package/src/test.tsx +0 -0
  280. package/src/type-utils.ts +0 -49
  281. package/src/types.ts +0 -199
  282. package/src/utility.d.ts +0 -70
  283. package/src/utils/blockchain.ts +0 -43
  284. package/src/utils/e2e.ts +0 -55
  285. package/src/utils/flatten.ts +0 -17
  286. package/src/utils/formatters.ts +0 -36
  287. package/src/utils/html.utils.ts +0 -3
  288. package/src/utils/ownEvent.ts +0 -8
  289. package/src/utils/test.ts +0 -20
@@ -1,187 +0,0 @@
1
- import React, {
2
- createRef,
3
- ForwardedRef,
4
- forwardRef,
5
- MutableRefObject,
6
- useEffect,
7
- useLayoutEffect,
8
- useMemo,
9
- useRef,
10
- useState,
11
- } from "react";
12
- import Styles from "./InfinityScroll.module.scss";
13
-
14
- export function shouldIncrementPage(
15
- howMuchTheParentScrolled: number,
16
- prevSectionPosition: number,
17
- nextSectionPosition: number
18
- ): -1 | 0 | 1 {
19
- if (howMuchTheParentScrolled === nextSectionPosition) return 1;
20
- else if (howMuchTheParentScrolled === prevSectionPosition) return -1;
21
- else return 0;
22
- }
23
-
24
- export function keys(currPage: number) {
25
- return [currPage % 3, (currPage + 1) % 3, (currPage + 2) % 3]
26
- .map((a) => `step_${a}`)
27
- .reverse();
28
- }
29
-
30
- export function getItemsFactory<T extends any>(
31
- pageSize: number,
32
- items: T[],
33
- isCountTheSameOrLowerThanPage: boolean
34
- ) {
35
- return function getItems(
36
- page: number,
37
- offset: number,
38
- _pageSize: number = pageSize
39
- ) {
40
- let from = page * _pageSize + offset;
41
- if (from < 0) from = items.length + from;
42
- if (from > items.length) from = from - items.length;
43
- const to = from + _pageSize;
44
- const slicedItems = items.slice(from, to);
45
-
46
- if (slicedItems.length < _pageSize && !isCountTheSameOrLowerThanPage) {
47
- slicedItems.push(...getItems(0, 0, _pageSize - slicedItems.length));
48
- }
49
- return slicedItems.map((i, index) =>
50
- typeof i === "object"
51
- ? {
52
- ...i,
53
- key: index,
54
- }
55
- : i
56
- );
57
- };
58
- }
59
- function _InfinityScroll(
60
- {
61
- items,
62
- pageSize,
63
- initialPage = 0,
64
- pageClass,
65
- className = "",
66
- }: {
67
- items: (React.ReactElement | string)[];
68
- pageSize: number;
69
- initialPage?: number;
70
- pageClass?: string;
71
- className?: string;
72
- },
73
- ref: ForwardedRef<HTMLDivElement>
74
- ) {
75
- const [currPage, setCurrPage] = useState({
76
- page: initialPage,
77
- offset: 0,
78
- });
79
- const parentDiv = useMemo(() => {
80
- return (ref as MutableRefObject<HTMLDivElement | null>) || createRef();
81
- }, [ref]);
82
- const prevDiv = useRef<HTMLDivElement>(null);
83
- const currDiv = useRef<HTMLDivElement>(null);
84
- const nextDiv = useRef<HTMLDivElement>(null);
85
-
86
- const isCountTheSameOrLowerThanPage = items.length <= pageSize;
87
-
88
- const getItems = useMemo(
89
- () => getItemsFactory(pageSize, items, isCountTheSameOrLowerThanPage),
90
- [pageSize, items, isCountTheSameOrLowerThanPage]
91
- );
92
-
93
- useLayoutEffect(() => {
94
- if (isCountTheSameOrLowerThanPage || (window as any).PRERENDER) return;
95
- const viewportWidth = parentDiv.current!.clientWidth;
96
- const centerScroll = parentDiv.current!.scrollWidth / 2;
97
- parentDiv.current!.scrollTo({
98
- left: centerScroll - viewportWidth / 2,
99
- });
100
- }, [isCountTheSameOrLowerThanPage, currPage.page, currPage.offset, items]);
101
- const [beforeKey, currKey, afterKey] = keys(currPage.page);
102
-
103
- return (
104
- <div
105
- ref={parentDiv}
106
- className={`${Styles.container} ${className}`}
107
- data-testid={InfinityDataTestId.ROOT}
108
- onScroll={
109
- !isCountTheSameOrLowerThanPage
110
- ? () => {
111
- const pageToIncrement = shouldIncrementPage(
112
- Math.round(parentDiv.current!.scrollLeft),
113
- prevDiv.current!.offsetLeft,
114
- nextDiv.current!.offsetLeft
115
- );
116
-
117
- if (pageToIncrement) {
118
- setCurrPage((prev) => {
119
- let nextPage = prev.page + pageToIncrement;
120
- let offset = prev.offset;
121
- if (nextPage < 0) {
122
- nextPage = Math.round(items.length / pageSize) - 1;
123
- const finalIndex = (nextPage + 1) * pageSize + offset;
124
- const maxIndex = items.length;
125
- const remainingItems = maxIndex + offset - finalIndex;
126
- offset += remainingItems;
127
- if (offset === -(items.length - 1)) offset = 1;
128
- }
129
- let nextIndex = nextPage * pageSize + offset;
130
- if (nextIndex > items.length) {
131
- offset = nextIndex - items.length;
132
- nextPage = 0;
133
- }
134
- return {
135
- page: nextPage,
136
- offset,
137
- };
138
- });
139
- }
140
- }
141
- : undefined
142
- }
143
- >
144
- {!isCountTheSameOrLowerThanPage && (
145
- <div
146
- key={beforeKey}
147
- className={pageClass}
148
- data-testid={InfinityDataTestId.PREV_PAGE}
149
- ref={prevDiv}
150
- >
151
- {getItems(currPage.page - 1, currPage.offset)}
152
- </div>
153
- )}
154
- <div
155
- key={currKey}
156
- className={pageClass}
157
- data-testid={InfinityDataTestId.CURR_PAGE}
158
- ref={currDiv}
159
- >
160
- {getItems(currPage.page, currPage.offset)}
161
- </div>
162
- {!isCountTheSameOrLowerThanPage && (
163
- <div
164
- key={afterKey}
165
- className={pageClass}
166
- data-testid={InfinityDataTestId.NEXT_PAGE}
167
- ref={nextDiv}
168
- >
169
- {getItems(currPage.page + 1, currPage.offset)}
170
- </div>
171
- )}
172
- </div>
173
- );
174
- }
175
-
176
- /**
177
- * Manages a set of divs that allows the effect of inifinite scrolling between elements
178
- **/
179
- const InfinityScroll = forwardRef(_InfinityScroll);
180
- export default InfinityScroll;
181
-
182
- export enum InfinityDataTestId {
183
- PREV_PAGE = "infinity-prev",
184
- CURR_PAGE = "infinity-curr",
185
- NEXT_PAGE = "infinity-next",
186
- ROOT = "infinity-parent",
187
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./InfinityScroll";
2
- export * from "./InfinityScroll";
@@ -1,71 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- .inputContainer {
4
- position: relative;
5
- display: flex;
6
- font-size: 22px;
7
- line-height: 33px;
8
- .icon {
9
- position: absolute;
10
- top: 1.5px;
11
- right: 1.5px;
12
- min-height: 30px;
13
- min-width: 30px;
14
- cursor: pointer;
15
- user-select: none;
16
- &img {
17
- height: 30px;
18
- width: 30px;
19
- }
20
- }
21
- &.withIcon {
22
- padding-right: 33px;
23
- }
24
- input,
25
- textarea {
26
- border: none;
27
- background-color: transparent;
28
- width: 100%;
29
- font-size: inherit;
30
- line-height: inherit;
31
- font-family: $mainFontFamily;
32
- color: var(--input-text-color, $spaceBlue);
33
- margin-bottom: 18px;
34
- outline: none;
35
- &:placeholder-shown ~ .border {
36
- animation-iteration-count: infinite;
37
- animation-duration: $verySlow;
38
- animation-name: pulse;
39
- animation-delay: $slow;
40
- }
41
- }
42
- & .border {
43
- position: absolute;
44
- left: 0px;
45
- right: 0px;
46
- bottom: 18px;
47
- height: 1px;
48
- background-color: $spaceBlue;
49
- opacity: 0;
50
- }
51
- .caption {
52
- position: absolute;
53
- bottom: 0px;
54
- white-space: nowrap;
55
- text-overflow: ellipsis;
56
- overflow: hidden;
57
- max-width: 100%;
58
- }
59
- }
60
-
61
- @keyframes pulse {
62
- 0% {
63
- opacity: 0;
64
- }
65
- 50% {
66
- opacity: 0.1;
67
- }
68
- 100% {
69
- opacity: 0;
70
- }
71
- }
@@ -1,134 +0,0 @@
1
- import React, {
2
- ChangeEventHandler,
3
- DetailedHTMLProps,
4
- ForwardedRef,
5
- forwardRef,
6
- ReactElement,
7
- useEffect,
8
- useImperativeHandle,
9
- useMemo,
10
- useRef,
11
- useState,
12
- } from "react";
13
- import { useOneUIConfig } from "../../context/OneUIProvider";
14
- import Text from "../Text";
15
- import Styles from "./Input.module.scss";
16
-
17
- export type InputProps = {
18
- decoration?: React.ReactElement | null;
19
- error?: string | ReactElement;
20
- hideError?: "onfocus";
21
- placeholder?: string;
22
- disclaimer?: string | ReactElement;
23
- multiline?: number;
24
- border?: boolean;
25
- icon?: {
26
- onClick?: () => void;
27
- } & DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, any>;
28
- Icon?: React.ReactElement;
29
- onChange?: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
30
- containerProps?: Omit<React.HTMLProps<HTMLDivElement>, "ref">;
31
- value?: string;
32
- 'data-testid'?: string;
33
- } & Omit<
34
- React.HTMLProps<HTMLInputElement | HTMLTextAreaElement>,
35
- "ref" | "onChange" | 'value'
36
- >;
37
- function _Input(
38
- {
39
- error,
40
- placeholder = " ",
41
- hideError,
42
- icon,
43
- Icon,
44
- autoFocus,
45
- disclaimer,
46
- multiline,
47
- decoration = null,
48
- border: propBorder,
49
- containerProps,
50
- className: localClassName,
51
- ...otherProps
52
- }: InputProps,
53
- ref: ForwardedRef<any>
54
- ) {
55
- const className = useOneUIConfig("component.input.className");
56
- const globalBorder = useOneUIConfig("component.input.border");
57
- const [focused, setFocused] = useState(false);
58
- const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);
59
- useImperativeHandle(ref, () => inputRef.current, []);
60
- const shouldShowError = useMemo(() => {
61
- if (hideError === "onfocus") return !focused;
62
- return !!error;
63
- }, [focused, error, hideError]);
64
- useEffect(() => {
65
- if (autoFocus) {
66
- const t = setTimeout(() => {
67
- inputRef.current!.focus();
68
- }, 500);
69
- return () => clearTimeout(t);
70
- }
71
- }, [autoFocus]);
72
- const Component = multiline ? "textarea" : "input";
73
- const withBorder = useMemo(() => {
74
- if (propBorder !== undefined) return propBorder;
75
- return globalBorder;
76
- }, [propBorder, globalBorder]);
77
- return (
78
- <div
79
- className={`${Styles.inputContainer} ${
80
- false ? Styles.withIcon : ""
81
- } ${className} ${localClassName}`}
82
- {...containerProps}
83
- >
84
- {decoration}
85
- <Component
86
- ref={inputRef as any}
87
- placeholder={placeholder}
88
- rows={multiline}
89
- {...otherProps}
90
- onFocus={(e) => {
91
- setFocused(true);
92
- if (otherProps.onFocus) otherProps.onFocus(e);
93
- }}
94
- onBlur={(e) => {
95
- setFocused(false);
96
- if (otherProps.onBlur) otherProps.onBlur(e);
97
- }}
98
- />
99
- {withBorder && <div className={Styles.border} />}
100
- {error && shouldShowError ? (
101
- <Text
102
- title={typeof error === "string" ? error : ""}
103
- data-testid={InputTestIds.ERROR}
104
- className={Styles.caption}
105
- type="error"
106
- >
107
- {error}
108
- </Text>
109
- ) : disclaimer ? (
110
- <Text
111
- title={typeof disclaimer === "string" ? disclaimer : ""}
112
- type="caption"
113
- className={Styles.caption}
114
- data-testid={InputTestIds.DISCLAIMER}
115
- >
116
- {disclaimer}
117
- </Text>
118
- ) : null}
119
- {Icon && <div className={Styles.icon}>{Icon}</div>}
120
- {icon && <img className={Styles.icon} {...icon} />}
121
- </div>
122
- );
123
- }
124
-
125
- export enum InputTestIds {
126
- DISCLAIMER = "disclaimer",
127
- ERROR = "error",
128
- }
129
-
130
- /**
131
- * A transparent input with some prebuilt states common to the application
132
- **/
133
- const Input = forwardRef(_Input);
134
- export default Input;
@@ -1,2 +0,0 @@
1
- export { default } from "./Input";
2
- export * from "./Input";
@@ -1,77 +0,0 @@
1
- import React, {
2
- ForwardedRef,
3
- forwardRef,
4
- useEffect,
5
- useImperativeHandle,
6
- useRef,
7
- useState,
8
- } from "react";
9
- import { FormatNumberOptions, useIntl } from "react-intl";
10
-
11
- function _InstantCounter(
12
- {
13
- from = 0,
14
- to,
15
- framesPerSecond = 30,
16
- durationInSeconds,
17
- formatOptions = {},
18
- autoStart = true,
19
- }: {
20
- from?: number;
21
- to: number;
22
- framesPerSecond?: number; //Usefull for testing
23
- durationInSeconds: number;
24
- formatOptions?: FormatNumberOptions;
25
- autoStart?: boolean;
26
- },
27
- ref: ForwardedRef<{ start: () => void }>
28
- ) {
29
- const [started, setStarted] = useState(autoStart);
30
- const initialValue = useRef<number>(from);
31
- const spanRef = useRef<HTMLSpanElement>(null);
32
- const { formatNumber } = useIntl();
33
-
34
- useImperativeHandle(
35
- ref,
36
- () => ({
37
- start: () => setStarted(true),
38
- }),
39
- []
40
- );
41
-
42
- useEffect(() => {
43
- if (started) {
44
- const incrementBy =
45
- (to - initialValue.current) / (framesPerSecond * durationInSeconds);
46
- spanRef.current!.innerHTML = formatNumber(
47
- initialValue.current!,
48
- formatOptions
49
- );
50
-
51
- const intervalId = setInterval(() => {
52
- initialValue.current! += incrementBy;
53
- spanRef.current!.innerHTML = formatNumber(
54
- initialValue.current!,
55
- formatOptions
56
- );
57
- if (Math.round(initialValue.current) === Math.round(to)) {
58
- clearInterval(intervalId);
59
- }
60
- }, 1000 / framesPerSecond);
61
- return () => {
62
- clearInterval(intervalId);
63
- };
64
- }
65
- }, [started, to]);
66
- return (
67
- <>
68
- <span ref={spanRef} />
69
- </>
70
- );
71
- }
72
-
73
- /**
74
- * Increments the numbers from 0 to the provided value
75
- **/
76
- const InstantCounter = forwardRef(_InstantCounter);
77
- export default InstantCounter;
@@ -1,2 +0,0 @@
1
- export { default } from "./InstantCounter";
2
- export * from "./InstantCounter";
@@ -1,114 +0,0 @@
1
- import { throttle as t } from "lodash";
2
- import { useEffect, useMemo, useRef, useState } from "react";
3
- import { useTiltUpdates } from "../../hooks/ui/useTilt";
4
- import Styles from "./LavaLamp.module.scss";
5
-
6
- const transitionMs = Number(Styles.transitionMs);
7
- export const transitionPositionMs = Number(Styles.transitionPositionMs);
8
-
9
- export default function useLavaLampSetup(
10
- onUpdatePosition: (x: number, y: number) => void,
11
- onUpdateSize: (size: number) => void
12
- ) {
13
- const [d, setDim] = useState<{ width: number; height: number }>();
14
- const relativeTo = useRef<HTMLDivElement>(null);
15
-
16
- const prevTilt = useRef<{ x: number; y: number }>(undefined);
17
-
18
- useEffect(() => {
19
- const baseWidth = Math.min(relativeTo.current!.clientWidth, 1440);
20
- setDim({
21
- width: baseWidth,
22
- height:
23
- baseWidth *
24
- (relativeTo.current!.clientHeight / relativeTo.current!.clientWidth),
25
- });
26
- }, []);
27
-
28
- const updateTiltCb = useMemo(() => {
29
- const throttlePosition = t;
30
- if (!d) return () => {};
31
- const baseSize = Math.min(d.width, d.height) * 0.1;
32
- let acceleration = t(
33
- (currTilt: { x: number; y: number }) => {
34
- if (!prevTilt.current) {
35
- prevTilt.current = currTilt;
36
- return;
37
- }
38
-
39
- const diff = {
40
- x: Math.abs(prevTilt.current.x - currTilt.x),
41
- y: Math.abs(prevTilt.current.y - currTilt.y),
42
- };
43
-
44
- const baseDiff = Math.max(diff.x, diff.y);
45
- const percent = (baseDiff * 100) / 90;
46
-
47
- onUpdateSize(baseSize + baseSize * (percent / 100));
48
-
49
- prevTilt.current = currTilt!;
50
- },
51
- transitionMs,
52
- {
53
- leading: false,
54
- trailing: true,
55
- }
56
- );
57
- let movement = throttlePosition(
58
- (currTilt: { x: number; y: number }) => {
59
- const [x, y] = [currTilt.x + 100, currTilt.y + 100];
60
- const [cx, cy] = [(d!.width * x) / 200, (d!.height * y) / 200];
61
- onUpdatePosition(cx, cy);
62
- },
63
- transitionPositionMs,
64
- {
65
- leading: false,
66
- trailing: true,
67
- }
68
- );
69
- return (tilt: NonNullable<typeof prevTilt.current>) => {
70
- if (!d) return;
71
- acceleration(tilt);
72
- movement(tilt);
73
- };
74
- }, [d]);
75
- useTiltUpdates(
76
- true,
77
- relativeTo,
78
- updateTiltCb,
79
- undefined,
80
- undefined,
81
- undefined,
82
- {
83
- round: false,
84
- gyroEnabled: false,
85
- }
86
- );
87
- const circlesConfig = useMemo(() => {
88
- if (!d) return [];
89
- const baseSize = Math.min(d.width, d.height) * 0.15;
90
- return new Array(10).fill(undefined).map((_, i) => {
91
- const mod = i % 2;
92
- const startX =
93
- Math.random() * d.width * 0.5 + (mod === 0 ? 0 : d.width * 0.5);
94
- const translateX = startX - (startX + 50 + Math.random() * 200);
95
- const startY =
96
- Math.random() * d.height * 0.75 + (mod === 0 ? 0 : d.height * 0.25);
97
- const translateY = startY - (startY + 50 + Math.random() * 200);
98
-
99
- return {
100
- baseSize,
101
- startX,
102
- startY,
103
- translateX,
104
- translateY,
105
- };
106
- });
107
- }, [d]);
108
-
109
- return {
110
- relativeTo,
111
- d,
112
- circlesConfig,
113
- };
114
- }
@@ -1,26 +0,0 @@
1
- @use 'sass:math';
2
-
3
- $transitionMs: math.div(1000, 5);
4
- $transitionPositionMs: math.div($transitionMs, 2);
5
- @value transitionMs #{$transitionMs};
6
- @value transitionPositionMs #{$transitionPositionMs};
7
-
8
- .root {
9
- position: relative;
10
- svg.effect {
11
- position: absolute;
12
- top: 0;
13
- left: 0;
14
- bottom: 0;
15
- right: 0;
16
- circle {
17
- will-change: r, cx, cy;
18
- transition: r #{$transitionMs}ms linear,
19
- cx #{$transitionPositionMs}ms linear,
20
- cy #{$transitionPositionMs}ms linear;
21
- }
22
- }
23
- > div {
24
- z-index: 1;
25
- }
26
- }