@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,11 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useOnce(cb: () => void | Promise<void>, condition: boolean) {
|
|
4
|
+
const called = useRef(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!called.current && condition) {
|
|
7
|
+
called.current = true;
|
|
8
|
+
cb();
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FontAwesomeIcon, FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
|
+
import { Override } from '../../TypeHelpers';
|
|
5
|
+
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
6
|
+
import { withMemo } from '../../helper/withMemo';
|
|
7
|
+
|
|
8
|
+
export type IconSource = IconProp | string;
|
|
9
|
+
|
|
10
|
+
export type IconProps = RbmComponentProps<
|
|
11
|
+
Override<
|
|
12
|
+
FontAwesomeIconProps,
|
|
13
|
+
{
|
|
14
|
+
icon: IconSource;
|
|
15
|
+
alt?: string;
|
|
16
|
+
}
|
|
17
|
+
>
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
function Icon({ icon, alt, className, style, title, ...props }: IconProps) {
|
|
21
|
+
// Variables
|
|
22
|
+
|
|
23
|
+
// States
|
|
24
|
+
|
|
25
|
+
// Refs
|
|
26
|
+
|
|
27
|
+
// Callbacks
|
|
28
|
+
|
|
29
|
+
// Effects
|
|
30
|
+
|
|
31
|
+
// Other
|
|
32
|
+
if (!alt && typeof icon === 'string') {
|
|
33
|
+
alt = icon;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Render Functions
|
|
37
|
+
|
|
38
|
+
if (typeof icon === 'string' && icon.indexOf('.') !== -1) {
|
|
39
|
+
return <img src={icon} alt={alt} className={className} style={style} title={title} />;
|
|
40
|
+
}
|
|
41
|
+
return <FontAwesomeIcon {...props} icon={icon as IconProp} className={className} style={style} title={title} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const IconMemo = withMemo(Icon);
|
|
45
|
+
export { IconMemo as Icon };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps, WithNoChildren } from '../RbmComponentProps';
|
|
4
|
+
import { CSSProperties, DOMAttributes } from 'react';
|
|
5
|
+
import { Override } from '../../TypeHelpers';
|
|
6
|
+
|
|
7
|
+
import styles from './image.scss';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
|
|
10
|
+
export type ImageProps = RbmComponentProps<
|
|
11
|
+
Override<
|
|
12
|
+
Omit<React.ComponentPropsWithoutRef<'img'>, keyof DOMAttributes<'img'>>,
|
|
13
|
+
{
|
|
14
|
+
src: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
alt?: string;
|
|
17
|
+
}
|
|
18
|
+
>,
|
|
19
|
+
WithNoChildren
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
function Image({ src, alt = '', className, style, ...otherProps }: ImageProps) {
|
|
23
|
+
// Variables
|
|
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 <img src={src} alt={alt} className={classNames(styles.image, className)} style={style} {...otherProps} />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Need ImageMemo for autocompletion of phpstorm
|
|
43
|
+
const ImageMemo = withMemo(Image, styles);
|
|
44
|
+
export { ImageMemo as Image };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import styles from './inViewport.scss';
|
|
6
|
+
import { withMemo } from '../../helper/withMemo';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
export type InViewportProps = RbmComponentProps<{
|
|
10
|
+
threshold?: number;
|
|
11
|
+
onInViewportChange: (isInViewport: boolean) => void;
|
|
12
|
+
root?: HTMLElement;
|
|
13
|
+
rootMargin?: string;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
function InViewport({
|
|
17
|
+
threshold = 0,
|
|
18
|
+
root,
|
|
19
|
+
rootMargin,
|
|
20
|
+
onInViewportChange,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
children,
|
|
24
|
+
}: InViewportProps) {
|
|
25
|
+
// Variables
|
|
26
|
+
|
|
27
|
+
// States
|
|
28
|
+
const [intersectionObserver, setIntersectionObserver] = useState<IntersectionObserver>();
|
|
29
|
+
|
|
30
|
+
// Refs
|
|
31
|
+
const viewportElement = useRef<HTMLSpanElement>(null);
|
|
32
|
+
|
|
33
|
+
// Callbacks
|
|
34
|
+
|
|
35
|
+
// Effects
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setIntersectionObserver((oldObserver) => {
|
|
38
|
+
oldObserver?.disconnect();
|
|
39
|
+
|
|
40
|
+
return new IntersectionObserver(
|
|
41
|
+
(entries) => {
|
|
42
|
+
onInViewportChange(entries[0].isIntersecting);
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
threshold: [threshold],
|
|
46
|
+
root,
|
|
47
|
+
rootMargin,
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
}, [onInViewportChange, threshold, root, rootMargin]);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (intersectionObserver && viewportElement.current) {
|
|
55
|
+
intersectionObserver.observe(viewportElement.current);
|
|
56
|
+
}
|
|
57
|
+
}, [intersectionObserver, viewportElement]);
|
|
58
|
+
|
|
59
|
+
// Other
|
|
60
|
+
|
|
61
|
+
// Render Functions
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<span ref={viewportElement} className={classNames(styles.inViewport, className)} style={style}>
|
|
65
|
+
{children}
|
|
66
|
+
</span>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const InViewportMemo = withMemo(InViewport, styles);
|
|
71
|
+
export { InViewportMemo as InViewport };
|
|
@@ -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 { ComponentRef, ForwardedRef } from 'react';
|
|
7
|
+
import { withForwardRef } from '../../helper/withForwardRef';
|
|
8
|
+
import { ViewWithoutListeners, ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
9
|
+
|
|
10
|
+
export type BlockProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<
|
|
11
|
+
ViewWithoutListenersProps<AsType>
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
function Block<AsType extends keyof JSX.IntrinsicElements = 'div'>(
|
|
15
|
+
{ children, as = 'div' as AsType, className, ...props }: BlockProps<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
|
+
className={classNames(styles.block, className)}
|
|
37
|
+
as={as as AsType}
|
|
38
|
+
ref={ref}
|
|
39
|
+
{...(props as ViewWithoutListenersProps<AsType>)}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</ViewWithoutListeners>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Need BlockMemo for autocompletion of phpstorm
|
|
47
|
+
const BlockMemo = withForwardRef(Block, styles);
|
|
48
|
+
export { BlockMemo as Block };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
import styles from './container.scss';
|
|
7
|
+
|
|
8
|
+
export const CONTAINER_CLASSES = {
|
|
9
|
+
sm: styles['container-sm'],
|
|
10
|
+
md: styles['container-md'],
|
|
11
|
+
lg: styles['container-lg'],
|
|
12
|
+
xl: styles['container-xl'],
|
|
13
|
+
xxl: styles['container-xxl'],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ContainerProps = RbmComponentProps<{
|
|
17
|
+
fluid?: boolean | keyof typeof CONTAINER_CLASSES;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
function Container({ fluid, className, children, style }: ContainerProps) {
|
|
21
|
+
// Variables
|
|
22
|
+
|
|
23
|
+
// Refs
|
|
24
|
+
|
|
25
|
+
// States
|
|
26
|
+
|
|
27
|
+
// Selectors
|
|
28
|
+
|
|
29
|
+
// Callbacks
|
|
30
|
+
|
|
31
|
+
// Effects
|
|
32
|
+
|
|
33
|
+
// Other
|
|
34
|
+
|
|
35
|
+
// Render Functions
|
|
36
|
+
|
|
37
|
+
const containerClass = typeof fluid === 'string' ? CONTAINER_CLASSES[fluid] : '';
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={classNames(
|
|
41
|
+
{
|
|
42
|
+
[styles.container]: fluid === false,
|
|
43
|
+
[styles.containerFluid]: fluid === true,
|
|
44
|
+
},
|
|
45
|
+
containerClass,
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
style={style}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Need ContainerMemo for autocompletion of phpstorm
|
|
56
|
+
const ContainerMemo = withMemo(Container, styles);
|
|
57
|
+
export { ContainerMemo as Container };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
|
|
4
|
+
import styles from './layout.scss';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { ComponentRef, ForwardedRef } from 'react';
|
|
7
|
+
import { withForwardRef } from '../../helper/withForwardRef';
|
|
8
|
+
import { ViewWithoutListeners, ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
9
|
+
|
|
10
|
+
export type FlexProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<
|
|
11
|
+
ViewWithoutListenersProps<AsType> & {
|
|
12
|
+
horizontal?: boolean;
|
|
13
|
+
grow?: boolean;
|
|
14
|
+
}
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
function Flex<AsType extends keyof JSX.IntrinsicElements = 'div'>(
|
|
18
|
+
{ children, as = 'div' as AsType, className, horizontal = false, grow = false, ...props }: FlexProps<AsType>,
|
|
19
|
+
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
20
|
+
) {
|
|
21
|
+
// Variables
|
|
22
|
+
|
|
23
|
+
// States
|
|
24
|
+
|
|
25
|
+
// Refs
|
|
26
|
+
|
|
27
|
+
// Callbacks
|
|
28
|
+
|
|
29
|
+
// Effects
|
|
30
|
+
|
|
31
|
+
// Other
|
|
32
|
+
|
|
33
|
+
// Render Functions
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ViewWithoutListeners
|
|
37
|
+
className={classNames(className, styles.flex, {
|
|
38
|
+
[styles.horizontal]: horizontal,
|
|
39
|
+
[styles.grow]: grow,
|
|
40
|
+
})}
|
|
41
|
+
as={as as AsType}
|
|
42
|
+
ref={ref}
|
|
43
|
+
{...(props as ViewWithoutListenersProps<AsType>)}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</ViewWithoutListeners>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const tmp = withForwardRef(Flex, styles);
|
|
51
|
+
export { tmp as Flex };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
|
+
import { Block } from '../Block';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
7
|
+
import styles from './grid.scss';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
|
|
10
|
+
export type GridProps = RbmComponentProps<{
|
|
11
|
+
columns?: number;
|
|
12
|
+
rows?: number;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
function Grid({ style, children, columns = 12, rows = 1, className, __allowChildren }: GridProps) {
|
|
16
|
+
// Variables
|
|
17
|
+
const appliedStyle = useMemo(
|
|
18
|
+
() => ({
|
|
19
|
+
...style,
|
|
20
|
+
'--grid-columns': columns,
|
|
21
|
+
'--grid-rows': rows,
|
|
22
|
+
}),
|
|
23
|
+
[style, columns, rows]
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Refs
|
|
27
|
+
|
|
28
|
+
// States
|
|
29
|
+
|
|
30
|
+
// Selectors
|
|
31
|
+
|
|
32
|
+
// Callbacks
|
|
33
|
+
|
|
34
|
+
// Effects
|
|
35
|
+
|
|
36
|
+
// Other
|
|
37
|
+
|
|
38
|
+
// Render Functions
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Block
|
|
42
|
+
style={appliedStyle}
|
|
43
|
+
className={classNames(styles.grid, className)}
|
|
44
|
+
__allowChildren={__allowChildren as 'all'}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</Block>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Need RowMemo for autocompletion of phpstorm
|
|
52
|
+
const GridMemo = withMemo(Grid, styles);
|
|
53
|
+
export { GridMemo as Grid };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { withMemo } from '../../../helper/withMemo';
|
|
3
|
+
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
|
+
import { InlineBlock } from '../InlineBlock';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
7
|
+
import styles from './grid.scss';
|
|
8
|
+
|
|
9
|
+
export type GridItemProps = RbmComponentProps<{
|
|
10
|
+
size: number;
|
|
11
|
+
sm?: number;
|
|
12
|
+
md?: number;
|
|
13
|
+
lg?: number;
|
|
14
|
+
xl?: number;
|
|
15
|
+
xxl?: number;
|
|
16
|
+
startXs?: number;
|
|
17
|
+
startSm?: number;
|
|
18
|
+
startMd?: number;
|
|
19
|
+
startLg?: number;
|
|
20
|
+
startXl?: number;
|
|
21
|
+
startXxl?: number;
|
|
22
|
+
orderXs?: number;
|
|
23
|
+
orderSm?: number;
|
|
24
|
+
orderMd?: number;
|
|
25
|
+
orderLg?: number;
|
|
26
|
+
orderXl?: number;
|
|
27
|
+
orderXxl?: number;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
function GridItem({
|
|
31
|
+
style,
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
__allowChildren,
|
|
35
|
+
size,
|
|
36
|
+
sm,
|
|
37
|
+
md,
|
|
38
|
+
lg,
|
|
39
|
+
xl,
|
|
40
|
+
xxl,
|
|
41
|
+
startXs,
|
|
42
|
+
startMd,
|
|
43
|
+
startSm,
|
|
44
|
+
startLg,
|
|
45
|
+
startXl,
|
|
46
|
+
startXxl,
|
|
47
|
+
orderXs,
|
|
48
|
+
orderSm,
|
|
49
|
+
orderMd,
|
|
50
|
+
orderLg,
|
|
51
|
+
orderXxl,
|
|
52
|
+
orderXl,
|
|
53
|
+
}: GridItemProps) {
|
|
54
|
+
// Variables
|
|
55
|
+
|
|
56
|
+
const classes = [`item-xs-${size}`];
|
|
57
|
+
if (sm) {
|
|
58
|
+
classes.push(`item-sm-${sm}`);
|
|
59
|
+
}
|
|
60
|
+
if (md) {
|
|
61
|
+
classes.push(`item-md-${md}`);
|
|
62
|
+
}
|
|
63
|
+
if (lg) {
|
|
64
|
+
classes.push(`item-lg-${lg}`);
|
|
65
|
+
}
|
|
66
|
+
if (xl) {
|
|
67
|
+
classes.push(`item-xl-${xl}`);
|
|
68
|
+
}
|
|
69
|
+
if (xxl) {
|
|
70
|
+
classes.push(`item-xxl-${xxl}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (startXs) {
|
|
74
|
+
classes.push(`start-xs-${startXs}`);
|
|
75
|
+
}
|
|
76
|
+
if (startSm) {
|
|
77
|
+
classes.push(`start-sm-${startSm}`);
|
|
78
|
+
}
|
|
79
|
+
if (startMd) {
|
|
80
|
+
classes.push(`start-md-${startMd}`);
|
|
81
|
+
}
|
|
82
|
+
if (startLg) {
|
|
83
|
+
classes.push(`start-lg-${startLg}`);
|
|
84
|
+
}
|
|
85
|
+
if (startXl) {
|
|
86
|
+
classes.push(`start-xl-${startXl}`);
|
|
87
|
+
}
|
|
88
|
+
if (startXxl) {
|
|
89
|
+
classes.push(`start-xxl-${startXxl}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (orderXs) {
|
|
93
|
+
classes.push(`order-xs-${orderXs}`);
|
|
94
|
+
}
|
|
95
|
+
if (orderSm) {
|
|
96
|
+
classes.push(`order-sm-${orderSm}`);
|
|
97
|
+
}
|
|
98
|
+
if (orderMd) {
|
|
99
|
+
classes.push(`order-md-${orderMd}`);
|
|
100
|
+
}
|
|
101
|
+
if (orderLg) {
|
|
102
|
+
classes.push(`order-lg-${orderLg}`);
|
|
103
|
+
}
|
|
104
|
+
if (orderXl) {
|
|
105
|
+
classes.push(`order-xl-${orderXl}`);
|
|
106
|
+
}
|
|
107
|
+
if (orderXxl) {
|
|
108
|
+
classes.push(`order-xxl-${orderXxl}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Refs
|
|
112
|
+
|
|
113
|
+
// States
|
|
114
|
+
|
|
115
|
+
// Selectors
|
|
116
|
+
|
|
117
|
+
// Callbacks
|
|
118
|
+
|
|
119
|
+
// Effects
|
|
120
|
+
|
|
121
|
+
// Other
|
|
122
|
+
|
|
123
|
+
// Render Functions
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<InlineBlock
|
|
127
|
+
style={style}
|
|
128
|
+
className={classNames(...classes.map((name) => styles[name]), styles.item, className)}
|
|
129
|
+
__allowChildren={__allowChildren as 'all'}
|
|
130
|
+
>
|
|
131
|
+
{children}
|
|
132
|
+
</InlineBlock>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Need GridItemMemo for autocompletion of phpstorm
|
|
137
|
+
const GridItemMemo = withMemo(GridItem, styles);
|
|
138
|
+
export { GridItemMemo as GridItem };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@import "../../../scss/variables";
|
|
2
|
+
@import "bootstrap/scss/mixins/breakpoints";
|
|
3
|
+
|
|
4
|
+
$columns: 12;
|
|
5
|
+
$breakpoints: $grid-breakpoints;
|
|
6
|
+
|
|
7
|
+
.grid {
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-rows: repeat(var(--grid-rows, 1), 1fr);
|
|
10
|
+
grid-template-columns: repeat(var(--grid-columns, $columns), 1fr);
|
|
11
|
+
gap: var(--grid-gap, 0);
|
|
12
|
+
|
|
13
|
+
.item {
|
|
14
|
+
padding: 4px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@each $breakpoint in map-keys($breakpoints) {
|
|
18
|
+
@include media-breakpoint-up($breakpoint, $breakpoints) {
|
|
19
|
+
@for $i from 1 through $columns {
|
|
20
|
+
.item-#{$breakpoint}-#{$i} {
|
|
21
|
+
grid-column: auto / span $i;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Start with `1` because `0` is and invalid value.
|
|
26
|
+
// Ends with `$columns - 1` because offsetting by the width of an entire row isn't possible.
|
|
27
|
+
@for $i from 1 through ($columns - 1) {
|
|
28
|
+
.start-#{$breakpoint}-#{$i} {
|
|
29
|
+
grid-column-start: $i;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Add classes for reordering
|
|
35
|
+
@include media-breakpoint-only($breakpoint, $breakpoints) {
|
|
36
|
+
@for $i from -10 through 10 {
|
|
37
|
+
.order-#{$breakpoint}-#{$i} {
|
|
38
|
+
order: $i;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
+
|
|
4
|
+
import styles from './layout.scss';
|
|
5
|
+
import { withMemo } from '../../helper/withMemo';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
|
|
8
|
+
export type GrowProps = RbmComponentProps<{
|
|
9
|
+
center?: boolean;
|
|
10
|
+
weight?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
function Grow({ className, children, center = false, style, weight = 1 }: GrowProps) {
|
|
14
|
+
// Variables
|
|
15
|
+
|
|
16
|
+
// States
|
|
17
|
+
|
|
18
|
+
// Refs
|
|
19
|
+
|
|
20
|
+
// Callbacks
|
|
21
|
+
|
|
22
|
+
// Effects
|
|
23
|
+
|
|
24
|
+
// Other
|
|
25
|
+
|
|
26
|
+
// Render Functions
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={classNames(
|
|
30
|
+
styles.grow,
|
|
31
|
+
{
|
|
32
|
+
[styles.center]: center,
|
|
33
|
+
[styles.weight0]: weight === 0,
|
|
34
|
+
[styles.weight1]: weight === 1,
|
|
35
|
+
[styles.weight2]: weight === 2,
|
|
36
|
+
[styles.weight3]: weight === 3,
|
|
37
|
+
[styles.weight4]: weight === 4,
|
|
38
|
+
[styles.weight5]: weight === 5,
|
|
39
|
+
[styles.weight6]: weight === 6,
|
|
40
|
+
},
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
style={style}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const tmp = withMemo(Grow, styles);
|
|
51
|
+
export { tmp as Grow };
|
|
@@ -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 { withForwardRef } from '../../helper/withForwardRef';
|
|
8
|
+
import { ComponentRef, ForwardedRef } from 'react';
|
|
9
|
+
|
|
10
|
+
export type InlineProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<
|
|
11
|
+
ViewWithoutListenersProps<AsType>
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
function Inline<AsType extends keyof JSX.IntrinsicElements = 'span'>(
|
|
15
|
+
{ children, as = 'span' as AsType, className, ...props }: InlineProps<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
|
+
className={classNames(styles.inline, className)}
|
|
37
|
+
as={as as AsType}
|
|
38
|
+
{...(props as ViewWithoutListenersProps<AsType>)}
|
|
39
|
+
ref={ref}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</ViewWithoutListeners>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Need InlineMemo for autocompletion of phpstorm
|
|
47
|
+
const InlineMemo = withForwardRef(Inline, styles);
|
|
48
|
+
export { InlineMemo as Inline };
|