@zohodesk/components 1.0.0-temp-252.4 → 1.0.0-temp-256

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 (88) hide show
  1. package/README.md +20 -3
  2. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +4 -4
  3. package/assets/Appearance/dark/themes/blue/blue_componentsCTA_DarkModifyCategory.module.css +14 -0
  4. package/assets/Appearance/dark/themes/green/green_componentsCTA_DarkModifyCategory.module.css +14 -0
  5. package/assets/Appearance/dark/themes/orange/orange_componentsCTA_DarkModifyCategory.module.css +14 -0
  6. package/assets/Appearance/dark/themes/red/red_componentsCTA_DarkModifyCategory.module.css +14 -0
  7. package/assets/Appearance/dark/themes/yellow/yellow_componentsCTA_DarkModifyCategory.module.css +14 -0
  8. package/assets/Appearance/light/mode/Component_LightMode.module.css +6 -6
  9. package/assets/Appearance/light/themes/blue/blue_componentsCTA_LightModifyCategory.module.css +14 -0
  10. package/assets/Appearance/light/themes/green/green_componentsCTA_LightModifyCategory.module.css +14 -0
  11. package/assets/Appearance/light/themes/orange/orange_componentsCTA_LightModifyCategory.module.css +14 -0
  12. package/assets/Appearance/light/themes/red/red_componentsCTA_LightModifyCategory.module.css +14 -0
  13. package/assets/Appearance/light/themes/yellow/yellow_componentsCTA_LightModifyCategory.module.css +14 -0
  14. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +3 -3
  15. package/assets/Appearance/pureDark/themes/blue/blue_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  16. package/assets/Appearance/pureDark/themes/green/green_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  17. package/assets/Appearance/pureDark/themes/orange/orange_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  18. package/assets/Appearance/pureDark/themes/red/red_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  19. package/assets/Appearance/pureDark/themes/yellow/yellow_componentsCTA_PureDarkModifyCategory.module.css +14 -0
  20. package/cbt.config.js +12 -3
  21. package/es/Avatar/Avatar.js +1 -2
  22. package/es/Button/css/cssJSLogic.js +4 -5
  23. package/es/DateTime/DateTime.js +3 -6
  24. package/es/DateTime/DateWidget.js +34 -11
  25. package/es/DateTime/YearView.js +5 -6
  26. package/es/DateTime/common.js +2 -9
  27. package/es/DateTime/dateFormatUtils/dateFormat.js +55 -76
  28. package/es/DateTime/dateFormatUtils/index.js +7 -12
  29. package/es/DateTime/dateFormatUtils/timeChange.js +3 -4
  30. package/es/DateTime/dateFormatUtils/yearChange.js +3 -4
  31. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -6
  32. package/es/Layout/utils.js +1 -2
  33. package/es/ListItem/ListContainer.js +4 -5
  34. package/es/Modal/Portal/Portal.js +4 -5
  35. package/es/MultiSelect/AdvancedGroupMultiSelect.js +91 -103
  36. package/es/MultiSelect/AdvancedMultiSelect.js +74 -80
  37. package/es/MultiSelect/MultiSelect.js +4 -13
  38. package/es/MultiSelect/Suggestions.js +14 -17
  39. package/es/Popup/Popup.js +1 -4
  40. package/es/Provider/IdProvider.js +4 -5
  41. package/es/Provider/LibraryContext.js +15 -12
  42. package/es/Provider/NumberGenerator/NumberGenerator.js +15 -17
  43. package/es/Provider/ZindexProvider.js +4 -5
  44. package/es/Responsive/CustomResponsive.js +8 -11
  45. package/es/Responsive/ResizeComponent.js +1 -3
  46. package/es/Responsive/Responsive.js +9 -12
  47. package/es/Responsive/sizeObservers.js +1 -5
  48. package/es/ResponsiveDropBox/ResponsiveDropBox.js +10 -14
  49. package/es/Select/GroupSelect.js +98 -103
  50. package/es/Select/Select.js +110 -116
  51. package/es/Select/SelectWithAvatar.js +91 -95
  52. package/es/Select/SelectWithIcon.js +104 -109
  53. package/es/Select/__tests__/Select.spec.js +6 -9
  54. package/es/Tab/Tab.js +90 -40
  55. package/es/Tab/Tab.module.css +25 -0
  56. package/es/Tab/TabContent.js +16 -19
  57. package/es/Tab/TabContentWrapper.js +19 -22
  58. package/es/Tab/TabWrapper.js +15 -16
  59. package/es/Tab/Tabs.js +105 -81
  60. package/es/Tab/Tabs.module.css +48 -3
  61. package/es/Tab/__tests__/Tab.spec.js +112 -0
  62. package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +316 -0
  63. package/es/Tab/props/defaultProps.js +3 -2
  64. package/es/Tab/props/propTypes.js +12 -3
  65. package/es/Tab/utils/tabConfigs.js +5 -0
  66. package/es/Typography/css/cssJSLogic.js +4 -5
  67. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -2
  68. package/es/utils/Common.js +10 -31
  69. package/es/utils/datetime/common.js +12 -9
  70. package/es/utils/dropDownUtils.js +7 -11
  71. package/es/utils/getInitial.js +1 -3
  72. package/es/v1/Button/css/cssJSLogic.js +4 -8
  73. package/es/v1/Label/css/cssJSLogic.js +4 -5
  74. package/es/v1/Switch/css/cssJSLogic.js +4 -5
  75. package/es/v1/helpers/colorHelpers/colorHelper.js +28 -39
  76. package/lib/DateTime/DateWidget.js +33 -6
  77. package/lib/Provider/LibraryContext.js +5 -1
  78. package/lib/Tab/Tab.js +62 -9
  79. package/lib/Tab/Tab.module.css +25 -0
  80. package/lib/Tab/Tabs.js +34 -3
  81. package/lib/Tab/Tabs.module.css +48 -3
  82. package/lib/Tab/__tests__/Tab.spec.js +115 -0
  83. package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +316 -0
  84. package/lib/Tab/props/defaultProps.js +3 -2
  85. package/lib/Tab/props/propTypes.js +14 -3
  86. package/lib/Tab/utils/tabConfigs.js +7 -1
  87. package/lib/utils/datetime/common.js +10 -2
  88. package/package.json +12 -11
