diginet-core-ui 1.3.85 → 1.3.86

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 (51) hide show
  1. package/components/accordion/css.js +10 -10
  2. package/components/accordion/details.js +2 -2
  3. package/components/alert/index.js +3 -3
  4. package/components/alert/notify.js +2 -2
  5. package/components/avatar/index.js +3 -3
  6. package/components/badge/index.js +6 -6
  7. package/components/button/icon.js +9 -9
  8. package/components/button/index.js +9 -9
  9. package/components/button/more.js +2 -2
  10. package/components/card/index.js +6 -6
  11. package/components/chip/index.js +7 -7
  12. package/components/form-control/attachment/index.js +335 -479
  13. package/components/form-control/calendar/function.js +5 -5
  14. package/components/form-control/checkbox/index.js +6 -6
  15. package/components/form-control/date-picker/index.js +2 -2
  16. package/components/form-control/date-range-picker/index.js +2 -2
  17. package/components/form-control/dropdown/index.js +335 -451
  18. package/components/form-control/dropdown-box/index.js +2 -2
  19. package/components/form-control/input-base/index.js +52 -58
  20. package/components/form-control/radio/index.js +4 -4
  21. package/components/form-control/toggle/index.js +2 -2
  22. package/components/grid/index.js +2 -2
  23. package/components/image/index.js +3 -3
  24. package/components/modal/body.js +2 -2
  25. package/components/modal/footer.js +3 -3
  26. package/components/modal/header.js +3 -3
  27. package/components/modal/modal.js +2 -2
  28. package/components/paging/page-info.js +6 -6
  29. package/components/paging/page-selector2.js +3 -3
  30. package/components/popover/footer.js +3 -3
  31. package/components/popover/header.js +3 -3
  32. package/components/popup/v2/index.js +5 -5
  33. package/components/rating/index.js +4 -4
  34. package/components/slider/slider-container.js +5 -5
  35. package/components/status/index.js +4 -4
  36. package/components/tab/tab-header.js +2 -2
  37. package/components/tab/tab-panel.js +2 -2
  38. package/components/tab/tab.js +7 -7
  39. package/components/tooltip/index.js +2 -2
  40. package/components/tree-view/css.js +4 -4
  41. package/components/tree-view/index.js +4 -4
  42. package/global/index.js +12 -0
  43. package/icons/effect.js +57 -59
  44. package/package.json +1 -1
  45. package/readme.md +6 -0
  46. package/styles/general.js +280 -114
  47. package/styles/utils.js +10 -0
  48. package/utils/array/array.js +18 -25
  49. package/utils/sb-template.js +2 -2
  50. package/utils/string/string.js +1 -9
  51. package/utils/validate.js +2 -2
package/styles/general.js CHANGED
@@ -1,7 +1,6 @@
1
- /* eslint-disable no-unused-vars */
2
- import { css, jsx } from '@emotion/core';
1
+ import { css } from '@emotion/core';
3
2
  import { color } from "./colors";
4
- import { parseToPixel } from "./utils";
3
+ import { getColor, parseCSSValue, parseToPixel } from "./utils";
5
4
  export const rootSpacing = 4;
6
5
  export let rootZIndex = 1500;
7
6
  export const typographyTypes = ['t1', 't2', 't3', 't4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p1', 'p2', 'p3', 'title1', 'title2', 'title3', 'title4', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', 'paragraph1', 'paragraph2', 'paragraph3'];
@@ -27,7 +26,7 @@ export const getSpacing = (vl = 1) => {
27
26
  if (typeof vl === 'number') return Number(vl) * rootSpacing;else if (Array.isArray(vl)) {
28
27
  if (vl.length > 4) vl.length = 4;
29
28
  return vl.flatMap(i => isNaN(i) ? i : i * rootSpacing + 'px').join(' ');
30
- }
29
+ } else return vl;
31
30
  };
32
31
 
