@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,175 +0,0 @@
1
- import React, {
2
- ElementRef,
3
- ForwardedRef,
4
- forwardRef,
5
- RefObject,
6
- useEffect,
7
- useImperativeHandle,
8
- useMemo,
9
- useRef,
10
- useState,
11
- } from "react";
12
- import chromajs from "chroma-js";
13
- import Styles from "./PixelatedScan.module.scss";
14
-
15
- const AnimDuration = Number(Styles.animationDuration);
16
-
17
- /**
18
- * This effect scans up and down on the div with a following pixelated trail
19
- **/
20
- export default function PixelatedScan({
21
- squaresByLine,
22
- color,
23
- className = "",
24
- }: {
25
- squaresByLine: number;
26
- color: string;
27
- className?: string;
28
- }) {
29
- const iteration = useRef(0);
30
- const tableRef = useRef<HTMLTableElement>(null);
31
- const [config, setConfig] =
32
- useState<{ squareSize: number; howMuchLines: number }>();
33
-
34
- useEffect(() => {
35
- const squareSize = tableRef.current!.clientWidth / squaresByLine;
36
- const howMuchLines = tableRef.current!.clientHeight / squareSize;
37
-
38
- setConfig({
39
- squareSize,
40
- howMuchLines,
41
- });
42
- }, []);
43
- const rowsDef = useMemo(() => {
44
- return new Array(Math.ceil(config?.howMuchLines || 0)).fill(undefined);
45
- }, [config]);
46
- const lineDef = useMemo(() => {
47
- return new Array(squaresByLine).fill(undefined);
48
- }, [config]);
49
- return (
50
- <>
51
- <div
52
- className={`${Styles.grid} ${Styles.iterate} ${className}`}
53
- ref={tableRef}
54
- >
55
- {rowsDef.map((_, iRow, _rows) => (
56
- <GridRow
57
- key={`${iRow}`}
58
- squares={lineDef}
59
- size={config!.squareSize}
60
- baseColor={color}
61
- lineCount={config!.howMuchLines}
62
- lineIndex={iRow}
63
- onFinish={
64
- iRow === _rows.length - 6
65
- ? () => {
66
- tableRef.current!.classList.remove(Styles.iterate);
67
- iteration.current += 1;
68
- if (iteration.current % 2 === 1)
69
- tableRef.current!.classList.add(Styles.inverse);
70
- else tableRef.current!.classList.remove(Styles.inverse);
71
- setTimeout(() => {
72
- tableRef.current!.classList.add(Styles.iterate);
73
- }, 100);
74
- }
75
- : undefined
76
- }
77
- />
78
- ))}
79
- <div className={Styles.guide} />
80
- </div>
81
- </>
82
- );
83
- }
84
-
85
- function GridRow({
86
- onFinish,
87
- squares,
88
- size,
89
- baseColor,
90
- lineCount,
91
- lineIndex,
92
- }: {
93
- squares: Array<any>;
94
- onFinish?: () => void;
95
- size: number;
96
- baseColor?: string;
97
- lineCount: number;
98
- lineIndex: number;
99
- }) {
100
- const ref = useRef<HTMLDivElement>(null);
101
- const gridItemsRefs = useRef<(ElementRef<typeof GridItem> | null)[]>([]);
102
-
103
- useEffect(() => {
104
- function updateColor() {
105
- gridItemsRefs.current.forEach((i) => i?.updateColor());
106
- }
107
- ref.current?.addEventListener("animationend", updateColor);
108
-
109
- return () => {
110
- ref.current?.removeEventListener("animationend", updateColor);
111
- };
112
- }, []);
113
- return (
114
- <div
115
- className={Styles.gridAnimate}
116
- onAnimationEnd={onFinish}
117
- style={{
118
- animationDelay: `${(AnimDuration / lineCount) * (lineIndex - 1)}ms`,
119
- }}
120
- >
121
- {squares.map((_, i) => (
122
- <GridItem
123
- ref={(refNode) => {
124
- gridItemsRefs.current[i] = refNode;
125
- }}
126
- key={i}
127
- size={size}
128
- baseColor={baseColor}
129
- />
130
- ))}
131
- </div>
132
- );
133
- }
134
-
135
- function _GridItem(
136
- {
137
- size,
138
- baseColor = "#ff0",
139
- }: {
140
- size: number;
141
- baseColor?: string;
142
- },
143
- externalRef: ForwardedRef<{ updateColor: () => void }>
144
- ) {
145
- const ref = useRef<HTMLDivElement>(null);
146
- function calculateNewRandomColorStrength() {
147
- const color = chromajs.hex(baseColor).alpha(1 - Math.random() * 0.3);
148
- return color;
149
- }
150
- const [randomColorStrength, setRandomColorStrength] =
151
- useState<chromajs.Color>(calculateNewRandomColorStrength);
152
-
153
- useImperativeHandle(
154
- externalRef,
155
- () => ({
156
- updateColor: () => {
157
- setRandomColorStrength(calculateNewRandomColorStrength());
158
- },
159
- }),
160
- []
161
- );
162
-
163
- return (
164
- <div
165
- ref={ref}
166
- className={Styles.gridItem}
167
- style={{
168
- width: size,
169
- height: size,
170
- ...({ "--pixel-color": randomColorStrength.hex() } as any),
171
- }}
172
- />
173
- );
174
- }
175
- const GridItem = forwardRef(_GridItem);
@@ -1,2 +0,0 @@
1
- export { default } from "./PixelatedScan";
2
- export * from "./PixelatedScan";
@@ -1,3 +0,0 @@
1
- .portal > :not(:last-child) {
2
- display: none;
3
- }
@@ -1,68 +0,0 @@
1
- import ReactDOM from "react-dom";
2
- import React, {
3
- DetailedHTMLProps,
4
- ForwardedRef,
5
- forwardRef,
6
- HTMLAttributes,
7
- PropsWithChildren,
8
- useMemo,
9
- } from "react";
10
- import { useRef } from "react";
11
- import { useEffect } from "react";
12
- import { useState } from "react";
13
- import Styles from "./Portal.module.scss";
14
-
15
- /**
16
- * A react portal implementation with current page fallback
17
- **/
18
- export default function Portal({
19
- to,
20
- children,
21
- }: PropsWithChildren<{ to: string }>) {
22
- const [target, setTarget] = useState<Element | null>();
23
-
24
- useEffect(() => {
25
- const els = document.querySelectorAll(`[data-one-portal="${to}"]`);
26
- let latestEl: any;
27
- els.forEach((el: any) => {
28
- latestEl =
29
- Number(el.getAttribute("data-timestamp")) >
30
- Number(latestEl?.timestamp || 0)
31
- ? el
32
- : latestEl;
33
- });
34
- setTarget(latestEl || null);
35
- }, []);
36
-
37
- return target === undefined ? null : (
38
- <>{target === null ? children : ReactDOM.createPortal(children, target)}</>
39
- );
40
- }
41
-
42
- function _PortalReceiver(
43
- {
44
- name,
45
- className = "",
46
- ...props
47
- }: {
48
- name: string;
49
- className?: string;
50
- } & Omit<
51
- DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
52
- "ref"
53
- >,
54
- _ref: ForwardedRef<HTMLDivElement>
55
- ) {
56
- const timestamp = useMemo(() => Date.now(), []);
57
- return (
58
- <div
59
- className={`${Styles.portal} ${className}`}
60
- data-one-portal={name}
61
- ref={_ref}
62
- data-timestamp={timestamp}
63
- {...props}
64
- />
65
- );
66
- }
67
-
68
- export const PortalReceiver = forwardRef(_PortalReceiver);
@@ -1,2 +0,0 @@
1
- export { default } from "./Portal";
2
- export * from "./Portal";
@@ -1,44 +0,0 @@
1
- @use "sass:math";
2
- @import "../../assets/styles/index.scss";
3
-
4
- .container {
5
- &.guide {
6
- margin: 0.375em;
7
- }
8
- &.gauge {
9
- margin: 0em;
10
- }
11
- &.sections {
12
- width: 100%;
13
- }
14
- height: 0.25em;
15
- background-color: red;
16
- position: relative;
17
- border-radius: math.div(0.25em, 2);
18
- background: var(--progress-bar-bg, #0000);
19
- > :first-child {
20
- position: absolute;
21
- top: 0;
22
- left: 0;
23
- background-color: green;
24
- height: inherit;
25
- border-top-left-radius: math.div(0.25em, 2);
26
- border-bottom-left-radius: math.div(0.25em, 2);
27
- background: var(--progress-bar-bar, var(--digital-blue));
28
- transition: width var(--animation-speed-transition, $fast) ease-out;
29
- }
30
- &.completed > :first-child {
31
- border-top-right-radius: math.div(0.25em, 2);
32
- border-bottom-right-radius: math.div(0.25em, 2);
33
- }
34
- &.guide > :last-child {
35
- position: absolute;
36
- margin-top: math.div(-0.5em, 1.25);
37
- margin-left: -0.5em;
38
- height: 1em;
39
- width: 1em;
40
- border-radius: 0.5em;
41
- transition: left var(--animation-speed-transition, $fast) ease-out;
42
- background: var(--progress-bar-guide, var(--digital-blue));
43
- }
44
- }
@@ -1,124 +0,0 @@
1
- import React, {
2
- ComponentProps,
3
- useEffect,
4
- useMemo,
5
- useRef,
6
- useState,
7
- } from "react";
8
- import Styles from "./ProgressBar.module.scss";
9
-
10
- /**
11
- * Shows a progress bar
12
- **/
13
- export default function ProgressBar({
14
- progress,
15
- ...props
16
- }: {
17
- /**
18
- * Given in percent
19
- */
20
- progress: number;
21
- } & (
22
- | {
23
- /**
24
- * Given as css font size
25
- */
26
- size: number | string;
27
- mode?: "gauge" | "guide";
28
- }
29
- | {
30
- /**
31
- * Given as pixels
32
- */
33
- size: number;
34
- mode?: "sections";
35
- /** The number of sections to split */
36
- sections: number;
37
- }
38
- )) {
39
- if (props.mode === "sections") {
40
- const ref = useRef<SVGSVGElement>(null);
41
- const strokeID = useMemo(
42
- () => `stroke-${(Math.random() * 100000).toFixed(0)}`,
43
- []
44
- );
45
- const height = props.size;
46
- const [width, setWidth] = useState(0);
47
- const dashWidth = width / props.sections;
48
- const spacing = dashWidth * 0.2;
49
- useEffect(() => {
50
- setWidth(ref.current!.clientWidth);
51
- }, []);
52
- return (
53
- <svg
54
- ref={ref}
55
- viewBox={`${-height / 2} 0 ${width + height - spacing} ${height}`}
56
- preserveAspectRatio="none"
57
- width={"100%"}
58
- height={`${height}px`}
59
- >
60
- <defs>
61
- <linearGradient
62
- id={`${strokeID}`}
63
- x1="0%"
64
- y1="0%"
65
- x2="100%"
66
- y2="0%"
67
- gradientUnits="userSpaceOnUse"
68
- >
69
- <stop offset="0%" stop-color="blue" />
70
- <stop offset={`${progress}%`} stop-color="blue" />
71
- <stop offset={`${progress}%`} stop-color="green" />
72
- <stop offset="100%" stop-color="green" />
73
- </linearGradient>
74
- </defs>
75
- <line
76
- x1="0"
77
- y1={height / 2}
78
- x2={width}
79
- y2={height / 2}
80
- stroke={`url(#${strokeID})`}
81
- stroke-width={height}
82
- stroke-dasharray={`${dashWidth - spacing},${spacing}`}
83
- stroke-linecap="round"
84
- />
85
- </svg>
86
- );
87
- }
88
- const mode = props.mode || "guide";
89
- const size = props.size;
90
- return (
91
- <div
92
- className={`${Styles.container} ${Styles[mode]} ${
93
- progress === 100 ? Styles.completed : ""
94
- }`}
95
- style={{ fontSize: size }}
96
- >
97
- <span style={{ width: `${progress}%` }} />
98
- {mode === "guide" && <span style={{ left: `${progress}%` }} />}
99
- </div>
100
- );
101
- }
102
-
103
- export function BalancedProgressBar({
104
- min,
105
- max,
106
- current,
107
- size,
108
- ...props
109
- }: {
110
- min: number;
111
- max: number;
112
- current: number;
113
- } & Omit<ComponentProps<typeof ProgressBar>, "progress">) {
114
- const progress = useMemo(() => {
115
- const progressVal = current - min;
116
- const maxVal = max - min;
117
-
118
- const currProgress = (progressVal * 100) / maxVal;
119
-
120
- return currProgress;
121
- }, [min, max, current]);
122
-
123
- return <ProgressBar size={size} progress={progress} {...props as any} />;
124
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./ProgressBar";
2
- export * from "./ProgressBar";
@@ -1,37 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- .container {
4
- font-family: Manrope;
5
- transition: max-height $slow;
6
- overflow: hidden;
7
- max-height: 0px;
8
- * {
9
- text-align: left;
10
- }
11
- button {
12
- text-align: center;
13
- }
14
- h1 {
15
- font-weight: bold;
16
- font-size: 34px;
17
- line-height: 41px;
18
- color: $spaceBlue !important;
19
- }
20
- p {
21
- font-family: Roboto;
22
- font-size: 22px;
23
- line-height: 33px;
24
- }
25
- }
26
-
27
- .hidden {
28
- max-height: 0px !important;
29
- }
30
-
31
- .loading * {
32
- color: $spaceBlue !important;
33
- }
34
-
35
- .disabled * {
36
- color: $mediumGray !important;
37
- }
@@ -1,85 +0,0 @@
1
- import React, { ComponentProps, MouseEvent, ReactElement } from "react";
2
- import Spacing from "../Spacing";
3
- import Text from "../Text";
4
- import Styles from "./ProgressTexts.module.scss";
5
- import Button from "../Button";
6
-
7
- type Step = {
8
- type: "wait" | "final";
9
- title?: string;
10
- description?: string | React.ReactElement;
11
- action?: {
12
- label: string | ReactElement;
13
- onClick: (e: MouseEvent<HTMLButtonElement>) => void;
14
- disabled?: boolean;
15
- variant?: ComponentProps<typeof Button>["variant"];
16
- };
17
- };
18
-
19
- /**
20
- * Displays new texts as they are pushed into the steps property allowing for a nice progress follow experience
21
- **/
22
- export default function ProgressTexts({
23
- steps,
24
- currentStep,
25
- spacingOnEachStep = true,
26
- }: {
27
- /**
28
- * Starts at 0
29
- */
30
- currentStep: number;
31
- steps: Step[];
32
- spacingOnEachStep?: boolean;
33
- }) {
34
- const _currentStep = steps[currentStep];
35
- return (
36
- <>
37
- {steps.map((s, i) => {
38
- function whichClassToUse(
39
- step: number,
40
- stepType: Step["type"],
41
- currentStep: number,
42
- currentStepType: Step["type"]
43
- ) {
44
- const classes = [Styles.container];
45
-
46
- // Decides the color
47
- if (stepType !== "final")
48
- classes.push(step < currentStep ? Styles.disabled : Styles.loading);
49
-
50
- // Decides if should be visible or not
51
- classes.push(
52
- currentStep !== step && currentStepType === "final"
53
- ? Styles.hidden
54
- : ""
55
- );
56
-
57
- return classes.join(" ");
58
- }
59
- return i <= currentStep ? (
60
- <div
61
- key={String(i)}
62
- ref={(a) => {
63
- if (a) a.style.maxHeight = `${a.scrollHeight}px`;
64
- }}
65
- className={whichClassToUse(
66
- i,
67
- s.type,
68
- currentStep,
69
- _currentStep.type
70
- )}
71
- >
72
- {s.title && <h1>{s.title}</h1>}
73
- {s.description && <p>{s.description}</p>}
74
- {s.action && (
75
- <Button variant={s.action.variant} onClick={s.action.onClick} disabled={s.action.disabled}>
76
- {s.action.label}
77
- </Button>
78
- )}
79
- {spacingOnEachStep !== false ? <Spacing size="large" /> : null}
80
- </div>
81
- ) : null;
82
- })}
83
- </>
84
- );
85
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./ProgressTexts";
2
- export * from "./ProgressTexts";
@@ -1,36 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- .container {
4
- display: flex;
5
- line-height: 1.5em;
6
- vertical-align: middle;
7
- flex-shrink: 0;
8
-
9
- input {
10
- max-width: 0px;
11
- max-height: 0px;width: 0;
12
- height: 0;
13
- opacity: 0;
14
- }
15
-
16
- > span:first-child {
17
- visibility: visible;
18
- width: 1.5em;
19
- height: 1.5em;
20
- border-radius: 0.8em;
21
- background-image: url("../../assets/img/svg/checkbox.svg");
22
- background-color: transparent;
23
- transition: background-color 250ms, border 250ms, box-shadow 250ms;
24
- border: 1px solid rgb(40, 43, 53);
25
- box-shadow: 0px 0px 0px -4px $digitalBlue;
26
- flex-shrink: 0;
27
- &.wContent {
28
- margin-right: 0.8em;
29
- }
30
- }
31
- > span:first-child.checked {
32
- background-color: $digitalBlue;
33
- border: 1px solid $digitalBlue;
34
- box-shadow: 0px 0px 12px -4px $digitalBlue;
35
- }
36
- }
@@ -1,53 +0,0 @@
1
- import React, { PropsWithChildren } from "react";
2
- import { useOneUIConfig } from "../../context/OneUIProvider";
3
- import Styles from "./Radio.module.scss";
4
-
5
- /**
6
- * A simple radio with nice guidelines
7
- **/
8
- export default function Radio({
9
- checked,
10
- onToggle,
11
- label,
12
- className = "",
13
- size = undefined,
14
- groupId,
15
- value,
16
- ...props
17
- }: PropsWithChildren<{
18
- checked: boolean;
19
- onToggle: (checked: boolean) => void;
20
- label: React.ReactNode;
21
- className?: string;
22
- size?: number;
23
- groupId: string;
24
- value: string;
25
- }> &
26
- React.DetailedHTMLProps<
27
- React.HTMLAttributes<HTMLSpanElement>,
28
- HTMLSpanElement
29
- >) {
30
- const Checkbox = useOneUIConfig(
31
- "component.radio.Component",
32
- "span" as any
33
- ) as any;
34
- return (
35
- <label
36
- className={`${Styles.container} ${className}`}
37
- style={{ fontSize: size }}
38
- onClick={(e) => {
39
- onToggle(!checked);
40
- e.preventDefault();
41
- }}
42
- >
43
- <Checkbox
44
- {...props}
45
- className={`${checked ? Styles.checked : ""} ${
46
- label ? Styles.wContent : ""
47
- }`}
48
- />
49
- <input type="radio" name={groupId} id={value} checked={checked} readOnly/>
50
- {label}
51
- </label>
52
- );
53
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./Radio";
2
- export * from "./Radio";
@@ -1,30 +0,0 @@
1
- .root {
2
- display: flex;
3
- align-items: center;
4
- justify-content: center;
5
- width: 100%;
6
- height: 100%;
7
- .content {
8
- width: 100%;
9
- max-width: 1200px;
10
- &.decorated {
11
- position: relative;
12
- }
13
- }
14
- .decoration {
15
- position: absolute;
16
- bottom: 0px;
17
- left: 0px;
18
- width: 16px;
19
- height: 16px;
20
- &.light {
21
- background-color: white;
22
- }
23
- &.dark {
24
- background-color: black;
25
- }
26
- }
27
- h1 {
28
- margin-bottom: 24px;
29
- }
30
- }