@@ -1,5 +1,152 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`Tab renderBefore / renderAfter slots renderAfter renders a node to the right of the label 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ aria-controls="t7"
7
+ aria-label="Home"
8
+ aria-selected="false"
9
+ class="tab horizontal basisAuto shrinkOff"
10
+ data-id="tabMenu_Tab"
11
+ data-key="t7"
12
+ data-selector-id="tab"
13
+ data-test-id="tabMenu_Tab"
14
+ role="link"
15
+ tabindex="0"
16
+ >
17
+ <div
18
+ class="textContainer flex cover rowdir both"
19
+ data-id="containerComponent"
20
+ data-selector-id="container"
21
+ data-test-id="containerComponent"
22
+ >
23
+ <div
24
+ class="tabText grow basisAuto shrinkOff"
25
+ data-id="boxComponent"
26
+ data-selector-id="box"
27
+ data-test-id="boxComponent"
28
+ >
29
+ Home
30
+ </div>
31
+ <span>
32
+ 3
33
+ </span>
34
+ </div>
35
+ </div>
36
+ </DocumentFragment>
37
+ `;
38
+
39
+ exports[`Tab renderBefore / renderAfter slots renderBefore and renderAfter both render around the label 1`] = `
40
+ <DocumentFragment>
41
+ <div
42
+ aria-controls="t8"
43
+ aria-label="Home"
44
+ aria-selected="false"
45
+ class="tab horizontal basisAuto shrinkOff"
46
+ data-id="tabMenu_Tab"
47
+ data-key="t8"
48
+ data-selector-id="tab"
49
+ data-test-id="tabMenu_Tab"
50
+ role="link"
51
+ tabindex="0"
52
+ >
53
+ <div
54
+ class="textContainer flex cover rowdir both"
55
+ data-id="containerComponent"
56
+ data-selector-id="container"
57
+ data-test-id="containerComponent"
58
+ >
59
+ <span>
60
+
61
+ </span>
62
+ <div
63
+ class="tabText grow basisAuto shrinkOff"
64
+ data-id="boxComponent"
65
+ data-selector-id="box"
66
+ data-test-id="boxComponent"
67
+ >
68
+ Home
69
+ </div>
70
+ <span>
71
+
72
+ </span>
73
+ </div>
74
+ </div>
75
+ </DocumentFragment>
76
+ `;
77
+
78
+ exports[`Tab renderBefore / renderAfter slots renderBefore as function renders custom node 1`] = `
79
+ <DocumentFragment>
80
+ <div
81
+ aria-controls="t9"
82
+ aria-label="Home"
83
+ aria-selected="false"
84
+ class="tab horizontal basisAuto shrinkOff"
85
+ data-id="tabMenu_Tab"
86
+ data-key="t9"
87
+ data-selector-id="tab"
88
+ data-test-id="tabMenu_Tab"
89
+ role="link"
90
+ tabindex="0"
91
+ >
92
+ <div
93
+ class="textContainer flex cover rowdir both"
94
+ data-id="containerComponent"
95
+ data-selector-id="container"
96
+ data-test-id="containerComponent"
97
+ >
98
+ <span>
99
+
100
+ </span>
101
+ <div
102
+ class="tabText grow basisAuto shrinkOff"
103
+ data-id="boxComponent"
104
+ data-selector-id="box"
105
+ data-test-id="boxComponent"
106
+ >
107
+ Home
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </DocumentFragment>
112
+ `;
113
+
114
+ exports[`Tab renderBefore / renderAfter slots renderBefore renders a node to the left of the label 1`] = `
115
+ <DocumentFragment>
116
+ <div
117
+ aria-controls="t6"
118
+ aria-label="Home"
119
+ aria-selected="false"
120
+ class="tab horizontal basisAuto shrinkOff"
121
+ data-id="tabMenu_Tab"
122
+ data-key="t6"
123
+ data-selector-id="tab"
124
+ data-test-id="tabMenu_Tab"
125
+ role="link"
126
+ tabindex="0"
127
+ >
128
+ <div
129
+ class="textContainer flex cover rowdir both"
130
+ data-id="containerComponent"
131
+ data-selector-id="container"
132
+ data-test-id="containerComponent"
133
+ >
134
+ <span>
135
+
136
+ </span>
137
+ <div
138
+ class="tabText grow basisAuto shrinkOff"
139
+ data-id="boxComponent"
140
+ data-selector-id="box"
141
+ data-test-id="boxComponent"
142
+ >
143
+ Home
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </DocumentFragment>
148
+ `;
149
+
3
150
  exports[`Tab rendering the defult props 1`] = `
4
151
  <DocumentFragment>
5
152
  <div
@@ -20,3 +167,172 @@ exports[`Tab rendering the defult props 1`] = `
20
167
  </div>
