@ainias42/react-bootstrap-mobile 0.1.8 → 0.1.9

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.
@@ -1,4 +1,4 @@
1
- import { Override } from '../../../TypeHelpers';
1
+ import { Override } from '@ainias42/js-helper';
2
2
  import { OptionalListener } from '../../Hooks/useListener';
3
3
  import { HTMLAttributes } from 'react';
4
4
  import { RbmComponentProps } from '../../RbmComponentProps';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RbmComponentProps } from '../RbmComponentProps';
3
2
  export declare const CONTAINER_CLASSES: {
4
3
  sm: string;
@@ -10,6 +9,4 @@ export declare const CONTAINER_CLASSES: {
10
9
  export type ContainerProps = RbmComponentProps<{
11
10
  fluid?: boolean | keyof typeof CONTAINER_CLASSES;
12
11
  }>;
13
- declare function Container({ fluid, className, children, style }: ContainerProps): JSX.Element;
14
- declare const ContainerMemo: typeof Container;
15
- export { ContainerMemo as Container };
12
+ export declare const Container: ({ fluid, className, children, style }: ContainerProps) => JSX.Element;
@@ -1,15 +1,15 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  import { Recursive } from '../TypeHelpers';
3
- type Child = Recursive<JSX.Element | undefined | null | Child[]> | false;
3
+ export type RbmChildWithoutString = Recursive<JSX.Element | undefined | null | RbmChildWithoutString[]> | false;
4
4
  export type WithNoStringProps = {
5
- children?: Child;
5
+ children?: RbmChildWithoutString;
6
6
  __allowChildren?: 'html';
7
7
  } | {
8
8
  children?: ReactNode;
9
9
  __allowChildren: 'text' | 'all';
10
10
  };
11
11
  export type WithNoStringAndChildrenProps = {
12
- children: Child;
12
+ children: RbmChildWithoutString;
13
13
  __allowChildren?: 'html';
14
14
  } | {
15
15
  children: ReactNode;
@@ -28,4 +28,3 @@ export type RbmComponentProps<SpecialProps, ChildrenProps = WithNoStringProps> =
28
28
  className?: string;
29
29
  style?: CSSProperties;
30
30
  } & SpecialProps;
31
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainias42/react-bootstrap-mobile",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Mobile React Components using Bootstrap",
5
5
  "main": "dist/bootstrapReactMobile",
6
6
  "scripts": {
@@ -81,7 +81,7 @@
81
81
  "@types/react-virtualized-auto-sizer": "^1.0.1",
82
82
  "classnames": "^2.3.1",
83
83
  "isomorphic-style-loader": "^5.3.2",
84
- "@ainias42/js-helper": ">=0.7.12",
84
+ "@ainias42/js-helper": ">=0.8.1",
85
85
  "react-color": "^2.19.3",
86
86
  "react-table": "^7.7.0",
87
87
  "react-virtualized-auto-sizer": "^1.0.7",
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Override } from '../../../TypeHelpers';
2
+ import { Override } from '@ainias42/js-helper';
3
3
  import { OptionalListener, useListener } from '../../Hooks/useListener';
4
4
 
5
5
  import styles from './button.scss';
@@ -17,7 +17,7 @@ export type ContainerProps = RbmComponentProps<{
17
17
  fluid?: boolean | keyof typeof CONTAINER_CLASSES;
18
18
  }>;
19
19
 
20
- function Container({ fluid, className, children, style }: ContainerProps) {
20
+ export const Container = withMemo(function Container({ fluid, className, children, style }: ContainerProps) {
21
21
  // Variables
22
22
 
23
23
  // Refs
@@ -50,8 +50,4 @@ function Container({ fluid, className, children, style }: ContainerProps) {
50
50
  {children}
51
51
  </div>
52
52
  );
53
- }
54
-
55
- // Need ContainerMemo for autocompletion of phpstorm
56
- const ContainerMemo = withMemo(Container, styles);
57
- export { ContainerMemo as Container };
53
+ }, styles);
@@ -32,15 +32,11 @@ export const List = withMemo(function List<ItemType>({
32
32
 
33
33
  // Callbacks
34
34
  const renderItemInner = useCallback<ComponentType<ListChildComponentProps>>(
35
- ({ index, style: itemStyle }) => {
36
- return renderItem(items[index], itemStyle, index);
37
- },
35
+ ({ index, style: itemStyle }) => renderItem(items[index], itemStyle, index),
38
36
  [items, renderItem]
39
37
  );
40
38
 
41
- const setHeight = useCallback<SizeCalculatorProps['onSize']>((_, height) => {
42
- setItemHeight(height);
43
- }, []);
39
+ const setHeight = useCallback<SizeCalculatorProps['onSize']>((_, height) => setItemHeight(height), []);
44
40
 
45
41
  // Effects
46
42
 
@@ -68,17 +64,19 @@ export const List = withMemo(function List<ItemType>({
68
64
  )}
69
65
  </SizeCalculator>
70
66
  )}
71
- <FixedSizeList
72
- height={height}
73
- itemCount={items.length}
74
- width={width}
75
- itemSize={itemHeight}
76
- style={style}
77
- className={className}
78
- itemData={items}
79
- >
80
- {renderItemInner}
81
- </FixedSizeList>
67
+ {height !== undefined && width !== undefined && (
68
+ <FixedSizeList
69
+ height={height}
70
+ itemCount={items.length}
71
+ width={width}
72
+ itemSize={itemHeight}
73
+ style={style}
74
+ className={className}
75
+ itemData={items}
76
+ >
77
+ {renderItemInner}
78
+ </FixedSizeList>
79
+ )}
82
80
  </>
83
81
  );
84
82
  }}
@@ -1,10 +1,10 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  import { Recursive } from '../TypeHelpers';
3
3
 
4
- type Child = Recursive<JSX.Element | undefined | null | Child[]> | false;
4
+ export type RbmChildWithoutString = Recursive<JSX.Element | undefined | null | RbmChildWithoutString[]> | false;
5
5
  export type WithNoStringProps =
6
6
  | {
7
- children?: Child;
7
+ children?: RbmChildWithoutString;
8
8
  __allowChildren?: 'html';
9
9
  }
10
10
  | {
@@ -14,7 +14,7 @@ export type WithNoStringProps =
14
14
 
15
15
  export type WithNoStringAndChildrenProps =
16
16
  | {
17
- children: Child;
17
+ children: RbmChildWithoutString;
18
18
  __allowChildren?: 'html';
19
19
  }
20
20
  | {
package/webpack.config.js CHANGED
@@ -23,7 +23,7 @@ const banner = `
23
23
  module.exports = (env) => {
24
24
  return {
25
25
  mode: env.production ? 'production' : 'development',
26
- // devtool: 'source-map',
26
+ devtool: env.production ? 'source-map' : 'eval-source-map',
27
27
  entry: './bootstrapReactMobile.ts',
28
28
  output: {
29
29
  filename: 'bootstrapReactMobile.js',