@evlop/commons 1.0.121 → 1.0.124
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/components/hoc/withSettings.d.ts +9 -2
- package/dist/src/components/hoc/withSettings.d.ts.map +1 -1
- package/dist/src/components/hoc/withSettings.js +1 -1
- package/dist/src/components/hoc/withSettings.js.map +1 -1
- package/dist/src/constants/i18ninstance.d.ts +3 -0
- package/dist/src/constants/i18ninstance.d.ts.map +1 -0
- package/dist/src/constants/i18ninstance.js +13 -0
- package/dist/src/constants/i18ninstance.js.map +1 -0
- package/dist/src/constants/index.d.ts +1 -0
- package/dist/src/constants/index.d.ts.map +1 -1
- package/dist/src/constants/index.js +3 -1
- package/dist/src/constants/index.js.map +1 -1
- package/dist/src/helpers/handlebarHelpers.js +5 -0
- package/dist/src/helpers/handlebarHelpers.js.map +1 -1
- package/dist/src/helpers/handlebarHelpers.test.d.ts.map +1 -1
- package/dist/src/helpers/handlebarHelpers.test.js +11 -0
- package/dist/src/helpers/handlebarHelpers.test.js.map +1 -1
- package/dist/src/helpers/index.d.ts +1 -1
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/index.js +1 -1
- package/dist/src/helpers/index.js.map +1 -1
- package/dist/src/helpers/themeHelpers.d.ts +119 -15
- package/dist/src/helpers/themeHelpers.d.ts.map +1 -1
- package/dist/src/helpers/themeHelpers.js +51 -43
- package/dist/src/helpers/themeHelpers.js.map +1 -1
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +2 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/useAction.d.ts +2 -11
- package/dist/src/hooks/useAction.d.ts.map +1 -1
- package/dist/src/hooks/useAction.js +9 -38
- package/dist/src/hooks/useAction.js.map +1 -1
- package/dist/src/hooks/useActionable.d.ts +21 -0
- package/dist/src/hooks/useActionable.d.ts.map +1 -0
- package/dist/src/hooks/useActionable.js +54 -0
- package/dist/src/hooks/useActionable.js.map +1 -0
- package/dist/src/hooks/useTheme.d.ts +4 -1
- package/dist/src/hooks/useTheme.d.ts.map +1 -1
- package/dist/src/hooks/useTheme.js.map +1 -1
- package/dist/src/hooks/useTranslation.d.ts +4 -0
- package/dist/src/hooks/useTranslation.d.ts.map +1 -0
- package/dist/src/hooks/useTranslation.js +17 -0
- package/dist/src/hooks/useTranslation.js.map +1 -0
- package/dist/src/reducers/config/index.d.ts +1 -1
- package/dist/src/reducers/config/index.d.ts.map +1 -1
- package/dist/src/reducers/config/index.js +4 -4
- package/dist/src/reducers/config/index.js.map +1 -1
- package/dist/src/reducers/notifications.d.ts +6 -3
- package/dist/src/reducers/notifications.d.ts.map +1 -1
- package/dist/src/reducers/notifications.js +10 -5
- package/dist/src/reducers/notifications.js.map +1 -1
- package/package.json +6 -3
@@ -1,13 +1,20 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { Action } from '../../hooks';
|
3
|
+
declare type SettingProp = {
|
4
|
+
model?: string;
|
5
|
+
dataModel?: string;
|
6
|
+
configModel?: string;
|
7
|
+
action?: Action;
|
8
|
+
};
|
2
9
|
export declare const withSettings: ({ name: elementName, valueOptions, configurationOptions }: {
|
3
10
|
name: any;
|
4
11
|
valueOptions?: any[];
|
5
12
|
configurationOptions?: any[];
|
6
|
-
}) => (RenderComponent:
|
13
|
+
}) => <P extends Object>(RenderComponent: React.ComponentType<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P & SettingProp> & React.RefAttributes<any>>;
|
7
14
|
export declare const withToolbar: ({ name: elementName, valueOptions, configurationOptions }: {
|
8
15
|
name: any;
|
9
16
|
valueOptions?: any[];
|
10
17
|
configurationOptions?: any[];
|
11
|
-
}) => (RenderComponent:
|
18
|
+
}) => <P extends Object>(RenderComponent: React.ComponentType<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P & SettingProp> & React.RefAttributes<any>>;
|
12
19
|
export default withSettings;
|
13
20
|
//# sourceMappingURL=withSettings.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"withSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/hoc/withSettings.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoF,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"withSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/hoc/withSettings.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoF,MAAM,OAAO,CAAC;AAEzG,OAAO,EAAE,MAAM,EAAgE,MAAM,aAAa,CAAC;AAEnG,aAAK,WAAW,GAAG;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/F,eAAO,MAAM,YAAY;;;;uKAsLvB,CAAC;AAGH,eAAO,MAAM,WAAW;;;;uKAAe,CAAC;AACxC,eAAe,YAAY,CAAC"}
|
@@ -35,7 +35,7 @@ const lodash_1 = __importStar(require("lodash"));
|
|
35
35
|
const react_1 = __importStar(require("react"));
|
36
36
|
const contexts_1 = require("../../contexts");
|
37
37
|
const hooks_1 = require("../../hooks");
|
38
|
-
const withSettings = ({ name: elementName, valueOptions = [], configurationOptions = [] }) => RenderComponent => react_1.forwardRef((props, forwardedRef) => {
|
38
|
+
const withSettings = ({ name: elementName, valueOptions = [], configurationOptions = [] }) => (RenderComponent) => react_1.forwardRef((props, forwardedRef) => {
|
39
39
|
const newRef = react_1.useRef();
|
40
40
|
const ref = react_1.useMemo(() => forwardedRef || newRef, [newRef, forwardedRef]);
|
41
41
|
const { model, dataModel = model, configModel = dataModel && `${dataModel}_config`, restrictEdit, action: actionProp, onPress, onClick: onClickProp = onPress } = props;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"withSettings.js","sourceRoot":"","sources":["../../../../src/components/hoc/withSettings.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA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AAO,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAExC,MAAM,EAAC,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAC,GAAG,kBAAU,CAAC,yBAAc,CAAC,CAAC;IAE3E,MAAM,cAAc,GAAO,eAAO,CAAC,GAAE,EAAE;QACnC,OAAO,EAAC,KAAK,EAAC,CAAC,EAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,oBAAoB,EAAC,EAAE,GAAG,YAAY,CAAC,EAAE,gBAAgB,EAAC,CAAC;IACnJ,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IAG7E,OAAO,CACH,8BAAC,0BAAe,IAAC,KAAK,EAAE,cAAc;QAClC,8BAAC,eAAe,6BACH,EAAE,EACX,OAAO,QACP,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,IACf,KAAK,EACL,OAAO,EACP,MAAM,EACN,UAAU,IACd,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG,IACV,CACY,CACrB,CAAC;AACN,CAAC,CAAC,CAAC;AAtLU,QAAA,YAAY,gBAsLtB;AAGU,QAAA,WAAW,GAAG,oBAAY,CAAC;AACxC,kBAAe,oBAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"i18ninstance.d.ts","sourceRoot":"","sources":["../../../src/constants/i18ninstance.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,YAAY,wBAA2B,CAAC;AAM9C,eAAe,YAAY,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const i18next_1 = __importDefault(require("i18next"));
|
7
|
+
const i18nInstance = i18next_1.default.createInstance();
|
8
|
+
i18nInstance.init({
|
9
|
+
fallbackLng: ['en', 'EN'],
|
10
|
+
defaultNS: "common",
|
11
|
+
});
|
12
|
+
exports.default = i18nInstance;
|
13
|
+
//# sourceMappingURL=i18ninstance.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"i18ninstance.js","sourceRoot":"","sources":["../../../src/constants/i18ninstance.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAE9B,MAAM,YAAY,GAAG,iBAAO,CAAC,cAAc,EAAE,CAAC;AAC9C,YAAY,CAAC,IAAI,CAAC;IACd,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IACzB,SAAS,EAAE,QAAQ;CACtB,CAAC,CAAC;AAEH,kBAAe,YAAY,CAAC"}
|
@@ -11,4 +11,5 @@ export declare const TYPE_COMPONENT = "type/component";
|
|
11
11
|
export declare const DATA_SOURCE_KEY_NAMESPACE = "a0aec1c8-4fed-4d5d-b399-504887b3b8e4";
|
12
12
|
export { API_BASE_URL, SOCKET_URL };
|
13
13
|
export { default as iconInfo } from './iconInfo';
|
14
|
+
export { default as i18ninstance } from './i18ninstance';
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAI9D,eAAO,MAAM,MAAM,SAAiC,CAAC;AAErD,eAAO,MAAM,MAAM,SAA0E,CAAC;AAE9F,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAG/C,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,eAAO,MAAM,yBAAyB,yCAAyC,CAAC;AAChF,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,CAAA;AAEjC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAI9D,eAAO,MAAM,MAAM,SAAiC,CAAC;AAErD,eAAO,MAAM,MAAM,SAA0E,CAAC;AAE9F,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAG/C,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,eAAO,MAAM,yBAAyB,yCAAyC,CAAC;AAChF,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,CAAA;AAEjC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.iconInfo = exports.SOCKET_URL = exports.API_BASE_URL = exports.DATA_SOURCE_KEY_NAMESPACE = exports.TYPE_COMPONENT = exports.HORIZONTAL_LAYOUT = exports.VERTICAL_LAYOUT = exports.DIRECTION_LEFT = exports.DIRECTION_BOTTOM = exports.DIRECTION_RIGHT = exports.DIRECTION_TOP = exports.IS_SSR = exports.isNode = void 0;
|
6
|
+
exports.i18ninstance = exports.iconInfo = exports.SOCKET_URL = exports.API_BASE_URL = exports.DATA_SOURCE_KEY_NAMESPACE = exports.TYPE_COMPONENT = exports.HORIZONTAL_LAYOUT = exports.VERTICAL_LAYOUT = exports.DIRECTION_LEFT = exports.DIRECTION_BOTTOM = exports.DIRECTION_RIGHT = exports.DIRECTION_TOP = exports.IS_SSR = exports.isNode = void 0;
|
7
7
|
const platformSpecific_1 = require("./platformSpecific");
|
8
8
|
Object.defineProperty(exports, "API_BASE_URL", { enumerable: true, get: function () { return platformSpecific_1.API_BASE_URL; } });
|
9
9
|
Object.defineProperty(exports, "SOCKET_URL", { enumerable: true, get: function () { return platformSpecific_1.SOCKET_URL; } });
|
@@ -19,4 +19,6 @@ exports.TYPE_COMPONENT = "type/component";
|
|
19
19
|
exports.DATA_SOURCE_KEY_NAMESPACE = "a0aec1c8-4fed-4d5d-b399-504887b3b8e4";
|
20
20
|
var iconInfo_1 = require("./iconInfo");
|
21
21
|
Object.defineProperty(exports, "iconInfo", { enumerable: true, get: function () { return __importDefault(iconInfo_1).default; } });
|
22
|
+
var i18ninstance_1 = require("./i18ninstance");
|
23
|
+
Object.defineProperty(exports, "i18ninstance", { enumerable: true, get: function () { return __importDefault(i18ninstance_1).default; } });
|
22
24
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.tsx"],"names":[],"mappings":";;;;;;AAAA,yDAA8D;AAoBtD,6FApBC,+BAAY,OAoBD;AAAE,2FApBC,6BAAU,OAoBD;AAhBnB,QAAA,MAAM,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC;AAExC,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A,OAAO,OAAY;AAC5B,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB"}
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const handlebars_min_js_1 = __importDefault(require("handlebars/dist/handlebars.min.js"));
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
8
8
|
const lodash_1 = require("lodash");
|
9
|
+
const i18ninstance_1 = __importDefault(require("../constants/i18ninstance"));
|
9
10
|
handlebars_min_js_1.default.registerHelper('json', function (context) {
|
10
11
|
return JSON.stringify(context, null, 2);
|
11
12
|
});
|
@@ -30,4 +31,8 @@ handlebars_min_js_1.default.registerHelper('plaintext', function (context) {
|
|
30
31
|
return '';
|
31
32
|
return context.replace(htmlTags, '');
|
32
33
|
});
|
34
|
+
// helper for translation of text
|
35
|
+
handlebars_min_js_1.default.registerHelper('t', function (key, options) {
|
36
|
+
return i18ninstance_1.default.t(key, options.hash);
|
37
|
+
});
|
33
38
|
//# sourceMappingURL=handlebarHelpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handlebarHelpers.js","sourceRoot":"","sources":["../../../src/helpers/handlebarHelpers.ts"],"names":[],"mappings":";;;;;AAAA,0FAA2D;AAC3D,oDAA4B;AAC5B,mCAA+B;AAE/B,2BAAU,CAAC,cAAc,CAAC,MAAM,EAAE,UAAS,OAAO;IAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC;AAEH,2BAAU,CAAC,cAAc,CAAC,MAAM,EAAE,UAAS,IAAI,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM;IACrE,MAAM,UAAU,GAAW,OAAO,MAAM,KAAK,QAAQ,CAAA,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;IACtE,MAAM,UAAU,GAAG,gBAAM,CAAC,IAAI,CAAC,CAAC;IAChC,IAAG,CAAC,UAAU,CAAC,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AAG,gBAAM,CAAC,IAAI,CAAC,CAAC;IAChC,IAAG,CAAC,UAAU,CAAC,OAAO,EAAE;QAAE,OAAO,IAAI,CAAC;IACtC,QAAO,UAAU,EAAC;QACd,KAAK,UAAU;YACX,OAAO,UAAU,CAAC,OAAO,EAAE,CAAC;QAChC;YACI,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KAC5C;AACL,CAAC,CAAC,CAAC;AAEH,2BAAU,CAAC,cAAc,CAAC,MAAM,EAAE,UAAS,GAAG,MAAqB;IAC/D,OAAO,gBAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA,EAAE,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,eAAe,CAAC;AACjC,2BAAU,CAAC,cAAc,CAAC,WAAW,EAAE,UAAS,OAAe;IAC3D,IAAG,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC,CAAC,CAAC;AAEH,iCAAiC;AACjC,2BAAU,CAAC,cAAc,CAAC,GAAG,EAAE,UAAS,GAAW,EAAE,OAAY;IAC7D,OAAO,sBAAY,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handlebarHelpers.test.d.ts","sourceRoot":"","sources":["../../../src/helpers/handlebarHelpers.test.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"handlebarHelpers.test.d.ts","sourceRoot":"","sources":["../../../src/helpers/handlebarHelpers.test.ts"],"names":[],"mappings":"AAIA,OAAO,oBAAoB,CAAC"}
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const chai_1 = require("chai");
|
7
7
|
const handlebars_min_js_1 = __importDefault(require("handlebars/dist/handlebars.min.js"));
|
8
8
|
const moment_1 = __importDefault(require("moment"));
|
9
|
+
const i18ninstance_1 = __importDefault(require("../constants/i18ninstance"));
|
9
10
|
require("./handlebarHelpers");
|
10
11
|
describe('Test handlebar temaplates', function () {
|
11
12
|
it('scan returns last value if none available before that', () => {
|
@@ -45,5 +46,15 @@ describe('Test handlebar temaplates', function () {
|
|
45
46
|
const templatedString = template({ now: testDate });
|
46
47
|
chai_1.expect(templatedString).to.eq(moment_1.default(testDate).fromNow());
|
47
48
|
});
|
49
|
+
it('translation', () => {
|
50
|
+
i18ninstance_1.default.addResources("en", "common", { "hello": " {{testId}} Hello my friend {{amount}}", hi: "hi friend how are you" });
|
51
|
+
i18ninstance_1.default.addResources("np", "common", { "hello": "{{testId}} Sathi k chha khabar {{amount}}?", });
|
52
|
+
i18ninstance_1.default.changeLanguage("np");
|
53
|
+
const stringValue = "{{t 'hello' amount=price testId=123 }} {{t 'cart here'}} {{t 'hi'}}";
|
54
|
+
const template = handlebars_min_js_1.default.compile(stringValue);
|
55
|
+
const templatedString = template({ price: 1024 });
|
56
|
+
// expect (templatedString).to.eq("asd")
|
57
|
+
console.log("templated:", templatedString);
|
58
|
+
});
|
48
59
|
});
|
49
60
|
//# sourceMappingURL=handlebarHelpers.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handlebarHelpers.test.js","sourceRoot":"","sources":["../../../src/helpers/handlebarHelpers.test.ts"],"names":[],"mappings":";;;;;AAAA,+BAA4B;AAC5B,0FAA2D;AAC3D,oDAA4B;AAC5B,8BAA4B;AAE5B,QAAQ,CAAC,2BAA2B,EAAE;IAClC,EAAE,CAAC,wDAAwD,EAAE,GAAE,EAAE;QAC7D,MAAM,WAAW,GAAG,gBAAgB,CAAC;QACrC,MAAM,QAAQ,GAAG,2BAAU,CAAC,OAAO,CAAC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ts","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"}
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
11
|
};
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
-
require("./handlebarHelpers");
|
13
|
+
__exportStar(require("./handlebarHelpers"), exports);
|
14
14
|
__exportStar(require("./functions"), exports);
|
15
15
|
__exportStar(require("./commonStyles"), exports);
|
16
16
|
__exportStar(require("./themeHelpers"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,8CAA4B;AAC5B,iDAA+B;AAC/B,iDAA+B;AAC/B,2CAAyB"}
|
@@ -1,25 +1,129 @@
|
|
1
1
|
export declare const generateSizeScale: (baseSize: number, variants: {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
[key: string]: number;
|
3
|
+
}) => {
|
4
|
+
[x: string]: number;
|
5
|
+
};
|
5
6
|
export declare const fontVariations: {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
xxxxs: number;
|
8
|
+
xxxs: number;
|
9
|
+
xxs: number;
|
10
|
+
xs: number;
|
11
|
+
sm: number;
|
12
|
+
md: number;
|
13
|
+
lg: number;
|
14
|
+
xl: number;
|
15
|
+
xxl: number;
|
16
|
+
xxxl: number;
|
17
|
+
xxxxl: number;
|
18
|
+
xxxxxl: number;
|
19
|
+
xxxxxxl: number;
|
20
|
+
xxxxxxxl: number;
|
21
|
+
xxxxxxxxl: number;
|
22
|
+
xxxxxxxxxl: number;
|
23
|
+
};
|
24
|
+
declare type FontVariants = typeof fontVariations;
|
25
|
+
declare type FontSize = keyof FontVariants;
|
26
|
+
export declare const generateFontSizes: (baseFontSize: number) => {
|
27
|
+
[x: string]: number;
|
28
|
+
};
|
10
29
|
export declare const lineHeightVariants: {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
30
|
+
xxxxs: number;
|
31
|
+
xxxs: number;
|
32
|
+
xxs: number;
|
33
|
+
xs: number;
|
34
|
+
sm: number;
|
35
|
+
md: number;
|
36
|
+
lg: number;
|
37
|
+
xl: number;
|
38
|
+
xxl: number;
|
39
|
+
xxxl: number;
|
40
|
+
xxxxl: number;
|
41
|
+
xxxxxl: number;
|
42
|
+
xxxxxxl: number;
|
43
|
+
xxxxxxxl: number;
|
44
|
+
xxxxxxxxl: number;
|
45
|
+
xxxxxxxxxl: number;
|
46
|
+
};
|
47
|
+
declare type LineHeightVariants = typeof lineHeightVariants;
|
48
|
+
declare type LineHeight = keyof LineHeightVariants;
|
49
|
+
export declare const generateLineHeights: (baseFontSize: number) => {
|
50
|
+
[x: string]: number;
|
51
|
+
};
|
15
52
|
export declare const spacingVariations: {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
53
|
+
none: number;
|
54
|
+
xxxxxxxs: number;
|
55
|
+
xxxxxxs: number;
|
56
|
+
xxxxxs: number;
|
57
|
+
xxxxs: number;
|
58
|
+
xxxs: number;
|
59
|
+
xxs: number;
|
60
|
+
xs: number;
|
61
|
+
sm: number;
|
62
|
+
md: number;
|
63
|
+
lg: number;
|
64
|
+
xl: number;
|
65
|
+
xxl: number;
|
66
|
+
xxxl: number;
|
67
|
+
xxxxl: number;
|
68
|
+
xxxxxl: number;
|
69
|
+
xxxxxxl: number;
|
70
|
+
xxxxxxxl: number;
|
71
|
+
};
|
72
|
+
declare type SpaceVariants = typeof fontVariations;
|
73
|
+
declare type Space = keyof SpaceVariants;
|
74
|
+
export declare const generateSpacingSizes: (baseSpacing: number) => {
|
75
|
+
[x: string]: number;
|
76
|
+
};
|
77
|
+
declare const colors: {
|
78
|
+
white: string;
|
79
|
+
black: string;
|
80
|
+
primary: string;
|
81
|
+
secondary: string;
|
82
|
+
success: string;
|
83
|
+
info: string;
|
84
|
+
warning: string;
|
85
|
+
danger: string;
|
86
|
+
grey: string;
|
87
|
+
};
|
88
|
+
declare type BaseColors = typeof colors;
|
89
|
+
declare type BaseColor = keyof BaseColors;
|
90
|
+
declare const colorShades: {
|
91
|
+
0: number;
|
92
|
+
50: number;
|
93
|
+
100: number;
|
94
|
+
200: number;
|
95
|
+
300: number;
|
96
|
+
400: number;
|
97
|
+
500: number;
|
98
|
+
600: number;
|
99
|
+
700: number;
|
100
|
+
800: number;
|
101
|
+
900: number;
|
102
|
+
};
|
103
|
+
declare type ColorShades = typeof colorShades;
|
104
|
+
export declare type ColorShade = keyof ColorShades;
|
105
|
+
declare type ShadeableColor = Exclude<BaseColor, 'white' | 'black'>;
|
106
|
+
declare type ShadedColor = `${ShadeableColor}-shade-${ColorShade}`;
|
107
|
+
export declare type Color = BaseColor | ShadedColor;
|
20
108
|
export declare function getColorVariants(colors: {
|
21
109
|
[colorName: string]: string;
|
22
110
|
}): {
|
23
111
|
[colorName: string]: string;
|
24
112
|
};
|
113
|
+
export interface Theme {
|
114
|
+
space: {
|
115
|
+
[key in Space]: string;
|
116
|
+
};
|
117
|
+
fontSizes: {
|
118
|
+
[key in FontSize]: string;
|
119
|
+
};
|
120
|
+
lineHeights: {
|
121
|
+
[key in LineHeight]: string;
|
122
|
+
};
|
123
|
+
colors: {
|
124
|
+
[key in Color]: string;
|
125
|
+
};
|
126
|
+
fontSize: number;
|
127
|
+
}
|
128
|
+
export {};
|
25
129
|
//# sourceMappingURL=themeHelpers.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"themeHelpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/themeHelpers.tsx"],"names":[],"mappings":"AA+BA,eAAO,MAAM,iBAAiB,aAAa,MAAM,
|
1
|
+
{"version":3,"file":"themeHelpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/themeHelpers.tsx"],"names":[],"mappings":"AA+BA,eAAO,MAAM,iBAAiB,aAAa,MAAM;;;;CAAqF,CAAC;AAGvI,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;CAiB1B,CAAA;AAED,aAAK,YAAY,GAAG,OAAO,cAAc,CAAC;AAC1C,aAAK,QAAQ,GAAG,MAAM,YAAY,CAAC;AAEnC,eAAO,MAAM,iBAAiB,iBAAkB,MAAM;;CAAoD,CAAC;AAG3G,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;CAAwC,CAAC;AACxE,aAAK,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AACpD,aAAK,UAAU,GAAG,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,mBAAmB,iBAAkB,MAAM;;CAAwD,CAAC;AAIjH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;CAmB7B,CAAC;AAEF,aAAK,aAAa,GAAG,OAAO,cAAc,CAAC;AAC3C,aAAK,KAAK,GAAG,MAAM,aAAa,CAAC;AAEjC,eAAO,MAAM,oBAAoB,gBAAiB,MAAM;;CAAsD,CAAC;AAE/G,QAAA,MAAM,MAAM;;;;;;;;;;CAUX,CAAA;AAED,aAAK,UAAU,GAAG,OAAO,MAAM,CAAC;AAEhC,aAAK,SAAS,GAAG,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,WAAW;;;;;;;;;;;;CAcd,CAAA;AAEH,aAAK,WAAW,GAAG,OAAO,WAAW,CAAC;AAEtC,oBAAY,UAAU,GAAG,MAAM,WAAW,CAAC;AAE3C,aAAK,cAAc,GAAG,OAAO,CAAC,SAAS,EAAE,OAAO,GAAC,OAAO,CAAC,CAAC;AAC1D,aAAK,WAAW,GAAG,GAAG,cAAc,UAAU,UAAU,EAAE,CAAA;AAE1D,oBAAY,KAAK,GAAG,SAAS,GAAG,WAAW,CAAC;AAqB5C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC;;EAuCrE;AAED,MAAM,WAAW,KAAK;IAClB,KAAK,EAAE;SAAE,GAAG,IAAI,KAAK,GAAG,MAAM;KAAC,CAAC;IAChC,SAAS,EAAE;SAAE,GAAG,IAAI,QAAQ,GAAG,MAAM;KAAC,CAAC;IACvC,WAAW,EAAE;SAAE,GAAG,IAAI,UAAU,GAAG,MAAM;KAAC,CAAC;IAC3C,MAAM,EAAE;SAAE,GAAG,IAAI,KAAK,GAAG,MAAM;KAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CACpB"}
|
@@ -23,59 +23,67 @@ function darkenRgb(hex, intensity) {
|
|
23
23
|
const b = Math.round(color.blue * (1 - intensity));
|
24
24
|
return polished_1.rgb(r, g, b);
|
25
25
|
}
|
26
|
-
const generateSizeScale = (baseSize, variants) =>
|
27
|
-
sizes[name] = baseSize * scale;
|
28
|
-
return sizes;
|
29
|
-
}, {});
|
26
|
+
const generateSizeScale = (baseSize, variants) => lodash_1.mapValues(variants, scale => scale * baseSize);
|
30
27
|
exports.generateSizeScale = generateSizeScale;
|
31
28
|
// font sizes
|
32
|
-
exports.fontVariations =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
29
|
+
exports.fontVariations = {
|
30
|
+
'xxxxs': 10 / 15,
|
31
|
+
'xxxs': 11 / 15,
|
32
|
+
'xxs': 12 / 15,
|
33
|
+
'xs': 13 / 15,
|
34
|
+
'sm': 14 / 15,
|
35
|
+
'md': 15 / 15,
|
36
|
+
'lg': 16 / 15,
|
37
|
+
'xl': 17 / 15,
|
38
|
+
'xxl': 20 / 15,
|
39
|
+
'xxxl': 24 / 15,
|
40
|
+
'xxxxl': 27 / 15,
|
41
|
+
'xxxxxl': 32 / 15,
|
42
|
+
'xxxxxxl': 48 / 15,
|
43
|
+
'xxxxxxxl': 60 / 15,
|
44
|
+
'xxxxxxxxl': 76 / 15,
|
45
|
+
'xxxxxxxxxl': 94 / 15
|
46
|
+
};
|
50
47
|
const generateFontSizes = (baseFontSize) => exports.generateSizeScale(baseFontSize, exports.fontVariations);
|
51
48
|
exports.generateFontSizes = generateFontSizes;
|
52
49
|
// line heights for font
|
53
|
-
exports.lineHeightVariants = exports.fontVariations
|
50
|
+
exports.lineHeightVariants = lodash_1.mapValues(exports.fontVariations, f => f * 1.6);
|
54
51
|
const generateLineHeights = (baseFontSize) => exports.generateSizeScale(baseFontSize, exports.lineHeightVariants);
|
55
52
|
exports.generateLineHeights = generateLineHeights;
|
56
53
|
// spacing
|
57
|
-
exports.spacingVariations =
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
54
|
+
exports.spacingVariations = {
|
55
|
+
'none': 0 / 20,
|
56
|
+
'xxxxxxxs': 1 / 20,
|
57
|
+
'xxxxxxs': 2 / 20,
|
58
|
+
'xxxxxs': 4 / 20,
|
59
|
+
'xxxxs': 5 / 20,
|
60
|
+
'xxxs': 8 / 20,
|
61
|
+
'xxs': 10 / 20,
|
62
|
+
'xs': 16 / 20,
|
63
|
+
'sm': 18 / 20,
|
64
|
+
'md': 20 / 20,
|
65
|
+
'lg': 24 / 20,
|
66
|
+
'xl': 28 / 20,
|
67
|
+
'xxl': 32 / 20,
|
68
|
+
'xxxl': 36 / 20,
|
69
|
+
'xxxxl': 40 / 20,
|
70
|
+
'xxxxxl': 48 / 20,
|
71
|
+
'xxxxxxl': 60 / 20,
|
72
|
+
'xxxxxxxl': 72 / 20
|
73
|
+
};
|
77
74
|
const generateSpacingSizes = (baseSpacing) => exports.generateSizeScale(baseSpacing, exports.spacingVariations);
|
78
75
|
exports.generateSpacingSizes = generateSpacingSizes;
|
76
|
+
const colors = {
|
77
|
+
white: "#ffffff",
|
78
|
+
black: "#1e1e1e",
|
79
|
+
primary: '#008f7b',
|
80
|
+
secondary: '#008f7b',
|
81
|
+
success: '#008f7b',
|
82
|
+
info: '#008f7b',
|
83
|
+
warning: '#ff00ff',
|
84
|
+
danger: '#ff0000',
|
85
|
+
grey: '#696969'
|
86
|
+
};
|
79
87
|
const colorShades = {
|
80
88
|
// whiten
|
81
89
|
0: 0,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"themeHelpers.js","sourceRoot":"","sources":["../../../src/helpers/themeHelpers.tsx"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"themeHelpers.js","sourceRoot":"","sources":["../../../src/helpers/themeHelpers.tsx"],"names":[],"mappings":";;;AAAA,mCAAkE;AAClE,uCAAiH;AAEjH,SAAS,UAAU,CAAC,GAAG,EAAE,SAAS;IAC9B,MAAM,KAAK,GAAG,qBAAU,CAAC,GAAG,CAAC,CAAC;IAE9B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAC;KACX;IAED,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;IAChE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,KAAK,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oBACV,KAAK,QAAQ;wBACT,MAAM,YAAY,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC;wBAChD,WAAW,GAAG,iBAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;wBAChD,MAAM;oBACV,KAAK,gBAAgB;wBACjB,MAAM,oBAAoB,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC;wBACxD,WAAW,GAAG,yBAAc,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;wBAChE,MAAM;oBACV,KAAK,QAAQ;wBACT,WAAW,GAAG,iBAAM,CAAC,WAAW,CAAC,CAAC;wBAClC,MAAM;oBACV,KAAK,WAAW;wBACZ,WAAW,GAAG,oBAAS,CAAC,WAAW,CAAC,CAAC;wBACrC,MAAM;oBACV,KAAK,OAAO;wBACR,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC;wBACvC,WAAW,GAAG,2BAA2B,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,CAAA;oBACvE,QAAQ;iBACX;aACJ;YAED,OAAO,WAAW,CAAC;QACvB,CAAC;QACD,GAAG,KAAI,OAAO,KAAK,CAAA,CAAC,CAAC;KACxB,CAAC,CAAA;AACN,CAAC;AAvCD,4CAuCC"}
|
@@ -7,6 +7,7 @@ export * from './useScope';
|
|
7
7
|
export * from './useComponentData';
|
8
8
|
export * from './useTemplate';
|
9
9
|
export * from './useTheme';
|
10
|
+
export * from './useTranslation';
|
10
11
|
export * from './useUrl';
|
11
12
|
export * from './useFocus';
|
12
13
|
export * from './useFonts';
|
@@ -21,6 +22,7 @@ export * from './useMenuItems';
|
|
21
22
|
export * from './useEditable';
|
22
23
|
export * from './usePage';
|
23
24
|
export * from './useParams';
|
25
|
+
export * from './useActionable';
|
24
26
|
export * from './useAction';
|
25
27
|
export * from './usePastePlainText';
|
26
28
|
export * from './useResponsive';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
package/dist/src/hooks/index.js
CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./useScope"), exports);
|
|
19
19
|
__exportStar(require("./useComponentData"), exports);
|
20
20
|
__exportStar(require("./useTemplate"), exports);
|
21
21
|
__exportStar(require("./useTheme"), exports);
|
22
|
+
__exportStar(require("./useTranslation"), exports);
|
22
23
|
__exportStar(require("./useUrl"), exports);
|
23
24
|
__exportStar(require("./useFocus"), exports);
|
24
25
|
__exportStar(require("./useFonts"), exports);
|
@@ -33,6 +34,7 @@ __exportStar(require("./useMenuItems"), exports);
|
|
33
34
|
__exportStar(require("./useEditable"), exports);
|
34
35
|
__exportStar(require("./usePage"), exports);
|
35
36
|
__exportStar(require("./useParams"), exports);
|
37
|
+
__exportStar(require("./useActionable"), exports);
|
36
38
|
__exportStar(require("./useAction"), exports);
|
37
39
|
__exportStar(require("./usePastePlainText"), exports);
|
38
40
|
__exportStar(require("./useResponsive"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yDAAuC;AACvC,8CAA4B;AAC5B,kDAAgC;AAChC,4CAA0B;AAC1B,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,6CAA2B;AAC3B,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,gEAA8C;AAC9C,6DAA2C;AAC3C,4DAA0C;AAC1C,oDAAkC;AAClC,iDAA+B;AAC/B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,8CAA4B;AAC5B,sDAAoC;AACpC,kDAAgC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yDAAuC;AACvC,8CAA4B;AAC5B,kDAAgC;AAChC,4CAA0B;AAC1B,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B;AAC3B,mDAAiC;AACjC,2CAAyB;AACzB,6CAA2B;AAC3B,6CAA2B;AAC3B,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,gEAA8C;AAC9C,6DAA2C;AAC3C,4DAA0C;AAC1C,oDAAkC;AAClC,iDAA+B;AAC/B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,kDAAgC;AAChC,8CAA4B;AAC5B,sDAAoC;AACpC,kDAAgC"}
|
@@ -1,18 +1,9 @@
|
|
1
|
+
import { Action } from './useActionable';
|
1
2
|
/**
|
2
3
|
* get a action function for
|
3
4
|
* @param action action object ot function
|
4
5
|
* @returns function
|
5
6
|
*/
|
6
|
-
|
7
|
-
link: string;
|
8
|
-
bindKey: string;
|
9
|
-
route: string;
|
10
|
-
navigate: Array<string> | string;
|
11
|
-
page: Array<string> | string;
|
12
|
-
dispatch: Object | Function;
|
13
|
-
callback: Function;
|
14
|
-
}
|
15
|
-
declare type Action = ActionObject | Function | any;
|
16
|
-
export declare const useAction: (action: Action) => (event: any) => any;
|
7
|
+
export declare const useAction: (action?: Action) => (event: any) => any;
|
17
8
|
export default useAction;
|
18
9
|
//# sourceMappingURL=useAction.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useAction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"useAction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":"AACA,OAAsB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGxD;;;;GAIG;AAEH,eAAO,MAAM,SAAS,YAAa,MAAM,wBAIxC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
@@ -5,45 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.useAction = void 0;
|
7
7
|
const react_1 = require("react");
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
const useActionable_1 = __importDefault(require("./useActionable"));
|
9
|
+
// link, callback, dispatch, navigate
|
10
|
+
/**
|
11
|
+
* get a action function for
|
12
|
+
* @param action action object ot function
|
13
|
+
* @returns function
|
14
|
+
*/
|
14
15
|
const useAction = (action) => {
|
15
|
-
const
|
16
|
-
|
17
|
-
const scope = useScope_1.useScope();
|
18
|
-
const template = useTemplate_1.default();
|
19
|
-
return react_1.useCallback((event) => {
|
20
|
-
let actionToUse = action;
|
21
|
-
while (actionToUse && actionToUse.bindKey) {
|
22
|
-
actionToUse = lodash_1.get(scope, actionToUse.bindKey);
|
23
|
-
}
|
24
|
-
if (typeof actionToUse === 'function')
|
25
|
-
return actionToUse(event);
|
26
|
-
if (actionToUse) {
|
27
|
-
const { link, navigate, push, page, params, dispatch: dispatchAction, route, callback } = actionToUse;
|
28
|
-
if (link)
|
29
|
-
return navigator.openURL(template(link));
|
30
|
-
if (navigate)
|
31
|
-
return navigator.navigate(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
32
|
-
if (push)
|
33
|
-
return navigator.push(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
34
|
-
if (page) {
|
35
|
-
const routeParams = lodash_2.mapValues(params, (paramValue) => template(paramValue.toString()));
|
36
|
-
return navigator.openPage(page, routeParams);
|
37
|
-
}
|
38
|
-
;
|
39
|
-
if (route)
|
40
|
-
return navigator.openRoute(template(route));
|
41
|
-
if (dispatchAction)
|
42
|
-
return dispatch(dispatchAction);
|
43
|
-
if (callback)
|
44
|
-
return callback({ event, navigator, dispatch });
|
45
|
-
}
|
46
|
-
}, [action, navigator, dispatch, template, scope]);
|
16
|
+
const createActionHandeller = useActionable_1.default();
|
17
|
+
return react_1.useMemo(() => createActionHandeller(action), [action, createActionHandeller]);
|
47
18
|
};
|
48
19
|
exports.useAction = useAction;
|
49
20
|
exports.default = exports.useAction;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":";;;;;;AAAA,
|
1
|
+
{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAAgC;AAChC,oEAAwD;AAExD,qCAAqC;AACrC;;;;GAIG;AAEI,MAAM,SAAS,GAAG,CAAC,MAAe,EAAC,EAAE;IACxC,MAAM,qBAAqB,GAAG,uBAAa,EAAE,CAAC;IAE9C,OAAO,eAAO,CAAC,GAAE,EAAE,CAAA,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAJW,QAAA,SAAS,aAIpB;AAEF,kBAAe,iBAAS,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* get a action function for
|
3
|
+
* @param action action object ot function
|
4
|
+
* @returns function
|
5
|
+
*/
|
6
|
+
export interface ActionObject {
|
7
|
+
link: string;
|
8
|
+
bindKey: string;
|
9
|
+
route: string;
|
10
|
+
navigate: Array<string> | string;
|
11
|
+
page: Array<string> | string;
|
12
|
+
dispatch: Object | Function;
|
13
|
+
callback: Function;
|
14
|
+
}
|
15
|
+
export declare type Action = ActionObject | Function | any;
|
16
|
+
/**
|
17
|
+
* @description a function to map action into action handeller function
|
18
|
+
*/
|
19
|
+
export declare const useActionable: () => (action: Action) => (event: any) => any;
|
20
|
+
export default useActionable;
|
21
|
+
//# sourceMappingURL=useActionable.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useActionable.d.ts","sourceRoot":"","sources":["../../../src/hooks/useActionable.tsx"],"names":[],"mappings":"AASA;;;;GAIG;AAEF,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAED,oBAAY,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,GAAG,CAAA;AAElD;;GAEG;AACJ,eAAO,MAAM,aAAa,iBAM8B,MAAM,aAAa,GAAG,QA0B7E,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.useActionable = void 0;
|
7
|
+
const react_1 = require("react");
|
8
|
+
const react_redux_1 = require("react-redux");
|
9
|
+
const lodash_1 = require("lodash");
|
10
|
+
const useNavigator_1 = require("./useNavigator");
|
11
|
+
const useScope_1 = require("./useScope");
|
12
|
+
const useTemplate_1 = __importDefault(require("./useTemplate"));
|
13
|
+
const lodash_2 = require("lodash");
|
14
|
+
/**
|
15
|
+
* @description a function to map action into action handeller function
|
16
|
+
*/
|
17
|
+
const useActionable = () => {
|
18
|
+
const navigator = useNavigator_1.useNavigator();
|
19
|
+
const dispatch = react_redux_1.useDispatch();
|
20
|
+
const scope = useScope_1.useScope();
|
21
|
+
const template = useTemplate_1.default();
|
22
|
+
const createActionHandeller = react_1.useCallback((action) => (event) => {
|
23
|
+
let actionToUse = action;
|
24
|
+
while (actionToUse && actionToUse.bindKey) {
|
25
|
+
actionToUse = lodash_1.get(scope, actionToUse.bindKey);
|
26
|
+
}
|
27
|
+
if (typeof actionToUse === 'function')
|
28
|
+
return actionToUse(event);
|
29
|
+
if (actionToUse) {
|
30
|
+
const { link, navigate, push, page, params, dispatch: dispatchAction, route, callback } = actionToUse;
|
31
|
+
if (link)
|
32
|
+
return navigator.openURL(template(link));
|
33
|
+
if (navigate)
|
34
|
+
return navigator.navigate(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
35
|
+
if (push)
|
36
|
+
return navigator.push(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
37
|
+
if (page) {
|
38
|
+
const routeParams = lodash_2.mapValues(params, (paramValue) => template(paramValue.toString()));
|
39
|
+
return navigator.openPage(page, routeParams);
|
40
|
+
}
|
41
|
+
;
|
42
|
+
if (route)
|
43
|
+
return navigator.openRoute(template(route));
|
44
|
+
if (dispatchAction)
|
45
|
+
return dispatch(dispatchAction);
|
46
|
+
if (callback)
|
47
|
+
return callback({ event, navigator, dispatch });
|
48
|
+
}
|
49
|
+
}, [navigator, dispatch, template, scope]);
|
50
|
+
return createActionHandeller;
|
51
|
+
};
|
52
|
+
exports.useActionable = useActionable;
|
53
|
+
exports.default = exports.useActionable;
|
54
|
+
//# sourceMappingURL=useActionable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useActionable.js","sourceRoot":"","sources":["../../../src/hooks/useActionable.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAA6C;AAC7C,6CAA0C;AAC1C,mCAAwC;AACxC,iDAA4C;AAC5C,yCAAo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IAAI,IAAI,EAAC;gBACL,MAAM,WAAW,GAAG,kBAAS,CAAC,MAAM,EAAE,CAAC,UAAiB,EAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;gBAC5F,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;aAC/C;YAAA,CAAC;YACF,IAAI,KAAK;gBAAE,OAAO,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACvD,IAAI,cAAc;gBAAE,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC;YACpD,IAAI,QAAQ;gBAAE,OAAO,QAAQ,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAC,CAAC,CAAC;SAC/D;IACL,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3C,OAAO,qBAAqB,CAAC;AACjC,CAAC,CAAC;AAhCW,QAAA,aAAa,iBAgCxB;AAEF,kBAAe,qBAAa,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTheme.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,aAAK,YAAY,GAAG,MAAM,KAAK,CAAA;AAE/B,eAAO,MAAM,QAAQ,EAAE,YAAyB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../../src/hooks/useTheme.tsx"],"names":[],"mappings":";;;AAAA,yDAA2D;
|
1
|
+
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../../src/hooks/useTheme.tsx"],"names":[],"mappings":";;;AAAA,yDAA2D;AAK9C,QAAA,QAAQ,GAAiB,4BAAU,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTranslation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC,eAAO,MAAM,cAAc,iBAM1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.useTranslation = void 0;
|
7
|
+
const react_1 = require("react");
|
8
|
+
const i18ninstance_1 = __importDefault(require("../constants/i18ninstance"));
|
9
|
+
const useTranslation = () => {
|
10
|
+
const translate = react_1.useCallback((key, options) => {
|
11
|
+
return i18ninstance_1.default.t(key, options);
|
12
|
+
}, []);
|
13
|
+
return translate;
|
14
|
+
};
|
15
|
+
exports.useTranslation = useTranslation;
|
16
|
+
exports.default = exports.useTranslation;
|
17
|
+
//# sourceMappingURL=useTranslation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTranslation.js","sourceRoot":"","sources":["../../../src/hooks/useTranslation.tsx"],"names":[],"mappings":";;;;;;AACA,iCAAoC;AACpC,6EAAqD;AAE9C,MAAM,cAAc,GAAG,GAAE,EAAE;IAC9B,MAAM,SAAS,GAAc,mBAAW,CAAC,CAAC,GAAQ,EAAE,OAAa,EAAC,EAAE;QAChE,OAAO,sBAAY,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACvC,CAAC,EAAG,EAAE,CAAC,CAAA;IAEP,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEF,kBAAe,sBAAc,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export declare const ADD_SETTINGS_FIELD = "ADD_SETTINGS_FIELD";
|
2
2
|
export declare const ADD_SITE_PAGE = "ADD_SITE_PAGE";
|
3
3
|
export declare const UPDATE_THEME = "UPDATE_SITE_THEME";
|
4
|
-
export declare const
|
4
|
+
export declare const SET_CONFIG = "SET_CONFIG";
|
5
5
|
export declare const GET_CONFIG_REQUEST = "GET_CONFIG_REQUEST";
|
6
6
|
export declare const GET_CONFIG_SUCCESS = "GET_CONFIG_SUCCESS";
|
7
7
|
export declare const GET_CONFIG_FAILURE = "GET_CONFIG_FAILURE";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,YAAY,sBAAsB,CAAC;AAChD,eAAO,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,YAAY,sBAAsB,CAAC;AAChD,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,wBAAgB,gBAAgB,CAAC,KAAK,KAAA,EAAE,UAAU,SAAQ;;;;EAMzD;AAED,eAAO,MAAM,SAAS;;;;;;;;;CAOpB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;CAQrB,CAAC;AAEH,aAAK,WAAW,GAAG;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,CAAC;AAE9C,QAAA,MAAM,MAAM;;;CA6BX,CAAA;AAID,eAAe,MAAM,CAAC"}
|
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.saveConfig = exports.getConfig = exports.addSettingsField = exports.SAVE_CONFIG_FAILURE = exports.SAVE_CONFIG_SUCCESS = exports.SAVE_CONFIG_REQUEST = exports.GET_CONFIG_FAILURE = exports.GET_CONFIG_SUCCESS = exports.GET_CONFIG_REQUEST = exports.
|
6
|
+
exports.saveConfig = exports.getConfig = exports.addSettingsField = exports.SAVE_CONFIG_FAILURE = exports.SAVE_CONFIG_SUCCESS = exports.SAVE_CONFIG_REQUEST = exports.GET_CONFIG_FAILURE = exports.GET_CONFIG_SUCCESS = exports.GET_CONFIG_REQUEST = exports.SET_CONFIG = exports.UPDATE_THEME = exports.ADD_SITE_PAGE = exports.ADD_SETTINGS_FIELD = void 0;
|
7
7
|
const redux_rest_1 = require("@mukti107/redux-rest");
|
8
8
|
const lodash_1 = require("lodash");
|
9
9
|
const initialState_1 = __importDefault(require("./initialState"));
|
10
10
|
exports.ADD_SETTINGS_FIELD = 'ADD_SETTINGS_FIELD';
|
11
11
|
exports.ADD_SITE_PAGE = 'ADD_SITE_PAGE';
|
12
12
|
exports.UPDATE_THEME = 'UPDATE_SITE_THEME';
|
13
|
-
exports.
|
13
|
+
exports.SET_CONFIG = 'SET_CONFIG';
|
14
14
|
exports.GET_CONFIG_REQUEST = 'GET_CONFIG_REQUEST';
|
15
15
|
exports.GET_CONFIG_SUCCESS = 'GET_CONFIG_SUCCESS';
|
16
16
|
exports.GET_CONFIG_FAILURE = 'GET_CONFIG_FAILURE';
|
@@ -49,8 +49,8 @@ const config = (state = initialState_1.default, action) => {
|
|
49
49
|
case exports.SAVE_CONFIG_SUCCESS:
|
50
50
|
case exports.GET_CONFIG_SUCCESS:
|
51
51
|
return Object.assign(Object.assign({}, state), { data: Object.assign(Object.assign({}, state.data), { [action.configName]: action.response }) });
|
52
|
-
case exports.
|
53
|
-
return Object.assign(Object.assign({}, state), { data: lodash_1.set(lodash_1.cloneDeep(state.data)
|
52
|
+
case exports.SET_CONFIG:
|
53
|
+
return Object.assign(Object.assign({}, state), { data: lodash_1.reduce(action.values, (oldState, value, path) => lodash_1.set(oldState, path, value), lodash_1.cloneDeep(state.data)) });
|
54
54
|
case exports.ADD_SETTINGS_FIELD: {
|
55
55
|
const { fields: { [action.configName]: fields = [] } } = state;
|
56
56
|
return Object.assign(Object.assign({}, state), { fields: Object.assign(Object.assign({}, state.fields), { [action.configName]: [...fields, action.field] }) });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAAgD;AAChD,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAAgD;AAChD,mCAAgD;AAChD,kEAAgD;AAEnC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,YAAY,GAAG,mBAAmB,CAAC;AACnC,QAAA,UAAU,GAAG,YAAY,CAAC;AAE1B,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAE1C,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,mBAAmB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AG,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,kBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAC3G;QACN,KAAK,0BAAkB,CAAC,CAAA;YACpB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;YAC/D,uCACO,KAAK,KACR,MAAM,kCACC,KAAK,CAAC,MAAM,KACf,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,KAAK,CAAE,OAErD;SACL;QACD;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;AAEtB,kBAAe,MAAM,CAAC"}
|
@@ -21,7 +21,7 @@ export interface Notification {
|
|
21
21
|
/**
|
22
22
|
* @description where should the notification be displayed
|
23
23
|
*/
|
24
|
-
position: 'top' | 'top-right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'top-left'
|
24
|
+
position: 'top' | 'top-right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'top-left';
|
25
25
|
/**
|
26
26
|
* Action buttons for notification
|
27
27
|
*/
|
@@ -42,9 +42,12 @@ export interface Notification {
|
|
42
42
|
*/
|
43
43
|
export declare const showNotification: (notification: Notification) => {
|
44
44
|
type: string;
|
45
|
-
notification:
|
45
|
+
notification: {
|
46
46
|
id: string;
|
47
|
-
|
47
|
+
timeout: number;
|
48
|
+
type: string;
|
49
|
+
position: string;
|
50
|
+
} & Notification;
|
48
51
|
};
|
49
52
|
export declare const removeNotification: (id: any) => {
|
50
53
|
type: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/reducers/notifications.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,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;;;CAG7B,CAAC;gCAIoB,MAAM,YAAY,CAAC;AAA1C,wBAgBC"}
|
@@ -11,7 +11,7 @@ exports.REMOVE_NOTIFICATION = 'notification/remove';
|
|
11
11
|
*/
|
12
12
|
const showNotification = (notification) => ({
|
13
13
|
type: exports.SHOW_NOTIFICATION,
|
14
|
-
notification: lodash_1.
|
14
|
+
notification: lodash_1.defaults(notification, { id: lodash_1.random(Number.MAX_SAFE_INTEGER).toString(36), timeout: 5000, type: 'info', position: 'bottom-right' }),
|
15
15
|
});
|
16
16
|
exports.showNotification = showNotification;
|
17
17
|
const removeNotification = (id) => ({
|
@@ -23,10 +23,15 @@ let initialState = [];
|
|
23
23
|
exports.default = (state = initialState, action) => {
|
24
24
|
switch (action.type) {
|
25
25
|
case exports.SHOW_NOTIFICATION:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
const notification = action.notification;
|
27
|
+
if (lodash_1.some(state, { id: notification.id })) {
|
28
|
+
// replace notification if notification with same id already exists
|
29
|
+
return state.map(_notification => notification.id === _notification.id ? notification : _notification);
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
// append notification to state
|
33
|
+
return [...state, action.notification,];
|
34
|
+
}
|
30
35
|
case exports.REMOVE_NOTIFICATION:
|
31
36
|
return state.filter(m => m.id !== action.id);
|
32
37
|
default:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/reducers/notifications.tsx"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/reducers/notifications.tsx"],"names":[],"mappings":";;;AAAA,mCAAgE;AAEnD,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAsCzD;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,YAA0B,EAAC,EAAE,CAAA,CAAC;IAC3D,IAAI,EAAE,yBAAiB;IACvB,YAAY,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op/commons",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.124",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/main.js",
|
6
6
|
"peerDependencies": {
|
7
7
|
"@mukti107/redux-rest": "^1.0.20",
|
8
|
-
"handlebars": "
|
9
|
-
"
|
8
|
+
"handlebars": "^4.7.6",
|
9
|
+
"i18next": "^21.8.8",
|
10
|
+
"change-case": "^4.1.1",
|
10
11
|
"lodash": "latest",
|
11
12
|
"polished": "latest",
|
12
13
|
"react": "latest",
|
@@ -52,6 +53,8 @@
|
|
52
53
|
"@types/uuid": "^8.3.4",
|
53
54
|
"chai": "^4.3.4",
|
54
55
|
"change-case": "^4.1.2",
|
56
|
+
"handlebars": "^4.7.7",
|
57
|
+
"i18next": "^21.8.8",
|
55
58
|
"jest": "^26.6.3",
|
56
59
|
"lodash": "^4.17.21",
|
57
60
|
"mocha": "^8.4.0",
|