@zohodesk/components 1.0.0-temp-54 → 1.0.0-temp-58

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,9 +32,17 @@ 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-232
36
+
37
+ - ListContainer => Mobile Responsive Implemented
38
+ # 1.0.0-alpha-231
39
+
40
+ - DropBox - Position Undefined Issue Solved
41
+
35
42
  # 1.0.0-alpha-230
36
43
 
37
44
  - Avatar, AdvancedGroupMultiSelect, AdvancedMultiSelect, MultiSelect, MultiSelectWithAvatar, GroupSelect, Select, SelectWithAvatar, SelectWithIcon, TextBoxIcon => Tooltip undefined case solved
45
+ - Select , MultiSelect => boxSize prop added
38
46
 
39
47
  # 1.0.0-alpha-229
40
48
 
@@ -117,7 +117,7 @@ export class DropBoxElement extends React.Component {
117
117
  } : {};
118
118
  }
119
119
 
120
- boxPosition = boxPosition ? boxPosition : 'bottomCenter';
120
+ boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
121
121
  const boxDirection = positionMapping[boxPosition].direction;
122
122
  /*getting box direction*/
123
123
 
@@ -1,11 +1,12 @@
1
1
  function _extends() { _extends = Object.assign || 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
 
3
3
  /**** Libraries ****/
4
- import React from 'react';
4
+ import React, { useCallback } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { Container } from '../Layout';
7
7
  import CssProvider from '../Provider/CssProvider';
8
8
  import style from './ListItem.module.css';
9
+ import { useResponsiveReceiver } from '../Responsive/CustomResponsive';
9
10
 
10
11
  const ListContainer = props => {
11
12
  const {
@@ -32,6 +33,22 @@ const ListContainer = props => {
32
33
  onMouseOver,
33
34
  eleRef
34
35
  } = props;
36
+ const responsiveFunc = useCallback(_ref => {
37
+ let {
38
+ mediaQueryOR,
39
+ isTouchDevice
40
+ } = _ref;
41
+ return {
42
+ mobileToTab: mediaQueryOR([{
43
+ maxWidth: 700
44
+ }]),
45
+ isTouchDevice: isTouchDevice
46
+ };
47
+ }, []);
48
+ const {
49
+ mobileToTab,
50
+ isTouchDevice
51
+ } = useResponsiveReceiver('Helmet', responsiveFunc);
35
52
  const {
36
53
  role,
37
54
  ariaSelected
@@ -57,7 +74,7 @@ const ListContainer = props => {
57
74
  isCover: false,
58
75
  align: "vertical",
59
76
  alignBox: "row",
60
- className: `${style.list} ${style[size]} ${style[palette]} ${active ? style[`active${palette}`] : highlight && !isDisabled ? style[`${palette}Hover`] : ''} ${autoHover && !isDisabled ? style[`${palette}Effect`] : ''} ${needTick ? style[`${size}withTick`] : ''} ${isDisabled ? CssProvider('isDisable') : ''} ${needBorder ? active ? style.activewithBorder : style.withBorder : ''} ${customClass}`,
77
+ className: `${style.list} ${style[size]} ${mobileToTab && isTouchDevice ? style.responsiveHeight : ''} ${style[palette]} ${active ? style[`active${palette}`] : highlight && !isDisabled ? style[`${palette}Hover`] : ''} ${autoHover && !isDisabled ? style[`${palette}Effect`] : ''} ${needTick ? style[`${size}withTick`] : ''} ${isDisabled ? CssProvider('isDisable') : ''} ${needBorder ? active ? style.activewithBorder : style.withBorder : ''} ${customClass}`,
61
78
  dataId: dataId,
62
79
  onClick: !isDisabled && onClick,
63
80
  onMouseEnter: onMouseEnter,
@@ -70,7 +70,6 @@
70
70
  [dir=rtl] .large {
71
71
  --listitem_padding: var(--zd_size10) var(--zd_size25) var(--zd_size10) var(--zd_size3);
72
72
  }
73
-
74
73
  .value,
75
74
  .children {
76
75
  composes: dotted from '../common/common.module.css';
@@ -185,10 +184,10 @@
185
184
  [dir=ltr] .mediumwithTick {
186
185
  --listitem_padding: var(--zd_size9) var(--zd_size39) var(--zd_size9)
187
186
  var(--zd_size20)
188
- /*rtl: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size30)*/;
187
+ /*rtl: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size39)*/;
189
188
  }
190
189
  [dir=rtl] .mediumwithTick {
191
- --listitem_padding: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size30);
190
+ --listitem_padding: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size39);
192
191
  }
193
192
  [dir=ltr] .largewithTick {
194
193
  --listitem_padding: var(--zd_size10) var(--zd_size39) var(--zd_size10)
@@ -198,3 +197,9 @@
198
197
  [dir=rtl] .largewithTick {
199
198
  --listitem_padding: var(--zd_size10) var(--zd_size25) var(--zd_size10) var(--zd_size39);
200
199
  }
200
+ .responsiveHeight {
201
+ --listitem_height: var(--zd_size45);
202
+ font-size: var(--zd_font_size15);
203
+ padding-top: var(--zd_size10);
204
+ padding-bottom: var(--zd_size10);
205
+ }
@@ -422,11 +422,6 @@ export class MultiSelectComponent extends React.Component {
422
422
  }
423
423
  } else if (keyCode === 27) {// this.handlePopupClose(e);
424
424
  } else if (keyCode === 9) {
425
- const selectedOption = suggestions[hoverOption] || {};
426
- const {
427
- id
428
- } = selectedOption;
429
- isPopupOpen && !getIsEmptyValue(id) && this.handleSelectOption(id, e);
430
425
  this.handlePopupClose(e);
431
426
  }
432
427
  }
@@ -873,7 +868,8 @@ export class MultiSelectComponent extends React.Component {
873
868
  customChildrenClass,
874
869
  getFooter,
875
870
  needEffect,
876
- disabledOptions
871
+ disabledOptions,
872
+ boxSize
877
873
  } = this.props;
878
874
  const {
879
875
  clearText = 'Clear all',
@@ -996,7 +992,8 @@ export class MultiSelectComponent extends React.Component {
996
992
  a11y: {
997
993
  role: 'listbox',
998
994
  ariaMultiselectable: true
999
- }
995
+ },
996
+ size: boxSize
1000
997
  }, /*#__PURE__*/React.createElement(Card, {
1001
998
  customClass: `${style.box} ${style[`${palette}Box`]}`,
1002
999
  onScroll: this.handleScroll
@@ -1112,7 +1109,8 @@ MultiSelectComponent.propTypes = {
1112
1109
  customChildrenClass: PropTypes.string,
1113
1110
  disabledOptions: PropTypes.arrayOf(PropTypes.string),
1114
1111
  getFooter: PropTypes.func,
1115
- needEffect: PropTypes.bool
1112
+ needEffect: PropTypes.bool,
1113
+ boxSize: PropTypes.string
1116
1114
  };
1117
1115
  MultiSelectComponent.defaultProps = {
1118
1116
  animationStyle: 'bounce',
@@ -1142,7 +1140,8 @@ MultiSelectComponent.defaultProps = {
1142
1140
  textBoxClass: '',
1143
1141
  palette: 'default',
1144
1142
  isSearchClearOnSelect: true,
1145
- needEffect: true
1143
+ needEffect: true,
1144
+ boxSize: 'default'
1146
1145
  };
1147
1146
 
1148
1147
  if (false) {
@@ -25,7 +25,14 @@ function rangeCheck(minValue, maxValue, screenValue) {
25
25
  return minValue <= screenValue && maxValue >= screenValue;
26
26
  }
27
27
 
28
- export const isTouchDevice = 'ontouchstart' in window && navigator.userAgent.match(/mobi/i) ? true : false;
28
+ function isTouchDeviceFunc() {
29
+ // return window.matchMedia("(pointer: coarse)").matches
30
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
31
+ } // export const isTouchDevice =
32
+ // 'ontouchstart' in window && navigator.userAgent.match(/mobi/i) ? true : false;
33
+
34
+
35
+ export const isTouchDevice = isTouchDeviceFunc();
29
36
  export function isBreackPointMatched(object, screen) {
30
37
  if (!isValideBreakPoint(object)) {
31
38
  // eslint-disable-next-line no-console
@@ -171,7 +171,7 @@ var DropBoxElement = /*#__PURE__*/function (_React$Component) {
171
171
  } : {};
172
172
  }
173
173
 
174
- boxPosition = boxPosition ? boxPosition : 'bottomCenter';
174
+ boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
175
175
  var boxDirection = _DropBoxPositionMapping.positionMapping[boxPosition].direction;
176
176
  /*getting box direction*/
177
177
 
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports["default"] = void 0;
7
9
 
8
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
9
11
 
10
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
13
 
@@ -15,8 +17,14 @@ var _CssProvider = _interopRequireDefault(require("../Provider/CssProvider"));
15
17
 
16
18
  var _ListItemModule = _interopRequireDefault(require("./ListItem.module.css"));
17
19
 
20
+ var _CustomResponsive = require("../Responsive/CustomResponsive");
21
+
18
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
23
 
24
+ 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); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
20
28
  function _extends() { _extends = Object.assign || 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); }
21
29
 
22
30
  var ListContainer = function ListContainer(props) {
@@ -42,6 +50,21 @@ var ListContainer = function ListContainer(props) {
42
50
  onMouseEnter = props.onMouseEnter,
43
51
  onMouseOver = props.onMouseOver,
44
52
  eleRef = props.eleRef;
53
+ var responsiveFunc = (0, _react.useCallback)(function (_ref) {
54
+ var mediaQueryOR = _ref.mediaQueryOR,
55
+ isTouchDevice = _ref.isTouchDevice;
56
+ return {
57
+ mobileToTab: mediaQueryOR([{
58
+ maxWidth: 700
59
+ }]),
60
+ isTouchDevice: isTouchDevice
61
+ };
62
+ }, []);
63
+
64
+ var _useResponsiveReceive = (0, _CustomResponsive.useResponsiveReceiver)('Helmet', responsiveFunc),
65
+ mobileToTab = _useResponsiveReceive.mobileToTab,
66
+ isTouchDevice = _useResponsiveReceive.isTouchDevice;
67
+
45
68
  var role = a11y.role,
46
69
  ariaSelected = a11y.ariaSelected;
47
70
  var options = {};
@@ -65,7 +88,7 @@ var ListContainer = function ListContainer(props) {
65
88
  isCover: false,
66
89
  align: "vertical",
67
90
  alignBox: "row",
68
- className: "".concat(_ListItemModule["default"].list, " ").concat(_ListItemModule["default"][size], " ").concat(_ListItemModule["default"][palette], " ").concat(active ? _ListItemModule["default"]["active".concat(palette)] : highlight && !isDisabled ? _ListItemModule["default"]["".concat(palette, "Hover")] : '', " ").concat(autoHover && !isDisabled ? _ListItemModule["default"]["".concat(palette, "Effect")] : '', " ").concat(needTick ? _ListItemModule["default"]["".concat(size, "withTick")] : '', " ").concat(isDisabled ? (0, _CssProvider["default"])('isDisable') : '', " ").concat(needBorder ? active ? _ListItemModule["default"].activewithBorder : _ListItemModule["default"].withBorder : '', " ").concat(customClass),
91
+ className: "".concat(_ListItemModule["default"].list, " ").concat(_ListItemModule["default"][size], " ").concat(mobileToTab && isTouchDevice ? _ListItemModule["default"].responsiveHeight : '', " ").concat(_ListItemModule["default"][palette], " ").concat(active ? _ListItemModule["default"]["active".concat(palette)] : highlight && !isDisabled ? _ListItemModule["default"]["".concat(palette, "Hover")] : '', " ").concat(autoHover && !isDisabled ? _ListItemModule["default"]["".concat(palette, "Effect")] : '', " ").concat(needTick ? _ListItemModule["default"]["".concat(size, "withTick")] : '', " ").concat(isDisabled ? (0, _CssProvider["default"])('isDisable') : '', " ").concat(needBorder ? active ? _ListItemModule["default"].activewithBorder : _ListItemModule["default"].withBorder : '', " ").concat(customClass),
69
92
  dataId: dataId,
70
93
  onClick: !isDisabled && onClick,
71
94
  onMouseEnter: onMouseEnter,
@@ -70,7 +70,6 @@
70
70
  [dir=rtl] .large {
71
71
  --listitem_padding: var(--zd_size10) var(--zd_size25) var(--zd_size10) var(--zd_size3);
72
72
  }
73
-
74
73
  .value,
75
74
  .children {
76
75
  composes: dotted from '../common/common.module.css';
@@ -185,10 +184,10 @@
185
184
  [dir=ltr] .mediumwithTick {
186
185
  --listitem_padding: var(--zd_size9) var(--zd_size39) var(--zd_size9)
187
186
  var(--zd_size20)
188
- /*rtl: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size30)*/;
187
+ /*rtl: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size39)*/;
189
188
  }
190
189
  [dir=rtl] .mediumwithTick {
191
- --listitem_padding: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size30);
190
+ --listitem_padding: var(--zd_size9) var(--zd_size20) var(--zd_size9) var(--zd_size39);
192
191
  }
193
192
  [dir=ltr] .largewithTick {
194
193
  --listitem_padding: var(--zd_size10) var(--zd_size39) var(--zd_size10)
@@ -198,3 +197,9 @@
198
197
  [dir=rtl] .largewithTick {
199
198
  --listitem_padding: var(--zd_size10) var(--zd_size25) var(--zd_size10) var(--zd_size39);
200
199
  }
200
+ .responsiveHeight {
201
+ --listitem_height: var(--zd_size45);
202
+ font-size: var(--zd_font_size15);
203
+ padding-top: var(--zd_size10);
204
+ padding-bottom: var(--zd_size10);
205
+ }
@@ -512,10 +512,6 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
512
512
  }
513
513
  } else if (keyCode === 27) {// this.handlePopupClose(e);
514
514
  } else if (keyCode === 9) {
515
- var _selectedOption = suggestions[hoverOption] || {};
516
-
517
- var _id = _selectedOption.id;
518
- isPopupOpen && !(0, _Common.getIsEmptyValue)(_id) && this.handleSelectOption(_id, e);
519
515
  this.handlePopupClose(e);
520
516
  }
521
517
  }
@@ -945,7 +941,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
945
941
  customChildrenClass = _this$props13.customChildrenClass,
946
942
  getFooter = _this$props13.getFooter,
947
943
  needEffect = _this$props13.needEffect,
948
- disabledOptions = _this$props13.disabledOptions;
944
+ disabledOptions = _this$props13.disabledOptions,
945
+ boxSize = _this$props13.boxSize;
949
946
  var _i18nKeys = i18nKeys,
950
947
  _i18nKeys$clearText = _i18nKeys.clearText,
951
948
  clearText = _i18nKeys$clearText === void 0 ? 'Clear all' : _i18nKeys$clearText,
@@ -1066,7 +1063,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1066
1063
  a11y: {
1067
1064
  role: 'listbox',
1068
1065
  ariaMultiselectable: true
1069
- }
1066
+ },
1067
+ size: boxSize
1070
1068
  }, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
1071
1069
  customClass: "".concat(_MultiSelectModule["default"].box, " ").concat(_MultiSelectModule["default"]["".concat(palette, "Box")]),
1072
1070
  onScroll: this.handleScroll
@@ -1186,7 +1184,8 @@ MultiSelectComponent.propTypes = {
1186
1184
  customChildrenClass: _propTypes["default"].string,
1187
1185
  disabledOptions: _propTypes["default"].arrayOf(_propTypes["default"].string),
1188
1186
  getFooter: _propTypes["default"].func,
1189
- needEffect: _propTypes["default"].bool
1187
+ needEffect: _propTypes["default"].bool,
1188
+ boxSize: _propTypes["default"].string
1190
1189
  };
1191
1190
  MultiSelectComponent.defaultProps = {
1192
1191
  animationStyle: 'bounce',
@@ -1216,7 +1215,8 @@ MultiSelectComponent.defaultProps = {
1216
1215
  textBoxClass: '',
1217
1216
  palette: 'default',
1218
1217
  isSearchClearOnSelect: true,
1219
- needEffect: true
1218
+ needEffect: true,
1219
+ boxSize: 'default'
1220
1220
  };
1221
1221
 
1222
1222
  if (false) {
@@ -62,7 +62,14 @@ function rangeCheck(minValue, maxValue, screenValue) {
62
62
  return minValue <= screenValue && maxValue >= screenValue;
63
63
  }
64
64
 
65
- var isTouchDevice = 'ontouchstart' in window && navigator.userAgent.match(/mobi/i) ? true : false;
65
+ function isTouchDeviceFunc() {
66
+ // return window.matchMedia("(pointer: coarse)").matches
67
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
68
+ } // export const isTouchDevice =
69
+ // 'ontouchstart' in window && navigator.userAgent.match(/mobi/i) ? true : false;
70
+
71
+
72
+ var isTouchDevice = isTouchDeviceFunc();
66
73
  exports.isTouchDevice = isTouchDevice;
67
74
 
68
75
  function isBreackPointMatched(object, screen) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-temp-54",
3
+ "version": "1.0.0-temp-58",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",