@zohodesk/components 1.6.14 → 1.6.16

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 (53) hide show
  1. package/README.md +12 -0
  2. package/es/Avatar/Avatar.js +1 -2
  3. package/es/Button/css/cssJSLogic.js +4 -5
  4. package/es/DateTime/DateTime.js +3 -6
  5. package/es/DateTime/DateWidget.js +34 -11
  6. package/es/DateTime/YearView.js +5 -6
  7. package/es/DateTime/common.js +2 -9
  8. package/es/DateTime/dateFormatUtils/dateFormat.js +55 -76
  9. package/es/DateTime/dateFormatUtils/index.js +7 -12
  10. package/es/DateTime/dateFormatUtils/timeChange.js +3 -4
  11. package/es/DateTime/dateFormatUtils/yearChange.js +3 -4
  12. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -6
  13. package/es/Layout/utils.js +1 -2
  14. package/es/ListItem/ListContainer.js +4 -5
  15. package/es/Modal/Portal/Portal.js +4 -5
  16. package/es/MultiSelect/AdvancedGroupMultiSelect.js +91 -103
  17. package/es/MultiSelect/AdvancedMultiSelect.js +74 -80
  18. package/es/MultiSelect/MultiSelect.js +4 -13
  19. package/es/MultiSelect/Suggestions.js +14 -17
  20. package/es/Popup/Popup.js +1 -4
  21. package/es/Provider/IdProvider.js +4 -5
  22. package/es/Provider/LibraryContext.js +11 -12
  23. package/es/Provider/NumberGenerator/NumberGenerator.js +15 -17
  24. package/es/Provider/ZindexProvider.js +4 -5
  25. package/es/Responsive/CustomResponsive.js +8 -11
  26. package/es/Responsive/ResizeComponent.js +1 -3
  27. package/es/Responsive/Responsive.js +9 -12
  28. package/es/Responsive/sizeObservers.js +1 -5
  29. package/es/ResponsiveDropBox/ResponsiveDropBox.js +10 -14
  30. package/es/Select/GroupSelect.js +98 -103
  31. package/es/Select/Select.js +110 -114
  32. package/es/Select/SelectWithAvatar.js +91 -95
  33. package/es/Select/SelectWithIcon.js +104 -109
  34. package/es/Select/__tests__/Select.spec.js +6 -9
  35. package/es/Tab/Tab.js +29 -30
  36. package/es/Tab/TabContent.js +16 -19
  37. package/es/Tab/TabContentWrapper.js +19 -22
  38. package/es/Tab/TabWrapper.js +15 -16
  39. package/es/Tab/Tabs.js +80 -87
  40. package/es/Typography/css/cssJSLogic.js +4 -5
  41. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -2
  42. package/es/utils/Common.js +10 -31
  43. package/es/utils/datetime/common.js +12 -9
  44. package/es/utils/dropDownUtils.js +7 -11
  45. package/es/utils/getInitial.js +1 -3
  46. package/es/v1/Button/css/cssJSLogic.js +4 -8
  47. package/es/v1/Label/css/cssJSLogic.js +4 -5
  48. package/es/v1/Switch/css/cssJSLogic.js +4 -5
  49. package/es/v1/helpers/colorHelpers/colorHelper.js +28 -39
  50. package/lib/DateTime/DateWidget.js +33 -6
  51. package/lib/Select/Select.js +3 -1
  52. package/lib/utils/datetime/common.js +10 -2
  53. package/package.json +2 -2
package/es/Tab/Tabs.js CHANGED
@@ -107,8 +107,7 @@ class Tabs extends React.Component {
107
107
  }
108
108
  }
109
109
 
