linear-react-components-ui 0.4.76-beta.28 → 0.4.76-beta.30

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.
@@ -48,7 +48,7 @@
48
48
  }
49
49
  }
50
50
 
51
- .dropdown-component > .select-dropdown {
51
+ .select-component > .dropdown {
52
52
  animation: 0.5s ease-in 0s 1 slideDown;
53
53
  background-color: #FFF;
54
54
  border: $component-border-color;
@@ -58,17 +58,17 @@
58
58
  height: auto;
59
59
  overflow-y: auto;
60
60
  overflow-x: hidden;
61
+ position: absolute;
61
62
  margin-top: 2px;
63
+ z-index: 99999999999;
62
64
  > .filtercontainer {
63
65
  display: grid;
64
66
  grid-template-columns: 1fr 20px;
65
- align-items: center;
66
67
  border: 1px solid $component-border-color;
67
68
  margin: 4px;
68
69
  }
69
70
  > .filtercontainer > .filterinput {
70
71
  border: 0;
71
- width: 100%;
72
72
  font-size: 13px;
73
73
  text-indent: 4px;
74
74
  padding: 10px 5px;
@@ -18,9 +18,8 @@ var getCalendarDropdownStyle = function getCalendarDropdownStyle(_ref) {
18
18
  leftPosition = _ref.leftPosition,
19
19
  rightPosition = _ref.rightPosition,
20
20
  align = _ref.align,
21
- isFloatMenu = _ref.isFloatMenu,
22
- minWidth = _ref.minWidth;
23
- var style = "top: ".concat(topPosition + (isFloatMenu ? 6 : 2), "px; min-width: ").concat(minWidth, "px;");
21
+ isFloatMenu = _ref.isFloatMenu;
22
+ var style = "top: ".concat(topPosition + (isFloatMenu ? 6 : 2), "px;");
24
23
 
25
24
  if (align === 'left') {
26
25
  style += "left: ".concat(leftPosition, "px;");
@@ -558,6 +558,10 @@ function getIcons() {
558
558
  tools: {
559
559
  viewbox: '0 0 20 16',
560
560
  paths: ['M7.696 11.009l2.295 2.295-1.823 2.341c-0.334 0.437-0.926 0.476-1.315 0.087l-1.586-1.586c-0.389-0.389-0.35-0.98 0.087-1.315l2.341-1.823zM19.899 4.101l-2.399 2.399-3-3 2.399-2.399c-0.289-0.066-0.59-0.101-0.899-0.101-2.209 0-4 1.791-4 4 0 0.797 0.233 1.539 0.635 2.163l-2.233 1.739-3.402-3.402 4.5-4.5h-5l-2.22 2.22-0.22-0.22h-1.061v1.061l0.22 0.22-3.22 3.22 2.5 2.5 3-3 9 9 1.5-1.5-3.902-3.902 1.739-2.233c0.624 0.402 1.366 0.635 2.163 0.635 2.209 0 4-1.791 4-4 0-0.309-0.035-0.61-0.101-0.899z']
561
+ },
562
+ checkmarkCircle: {
563
+ viewbox: '0 0 16 16',
564
+ paths: ['M8 0c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zM6.5 12.031l-2.813-3.344 1.031-1.031 1.781 1.75 5.156-4.5 0.719 0.719-5.875 6.406z']
561
565
  }
562
566
  };
563
567
  return icons;
@@ -17,8 +17,6 @@ var _avatar = _interopRequireDefault(require("../../avatar"));
17
17
 
18
18
  var helper = _interopRequireWildcard(require("./helper"));
19
19
 
20
- var _Popup = _interopRequireDefault(require("../../dropdown/Popup"));
21
-
22
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
21
 
24
22
  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); }
@@ -39,50 +37,67 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
39
37
 
40
38
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
39
 
42
- var Dropdown = function Dropdown(props) {
43
- var dataCombo = props.dataCombo,
44
- dropdownWidth = props.dropdownWidth,
45
- selected = props.selected,
46
- handleOnSelect = props.handleOnSelect,
47
- handleOnFilter = props.handleOnFilter,
48
- searchOnDropdown = props.searchOnDropdown,
49
- handleOnKeydown = props.handleOnKeydown,
50
- searchNotFoundText = props.searchNotFoundText,
51
- handleOnBlur = props.handleOnBlur,
52
- handleOnFocus = props.handleOnFocus,
53
- opened = props.opened,
54
- idKey = props.idKey,
55
- descriptionKey = props.descriptionKey,
56
- currents = props.currents,
57
- imageAlign = props.imageAlign,
58
- striped = props.striped,
59
- imgSrcKey = props.imgSrcKey,
60
- gridWrapperStyle = props.gridWrapperStyle,
61
- inputValue = props.inputValue,
62
- dropdownRef = props.dropdownRef;
63
-
64
- var _useState = (0, _react.useState)(helper.returnDropdownDynamicStyles(_extends({}, props))),
65
- _useState2 = _slicedToArray(_useState, 2),
66
- dropdownDynamicStyles = _useState2[0],
67
- setDropdownDynamicStyles = _useState2[1];
68
-
69
- (0, _react.useEffect)(function () {
70
- if (dropdownRef.current) {
71
- setDropdownDynamicStyles(helper.returnDropdownDynamicStyles(_extends({}, props)));
40
+ var returnDropdownDynamicStyles = function returnDropdownDynamicStyles(selectFieldRef, dropdownMaxHeight) {
41
+ var selectFieldRects = selectFieldRef.current.getBoundingClientRect();
42
+ var dropdownBottomDistance = window.innerHeight - selectFieldRects.bottom;
43
+ var maxDropdownBottomDistance = 200;
44
+ var height = dropdownMaxHeight;
45
+ var dropdownPosition;
46
+
47
+ if (!height || height <= 0) {
48
+ if (dropdownBottomDistance < maxDropdownBottomDistance) {
49
+ height = selectFieldRects.top;
50
+ dropdownPosition = window.innerHeight - selectFieldRef.current.offsetTop + 10;
51
+ } else {
52
+ height = dropdownBottomDistance;
72
53
  }
73
- }, [dropdownRef.current, dataCombo]);
74
- return /*#__PURE__*/_react["default"].createElement(_Popup["default"], {
75
- leftPosition: dropdownDynamicStyles.left,
76
- topPosition: dropdownDynamicStyles.top,
77
- minWidth: dropdownWidth
78
- }, /*#__PURE__*/_react["default"].createElement("div", {
79
- className: "select-dropdown",
80
- ref: dropdownRef,
81
- style: {
82
- width: dropdownWidth,
83
- marginLeft: gridWrapperStyle ? gridWrapperStyle.paddingLeft : '0',
84
- maxHeight: dropdownDynamicStyles.maxHeight
54
+ } else {
55
+ maxDropdownBottomDistance = height;
56
+
57
+ if (dropdownBottomDistance < maxDropdownBottomDistance) {
58
+ dropdownPosition = window.innerHeight - selectFieldRef.current.offsetTop + 10;
85
59
  }
60
+ }
61
+
62
+ return {
63
+ maxHeight: "".concat(height - 30, "px"),
64
+ bottom: dropdownBottomDistance < maxDropdownBottomDistance && "".concat(dropdownPosition, "px")
65
+ };
66
+ };
67
+
68
+ var Dropdown = function Dropdown(_ref) {
69
+ var dataCombo = _ref.dataCombo,
70
+ dropdownWidth = _ref.dropdownWidth,
71
+ selected = _ref.selected,
72
+ handleOnSelect = _ref.handleOnSelect,
73
+ handleOnFilter = _ref.handleOnFilter,
74
+ searchOnDropdown = _ref.searchOnDropdown,
75
+ handleOnKeydown = _ref.handleOnKeydown,
76
+ searchNotFoundText = _ref.searchNotFoundText,
77
+ handleOnBlur = _ref.handleOnBlur,
78
+ handleOnFocus = _ref.handleOnFocus,
79
+ opened = _ref.opened,
80
+ idKey = _ref.idKey,
81
+ descriptionKey = _ref.descriptionKey,
82
+ currents = _ref.currents,
83
+ imageAlign = _ref.imageAlign,
84
+ striped = _ref.striped,
85
+ imgSrcKey = _ref.imgSrcKey,
86
+ gridWrapperStyle = _ref.gridWrapperStyle,
87
+ selectFieldRef = _ref.selectFieldRef,
88
+ dropdownMaxHeight = _ref.dropdownMaxHeight,
89
+ inputValue = _ref.inputValue;
90
+
91
+ var _useState = (0, _react.useState)(returnDropdownDynamicStyles(selectFieldRef, dropdownMaxHeight)),
92
+ _useState2 = _slicedToArray(_useState, 1),
93
+ dropdownDynamicStyles = _useState2[0];
94
+
95
+ return /*#__PURE__*/_react["default"].createElement("div", {
96
+ className: "dropdown",
97
+ style: _extends({
98
+ width: dropdownWidth,
99
+ marginLeft: gridWrapperStyle ? gridWrapperStyle.paddingLeft : '0'
100
+ }, dropdownDynamicStyles)
86
101
  }, searchOnDropdown && /*#__PURE__*/_react["default"].createElement("div", {
87
102
  className: "filtercontainer"
88
103
  }, /*#__PURE__*/_react["default"].createElement("input", {
@@ -138,7 +153,7 @@ var Dropdown = function Dropdown(props) {
138
153
  }, item[descriptionKey])));
139
154
  }), dataCombo.length === 0 && /*#__PURE__*/_react["default"].createElement("div", {
140
155
  className: "notfound"
141
- }, searchNotFoundText)));
156
+ }, searchNotFoundText));
142
157
  };
143
158
 
144
159
  Dropdown.propTypes = {
@@ -156,14 +171,13 @@ Dropdown.propTypes = {
156
171
  handleOnBlur: _propTypes["default"].func.isRequired,
157
172
  handleOnFocus: _propTypes["default"].func.isRequired,
158
173
  opened: _propTypes["default"].bool.isRequired,
159
- inputValue: _propTypes["default"].string.isRequired,
160
- dropdownRef: _propTypes["default"].object.isRequired,
161
174
  currents: _propTypes["default"].arrayOf(_propTypes["default"].object),
162
175
  imageAlign: _propTypes["default"].oneOf(['left', 'right']),
163
176
  striped: _propTypes["default"].bool,
164
177
  gridWrapperStyle: _propTypes["default"].object,
165
178
  selectFieldRef: _propTypes["default"].object,
166
- dropdownMaxHeight: _propTypes["default"].number
179
+ dropdownMaxHeight: _propTypes["default"].number,
180
+ inputValue: _propTypes["default"].string.isRequired
167
181
  };
168
182
  Dropdown.defaultProps = {
169
183
  selected: null,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.returnDropdownDynamicStyles = exports.getFilteredMultipleDataCombo = exports.getFilteredSimpleDataCombo = exports.getDropdownItemCssClass = exports.contentClass = void 0;
6
+ exports.getFilteredMultipleDataCombo = exports.getFilteredSimpleDataCombo = exports.getDropdownItemCssClass = exports.contentClass = void 0;
7
7
 
8
8
  var contentClass = function contentClass(props) {
9
9
  return "content ".concat(props.showClearButton ? '' : 'noclear');
@@ -42,67 +42,4 @@ var getFilteredMultipleDataCombo = function getFilteredMultipleDataCombo(_ref2)
42
42
  });
43
43
  };
44
44
 
45
- exports.getFilteredMultipleDataCombo = getFilteredMultipleDataCombo;
46
-
47
- var returnDropdownPosition = function returnDropdownPosition(_ref3) {
48
- var selectFieldRects = _ref3.selectFieldRects,
49
- dropdownRef = _ref3.dropdownRef,
50
- dropdownRects = _ref3.dropdownRects;
51
- var aboveDropdown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
52
- var DEFAULT_MARGIN_BOTTOM = 10;
53
-
54
- if (aboveDropdown) {
55
- return selectFieldRects.top + window.scrollY - (dropdownRef.current && dropdownRects.height) - DEFAULT_MARGIN_BOTTOM;
56
- }
57
-
58
- return selectFieldRects.top + window.scrollY + selectFieldRects.height;
59
- };
60
-
61
- var returnDropdownDynamicStyles = function returnDropdownDynamicStyles(_ref4) {
62
- var selectFieldRef = _ref4.selectFieldRef,
63
- dropdownMaxHeight = _ref4.dropdownMaxHeight,
64
- dropdownRef = _ref4.dropdownRef;
65
- var selectFieldRects = selectFieldRef.current.getBoundingClientRect();
66
- var dropdownRects = dropdownRef.current && dropdownRef.current.getBoundingClientRect();
67
- var dropdownBottomDistance = window.innerHeight - selectFieldRects.bottom;
68
- var bottomOffset = 30;
69
- var maxDropdownBottomDistance = 200;
70
- var height = dropdownMaxHeight;
71
- var dropdownPosition;
72
-
73
- if (!height || height <= 0) {
74
- if (dropdownBottomDistance < maxDropdownBottomDistance) {
75
- height = selectFieldRects.top;
76
- dropdownPosition = returnDropdownPosition({
77
- selectFieldRects: selectFieldRects,
78
- dropdownRef: dropdownRef,
79
- dropdownRects: dropdownRects
80
- }, true);
81
- } else {
82
- height = dropdownBottomDistance;
83
- dropdownPosition = returnDropdownPosition({
84
- selectFieldRects: selectFieldRects
85
- });
86
- }
87
- } else {
88
- maxDropdownBottomDistance = height;
89
-
90
- if (dropdownBottomDistance < maxDropdownBottomDistance) {
91
- dropdownPosition = returnDropdownPosition({
92
- selectFieldRects: selectFieldRects,
93
- dropdownRef: dropdownRef,
94
- dropdownRects: dropdownRects
95
- }, true);
96
- } else {
97
- dropdownPosition = returnDropdownPosition(selectFieldRects);
98
- }
99
- }
100
-
101
- return {
102
- maxHeight: height - bottomOffset,
103
- top: dropdownPosition,
104
- left: selectFieldRects.left
105
- };
106
- };
107
-
108
- exports.returnDropdownDynamicStyles = returnDropdownDynamicStyles;
45
+ exports.getFilteredMultipleDataCombo = getFilteredMultipleDataCombo;
@@ -83,7 +83,6 @@ var MultipleSelect = /*#__PURE__*/function (_Component) {
83
83
 
84
84
  _this.componentId = "select-component".concat(_uuid["default"].v1());
85
85
  _this.componentRef = /*#__PURE__*/_react["default"].createRef();
86
- _this.dropdownRef = /*#__PURE__*/_react["default"].createRef();
87
86
  _this.state = {
88
87
  valueFromProps: null,
89
88
  dataCombo: props.dataSource,
@@ -143,11 +142,10 @@ var MultipleSelect = /*#__PURE__*/function (_Component) {
143
142
  }, {
144
143
  key: "onClickOutside",
145
144
  value: function onClickOutside(event) {
146
- var selectWrapper = this.selectWrapper,
147
- dropdownRef = this.dropdownRef;
145
+ var selectWrapper = this.selectWrapper;
148
146
  var target = event.target;
149
147
 
150
- if (target !== selectWrapper && !selectWrapper.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
148
+ if (target !== selectWrapper && !selectWrapper.contains(target)) {
151
149
  this.setState({
152
150
  opened: false
153
151
  });
@@ -365,7 +363,6 @@ var MultipleSelect = /*#__PURE__*/function (_Component) {
365
363
  handleOnUnselect: this.onUnselect
366
364
  }))), opened && /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], _extends({}, this.state, this.props, {
367
365
  selectFieldRef: this.componentRef,
368
- dropdownRef: this.dropdownRef,
369
366
  gridWrapperStyle: gridLayout ? window.getComputedStyle(this.gridEl) : undefined,
370
367
  handleOnSelect: this.onSelect,
371
368
  handleOnFilter: this.onFilter,
@@ -78,7 +78,6 @@ var SimpleSelect = /*#__PURE__*/function (_Component) {
78
78
  onDenied: undefined,
79
79
  isTyping: false
80
80
  };
81
- _this.dropdownRef = /*#__PURE__*/_react["default"].createRef();
82
81
  _this.componentId = "select-component".concat(_uuid["default"].v1());
83
82
  _this.componentRef = /*#__PURE__*/_react["default"].createRef();
84
83
  return _this;
@@ -153,7 +152,6 @@ var SimpleSelect = /*#__PURE__*/function (_Component) {
153
152
  }))
154
153
  })), opened && /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], _extends({}, this.state, this.props, {
155
154
  selectFieldRef: this.componentRef,
156
- dropdownRef: this.dropdownRef,
157
155
  gridWrapperStyle: gridLayout ? window.getComputedStyle(this.gridEl) : undefined,
158
156
  handleOnSelect: this.onSelect,
159
157
  handleOnFilter: this.onFilter,
@@ -229,11 +227,10 @@ var _initialiseProps = function _initialiseProps() {
229
227
  enumerable: true,
230
228
  writable: true,
231
229
  value: function value(event) {
232
- var selectWrapper = _this3.selectWrapper,
233
- dropdownRef = _this3.dropdownRef;
230
+ var selectWrapper = _this3.selectWrapper;
234
231
  var target = event.target;
235
232
 
236
- if (target !== selectWrapper && !selectWrapper.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
233
+ if (target !== selectWrapper && !selectWrapper.contains(target)) {
237
234
  _this3.setState({
238
235
  opened: false
239
236
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "0.4.76-beta.28",
3
+ "version": "0.4.76-beta.30",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {