@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,129 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { SelectItem } from "../../../Select/Select";
|
|
3
|
+
import { UploadTask } from "firebase/storage";
|
|
4
|
+
import { UnresolvableOr } from "../../../../type-utils";
|
|
5
|
+
|
|
6
|
+
export type GenericFormFieldProps<T extends FormField["type"]> = {
|
|
7
|
+
value: AnswerByField<{ type: T }>;
|
|
8
|
+
onAnswer: (FormFieldProps<{ type: T }> & {
|
|
9
|
+
mode: FormMode.WRITE;
|
|
10
|
+
})["onAnswer"];
|
|
11
|
+
question: FormFieldView & { type: T };
|
|
12
|
+
error?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type FormFieldProps<Q extends Pick<FormFieldView, "type">> = {
|
|
16
|
+
config: Q;
|
|
17
|
+
value: AnswerByField<Q>;
|
|
18
|
+
} & (
|
|
19
|
+
| {
|
|
20
|
+
mode: FormMode.READ_ONLY;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
mode?: FormMode.WRITE;
|
|
24
|
+
onAnswer: <T extends Q["type"]>(
|
|
25
|
+
questionType: T,
|
|
26
|
+
questionId: string,
|
|
27
|
+
answer:
|
|
28
|
+
| AnswerAction<{
|
|
29
|
+
type: T;
|
|
30
|
+
}>
|
|
31
|
+
| undefined
|
|
32
|
+
) => void;
|
|
33
|
+
error?: string | string[];
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export enum FormMode {
|
|
38
|
+
READ_ONLY,
|
|
39
|
+
WRITE,
|
|
40
|
+
}
|
|
41
|
+
export type FormFieldView = FormField & {
|
|
42
|
+
title: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type AnswerAction<F extends Pick<FormField, "type">> =
|
|
46
|
+
F["type"] extends "file" ? File : AnswerByField<F>;
|
|
47
|
+
|
|
48
|
+
export type BasicFormFields =
|
|
49
|
+
| {
|
|
50
|
+
type: "select";
|
|
51
|
+
filter?: (item: SelectItem, term: string) => boolean;
|
|
52
|
+
options: SelectItem[];
|
|
53
|
+
}
|
|
54
|
+
| {
|
|
55
|
+
type: "text";
|
|
56
|
+
multiline?: number;
|
|
57
|
+
}
|
|
58
|
+
| {
|
|
59
|
+
type: "number";
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type DistributeValidatorOverUnion<FormFieldTypes extends { type: any }> =
|
|
63
|
+
FormFieldTypes extends any
|
|
64
|
+
? FormFieldTypes & {
|
|
65
|
+
validator?: (
|
|
66
|
+
val: AnswerAction<FormFieldTypes> | undefined
|
|
67
|
+
) => boolean | string;
|
|
68
|
+
}
|
|
69
|
+
: never;
|
|
70
|
+
export type FormField = {
|
|
71
|
+
optional?: boolean;
|
|
72
|
+
id: string;
|
|
73
|
+
} & DistributeValidatorOverUnion<
|
|
74
|
+
| BasicFormFields
|
|
75
|
+
| {
|
|
76
|
+
type: "radio";
|
|
77
|
+
options: SelectItem[];
|
|
78
|
+
}
|
|
79
|
+
| {
|
|
80
|
+
type: "check" | "rawcheck";
|
|
81
|
+
options: SelectItem[];
|
|
82
|
+
}
|
|
83
|
+
| {
|
|
84
|
+
type: "file";
|
|
85
|
+
fileUsageDescription: string;
|
|
86
|
+
extensions: string[];
|
|
87
|
+
footer: string;
|
|
88
|
+
openFile?: {
|
|
89
|
+
action: () => void;
|
|
90
|
+
label: string | ReactNode;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
| {
|
|
94
|
+
type: "accept";
|
|
95
|
+
link: {
|
|
96
|
+
type: "file" | "route";
|
|
97
|
+
to: string;
|
|
98
|
+
};
|
|
99
|
+
contract: {
|
|
100
|
+
action: () => void;
|
|
101
|
+
label: string | ReactNode;
|
|
102
|
+
};
|
|
103
|
+
accept: {
|
|
104
|
+
label: string;
|
|
105
|
+
optional?: true;
|
|
106
|
+
}[];
|
|
107
|
+
}
|
|
108
|
+
| UnresolvableOr<OnepercentUtility.UIElements.FormExtension["fields"], {}>
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
export type FormFieldTypes = FormField['type'] | 'accept'
|
|
112
|
+
|
|
113
|
+
type ExternalQuestionFields = UnresolvableOr<
|
|
114
|
+
OnepercentUtility.UIElements.FormExtension["fieldAnswer"],
|
|
115
|
+
{}
|
|
116
|
+
>;
|
|
117
|
+
|
|
118
|
+
export type AnswerByField<F extends Pick<FormField, "type">> =
|
|
119
|
+
F["type"] extends "file"
|
|
120
|
+
? UploadTask | true
|
|
121
|
+
: F["type"] extends "accept" | "check" | "rawcheck"
|
|
122
|
+
? boolean[]
|
|
123
|
+
: F["type"] extends "radio" | "text" | "select" | "number"
|
|
124
|
+
? string
|
|
125
|
+
: F["type"] extends keyof ExternalQuestionFields
|
|
126
|
+
? OnepercentUtility.UIElements.FormExtension["fieldAnswer"][F["type"]]
|
|
127
|
+
: unknown;
|
|
128
|
+
|
|
129
|
+
type O = FormField["type"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FormField';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Form';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { PropsWithChildren, ReactElement, useRef } from "react";
|
|
2
|
+
import useFreeze from "../../hooks/useFreeze";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Use this component when you would like to freeze some child when this child can assume undefined in the next 'frame'
|
|
6
|
+
**/
|
|
7
|
+
export default function Freeze({ children }: PropsWithChildren<{}>) {
|
|
8
|
+
return useFreeze(children) as ReactElement;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Freeze';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
export default function HSForms({
|
|
4
|
+
region,
|
|
5
|
+
partialId,
|
|
6
|
+
formId,
|
|
7
|
+
className,
|
|
8
|
+
onFormReady,
|
|
9
|
+
onFormSubmitted,
|
|
10
|
+
}: {
|
|
11
|
+
region: "na1";
|
|
12
|
+
partialId: string;
|
|
13
|
+
formId: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
onFormReady?: (div: HTMLDivElement, form: any) => void;
|
|
16
|
+
onFormSubmitted?: () => void;
|
|
17
|
+
}) {
|
|
18
|
+
if ((window as any).PRERENDER) return null;
|
|
19
|
+
const container = useRef<HTMLDivElement>(null);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
import("jquery"!).then((jqueryModule) => {
|
|
23
|
+
const funcId = String(Math.round(Math.random() * 999999));
|
|
24
|
+
const idx = `onLoad${funcId}`;
|
|
25
|
+
const idx2 = `onSubmit${funcId}`;
|
|
26
|
+
(window as any)[idx as any] = function (form: any) {
|
|
27
|
+
if (onFormReady) onFormReady(container.current!, form);
|
|
28
|
+
};
|
|
29
|
+
(window as any)[idx2 as any] = function () {
|
|
30
|
+
if (onFormSubmitted) onFormSubmitted();
|
|
31
|
+
};
|
|
32
|
+
(window as any).jQuery = jqueryModule.default;
|
|
33
|
+
const script = document.createElement("script");
|
|
34
|
+
script.setAttribute("src", "https://js.hsforms.net/forms/v2.js");
|
|
35
|
+
script.setAttribute("type", "text/javascript");
|
|
36
|
+
script.setAttribute("charset", "utf-8");
|
|
37
|
+
script.onload = () => {
|
|
38
|
+
const createFormScript = document.createElement("script");
|
|
39
|
+
createFormScript.setAttribute("type", "text/javascript");
|
|
40
|
+
createFormScript.innerHTML = `hbspt.forms.create({
|
|
41
|
+
region: "${region}",
|
|
42
|
+
portalId: "${partialId}",
|
|
43
|
+
formId: "${formId}",
|
|
44
|
+
submitButtonClass: '#',
|
|
45
|
+
css: ' ',
|
|
46
|
+
cssClass: '#',
|
|
47
|
+
onFormReady: ${idx},
|
|
48
|
+
onFormSubmit: ${idx2},
|
|
49
|
+
formInstanceId: ${funcId}
|
|
50
|
+
});`;
|
|
51
|
+
container.current!.appendChild(createFormScript);
|
|
52
|
+
};
|
|
53
|
+
document.head.appendChild(script);
|
|
54
|
+
});
|
|
55
|
+
}, [region, partialId, formId]);
|
|
56
|
+
return <div ref={container} className={className}></div>;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './HSForms';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
@import "../../assets/styles/index.scss";
|
|
2
|
+
|
|
3
|
+
.header {
|
|
4
|
+
position: sticky;
|
|
5
|
+
top: 0px;
|
|
6
|
+
width: 100%;
|
|
7
|
+
background-color: $headerFillBackgroundColor;
|
|
8
|
+
display: flex;
|
|
9
|
+
padding: 32px;
|
|
10
|
+
align-items: center;
|
|
11
|
+
font-family: $mainFontFamily;
|
|
12
|
+
z-index: 100;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.logo {
|
|
16
|
+
align-self: stretch;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
|
|
20
|
+
@media (orientation: portrait) {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.option {
|
|
26
|
+
font-size: 18px;
|
|
27
|
+
line-height: 22px;
|
|
28
|
+
margin-right: 28px;
|
|
29
|
+
color: $headerTextColor;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.logoDivider {
|
|
33
|
+
margin: -32px 32px;
|
|
34
|
+
width: 1px;
|
|
35
|
+
background-color: $headerBackgroundColor;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.profile {
|
|
39
|
+
background-color: $headerBrightColor;
|
|
40
|
+
height: 36px;
|
|
41
|
+
width: 36px;
|
|
42
|
+
border-radius: 18px;
|
|
43
|
+
line-height: 36px;
|
|
44
|
+
text-align: center;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.profile,
|
|
48
|
+
.profileName {
|
|
49
|
+
margin-right: 8px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.profileName {
|
|
53
|
+
color: $headerBrightColor;
|
|
54
|
+
|
|
55
|
+
@media (orientation: portrait) {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.headerOptions {
|
|
60
|
+
right: 0px;
|
|
61
|
+
width: fit-content;
|
|
62
|
+
margin-top: 18px;
|
|
63
|
+
z-index: 1000;
|
|
64
|
+
> * {
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
backdrop-filter: var(--header-submenu-backdrop, initial);
|
|
67
|
+
padding: 12px 32px;
|
|
68
|
+
margin-bottom: 8px;
|
|
69
|
+
margin-left: 4px;
|
|
70
|
+
margin-right: 4px;
|
|
71
|
+
text-align: left;
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.indicator {
|
|
77
|
+
@include iteractibleElement();
|
|
78
|
+
transition: transform $fast;
|
|
79
|
+
transform: rotateX(0deg);
|
|
80
|
+
|
|
81
|
+
&.open {
|
|
82
|
+
transform: rotateX(180deg);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
display: none;
|
|
86
|
+
@media screen and (max-width: 640px) {
|
|
87
|
+
display: initial;
|
|
88
|
+
}
|
|
89
|
+
&.withMoreOptions {
|
|
90
|
+
display: initial;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.desktopOnly {
|
|
95
|
+
@media screen and (max-width: 640px) {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.mobileOnly {
|
|
101
|
+
@media screen and (min-width: 640px) {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.options-right {
|
|
107
|
+
.logo {
|
|
108
|
+
margin-right: auto;
|
|
109
|
+
}
|
|
110
|
+
.sectionDivider {
|
|
111
|
+
margin-left: initial;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.options-left {
|
|
116
|
+
.sectionDivider {
|
|
117
|
+
margin-left: auto;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React, { PropsWithChildren, useEffect, useState } from "react";
|
|
2
|
+
import { useOneUIContext } from "../../context/OneUIProvider";
|
|
3
|
+
import { AnchoredTooltipAlignment } from "../AnchoredTooltip/AnchoredTooltip";
|
|
4
|
+
import Collapsable from "../Collapsable";
|
|
5
|
+
import Text from "../Text";
|
|
6
|
+
import Styles from "./Header.module.scss";
|
|
7
|
+
|
|
8
|
+
type Option = {
|
|
9
|
+
label: string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type User = {
|
|
14
|
+
name: string;
|
|
15
|
+
profilePicture?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type MoreOptions = Option[];
|
|
19
|
+
|
|
20
|
+
type Props = PropsWithChildren<{
|
|
21
|
+
optionsAlignment?: "left" | "right";
|
|
22
|
+
user?: User;
|
|
23
|
+
options: Option[];
|
|
24
|
+
moreOptions?: MoreOptions;
|
|
25
|
+
/**
|
|
26
|
+
* This controls the visbility of a control for showing or hiding a menu on mobile
|
|
27
|
+
*/
|
|
28
|
+
responsive?: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A generic header implementation
|
|
33
|
+
**/
|
|
34
|
+
export default function Header(props: Props) {
|
|
35
|
+
const { user, moreOptions } = props;
|
|
36
|
+
const [showMoreOptions, setShowMoreOptions] = useState(false);
|
|
37
|
+
const { LogoImage = () => null, MoreOptions = () => <div>v</div> } =
|
|
38
|
+
useOneUIContext().component.header;
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (showMoreOptions) {
|
|
42
|
+
const close = () => setShowMoreOptions(false);
|
|
43
|
+
window.addEventListener("click", close);
|
|
44
|
+
return () => {
|
|
45
|
+
window.removeEventListener("click", close);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}, [showMoreOptions]);
|
|
49
|
+
return (
|
|
50
|
+
<header className={`${Styles.header} ${Styles[`options-${props.optionsAlignment || "left"}`]}`}>
|
|
51
|
+
<div className={Styles.logo}>
|
|
52
|
+
<LogoImage />
|
|
53
|
+
<div className={Styles.logoDivider} />
|
|
54
|
+
</div>
|
|
55
|
+
<Controls {...props} mode="desktop" />
|
|
56
|
+
{user ? (
|
|
57
|
+
user.profilePicture ? (
|
|
58
|
+
<img
|
|
59
|
+
className={Styles.profile}
|
|
60
|
+
data-testid="profile-container"
|
|
61
|
+
src={user.profilePicture!}
|
|
62
|
+
/>
|
|
63
|
+
) : (
|
|
64
|
+
<div className={Styles.profile} data-testid="profile-container">
|
|
65
|
+
{user.name
|
|
66
|
+
.split(" ")
|
|
67
|
+
.slice(0, 2)
|
|
68
|
+
.map((a) => a.charAt(0).toUpperCase())
|
|
69
|
+
.join("")}
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
) : null}
|
|
73
|
+
{user ? <p className={Styles.profileName}>{user.name}</p> : null}
|
|
74
|
+
{
|
|
75
|
+
<Collapsable
|
|
76
|
+
title={
|
|
77
|
+
<div
|
|
78
|
+
className={`${Styles.indicator} ${
|
|
79
|
+
moreOptions ? Styles.withMoreOptions : ""
|
|
80
|
+
}`}
|
|
81
|
+
>
|
|
82
|
+
<MoreOptions open={showMoreOptions} />
|
|
83
|
+
</div>
|
|
84
|
+
}
|
|
85
|
+
data-testid="more-options-container"
|
|
86
|
+
open={showMoreOptions}
|
|
87
|
+
onToggleOpen={setShowMoreOptions}
|
|
88
|
+
mode="float"
|
|
89
|
+
contentClassName={Styles.headerOptions}
|
|
90
|
+
alignTo={AnchoredTooltipAlignment.CENTER}
|
|
91
|
+
>
|
|
92
|
+
<Controls {...props} mode="mobile" />
|
|
93
|
+
{moreOptions
|
|
94
|
+
? moreOptions.map((opt) => (
|
|
95
|
+
<Text type="link" onClick={opt.onClick}>
|
|
96
|
+
{opt.label}
|
|
97
|
+
</Text>
|
|
98
|
+
))
|
|
99
|
+
: null}
|
|
100
|
+
</Collapsable>
|
|
101
|
+
}
|
|
102
|
+
</header>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function Controls({
|
|
107
|
+
options,
|
|
108
|
+
children,
|
|
109
|
+
mode,
|
|
110
|
+
}: Props & { mode: "desktop" | "mobile" }) {
|
|
111
|
+
return (
|
|
112
|
+
<>
|
|
113
|
+
{options.map((option, i) => (
|
|
114
|
+
<Text
|
|
115
|
+
type="link"
|
|
116
|
+
key={option.label}
|
|
117
|
+
data-testid={`option-${i}`}
|
|
118
|
+
onClick={option.onClick}
|
|
119
|
+
className={`${Styles.option} ${
|
|
120
|
+
mode === "desktop" ? Styles.desktopOnly : Styles.mobileOnly
|
|
121
|
+
}`}
|
|
122
|
+
>
|
|
123
|
+
{option.label}
|
|
124
|
+
</Text>
|
|
125
|
+
))}
|
|
126
|
+
<div className={Styles.sectionDivider} />
|
|
127
|
+
{children && (
|
|
128
|
+
<div
|
|
129
|
+
className={`${Styles.children} ${
|
|
130
|
+
mode === "desktop" ? Styles.desktopOnly : Styles.mobileOnly
|
|
131
|
+
}`}
|
|
132
|
+
>
|
|
133
|
+
{children}
|
|
134
|
+
</div>
|
|
135
|
+
)}
|
|
136
|
+
</>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Header';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@import "../../assets/styles/index.scss";
|
|
2
|
+
|
|
3
|
+
.headerButton {
|
|
4
|
+
width: 22px;
|
|
5
|
+
height: 22px;
|
|
6
|
+
position: relative;
|
|
7
|
+
opacity: 1;
|
|
8
|
+
@include iteractibleElement();
|
|
9
|
+
transition: opacity $fast, transform $fast;
|
|
10
|
+
&.pointOfNoReturn {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
div {
|
|
14
|
+
transition: width $fast, top $fast, left $fast;
|
|
15
|
+
position: absolute;
|
|
16
|
+
height: 3px;
|
|
17
|
+
border-radius: 1.5px;
|
|
18
|
+
width: 22px;
|
|
19
|
+
background-color: $digitalBlue;
|
|
20
|
+
transform-origin: 1.5px 1.5px;
|
|
21
|
+
&:nth-child(1) {
|
|
22
|
+
transform: rotateZ(45deg);
|
|
23
|
+
}
|
|
24
|
+
&:nth-child(2) {
|
|
25
|
+
transform: rotateZ(-45deg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
&.back div {
|
|
29
|
+
width: 12.5px;
|
|
30
|
+
top: 5.5px;
|
|
31
|
+
left: 0px;
|
|
32
|
+
}
|
|
33
|
+
&.close div {
|
|
34
|
+
width: 22px;
|
|
35
|
+
&:nth-child(1) {
|
|
36
|
+
top: 0px;
|
|
37
|
+
left: 0px;
|
|
38
|
+
}
|
|
39
|
+
&:nth-child(2) {
|
|
40
|
+
top: 13px;
|
|
41
|
+
left: 0px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Styles from "./HeaderCloseBtn.module.scss";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A simple close button implemented with pure HTML and CSS
|
|
6
|
+
**/
|
|
7
|
+
export default function HeaderButton({
|
|
8
|
+
mode,
|
|
9
|
+
hidden,
|
|
10
|
+
onClick,
|
|
11
|
+
}: {
|
|
12
|
+
mode: "back" | "close";
|
|
13
|
+
hidden: boolean;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
data-testid="header-control-back"
|
|
19
|
+
className={`${Styles.headerButton} ${Styles[mode]} ${
|
|
20
|
+
hidden ? Styles.pointOfNoReturn : ""
|
|
21
|
+
}`}
|
|
22
|
+
onClick={onClick}
|
|
23
|
+
>
|
|
24
|
+
<div />
|
|
25
|
+
<div />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './HeaderCloseBtn';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
overflow: auto;
|
|
6
|
+
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
7
|
+
&::-webkit-scrollbar {
|
|
8
|
+
display: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Hide scrollbar for IE, Edge and Firefox */
|
|
12
|
+
& {
|
|
13
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
14
|
+
scrollbar-width: none; /* Firefox */
|
|
15
|
+
}
|
|
16
|
+
> * {
|
|
17
|
+
width: 100%;
|
|
18
|
+
min-width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> :first-child {
|
|
22
|
+
// background-color: green;
|
|
23
|
+
}
|
|
24
|
+
> :nth-child(2) {
|
|
25
|
+
// background-color: yellow;
|
|
26
|
+
}
|
|
27
|
+
> :nth-child(3) {
|
|
28
|
+
// background-color: blue;
|
|
29
|
+
}
|
|
30
|
+
}
|