110
- setMaxDim() {
111
- let totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
110
+ setMaxDim(totalDimension = 0) {
112
111
  let {
113
112
  selectedTab
114
113
  } = this.props; // let actual = Object.keys(tabDimensions).reduce(
@@ -409,10 +408,9 @@ class Tabs extends React.Component {
409
408
  togglePopup(e, boxPosition);
410
409
  }
411
410
 
412
- responsiveFunc(_ref) {
413
- let {
414
- mediaQueryOR
415
- } = _ref;
411
+ responsiveFunc({
412
+ mediaQueryOR
413
+ }) {
416
414
  return {
417
415
  tabletMode: mediaQueryOR([{
418
416
  maxWidth: 700
@@ -432,10 +430,9 @@ class Tabs extends React.Component {
432
430
  });
433
431
  }
434
432
 
435
- getMoreList(_ref2) {
436
- let {
437
- moreTabs
438
- } = _ref2;
433
+ getMoreList({
434
+ moreTabs
435
+ }) {
439
436
  const validElements = [];
440
437
  React.Children.map(moreTabs, child => {
441
438
  const isValidElement = /*#__PURE__*/React.isValidElement(child);
@@ -447,10 +444,9 @@ class Tabs extends React.Component {
447
444
  return validElements;
448
445
  }
449
446
 
450
- handleFilterSuggestions(_ref3) {
451
- let {
452
- moreTabs
453
- } = _ref3;
447
+ handleFilterSuggestions({
448
+ moreTabs
449
+ }) {
454
450
  const {
455
451
  showTitleInMoreOptions
456
452
  } = this.props;
@@ -582,82 +578,79 @@ class Tabs extends React.Component {
582
578
  })), isPopupOpen && /*#__PURE__*/React.createElement(ResponsiveReceiver, {
583
579
  query: this.responsiveFunc,
584
580
  responsiveId: "Helmet"
585
- }, _ref4 => {
581
+ }, ({
582
+ tabletMode
583
+ }) => /*#__PURE__*/React.createElement(ResponsiveDropBox, _extends({
584
+ isActive: isPopupReady,
585
+ isAnimate: true,
586
+ size: "medium",
587
+ customClass: {
588
+ customDropBoxWrap: `${moreContainerClass} ${popupClass}`
589
+ },
590
+ boxPosition: position,
591
+ getRef: getContainerRef,
592
+ isBoxPaddingNeed: false,
593
+ isArrow: false,
594
+ isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
595
+ isRestrictScroll: isRestrictScroll,
596
+ positionsOffset: positionsOffset,
597
+ targetOffset: targetOffset
598
+ }, DropBoxProps, {
599
+ isResponsivePadding: true,
600
+ needFocusScope: true,
601
+ dataId: `${dataId}_dropbox`,
602
+ onClick: removeClose,
603
+ onClose: this.togglePopup
604
+ }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(this.props), hasSearch ? /*#__PURE__*/React.createElement(Box, {
605
+ className: tabsStyle.search
606
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
607
+ placeHolder: placeHolderText,
608
+ onChange: this.handleChange,
609
+ value: searchValue,
610
+ onClear: this.handleSearchValueClear,
611
+ size: searchBoxSize,
612
+ customProps: {
613
+ TextBoxProps: {
614
+ 'data-a11y-autofocus': true
615
+ }
616
+ },
617
+ dataId: `${dataId}_search`,
618
+ autoComplete: false,
619
+ name: "search"
620
+ }, TextBoxIconProps))) : null, /*#__PURE__*/React.createElement(Box, {
621
+ flexible: true,
622
+ shrink: true,
623
+ scroll: "vertical",
624
+ className: `${tabsStyle.listWrapper} ${tabletMode ? '' : tabsStyle.menuBox} ${moreBoxClass}`,
625
+ onScroll: this.onScroll,
626
+ dataId: `${dataId}_Tabs`
627
+ }, moreTabsListItems.length ? moreTabsListItems.map(data => {
586
628
  let {
587
- tabletMode
588
- } = _ref4;
589
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, _extends({
590
- isActive: isPopupReady,
591
- isAnimate: true,
592
- size: "medium",
629
+ text,
630
+ id,
631
+ title,
632
+ isLink,
633
+ href,
634
+ children,
635
+ dataId
636
+ } = data;
637
+ const value = text ? text : showTitleInMoreOptions ? title : null;
638
+ return /*#__PURE__*/React.createElement(ListItem, _extends({
639
+ key: id,
640
+ value: value,
641
+ onClick: this.moreTabSelect,
642
+ id: id,
643
+ title: title || text,
644
+ isLink: isLink,
645
+ href: href,
646
+ autoHover: true,
593
647
  customClass: {
594
- customDropBoxWrap: `${moreContainerClass} ${popupClass}`
595
- },
596
- boxPosition: position,
597
- getRef: getContainerRef,
598
- isBoxPaddingNeed: false,
599
- isArrow: false,
600
- isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
601
- isRestrictScroll: isRestrictScroll,
602
- positionsOffset: positionsOffset,
603
- targetOffset: targetOffset
604
- }, DropBoxProps, {
605
- isResponsivePadding: true,
606
- needFocusScope: true,
607
- dataId: `${dataId}_dropbox`,
608
- onClick: removeClose,
609
- onClose: this.togglePopup
610
- }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(this.props), hasSearch ? /*#__PURE__*/React.createElement(Box, {
611
- className: tabsStyle.search
612
- }, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
613
- placeHolder: placeHolderText,
614
- onChange: this.handleChange,
615
- value: searchValue,
616
- onClear: this.handleSearchValueClear,
617
- size: searchBoxSize,
618
- customProps: {
619
- TextBoxProps: {
620
- 'data-a11y-autofocus': true
621
- }
648
+ customListItem: menuItemClass
622
649
  },
623
- dataId: `${dataId}_search`,
624
- autoComplete: false,
625
- name: "search"
626
- }, TextBoxIconProps))) : null, /*#__PURE__*/React.createElement(Box, {
627
- flexible: true,
628
- shrink: true,
629
- scroll: "vertical",
630
- className: `${tabsStyle.listWrapper} ${tabletMode ? '' : tabsStyle.menuBox} ${moreBoxClass}`,
631
- onScroll: this.onScroll,
632
- dataId: `${dataId}_Tabs`
633
- }, moreTabsListItems.length ? moreTabsListItems.map(data => {
634
- let {
635
- text,
636
- id,
637
- title,
638
- isLink,
639
- href,
640
- children,
641
- dataId
642
- } = data;
643
- const value = text ? text : showTitleInMoreOptions ? title : null;
644
- return /*#__PURE__*/React.createElement(ListItem, _extends({
645
- key: id,
646
- value: value,
647
- onClick: this.moreTabSelect,
648
- id: id,
649
- title: title || text,
650
- isLink: isLink,
651
- href: href,
652
- autoHover: true,
653
- customClass: {
654
- customListItem: menuItemClass
655
- },
656
- target: "self",
657
- dataId: `${dataId}_Tab`
658
- }, ListItemProps), !showTitleInMoreOptions ? children : null);
659
- }) : this.renderEmptyState()));
660
- })) : null);
650
+ target: "self",
651
+ dataId: `${dataId}_Tab`
652
+ }, ListItemProps), !showTitleInMoreOptions ? children : null);
653
+ }) : this.renderEmptyState())))) : null);
661
654
  }
