@ainias42/react-bootstrap-mobile 0.2.16 → 1.0.1
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/bootstrapReactMobile.ts +0 -1
- package/dist/bootstrapReactMobile.d.ts +0 -1
- package/dist/bootstrapReactMobile.js +3217 -3269
- package/dist/bootstrapReactMobile.js.map +1 -1
- package/dist/src/Components/ActionSheet/ActionSheet.d.ts +8 -6
- package/dist/src/Components/Clickable/Clickable.d.ts +5 -3
- package/dist/src/Components/Dialog/DialogContainer.d.ts +4 -2
- package/dist/src/Components/FormElements/Controller/ColorInputController.d.ts +5 -3
- package/dist/src/Components/FormElements/Controller/InputController.d.ts +5 -4
- package/dist/src/Components/FormElements/Controller/MultipleFileInputController.d.ts +5 -3
- package/dist/src/Components/FormElements/Controller/PasswordInputController.d.ts +5 -4
- package/dist/src/Components/FormElements/Controller/SelectController.d.ts +5 -3
- package/dist/src/Components/FormElements/Controller/SendFormContext.d.ts +0 -1
- package/dist/src/Components/FormElements/Controller/SwitchController.d.ts +5 -3
- package/dist/src/Components/FormElements/Controller/TextareaController.d.ts +5 -4
- package/dist/src/Components/FormElements/Controller/withHookController.d.ts +7 -4
- package/dist/src/Components/FormElements/Input/Input.d.ts +4 -2
- package/dist/src/Components/FormElements/Input/PasswordInput/PasswordInput.d.ts +3 -1
- package/dist/src/Components/FormElements/Textarea/Textarea.d.ts +5 -3
- package/dist/src/Components/FormElements/hooks/useOnChangeDone.d.ts +1 -1
- package/dist/src/Components/FullScreen/FullScreen.d.ts +3 -1
- package/dist/src/Components/Hooks/useMousePosition.d.ts +1 -2
- package/dist/src/Components/Layout/Block.d.ts +8 -5
- package/dist/src/Components/Layout/Flex.d.ts +5 -5
- package/dist/src/Components/Layout/Grid/Grid.d.ts +4 -2
- package/dist/src/Components/Layout/Grow.d.ts +4 -1
- package/dist/src/Components/Layout/Inline.d.ts +5 -5
- package/dist/src/Components/Layout/InlineBlock.d.ts +5 -5
- package/dist/src/Components/Layout/View.d.ts +8 -3
- package/dist/src/Components/Layout/ViewWithoutListeners.d.ts +4 -2
- package/dist/src/Components/List/List.d.ts +4 -2
- package/dist/src/Components/RbmComponentProps.d.ts +1 -0
- package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +2 -2
- package/dist/src/Components/Text/Text.d.ts +3 -1
- package/dist/src/Components/Toast/ToastContext.d.ts +3 -4
- package/dist/src/helper/withRestrictedChildren.d.ts +2 -2
- package/package.json +43 -43
- package/src/Components/ActionSheet/ActionSheet.tsx +12 -15
- package/src/Components/Clickable/Clickable.tsx +5 -8
- package/src/Components/Dialog/DialogContainer.tsx +7 -5
- package/src/Components/FormElements/Controller/withHookController.tsx +12 -8
- package/src/Components/FormElements/Input/Input.tsx +5 -5
- package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +4 -5
- package/src/Components/FormElements/Textarea/Textarea.tsx +18 -17
- package/src/Components/FullScreen/FullScreen.tsx +7 -7
- package/src/Components/Hooks/useDelayed.ts +2 -1
- package/src/Components/Hooks/useOnMount.ts +1 -1
- package/src/Components/Hooks/useRerender.ts +1 -1
- package/src/Components/Layout/Block.tsx +10 -12
- package/src/Components/Layout/Flex.tsx +7 -11
- package/src/Components/Layout/Grid/Grid.tsx +4 -7
- package/src/Components/Layout/Grow.tsx +3 -2
- package/src/Components/Layout/Inline.tsx +6 -12
- package/src/Components/Layout/InlineBlock.tsx +6 -12
- package/src/Components/Layout/View.tsx +7 -6
- package/src/Components/Layout/ViewWithoutListeners.tsx +8 -7
- package/src/Components/List/List.tsx +5 -3
- package/src/Components/RbmComponentProps.ts +1 -0
- package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +2 -2
- package/src/Components/Text/Text.tsx +3 -1
- package/webpack.config.js +3 -2
- package/dist/src/helper/withForwardRef.d.ts +0 -7
- package/src/helper/withForwardRef.ts +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainias42/react-bootstrap-mobile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Mobile React Components using Bootstrap",
|
|
5
5
|
"main": "dist/bootstrapReactMobile",
|
|
6
6
|
"scripts": {
|
|
@@ -37,71 +37,71 @@
|
|
|
37
37
|
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
|
38
38
|
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
39
39
|
"bootstrap": "^5.3.3",
|
|
40
|
-
"react": "
|
|
40
|
+
"react": "^19.1.1",
|
|
41
41
|
"react-beautiful-dnd": "^13.1.1",
|
|
42
|
-
"react-hook-form": "^7.
|
|
42
|
+
"react-hook-form": "^7.62.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@babel/core": "^7.
|
|
45
|
+
"@babel/core": "^7.28.3",
|
|
46
46
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
47
|
-
"@babel/plugin-transform-typescript": "^7.
|
|
48
|
-
"@babel/preset-env": "^7.
|
|
49
|
-
"@babel/preset-react": "^7.
|
|
50
|
-
"@babel/preset-typescript": "^7.
|
|
47
|
+
"@babel/plugin-transform-typescript": "^7.28.0",
|
|
48
|
+
"@babel/preset-env": "^7.28.3",
|
|
49
|
+
"@babel/preset-react": "^7.27.1",
|
|
50
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
51
51
|
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
|
52
52
|
"@fortawesome/free-regular-svg-icons": "^6.5.2",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
55
|
-
"@types/react": "
|
|
55
|
+
"@types/react": "^19.1.11",
|
|
56
56
|
"@types/react-beautiful-dnd": "^13.1.8",
|
|
57
|
-
"@types/react-dom": "
|
|
57
|
+
"@types/react-dom": "^19.1.7",
|
|
58
58
|
"@types/react-table": "^7.7.20",
|
|
59
59
|
"@types/react-window": "^1.8.8",
|
|
60
60
|
"@types/react-window-infinite-loader": "^1.0.9",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
62
|
-
"@typescript-eslint/parser": "^7.
|
|
63
|
-
"ajv": "^8.
|
|
64
|
-
"babel-loader": "^
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
62
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
63
|
+
"ajv": "^8.17.1",
|
|
64
|
+
"babel-loader": "^10.0.0",
|
|
65
65
|
"bootstrap": "^5.3.3",
|
|
66
|
-
"css-layering-webpack-plugin": "^0.
|
|
66
|
+
"css-layering-webpack-plugin": "^0.4.0",
|
|
67
67
|
"css-loader": "^7.1.2",
|
|
68
68
|
"eslint": "^8.57.0",
|
|
69
69
|
"eslint-config-airbnb": "^19.0.4",
|
|
70
70
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
71
|
-
"eslint-config-prettier": "^
|
|
72
|
-
"eslint-import-resolver-typescript": "^
|
|
73
|
-
"eslint-plugin-import": "^2.
|
|
74
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
75
|
-
"eslint-plugin-react": "^7.
|
|
71
|
+
"eslint-config-prettier": "^10.1.8",
|
|
72
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
73
|
+
"eslint-plugin-import": "^2.32.0",
|
|
74
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
75
|
+
"eslint-plugin-react": "^7.37.5",
|
|
76
76
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
77
|
-
"html-webpack-plugin": "^5.6.
|
|
78
|
-
"loader-utils": "3.
|
|
79
|
-
"mini-css-extract-plugin": "^2.9.
|
|
80
|
-
"prettier": "^3.2
|
|
81
|
-
"react": "
|
|
77
|
+
"html-webpack-plugin": "^5.6.4",
|
|
78
|
+
"loader-utils": "^3.3.1",
|
|
79
|
+
"mini-css-extract-plugin": "^2.9.4",
|
|
80
|
+
"prettier": "^3.6.2",
|
|
81
|
+
"react": "^19.1.1",
|
|
82
82
|
"react-beautiful-dnd": "^13.1.1",
|
|
83
|
-
"react-dom": "
|
|
84
|
-
"react-hook-form": "^7.
|
|
85
|
-
"sass": "^1.
|
|
86
|
-
"sass-loader": "^
|
|
87
|
-
"terser-webpack-plugin": "^5.3.
|
|
88
|
-
"ts-loader": "^9.5.
|
|
89
|
-
"typescript": "^5.
|
|
90
|
-
"webpack": "^5.
|
|
91
|
-
"webpack-cli": "^
|
|
92
|
-
"webpack-dev-server": "^5.
|
|
83
|
+
"react-dom": "^19.1.1",
|
|
84
|
+
"react-hook-form": "^7.62.0",
|
|
85
|
+
"sass": "^1.90.0",
|
|
86
|
+
"sass-loader": "^16.0.5",
|
|
87
|
+
"terser-webpack-plugin": "^5.3.14",
|
|
88
|
+
"ts-loader": "^9.5.4",
|
|
89
|
+
"typescript": "^5.9.2",
|
|
90
|
+
"webpack": "^5.101.3",
|
|
91
|
+
"webpack-cli": "^6.0.1",
|
|
92
|
+
"webpack-dev-server": "^5.2.2"
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"@ainias42/js-helper": "
|
|
96
|
-
"@types/react-virtualized-auto-sizer": "
|
|
97
|
-
"@uiw/react-color": "^2.
|
|
95
|
+
"@ainias42/js-helper": "^0.8.17",
|
|
96
|
+
"@types/react-virtualized-auto-sizer": "1.0.4",
|
|
97
|
+
"@uiw/react-color": "^2.8.0",
|
|
98
98
|
"classnames": "^2.5.1",
|
|
99
|
-
"isomorphic-style-loader": "^5.
|
|
99
|
+
"isomorphic-style-loader": "^5.4.0",
|
|
100
100
|
"react-color": "^2.19.3",
|
|
101
101
|
"react-table": "^7.8.0",
|
|
102
|
-
"react-virtualized-auto-sizer": "^1.0.
|
|
103
|
-
"react-window": "^1.8.
|
|
104
|
-
"react-window-infinite-loader": "^1.0.
|
|
105
|
-
"yup": "^1.
|
|
102
|
+
"react-virtualized-auto-sizer": "^1.0.26",
|
|
103
|
+
"react-window": "^1.8.11",
|
|
104
|
+
"react-window-infinite-loader": "^1.0.10",
|
|
105
|
+
"yup": "^1.7.0"
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
-
import {
|
|
3
|
+
import { ForwardedRef, useCallback, useImperativeHandle, useState } from 'react';
|
|
4
4
|
import { Clickable } from '../Clickable/Clickable';
|
|
5
5
|
import { Container } from '../Layout/Container';
|
|
6
6
|
import { faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
7
7
|
import { Icon, IconSource } from '../Icon/Icon';
|
|
8
|
-
|
|
9
8
|
import styles from './actionSheet.scss';
|
|
10
|
-
import { withForwardRef } from '../../helper/withForwardRef';
|
|
11
9
|
import classNames from 'classnames';
|
|
12
10
|
import { InlineBlock } from '../Layout/InlineBlock';
|
|
13
11
|
import { Text } from '../Text/Text';
|
|
14
12
|
import { Flex } from '../Layout/Flex';
|
|
15
13
|
import { Block } from '../Layout/Block';
|
|
14
|
+
import { withMemo } from "../../helper/withMemo";
|
|
16
15
|
|
|
17
16
|
export type ActionSheetAction<ActionData> = {
|
|
18
17
|
name: string;
|
|
@@ -22,21 +21,22 @@ export type ActionSheetAction<ActionData> = {
|
|
|
22
21
|
isDeleteAction?: boolean;
|
|
23
22
|
};
|
|
24
23
|
|
|
24
|
+
export type ActionSheetHandle = {
|
|
25
|
+
show: () => void;
|
|
26
|
+
hide: () => void;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
25
30
|
export type ActionSheetProps = RbmComponentProps<{
|
|
26
31
|
title?: string;
|
|
27
32
|
actions: ActionSheetAction<any>[];
|
|
28
33
|
cancelText?: string;
|
|
29
34
|
onClose?: () => void;
|
|
35
|
+
ref?: ForwardedRef<ActionSheetHandle>
|
|
30
36
|
}>;
|
|
31
37
|
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
hide: () => void;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
function ActionSheet(
|
|
38
|
-
{ title, actions, cancelText = 'Cancel', className, onClose, style }: ActionSheetProps,
|
|
39
|
-
ref: Ref<ActionSheetHandle>
|
|
38
|
+
export const ActionSheet = withMemo(function ActionSheet(
|
|
39
|
+
{ title, actions, cancelText = 'Cancel', className, onClose, style, ref }: ActionSheetProps,
|
|
40
40
|
) {
|
|
41
41
|
const [isOpen, setIsOpen] = useState(false);
|
|
42
42
|
|
|
@@ -109,7 +109,4 @@ function ActionSheet(
|
|
|
109
109
|
</Container>
|
|
110
110
|
</Clickable>
|
|
111
111
|
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const ActionSheetMemo = withForwardRef<ActionSheetProps, ActionSheetHandle>(ActionSheet, styles);
|
|
115
|
-
export { ActionSheetMemo as ActionSheet };
|
|
112
|
+
}, styles);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {RbmComponentProps} from '../RbmComponentProps';
|
|
3
3
|
import {OptionalListener, useListener} from '../Hooks/useListener';
|
|
4
|
-
|
|
5
4
|
import styles from './clickable.scss';
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import {
|
|
@@ -13,8 +12,8 @@ import {
|
|
|
13
12
|
PointerEvent,
|
|
14
13
|
useRef
|
|
15
14
|
} from 'react';
|
|
16
|
-
import {withForwardRef} from '../../helper/withForwardRef';
|
|
17
15
|
import {useComposedRef} from "../Hooks/useComposedRef";
|
|
16
|
+
import { withMemo } from "../../helper/withMemo";
|
|
18
17
|
|
|
19
18
|
type OnClickListener<Data> = OptionalListener<'onClick', Data>;
|
|
20
19
|
type OnPointerDownListener<Data> = OptionalListener<'onPointerDown', Data, PointerEvent>;
|
|
@@ -49,6 +48,7 @@ export type ClickableProps<
|
|
|
49
48
|
tabIndex?: number;
|
|
50
49
|
draggable?: boolean
|
|
51
50
|
title?: string;
|
|
51
|
+
ref?: ForwardedRef<HrefType extends string ? HTMLAnchorElement : HTMLSpanElement>
|
|
52
52
|
} & OnClickListener<OnClickData> &
|
|
53
53
|
OnPointerDownListener<OnMouseDownData> &
|
|
54
54
|
OnPointerMoveListener<OnMouseMoveData> &
|
|
@@ -62,7 +62,7 @@ export type ClickableProps<
|
|
|
62
62
|
OptionalListener<'onDoubleClick', OnDoubleClickData>
|
|
63
63
|
>;
|
|
64
64
|
|
|
65
|
-
function Clickable<
|
|
65
|
+
export const Clickable = withMemo(function Clickable<
|
|
66
66
|
OnClickData,
|
|
67
67
|
OnPointerDownData,
|
|
68
68
|
OnPointerMoveData,
|
|
@@ -90,9 +90,9 @@ function Clickable<
|
|
|
90
90
|
tabIndex,
|
|
91
91
|
draggable,
|
|
92
92
|
title,
|
|
93
|
+
ref,
|
|
93
94
|
...clickData
|
|
94
95
|
}: ClickableProps<OnClickData, OnPointerDownData, OnPointerMoveData, OnPointerUpData, OnClickCaptureData, OnDropData,OnDragStartData, OnDragOverData,OnMouseEnterData, OnMouseLeaveData, OnDoubleClickData, HrefType>,
|
|
95
|
-
ref: ForwardedRef<HrefType extends string ? HTMLAnchorElement : HTMLSpanElement>
|
|
96
96
|
) {
|
|
97
97
|
// Variables
|
|
98
98
|
|
|
@@ -328,7 +328,4 @@ function Clickable<
|
|
|
328
328
|
{children}
|
|
329
329
|
</span>
|
|
330
330
|
);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const ClickableMemo = withForwardRef(Clickable, styles);
|
|
334
|
-
export {ClickableMemo as Clickable};
|
|
331
|
+
}, styles);
|
|
@@ -3,11 +3,12 @@ import { ComponentType, ForwardedRef, PropsWithChildren, useCallback, useImperat
|
|
|
3
3
|
import { PromiseWithHandlers } from '@ainias42/js-helper';
|
|
4
4
|
import { DialogProvider, ShowDialog } from './DialogContext';
|
|
5
5
|
import { Dialog } from './Dialog';
|
|
6
|
-
import { withForwardRef } from "../../helper/withForwardRef";
|
|
7
6
|
import { Block } from "../Layout/Block";
|
|
7
|
+
import { withMemo } from "../../helper/withMemo";
|
|
8
8
|
|
|
9
9
|
export type DialogContainerProps = PropsWithChildren<{
|
|
10
10
|
dialogClassName?: string
|
|
11
|
+
ref?: ForwardedRef<DialogContainerRef>
|
|
11
12
|
}>;
|
|
12
13
|
|
|
13
14
|
type DialogData = {
|
|
@@ -21,10 +22,11 @@ export type DialogContainerRef = {
|
|
|
21
22
|
showDialog: ShowDialog;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export const DialogContainer =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
export const DialogContainer = withMemo(function DialogContainer({
|
|
26
|
+
children,
|
|
27
|
+
dialogClassName,
|
|
28
|
+
ref
|
|
29
|
+
}: DialogContainerProps) {
|
|
28
30
|
// Variables
|
|
29
31
|
const [dialogs, setDialogs] = useState<DialogData[]>([]);
|
|
30
32
|
const [, setLastId] = useState(0);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentProps,
|
|
3
|
+
ComponentRef,
|
|
4
|
+
ComponentType, ForwardedRef,
|
|
5
|
+
useCallback
|
|
6
|
+
} from "react";
|
|
2
7
|
import { FieldPath, FieldValues, useController, useFormContext } from "react-hook-form";
|
|
3
8
|
import { useComposedRef } from "../../Hooks/useComposedRef";
|
|
4
|
-
import {
|
|
9
|
+
import { withMemo } from "../../../helper/withMemo";
|
|
5
10
|
|
|
6
11
|
export function withHookController<C extends ComponentType<any>, OnChangeProp extends keyof ComponentProps<C>>(Comp: C, onChangeProp: OnChangeProp, emptyValue: any = null) {
|
|
7
12
|
type RefType = ComponentRef<C>;
|
|
@@ -9,12 +14,11 @@ export function withHookController<C extends ComponentType<any>, OnChangeProp ex
|
|
|
9
14
|
|
|
10
15
|
type Props<Values extends FieldValues, Name extends FieldPath<Values> = FieldPath<Values>> = Omit<
|
|
11
16
|
OldProps,
|
|
12
|
-
'name' | 'onBlur' | OnChangeProp | '
|
|
17
|
+
'name' | 'onBlur' | OnChangeProp | 'value'
|
|
13
18
|
> & { name: Name };
|
|
14
19
|
|
|
15
20
|
function WithHookComponent<Values extends FieldValues, Name extends FieldPath<Values> = FieldPath<Values>>(
|
|
16
|
-
{name, ...otherProps}: Props<Values, Name
|
|
17
|
-
ref?: ForwardedRef<RefType>
|
|
21
|
+
{name, ref, ...otherProps}: Props<Values, Name> & {ref?: ForwardedRef<RefType>},
|
|
18
22
|
) {
|
|
19
23
|
const children = "children" in otherProps ? otherProps.children : undefined;
|
|
20
24
|
|
|
@@ -25,8 +29,8 @@ export function withHookController<C extends ComponentType<any>, OnChangeProp ex
|
|
|
25
29
|
|
|
26
30
|
const internalOnChange = useCallback(
|
|
27
31
|
(arg: any) => {
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
clearErrors(name);
|
|
33
|
+
field.onChange(arg);
|
|
30
34
|
},
|
|
31
35
|
[clearErrors, field, name]
|
|
32
36
|
);
|
|
@@ -52,5 +56,5 @@ export function withHookController<C extends ComponentType<any>, OnChangeProp ex
|
|
|
52
56
|
);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
return
|
|
59
|
+
return withMemo(WithHookComponent);
|
|
56
60
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
ChangeEvent,
|
|
3
|
+
ChangeEvent, ForwardedRef,
|
|
4
4
|
InputHTMLAttributes,
|
|
5
5
|
KeyboardEvent,
|
|
6
|
-
MutableRefObject,
|
|
7
6
|
useCallback, useEffect,
|
|
8
7
|
useMemo, useRef,
|
|
9
8
|
} from 'react';
|
|
10
9
|
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
11
10
|
import { Override } from '../../../TypeHelpers';
|
|
12
11
|
import { OptionalListener, useListenerWithExtractedProps } from '../../Hooks/useListener';
|
|
13
|
-
import { withForwardRef } from '../../../helper/withForwardRef';
|
|
14
12
|
import styles from './input.scss';
|
|
15
13
|
import classNames from 'classnames';
|
|
16
14
|
import { useComposedRef } from '../../Hooks/useComposedRef';
|
|
@@ -18,6 +16,7 @@ import { useOnChangeDone } from '../hooks/useOnChangeDone';
|
|
|
18
16
|
import { useSendFormContext } from "../Controller/SendFormContext";
|
|
19
17
|
import { useDebounced } from "../../Hooks/useDebounced";
|
|
20
18
|
import { FormError } from "../FormError";
|
|
19
|
+
import { withMemo } from "../../../helper/withMemo";
|
|
21
20
|
|
|
22
21
|
export type InputProps<OnChangeData, OnBlurData, OnChangeDoneData> = RbmComponentProps<
|
|
23
22
|
Override<
|
|
@@ -28,13 +27,14 @@ export type InputProps<OnChangeData, OnBlurData, OnChangeDoneData> = RbmComponen
|
|
|
28
27
|
onChangeText?: (newText: string) => void;
|
|
29
28
|
onEnter?: (newText: string) => void;
|
|
30
29
|
error?: string,
|
|
30
|
+
ref?: ForwardedRef<HTMLInputElement>
|
|
31
31
|
} & OptionalListener<'onChange', OnChangeData> &
|
|
32
32
|
OptionalListener<'onBlur', OnBlurData> &
|
|
33
33
|
OptionalListener<'onChangeDone', OnChangeDoneData>
|
|
34
34
|
>
|
|
35
35
|
>;
|
|
36
36
|
|
|
37
|
-
export const Input =
|
|
37
|
+
export const Input = withMemo(function Input<OnChangeData, OnBlurData, OnChangeDoneData>(
|
|
38
38
|
{
|
|
39
39
|
label,
|
|
40
40
|
className,
|
|
@@ -45,9 +45,9 @@ export const Input = withForwardRef(function Input<OnChangeData, OnBlurData, OnC
|
|
|
45
45
|
error,
|
|
46
46
|
onChangeText,
|
|
47
47
|
onEnter,
|
|
48
|
+
ref,
|
|
48
49
|
...otherProps
|
|
49
50
|
}: InputProps<OnChangeData, OnBlurData, OnChangeDoneData>,
|
|
50
|
-
ref: MutableRefObject<HTMLInputElement> | null
|
|
51
51
|
) {
|
|
52
52
|
// Variables
|
|
53
53
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React, { ForwardedRef, useCallback, useState } from 'react';
|
|
2
2
|
import { Input, InputProps } from '../Input';
|
|
3
3
|
import { DistributiveOmit } from '../../../../helper/DistributiveOmit';
|
|
4
|
-
import { withForwardRef } from '../../../../helper/withForwardRef';
|
|
5
4
|
import { Flex } from '../../../Layout/Flex';
|
|
6
5
|
import { Grow } from '../../../Layout/Grow';
|
|
7
6
|
import { Icon } from '../../../Icon/Icon';
|
|
8
7
|
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
|
9
8
|
import { Clickable } from '../../../Clickable/Clickable';
|
|
10
|
-
|
|
11
9
|
import styles from './passwordInput.scss';
|
|
12
10
|
import classNames from 'classnames';
|
|
11
|
+
import { withMemo } from "../../../../helper/withMemo";
|
|
13
12
|
|
|
14
13
|
export type PasswordInputProps<OnChangeData, OnBlurData, OnChangeEndData> = DistributiveOmit<
|
|
15
14
|
InputProps<OnChangeData, OnBlurData, OnChangeEndData>,
|
|
@@ -17,11 +16,11 @@ export type PasswordInputProps<OnChangeData, OnBlurData, OnChangeEndData> = Dist
|
|
|
17
16
|
> & {
|
|
18
17
|
onChangeText?: (newText: string) => void;
|
|
19
18
|
onEnter?: (newText: string) => void;
|
|
19
|
+
ref?: ForwardedRef<HTMLInputElement>
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const PasswordInput =
|
|
23
|
-
{ className, style,
|
|
24
|
-
ref: ForwardedRef<HTMLInputElement>
|
|
22
|
+
export const PasswordInput = withMemo(function PasswordInput<OnChangeData, OnBlurData, OnChangeEndData>(
|
|
23
|
+
{ className, style, ref,...props }: PasswordInputProps<OnChangeData, OnBlurData, OnChangeEndData>,
|
|
25
24
|
) {
|
|
26
25
|
// Variables
|
|
27
26
|
const [isVisible, setIsVisible] = useState(false);
|
|
@@ -6,17 +6,16 @@ import {
|
|
|
6
6
|
useCallback,
|
|
7
7
|
KeyboardEvent,
|
|
8
8
|
ChangeEvent,
|
|
9
|
-
|
|
10
|
-
CSSProperties, useRef
|
|
9
|
+
CSSProperties, useRef, ForwardedRef
|
|
11
10
|
} from 'react';
|
|
12
11
|
import { OptionalListener, useListenerWithExtractedProps } from '../../Hooks/useListener';
|
|
13
12
|
import styles from './textarea.scss';
|
|
14
13
|
import classNames from 'classnames';
|
|
15
|
-
import { withForwardRef } from "../../../helper/withForwardRef";
|
|
16
14
|
import { useOnChangeDone } from "../hooks/useOnChangeDone";
|
|
17
15
|
import { useComposedRef } from "../../Hooks/useComposedRef";
|
|
18
16
|
import { InlineBlock } from "../../Layout/InlineBlock";
|
|
19
17
|
import { Text } from "../../Text/Text";
|
|
18
|
+
import { withMemo } from "../../../helper/withMemo";
|
|
20
19
|
|
|
21
20
|
export type TextareaProps<OnChangeData, OnChangeDoneData> = RbmComponentProps<
|
|
22
21
|
Override<
|
|
@@ -27,26 +26,28 @@ export type TextareaProps<OnChangeData, OnChangeDoneData> = RbmComponentProps<
|
|
|
27
26
|
onEnter?: (newText: string) => void;
|
|
28
27
|
onEscape?: (newText: string) => void;
|
|
29
28
|
textareaStyles?: CSSProperties & Record<`--${string}`, string | number | undefined>,
|
|
30
|
-
containerRef?:
|
|
29
|
+
containerRef?: ForwardedRef<HTMLLabelElement>
|
|
30
|
+
ref?: ForwardedRef<HTMLTextAreaElement>
|
|
31
31
|
error?: string,
|
|
32
32
|
} & OptionalListener<'onChange', OnChangeData>
|
|
33
33
|
& OptionalListener<'onChangeDone', OnChangeDoneData>
|
|
34
34
|
>
|
|
35
35
|
>;
|
|
36
36
|
|
|
37
|
-
export const Textarea =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
export const Textarea = withMemo(function Textarea<OnChangeData, OnChangeDoneData>({
|
|
38
|
+
label,
|
|
39
|
+
className,
|
|
40
|
+
style,
|
|
41
|
+
onKeyUp,
|
|
42
|
+
onChangeText,
|
|
43
|
+
onEnter,
|
|
44
|
+
onEscape,
|
|
45
|
+
textareaStyles,
|
|
46
|
+
containerRef,
|
|
47
|
+
ref,
|
|
48
|
+
error,
|
|
49
|
+
...otherProps
|
|
50
|
+
}: TextareaProps<OnChangeData, OnChangeDoneData>) {
|
|
50
51
|
// Refs
|
|
51
52
|
const innerRef = useRef<HTMLTextAreaElement>(null);
|
|
52
53
|
const refSetter = useComposedRef(ref, innerRef);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentPropsWithoutRef,
|
|
2
|
+
import { ComponentPropsWithoutRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { Override } from '../../TypeHelpers';
|
|
4
4
|
import { withMemo } from '../../helper/withMemo';
|
|
5
5
|
import { useWindow } from '../../WindowContext/WindowContext';
|
|
6
6
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
7
|
+
import { JSX } from "react/jsx-runtime";
|
|
8
|
+
import IntrinsicElements = JSX.IntrinsicElements;
|
|
7
9
|
|
|
8
|
-
export type FullScreenProps<AsType extends keyof
|
|
10
|
+
export type FullScreenProps<AsType extends keyof IntrinsicElements> = RbmComponentProps<
|
|
9
11
|
Override<
|
|
10
12
|
ComponentPropsWithoutRef<AsType>,
|
|
11
13
|
{ as?: AsType; fullscreenKey?: string; onEnterFullscreen?: () => void; onLeaveFullscreen?: () => void }
|
|
@@ -23,7 +25,7 @@ export const FullScreen = withMemo(function FullScreen<AsTag extends keyof JSX.I
|
|
|
23
25
|
// Variables
|
|
24
26
|
|
|
25
27
|
// Refs
|
|
26
|
-
const containerRef = useRef<
|
|
28
|
+
const containerRef = useRef<HTMLElement>(null);
|
|
27
29
|
const window = useWindow();
|
|
28
30
|
|
|
29
31
|
// States
|
|
@@ -39,16 +41,14 @@ export const FullScreen = withMemo(function FullScreen<AsTag extends keyof JSX.I
|
|
|
39
41
|
if ('exitFullscreen' in document) {
|
|
40
42
|
document.exitFullscreen();
|
|
41
43
|
} else {
|
|
42
|
-
//
|
|
43
|
-
// @ts-ignore
|
|
44
|
+
// @ts-expect-error this is not in the types but it exists
|
|
44
45
|
document.webkitCancelFullScreen();
|
|
45
46
|
}
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
if ('webkitRequestFullscreen' in document.body) {
|
|
50
|
-
//
|
|
51
|
-
// @ts-ignore
|
|
51
|
+
// @ts-expect-error this is not in the types but it exists
|
|
52
52
|
containerRef.current?.webkitRequestFullscreen();
|
|
53
53
|
} else {
|
|
54
54
|
containerRef.current?.requestFullscreen();
|
|
@@ -9,6 +9,8 @@ export function useDelayed<Args extends any[]>(
|
|
|
9
9
|
const argsRef = useRef<Args | undefined>(undefined);
|
|
10
10
|
const timeoutRef = useRef<any>(undefined);
|
|
11
11
|
const mayDelayTimeoutRef = useRef<any>(undefined);
|
|
12
|
+
const maxDelayTimeout = useRef<any>(undefined);
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
16
|
const realCB = useCallback(callback, dependencies);
|
|
@@ -40,7 +42,6 @@ export function useDelayed<Args extends any[]>(
|
|
|
40
42
|
},
|
|
41
43
|
[delay, maxDelay, realCB]
|
|
42
44
|
);
|
|
43
|
-
const maxDelayTimeout = useRef<any>();
|
|
44
45
|
|
|
45
46
|
return func;
|
|
46
47
|
}
|
|
@@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react';
|
|
|
3
3
|
export function useOnMount(cb: () => void | Promise<void> | (() => any)) {
|
|
4
4
|
const called = useRef(false);
|
|
5
5
|
const unmountTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
6
|
-
const unmountFunc = useRef<() => any | undefined>();
|
|
6
|
+
const unmountFunc = useRef<() => any | undefined>(undefined);
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
clearTimeout(unmountTimeout.current);
|
|
9
9
|
unmountTimeout.current = undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useRef, useState } from "react";
|
|
2
2
|
|
|
3
3
|
export function useRerender(defaultDelay = 0){
|
|
4
|
-
const timeoutRef = useRef<ReturnType<typeof setTimeout>|undefined>();
|
|
4
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout>|undefined>(undefined);
|
|
5
5
|
const [renderCounter, updateRenderCounter] = useState(0);
|
|
6
6
|
const update = useCallback((delay = defaultDelay) => {
|
|
7
7
|
if (delay === 0){
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
|
|
5
4
|
import styles from './layout.scss';
|
|
6
5
|
import { ComponentRef, ForwardedRef } from 'react';
|
|
7
|
-
import { withForwardRef } from '../../helper/withForwardRef';
|
|
8
6
|
import { ViewWithoutListeners, ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
7
|
+
import { withMemo } from "../../helper/withMemo";
|
|
8
|
+
import { JSX } from "react/jsx-runtime";
|
|
9
|
+
import IntrinsicElements = JSX.IntrinsicElements;
|
|
9
10
|
|
|
10
|
-
export type BlockProps<AsType extends keyof
|
|
11
|
-
ViewWithoutListenersProps<AsType>
|
|
11
|
+
export type BlockProps<AsType extends keyof IntrinsicElements> = RbmComponentProps<
|
|
12
|
+
ViewWithoutListenersProps<AsType> & {
|
|
13
|
+
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
14
|
+
}
|
|
12
15
|
>;
|
|
13
16
|
|
|
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
|
+
export const Block = withMemo(function Block<AsType extends keyof JSX.IntrinsicElements = 'div'>(
|
|
18
|
+
{ children, as = 'div' as AsType, className, ref, ...props }: BlockProps<AsType>,
|
|
17
19
|
) {
|
|
18
20
|
// Variables
|
|
19
21
|
|
|
@@ -41,8 +43,4 @@ function Block<AsType extends keyof JSX.IntrinsicElements = 'div'>(
|
|
|
41
43
|
{children}
|
|
42
44
|
</ViewWithoutListeners>
|
|
43
45
|
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Need BlockMemo for autocompletion of phpstorm
|
|
47
|
-
const BlockMemo = withForwardRef(Block, styles);
|
|
48
|
-
export { BlockMemo as Block };
|
|
46
|
+
}, styles);
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
3
|
-
|
|
4
3
|
import styles from './layout.scss';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
|
-
import { ComponentRef, ForwardedRef } from 'react';
|
|
7
|
-
import { withForwardRef } from '../../helper/withForwardRef';
|
|
8
5
|
import { ViewWithoutListeners, ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
6
|
+
import { withMemo } from "../../helper/withMemo";
|
|
7
|
+
import { JSX } from "react/jsx-runtime";
|
|
8
|
+
import IntrinsicElements = JSX.IntrinsicElements;
|
|
9
9
|
|
|
10
|
-
export type FlexProps<AsType extends keyof
|
|
10
|
+
export type FlexProps<AsType extends keyof IntrinsicElements> = RbmComponentProps<
|
|
11
11
|
ViewWithoutListenersProps<AsType> & {
|
|
12
12
|
horizontal?: boolean;
|
|
13
13
|
grow?: boolean;
|
|
14
14
|
}
|
|
15
15
|
>;
|
|
16
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>>
|
|
17
|
+
export const Flex = withMemo(function Flex<AsType extends keyof JSX.IntrinsicElements = 'div'>(
|
|
18
|
+
{ children, as = 'div' as AsType, className, horizontal = false, ref, grow = false, ...props }: FlexProps<AsType>
|
|
20
19
|
) {
|
|
21
20
|
// Variables
|
|
22
21
|
|
|
@@ -46,7 +45,4 @@ function Flex<AsType extends keyof JSX.IntrinsicElements = 'div'>(
|
|
|
46
45
|
{children}
|
|
47
46
|
</ViewWithoutListeners>
|
|
48
47
|
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const tmp = withForwardRef(Flex, styles);
|
|
52
|
-
export { tmp as Flex };
|
|
48
|
+
}, styles);
|