@zohodesk/utils 1.3.16 → 1.3.17

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.
Files changed (61) hide show
  1. package/README.md +16 -33
  2. package/es/StringUtils.js +2 -6
  3. package/es/abbreviateNumber.js +1 -4
  4. package/es/compileClassNames.js +4 -9
  5. package/es/constantProps/constant.js +2 -1
  6. package/es/createTemplateLiteral.js +2 -10
  7. package/es/crud/ArrayManager.js +1 -2
  8. package/es/crud/ObjectManager.js +1 -2
  9. package/es/crud/arrayCRUD.js +22 -27
  10. package/es/crud/objectCRUD.js +17 -21
  11. package/es/eventListenerUtils.js +12 -16
  12. package/es/getCompliedClassName.js +1 -6
  13. package/es/getCompliedCustomId.js +5 -7
  14. package/es/loadResource.js +1 -2
  15. package/es/mergeStyle.js +1 -3
  16. package/es/uniqueNumber.js +1 -2
  17. package/lib/ErrorBoundary.js +78 -0
  18. package/lib/StringUtils.js +343 -0
  19. package/lib/abbreviateNumber.js +51 -0
  20. package/lib/accessKeyCodes.js +26 -0
  21. package/lib/applyOpenToCustomize.js +41 -0
  22. package/lib/combineCustomStyle.js +52 -0
  23. package/lib/compileClassNames.js +45 -0
  24. package/lib/constantProps/constant.js +14 -0
  25. package/lib/constantProps/index.js +18 -0
  26. package/lib/constantProps/uiProps.js +71 -0
  27. package/lib/contextFactory.js +23 -0
  28. package/lib/createTemplateLiteral.js +84 -0
  29. package/lib/crud/ArrayManager.js +91 -0
  30. package/lib/crud/ObjectManager.js +81 -0
  31. package/lib/crud/arrayCRUD.js +110 -0
  32. package/lib/crud/objectCRUD.js +66 -0
  33. package/lib/dataTypes.js +42 -0
  34. package/lib/debounce.js +33 -0
  35. package/lib/deepEqual.js +39 -0
  36. package/lib/disCustomStyleProps.js +46 -0
  37. package/lib/eventListenerUtils.js +36 -0
  38. package/lib/getCompliedClassName.js +24 -0
  39. package/lib/getCompliedCustomId.js +37 -0
  40. package/lib/getCurrentTime.js +25 -0
  41. package/lib/getCustomBoundingClientRect.js +18 -0
  42. package/lib/index.js +135 -0
  43. package/lib/isTouchDevice.js +16 -0
  44. package/lib/jsonToQueryString.js +13 -0
  45. package/lib/loadResource.js +63 -0
  46. package/lib/mergeStyle.js +65 -0
  47. package/lib/objectUtils.js +14 -0
  48. package/lib/omit.js +20 -0
  49. package/lib/props/automationProps.js +19 -0
  50. package/lib/props/customReducerPropTypes.js +17 -0
  51. package/lib/props/customStyleProps.js +21 -0
  52. package/lib/props/generalAriaProps.js +17 -0
  53. package/lib/props/tagAttributeProps.js +58 -0
  54. package/lib/props/tagGeneralAttributeProps.js +58 -0
  55. package/lib/props/uiProps.js +138 -0
  56. package/lib/reducerHandler.js +42 -0
  57. package/lib/renderNode.js +44 -0
  58. package/lib/replaceAtFirst.js +12 -0
  59. package/lib/replaceAtLast.js +10 -0
  60. package/lib/uniqueNumber.js +22 -0
  61. package/package.json +28 -12
