linear-react-components-ui 0.4.76-rc.14 → 0.4.76-rc.15

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/.DS_Store ADDED
Binary file
@@ -88,6 +88,7 @@
88
88
 
89
89
  .tabs-component {
90
90
  display: grid;
91
+ grid-template-rows: auto 1fr;
91
92
  width: 100%;
92
93
  height: 100%;
93
94
  @extend %tab-component-menus;
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
+ var _lodash = _interopRequireDefault(require("lodash"));
15
+
14
16
  var _inputHOC = _interopRequireDefault(require("../inputHOC"));
15
17
 
16
18
  require("../../assets/styles/input.scss");
@@ -111,7 +113,14 @@ var InputTextBase = function InputTextBase(props) {
111
113
  id: id,
112
114
  className: helpers.getInputClass(props),
113
115
  ref: function ref(r) {
114
- if (inputRef) inputRef.current = r;
116
+ if (inputRef) {
117
+ if (!_lodash["default"].isFunction(inputRef)) {
118
+ inputRef.current = r;
119
+ } else {
120
+ inputRef(r);
121
+ }
122
+ }
123
+
115
124
  if (targetRef) targetRef(r);
116
125
  }
117
126
  };
@@ -7,9 +7,14 @@ exports.getRightElements = exports.getErrorMessages = exports.getInputWrapperCla
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
+ var _lodash = _interopRequireDefault(require("lodash"));
11
+
12
+ var _uuid = _interopRequireDefault(require("uuid"));
13
+
10
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
15
 
12
- // import Popover from '../../popover';
16
+ 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); }
17
+
13
18
  var getInputClass = function getInputClass(_ref) {
14
19
  var textAlign = _ref.textAlign,
15
20
  readOnly = _ref.readOnly;
@@ -39,11 +44,22 @@ var getErrorMessages = function getErrorMessages(messages) {
39
44
  exports.getErrorMessages = getErrorMessages;
40
45
 
41
46
  var getRightElements = function getRightElements(rightElements, errorMessages) {
42
- if (errorMessages.length === 0) return rightElements;
43
47
  var elements = rightElements || [];
48
+ var newElements = _lodash["default"].isArray(elements) ? elements : [elements];
49
+
50
+ var elementsMap = function elementsMap() {
51
+ return newElements.map(function (element) {
52
+ return _extends({}, element, {
53
+ key: "rightelement-".concat(_uuid["default"].v1())
54
+ });
55
+ });
56
+ };
57
+
58
+ newElements = elementsMap();
59
+ if (errorMessages.length === 0) return newElements;
44
60
  return /*#__PURE__*/_react["default"].createElement("div", {
45
61
  className: "sidebuttons"
46
- }, elements);
62
+ }, newElements);
47
63
  };
48
64
 
49
65
  exports.getRightElements = getRightElements;
@@ -205,7 +205,7 @@ var withTooltip = function withTooltip(WrappedComponent) {
205
205
  tooltipPosition: _propTypes["default"].string
206
206
  };
