@zohodesk/components 1.0.0-alpha-263 → 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.
Files changed (76) hide show
  1. package/README.md +11 -0
  2. package/css_error.log +1 -0
  3. package/es/DateTime/DateTime.js +26 -65
  4. package/es/DateTime/dateFormatUtils/dateFormats.js +43 -0
  5. package/es/DateTime/dateFormatUtils/index.js +27 -0
  6. package/es/DateTime/props/propTypes.js +2 -1
  7. package/es/DropBox/DropBox.js +68 -244
  8. package/es/DropBox/DropBoxElement/DropBoxElement.js +118 -0
  9. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +432 -0
  10. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +89 -0
  11. package/es/DropBox/DropBoxElement/props/defaultProps.js +18 -0
  12. package/es/DropBox/DropBoxElement/props/propTypes.js +45 -0
  13. package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +51 -0
  14. package/es/DropBox/css/DropBox.module.css +59 -0
  15. package/es/DropBox/css/cssJSLogic.js +14 -0
  16. package/es/DropBox/props/defaultProps.js +9 -17
  17. package/es/DropBox/props/propTypes.js +9 -43
  18. package/es/MultiSelect/AdvancedMultiSelect.js +0 -2
  19. package/es/MultiSelect/MultiSelect.js +0 -3
  20. package/es/Popup/Popup.js +2 -3
  21. package/es/Tab/Tab.js +1 -1
  22. package/es/Tab/Tabs.js +10 -5
  23. package/es/Tab/__tests__/Tab.spec.js +5 -11
  24. package/es/Tab/props/propTypes.js +1 -1
  25. package/es/css.js +2 -1
  26. package/es/utils/Common.js +4 -0
  27. package/es/utils/css/mergeStyle.js +25 -11
  28. package/lib/DateTime/DateTime.js +25 -61
  29. package/lib/DateTime/dateFormatUtils/dateFormats.js +51 -0
  30. package/lib/DateTime/dateFormatUtils/index.js +31 -3
  31. package/lib/DateTime/props/propTypes.js +8 -1
  32. package/lib/DropBox/DropBox.js +65 -276
  33. package/lib/DropBox/DropBoxElement/DropBoxElement.js +117 -0
  34. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +432 -0
  35. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +72 -0
  36. package/lib/DropBox/DropBoxElement/props/defaultProps.js +25 -0
  37. package/lib/DropBox/DropBoxElement/props/propTypes.js +53 -0
  38. package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +55 -0
  39. package/lib/DropBox/css/DropBox.module.css +59 -0
  40. package/lib/DropBox/css/cssJSLogic.js +18 -0
  41. package/lib/DropBox/props/defaultProps.js +15 -19
  42. package/lib/DropBox/props/propTypes.js +15 -45
  43. package/lib/MultiSelect/AdvancedMultiSelect.js +0 -1
  44. package/lib/MultiSelect/MultiSelect.js +0 -2
  45. package/lib/Popup/Popup.js +1 -2
  46. package/lib/Tab/Tabs.js +7 -2
  47. package/lib/Tab/__tests__/Tab.spec.js +17 -22
  48. package/lib/Tab/props/propTypes.js +1 -1
  49. package/lib/css.js +2 -1
  50. package/lib/utils/Common.js +7 -1
  51. package/lib/utils/css/mergeStyle.js +25 -11
  52. package/package.json +1 -1
  53. package/docs/external/active-line.js +0 -72
  54. package/docs/external/autorefresh.js +0 -47
  55. package/docs/external/codemirror.js +0 -9681
  56. package/docs/external/css/hopscotch.css +0 -576
  57. package/docs/external/css/styleGuide.css +0 -1100
  58. package/docs/external/css.js +0 -466
  59. package/docs/external/designTokens.js +0 -1
  60. package/docs/external/foldcode.js +0 -152
  61. package/docs/external/format.js +0 -129
  62. package/docs/external/htmlmixed.js +0 -84
  63. package/docs/external/images/bottom.png +0 -0
  64. package/docs/external/images/bottombg.jpg +0 -0
  65. package/docs/external/images/desk.png +0 -0
  66. package/docs/external/images/desklogo.png +0 -0
  67. package/docs/external/images/menu.png +0 -0
  68. package/docs/external/index.html +0 -127
  69. package/docs/external/javascript.js +0 -422
  70. package/docs/external/jsx.js +0 -148
  71. package/docs/external/matchbrackets.js +0 -145
  72. package/docs/external/xml.js +0 -322
  73. package/docs/package.json +0 -41
  74. package/docs/src/index.js +0 -1311
  75. package/es/DropBox/DropBox.module.css +0 -405
  76. package/lib/DropBox/DropBox.module.css +0 -405
