@ainias42/react-bootstrap-mobile 0.2.15 → 1.0.0
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 +194 -197
- 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 +4 -3
- 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 +7 -7
- 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 +5 -3
- package/src/Components/SpoilerList/Spoiler/spoiler.scss +2 -2
- package/src/Components/Text/Text.tsx +3 -1
- package/dist/src/helper/withForwardRef.d.ts +0 -7
- package/src/helper/withForwardRef.ts +0 -28
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentRef, ForwardedRef, PropsWithChildren } from 'react';
|
|
3
3
|
import { Override } from '../../TypeHelpers';
|
|
4
|
-
import {
|
|
4
|
+
import { JSX } from "react/jsx-runtime";
|
|
5
|
+
import IntrinsicElements = JSX.IntrinsicElements;
|
|
6
|
+
import { withMemo } from "../../helper/withMemo";
|
|
5
7
|
|
|
6
|
-
export type ViewProps<AsType extends keyof
|
|
7
|
-
Override<React.ComponentPropsWithoutRef<AsType>, { as?: AsType; children?: React.ReactNode }>
|
|
8
|
+
export type ViewProps<AsType extends keyof IntrinsicElements> = PropsWithChildren<
|
|
9
|
+
Override<React.ComponentPropsWithoutRef<AsType>, { as?: AsType; children?: React.ReactNode, ref?: ForwardedRef<ComponentRef<AsType>> }>
|
|
8
10
|
>;
|
|
9
11
|
|
|
10
|
-
export const View =
|
|
11
|
-
{children, as, ...otherProps}: ViewProps<AsType
|
|
12
|
-
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
12
|
+
export const View = withMemo(function View<AsType extends keyof JSX.IntrinsicElements>(
|
|
13
|
+
{children, as,ref, ...otherProps}: ViewProps<AsType>
|
|
13
14
|
) {
|
|
14
15
|
// Variables
|
|
15
16
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DOMAttributes, ForwardedRef } from 'react';
|
|
3
3
|
import { View, ViewProps } from './View';
|
|
4
|
-
import {
|
|
4
|
+
import { JSX } from "react/jsx-runtime";
|
|
5
|
+
import IntrinsicElements = JSX.IntrinsicElements;
|
|
6
|
+
import { withMemo } from "../../helper/withMemo";
|
|
5
7
|
|
|
6
|
-
export type ViewWithoutListenersProps<AsType extends keyof
|
|
8
|
+
export type ViewWithoutListenersProps<AsType extends keyof IntrinsicElements> = Omit<
|
|
7
9
|
ViewProps<AsType>,
|
|
8
10
|
keyof DOMAttributes<AsType>
|
|
9
11
|
> & { children?: React.ReactNode, dangerouslySetInnerHTML?: {
|
|
@@ -12,9 +14,8 @@ export type ViewWithoutListenersProps<AsType extends keyof JSX.IntrinsicElements
|
|
|
12
14
|
__html: string | TrustedHTML;
|
|
13
15
|
} | undefined; };
|
|
14
16
|
|
|
15
|
-
export const ViewWithoutListeners =
|
|
16
|
-
{ children, ...props }: ViewWithoutListenersProps<AsType>,
|
|
17
|
-
ref?: ForwardedRef<ComponentRef<AsType>>
|
|
17
|
+
export const ViewWithoutListeners = withMemo(function ViewWithoutListeners<AsType extends keyof JSX.IntrinsicElements>(
|
|
18
|
+
{ children,ref, ...props }: ViewWithoutListenersProps<AsType>,
|
|
18
19
|
) {
|
|
19
20
|
// Variables
|
|
20
21
|
|
|
@@ -32,7 +33,7 @@ export const ViewWithoutListeners = withForwardRef(function ViewWithoutListeners
|
|
|
32
33
|
|
|
33
34
|
// Render Functions
|
|
34
35
|
return (
|
|
35
|
-
<View {...props} ref={ref}>
|
|
36
|
+
<View {...props} ref={ref as ForwardedRef<SVGElement|HTMLElement>}>
|
|
36
37
|
{children}
|
|
37
38
|
</View>
|
|
38
39
|
);
|
|
@@ -5,7 +5,7 @@ import styles from './list.scss';
|
|
|
5
5
|
import { FixedSizeList, FixedSizeListProps, ListChildComponentProps } from 'react-window';
|
|
6
6
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
7
7
|
import { SizeCalculator, SizeCalculatorProps } from '../SizeCalculator/SizeCalculator';
|
|
8
|
-
import {
|
|
8
|
+
import { withMemo } from "../../helper/withMemo";
|
|
9
9
|
|
|
10
10
|
export type ListProps<ItemType> = RbmComponentProps<{
|
|
11
11
|
renderItem: (item: ItemType, style: CSSProperties, index: number) => ReactElement;
|
|
@@ -15,9 +15,10 @@ export type ListProps<ItemType> = RbmComponentProps<{
|
|
|
15
15
|
keyExtractor?: (item: ItemType, index: number) => string;
|
|
16
16
|
onItemsRendered?: FixedSizeListProps<ItemType>['onItemsRendered'];
|
|
17
17
|
autoSizeClassName?: string;
|
|
18
|
+
ref?: ForwardedRef<FixedSizeList<ItemType>>
|
|
18
19
|
}>;
|
|
19
20
|
|
|
20
|
-
export const List =
|
|
21
|
+
export const List = withMemo(function List<ItemType>({
|
|
21
22
|
items,
|
|
22
23
|
renderItem,
|
|
23
24
|
itemHeight: initialItemHeight = 0,
|
|
@@ -25,7 +26,8 @@ export const List = withForwardRef(function List<ItemType>({
|
|
|
25
26
|
style,
|
|
26
27
|
onItemsRendered,
|
|
27
28
|
autoSizeClassName,
|
|
28
|
-
|
|
29
|
+
ref,
|
|
30
|
+
}: ListProps<ItemType>) {
|
|
29
31
|
// Variables
|
|
30
32
|
|
|
31
33
|
// States
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { Recursive } from '../TypeHelpers';
|
|
3
|
+
import { JSX } from "react/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
export type RbmChildWithoutString = Recursive<JSX.Element | undefined | null | RbmChildWithoutString[]> | false;
|
|
5
6
|
export type WithNoStringProps =
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { withMemo } from '../../../helper/withMemo';
|
|
3
3
|
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
|
-
import { MouseEvent,
|
|
4
|
+
import { MouseEvent, ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { Flex } from '../../Layout/Flex';
|
|
6
6
|
import { Grow } from '../../Layout/Grow';
|
|
7
7
|
import { Text, TEXT_SIZE } from '../../Text/Text';
|
|
@@ -15,11 +15,12 @@ import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
|
15
15
|
|
|
16
16
|
export type SpoilerProps<OnClickData> = RbmComponentProps<
|
|
17
17
|
{
|
|
18
|
-
title:
|
|
18
|
+
title: ReactNode;
|
|
19
19
|
initialOpen?: boolean;
|
|
20
20
|
open?: boolean;
|
|
21
21
|
onlyTitleToggles?: boolean;
|
|
22
22
|
noClosingAnimation?: boolean;
|
|
23
|
+
noAnimation?: boolean;
|
|
23
24
|
openIcon?: IconSource | null;
|
|
24
25
|
closeIcon?: IconSource | null;
|
|
25
26
|
} & OptionalListener<'onClick', OnClickData>
|
|
@@ -30,6 +31,7 @@ function Spoiler<OnClickData>({
|
|
|
30
31
|
children,
|
|
31
32
|
initialOpen = false,
|
|
32
33
|
noClosingAnimation = false,
|
|
34
|
+
noAnimation = false,
|
|
33
35
|
openIcon = faChevronDown,
|
|
34
36
|
closeIcon = faChevronUp,
|
|
35
37
|
className,
|
|
@@ -85,7 +87,7 @@ function Spoiler<OnClickData>({
|
|
|
85
87
|
onClick={onlyTitleToggles ? undefined: toggleOpen}
|
|
86
88
|
className={classNames(className, styles.spoiler, {
|
|
87
89
|
[styles.open]: open ?? isOpen,
|
|
88
|
-
[styles.noAnimation]: isInitialValue,
|
|
90
|
+
[styles.noAnimation]: isInitialValue || noAnimation,
|
|
89
91
|
[styles.noClosingAnimation]: noClosingAnimation,
|
|
90
92
|
})}
|
|
91
93
|
style={style}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
100% {
|
|
25
25
|
height: initial;
|
|
26
|
-
transform:
|
|
26
|
+
transform: none !important;
|
|
27
27
|
opacity: 1;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
|
|
75
75
|
.body {
|
|
76
76
|
height: initial;
|
|
77
|
-
transform:
|
|
77
|
+
transform: none;
|
|
78
78
|
animation-name: spoilerOpen;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -6,6 +6,8 @@ import { WrongChildError } from '../../WrongChildError';
|
|
|
6
6
|
import withStyles from 'isomorphic-style-loader/withStyles';
|
|
7
7
|
import { Inline, InlineProps } from '../Layout/Inline';
|
|
8
8
|
import { ViewProps } from '../Layout/View';
|
|
9
|
+
import { JSX } from "react/jsx-runtime";
|
|
10
|
+
import IntrinsicElements = JSX.IntrinsicElements;
|
|
9
11
|
|
|
10
12
|
export const TEXT_PRIO = {
|
|
11
13
|
primary: styles.primary,
|
|
@@ -23,7 +25,7 @@ export const TEXT_SIZE = {
|
|
|
23
25
|
xxLarge: styles.xxlarge,
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
export type TextProps<AsType extends keyof
|
|
28
|
+
export type TextProps<AsType extends keyof IntrinsicElements> = {
|
|
27
29
|
block?: boolean;
|
|
28
30
|
prio?: ValueOf<typeof TEXT_PRIO>;
|
|
29
31
|
size?: ValueOf<typeof TEXT_SIZE>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ForwardRefRenderFunction, PropsWithoutRef, ReactElement, RefAttributes } from 'react';
|
|
2
|
-
import { RESTRICT_CHILDREN } from './withRestrictedChildren';
|
|
3
|
-
export interface RefComponent<PropTypes, ForwardedRefType> {
|
|
4
|
-
(props: PropsWithoutRef<PropTypes> & RefAttributes<ForwardedRefType>): ReactElement | null;
|
|
5
|
-
displayName?: string | undefined;
|
|
6
|
-
}
|
|
7
|
-
export declare function withForwardRef<PropTypes, ForwardedRefType>(component: ForwardRefRenderFunction<ForwardedRefType, PropTypes>, styles?: any, defaultAllowChildren?: typeof RESTRICT_CHILDREN['allowChildren']): RefComponent<PropTypes, ForwardedRefType>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React, { ForwardedRef, ForwardRefRenderFunction, PropsWithoutRef, ReactElement, RefAttributes } from 'react';
|
|
2
|
-
import withStyles from 'isomorphic-style-loader/withStyles';
|
|
3
|
-
import { RESTRICT_CHILDREN, withRestrictedChildren } from './withRestrictedChildren';
|
|
4
|
-
import { memoComparator } from './memoComparator';
|
|
5
|
-
|
|
6
|
-
export interface RefComponent<PropTypes, ForwardedRefType> {
|
|
7
|
-
(props: PropsWithoutRef<PropTypes> & RefAttributes<ForwardedRefType>): ReactElement | null;
|
|
8
|
-
|
|
9
|
-
displayName?: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function withForwardRef<PropTypes, ForwardedRefType>(
|
|
13
|
-
component: ForwardRefRenderFunction<ForwardedRefType, PropTypes>,
|
|
14
|
-
styles?: any,
|
|
15
|
-
defaultAllowChildren?: typeof RESTRICT_CHILDREN['allowChildren']
|
|
16
|
-
) {
|
|
17
|
-
const forwarded = React.forwardRef(component);
|
|
18
|
-
forwarded.displayName = component.displayName ?? component.name;
|
|
19
|
-
const forwardedComp = React.forwardRef(withRestrictedChildren(forwarded, defaultAllowChildren));
|
|
20
|
-
const c: (props: PropTypes, ref: ForwardedRef<ForwardedRefType>) => ReactElement = styles
|
|
21
|
-
? withStyles(styles)(forwardedComp)
|
|
22
|
-
: forwardedComp;
|
|
23
|
-
|
|
24
|
-
const memoizedComponent = React.memo(c, memoComparator) as RefComponent<PropTypes, ForwardedRefType>;
|
|
25
|
-
memoizedComponent.displayName = `Memoized-Forwarded(${component.displayName || component.name})`;
|
|
26
|
-
|
|
27
|
-
return memoizedComponent;
|
|
28
|
-
}
|