@react-pakistan/util-functions 1.23.33 → 1.23.34
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/api/cors/index.js +6 -6
- package/api/stellar-solutions/app-user/index.js +97 -38
- package/api/stellar-solutions/banking-detail/index.js +107 -48
- package/api/stellar-solutions/branch/index.js +107 -48
- package/api/stellar-solutions/company/index.js +124 -57
- package/api/stellar-solutions/company-report/index.js +48 -13
- package/api/stellar-solutions/contact/index.js +132 -65
- package/api/stellar-solutions/currency/index.js +101 -42
- package/api/stellar-solutions/customer/index.js +149 -74
- package/api/stellar-solutions/expense/index.js +132 -65
- package/api/stellar-solutions/expense-category/index.js +133 -66
- package/api/stellar-solutions/lead/index.js +132 -65
- package/api/stellar-solutions/menu-order/index.js +97 -38
- package/api/stellar-solutions/payment/index.js +135 -77
- package/api/stellar-solutions/payment-mode/index.js +90 -31
- package/api/stellar-solutions/preference/index.js +71 -28
- package/api/stellar-solutions/product/index.js +144 -77
- package/api/stellar-solutions/product-category/index.js +130 -63
- package/api/stellar-solutions/profile/index.js +152 -77
- package/api/stellar-solutions/quote-invoice/index.js +280 -201
- package/api/stellar-solutions/quote-invoice-report/index.js +48 -13
- package/api/stellar-solutions/tax/index.js +103 -44
- package/constants/react-pakistan.js +11 -22
- package/constants/social-media-sizes.js +33 -32
- package/general/basic-get.js +68 -6
- package/general/basic-post.js +55 -6
- package/general/camel-to-sentence-case.js +3 -3
- package/general/check-even-odd-length.js +1 -1
- package/general/create-date.js +4 -4
- package/general/dynamic-page-limit.js +15 -4
- package/general/enum-to-text.js +2 -2
- package/general/fetch-supabase-image.js +53 -15
- package/general/format-date.js +13 -12
- package/general/generate-blog-schema.js +10 -9
- package/general/generate-breadcrumb-schema.js +5 -4
- package/general/generate-faq-schema.js +5 -3
- package/general/generate-grid.js +2 -2
- package/general/generate-organization-schema.js +14 -13
- package/general/get-day-name.js +1 -1
- package/general/get-full-name.js +4 -1
- package/general/get-href.js +1 -1
- package/general/get-month-name.js +1 -1
- package/general/get-pathname.js +1 -1
- package/general/index.d.ts +2 -2
- package/general/index.js +2 -2
- package/general/is-next-button-disabled.js +1 -1
- package/general/is-odd.js +1 -1
- package/general/is-previous-button-disabled.js +1 -1
- package/general/remove-data-image-prefix.js +2 -2
- package/general/repeat-times.js +3 -3
- package/general/resolve-anchor-link.js +4 -4
- package/general/resolve-current-date.js +2 -2
- package/general/resolve-grid.js +1 -1
- package/general/resolve-initials.js +2 -2
- package/general/set-timezone.js +6 -3
- package/general/slugify.js +2 -2
- package/general/text-to-enum.js +1 -1
- package/general/text-to-sentence-case.js +1 -1
- package/general/truncate-text.js +1 -1
- package/general/upload-blob-to-private-supabase.d.ts +11 -0
- package/general/upload-blob-to-private-supabase.js +62 -0
- package/general/upload-blob-to-public-supabase.d.ts +11 -0
- package/general/upload-blob-to-public-supabase.js +62 -0
- package/general/upload-image-to-private-supabase.js +51 -15
- package/general/upload-image-to-public-supabase.js +51 -15
- package/general/url-to-sentence-case.js +4 -4
- package/general/validate-comment.js +1 -1
- package/general/validate-email.js +2 -2
- package/general/validate-name.js +1 -1
- package/hooks/use-change.js +14 -5
- package/hooks/use-debounce.js +7 -6
- package/hooks/use-fetch.js +82 -31
- package/hooks/use-force-render.js +3 -3
- package/hooks/use-ip-geo-location.js +57 -22
- package/hooks/use-is-mobile.js +6 -6
- package/hooks/use-position.js +16 -16
- package/hooks/use-sticky.js +9 -8
- package/hooks/use-toggle-state.js +6 -5
- package/hooks/use-window-event-listener.js +4 -4
- package/local-storage/get-storage-value.js +2 -2
- package/local-storage/remove-storage-value.js +1 -1
- package/local-storage/set-storage-value.js +1 -1
- package/package.json +1 -1
- package/storybook/generate-sitemap.js +6 -22
- package/storybook/preview.js +13 -2
- package/storybook/react-design-story-script.js +7 -11
- package/storybook/react-emoji-collection.js +23 -33
- package/storybook/react-emoji-story-script.js +9 -13
- package/storybook/react-emoji-story-template.js +1 -46
- package/storybook/react-icon-collection.js +17 -27
- package/storybook/react-icon-story-script.js +9 -13
- package/storybook/react-icon-story-template.js +1 -46
- package/storybook/react-logo-collection.js +17 -27
- package/storybook/react-logo-story-script.js +9 -13
- package/storybook/react-logo-story-template.js +1 -46
- package/storybook/responsive-component.js +11 -46
- package/storybook/theme.js +4 -4
- package/general/upload-image-blob-to-private-supabase.d.ts +0 -11
- package/general/upload-image-blob-to-private-supabase.js +0 -27
- package/general/upload-image-blob-to-public-supabase.d.ts +0 -11
- package/general/upload-image-blob-to-public-supabase.js +0 -27
package/hooks/use-sticky.js
CHANGED
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.useSticky = void 0;
|
|
14
14
|
/* eslint-disable consistent-return */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(0,
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
var react_1 = require("react");
|
|
16
|
+
var use_toggle_state_1 = require("./use-toggle-state");
|
|
17
|
+
var useSticky = function (offset) {
|
|
18
|
+
if (offset === void 0) { offset = 0; }
|
|
19
|
+
var _a = (0, use_toggle_state_1.useToggleState)(), isSticky = _a[0], setSticky = _a[1], clearSticky = _a[2];
|
|
20
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
21
|
+
var onScroll = function () {
|
|
22
|
+
window.requestAnimationFrame(function () {
|
|
22
23
|
if (window.pageYOffset > offset) {
|
|
23
24
|
setSticky();
|
|
24
25
|
}
|
|
@@ -29,7 +30,7 @@ const useSticky = (offset = 0) => {
|
|
|
29
30
|
};
|
|
30
31
|
if (window) {
|
|
31
32
|
window.addEventListener('scroll', onScroll);
|
|
32
|
-
return ()
|
|
33
|
+
return function () {
|
|
33
34
|
window.removeEventListener('scroll', onScroll);
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
/** End file docs */
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.useToggleState = void 0;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
var react_1 = require("react");
|
|
15
|
+
var useToggleState = function (defaultValue) {
|
|
16
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
17
|
+
var _a = (0, react_1.useState)(defaultValue), state = _a[0], setState = _a[1];
|
|
18
|
+
var toggleOn = (0, react_1.useCallback)(function () {
|
|
18
19
|
setState(true);
|
|
19
20
|
}, [setState]);
|
|
20
|
-
|
|
21
|
+
var toggleOff = (0, react_1.useCallback)(function () {
|
|
21
22
|
setState(false);
|
|
22
23
|
}, [setState]);
|
|
23
24
|
return [state, toggleOn, toggleOff];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useWindowEventListener = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
(0, react_1.useEffect)(()
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var useWindowEventListener = function (eventName, callback) {
|
|
6
|
+
(0, react_1.useEffect)(function () {
|
|
7
7
|
window.addEventListener(eventName, callback);
|
|
8
|
-
return ()
|
|
8
|
+
return function () { return window.removeEventListener(eventName, callback); };
|
|
9
9
|
}, [eventName, callback]);
|
|
10
10
|
};
|
|
11
11
|
exports.useWindowEventListener = useWindowEventListener;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/* eslint-disable consistent-return */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.getStorageValue = void 0;
|
|
5
|
-
|
|
5
|
+
var getStorageValue = function (key) {
|
|
6
6
|
try {
|
|
7
|
-
|
|
7
|
+
var value = localStorage.getItem(key);
|
|
8
8
|
try {
|
|
9
9
|
return value === null ? value : JSON.parse(value);
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setStorageValue = void 0;
|
|
4
|
-
|
|
4
|
+
var setStorageValue = function (key, value) {
|
|
5
5
|
try {
|
|
6
6
|
localStorage.setItem(key, JSON.stringify(value));
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -15,29 +15,13 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.generateSitemap = void 0;
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Object.keys(stories).forEach((id)
|
|
21
|
-
generatedSitemap +=
|
|
22
|
-
<url>
|
|
23
|
-
<loc>${baseUrl}${id}</loc>
|
|
24
|
-
<changefreq>weekly</changefreq>
|
|
25
|
-
<priority>0.5</priority>
|
|
26
|
-
<lastmod>2020-10-10</lastmod>
|
|
27
|
-
</url>`;
|
|
18
|
+
var generateSitemap = function (baseUrl, fs, stories) {
|
|
19
|
+
var generatedSitemap = '';
|
|
20
|
+
Object.keys(stories).forEach(function (id) {
|
|
21
|
+
generatedSitemap += "\n <url>\n <loc>".concat(baseUrl).concat(id, "</loc>\n <changefreq>weekly</changefreq>\n <priority>0.5</priority>\n <lastmod>2020-10-10</lastmod>\n </url>");
|
|
28
22
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" >
|
|
32
|
-
<url>
|
|
33
|
-
<loc>${resolvedInitialUrl}</loc>
|
|
34
|
-
<changefreq>daily</changefreq>
|
|
35
|
-
<priority>1</priority>
|
|
36
|
-
<lastmod>2020-10-10</lastmod>
|
|
37
|
-
</url>
|
|
38
|
-
${generatedSitemap}
|
|
39
|
-
</urlset>
|
|
40
|
-
`;
|
|
23
|
+
var resolvedInitialUrl = baseUrl.split('?')[0];
|
|
24
|
+
var sitemap = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n <urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" >\n <url>\n <loc>".concat(resolvedInitialUrl, "</loc>\n <changefreq>daily</changefreq>\n <priority>1</priority>\n <lastmod>2020-10-10</lastmod>\n </url>\n ").concat(generatedSitemap, "\n </urlset>\n ");
|
|
41
25
|
fs.writeFileSync('./sitemap.xml', sitemap);
|
|
42
26
|
};
|
|
43
27
|
exports.generateSitemap = generateSitemap;
|
package/storybook/preview.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.globalTypes = exports.parameters = void 0;
|
|
4
|
-
|
|
15
|
+
var responsive_screens_1 = require("./responsive-screens");
|
|
5
16
|
exports.parameters = {
|
|
6
17
|
actions: {
|
|
7
18
|
argTypesRegex: '^on[A-Z].*',
|
|
@@ -20,7 +31,7 @@ exports.parameters = {
|
|
|
20
31
|
},
|
|
21
32
|
controls: { expanded: true },
|
|
22
33
|
viewport: {
|
|
23
|
-
viewports:
|
|
34
|
+
viewports: __assign({}, responsive_screens_1.responsiveScreens),
|
|
24
35
|
},
|
|
25
36
|
};
|
|
26
37
|
exports.globalTypes = {
|
|
@@ -11,23 +11,19 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.generateReactDesignScript = void 0;
|
|
13
13
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# DO NO EDIT
|
|
19
|
-
|
|
20
|
-
`;
|
|
14
|
+
var generateReactDesignScript = function (fs) {
|
|
15
|
+
var svgDir = './assets/templates/';
|
|
16
|
+
var saveDir = './scripts/';
|
|
17
|
+
var scriptOutput = "# Generated by scripts/generate-script.js\n# DO NO EDIT\n\n";
|
|
21
18
|
// Read root Svg logo directory
|
|
22
|
-
fs.readdirSync(svgDir).forEach((folderName)
|
|
19
|
+
fs.readdirSync(svgDir).forEach(function (folderName) {
|
|
23
20
|
if (folderName === '.DS_Store')
|
|
24
21
|
return;
|
|
25
22
|
// const flowArray = folderName.split('-');
|
|
26
23
|
// const flow = 'color';
|
|
27
24
|
// eslint-disable-next-line max-len
|
|
28
|
-
scriptOutput +=
|
|
29
|
-
`;
|
|
25
|
+
scriptOutput += "svgr --template scripts/svgr-template.js --config-file scripts/.svgrrc-color.js -d src/templates/ --ext tsx assets/templates/".concat(folderName, "\n");
|
|
30
26
|
});
|
|
31
|
-
fs.writeFileSync(
|
|
27
|
+
fs.writeFileSync("".concat(saveDir, "all-scripts.sh"), scriptOutput);
|
|
32
28
|
};
|
|
33
29
|
exports.generateReactDesignScript = generateReactDesignScript;
|
|
@@ -12,52 +12,42 @@
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.generateReactEmojis = void 0;
|
|
14
14
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var react_emoji_story_template_1 = require("./react-emoji-story-template");
|
|
16
|
+
var generateReactEmojis = function (fs) {
|
|
17
|
+
var emojiDir = './assets/';
|
|
18
|
+
var saveDir = './src/__stories__/';
|
|
19
19
|
// Read root Emoji directory
|
|
20
|
-
fs.readdirSync(emojiDir).forEach((fileName)
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
fs.readdirSync(emojiDir).forEach(function (fileName) {
|
|
21
|
+
var emojiListOutput = '';
|
|
22
|
+
var level1FileName = '';
|
|
23
23
|
if (fileName === '.DS_Store')
|
|
24
24
|
return;
|
|
25
|
-
|
|
25
|
+
var level1Dir = "".concat(emojiDir).concat(fileName);
|
|
26
26
|
// Read level1-directory
|
|
27
|
-
fs.readdirSync(level1Dir).forEach((_level1FileName)
|
|
27
|
+
fs.readdirSync(level1Dir).forEach(function (_level1FileName) {
|
|
28
28
|
if (_level1FileName === '.DS_Store')
|
|
29
29
|
return;
|
|
30
30
|
level1FileName = _level1FileName;
|
|
31
|
-
|
|
32
|
-
emojiListOutput =
|
|
33
|
-
* Generated by scripts/generate-emojis.js.
|
|
34
|
-
* DO NOT EDIT!
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
import * as Emojis from '../../${fileName}/${_level1FileName}';
|
|
38
|
-
|
|
39
|
-
export const EMOJI_LIST = [
|
|
40
|
-
`;
|
|
31
|
+
var level2Dir = "".concat(emojiDir).concat(fileName, "/").concat(_level1FileName);
|
|
32
|
+
emojiListOutput = "/**\n * Generated by scripts/generate-emojis.js.\n * DO NOT EDIT!\n */\n\nimport * as Emojis from '../../".concat(fileName, "/").concat(_level1FileName, "';\n\nexport const EMOJI_LIST = [\n");
|
|
41
33
|
// Read level2-directory
|
|
42
|
-
fs.readdirSync(level2Dir).forEach((level2FileName)
|
|
34
|
+
fs.readdirSync(level2Dir).forEach(function (level2FileName) {
|
|
43
35
|
if (level2FileName === '.DS_Store')
|
|
44
36
|
return;
|
|
45
37
|
// eslint-disable-next-line max-len
|
|
46
|
-
emojiListOutput +=
|
|
47
|
-
`;
|
|
38
|
+
emojiListOutput += " { emoji: Emojis.".concat(level2FileName.split('.')[0], ", name: '").concat(level2FileName.split('.')[0], "' },\n");
|
|
48
39
|
});
|
|
49
|
-
emojiListOutput +=
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fs.mkdirSync(`${saveDir}${fileName}`);
|
|
40
|
+
emojiListOutput += "];\n ";
|
|
41
|
+
if (!fs.existsSync("".concat(saveDir).concat(fileName))) {
|
|
42
|
+
fs.mkdirSync("".concat(saveDir).concat(fileName));
|
|
53
43
|
}
|
|
54
|
-
|
|
55
|
-
.map((str)
|
|
56
|
-
|
|
57
|
-
.map((str)
|
|
58
|
-
|
|
59
|
-
fs.writeFileSync(
|
|
60
|
-
fs.writeFileSync(
|
|
44
|
+
var mainCategoryName = fileName.split('-')
|
|
45
|
+
.map(function (str) { return str[0].toUpperCase() + str.slice(1); }).join('');
|
|
46
|
+
var subCategoryName = level1FileName.split('-')
|
|
47
|
+
.map(function (str) { return str[0].toUpperCase() + str.slice(1); }).join('');
|
|
48
|
+
var story = (0, react_emoji_story_template_1.reactEmojiStoryTemplate)(mainCategoryName, subCategoryName, level1FileName);
|
|
49
|
+
fs.writeFileSync("".concat(saveDir).concat(fileName, "/").concat(level1FileName, ".ts"), emojiListOutput);
|
|
50
|
+
fs.writeFileSync("".concat(saveDir).concat(fileName, "/").concat(level1FileName, ".story.tsx"), story);
|
|
61
51
|
});
|
|
62
52
|
});
|
|
63
53
|
};
|
|
@@ -11,27 +11,23 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.generateReactEmojiScript = void 0;
|
|
13
13
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# DO NO EDIT
|
|
19
|
-
|
|
20
|
-
`;
|
|
14
|
+
var generateReactEmojiScript = function (fs) {
|
|
15
|
+
var svgDir = './assets/';
|
|
16
|
+
var saveDir = './scripts/';
|
|
17
|
+
var scriptOutput = "# Generated by scripts/generate-script.js\n# DO NO EDIT\n\n";
|
|
21
18
|
// Read root Svg emoji directory
|
|
22
|
-
fs.readdirSync(svgDir).forEach((folderName)
|
|
19
|
+
fs.readdirSync(svgDir).forEach(function (folderName) {
|
|
23
20
|
if (folderName === '.DS_Store')
|
|
24
21
|
return;
|
|
25
|
-
|
|
22
|
+
var subDir = "".concat(svgDir).concat(folderName);
|
|
26
23
|
// Read sub-directory
|
|
27
|
-
fs.readdirSync(subDir).forEach((subFolderName)
|
|
24
|
+
fs.readdirSync(subDir).forEach(function (subFolderName) {
|
|
28
25
|
if (subFolderName === '.DS_Store')
|
|
29
26
|
return;
|
|
30
27
|
// eslint-disable-next-line max-len
|
|
31
|
-
scriptOutput +=
|
|
32
|
-
`;
|
|
28
|
+
scriptOutput += "svgr --template scripts/svgr-template.js --config-file scripts/.svgrrc-color.js -d src/".concat(folderName, "/").concat(subFolderName, " --ext tsx assets/").concat(folderName, "/").concat(subFolderName, "\n");
|
|
33
29
|
});
|
|
34
30
|
});
|
|
35
|
-
fs.writeFileSync(
|
|
31
|
+
fs.writeFileSync("".concat(saveDir, "all-scripts.sh"), scriptOutput);
|
|
36
32
|
};
|
|
37
33
|
exports.generateReactEmojiScript = generateReactEmojiScript;
|
|
@@ -12,50 +12,5 @@
|
|
|
12
12
|
/** End file docs */
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.reactEmojiStoryTemplate = void 0;
|
|
15
|
-
|
|
16
|
-
* Generated by scripts/generate-emojis.js
|
|
17
|
-
* DO NOT EDIT!
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import React, { ReactElement } from 'react';
|
|
21
|
-
import { EmojiWrapper, EmojiTextWrapper, EmojiItem } from '../../styled';
|
|
22
|
-
import { StyledStory } from '../../styled-app';
|
|
23
|
-
import { EMOJI_LIST } from './${emojiListDirName}';
|
|
24
|
-
|
|
25
|
-
const emojiStyle = { width: '7rem', height: '7rem' };
|
|
26
|
-
|
|
27
|
-
const renderItem = (
|
|
28
|
-
item: { emoji: React.FC<React.SVGProps<SVGSVGElement>>, name: string }
|
|
29
|
-
): ReactElement => {
|
|
30
|
-
const Emoji = item.emoji;
|
|
31
|
-
return (
|
|
32
|
-
<EmojiItem
|
|
33
|
-
key={item.name}
|
|
34
|
-
>
|
|
35
|
-
<Emoji style={emojiStyle} />
|
|
36
|
-
<EmojiTextWrapper>
|
|
37
|
-
{item.name}
|
|
38
|
-
</EmojiTextWrapper>
|
|
39
|
-
</EmojiItem>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const emojis = EMOJI_LIST.map(renderItem);
|
|
44
|
-
|
|
45
|
-
export const ${subCategory} = (): ReactElement => (
|
|
46
|
-
<StyledStory>
|
|
47
|
-
<EmojiWrapper>
|
|
48
|
-
{emojis}
|
|
49
|
-
</EmojiWrapper>
|
|
50
|
-
</StyledStory>
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
export default {
|
|
54
|
-
title: '${mainCategory}/${subCategory}',
|
|
55
|
-
|
|
56
|
-
parameters: {
|
|
57
|
-
component: ${subCategory},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
`;
|
|
15
|
+
var reactEmojiStoryTemplate = function (mainCategory, subCategory, emojiListDirName) { return "/*\n * Generated by scripts/generate-emojis.js\n * DO NOT EDIT!\n */\n\nimport React, { ReactElement } from 'react';\nimport { EmojiWrapper, EmojiTextWrapper, EmojiItem } from '../../styled';\nimport { StyledStory } from '../../styled-app';\nimport { EMOJI_LIST } from './".concat(emojiListDirName, "';\n\nconst emojiStyle = { width: '7rem', height: '7rem' };\n\nconst renderItem = (\n item: { emoji: React.FC<React.SVGProps<SVGSVGElement>>, name: string }\n): ReactElement => {\n const Emoji = item.emoji;\n return (\n <EmojiItem\n key={item.name}\n >\n <Emoji style={emojiStyle} />\n <EmojiTextWrapper>\n {item.name}\n </EmojiTextWrapper>\n </EmojiItem>\n );\n};\n\nconst emojis = EMOJI_LIST.map(renderItem);\n\nexport const ").concat(subCategory, " = (): ReactElement => (\n <StyledStory>\n <EmojiWrapper>\n {emojis}\n </EmojiWrapper>\n </StyledStory>\n);\n\nexport default {\n title: '").concat(mainCategory, "/").concat(subCategory, "',\n\n parameters: {\n component: ").concat(subCategory, ",\n },\n};\n"); };
|
|
61
16
|
exports.reactEmojiStoryTemplate = reactEmojiStoryTemplate;
|
|
@@ -12,41 +12,31 @@
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.generateReactIcons = void 0;
|
|
14
14
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
var react_icon_story_template_1 = require("./react-icon-story-template");
|
|
16
|
+
var generateReactIcons = function (fs) {
|
|
17
|
+
var iconDir = './assets/';
|
|
18
|
+
var saveDir = './src/__stories__/';
|
|
19
|
+
var iconListOutput = '';
|
|
20
|
+
var level1FileName = '';
|
|
21
21
|
// Read root Icon directory
|
|
22
|
-
fs.readdirSync(iconDir).forEach((fileName)
|
|
22
|
+
fs.readdirSync(iconDir).forEach(function (fileName) {
|
|
23
23
|
if (fileName === '.DS_Store')
|
|
24
24
|
return;
|
|
25
|
-
|
|
26
|
-
iconListOutput =
|
|
27
|
-
* Generated by scripts/generate-icons.js
|
|
28
|
-
* DO NOT EDIT!
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
import * as Icons from '../${fileName}';
|
|
32
|
-
|
|
33
|
-
export const ICON_LIST = [
|
|
34
|
-
`;
|
|
25
|
+
var level1Dir = "".concat(iconDir).concat(fileName);
|
|
26
|
+
iconListOutput = "/**\n * Generated by scripts/generate-icons.js\n * DO NOT EDIT!\n */\n\nimport * as Icons from '../".concat(fileName, "';\n\nexport const ICON_LIST = [\n");
|
|
35
27
|
// Read level1-directory
|
|
36
|
-
fs.readdirSync(level1Dir).forEach((_level1FileName)
|
|
28
|
+
fs.readdirSync(level1Dir).forEach(function (_level1FileName) {
|
|
37
29
|
if (_level1FileName === '.DS_Store')
|
|
38
30
|
return;
|
|
39
31
|
level1FileName = _level1FileName;
|
|
40
|
-
iconListOutput +=
|
|
41
|
-
`;
|
|
32
|
+
iconListOutput += " { icon: Icons.".concat(level1FileName.split('.')[0], ", name: '").concat(level1FileName.split('.')[0], "' },\n");
|
|
42
33
|
});
|
|
43
|
-
iconListOutput +=
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
fs.writeFileSync(
|
|
49
|
-
fs.writeFileSync(`${saveDir}/${fileName}.story.tsx`, story);
|
|
34
|
+
iconListOutput += "];\n";
|
|
35
|
+
var categoryName = fileName.split('-')
|
|
36
|
+
.map(function (str) { return str[0].toUpperCase() + str.slice(1); }).join('');
|
|
37
|
+
var story = (0, react_icon_story_template_1.reactIconStoryTemplate)(categoryName, fileName);
|
|
38
|
+
fs.writeFileSync("".concat(saveDir, "/").concat(fileName, ".ts"), iconListOutput);
|
|
39
|
+
fs.writeFileSync("".concat(saveDir, "/").concat(fileName, ".story.tsx"), story);
|
|
50
40
|
});
|
|
51
41
|
};
|
|
52
42
|
exports.generateReactIcons = generateReactIcons;
|
|
@@ -11,23 +11,19 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.generateReactIconScript = void 0;
|
|
13
13
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# DO NO EDIT
|
|
19
|
-
|
|
20
|
-
`;
|
|
14
|
+
var generateReactIconScript = function (fs) {
|
|
15
|
+
var svgDir = './assets/';
|
|
16
|
+
var saveDir = './scripts/';
|
|
17
|
+
var scriptOutput = "# Generated by scripts/generate-script.js\n# DO NO EDIT\n\n";
|
|
21
18
|
// Read root Svg emoji directory
|
|
22
|
-
fs.readdirSync(svgDir).forEach((folderName)
|
|
19
|
+
fs.readdirSync(svgDir).forEach(function (folderName) {
|
|
23
20
|
if (folderName === '.DS_Store')
|
|
24
21
|
return;
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
var flowArray = folderName.split('-');
|
|
23
|
+
var flow = flowArray[flowArray.length - 1];
|
|
27
24
|
// eslint-disable-next-line max-len
|
|
28
|
-
scriptOutput +=
|
|
29
|
-
`;
|
|
25
|
+
scriptOutput += "svgr --template scripts/svgr-template.js --config-file scripts/.svgrrc-".concat(flow, ".js -d src/").concat(folderName, " --ext tsx assets/").concat(folderName, "\n");
|
|
30
26
|
});
|
|
31
|
-
fs.writeFileSync(
|
|
27
|
+
fs.writeFileSync("".concat(saveDir, "all-scripts.sh"), scriptOutput);
|
|
32
28
|
};
|
|
33
29
|
exports.generateReactIconScript = generateReactIconScript;
|
|
@@ -11,50 +11,5 @@
|
|
|
11
11
|
/** End file docs */
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.reactIconStoryTemplate = void 0;
|
|
14
|
-
|
|
15
|
-
* Generated by scripts/generate-icons.js
|
|
16
|
-
* DO NOT EDIT!
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import React, { ReactElement } from 'react';
|
|
20
|
-
import { IconWrapper, IconTextWrapper, IconItem } from '../styled';
|
|
21
|
-
import { StyledStory } from '../styled-app';
|
|
22
|
-
import { ICON_LIST } from './${iconListDirName}';
|
|
23
|
-
|
|
24
|
-
const iconStyle = { width: '7rem', height: '7rem' };
|
|
25
|
-
|
|
26
|
-
const renderItem = (
|
|
27
|
-
item: { icon: React.FC<React.SVGProps<SVGSVGElement>>, name: string }
|
|
28
|
-
): ReactElement => {
|
|
29
|
-
const Icon = item.icon;
|
|
30
|
-
return (
|
|
31
|
-
<IconItem
|
|
32
|
-
key={item.name}
|
|
33
|
-
>
|
|
34
|
-
<Icon style={iconStyle} />
|
|
35
|
-
<IconTextWrapper>
|
|
36
|
-
{item.name}
|
|
37
|
-
</IconTextWrapper>
|
|
38
|
-
</IconItem>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const icons = ICON_LIST.map(renderItem);
|
|
43
|
-
|
|
44
|
-
export const ${category} = (): ReactElement => (
|
|
45
|
-
<StyledStory>
|
|
46
|
-
<IconWrapper>
|
|
47
|
-
{icons}
|
|
48
|
-
</IconWrapper>
|
|
49
|
-
</StyledStory>
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
export default {
|
|
53
|
-
title: 'Icon/${category}',
|
|
54
|
-
|
|
55
|
-
parameters: {
|
|
56
|
-
component: ${category},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
`;
|
|
14
|
+
var reactIconStoryTemplate = function (category, iconListDirName) { return "/*\n * Generated by scripts/generate-icons.js\n * DO NOT EDIT!\n */\n\nimport React, { ReactElement } from 'react';\nimport { IconWrapper, IconTextWrapper, IconItem } from '../styled';\nimport { StyledStory } from '../styled-app';\nimport { ICON_LIST } from './".concat(iconListDirName, "';\n\nconst iconStyle = { width: '7rem', height: '7rem' };\n\nconst renderItem = (\n item: { icon: React.FC<React.SVGProps<SVGSVGElement>>, name: string }\n): ReactElement => {\n const Icon = item.icon;\n return (\n <IconItem\n key={item.name}\n >\n <Icon style={iconStyle} />\n <IconTextWrapper>\n {item.name}\n </IconTextWrapper>\n </IconItem>\n );\n};\n\nconst icons = ICON_LIST.map(renderItem);\n\nexport const ").concat(category, " = (): ReactElement => (\n <StyledStory>\n <IconWrapper>\n {icons}\n </IconWrapper>\n </StyledStory>\n);\n\nexport default {\n title: 'Icon/").concat(category, "',\n\n parameters: {\n component: ").concat(category, ",\n },\n};\n"); };
|
|
60
15
|
exports.reactIconStoryTemplate = reactIconStoryTemplate;
|
|
@@ -12,41 +12,31 @@
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.generateReactLogos = void 0;
|
|
14
14
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
var react_logo_story_template_1 = require("./react-logo-story-template");
|
|
16
|
+
var generateReactLogos = function (fs) {
|
|
17
|
+
var logoDir = './assets/';
|
|
18
|
+
var saveDir = './src/__stories__/';
|
|
19
|
+
var logoListOutput = '';
|
|
20
|
+
var level1FileName = '';
|
|
21
21
|
// Read root Logo directory
|
|
22
|
-
fs.readdirSync(logoDir).forEach((fileName)
|
|
22
|
+
fs.readdirSync(logoDir).forEach(function (fileName) {
|
|
23
23
|
if (fileName === '.DS_Store')
|
|
24
24
|
return;
|
|
25
|
-
|
|
26
|
-
logoListOutput =
|
|
27
|
-
* Generated by scripts/generate-logos.js
|
|
28
|
-
* DO NOT EDIT!
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
import * as Logos from '../${fileName}';
|
|
32
|
-
|
|
33
|
-
export const LOGO_LIST = [
|
|
34
|
-
`;
|
|
25
|
+
var level1Dir = "".concat(logoDir).concat(fileName);
|
|
26
|
+
logoListOutput = "/**\n * Generated by scripts/generate-logos.js\n * DO NOT EDIT!\n */\n\nimport * as Logos from '../".concat(fileName, "';\n\nexport const LOGO_LIST = [\n");
|
|
35
27
|
// Read level1-directory
|
|
36
|
-
fs.readdirSync(level1Dir).forEach((_level1FileName)
|
|
28
|
+
fs.readdirSync(level1Dir).forEach(function (_level1FileName) {
|
|
37
29
|
if (_level1FileName === '.DS_Store')
|
|
38
30
|
return;
|
|
39
31
|
level1FileName = _level1FileName;
|
|
40
|
-
logoListOutput +=
|
|
41
|
-
`;
|
|
32
|
+
logoListOutput += " { logo: Logos.".concat(level1FileName.split('.')[0], ", name: '").concat(level1FileName.split('.')[0], "' },\n");
|
|
42
33
|
});
|
|
43
|
-
logoListOutput +=
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
fs.writeFileSync(
|
|
49
|
-
fs.writeFileSync(`${saveDir}/${fileName}.story.tsx`, story);
|
|
34
|
+
logoListOutput += "];\n";
|
|
35
|
+
var categoryName = fileName.split('-')
|
|
36
|
+
.map(function (str) { return str[0].toUpperCase() + str.slice(1); }).join('');
|
|
37
|
+
var story = (0, react_logo_story_template_1.reactLogoStoryTemplate)(categoryName, fileName);
|
|
38
|
+
fs.writeFileSync("".concat(saveDir, "/").concat(fileName, ".ts"), logoListOutput);
|
|
39
|
+
fs.writeFileSync("".concat(saveDir, "/").concat(fileName, ".story.tsx"), story);
|
|
50
40
|
});
|
|
51
41
|
};
|
|
52
42
|
exports.generateReactLogos = generateReactLogos;
|
|
@@ -11,23 +11,19 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.generateReactLogoScript = void 0;
|
|
13
13
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# DO NO EDIT
|
|
19
|
-
|
|
20
|
-
`;
|
|
14
|
+
var generateReactLogoScript = function (fs) {
|
|
15
|
+
var svgDir = './assets/';
|
|
16
|
+
var saveDir = './scripts/';
|
|
17
|
+
var scriptOutput = "# Generated by scripts/generate-script.js\n# DO NO EDIT\n\n";
|
|
21
18
|
// Read root Svg logo directory
|
|
22
|
-
fs.readdirSync(svgDir).forEach((folderName)
|
|
19
|
+
fs.readdirSync(svgDir).forEach(function (folderName) {
|
|
23
20
|
if (folderName === '.DS_Store')
|
|
24
21
|
return;
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
var flowArray = folderName.split('-');
|
|
23
|
+
var flow = flowArray[flowArray.length - 1];
|
|
27
24
|
// eslint-disable-next-line max-len
|
|
28
|
-
scriptOutput +=
|
|
29
|
-
`;
|
|
25
|
+
scriptOutput += "svgr --template scripts/svgr-template.js --config-file scripts/.svgrrc-".concat(flow, ".js -d src/").concat(folderName, " --ext tsx assets/").concat(folderName, "\n");
|
|
30
26
|
});
|
|
31
|
-
fs.writeFileSync(
|
|
27
|
+
fs.writeFileSync("".concat(saveDir, "all-scripts.sh"), scriptOutput);
|
|
32
28
|
};
|
|
33
29
|
exports.generateReactLogoScript = generateReactLogoScript;
|