@@ -0,0 +1,51 @@
1
+ import { remConvert } from '../../utils/Common';
2
+ export default function useDropboxPosCalc(props) {
3
+ let {
4
+ right,
5
+ left,
6
+ top,
7
+ arrowRight,
8
+ arrowLeft,
9
+ arrowTop,
10
+ arrowBottom,
11
+ bottom,
12
+ isModel,
13
+ direction
14
+ } = props;
15
+ const unit = 'rem';
16
+ let boxstyle = {};
17
+ let arrowstyle = {};
18
+ const needBoxStyle = right || left || top || bottom;
19
+ const needArrowStyle = arrowLeft || arrowRight || arrowTop || arrowBottom;
20
+ if (needBoxStyle) {
21
+ boxstyle = !isModel ? direction === 'rtl' ? {
22
+ right: [remConvert(left)] + unit,
23
+ left: [remConvert(right)] + unit,
24
+ top: [remConvert(top)] + unit,
25
+ bottom: [remConvert(bottom)] + unit
26
+ } : {
27
+ right: [remConvert(right)] + unit,
28
+ left: [remConvert(left)] + unit,
29
+ top: [remConvert(top)] + unit,
30
+ bottom: [remConvert(bottom)] + unit
31
+ } : {};
32
+ }
33
+ if (needArrowStyle) {
34
+ arrowstyle = !isModel ? direction === 'rtl' ? {
35
+ right: [remConvert(arrowLeft)] + unit,
36
+ left: [remConvert(arrowRight)] + unit,
37
+ top: [remConvert(arrowTop)] + unit,
38
+ bottom: [remConvert(arrowBottom)] + unit
39
+ } : {
40
+ right: [remConvert(arrowRight)] + unit,
41
+ left: [remConvert(arrowLeft)] + unit,
42
+ top: [remConvert(arrowTop)] + unit,
43
+ bottom: [remConvert(arrowBottom)] + unit
44
+ } : {};
45
+ }
46
+ return {
47
+ needBoxStyle,
48
+ boxstyle,
49
+ arrowstyle
50
+ };
51
+ }
@@ -0,0 +1,59 @@
1
+ .varClass {
2
+ /* dropbox default variables */
3
+ --dropbox_bg_color: var(--zdt_dropbox_default_bg);
4
+ --dropbox_border_radius: 0;
5
+ --dropbox_padding: 0;
6
+ --dropbox_box_shadow: 0 3px 30px var(--zdt_dropbox_default_box_shadow);
7
+
8
+ /* dropbox arrow default variables */
9
+ --dropbox_arrow_box_shadow_color: var(--zdt_dropbox_arrow_shadow);
10
+
11
+ /* dropbox responsive default variables */
12
+ --dropbox_mob_bg_color: var(--zdt_dropbox_mob_bg);
13
+ --dropbox_mob_close_bg_color: var(--zdt_dropbox_mob_close_bg);
14
+ }
15
+
16
+ .activateInDelay {
17
+ composes: modeForward from '../../common/animation.module.css';
18
+ pointer-events: none;
19
+ }
20
+
21
+ [dir=ltr] .activateInDelay {
22
+ animation-duration: var(--zd_transition1);
23
+ animation-delay: var(--zd_transition2);
24
+ animation-name: activateInDelay;
25
+ }
26
+
27
+ [dir=rtl] .activateInDelay {
28
+ animation-duration: var(--zd_transition1);
29
+ animation-delay: var(--zd_transition2);
30
+ animation-name: activateInDelay;
31
+ }
32
+
33
+ .freezeLayer {
34
+ position: absolute;
35
+ top: 0;
36
+ bottom: 0;
37
+ composes: activateInDelay;
38
+ }
39
+
40
+ [dir=ltr] .freezeLayer {
41
+ left: 0;
42
+ right: 0;
43
+ }
44
+
45
+ [dir=rtl] .freezeLayer {
46
+ right: 0;
47
+ left: 0;
48
+ }
49
+
50
+ .freeze {
51
+ composes: varClass;
52
+ background: var(--dropbox_mob_bg_color);
53
+ }
54
+
55
+ @keyframes activateInDelay {
56
+ 100% {
57
+ pointer-events: initial;
58
+ }
59
+ }
@@ -0,0 +1,14 @@
1
+ import { useZIndex } from '../../Provider/ZindexProvider';
2
+ export default function cssJSLogic(props) {
3
+ const {
4
+ isActive,
5
+ needAutoZindex
6
+ } = props;
7
+ const zIndex = useZIndex();
8
+ const zIndexStyle = isActive && needAutoZindex ? {
9
+ zIndex: zIndex()
10
+ } : {};
11
+ return {
12
+ zIndexStyle
13
+ };
14
+ }
@@ -1,22 +1,14 @@
1
+ import { DropBoxElementDefaultProps } from '../DropBoxElement/props/defaultProps';
1
2
  export const defaultProps = {
2
- animationStyle: 'default',
3
- boxPosition: 'bottomLeft',
4
- dataId: 'dropBox',
5
- dataSelectorId: 'dropBox',
6
- isActive: false,
7
- isAnimate: false,
8
- isArrow: true,
9
- isRadius: true,
10
- size: 'default',
11
3
  needResponsive: true,
12
- isAbsolutePositioningNeeded: true,
13
- isBoxPaddingNeed: false,
14
- isPadding: true,
15
- customClass: {},
16
- a11y: {},
17
- palette: 'default',
18
- needAutoZindex: true,
19
4
  portalId: 'portal1',
5
+ isActive: false,
6
+ isAbsolutePositioningNeeded: true,
20
7
  isRestrictScroll: false,
21
- needFocusScope: false
8
+ needFocusScope: false,
9
+ needAutoZindex: true
10
+ };
11
+ export const DropBoxDefaultProps = {
12
+ ...DropBoxElementDefaultProps,
13
+ ...defaultProps
22
14
  };