21
168
  </DocumentFragment>
22
169
  `;
170
+
171
+ exports[`Tab variant-based label rendering renderIcon as function receives no args and renders custom node 1`] = `
172
+ <DocumentFragment>
173
+ <div
174
+ aria-controls="t5"
175
+ aria-label="Home"
176
+ aria-selected="false"
177
+ class="tab horizontal basisAuto shrinkOff"
178
+ data-id="tabMenu_Tab"
179
+ data-key="t5"
180
+ data-selector-id="tab"
181
+ data-test-id="tabMenu_Tab"
182
+ role="link"
183
+ tabindex="0"
184
+ >
185
+ <div
186
+ class="textContainer flex cover rowdir both"
187
+ data-id="containerComponent"
188
+ data-selector-id="container"
189
+ data-test-id="containerComponent"
190
+ >
191
+ <span>
192
+
193
+ </span>
194
+ </div>
195
+ </div>
196
+ </DocumentFragment>
197
+ `;
198
+
199
+ exports[`Tab variant-based label rendering renderIcon overrides iconName 1`] = `
200
+ <DocumentFragment>
201
+ <div
202
+ aria-controls="t4"
203
+ aria-label="Home"
204
+ aria-selected="false"
205
+ class="tab horizontal basisAuto shrinkOff"
206
+ data-id="tabMenu_Tab"
207
+ data-key="t4"
208
+ data-selector-id="tab"
209
+ data-test-id="tabMenu_Tab"
210
+ role="link"
211
+ tabindex="0"
212
+ >
213
+ <div
214
+ class="textContainer flex cover rowdir both"
215
+ data-id="containerComponent"
216
+ data-selector-id="container"
217
+ data-test-id="containerComponent"
218
+ >
219
+ <span>
220
+
221
+ </span>
222
+ <div
223
+ class="tabText grow basisAuto shrinkOff"
224
+ data-id="boxComponent"
225
+ data-selector-id="box"
226
+ data-test-id="boxComponent"
227
+ >
228
+ Home
229
+ </div>
230
+ </div>
231
+ </div>
232
+ </DocumentFragment>
233
+ `;
234
+
235
+ exports[`Tab variant-based label rendering variant="icon" renders icon and suppresses text label 1`] = `
236
+ <DocumentFragment>
237
+ <div
238
+ aria-controls="t2"
239
+ aria-label="Home"
240
+ aria-selected="false"
241
+ class="tab horizontal basisAuto shrinkOff"
242
+ data-id="tabMenu_Tab"
243
+ data-key="t2"
244
+ data-selector-id="tab"
245
+ data-test-id="tabMenu_Tab"
246
+ role="link"
247
+ tabindex="0"
248
+ >
249
+ <div
250
+ class="textContainer flex cover rowdir both"
251
+ data-id="containerComponent"
252
+ data-selector-id="container"
253
+ data-test-id="containerComponent"
254
+ >
255
+ <i
256
+ aria-hidden="true"
257
+ class="zd_font_icons basic icon-menu rtl "
258
+ data-id="fontIcon"
259
+ data-selector-id="fontIcon"
260
+ data-test-id="fontIcon"
261
+ />
262
+ </div>
263
+ </div>
264
+ </DocumentFragment>
265
+ `;
266
+
267
+ exports[`Tab variant-based label rendering variant="iconWithText" renders icon followed by text 1`] = `
268
+ <DocumentFragment>
269
+ <div
270
+ aria-controls="t3"
271
+ aria-label="Home"
272
+ aria-selected="false"
273
+ class="tab horizontal basisAuto shrinkOff"
274
+ data-id="tabMenu_Tab"
275
+ data-key="t3"
276
+ data-selector-id="tab"
277
+ data-test-id="tabMenu_Tab"
278
+ role="link"
279
+ tabindex="0"
280
+ >
281
+ <div
282
+ class="textContainer flex cover rowdir both"
283
+ data-id="containerComponent"
284
+ data-selector-id="container"
285
+ data-test-id="containerComponent"
286
+ >
287
+ <i
288
+ aria-hidden="true"
289
+ class="zd_font_icons basic icon-menu rtl "
290
+ data-id="fontIcon"
291
+ data-selector-id="fontIcon"
292
+ data-test-id="fontIcon"
293
+ />
294
+ <div
295
+ class="tabText grow basisAuto shrinkOff"
296
+ data-id="boxComponent"
297
+ data-selector-id="box"
298
+ data-test-id="boxComponent"
299
+ >
300
+ Home
301
+ </div>
302
+ </div>
303
+ </div>
304
+ </DocumentFragment>
305
+ `;
306
+
307
+ exports[`Tab variant-based label rendering variant="text" renders text only 1`] = `
308
+ <DocumentFragment>
309
+ <div
310
+ aria-controls="t1"
311
+ aria-label="Home"
312
+ aria-selected="false"
313
+ class="tab horizontal basisAuto shrinkOff"
314
+ data-id="tabMenu_Tab"
315
+ data-key="t1"
316
+ data-selector-id="tab"
317
+ data-test-id="tabMenu_Tab"
318
+ role="link"
319
+ tabindex="0"
320
+ >
321
+ <div
322
+ class="textContainer flex cover rowdir both"
323
+ data-id="containerComponent"
324
+ data-selector-id="container"
325
+ data-test-id="containerComponent"
326
+ >
327
+ <div
328
+ class="tabText grow basisAuto shrinkOff"
329
+ data-id="boxComponent"
330
+ data-selector-id="box"
331
+ data-test-id="boxComponent"
332
+ >
333
+ Home
334
+ </div>
335
+ </div>
336
+ </div>
337
+ </DocumentFragment>
338
+ `;
@@ -3,7 +3,8 @@ export const Tab_defaultProps = {
3
3
  contentAlign: 'both',
4
4
  contentAlignBox: 'row',
5
5
  customProps: {},
6
- dataSelectorId: 'tab'
6
+ dataSelectorId: 'tab',
7
+ variant: 'text'
7
8
  };
8
9
  export const TabContent_defaultProps = {
9
10
  dataId: 'tabContent',
@@ -36,7 +37,7 @@ export const Tabs_defaultProps = {
36
37
  searchBoxSize: 'small',
37
38
  searchErrorText: 'No results',
38
39
  placeHolderText: 'Search',
39
- isAbsolutePositioningNeeded: true,
40
+ isAbsolutePositioningNeeded: false,
40
41
  isRestrictScroll: false,
41
42
  moreContainerClass: ''
42
43
  };
@@ -1,4 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
+ import { VARIANT } from "../utils/tabConfigs";
3
+ const renderSlotType = PropTypes.oneOfType([PropTypes.node, PropTypes.func]);
2
4
  export const Tab_propTypes = {
3
5
  activeClass: PropTypes.string,
4
6
  align: PropTypes.oneOf(['vertical', 'horizontal']),
@@ -26,7 +28,14 @@ export const Tab_propTypes = {
26
28
  contentAlignBox: PropTypes.oneOf(['row', 'column', 'row-reverse', 'column-reverse']),
27
29
  customProps: PropTypes.object,
28
30
  isVirtual: PropTypes.bool,
29
- dataSelectorId: PropTypes.string
31
+ dataSelectorId: PropTypes.string,
32
+ variant: PropTypes.oneOf(Object.values(VARIANT)),
33
+ iconPlacement: PropTypes.string,
34
+ iconName: PropTypes.string,
35
+ iconSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
36
+ renderIcon: renderSlotType,
37
+ renderBefore: renderSlotType,
38
+ renderAfter: renderSlotType
30
39
  };
31
40
  export const TabContent_propTypes = {
32
41
  children: PropTypes.node,
@@ -82,7 +91,7 @@ export const Tabs_propTypes = {
82
91
  showTitleInMoreOptions: PropTypes.bool,
83
92
  style: PropTypes.object,
84
93
  togglePopup: PropTypes.func,
85
- type: PropTypes.oneOf(['alpha', 'beta', 'delta']),
94
+ type: PropTypes.oneOf(['alpha', 'beta', 'delta', 'default']),
86
95
  getTargetRef: PropTypes.func,
87
96
  containerClass: PropTypes.string,
88
97
  customProps: PropTypes.shape({
@@ -114,6 +123,6 @@ export const TabWrapper_propTypes = {
114
123
  needPadding: PropTypes.bool,
115
124
  needTabBorder: PropTypes.bool,
116
125
  onSelect: PropTypes.func,
117
- type: PropTypes.oneOf(['alpha', 'beta', 'delta']),
126
+ type: PropTypes.oneOf(['alpha', 'beta', 'delta', 'default']),
118
127
  dataSelectorId: PropTypes.string
119
128
  };
@@ -1,3 +1,8 @@
1
+ export const VARIANT = {
2
+ TEXT: 'text',
3
+ ICON: 'icon',
4
+ ICON_WITH_TEXT: 'iconWithText'
5
+ };
1
6
  export const TAB_ALIGN_MAPPING = {
2
7
  vertical: 'column',
3
8
  horizontal: 'row',
@@ -1,10 +1,9 @@
1
1
  import { compileClassNames } from '@zohodesk/utils';
2
2
  import { letterspacingMapping, lineheightMapping } from "../utils";
3
- export default function cssJSLogic(_ref) {
4
- let {
5
- props,
6
- style
7
- } = _ref;
3
+ export default function cssJSLogic({
4
+ props,
5
+ style
6
+ }) {
8
7
  let {
9
8
  $flag_reset,
10
9
  shouldReset,
@@ -34,8 +34,7 @@ export default class VelocityAnimationGroup extends React.Component {
34
34
 
35
35
  if (postEnterStyles && typeof postEnterStyles === 'object') {
36
36
  elements.forEach(rootElement => {
37
- Object.entries(postEnterStyles).forEach(_ref => {
38
- let [cssProperty, cssValue] = _ref;
37
+ Object.entries(postEnterStyles).forEach(([cssProperty, cssValue]) => {
39
38
  rootElement.style[cssProperty] = cssValue;
40
39
  });
41
40
  });
@@ -49,14 +49,11 @@ export function encodeForHtml(str) {
49
49
 
50
50
  return str;
51
51
  }
52
- export function getListOfDetails() {
53
- let Obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
54
- let fn = arguments.length > 1 ? arguments[1] : undefined;
52
+ export function getListOfDetails(Obj = {}, fn) {
55
53
  const ids = Object.keys(Obj) || [];
56
54
  return ids.map(id => fn(Obj[id]));
57
55
  }
58
- export function capitalize() {
59
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
56
+ export function capitalize(value = '') {
60
57
  let newValue = '';
61
58
 
62
59
  for (let i = 0; i < value.length; i++) {
@@ -69,18 +66,12 @@ export function capitalize() {
69
66
 
70
67
  return newValue;
71
68
  }
72
- export function bind() {
73
- for (var _len = arguments.length, handlers = new Array(_len), _key = 0; _key < _len; _key++) {
74
- handlers[_key] = arguments[_key];
75
- }
76
-
69
+ export function bind(...handlers) {
77
70
  handlers.forEach(handler => {
78
71
  this[handler] = this[handler].bind(this);
79
72
  });
80
73
  }
81
- export function getFullName() {
82
- let firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
83
- let lastName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
74
+ export function getFullName(firstName = '', lastName = '') {
84
75
  let fullName = '';
85
76
 
86
77
  if (firstName !== null && firstName !== '') {
@@ -93,8 +84,7 @@ export function getFullName() {
93
84
 
94
85
  return fullName;
95
86
  }
96
- export function getStringifiedOutputForJson() {
97
- let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87
+ export function getStringifiedOutputForJson(input = {}) {
98
88
  const keys = Object.keys(input);
99
89
  const modifiedInput = keys.reduce((curr, next) => {
100
90
  const values = input[next] || [];
@@ -130,19 +120,14 @@ export function filterValue(obj, val) {
130
120
  });
131
121
  return result;
132
122
  }
133
- export function merge() {
134
- let oldObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
135
- let newObj = arguments.length > 1 ? arguments[1] : undefined;
123
+ export function merge(oldObj = {}, newObj) {
136
124
  const copyOfOld = Object.assign({}, oldObj);
137
125
  return Object.keys(newObj).reduce((res, key) => {
138
126
  res[key] = Object.assign({}, res[key] || {}, newObj[key]);
139
127
  return res;
140
128
  }, copyOfOld);
141
129
  }
142
- export function formatValue() {
143
- let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
144
- let valueField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
145
- let textField = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'name';
130
+ export function formatValue(values = [], valueField = 'id', textField = 'name') {
146
131
  return values && values.map(value => {
147
132
  let formattedValue = value;
148
133
 
@@ -166,8 +151,7 @@ export function bytesToSize(bytes) {
166
151
  const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10);
167
152
  return `${Math.round(bytes / Math.pow(1024, i), 2)} ${sizes[i]}`;
168
153
  }
169
- export function getMemSize(bytes) {
170
- let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
154
+ export function getMemSize(bytes, size = !0) {
171
155
  const thresh = size ? 1000 : 1024;
172
156
 
173
157
  if (Math.abs(bytes) < thresh) {
@@ -300,11 +284,7 @@ export const debounce = function (func, wait) {
300
284
  };
301
285
  };
302
286
  let timerId;
303
- export const throttle = function (func, wait) {
304
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
305
- args[_key2 - 2] = arguments[_key2];
306
- }
307
-
287
+ export const throttle = (func, wait, ...args) => {
308
288
  if (timerId) {
309
289
  return;
310
290
  }
@@ -374,8 +354,7 @@ export function getElementSpace(elementRef) {
374
354
  availableInsideSpace: availableInsideSpace
375
355
  };
376
356
  }
377
- export function getSearchString() {
378
- let charachers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
357
+ export function getSearchString(charachers = '') {
379
358
  return (charachers || '').toString().toLowerCase().trim(); //.replace(/\s+/g, '');
380
359
  }
381
360
  export function findScrollEnd(element) {
@@ -4,9 +4,7 @@ let dateFormat = {
4
4
  monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
5
5
  timeNames: ['a', 'p', 'am', 'pm', 'A', 'P', 'AM', 'PM']
6
6
  };
7
- export function pad(n) {
8
- let width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9
- let z = arguments.length > 2 ? arguments[2] : undefined;
7
+ export function pad(n, width = 1, z) {
10
8
  z = z || '0';
11
9
  n = `${n}`;
12
10
  return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
@@ -16,7 +14,10 @@ export function getTimeOffset() {
16
14
  const matchingOffset = Object.keys(offsetMap).find(offset => GMT.getTimezoneOffset() === Number(offset));
17
15
  return matchingOffset ? offsetMap[matchingOffset].toString().split(' ') : ['', ''];
18
16
  }
19
- export function formatDate(dateMill, mask) {
17
+ export function formatDate(dateMill, mask, {
18
+ i18nShortMonths,
19
+ i18nMonths
20
+ } = {}) {
20
21
  let date = new Date(dateMill);
21
22
  let O = getTimeOffset()[0];
22
23
  let Z = getTimeOffset()[1];
@@ -28,6 +29,10 @@ export function formatDate(dateMill, mask) {
28
29
  let M = date.getMinutes();
29
30
  let s = date.getSeconds();
30
31
  let L = date.getMilliseconds();
32
+ const defaultShortMonths = dateFormat.monthNames.slice(0, 12);
33
+ const defaultMonths = dateFormat.monthNames.slice(12);
34
+ const resolvedShortMonths = Array.isArray(i18nShortMonths) ? i18nShortMonths : defaultShortMonths;
35
+ const resolvedMonths = Array.isArray(i18nMonths) ? i18nMonths : defaultMonths;
31
36
  let flags = {
32
37
  d: d,
33
38
  O: O,
@@ -40,8 +45,8 @@ export function formatDate(dateMill, mask) {
40
45
  DDDD: dateFormat.dayNames[D + 7],
41
46
  M: m + 1,
42
47
  MM: pad(m + 1, 2),
43
- MMM: dateFormat.monthNames[m],
44
- MMMM: dateFormat.monthNames[m + 12],
48
+ MMM: resolvedShortMonths[m],
49
+ MMMM: resolvedMonths[m],
45
50
  yy: String(y).slice(2),
46
51
  YY: String(y).slice(2),
47
52
  yyyy: y,
@@ -90,9 +95,7 @@ export function replaceI18NValuesWithRegex(i18nStr, values) {
90
95
  export function unescapeUnicode(str) {
91
96
  return str.replace(/\\u([a-fA-F0-9]{4})/g, (g, m1) => String.fromCharCode(parseInt(m1, 16)));
92
97
  }
93
- export function getValues() {
94
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
95
- let diff = arguments.length > 1 ? arguments[1] : undefined;
98
+ export function getValues(params = [], diff) {
96
99
  return params.map(param => diff[param]);
97
100
  }
98
101
  export function getI18NValue(i18n) {
@@ -58,10 +58,7 @@ const getSearchFields = props => {
58
58
  // }
59
59
 
60
60
 
61
- export const isObjectContainsSearchString = function () {
62
- let searchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
63
- let searchStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
64
- let obj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
61
+ export const isObjectContainsSearchString = (searchFields = [], searchStr = '', obj = {}) => {
65
62
  return searchFields.some(field => {
66
63
  const val = obj[field];
67
64
  if (val === null || val === undefined) return false;
@@ -444,13 +441,12 @@ export const makeGetOptionIdChange = () => createSelector([getOptions, getValueF
444
441
  return changedOptions;
445
442
  }, newOptions);
446
443
  });
447
- export const filterSelectedOptions = function () {
448
- let {
449
- selectedOptions = dummyArray,
450
- propSelectedOptions = dummyArray,
451
- disabledOptions = dummyArray,
452
- limit
453
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
444
+ export const filterSelectedOptions = ({
445
+ selectedOptions = dummyArray,
446
+ propSelectedOptions = dummyArray,
447
+ disabledOptions = dummyArray,
448
+ limit
449
+ } = {}) => {
454
450
  // eslint-disable-next-line no-param-reassign
455
451
  selectedOptions = selectedOptions || dummyArray; // eslint-disable-next-line no-param-reassign
456
452
 
@@ -1,6 +1,4 @@
1
- export function getInitial() {
2
- let firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
3
- let lastName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1
+ export function getInitial(firstName = '', lastName = '') {
4
2
  let initial = '';
5
3
 
6
4
  if (firstName) {
@@ -5,15 +5,11 @@ import getPaletteClasses from "../../helpers/colorHelpers/colorHelper";
5
5
  import { DUMMY_OBJECT } from '@zohodesk/dotkit/es/utils/constants';
6
6
  import { DISABLED_APPEARANCE, LOADER_PLACEMENT, SHAPE, SIZE, STATUS } from "../constants";
7
7
 
8
- const capitalize = function () {
9
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
10
- return value.charAt(0).toUpperCase() + value.slice(1);
11
- };
8
+ const capitalize = (value = '') => value.charAt(0).toUpperCase() + value.slice(1);
12
9
 
13
- export default function cssJSLogic(_ref) {
14
- let {
15
- props
16
- } = _ref;
10
+ export default function cssJSLogic({
11
+ props
12
+ }) {
17
13
  const {
18
14
  palette,
19
15
  bgAppearance,
@@ -1,10 +1,9 @@
1
1
  import compileClassNames from '@zohodesk/utils/es/compileClassNames';
2
2
  import commonStyle from "../../../common/common.module.css";
3
- export default function cssJSLogic(_ref) {
4
- let {
5
- style,
6
- props
7
- } = _ref;
3
+ export default function cssJSLogic({
4
+ style,
5
+ props
6
+ }) {
8
7
  const {
9
8
  shouldHighlightRequired,
10
9
  isRequired,
@@ -1,9 +1,8 @@
1
1
  import compileClassNames from '@zohodesk/utils/es/compileClassNames';
2
- export default function cssJSLogic(_ref) {
3
- let {
4
- props,
5
- style
6
- } = _ref;
2
+ export default function cssJSLogic({
3
+ props,
4
+ style
5
+ }) {
7
6
  const {
8
7
  size,
9
8
  isChecked,