@synerise/ds-inline-edit 0.5.0 → 0.5.4

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/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.5.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@0.5.3...@synerise/ds-inline-edit@0.5.4) (2021-11-23)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-inline-edit
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.5.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@0.5.2...@synerise/ds-inline-edit@0.5.3) (2021-11-22)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-inline-edit
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.5.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@0.5.1...@synerise/ds-inline-edit@0.5.2) (2021-11-16)
23
+
24
+ **Note:** Version bump only for package @synerise/ds-inline-edit
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.5.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@0.4.39...@synerise/ds-inline-edit@0.5.1) (2021-11-09)
31
+
32
+ **Note:** Version bump only for package @synerise/ds-inline-edit
33
+
34
+
35
+
36
+
37
+
6
38
  # [0.5.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@0.4.39...@synerise/ds-inline-edit@0.5.0) (2021-11-09)
7
39
 
8
40
  **Note:** Version bump only for package @synerise/ds-inline-edit
@@ -1,23 +1,3 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
6
-
7
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
-
9
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
-
11
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
-
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
-
15
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
16
-
17
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
-
19
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20
-
21
1
  import * as React from 'react';
22
2
  import AutosizeInput from 'react-input-autosize';
23
3
  import Tooltip from '@synerise/ds-tooltip';
@@ -25,9 +5,9 @@ import Icon, { EditS } from '@synerise/ds-icon';
25
5
  import { toCamelCase } from '@synerise/ds-utils';
26
6
  import * as S from './InlineEdit.styles';
27
7
  import { attachWidthWatcher } from './utils';
28
- var SAMPLE = String.fromCharCode.apply(String, _toConsumableArray(_toConsumableArray(Array(26).keys()).map(function (i) {
8
+ var SAMPLE = String.fromCharCode.apply(String, [].concat(Array(26).keys()).map(function (i) {
29
9
  return i + 65;
30
- })));
10
+ }));
31
11
 
