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