207
207
  EnhancedComponent.defaultProps = {
208
- tooltipWidth: undefined,
208
+ tooltipWidth: 'auto',
209
209
  space: 20,
210
210
  tooltip: '',
211
211
  tooltipPosition: 'bottom'
@@ -31,19 +31,16 @@ var Tooltip = function Tooltip(props) {
31
31
  text = props.text,
32
32
  tooltipRef = props.tooltipRef;
33
33
  var tooltipComponent = (0, _react.useRef)(document.createElement('div'));
34
- tooltipComponent.current.id = "tooltip-".concat(_uuid["default"].v1());
35
- tooltipComponent.current.className = "tooltip-component ".concat(className, " ");
36
- tooltipComponent.current.dataset.testid = 'tooltip-component';
37
- tooltipComponent.current.style = style;
38
34
  (0, _react.useEffect)(function () {
39
35
  tooltipComponent.current.id = "tooltip-".concat(_uuid["default"].v1());
40
36
  tooltipComponent.current.className = "tooltip-component ".concat(className, " ");
37
+ tooltipComponent.current.dataset.testid = 'tooltip-component';
41
38
  tooltipComponent.current.style = style;
42
39
  document.body.appendChild(tooltipComponent.current);
43
40
  var tooltipEl = document.querySelector("div#".concat(tooltipComponent.current.id));
44
41
  var width = tooltipEl.offsetWidth;
45
42
 
46
- if (tooltipDimensions.width && tooltipDimensions.width !== 'auto') {
43
+ if (tooltipDimensions.width) {
47
44
  width = tooltipDimensions.width;
48
45
  }
49
46
 
@@ -89,8 +89,9 @@ var TreeNode = /*#__PURE__*/function (_Component) {
89
89
  var node = props.node,
90
90
  startNodesOpened = props.startNodesOpened;
91
91
  _this.state = {
92
- isVisible: nodeHasItens(node) && startNodesOpened,
93
- wasOpened: nodeHasItens(node) && startNodesOpened,
92
+ node: node,
93
+ isVisible: startNodesOpened && nodeHasItens(node),
94
+ wasOpened: startNodesOpened && nodeHasItens(node),
94
95
  showNodeElements: false,
95
96
  keepMenuOpened: false
96
97
  };
@@ -110,28 +111,13 @@ var TreeNode = /*#__PURE__*/function (_Component) {
110
111
  this.labelRef.current.addEventListener('mouseleave', this.handleShowNodeElements);
111
112
  }
112
113
  }
113
- }, {
114
- key: "componentDidUpdate",
115
- value: function componentDidUpdate(prevProps) {
116
- var _this$props2 = this.props,
117
- node = _this$props2.node,
118
- startNodesOpened = _this$props2.startNodesOpened;
119
-
120
- if (node !== prevProps.node && startNodesOpened) {
121
- // eslint-disable-next-line react/no-did-update-set-state
122
- this.setState({
123
- isVisible: nodeHasItens(node) && startNodesOpened,
124
- wasOpened: nodeHasItens(node) && startNodesOpened
125
- });
126
- }
127
- }
128
114
  }, {
129
115
  key: "componentWillUnmount",
130
116
  value: function componentWillUnmount() {
131
- var _this$props3 = this.props,
132
- isParent = _this$props3.isParent,
133
- nodeToolbarElements = _this$props3.nodeToolbarElements,
134
- nodeRightElements = _this$props3.nodeRightElements;
117
+ var _this$props2 = this.props,
118
+ isParent = _this$props2.isParent,
119
+ nodeToolbarElements = _this$props2.nodeToolbarElements,
120
+ nodeRightElements = _this$props2.nodeRightElements;
135
121
 
136
122
  if (isParent || nodeRightElements || nodeToolbarElements) {
137
123
  this.labelRef.current.removeEventListener('mouseenter', this.handleShowNodeElements);
@@ -143,12 +129,12 @@ var TreeNode = /*#__PURE__*/function (_Component) {
143
129
  value: function render() {
144
130
  var _this2 = this;
145
131
 
146
- var _this$props4 = this.props,
147
- node = _this$props4.node,
148
- children = _this$props4.children,
149
- isParent = _this$props4.isParent,
150
- onNodeClick = _this$props4.onNodeClick,
151
- nodeMenuButtonSize = _this$props4.nodeMenuButtonSize;
132
+ var _this$props3 = this.props,
133
+ children = _this$props3.children,
134
+ isParent = _this$props3.isParent,
135
+ onNodeClick = _this$props3.onNodeClick,
136
+ nodeMenuButtonSize = _this$props3.nodeMenuButtonSize;
137
+ var node = this.state.node;
152
138
  var showNodeElements = this.state.showNodeElements;
153
139
  return /*#__PURE__*/_react["default"].createElement(_constants.TreeviewContext.Consumer, null, function (_ref) {
154
140
  var valuePropName = _ref.valuePropName,
@@ -225,6 +211,22 @@ var TreeNode = /*#__PURE__*/function (_Component) {
225
211
  }, _this2.state.isVisible && children));
226
212
  });
227
213
  }
214
+ }], [{
215
+ key: "getDerivedStateFromProps",
216
+ value: function getDerivedStateFromProps(props, state) {
217
+ var node = props.node,
218
+ startNodesOpened = props.startNodesOpened;
219
+
220
+ if (node !== state.node) {
221
+ return {
222
+ node: node,
223
+ isVisible: startNodesOpened && nodeHasItens(node),
224
+ wasOpened: startNodesOpened && nodeHasItens(node)
225
+ };
226
+ }
227
+
228
+ return null;
229
+ }
228
230
  }]);
229
231
 
230
232
  return TreeNode;
@@ -238,9 +240,8 @@ var _initialiseProps = function _initialiseProps() {
238
240
  enumerable: true,
239
241
  writable: true,
240
242
  value: function value() {
241
- var _this3$props = _this3.props,
242
- node = _this3$props.node,
243
- alwaysShowArrow = _this3$props.alwaysShowArrow;
243
+ var alwaysShowArrow = _this3.props.alwaysShowArrow;
244
+ var node = _this3.state.node;
244
245
 
245
246
  var span = /*#__PURE__*/_react["default"].createElement("noscript", null);
246
247
 
@@ -307,9 +308,8 @@ var _initialiseProps = function _initialiseProps() {
307
308
  enumerable: true,
308
309
  writable: true,
309
310
  value: function value(elements) {
310
- var _this3$props2 = _this3.props,
311
- node = _this3$props2.node,
312
- nodeElementsValidations = _this3$props2.nodeElementsValidations;
311
+ var nodeElementsValidations = _this3.props.nodeElementsValidations;
312
+ var node = _this3.state.node;
313
313
  var updatedElements = [];
314
314
 
315
315
  if (elements) {
@@ -388,9 +388,8 @@ var _initialiseProps = function _initialiseProps() {
388
388
  enumerable: true,
389
389
  writable: true,
390
390
  value: function value(validationKey) {
391
- var _this3$props3 = _this3.props,
392
- nodeElementsValidations = _this3$props3.nodeElementsValidations,
393
- node = _this3$props3.node;
391
+ var nodeElementsValidations = _this3.props.nodeElementsValidations;
392
+ var node = _this3.state.node;
394
393
  var validations = nodeElementsValidations[validationKey];
395
394
  var options = {
396
395
  disabled: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "0.4.76-rc.14",
3
+ "version": "0.4.76-rc.15",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {