@ainias42/react-bootstrap-mobile 0.1.7
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/.eslintrc.json +189 -0
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/babel.config.js +22 -0
- package/bin/build.js +60 -0
- package/bin/release.sh +35 -0
- package/bin/updateCopies.js +86 -0
- package/bootstrapReactMobile.ts +87 -0
- package/dist/bootstrapReactMobile.d.ts +87 -0
- package/dist/bootstrapReactMobile.js +6275 -0
- package/dist/src/Components/ActionSheet/ActionSheet.d.ts +21 -0
- package/dist/src/Components/Card/Card.d.ts +13 -0
- package/dist/src/Components/Clickable/Clickable.d.ts +14 -0
- package/dist/src/Components/Dialog/AlertDialog.d.ts +10 -0
- package/dist/src/Components/Dialog/ButtonDialog.d.ts +13 -0
- package/dist/src/Components/Dialog/ConfirmDialog.d.ts +11 -0
- package/dist/src/Components/Dialog/Dialog.d.ts +14 -0
- package/dist/src/Components/Dialog/DialogBackground.d.ts +7 -0
- package/dist/src/Components/Dialog/DialogContainer.d.ts +6 -0
- package/dist/src/Components/Dialog/DialogContext.d.ts +9 -0
- package/dist/src/Components/Dialog/useAlertDialog.d.ts +1 -0
- package/dist/src/Components/Dialog/useConfirmDialog.d.ts +1 -0
- package/dist/src/Components/DragAndDrop/DragItem.d.ts +7 -0
- package/dist/src/Components/DragAndDrop/DropArea.d.ts +7 -0
- package/dist/src/Components/DragAndDrop/useStrictEnabled.d.ts +1 -0
- package/dist/src/Components/FormElements/Button/Button.d.ts +8 -0
- package/dist/src/Components/FormElements/CheckBox/Checkbox.d.ts +10 -0
- package/dist/src/Components/FormElements/ColorInput/ColorInput.d.ts +17 -0
- package/dist/src/Components/FormElements/ColorInput/sharedSelectedColor.d.ts +4 -0
- package/dist/src/Components/FormElements/ImageInput/ImageInput.d.ts +17 -0
- package/dist/src/Components/FormElements/Input/HiddenInput.d.ts +8 -0
- package/dist/src/Components/FormElements/Input/Input.d.ts +10 -0
- package/dist/src/Components/FormElements/Input/PasswordInput/PasswordInput.d.ts +4 -0
- package/dist/src/Components/FormElements/SearchSelectInput/SearchSelectInput.d.ts +10 -0
- package/dist/src/Components/FormElements/Select/Select.d.ts +16 -0
- package/dist/src/Components/FormElements/Slider/Slider.d.ts +8 -0
- package/dist/src/Components/FormElements/Switch/Switch.d.ts +12 -0
- package/dist/src/Components/FormElements/Textarea/Textarea.d.ts +12 -0
- package/dist/src/Components/FormElements/hooks/useOnChangeDone.d.ts +2 -0
- package/dist/src/Components/FullScreen/FullScreen.d.ts +14 -0
- package/dist/src/Components/Hooks/useBreakpoint.d.ts +11 -0
- package/dist/src/Components/Hooks/useComposedRef.d.ts +2 -0
- package/dist/src/Components/Hooks/useDebounced.d.ts +1 -0
- package/dist/src/Components/Hooks/useDelayed.d.ts +1 -0
- package/dist/src/Components/Hooks/useInViewport.d.ts +2 -0
- package/dist/src/Components/Hooks/useKeyListener.d.ts +3 -0
- package/dist/src/Components/Hooks/useListener.d.ts +18 -0
- package/dist/src/Components/Hooks/useOnMount.d.ts +1 -0
- package/dist/src/Components/Hooks/useOnce.d.ts +1 -0
- package/dist/src/Components/Icon/Icon.d.ts +13 -0
- package/dist/src/Components/Image/Image.d.ts +12 -0
- package/dist/src/Components/InViewport/InViewport.d.ts +11 -0
- package/dist/src/Components/Layout/Block.d.ts +7 -0
- package/dist/src/Components/Layout/Container.d.ts +15 -0
- package/dist/src/Components/Layout/Flex.d.ts +10 -0
- package/dist/src/Components/Layout/Grid/Grid.d.ts +9 -0
- package/dist/src/Components/Layout/Grid/GridItem.d.ts +25 -0
- package/dist/src/Components/Layout/Grow.d.ts +9 -0
- package/dist/src/Components/Layout/Inline.d.ts +7 -0
- package/dist/src/Components/Layout/InlineBlock.d.ts +7 -0
- package/dist/src/Components/Layout/View.d.ts +9 -0
- package/dist/src/Components/Layout/ViewWithoutListeners.d.ts +8 -0
- package/dist/src/Components/List/BulletList/BulletList.d.ts +8 -0
- package/dist/src/Components/List/BulletList/ListItem.d.ts +7 -0
- package/dist/src/Components/List/List.d.ts +10 -0
- package/dist/src/Components/LoadingArea/LoadingArea.d.ts +12 -0
- package/dist/src/Components/LoadingCircle/LoadingCircle.d.ts +8 -0
- package/dist/src/Components/Menu/Menu.d.ts +16 -0
- package/dist/src/Components/Menu/useMenu.d.ts +3 -0
- package/dist/src/Components/RbmComponentProps.d.ts +31 -0
- package/dist/src/Components/SizeCalculator/SizeCalculator.d.ts +9 -0
- package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +15 -0
- package/dist/src/Components/SpoilerList/SpoilerList.d.ts +15 -0
- package/dist/src/Components/SpoilerList/useSpoilerGroup.d.ts +12 -0
- package/dist/src/Components/TabBar/TabBar.d.ts +30 -0
- package/dist/src/Components/TabBar/TabBarButton.d.ts +9 -0
- package/dist/src/Components/Table/Table.d.ts +36 -0
- package/dist/src/Components/Text/Heading.d.ts +7 -0
- package/dist/src/Components/Text/Text.d.ts +26 -0
- package/dist/src/Components/Toast/Toast.d.ts +13 -0
- package/dist/src/Components/Toast/ToastContainer.d.ts +7 -0
- package/dist/src/Components/TopBar/MoreButton.d.ts +9 -0
- package/dist/src/Components/TopBar/TopBar.d.ts +25 -0
- package/dist/src/Components/TopBar/TopBarButton.d.ts +9 -0
- package/dist/src/StyleProvider.d.ts +2 -0
- package/dist/src/TypeHelpers.d.ts +4 -0
- package/dist/src/WindowContext/WindowContext.d.ts +3 -0
- package/dist/src/WrongChildError.d.ts +4 -0
- package/dist/src/helper/Characters.d.ts +5 -0
- package/dist/src/helper/DistributiveOmit.d.ts +1 -0
- package/dist/src/helper/EmptyProps.d.ts +1 -0
- package/dist/src/helper/memoComparator.d.ts +1 -0
- package/dist/src/helper/nonEmptyString.d.ts +1 -0
- package/dist/src/helper/withForwardRef.d.ts +7 -0
- package/dist/src/helper/withMemo.d.ts +3 -0
- package/dist/src/helper/withRenderBrowserOnly.d.ts +2 -0
- package/dist/src/helper/withRestrictedChildren.d.ts +6 -0
- package/package.json +92 -0
- package/react-bootstrap-mobile.scss +6 -0
- package/scripts/getPackageJson.js +25 -0
- package/src/Components/ActionSheet/ActionSheet.tsx +115 -0
- package/src/Components/ActionSheet/actionSheet.scss +153 -0
- package/src/Components/Card/Card.tsx +46 -0
- package/src/Components/Card/card.scss +76 -0
- package/src/Components/Clickable/Clickable.tsx +174 -0
- package/src/Components/Clickable/clickable.scss +3 -0
- package/src/Components/Dialog/AlertDialog.tsx +44 -0
- package/src/Components/Dialog/ButtonDialog.tsx +57 -0
- package/src/Components/Dialog/ConfirmDialog.tsx +46 -0
- package/src/Components/Dialog/Dialog.tsx +82 -0
- package/src/Components/Dialog/DialogBackground.tsx +38 -0
- package/src/Components/Dialog/DialogContainer.tsx +77 -0
- package/src/Components/Dialog/DialogContext.ts +21 -0
- package/src/Components/Dialog/buttonDialog.scss +114 -0
- package/src/Components/Dialog/dialog.scss +30 -0
- package/src/Components/Dialog/dialogBackground.scss +4 -0
- package/src/Components/Dialog/useAlertDialog.ts +13 -0
- package/src/Components/Dialog/useConfirmDialog.ts +13 -0
- package/src/Components/DragAndDrop/DragItem.tsx +38 -0
- package/src/Components/DragAndDrop/DropArea.tsx +43 -0
- package/src/Components/DragAndDrop/useStrictEnabled.ts +20 -0
- package/src/Components/FormElements/Button/Button.tsx +25 -0
- package/src/Components/FormElements/Button/button.scss +39 -0
- package/src/Components/FormElements/CheckBox/Checkbox.tsx +61 -0
- package/src/Components/FormElements/CheckBox/checkbox.scss +107 -0
- package/src/Components/FormElements/ColorInput/ColorInput.tsx +139 -0
- package/src/Components/FormElements/ColorInput/colorInput.scss +35 -0
- package/src/Components/FormElements/ColorInput/sharedSelectedColor.ts +40 -0
- package/src/Components/FormElements/ImageInput/ImageInput.tsx +97 -0
- package/src/Components/FormElements/ImageInput/imageInput.scss +24 -0
- package/src/Components/FormElements/Input/HiddenInput.tsx +43 -0
- package/src/Components/FormElements/Input/Input.tsx +102 -0
- package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +55 -0
- package/src/Components/FormElements/Input/PasswordInput/passwordInput.scss +7 -0
- package/src/Components/FormElements/Input/input.scss +57 -0
- package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.tsx +162 -0
- package/src/Components/FormElements/SearchSelectInput/seachSelectInput.scss +90 -0
- package/src/Components/FormElements/Select/Select.tsx +77 -0
- package/src/Components/FormElements/Select/select.scss +51 -0
- package/src/Components/FormElements/Slider/Slider.tsx +80 -0
- package/src/Components/FormElements/Slider/slider.scss +92 -0
- package/src/Components/FormElements/Switch/Switch.tsx +82 -0
- package/src/Components/FormElements/Switch/switch.scss +149 -0
- package/src/Components/FormElements/Textarea/Textarea.tsx +77 -0
- package/src/Components/FormElements/Textarea/textarea.scss +22 -0
- package/src/Components/FormElements/hooks/useOnChangeDone.ts +16 -0
- package/src/Components/FullScreen/FullScreen.tsx +89 -0
- package/src/Components/Hooks/useBreakpoint.ts +66 -0
- package/src/Components/Hooks/useComposedRef.ts +17 -0
- package/src/Components/Hooks/useDebounced.ts +22 -0
- package/src/Components/Hooks/useDelayed.ts +46 -0
- package/src/Components/Hooks/useInViewport.ts +23 -0
- package/src/Components/Hooks/useKeyListener.ts +77 -0
- package/src/Components/Hooks/useListener.ts +73 -0
- package/src/Components/Hooks/useOnMount.ts +12 -0
- package/src/Components/Hooks/useOnce.ts +11 -0
- package/src/Components/Icon/Icon.tsx +45 -0
- package/src/Components/Image/Image.tsx +44 -0
- package/src/Components/Image/image.scss +3 -0
- package/src/Components/InViewport/InViewport.tsx +71 -0
- package/src/Components/InViewport/inViewport.scss +3 -0
- package/src/Components/Layout/Block.tsx +48 -0
- package/src/Components/Layout/Container.tsx +57 -0
- package/src/Components/Layout/Flex.tsx +51 -0
- package/src/Components/Layout/Grid/Grid.tsx +53 -0
- package/src/Components/Layout/Grid/GridItem.tsx +138 -0
- package/src/Components/Layout/Grid/grid.scss +43 -0
- package/src/Components/Layout/Grow.tsx +51 -0
- package/src/Components/Layout/Inline.tsx +48 -0
- package/src/Components/Layout/InlineBlock.tsx +48 -0
- package/src/Components/Layout/View.tsx +40 -0
- package/src/Components/Layout/ViewWithoutListeners.tsx +40 -0
- package/src/Components/Layout/container.scss +12 -0
- package/src/Components/Layout/layout.scss +56 -0
- package/src/Components/List/BulletList/BulletList.tsx +33 -0
- package/src/Components/List/BulletList/ListItem.tsx +34 -0
- package/src/Components/List/List.tsx +88 -0
- package/src/Components/List/list.scss +30 -0
- package/src/Components/LoadingArea/LoadingArea.tsx +64 -0
- package/src/Components/LoadingArea/loadingArea.scss +19 -0
- package/src/Components/LoadingCircle/LoadingCircle.tsx +41 -0
- package/src/Components/LoadingCircle/loadingCircle.scss +42 -0
- package/src/Components/Menu/Menu.tsx +113 -0
- package/src/Components/Menu/menu.scss +21 -0
- package/src/Components/Menu/useMenu.ts +20 -0
- package/src/Components/RbmComponentProps.ts +40 -0
- package/src/Components/SizeCalculator/SizeCalculator.tsx +45 -0
- package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +106 -0
- package/src/Components/SpoilerList/Spoiler/spoiler.scss +120 -0
- package/src/Components/SpoilerList/SpoilerList.tsx +63 -0
- package/src/Components/SpoilerList/useSpoilerGroup.ts +39 -0
- package/src/Components/TabBar/TabBar.tsx +117 -0
- package/src/Components/TabBar/TabBarButton.tsx +44 -0
- package/src/Components/TabBar/tabBar.scss +108 -0
- package/src/Components/Table/Table.tsx +182 -0
- package/src/Components/Text/Heading.tsx +44 -0
- package/src/Components/Text/Text.tsx +79 -0
- package/src/Components/Text/heading.scss +3 -0
- package/src/Components/Text/text.scss +60 -0
- package/src/Components/Toast/Toast.tsx +107 -0
- package/src/Components/Toast/ToastContainer.tsx +35 -0
- package/src/Components/Toast/toast.scss +52 -0
- package/src/Components/TopBar/MoreButton.tsx +38 -0
- package/src/Components/TopBar/TopBar.tsx +176 -0
- package/src/Components/TopBar/TopBarButton.tsx +29 -0
- package/src/Components/TopBar/topBar.scss +124 -0
- package/src/StyleProvider.ts +4 -0
- package/src/TypeHelpers.ts +4 -0
- package/src/WindowContext/WindowContext.ts +8 -0
- package/src/WrongChildError.ts +19 -0
- package/src/env.d.ts +1 -0
- package/src/helper/Characters.ts +5 -0
- package/src/helper/DistributiveOmit.ts +1 -0
- package/src/helper/EmptyProps.ts +2 -0
- package/src/helper/memoComparator.ts +18 -0
- package/src/helper/nonEmptyString.ts +8 -0
- package/src/helper/withForwardRef.ts +28 -0
- package/src/helper/withMemo.ts +16 -0
- package/src/helper/withRenderBrowserOnly.tsx +30 -0
- package/src/helper/withRestrictedChildren.tsx +57 -0
- package/src/scss/_animations.scss +46 -0
- package/src/scss/_baseClasses.scss +27 -0
- package/src/scss/_colors.scss +13 -0
- package/src/scss/_default.scss +17 -0
- package/src/scss/_designMixin.scss +13 -0
- package/src/scss/_mobileMixin.scss +35 -0
- package/src/scss/_variables.scss +22 -0
- package/src/types/isomorphic-style-loader.d.ts +3 -0
- package/src/types/react-table-config.d.ts +120 -0
- package/src/types/scss-module.d.ts +7 -0
- package/tsconfig.json +57 -0
- package/webpack.config.js +85 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
|
+
import { Block } from '../Layout/Block';
|
|
5
|
+
import { EmptyProps } from '../../helper/EmptyProps';
|
|
6
|
+
|
|
7
|
+
import styles from './dialogBackground.scss';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
|
|
10
|
+
export type DialogBackgroundProps = RbmComponentProps<EmptyProps>;
|
|
11
|
+
|
|
12
|
+
function DialogBackground({ children, className, style }: DialogBackgroundProps) {
|
|
13
|
+
// Variables
|
|
14
|
+
|
|
15
|
+
// Refs
|
|
16
|
+
|
|
17
|
+
// States
|
|
18
|
+
|
|
19
|
+
// Selectors
|
|
20
|
+
|
|
21
|
+
// Callbacks
|
|
22
|
+
|
|
23
|
+
// Effects
|
|
24
|
+
|
|
25
|
+
// Other
|
|
26
|
+
|
|
27
|
+
// Render Functions
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Block __allowChildren="all" className={classNames(styles.dialogBackground, className)} style={style}>
|
|
31
|
+
{children}
|
|
32
|
+
</Block>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Need DialogBackgroundMemo for autocompletion of phpstorm
|
|
37
|
+
const DialogBackgroundMemo = withMemo(DialogBackground, styles);
|
|
38
|
+
export { DialogBackgroundMemo as DialogBackground };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { ComponentType, PropsWithChildren, useCallback, useState } from 'react';
|
|
4
|
+
import { PromiseWithHandlers } from '@ainias42/js-helper';
|
|
5
|
+
import { DialogProvider, ShowDialog } from './DialogContext';
|
|
6
|
+
import { Dialog } from './Dialog';
|
|
7
|
+
import { EmptyProps } from '../../helper/EmptyProps';
|
|
8
|
+
|
|
9
|
+
export type DialogContainerProps = PropsWithChildren<EmptyProps>;
|
|
10
|
+
|
|
11
|
+
type DialogData = {
|
|
12
|
+
id: number;
|
|
13
|
+
component: ComponentType;
|
|
14
|
+
props?: Record<string, any>;
|
|
15
|
+
resultPromise: PromiseWithHandlers<any>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function DialogContainer({ children }: DialogContainerProps) {
|
|
19
|
+
// Variables
|
|
20
|
+
const [dialogs, setDialogs] = useState<DialogData[]>([]);
|
|
21
|
+
const [, setLastId] = useState(0);
|
|
22
|
+
|
|
23
|
+
// Refs
|
|
24
|
+
|
|
25
|
+
// States
|
|
26
|
+
|
|
27
|
+
// Selectors
|
|
28
|
+
|
|
29
|
+
// Callbacks
|
|
30
|
+
const showDialog: ShowDialog = useCallback((component, props) => {
|
|
31
|
+
const promise = new PromiseWithHandlers<any>();
|
|
32
|
+
setLastId((oldId) => {
|
|
33
|
+
const id = oldId + 1;
|
|
34
|
+
setDialogs((oldDialogs) => {
|
|
35
|
+
return [...oldDialogs, { id, component, props, resultPromise: promise }] as DialogData[];
|
|
36
|
+
});
|
|
37
|
+
return id;
|
|
38
|
+
});
|
|
39
|
+
return promise;
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
const onClose = useCallback((result?: any, id?: number) => {
|
|
43
|
+
setDialogs((oldDialogs) =>
|
|
44
|
+
oldDialogs.filter((d) => {
|
|
45
|
+
if (d.id === id) {
|
|
46
|
+
d.resultPromise.resolve(result);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
// Effects
|
|
55
|
+
|
|
56
|
+
// Other
|
|
57
|
+
|
|
58
|
+
// Render Functions
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<DialogProvider value={showDialog}>
|
|
62
|
+
{children}
|
|
63
|
+
{dialogs.map((d) => {
|
|
64
|
+
const DialogComponent = d.component;
|
|
65
|
+
return (
|
|
66
|
+
<Dialog {...d.props} key={d.id} onClose={onClose} identifier={d.id}>
|
|
67
|
+
<DialogComponent {...d.props} />
|
|
68
|
+
</Dialog>
|
|
69
|
+
);
|
|
70
|
+
})}
|
|
71
|
+
</DialogProvider>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Need DialogContainerMemo for autocompletion of phpstorm
|
|
76
|
+
const DialogContainerMemo = withMemo(DialogContainer);
|
|
77
|
+
export { DialogContainerMemo as DialogContainer };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ComponentType, useContext } from 'react';
|
|
2
|
+
import { EmptyProps } from '../../helper/EmptyProps';
|
|
3
|
+
|
|
4
|
+
export type ShowDialog = <
|
|
5
|
+
P = EmptyProps,
|
|
6
|
+
R = any,
|
|
7
|
+
C extends ComponentType<(P & { close: (result?: R) => void }) | P> = ComponentType<
|
|
8
|
+
(P & { close: (result?: R) => void }) | P
|
|
9
|
+
>
|
|
10
|
+
>(
|
|
11
|
+
dialog: C,
|
|
12
|
+
props?: Omit<P, 'close'>
|
|
13
|
+
) => Promise<R | void>;
|
|
14
|
+
|
|
15
|
+
const DialogContext = React.createContext<ShowDialog>(() => Promise.reject());
|
|
16
|
+
export const DialogProvider = DialogContext.Provider;
|
|
17
|
+
|
|
18
|
+
export function useDialog() {
|
|
19
|
+
const showDialog = useContext(DialogContext);
|
|
20
|
+
return showDialog as ShowDialog;
|
|
21
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@import "../../scss/variables";
|
|
2
|
+
@import "../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
.buttonDialog {
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
max-width: 95%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
min-width: 270px;
|
|
9
|
+
|
|
10
|
+
.title {
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.message {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.buttonContainer {
|
|
18
|
+
width: 100%;
|
|
19
|
+
|
|
20
|
+
.button {
|
|
21
|
+
color: var(--flavor-accent);
|
|
22
|
+
padding: 0 8px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@include design($flat) {
|
|
27
|
+
border-radius: 8px;
|
|
28
|
+
background-color: #f4f4f4;
|
|
29
|
+
padding-top: 16px;
|
|
30
|
+
color: #1f1f21;
|
|
31
|
+
font-family: -apple-system, 'Helvetica Neue', 'Helvetica', 'Arial', 'Lucida Grande', sans-serif;
|
|
32
|
+
text-align: center;
|
|
33
|
+
|
|
34
|
+
.title {
|
|
35
|
+
font-size: 17px;
|
|
36
|
+
padding: 0 8px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.message {
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
padding: 4px 12px 8px;
|
|
42
|
+
min-height: 36px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.buttonContainer {
|
|
46
|
+
display: flex;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
|
|
49
|
+
.button {
|
|
50
|
+
flex: 1;
|
|
51
|
+
display: block;
|
|
52
|
+
border-left: 1px solid var(--border-light);
|
|
53
|
+
border-top: 1px solid var(--border-light);
|
|
54
|
+
text-overflow: ellipsis;
|
|
55
|
+
letter-spacing: 0;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
font-size: 16px;
|
|
58
|
+
text-align: center;
|
|
59
|
+
height: 44px;
|
|
60
|
+
line-height: 44px;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
|
|
63
|
+
&:first-child {
|
|
64
|
+
border-left: none;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@include design($material) {
|
|
71
|
+
border-radius: 2px;
|
|
72
|
+
background-color: #ffffff;
|
|
73
|
+
padding: 22px 0 0;
|
|
74
|
+
box-shadow: 0 16px 24px 2px rgb(0 0 0 / 14%), 0 6px 30px 5px rgb(0 0 0 / 12%), 0 8px 10px -5px rgb(0 0 0 / 40%);
|
|
75
|
+
color: #31313a;
|
|
76
|
+
font-family: 'Roboto', 'Noto', sans-serif;
|
|
77
|
+
text-align: left;
|
|
78
|
+
|
|
79
|
+
.title {
|
|
80
|
+
font-size: 20px;
|
|
81
|
+
padding: 0 24px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.message {
|
|
85
|
+
font-size: 16px;
|
|
86
|
+
line-height: 20px;
|
|
87
|
+
padding: 0 24px;
|
|
88
|
+
margin: 24px 0 10px 0;
|
|
89
|
+
min-height: 0;
|
|
90
|
+
color: rgba(49, 49, 58, .85);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.buttonContainer {
|
|
94
|
+
display: block;
|
|
95
|
+
padding: 0;
|
|
96
|
+
height: 52px;
|
|
97
|
+
line-height: 1;
|
|
98
|
+
|
|
99
|
+
.button {
|
|
100
|
+
text-transform: uppercase;
|
|
101
|
+
display: inline-block;
|
|
102
|
+
width: auto;
|
|
103
|
+
float: right;
|
|
104
|
+
border-radius: 2px;
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
height: 36px;
|
|
108
|
+
line-height: 36px;
|
|
109
|
+
margin: 8px 8px 8px 0;
|
|
110
|
+
min-width: 50px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import "../../scss/variables";
|
|
2
|
+
@import "../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
.dialogContainer {
|
|
5
|
+
position: fixed;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
top: 0;
|
|
10
|
+
margin: auto;
|
|
11
|
+
z-index: 1001;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
17
|
+
|
|
18
|
+
.closeCurtain {
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
right: 0;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dialog {
|
|
27
|
+
max-width: map-get($grid-breakpoints, "xxl");
|
|
28
|
+
z-index: 1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useDialog } from './DialogContext';
|
|
3
|
+
import { AlertDialog } from './AlertDialog';
|
|
4
|
+
|
|
5
|
+
export function useAlertDialog() {
|
|
6
|
+
const showDialog = useDialog();
|
|
7
|
+
return useCallback(
|
|
8
|
+
(message: string, title?: string) => {
|
|
9
|
+
return showDialog(AlertDialog, { message, title });
|
|
10
|
+
},
|
|
11
|
+
[showDialog]
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useDialog } from './DialogContext';
|
|
3
|
+
import { ConfirmDialog } from './ConfirmDialog';
|
|
4
|
+
|
|
5
|
+
export function useConfirmDialog() {
|
|
6
|
+
const showDialog = useDialog();
|
|
7
|
+
return useCallback(
|
|
8
|
+
(message: string, title?: string) => {
|
|
9
|
+
return showDialog(ConfirmDialog, { message, title });
|
|
10
|
+
},
|
|
11
|
+
[showDialog]
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps, WithNoStringAndChildrenProps } from '../RbmComponentProps';
|
|
4
|
+
import { Draggable, DraggableProps } from 'react-beautiful-dnd';
|
|
5
|
+
|
|
6
|
+
export type DragItemProps = RbmComponentProps<Omit<DraggableProps, 'children'>, WithNoStringAndChildrenProps>;
|
|
7
|
+
|
|
8
|
+
function DragItem({ children, ...dragProps }: DragItemProps) {
|
|
9
|
+
// Variables
|
|
10
|
+
|
|
11
|
+
// Refs
|
|
12
|
+
|
|
13
|
+
// States
|
|
14
|
+
|
|
15
|
+
// Selectors
|
|
16
|
+
|
|
17
|
+
// Callbacks
|
|
18
|
+
|
|
19
|
+
// Effects
|
|
20
|
+
|
|
21
|
+
// Other
|
|
22
|
+
|
|
23
|
+
// Render Functions
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Draggable {...dragProps}>
|
|
27
|
+
{({ innerRef, dragHandleProps, draggableProps }) => (
|
|
28
|
+
<div {...draggableProps} {...dragHandleProps} ref={innerRef}>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
)}
|
|
32
|
+
</Draggable>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Need DragItemMemo for autocompletion of phpstorm
|
|
37
|
+
const DragItemMemo = withMemo(DragItem);
|
|
38
|
+
export { DragItemMemo as DragItem };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps, WithNoStringAndChildrenProps } from '../RbmComponentProps';
|
|
4
|
+
import { Droppable, DroppableProps } from 'react-beautiful-dnd';
|
|
5
|
+
import { useStrictEnabled } from './useStrictEnabled';
|
|
6
|
+
|
|
7
|
+
export type DropAreaProps = RbmComponentProps<Omit<DroppableProps, 'children'>, WithNoStringAndChildrenProps>;
|
|
8
|
+
|
|
9
|
+
function DropArea({ children, style, className, ...dropProps }: DropAreaProps) {
|
|
10
|
+
// Variables
|
|
11
|
+
|
|
12
|
+
// Refs
|
|
13
|
+
|
|
14
|
+
// States
|
|
15
|
+
const enabled = useStrictEnabled();
|
|
16
|
+
|
|
17
|
+
// Selectors
|
|
18
|
+
|
|
19
|
+
// Callbacks
|
|
20
|
+
|
|
21
|
+
// Effects
|
|
22
|
+
|
|
23
|
+
// Other
|
|
24
|
+
|
|
25
|
+
// Render Functions
|
|
26
|
+
if (!enabled) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Droppable {...dropProps}>
|
|
32
|
+
{({ innerRef, droppableProps }) => (
|
|
33
|
+
<div {...droppableProps} ref={innerRef} style={style} className={className}>
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
</Droppable>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Need DropAreaMemo for autocompletion of phpstorm
|
|
42
|
+
const DropAreaMemo = withMemo(DropArea);
|
|
43
|
+
export { DropAreaMemo as DropArea };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export const useStrictEnabled = (loading = false) => {
|
|
4
|
+
const [enabled, setEnabled] = useState(false);
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
let animation: any;
|
|
8
|
+
|
|
9
|
+
if (!loading) {
|
|
10
|
+
animation = requestAnimationFrame(() => setEnabled(true));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return () => {
|
|
14
|
+
cancelAnimationFrame(animation);
|
|
15
|
+
setEnabled(false);
|
|
16
|
+
};
|
|
17
|
+
}, [loading]);
|
|
18
|
+
|
|
19
|
+
return enabled;
|
|
20
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Override } from '../../../TypeHelpers';
|
|
3
|
+
import { OptionalListener, useListener } from '../../Hooks/useListener';
|
|
4
|
+
|
|
5
|
+
import styles from './button.scss';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
8
|
+
import { HTMLAttributes } from 'react';
|
|
9
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
10
|
+
|
|
11
|
+
export type ButtonProps<ClickData> = RbmComponentProps<
|
|
12
|
+
Override<HTMLAttributes<HTMLButtonElement>, OptionalListener<'onClick', ClickData>>
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
function Button<ClickData>({ children, className, ...props }: ButtonProps<ClickData>) {
|
|
16
|
+
const onClick = useListener<'onClick', ClickData>('onClick', props);
|
|
17
|
+
return (
|
|
18
|
+
<button {...props} type="button" onClick={onClick} className={classNames(styles.button, className)}>
|
|
19
|
+
{children}
|
|
20
|
+
</button>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const ButtonMemo = withMemo(Button, styles);
|
|
25
|
+
export { ButtonMemo as Button };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@import "../../../scss/variables";
|
|
2
|
+
@import "../../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
.button {
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
margin: 0;
|
|
7
|
+
user-select: none;
|
|
8
|
+
text-overflow: ellipsis;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
text-decoration: none;
|
|
12
|
+
letter-spacing: 0;
|
|
13
|
+
color: white;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
border: 0 solid currentColor;
|
|
16
|
+
border-radius: 3px;
|
|
17
|
+
transition: none;
|
|
18
|
+
|
|
19
|
+
--text-primary-default-color: white;
|
|
20
|
+
|
|
21
|
+
@include design($material) {
|
|
22
|
+
box-shadow: $boxShadowMaterial;
|
|
23
|
+
min-height: 40px;
|
|
24
|
+
line-height: 40px;
|
|
25
|
+
padding: 0 16px;
|
|
26
|
+
text-align: center;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
text-transform: uppercase;
|
|
29
|
+
background-color: var(--flavor-accent);
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@include design($flat) {
|
|
34
|
+
line-height: 32px;
|
|
35
|
+
padding: 4px 18px;
|
|
36
|
+
font-size: 17px;
|
|
37
|
+
background-color: var(--flavor-accent);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
3
|
+
import { InputHTMLAttributes } from 'react';
|
|
4
|
+
|
|
5
|
+
import styles from './checkbox.scss';
|
|
6
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
export type CheckboxProps = RbmComponentProps<
|
|
10
|
+
{
|
|
11
|
+
label?: string;
|
|
12
|
+
children?: string;
|
|
13
|
+
isLabelBeforeCheckbox?: boolean;
|
|
14
|
+
} & InputHTMLAttributes<HTMLInputElement>
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
function Checkbox({
|
|
18
|
+
children,
|
|
19
|
+
label = '',
|
|
20
|
+
isLabelBeforeCheckbox = false,
|
|
21
|
+
id,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
...props
|
|
25
|
+
}: CheckboxProps) {
|
|
26
|
+
// Variables
|
|
27
|
+
|
|
28
|
+
// States
|
|
29
|
+
|
|
30
|
+
// Refs
|
|
31
|
+
|
|
32
|
+
// Callbacks
|
|
33
|
+
|
|
34
|
+
// Effects
|
|
35
|
+
|
|
36
|
+
// Other
|
|
37
|
+
|
|
38
|
+
// Render Functions
|
|
39
|
+
if (React.Children.count(children) === 1 && typeof children === 'string') {
|
|
40
|
+
label = children;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let preLabel = '';
|
|
44
|
+
if (isLabelBeforeCheckbox) {
|
|
45
|
+
[label, preLabel] = [preLabel, label];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<span className={classNames(styles.checkbox, className)} style={style}>
|
|
50
|
+
<label htmlFor={id} key={id}>
|
|
51
|
+
<span className={styles.label}>{preLabel}</span>
|
|
52
|
+
<input {...props} type="checkbox" id={id} className={styles.input} />
|
|
53
|
+
<span className={styles.checkmark} />
|
|
54
|
+
<span className={styles.label}>{label}</span>
|
|
55
|
+
</label>
|
|
56
|
+
</span>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const tmp = withMemo(Checkbox, styles);
|
|
61
|
+
export { tmp as Checkbox };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@import "../../../scss/variables";
|
|
2
|
+
@import "../../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
.checkbox {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
|
|
9
|
+
> label {
|
|
10
|
+
display: flex;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.label {
|
|
15
|
+
line-height: 22px;
|
|
16
|
+
|
|
17
|
+
&:not(:empty) {
|
|
18
|
+
margin-left: 0.2rem;
|
|
19
|
+
margin-right: 0.2rem;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.input {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.checkmark {
|
|
28
|
+
display: inline-block;
|
|
29
|
+
user-select: none;
|
|
30
|
+
position: relative;
|
|
31
|
+
|
|
32
|
+
&::before {
|
|
33
|
+
content: " ";
|
|
34
|
+
position: absolute;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
left: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include design($material) {
|
|
41
|
+
width: 18px;
|
|
42
|
+
height: 18px;
|
|
43
|
+
margin: 2px;
|
|
44
|
+
|
|
45
|
+
&::before {
|
|
46
|
+
border: 2px solid var(--border-strong);
|
|
47
|
+
border-radius: 2px;
|
|
48
|
+
transition: background-color 0.1s linear 0.2s, border-color 0.1s linear 0.2s;
|
|
49
|
+
background-color: transparent;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
@include design($flat) {
|
|
53
|
+
width: 22px;
|
|
54
|
+
height: 22px;
|
|
55
|
+
|
|
56
|
+
&::before {
|
|
57
|
+
background: transparent;
|
|
58
|
+
border: 1px solid var(--border-light);
|
|
59
|
+
border-radius: 22px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
input:checked + {
|
|
65
|
+
.checkmark {
|
|
66
|
+
&::after {
|
|
67
|
+
content: " ";
|
|
68
|
+
position: absolute;
|
|
69
|
+
height: 5px;
|
|
70
|
+
background: transparent;
|
|
71
|
+
border-radius: 0;
|
|
72
|
+
transform: rotate(-45deg);
|
|
73
|
+
border: 2px none #fff;
|
|
74
|
+
border-bottom-style: solid;
|
|
75
|
+
border-left-style: solid;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&::before {
|
|
79
|
+
background-color: var(--flavor-accent);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@include design($material) {
|
|
83
|
+
&::before {
|
|
84
|
+
border: 2px solid var(--flavor-accent);
|
|
85
|
+
transition: background-color 0.1s linear, border-color 0.1s linear;
|
|
86
|
+
}
|
|
87
|
+
&::after {
|
|
88
|
+
transition: transform 0.2s ease 0.2s;
|
|
89
|
+
top: 5px;
|
|
90
|
+
left: 4px;
|
|
91
|
+
width: 10px;
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
@include design($flat) {
|
|
96
|
+
&::before {
|
|
97
|
+
border: none;
|
|
98
|
+
}
|
|
99
|
+
&::after {
|
|
100
|
+
top: 7px;
|
|
101
|
+
left: 5px;
|
|
102
|
+
width: 11px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|