32
12
  var InlineEdit = function InlineEdit(_ref) {
33
13
  var className = _ref.className,
@@ -41,21 +21,20 @@ var InlineEdit = function InlineEdit(_ref) {
41
21
  error = _ref.error,
42
22
  input = _ref.input;
43
23
  var inputRef = React.useMemo(function () {
44
- return /*#__PURE__*/React.createRef();
24
+ return React.createRef();
45
25
  }, []);
46
26
  var fontStyleWatcher = React.useMemo(function () {
47
- return /*#__PURE__*/React.createRef();
27
+ return React.createRef();
48
28
  }, []);
49
29
 
50
30
  var _React$useState = React.useState(),
51
- _React$useState2 = _slicedToArray(_React$useState, 2),
52
- scrolled = _React$useState2[0],
53
- setScrolled = _React$useState2[1];
31
+ scrolled = _React$useState[0],
32
+ setScrolled = _React$useState[1];
54
33
 
55
34
  var handleScroll = React.useCallback(function () {
56
- if ((inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) !== null) {
35
+ if ((inputRef == null ? void 0 : inputRef.current) !== null) {
57
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
- var scrolledPixels = (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current).input.scrollLeft;
37
+ var scrolledPixels = (inputRef == null ? void 0 : inputRef.current).input.scrollLeft;
59
38
 
60
39
  if (scrolledPixels > 0) {
61
40
  setScrolled(true);
@@ -101,7 +80,7 @@ var InlineEdit = function InlineEdit(_ref) {
101
80
  }
102
81
  }, [autoFocus, fontStyleWatcher, inputRef, updateInputWidth]);
103
82
  return /*#__PURE__*/React.createElement(S.InPlaceEditableInputContainer, {
104
- className: "ds-inline-edit ".concat(className || ''),
83
+ className: "ds-inline-edit " + (className || ''),
105
84
  style: style,
106
85
  size: size,
107
86
  disabled: disabled,
@@ -17,7 +17,7 @@ var applyDots = function applyDots(props) {
17
17
  };
18
18
 
19
19
  var applyDotsOnError = function applyDotsOnError(props) {
20
- if (props.error) return "background-image: linear-gradient(to right, ".concat(applyDots(props), " 20%, rgba(255, 255, 255, 0) 10%);\n background-color: transparent;\n background-position: bottom left;\n background-size: 5px 1px;\n background-repeat: repeat-x;");
20
+ if (props.error) return "background-image: linear-gradient(to right, " + applyDots(props) + " 20%, rgba(255, 255, 255, 0) 10%);\n background-color: transparent;\n background-position: bottom left;\n background-size: 5px 1px;\n background-repeat: repeat-x;";
21
21
  return '';
22
22
  };
23
23
 
@@ -1,17 +1,5 @@
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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
-
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
3
  import * as React from 'react';
16
4
  import AutosizeInput from 'react-input-autosize';
17
5
  import { toCamelCase } from '@synerise/ds-utils';
@@ -39,10 +27,10 @@ var InlineSelect = function InlineSelect(_ref) {
39
27
  dataSource = _ref.dataSource,
40
28
  initialValue = _ref.initialValue;
41
29
  var inputRef = React.useMemo(function () {
42
- return /*#__PURE__*/React.createRef();
30
+ return React.createRef();
43
31
  }, []);
44
32
  var fontStyleWatcher = React.useMemo(function () {
45
- return /*#__PURE__*/React.createRef();
33
+ return React.createRef();
46
34
  }, []);
47
35
  var updateInputWidth = React.useCallback(function () {
48
36
  if (inputRef.current) {
@@ -61,23 +49,20 @@ var InlineSelect = function InlineSelect(_ref) {
61
49
  }, [autoFocus, fontStyleWatcher, inputRef, updateInputWidth]);
62
50
 
63
51
  var _React$useState = React.useState(initialValue || placeholder || 'option'),
64
- _React$useState2 = _slicedToArray(_React$useState, 2),
65
- selectedValue = _React$useState2[0],
66
- setSelectedValue = _React$useState2[1];
52
+ selectedValue = _React$useState[0],
53
+ setSelectedValue = _React$useState[1];
67
54
 
68
- var _React$useState3 = React.useState(false),
69
- _React$useState4 = _slicedToArray(_React$useState3, 2),
70
- opened = _React$useState4[0],
71
- setOpened = _React$useState4[1];
55
+ var _React$useState2 = React.useState(false),
56
+ opened = _React$useState2[0],
57
+ setOpened = _React$useState2[1];
72
58
 
73
- var _React$useState5 = React.useState(false),
74
- _React$useState6 = _slicedToArray(_React$useState5, 2),
75
- pressed = _React$useState6[0],
76
- setPressed = _React$useState6[1];
59
+ var _React$useState3 = React.useState(false),
60
+ pressed = _React$useState3[0],
61
+ setPressed = _React$useState3[1];
77
62
 
78
63
  React.useEffect(function () {
79
- if ((input === null || input === void 0 ? void 0 : input.value) !== selectedValue) {
80
- setSelectedValue(input === null || input === void 0 ? void 0 : input.value);
64
+ if ((input == null ? void 0 : input.value) !== selectedValue) {
65
+ setSelectedValue(input == null ? void 0 : input.value);
81
66
  }
82
67
  }, [input, selectedValue]);
83
68
  return /*#__PURE__*/React.createElement(Dropdown, _extends({
@@ -97,7 +82,7 @@ var InlineSelect = function InlineSelect(_ref) {
97
82
  }),
98
83
  trigger: ['click']
99
84
  }, dropdownProps), /*#__PURE__*/React.createElement(S.InPlaceEditableInputContainer, {
100
- className: "ds-inline-edit ".concat(className || ''),
85
+ className: "ds-inline-edit " + (className || ''),
101
86
  style: style,
102
87
  size: size,
103
88
  disabled: disabled,
@@ -17,7 +17,7 @@ var applyColorActive = function applyColorActive(props) {
17
17
  };
18
18
 
19
19
  var applyDotsOnError = function applyDotsOnError(props) {
20
- if (props.error) return "background-image: linear-gradient(to right, ".concat(applyColor(props), " 20%, rgba(255, 255, 255, 0) 10%);\n background-color: transparent;\n background-position: bottom left;\n background-size: 5px 1px;\n background-repeat: repeat-x;");
20
+ if (props.error) return "background-image: linear-gradient(to right, " + applyColor(props) + " 20%, rgba(255, 255, 255, 0) 10%);\n background-color: transparent;\n background-position: bottom left;\n background-size: 5px 1px;\n background-repeat: repeat-x;";
21
21
  return '';
22
22
  };
23
23
 
@@ -1,17 +1,5 @@
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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
-
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
3
  import * as React from 'react';
16
4
  import Menu from '@synerise/ds-menu';
17
5
  import { SearchItems } from '@synerise/ds-search/dist/Elements';
@@ -30,9 +18,8 @@ var SelectDropdown = function SelectDropdown(_ref) {
30
18
  var rowHeight = dropdownRowHeight || DEFAULT_ROW_HEIGHT;
31
19
 
32
20
  var _React$useState = React.useState(0),
33
- _React$useState2 = _slicedToArray(_React$useState, 2),
34
- scrollTop = _React$useState2[0],
35
- setScrollTop = _React$useState2[1];
21
+ scrollTop = _React$useState[0],
22
+ setScrollTop = _React$useState[1];
36
23
 
37
24
  var handleChange = React.useCallback(function (item) {
38
25
  onSelect(item);
@@ -50,7 +37,7 @@ var SelectDropdown = function SelectDropdown(_ref) {
50
37
  data: dataSource,
51
38
  itemRender: function itemRender(item) {
52
39
  return /*#__PURE__*/React.createElement(Menu.Item, _extends({
53
- key: item === null || item === void 0 ? void 0 : item.text
40
+ key: item == null ? void 0 : item.text
54
41
  }, item));
55
42
  },
56
43
  onItemClick: function onItemClick(i) {
@@ -1,6 +1,12 @@
1
- export default (function (element, resizeCallback) {
2
- var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
3
- var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1
+ export default (function (element, resizeCallback, width, height) {
2
+ if (width === void 0) {
3
+ width = true;
4
+ }
5
+
6
+ if (height === void 0) {
7
+ height = true;
8
+ }
9
+
4
10
  var customElement = element;
5
11
  if (customElement.sizeWatcher) return false;
6
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-inline-edit",
3
- "version": "0.5.0",
3
+ "version": "0.5.4",
4
4
  "description": "InlineEdit UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -32,11 +32,11 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-dropdown": "^0.17.0",
36
- "@synerise/ds-icon": "^0.46.0",
37
- "@synerise/ds-menu": "^0.11.0",
38
- "@synerise/ds-search": "^0.6.0",
39
- "@synerise/ds-tooltip": "^0.11.0",
35
+ "@synerise/ds-dropdown": "^0.17.4",
36
+ "@synerise/ds-icon": "^0.46.2",
37
+ "@synerise/ds-menu": "^0.11.2",
38
+ "@synerise/ds-search": "^0.6.4",
39
+ "@synerise/ds-tooltip": "^0.11.2",
40
40
  "react-input-autosize": "^2.2.2"
41
41
  },
42
42
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "@synerise/ds-utils": "^0.19.0",
48
48
  "@types/react-input-autosize": "2.0.2"
49
49
  },
50
- "gitHead": "a797e1d5e1233f121f8f7dfbeaf97b48a8195d25"
50
+ "gitHead": "3e5f807c3c9ce7bbcb707b1e229ad5d7ef50d830"
51
51
  }