@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,200 +0,0 @@
1
- import React, {
2
- ComponentProps,
3
- ElementRef,
4
- FunctionComponent,
5
- HTMLAttributes,
6
- HTMLProps,
7
- JSX,
8
- ReactElement,
9
- useEffect,
10
- useMemo,
11
- useRef,
12
- } from "react";
13
- import { TransitionAnimationTypes } from "../Transition";
14
- import UncontrolledTransition from "../UncontrolledTransition";
15
- import Styles from "./AdaptiveContainer.module.scss";
16
-
17
- /**
18
- * A container that animates width changes across content updates
19
- **/
20
- export default function AdaptiveContainer<
21
- E extends keyof JSX.IntrinsicElements | FunctionComponent
22
- >({
23
- children,
24
- className = "",
25
- containerElement: _Wrapper = "div" as any,
26
- direction = "h",
27
- strict = true,
28
- ...otherProps
29
- }: {
30
- containerElement?: E;
31
- children: ReactElement;
32
- /**
33
- * The direction in which the content will be resized
34
- *
35
- * "h" // When the content will change in width
36
- * "v" // When the content will change in height
37
- */
38
- direction?: "h" | "v" | "both";
39
- className?: string;
40
- contentClassName?: string;
41
- /**
42
- * true: It will animate restricting to the height when it was rendered
43
- * false: It will animate trying to reach the height when it was rendered, growing in size if the content inside it changes */
44
- strict?: boolean;
45
- } & ComponentProps<E>) {
46
- const animatedProperty = useMemo(() => {
47
- if (!strict && direction !== "v")
48
- throw new Error(
49
- `Strict false only works with direction "v" at the moment`
50
- );
51
- switch (direction) {
52
- case "both":
53
- return ["width", "height"] as const
54
- case "h":
55
- return ("width" as const);
56
- case "v":
57
- return strict ? ("height" as const) : ("minHeight" as const);
58
- }
59
- }, [direction, strict]);
60
- const uncontrolledRef =
61
- useRef<ElementRef<typeof UncontrolledTransition>>(null);
62
- const buttonRef = useRef<HTMLElement>(null);
63
-
64
- useEffect(() => {
65
- const transitionContainer = uncontrolledRef.current!.sectionRef.current;
66
- if (transitionContainer)
67
- if (direction === "both") {
68
- transitionContainer.style.width = `${transitionContainer.clientWidth}px`;
69
- transitionContainer.style.height = `${transitionContainer.clientHeight}px`;
70
- } else if (direction === "h") {
71
- transitionContainer.style.width = `${transitionContainer.clientWidth}px`;
72
- transitionContainer.style[animatedProperty as "width"] = ``;
73
- } else {
74
- transitionContainer.style[
75
- animatedProperty as "height"
76
- ] = `${transitionContainer.clientHeight}px`;
77
- transitionContainer.style.width = ``;
78
- }
79
- const t = setTimeout(() => {
80
- if (uncontrolledRef.current) {
81
- const transitionContainer = uncontrolledRef.current.sectionRef.current;
82
- if (transitionContainer) {
83
- const screenThatWillEnter =
84
- transitionContainer.lastChild as HTMLDivElement;
85
-
86
- if (screenThatWillEnter) {
87
- function resetFactory(
88
- param: "minHeight" | "height" | "width",
89
- target: number
90
- ) {
91
- const resetPropertyInstance = (e: Pick<TransitionEvent, "propertyName">) => {
92
- if (e.propertyName !== param) return;
93
- setTimeout(() => {
94
- if (transitionContainer?.style[param] === `${target}px`) {
95
- transitionContainer!.style[param] = "";
96
- }
97
- }, 100);
98
-
99
- if (transitionContainer)
100
- transitionContainer.removeEventListener(
101
- "transitionend",
102
- resetPropertyInstance
103
- );
104
- };
105
- return resetPropertyInstance;
106
- }
107
- if (direction === "both") {
108
- const contentSize = {
109
- width: screenThatWillEnter.clientWidth,
110
- height: screenThatWillEnter.scrollHeight
111
- };
112
-
113
- const targetSize = {
114
- width: `${contentSize.width}px`,
115
- height: `${contentSize.height}px`
116
- };
117
-
118
- const prevSize = {
119
- width: transitionContainer.style.width,
120
- height: transitionContainer.style.height
121
- };
122
-
123
- transitionContainer.style.width = targetSize.width;
124
- transitionContainer.style.height = targetSize.height;
125
-
126
- if (Array.isArray(animatedProperty))
127
- for (let prop of animatedProperty as ('width' | 'height')[]) {
128
- const resetProperty = resetFactory(
129
- prop,
130
- contentSize[prop]
131
- );
132
- if (targetSize[prop] === prevSize[prop])
133
- resetProperty({ propertyName: prop });
134
- else
135
- transitionContainer.addEventListener(
136
- "transitionend",
137
- resetProperty
138
- );
139
- }
140
- } else if (direction === "h") {
141
- const contentWidth = screenThatWillEnter.clientWidth;
142
- const targetWidth = `${contentWidth}px`;
143
- const prevWidth = transitionContainer.style.width;
144
- transitionContainer.style.width = targetWidth;
145
- const func = resetFactory("width", contentWidth);
146
- if (targetWidth === prevWidth) func({ propertyName: "width" });
147
- else transitionContainer.addEventListener("transitionend", func);
148
- } else {
149
- const _animatedProperty = animatedProperty as "width"
150
- const contentHeight = screenThatWillEnter.scrollHeight;
151
- const targetHeight = `${contentHeight}px`;
152
- const prevHeight = transitionContainer.style[_animatedProperty];
153
- transitionContainer.style[_animatedProperty] = targetHeight;
154
- const resetProperty = resetFactory(
155
- _animatedProperty,
156
- contentHeight
157
- );
158
- if (targetHeight === prevHeight)
159
- resetProperty({ propertyName: _animatedProperty });
160
- else
161
- transitionContainer.addEventListener(
162
- "transitionend",
163
- resetProperty
164
- );
165
- }
166
- }
167
- }
168
- }
169
- }, 100);
170
- return () => clearTimeout(t);
171
- }, [children.key, direction]);
172
- const Wrapper = _Wrapper as any;
173
- const directionClass = direction in Styles ? Styles[direction] : "";
174
-
175
- return (
176
- <>
177
- <Wrapper className={`${className}`} ref={buttonRef} {...otherProps}>
178
- <UncontrolledTransition
179
- ref={uncontrolledRef}
180
- transitionType={TransitionAnimationTypes.CUSTOM}
181
- lockTransitionWidth={false}
182
- config={{
183
- backward: {
184
- elementExiting: Styles.fadeOutAbsolute,
185
- elementEntering: Styles.fadeInDelayed,
186
- },
187
- forward: {
188
- elementExiting: Styles.fadeOutAbsolute,
189
- elementEntering: Styles.fadeInDelayed,
190
- },
191
- }}
192
- className={`${Styles.resetSection} ${directionClass}`}
193
- contentClassName={otherProps.contentClassName}
194
- >
195
- {children}
196
- </UncontrolledTransition>
197
- </Wrapper>
198
- </>
199
- );
200
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./AdaptiveContainer";
2
- export * from "./AdaptiveContainer";
@@ -1,147 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- .backdrop {
4
- position: fixed;
5
- top: 0px;
6
- left: 0px;
7
- right: 0px;
8
- bottom: 0px;
9
- display: flex;
10
- align-items: center;
11
- justify-content: center;
12
- z-index: 1000;
13
- transition: backdrop-filter $veryFast linear;
14
- backdrop-filter: var(--adaptive-dialog-backdrop-backdrop, initial);
15
- pointer-events: none;
16
-
17
- @media screen and (orientation: "portrait") {
18
- align-items: flex-end;
19
- }
20
- }
21
- .backdrop,
22
- .container {
23
- animation-duration: $fast;
24
- animation-fill-mode: forwards;
25
- }
26
-
27
- .open {
28
- &.backdrop {
29
- animation-name: backdropAppear;
30
- }
31
- .container {
32
- animation-name: reveal;
33
- }
34
- @media screen and (orientation: "portrait") {
35
- .container {
36
- animation-timing-function: ease-in-out;
37
- animation-name: slideUp;
38
- transform: translateY(100%);
39
- }
40
- }
41
- }
42
-
43
- .close {
44
- &.backdrop {
45
- animation-name: backdropDismiss;
46
- }
47
-
48
- .container {
49
- animation-name: dismiss;
50
- }
51
-
52
- @media screen and (orientation: "portrait") {
53
- .container {
54
- animation-name: slideDown;
55
- }
56
- }
57
- }
58
-
59
- .container {
60
- > .closeBtn {
61
- position: absolute;
62
- right: 16px;
63
- top: 16px;
64
- background: none;
65
- border: none;
66
- width: auto;
67
- height: auto;
68
- padding: 0px !important;
69
- }
70
- padding: 16px 32px;
71
- position: relative;
72
- width: 100%;
73
- max-width: 640px;
74
- background: $mainBackgroundColor;
75
- backdrop-filter: var(--adaptive-dialog-backdrop, initial);
76
- display: flex;
77
- align-items: center;
78
- justify-content: center;
79
- flex-direction: column;
80
- max-height: 90% !important;
81
- overscroll-behavior: contain;
82
- @media screen and (orientation: "portrait") {
83
- min-height: initial;
84
- align-items: flex-start;
85
- }
86
- }
87
-
88
- @keyframes backdropAppear {
89
- 0% {
90
- background-color: #0000;
91
- }
92
-
93
- 100% {
94
- background-color: #0005;
95
- }
96
- }
97
-
98
- @keyframes backdropDismiss {
99
- 0% {
100
- background-color: #0005;
101
- }
102
-
103
- 100% {
104
- background-color: #0000;
105
- }
106
- }
107
-
108
- @keyframes reveal {
109
- 0% {
110
- opacity: 0;
111
- }
112
- 100% {
113
- opacity: 1;
114
- }
115
- }
116
-
117
- @keyframes dismiss {
118
- 0% {
119
- opacity: 1;
120
- }
121
- 100% {
122
- opacity: 0;
123
- }
124
- }
125
-
126
- @keyframes slideUp {
127
- 0% {
128
- min-height: 0px;
129
- transform: translateY(100%);
130
- }
131
-
132
- 100% {
133
- min-height: 0px;
134
- transform: translateY(0%);
135
- }
136
- }
137
-
138
- @keyframes slideDown {
139
- 0% {
140
- transform: translateY(0%);
141
- }
142
-
143
- 100% {
144
- min-height: 0px;
145
- transform: translateY(100%);
146
- }
147
- }
@@ -1,97 +0,0 @@
1
- import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
2
- import ReactDOM from "react-dom";
3
- import Styles from "./AdaptiveDialog.module.scss";
4
- import MutableHamburgerButton from "../MutableHamburgerButton";
5
- import ScrollAndFocusLock from "../utilitary/ScrollAndFocusLock";
6
- import { useOneUIConfig } from "../../context/OneUIProvider";
7
-
8
- /**
9
- * This component implements a generic drawer that displays it as a drawer on mobile and as a modal on desktop
10
- **/
11
- export default function AdaptiveDialog({
12
- variant = "default",
13
- onClose,
14
- open = false,
15
- className = "",
16
- onClickOut,
17
- children,
18
- onClosed,
19
- inline = false,
20
- }: PropsWithChildren<{
21
- variant?: OnepercentUtility.UIElements.AdaptiveDialogVariants;
22
- className?: string;
23
- open: boolean;
24
- onClose?: () => void;
25
- onClickOut?: () => void;
26
- onClosed?: () => void;
27
- /**
28
- * Indicates this rendering will write the html inside the current position on dom.
29
- * If omitted or false, it will render on the document body, to prevent style bleeding */
30
- inline?: boolean;
31
- }>) {
32
- const rootDivRef = useRef<HTMLDivElement>(null);
33
- const [isVisible, setIsVisible] = useState(open);
34
- const [expanded, setExpanded] = useState(false);
35
- const variantClass = useOneUIConfig(
36
- `component.adaptiveDialog.variant.${variant}`,
37
- ""
38
- );
39
-
40
- useEffect(() => {
41
- if (open) {
42
- setIsVisible(true);
43
- const toggleVisbility = (e: AnimationEvent) => {
44
- if (e.animationName === Styles.backdropDismiss) {
45
- onClosed?.();
46
- setIsVisible(false);
47
- (e.target! as HTMLDivElement).removeEventListener(
48
- "animationend",
49
- toggleVisbility
50
- );
51
- }
52
- };
53
- rootDivRef.current!.addEventListener("animationend", toggleVisbility);
54
- }
55
- }, [open]);
56
-
57
- const globalClassName = {
58
- backdrop: useOneUIConfig("component.adaptiveDialog.backdropClassName", ""),
59
- dialog: useOneUIConfig("component.adaptiveDialog.dialogClassName", ""),
60
- };
61
- const content = (
62
- <div
63
- ref={rootDivRef}
64
- className={`${Styles.backdrop} ${open ? Styles.open : Styles.close} ${
65
- expanded ? Styles.expanded : ""
66
- } ${globalClassName.backdrop} ${variantClass}`}
67
- onClick={onClickOut}
68
- onAnimationEnd={({ target, currentTarget }) => {
69
- if (target === currentTarget)
70
- (target as HTMLDivElement).style.pointerEvents = "initial";
71
- }}
72
- >
73
- <div
74
- className={`${Styles.container} ${className} ${globalClassName.dialog}`}
75
- onClick={(e) => e.stopPropagation()}
76
- >
77
- <ScrollAndFocusLock open={open}>
78
- {onClose && (
79
- <button className={Styles.closeBtn} onClick={onClose}>
80
- <MutableHamburgerButton state="closed" size={24} />
81
- </button>
82
- )}
83
- <div onClick={() => setExpanded((p) => !p)} />
84
- {children}
85
- </ScrollAndFocusLock>
86
- </div>
87
- </div>
88
- );
89
-
90
- return isVisible || open ? (
91
- inline ? (
92
- content
93
- ) : (
94
- <>{ReactDOM.createPortal(content, document.body)}</>
95
- )
96
- ) : null;
97
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./AdaptiveDialog";
2
- export * from "./AdaptiveDialog";
@@ -1,49 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- $hamburgerSize: 48;
4
- $hamburgerOffset: 24;
5
-
6
- @value hamburgerSize #{$hamburgerSize};
7
-
8
- .hamburger {
9
- position: fixed;
10
- top: #{$hamburgerOffset}px;
11
- left: #{$hamburgerOffset}px;
12
- }
13
-
14
- .hamburger {
15
- display: initial;
16
- }
17
-
18
- .hamburger,
19
- .container {
20
- z-index: 1000;
21
- }
22
-
23
- .container {
24
- box-sizing: border-box;
25
- height: 100%;
26
- }
27
- .hamburger.desktop {
28
- display: none;
29
- }
30
-
31
- .container.mobile {
32
- &.defaultPadding {
33
- padding-top: #{$hamburgerSize + $hamburgerOffset * 2}px;
34
- }
35
- position: fixed;
36
- width: 100%;
37
- overflow: auto;
38
- z-index: 1000;
39
- left: 0;
40
-
41
- &.open {
42
- transition: transform $veryFast ease-out;
43
- transform: translateX(-0%);
44
- }
45
- &.closed {
46
- transition: transform $veryFast ease-in;
47
- transform: translateX(-100%);
48
- }
49
- }
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import AdaptiveSidebar from "./AdaptiveSidebar";
3
-
4
- export default function AdaptiveSidebarSample() {
5
- return (
6
- <AdaptiveSidebar>
7
- Experiment with different resolutions to see how this container behaves
8
- </AdaptiveSidebar>
9
- );
10
- }
@@ -1,123 +0,0 @@
1
- import React, {
2
- ForwardedRef,
3
- forwardRef,
4
- PropsWithChildren,
5
- useEffect,
6
- useImperativeHandle,
7
- useRef,
8
- useState,
9
- } from "react";
10
- import { createPortal } from "react-dom";
11
- import MutableHamburgerButton from "../MutableHamburgerButton";
12
- import ScrollAndFocusLock from "../utilitary/ScrollAndFocusLock";
13
- import Styles from "./AdaptiveSidebar.module.scss";
14
- import useBreakpoint from "../../hooks/ui/useBreakpoint";
15
- import { useOneUIConfig } from "../../context/OneUIProvider";
16
-
17
- const DefaultVisibilityControl = ({ open }: { open: boolean }) => (
18
- <MutableHamburgerButton size={48} state={open ? "closed" : "default"} />
19
- );
20
-
21
- type AdaptiveSidebarControls = {
22
- dismiss: () => void;
23
- };
24
- function _AdaptiveSidebar(
25
- {
26
- open: externalOpen,
27
- children,
28
- className = "",
29
- breakInto = 640,
30
- visibilityControlComponent:
31
- VisibilityControlComponent = DefaultVisibilityControl,
32
- ...props
33
- }: PropsWithChildren<
34
- {
35
- /** To control AdaptiveSidebar externally
36
- * (created for flows that requires floating views when on mobile)
37
- **/
38
- open?: boolean;
39
- /**
40
- * The screen width to turn into responsive mode
41
- */
42
- breakInto?: number;
43
- className?: string;
44
- visibilityControlComponent?: (props: {
45
- open: boolean;
46
- }) => React.ReactElement;
47
- } & Omit<React.HTMLProps<HTMLDivElement>, "ref">
48
- >,
49
- ref: ForwardedRef<AdaptiveSidebarControls>
50
- ) {
51
- const [open, setOpen] = useState(false);
52
- const containerRef = useRef<HTMLDivElement>(null);
53
- const _open = externalOpen === undefined ? open : externalOpen;
54
- const isMobile = useBreakpoint(breakInto);
55
- const globalClassName = useOneUIConfig("component.adaptiveSidebar.className");
56
- const globalControlClassName = useOneUIConfig(
57
- "component.adaptiveSidebar.controlClassName"
58
- );
59
-
60
- useImperativeHandle(
61
- ref,
62
- () => ({
63
- dismiss: () => setOpen(false),
64
- }),
65
- []
66
- );
67
-
68
- useEffect(() => {
69
- if (process.env.NODE_ENV === "test") return;
70
- containerRef.current!.scrollTo({
71
- left: 0,
72
- behavior: "smooth",
73
- top: 0,
74
- });
75
- }, [_open]);
76
- const externalControl = externalOpen !== undefined;
77
-
78
- const content = (
79
- <div
80
- ref={containerRef}
81
- className={`${isMobile ? Styles.mobile : Styles.desktop} ${
82
- Styles.container
83
- } ${
84
- !externalControl &&
85
- DefaultVisibilityControl === VisibilityControlComponent
86
- ? Styles.defaultPadding
87
- : ""
88
- } ${_open ? Styles.open : Styles.closed} ${className} ${globalClassName}`}
89
- {...props}
90
- >
91
- <ScrollAndFocusLock open={_open}>{children}</ScrollAndFocusLock>
92
- </div>
93
- );
94
-
95
- return (
96
- <>
97
- {isMobile
98
- ? createPortal(
99
- <>
100
- {content}
101
- {!externalControl && (
102
- <div
103
- className={`${isMobile ? Styles.mobile : Styles.desktop} ${
104
- Styles.hamburger
105
- } ${globalControlClassName}`}
106
- onClick={() => setOpen((a) => !a)}
107
- >
108
- <VisibilityControlComponent open={_open} />
109
- </div>
110
- )}
111
- </>,
112
- document.body
113
- )
114
- : content}
115
- </>
116
- );
117
- }
118
-
119
- /**
120
- * A component that you can put anywhere but hides when small enough and shows the control via a fixed floating button
121
- **/
122
- const AdaptiveSidebar = forwardRef(_AdaptiveSidebar);
123
- export default AdaptiveSidebar;
@@ -1,2 +0,0 @@
1
- export { default } from "./AdaptiveSidebar";
2
- export * from "./AdaptiveSidebar";
@@ -1,64 +0,0 @@
1
- @import "../../assets/styles/index.scss";
2
-
3
- $arrowDim: 1em;
4
-
5
- /**
6
- * Some notions to take into account
7
- */
8
-
9
- .tooltipContainer {
10
- & > div {
11
- background-color: $tooltipBackgroudColor;
12
- }
13
- // It should not overflow the viewport (screen)
14
- max-width: 100vw;
15
- max-height: 100vh;
16
- min-width: fit-content;
17
-
18
- // It should be floating over some point into the viewport
19
- position: fixed;
20
-
21
- // The position will be calculated via the javascript and the context
22
-
23
- transition: top $almostInstant, left $almostInstant, opacity $normal;
24
- z-index: 1000;
25
-
26
- pointer-events: none;
27
-
28
- &.open {
29
- pointer-events: initial;
30
- }
31
-
32
- &::after,
33
- &::before {
34
- content: " ";
35
- width: 0px;
36
- height: 0px;
37
- border: $arrowDim solid $tooltipBackgroudColor;
38
- border-top-color: transparent;
39
- border-right-color: transparent;
40
- transform: translateY(-$arrowDim) rotate(-45deg);
41
- display: block;
42
- margin: auto;
43
- position: relative;
44
- left: var(--anchor-indicator-offset-left, 0px);
45
- z-index: -1;
46
- }
47
-
48
- &::before {
49
- display: none;
50
- transform: translateY($arrowDim) rotate(135deg);
51
- }
52
- &.anchoredTop {
53
- transform: translateY(4px);
54
- }
55
- &.anchoredBottom {
56
- transform: translateY(-4px);
57
- &::after {
58
- display: none;
59
- }
60
- &::before {
61
- display: block;
62
- }
63
- }
64
- }