@onepercentio/one-ui 0.29.4 → 0.29.6

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 (294) hide show
  1. package/dist/components/Portal/Portal.d.ts +5 -0
  2. package/dist/components/Portal/Portal.js +6 -1
  3. package/dist/components/Switch/Switch.d.ts +1 -1
  4. package/dist/components/Switch/Switch.js +1 -1
  5. package/dist/utils/e2e.d.ts +1 -1
  6. package/dist/utils/e2e.js +1 -1
  7. package/dist-ts/components/Portal/Portal.d.ts +5 -0
  8. package/dist-ts/components/Portal/Portal.js +5 -0
  9. package/dist-ts/components/Portal/Portal.js.map +1 -1
  10. package/dist-ts/components/Switch/Switch.d.ts +1 -1
  11. package/dist-ts/utils/e2e.d.ts +1 -1
  12. package/package.json +1 -1
  13. package/src/assets/img/svg/checkbox.svg +0 -3
  14. package/src/assets/styles/index.scss +0 -2
  15. package/src/assets/styles/mixins.scss +0 -12
  16. package/src/assets/styles/variables.scss +0 -49
  17. package/src/components/AdaptiveButton/AdaptiveButton.module.scss +0 -7
  18. package/src/components/AdaptiveButton/AdaptiveButton.tsx +0 -26
  19. package/src/components/AdaptiveButton/index.tsx +0 -2
  20. package/src/components/AdaptiveContainer/AdaptiveContainer.module.scss +0 -53
  21. package/src/components/AdaptiveContainer/AdaptiveContainer.tsx +0 -200
  22. package/src/components/AdaptiveContainer/index.tsx +0 -2
  23. package/src/components/AdaptiveDialog/AdaptiveDialog.module.scss +0 -147
  24. package/src/components/AdaptiveDialog/AdaptiveDialog.tsx +0 -97
  25. package/src/components/AdaptiveDialog/index.tsx +0 -2
  26. package/src/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +0 -49
  27. package/src/components/AdaptiveSidebar/AdaptiveSidebar.sample.tsx +0 -10
  28. package/src/components/AdaptiveSidebar/AdaptiveSidebar.tsx +0 -123
  29. package/src/components/AdaptiveSidebar/index.tsx +0 -2
  30. package/src/components/AnchoredTooltip/AnchoredTooltip.module.scss +0 -64
  31. package/src/components/AnchoredTooltip/AnchoredTooltip.tsx +0 -250
  32. package/src/components/AnchoredTooltip/index.tsx +0 -2
  33. package/src/components/AnimatedEntrance/AnimatedEntrance.module.scss +0 -108
  34. package/src/components/AnimatedEntrance/AnimatedEntrance.tsx +0 -227
  35. package/src/components/AnimatedEntrance/index.tsx +0 -2
  36. package/src/components/AsyncWrapper/AsyncWrapper.tsx +0 -38
  37. package/src/components/AsyncWrapper/index.tsx +0 -2
  38. package/src/components/Avatar/Avatar.module.scss +0 -22
  39. package/src/components/Avatar/Avatar.tsx +0 -31
  40. package/src/components/Avatar/index.tsx +0 -2
  41. package/src/components/BucketFill/BucketFill.module.scss +0 -36
  42. package/src/components/BucketFill/BucketFill.tsx +0 -65
  43. package/src/components/BucketFill/index.tsx +0 -2
  44. package/src/components/Button/Button.module.scss +0 -45
  45. package/src/components/Button/Button.tsx +0 -40
  46. package/src/components/Button/index.tsx +0 -2
  47. package/src/components/Card/Card.module.scss +0 -12
  48. package/src/components/Card/Card.tsx +0 -9
  49. package/src/components/Card/index.tsx +0 -2
  50. package/src/components/Chart/Chart.e2e.ts +0 -4
  51. package/src/components/Chart/Chart.logic.tsx +0 -8
  52. package/src/components/Chart/Chart.module.scss +0 -58
  53. package/src/components/Chart/Chart.tsx +0 -2
  54. package/src/components/Chart/Chart.types.ts +0 -35
  55. package/src/components/Chart/Chart.view.tsx +0 -241
  56. package/src/components/Chart/index.tsx +0 -2
  57. package/src/components/CheckBox/CheckBox.module.scss +0 -36
  58. package/src/components/CheckBox/CheckBox.tsx +0 -63
  59. package/src/components/CheckBox/index.tsx +0 -2
  60. package/src/components/CodeInput/CodeInput.module.scss +0 -5
  61. package/src/components/CodeInput/CodeInput.tsx +0 -84
  62. package/src/components/CodeInput/index.tsx +0 -2
  63. package/src/components/Collapsable/Collapsable.module.scss +0 -42
  64. package/src/components/Collapsable/Collapsable.tsx +0 -253
  65. package/src/components/Collapsable/index.tsx +0 -2
  66. package/src/components/Countdown/Countdown.tsx +0 -130
  67. package/src/components/Countdown/index.tsx +0 -2
  68. package/src/components/CurrencyInput/CurrencyInput.hook.ts +0 -37
  69. package/src/components/CurrencyInput/CurrencyInput.tsx +0 -25
  70. package/src/components/CurrencyInput/index.tsx +0 -2
  71. package/src/components/Divider/Divider.module.scss +0 -7
  72. package/src/components/Divider/Divider.tsx +0 -13
  73. package/src/components/Divider/index.tsx +0 -2
  74. package/src/components/EmailInput/EmailInput.module.scss +0 -0
  75. package/src/components/EmailInput/EmailInput.tsx +0 -51
  76. package/src/components/EmailInput/index.tsx +0 -2
  77. package/src/components/FadeIn/FadeIn.module.scss +0 -9
  78. package/src/components/FadeIn/FadeIn.tsx +0 -77
  79. package/src/components/FadeIn/index.tsx +0 -2
  80. package/src/components/FileInput/FileInput.module.scss +0 -6
  81. package/src/components/FileInput/FileInput.tsx +0 -75
  82. package/src/components/FileInput/View/BigFactory/BigFactory.module.scss +0 -20
  83. package/src/components/FileInput/View/BigFactory/BigFactory.tsx +0 -48
  84. package/src/components/FileInput/View/BigFactory/index.tsx +0 -2
  85. package/src/components/FileInput/View/Compact/Compact.module.scss +0 -68
  86. package/src/components/FileInput/View/Compact/Compact.tsx +0 -151
  87. package/src/components/FileInput/View/Compact/index.tsx +0 -2
  88. package/src/components/FileInput/View/View.types.ts +0 -12
  89. package/src/components/FileInput/index.tsx +0 -2
  90. package/src/components/FlowController/FlowController.module.scss +0 -47
  91. package/src/components/FlowController/FlowController.tsx +0 -93
  92. package/src/components/FlowController/index.tsx +0 -2
  93. package/src/components/Form/Form.tsx +0 -243
  94. package/src/components/Form/index.ts +0 -2
  95. package/src/components/Form/v2/Form.hook.ts +0 -341
  96. package/src/components/Form/v2/Form.module.scss +0 -0
  97. package/src/components/Form/v2/Form.tsx +0 -78
  98. package/src/components/Form/v2/Form.types.ts +0 -118
  99. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
  100. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.tsx +0 -73
  101. package/src/components/Form/v2/FormField/Extensions/DateField/index.tsx +0 -2
  102. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
  103. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.tsx +0 -91
  104. package/src/components/Form/v2/FormField/Extensions/PhoneField/index.tsx +0 -2
  105. package/src/components/Form/v2/FormField/FormField.module.scss +0 -0
  106. package/src/components/Form/v2/FormField/FormField.tsx +0 -378
  107. package/src/components/Form/v2/FormField/FormField.types.ts +0 -129
  108. package/src/components/Form/v2/FormField/index.tsx +0 -2
  109. package/src/components/Form/v2/index.tsx +0 -2
  110. package/src/components/Freeze/Freeze.tsx +0 -9
  111. package/src/components/Freeze/index.tsx +0 -2
  112. package/src/components/HSForms/HSForms.tsx +0 -57
  113. package/src/components/HSForms/index.tsx +0 -2
  114. package/src/components/Header/Header.module.scss +0 -119
  115. package/src/components/Header/Header.tsx +0 -138
  116. package/src/components/Header/index.tsx +0 -2
  117. package/src/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +0 -44
  118. package/src/components/HeaderCloseBtn/HeaderCloseBtn.tsx +0 -28
  119. package/src/components/HeaderCloseBtn/index.tsx +0 -2
  120. package/src/components/InfinityScroll/InfinityScroll.module.scss +0 -30
  121. package/src/components/InfinityScroll/InfinityScroll.tsx +0 -187
  122. package/src/components/InfinityScroll/index.tsx +0 -2
  123. package/src/components/Input/Input.module.scss +0 -71
  124. package/src/components/Input/Input.tsx +0 -134
  125. package/src/components/Input/index.tsx +0 -2
  126. package/src/components/InstantCounter/InstantCounter.tsx +0 -77
  127. package/src/components/InstantCounter/index.tsx +0 -2
  128. package/src/components/LavaLamp/LavaLamp.data.tsx +0 -114
  129. package/src/components/LavaLamp/LavaLamp.module.scss +0 -26
  130. package/src/components/LavaLamp/LavaLamp.tsx +0 -131
  131. package/src/components/LavaLamp/index.tsx +0 -2
  132. package/src/components/LavaLamp/v2/LavaLamp.module.scss +0 -23
  133. package/src/components/LavaLamp/v2/LavaLamp.tsx +0 -197
  134. package/src/components/LinkToId/LinkToId.module.scss +0 -4
  135. package/src/components/LinkToId/LinkToId.tsx +0 -51
  136. package/src/components/LinkToId/index.tsx +0 -2
  137. package/src/components/Loader/Loader.module.scss +0 -40
  138. package/src/components/Loader/Loader.tsx +0 -18
  139. package/src/components/Loader/index.tsx +0 -2
  140. package/src/components/LoaderDotsIndicator/LoaderDotsIndicator.tsx +0 -34
  141. package/src/components/LoaderDotsIndicator/index.tsx +0 -2
  142. package/src/components/LoopableVideo/LoopableVideo.tsx +0 -37
  143. package/src/components/LoopableVideo/index.tsx +0 -2
  144. package/src/components/MainGrid/MainGrid.module.scss +0 -28
  145. package/src/components/MainGrid/MainGrid.tsx +0 -68
  146. package/src/components/MainGrid/index.tsx +0 -2
  147. package/src/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +0 -220
  148. package/src/components/MutableHamburgerButton/MutableHamburgerButton.tsx +0 -38
  149. package/src/components/MutableHamburgerButton/index.tsx +0 -2
  150. package/src/components/Notification/Notification.module.scss +0 -25
  151. package/src/components/Notification/Notification.tsx +0 -13
  152. package/src/components/Notification/index.tsx +0 -2
  153. package/src/components/OrderableList/OrderableList.module.scss +0 -98
  154. package/src/components/OrderableList/OrderableList.tsx +0 -564
  155. package/src/components/OrderableList/index.tsx +0 -2
  156. package/src/components/PaginationIndicator/PaginationIndicator.tsx +0 -365
  157. package/src/components/PaginationIndicator/index.tsx +0 -2
  158. package/src/components/Parallax/Parallax.module.scss +0 -28
  159. package/src/components/Parallax/Parallax.tsx +0 -225
  160. package/src/components/Parallax/index.tsx +0 -2
  161. package/src/components/Parallax/math/helpers.ts +0 -289
  162. package/src/components/PasswordInput/PasswordInput.module.scss +0 -17
  163. package/src/components/PasswordInput/PasswordInput.tsx +0 -154
  164. package/src/components/PasswordInput/index.tsx +0 -2
  165. package/src/components/PingPongText/PingPongText.module.scss +0 -4
  166. package/src/components/PingPongText/PingPongText.tsx +0 -83
  167. package/src/components/PingPongText/index.tsx +0 -2
  168. package/src/components/PixelatedScan/PixelatedScan.module.scss +0 -86
  169. package/src/components/PixelatedScan/PixelatedScan.tsx +0 -175
  170. package/src/components/PixelatedScan/index.tsx +0 -2
  171. package/src/components/Portal/Portal.module.scss +0 -3
  172. package/src/components/Portal/Portal.tsx +0 -68
  173. package/src/components/Portal/index.tsx +0 -2
  174. package/src/components/ProgressBar/ProgressBar.module.scss +0 -44
  175. package/src/components/ProgressBar/ProgressBar.tsx +0 -124
  176. package/src/components/ProgressBar/index.tsx +0 -2
  177. package/src/components/ProgressTexts/ProgressTexts.module.scss +0 -37
  178. package/src/components/ProgressTexts/ProgressTexts.tsx +0 -85
  179. package/src/components/ProgressTexts/index.tsx +0 -2
  180. package/src/components/Radio/Radio.module.scss +0 -36
  181. package/src/components/Radio/Radio.tsx +0 -53
  182. package/src/components/Radio/index.tsx +0 -2
  183. package/src/components/SectionContainer/SectionContainer.module.scss +0 -30
  184. package/src/components/SectionContainer/SectionContainer.tsx +0 -49
  185. package/src/components/SectionContainer/index.tsx +0 -2
  186. package/src/components/Select/Select.module.scss +0 -58
  187. package/src/components/Select/Select.tsx +0 -192
  188. package/src/components/Select/index.tsx +0 -2
  189. package/src/components/Skeleton/Skeleton.module.scss +0 -21
  190. package/src/components/Skeleton/Skeleton.tsx +0 -29
  191. package/src/components/Skeleton/index.tsx +0 -2
  192. package/src/components/Spacing/Spacing.module.scss +0 -13
  193. package/src/components/Spacing/Spacing.tsx +0 -24
  194. package/src/components/Spacing/index.tsx +0 -2
  195. package/src/components/StaticScroller/StaticScroller.module.scss +0 -14
  196. package/src/components/StaticScroller/StaticScroller.tsx +0 -83
  197. package/src/components/StaticScroller/index.tsx +0 -2
  198. package/src/components/Switch/Switch.module.scss +0 -43
  199. package/src/components/Switch/Switch.tsx +0 -41
  200. package/src/components/Switch/index.tsx +0 -2
  201. package/src/components/Table/Table.module.scss +0 -76
  202. package/src/components/Table/Table.tsx +0 -152
  203. package/src/components/Table/index.tsx +0 -2
  204. package/src/components/Tabs/Tabs.module.scss +0 -40
  205. package/src/components/Tabs/Tabs.tsx +0 -104
  206. package/src/components/Tabs/index.tsx +0 -2
  207. package/src/components/Text/Text.module.scss +0 -81
  208. package/src/components/Text/Text.tsx +0 -42
  209. package/src/components/Text/index.tsx +0 -2
  210. package/src/components/Transition/MasksFactory/DiagonalReveal.tsx +0 -47
  211. package/src/components/Transition/MasksFactory/DiagonalSquareToBalls.tsx +0 -78
  212. package/src/components/Transition/MasksFactory/PhysicsSquares.tsx +0 -106
  213. package/src/components/Transition/MasksFactory/SquareToBalls.tsx +0 -66
  214. package/src/components/Transition/MasksFactory/utils.ts +0 -35
  215. package/src/components/Transition/Transition.module.scss +0 -211
  216. package/src/components/Transition/Transition.tsx +0 -495
  217. package/src/components/Transition/index.tsx +0 -2
  218. package/src/components/UncontrolledTransition/UncontrolledTransition.ai.md +0 -9
  219. package/src/components/UncontrolledTransition/UncontrolledTransition.sample.tsx +0 -34
  220. package/src/components/UncontrolledTransition/UncontrolledTransition.tsx +0 -143
  221. package/src/components/UncontrolledTransition/index.tsx +0 -2
  222. package/src/components/WalletConnectionWrapper/WalletConnectionWrapper.tsx +0 -212
  223. package/src/components/WalletConnectionWrapper/index.tsx +0 -2
  224. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +0 -5
  225. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.tsx +0 -52
  226. package/src/components/utilitary/ScrollAndFocusLock/index.tsx +0 -2
  227. package/src/context/AsyncProcess.tsx +0 -107
  228. package/src/context/ContextAsyncControl.tsx +0 -89
  229. package/src/context/CustomBrowserRouter.tsx +0 -55
  230. package/src/context/OneUIProvider.tsx +0 -308
  231. package/src/hooks/logs/useDependencyChangeDetection.ts +0 -25
  232. package/src/hooks/logs/useIsMounting.ts +0 -7
  233. package/src/hooks/persistence/useLocalStorage.ts +0 -45
  234. package/src/hooks/shims/ObjectWatchShim.ts +0 -56
  235. package/src/hooks/ui/useAdaptiveImage.tsx +0 -36
  236. package/src/hooks/ui/useAlternating.tsx +0 -22
  237. package/src/hooks/ui/useBreakpoint.tsx +0 -21
  238. package/src/hooks/ui/useCustomScrollbar.module.scss +0 -20
  239. package/src/hooks/ui/useCustomScrollbar.tsx +0 -22
  240. package/src/hooks/ui/useEffectIf.ts +0 -11
  241. package/src/hooks/ui/useMouseHover.tsx +0 -26
  242. package/src/hooks/ui/usePaginationControls.module.scss +0 -16
  243. package/src/hooks/ui/usePaginationControls.tsx +0 -176
  244. package/src/hooks/ui/useSnapToViewport.module.scss +0 -6
  245. package/src/hooks/ui/useSnapToViewport.ts +0 -28
  246. package/src/hooks/ui/useTilt.tsx +0 -219
  247. package/src/hooks/ui/useZoomable.module.scss +0 -34
  248. package/src/hooks/ui/useZoomable.tsx +0 -144
  249. package/src/hooks/useAsyncControl.ai.md +0 -25
  250. package/src/hooks/useAsyncControl.ts +0 -101
  251. package/src/hooks/useContainedRepositioning.ts +0 -110
  252. package/src/hooks/useCustomHistory.ts +0 -14
  253. package/src/hooks/useElementFit.ts +0 -82
  254. package/src/hooks/useFirestoreWatch.ts +0 -54
  255. package/src/hooks/useForm.ts +0 -49
  256. package/src/hooks/useFreeze.ts +0 -12
  257. package/src/hooks/useHero.module.scss +0 -41
  258. package/src/hooks/useHero.ts +0 -514
  259. package/src/hooks/useIntersection.ts +0 -32
  260. package/src/hooks/useMergeRefs.ts +0 -29
  261. package/src/hooks/useObserve.ts +0 -24
  262. package/src/hooks/usePagination.ts +0 -228
  263. package/src/hooks/usePooledOperation.ts +0 -54
  264. package/src/hooks/usePooling.ts +0 -46
  265. package/src/hooks/useRebound.ts +0 -23
  266. package/src/hooks/useShortIntl.ai.md +0 -5
  267. package/src/hooks/useShortIntl.ts +0 -97
  268. package/src/hooks/utility/useAsyncMemo.ts +0 -43
  269. package/src/hooks/utility/useDepChange.ts +0 -11
  270. package/src/hooks/utility/useEvents.ts +0 -33
  271. package/src/hooks/utility/useImmediate.ts +0 -8
  272. package/src/hooks/utility/useManualInit.ts +0 -24
  273. package/src/hooks/utility/useModule.ts +0 -15
  274. package/src/hooks/utility/useQuery.ts +0 -15
  275. package/src/hooks/utility/useUniqueEffect.ts +0 -22
  276. package/src/index.preprocess.ts +0 -82
  277. package/src/index.ts +0 -229
  278. package/src/models/DebugLogger.ts +0 -7
  279. package/src/models/GenericContract.ts +0 -169
  280. package/src/models/Orbs.ts +0 -97
  281. package/src/reac-app-env.d.ts +0 -6
  282. package/src/storybook/assets/video/txt-reversed.mp4 +0 -0
  283. package/src/storybookUtils/index.tsx +0 -53
  284. package/src/test.tsx +0 -0
  285. package/src/type-utils.ts +0 -49
  286. package/src/types.ts +0 -199
  287. package/src/utility.d.ts +0 -70
  288. package/src/utils/blockchain.ts +0 -43
  289. package/src/utils/e2e.ts +0 -55
  290. package/src/utils/flatten.ts +0 -17
  291. package/src/utils/formatters.ts +0 -36
  292. package/src/utils/html.utils.ts +0 -3
  293. package/src/utils/ownEvent.ts +0 -8
  294. package/src/utils/test.ts +0 -20
