@zohodesk/components 1.0.0-alpha-264 → 1.0.0-alpha-265

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,6 +33,12 @@ In this Package, we Provide Some Basic Components to Build Web App
33
33
  - Tooltip
34
34
 
35
35
 
36
+ # 1.0.0-alpha-265
37
+
38
+ - **mergeStyle** - Logic Issue Fixed
39
+ - **Tab** - State Restricted Names Check added
40
+ - **cancelBubblingEffect** function added in utils/Common
41
+
36
42
  # 1.0.0-alpha-264
37
43
 
38
44
  - **DropBox** - customStyle renamed to customInlineStyle and migrarted to functional UCL component
@@ -15,9 +15,8 @@ import { formatDate, getMonthEnd } from '../utils/datetime/common';
15
15
  import { getIsEmptyValue } from '../utils/Common';
16
16
  import { monthNamesDefault, monthNamesShortDefault, dayNamesDefault, dayNamesShortDefault, ampmTextDefault } from './constants';
17
17
  import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
18
- import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
19
18
  import { Box } from '../Layout';
20
- import { getHourDetails } from './dateFormatUtils';
19
+ import { getHourSuggestions, getMinuteSuggestions, addZeroIfNeeded } from './dateFormatUtils';
21
20
  function title(date, year, month) {
22
21
  let monthNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
23
22
  const HeadingText = `${monthNames[month] || ''} ${year}`;
@@ -48,26 +47,6 @@ export default class DateTime extends React.PureComponent {
48
47
  const {
49
48
  ampmText = ampmTextDefault
50
49
  } = props.i18nKeys;
51
- const {
52
- startPoint: hourStart,
53
- endPoint: hourEnd
54
- } = getHourDetails(props.is24Hour);
55
- this.hourSuggestions = (() => {
56
- const hourArr = [];
57
- for (let hour = hourStart; hour <= hourEnd; hour++) {
58
- const htxt = hour < 10 ? `0${hour}` : `${hour}`;
59
- hourArr.push(htxt);
60
- }
61
- return hourArr;
62
- })();
63
- this.minSuggestions = (() => {
64
- const minArr = [];
65
- for (let minute = 0; minute <= 59; minute++) {
66
- const mtxt = minute < 10 ? `0${minute}` : `${minute}`;
67
- minArr.push(mtxt);
68
- }
69
- return minArr;
70
- })();
71
50
  this.ampmSuggestions = (() => {
72
51
  const ampmSuggestions = [];
73
52
  ampmText.forEach((text, index) => {
@@ -140,7 +119,7 @@ export default class DateTime extends React.PureComponent {
140
119
  year = dateObj.getFullYear();
141
120
  hours = defaultHour ? defaultHour : dateObj.getHours();
142
121
  mins = !getIsEmptyValue(defaultMin) ? defaultMin : dateObj.getMinutes();
143
- mins = mins < 10 ? `0${mins}` : mins;
122
+ mins = addZeroIfNeeded(mins);
144
123
  amPm = defaultAmPm ? defaultAmPm : hours < 12 ? 'AM' : 'PM';
145
124
  hours = this.getHours(hours, is24Hour);
146
125
  return {
@@ -164,7 +143,7 @@ export default class DateTime extends React.PureComponent {
164
143
  hours -= 12;
165
144
  }
166
145
  }
167
- hours = hours < 10 ? `0${hours}` : hours;
146
+ hours = addZeroIfNeeded(hours);
168
147
  return hours;
169
148
  }
170
149
  handleGetSelectedDate() {
@@ -563,16 +542,6 @@ export default class DateTime extends React.PureComponent {
563
542
  isMonthOpen: false
564
543
  });
565
544
  }
566
- responsiveFunc(_ref) {
567
- let {
568
- mediaQueryOR
569
- } = _ref;
570
- return {
571
- tabletMode: mediaQueryOR([{
572
- maxWidth: 700
573
- }])
574
- };
575
- }
576
545
  render() {
577
546
  const {
578
547
  date,
@@ -653,12 +622,12 @@ export default class DateTime extends React.PureComponent {
653
622
  }), isDateTimeField ? /*#__PURE__*/React.createElement(Time, {
654
623
  timeText: timeText,
655
624
  dataId: dataId,
656
- hourSuggestions: this.hourSuggestions,
625
+ hourSuggestions: getHourSuggestions(),
657
626
  onHourSelect: this.hoursSelect,
658
627
  hours: hours,
659
628
  hourEmptyText: hourEmptyText,
660
629
  needResponsive: needResponsive,
661
- minSuggestions: this.minSuggestions,
630
+ minSuggestions: getMinuteSuggestions(),
662
631
  onMinutesSelect: this.minutesSelect,
663
632
  mins: mins,
664
633
  minuteEmptyText: minuteEmptyText,
@@ -686,35 +655,27 @@ export default class DateTime extends React.PureComponent {
686
655
  return isDefaultPosition ? /*#__PURE__*/React.createElement("div", {
687
656
  className: `${style.dropBox} ${className}`,
688
657
  "data-id": `${dataId}_dateBoxContainer`
689
- }, childEle) : isReady ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
690
- query: this.responsiveFunc,
691
- responsiveId: "Helmet"
692
- }, _ref2 => {
693
- let {
694
- tabletMode
695
- } = _ref2;
696
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
697
- size: boxSize,
698
- boxPosition: position,
699
- isActive: isActive,
700
- isArrow: false,
701
- isAnimate: isAnimate,
702
- animationStyle: "bounce",
703
- getRef: getRef,
704
- onClick: onClick,
705
- dataId: `${dataId}_dateBoxContainer`,
706
- needResponsive: needResponsive,
707
- isAbsolutePositioningNeeded: isAbsolute,
708
- customClass: {
709
- customDropBoxWrap: className
710
- },
711
- isPadding: isPadding,
712
- positionsOffset: positionsOffset,
713
- targetOffset: targetOffset,
714
- isRestrictScroll: isRestrictScroll,
715
- portalId: dropBoxPortalId
716
- }, /*#__PURE__*/React.createElement(Box, null, childEle));
717
- }) : null;
658
+ }, childEle) : isReady ? /*#__PURE__*/React.createElement(ResponsiveDropBox, {
659
+ size: boxSize,
660
+ boxPosition: position,
661
+ isActive: isActive,
662
+ isArrow: false,
663
+ isAnimate: isAnimate,
664
+ animationStyle: "bounce",
665
+ getRef: getRef,
666
+ onClick: onClick,
667
+ dataId: `${dataId}_dateBoxContainer`,
668
+ needResponsive: needResponsive,
669
+ isAbsolutePositioningNeeded: isAbsolute,
670
+ customClass: {
671
+ customDropBoxWrap: className
672
+ },
673
+ isPadding: isPadding,
674
+ positionsOffset: positionsOffset,
675
+ targetOffset: targetOffset,
676
+ isRestrictScroll: isRestrictScroll,
677
+ portalId: dropBoxPortalId
678
+ }, /*#__PURE__*/React.createElement(Box, null, childEle)) : null;
718
679
  }
719
680
  }
720
681
  DateTime.propTypes = DateTime_propTypes;
@@ -0,0 +1,43 @@
1
+ // Date Pattern Letters And its Meanings :-
2
+ // 1. d/D: day without 0 prefix on single digit.
3
+ // 2. dd/DD: day with 0 prefix if single digit.
4
+ // 3. M: Month without 0 prefix on single digit.
5
+ // 4. MM: Month with 0 prefix if single digit.
6
+ // 5. yy/YY: Last two digit of year.
7
+ // 6. yyyy/YYYY: represents full year.
8
+ // 7. HH: 24 hour based hour. ie. 13:00. **H** will display hour without prefix 0 if single digit
9
+ // 8. hh: 12 hour based hour. ie. 01:00. **h** will display hour without prefix 0 if single digit
10
+ // 9. m: minute without 0 prefix on single digit.
11
+ // 10.mm: minute with 0 prefix if single digit.
12
+ // 11.s: second without 0 prefix on single digit.
13
+ // 12.ss: second with 0 prefix if single digit.
14
+ // 13.S: milliseconds with 0 prefix if single digit.
15
+ // 14.a: represent the AM or PM
16
+ // 15.A: represent the AM or PM
17
+ // 16.Z: represent the timezone (Asia/Kolkata)
18
+ // 17. (O) : Offset Of the timezone (GMT+00:00)
19
+
20
+ export const dateSymbols = {
21
+ d: 'date',
22
+ dd: 'date',
23
+ DD: 'date',
24
+ M: 'month',
25
+ MM: 'month',
26
+ yy: 'year',
27
+ YY: 'year',
28
+ YYYY: 'year',
29
+ yyyy: 'year',
30
+ h: 'hour',
31
+ hh: 'hour',
32
+ H: 'hour',
33
+ HH: 'hour',
34
+ m: 'minute',
35
+ mm: 'minute',
36
+ s: 'second',
37
+ ss: 'second',
38
+ S: 'millisecond',
39
+ a: 'AMPM',
40
+ Z: 'timezone',
41
+ O: 'offset'
42
+ };
43
+ export const dataFormatList = ['yyyy/MM/dd', 'yyyy-MM-dd', 'yyyy.MM.dd', 'yyyy MM dd', 'MM/dd/yyyy', 'MM-dd-yyyy', 'MM.dd.yyyy', 'MM dd yyyy', 'dd/MM/yyyy', 'dd-MM-yyyy', 'dd.MM.yyyy', 'dd MM yyyy', 'yyyy/MMM/dd', 'yyyy-MMM-dd', 'yyyy.MMM.dd', 'yyyy MMM dd', 'MMM/dd/yyyy', 'MMM-dd-yyyy', 'MMM.dd.yyyy', 'MMM dd yyyy', 'dd/MMM/yyyy', 'dd-MMM-yyyy', 'dd.MMM.yyyy', 'dd MMM yyyy', 'dd/MMMM/yyyy', 'dd-MMMM-yyyy', 'dd-MMMM-yyyy', 'dd MMMM yyyy', 'MMMM/dd/yyyy', 'MMMM-dd-yyyy', 'MMMM.dd.yyyy', 'MMMM dd yyyy', 'yyyy/MMMM/dd', 'yyyy-MMMM-dd', 'yyyy.MMMM.dd', 'yyyy MMMM dd', 'dd/MM/YY', 'dd-MM-YY', 'dd.MM.YY', 'dd MM YY', 'MM/dd/YY', 'MM-dd-YY', 'MM.dd.YY', 'MM dd YY', 'YY/MM/dd', 'YY-MM-dd', 'YY.MM.dd', 'YY MM dd', 'dd/MMM/YY', 'dd-MMM-YY', 'dd.MMM.YY', 'dd MMM YY', 'MMM/dd/YY', 'MMM-dd-YY', 'MMM.dd.YY', 'MMM dd YY', 'YY/MMM/dd', 'YY-MMM-dd', 'YY.MMM.dd', 'YY MMM dd', 'dd/MMMM/YY', 'dd-MMMM-YY', 'dd.MMMM.YY', 'dd MMMM YY', 'MMMM/dd/YY', 'MMMM-dd-YY', 'MMMM.dd.YY', 'MMMM dd YY', 'YY/MMMM/dd', 'YY-MMMM-dd', 'YY.MMMM.dd', 'YY MMMM dd'];
@@ -109,12 +109,39 @@ export function getHourDetails(is24Hour) {
109
109
  endPoint: is24Hour ? 23 : 12
110
110
  };
111
111
  }
