@ainias42/react-bootstrap-mobile 0.2.16 → 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.
Files changed (62) hide show
  1. package/bootstrapReactMobile.ts +0 -1
  2. package/dist/bootstrapReactMobile.d.ts +0 -1
  3. package/dist/bootstrapReactMobile.js +190 -194
  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 +7 -7
  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/dist/src/helper/withForwardRef.d.ts +0 -7
  62. package/src/helper/withForwardRef.ts +0 -28
@@ -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 = withForwardRef(function DialogContainer({
25
- children,
26
- dialogClassName
27
- }: DialogContainerProps, ref: ForwardedRef<DialogContainerRef>) {
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, { ComponentProps, ComponentRef, ComponentType, ForwardedRef, useCallback } from "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 { withForwardRef } from "../../../helper/withForwardRef";
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 | 'ref' | 'value'
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
- clearErrors(name);
29
- field.onChange(arg);
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 withForwardRef(WithHookComponent);
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 = withForwardRef(function Input<OnChangeData, OnBlurData, OnChangeDoneData>(
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 = withForwardRef(function PasswordInput<OnChangeData, OnBlurData, OnChangeEndData>(
23
- { className, style, ...props }: PasswordInputProps<OnChangeData, OnBlurData, OnChangeEndData>,
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
- MutableRefObject,
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?: MutableRefObject<HTMLLabelElement|null>
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 = withForwardRef(function Textarea<OnChangeData, OnChangeDoneData>({
38
- label,
39
- className,
40
- style,
41
- onKeyUp,
42
- onChangeText,
43
- onEnter,
44
- onEscape,
45
- textareaStyles,
46
- containerRef,
47
- error,
48
- ...otherProps
49
- }: TextareaProps<OnChangeData, OnChangeDoneData>, ref: MutableRefObject<HTMLTextAreaElement> | null) {
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, ComponentRef, useCallback, useEffect, useMemo, useRef } from 'react';
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 JSX.IntrinsicElements> = RbmComponentProps<
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<ComponentRef<AsTag>>(null);
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
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
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
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
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 JSX.IntrinsicElements> = RbmComponentProps<
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 JSX.IntrinsicElements> = RbmComponentProps<
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);
@@ -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
  );