@ainias42/react-bootstrap-mobile 0.1.31 → 0.1.32
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 +1 -1
- package/bootstrapReactMobile.ts +1 -0
- package/dist/bootstrapReactMobile.d.ts +1 -0
- package/dist/bootstrapReactMobile.js +1435 -1047
- package/dist/bootstrapReactMobile.js.map +1 -1
- package/dist/src/Components/DragAndDrop/DropArea.d.ts +1 -3
- package/dist/src/Components/Hooks/useClientLayoutEffect.d.ts +2 -0
- package/dist/src/Components/Hooks/useDelayed.d.ts +1 -1
- package/dist/src/Components/Layout/Block.d.ts +1 -1
- package/dist/src/Components/Layout/Flex.d.ts +1 -1
- package/dist/src/Components/Layout/Inline.d.ts +1 -1
- package/dist/src/Components/Layout/InlineBlock.d.ts +1 -1
- package/dist/src/Components/Layout/View.d.ts +2 -3
- package/dist/src/Components/Layout/ViewWithoutListeners.d.ts +2 -3
- package/package.json +64 -53
- package/src/Components/Card/Card.tsx +0 -1
- package/src/Components/Dialog/DialogContainer.tsx +0 -1
- package/src/Components/DragAndDrop/DropArea.tsx +2 -6
- package/src/Components/FormElements/Button/Button.tsx +1 -1
- package/src/Components/FormElements/ColorInput/ColorInput.tsx +3 -2
- package/src/Components/FormElements/Input/FileInput/FileInput.tsx +1 -1
- package/src/Components/FormElements/Input/FileInput/MultipleFileInput.tsx +1 -3
- package/src/Components/FormElements/Input/HiddenInput.tsx +0 -1
- package/src/Components/FormElements/Input/Input.tsx +30 -20
- package/src/Components/FormElements/Select/Select.tsx +1 -1
- package/src/Components/FullScreen/FullScreen.tsx +1 -1
- package/src/Components/Hooks/useClientLayoutEffect.ts +8 -0
- package/src/Components/Hooks/useDelayed.ts +1 -1
- package/src/Components/Hooks/useMousePosition.ts +3 -2
- package/src/Components/Layout/Grid/GridItem.tsx +0 -1
- package/src/Components/Layout/Grow.tsx +2 -4
- package/src/Components/Layout/View.tsx +6 -10
- package/src/Components/Layout/ViewWithoutListeners.tsx +5 -9
- package/src/Components/Menu/Menu.tsx +9 -9
- package/src/Components/RbmComponentProps.ts +0 -1
- package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +1 -3
- package/src/Components/Toast/Toast.tsx +0 -1
- package/src/helper/withRenderBrowserOnly.tsx +2 -2
- package/webpack.config.js +1 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentRef, ForwardedRef, PropsWithChildren
|
|
2
|
+
import { ComponentRef, ForwardedRef, PropsWithChildren } from 'react';
|
|
3
3
|
import { Override } from '../../TypeHelpers';
|
|
4
|
+
import { withMemo } from "../../helper/withMemo";
|
|
5
|
+
import { withForwardRef } from "../../helper/withForwardRef";
|
|
4
6
|
|
|
5
7
|
export type ViewProps<AsType extends keyof JSX.IntrinsicElements> = PropsWithChildren<
|
|
6
8
|
Override<React.ComponentPropsWithoutRef<AsType>, { as?: AsType; children?: React.ReactNode }>
|
|
7
9
|
>;
|
|
8
10
|
|
|
9
|
-
function View<AsType extends keyof JSX.IntrinsicElements>(
|
|
10
|
-
{
|
|
11
|
+
export const View = withForwardRef(function View<AsType extends keyof JSX.IntrinsicElements>(
|
|
12
|
+
{children, as, ...otherProps}: ViewProps<AsType>,
|
|
11
13
|
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
12
14
|
) {
|
|
13
15
|
// Variables
|
|
@@ -31,10 +33,4 @@ function View<AsType extends keyof JSX.IntrinsicElements>(
|
|
|
31
33
|
ref,
|
|
32
34
|
};
|
|
33
35
|
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
|
-
) => ReactNode | null = React.memo(React.forwardRef(View));
|
|
40
|
-
export { ViewMemo as View };
|
|
36
|
+
}, undefined, "all");
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentRef, DOMAttributes, ForwardedRef
|
|
2
|
+
import { ComponentRef, DOMAttributes, ForwardedRef } from 'react';
|
|
3
3
|
import { View, ViewProps } from './View';
|
|
4
|
+
import { withMemo } from "../../helper/withMemo";
|
|
5
|
+
import { withForwardRef } from "../../helper/withForwardRef";
|
|
4
6
|
|
|
5
7
|
export type ViewWithoutListenersProps<AsType extends keyof JSX.IntrinsicElements> = Omit<
|
|
6
8
|
ViewProps<AsType>,
|
|
@@ -11,7 +13,7 @@ export type ViewWithoutListenersProps<AsType extends keyof JSX.IntrinsicElements
|
|
|
11
13
|
__html: string | TrustedHTML;
|
|
12
14
|
} | undefined; };
|
|
13
15
|
|
|
14
|
-
function ViewWithoutListeners<AsType extends keyof JSX.IntrinsicElements>(
|
|
16
|
+
export const ViewWithoutListeners = withForwardRef(function ViewWithoutListeners<AsType extends keyof JSX.IntrinsicElements>(
|
|
15
17
|
{ children, ...props }: ViewWithoutListenersProps<AsType>,
|
|
16
18
|
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
17
19
|
) {
|
|
@@ -35,10 +37,4 @@ function ViewWithoutListeners<AsType extends keyof JSX.IntrinsicElements>(
|
|
|
35
37
|
{children}
|
|
36
38
|
</View>
|
|
37
39
|
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Need ViewWithoutListenersMemo for autocompletion of phpstorm
|
|
41
|
-
const ViewWithoutListenersMemo: <AsType extends keyof JSX.IntrinsicElements>(
|
|
42
|
-
props: ViewWithoutListenersProps<AsType> & RefAttributes<ComponentRef<AsType>>
|
|
43
|
-
) => ReactNode = React.memo(React.forwardRef(ViewWithoutListeners));
|
|
44
|
-
export { ViewWithoutListenersMemo as ViewWithoutListeners };
|
|
40
|
+
}, undefined, "all");
|
|
@@ -5,12 +5,13 @@ import {IconSource} from '../Icon/Icon';
|
|
|
5
5
|
import {Block} from '../Layout/Block';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import styles from './menu.scss';
|
|
8
|
-
import {useEffect,
|
|
8
|
+
import {useEffect, useRef, useState} from 'react';
|
|
9
9
|
import {withRenderBrowserOnly} from '../../helper/withRenderBrowserOnly';
|
|
10
10
|
import {useWindow} from '../../WindowContext/WindowContext';
|
|
11
11
|
import {MenuItem} from "./MenuItem";
|
|
12
12
|
import {MenuCloseContextProvider} from "./MenuCloseContext";
|
|
13
13
|
import {createPortal} from "react-dom";
|
|
14
|
+
import { useClientLayoutEffect } from "../Hooks/useClientLayoutEffect";
|
|
14
15
|
|
|
15
16
|
export type MenuItemType = {
|
|
16
17
|
label: string;
|
|
@@ -78,26 +79,25 @@ export const Menu = withMemo(
|
|
|
78
79
|
window?.addEventListener('mousedown', listener, {capture: true});
|
|
79
80
|
window?.addEventListener('touchstart', listener, {capture: true});
|
|
80
81
|
return () => {
|
|
81
|
-
window?.removeEventListener('mousedown', listener, {capture: true})
|
|
82
|
-
window?.removeEventListener('touchstart', listener, {capture: true})
|
|
82
|
+
window?.removeEventListener('mousedown', listener, {capture: true});
|
|
83
|
+
window?.removeEventListener('touchstart', listener, {capture: true});
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
return undefined;
|
|
86
87
|
}, [isOpen, onClose, window]);
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
useClientLayoutEffect(() => {
|
|
89
90
|
if (!isOpen) {
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
92
|
-
let elem = window?.document.body.querySelector(
|
|
93
|
+
let elem = window?.document.body.querySelector(`.${ MENU_CONTAINER_CLASS}`);
|
|
93
94
|
if (!elem) {
|
|
94
95
|
elem = window?.document.body;
|
|
95
96
|
}
|
|
96
|
-
elem?.appendChild(portalContainer)
|
|
97
|
+
elem?.appendChild(portalContainer);
|
|
97
98
|
}, [isOpen, portalContainer, window?.document.body]);
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
useLayoutEffect(() => {
|
|
100
|
+
useClientLayoutEffect(() => {
|
|
101
101
|
if (!menuRef.current) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
@@ -114,7 +114,7 @@ export const Menu = withMemo(
|
|
|
114
114
|
setInnerX(newX);
|
|
115
115
|
}, [offsetX, window?.innerWidth, x]);
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
useClientLayoutEffect(() => {
|
|
118
118
|
if (!menuRef.current) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { Recursive } from '../TypeHelpers';
|
|
3
|
-
import { URecord } from "@ainias42/js-helper";
|
|
4
3
|
|
|
5
4
|
export type RbmChildWithoutString = Recursive<JSX.Element | undefined | null | RbmChildWithoutString[]> | false;
|
|
6
5
|
export type WithNoStringProps =
|
|
@@ -7,13 +7,11 @@ import { Grow } from '../../Layout/Grow';
|
|
|
7
7
|
import { Text, TEXT_SIZE } from '../../Text/Text';
|
|
8
8
|
import { Block } from '../../Layout/Block';
|
|
9
9
|
import { Clickable } from '../../Clickable/Clickable';
|
|
10
|
-
|
|
11
10
|
import styles from './spoiler.scss';
|
|
12
11
|
import classNames from 'classnames';
|
|
13
12
|
import { OptionalListener, useListener } from '../../Hooks/useListener';
|
|
14
13
|
import { Icon, IconSource } from '../../Icon/Icon';
|
|
15
14
|
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
16
|
-
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
17
15
|
|
|
18
16
|
export type SpoilerProps<OnClickData> = RbmComponentProps<
|
|
19
17
|
{
|
|
@@ -89,7 +87,7 @@ function Spoiler<OnClickData>({
|
|
|
89
87
|
style={style}
|
|
90
88
|
>
|
|
91
89
|
<Flex horizontal={true}>
|
|
92
|
-
<Grow __allowChildren=
|
|
90
|
+
<Grow __allowChildren="all">{titleComponent}</Grow>
|
|
93
91
|
{icon ? <Icon icon={icon} className={styles.icon} /> : null}
|
|
94
92
|
</Flex>
|
|
95
93
|
<Block className={styles.bodyContainer}>
|
|
@@ -6,7 +6,7 @@ export function withRenderBrowserOnly<C extends ComponentType<any>>(Component: C
|
|
|
6
6
|
|
|
7
7
|
const displayName = `WithRenderBrowserOnly(${Component.displayName || Component.name})`;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function HocComponent({ children, ...props }: Props, ref?: ForwardedRef<RefType>) {
|
|
10
10
|
const [isBrowser, setIsBrowser] = useState(false);
|
|
11
11
|
|
|
12
12
|
useEffect(() => setIsBrowser(true), []);
|
|
@@ -24,7 +24,7 @@ export function withRenderBrowserOnly<C extends ComponentType<any>>(Component: C
|
|
|
24
24
|
// @ts-ignore
|
|
25
25
|
<Component {...(newProps as Props)}>{children}</Component>
|
|
26
26
|
);
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
HocComponent.displayName = displayName;
|
|
29
29
|
return HocComponent as C;
|
|
30
30
|
}
|