112
+ export function getHourSuggestions(is24Hour) {
113
+ const {
114
+ startPoint,
115
+ endPoint
116
+ } = getHourDetails(is24Hour);
117
+ const hourArr = [];
118
+ for (let hour = startPoint; hour <= endPoint; hour++) {
119
+ const htxt = addZeroIfNeeded(hour);
120
+ hourArr.push(htxt);
121
+ }
122
+ return hourArr;
123
+ }
112
124
  export function getMinuteDetails() {
113
125
  return {
114
126
  startPoint: 0,
115
127
  endPoint: 59
116
128
  };
117
129
  }
130
+ export function getMinuteSuggestions() {
131
+ const {
132
+ startPoint,
133
+ endPoint
134
+ } = getMinuteDetails();
135
+ const minArr = [];
136
+ for (let minute = startPoint; minute <= endPoint; minute++) {
137
+ const mtxt = addZeroIfNeeded(minute);
138
+ minArr.push(mtxt);
139
+ }
140
+ return minArr;
141
+ }
142
+ export function addZeroIfNeeded(value) {
143
+ return value < 10 ? `0${value}` : value;
144
+ }
118
145
  export function getIsNoonValueTyped(event) {
119
146
  const {
120
147
  keyCode
@@ -1,4 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
+ import { dataFormatList } from '../dateFormatUtils/dateFormats';
2
3
  export const CalendarView_propTypes = {
3
4
  dataId: PropTypes.string,
4
5
  date: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -71,7 +72,7 @@ export const DateWidget_propTypes = {
71
72
  className: PropTypes.string,
72
73
  closePopupOnly: PropTypes.func,
73
74
  dataId: PropTypes.string,
74
- dateFormat: PropTypes.oneOf(['yyyy/MM/dd', 'MM/dd/yyyy', 'dd/MM/yyyy', 'yyyy-MM-dd', 'MM-dd-yyyy', 'dd-MM-yyyy', 'yyyy.MM.dd', 'MM.dd.yyyy', 'dd.MM.yyyy', 'dd/MMMM/YY', 'dd/MMM/YY']),
75
+ dateFormat: PropTypes.oneOf([...dataFormatList]),
75
76
  defaultPosition: PropTypes.oneOf(['top', 'bottom', 'right', 'left']),
76
77
  defaultTime: PropTypes.string,
77
78
  getContainerRef: PropTypes.func,
@@ -8,13 +8,11 @@ import cssJSLogic from './css/cssJSLogic';
8
8
  import DropBoxElement from './DropBoxElement/DropBoxElement';
9
9
  import { DropBoxDefaultProps } from './props/defaultProps';
10
10
  import { DropBoxPropTypes } from './props/propTypes';
11
+ import { cancelBubblingEffect } from './../utils/Common';
11
12
  import style from './css/DropBox.module.css';
12
13
  export default function DropBox(props) {
13
14
  const focusRef = useRef(null);
14
15
  const DropBoxContext = useContext(LibraryContext);
15
- const onFreezeClick = e => {
16
- e && e.stopPropagation();
17
- };
18
16
  const {
19
17
  needResponsive,
20
18
  portalId,
@@ -64,13 +62,13 @@ export default function DropBox(props) {
64
62
  }, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
65
63
  className: `${style.freezeLayer} ${style.freeze}`,
66
64
  style: zIndexStyle,
67
- onClick: onFreezeClick
65
+ onClick: cancelBubblingEffect
68
66
  }), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/React.createElement(Modal, {
69
67
  portalId: portalId
70
68
  }, /*#__PURE__*/React.createElement(Fragment, null, isRestrictScroll ? /*#__PURE__*/React.createElement("div", {
71
69
  className: style.freezeLayer,
72
70
  style: zIndexStyle,
73
- onClick: onFreezeClick
71
+ onClick: cancelBubblingEffect
74
72
  }) : null, dropBoxEle)) : dropBoxEle;
75
73
  }
76
74
  DropBox.propTypes = DropBoxPropTypes;
@@ -125,9 +125,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
125
125
  } else {
126
126
  this.handleChange([...selectedOptions, option], e);
127
127
  }
128
- // e && e.stopPropagation && this.handlePopupClose(e);
129
128
  }
130
-
131
129
  handleFormatOptions(props) {
132
130
  const {
133
131
  options,
@@ -469,10 +469,7 @@ export class MultiSelectComponent extends React.Component {
469
469
  } else {
470
470
  this.handleChange([...selectedOptions, option], e);
471
471
  }
472
-
473
- // e && e.stopPropagation && this.handlePopupClose(e);
474
472
  }
475
-
476
473
  handleRemoveOption(options) {
477
474
  const newOptions = !getIsEmptyValue(options) && !Array.isArray(options) ? [options] : options;
478
475
  const {
package/es/Popup/Popup.js CHANGED
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
5
5
  import hoistStatics from 'hoist-non-react-statics';
6
6
 
7
7
  /**** Methods ****/
8
- import { debounce, isDescendant, isTextSelected } from '../utils/Common.js';
8
+ import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from '../utils/Common.js';
9
9
  import viewPort from './viewPort';
10
10
  import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from './PositionMapping.json';
11
11
  import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
@@ -376,8 +376,7 @@ const Popup = function (Component) {
376
376
  }
377
377
  removeClose(e) {
378
378
  // e && e.preventDefault && e.preventDefault();
379
- e && e.stopPropagation && e.stopPropagation();
380
- e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
379
+ cancelBubblingEffect(e);
381
380
  }
382
381
  handlePopupPosition() {
383
382
  let defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
package/es/Tab/Tab.js CHANGED
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  /* eslint-disable react/forbid-component-props */
3
- /* eslint css-modules/no-unused-class: [2, { markAsUsed: ['text', 'tabAlpha', 'alphaActive', 'gammaActive', 'betaActive', 'zetaActive', 'deltaActive', 'tabGamma', 'tabBeta', 'tabDelta', 'tabZeta', 'specialActive', 'tabSpecial', 'alphaActive_border', 'gammaActive_border', 'betaActive_border', 'zetaActive_border', 'deltaActive_border'] }] */
3
+ /* eslint css-modules/no-unused-class: [2, { markAsUsed: ['text', 'tabAlpha', 'alphaActive', 'gammaActive', 'betaActive', 'deltaActive', 'tabGamma', 'tabBeta', 'tabDelta',', 'specialActive', 'tabSpecial', 'alphaActive_border', 'gammaActive_border', 'betaActive_border', 'deltaActive_border'] }] */
4
4
 
5
5
  import React, { useMemo, useCallback } from 'react';
6
6
  import { Tab_defaultProps } from './props/defaultProps';
package/es/Tab/Tabs.js CHANGED
@@ -2,8 +2,8 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  /* eslint-disable react/forbid-component-props */
3
3
  /* eslint css-modules/no-unused-class: [2, {
4
4
  markAsUsed: [
5
- 'hidden','alpha','gamma','beta','delta','zeta','special','text','maxWidth','widgetList','menuContainer','border','tabText','block','tabAlpha','alphaActive','gammaActive','betaActive','zetaActive','deltaActive','tabGamma','tabBeta','tabDelta','tabZeta','specialActive','tabSpecial',
6
- 'alpha_padding','alpha_border','gamma_padding','gamma_border','beta_padding','beta_border','delta_padding','delta_border','zeta_padding','zeta_border','textContainer','disabled','alphaActive_border','gammaActive_border','betaActive_border','zetaActive_border','deltaActive_border'
5
+ 'hidden','alpha','gamma','beta','delta','special','text','maxWidth','widgetList','menuContainer','border','tabText','block','tabAlpha','alphaActive','gammaActive','betaActive','deltaActive','tabGamma','tabBeta','tabDelta','specialActive','tabSpecial',
6
+ 'alpha_padding','alpha_border','gamma_padding','gamma_border','beta_padding','beta_border','delta_padding','delta_border','textContainer','disabled','alphaActive_border','gammaActive_border','betaActive_border','deltaActive_border'
7
7
  ]
8
8
  }]
9
9
  */
@@ -11,7 +11,7 @@ import React from 'react';
11
11
  import Tab from './Tab';
12
12
  import { Tabs_defaultProps } from './props/defaultProps';
13
13
  import { Tabs_propTypes } from './props/propTypes';
14
- import { remConvert, getTotalDimension, cs, bind, throttle } from '../utils/Common';
14
+ import { remConvert, getTotalDimension, cs, bind, throttle, cancelBubblingEffect } from '../utils/Common';
15
15
  import { Box, Container } from '../Layout';
16
16
  import ResizeObserver from '../Responsive/ResizeObserver';
17
17
  import ListItem from '../ListItem/ListItem';
@@ -59,9 +59,14 @@ class Tabs extends React.Component {
59
59
  let totalDimension = this.getTotalDimension();
60
60
  let tabDimensions = this.getTabDimensions();
61
61
  let tabKeys = [];
62
+ let restrictedKeys = ['state', 'props', 'refs', 'context'];
62
63
  React.Children.toArray(children).forEach(child => {
63
64
  if (child && child.props.id && child.type === childType) {
64
- tabKeys.push(child.props.id);
65
+ if (restrictedKeys.includes(child.props.id)) {
66
+ throw new Error('Restricted id name found in Tabs, Please avoid these names => ' + restrictedKeys.toString());
67
+ } else {
68
+ tabKeys.push(child.props.id);
69
+ }
65
70
  }
66
71
  });
67
72
  this.setState({
@@ -329,7 +334,7 @@ class Tabs extends React.Component {
329
334
  onSelect
330
335
  } = this.props;
331
336
  if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {
332
- e && e.stopPropagation();
337
+ cancelBubblingEffect(e);
333
338
  return;
334
339
  }
335
340
  e.preventDefault();
@@ -45,17 +45,11 @@ describe('Tab Component', () => {
45
45
  });
46
46
  expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tabDelta')).toBe(true);
47
47
  });
48
- it('Is Contains zeta class', () => {
49
- const {
50
- props,
51
- renderedDOM
52
- } = setup(Tab, {
53
- type: 'zeta',
54
- needAppearance: true,
55
- getActiveRef: () => {}
56
- });
57
- expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tab')).toBe(true);
58
- });
48
+ // it('Is Contains zeta class', () => {
49
+ // const { props, renderedDOM } = setup(Tab, { type: 'zeta', needAppearance: true, getActiveRef: () => { } });
50
+ // expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tab')).toBe(true);
51
+
52
+ // });
59
53
  // it('Is Contains special class', () => {
60
54
  // const { props, renderedDOM } = setup(Tab, { type: 'special', getActiveRef: () => {} });
61
55
  // expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('special')).toBe(true);
@@ -102,6 +102,6 @@ export const TabWrapper_propTypes = {
102
102
  needPadding: PropTypes.bool,
103
103
  needTabBorder: PropTypes.bool,
104
104
  onSelect: PropTypes.func,
105
- type: PropTypes.oneOf(['alpha', 'beta', 'zeta']),
105
+ type: PropTypes.oneOf(['alpha', 'beta', 'delta']),
106
106
  dataSelectorId: PropTypes.string
107
107
  };
@@ -13,6 +13,10 @@ export const stopAllEventPropagation = e => {
13
13
  e.stopPropagation && e.stopPropagation();
14
14
  e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
15
15
  };
16
+ export function cancelBubblingEffect(e) {
17
+ e && e.stopPropagation && e.stopPropagation();
18
+ e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
19
+ }
16
20
 
17
21
  // export function getCommentsDetails(
18
22
  // commentIds = [],
@@ -18,20 +18,33 @@ export default function mergeStyle(defaultStyle) {
18
18
  // return res;
19
19
  throw new Error(`UNKNOWN CLASSNAME DETECTED - Given customStyle's key "${styleName}" is not available in that component style`);
20
20
  }
21
- let val = defaultStyle[styleName];
22
- Object.keys(res).map(keyName => {
23
- let styleKey = res[keyName];
24
- if (styleKey.includes(val)) {
25
- res[keyName] = styleKey.replace(val, styleValue);
26
- }
27
- });
28
- } else if (defaultStyle[next] || additionalStyle.includes(next)) {
21
+ if (additionalStyle.includes(styleName)) {
22
+ res[styleName] = styleValue;
23
+ } else {
24
+ let val = defaultStyle[styleName];
25
+ Object.keys(res).map(keyName => {
26
+ let styleKey = res[keyName];
27
+ let styleClasses = styleKey.split(' ');
28
+ let ind = styleClasses.indexOf(val);
29
+ if (ind !== -1) {
30
+ styleClasses[ind] = styleValue;
31
+ res[keyName] = styleClasses.join(' ');
32
+ }
33
+ });
34
+ }
35
+ } else if (defaultStyle[next]) {
29
36
  let val = defaultStyle[next];
30
37
  Object.keys(res).map(keyName => {
31
- if (res[keyName].includes(val)) {
32
- res[keyName] = res[keyName] + ' ' + customStyle[next];
38
+ let styleKey = res[keyName];
39
+ let styleClasses = styleKey.split(' ');
40
+ let ind = styleClasses.indexOf(val);
41
+ if (ind !== -1) {
42
+ styleClasses[ind] = styleClasses[ind] + ' ' + customStyle[next];
43
+ res[keyName] = styleClasses.join(' ');
33
44
  }
34
45
  });
46
+ } else if (additionalStyle.includes(next)) {
47
+ res[next] = customStyle[next];
35
48
  } else if (!defaultStyle[next] && !additionalStyle.includes(next)) {
36
49
  // res[next] = customStyle[next];
37
50
  `UNKNOWN CLASSNAME DETECTED - Given customStyle's key "${next}" is not available in that component style`;
@@ -19,7 +19,6 @@ var _common = require("../utils/datetime/common");
19
19
  var _Common = require("../utils/Common");
20
20
  var _constants = require("./constants");
21
21
  var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox"));
22
- var _CustomResponsive = require("../Responsive/CustomResponsive");
23
22
  var _Layout = require("../Layout");
24
23
  var _dateFormatUtils = require("./dateFormatUtils");
25
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -74,25 +73,6 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
74
73
  _this.handleYearViewToggle = _this.handleYearViewToggle.bind(_assertThisInitialized(_this));
75
74
  var _props$i18nKeys$ampmT = props.i18nKeys.ampmText,
76
75
  ampmText = _props$i18nKeys$ampmT === void 0 ? _constants.ampmTextDefault : _props$i18nKeys$ampmT;
77
- var _getHourDetails = (0, _dateFormatUtils.getHourDetails)(props.is24Hour),
78
- hourStart = _getHourDetails.startPoint,
79
- hourEnd = _getHourDetails.endPoint;
80
- _this.hourSuggestions = function () {
81
- var hourArr = [];
82
- for (var hour = hourStart; hour <= hourEnd; hour++) {
83
- var htxt = hour < 10 ? "0".concat(hour) : "".concat(hour);
84
- hourArr.push(htxt);
85
- }
86
- return hourArr;
87
- }();
88
- _this.minSuggestions = function () {
89
- var minArr = [];
90
- for (var minute = 0; minute <= 59; minute++) {
91
- var mtxt = minute < 10 ? "0".concat(minute) : "".concat(minute);
92
- minArr.push(mtxt);
93
- }
94
- return minArr;
95
- }();
96
76
  _this.ampmSuggestions = function () {
97
77
  var ampmSuggestions = [];
98
78
  ampmText.forEach(function (text, index) {
@@ -175,7 +155,7 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
175
155
  year = dateObj.getFullYear();
176
156
  hours = defaultHour ? defaultHour : dateObj.getHours();
177
157
  mins = !(0, _Common.getIsEmptyValue)(defaultMin) ? defaultMin : dateObj.getMinutes();
178
- mins = mins < 10 ? "0".concat(mins) : mins;
158
+ mins = (0, _dateFormatUtils.addZeroIfNeeded)(mins);
179
159
  amPm = defaultAmPm ? defaultAmPm : hours < 12 ? 'AM' : 'PM';
180
160
  hours = this.getHours(hours, is24Hour);
181
161
  return {
@@ -201,7 +181,7 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
201
181
  hours -= 12;
202
182
  }
203
183
  }
204
- hours = hours < 10 ? "0".concat(hours) : hours;
184
+ hours = (0, _dateFormatUtils.addZeroIfNeeded)(hours);
205
185
  return hours;
206
186
  }
207
187
  }, {
@@ -613,16 +593,6 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
613
593
  isMonthOpen: false
614
594
  });
615
595
  }
616
- }, {
617
- key: "responsiveFunc",
618
- value: function responsiveFunc(_ref3) {
619
- var mediaQueryOR = _ref3.mediaQueryOR;
620
- return {
621
- tabletMode: mediaQueryOR([{
622
- maxWidth: 700
623
- }])
624
- };
625
- }
626
596
  }, {
627
597
  key: "render",
628
598
  value: function render() {
@@ -712,12 +682,12 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
712
682
  }), isDateTimeField ? /*#__PURE__*/_react["default"].createElement(_Time["default"], {
713
683
  timeText: timeText,
714
684
  dataId: dataId,
715
- hourSuggestions: this.hourSuggestions,
685
+ hourSuggestions: (0, _dateFormatUtils.getHourSuggestions)(),
716
686
  onHourSelect: this.hoursSelect,
717
687
  hours: hours,
718
688
  hourEmptyText: hourEmptyText,
719
689
  needResponsive: needResponsive,
720
- minSuggestions: this.minSuggestions,
690
+ minSuggestions: (0, _dateFormatUtils.getMinuteSuggestions)(),
721
691
  onMinutesSelect: this.minutesSelect,
722
692
  mins: mins,
723
693
  minuteEmptyText: minuteEmptyText,
@@ -745,33 +715,27 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
745
715
  return isDefaultPosition ? /*#__PURE__*/_react["default"].createElement("div", {
746
716
  className: "".concat(_DateTimeModule["default"].dropBox, " ").concat(className),
747
717
  "data-id": "".concat(dataId, "_dateBoxContainer")
748
- }, childEle) : isReady ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
749
- query: this.responsiveFunc,
750
- responsiveId: "Helmet"
751
- }, function (_ref4) {
752
- var tabletMode = _ref4.tabletMode;
753
- return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], {
754
- size: boxSize,
755
- boxPosition: position,
756
- isActive: isActive,
757
- isArrow: false,
758
- isAnimate: isAnimate,
759
- animationStyle: "bounce",
760
- getRef: getRef,
761
- onClick: onClick,
762
- dataId: "".concat(dataId, "_dateBoxContainer"),
763
- needResponsive: needResponsive,
764
- isAbsolutePositioningNeeded: isAbsolute,
765
- customClass: {
766
- customDropBoxWrap: className
767
- },
768
- isPadding: isPadding,
769
- positionsOffset: positionsOffset,
770
- targetOffset: targetOffset,
771
- isRestrictScroll: isRestrictScroll,
772
- portalId: dropBoxPortalId
773
- }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, childEle));
774
- }) : null;
718
+ }, childEle) : isReady ? /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], {
719
+ size: boxSize,
720
+ boxPosition: position,
721
+ isActive: isActive,
722
+ isArrow: false,
723
+ isAnimate: isAnimate,
724
+ animationStyle: "bounce",
725
+ getRef: getRef,
726
+ onClick: onClick,
727
+ dataId: "".concat(dataId, "_dateBoxContainer"),
728
+ needResponsive: needResponsive,
729
+ isAbsolutePositioningNeeded: isAbsolute,
730
+ customClass: {
731
+ customDropBoxWrap: className
732
+ },
733
+ isPadding: isPadding,
734
+ positionsOffset: positionsOffset,
735
+ targetOffset: targetOffset,
736
+ isRestrictScroll: isRestrictScroll,
737
+ portalId: dropBoxPortalId
738
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, childEle)) : null;
775
739
  }
