@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.
Files changed (63) hide show
  1. package/bootstrapReactMobile.ts +0 -1
  2. package/dist/bootstrapReactMobile.d.ts +0 -1
  3. package/dist/bootstrapReactMobile.js +3217 -3269
  4. package/dist/bootstrapReactMobile.js.map +1 -1
  5. package/dist/src/Components/ActionSheet/ActionSheet.d.ts +8 -6
  6. package/dist/src/Components/Clickable/Clickable.d.ts +5 -3
  7. package/dist/src/Components/Dialog/DialogContainer.d.ts +4 -2
  8. package/dist/src/Components/FormElements/Controller/ColorInputController.d.ts +5 -3
  9. package/dist/src/Components/FormElements/Controller/InputController.d.ts +5 -4
  10. package/dist/src/Components/FormElements/Controller/MultipleFileInputController.d.ts +5 -3
  11. package/dist/src/Components/FormElements/Controller/PasswordInputController.d.ts +5 -4
  12. package/dist/src/Components/FormElements/Controller/SelectController.d.ts +5 -3
  13. package/dist/src/Components/FormElements/Controller/SendFormContext.d.ts +0 -1
  14. package/dist/src/Components/FormElements/Controller/SwitchController.d.ts +5 -3
  15. package/dist/src/Components/FormElements/Controller/TextareaController.d.ts +5 -4
  16. package/dist/src/Components/FormElements/Controller/withHookController.d.ts +7 -4
  17. package/dist/src/Components/FormElements/Input/Input.d.ts +4 -2
  18. package/dist/src/Components/FormElements/Input/PasswordInput/PasswordInput.d.ts +3 -1
  19. package/dist/src/Components/FormElements/Textarea/Textarea.d.ts +5 -3
  20. package/dist/src/Components/FormElements/hooks/useOnChangeDone.d.ts +1 -1
  21. package/dist/src/Components/FullScreen/FullScreen.d.ts +3 -1
  22. package/dist/src/Components/Hooks/useMousePosition.d.ts +1 -2
  23. package/dist/src/Components/Layout/Block.d.ts +8 -5
  24. package/dist/src/Components/Layout/Flex.d.ts +5 -5
  25. package/dist/src/Components/Layout/Grid/Grid.d.ts +4 -2
  26. package/dist/src/Components/Layout/Grow.d.ts +4 -1
  27. package/dist/src/Components/Layout/Inline.d.ts +5 -5
  28. package/dist/src/Components/Layout/InlineBlock.d.ts +5 -5
  29. package/dist/src/Components/Layout/View.d.ts +8 -3
  30. package/dist/src/Components/Layout/ViewWithoutListeners.d.ts +4 -2
  31. package/dist/src/Components/List/List.d.ts +4 -2
  32. package/dist/src/Components/RbmComponentProps.d.ts +1 -0
  33. package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +2 -2
  34. package/dist/src/Components/Text/Text.d.ts +3 -1
  35. package/dist/src/Components/Toast/ToastContext.d.ts +3 -4
  36. package/dist/src/helper/withRestrictedChildren.d.ts +2 -2
  37. package/package.json +43 -43
  38. package/src/Components/ActionSheet/ActionSheet.tsx +12 -15
  39. package/src/Components/Clickable/Clickable.tsx +5 -8
  40. package/src/Components/Dialog/DialogContainer.tsx +7 -5
  41. package/src/Components/FormElements/Controller/withHookController.tsx +12 -8
  42. package/src/Components/FormElements/Input/Input.tsx +5 -5
  43. package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +4 -5
  44. package/src/Components/FormElements/Textarea/Textarea.tsx +18 -17
  45. package/src/Components/FullScreen/FullScreen.tsx +7 -7
  46. package/src/Components/Hooks/useDelayed.ts +2 -1
  47. package/src/Components/Hooks/useOnMount.ts +1 -1
  48. package/src/Components/Hooks/useRerender.ts +1 -1
  49. package/src/Components/Layout/Block.tsx +10 -12
  50. package/src/Components/Layout/Flex.tsx +7 -11
  51. package/src/Components/Layout/Grid/Grid.tsx +4 -7
  52. package/src/Components/Layout/Grow.tsx +3 -2
  53. package/src/Components/Layout/Inline.tsx +6 -12
  54. package/src/Components/Layout/InlineBlock.tsx +6 -12
  55. package/src/Components/Layout/View.tsx +7 -6
  56. package/src/Components/Layout/ViewWithoutListeners.tsx +8 -7
  57. package/src/Components/List/List.tsx +5 -3
  58. package/src/Components/RbmComponentProps.ts +1 -0
  59. package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +2 -2
  60. package/src/Components/Text/Text.tsx +3 -1
  61. package/webpack.config.js +3 -2
  62. package/dist/src/helper/withForwardRef.d.ts +0 -7
  63. package/src/helper/withForwardRef.ts +0 -28
