@onepercentio/one-ui 0.28.8 → 0.29.0
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/utils/e2e.d.ts +13 -0
- package/dist/utils/e2e.js +42 -0
- package/package.json +4 -1
- package/src/assets/img/svg/checkbox.svg +3 -0
- package/src/assets/styles/index.scss +2 -0
- package/src/assets/styles/mixins.scss +12 -0
- package/src/assets/styles/variables.scss +49 -0
- package/src/components/AdaptiveButton/AdaptiveButton.module.scss +7 -0
- package/src/components/AdaptiveButton/AdaptiveButton.tsx +26 -0
- package/src/components/AdaptiveButton/index.tsx +1 -0
- package/src/components/AdaptiveContainer/AdaptiveContainer.module.scss +53 -0
- package/src/components/AdaptiveContainer/AdaptiveContainer.tsx +200 -0
- package/src/components/AdaptiveContainer/index.tsx +1 -0
- package/src/components/AdaptiveDialog/AdaptiveDialog.module.scss +147 -0
- package/src/components/AdaptiveDialog/AdaptiveDialog.tsx +97 -0
- package/src/components/AdaptiveDialog/index.tsx +1 -0
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +49 -0
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.sample.tsx +10 -0
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.tsx +123 -0
- package/src/components/AdaptiveSidebar/index.tsx +1 -0
- package/src/components/AnchoredTooltip/AnchoredTooltip.module.scss +64 -0
- package/src/components/AnchoredTooltip/AnchoredTooltip.tsx +250 -0
- package/src/components/AnchoredTooltip/index.tsx +1 -0
- package/src/components/AnimatedEntrance/AnimatedEntrance.module.scss +108 -0
- package/src/components/AnimatedEntrance/AnimatedEntrance.tsx +227 -0
- package/src/components/AnimatedEntrance/index.tsx +5 -0
- package/src/components/AsyncWrapper/AsyncWrapper.tsx +38 -0
- package/src/components/AsyncWrapper/index.tsx +1 -0
- package/src/components/Avatar/Avatar.module.scss +22 -0
- package/src/components/Avatar/Avatar.tsx +31 -0
- package/src/components/Avatar/index.tsx +1 -0
- package/src/components/BucketFill/BucketFill.module.scss +36 -0
- package/src/components/BucketFill/BucketFill.tsx +65 -0
- package/src/components/BucketFill/index.tsx +1 -0
- package/src/components/Button/Button.module.scss +45 -0
- package/src/components/Button/Button.tsx +40 -0
- package/src/components/Button/index.tsx +1 -0
- package/src/components/Card/Card.module.scss +12 -0
- package/src/components/Card/Card.tsx +9 -0
- package/src/components/Card/index.tsx +1 -0
- package/src/components/Chart/Chart.e2e.ts +4 -0
- package/src/components/Chart/Chart.logic.tsx +8 -0
- package/src/components/Chart/Chart.module.scss +58 -0
- package/src/components/Chart/Chart.types.ts +35 -0
- package/src/components/Chart/Chart.view.tsx +240 -0
- package/src/components/Chart/index.tsx +1 -0
- package/src/components/CheckBox/CheckBox.module.scss +36 -0
- package/src/components/CheckBox/CheckBox.tsx +63 -0
- package/src/components/CheckBox/index.tsx +1 -0
- package/src/components/CodeInput/CodeInput.module.scss +5 -0
- package/src/components/CodeInput/CodeInput.tsx +84 -0
- package/src/components/CodeInput/index.tsx +1 -0
- package/src/components/Collapsable/Collapsable.module.scss +42 -0
- package/src/components/Collapsable/Collapsable.tsx +253 -0
- package/src/components/Collapsable/index.tsx +1 -0
- package/src/components/Countdown/Countdown.tsx +130 -0
- package/src/components/Countdown/index.tsx +1 -0
- package/src/components/CurrencyInput/CurrencyInput.hook.ts +37 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +25 -0
- package/src/components/CurrencyInput/index.tsx +1 -0
- package/src/components/Divider/Divider.module.scss +7 -0
- package/src/components/Divider/Divider.tsx +13 -0
- package/src/components/Divider/index.tsx +1 -0
- package/src/components/EmailInput/EmailInput.module.scss +0 -0
- package/src/components/EmailInput/EmailInput.tsx +51 -0
- package/src/components/EmailInput/index.tsx +1 -0
- package/src/components/FadeIn/FadeIn.module.scss +9 -0
- package/src/components/FadeIn/FadeIn.tsx +77 -0
- package/src/components/FadeIn/index.tsx +1 -0
- package/src/components/FileInput/FileInput.module.scss +6 -0
- package/src/components/FileInput/FileInput.tsx +75 -0
- package/src/components/FileInput/View/BigFactory/BigFactory.module.scss +20 -0
- package/src/components/FileInput/View/BigFactory/BigFactory.tsx +48 -0
- package/src/components/FileInput/View/BigFactory/index.tsx +1 -0
- package/src/components/FileInput/View/Compact/Compact.module.scss +68 -0
- package/src/components/FileInput/View/Compact/Compact.tsx +151 -0
- package/src/components/FileInput/View/Compact/index.tsx +1 -0
- package/src/components/FileInput/View/View.types.ts +12 -0
- package/src/components/FileInput/index.tsx +1 -0
- package/src/components/FlowController/FlowController.module.scss +47 -0
- package/src/components/FlowController/FlowController.tsx +93 -0
- package/src/components/FlowController/index.tsx +1 -0
- package/src/components/Form/Form.tsx +243 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/Form/v2/Form.hook.ts +341 -0
- package/src/components/Form/v2/Form.module.scss +0 -0
- package/src/components/Form/v2/Form.tsx +78 -0
- package/src/components/Form/v2/Form.types.ts +118 -0
- package/src/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
- package/src/components/Form/v2/FormField/Extensions/DateField/DateField.tsx +73 -0
- package/src/components/Form/v2/FormField/Extensions/DateField/index.tsx +1 -0
- package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
- package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.tsx +91 -0
- package/src/components/Form/v2/FormField/Extensions/PhoneField/index.tsx +1 -0
- package/src/components/Form/v2/FormField/FormField.module.scss +0 -0
- package/src/components/Form/v2/FormField/FormField.tsx +378 -0
- package/src/components/Form/v2/FormField/FormField.types.ts +129 -0
- package/src/components/Form/v2/FormField/index.tsx +1 -0
- package/src/components/Form/v2/index.tsx +1 -0
- package/src/components/Freeze/Freeze.tsx +9 -0
- package/src/components/Freeze/index.tsx +1 -0
- package/src/components/HSForms/HSForms.tsx +57 -0
- package/src/components/HSForms/index.tsx +1 -0
- package/src/components/Header/Header.module.scss +119 -0
- package/src/components/Header/Header.tsx +138 -0
- package/src/components/Header/index.tsx +1 -0
- package/src/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +44 -0
- package/src/components/HeaderCloseBtn/HeaderCloseBtn.tsx +28 -0
- package/src/components/HeaderCloseBtn/index.tsx +1 -0
- package/src/components/InfinityScroll/InfinityScroll.module.scss +30 -0
- package/src/components/InfinityScroll/InfinityScroll.tsx +187 -0
- package/src/components/InfinityScroll/index.tsx +1 -0
- package/src/components/Input/Input.module.scss +71 -0
- package/src/components/Input/Input.tsx +134 -0
- package/src/components/Input/index.tsx +1 -0
- package/src/components/InstantCounter/InstantCounter.tsx +77 -0
- package/src/components/InstantCounter/index.tsx +1 -0
- package/src/components/LavaLamp/LavaLamp.data.tsx +114 -0
- package/src/components/LavaLamp/LavaLamp.module.scss +26 -0
- package/src/components/LavaLamp/LavaLamp.tsx +131 -0
- package/src/components/LavaLamp/index.tsx +1 -0
- package/src/components/LavaLamp/v2/LavaLamp.module.scss +23 -0
- package/src/components/LavaLamp/v2/LavaLamp.tsx +197 -0
- package/src/components/LinkToId/LinkToId.module.scss +4 -0
- package/src/components/LinkToId/LinkToId.tsx +51 -0
- package/src/components/LinkToId/index.tsx +1 -0
- package/src/components/Loader/Loader.module.scss +40 -0
- package/src/components/Loader/Loader.tsx +18 -0
- package/src/components/Loader/index.tsx +1 -0
- package/src/components/LoaderDotsIndicator/LoaderDotsIndicator.tsx +34 -0
- package/src/components/LoaderDotsIndicator/index.tsx +1 -0
- package/src/components/LoopableVideo/LoopableVideo.tsx +37 -0
- package/src/components/LoopableVideo/index.tsx +1 -0
- package/src/components/MainGrid/MainGrid.module.scss +28 -0
- package/src/components/MainGrid/MainGrid.tsx +68 -0
- package/src/components/MainGrid/index.tsx +1 -0
- package/src/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +220 -0
- package/src/components/MutableHamburgerButton/MutableHamburgerButton.tsx +38 -0
- package/src/components/MutableHamburgerButton/index.tsx +1 -0
- package/src/components/Notification/Notification.module.scss +25 -0
- package/src/components/Notification/Notification.tsx +13 -0
- package/src/components/Notification/index.tsx +1 -0
- package/src/components/OrderableList/OrderableList.module.scss +98 -0
- package/src/components/OrderableList/OrderableList.tsx +564 -0
- package/src/components/OrderableList/index.tsx +1 -0
- package/src/components/PaginationIndicator/PaginationIndicator.tsx +365 -0
- package/src/components/PaginationIndicator/index.tsx +1 -0
- package/src/components/Parallax/Parallax.module.scss +28 -0
- package/src/components/Parallax/Parallax.tsx +248 -0
- package/src/components/Parallax/index.tsx +1 -0
- package/src/components/Parallax/math/helpers.ts +289 -0
- package/src/components/PasswordInput/PasswordInput.module.scss +17 -0
- package/src/components/PasswordInput/PasswordInput.tsx +154 -0
- package/src/components/PasswordInput/index.tsx +1 -0
- package/src/components/PingPongText/PingPongText.module.scss +4 -0
- package/src/components/PingPongText/PingPongText.tsx +83 -0
- package/src/components/PingPongText/index.tsx +1 -0
- package/src/components/PixelatedScan/PixelatedScan.module.scss +86 -0
- package/src/components/PixelatedScan/PixelatedScan.tsx +175 -0
- package/src/components/PixelatedScan/index.tsx +1 -0
- package/src/components/Portal/Portal.module.scss +3 -0
- package/src/components/Portal/Portal.tsx +68 -0
- package/src/components/Portal/index.tsx +1 -0
- package/src/components/ProgressBar/ProgressBar.module.scss +44 -0
- package/src/components/ProgressBar/ProgressBar.tsx +124 -0
- package/src/components/ProgressBar/index.tsx +1 -0
- package/src/components/ProgressTexts/ProgressTexts.module.scss +37 -0
- package/src/components/ProgressTexts/ProgressTexts.tsx +85 -0
- package/src/components/ProgressTexts/index.tsx +1 -0
- package/src/components/Radio/Radio.module.scss +36 -0
- package/src/components/Radio/Radio.tsx +53 -0
- package/src/components/Radio/index.tsx +1 -0
- package/src/components/SectionContainer/SectionContainer.module.scss +30 -0
- package/src/components/SectionContainer/SectionContainer.tsx +49 -0
- package/src/components/SectionContainer/index.tsx +1 -0
- package/src/components/Select/Select.module.scss +58 -0
- package/src/components/Select/Select.tsx +192 -0
- package/src/components/Select/index.tsx +1 -0
- package/src/components/Skeleton/Skeleton.module.scss +21 -0
- package/src/components/Skeleton/Skeleton.tsx +29 -0
- package/src/components/Skeleton/index.tsx +1 -0
- package/src/components/Spacing/Spacing.module.scss +13 -0
- package/src/components/Spacing/Spacing.tsx +24 -0
- package/src/components/Spacing/index.tsx +1 -0
- package/src/components/StaticScroller/StaticScroller.module.scss +14 -0
- package/src/components/StaticScroller/StaticScroller.tsx +83 -0
- package/src/components/StaticScroller/index.tsx +1 -0
- package/src/components/Switch/Switch.module.scss +43 -0
- package/src/components/Switch/Switch.tsx +41 -0
- package/src/components/Switch/index.tsx +1 -0
- package/src/components/Table/Table.module.scss +76 -0
- package/src/components/Table/Table.tsx +152 -0
- package/src/components/Table/index.tsx +1 -0
- package/src/components/Tabs/Tabs.module.scss +40 -0
- package/src/components/Tabs/Tabs.tsx +104 -0
- package/src/components/Tabs/index.tsx +1 -0
- package/src/components/Text/Text.module.scss +81 -0
- package/src/components/Text/Text.tsx +42 -0
- package/src/components/Text/index.tsx +1 -0
- package/src/components/Transition/MasksFactory/DiagonalReveal.tsx +47 -0
- package/src/components/Transition/MasksFactory/DiagonalSquareToBalls.tsx +78 -0
- package/src/components/Transition/MasksFactory/PhysicsSquares.tsx +106 -0
- package/src/components/Transition/MasksFactory/SquareToBalls.tsx +66 -0
- package/src/components/Transition/MasksFactory/utils.ts +35 -0
- package/src/components/Transition/Transition.module.scss +211 -0
- package/src/components/Transition/Transition.tsx +495 -0
- package/src/components/Transition/index.tsx +1 -0
- package/src/components/UncontrolledTransition/UncontrolledTransition.ai.md +9 -0
- package/src/components/UncontrolledTransition/UncontrolledTransition.sample.tsx +34 -0
- package/src/components/UncontrolledTransition/UncontrolledTransition.tsx +143 -0
- package/src/components/UncontrolledTransition/index.tsx +2 -0
- package/src/components/WalletConnectionWrapper/WalletConnectionWrapper.tsx +212 -0
- package/src/components/WalletConnectionWrapper/index.tsx +1 -0
- package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +5 -0
- package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.tsx +52 -0
- package/src/components/utilitary/ScrollAndFocusLock/index.tsx +1 -0
- package/src/context/AsyncProcess.tsx +107 -0
- package/src/context/ContextAsyncControl.tsx +89 -0
- package/src/context/CustomBrowserRouter.tsx +55 -0
- package/src/context/OneUIProvider.tsx +308 -0
- package/src/hooks/logs/useDependencyChangeDetection.ts +25 -0
- package/src/hooks/logs/useIsMounting.ts +7 -0
- package/src/hooks/persistence/useLocalStorage.ts +45 -0
- package/src/hooks/shims/ObjectWatchShim.ts +56 -0
- package/src/hooks/ui/useAdaptiveImage.tsx +36 -0
- package/src/hooks/ui/useAlternating.tsx +22 -0
- package/src/hooks/ui/useBreakpoint.tsx +21 -0
- package/src/hooks/ui/useCustomScrollbar.module.scss +20 -0
- package/src/hooks/ui/useCustomScrollbar.tsx +22 -0
- package/src/hooks/ui/useEffectIf.ts +11 -0
- package/src/hooks/ui/useMouseHover.tsx +26 -0
- package/src/hooks/ui/usePaginationControls.module.scss +16 -0
- package/src/hooks/ui/usePaginationControls.tsx +176 -0
- package/src/hooks/ui/useSnapToViewport.module.scss +6 -0
- package/src/hooks/ui/useSnapToViewport.ts +28 -0
- package/src/hooks/ui/useTilt.tsx +219 -0
- package/src/hooks/ui/useZoomable.module.scss +34 -0
- package/src/hooks/ui/useZoomable.tsx +144 -0
- package/src/hooks/useAsyncControl.ai.md +25 -0
- package/src/hooks/useAsyncControl.ts +101 -0
- package/src/hooks/useContainedRepositioning.ts +110 -0
- package/src/hooks/useCustomHistory.ts +14 -0
- package/src/hooks/useElementFit.ts +82 -0
- package/src/hooks/useFirestoreWatch.ts +54 -0
- package/src/hooks/useForm.ts +49 -0
- package/src/hooks/useFreeze.ts +12 -0
- package/src/hooks/useHero.module.scss +41 -0
- package/src/hooks/useHero.ts +512 -0
- package/src/hooks/useIntersection.ts +32 -0
- package/src/hooks/useMergeRefs.ts +29 -0
- package/src/hooks/useObserve.ts +24 -0
- package/src/hooks/usePagination.ts +228 -0
- package/src/hooks/usePooledOperation.ts +54 -0
- package/src/hooks/usePooling.ts +46 -0
- package/src/hooks/useRebound.ts +23 -0
- package/src/hooks/useShortIntl.ai.md +5 -0
- package/src/hooks/useShortIntl.ts +97 -0
- package/src/hooks/utility/useAsyncMemo.ts +43 -0
- package/src/hooks/utility/useDepChange.ts +11 -0
- package/src/hooks/utility/useEvents.ts +33 -0
- package/src/hooks/utility/useImmediate.ts +8 -0
- package/src/hooks/utility/useManualInit.ts +24 -0
- package/src/hooks/utility/useModule.ts +15 -0
- package/src/hooks/utility/useQuery.ts +15 -0
- package/src/hooks/utility/useUniqueEffect.ts +22 -0
- package/src/index.ts +3 -0
- package/src/models/DebugLogger.ts +7 -0
- package/src/models/GenericContract.ts +169 -0
- package/src/models/Orbs.ts +97 -0
- package/src/reac-app-env.d.ts +6 -0
- package/src/storybook/assets/video/txt-reversed.mp4 +0 -0
- package/src/storybookUtils/index.tsx +53 -0
- package/src/type-utils.ts +49 -0
- package/src/utility.d.ts +70 -0
- package/src/utils/blockchain.ts +43 -0
- package/src/utils/e2e.ts +52 -0
- package/src/utils/flatten.ts +17 -0
- package/src/utils/formatters.ts +36 -0
- package/src/utils/html.utils.ts +3 -0
- package/src/utils/ownEvent.ts +8 -0
- package/src/utils/test.ts +19 -0
|
@@ -0,0 +1,75 @@
|
|
|
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;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './BigFactory';
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, ProgressIndicator } from './Compact';
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FileInput';
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FlowController';
|