@@ -0,0 +1,343 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.capitalizeFirstLetter = capitalizeFirstLetter;
7
+ exports.countOccurrences = countOccurrences;
8
+ exports.decodeContent = decodeContent;
9
+ exports.encodeForHtml = encodeForHtml;
10
+ exports.encodeToBase64 = encodeToBase64;
11
+ exports.extractDomainFromEmail = extractDomainFromEmail;
12
+ exports.indexOf = indexOf;
13
+ exports.isBlank = isBlank;
14
+ exports.isEmpty = isEmpty;
15
+ exports.isNotBlank = isNotBlank;
16
+ exports.isNotEmpty = isNotEmpty;
17
+ exports.isPalindrome = isPalindrome;
18
+ exports.isStartsWithVowel = isStartsWithVowel;
19
+ exports.joinArray = joinArray;
20
+ exports.removeWhitespace = removeWhitespace;
21
+ exports.replaceAllOccurrences = replaceAllOccurrences;
22
+ exports.reverseString = reverseString;
23
+ exports.toKebabCase = toKebabCase;
24
+ exports.toPascalCase = toPascalCase;
25
+ exports.toSnakeCase = toSnakeCase;
26
+ exports.truncate = truncate;
27
+ exports.validateEmail = validateEmail;
28
+
29
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
30
+
31
+ /**
32
+ * check given string is empty.
33
+ * @param {string} string - The string to be check.
34
+ */
35
+ function isEmpty(string) {
36
+ if (!string) {
37
+ return true;
38
+ }
39
+
40
+ return string.length === 0;
41
+ }
42
+ /**
43
+ * check given string is not empty.
44
+ * @param {string} string - Th e string to be check.
45
+ */
46
+
47
+
48
+ function isNotEmpty(string) {
49
+ return !isEmpty(string);
50
+ }
51
+ /**
52
+ * check given string is blank.
53
+ * @param {string} string - The string to be check.
54
+ */
55
+
56
+
57
+ function isBlank(string) {
58
+ if (!string) {
59
+ return true;
60
+ }
61
+
62
+ return !new RegExp('\\S', 'g').test(string);
63
+ }
64
+ /**
65
+ * check given string is not blank.
66
+ * @param {string} string - The string to be check.
67
+ */
68
+
69
+
70
+ function isNotBlank(string) {
71
+ return !isBlank(string);
72
+ }
73
+ /**
74
+ * find index of given char in the string.
75
+ * @param {string} string - The string to be modify.
76
+ */
77
+
78
+
79
+ function indexOf(string, chars, pos) {
80
+ if (string == null || _typeof(string) === undefined) {
81
+ return -1;
82
+ }
83
+
84
+ if (pos) {
85
+ return str.indexOf(chars, _typeof(pos) === undefined ? 0 : pos);
86
+ } else {
87
+ return str.indexOf(chars);
88
+ }
89
+ }
90
+ /**
91
+ * Capitalize the first letter of a string.
92
+ *
93
+ * @param {string} string - The input string to modify.
94
+ * @returns {string} The input string with the first letter capitalized.
95
+ */
96
+
97
+
98
+ function capitalizeFirstLetter(string) {
99
+ return !isStringEmpty(string) ? string.charAt(0).toUpperCase() + string.slice(1) : string;
100
+ }
101
+ /**
102
+ * Encode a string for HTML to prevent cross-site scripting (XSS) attacks.
103
+ *
104
+ * @param {string} str - The input string to encode for HTML.
105
+ * @returns {string} The encoded string safe for inclusion in HTML content.
106
+ */
107
+
108
+
109
+ function encodeForHtml(str) {
110
+ if (/<|>|&|"|'|\\/g.test(str) === true) {
111
+ str = str.replace(/&/g, '&amp;');
112
+ str = str.replace(/</g, '&lt;');
113
+ str = str.replace(/>/g, '&gt;');
114
+ str = str.replace(/"/g, '&quot;');
115
+ str = str.replace(/\\/g, '&#x5c;');
116
+ str = str.replace(/'/g, '&#39;');
117
+ }
118
+
119
+ return str;
120
+ }
121
+ /**
122
+ * Decode HTML entities in a string.
123
+ *
124
+ * @param {string} str - The input string containing HTML-encoded content.
125
+ * @returns {string} The decoded string.
126
+ */
127
+
128
+
129
+ function decodeContent(str) {
130
+ if (/&amp;|&lt;|&gt;|&quot;|&#x5c;|&#39;|&amp;lt;|&amp;gt;/g.test(str) == true) {
131
+ str = str.replace(/&amp;/g, '&');
132
+ str = str.replace(/&lt;|&amp;lt;/g, '<');
133
+ str = str.replace(/&gt;|&amp;gt;/g, '>');
134
+ str = str.replace(/&quot;/g, '"');
135
+ str = str.replace(/&#x5c;/g, '\\');
136
+ str = str.replace(/&#39;/g, "'");
137
+ }
138
+
139
+ return str;
140
+ }
141
+ /**
142
+ * Validatate email.
143
+ *
144
+ * @param {string} email - The input string to validate.
145
+ */
146
+
147
+
148
+ function validateEmail(email) {
149
+ var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
150
+ return emailRegex.test(email);
151
+ }
152
+ /**
153
+ * extract domain from the email.
154
+ *
155
+ * @param {string} email - The input email to extract domain.
156
+ */
157
+
158
+
159
+ function extractDomainFromEmail(email) {
160
+ var atIndex = email.lastIndexOf('@');
161
+ return atIndex !== -1 ? email.slice(atIndex + 1) : '';
162
+ }
163
+ /**
164
+ * Reverse a given string.
165
+ *
166
+ * @param {string} string - The input string to reverse.
167
+ * @returns {string} The reversed string.
168
+ */
169
+
170
+
171
+ function reverseString(string) {
172
+ return !isStringEmpty(string) ? string.split('').reverse().join('') : string;
173
+ }
174
+ /**
175
+ * Truncate a given string and append an ellipsis if it exceeds a specified length.
176
+ * @param {string} string - The string to truncate.
177
+ * @param {number} maxLength - The maximum length of the truncated string.
178
+ * @returns {string} The truncated string.
179
+ */
180
+
181
+
182
+ function truncate(string) {
183
+ var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
184
+
185
+ if (!isStringEmpty() && string.length > maxLength) {
186
+ return string.slice(0, maxLength) + '...';
187
+ }
188
+
189
+ return string;
190
+ }
191
+ /**
192
+ * Convert a string to PascalCase.
193
+ * Split the string into words, capitalize the first letter of each word, and join them
194
+ *
195
+ * @param {string} string - The input string to convert.
196
+ * @returns {string} The PascalCase version of the input string.
197
+ */
198
+
199
+
200
+ function toPascalCase(string) {
201
+ if (typeof string === 'string' && !isStringEmpty(string)) {
202
+ var pascalCaseStr = string.split(/[\s_-]+/).map(function (word) {
203
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
204
+ }).join('');
205
+ return pascalCaseStr;
206
+ }
207
+ }
208
+ /**
209
+ * Convert a string to kebab-case.
210
+ * Replace spaces and underscores with hyphens, and convert to lowercase
211
+ *
212
+ * @param {string} string - The input string to convert.
213
+ * @returns {string} The kebab-case version of the input string.
214
+ */
215
+
216
+
217
+ function toKebabCase(string) {
218
+ if (typeof string === 'string' && !isStringEmpty(string)) {
219
+ var kebabCaseStr = string.replace(/[\s_]+/g, '-').toLowerCase();
220
+ return kebabCaseStr;
221
+ }
222
+ }
223
+ /**
224
+ * Convert a string to snake_case.
225
+ * Replace spaces and hyphens with underscores, and convert to lowercase
226
+ *
227
+ * @param {string} string - The input string to convert.
228
+ * @returns {string} The snake_case version of the input string.
229
+ */
230
+
231
+
232
+ function toSnakeCase(string) {
233
+ if (typeof string === 'string' && !isStringEmpty(string)) {
234
+ var snakeCaseStr = string.replace(/[\s-]+/g, '_').toLowerCase();
235
+ return snakeCaseStr;
236
+ }
237
+ }
238
+ /**
239
+ * Join an array of strings into a single string using a specified delimiter.
240
+ *
241
+ * @param {string[]} array - The array of strings to join.
242
+ * @param {string} delimiter - The delimiter used to separate the strings in the output.
243
+ * @returns {string} The concatenated string with the specified delimiter.
244
+ */
245
+
246
+
247
+ function joinArray(array) {
248
+ var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ', ';
249
+
250
+ if (Array.isArray(array)) {
251
+ return array.join(delimiter);
252
+ }
253
+ }
254
+ /**
255
+ * Remove whitespace characters from a given string.
256
+ *
257
+ * @param {string} inputString - The input string from which to remove whitespace.
258
+ * @returns {string} The input string with whitespace characters removed.
259
+ */
260
+
261
+
262
+ function removeWhitespace(inputString) {
263
+ if (!isStringEmpty(inputString) && typeof inputString == 'string') {
264
+ return inputString.replace(/\s+/g, '');
265
+ }
266
+
267
+ return inputString;
268
+ }
269
+ /**
270
+ * Check if a given string is a palindrome.
271
+ *
272
+ * @param {string} string - The input string to check for palindromic property.
273
+ * @returns {boolean} True if the input string is a palindrome, false otherwise.
274
+ */
275
+
276
+
277
+ function isPalindrome(string) {
278
+ if (!isStringEmpty(string) && typeof string == 'string') {
279
+ var cleanString = string.toLowerCase().replace(/[^a-zA-Z0-9]/g, '');
280
+ var reversedString = cleanString.split('').reverse().join('');
281
+ return cleanString === reversedString;
282
+ }
283
+
284
+ return string;
285
+ }
286
+ /**
287
+ * Check if a string starts with a vowel (a, e, i, o, or u).
288
+ *
289
+ * @param {string} string - The input string to check.
290
+ * @returns {boolean} True if the string starts with a vowel, false otherwise.
291
+ */
292
+
293
+
294
+ function isStartsWithVowel(string) {
295
+ return /^[aeiouAEIOU]/.test(string);
296
+ }
297
+
298
+ ;
299
+ /**
300
+ * Count the number of occurrences of a substring in a string.
301
+ *
302
+ * @param {string} string - The input string to search in.
303
+ * @param {string} substring - The substring to count occurrences of.
304
+ * @returns {number} The number of occurrences of the substring in the input string.
305
+ */
306
+
307
+ function countOccurrences(string, substring) {
308
+ if (typeof string == 'string') {
309
+ var regex = new RegExp(substring, 'g');
310
+ var matches = string.match(regex);
311
+ return matches ? matches.length : 0;
312
+ }
313
+
314
+ return string;
315
+ }
316
+ /**
317
+ * Replace all occurrences of a substring with another substring in a string.
318
+ *
319
+ * @param {string} string - The input string in which to perform replacements.
320
+ * @param {string} target - The substring to find and replace.
321
+ * @param {string} replacement - The substring to replace occurrences of the target with.
322
+ * @returns {string} The input string with all occurrences of the target replaced.
323
+ */
324
+
325
+
326
+ function replaceAllOccurrences(string, target, replacement) {
327
+ if (!isStringEmpty(string) && typeof string == 'string') {
328
+ return string.split(target).join(replacement);
329
+ }
330
+
331
+ return string;
332
+ }
333
+ /**
334
+ * Encode a string to Base64.
335
+ *
336
+ * @param {string} inputString - The input string to encode.
337
+ * @returns {string} The Base64-encoded string.
338
+ */
339
+
340
+
341
+ function encodeToBase64(string) {
342
+ return btoa(string);
343
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = abbreviateNumber;
7
+
8
+ /**
9
+ *
10
+ * @param {number|string} count
11
+ * @param {object} options
12
+ * @param {string} options.locale
13
+ * @param {boolean} options.withAbbr
14
+ * @param {number} options.decimals
15
+ * @returns
16
+ */
17
+ function abbreviateNumber() {
18
+ var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
19
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
+
21
+ if (typeof count === 'string') {
22
+ count = parseInt(count);
23
+ }
24
+
25
+ if (global.Intl && global.Intl.NumberFormat) {
26
+ var numberFormat = Intl.NumberFormat(options.locale || 'en', {
27
+ notation: 'compact' // compactDisplay: "short",
28
+
29
+ });
30
+ return numberFormat.format(count);
31
+ } //Comaptibility
32
+
33
+
34
+ var COUNT_ABBRS = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
35
+ var _options$withAbbr = options.withAbbr,
36
+ withAbbr = _options$withAbbr === void 0 ? true : _options$withAbbr,
37
+ _options$decimals = options.decimals,
38
+ decimals = _options$decimals === void 0 ? 2 : _options$decimals;
39
+ var i = 0 === count ? count : Math.floor(Math.log(count) / Math.log(1000));
40
+ var result = parseFloat((count / Math.pow(1000, i)).toFixed(decimals));
41
+
42
+ if (withAbbr) {
43
+ result += "".concat(COUNT_ABBRS[i]);
44
+ }
45
+
46
+ return result;
47
+ }
48
+ /* need discussion
49
+ 1001 => 1K+
50
+
51
+ G, T, P, E, Z,Y are needed in practical */
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.accessKeyNames = void 0;
7
+ var _default = {
8
+ tab: 9,
9
+ enter: 13,
10
+ space: 32,
11
+ rightArrow: 39,
12
+ leftArrow: 37,
13
+ topArrow: 38,
14
+ bottomArrow: 40
15
+ };
16
+ exports["default"] = _default;
17
+ var accessKeyNames = {
18
+ 'tab': 'tab',
19
+ 'enter': 'enter',
20
+ 'space': 'space',
21
+ 'arrowleft': 'arrowleft',
22
+ 'arrowtop': 'arrowtop',
23
+ 'arrowright': 'arrowright',
24
+ 'arrowbottom': 'arrowbottom'
25
+ };
26
+ exports.accessKeyNames = accessKeyNames;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = applyOpenToCustomize;
7
+
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
+
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
14
+ /**
15
+ * Opening the customization, need to addd for behaviour changes. also add only enabled.
16
+ * @param {*} style
17
+ * @param {*} options
18
+ * Example code
19
+ * <Component openToCutsomize={{prefix:'dot'}} />
20
+ * let style = applyOpenToCustomize(style,openToCutsomize)
21
+ */
22
+ function applyOpenToCustomize(style, options) {
23
+ var resultStyle = style;
24
+
25
+ if (options && options.prefix) {
26
+ resultStyle = _objectSpread({}, style);
27
+ var defaultPrefix = options.prefix || "";
28
+
29
+ if (defaultPrefix) {
30
+ defaultPrefix = "".concat(defaultPrefix, "-");
31
+ }
32
+
33
+ Object.keys(style).forEach(function (styleName) {
34
+ if (resultStyle[styleName] && !resultStyle[styleName].includes(styleName)) {
35
+ resultStyle[styleName] = "".concat(resultStyle[styleName], " ").concat(defaultPrefix).concat(styleName);
36
+ }
37
+ });
38
+ }
39
+
40
+ return resultStyle;
41
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = combineCustomStyle;
7
+
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
+
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
14
+ var REPLACER_SYMBOL = "$";
15
+ /**
16
+ *
17
+ * if two is same ==> do the think if replace do, if append do.
18
+ * replace vs append ==> append
19
+ * append vs replace ==> replace
20
+ * @param {*} style1
21
+ * @param {*} style2
22
+ * @returns
23
+ */
24
+
25
+ function combineCustomStyle(style1, style2) {
26
+ var resultStyle = _objectSpread({}, style1);
27
+
28
+ Object.keys(style2).forEach(function (styleName) {
29
+ var oldStyleName = style1["$".concat(styleName)] ? "$".concat(styleName) : styleName;
30
+
31
+ if (oldStyleName.startsWith(REPLACER_SYMBOL) && styleName.startsWith(REPLACER_SYMBOL)) {
32
+ resultStyle[styleName] = style2[styleName];
33
+ } else if (!oldStyleName.startsWith(REPLACER_SYMBOL) && !styleName.startsWith(REPLACER_SYMBOL)) {
34
+ resultStyle[styleName] = "".concat(resultStyle[styleName], " ").concat(style2[styleName]);
35
+ } else {
36
+ delete resultStyle[oldStyleName];
37
+ resultStyle[styleName] = style2[styleName];
38
+ }
39
+ /*else if (oldStyleName.startsWith(REPLACER_SYMBOL) && !styleName.startsWith(REPLACER_SYMBOL) ) {
40
+
41
+ delete resultStyle[oldStyleName];
42
+ resultStyle[styleName] = style2[styleName];
43
+ }
44
+ else if (!oldStyleName.startsWith(REPLACER_SYMBOL) && styleName.startsWith(REPLACER_SYMBOL) ) {
45
+
46
+ delete resultStyle[oldStyleName];
47
+ resultStyle[styleName] = style2[styleName];
48
+ }*/
49
+
50
+ });
51
+ return resultStyle;
52
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = compileClassNames;
9
+
10
+ var _dataTypes = _interopRequireWildcard(require("./dataTypes"));
11
+
12
+ var _objectUtils = require("./objectUtils");
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ var collectClassNames = function collectClassNames(processedClassNameList) {
19
+ for (var index = 0; index < (arguments.length <= 1 ? 0 : arguments.length - 1); index++) {
20
+ var classInfo = index + 1 < 1 || arguments.length <= index + 1 ? undefined : arguments[index + 1];
21
+
22
+ if (!classInfo) {
23
+ continue;
24
+ } else if ((0, _dataTypes.isDataTypeOf)(classInfo, _dataTypes["default"].object)) {
25
+ for (var property in classInfo) {
26
+ if (_objectUtils.hasOwnProperty.call(classInfo, property) && property !== 'undefined' && property !== 'null' && classInfo[property] && !processedClassNameList.includes(property)) {
27
+ processedClassNameList.push(property);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ };
33
+
34
+ function compileClassNames() {
35
+ var resultClassNameList = [];
36
+
37
+ for (var _len = arguments.length, classinfoList = new Array(_len), _key = 0; _key < _len; _key++) {
38
+ classinfoList[_key] = arguments[_key];
39
+ }
40
+
41
+ collectClassNames.apply(void 0, [resultClassNameList].concat(classinfoList));
42
+ return resultClassNameList.filter(function (a) {
43
+ return a !== '';
44
+ }).join(' ');
45
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DUMMY_OBJECT = exports.DUMMY_FUNCTION = exports.DUMMY_ARRAY = void 0;
7
+ var DUMMY_OBJECT = Object.freeze({});
8
+ exports.DUMMY_OBJECT = DUMMY_OBJECT;
9
+ var DUMMY_ARRAY = Object.freeze([]);
10
+ exports.DUMMY_ARRAY = DUMMY_ARRAY;
11
+
12
+ var DUMMY_FUNCTION = function DUMMY_FUNCTION() {};
13
+
14
+ exports.DUMMY_FUNCTION = DUMMY_FUNCTION;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _uiProps = require("./uiProps");
8
+
9
+ Object.keys(_uiProps).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _uiProps[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _uiProps[key];
16
+ }
17
+ });
18
+ });
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.variants = exports.variantList = exports.sizes = exports.sizeList = exports.sizeKeys = exports.shapes = exports.shapeList = exports.positions = exports.positionList = exports.positionKeys = exports.decorations = exports.decorationList = exports.colors = exports.colorList = exports.colorKeys = void 0;
7
+ var variantList = {
8
+ outlined: 'variant_outlined',
9
+ contained: 'variant_contained',
10
+ flushed: 'variant_flushed',
11
+ plain: 'variant_plain'
12
+ };
13
+ exports.variantList = variantList;
14
+ var variants = Object.values(variantList);
15
+ exports.variants = variants;
16
+ var sizeList = {
17
+ xsmall: 'size_xsmall',
18
+ small: 'size_small',
19
+ medium: 'size_medium',
20
+ large: 'size_large',
21
+ xlarge: 'size_xlarge'
22
+ };
23
+ exports.sizeList = sizeList;
24
+ var sizeKeys = Object.keys(sizeList);
25
+ exports.sizeKeys = sizeKeys;
26
+ var sizes = Object.values(sizeList);
27
+ exports.sizes = sizes;
28
+ var colorList = {
29
+ danger: 'color_danger',
30
+ success: 'color_success',
31
+ info: 'color_info',
32
+ primary: 'color_primary',
33
+ secondary: 'color_secondary',
34
+ warning: 'color_warning'
35
+ };
36
+ exports.colorList = colorList;
37
+ var colorKeys = Object.keys(colorList);
38
+ exports.colorKeys = colorKeys;
39
+ var colors = Object.values(colorList);
40
+ exports.colors = colors;
41
+ var shapeList = {
42
+ circle: 'shape_circle',
43
+ oval: 'shape_oval',
44
+ square: 'shape_square',
45
+ roundedRect: 'shape_roundedRect',
46
+ rounded: 'shape_rounded'
47
+ };
48
+ exports.shapeList = shapeList;
49
+ var shapes = Object.values(shapeList);
50
+ exports.shapes = shapes;
51
+ var decorationList = {
52
+ overLine: 'decoration_overline',
53
+ lineThrough: 'decoration_linethrough',
54
+ underLine: 'decoration_underline',
55
+ none: 'decoration_none'
56
+ };
57
+ exports.decorationList = decorationList;
58
+ var decorations = Object.values(decorationList);
59
+ exports.decorations = decorations;
60
+ var positionList = {
61
+ left: 'position_left',
62
+ right: 'position_right',
63
+ top: 'position_top',
64
+ bottom: 'position_bottom',
65
+ center: 'position_center'
66
+ };
67
+ exports.positionList = positionList;
68
+ var positionKeys = Object.keys(positionList);
69
+ exports.positionKeys = positionKeys;
70
+ var positions = Object.values(positionList);
71
+ exports.positions = positions;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = contextFactory;
7
+
8
+ var _react = require("react");
9
+
10
+ var context = {};
11
+ /**
12
+ *
13
+ * @param {string} name
14
+ * @returns {object}
15
+ */
16
+
17
+ function contextFactory(name) {
18
+ if (!context[name]) {
19
+ context[name] = /*#__PURE__*/(0, _react.createContext)();
20
+ }
21
+
22
+ return context[name];
23
+ }