@onepercentio/one-ui 0.29.4 → 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 (286) hide show
  1. package/dist/components/Switch/Switch.d.ts +1 -1
  2. package/dist/components/Switch/Switch.js +1 -1
  3. package/dist-ts/components/Switch/Switch.d.ts +1 -1
  4. package/package.json +1 -1
  5. package/src/assets/img/svg/checkbox.svg +0 -3
  6. package/src/assets/styles/index.scss +0 -2
  7. package/src/assets/styles/mixins.scss +0 -12
  8. package/src/assets/styles/variables.scss +0 -49
  9. package/src/components/AdaptiveButton/AdaptiveButton.module.scss +0 -7
  10. package/src/components/AdaptiveButton/AdaptiveButton.tsx +0 -26
  11. package/src/components/AdaptiveButton/index.tsx +0 -2
  12. package/src/components/AdaptiveContainer/AdaptiveContainer.module.scss +0 -53
  13. package/src/components/AdaptiveContainer/AdaptiveContainer.tsx +0 -200
  14. package/src/components/AdaptiveContainer/index.tsx +0 -2
  15. package/src/components/AdaptiveDialog/AdaptiveDialog.module.scss +0 -147
  16. package/src/components/AdaptiveDialog/AdaptiveDialog.tsx +0 -97
  17. package/src/components/AdaptiveDialog/index.tsx +0 -2
  18. package/src/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +0 -49
  19. package/src/components/AdaptiveSidebar/AdaptiveSidebar.sample.tsx +0 -10
  20. package/src/components/AdaptiveSidebar/AdaptiveSidebar.tsx +0 -123
  21. package/src/components/AdaptiveSidebar/index.tsx +0 -2
  22. package/src/components/AnchoredTooltip/AnchoredTooltip.module.scss +0 -64
  23. package/src/components/AnchoredTooltip/AnchoredTooltip.tsx +0 -250
  24. package/src/components/AnchoredTooltip/index.tsx +0 -2
  25. package/src/components/AnimatedEntrance/AnimatedEntrance.module.scss +0 -108
  26. package/src/components/AnimatedEntrance/AnimatedEntrance.tsx +0 -227
  27. package/src/components/AnimatedEntrance/index.tsx +0 -2
  28. package/src/components/AsyncWrapper/AsyncWrapper.tsx +0 -38
  29. package/src/components/AsyncWrapper/index.tsx +0 -2
  30. package/src/components/Avatar/Avatar.module.scss +0 -22
  31. package/src/components/Avatar/Avatar.tsx +0 -31
  32. package/src/components/Avatar/index.tsx +0 -2
  33. package/src/components/BucketFill/BucketFill.module.scss +0 -36
  34. package/src/components/BucketFill/BucketFill.tsx +0 -65
  35. package/src/components/BucketFill/index.tsx +0 -2
  36. package/src/components/Button/Button.module.scss +0 -45
  37. package/src/components/Button/Button.tsx +0 -40
  38. package/src/components/Button/index.tsx +0 -2
  39. package/src/components/Card/Card.module.scss +0 -12
  40. package/src/components/Card/Card.tsx +0 -9
  41. package/src/components/Card/index.tsx +0 -2
  42. package/src/components/Chart/Chart.e2e.ts +0 -4
  43. package/src/components/Chart/Chart.logic.tsx +0 -8
  44. package/src/components/Chart/Chart.module.scss +0 -58
  45. package/src/components/Chart/Chart.tsx +0 -2
  46. package/src/components/Chart/Chart.types.ts +0 -35
  47. package/src/components/Chart/Chart.view.tsx +0 -241
  48. package/src/components/Chart/index.tsx +0 -2
  49. package/src/components/CheckBox/CheckBox.module.scss +0 -36
  50. package/src/components/CheckBox/CheckBox.tsx +0 -63
  51. package/src/components/CheckBox/index.tsx +0 -2
  52. package/src/components/CodeInput/CodeInput.module.scss +0 -5
  53. package/src/components/CodeInput/CodeInput.tsx +0 -84
  54. package/src/components/CodeInput/index.tsx +0 -2
  55. package/src/components/Collapsable/Collapsable.module.scss +0 -42
  56. package/src/components/Collapsable/Collapsable.tsx +0 -253
  57. package/src/components/Collapsable/index.tsx +0 -2
  58. package/src/components/Countdown/Countdown.tsx +0 -130
  59. package/src/components/Countdown/index.tsx +0 -2
  60. package/src/components/CurrencyInput/CurrencyInput.hook.ts +0 -37
  61. package/src/components/CurrencyInput/CurrencyInput.tsx +0 -25
  62. package/src/components/CurrencyInput/index.tsx +0 -2
  63. package/src/components/Divider/Divider.module.scss +0 -7
  64. package/src/components/Divider/Divider.tsx +0 -13
  65. package/src/components/Divider/index.tsx +0 -2
  66. package/src/components/EmailInput/EmailInput.module.scss +0 -0
  67. package/src/components/EmailInput/EmailInput.tsx +0 -51
  68. package/src/components/EmailInput/index.tsx +0 -2
  69. package/src/components/FadeIn/FadeIn.module.scss +0 -9
  70. package/src/components/FadeIn/FadeIn.tsx +0 -77
  71. package/src/components/FadeIn/index.tsx +0 -2
  72. package/src/components/FileInput/FileInput.module.scss +0 -6
  73. package/src/components/FileInput/FileInput.tsx +0 -75
  74. package/src/components/FileInput/View/BigFactory/BigFactory.module.scss +0 -20
  75. package/src/components/FileInput/View/BigFactory/BigFactory.tsx +0 -48
  76. package/src/components/FileInput/View/BigFactory/index.tsx +0 -2
  77. package/src/components/FileInput/View/Compact/Compact.module.scss +0 -68
  78. package/src/components/FileInput/View/Compact/Compact.tsx +0 -151
  79. package/src/components/FileInput/View/Compact/index.tsx +0 -2
  80. package/src/components/FileInput/View/View.types.ts +0 -12
  81. package/src/components/FileInput/index.tsx +0 -2
  82. package/src/components/FlowController/FlowController.module.scss +0 -47
  83. package/src/components/FlowController/FlowController.tsx +0 -93
  84. package/src/components/FlowController/index.tsx +0 -2
  85. package/src/components/Form/Form.tsx +0 -243
  86. package/src/components/Form/index.ts +0 -2
  87. package/src/components/Form/v2/Form.hook.ts +0 -341
  88. package/src/components/Form/v2/Form.module.scss +0 -0
  89. package/src/components/Form/v2/Form.tsx +0 -78
  90. package/src/components/Form/v2/Form.types.ts +0 -118
  91. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
  92. package/src/components/Form/v2/FormField/Extensions/DateField/DateField.tsx +0 -73
  93. package/src/components/Form/v2/FormField/Extensions/DateField/index.tsx +0 -2
  94. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
  95. package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.tsx +0 -91
  96. package/src/components/Form/v2/FormField/Extensions/PhoneField/index.tsx +0 -2
  97. package/src/components/Form/v2/FormField/FormField.module.scss +0 -0
  98. package/src/components/Form/v2/FormField/FormField.tsx +0 -378
  99. package/src/components/Form/v2/FormField/FormField.types.ts +0 -129
  100. package/src/components/Form/v2/FormField/index.tsx +0 -2
  101. package/src/components/Form/v2/index.tsx +0 -2
  102. package/src/components/Freeze/Freeze.tsx +0 -9
  103. package/src/components/Freeze/index.tsx +0 -2
  104. package/src/components/HSForms/HSForms.tsx +0 -57
  105. package/src/components/HSForms/index.tsx +0 -2
  106. package/src/components/Header/Header.module.scss +0 -119
  107. package/src/components/Header/Header.tsx +0 -138
  108. package/src/components/Header/index.tsx +0 -2
  109. package/src/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +0 -44
  110. package/src/components/HeaderCloseBtn/HeaderCloseBtn.tsx +0 -28
  111. package/src/components/HeaderCloseBtn/index.tsx +0 -2
  112. package/src/components/InfinityScroll/InfinityScroll.module.scss +0 -30
  113. package/src/components/InfinityScroll/InfinityScroll.tsx +0 -187
  114. package/src/components/InfinityScroll/index.tsx +0 -2
  115. package/src/components/Input/Input.module.scss +0 -71
  116. package/src/components/Input/Input.tsx +0 -134
  117. package/src/components/Input/index.tsx +0 -2
  118. package/src/components/InstantCounter/InstantCounter.tsx +0 -77
  119. package/src/components/InstantCounter/index.tsx +0 -2
  120. package/src/components/LavaLamp/LavaLamp.data.tsx +0 -114
  121. package/src/components/LavaLamp/LavaLamp.module.scss +0 -26
  122. package/src/components/LavaLamp/LavaLamp.tsx +0 -131
  123. package/src/components/LavaLamp/index.tsx +0 -2
  124. package/src/components/LavaLamp/v2/LavaLamp.module.scss +0 -23
  125. package/src/components/LavaLamp/v2/LavaLamp.tsx +0 -197
  126. package/src/components/LinkToId/LinkToId.module.scss +0 -4
  127. package/src/components/LinkToId/LinkToId.tsx +0 -51
  128. package/src/components/LinkToId/index.tsx +0 -2
  129. package/src/components/Loader/Loader.module.scss +0 -40
  130. package/src/components/Loader/Loader.tsx +0 -18
  131. package/src/components/Loader/index.tsx +0 -2
  132. package/src/components/LoaderDotsIndicator/LoaderDotsIndicator.tsx +0 -34
  133. package/src/components/LoaderDotsIndicator/index.tsx +0 -2
  134. package/src/components/LoopableVideo/LoopableVideo.tsx +0 -37
  135. package/src/components/LoopableVideo/index.tsx +0 -2
  136. package/src/components/MainGrid/MainGrid.module.scss +0 -28
  137. package/src/components/MainGrid/MainGrid.tsx +0 -68
  138. package/src/components/MainGrid/index.tsx +0 -2
  139. package/src/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +0 -220
  140. package/src/components/MutableHamburgerButton/MutableHamburgerButton.tsx +0 -38
  141. package/src/components/MutableHamburgerButton/index.tsx +0 -2
  142. package/src/components/Notification/Notification.module.scss +0 -25
  143. package/src/components/Notification/Notification.tsx +0 -13
  144. package/src/components/Notification/index.tsx +0 -2
  145. package/src/components/OrderableList/OrderableList.module.scss +0 -98
  146. package/src/components/OrderableList/OrderableList.tsx +0 -564
  147. package/src/components/OrderableList/index.tsx +0 -2
  148. package/src/components/PaginationIndicator/PaginationIndicator.tsx +0 -365
  149. package/src/components/PaginationIndicator/index.tsx +0 -2
  150. package/src/components/Parallax/Parallax.module.scss +0 -28
  151. package/src/components/Parallax/Parallax.tsx +0 -225
  152. package/src/components/Parallax/index.tsx +0 -2
  153. package/src/components/Parallax/math/helpers.ts +0 -289
  154. package/src/components/PasswordInput/PasswordInput.module.scss +0 -17
  155. package/src/components/PasswordInput/PasswordInput.tsx +0 -154
  156. package/src/components/PasswordInput/index.tsx +0 -2
  157. package/src/components/PingPongText/PingPongText.module.scss +0 -4
  158. package/src/components/PingPongText/PingPongText.tsx +0 -83
  159. package/src/components/PingPongText/index.tsx +0 -2
  160. package/src/components/PixelatedScan/PixelatedScan.module.scss +0 -86
  161. package/src/components/PixelatedScan/PixelatedScan.tsx +0 -175
  162. package/src/components/PixelatedScan/index.tsx +0 -2
  163. package/src/components/Portal/Portal.module.scss +0 -3
  164. package/src/components/Portal/Portal.tsx +0 -68
  165. package/src/components/Portal/index.tsx +0 -2
  166. package/src/components/ProgressBar/ProgressBar.module.scss +0 -44
  167. package/src/components/ProgressBar/ProgressBar.tsx +0 -124
  168. package/src/components/ProgressBar/index.tsx +0 -2
  169. package/src/components/ProgressTexts/ProgressTexts.module.scss +0 -37
  170. package/src/components/ProgressTexts/ProgressTexts.tsx +0 -85
  171. package/src/components/ProgressTexts/index.tsx +0 -2
  172. package/src/components/Radio/Radio.module.scss +0 -36
  173. package/src/components/Radio/Radio.tsx +0 -53
  174. package/src/components/Radio/index.tsx +0 -2
  175. package/src/components/SectionContainer/SectionContainer.module.scss +0 -30
  176. package/src/components/SectionContainer/SectionContainer.tsx +0 -49
  177. package/src/components/SectionContainer/index.tsx +0 -2
  178. package/src/components/Select/Select.module.scss +0 -58
  179. package/src/components/Select/Select.tsx +0 -192
  180. package/src/components/Select/index.tsx +0 -2
  181. package/src/components/Skeleton/Skeleton.module.scss +0 -21
  182. package/src/components/Skeleton/Skeleton.tsx +0 -29
  183. package/src/components/Skeleton/index.tsx +0 -2
  184. package/src/components/Spacing/Spacing.module.scss +0 -13
  185. package/src/components/Spacing/Spacing.tsx +0 -24
  186. package/src/components/Spacing/index.tsx +0 -2
  187. package/src/components/StaticScroller/StaticScroller.module.scss +0 -14
  188. package/src/components/StaticScroller/StaticScroller.tsx +0 -83
  189. package/src/components/StaticScroller/index.tsx +0 -2
  190. package/src/components/Switch/Switch.module.scss +0 -43
  191. package/src/components/Switch/Switch.tsx +0 -41
  192. package/src/components/Switch/index.tsx +0 -2
  193. package/src/components/Table/Table.module.scss +0 -76
  194. package/src/components/Table/Table.tsx +0 -152
  195. package/src/components/Table/index.tsx +0 -2
  196. package/src/components/Tabs/Tabs.module.scss +0 -40
  197. package/src/components/Tabs/Tabs.tsx +0 -104
  198. package/src/components/Tabs/index.tsx +0 -2
  199. package/src/components/Text/Text.module.scss +0 -81
  200. package/src/components/Text/Text.tsx +0 -42
  201. package/src/components/Text/index.tsx +0 -2
  202. package/src/components/Transition/MasksFactory/DiagonalReveal.tsx +0 -47
  203. package/src/components/Transition/MasksFactory/DiagonalSquareToBalls.tsx +0 -78
  204. package/src/components/Transition/MasksFactory/PhysicsSquares.tsx +0 -106
  205. package/src/components/Transition/MasksFactory/SquareToBalls.tsx +0 -66
  206. package/src/components/Transition/MasksFactory/utils.ts +0 -35
  207. package/src/components/Transition/Transition.module.scss +0 -211
  208. package/src/components/Transition/Transition.tsx +0 -495
  209. package/src/components/Transition/index.tsx +0 -2
  210. package/src/components/UncontrolledTransition/UncontrolledTransition.ai.md +0 -9
  211. package/src/components/UncontrolledTransition/UncontrolledTransition.sample.tsx +0 -34
  212. package/src/components/UncontrolledTransition/UncontrolledTransition.tsx +0 -143
  213. package/src/components/UncontrolledTransition/index.tsx +0 -2
  214. package/src/components/WalletConnectionWrapper/WalletConnectionWrapper.tsx +0 -212
  215. package/src/components/WalletConnectionWrapper/index.tsx +0 -2
  216. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +0 -5
  217. package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.tsx +0 -52
  218. package/src/components/utilitary/ScrollAndFocusLock/index.tsx +0 -2
  219. package/src/context/AsyncProcess.tsx +0 -107
  220. package/src/context/ContextAsyncControl.tsx +0 -89
  221. package/src/context/CustomBrowserRouter.tsx +0 -55
  222. package/src/context/OneUIProvider.tsx +0 -308
  223. package/src/hooks/logs/useDependencyChangeDetection.ts +0 -25
  224. package/src/hooks/logs/useIsMounting.ts +0 -7
  225. package/src/hooks/persistence/useLocalStorage.ts +0 -45
  226. package/src/hooks/shims/ObjectWatchShim.ts +0 -56
  227. package/src/hooks/ui/useAdaptiveImage.tsx +0 -36
  228. package/src/hooks/ui/useAlternating.tsx +0 -22
  229. package/src/hooks/ui/useBreakpoint.tsx +0 -21
  230. package/src/hooks/ui/useCustomScrollbar.module.scss +0 -20
  231. package/src/hooks/ui/useCustomScrollbar.tsx +0 -22
  232. package/src/hooks/ui/useEffectIf.ts +0 -11
  233. package/src/hooks/ui/useMouseHover.tsx +0 -26
  234. package/src/hooks/ui/usePaginationControls.module.scss +0 -16
  235. package/src/hooks/ui/usePaginationControls.tsx +0 -176
  236. package/src/hooks/ui/useSnapToViewport.module.scss +0 -6
  237. package/src/hooks/ui/useSnapToViewport.ts +0 -28
  238. package/src/hooks/ui/useTilt.tsx +0 -219
  239. package/src/hooks/ui/useZoomable.module.scss +0 -34
  240. package/src/hooks/ui/useZoomable.tsx +0 -144
  241. package/src/hooks/useAsyncControl.ai.md +0 -25
  242. package/src/hooks/useAsyncControl.ts +0 -101
  243. package/src/hooks/useContainedRepositioning.ts +0 -110
  244. package/src/hooks/useCustomHistory.ts +0 -14
  245. package/src/hooks/useElementFit.ts +0 -82
  246. package/src/hooks/useFirestoreWatch.ts +0 -54
  247. package/src/hooks/useForm.ts +0 -49
  248. package/src/hooks/useFreeze.ts +0 -12
  249. package/src/hooks/useHero.module.scss +0 -41
  250. package/src/hooks/useHero.ts +0 -514
  251. package/src/hooks/useIntersection.ts +0 -32
  252. package/src/hooks/useMergeRefs.ts +0 -29
  253. package/src/hooks/useObserve.ts +0 -24
  254. package/src/hooks/usePagination.ts +0 -228
  255. package/src/hooks/usePooledOperation.ts +0 -54
  256. package/src/hooks/usePooling.ts +0 -46
  257. package/src/hooks/useRebound.ts +0 -23
  258. package/src/hooks/useShortIntl.ai.md +0 -5
  259. package/src/hooks/useShortIntl.ts +0 -97
  260. package/src/hooks/utility/useAsyncMemo.ts +0 -43
  261. package/src/hooks/utility/useDepChange.ts +0 -11
  262. package/src/hooks/utility/useEvents.ts +0 -33
  263. package/src/hooks/utility/useImmediate.ts +0 -8
  264. package/src/hooks/utility/useManualInit.ts +0 -24
  265. package/src/hooks/utility/useModule.ts +0 -15
  266. package/src/hooks/utility/useQuery.ts +0 -15
  267. package/src/hooks/utility/useUniqueEffect.ts +0 -22
  268. package/src/index.preprocess.ts +0 -82
  269. package/src/index.ts +0 -229
  270. package/src/models/DebugLogger.ts +0 -7
  271. package/src/models/GenericContract.ts +0 -169
  272. package/src/models/Orbs.ts +0 -97
  273. package/src/reac-app-env.d.ts +0 -6
  274. package/src/storybook/assets/video/txt-reversed.mp4 +0 -0
  275. package/src/storybookUtils/index.tsx +0 -53
  276. package/src/test.tsx +0 -0
  277. package/src/type-utils.ts +0 -49
  278. package/src/types.ts +0 -199
  279. package/src/utility.d.ts +0 -70
  280. package/src/utils/blockchain.ts +0 -43
  281. package/src/utils/e2e.ts +0 -55
  282. package/src/utils/flatten.ts +0 -17
  283. package/src/utils/formatters.ts +0 -36
  284. package/src/utils/html.utils.ts +0 -3
  285. package/src/utils/ownEvent.ts +0 -8
  286. package/src/utils/test.ts +0 -20