776
740
  }]);
777
741
  return DateTime;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.dateSymbols = exports.dataFormatList = void 0;
7
+ // Date Pattern Letters And its Meanings :-
8
+ // 1. d/D: day without 0 prefix on single digit.
9
+ // 2. dd/DD: day with 0 prefix if single digit.
10
+ // 3. M: Month without 0 prefix on single digit.
11
+ // 4. MM: Month with 0 prefix if single digit.
12
+ // 5. yy/YY: Last two digit of year.
13
+ // 6. yyyy/YYYY: represents full year.
14
+ // 7. HH: 24 hour based hour. ie. 13:00. **H** will display hour without prefix 0 if single digit
15
+ // 8. hh: 12 hour based hour. ie. 01:00. **h** will display hour without prefix 0 if single digit
16
+ // 9. m: minute without 0 prefix on single digit.
17
+ // 10.mm: minute with 0 prefix if single digit.
18
+ // 11.s: second without 0 prefix on single digit.
19
+ // 12.ss: second with 0 prefix if single digit.
20
+ // 13.S: milliseconds with 0 prefix if single digit.
21
+ // 14.a: represent the AM or PM
22
+ // 15.A: represent the AM or PM
23
+ // 16.Z: represent the timezone (Asia/Kolkata)
24
+ // 17. (O) : Offset Of the timezone (GMT+00:00)
25
+
26
+ var dateSymbols = {
27
+ d: 'date',
28
+ dd: 'date',
29
+ DD: 'date',
30
+ M: 'month',
31
+ MM: 'month',
32
+ yy: 'year',
33
+ YY: 'year',
34
+ YYYY: 'year',
35
+ yyyy: 'year',
36
+ h: 'hour',
37
+ hh: 'hour',
38
+ H: 'hour',
39
+ HH: 'hour',
40
+ m: 'minute',
41
+ mm: 'minute',
42
+ s: 'second',
43
+ ss: 'second',
44
+ S: 'millisecond',
45
+ a: 'AMPM',
46
+ Z: 'timezone',
47
+ O: 'offset'
48
+ };
49
+ exports.dateSymbols = dateSymbols;
50
+ var dataFormatList = ['yyyy/MM/dd', 'yyyy-MM-dd', 'yyyy.MM.dd', 'yyyy MM dd', 'MM/dd/yyyy', 'MM-dd-yyyy', 'MM.dd.yyyy', 'MM dd yyyy', 'dd/MM/yyyy', 'dd-MM-yyyy', 'dd.MM.yyyy', 'dd MM yyyy', 'yyyy/MMM/dd', 'yyyy-MMM-dd', 'yyyy.MMM.dd', 'yyyy MMM dd', 'MMM/dd/yyyy', 'MMM-dd-yyyy', 'MMM.dd.yyyy', 'MMM dd yyyy', 'dd/MMM/yyyy', 'dd-MMM-yyyy', 'dd.MMM.yyyy', 'dd MMM yyyy', 'dd/MMMM/yyyy', 'dd-MMMM-yyyy', 'dd-MMMM-yyyy', 'dd MMMM yyyy', 'MMMM/dd/yyyy', 'MMMM-dd-yyyy', 'MMMM.dd.yyyy', 'MMMM dd yyyy', 'yyyy/MMMM/dd', 'yyyy-MMMM-dd', 'yyyy.MMMM.dd', 'yyyy MMMM dd', 'dd/MM/YY', 'dd-MM-YY', 'dd.MM.YY', 'dd MM YY', 'MM/dd/YY', 'MM-dd-YY', 'MM.dd.YY', 'MM dd YY', 'YY/MM/dd', 'YY-MM-dd', 'YY.MM.dd', 'YY MM dd', 'dd/MMM/YY', 'dd-MMM-YY', 'dd.MMM.YY', 'dd MMM YY', 'MMM/dd/YY', 'MMM-dd-YY', 'MMM.dd.YY', 'MMM dd YY', 'YY/MMM/dd', 'YY-MMM-dd', 'YY.MMM.dd', 'YY MMM dd', 'dd/MMMM/YY', 'dd-MMMM-YY', 'dd.MMMM.YY', 'dd MMMM YY', 'MMMM/dd/YY', 'MMMM-dd-YY', 'MMMM.dd.YY', 'MMMM dd YY', 'YY/MMMM/dd', 'YY-MMMM-dd', 'YY.MMMM.dd', 'YY MMMM dd'];
51
+ exports.dataFormatList = dataFormatList;
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addZero = addZero;
7
+ exports.addZeroIfNeeded = addZeroIfNeeded;
7
8
  exports.arrayIsNotEqual = arrayIsNotEqual;