@@ -1,49 +1,15 @@
1
1
  import PropTypes from 'prop-types';
2
+ import { DropBoxElementPropTypes } from '../DropBoxElement/props/propTypes';
2
3
  export const propTypes = {
3
- animationStyle: PropTypes.oneOf(['default', 'bounce']),
4
- arrowBottom: PropTypes.number,
5
- arrowLeft: PropTypes.number,
6
- arrowPosition: PropTypes.oneOf(['start', 'mid', 'end']),
7
- arrowRight: PropTypes.number,
8
- arrowTop: PropTypes.number,
9
- bottom: PropTypes.number,
10
- boxPosition: PropTypes.oneOf(['bottomRight', 'bottomLeft', 'bottomCenter', 'topRight', 'topLeft', 'topCenter', 'rightTop', 'rightBottom', 'rightCenter', 'leftTop', 'leftBottom', 'leftCenter']),
11
- children: PropTypes.element,
12
- dataId: PropTypes.string,
13
- dataSelectorId: PropTypes.string,
14
- forwardRef: PropTypes.object,
15
- getRef: PropTypes.func,
16
- isAbsolutePositioningNeeded: PropTypes.bool,
17
- isActive: PropTypes.bool,
18
- isAnimate: PropTypes.bool,
19
- isArrow: PropTypes.bool,
20
- isBoxPaddingNeed: PropTypes.bool,
21
- isPadding: PropTypes.bool,
22
- isRadius: PropTypes.bool,
23
- left: PropTypes.number,
24
4
  needResponsive: PropTypes.bool,
25
- onClick: PropTypes.func,
26
- needFocusScope: PropTypes.bool,
27
- right: PropTypes.number,
28
- size: PropTypes.oneOf(['mini', 'xmini', 'xsmall', 'small', 'medium', 'large', 'mlarge', 'xlarge', 'xxlarge', 'default']),
29
- top: PropTypes.number,
30
- tourId: PropTypes.string,
31
- htmlId: PropTypes.string,
32
- tabIndex: PropTypes.number,
33
- customClass: PropTypes.shape({
34
- customDropBox: PropTypes.string,
35
- customMobileDropBox: PropTypes.string,
36
- customDropBoxWrap: PropTypes.string,
37
- customMobileDropBoxWrap: PropTypes.string
38
- }),
39
- a11y: PropTypes.shape({
40
- role: PropTypes.string,
41
- ariaMultiselectable: PropTypes.bool,
42
- ariaLabelledby: PropTypes.string
43
- }),
44
- palette: PropTypes.oneOf(['default', 'dark']),
45
- needAutoZindex: PropTypes.bool,
46
5
  portalId: PropTypes.string,
6
+ isActive: PropTypes.bool,
7
+ isAbsolutePositioningNeeded: PropTypes.bool,
47
8
  isRestrictScroll: PropTypes.bool,
48
- customStyle: PropTypes.object
9
+ needFocusScope: PropTypes.bool,
10
+ needAutoZindex: PropTypes.bool
11
+ };
12
+ export const DropBoxPropTypes = {
13
+ ...DropBoxElementPropTypes,
14
+ ...propTypes
49
15
  };
