@atlaskit/textarea 4.2.6 → 4.3.2

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
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/textarea
2
2
 
3
+ ## 4.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 4.3.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`2e56ff8ea50`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e56ff8ea50) - [ux] Fixed a bug where smart resize did not work when the value prop was changed
20
+
3
21
  ## 4.2.6
4
22
 
5
23
  ### Patch Changes
@@ -29,7 +29,7 @@ var _styles = require("./styles");
29
29
 
30
30
  var _theme = require("./theme");
31
31
 
32
- var _excluded = ["resize", "appearance", "isCompact", "isRequired", "isReadOnly", "isDisabled", "isInvalid", "isMonospaced", "minimumRows", "theme", "testId", "maxHeight", "onBlur", "onFocus", "onChange", "tokens"];
32
+ var _excluded = ["resize", "appearance", "isCompact", "isRequired", "isReadOnly", "isDisabled", "isInvalid", "isMonospaced", "minimumRows", "theme", "testId", "maxHeight", "onBlur", "onFocus", "onChange", "tokens", "value"];
33
33
 
34
34
  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); }
35
35
 
@@ -40,7 +40,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
40
40
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
41
41
 
42
42
  var packageName = "@atlaskit/textarea";
43
- var packageVersion = "4.2.6";
43
+ var packageVersion = "4.3.2";
44
44
  var analyticsParams = {
45
45
  componentName: 'textArea',
46
46
  packageName: packageName,
@@ -48,6 +48,8 @@ var analyticsParams = {
48
48
  };
49
49
 
50
50
  var setSmartHeight = function setSmartHeight(el) {
51
+ // Always reset height to auto before calculating new height
52
+ el.style.height = 'auto';
51
53
  var borderHeight = _styles.borderWidth;
52
54
  var paddingBoxHeight = el.scrollHeight;
53
55
  var borderBoxHeight = paddingBoxHeight + borderHeight * 2;
@@ -82,6 +84,7 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
82
84
  onFocus = props.onFocus,
83
85
  onChange = props.onChange,
84
86
  tokens = props.tokens,
87
+ value = props.value,
85
88
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
86
89
  (0, _react.useEffect)(function () {
87
90
  var el = ourRef.current;
@@ -89,7 +92,7 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
89
92
  if (resize === 'smart' && el) {
90
93
  setSmartHeight(el);
91
94
  }
92
- }, [resize]);
95
+ }, [resize, value]);
93
96
  var onBlurWithAnalytics = (0, _analyticsNext.usePlatformLeafEventHandler)(_objectSpread({
94
97
  fn: function fn(event) {
95
98
  onBlur && onBlur(event);
@@ -120,7 +123,6 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
120
123
  var el = ourRef.current;
121
124
 
122
125
  if (resize === 'smart' && el) {
123
- el.style.height = 'auto';
124
126
  setSmartHeight(el);
125
127
  }
126
128
 
@@ -143,6 +145,7 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
143
145
  var textAreaStyles = [baseStyles, // not memoizing themeStyles as `tokens` is an unstable reference
144
146
  (0, _styles.themeStyles)(tokens)];
145
147
  return (0, _core.jsx)("textarea", (0, _extends2.default)({}, controlProps, {
148
+ value: value,
146
149
  disabled: isDisabled,
147
150
  readOnly: isReadOnly,
148
151
  required: isRequired,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textarea",
3
- "version": "4.2.6",
3
+ "version": "4.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -8,7 +8,7 @@ import GlobalTheme from '@atlaskit/theme/components';
8
8
  import { borderWidth, getBaseStyles, themeStyles } from './styles';
9
9
  import { Theme } from './theme';
10
10
  const packageName = "@atlaskit/textarea";
11
- const packageVersion = "4.2.6";
11
+ const packageVersion = "4.3.2";
12
12
  const analyticsParams = {
13
13
  componentName: 'textArea',
14
14
  packageName,
@@ -16,6 +16,8 @@ const analyticsParams = {
16
16
  };
17
17
 
18
18
  const setSmartHeight = el => {
19
+ // Always reset height to auto before calculating new height
20
+ el.style.height = 'auto';
19
21
  const borderHeight = borderWidth;
20
22
  const paddingBoxHeight = el.scrollHeight;
21
23
  const borderBoxHeight = paddingBoxHeight + borderHeight * 2;
@@ -41,6 +43,7 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
41
43
  onFocus,
42
44
  onChange,
43
45
  tokens,
46
+ value,
44
47
  ...rest
45
48
  } = props;
46
49
  useEffect(() => {
@@ -49,7 +52,7 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
49
52
  if (resize === 'smart' && el) {
50
53
  setSmartHeight(el);
51
54
  }
52
- }, [resize]);
55
+ }, [resize, value]);
53
56
  const onBlurWithAnalytics = usePlatformLeafEventHandler({
54
57
  fn: event => {
55
58
  onBlur && onBlur(event);
@@ -82,7 +85,6 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
82
85
  const el = ourRef.current;
83
86
 
84
87
  if (resize === 'smart' && el) {
85
- el.style.height = 'auto';
86
88
  setSmartHeight(el);
87
89
  }
88
90
 
@@ -103,6 +105,7 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
103
105
  const textAreaStyles = [baseStyles, // not memoizing themeStyles as `tokens` is an unstable reference
104
106
  themeStyles(tokens)];
105
107
  return jsx("textarea", _extends({}, controlProps, {
108
+ value: value,
106
109
  disabled: isDisabled,
107
110
  readOnly: isReadOnly,
108
111
  required: isRequired,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textarea",
3
- "version": "4.2.6",
3
+ "version": "4.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _typeof from "@babel/runtime/helpers/typeof";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["resize", "appearance", "isCompact", "isRequired", "isReadOnly", "isDisabled", "isInvalid", "isMonospaced", "minimumRows", "theme", "testId", "maxHeight", "onBlur", "onFocus", "onChange", "tokens"];
5
+ var _excluded = ["resize", "appearance", "isCompact", "isRequired", "isReadOnly", "isDisabled", "isInvalid", "isMonospaced", "minimumRows", "theme", "testId", "maxHeight", "onBlur", "onFocus", "onChange", "tokens", "value"];
6
6
 
7
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
8
 
@@ -16,7 +16,7 @@ import GlobalTheme from '@atlaskit/theme/components';
16
16
  import { borderWidth, getBaseStyles, themeStyles } from './styles';
17
17
  import { Theme } from './theme';
18
18
  var packageName = "@atlaskit/textarea";
19
- var packageVersion = "4.2.6";
19
+ var packageVersion = "4.3.2";
20
20
  var analyticsParams = {
21
21
  componentName: 'textArea',
22
22
  packageName: packageName,
@@ -24,6 +24,8 @@ var analyticsParams = {
24
24
  };
25
25
 
26
26
  var setSmartHeight = function setSmartHeight(el) {
27
+ // Always reset height to auto before calculating new height
28
+ el.style.height = 'auto';
27
29
  var borderHeight = borderWidth;
28
30
  var paddingBoxHeight = el.scrollHeight;
29
31
  var borderBoxHeight = paddingBoxHeight + borderHeight * 2;
@@ -59,6 +61,7 @@ var TextAreaWithTokens = /*#__PURE__*/forwardRef(function (props, ref) {
59
61
  onFocus = props.onFocus,
60
62
  onChange = props.onChange,
61
63
  tokens = props.tokens,
64
+ value = props.value,
62
65
  rest = _objectWithoutProperties(props, _excluded);
63
66
 
64
67
  useEffect(function () {
@@ -67,7 +70,7 @@ var TextAreaWithTokens = /*#__PURE__*/forwardRef(function (props, ref) {
67
70
  if (resize === 'smart' && el) {
68
71
  setSmartHeight(el);
69
72
  }
70
- }, [resize]);
73
+ }, [resize, value]);
71
74
  var onBlurWithAnalytics = usePlatformLeafEventHandler(_objectSpread({
72
75
  fn: function fn(event) {
73
76
  onBlur && onBlur(event);
@@ -98,7 +101,6 @@ var TextAreaWithTokens = /*#__PURE__*/forwardRef(function (props, ref) {
98
101
  var el = ourRef.current;
99
102
 
100
103
  if (resize === 'smart' && el) {
101
- el.style.height = 'auto';
102
104
  setSmartHeight(el);
103
105
  }
104
106
 
@@ -121,6 +123,7 @@ var TextAreaWithTokens = /*#__PURE__*/forwardRef(function (props, ref) {
121
123
  var textAreaStyles = [baseStyles, // not memoizing themeStyles as `tokens` is an unstable reference
122
124
  themeStyles(tokens)];
123
125
  return jsx("textarea", _extends({}, controlProps, {
126
+ value: value,
124
127
  disabled: isDisabled,
125
128
  readOnly: isReadOnly,
126
129
  required: isRequired,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textarea",
3
- "version": "4.2.6",
3
+ "version": "4.3.2",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/textarea",
3
- "version": "4.2.6",
3
+ "version": "4.3.2",
4
4
  "description": "A text area lets users enter long form text which spans over multiple lines.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@atlaskit/analytics-next": "^8.0.0",
28
28
  "@atlaskit/theme": "^12.1.0",
29
- "@atlaskit/tokens": "^0.6.0",
29
+ "@atlaskit/tokens": "^0.8.0",
30
30
  "@babel/runtime": "^7.0.0",
31
31
  "@emotion/core": "^10.0.9"
32
32
  },
@@ -34,9 +34,9 @@
34
34
  "react": "^16.8.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@atlaskit/button": "^16.1.0",
37
+ "@atlaskit/button": "^16.2.0",
38
38
  "@atlaskit/docs": "*",
39
- "@atlaskit/form": "^8.4.0",
39
+ "@atlaskit/form": "^8.5.0",
40
40
  "@atlaskit/section-message": "^6.1.0",
41
41
  "@atlaskit/ssr": "*",
42
42
  "@atlaskit/visual-regression": "*",