8
9
  exports.convertTwoDigitToYear = convertTwoDigitToYear;
9
10
  exports.convertYearToTwoDigit = convertYearToTwoDigit;
10
11
  exports.getDayDetails = getDayDetails;
11
12
  exports.getDayEnd = getDayEnd;
12
13
  exports.getHourDetails = getHourDetails;
14
+ exports.getHourSuggestions = getHourSuggestions;
13
15
  exports.getIsCurrentYear = getIsCurrentYear;
14
16
  exports.getIsDeleteTyped = getIsDeleteTyped;
15
17
  exports.getIsEmptyHour = getIsEmptyHour;
@@ -19,6 +21,7 @@ exports.getIsNoonValueTyped = getIsNoonValueTyped;
19
21
  exports.getIsNumberTyped = getIsNumberTyped;
20
22
  exports.getIsSupportedKey = getIsSupportedKey;
21
23
  exports.getMinuteDetails = getMinuteDetails;
24
+ exports.getMinuteSuggestions = getMinuteSuggestions;
22
25
  exports.getMonthDetails = getMonthDetails;
23
26
  exports.getNoonDetails = getNoonDetails;
24
27
  exports.getYearDetails = getYearDetails;
@@ -130,12 +133,37 @@ function getHourDetails(is24Hour) {
130
133
  endPoint: is24Hour ? 23 : 12
131
134
  };
