@onepercentio/one-ui 0.28.8 → 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 +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/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,49 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createRef,
|
|
3
|
+
ForwardedRef,
|
|
4
|
+
forwardRef,
|
|
5
|
+
JSX,
|
|
6
|
+
PropsWithChildren,
|
|
7
|
+
RefObject,
|
|
8
|
+
} from "react";
|
|
9
|
+
import Styles from "./SectionContainer.module.scss";
|
|
10
|
+
|
|
11
|
+
export function createId(...args: string[]): string {
|
|
12
|
+
return args.join("-");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type Props<S extends string> = PropsWithChildren<{
|
|
16
|
+
decoration?: "dark" | "light";
|
|
17
|
+
section?: S;
|
|
18
|
+
className?: string;
|
|
19
|
+
onClick?: JSX.IntrinsicElements["div"]["onClick"];
|
|
20
|
+
}>;
|
|
21
|
+
function _SectionContainer<S extends string = OnepercentUtility.PageSections>(
|
|
22
|
+
{ children, section, className = "", decoration, onClick }: Props<S>,
|
|
23
|
+
ref: ForwardedRef<HTMLDivElement>
|
|
24
|
+
) {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
ref={ref}
|
|
28
|
+
onClick={onClick}
|
|
29
|
+
className={`${Styles.root} ${className}`}
|
|
30
|
+
id={section}
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
className={`${Styles.content} ${decoration ? Styles.decorated : ""}`}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
{decoration && (
|
|
37
|
+
<div className={`${Styles.decoration} ${Styles[decoration]}`} />
|
|
38
|
+
)}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* This component wraps a section and limits the width of it's content as well as requiring an id to reference to this section
|
|
46
|
+
**/
|
|
47
|
+
const SectionContainer =
|
|
48
|
+
forwardRef<HTMLDivElement, Props<string>>(_SectionContainer);
|
|
49
|
+
export default SectionContainer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SectionContainer';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@import "../../assets/styles/index.scss";
|
|
2
|
+
|
|
3
|
+
.items > * {
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
background: $mainBackgroundColor;
|
|
6
|
+
padding: 12px 32px;
|
|
7
|
+
&:not(:last-child) {
|
|
8
|
+
margin-bottom: 8px;
|
|
9
|
+
}
|
|
10
|
+
margin-left: 4px;
|
|
11
|
+
margin-right: 4px;
|
|
12
|
+
text-align: left;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
&.selected {
|
|
16
|
+
background-color: $lightGray;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
.empty {
|
|
20
|
+
opacity: 0.3;
|
|
21
|
+
}
|
|
22
|
+
.input {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
input {
|
|
25
|
+
transition: opacity $fast;
|
|
26
|
+
padding-right: 30px;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.indicator {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
transition: transform $fast;
|
|
37
|
+
min-height: inherit;
|
|
38
|
+
transform: rotateX(0deg);
|
|
39
|
+
}
|
|
40
|
+
.open {
|
|
41
|
+
transform: rotateX(180deg);
|
|
42
|
+
}
|
|
43
|
+
.optionsContainer {
|
|
44
|
+
margin: 0px 8px;
|
|
45
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.16);
|
|
46
|
+
}
|
|
47
|
+
.searchInput {
|
|
48
|
+
position: sticky;
|
|
49
|
+
top: 0px;
|
|
50
|
+
> * > span {
|
|
51
|
+
margin-right: 12px;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
input {
|
|
56
|
+
margin-bottom: 0px !important;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentProps,
|
|
3
|
+
DetailedHTMLProps,
|
|
4
|
+
ElementRef,
|
|
5
|
+
HTMLAttributes,
|
|
6
|
+
ReactElement,
|
|
7
|
+
useEffect,
|
|
8
|
+
useLayoutEffect,
|
|
9
|
+
useMemo,
|
|
10
|
+
useRef,
|
|
11
|
+
useState,
|
|
12
|
+
} from "react";
|
|
13
|
+
import Collapsable from "../Collapsable";
|
|
14
|
+
import Text from "../Text";
|
|
15
|
+
import Styles from "./Select.module.scss";
|
|
16
|
+
import Input from "../Input";
|
|
17
|
+
import Loader from "../Loader";
|
|
18
|
+
import {
|
|
19
|
+
OneUIContextSpecs,
|
|
20
|
+
useOneUIConfig,
|
|
21
|
+
useOneUIContext,
|
|
22
|
+
} from "../../context/OneUIProvider";
|
|
23
|
+
import {
|
|
24
|
+
AnchoredTooltipAlignment,
|
|
25
|
+
AnchoredTooltipAnchor,
|
|
26
|
+
} from "../AnchoredTooltip/AnchoredTooltip";
|
|
27
|
+
|
|
28
|
+
export type SelectItem = (
|
|
29
|
+
| {
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
| {
|
|
34
|
+
label: ReactElement;
|
|
35
|
+
labelStr: string;
|
|
36
|
+
value: string;
|
|
37
|
+
}
|
|
38
|
+
) &
|
|
39
|
+
Omit<
|
|
40
|
+
DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLElement>,
|
|
41
|
+
"ref" | "color"
|
|
42
|
+
>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A dropdown select
|
|
46
|
+
**/
|
|
47
|
+
function Select<I extends SelectItem>({
|
|
48
|
+
items,
|
|
49
|
+
selected,
|
|
50
|
+
label,
|
|
51
|
+
onClick,
|
|
52
|
+
loading,
|
|
53
|
+
rootClassName = "",
|
|
54
|
+
dropdownClassName: _drop = "",
|
|
55
|
+
alignTo = AnchoredTooltipAlignment.CENTER,
|
|
56
|
+
filter,
|
|
57
|
+
...otherProps
|
|
58
|
+
}: {
|
|
59
|
+
loading?: boolean;
|
|
60
|
+
items: Readonly<I[]>;
|
|
61
|
+
onClick: (i: I) => void;
|
|
62
|
+
rootClassName?: string;
|
|
63
|
+
dropdownClassName?: string;
|
|
64
|
+
alignTo?: AnchoredTooltipAlignment;
|
|
65
|
+
filter?: (item: I, term: string) => boolean;
|
|
66
|
+
} & (
|
|
67
|
+
| {
|
|
68
|
+
selected?: I["value"];
|
|
69
|
+
label: string;
|
|
70
|
+
}
|
|
71
|
+
| {
|
|
72
|
+
selected: I["value"];
|
|
73
|
+
label?: string;
|
|
74
|
+
}
|
|
75
|
+
) &
|
|
76
|
+
Omit<ComponentProps<typeof Input>, "selected" | "onClick">) {
|
|
77
|
+
const { StateIndicator } = useOneUIContext().component.select;
|
|
78
|
+
const collapsableRef = useRef<ElementRef<typeof Collapsable>>(null);
|
|
79
|
+
|
|
80
|
+
const _selected = useMemo(() => {
|
|
81
|
+
return items.find((a) => a.value === selected);
|
|
82
|
+
}, [selected, items]);
|
|
83
|
+
|
|
84
|
+
const [open, setOpen] = useState(false);
|
|
85
|
+
const [filterTerm, setFilterTerm] = useState("");
|
|
86
|
+
|
|
87
|
+
const filteredItems = useMemo(() => {
|
|
88
|
+
if (filter && filterTerm)
|
|
89
|
+
return items.filter((item) => filter(item, filterTerm));
|
|
90
|
+
else return items;
|
|
91
|
+
}, [filterTerm, items]);
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
collapsableRef.current!.redimension();
|
|
95
|
+
}, [filteredItems.length]);
|
|
96
|
+
|
|
97
|
+
useLayoutEffect(() => {
|
|
98
|
+
if (open) setFilterTerm("");
|
|
99
|
+
}, [open]);
|
|
100
|
+
|
|
101
|
+
const selectClasses = _drop
|
|
102
|
+
? ({
|
|
103
|
+
dropdown: _drop,
|
|
104
|
+
} as NonNullable<OneUIContextSpecs["component"]["select"]["className"]>)
|
|
105
|
+
: useOneUIConfig("component.select.className", {});
|
|
106
|
+
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (open) {
|
|
109
|
+
const close = () => {
|
|
110
|
+
setOpen(false);
|
|
111
|
+
};
|
|
112
|
+
window.addEventListener("click", close);
|
|
113
|
+
return () => window.removeEventListener("click", close);
|
|
114
|
+
}
|
|
115
|
+
}, [open]);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<Collapsable
|
|
119
|
+
title={
|
|
120
|
+
<Input
|
|
121
|
+
{...otherProps}
|
|
122
|
+
className={`${Styles.input} ${selectClasses.input} ${
|
|
123
|
+
!items.length ? Styles.empty : ""
|
|
124
|
+
}`}
|
|
125
|
+
value={
|
|
126
|
+
_selected
|
|
127
|
+
? "labelStr" in _selected
|
|
128
|
+
? _selected.labelStr
|
|
129
|
+
: _selected.label
|
|
130
|
+
: label || ""
|
|
131
|
+
}
|
|
132
|
+
disabled
|
|
133
|
+
Icon={
|
|
134
|
+
<div className={`${Styles.indicator}`}>
|
|
135
|
+
{loading ? <Loader /> : <StateIndicator open={!!open} />}
|
|
136
|
+
</div>
|
|
137
|
+
}
|
|
138
|
+
/>
|
|
139
|
+
}
|
|
140
|
+
id={undefined}
|
|
141
|
+
mode="float"
|
|
142
|
+
open={open}
|
|
143
|
+
onToggleOpen={(open) => {
|
|
144
|
+
if (items.length) setOpen(open);
|
|
145
|
+
}}
|
|
146
|
+
className={`${otherProps.disabled ? "disabled" : ""} ${rootClassName}`}
|
|
147
|
+
contentClassName={`${Styles.optionsContainer} ${selectClasses.dropdown}`}
|
|
148
|
+
alignTo={alignTo}
|
|
149
|
+
ref={collapsableRef}
|
|
150
|
+
anchorTo={AnchoredTooltipAnchor.BOTTOM}
|
|
151
|
+
>
|
|
152
|
+
<div
|
|
153
|
+
className={Styles.items}
|
|
154
|
+
onClick={(e) => {
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
setOpen(false);
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
{filter && (
|
|
160
|
+
<div className={Styles.searchInput}>
|
|
161
|
+
<Input
|
|
162
|
+
onChange={({ target: { value } }) => setFilterTerm(value)}
|
|
163
|
+
decoration={<span>🔎 </span>}
|
|
164
|
+
containerProps={{
|
|
165
|
+
onClick: (e) => e.stopPropagation(),
|
|
166
|
+
}}
|
|
167
|
+
border={false}
|
|
168
|
+
value={filterTerm}
|
|
169
|
+
/>
|
|
170
|
+
</div>
|
|
171
|
+
)}
|
|
172
|
+
{filteredItems.map((i) => (
|
|
173
|
+
<Text
|
|
174
|
+
type="caption"
|
|
175
|
+
key={i.value}
|
|
176
|
+
className={`${
|
|
177
|
+
i === _selected
|
|
178
|
+
? `${Styles.selected} ${selectClasses.selectedItem}`
|
|
179
|
+
: ""
|
|
180
|
+
} ${selectClasses.item || ""}`}
|
|
181
|
+
onClick={() => onClick(i)}
|
|
182
|
+
{...i}
|
|
183
|
+
>
|
|
184
|
+
{i.label}
|
|
185
|
+
</Text>
|
|
186
|
+
))}
|
|
187
|
+
</div>
|
|
188
|
+
</Collapsable>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export default Select;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Select';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@import "../../assets/styles";
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
background: linear-gradient(10deg, #0000 10%, #0006, #0000 80%);
|
|
5
|
+
background-size: var(--biggest-unit) var(--biggest-unit);
|
|
6
|
+
animation-name: moving;
|
|
7
|
+
animation-duration: $slow;
|
|
8
|
+
animation-iteration-count: infinite;
|
|
9
|
+
animation-timing-function: linear;
|
|
10
|
+
border-radius: 0.4em;
|
|
11
|
+
display: inline-block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@keyframes moving {
|
|
15
|
+
0% {
|
|
16
|
+
background-position: 0em 0em;
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
background-position: 0em var(--biggest-unit);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Styles from "./Skeleton.module.scss";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A skeleton element used to display a content that is loading
|
|
6
|
+
*
|
|
7
|
+
* Usually, it is used for paragraph elements, with a specific size
|
|
8
|
+
* So it's width and height is translated to em units
|
|
9
|
+
**/
|
|
10
|
+
export default function Skeleton({
|
|
11
|
+
width,
|
|
12
|
+
height = 1,
|
|
13
|
+
}: {
|
|
14
|
+
width: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<span
|
|
19
|
+
className={Styles.root}
|
|
20
|
+
style={
|
|
21
|
+
{
|
|
22
|
+
"--biggest-unit": `${Math.max(width, height) * 2}em`,
|
|
23
|
+
width: `${width}em`,
|
|
24
|
+
height: `${height}em`,
|
|
25
|
+
} as any
|
|
26
|
+
}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Skeleton';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import Styles from "./Spacing.module.scss";
|
|
3
|
+
import { useOneUIConfig } from "../../context/OneUIProvider";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A component to inject some spacing between component when required
|
|
7
|
+
**/
|
|
8
|
+
export default function Spacing({
|
|
9
|
+
size,
|
|
10
|
+
}: {
|
|
11
|
+
size: OnepercentUtility.UIElements.SpacingVariants | "stretch";
|
|
12
|
+
}) {
|
|
13
|
+
const spacingClasses = useOneUIConfig("component.spacing.variants", {
|
|
14
|
+
large: Styles.spacing_large,
|
|
15
|
+
small: Styles.spacing_small,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const cls = useMemo(
|
|
19
|
+
() => (size === "stretch" ? Styles.spacing_stretch : spacingClasses[size]),
|
|
20
|
+
[size]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return <div className={`${Styles.spacing} ${cls}`} />;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Spacing';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
DetailedHTMLProps,
|
|
3
|
+
ForwardedRef,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
MutableRefObject,
|
|
6
|
+
PropsWithChildren,
|
|
7
|
+
createRef,
|
|
8
|
+
forwardRef,
|
|
9
|
+
useLayoutEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useRef,
|
|
12
|
+
} from "react";
|
|
13
|
+
import { debounce, throttle } from "lodash";
|
|
14
|
+
import Styles from "./StaticScroller.module.scss";
|
|
15
|
+
|
|
16
|
+
function _StaticScroller(
|
|
17
|
+
{
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}: PropsWithChildren<
|
|
21
|
+
DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
|
|
22
|
+
>,
|
|
23
|
+
ref: ForwardedRef<HTMLDivElement>
|
|
24
|
+
) {
|
|
25
|
+
const rootRef = useMemo(() => {
|
|
26
|
+
return (
|
|
27
|
+
(ref as MutableRefObject<HTMLDivElement>) || createRef<HTMLDivElement>()
|
|
28
|
+
);
|
|
29
|
+
}, [ref]);
|
|
30
|
+
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
const el = rootRef.current!;
|
|
33
|
+
let latestScroll: number | undefined;
|
|
34
|
+
const child = el.children[0] as HTMLDivElement;
|
|
35
|
+
|
|
36
|
+
const checkIfNeedsToHide = debounce(() => {
|
|
37
|
+
const direction = el.scrollLeft > latestScroll! ? "in" : "out";
|
|
38
|
+
if (el.scrollLeft < child.clientWidth) {
|
|
39
|
+
el.scrollTo({
|
|
40
|
+
left: direction === "in" ? child.clientWidth : 0,
|
|
41
|
+
behavior: "smooth",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
latestScroll = undefined;
|
|
45
|
+
}, 500);
|
|
46
|
+
const throtleSetLast = throttle(
|
|
47
|
+
(last: number) => {
|
|
48
|
+
latestScroll = last;
|
|
49
|
+
},
|
|
50
|
+
1000 / 5,
|
|
51
|
+
{
|
|
52
|
+
leading: true,
|
|
53
|
+
trailing: false,
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
const onScroll = () => {
|
|
57
|
+
const min = Math.min(el.scrollLeft, child.clientWidth);
|
|
58
|
+
const opacity = String(1 - min / child.clientWidth);
|
|
59
|
+
child.style.opacity = opacity;
|
|
60
|
+
checkIfNeedsToHide();
|
|
61
|
+
throtleSetLast(el.scrollLeft);
|
|
62
|
+
};
|
|
63
|
+
el.addEventListener("scroll", onScroll, {
|
|
64
|
+
passive: true,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return () => {
|
|
68
|
+
el.removeEventListener("scroll", onScroll);
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div className={Styles.root} {...props} ref={rootRef}>
|
|
74
|
+
{children}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Mantains a static content at the start of the container and when scrolled animates it's concealment
|
|
81
|
+
**/
|
|
82
|
+
const StaticScroller = forwardRef(_StaticScroller);
|
|
83
|
+
export default StaticScroller;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './StaticScroller';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@import "../../assets/styles/variables.scss";
|
|
3
|
+
|
|
4
|
+
.root {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
$height: 1.4em;
|
|
7
|
+
height: $height;
|
|
8
|
+
width: 2em + 0.4em;
|
|
9
|
+
padding: 0.1em;
|
|
10
|
+
border-radius: math.div($height, 1);
|
|
11
|
+
border: 0.1em solid $digitalBlue;
|
|
12
|
+
background-color: white;
|
|
13
|
+
transition: background-color $fast linear;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
|
|
16
|
+
input {
|
|
17
|
+
max-width: 0px;
|
|
18
|
+
max-height: 0px;
|
|
19
|
+
width: 0;
|
|
20
|
+
height: 0;
|
|
21
|
+
opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.toggler {
|
|
25
|
+
height: 1em;
|
|
26
|
+
width: 1em;
|
|
27
|
+
background-color: $digitalBlue;
|
|
28
|
+
border-radius: math.div(1em, 2);
|
|
29
|
+
transition: transform $fast linear;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.disabled {
|
|
33
|
+
opacity: 0.4;
|
|
34
|
+
cursor: initial;
|
|
35
|
+
}
|
|
36
|
+
&.on {
|
|
37
|
+
background-color: $digitalBlue;
|
|
38
|
+
.toggler {
|
|
39
|
+
transform: translateX(1em);
|
|
40
|
+
background-color: white;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentProps,
|
|
3
|
+
DetailedHTMLProps,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
} from "react";
|
|
6
|
+
import Styles from "./Switch.module.scss";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Switchs between states
|
|
10
|
+
**/
|
|
11
|
+
export default function Switch({
|
|
12
|
+
enabled,
|
|
13
|
+
onToggle,
|
|
14
|
+
size,
|
|
15
|
+
disabled,
|
|
16
|
+
...props
|
|
17
|
+
}: {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
onToggle: (newState: boolean) => void;
|
|
20
|
+
size: number;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
} & Omit<
|
|
23
|
+
DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
24
|
+
"ref"
|
|
25
|
+
>) {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<div
|
|
29
|
+
style={{ fontSize: `${size}px` }}
|
|
30
|
+
className={`${Styles.root} ${enabled ? Styles.on : ""} ${
|
|
31
|
+
disabled ? Styles.disabled : ""
|
|
32
|
+
}`}
|
|
33
|
+
onClick={() => onToggle(!enabled)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
<div className={Styles.toggler} />
|
|
37
|
+
<input checked={enabled} type="checkbox" />
|
|
38
|
+
</div>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Switch';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@import "../../assets/styles/index.scss";
|
|
2
|
+
|
|
3
|
+
.transitionContainer {
|
|
4
|
+
min-height: auto;
|
|
5
|
+
max-width: 100vw;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.container {
|
|
10
|
+
font-family: $mainFontFamily;
|
|
11
|
+
padding: 0px 4px;
|
|
12
|
+
width: 100%;
|
|
13
|
+
position: relative;
|
|
14
|
+
border-spacing: 0px;
|
|
15
|
+
th {
|
|
16
|
+
font-family: 14px;
|
|
17
|
+
line-height: 28px;
|
|
18
|
+
text-align: start;
|
|
19
|
+
font-weight: normal;
|
|
20
|
+
}
|
|
21
|
+
td,
|
|
22
|
+
th {
|
|
23
|
+
padding: 20px;
|
|
24
|
+
}
|
|
25
|
+
tbody tr {
|
|
26
|
+
background-color: $tableRowBgColor;
|
|
27
|
+
&:first-child td {
|
|
28
|
+
&:first-child {
|
|
29
|
+
border-top-left-radius: 8px;
|
|
30
|
+
}
|
|
31
|
+
&:last-child {
|
|
32
|
+
border-top-right-radius: 8px;
|
|
33
|
+
}
|
|
34
|
+
border-top: 1px solid $tableRowBorderColor;
|
|
35
|
+
}
|
|
36
|
+
&:last-child td {
|
|
37
|
+
&:first-child {
|
|
38
|
+
border-bottom-left-radius: 8px;
|
|
39
|
+
}
|
|
40
|
+
&:last-child {
|
|
41
|
+
border-bottom-right-radius: 8px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
td {
|
|
45
|
+
border-bottom: 1px solid $tableRowBorderColor;
|
|
46
|
+
&:first-child {
|
|
47
|
+
border-left: 1px solid $tableRowBorderColor;
|
|
48
|
+
}
|
|
49
|
+
&:last-child {
|
|
50
|
+
border-right: 1px solid $tableRowBorderColor;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
.footer {
|
|
56
|
+
padding: 0px 4px;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: flex-end;
|
|
60
|
+
--button-min-width: auto;
|
|
61
|
+
--button-min-height: auto;
|
|
62
|
+
|
|
63
|
+
.paging {
|
|
64
|
+
font-family: $mainFontFamily;
|
|
65
|
+
color: $digitalBlue;
|
|
66
|
+
margin: 0px 12px;
|
|
67
|
+
font-size: 18px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.iterable {
|
|
72
|
+
@include iteractibleElement;
|
|
73
|
+
&:first-child {
|
|
74
|
+
margin-left: auto;
|
|
75
|
+
}
|
|
76
|
+
}
|