@zohodesk/components 1.0.0-alpha-270 → 1.0.0-alpha-271

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
@@ -32,6 +32,18 @@ In this Package, we Provide Some Basic Components to Build Web App
32
32
  - TextBoxIcon
33
33
  - Tooltip
34
34
 
35
+ # 1.0.0-alpha-271
36
+
37
+ - **Tabs** - DropBox position RTL fix.
38
+
39
+ - `stopPropagation` method added in common utils.
40
+
41
+ - **DropBox**
42
+
43
+ cancelBubblingEffect fix.
44
+
45
+ `fadeIn` and `scaleIn` animations added.
46
+
35
47
  # 1.0.0-alpha-270
36
48
 
37
49
  - **Tabs** - DropBox position RTL fix
@@ -8,7 +8,7 @@ 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
+ import { stopPropagation } from './../utils/Common';
12
12
  import style from './css/DropBox.module.css';
13
13
  export default function DropBox(props) {
14
14
  const focusRef = useRef(null);
@@ -62,13 +62,13 @@ export default function DropBox(props) {
62
62
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
63
63
  className: `${style.freezeLayer} ${style.freeze}`,
64
64
  style: zIndexStyle,
65
- onClick: cancelBubblingEffect
65
+ onClick: stopPropagation
66
66
  }), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/React.createElement(Modal, {
67
67
  portalId: portalId
68
68
  }, /*#__PURE__*/React.createElement(React.Fragment, null, isRestrictScroll ? /*#__PURE__*/React.createElement("div", {
69
69
  className: style.freezeLayer,
70
70
  style: zIndexStyle,
71
- onClick: cancelBubblingEffect
71
+ onClick: stopPropagation
72
72
  }) : null, dropBoxEle)) : dropBoxEle;
73
73
  }
74
74
  DropBox.propTypes = DropBoxPropTypes;
@@ -26,14 +26,16 @@ export default function DropBoxElement(props) {
26
26
  tabIndex,
27
27
  palette,
28
28
  subContainerRef,
29
- customStyle
29
+ customStyle,
30
+ animationStyle
30
31
  } = props;
31
32
  let isAbsolute = isAbsolutePositioningNeeded;