132
135
  }
136
+ function getHourSuggestions(is24Hour) {
137
+ var _getHourDetails = getHourDetails(is24Hour),
138
+ startPoint = _getHourDetails.startPoint,
139
+ endPoint = _getHourDetails.endPoint;
140
+ var hourArr = [];
141
+ for (var hour = startPoint; hour <= endPoint; hour++) {
142
+ var htxt = addZeroIfNeeded(hour);
143
+ hourArr.push(htxt);
144
+ }
145
+ return hourArr;
146
+ }
133
147
  function getMinuteDetails() {
134
148
  return {
135
149
  startPoint: 0,
136
150
  endPoint: 59
137
151
  };
138
152
  }
153
+ function getMinuteSuggestions() {
154
+ var _getMinuteDetails = getMinuteDetails(),
155
+ startPoint = _getMinuteDetails.startPoint,
156
+ endPoint = _getMinuteDetails.endPoint;
157
+ var minArr = [];
158
+ for (var minute = startPoint; minute <= endPoint; minute++) {
159
+ var mtxt = addZeroIfNeeded(minute);
160
+ minArr.push(mtxt);
161
+ }
162
+ return minArr;
163
+ }
164
+ function addZeroIfNeeded(value) {
165
+ return value < 10 ? "0".concat(value) : value;
166
+ }
139
167
  function getIsNoonValueTyped(event) {
140
168
  var keyCode = event.keyCode;
141
169
  if (keyCode === 65 || keyCode === 77 || keyCode === 80) {
@@ -178,9 +206,9 @@ function getIsEmptyValue(value, startPoint, endPoint) {
178
206
  return true;
179
207
  }
180
208
  function getIsEmptyHour(value, is24Hour) {
181
- var _getHourDetails = getHourDetails(is24Hour),
182
- startPoint = _getHourDetails.startPoint,
183
- endPoint = _getHourDetails.endPoint;
209
+ var _getHourDetails2 = getHourDetails(is24Hour),
210
+ startPoint = _getHourDetails2.startPoint,
211
+ endPoint = _getHourDetails2.endPoint;
184
212
  return getIsEmptyValue(value, startPoint, endPoint);
185
213
  }
186
214
  function getIsEmptyYear(value, yearLength) {
@@ -5,7 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.YearView_propTypes = exports.Span_propTypes = exports.DateWidget_propTypes = exports.DateTime_propTypes = exports.CalendarView_propTypes = void 0;
7
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
8
+ var _dateFormats = require("../dateFormatUtils/dateFormats");
8
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
11
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
16
  var CalendarView_propTypes = {
10
17
  dataId: _propTypes["default"].string,
11
18
  date: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
@@ -81,7 +88,7 @@ var DateWidget_propTypes = {
81
88
  className: _propTypes["default"].string,
82
89
  closePopupOnly: _propTypes["default"].func,
83
90
  dataId: _propTypes["default"].string,
84
- dateFormat: _propTypes["default"].oneOf(['yyyy/MM/dd', 'MM/dd/yyyy', 'dd/MM/yyyy', 'yyyy-MM-dd', 'MM-dd-yyyy', 'dd-MM-yyyy', 'yyyy.MM.dd', 'MM.dd.yyyy', 'dd.MM.yyyy', 'dd/MMMM/YY', 'dd/MMM/YY']),
91
+ dateFormat: _propTypes["default"].oneOf(_toConsumableArray(_dateFormats.dataFormatList)),
85
92
  defaultPosition: _propTypes["default"].oneOf(['top', 'bottom', 'right', 'left']),
86
93
  defaultTime: _propTypes["default"].string,
87
94
  getContainerRef: _propTypes["default"].func,
@@ -14,6 +14,7 @@ var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
14
14
  var _DropBoxElement = _interopRequireDefault(require("./DropBoxElement/DropBoxElement"));
15
15
  var _defaultProps = require("./props/defaultProps");
16
16
  var _propTypes = require("./props/propTypes");
17
+ var _Common = require("./../utils/Common");
17
18
  var _DropBoxModule = _interopRequireDefault(require("./css/DropBox.module.css"));
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
20
  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); }
@@ -22,9 +23,6 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
22
23
  function DropBox(props) {
23
24
  var focusRef = (0, _react.useRef)(null);
24
25
  var DropBoxContext = (0, _react.useContext)(_LibraryContextInit["default"]);
25
- var onFreezeClick = function onFreezeClick(e) {
26
- e && e.stopPropagation();
27
- };
28
26
  var needResponsive = props.needResponsive,
29
27
  portalId = props.portalId,
30
28
  isActive = props.isActive,
@@ -70,13 +68,13 @@ function DropBox(props) {
70
68
  }, /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
71
69
  className: "".concat(_DropBoxModule["default"].freezeLayer, " ").concat(_DropBoxModule["default"].freeze),
72
70
  style: zIndexStyle,
73
- onClick: onFreezeClick
71
+ onClick: _Common.cancelBubblingEffect
74
72
  }), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
75
73
  portalId: portalId
76
74
  }, /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, isRestrictScroll ? /*#__PURE__*/_react["default"].createElement("div", {
77
75
  className: _DropBoxModule["default"].freezeLayer,
78
76
  style: zIndexStyle,
79
- onClick: onFreezeClick
77
+ onClick: _Common.cancelBubblingEffect
80
78
  }) : null, dropBoxEle)) : dropBoxEle;
