@bigbinary/neeto-commons-frontend 4.8.12 → 4.10.2
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/README.md +1 -0
- package/configs/webpack/resolve.js +1 -0
- package/dist/cjs/utils/index.js +2 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/loadGoogleFonts.js +13 -0
- package/dist/cjs/utils/loadGoogleFonts.js.map +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/loadGoogleFonts.js +11 -0
- package/dist/utils/loadGoogleFonts.js.map +1 -0
- package/package.json +1 -1
- package/utils.d.ts +18 -1
package/README.md
CHANGED
|
@@ -135,6 +135,7 @@ Web utility functions [↗](./docs/utils/README.md)
|
|
|
135
135
|
- [captureAnalyticsEvent](./docs/utils/captureAnalyticsEvent.md)
|
|
136
136
|
- [captureAnalyticsPageView](./docs/utils/captureAnalyticsPageView.md)
|
|
137
137
|
- [buildNestedAttributesPayload](./docs/utils/buildNestedAttributesPayload.md)
|
|
138
|
+
- [loadGoogleFonts](./docs/utils/loadGoogleFonts.md)
|
|
138
139
|
|
|
139
140
|
</td>
|
|
140
141
|
|
|
@@ -25,6 +25,7 @@ module.exports = {
|
|
|
25
25
|
neetopayments: "@bigbinary/neeto-payments-frontend",
|
|
26
26
|
neetocist: "@bigbinary/neeto-cist",
|
|
27
27
|
neetohotkeys: "@bigbinary/neeto-hotkeys",
|
|
28
|
+
"rc-picker": "@bigbinary/neeto-datepicker",
|
|
28
29
|
images: path.resolve(__dirname, "../../../../../", "app/assets/images"),
|
|
29
30
|
},
|
|
30
31
|
extensions: [
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var utils_validators_slug = require('./validators/slug.js');
|
|
|
10
10
|
var utils_captureAnalyticsEvent = require('./captureAnalyticsEvent.js');
|
|
11
11
|
var utils_captureAnalyticsPageView = require('./captureAnalyticsPageView.js');
|
|
12
12
|
var utils_buildNestedAttributesPayload = require('./buildNestedAttributesPayload.js');
|
|
13
|
+
var utils_loadGoogleFonts = require('./loadGoogleFonts.js');
|
|
13
14
|
var utils_dayjs = require('./dayjs.js');
|
|
14
15
|
require('axios');
|
|
15
16
|
require('../initializers/constants.js');
|
|
@@ -60,5 +61,6 @@ exports.slugValidator = utils_validators_slug.slugValidator;
|
|
|
60
61
|
exports.captureAnalyticsEvent = utils_captureAnalyticsEvent.captureAnalyticsEvent;
|
|
61
62
|
exports.captureAnalyticsPageView = utils_captureAnalyticsPageView.captureAnalyticsPageView;
|
|
62
63
|
exports.buildNestedAttributesPayload = utils_buildNestedAttributesPayload.buildNestedAttributesPayload;
|
|
64
|
+
exports.loadGoogleFonts = utils_loadGoogleFonts.loadGoogleFonts;
|
|
63
65
|
exports.dayjs = utils_dayjs;
|
|
64
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var loadGoogleFonts = function loadGoogleFonts(fontFamilies) {
|
|
4
|
+
fontFamilies.forEach(function (fontFamily) {
|
|
5
|
+
var link = document.createElement("link");
|
|
6
|
+
link.href = "https://fonts.googleapis.com/css2?family=".concat(fontFamily);
|
|
7
|
+
link.rel = "stylesheet";
|
|
8
|
+
document.head.appendChild(link);
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.loadGoogleFonts = loadGoogleFonts;
|
|
13
|
+
//# sourceMappingURL=loadGoogleFonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadGoogleFonts.js","sources":["../../../src/utils/loadGoogleFonts.js"],"sourcesContent":["export const loadGoogleFonts = fontFamilies => {\n fontFamilies.forEach(fontFamily => {\n const link = document.createElement(\"link\");\n link.href = `https://fonts.googleapis.com/css2?family=${fontFamily}`;\n link.rel = \"stylesheet\";\n document.head.appendChild(link);\n });\n};\n"],"names":["loadGoogleFonts","fontFamilies","forEach","fontFamily","link","document","createElement","href","concat","rel","head","appendChild"],"mappings":";;IAAaA,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,YAAY,EAAI;AAC7CA,EAAAA,YAAY,CAACC,OAAO,CAAC,UAAAC,UAAU,EAAI;AACjC,IAAA,IAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC,CAAA;AAC3CF,IAAAA,IAAI,CAACG,IAAI,GAAA,2CAAA,CAAAC,MAAA,CAA+CL,UAAU,CAAE,CAAA;IACpEC,IAAI,CAACK,GAAG,GAAG,YAAY,CAAA;AACvBJ,IAAAA,QAAQ,CAACK,IAAI,CAACC,WAAW,CAACP,IAAI,CAAC,CAAA;AACjC,GAAC,CAAC,CAAA;AACJ;;;;"}
|
package/dist/utils/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { slugValidator } from './validators/slug.js';
|
|
|
8
8
|
export { captureAnalyticsEvent } from './captureAnalyticsEvent.js';
|
|
9
9
|
export { captureAnalyticsPageView } from './captureAnalyticsPageView.js';
|
|
10
10
|
export { buildNestedAttributesPayload } from './buildNestedAttributesPayload.js';
|
|
11
|
+
export { loadGoogleFonts } from './loadGoogleFonts.js';
|
|
11
12
|
export { default as dayjs } from './dayjs.js';
|
|
12
13
|
import 'axios';
|
|
13
14
|
import '../initializers/constants.js';
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var loadGoogleFonts = function loadGoogleFonts(fontFamilies) {
|
|
2
|
+
fontFamilies.forEach(function (fontFamily) {
|
|
3
|
+
var link = document.createElement("link");
|
|
4
|
+
link.href = "https://fonts.googleapis.com/css2?family=".concat(fontFamily);
|
|
5
|
+
link.rel = "stylesheet";
|
|
6
|
+
document.head.appendChild(link);
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { loadGoogleFonts };
|
|
11
|
+
//# sourceMappingURL=loadGoogleFonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadGoogleFonts.js","sources":["../../src/utils/loadGoogleFonts.js"],"sourcesContent":["export const loadGoogleFonts = fontFamilies => {\n fontFamilies.forEach(fontFamily => {\n const link = document.createElement(\"link\");\n link.href = `https://fonts.googleapis.com/css2?family=${fontFamily}`;\n link.rel = \"stylesheet\";\n document.head.appendChild(link);\n });\n};\n"],"names":["loadGoogleFonts","fontFamilies","forEach","fontFamily","link","document","createElement","href","concat","rel","head","appendChild"],"mappings":"IAAaA,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,YAAY,EAAI;AAC7CA,EAAAA,YAAY,CAACC,OAAO,CAAC,UAAAC,UAAU,EAAI;AACjC,IAAA,IAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC,CAAA;AAC3CF,IAAAA,IAAI,CAACG,IAAI,GAAA,2CAAA,CAAAC,MAAA,CAA+CL,UAAU,CAAE,CAAA;IACpEC,IAAI,CAACK,GAAG,GAAG,YAAY,CAAA;AACvBJ,IAAAA,QAAQ,CAACK,IAAI,CAACC,WAAW,CAACP,IAAI,CAAC,CAAA;AACjC,GAAC,CAAC,CAAA;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.2",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/utils.d.ts
CHANGED
|
@@ -663,4 +663,21 @@ export function buildNestedAttributesPayload(modifiedValues: {
|
|
|
663
663
|
[key: string]: any;
|
|
664
664
|
}, nestedKeyToModify: string, nestedAttributeKeyInPayload: string, nestedAttributesForArrayKey: string): {
|
|
665
665
|
[key: string]: any;
|
|
666
|
-
};
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
*
|
|
669
|
+
* The loadGoogleFonts is a utility function which facilitates loading multiple Google Fonts dynamically by injecting link elements into the document head.
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
*
|
|
673
|
+
* import { useEffect } from "react";
|
|
674
|
+
*
|
|
675
|
+
* import { loadGoogleFonts } from "@bigbinary/neeto-commons-frontend/utils";
|
|
676
|
+
*
|
|
677
|
+
* useEffect(() => {
|
|
678
|
+
* const fontFamilies = ['Roboto', 'Open Sans', 'Lato'];
|
|
679
|
+
* loadGoogleFonts(fontFamilies);
|
|
680
|
+
* }, []);
|
|
681
|
+
* @endexample
|
|
682
|
+
*/
|
|
683
|
+
export function loadGoogleFonts(fontFamilies: string[]): void;
|