@@ -1,77 +0,0 @@
1
- import React, {
2
- createRef,
3
- ForwardedRef,
4
- forwardRef,
5
- PropsWithChildren,
6
- RefObject,
7
- SyntheticEvent,
8
- useEffect,
9
- useRef,
10
- useState,
11
- } from "react";
12
- import Styles from "./FadeIn.module.scss";
13
-
14
- type FadeInProps = PropsWithChildren<{
15
- className?: string;
16
- active?: boolean;
17
- onClick?: (e: SyntheticEvent<HTMLDivElement>) => void;
18
- onHidden?: () => void;
19
- "data-testid"?: string;
20
- style?: any;
21
- }>;
22
- function _FadeIn(
23
- {
24
- onHidden,
25
- children,
26
- className = "",
27
- active,
28
- onClick,
29
- ...props
30
- }: FadeInProps,
31
- divRef: ForwardedRef<HTMLDivElement>
32
- ) {
33
- if (!divRef) {
34
- divRef = createRef();
35
- }
36
- const [, trigger] = useState(0);
37
- const prevChildren = useRef<typeof children>(undefined);
38
- prevChildren.current = children || prevChildren.current;
39
-
40
- useEffect(() => {
41
- const el = (divRef as RefObject<HTMLDivElement>).current!;
42
- const isElHidden = active !== undefined ? !active : !children;
43
-
44
- if (isElHidden) {
45
- el.classList.remove(Styles.active);
46
- const handler = () => {
47
- prevChildren.current = null;
48
- trigger((a) => a + 1);
49
- if (onHidden && !el.classList.contains(Styles.active)) onHidden();
50
- };
51
- el.addEventListener("transitionend", handler);
52
- return () => {
53
- el.removeEventListener("transitionend", handler);
54
- };
55
- } else {
56
- setTimeout(() => {
57
- el.classList.add(Styles.active);
58
- }, 0);
59
- }
60
- }, [children, active]);
61
- return (
62
- <div
63
- ref={divRef}
64
- className={`${Styles.container} ${className}`}
65
- onClick={onClick}
66
- {...props}
67
- >
68
- {prevChildren.current}
69
- </div>
70
- );
71
- }
72
-
73
- /**
74
- * Receives a children and displays it with a fade in animation, also when it's removed, it hides with a fadeout
75
- **/
76
- const FadeIn = forwardRef<HTMLDivElement, FadeInProps>(_FadeIn);
77
- export default FadeIn;
@@ -1,2 +0,0 @@
1
- export { default } from "./FadeIn";
2
- export * from "./FadeIn";
@@ -1,6 +0,0 @@
1
- .hidden {
2
- width: 0px;
3
- height: 0px;
4
- position: fixed;
5
- opacity: 0.01;
6
- }
@@ -1,75 +0,0 @@
1
- import React, {
2
- ChangeEventHandler,
3
- ReactElement,
4
- useCallback,
5
- useRef,
6
- } from "react";
7
- import { useOneUIView } from "../../context/OneUIProvider";
8
- import Styles from "./FileInput.module.scss";
9
-
10
- export type FileInputProps = {
11
- states: {
12
- waitingFile: {
13
- /** The reason why this file is being requested */
14
- title: string | ReactElement;
15
- /** Shown below the title */
16
- description?: string;
17
- /** The label to show on the button */
18
- button?: string;
19
- };
20
- fileProvided: {
21
- /** Text show when the file has been provided */
22
- title: string | ReactElement;
23
- /** Shown below the title */
24
- description?: string;
25
- /** Shown on the button to remove the file */
26
- button?: string;
27
- };
28
- };
29
- footer: string;
30
- file?: File;
31
- onFile: (file: File | undefined) => void;
32
- progress?: number;
33
- disabled?: boolean;
34
- } & React.HTMLProps<HTMLInputElement>;
35
-
36
- /**
37
- * A component to provide the upload of a file
38
- **/
39
- function FileInput({ onFile, ...props }: FileInputProps) {
40
- const View = useOneUIView("component.fileInput.View", "FileInput");
41
- const inputRef = useRef<HTMLInputElement>(null);
42
-
43
- const onFileSelected = useCallback(
44
- ((e) => {
45
- const file = e.target.files!.item(0);
46
- onFile(file || undefined);
47
- }) as ChangeEventHandler<HTMLInputElement>,
48
- []
49
- );
50
-
51
- return (
52
- <View
53
- {...props}
54
- onAction={() => {
55
- if (props.file) {
56
- inputRef.current!.value = "";
57
- onFile(undefined);
58
- } else {
59
- inputRef.current!.click();
60
- }
61
- }}
62
- inputEl={
63
- <input
64
- {...props}
65
- ref={inputRef}
66
- onChange={onFileSelected}
67
- type={"file"}
68
- className={Styles.hidden}
69
- />
70
- }
71
- />
72
- );
73
- }
74
-
75
- export default FileInput;
@@ -1,20 +0,0 @@
1
- @import "../../../../assets/styles/index.scss";
2
-
3
- .container {
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
7
- flex-direction: column;
8
- background-color: $fileInputBackgroundColor;
9
- padding: 72px;
10
- border: 1px solid;
11
- border-color: $fileInputBorderColor;
12
- position: relative;
13
- margin-bottom: 28px;
14
- }
15
-
16
- .footer {
17
- position: absolute;
18
- bottom: -24px;
19
- left: 0px;
20
- }
@@ -1,48 +0,0 @@
1
- import React, {
2
- ChangeEventHandler,
3
- ReactElement,
4
- useCallback,
5
- useRef,
6
- } from "react";
7
- import Styles from "./BigFactory.module.scss";
8
- import { FileInputViewProps } from "../View.types";
9
- import Spacing from "../../../Spacing/Spacing";
10
- import Text from "../../../Text/Text";
11
- import Button from "../../../Button/Button";
12
-
13
- /**
14
- * The file input layout with a big appearance
15
- **/
16
- export default function BigFactory(IconComponent: () => ReactElement) {
17
- return function Big({
18
- states: {
19
- fileProvided: { title: fileProvided, button: removeFile },
20
- waitingFile: { button, title: reason },
21
- },
22
- file,
23
- footer,
24
- className,
25
- inputEl,
26
- onAction: onRemoveFile
27
- }: FileInputViewProps) {
28
- return (
29
- <div className={`${Styles.container} ${className ?? ""}`}>
30
- <IconComponent />
31
- <Spacing size="small" />
32
- <Text type="description">{file ? fileProvided : reason}</Text>
33
- <Spacing size="small" />
34
- <Button
35
- variant="filled"
36
- onClick={onRemoveFile}
37
- >
38
- {file ? removeFile : button}
39
- </Button>
40
- {inputEl}
41
-
42
- <Text className={Styles.footer} type="caption">
43
- {footer}
44
- </Text>
45
- </div>
46
- );
47
- };
48
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./BigFactory";
2
- export * from "./BigFactory";
@@ -1,68 +0,0 @@
1
- @import "../../../../assets/styles/index.scss";
2
-
3
- .root {
4
- padding: 14px 22px;
5
- background-color: $fileInputBackgroundColor;
6
- display: flex;
7
- align-items: center;
8
- cursor: pointer;
9
- .button {
10
- margin-right: 24px;
11
- }
12
- }
13
-
14
- .root,
15
- .icon {
16
- &.disabled {
17
- pointer-events: none;
18
- cursor: initial;
19
- }
20
- .button {
21
- padding: 0px;
22
- min-width: initial;
23
- }
24
- > :first-child svg {
25
- height: 46px;
26
- }
27
- > div {
28
- p {
29
- margin: 0px;
30
- }
31
- p:nth-child(1) {
32
- font-weight: bold;
33
- font-size: 14px;
34
- font-family: $mainFontFamily;
35
- }
36
- p:nth-child(2) {
37
- font-size: 12px;
38
- font-family: $mainFontFamily;
39
- }
40
- p:nth-child(3) {
41
- margin-top: 8px;
42
- font-size: 16px;
43
- font-family: $mainFontFamily;
44
- }
45
- }
46
- svg {
47
- --svg-color: #{$digitalBlue};
48
- &.loading {
49
- circle {
50
- transition: stroke-dasharray 250ms ease-out;
51
- stroke-dasharray: var(--progress-stroke-dasharray);
52
- }
53
- }
54
- &.completed {
55
- circle {
56
- fill: var(--svg-color);
57
- }
58
- polyline {
59
- stroke-width: 3;
60
- }
61
- }
62
- &.waiting {
63
- circle {
64
- stroke-dasharray: 10%;
65
- }
66
- }
67
- }
68
- }
@@ -1,151 +0,0 @@
1
- import React, {
2
- PropsWithChildren,
3
- ReactElement,
4
- ReactNode,
5
- useMemo,
6
- } from "react";
7
- import Styles from "./Compact.module.scss";
8
- import { FileInputViewProps } from "../View.types";
9
- import _UncontrolledTransition from "../../../UncontrolledTransition/UncontrolledTransition";
10
- import { TransitionAnimationTypes } from "../../../Transition";
11
- import Button from "../../../Button/Button";
12
-
13
- /**
14
- * Shows the file submission input in a more compact form
15
- **/
16
- function Compact({
17
- states,
18
- file,
19
- footer,
20
- inputEl,
21
- onAction,
22
- progress,
23
- className,
24
- disabled,
25
- }: FileInputViewProps) {
26
- const state = states[file ? "fileProvided" : "waitingFile"];
27
-
28
- const progressDashArray = useMemo(() => {
29
- if (progress !== undefined) {
30
- const strokePercent = (progress * 300) / 100;
31
-
32
- return `${strokePercent}% ${300 - strokePercent}%`;
33
- }
34
- }, [progress]);
35
-
36
- return (
37
- <div
38
- className={`${Styles.root} ${className} ${
39
- disabled ? Styles.disabled : ""
40
- }`}
41
- onClick={onAction}
42
- style={
43
- {
44
- "--progress-stroke-dasharray": progressDashArray,
45
- } as any
46
- }
47
- >
48
- <ProgressIndicator file={file} progress={progress} />
49
- <div>
50
- <p>{state.title}</p>
51
- {state.description && <p>{state.description}</p>}
52
- <p>{footer}</p>
53
- </div>
54
- {inputEl}
55
- </div>
56
- );
57
- }
58
-
59
- export function ProgressIndicator({
60
- progress,
61
- file,
62
- defaultIcon,
63
- Wrapper = Button,
64
- }: Pick<FileInputViewProps, "progress" | "file"> & {
65
- defaultIcon?: ReactElement;
66
- Wrapper?: (p: PropsWithChildren<any>) => ReactNode;
67
- }) {
68
- const statusClass =
69
- progress !== undefined && progress < 100
70
- ? "loading"
71
- : file
72
- ? "completed"
73
- : "waiting";
74
-
75
- const polylines = useMemo(() => {
76
- switch (statusClass) {
77
- case "completed":
78
- return [
79
- "rotate(45, 23, 23.5)",
80
- "14 23.9, 23 23.9, 32 23.9",
81
- "23 14.8 23 33",
82
- ];
83
- case "loading":
84
- return ["", "18 23.9, 23 18.8, 28 23.9", "23 18.8 23 29"];
85
- default:
86
- return ["", "18 23.9, 23 23.9, 28 23.9", "23 18.8 23 29"];
87
- }
88
- }, [statusClass]);
89
- return (
90
- <_UncontrolledTransition
91
- transitionType={TransitionAnimationTypes.COIN_FLIP}
92
- className={Styles.icon}
93
- >
94
- <Wrapper variant="transparent" key={`${Styles.button} ${statusClass}`}>
95
- <svg
96
- viewBox="0 0 46 47"
97
- className={Styles[statusClass]}
98
- fill="none"
99
- xmlns="http://www.w3.org/2000/svg"
100
- >
101
- <circle
102
- cx="23"
103
- cy="23.859"
104
- r="22"
105
- style={{ stroke: "var(--svg-color, #000)" }}
106
- strokeWidth="2"
107
- strokeLinecap="round"
108
- strokeLinejoin="round"
109
- />
110
- {statusClass === "completed" ? (
111
- <g transform="translate(11, 11)">
112
- <path
113
- d="M22 11.0801V12.0001C21.9988 14.1565 21.3005 16.2548 20.0093 17.9819C18.7182 19.7091 16.9033 20.9726 14.8354 21.584C12.7674 22.1954 10.5573 22.122 8.53447 21.3747C6.51168 20.6274 4.78465 19.2462 3.61096 17.4372C2.43727 15.6281 1.87979 13.4882 2.02168 11.3364C2.16356 9.18467 2.99721 7.13643 4.39828 5.49718C5.79935 3.85793 7.69279 2.71549 9.79619 2.24025C11.8996 1.76502 14.1003 1.98245 16.07 2.86011"
114
- stroke="white"
115
- strokeWidth="2"
116
- strokeLinecap="round"
117
- strokeLinejoin="round"
118
- />
119
- <path
120
- d="M22 4L12 14.01L9 11.01"
121
- stroke="white"
122
- strokeWidth="2"
123
- strokeLinecap="round"
124
- strokeLinejoin="round"
125
- />
126
- </g>
127
- ) : (
128
- defaultIcon || (
129
- <g transform={polylines[0]}>
130
- <polyline
131
- points={polylines[1]}
132
- strokeWidth="2.8"
133
- style={{ stroke: "var(--svg-color, #000)" }}
134
- stroke-linecap="round"
135
- />
136
- <polyline
137
- points={polylines[2]}
138
- strokeWidth="2.8"
139
- style={{ stroke: "var(--svg-color, #000)" }}
140
- stroke-linecap="round"
141
- />
142
- </g>
143
- )
144
- )}
145
- </svg>
146
- </Wrapper>
147
- </_UncontrolledTransition>
148
- );
149
- }
150
-
151
- export default Compact;
@@ -1,2 +0,0 @@
1
- export { default } from "./Compact";
2
- export * from "./Compact";
@@ -1,12 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { FileInputProps } from "../FileInput";
3
-
4
- export type FileInputViewProps = {
5
- inputEl: ReactNode;
6
- onAction: () => void;
7
- /** A range from 0-100 to indicate some file upload progress */
8
- progress?: number;
9
- } & Pick<
10
- FileInputProps,
11
- "states" | "file" | "footer" | "className" | "disabled"
12
- >;
@@ -1,2 +0,0 @@
1
- export { default } from "./FileInput";
2
- export * from "./FileInput";
@@ -1,47 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- .container {
4
- .headingImg {
5
- width: 100%;
6
- margin: 0px -33px;
7
- }
8
- height: 100%;
9
- display: flex;
10
- flex-direction: column;
11
- justify-content: space-between;
12
- button {
13
- width: 100%;
14
- border-top: 1px solid $lightGray;
15
- }
16
- .transition {
17
- margin-top: -105px;
18
- height: 100%;
19
- .content {
20
- padding: 0px 33px 33px 33px;
21
- margin-top: 105px;
22
- max-height: calc(100% - 105px);
23
-
24
- &.fullHeight {
25
- margin-top: 0px;
26
- max-height: 100%;
27
- height: 100%;
28
- }
29
- }
30
- section {
31
- border-top: 1px solid $lightGray;
32
- margin: 0px -33px;
33
- padding: 0px 33px;
34
- }
35
- }
36
- header {
37
- margin: 55px 33px;
38
- margin-bottom: 33px;
39
- }
40
- footer {
41
- transition: opacity $fast;
42
- opacity: 1;
43
- }
44
- footer.hidden {
45
- opacity: 0;
46
- }
47
- }
@@ -1,93 +0,0 @@
1
- import React, { JSX, MouseEvent, useEffect, useMemo, useRef, useState } from "react";
2
- import Button from "../Button";
3
- import HeaderCloseBtn from "../HeaderCloseBtn";
4
- import Transition from "../Transition";
5
- import Styles from "./FlowController.module.scss";
6
-
7
- export type FlowControlState = "disabled" | "enabled" | "hidden";
8
- /**
9
- * Container for a flow, managing the go back and close controller
10
- **/
11
- export default function FlowController<
12
- E extends Pick<JSX.IntrinsicElements, "div" | "form">,
13
- W extends keyof E
14
- >({
15
- children,
16
- buttons,
17
- step,
18
- onClose,
19
- onBack,
20
- fullPage,
21
- firstStep = 0,
22
- style,
23
- wrapper: Wrapper = "div" as any,
24
- }: {
25
- onClose?: () => void;
26
- onBack?: () => void;
27
- step: number;
28
- firstStep?: number;
29
- buttons: {
30
- label: string;
31
- onClick: () => void;
32
- state: FlowControlState;
33
- }[];
34
- children: React.ReactElement[];
35
- fullPage?: boolean;
36
- style?: React.CSSProperties;
37
- wrapper?: React.ElementType;
38
- } & E[W]) {
39
- function _handleBackPress() {
40
- if (isAtFirstStep) onClose && onClose();
41
- else if (onBack) onBack();
42
- }
43
-
44
- const isAtFirstStep = step === firstStep;
45
-
46
- const shouldDisplayHeaderButton =
47
- (isAtFirstStep && onClose) || (!isAtFirstStep && onBack);
48
-
49
- return (
50
- <Wrapper
51
- onClick={(e: MouseEvent) => e.stopPropagation()}
52
- className={Styles.container}
53
- style={style}
54
- >
55
- <header>
56
- {shouldDisplayHeaderButton && (
57
- <HeaderCloseBtn
58
- mode={isAtFirstStep ? "close" : "back"}
59
- hidden={!onBack}
60
- onClick={_handleBackPress}
61
- />
62
- )}
63
- </header>
64
- <Transition
65
- step={step}
66
- className={Styles.transition}
67
- contentClassName={`${fullPage ? Styles.fullHeight : ""} ${
68
- Styles.content
69
- }`}
70
- >
71
- {children}
72
- </Transition>
73
- <footer
74
- className={
75
- buttons.find((b) => b.state === "hidden") ? Styles.hidden : undefined
76
- }
77
- >
78
- {buttons.map((b) => (
79
- <Button
80
- onClick={b.onClick}
81
- disabled={b.state === "hidden" || b.state === "disabled"}
82
- >
83
- {b.label}
84
- </Button>
85
- ))}
86
- </footer>
87
- </Wrapper>
88
- );
89
- }
90
-
91
- export function HeadingImage({ src }: { src: string }) {
92
- return <img src={src} className={Styles.headingImg} />;
93
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./FlowController";
2
- export * from "./FlowController";