@@ -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
- }
@@ -1,250 +0,0 @@
1
- import React, {
2
- ForwardedRef,
3
- forwardRef,
4
- JSX,
5
- ReactNode,
6
- RefObject,
7
- useEffect,
8
- useImperativeHandle,
9
- useLayoutEffect,
10
- useRef,
11
- useState,
12
- } from "react";
13
- import ReactDOM from "react-dom";
14
- import { useOneUIConfig } from "../../context/OneUIProvider";
15
- import FadeIn from "../FadeIn";
16
- import Styles from "./AnchoredTooltip.module.scss";
17
-
18
- type Props = {
19
- children: JSX.Element;
20
- anchorRef: RefObject<HTMLElement | null>;
21
- open: boolean;
22
- className?: string;
23
- /**
24
- * Indicates the tooltip should be always visible on viewport
25
- *
26
- * @default true
27
- */
28
- containInViewport?: boolean;
29
-
30
- style?: any;
31
- alignment?: AnchoredTooltipAlignment;
32
- };
33
-
34
- function getPositionOnViewport(element: HTMLElement) {
35
- return element.getBoundingClientRect();
36
- }
37
-
38
- export enum AnchoredTooltipAlignment {
39
- LEFT,
40
- CENTER,
41
- RIGHT,
42
- }
43
-
44
- export enum AnchoredTooltipAnchor {
45
- TOP,
46
- BOTTOM,
47
- }
48
-
49
- function calculateTooltipFromAnchor(
50
- anchorRef: HTMLElement,
51
- tooltipRef: HTMLDivElement,
52
- containInViewport: boolean,
53
- alignTo: AnchoredTooltipAlignment = AnchoredTooltipAlignment.CENTER,
54
- anchorTo: AnchoredTooltipAnchor = AnchoredTooltipAnchor.TOP
55
- ) {
56
- const anchorPosition = getPositionOnViewport(anchorRef);
57
-
58
- const shouldAnchorToBottom =
59
- anchorTo === AnchoredTooltipAnchor.BOTTOM ||
60
- tooltipRef.clientHeight > anchorPosition.top;
61
-
62
- let top = anchorPosition.top - tooltipRef.clientHeight;
63
-
64
- /**
65
- * The terms mean:
66
- * anchorPosition.left = The left to get to the left border of the anchor (visible element)
67
- * anchorPosition.width = The width of the anchor (visible element)
68
- * tooltipRef.clientWidth = The width of the content
69
- */
70
- let left = (() => {
71
- switch (alignTo) {
72
- case AnchoredTooltipAlignment.CENTER:
73
- return (
74
- anchorPosition.left +
75
- anchorPosition.width / 2 -
76
- tooltipRef.clientWidth / 2
77
- );
78
- case AnchoredTooltipAlignment.LEFT:
79
- return anchorPosition.left;
80
- case AnchoredTooltipAlignment.RIGHT:
81
- return (
82
- anchorPosition.left + anchorPosition.width - tooltipRef.clientWidth
83
- );
84
- }
85
- })();
86
-
87
- if (shouldAnchorToBottom)
88
- top += tooltipRef.clientHeight + anchorRef.clientHeight;
89
-
90
- if (containInViewport && top < 0) top = 0;
91
- const offset = top + tooltipRef.clientHeight - window.innerHeight;
92
- if (containInViewport && offset > 0) {
93
- top -= offset;
94
- }
95
- const offsetLeft = left + tooltipRef.clientWidth - window.innerWidth;
96
- if (containInViewport && offsetLeft > 0) {
97
- left -= offsetLeft;
98
- }
99
- if (containInViewport && left < 0) {
100
- left = 0;
101
- }
102
-
103
- const maxLeftOffsetIndicator = tooltipRef.clientWidth / 2 - 60;
104
- const tooltipCenter = tooltipRef.clientWidth / 2 + left;
105
- const anchorPositionCenter = anchorPosition.left + anchorPosition.width / 2;
106
-
107
- const offsetTooltip = anchorPositionCenter - tooltipCenter;
108
- const minOffsetTooltip = -(tooltipRef.clientWidth / 2) + 60;
109
-
110
- const offsetIndicatorLeft =
111
- offsetLeft > 0
112
- ? offsetLeft > maxLeftOffsetIndicator
113
- ? maxLeftOffsetIndicator
114
- : offsetLeft
115
- : offsetTooltip < 0
116
- ? offsetTooltip < minOffsetTooltip
117
- ? minOffsetTooltip
118
- : offsetTooltip
119
- : 0;
120
-
121
- return {
122
- offset,
123
- offsetIndicatorLeft,
124
- top,
125
- left,
126
- shouldAnchorToBottom,
127
- };
128
- }
129
-
130
- export function updateTooltipPosition(
131
- tooltipRef: HTMLDivElement,
132
- anchorRef: HTMLElement,
133
- limitToViewport: boolean = true,
134
- alignment: AnchoredTooltipAlignment = AnchoredTooltipAlignment.CENTER,
135
- anchorTo: AnchoredTooltipAnchor = AnchoredTooltipAnchor.TOP
136
- ) {
137
- const { top, left, shouldAnchorToBottom, offsetIndicatorLeft } =
138
- calculateTooltipFromAnchor(
139
- anchorRef,
140
- tooltipRef,
141
- limitToViewport,
142
- alignment,
143
- anchorTo
144
- );
145
- if (limitToViewport) {
146
- const maxHeight = window.innerHeight - top;
147
- tooltipRef.style.maxHeight = `${maxHeight - 32}px`;
148
- }
149
- tooltipRef.style.top = `${top}px`;
150
- tooltipRef.style.left = `${left}px`;
151
- tooltipRef.style.setProperty(
152
- "--anchor-indicator-offset-left",
153
- `${offsetIndicatorLeft}px`
154
- );
155
- if (shouldAnchorToBottom) {
156
- tooltipRef.classList.remove(Styles.anchoredTop);
157
- tooltipRef.classList.add(Styles.anchoredBottom);
158
- } else {
159
- tooltipRef.classList.add(Styles.anchoredTop);
160
- tooltipRef.classList.remove(Styles.anchoredBottom);
161
- }
162
-
163
- return { shouldAnchorToBottom };
164
- }
165
- function _AnchoredTooltip(
166
- { containInViewport = true, alignment, ...props }: Props,
167
- ref: ForwardedRef<{ updatePosition: () => void } | null>
168
- ) {
169
- const { open, children, anchorRef } = props;
170
- const tooltipRef = useRef<HTMLDivElement>(null);
171
- const className = useOneUIConfig("component.tooltip.className");
172
- const [realClosed, setRealClosed] = useState(!open);
173
-
174
- useEffect(() => {
175
- if (open) setRealClosed(false);
176
- }, [open]);
177
-
178
- useImperativeHandle(
179
- ref,
180
- () => ({
181
- updatePosition: () => {
182
- updateTooltipPosition(
183
- tooltipRef.current!,
184
- anchorRef.current!,
185
- containInViewport,
186
- alignment
187
- );
188
- },
189
- }),
190
- [containInViewport]
191
- );
192
-
193
- useEffect(() => {
194
- if (open && !realClosed) {
195
- if (anchorRef.current && tooltipRef.current)
196
- updateTooltipPosition(
197
- tooltipRef.current,
198
- anchorRef.current,
199
- containInViewport,
200
- alignment
201
- );
202
- const scrollHandler = () => {
203
- if (anchorRef.current && tooltipRef.current)
204
- updateTooltipPosition(
205
- tooltipRef.current,
206
- anchorRef.current,
207
- containInViewport,
208
- alignment
209
- );
210
- };
211
- window.addEventListener("scroll", scrollHandler, {
212
- passive: true,
213
- });
214
- return () => {
215
- window.removeEventListener("scroll", scrollHandler);
216
- };
217
- }
218
- }, [open, anchorRef, realClosed]);
219
-
220
- useLayoutEffect(() => {
221
- if (!tooltipRef.current) return;
222
- if (open) tooltipRef.current!.classList.add(Styles.open);
223
- else tooltipRef.current!.classList.remove(Styles.open);
224
- }, [open]);
225
-
226
- return !realClosed || open ? (
227
- <>
228
- {ReactDOM.createPortal(
229
- <FadeIn
230
- onClick={(e) => e.stopPropagation()}
231
- ref={tooltipRef}
232
- className={`${Styles.tooltipContainer} ${
233
- props.className || ""
234
- } ${className}`}
235
- style={props.style}
236
- onHidden={() => setRealClosed(true)}
237
- >
238
- {open && !realClosed ? <div>{children}</div> : undefined}
239
- </FadeIn>,
240
- document.body
241
- )}
242
- </>
243
- ) : null;
244
- }
245
-
246
- /**
247
- * This tooltip anchors itself to an element and handles positioning relative to the anchored element
248
- **/
249
- const AnchoredTooltip = forwardRef(_AnchoredTooltip);
250
- export default AnchoredTooltip;
@@ -1,2 +0,0 @@
1
- export { default } from "./AnchoredTooltip";
2
- export * from "./AnchoredTooltip";
@@ -1,108 +0,0 @@
1
- @use 'sass:math';
2
- @keyframes expand {
3
- 0% {
4
- transform: translateX(100%);
5
- }
6
-
7
- 35% {
8
- transform: translateX(100%);
9
- }
10
-
11
- 85% {
12
- transform: translateX(-5%);
13
- }
14
-
15
- 100% {
16
- transform: translateX(0%);
17
- }
18
- }
19
-
20
- @keyframes exiting {
21
- 100% {
22
- transform: translateX(100%);
23
- }
24
-
25
- 65% {
26
- transform: translateX(100%);
27
- }
28
-
29
- 50% {
30
- opacity: 0;
31
- }
32
-
33
- 15% {
34
- transform: translateX(-5%);
35
- opacity: 1;
36
- }
37
-
38
- 0% {
39
- transform: translateX(0%);
40
- }
41
- }
42
- $duration: 1s;
43
-
44
- .elementExiting {
45
- animation-duration: $duration !important;
46
- animation-name: exiting;
47
- position: absolute;
48
- }
49
-
50
- .elementEntering {
51
- animation-duration: $duration !important;
52
- animation-name: expand;
53
- }
54
- .elementExitingReverse {
55
- animation-duration: $duration !important;
56
- animation-name: exiting;
57
- }
58
-
59
- .elementEnteringReverse {
60
- animation-duration: $duration !important;
61
- animation-name: expand;
62
- position: absolute;
63
- }
64
-
65
- .resetHeight {
66
- transition: max-height math.div($duration, 2) $duration * 0.2;
67
- min-height: initial;
68
- align-items: flex-start !important;
69
- flex-shrink: 0;
70
- > * {
71
- justify-content: flex-start !important;
72
- }
73
- }
74
-
75
- .maxHeight {
76
- max-height: 0px;
77
- }
78
-
79
- @keyframes nothing {
80
- 100% {
81
- transform: translateX(0%);
82
- }
83
-
84
- 0% {
85
- transform: translateX(0%);
86
- }
87
- }
88
-
89
- .elementShrinking {
90
- animation-duration: $duration !important;
91
- animation-name: nothing;
92
- position: absolute;
93
- }
94
-
95
- .elementExpanding {
96
- animation-duration: $duration !important;
97
- animation-name: nothing;
98
- }
99
- .elementShrinkingReverse {
100
- animation-duration: $duration !important;
101
- animation-name: nothing;
102
- }
103
-
104
- .elementExpandingReverse {
105
- animation-duration: $duration !important;
106
- animation-name: nothing;
107
- position: absolute;
108
- }