662
655
 
663
656
  render() {
@@ -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,
@@ -48,37 +48,27 @@ const toBorderIntensity = (tone, hasState, isLighter) => {
48
48
  return `${tone}-${isLighter ? intensity.borderLight : intensity.base}`;
49
49
  };
50
50
 
51
- export const getBgClass = _ref => {
52
- let {
53
- state,
54
- tone,
55
- isLighter
56
- } = _ref;
57
- return paletteBgStyle[withState(state, `bg-${toBgIntensity(tone, !!state, isLighter)}`)];
58
- };
59
- export const getTextClass = _ref2 => {
60
- let {
61
- state,
62
- textTone
63
- } = _ref2;
64
- return paletteTextStyle[withState(state, `text-${toTextIntensity(textTone, !!state)}`)];
65
- };
66
- export const getBorderClass = _ref3 => {
67
- let {
68
- state,
69
- tone,
70
- isLighter
71
- } = _ref3;
72
- return paletteBorderStyle[withState(state, `border-${toBorderIntensity(tone, !!state, isLighter)}`)];
73
- };
74
-
75
- const buildPaletteClasses = (config, _ref4) => {
76
- let {
77
- bgAppearance,
78
- borderAppearance,
79
- paletteShade,
80
- isSelected
81
- } = _ref4;
51
+ export const getBgClass = ({
52
+ state,
53
+ tone,
54
+ isLighter
55
+ }) => paletteBgStyle[withState(state, `bg-${toBgIntensity(tone, !!state, isLighter)}`)];
56
+ export const getTextClass = ({
57
+ state,
58
+ textTone
59
+ }) => paletteTextStyle[withState(state, `text-${toTextIntensity(textTone, !!state)}`)];
60
+ export const getBorderClass = ({
61
+ state,
62
+ tone,
63
+ isLighter
64
+ }) => paletteBorderStyle[withState(state, `border-${toBorderIntensity(tone, !!state, isLighter)}`)];
65
+
66
+ const buildPaletteClasses = (config, {
67
+ bgAppearance,
68
+ borderAppearance,
69
+ paletteShade,
70
+ isSelected
71
+ }) => {
82
72
  const {
83
73
  tone,
84
74
  textTone,
@@ -159,14 +149,13 @@ const buildPaletteClasses = (config, _ref4) => {
159
149
  };
160
150
  };
161
151
 
162
- const getPaletteClasses = _ref5 => {
163
- let {
164
- palette,
165
- bgAppearance,
166
- borderAppearance,
167
- paletteShade,
168
- isSelected
169
- } = _ref5;
152
+ const getPaletteClasses = ({
153
+ palette,
154
+ bgAppearance,
155
+ borderAppearance,
156
+ paletteShade,
157
+ isSelected
158
+ }) => {
170
159
  const config = PALETTE_CONFIG[palette];
171
160
  return config ? buildPaletteClasses(config, {
172
161
  bgAppearance,
@@ -102,6 +102,7 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
102
102
  _this.handleDateIconClick = _this.handleDateIconClick.bind(_assertThisInitialized(_this));
103
103
  _this.handleSelectionRangeDetails = _this.handleSelectionRangeDetails.bind(_assertThisInitialized(_this));
104
104
  _this.handleBlurSelectionRange = _this.handleBlurSelectionRange.bind(_assertThisInitialized(_this));
105
+ _this.getI18nMonthLabels = _this.getI18nMonthLabels.bind(_assertThisInitialized(_this));
105
106
  _this.state = {
106
107
  selected: '',
107
108
  displayText: '',
@@ -313,6 +314,15 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
313
314
 
314
315
  !isOpenOnly && togglePopup(e, "".concat(defaultPosition, "Right"));
315
316
  }
317
+ }, {
318
+ key: "getI18nMonthLabels",
319
+ value: function getI18nMonthLabels() {
320
+ var i18nKeys = this.props.i18nKeys;
321
+ return {
322
+ i18nShortMonths: i18nKeys.monthNamesShort || _constants.i18nShortMonths,
323
+ i18nMonths: i18nKeys.monthNames || _constants.i18nMonths
324
+ };
325
+ }
316
326
  }, {
317
327
  key: "handleSelectionRangeDetails",
318
328
  value: function handleSelectionRangeDetails(props) {
@@ -328,7 +338,12 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
328
338
  hour = _this$state2.hour,
329
339
  minute = _this$state2.minute,
330
340
  noon = _this$state2.noon;
331
- var selected = value === _constants.INVALID_DATE ? '' : value; //New UI Changes
341
+ var selected = value === _constants.INVALID_DATE ? '' : value;
342
+
343
+ var _this$getI18nMonthLab = this.getI18nMonthLabels(),
344
+ localizedShortMonths = _this$getI18nMonthLab.i18nShortMonths,
345
+ localizedMonths = _this$getI18nMonthLab.i18nMonths; //New UI Changes
346
+
332
347
 
333
348
  var dateFormatDetails = (0, _dateFormat.getDateFormatDetails)(dateFormat, {
334
349
  isHideCurrentYear: false,
@@ -337,8 +352,8 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
337
352
  isDateTime: isDateTime
338
353
  });
339
354
  var dateFormatSelection = (0, _dateFormat.getDateFormatSelection)(dateFormatDetails, isDateTime, {
340
- i18nShortMonths: _constants.i18nShortMonths,
341
- i18nMonths: _constants.i18nMonths,
355
+ i18nShortMonths: localizedShortMonths,
356
+ i18nMonths: localizedMonths,
342
357
  selectedValue: selected,
343
358
  day: day,
344
359
  month: month,
@@ -365,6 +380,11 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
365
380
  value = props.value,
366
381
  is24Hour = props.is24Hour,
367
382
  isHideCurrentYear = props.isHideCurrentYear;
383
+
384
+ var _this$getI18nMonthLab2 = this.getI18nMonthLabels(),
385
+ localizedShortMonths = _this$getI18nMonthLab2.i18nShortMonths,
386
+ localizedMonths = _this$getI18nMonthLab2.i18nMonths;
387
+
368
388
  var dateFormatDetails = (0, _dateFormat.getDateFormatDetails)(dateFormat, {
369
389
  isHideCurrentYear: isHideCurrentYear,
370
390
  value: value,
@@ -383,7 +403,10 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
383
403
  format = "".concat(newDateFormat, " ").concat(is24Hour ? 'HH:mm' : 'hh:mm A');
384
404
  }
385
405
 
386
- displayText = (0, _common.formatDate)(convertedValue, format);
406
+ displayText = (0, _common.formatDate)(convertedValue, format, {
407
+ i18nShortMonths: localizedShortMonths,
408
+ i18nMonths: localizedMonths
409
+ });
387
410
  }
388
411
 
389
412
  return {
@@ -849,6 +872,10 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
849
872
  isPopupOpen = _this$props9.isPopupOpen;
850
873
 
851
874
  if (isDateEdited || isFocused || isPopupReady || isPopupOpen) {
875
+ var _this$getI18nMonthLab3 = this.getI18nMonthLabels(),
876
+ localizedShortMonths = _this$getI18nMonthLab3.i18nShortMonths,
877
+ localizedMonths = _this$getI18nMonthLab3.i18nMonths;
878
+
852
879
  var _getDateDetails2 = (0, _dateFormat.getDateDetails)(selected, {
853
880
  day: day,
854
881
  month: month,
@@ -880,8 +907,8 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
880
907
  minute: selectedMinute,
881
908
  noon: selectedNoon
882
909
  }, dateFormatDetails, isDateTime, {
883
- i18nShortMonths: _constants.i18nShortMonths,
884
- i18nMonths: _constants.i18nMonths,
910
+ i18nShortMonths: localizedShortMonths,
911
+ i18nMonths: localizedMonths,
885
912
  is24Hour: is24Hour
886
913
  });
887
914
  return dateTimeString;
@@ -1136,7 +1136,9 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
1136
1136
  }), isFetchingOptions && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
1137
1137
  isCover: false,
1138
1138
  align: "both"
1139
- }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))), getFooter ? /*#__PURE__*/_react["default"].createElement(_Card.CardFooter, null, getFooter()) : null)) : /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
1139
+ }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))), getFooter ? /*#__PURE__*/_react["default"].createElement(_Card.CardFooter, null, getFooter({
1140
+ closePopup: _this7.handlePopupClose
1141
+ })) : null)) : /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
1140
1142
  flexible: true
1141
1143
  }, getChildren())));
1142
1144
  }) : null);