32
33
  const FireOnAnimationEnd = () => {
33
- let element = subContainerRef && subContainerRef.current.classList;
34
- (isAnimate ? style.fadeIn : style.bounce).split(' ').map(rmStyle => {
35
- if (element && element.contains(rmStyle)) {
36
- element.remove(rmStyle);
34
+ let eleClassList = subContainerRef && subContainerRef.current.classList;
35
+ let animationStyles = animationStyle == 'default' ? style.fadeInScale : style[animationStyle];
36
+ animationStyles.split(' ').map(rmStyle => {
37
+ if (eleClassList && eleClassList.contains(rmStyle)) {
38
+ eleClassList.remove(rmStyle);
37
39
  }
38
40
  });
39
41
  };
@@ -97,7 +99,7 @@ export default function DropBoxElement(props) {
97
99
  "aria-multiselectable": ariaMultiselectable,
98
100
  "aria-labelledby": ariaLabelledby,
99
101
  tabIndex: tabIndex,
100
- onAnimationEnd: FireOnAnimationEnd
102
+ onAnimationEnd: isAnimate && FireOnAnimationEnd
101
103
  }, /*#__PURE__*/React.createElement("div", {
102
104
  tabIndex: "-1",
103
105
  className: `${subContainerClass} ${style[`${palette}Palette`]}`,
@@ -336,20 +336,26 @@
336
336
  animation-duration: var(--zd_transition2);
337
337
  }
338
338
 
339
- .fadeIn {
339
+ .fadeInScale {
340
340
  composes: animationBasic;
341
341
  composes: fadeInScale modeForward from '../../../common/animation.module.css';
342
342
  }
343
343
 
344
+ .fadeIn {
345
+ composes: animationBasic;
346
+ composes: fadeIn modeForward from '../../../common/animation.module.css';
347
+ }
348
+ .scaleIn {
349
+ composes: animationBasic;
350
+ composes: scaleIn from '../../../common/animation.module.css';
351
+ }
344
352
  .bounce {
345
353
  composes: animationBasic;
346
354
  }
347
-
348
355
  [dir=ltr] .bounce {
349
356
  animation-name: animation;
350
357
  animation-timing-function: cubic-bezier(0.4, 1, 0.65, 1.1);
351
358
  }
352
-
353
359
  [dir=rtl] .bounce {
354
360
  animation-name: animation;
355
361
  animation-timing-function: cubic-bezier(0.4, 1, 0.65, 1.1);
@@ -40,6 +40,7 @@ export default function cssJSLogic(_ref) {
40
40
  customDropBoxWrap = '',
41
41
  customMobileDropBoxWrap = ''
42
42
  } = customClass;
43
+ const animationValue = animationStyle === 'default' ? 'fadeInScale' : animationStyle;
43
44
 
44
45
  // const {needBoxStyle,boxstyle} = useDropboxPosCalc(props)
45
46
 
@@ -66,8 +67,7 @@ export default function cssJSLogic(_ref) {
66
67
  [style[`${boxDirection}_shadow`]]: !isModel,
67
68
  [style.boxPadding]: !isModel && isBoxPaddingNeed,
68
69
  [style.radius]: !isModel && isRadius,
69
- [style.fadeIn]: !isModel && isAnimate && !isReducedMotion && isActive && animationStyle === 'default',
70
- [style.bounce]: !isModel && isAnimate && !isReducedMotion && isActive && animationStyle === 'bounce'
70
+ [style[animationValue]]: !isModel && isAnimate && !isReducedMotion && isActive && !!animationStyle
71
71
  });
72
72
  let inlineStyle = !isModel ? isAbsolute ? needBoxStyle && boxstyle : positionsOffset && positionsOffset[boxPosition] || {} : {};
73
73
  if (zIndexStyle) {
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  export const DropBoxElementPropTypes = {
3
- animationStyle: PropTypes.oneOf(['default', 'bounce']),
3
+ animationStyle: PropTypes.oneOf(['default', 'bounce', 'fadeIn', 'scaleIn']),
4
4
  arrowBottom: PropTypes.number,
5
5
  arrowLeft: PropTypes.number,
6
6
  arrowPosition: PropTypes.oneOf(['start', 'mid', 'end']),
@@ -58,7 +58,7 @@ describe('DropBox component', () => {
58
58
  isAnimate: true,
59
59
  isActive: true
60
60
  }));
61
- let x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeIn');
61
+ let x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeInScale');
62
62
  expect(x.length).toBe(1);
63
63
  });
64
64
  it('Should check render proper class name(isAnimate & isActive)', () => {
@@ -67,7 +67,7 @@ describe('DropBox component', () => {
67
67
  isAnimate: true,
68
68
  isActive: true
69
69
  }));
70
- let x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeIn');
70
+ let x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeInScale');
71
71
  expect(x.length).toBe(1);
72
72
  });
73
73
  it('Should check render proper class name(arrowPosition)', () => {
@@ -120,34 +120,16 @@
120
120
  .menuBox {
121
121
  max-height: 220px;
122
122
  }
123
-
124
-
125
123
  .bottomRightToLeft,
126
124
  .topRightToLeft,
127
125
  .bottomCenterToLeft {
128
- }
129
-
130
-
131
- [dir=ltr] .bottomRightToLeft, [dir=ltr] .topRightToLeft, [dir=ltr] .bottomCenterToLeft {
132
- right: calc(var(--tab_position_gap) * -1);
133
- }
134
-
135
-
136
- [dir=rtl] .bottomRightToLeft, [dir=rtl] .topRightToLeft, [dir=rtl] .bottomCenterToLeft {
137
- left: calc(var(--tab_position_gap) * -1);
126
+ right: calc(var(--tab_position_gap) * -1);
138
127
  }
139
128
 
140
129
  .bottomLeftToRight,
141
130
  .topLeftToRight,
142
131
  .bottomCenterToRight {
143
- }
144
-
145
- [dir=ltr] .bottomLeftToRight, [dir=ltr] .topLeftToRight, [dir=ltr] .bottomCenterToRight {
146
- left: calc(var(--tab_position_gap) * -1);
147
- }
148
-
149
- [dir=rtl] .bottomLeftToRight, [dir=rtl] .topLeftToRight, [dir=rtl] .bottomCenterToRight {
150
- right: calc(var(--tab_position_gap) * -1);
132
+ left: calc(var(--tab_position_gap) * -1);
151
133
  }
152
134
 
153
135
  .hidden {
@@ -9,6 +9,10 @@ export const getTotalDimension = (elem, align) => {
9
9
  const style = window.getComputedStyle(elem);
10
10
  return align === 'vertical' ? elem.offsetWidth + parseDecimal(style.marginLeft) + parseDecimal(style.marginRight) : elem.offsetHeight + parseDecimal(style.marginTop) + parseDecimal(style.marginBottom);
11
11
  };
12
+ export function stopPropagation(e) {
13
+ e && e.stopPropagation && e.stopPropagation();
14
+ }
15
+ ;
12
16
  export const stopAllEventPropagation = e => {
13
17
  e.stopPropagation && e.stopPropagation();
14
18
  e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
@@ -68,13 +68,13 @@ function DropBox(props) {
68
68
  }, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
69
69
  className: "".concat(_DropBoxModule["default"].freezeLayer, " ").concat(_DropBoxModule["default"].freeze),
70
70
  style: zIndexStyle,
71
- onClick: _Common.cancelBubblingEffect
71
+ onClick: _Common.stopPropagation
72
72
  }), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
73
73
  portalId: portalId
74
74
  }, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isRestrictScroll ? /*#__PURE__*/_react["default"].createElement("div", {
75
75
  className: _DropBoxModule["default"].freezeLayer,
76
76
  style: zIndexStyle,
77
- onClick: _Common.cancelBubblingEffect
77
+ onClick: _Common.stopPropagation
78
78
  }) : null, dropBoxEle)) : dropBoxEle;
79
79
  }
80
80
  DropBox.propTypes = _propTypes.DropBoxPropTypes;
@@ -32,13 +32,15 @@ function DropBoxElement(props) {
32
32
  tabIndex = props.tabIndex,
33
33
  palette = props.palette,
34
34
  subContainerRef = props.subContainerRef,
35
- customStyle = props.customStyle;
35
+ customStyle = props.customStyle,
36
+ animationStyle = props.animationStyle;
36
37
  var isAbsolute = isAbsolutePositioningNeeded;
37
38
  var FireOnAnimationEnd = function FireOnAnimationEnd() {
38
- var element = subContainerRef && subContainerRef.current.classList;
39
- (isAnimate ? _DropBoxElementModule["default"].fadeIn : _DropBoxElementModule["default"].bounce).split(' ').map(function (rmStyle) {
40
- if (element && element.contains(rmStyle)) {
41
- element.remove(rmStyle);
39
+ var eleClassList = subContainerRef && subContainerRef.current.classList;
40
+ var animationStyles = animationStyle == 'default' ? _DropBoxElementModule["default"].fadeInScale : _DropBoxElementModule["default"][animationStyle];
41
+ animationStyles.split(' ').map(function (rmStyle) {
42
+ if (eleClassList && eleClassList.contains(rmStyle)) {
43
+ eleClassList.remove(rmStyle);
42
44
  }
43
45
  });
44
46
  };
@@ -96,7 +98,7 @@ function DropBoxElement(props) {
96
98
  "aria-multiselectable": ariaMultiselectable,
97
99
  "aria-labelledby": ariaLabelledby,
98
100
  tabIndex: tabIndex,
99
- onAnimationEnd: FireOnAnimationEnd
101
+ onAnimationEnd: isAnimate && FireOnAnimationEnd
100
102
  }, /*#__PURE__*/_react["default"].createElement("div", {
101
103
  tabIndex: "-1",
102
104
  className: "".concat(subContainerClass, " ").concat(_DropBoxElementModule["default"]["".concat(palette, "Palette")]),
@@ -336,20 +336,26 @@
336
336
  animation-duration: var(--zd_transition2);
337
337
  }
338
338
 
339
- .fadeIn {
339
+ .fadeInScale {
340
340
  composes: animationBasic;
341
341
  composes: fadeInScale modeForward from '../../../common/animation.module.css';
342
342
  }
343
343
 
344
+ .fadeIn {
345
+ composes: animationBasic;
346
+ composes: fadeIn modeForward from '../../../common/animation.module.css';
347
+ }
348
+ .scaleIn {
349
+ composes: animationBasic;
350
+ composes: scaleIn from '../../../common/animation.module.css';
351
+ }
344
352
  .bounce {
345
353
  composes: animationBasic;
346
354
  }
347
-
348
355
  [dir=ltr] .bounce {
349
356
  animation-name: animation;
350
357
  animation-timing-function: cubic-bezier(0.4, 1, 0.65, 1.1);
351
358
  }
352
-
353
359
  [dir=rtl] .bounce {
354
360
  animation-name: animation;
355
361
  animation-timing-function: cubic-bezier(0.4, 1, 0.65, 1.1);
@@ -47,11 +47,12 @@ function cssJSLogic(_ref) {
47
47
  customDropBoxWrap = _customClass$customDr2 === void 0 ? '' : _customClass$customDr2,
48
48
  _customClass$customMo2 = customClass.customMobileDropBoxWrap,
49
49
  customMobileDropBoxWrap = _customClass$customMo2 === void 0 ? '' : _customClass$customMo2;
50
+ var animationValue = animationStyle === 'default' ? 'fadeInScale' : animationStyle;
50
51
 
51
52
  // const {needBoxStyle,boxstyle} = useDropboxPosCalc(props)
52
53
 
53
54
  var boxClassName = (0, _utils.compileClassNames)((_compileClassNames = {}, _defineProperty(_compileClassNames, style.main, true), _defineProperty(_compileClassNames, style.hidden, !isActive), _defineProperty(_compileClassNames, style.responsive, !!isModel), _defineProperty(_compileClassNames, customMobileDropBoxWrap, !!isModel), _defineProperty(_compileClassNames, customDropBoxWrap, !isModel), _defineProperty(_compileClassNames, style.container, isAbsolute && !isModel), _defineProperty(_compileClassNames, style[boxPosition], isAbsolute && !isModel), _defineProperty(_compileClassNames, style.fixedContainer, !isAbsolute && !isModel), _defineProperty(_compileClassNames, style[size], size && !isModel), _defineProperty(_compileClassNames, style[boxDirection], !isModel && isActive && isArrow), _defineProperty(_compileClassNames, style["arrow".concat(boxDirection)], !isModel && isActive && isArrow && isAbsolute), _defineProperty(_compileClassNames, style["paddingSpace_".concat(boxDirection)], !isModel && isActive && !isArrow && isPadding), _compileClassNames));
54
- var subContainerClass = (0, _utils.compileClassNames)((_compileClassNames2 = {}, _defineProperty(_compileClassNames2, style.subContainer, true), _defineProperty(_compileClassNames2, customMobileDropBox, !!isModel), _defineProperty(_compileClassNames2, style.mobRadius, !!isModel), _defineProperty(_compileClassNames2, style.slideUp, !!isModel && isActive), _defineProperty(_compileClassNames2, customDropBox, !isModel), _defineProperty(_compileClassNames2, style["".concat(boxDirection, "_shadow")], !isModel), _defineProperty(_compileClassNames2, style.boxPadding, !isModel && isBoxPaddingNeed), _defineProperty(_compileClassNames2, style.radius, !isModel && isRadius), _defineProperty(_compileClassNames2, style.fadeIn, !isModel && isAnimate && !isReducedMotion && isActive && animationStyle === 'default'), _defineProperty(_compileClassNames2, style.bounce, !isModel && isAnimate && !isReducedMotion && isActive && animationStyle === 'bounce'), _compileClassNames2));
55
+ var subContainerClass = (0, _utils.compileClassNames)((_compileClassNames2 = {}, _defineProperty(_compileClassNames2, style.subContainer, true), _defineProperty(_compileClassNames2, customMobileDropBox, !!isModel), _defineProperty(_compileClassNames2, style.mobRadius, !!isModel), _defineProperty(_compileClassNames2, style.slideUp, !!isModel && isActive), _defineProperty(_compileClassNames2, customDropBox, !isModel), _defineProperty(_compileClassNames2, style["".concat(boxDirection, "_shadow")], !isModel), _defineProperty(_compileClassNames2, style.boxPadding, !isModel && isBoxPaddingNeed), _defineProperty(_compileClassNames2, style.radius, !isModel && isRadius), _defineProperty(_compileClassNames2, style[animationValue], !isModel && isAnimate && !isReducedMotion && isActive && !!animationStyle), _compileClassNames2));
55
56
  var inlineStyle = !isModel ? isAbsolute ? needBoxStyle && boxstyle : positionsOffset && positionsOffset[boxPosition] || {} : {};
56
57
  if (zIndexStyle) {
57
58
  inlineStyle = Object.assign({}, inlineStyle, zIndexStyle);
@@ -7,7 +7,7 @@ exports.DropBoxElementPropTypes = void 0;
7
7
  var _propTypes = _interopRequireDefault(require("prop-types"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
9
  var DropBoxElementPropTypes = {
10
- animationStyle: _propTypes["default"].oneOf(['default', 'bounce']),
10
+ animationStyle: _propTypes["default"].oneOf(['default', 'bounce', 'fadeIn', 'scaleIn']),
11
11
  arrowBottom: _propTypes["default"].number,
12
12
  arrowLeft: _propTypes["default"].number,
13
13
  arrowPosition: _propTypes["default"].oneOf(['start', 'mid', 'end']),
@@ -60,7 +60,7 @@ describe('DropBox component', function () {
60
60
  isAnimate: true,
61
61
  isActive: true
62
62
  }));
63
- var x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeIn');
63
+ var x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeInScale');
64
64
  expect(x.length).toBe(1);
65
65
  });
66
66
  it('Should check render proper class name(isAnimate & isActive)', function () {
@@ -69,7 +69,7 @@ describe('DropBox component', function () {
69
69
  isAnimate: true,
70
70
  isActive: true
71
71
  }));
72
- var x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeIn');
72
+ var x = TestUtils.scryRenderedDOMComponentsWithClass(renderedDOM, 'fadeInScale');
73
73
  expect(x.length).toBe(1);
74
74
  });
75
75
  it('Should check render proper class name(arrowPosition)', function () {
@@ -120,34 +120,16 @@
120
120
  .menuBox {
121
121
  max-height: 220px;
122
122
  }
123
-
124
-
125
123
  .bottomRightToLeft,
126
124
  .topRightToLeft,
127
125
  .bottomCenterToLeft {
128
- }
129
-
130
-
131
- [dir=ltr] .bottomRightToLeft, [dir=ltr] .topRightToLeft, [dir=ltr] .bottomCenterToLeft {
132
- right: calc(var(--tab_position_gap) * -1);
133
- }
134
-
135
-
136
- [dir=rtl] .bottomRightToLeft, [dir=rtl] .topRightToLeft, [dir=rtl] .bottomCenterToLeft {
137
- left: calc(var(--tab_position_gap) * -1);
126
+ right: calc(var(--tab_position_gap) * -1);
138
127
  }
139
128
 
140
129
  .bottomLeftToRight,
141
130
  .topLeftToRight,
142
131
  .bottomCenterToRight {
143
- }
144
-
145
- [dir=ltr] .bottomLeftToRight, [dir=ltr] .topLeftToRight, [dir=ltr] .bottomCenterToRight {
146
- left: calc(var(--tab_position_gap) * -1);
147
- }
148
-
149
- [dir=rtl] .bottomLeftToRight, [dir=rtl] .topLeftToRight, [dir=rtl] .bottomCenterToRight {
150
- right: calc(var(--tab_position_gap) * -1);
132
+ left: calc(var(--tab_position_gap) * -1);
151
133
  }
152
134
 
153
135
  .hidden {
@@ -32,7 +32,9 @@ exports.mapValues = mapValues;
32
32
  exports.merge = merge;
33
33
  exports.parseDecimal = void 0;
34
34
  exports.remConvert = remConvert;
35
- exports.throttle = exports.stopAllEventPropagation = exports.scrollTo = void 0;
35
+ exports.stopAllEventPropagation = exports.scrollTo = void 0;
36
+ exports.stopPropagation = stopPropagation;
37
+ exports.throttle = void 0;
36
38
  var _viewPort = _interopRequireDefault(require("../Popup/viewPort"));
37
39
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
38
40
  //$Id$//
@@ -53,6 +55,10 @@ var getTotalDimension = function getTotalDimension(elem, align) {
53
55
  return align === 'vertical' ? elem.offsetWidth + parseDecimal(style.marginLeft) + parseDecimal(style.marginRight) : elem.offsetHeight + parseDecimal(style.marginTop) + parseDecimal(style.marginBottom);
54
56
  };
55
57
  exports.getTotalDimension = getTotalDimension;
58
+ function stopPropagation(e) {
59
+ e && e.stopPropagation && e.stopPropagation();
60
+ }
61
+ ;
56
62
  var stopAllEventPropagation = function stopAllEventPropagation(e) {
57
63
  e.stopPropagation && e.stopPropagation();
58
64
  e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-alpha-270",
3
+ "version": "1.0.0-alpha-271",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,