@aliexme/react-utils 0.2.0 → 0.2.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.
@@ -1,7 +1,7 @@
1
1
  import { type PropsWithChildren, type FC, type ReactElement } from 'react';
2
2
  export type MaybeProps = PropsWithChildren<{
3
3
  cond: boolean;
4
- thenComponent: ReactElement;
5
- elseComponent?: ReactElement;
4
+ component: ReactElement;
5
+ fallback?: ReactElement;
6
6
  }>;
7
7
  export declare const Maybe: FC<MaybeProps>;
@@ -1,9 +1,9 @@
1
1
  import { Fragment, cloneElement } from 'react';
2
2
  export const Maybe = (props) => {
3
- const { cond, thenComponent, elseComponent = <Fragment />, children } = props;
3
+ const { cond, component, fallback = <Fragment />, children } = props;
4
4
  if (cond) {
5
- return cloneElement(thenComponent, { children });
5
+ return cloneElement(component, { children });
6
6
  }
7
- return cloneElement(elseComponent, { children });
7
+ return cloneElement(fallback, { children });
8
8
  };
9
9
  //# sourceMappingURL=Maybe.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"Maybe.jsx","sourceRoot":"","sources":["../../src/components/Maybe/Maybe.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsD,QAAQ,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQlG,MAAM,CAAC,MAAM,KAAK,GAAmB,CAAC,KAAK,EAAE,EAAE;IAC7C,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,GAAG,CAAC,QAAQ,CAAC,AAAD,EAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IAE7E,IAAI,IAAI,EAAE;QACR,OAAO,YAAY,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;KACjD;IAED,OAAO,YAAY,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;AAClD,CAAC,CAAA"}
1
+ {"version":3,"file":"Maybe.jsx","sourceRoot":"","sources":["../../src/components/Maybe/Maybe.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsD,QAAQ,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQlG,MAAM,CAAC,MAAM,KAAK,GAAmB,CAAC,KAAK,EAAE,EAAE;IAC7C,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,GAAG,CAAC,QAAQ,CAAC,AAAD,EAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IAEpE,IAAI,IAAI,EAAE;QACR,OAAO,YAAY,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,YAAY,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;AAC7C,CAAC,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { useEffect } from 'react';
2
2
  export const useDidMount = (effect) => {
3
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3
4
  useEffect(effect, []);
4
5
  };
5
6
  //# sourceMappingURL=useDidMount.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDidMount.js","sourceRoot":"","sources":["../src/hooks/useDidMount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAsB,EAAE,EAAE;IACpD,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACvB,CAAC,CAAA"}
1
+ {"version":3,"file":"useDidMount.js","sourceRoot":"","sources":["../src/hooks/useDidMount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAsB,EAAE,EAAE;IACpD,uDAAuD;IACvD,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACvB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliexme/react-utils",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "React utilites",
5
5
  "private": false,
6
6
  "author": "Alexander Smirnov <al.smirnov996@gmail.com>",
@@ -25,7 +25,7 @@
25
25
  "test:coverage": "jest --collectCoverage"
26
26
  },
27
27
  "devDependencies": {
28
- "@aliexme/eslint-config": "0.2.7",
28
+ "@aliexme/eslint-config": "0.3.1",
29
29
  "@aliexme/ts-types": "0.2.3",
30
30
  "@types/jest": "29.5.0",
31
31
  "@types/react": "18.0.31",