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