@@ -4,15 +4,16 @@ import { Block } from '../Block';
4
4
  import classNames from 'classnames';
5
5
  import styles from './grid.scss';
6
6
  import { ForwardedRef, useMemo } from 'react';
7
- import { withForwardRef } from "../../../helper/withForwardRef";
7
+ import { withMemo } from "../../../helper/withMemo";
8
8
 
9
9
  export type GridProps = RbmComponentProps<{
10
10
  columns?: number;
11
11
  rows?: number;
12
12
  useContainerWidth?: boolean;
13
+ ref?:ForwardedRef<HTMLDivElement>
13
14
  }>;
14
15
 
15
- function Grid({ style, children, columns = 12, rows = 1, useContainerWidth = false, className, __allowChildren }: GridProps, ref?:ForwardedRef<HTMLDivElement>) {
16
+ export const Grid = withMemo(function Grid({ style, children, columns = 12, rows = 1, useContainerWidth = false,ref, className, __allowChildren }: GridProps) {
16
17
  // Variables
17
18
  const appliedStyle = useMemo(
18
19
  () => ({
@@ -47,8 +48,4 @@ function Grid({ style, children, columns = 12, rows = 1, useContainerWidth = fal
47
48
  {children}
48
49
  </Block>
49
50
  );
50
- }
51
-
52
- // Need RowMemo for autocompletion of phpstorm
53
- const GridMemo = withForwardRef(Grid, styles);
54
- export { GridMemo as Grid };
51
+ }, styles);
@@ -2,15 +2,16 @@ import * as React from 'react';
2
2
  import { RbmComponentProps } from '../RbmComponentProps';
3
3
  import styles from './layout.scss';
4
4
  import classNames from 'classnames';
5
- import { withForwardRef } from "../../helper/withForwardRef";
6
5
  import { ForwardedRef } from "react";
6
+ import { withMemo } from "../../helper/withMemo";
7
7
 
8
8
  export type GrowProps = RbmComponentProps<{
9
9
  center?: boolean;
10
10
  weight?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
11
+ ref?: ForwardedRef<HTMLDivElement>
11
12
  }>;
12
13
 
13
- export const Grow = withForwardRef(function Grow({ className, children, center = false, style, weight = 1 }: GrowProps, ref?: ForwardedRef<HTMLDivElement>) {
14
+ export const Grow = withMemo(function Grow({ className, children, center = false, style, weight = 1, ref }: GrowProps ) {
14
15
  // Variables
15
16
 
16
17
  // States
@@ -1,19 +1,18 @@
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 { ViewWithoutListeners, ViewWithoutListenersProps } from './ViewWithoutListeners';
7
- import { withForwardRef } from '../../helper/withForwardRef';
8
- import { ComponentRef, ForwardedRef } from 'react';
6
+ import { withMemo } from "../../helper/withMemo";
7
+ import { JSX } from "react/jsx-runtime";
8
+ import IntrinsicElements = JSX.IntrinsicElements;
9
9
 
10
- export type InlineProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<
10
+ export type InlineProps<AsType extends keyof IntrinsicElements> = RbmComponentProps<
11
11
  ViewWithoutListenersProps<AsType>
12
12
  >;
13
13
 
14
- function Inline<AsType extends keyof JSX.IntrinsicElements = 'span'>(
14
+ export const Inline = withMemo(function Inline<AsType extends keyof JSX.IntrinsicElements = 'span'>(
15
15
  { children, as = 'span' as AsType, className, ...props }: InlineProps<AsType>,
16
- ref?: ForwardedRef<ComponentRef<AsType>>
17
16
  ) {
18
17
  // Variables
19
18
 
@@ -36,13 +35,8 @@ function Inline<AsType extends keyof JSX.IntrinsicElements = 'span'>(
36
35
  className={classNames(styles.inline, className)}
37
36
  as={as as AsType}
38
37
  {...(props as ViewWithoutListenersProps<AsType>)}
39
- ref={ref}
40
38
  >
41
39
  {children}
42
40
  </ViewWithoutListeners>
43
41
  );
44
- }
45
-
46
- // Need InlineMemo for autocompletion of phpstorm
47
- const InlineMemo = withForwardRef(Inline, styles);
48
- export { InlineMemo as Inline };
42
+ }, styles);
@@ -1,22 +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 { ViewWithoutListeners, ViewWithoutListenersProps } from './ViewWithoutListeners';
7
- import { ComponentRef, ForwardedRef } from 'react';
8
- import { withForwardRef } from '../../helper/withForwardRef';
6
+ import { JSX } from "react/jsx-runtime";
7
+ import IntrinsicElements = JSX.IntrinsicElements;
8
+ import { withMemo } from "../../helper/withMemo";
9
9
 
10
- export type InlineBlockProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<
10
+ export type InlineBlockProps<AsType extends keyof IntrinsicElements> = RbmComponentProps<
11
11
  ViewWithoutListenersProps<AsType> & {
12
12
  id?: string
13
13
  title?: string
14
14
  }
15
15
  >;
16
16
 
17
- function InlineBlock<AsType extends keyof JSX.IntrinsicElements = 'span'>(
17
+ export const InlineBlock = withMemo(function InlineBlock<AsType extends keyof JSX.IntrinsicElements = 'span'>(
18
18
  { children, as = 'span' as AsType, className, ...props }: InlineBlockProps<AsType>,
19
- ref?: ForwardedRef<ComponentRef<AsType>>
20
19
  ) {
21
20
  // Variables
22
21
 
@@ -39,13 +38,8 @@ function InlineBlock<AsType extends keyof JSX.IntrinsicElements = 'span'>(
39
38
  {...(props as ViewWithoutListenersProps<AsType>)}
40
39
  className={classNames(styles.inlineBlock, className)}
41
40
  as={as as AsType}
42
- ref={ref}
43
41
  >
44
42
  {children}
45
43
  </ViewWithoutListeners>
46
44
  );
47
- }
48
-
49
- // Need InlineMemo for autocompletion of phpstorm
50
- const InlineBlockMemo = withForwardRef(InlineBlock, styles);
51
- export { InlineBlockMemo as InlineBlock };
45
+ }, styles);
@@ -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 { withForwardRef } from "../../helper/withForwardRef";
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 JSX.IntrinsicElements> = PropsWithChildren<
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 = withForwardRef(function View<AsType extends keyof JSX.IntrinsicElements>(
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 { ComponentRef, DOMAttributes, ForwardedRef } from 'react';
2
+ import { DOMAttributes, ForwardedRef } from 'react';
3
3
  import { View, ViewProps } from './View';
4
- import { withForwardRef } from "../../helper/withForwardRef";
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 JSX.IntrinsicElements> = Omit<
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 = withForwardRef(function ViewWithoutListeners<AsType extends keyof JSX.IntrinsicElements>(
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 { withForwardRef } from "../../helper/withForwardRef";
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 = withForwardRef(function List<ItemType>({
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
- }: ListProps<ItemType>, ref: ForwardedRef<FixedSizeList<ItemType>>) {
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, ReactChild, useCallback, useEffect, useRef, useState } from 'react';
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,7 +15,7 @@ import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
15
15
 
16
16
  export type SpoilerProps<OnClickData> = RbmComponentProps<
17
17
  {
18
- title: ReactChild;
18
+ title: ReactNode;
19
19
  initialOpen?: boolean;
20
20
  open?: boolean;
21
21
  onlyTitleToggles?: boolean;
@@ -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 JSX.IntrinsicElements> = {
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>;
package/webpack.config.js CHANGED
@@ -3,7 +3,8 @@ const webpack = require('webpack');
3
3
  // const PrettierPlugin = require('prettier-webpack-plugin');
4
4
  const TerserPlugin = require('terser-webpack-plugin');
5
5
  const getPackageJson = require('./scripts/getPackageJson');
6
- const CssLayeringPlugin = require('css-layering-webpack-plugin');
6
+ const {CSSLayeringPlugin} = require('css-layering-webpack-plugin');
7
+
7
8
 
8
9
  const { version, name, license, repository, author } = getPackageJson(
9
10
  'version',
@@ -80,7 +81,7 @@ module.exports = (env) => {
80
81
  // filename: 'css/index.css',
81
82
  // }),
82
83
  new webpack.BannerPlugin(banner),
83
- new CssLayeringPlugin({
84
+ new CSSLayeringPlugin({
84
85
  layers: [
85
86
  { path: "**/src/**/*.scss", name: "rbm" },
86
87
  ],
@@ -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
- }