@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,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
import styles from './layout.scss';
|
|
6
|
+
import { ViewWithoutListeners, ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
7
|
+
import { ComponentRef, ForwardedRef } from 'react';
|
|
8
|
+
import { withForwardRef } from '../../helper/withForwardRef';
|
|
9
|
+
|
|
10
|
+
export type InlineBlockProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<
|
|
11
|
+
ViewWithoutListenersProps<AsType>
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
function InlineBlock<AsType extends keyof JSX.IntrinsicElements = 'span'>(
|
|
15
|
+
{ children, as = 'span' as AsType, className, ...props }: InlineBlockProps<AsType>,
|
|
16
|
+
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
17
|
+
) {
|
|
18
|
+
// Variables
|
|
19
|
+
|
|
20
|
+
// Refs
|
|
21
|
+
|
|
22
|
+
// States
|
|
23
|
+
|
|
24
|
+
// Selectors
|
|
25
|
+
|
|
26
|
+
// Callbacks
|
|
27
|
+
|
|
28
|
+
// Effects
|
|
29
|
+
|
|
30
|
+
// Other
|
|
31
|
+
|
|
32
|
+
// Render Functions
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<ViewWithoutListeners
|
|
36
|
+
{...(props as ViewWithoutListenersProps<AsType>)}
|
|
37
|
+
className={classNames(styles.inlineBlock, className)}
|
|
38
|
+
as={as as AsType}
|
|
39
|
+
ref={ref}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</ViewWithoutListeners>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Need InlineMemo for autocompletion of phpstorm
|
|
47
|
+
const InlineBlockMemo = withForwardRef(InlineBlock, styles);
|
|
48
|
+
export { InlineBlockMemo as InlineBlock };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentRef, ForwardedRef, PropsWithChildren, ReactElement, RefAttributes } from 'react';
|
|
3
|
+
import { Override } from '../../TypeHelpers';
|
|
4
|
+
|
|
5
|
+
export type ViewProps<AsType extends keyof JSX.IntrinsicElements> = PropsWithChildren<
|
|
6
|
+
Override<React.ComponentPropsWithoutRef<AsType>, { as?: AsType; children?: React.ReactNode }>
|
|
7
|
+
>;
|
|
8
|
+
|
|
9
|
+
function View<AsType extends keyof JSX.IntrinsicElements>(
|
|
10
|
+
{ children, as, ...otherProps }: ViewProps<AsType>,
|
|
11
|
+
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
12
|
+
) {
|
|
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
|
+
const element = (as as keyof JSX.IntrinsicElements) ?? 'span';
|
|
29
|
+
const props = {
|
|
30
|
+
...otherProps,
|
|
31
|
+
ref,
|
|
32
|
+
};
|
|
33
|
+
return React.createElement(element, props, children);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Need ViewMemo for autocompletion of phpstorm
|
|
37
|
+
const ViewMemo: <AsType extends keyof JSX.IntrinsicElements>(
|
|
38
|
+
props: ViewProps<AsType> & RefAttributes<ComponentRef<AsType>>
|
|
39
|
+
) => ReactElement | null = React.memo(React.forwardRef(View));
|
|
40
|
+
export { ViewMemo as View };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentRef, DOMAttributes, ForwardedRef, ReactElement, RefAttributes } from 'react';
|
|
3
|
+
import { View, ViewProps } from './View';
|
|
4
|
+
|
|
5
|
+
export type ViewWithoutListenersProps<AsType extends keyof JSX.IntrinsicElements> = Omit<
|
|
6
|
+
ViewProps<AsType>,
|
|
7
|
+
keyof DOMAttributes<AsType>
|
|
8
|
+
> & { children?: React.ReactNode };
|
|
9
|
+
|
|
10
|
+
function ViewWithoutListeners<AsType extends keyof JSX.IntrinsicElements>(
|
|
11
|
+
{ children, ...props }: ViewWithoutListenersProps<AsType>,
|
|
12
|
+
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
13
|
+
) {
|
|
14
|
+
// Variables
|
|
15
|
+
|
|
16
|
+
// Refs
|
|
17
|
+
|
|
18
|
+
// States
|
|
19
|
+
|
|
20
|
+
// Selectors
|
|
21
|
+
|
|
22
|
+
// Callbacks
|
|
23
|
+
|
|
24
|
+
// Effects
|
|
25
|
+
|
|
26
|
+
// Other
|
|
27
|
+
|
|
28
|
+
// Render Functions
|
|
29
|
+
return (
|
|
30
|
+
<View {...props} ref={ref}>
|
|
31
|
+
{children}
|
|
32
|
+
</View>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Need ViewWithoutListenersMemo for autocompletion of phpstorm
|
|
37
|
+
const ViewWithoutListenersMemo: <AsType extends keyof JSX.IntrinsicElements>(
|
|
38
|
+
props: ViewWithoutListenersProps<AsType> & RefAttributes<ComponentRef<AsType>>
|
|
39
|
+
) => ReactElement | null = React.memo(React.forwardRef(ViewWithoutListeners));
|
|
40
|
+
export { ViewWithoutListenersMemo as ViewWithoutListeners };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.flex {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
|
|
7
|
+
&.horizontal {
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.grow {
|
|
13
|
+
&.weight0 {
|
|
14
|
+
flex: 0
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.weight1 {
|
|
18
|
+
flex: 1
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.weight2 {
|
|
22
|
+
flex: 2
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.weight3 {
|
|
26
|
+
flex: 3
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.weight4 {
|
|
30
|
+
flex: 4
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.weight5 {
|
|
34
|
+
flex: 5
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.weight6 {
|
|
38
|
+
flex: 6
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.center {
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.block {
|
|
47
|
+
display: block;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.inlineBlock {
|
|
51
|
+
display: inline-block;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.inline {
|
|
55
|
+
display: inline;
|
|
56
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
|
+
|
|
5
|
+
export type BulletListProps = RbmComponentProps<{ numbered?: boolean }>;
|
|
6
|
+
|
|
7
|
+
function BulletList({ numbered = false, className, children, style }: BulletListProps) {
|
|
8
|
+
// Variables
|
|
9
|
+
|
|
10
|
+
// Refs
|
|
11
|
+
|
|
12
|
+
// States
|
|
13
|
+
|
|
14
|
+
// Selectors
|
|
15
|
+
|
|
16
|
+
// Callbacks
|
|
17
|
+
|
|
18
|
+
// Effects
|
|
19
|
+
|
|
20
|
+
// Other
|
|
21
|
+
const props = { className, style };
|
|
22
|
+
|
|
23
|
+
// Render Functions
|
|
24
|
+
if (numbered) {
|
|
25
|
+
return <ol {...props}>{children}</ol>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return <ul {...props}>{children}</ul>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Need BulletListMemo for autocompletion of phpstorm
|
|
32
|
+
const BulletListMemo = withMemo(BulletList);
|
|
33
|
+
export { BulletListMemo as BulletList };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
|
+
import { EmptyProps } from '../../../helper/EmptyProps';
|
|
5
|
+
|
|
6
|
+
export type ListItemProps = RbmComponentProps<EmptyProps>;
|
|
7
|
+
|
|
8
|
+
function ListItem({ className, children, style }: ListItemProps) {
|
|
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
|
+
<li className={className} style={style}>
|
|
27
|
+
{children}
|
|
28
|
+
</li>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Need ListItemMemo for autocompletion of phpstorm
|
|
33
|
+
const ListItemMemo = withMemo(ListItem);
|
|
34
|
+
export { ListItemMemo as ListItem };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentType, CSSProperties, ReactElement, ReactNode, useCallback, useState } from 'react';
|
|
3
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
|
+
|
|
5
|
+
import styles from './list.scss';
|
|
6
|
+
import { withMemo } from '../../helper/withMemo';
|
|
7
|
+
import { FixedSizeList, ListChildComponentProps } from 'react-window';
|
|
8
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
9
|
+
import { SizeCalculator, SizeCalculatorProps } from '../SizeCalculator/SizeCalculator';
|
|
10
|
+
|
|
11
|
+
export type ListProps<ItemType> = RbmComponentProps<{
|
|
12
|
+
renderItem: (item: ItemType, style: CSSProperties, index: number) => ReactElement;
|
|
13
|
+
itemHeight?: number;
|
|
14
|
+
items: ItemType[];
|
|
15
|
+
renderBefore?: (item: ItemType, index: number) => ReactNode;
|
|
16
|
+
keyExtractor?: (item: ItemType, index: number) => string;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export const List = withMemo(function List<ItemType>({
|
|
20
|
+
items,
|
|
21
|
+
renderItem,
|
|
22
|
+
itemHeight: initialItemHeight = 0,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
}: ListProps<ItemType>) {
|
|
26
|
+
// Variables
|
|
27
|
+
|
|
28
|
+
// States
|
|
29
|
+
const [itemHeight, setItemHeight] = useState(initialItemHeight);
|
|
30
|
+
|
|
31
|
+
// Refs
|
|
32
|
+
|
|
33
|
+
// Callbacks
|
|
34
|
+
const renderItemInner = useCallback<ComponentType<ListChildComponentProps>>(
|
|
35
|
+
({ index, style: itemStyle }) => {
|
|
36
|
+
return renderItem(items[index], itemStyle, index);
|
|
37
|
+
},
|
|
38
|
+
[items, renderItem]
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const setHeight = useCallback<SizeCalculatorProps['onSize']>((_, height) => {
|
|
42
|
+
setItemHeight(height);
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
// Effects
|
|
46
|
+
|
|
47
|
+
// Other
|
|
48
|
+
|
|
49
|
+
// Render Functions
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<AutoSizer>
|
|
53
|
+
{({ height, width }) => {
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
{initialItemHeight === 0 && items.length > 0 && (
|
|
57
|
+
<SizeCalculator onSize={setHeight} absolute={true}>
|
|
58
|
+
{renderItem(
|
|
59
|
+
items[0],
|
|
60
|
+
{
|
|
61
|
+
position: 'relative',
|
|
62
|
+
top: '0px',
|
|
63
|
+
left: '0px',
|
|
64
|
+
width: '100%',
|
|
65
|
+
zIndex: -1,
|
|
66
|
+
},
|
|
67
|
+
0
|
|
68
|
+
)}
|
|
69
|
+
</SizeCalculator>
|
|
70
|
+
)}
|
|
71
|
+
<FixedSizeList
|
|
72
|
+
height={height}
|
|
73
|
+
itemCount={items.length}
|
|
74
|
+
width={width}
|
|
75
|
+
itemSize={itemHeight}
|
|
76
|
+
style={style}
|
|
77
|
+
className={className}
|
|
78
|
+
itemData={items}
|
|
79
|
+
>
|
|
80
|
+
{renderItemInner}
|
|
81
|
+
</FixedSizeList>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
}}
|
|
85
|
+
</AutoSizer>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
styles);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.list {
|
|
2
|
+
width: 100%;
|
|
3
|
+
background-color: white;
|
|
4
|
+
list-style-type: none;
|
|
5
|
+
background-image: linear-gradient(var(--border-light), var(--border-light)),
|
|
6
|
+
linear-gradient(var(--border-light), var(--border-light));
|
|
7
|
+
background-size: 100% 1px, 100% 1px;
|
|
8
|
+
background-repeat: no-repeat;
|
|
9
|
+
background-position: bottom, top;
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
|
|
13
|
+
.item {
|
|
14
|
+
position: relative;
|
|
15
|
+
width: 100%;
|
|
16
|
+
list-style: none;
|
|
17
|
+
display: flex;
|
|
18
|
+
padding: 0 0 0 0.9rem;
|
|
19
|
+
|
|
20
|
+
.itemMain {
|
|
21
|
+
flex-grow: 1;
|
|
22
|
+
display: flex;
|
|
23
|
+
background-image: linear-gradient(0deg, var(--border-light), var(--border-light) 100%);
|
|
24
|
+
background-size: 100% 1px;
|
|
25
|
+
background-position: bottom;
|
|
26
|
+
background-repeat: no-repeat;
|
|
27
|
+
padding: 0.75rem 0 0.75rem 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
import { LoadingCircle } from '../LoadingCircle/LoadingCircle';
|
|
4
|
+
|
|
5
|
+
import styles from './loadingArea.scss';
|
|
6
|
+
import { withMemo } from '../../helper/withMemo';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
export type LoadingAreaProps = RbmComponentProps<{
|
|
10
|
+
opacity?: number;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
fullHeight?: boolean;
|
|
14
|
+
fullSize?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
function LoadingArea({
|
|
18
|
+
loading,
|
|
19
|
+
fullWidth = false,
|
|
20
|
+
fullSize = false,
|
|
21
|
+
fullHeight = false,
|
|
22
|
+
opacity = 0.65,
|
|
23
|
+
className,
|
|
24
|
+
style,
|
|
25
|
+
children,
|
|
26
|
+
}: LoadingAreaProps) {
|
|
27
|
+
// Variables
|
|
28
|
+
if (fullSize) {
|
|
29
|
+
fullHeight = true;
|
|
30
|
+
fullWidth = true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// States
|
|
34
|
+
|
|
35
|
+
// Refs
|
|
36
|
+
|
|
37
|
+
// Callbacks
|
|
38
|
+
|
|
39
|
+
// Effects
|
|
40
|
+
|
|
41
|
+
// Other
|
|
42
|
+
|
|
43
|
+
// Render Functions
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<span
|
|
47
|
+
className={classNames(styles.loadingArea, className, {
|
|
48
|
+
'full-height': fullHeight,
|
|
49
|
+
'full-width': fullWidth,
|
|
50
|
+
})}
|
|
51
|
+
style={style}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
{loading ? (
|
|
55
|
+
<span className={styles.curtain} style={{ opacity }}>
|
|
56
|
+
<LoadingCircle />
|
|
57
|
+
</span>
|
|
58
|
+
) : null}
|
|
59
|
+
</span>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const LoadingAreaMemo = withMemo(LoadingArea, styles);
|
|
64
|
+
export { LoadingAreaMemo as LoadingArea };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.loadingArea {
|
|
2
|
+
height: fit-content;
|
|
3
|
+
width: fit-content;
|
|
4
|
+
position: relative;
|
|
5
|
+
display: contents;
|
|
6
|
+
|
|
7
|
+
.curtain {
|
|
8
|
+
z-index: 1;
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
right: 0;
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
background-color: #efeff4;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
|
|
4
|
+
import styles from './loadingCircle.scss';
|
|
5
|
+
import { withMemo } from '../../helper/withMemo';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
|
|
8
|
+
export type LoadingCircleProps = RbmComponentProps<{
|
|
9
|
+
size?: number;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
function LoadingCircle({ size = 32, className, style }: LoadingCircleProps) {
|
|
13
|
+
// Variables
|
|
14
|
+
|
|
15
|
+
// States
|
|
16
|
+
|
|
17
|
+
// Refs
|
|
18
|
+
|
|
19
|
+
// Callbacks
|
|
20
|
+
|
|
21
|
+
// Effects
|
|
22
|
+
|
|
23
|
+
// Other
|
|
24
|
+
|
|
25
|
+
// Render Functions
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<svg
|
|
29
|
+
className={classNames(styles.loadingCircle, className)}
|
|
30
|
+
viewBox={`0 0 ${size} ${size}`}
|
|
31
|
+
width={size}
|
|
32
|
+
height={size}
|
|
33
|
+
style={style}
|
|
34
|
+
>
|
|
35
|
+
<circle cx="50%" cy="50%" r="40%" fill="none" className={styles.spinner} />
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const LoadingCircleMemo = withMemo(LoadingCircle, styles);
|
|
41
|
+
export { LoadingCircleMemo as LoadingCircle };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@import "../../scss/variables";
|
|
2
|
+
@import "../../scss/designMixin";
|
|
3
|
+
|
|
4
|
+
@keyframes loadingCircle {
|
|
5
|
+
0% {
|
|
6
|
+
stroke-dasharray: 10%, 241.32%;
|
|
7
|
+
stroke-dashoffset: 0;
|
|
8
|
+
}
|
|
9
|
+
50% {
|
|
10
|
+
stroke-dasharray: 201%, 50.322%;
|
|
11
|
+
stroke-dashoffset: -100%;
|
|
12
|
+
}
|
|
13
|
+
100% {
|
|
14
|
+
stroke-dasharray: 10%, 241.32%;
|
|
15
|
+
stroke-dashoffset: -251.32%;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes loadingCircleRotate {
|
|
20
|
+
from {
|
|
21
|
+
transform: rotate(0);
|
|
22
|
+
}
|
|
23
|
+
to {
|
|
24
|
+
transform: rotate(360deg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.loadingCircle {
|
|
29
|
+
.spinner {
|
|
30
|
+
stroke-miterlimit: 10;
|
|
31
|
+
transform-origin: 50%;
|
|
32
|
+
animation: loadingCircle 2s ease-in-out infinite, loadingCircleRotate 1.5s linear infinite;
|
|
33
|
+
stroke: var(--flavor-accent);
|
|
34
|
+
|
|
35
|
+
@include design($material) {
|
|
36
|
+
stroke-width: 9%;
|
|
37
|
+
}
|
|
38
|
+
@include design($flat) {
|
|
39
|
+
stroke-width: 5%;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps, WithNoChildren } from '../RbmComponentProps';
|
|
4
|
+
import { Icon, IconSource } from '../Icon/Icon';
|
|
5
|
+
import { Block } from '../Layout/Block';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
|
|
8
|
+
import styles from './menu.scss';
|
|
9
|
+
import { Text } from '../Text/Text';
|
|
10
|
+
import { Clickable } from '../Clickable/Clickable';
|
|
11
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
12
|
+
import { withRenderBrowserOnly } from '../../helper/withRenderBrowserOnly';
|
|
13
|
+
import { useWindow } from '../../WindowContext/WindowContext';
|
|
14
|
+
|
|
15
|
+
export type MenuItem = {
|
|
16
|
+
label: string;
|
|
17
|
+
callback: () => void;
|
|
18
|
+
icon?: IconSource;
|
|
19
|
+
key: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type MenuProps = RbmComponentProps<
|
|
23
|
+
{ items: MenuItem[]; x: number; y: number; isOpen: boolean; onClose: () => void },
|
|
24
|
+
WithNoChildren
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
export const Menu = withMemo(
|
|
28
|
+
withRenderBrowserOnly(function Menu({ className, style, items, y, x, isOpen, onClose }: MenuProps) {
|
|
29
|
+
// Variables
|
|
30
|
+
|
|
31
|
+
// Refs
|
|
32
|
+
const menuRef = useRef<HTMLDivElement>(null);
|
|
33
|
+
const window = useWindow();
|
|
34
|
+
|
|
35
|
+
// States
|
|
36
|
+
const [innerX, setInnerX] = useState(x);
|
|
37
|
+
const [innerY, setInnerY] = useState(y);
|
|
38
|
+
|
|
39
|
+
// Selectors
|
|
40
|
+
|
|
41
|
+
// Callbacks
|
|
42
|
+
const callItemCallback = useCallback(
|
|
43
|
+
(_: any, cb: () => void) => {
|
|
44
|
+
onClose();
|
|
45
|
+
cb();
|
|
46
|
+
},
|
|
47
|
+
[onClose]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// Effects
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (isOpen) {
|
|
53
|
+
const listener = (e: MouseEvent) => {
|
|
54
|
+
if (!menuRef.current?.contains(e.target as Node)) {
|
|
55
|
+
onClose();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
window?.addEventListener('mousedown', listener, { capture: true });
|
|
59
|
+
return () => window?.removeEventListener('mousedown', listener, { capture: true });
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}, [isOpen, onClose, window]);
|
|
63
|
+
|
|
64
|
+
useLayoutEffect(() => {
|
|
65
|
+
if (!menuRef.current) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const { width } = getComputedStyle(menuRef.current);
|
|
69
|
+
const newX = Math.min(x, (window?.innerWidth ?? 0) - parseFloat(width));
|
|
70
|
+
setInnerX(newX);
|
|
71
|
+
}, [window?.innerWidth, x]);
|
|
72
|
+
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
if (!menuRef.current) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const height = parseFloat(getComputedStyle(menuRef.current).height);
|
|
78
|
+
let newY = y;
|
|
79
|
+
if (newY > (window?.innerHeight ?? 0) - height) {
|
|
80
|
+
newY -= height;
|
|
81
|
+
}
|
|
82
|
+
setInnerY(newY);
|
|
83
|
+
}, [window?.innerHeight, y]);
|
|
84
|
+
|
|
85
|
+
// Other
|
|
86
|
+
|
|
87
|
+
// Render Functions
|
|
88
|
+
if (!isOpen) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Block
|
|
94
|
+
className={classNames(className, styles.menu)}
|
|
95
|
+
style={{ ...style, top: innerY, left: innerX }}
|
|
96
|
+
ref={menuRef}
|
|
97
|
+
>
|
|
98
|
+
{items.map((item) => (
|
|
99
|
+
<Clickable
|
|
100
|
+
onClick={callItemCallback}
|
|
101
|
+
onClickData={item.callback}
|
|
102
|
+
className={styles.item}
|
|
103
|
+
key={item.key}
|
|
104
|
+
>
|
|
105
|
+
{!!item.icon && <Icon icon={item.icon} />}
|
|
106
|
+
<Text>{item.label}</Text>
|
|
107
|
+
</Clickable>
|
|
108
|
+
))}
|
|
109
|
+
</Block>
|
|
110
|
+
);
|
|
111
|
+
}),
|
|
112
|
+
styles
|
|
113
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
.menu {
|
|
3
|
+
position: fixed;
|
|
4
|
+
background: #ffffff;
|
|
5
|
+
border: 1px solid var(--border-light);
|
|
6
|
+
|
|
7
|
+
.item {
|
|
8
|
+
display: block;
|
|
9
|
+
border-top: 1px solid var(--border-light);
|
|
10
|
+
padding: 8px;
|
|
11
|
+
margin: 0 4px;
|
|
12
|
+
|
|
13
|
+
&:hover {
|
|
14
|
+
background-color: #f5f5f5;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:first-child {
|
|
18
|
+
border-top: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|