@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,153 @@
|
|
|
1
|
+
@import "../../scss/variables";
|
|
2
|
+
@import "../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
$zIndexActionSheet: 10000;
|
|
5
|
+
|
|
6
|
+
.actionSheet {
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 100%;
|
|
9
|
+
left: 0;
|
|
10
|
+
right: 0;
|
|
11
|
+
bottom: 0;
|
|
12
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
13
|
+
z-index: $zIndexActionSheet;
|
|
14
|
+
|
|
15
|
+
transition-duration: 0s;
|
|
16
|
+
transition-delay: 0.25s;
|
|
17
|
+
|
|
18
|
+
&.open {
|
|
19
|
+
transition-delay: 0s;
|
|
20
|
+
top: 0;
|
|
21
|
+
|
|
22
|
+
> :global(.full-height) {;
|
|
23
|
+
top: 0
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
> :global(.full-height) {
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
bottom: 0;
|
|
32
|
+
top: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.content {
|
|
36
|
+
bottom: 0;
|
|
37
|
+
height: 100%;
|
|
38
|
+
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
justify-content: end;
|
|
42
|
+
|
|
43
|
+
.action {
|
|
44
|
+
height: 56px;
|
|
45
|
+
width: 100%;
|
|
46
|
+
font-size: 20px;
|
|
47
|
+
background-color: #ffffff;
|
|
48
|
+
border-radius: 0;
|
|
49
|
+
line-height: 56px;
|
|
50
|
+
display: block;
|
|
51
|
+
text-overflow: ellipsis;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.cancel {
|
|
57
|
+
height: 56px;
|
|
58
|
+
width: 100%;
|
|
59
|
+
font-size: 20px;
|
|
60
|
+
background-color: #ffffff;
|
|
61
|
+
line-height: 56px;
|
|
62
|
+
display: block;
|
|
63
|
+
text-overflow: ellipsis;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@include design($material) {
|
|
70
|
+
> .full-height {
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.content {
|
|
75
|
+
text-align: left;
|
|
76
|
+
|
|
77
|
+
.action {
|
|
78
|
+
padding: 0 0 0 16px;
|
|
79
|
+
color: #686868;
|
|
80
|
+
|
|
81
|
+
.actionIcon {
|
|
82
|
+
display: inline-block;
|
|
83
|
+
float: left;
|
|
84
|
+
margin-right: 32px;
|
|
85
|
+
font-size: 26px;
|
|
86
|
+
text-align: center;
|
|
87
|
+
width: 0.8em;
|
|
88
|
+
height: 56px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.cancel {
|
|
93
|
+
padding: 0 0 0 16px;
|
|
94
|
+
color: #686868;
|
|
95
|
+
|
|
96
|
+
.actionIcon {
|
|
97
|
+
display: inline-block;
|
|
98
|
+
float: left;
|
|
99
|
+
margin-right: 32px;
|
|
100
|
+
font-size: 1rem;
|
|
101
|
+
text-align: center;
|
|
102
|
+
width: 0.8em;
|
|
103
|
+
height: 56px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@include design($flat) {
|
|
110
|
+
.content {
|
|
111
|
+
|
|
112
|
+
text-align: center;
|
|
113
|
+
|
|
114
|
+
padding-right: 10px;
|
|
115
|
+
padding-left: 10px;
|
|
116
|
+
padding-bottom: 10px;
|
|
117
|
+
|
|
118
|
+
.action {
|
|
119
|
+
color: var(--flavor-accent);
|
|
120
|
+
|
|
121
|
+
background-size: 100% 1px;
|
|
122
|
+
background-repeat: no-repeat;
|
|
123
|
+
background-position: bottom;
|
|
124
|
+
background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1) 100%);
|
|
125
|
+
|
|
126
|
+
&:first-child {
|
|
127
|
+
border-top-right-radius: 12px;
|
|
128
|
+
border-top-left-radius: 12px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:nth-last-child(2) {
|
|
132
|
+
border-bottom-right-radius: 12px;
|
|
133
|
+
border-bottom-left-radius: 12px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.actionIcon {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.cancel {
|
|
142
|
+
color: var(--flavor-accent);
|
|
143
|
+
|
|
144
|
+
border-radius: 12px;
|
|
145
|
+
margin: 8px 0 0 0;
|
|
146
|
+
|
|
147
|
+
.actionIcon {
|
|
148
|
+
display: none;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
|
|
4
|
+
import styles from './card.scss';
|
|
5
|
+
import { withMemo } from '../../helper/withMemo';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { ReactElement } from 'react';
|
|
8
|
+
|
|
9
|
+
export type CardProps = RbmComponentProps<{
|
|
10
|
+
title?: string | ReactElement;
|
|
11
|
+
fullHeight?: boolean;
|
|
12
|
+
noPaddingHeight?: boolean;
|
|
13
|
+
noPaddingWidth?: boolean;
|
|
14
|
+
noPadding?: boolean;
|
|
15
|
+
noMargin?: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
function Card({
|
|
19
|
+
title,
|
|
20
|
+
children,
|
|
21
|
+
fullHeight = false,
|
|
22
|
+
noPaddingHeight = false,
|
|
23
|
+
noPadding = false,
|
|
24
|
+
noPaddingWidth = false,
|
|
25
|
+
noMargin = false,
|
|
26
|
+
className,
|
|
27
|
+
...rbmProps
|
|
28
|
+
}: CardProps) {
|
|
29
|
+
const classes = classNames(styles.card, className, {
|
|
30
|
+
[styles.fullHeight]: fullHeight,
|
|
31
|
+
[styles.noPadding]: noPadding,
|
|
32
|
+
[styles.noMargin]: noMargin,
|
|
33
|
+
[styles.noPaddingHeight]: noPaddingHeight,
|
|
34
|
+
[styles.noPaddingWidth]: noPaddingWidth,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div {...rbmProps} className={classes}>
|
|
39
|
+
{title ? <div className={styles.title}>{title}</div> : null}
|
|
40
|
+
<div className={styles.content}>{children}</div>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const CardMemo = withMemo(Card, styles);
|
|
46
|
+
export { CardMemo as Card };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@import "../../scss/variables";
|
|
2
|
+
@import "../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
$marginCard: 8px;
|
|
5
|
+
|
|
6
|
+
.card {
|
|
7
|
+
margin: $marginCard;
|
|
8
|
+
padding: 16px;
|
|
9
|
+
word-wrap: break-word;
|
|
10
|
+
background-color: #ffffff;
|
|
11
|
+
|
|
12
|
+
&.fullHeight {
|
|
13
|
+
height: calc(100% - #{2*$marginCard})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.noPaddingHeight {
|
|
17
|
+
padding-top: 0;
|
|
18
|
+
padding-bottom: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.noPaddingWidth {
|
|
22
|
+
padding-left: 0;
|
|
23
|
+
padding-right: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.noPadding {
|
|
27
|
+
padding: 0
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.noMargin {
|
|
31
|
+
margin: 0;
|
|
32
|
+
|
|
33
|
+
&.fullHeight {
|
|
34
|
+
height: 100%
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.content {
|
|
39
|
+
font-size: $fontSizeBase;
|
|
40
|
+
margin: 0;
|
|
41
|
+
line-height: 1.4;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.title {
|
|
45
|
+
padding: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@include design($material) {
|
|
49
|
+
border-radius: 2px;
|
|
50
|
+
box-shadow: $boxShadowMaterial;
|
|
51
|
+
|
|
52
|
+
.content {
|
|
53
|
+
color: #000000;
|
|
54
|
+
color: rgba(0, 0, 0, 0.54);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.title {
|
|
58
|
+
margin: 8px 0 12px 0;
|
|
59
|
+
font-size: 24px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include design($flat) {
|
|
64
|
+
border-radius: 8px;
|
|
65
|
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 12%);
|
|
66
|
+
|
|
67
|
+
.content {
|
|
68
|
+
color: #030303;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.title {
|
|
72
|
+
margin: 4px 0 8px 0;
|
|
73
|
+
font-size: 20px;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
import { OptionalListener, useListener } from '../Hooks/useListener';
|
|
4
|
+
|
|
5
|
+
import styles from './clickable.scss';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { useCallback, MouseEvent, ForwardedRef } from 'react';
|
|
8
|
+
import { withForwardRef } from '../../helper/withForwardRef';
|
|
9
|
+
|
|
10
|
+
type OnClickListener<Data> = OptionalListener<'onClick', Data>;
|
|
11
|
+
type OnMouseDownListener<Data> = OptionalListener<'onMouseDown', Data>;
|
|
12
|
+
type OnMouseUpListener<Data> = OptionalListener<'onMouseUp', Data>;
|
|
13
|
+
type OnMouseMoveListener<Data> = OptionalListener<'onMouseMove', Data>;
|
|
14
|
+
|
|
15
|
+
export type ClickableProps<
|
|
16
|
+
OnClickData,
|
|
17
|
+
OnMouseDownData,
|
|
18
|
+
OnMouseMoveData,
|
|
19
|
+
OnMouseUpData,
|
|
20
|
+
OnClickCaptureData,
|
|
21
|
+
HrefType extends string | undefined
|
|
22
|
+
> = RbmComponentProps<
|
|
23
|
+
{
|
|
24
|
+
interactable?: boolean;
|
|
25
|
+
href?: HrefType;
|
|
26
|
+
preventDefault?: boolean;
|
|
27
|
+
stopPropagation?: boolean;
|
|
28
|
+
} & OnClickListener<OnClickData> &
|
|
29
|
+
OnMouseDownListener<OnMouseDownData> &
|
|
30
|
+
OnMouseMoveListener<OnMouseMoveData> &
|
|
31
|
+
OnMouseUpListener<OnMouseUpData> &
|
|
32
|
+
OptionalListener<'onClickCapture', OnClickCaptureData>
|
|
33
|
+
>;
|
|
34
|
+
|
|
35
|
+
function Clickable<
|
|
36
|
+
OnClickData,
|
|
37
|
+
OnMouseDownData,
|
|
38
|
+
OnMouseMoveData,
|
|
39
|
+
OnMouseUpData,
|
|
40
|
+
OnClickCaptureData,
|
|
41
|
+
HrefType extends string | undefined
|
|
42
|
+
>(
|
|
43
|
+
{
|
|
44
|
+
className,
|
|
45
|
+
children,
|
|
46
|
+
style,
|
|
47
|
+
href,
|
|
48
|
+
interactable = true,
|
|
49
|
+
preventDefault = true,
|
|
50
|
+
stopPropagation = true,
|
|
51
|
+
...clickData
|
|
52
|
+
}: ClickableProps<OnClickData, OnMouseDownData, OnMouseMoveData, OnMouseUpData, OnClickCaptureData, HrefType>,
|
|
53
|
+
ref: ForwardedRef<HrefType extends string ? HTMLAnchorElement : HTMLSpanElement>
|
|
54
|
+
) {
|
|
55
|
+
// Variables
|
|
56
|
+
|
|
57
|
+
// States
|
|
58
|
+
|
|
59
|
+
// Refs
|
|
60
|
+
|
|
61
|
+
// Callbacks
|
|
62
|
+
const onClickInner = useListener<'onClick', OnClickData>('onClick', clickData);
|
|
63
|
+
const realOnClick = useCallback(
|
|
64
|
+
(e: MouseEvent) => {
|
|
65
|
+
if (clickData.onClick) {
|
|
66
|
+
if (stopPropagation) {
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
}
|
|
69
|
+
if (preventDefault) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
onClickInner(e);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[clickData.onClick, onClickInner, preventDefault, stopPropagation]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const onMouseDownInner = useListener<'onMouseDown', OnMouseDownData>('onMouseDown', clickData);
|
|
79
|
+
const realOnMouseDown = useCallback(
|
|
80
|
+
(e: MouseEvent) => {
|
|
81
|
+
if (clickData.onMouseDown) {
|
|
82
|
+
if (stopPropagation) {
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
}
|
|
85
|
+
if (preventDefault) {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
}
|
|
88
|
+
onMouseDownInner(e);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[clickData.onMouseDown, onMouseDownInner, preventDefault, stopPropagation]
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const onMouseMoveInner = useListener<'onMouseMove', OnMouseMoveData>('onMouseMove', clickData);
|
|
95
|
+
const realOnMouseMove = useCallback(
|
|
96
|
+
(e: MouseEvent) => {
|
|
97
|
+
if (clickData.onMouseMove) {
|
|
98
|
+
if (stopPropagation) {
|
|
99
|
+
e.stopPropagation();
|
|
100
|
+
}
|
|
101
|
+
if (preventDefault) {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
}
|
|
104
|
+
onMouseMoveInner(e);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
[clickData.onMouseMove, onMouseMoveInner, preventDefault, stopPropagation]
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const onMouseUpInner = useListener<'onMouseUp', OnMouseUpData>('onMouseUp', clickData);
|
|
111
|
+
const realOnMouseUp = useCallback(
|
|
112
|
+
(e: MouseEvent) => {
|
|
113
|
+
if (clickData.onMouseUp) {
|
|
114
|
+
if (stopPropagation) {
|
|
115
|
+
e.stopPropagation();
|
|
116
|
+
}
|
|
117
|
+
if (preventDefault) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
}
|
|
120
|
+
onMouseUpInner(e);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
[clickData.onMouseUp, onMouseUpInner, preventDefault, stopPropagation]
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const onClickCaptureInner = useListener<'onClickCapture', OnClickCaptureData>('onClickCapture', clickData);
|
|
127
|
+
const realOnClickCaptureInner = useCallback(
|
|
128
|
+
(e: MouseEvent) => {
|
|
129
|
+
if (clickData.onClickCapture) {
|
|
130
|
+
if (stopPropagation) {
|
|
131
|
+
e.stopPropagation();
|
|
132
|
+
}
|
|
133
|
+
if (preventDefault) {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
}
|
|
136
|
+
onClickCaptureInner(e);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
[clickData.onClickCapture, onClickCaptureInner, preventDefault, stopPropagation]
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Effects
|
|
143
|
+
|
|
144
|
+
// Other
|
|
145
|
+
|
|
146
|
+
// Render Functions
|
|
147
|
+
const props = {
|
|
148
|
+
style,
|
|
149
|
+
role: interactable ? 'button' : undefined,
|
|
150
|
+
'aria-hidden': interactable ? undefined : true,
|
|
151
|
+
className: classNames(styles.clickable, className),
|
|
152
|
+
onClick: realOnClick,
|
|
153
|
+
onMouseDown: realOnMouseDown,
|
|
154
|
+
onMouseMove: realOnMouseMove,
|
|
155
|
+
onMouseUp: realOnMouseUp,
|
|
156
|
+
onClickCapture: realOnClickCaptureInner,
|
|
157
|
+
tabIndex: interactable ? 0 : undefined,
|
|
158
|
+
};
|
|
159
|
+
if (typeof href === 'string') {
|
|
160
|
+
return (
|
|
161
|
+
<a {...props} href={href} ref={ref as ForwardedRef<HTMLAnchorElement>}>
|
|
162
|
+
{children}
|
|
163
|
+
</a>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return (
|
|
167
|
+
<span {...props} ref={ref as ForwardedRef<HTMLSpanElement>}>
|
|
168
|
+
{children}
|
|
169
|
+
</span>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const ClickableMemo = withForwardRef(Clickable, styles);
|
|
174
|
+
export { ClickableMemo as Clickable };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { withMemo } from '../../helper/withMemo';
|
|
4
|
+
import { ButtonDialog } from './ButtonDialog';
|
|
5
|
+
|
|
6
|
+
export type AlertDialogProps = {
|
|
7
|
+
title?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
close: () => void;
|
|
10
|
+
confirmText?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function AlertDialog({ title, message, close, confirmText = 'OK' }: AlertDialogProps) {
|
|
14
|
+
// Variables
|
|
15
|
+
const buttons = useMemo(
|
|
16
|
+
() => [
|
|
17
|
+
{
|
|
18
|
+
text: confirmText,
|
|
19
|
+
callback: () => close(),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
[close, confirmText]
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
// Refs
|
|
26
|
+
|
|
27
|
+
// States
|
|
28
|
+
|
|
29
|
+
// Selectors
|
|
30
|
+
|
|
31
|
+
// Callbacks
|
|
32
|
+
|
|
33
|
+
// Effects
|
|
34
|
+
|
|
35
|
+
// Other
|
|
36
|
+
|
|
37
|
+
// Render Functions
|
|
38
|
+
|
|
39
|
+
return <ButtonDialog message={message} buttons={buttons} title={title} />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Need AlertDialogMemo for autocompletion of phpstorm
|
|
43
|
+
const AlertDialogMemo = withMemo(AlertDialog);
|
|
44
|
+
export { AlertDialogMemo as AlertDialog };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { Block } from '../Layout/Block';
|
|
4
|
+
import { Text } from '../Text/Text';
|
|
5
|
+
import { Clickable } from '../Clickable/Clickable';
|
|
6
|
+
|
|
7
|
+
import styles from './buttonDialog.scss';
|
|
8
|
+
import { RbmComponentProps, WithNoChildren } from '../RbmComponentProps';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
|
|
11
|
+
export type ButtonDialogProps = RbmComponentProps<
|
|
12
|
+
{ title?: string; message: string; buttons: { text: string; callback: () => void }[] },
|
|
13
|
+
WithNoChildren
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
function ButtonDialog({ title, message, buttons, style, className }: ButtonDialogProps) {
|
|
17
|
+
// Variables
|
|
18
|
+
|
|
19
|
+
// Refs
|
|
20
|
+
|
|
21
|
+
// States
|
|
22
|
+
|
|
23
|
+
// Selectors
|
|
24
|
+
|
|
25
|
+
// Callbacks
|
|
26
|
+
|
|
27
|
+
// Effects
|
|
28
|
+
|
|
29
|
+
// Other
|
|
30
|
+
|
|
31
|
+
// Render Functions
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Block className={classNames(styles.buttonDialog, className)} style={style}>
|
|
35
|
+
{!!title && (
|
|
36
|
+
<Block className={styles.title}>
|
|
37
|
+
<Text>{title}</Text>
|
|
38
|
+
</Block>
|
|
39
|
+
)}
|
|
40
|
+
<Block className={styles.message}>
|
|
41
|
+
<Text>{message}</Text>
|
|
42
|
+
</Block>
|
|
43
|
+
<Block className={styles.buttonContainer}>
|
|
44
|
+
{buttons.map((b, i) => (
|
|
45
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
46
|
+
<Clickable onClick={b.callback} className={styles.button} key={i + b.text}>
|
|
47
|
+
<Text>{b.text}</Text>
|
|
48
|
+
</Clickable>
|
|
49
|
+
))}
|
|
50
|
+
</Block>
|
|
51
|
+
</Block>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Need ButtonDialogMemo for autocompletion of phpstorm
|
|
56
|
+
const ButtonDialogMemo = withMemo(ButtonDialog, styles);
|
|
57
|
+
export { ButtonDialogMemo as ButtonDialog };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { withMemo } from '../../helper/withMemo';
|
|
4
|
+
import { ButtonDialog } from './ButtonDialog';
|
|
5
|
+
|
|
6
|
+
export type ConfirmDialogProps = {
|
|
7
|
+
title?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
close: (confirmed: boolean) => void;
|
|
10
|
+
cancelText?: string;
|
|
11
|
+
confirmText?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function ConfirmDialog({ title, message, close, cancelText = 'Cancel', confirmText = 'OK' }: ConfirmDialogProps) {
|
|
15
|
+
// Variables
|
|
16
|
+
const buttons = useMemo(
|
|
17
|
+
() => [
|
|
18
|
+
{
|
|
19
|
+
text: confirmText,
|
|
20
|
+
callback: () => close(true),
|
|
21
|
+
},
|
|
22
|
+
{ text: cancelText, callback: () => close(false) },
|
|
23
|
+
],
|
|
24
|
+
[cancelText, close, confirmText]
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// Refs
|
|
28
|
+
|
|
29
|
+
// States
|
|
30
|
+
|
|
31
|
+
// Selectors
|
|
32
|
+
|
|
33
|
+
// Callbacks
|
|
34
|
+
|
|
35
|
+
// Effects
|
|
36
|
+
|
|
37
|
+
// Other
|
|
38
|
+
|
|
39
|
+
// Render Functions
|
|
40
|
+
|
|
41
|
+
return <ButtonDialog message={message} buttons={buttons} title={title} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Need ConfirmDialogMemo for autocompletion of phpstorm
|
|
45
|
+
const ConfirmDialogMemo = withMemo(ConfirmDialog);
|
|
46
|
+
export { ConfirmDialogMemo as ConfirmDialog };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import styles from './dialog.scss';
|
|
5
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
6
|
+
import { withMemo } from '../../helper/withMemo';
|
|
7
|
+
import { InlineBlock } from '../Layout/InlineBlock';
|
|
8
|
+
import { Block } from '../Layout/Block';
|
|
9
|
+
import { ReactElement, useCallback, useState } from 'react';
|
|
10
|
+
import { Clickable } from '../Clickable/Clickable';
|
|
11
|
+
|
|
12
|
+
export type DialogProps<ReturnData> = RbmComponentProps<
|
|
13
|
+
{
|
|
14
|
+
closable?: boolean;
|
|
15
|
+
onClose?: (data?: ReturnData, identifier?: number) => void;
|
|
16
|
+
identifier?: number;
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
children: ReactElement<Record<string, any> & { close?: (data?: ReturnData) => void }> | string | number;
|
|
20
|
+
}
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
function Dialog<ReturnData>({
|
|
24
|
+
style,
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
closable = true,
|
|
28
|
+
onClose,
|
|
29
|
+
identifier,
|
|
30
|
+
}: DialogProps<ReturnData>) {
|
|
31
|
+
// Variables
|
|
32
|
+
const [isClosed, setIsClosed] = useState(false);
|
|
33
|
+
|
|
34
|
+
// Refs
|
|
35
|
+
|
|
36
|
+
// States
|
|
37
|
+
|
|
38
|
+
// Selectors
|
|
39
|
+
|
|
40
|
+
// Callbacks
|
|
41
|
+
const close = useCallback(
|
|
42
|
+
(data?: ReturnData) => {
|
|
43
|
+
setIsClosed(true);
|
|
44
|
+
onClose?.(data, identifier);
|
|
45
|
+
},
|
|
46
|
+
[identifier, onClose]
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const onCurtainClick = useCallback(() => {
|
|
50
|
+
if (!closable) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
close();
|
|
54
|
+
}, [closable, close]);
|
|
55
|
+
|
|
56
|
+
// Effects
|
|
57
|
+
|
|
58
|
+
// Other
|
|
59
|
+
|
|
60
|
+
// Render Functions
|
|
61
|
+
if (isClosed) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Block className={classNames(styles.dialogContainer, className)} __allowChildren="all" style={style}>
|
|
67
|
+
<Clickable onClick={onCurtainClick} className={styles.closeCurtain} interactable={closable} />
|
|
68
|
+
<InlineBlock __allowChildren="all" className={styles.dialog}>
|
|
69
|
+
{React.Children.map(children, (child) => {
|
|
70
|
+
if (React.isValidElement(child)) {
|
|
71
|
+
return React.cloneElement(child, { close });
|
|
72
|
+
}
|
|
73
|
+
return child;
|
|
74
|
+
})}
|
|
75
|
+
</InlineBlock>
|
|
76
|
+
</Block>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Need Dialog Memo for autocompletion of phpstorm
|
|
81
|
+
const DialogMemo = withMemo(Dialog, styles);
|
|
82
|
+
export { DialogMemo as Dialog };
|