@react-pakistan/util-functions 1.19.2 → 1.20.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/hooks/index.d.ts +0 -1
- package/hooks/index.js +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +15 -16
- package/storybook/theme.d.ts +4 -3
- package/storybook/theme.js +973 -788
- package/action-creator-factories/empty-action-creator.d.ts +0 -4
- package/action-creator-factories/empty-action-creator.js +0 -5
- package/action-creator-factories/index.d.ts +0 -3
- package/action-creator-factories/index.js +0 -19
- package/action-creator-factories/payload-action-creator.d.ts +0 -4
- package/action-creator-factories/payload-action-creator.js +0 -5
- package/action-creator-factories/types.d.ts +0 -48
- package/action-creator-factories/types.js +0 -2
- package/hooks/use-selector.d.ts +0 -10
- package/hooks/use-selector.js +0 -16
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./payload-action-creator"), exports);
|
|
18
|
-
__exportStar(require("./empty-action-creator"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export interface IEmptyAction<T extends string> {
|
|
2
|
-
type: T;
|
|
3
|
-
}
|
|
4
|
-
export interface IActionData<D> {
|
|
5
|
-
data: D;
|
|
6
|
-
}
|
|
7
|
-
export interface IPayloadAction<T extends string, D> extends IEmptyAction<T>, IActionData<D> {
|
|
8
|
-
}
|
|
9
|
-
export interface IAction {
|
|
10
|
-
type: string;
|
|
11
|
-
data?: any;
|
|
12
|
-
}
|
|
13
|
-
export type TActionCreator = (...args: Array<any>) => IAction;
|
|
14
|
-
export type TAction<AC extends TActionCreator> = ReturnType<AC>;
|
|
15
|
-
interface IMap {
|
|
16
|
-
[K: string]: TActionCreator;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Helper which returns a map of types of each action by creators passed in as a Map
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* import * as CfdActions from 'actions/cfd';
|
|
23
|
-
* type CfdActionTypeMap = TActionMap<typeof CfdActions>;
|
|
24
|
-
* type onChangeAction = TCfdActionMap['onChange']
|
|
25
|
-
*/
|
|
26
|
-
export type TActionMap<T extends IMap> = {
|
|
27
|
-
[K in keyof T]: TAction<T[K]>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Helper which combines the types of each action by creators passed in as a Map
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* import * as CfdActions from 'actions/cfd';
|
|
34
|
-
* type CfdAction = TActionsMap<typeof CfdActions>;
|
|
35
|
-
*
|
|
36
|
-
* const test = (action : CfdAction) => {
|
|
37
|
-
* if (action.type === 'onChange') {
|
|
38
|
-
* // narrowed down to onChange action
|
|
39
|
-
* }
|
|
40
|
-
* switch (action.type) {
|
|
41
|
-
* case 'onChange' : {
|
|
42
|
-
* // narrowed down to onChange action
|
|
43
|
-
* }
|
|
44
|
-
* }
|
|
45
|
-
* };
|
|
46
|
-
*/
|
|
47
|
-
export type TActionsMap<T extends IMap> = TActionMap<T>[keyof TActionMap<T>];
|
|
48
|
-
export {};
|
package/hooks/use-selector.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A util hook over react redux useSelector hook to enable memoization.
|
|
3
|
-
*
|
|
4
|
-
* @param selector - selector which needed to be memoized
|
|
5
|
-
* @returns memoized value off the provided selector
|
|
6
|
-
* @author Taimoor Khan
|
|
7
|
-
* @remarks
|
|
8
|
-
*/
|
|
9
|
-
/** End file docs */
|
|
10
|
-
export declare const useSelector: (selector: () => void) => void;
|
package/hooks/use-selector.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* A util hook over react redux useSelector hook to enable memoization.
|
|
4
|
-
*
|
|
5
|
-
* @param selector - selector which needed to be memoized
|
|
6
|
-
* @returns memoized value off the provided selector
|
|
7
|
-
* @author Taimoor Khan
|
|
8
|
-
* @remarks
|
|
9
|
-
*/
|
|
10
|
-
/** End file docs */
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.useSelector = void 0;
|
|
13
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
-
const react_redux_1 = require("react-redux");
|
|
15
|
-
const useSelector = (selector) => (0, react_redux_1.useSelector)(selector, react_redux_1.shallowEqual);
|
|
16
|
-
exports.useSelector = useSelector;
|