81
79
  }
82
80
  DropBox.propTypes = _propTypes.DropBoxPropTypes;
@@ -147,7 +147,6 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
147
147
  } else {
148
148
  this.handleChange([].concat(_toConsumableArray(selectedOptions), [option]), e);
149
149
  }
150
- // e && e.stopPropagation && this.handlePopupClose(e);
151
150
  }
152
151
  }, {
153
152
  key: "handleFormatOptions",
@@ -492,8 +492,6 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
492
492
  } else {
493
493
  this.handleChange([].concat(_toConsumableArray(selectedOptions), [option]), e);
494
494
  }
495
-
496
- // e && e.stopPropagation && this.handlePopupClose(e);
497
495
  }
498
496
  }, {
499
497
  key: "handleRemoveOption",
@@ -415,8 +415,7 @@ var Popup = function Popup(Component) {
415
415
  key: "removeClose",
416
416
  value: function removeClose(e) {
417
417
  // e && e.preventDefault && e.preventDefault();
418
- e && e.stopPropagation && e.stopPropagation();
419
- e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
418
+ (0, _Common.cancelBubblingEffect)(e);
420
419
  }
421
420
  }, {
422
421
  key: "handlePopupPosition",
package/lib/Tab/Tabs.js CHANGED
@@ -79,9 +79,14 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
79
79
  var totalDimension = this.getTotalDimension();
80
80
  var tabDimensions = this.getTabDimensions();
81
81
  var tabKeys = [];
82
+ var restrictedKeys = ['state', 'props', 'refs', 'context'];
82
83
  _react["default"].Children.toArray(children).forEach(function (child) {
83
84
  if (child && child.props.id && child.type === childType) {
84
- tabKeys.push(child.props.id);
85
+ if (restrictedKeys.includes(child.props.id)) {
86
+ throw new Error('Restricted id name found in Tabs, Please avoid these names => ' + restrictedKeys.toString());
87
+ } else {
88
+ tabKeys.push(child.props.id);
89
+ }
85
90
  }
86
91
  });
87
92
  this.setState({
@@ -362,7 +367,7 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
362
367
  value: function moreTabSelect(tab, value, index, e) {
363
368
  var onSelect = this.props.onSelect;
364
369
  if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {
365
- e && e.stopPropagation();
370
+ (0, _Common.cancelBubblingEffect)(e);
366
371
  return;
367
372
  }
368
373
  e.preventDefault();
@@ -44,16 +44,11 @@ describe('Tab Component', function () {
44
44
  renderedDOM = _setup4.renderedDOM;
45
45
  expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tabDelta')).toBe(true);
46
46
  });
47
- it('Is Contains zeta class', function () {
48
- var _setup5 = setup(_Tab["default"], {
49
- type: 'zeta',
50
- needAppearance: true,
51
- getActiveRef: function getActiveRef() {}
52
- }),
53
- props = _setup5.props,
54
- renderedDOM = _setup5.renderedDOM;
55
- expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tab')).toBe(true);
56
- });
47
+ // it('Is Contains zeta class', () => {
48
+ // const { props, renderedDOM } = setup(Tab, { type: 'zeta', needAppearance: true, getActiveRef: () => { } });
49
+ // expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tab')).toBe(true);
50
+
51
+ // });
57
52
  // it('Is Contains special class', () => {
58
53
  // const { props, renderedDOM } = setup(Tab, { type: 'special', getActiveRef: () => {} });
59
54
  // expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('special')).toBe(true);
@@ -61,7 +56,7 @@ describe('Tab Component', function () {
61
56
  // });
62
57
 
63
58
  it('Is Contains active class', function () {
64
- var _setup6 = setup(_Tab["default"], {
59
+ var _setup5 = setup(_Tab["default"], {
65
60
  type: 'alpha',
66
61
  needAppearance: true,
67
62
  id: '0',
@@ -69,31 +64,31 @@ describe('Tab Component', function () {
69
64
  isActive: true,
70
65
  getActiveRef: function getActiveRef() {}
71
66
  }),
72
- props = _setup6.props,
73
- renderedDOM = _setup6.renderedDOM;
67
+ props = _setup5.props,
68
+ renderedDOM = _setup5.renderedDOM;
74
69
  expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('alphaActive')).toBe(true);
75
70
  });
76
71
  it('Is Contains border class', function () {
77
- var _setup7 = setup(_Tab["default"], {
72
+ var _setup6 = setup(_Tab["default"], {
78
73
  isActive: true,
79
74
  type: 'alpha',
80
75
  needAppearance: true,
81
76
  needBorder: true,
82
77
  getActiveRef: function getActiveRef() {}
83
78
  }),
84
- props = _setup7.props,
85
- renderedDOM = _setup7.renderedDOM;
79
+ props = _setup6.props,
80
+ renderedDOM = _setup6.renderedDOM;
86
81
  expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('alphaActive_border')).toBe(true);
87
82
  });
88
83
  it('Is call onClick', function () {
89
- var _setup8 = setup(_Tab["default"], {
84
+ var _setup7 = setup(_Tab["default"], {
90
85
  id: '2',
91
86
  onClick: jest.fn(),
92
87
  onSelect: jest.fn(),
93
88
  getActiveRef: function getActiveRef() {}
94
89
  }),
95
- renderedDOM = _setup8.renderedDOM,
96
- props = _setup8.props;
90
+ renderedDOM = _setup7.renderedDOM,
91
+ props = _setup7.props;
97
92
  var tabElement = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab');
98
93
  TestUtils.Simulate.click(tabElement, {
99
94
  currentTarget: {
@@ -105,14 +100,14 @@ describe('Tab Component', function () {
105
100
  expect(props.onSelect).toHaveBeenLastCalledWith('2');
106
101
  });
107
102
  it('is render text span', function () {
108
- var _setup9 = setup(_Tab["default"], {
103
+ var _setup8 = setup(_Tab["default"], {
109
104
  type: 'alpha',
110
105
  dataId: 'taskSubtab1',
111
106
  text: 'Tab1',
112
107
  getActiveRef: function getActiveRef() {}
113
108
  }),
114
- renderedDOM = _setup9.renderedDOM,
115
- props = _setup9.props;
109
+ renderedDOM = _setup8.renderedDOM,
110
+ props = _setup8.props;
116
111
  var tabElement = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'taskSubtab1_Tab');
117
112
  expect(tabElement.getAttribute('data-id')).toBe('taskSubtab1_Tab');
118
113
  });
@@ -113,7 +113,7 @@ var TabWrapper_propTypes = {
113
113
  needPadding: _propTypes["default"].bool,
114
114
  needTabBorder: _propTypes["default"].bool,
115
115
  onSelect: _propTypes["default"].func,
116
- type: _propTypes["default"].oneOf(['alpha', 'beta', 'zeta']),
116
+ type: _propTypes["default"].oneOf(['alpha', 'beta', 'delta']),
117
117
  dataSelectorId: _propTypes["default"].string
118
118
  };
119
119
  exports.TabWrapper_propTypes = TabWrapper_propTypes;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.bind = bind;
7
7
  exports.bytesToSize = bytesToSize;
8
+ exports.cancelBubblingEffect = cancelBubblingEffect;
8
9
  exports.capitalize = capitalize;
9
10
  exports.checkIsImageFile = checkIsImageFile;
10
11
  exports.debounce = exports.cs = void 0;
@@ -56,6 +57,11 @@ var stopAllEventPropagation = function stopAllEventPropagation(e) {
56
57
  e.stopPropagation && e.stopPropagation();
57
58
  e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
58
59
  };
60
+ exports.stopAllEventPropagation = stopAllEventPropagation;
61
+ function cancelBubblingEffect(e) {
62
+ e && e.stopPropagation && e.stopPropagation();
63
+ e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
64
+ }
59
65
 
60
66
  // export function getCommentsDetails(
61
67
  // commentIds = [],
@@ -70,7 +76,7 @@ var stopAllEventPropagation = function stopAllEventPropagation(e) {
70
76
  // }) || []
71
77
  // );
72
78
  // }
73
- exports.stopAllEventPropagation = stopAllEventPropagation;
79
+
74
80
  function encodeForHtml(str) {
75
81
  if (/<|>|&|"|'|\\/g.test(str) == true) {
76
82
  str = str.replace(/&/g, '&amp;');
@@ -30,20 +30,33 @@ function mergeStyle(defaultStyle) {
30
30
  // return res;
31
31
  throw new Error("UNKNOWN CLASSNAME DETECTED - Given customStyle's key \"".concat(styleName, "\" is not available in that component style"));
32
32
  }
33
- var val = defaultStyle[styleName];
34
- Object.keys(res).map(function (keyName) {
35
- var styleKey = res[keyName];
36
- if (styleKey.includes(val)) {
37
- res[keyName] = styleKey.replace(val, styleValue);
38
- }
39
- });
40
- } else if (defaultStyle[next] || additionalStyle.includes(next)) {
33
+ if (additionalStyle.includes(styleName)) {
34
+ res[styleName] = styleValue;
35
+ } else {
36
+ var val = defaultStyle[styleName];
37
+ Object.keys(res).map(function (keyName) {
38
+ var styleKey = res[keyName];
39
+ var styleClasses = styleKey.split(' ');
40
+ var ind = styleClasses.indexOf(val);
41
+ if (ind !== -1) {
42
+ styleClasses[ind] = styleValue;
43
+ res[keyName] = styleClasses.join(' ');
44
+ }
45
+ });
46
+ }
47
+ } else if (defaultStyle[next]) {
41
48
  var _val = defaultStyle[next];
42
49
  Object.keys(res).map(function (keyName) {
43
- if (res[keyName].includes(_val)) {
44
- res[keyName] = res[keyName] + ' ' + customStyle[next];
50
+ var styleKey = res[keyName];
51
+ var styleClasses = styleKey.split(' ');
52
+ var ind = styleClasses.indexOf(_val);
53
+ if (ind !== -1) {
54
+ styleClasses[ind] = styleClasses[ind] + ' ' + customStyle[next];
55
+ res[keyName] = styleClasses.join(' ');
45
56
  }
46
57
  });
58
+ } else if (additionalStyle.includes(next)) {
59
+ res[next] = customStyle[next];
47
60
  } else if (!defaultStyle[next] && !additionalStyle.includes(next)) {
48
61
  // res[next] = customStyle[next];
49
62
  "UNKNOWN CLASSNAME DETECTED - Given customStyle's key \"".concat(next, "\" is not available in that component style");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-alpha-264",
3
+ "version": "1.0.0-alpha-265",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,