33
32
  /**
@@ -38,183 +37,350 @@ export const setZIndex = number => {
38
37
  number = Number(number || 0);
39
38
  if (!isNaN(number)) rootZIndex = number;
40
39
  };
41
- export const flexRow = css`
42
- display: flex;
43
- flex-direction: row;
40
+
41
+ // Common CSS
42
+ const bgColor = cl => css`
43
+ background-color: ${getColor(cl)};
44
+ `;
45
+ const bgCurrent = css`
46
+ background-color: currentColor;
47
+ `;
48
+ const bgTransparent = css`
49
+ background-color: transparent;
50
+ `;
51
+ const border = (withVl, colorVl) => css`
52
+ border: ${parseToPixel(withVl)} solid ${colorVl || color.dark};
53
+ `;
54
+ const borderNone = css`
55
+ border: none;
56
+ `;
57
+ const borderRadius = vl => css`
58
+ border-radius: ${parseCSSValue(vl)};
59
+ `;
60
+ const borderRadius100 = css`
61
+ border-radius: 100%;
62
+ `;
63
+ const borderRadius4px = css`
64
+ border-radius: 4px;
65
+ `;
66
+ const borderRadius50 = css`
67
+ border-radius: 50%;
68
+ `;
69
+ const boxBorder = css`
70
+ box-sizing: border-box;
71
+ `;
72
+ const boxContent = css`
73
+ box-sizing: content-box;
74
+ `;
75
+ const shadowNone = css`
76
+ box-shadow: none;
77
+ `;
78
+ const breakAll = css`
79
+ word-break: break-all;
80
+ `;
81
+ const breakWord = css`
82
+ word-break: break-word;
83
+ `;
84
+ const cursorDefault = css`
85
+ cursor: default;
86
+ `;
87
+ const cursorInherit = css`
88
+ cursor: inherit;
89
+ `;
90
+ const cursorMove = css`
91
+ cursor: move;
92
+ `;
93
+ const cursorNoDrop = css`
94
+ cursor: no-drop !important;
95
+ `;
96
+ const cursorNotAllowed = css`
97
+ cursor: not-allowed;
98
+ `;
99
+ const cursorText = css`
100
+ cursor: text;
44
101
  `;
45
- export const inlineFlex = css`
102
+ const cursorPointer = css`
103
+ cursor: pointer;
104
+ `;
105
+ const displayBlock = css`
106
+ display: block;
107
+ `;
108
+ const displayInlineBlock = css`
109
+ display: inline-block;
110
+ `;
111
+ const displayInlineFlex = css`
46
112
  display: inline-flex;
47
113
  `;
48
- export const flexCol = css`
114
+ const displayFlex = css`
115
+ display: flex;
116
+ `;
117
+ const displayNone = css`
118
+ display: none;
119
+ `;
120
+ const flexCol = css`
49
121
  display: flex;
50
122
  flex-direction: column;
51
123
  `;
52
- export const flexColReverse = css`
124
+ const flexColReverse = css`
53
125
  display: flex;
54
126
  flex-direction: column-reverse;
55
127
  `;
56
- export const flexRowReverse = css`
57
- flex-direction: row-reverse;
128
+ const flexNowrap = css`
129
+ flex-wrap: nowrap;
58
130
  `;
59
- export const flexWrap = css`
131
+ const flexRow = css`
60
132
  display: flex;
133
+ flex-direction: row;
134
+ `;
135
+ const flexRowReverse = css`
136
+ flex-direction: row-reverse;
137
+ `;
138
+ const flexShrink = css`
139
+ flex-shrink: 1;
140
+ `;
141
+ const flexShrink0 = css`
142
+ flex-shrink: 0;
143
+ `;
144
+ const flexWrap = css`
61
145
  flex-wrap: wrap;
62
146
  `;
63
- export const alignStart = css`
64
- align-items: flex-start;
147
+ const flexWrapReverse = css`
148
+ flex-wrap: wrap-reverse;
149
+ `;
150
+ const floatLeft = css`
151
+ float: left;
152
+ `;
153
+ const floatNone = css`
154
+ float: none;
155
+ `;
156
+ const floatRight = css`
157
+ float: right;
158
+ `;
159
+ const gap = vl => css`
160
+ gap: ${getSpacing(vl)};
161
+ `;
162
+ const gapX = vl => css`
163
+ column-gap: ${getSpacing(vl)};
164
+ `;
165
+ const gapY = vl => css`
166
+ column-gap: ${getSpacing(vl)};
65
167
  `;
66
- export const alignCenter = css`
168
+ const inset = vl => css`
169
+ inset: ${parseCSSValue(vl)};
170
+ `;
171
+ const insetX = vl => css`
172
+ right: ${parseCSSValue(vl)};
173
+ left: ${parseCSSValue(vl)};
174
+ `;
175
+ const insetY = vl => css`
176
+ top: ${parseCSSValue(vl)};
177
+ bottom: ${parseCSSValue(vl)};
178
+ `;
179
+ const itemsCenter = css`
67
180
  align-items: center;
68
181
  `;
69
- export const alignEnd = css`
182
+ const itemsEnd = css`
70
183
  align-items: flex-end;
71
184
  `;
72
- export const justifyStart = css`
73
- justify-content: flex-start;
185
+ const itemsStart = css`
186
+ align-items: flex-start;
187
+ `;
188
+ const justifyAround = css`
189
+ justify-content: space-around;
190
+ `;
191
+ const justifyBetween = css`
192
+ justify-content: space-between;
74
193
  `;
75
- export const justifyCenter = css`
194
+ const justifyCenter = css`
76
195
  justify-content: center;
77
196
  `;
78
- export const justifyEnd = css`
197
+ const justifyEnd = css`
79
198
  justify-content: flex-end;
80
199
  `;
81
- export const justifyBetween = css`
82
- justify-content: space-between;
200
+ const justifyEvenly = css`
201
+ justify-content: space-evenly;
83
202
  `;
84
- export const displayBlock = css`
85
- display: block;
203
+ const justifyStart = css`
204
+ justify-content: flex-start;
86
205
  `;
87
- export const displayInlineBlock = css`
88
- display: inline-block;
206
+ const mg = vl => css`
207
+ margin: ${getSpacing(vl)};
89
208
  `;
90
- export const positionRelative = css`
91
- position: relative;
209
+ const mgb = vl => css`
210
+ margin-bottom: ${getSpacing(vl)};
92
211
  `;
93
- export const positionAbsolute = css`
94
- position: absolute;
212
+ const mgl = vl => css`
213
+ margin-left: ${getSpacing(vl)};
95
214
  `;
96
- export const positionFixed = css`
97
- position: fixed;
215
+ const mgr = vl => css`
216
+ margin-right: ${getSpacing(vl)};
98
217
  `;
99
- export const borderRadius4px = css`
100
- border-radius: 4px;
218
+ const mgt = vl => css`
219
+ margin-top: ${getSpacing(vl)};
101
220
  `;
102
- export const borderRadius50 = css`
103
- border-radius: 50%;
221
+ const mgx = vl => css`
222
+ margin-left: ${getSpacing(vl)};
223
+ margin-right: ${getSpacing(vl)};
104
224
  `;
105
- export const borderRadius100 = css`
106
- border-radius: 100%;
225
+ const mgy = vl => css`
226
+ margin-top: ${getSpacing(vl)};
227
+ margin-bottom: ${getSpacing(vl)};
107
228
  `;
108
- export const borderBox = css`
109
- box-sizing: border-box;
229
+ const noBorder = css`
230
+ border: none !important;
110
231
  `;
111
- export const cursorDefault = css`
112
- cursor: default;
232
+ const noBoxShadow = css`
233
+ box-shadow: none !important;
113
234
  `;
114
- export const cursorInherit = css`
115
- cursor: inherit;
235
+ const noMargin = css`
236
+ margin: 0 !important;
116
237
  `;
117
- export const cursorNotAllowed = css`
118
- cursor: not-allowed;
238
+ const noPadding = css`
239
+ padding: 0 !important;
119
240
  `;
120
- export const cursorPointer = css`
121
- cursor: pointer;
241
+ const objectContain = css`
242
+ object-fit: contain;
243
+ `;
244
+ const objectCover = css`
245
+ object-fit: cover;
246
+ `;
247
+ const objectFill = css`
248
+ object-fit: fill;
249
+ `;
250
+ const objectNone = css`
251
+ object-fit: none;
122
252
  `;
123
- export const overflowAuto = css`
253
+ const order = vl => css`
254
+ order: ${vl};
255
+ `;
256
+ const outlineNone = css`
257
+ outline: none;
258
+ `;
259
+ const overflowAuto = css`
124
260
  overflow: auto;
125
261
  `;
126
- export const overflowHidden = css`
262
+ const overflowHidden = css`
127
263
  overflow: hidden;
128
264
  `;
129
- export const backgroundTransparent = css`
130
- background-color: transparent;
265
+ const pd = vl => css`
266
+ padding: ${getSpacing(vl)};
131
267
  `;
132
- export const ellipsis = css`
133
- white-space: nowrap;
134
- text-overflow: ellipsis;
135
- overflow: hidden;
268
+ const pdb = vl => css`
269
+ padding-bottom: ${getSpacing(vl)};
136
270
  `;
137
- export const whiteSpaceNoWrap = css`
138
- white-space: nowrap;
271
+ const pdl = vl => css`
272
+ padding-left: ${getSpacing(vl)};
139
273
  `;
140
- export const breakAll = css`
141
- word-break: break-all;
274
+ const pdr = vl => css`
275
+ padding-right: ${getSpacing(vl)};
142
276
  `;
143
- export const breakWord = css`
144
- word-break: break-word;
277
+ const pdt = vl => css`
278
+ padding-top: ${getSpacing(vl)};
145
279
  `;
146
- export const textCapitalize = css`
147
- text-transform: capitalize;
280
+ const pdx = vl => css`
281
+ padding-left: ${getSpacing(vl)};
282
+ padding-right: ${getSpacing(vl)};
148
283
  `;
149
- export const textUppercase = css`
150
- text-transform: uppercase;
284
+ const pdy = vl => css`
285
+ padding-top: ${getSpacing(vl)};
286
+ padding-bottom: ${getSpacing(vl)};
151
287
  `;
152
- export const textCenter = css`
153
- text-align: center;
288
+ const parseHeight = height => css`
289
+ height: ${parseCSSValue(height)};
154
290
  `;
155
- export const outlineNone = css`
156
- outline: none;
291
+ const parseMaxHeight = height => css`
292
+ max-height: ${parseCSSValue(height)};
157
293
  `;
158
- export const userSelectNone = css`
159
- user-select: none;
294
+ const parseMaxWidth = width => css`
295
+ max-width: ${parseCSSValue(width)};
160
296
  `;
161
- export const cursorNoDrop = css`
162
- cursor: no-drop !important;
297
+ const parseMaxWidthHeight = (width, height = width) => css`
298
+ max-width: ${parseCSSValue(width)};
299
+ max-height: ${parseCSSValue(height)};
300
+ `;
301
+ const parseMinHeight = height => css`
302
+ min-height: ${parseCSSValue(height)};
303
+ `;
304
+ const parseMinWidth = width => css`
305
+ min-width: ${parseCSSValue(width)};
306
+ `;
307
+ const parseMinWidthHeight = (width, height = width) => css`
308
+ min-width: ${parseCSSValue(width)};
309
+ min-height: ${parseCSSValue(height)};
310
+ `;
311
+ const parseWidth = width => css`
312
+ width: ${parseCSSValue(width)};
313
+ `;
314
+ const parseWidthHeight = (width, height = width) => css`
315
+ width: ${parseCSSValue(width)};
316
+ height: ${parseCSSValue(height)};
163
317
  `;
164
- export const pointerEventsNone = css`
318
+ const pointerEventsAuto = css`
319
+ pointer-events: auto;
320
+ `;
321
+ const pointerEventsNone = css`
165
322
  pointer-events: none;
166
323
  `;
167
- export const borderNone = css`
168
- border: none;
324
+ const positionAbsolute = css`
325
+ position: absolute;
169
326
  `;
170
- export const boxShadowNone = css`
171
- box-shadow: none;
327
+ const positionFixed = css`
328
+ position: fixed;
172
329
  `;
173
- export const displayNone = css`
174
- display: none;
330
+ const positionRelative = css`
331
+ position: relative;
175
332
  `;
176
- export const noMargin = css`
177
- margin: 0 !important;
333
+ const positionSticky = css`
334
+ position: sticky;
178
335
  `;
179
- export const noPadding = css`
180
- padding: 0 !important;
336
+ const selfCenter = css`
337
+ align-self: center;
181
338
  `;
182
- export const noBorder = css`
183
- border: none !important;
339
+ const selfEnd = css`
340
+ align-self: flex-end;
184
341
  `;
185
- export const noBoxShadow = css`
186
- box-shadow: none !important;
342
+ const selfStart = css`
343
+ align-self: flex-start;
187
344
  `;
188
- export const border = (withVl, colorVl) => css`
189
- border: ${parseToPixel(withVl)} solid ${colorVl || color.dark};
345
+ const textCapitalize = css`
346
+ text-transform: capitalize;
190
347
  `;
191
- export const parseWidth = width => css`
192
- width: ${isNaN(width) ? width : width + 'px'};
348
+ const textCenter = css`
349
+ text-align: center;
350
+ `;
351
+ const textCurrent = css`
352
+ color: currentColor;
193
353
  `;
194
- export const parseHeight = height => css`
195
- height: ${isNaN(height) ? height : height + 'px'};
354
+ const textEllipsis = css`
355
+ text-overflow: ellipsis;
196
356
  `;
197
- export const parseWidthHeight = (width, height = width) => css`
198
- width: ${isNaN(width) ? width : width + 'px'};
199
- height: ${isNaN(height) ? height : height + 'px'};
357
+ const textLeft = css`
358
+ text-align: left;
200
359
  `;
201
- export const parseMinWidth = width => css`
202
- min-width: ${isNaN(width) ? width : width + 'px'};
360
+ const textRight = css`
361
+ text-align: right;
203
362
  `;
204
- export const parseMinHeight = height => css`
205
- min-height: ${isNaN(height) ? height : height + 'px'};
363
+ const textUppercase = css`
364
+ text-transform: uppercase;
206
365
  `;
207
- export const parseMinWidthHeight = (width, height = width) => css`
208
- min-width: ${isNaN(width) ? width : width + 'px'};
209
- min-height: ${isNaN(height) ? height : height + 'px'};
366
+ const truncate = css`
367
+ overflow: hidden;
368
+ text-overflow: ellipsis;
369
+ white-space: nowrap;
370
+ `;
371
+ const userSelectNone = css`
372
+ user-select: none;
373
+ `;
374
+ const whiteSpaceBreakSpaces = css`
375
+ white-space: break-space;
376
+ `;
377
+ const whiteSpaceNoWrap = css`
378
+ white-space: nowrap;
210
379
  `;
211
- export const parseMaxWidth = width => css`
212
- max-width: ${isNaN(width) ? width : width + 'px'};
380
+ const whiteSpacePreWrap = css`
381
+ white-space: pre-wrap;
213
382
  `;
214
- export const parseMaxHeight = height => css`
215
- max-height: ${isNaN(height) ? height : height + 'px'};
383
+ const z = vl => css`
384
+ z-index: ${zIndex(vl)};
216
385
  `;
217
- export const parseMaxWidthHeight = (width, height = width) => css`
218
- max-width: ${isNaN(width) ? width : width + 'px'};
219
- max-height: ${isNaN(height) ? height : height + 'px'};
220
- `;
386
+ export { bgColor, bgCurrent, bgTransparent, border, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, flexCol, flexColReverse, shadowNone, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, pd, pdb, pdl, pdr, pdt, pdx, pdy, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pointerEventsAuto, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, selfCenter, selfEnd, selfStart, textCapitalize, textCenter, textCurrent, textEllipsis, textLeft, textRight, textUppercase, truncate, userSelectNone, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
package/styles/utils.js CHANGED
@@ -1,5 +1,15 @@
1
1
  import { color as colors } from "./colors";
2
2
 
3
+ /**
4
+ * Parse css value
5
+ *
6
+ * @param {string | number} vl
7
+ * @returns {string | number}
8
+ */
9
+ export const parseCSSValue = vl => {
10
+ return isNaN(vl) ? vl : vl + 'px';
11
+ };
12
+
3
13
  /**
4
14
  * Parse to pixel
5
15
  *
@@ -3,22 +3,15 @@ import { each } from "../iterator";
3
3
  import { orderEach } from "../object/object";
4
4
 
5
5
  /**
6
- *
7
- * @param {Array} entity
8
- * @returns {Boolean}
9
- */
10
- export const isEmpty = entity => Array.isArray(entity) && !entity.length;
11
-
12
- /**
13
- *
14
- * @param {any} entity
6
+ *
7
+ * @param {any} entity
15
8
  * @returns {Array} [entity]
16
9
  */
17
10
  export const wrapToArray = entity => Array.isArray(entity) ? entity : [entity];
18
11
 
19
12
  /**
20
- *
21
- * @param {*} value in object
13
+ *
14
+ * @param {*} value in object
22
15
  * @param {ArrayLike} object is a array-like object
23
16
  * @returns {Number} index of value, -1 if not found
24
17
  */
@@ -29,9 +22,9 @@ export const inArray = (value, object) => {
29
22
  };
30
23
 
31
24
  /**
32
- *
33
- * @param {Array} a
34
- * @param {Array} b
25
+ *
26
+ * @param {Array} a
27
+ * @param {Array} b
35
28
  * @returns {Array} intersection array of a and b
36
29
  */
37
30
  export const intersection = (a, b) => {
@@ -47,16 +40,16 @@ export const intersection = (a, b) => {
47
40
  };
48
41
 
49
42
  /**
50
- *
51
- * @param {Array} data
43
+ *
44
+ * @param {Array} data
52
45
  * @returns {Array} array with unique values
53
46
  */
54
47
  export const uniqueValues = data => data.filter((item, position) => data.indexOf(item) === position);
55
48
 
56
49
  /**
57
- *
58
- * @param {Array} from
59
- * @param {Array} what
50
+ *
51
+ * @param {Array} from
52
+ * @param {Array} what
60
53
  * @returns {Array} without duplicate
61
54
  */
62
55
  export const removeDuplicates = function (from, what) {
@@ -77,12 +70,12 @@ export const removeDuplicates = function (from, what) {
77
70
  };
78
71
 
79
72
  /**
80
- *
81
- * @param {Array} items
82
- * @param {*} indexParameterName
83
- * @param {*} currentItem
84
- * @param {Function} needIndexCallback
85
- * @returns
73
+ *
74
+ * @param {Array} items
75
+ * @param {*} indexParameterName
76
+ * @param {*} currentItem
77
+ * @param {Function} needIndexCallback
78
+ * @returns
86
79
  */
87
80
  export const normalizeIndexes = function (items, indexParameterName, currentItem, needIndexCallback) {
88
81
  const indexedItems = {};
@@ -2,13 +2,13 @@ import React from 'react';
2
2
  import { css } from '@emotion/core';
3
3
  import { Col, Row, Tooltip, Typography } from "../components/index";
4
4
  import { useTheme } from "../theme";
5
- import { flexWrap, flexRow, alignCenter, flexCol, alignStart, alignEnd } from "../styles/general";
5
+ import { flexWrap, flexRow, itemsCenter, flexCol, itemsStart, itemsEnd } from "../styles/general";
6
6
  import ImportComp from "../components/others/import";
7
7
  import PropTypes from 'prop-types';
8
8
  const {
9
9
  spacing
10
10
  } = useTheme();
11
- const alignMap = new Map([['start', alignStart], ['center', alignCenter], ['end', alignEnd]]);
11
+ const alignMap = new Map([['start', itemsStart], ['center', itemsCenter], ['end', itemsEnd]]);
12
12
  export const Template = ({
13
13
  title,
14
14
  args,
@@ -57,12 +57,4 @@ export const replaceAll = (() => {
57
57
  const quote = str => (str + '').replace(/([+*?.[^\]$(){}><|=!:])/g, '\\$1'); // lgtm[js/incomplete-sanitization]
58
58
 
59
59
  return (text, searchToken, replacementToken) => text.replace(new RegExp('(' + quote(searchToken) + ')', 'gi'), replacementToken);
60
- })();
61
- export const isEmpty = (() => {
62
- const SPACE_REGEXP = /\s/g;
63
- return text => !text || !text.replace(SPACE_REGEXP, '');
64
- })();
65
- export const isEmail = str => {
66
- const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
67
- return re.test(String(str).toLowerCase());
68
- };
60
+ })();
package/utils/validate.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { getGlobal } from "../global";
2
- import { isEmail as isEmailHandler } from "./";
3
2
 
4
3
  /**
5
4
  * Validation the string is an valid email
@@ -8,8 +7,9 @@ import { isEmail as isEmailHandler } from "./";
8
7
  * @returns {Boolean} true if value is an email, message or default error if value is not an email
9
8
  */
10
9
  export const isEmail = (str, _, message) => {
10
+ const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
11
11
  if (!nonNullish(str) || str === '') return true;
12
- return isEmailHandler(str) || (nonNullish(message) ? message : getGlobal(['validate', 'isEmail']));
12
+ return re.test(String(str).toLowerCase()) || (nonNullish(message) ? message : getGlobal(['validate', 'isEmail']));
13
13
  };
14
14
 
15
15
  /**