@@ -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
  };
package/es/css.js CHANGED
@@ -31,7 +31,8 @@ import './Tag/Tag.module.css';
31
31
  import './Stencils/Stencils.module.css';
32
32
  import './PopOver/PopOver.module.css';
33
33
  import './DropDown/DropDown.module.css';
34
- import './DropBox/DropBox.module.css';
34
+ import './DropBox/css/DropBox.module.css';
35
+ import './DropBox/DropBoxElement/css/DropBoxElement.module.css';
35
36
  import './DateTime/DateTime.module.css';
36
37
  import './DateTime/DateWidget.module.css';
37
38
  import './Card/Card.module.css';
@@ -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 = [],
@@ -3,7 +3,8 @@ const REPLACER_SYMBOL = '$';
3
3
  // $ startWith is used for replace the existing style.
4
4
  // all other will be append
5
5
 
6
- export default function mergeStyle(defaultStyle, customStyle) {
6
+ export default function mergeStyle(defaultStyle) {
7
+ let customStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7
8
  let additionalStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
8
9
  // if(!Object.keys(defaultStyle).includes('base')) {
9
10
  // throw new Error(`STYLE CUSTOMIZATION RULE - Your style sheet should have "base" class name for customization`);
@@ -17,20 +18,33 @@ export default function mergeStyle(defaultStyle, customStyle) {
17
18
  // return res;
18
19
  throw new Error(`UNKNOWN CLASSNAME DETECTED - Given customStyle's key "${styleName}" is not available in that component style`);
19
20
  }
20
- let val = defaultStyle[styleName];
21
- Object.keys(res).map(keyName => {
22
- let styleKey = res[keyName];
23
- if (styleKey.includes(val)) {
24
- res[keyName] = styleKey.replace(val, styleValue);
25
- }
26
- });
27
- } 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]) {
28
36
  let val = defaultStyle[next];
29
37
  Object.keys(res).map(keyName => {
30
- if (res[keyName].includes(val)) {
31
- 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(' ');
32
44
  }
33
45
  });
46
+ } else if (additionalStyle.includes(next)) {
47
+ res[next] = customStyle[next];
34
48
  } else if (!defaultStyle[next] && !additionalStyle.includes(next)) {
35
49
  // res[next] = customStyle[next];
36
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;