@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.
Files changed (233) hide show
  1. package/.eslintrc.json +189 -0
  2. package/.prettierrc +5 -0
  3. package/LICENSE +21 -0
  4. package/README.md +1 -0
  5. package/babel.config.js +22 -0
  6. package/bin/build.js +60 -0
  7. package/bin/release.sh +35 -0
  8. package/bin/updateCopies.js +86 -0
  9. package/bootstrapReactMobile.ts +87 -0
  10. package/dist/bootstrapReactMobile.d.ts +87 -0
  11. package/dist/bootstrapReactMobile.js +6275 -0
  12. package/dist/src/Components/ActionSheet/ActionSheet.d.ts +21 -0
  13. package/dist/src/Components/Card/Card.d.ts +13 -0
  14. package/dist/src/Components/Clickable/Clickable.d.ts +14 -0
  15. package/dist/src/Components/Dialog/AlertDialog.d.ts +10 -0
  16. package/dist/src/Components/Dialog/ButtonDialog.d.ts +13 -0
  17. package/dist/src/Components/Dialog/ConfirmDialog.d.ts +11 -0
  18. package/dist/src/Components/Dialog/Dialog.d.ts +14 -0
  19. package/dist/src/Components/Dialog/DialogBackground.d.ts +7 -0
  20. package/dist/src/Components/Dialog/DialogContainer.d.ts +6 -0
  21. package/dist/src/Components/Dialog/DialogContext.d.ts +9 -0
  22. package/dist/src/Components/Dialog/useAlertDialog.d.ts +1 -0
  23. package/dist/src/Components/Dialog/useConfirmDialog.d.ts +1 -0
  24. package/dist/src/Components/DragAndDrop/DragItem.d.ts +7 -0
  25. package/dist/src/Components/DragAndDrop/DropArea.d.ts +7 -0
  26. package/dist/src/Components/DragAndDrop/useStrictEnabled.d.ts +1 -0
  27. package/dist/src/Components/FormElements/Button/Button.d.ts +8 -0
  28. package/dist/src/Components/FormElements/CheckBox/Checkbox.d.ts +10 -0
  29. package/dist/src/Components/FormElements/ColorInput/ColorInput.d.ts +17 -0
  30. package/dist/src/Components/FormElements/ColorInput/sharedSelectedColor.d.ts +4 -0
  31. package/dist/src/Components/FormElements/ImageInput/ImageInput.d.ts +17 -0
  32. package/dist/src/Components/FormElements/Input/HiddenInput.d.ts +8 -0
  33. package/dist/src/Components/FormElements/Input/Input.d.ts +10 -0
  34. package/dist/src/Components/FormElements/Input/PasswordInput/PasswordInput.d.ts +4 -0
  35. package/dist/src/Components/FormElements/SearchSelectInput/SearchSelectInput.d.ts +10 -0
  36. package/dist/src/Components/FormElements/Select/Select.d.ts +16 -0
  37. package/dist/src/Components/FormElements/Slider/Slider.d.ts +8 -0
  38. package/dist/src/Components/FormElements/Switch/Switch.d.ts +12 -0
  39. package/dist/src/Components/FormElements/Textarea/Textarea.d.ts +12 -0
  40. package/dist/src/Components/FormElements/hooks/useOnChangeDone.d.ts +2 -0
  41. package/dist/src/Components/FullScreen/FullScreen.d.ts +14 -0
  42. package/dist/src/Components/Hooks/useBreakpoint.d.ts +11 -0
  43. package/dist/src/Components/Hooks/useComposedRef.d.ts +2 -0
  44. package/dist/src/Components/Hooks/useDebounced.d.ts +1 -0
  45. package/dist/src/Components/Hooks/useDelayed.d.ts +1 -0
  46. package/dist/src/Components/Hooks/useInViewport.d.ts +2 -0
  47. package/dist/src/Components/Hooks/useKeyListener.d.ts +3 -0
  48. package/dist/src/Components/Hooks/useListener.d.ts +18 -0
  49. package/dist/src/Components/Hooks/useOnMount.d.ts +1 -0
  50. package/dist/src/Components/Hooks/useOnce.d.ts +1 -0
  51. package/dist/src/Components/Icon/Icon.d.ts +13 -0
  52. package/dist/src/Components/Image/Image.d.ts +12 -0
  53. package/dist/src/Components/InViewport/InViewport.d.ts +11 -0
  54. package/dist/src/Components/Layout/Block.d.ts +7 -0
  55. package/dist/src/Components/Layout/Container.d.ts +15 -0
  56. package/dist/src/Components/Layout/Flex.d.ts +10 -0
  57. package/dist/src/Components/Layout/Grid/Grid.d.ts +9 -0
  58. package/dist/src/Components/Layout/Grid/GridItem.d.ts +25 -0
  59. package/dist/src/Components/Layout/Grow.d.ts +9 -0
  60. package/dist/src/Components/Layout/Inline.d.ts +7 -0
  61. package/dist/src/Components/Layout/InlineBlock.d.ts +7 -0
  62. package/dist/src/Components/Layout/View.d.ts +9 -0
  63. package/dist/src/Components/Layout/ViewWithoutListeners.d.ts +8 -0
  64. package/dist/src/Components/List/BulletList/BulletList.d.ts +8 -0
  65. package/dist/src/Components/List/BulletList/ListItem.d.ts +7 -0
  66. package/dist/src/Components/List/List.d.ts +10 -0
  67. package/dist/src/Components/LoadingArea/LoadingArea.d.ts +12 -0
  68. package/dist/src/Components/LoadingCircle/LoadingCircle.d.ts +8 -0
  69. package/dist/src/Components/Menu/Menu.d.ts +16 -0
  70. package/dist/src/Components/Menu/useMenu.d.ts +3 -0
  71. package/dist/src/Components/RbmComponentProps.d.ts +31 -0
  72. package/dist/src/Components/SizeCalculator/SizeCalculator.d.ts +9 -0
  73. package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +15 -0
  74. package/dist/src/Components/SpoilerList/SpoilerList.d.ts +15 -0
  75. package/dist/src/Components/SpoilerList/useSpoilerGroup.d.ts +12 -0
  76. package/dist/src/Components/TabBar/TabBar.d.ts +30 -0
  77. package/dist/src/Components/TabBar/TabBarButton.d.ts +9 -0
  78. package/dist/src/Components/Table/Table.d.ts +36 -0
  79. package/dist/src/Components/Text/Heading.d.ts +7 -0
  80. package/dist/src/Components/Text/Text.d.ts +26 -0
  81. package/dist/src/Components/Toast/Toast.d.ts +13 -0
  82. package/dist/src/Components/Toast/ToastContainer.d.ts +7 -0
  83. package/dist/src/Components/TopBar/MoreButton.d.ts +9 -0
  84. package/dist/src/Components/TopBar/TopBar.d.ts +25 -0
  85. package/dist/src/Components/TopBar/TopBarButton.d.ts +9 -0
  86. package/dist/src/StyleProvider.d.ts +2 -0
  87. package/dist/src/TypeHelpers.d.ts +4 -0
  88. package/dist/src/WindowContext/WindowContext.d.ts +3 -0
  89. package/dist/src/WrongChildError.d.ts +4 -0
  90. package/dist/src/helper/Characters.d.ts +5 -0
  91. package/dist/src/helper/DistributiveOmit.d.ts +1 -0
  92. package/dist/src/helper/EmptyProps.d.ts +1 -0
  93. package/dist/src/helper/memoComparator.d.ts +1 -0
  94. package/dist/src/helper/nonEmptyString.d.ts +1 -0
  95. package/dist/src/helper/withForwardRef.d.ts +7 -0
  96. package/dist/src/helper/withMemo.d.ts +3 -0
  97. package/dist/src/helper/withRenderBrowserOnly.d.ts +2 -0
  98. package/dist/src/helper/withRestrictedChildren.d.ts +6 -0
  99. package/package.json +92 -0
  100. package/react-bootstrap-mobile.scss +6 -0
  101. package/scripts/getPackageJson.js +25 -0
  102. package/src/Components/ActionSheet/ActionSheet.tsx +115 -0
  103. package/src/Components/ActionSheet/actionSheet.scss +153 -0
  104. package/src/Components/Card/Card.tsx +46 -0
  105. package/src/Components/Card/card.scss +76 -0
  106. package/src/Components/Clickable/Clickable.tsx +174 -0
  107. package/src/Components/Clickable/clickable.scss +3 -0
  108. package/src/Components/Dialog/AlertDialog.tsx +44 -0
  109. package/src/Components/Dialog/ButtonDialog.tsx +57 -0
  110. package/src/Components/Dialog/ConfirmDialog.tsx +46 -0
  111. package/src/Components/Dialog/Dialog.tsx +82 -0
  112. package/src/Components/Dialog/DialogBackground.tsx +38 -0
  113. package/src/Components/Dialog/DialogContainer.tsx +77 -0
  114. package/src/Components/Dialog/DialogContext.ts +21 -0
  115. package/src/Components/Dialog/buttonDialog.scss +114 -0
  116. package/src/Components/Dialog/dialog.scss +30 -0
  117. package/src/Components/Dialog/dialogBackground.scss +4 -0
  118. package/src/Components/Dialog/useAlertDialog.ts +13 -0
  119. package/src/Components/Dialog/useConfirmDialog.ts +13 -0
  120. package/src/Components/DragAndDrop/DragItem.tsx +38 -0
  121. package/src/Components/DragAndDrop/DropArea.tsx +43 -0
  122. package/src/Components/DragAndDrop/useStrictEnabled.ts +20 -0
  123. package/src/Components/FormElements/Button/Button.tsx +25 -0
  124. package/src/Components/FormElements/Button/button.scss +39 -0
  125. package/src/Components/FormElements/CheckBox/Checkbox.tsx +61 -0
  126. package/src/Components/FormElements/CheckBox/checkbox.scss +107 -0
  127. package/src/Components/FormElements/ColorInput/ColorInput.tsx +139 -0
  128. package/src/Components/FormElements/ColorInput/colorInput.scss +35 -0
  129. package/src/Components/FormElements/ColorInput/sharedSelectedColor.ts +40 -0
  130. package/src/Components/FormElements/ImageInput/ImageInput.tsx +97 -0
  131. package/src/Components/FormElements/ImageInput/imageInput.scss +24 -0
  132. package/src/Components/FormElements/Input/HiddenInput.tsx +43 -0
  133. package/src/Components/FormElements/Input/Input.tsx +102 -0
  134. package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +55 -0
  135. package/src/Components/FormElements/Input/PasswordInput/passwordInput.scss +7 -0
  136. package/src/Components/FormElements/Input/input.scss +57 -0
  137. package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.tsx +162 -0
  138. package/src/Components/FormElements/SearchSelectInput/seachSelectInput.scss +90 -0
  139. package/src/Components/FormElements/Select/Select.tsx +77 -0
  140. package/src/Components/FormElements/Select/select.scss +51 -0
  141. package/src/Components/FormElements/Slider/Slider.tsx +80 -0
  142. package/src/Components/FormElements/Slider/slider.scss +92 -0
  143. package/src/Components/FormElements/Switch/Switch.tsx +82 -0
  144. package/src/Components/FormElements/Switch/switch.scss +149 -0
  145. package/src/Components/FormElements/Textarea/Textarea.tsx +77 -0
  146. package/src/Components/FormElements/Textarea/textarea.scss +22 -0
  147. package/src/Components/FormElements/hooks/useOnChangeDone.ts +16 -0
  148. package/src/Components/FullScreen/FullScreen.tsx +89 -0
  149. package/src/Components/Hooks/useBreakpoint.ts +66 -0
  150. package/src/Components/Hooks/useComposedRef.ts +17 -0
  151. package/src/Components/Hooks/useDebounced.ts +22 -0
  152. package/src/Components/Hooks/useDelayed.ts +46 -0
  153. package/src/Components/Hooks/useInViewport.ts +23 -0
  154. package/src/Components/Hooks/useKeyListener.ts +77 -0
  155. package/src/Components/Hooks/useListener.ts +73 -0
  156. package/src/Components/Hooks/useOnMount.ts +12 -0
  157. package/src/Components/Hooks/useOnce.ts +11 -0
  158. package/src/Components/Icon/Icon.tsx +45 -0
  159. package/src/Components/Image/Image.tsx +44 -0
  160. package/src/Components/Image/image.scss +3 -0
  161. package/src/Components/InViewport/InViewport.tsx +71 -0
  162. package/src/Components/InViewport/inViewport.scss +3 -0
  163. package/src/Components/Layout/Block.tsx +48 -0
  164. package/src/Components/Layout/Container.tsx +57 -0
  165. package/src/Components/Layout/Flex.tsx +51 -0
  166. package/src/Components/Layout/Grid/Grid.tsx +53 -0
  167. package/src/Components/Layout/Grid/GridItem.tsx +138 -0
  168. package/src/Components/Layout/Grid/grid.scss +43 -0
  169. package/src/Components/Layout/Grow.tsx +51 -0
  170. package/src/Components/Layout/Inline.tsx +48 -0
  171. package/src/Components/Layout/InlineBlock.tsx +48 -0
  172. package/src/Components/Layout/View.tsx +40 -0
  173. package/src/Components/Layout/ViewWithoutListeners.tsx +40 -0
  174. package/src/Components/Layout/container.scss +12 -0
  175. package/src/Components/Layout/layout.scss +56 -0
  176. package/src/Components/List/BulletList/BulletList.tsx +33 -0
  177. package/src/Components/List/BulletList/ListItem.tsx +34 -0
  178. package/src/Components/List/List.tsx +88 -0
  179. package/src/Components/List/list.scss +30 -0
  180. package/src/Components/LoadingArea/LoadingArea.tsx +64 -0
  181. package/src/Components/LoadingArea/loadingArea.scss +19 -0
  182. package/src/Components/LoadingCircle/LoadingCircle.tsx +41 -0
  183. package/src/Components/LoadingCircle/loadingCircle.scss +42 -0
  184. package/src/Components/Menu/Menu.tsx +113 -0
  185. package/src/Components/Menu/menu.scss +21 -0
  186. package/src/Components/Menu/useMenu.ts +20 -0
  187. package/src/Components/RbmComponentProps.ts +40 -0
  188. package/src/Components/SizeCalculator/SizeCalculator.tsx +45 -0
  189. package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +106 -0
  190. package/src/Components/SpoilerList/Spoiler/spoiler.scss +120 -0
  191. package/src/Components/SpoilerList/SpoilerList.tsx +63 -0
  192. package/src/Components/SpoilerList/useSpoilerGroup.ts +39 -0
  193. package/src/Components/TabBar/TabBar.tsx +117 -0
  194. package/src/Components/TabBar/TabBarButton.tsx +44 -0
  195. package/src/Components/TabBar/tabBar.scss +108 -0
  196. package/src/Components/Table/Table.tsx +182 -0
  197. package/src/Components/Text/Heading.tsx +44 -0
  198. package/src/Components/Text/Text.tsx +79 -0
  199. package/src/Components/Text/heading.scss +3 -0
  200. package/src/Components/Text/text.scss +60 -0
  201. package/src/Components/Toast/Toast.tsx +107 -0
  202. package/src/Components/Toast/ToastContainer.tsx +35 -0
  203. package/src/Components/Toast/toast.scss +52 -0
  204. package/src/Components/TopBar/MoreButton.tsx +38 -0
  205. package/src/Components/TopBar/TopBar.tsx +176 -0
  206. package/src/Components/TopBar/TopBarButton.tsx +29 -0
  207. package/src/Components/TopBar/topBar.scss +124 -0
  208. package/src/StyleProvider.ts +4 -0
  209. package/src/TypeHelpers.ts +4 -0
  210. package/src/WindowContext/WindowContext.ts +8 -0
  211. package/src/WrongChildError.ts +19 -0
  212. package/src/env.d.ts +1 -0
  213. package/src/helper/Characters.ts +5 -0
  214. package/src/helper/DistributiveOmit.ts +1 -0
  215. package/src/helper/EmptyProps.ts +2 -0
  216. package/src/helper/memoComparator.ts +18 -0
  217. package/src/helper/nonEmptyString.ts +8 -0
  218. package/src/helper/withForwardRef.ts +28 -0
  219. package/src/helper/withMemo.ts +16 -0
  220. package/src/helper/withRenderBrowserOnly.tsx +30 -0
  221. package/src/helper/withRestrictedChildren.tsx +57 -0
  222. package/src/scss/_animations.scss +46 -0
  223. package/src/scss/_baseClasses.scss +27 -0
  224. package/src/scss/_colors.scss +13 -0
  225. package/src/scss/_default.scss +17 -0
  226. package/src/scss/_designMixin.scss +13 -0
  227. package/src/scss/_mobileMixin.scss +35 -0
  228. package/src/scss/_variables.scss +22 -0
  229. package/src/types/isomorphic-style-loader.d.ts +3 -0
  230. package/src/types/react-table-config.d.ts +120 -0
  231. package/src/types/scss-module.d.ts +7 -0
  232. package/tsconfig.json +57 -0
  233. 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,4 @@
1
+ .dialogBackground {
2
+ background-color: white;
3
+ padding: 0.3rem;
4
+ }
@@ -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
+ }