@instructure/ui-text-area 11.7.8 → 11.7.9-snapshot-1
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 +8 -0
- package/lib/TextArea/v1/index.js +15 -20
- package/lib/TextArea/v2/index.js +16 -21
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-text-area
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-text-area
|
package/lib/TextArea/v1/index.js
CHANGED
|
@@ -7,17 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.TextArea = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _v11_ = require("@instructure/ui-form-field/v11_6");
|
|
10
|
-
var
|
|
11
|
-
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
12
|
-
var _requestAnimationFrame = require("@instructure/ui-dom-utils/lib/requestAnimationFrame.js");
|
|
13
|
-
var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
14
11
|
var _debounce = require("@instructure/debounce");
|
|
15
12
|
var _emotion = require("@instructure/emotion");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
20
|
-
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
13
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
14
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
15
|
+
var _uiA11yUtils = require("@instructure/ui-a11y-utils");
|
|
21
16
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
22
17
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
23
18
|
var _props = require("./props.js");
|
|
@@ -51,7 +46,7 @@ var _dec, _dec2, _class;
|
|
|
51
46
|
category: components
|
|
52
47
|
---
|
|
53
48
|
**/
|
|
54
|
-
let TextArea = exports.TextArea = (_dec = (0,
|
|
49
|
+
let TextArea = exports.TextArea = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class TextArea extends _react.Component {
|
|
55
50
|
static displayName = 'TextArea';
|
|
56
51
|
static componentId = 'TextArea';
|
|
57
52
|
static allowedProps = _props.allowedProps;
|
|
@@ -158,12 +153,12 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
158
153
|
});
|
|
159
154
|
}
|
|
160
155
|
if (!this._listener) {
|
|
161
|
-
this._listener = (0,
|
|
156
|
+
this._listener = (0, _uiDomUtils.addEventListener)(window, 'resize', this._debounced);
|
|
162
157
|
}
|
|
163
158
|
if (this._textarea && !this._textareaResizeListener) {
|
|
164
159
|
const {
|
|
165
160
|
height: origHeight
|
|
166
|
-
} = (0,
|
|
161
|
+
} = (0, _uiDomUtils.getBoundingClientRect)(this._textarea);
|
|
167
162
|
this._textareaResizeListener = new ResizeObserver(entries => {
|
|
168
163
|
for (const entry of entries) {
|
|
169
164
|
const {
|
|
@@ -176,7 +171,7 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
176
171
|
});
|
|
177
172
|
this._textareaResizeListener.observe(this._textarea);
|
|
178
173
|
}
|
|
179
|
-
this._request = (0,
|
|
174
|
+
this._request = (0, _uiDomUtils.requestAnimationFrame)(this.grow);
|
|
180
175
|
}
|
|
181
176
|
}
|
|
182
177
|
grow = () => {
|
|
@@ -192,13 +187,13 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
192
187
|
this._textarea.style.height = 'auto';
|
|
193
188
|
this._textarea.style.overflowY = 'hidden'; // hide scrollbars for autoGrow textareas
|
|
194
189
|
height = this._textarea.scrollHeight + offset + 'px';
|
|
195
|
-
const maxHeight = this.props.maxHeight ? (0,
|
|
190
|
+
const maxHeight = this.props.maxHeight ? (0, _uiUtils.px)(this.props.maxHeight, this._container) : undefined;
|
|
196
191
|
if (this.props.maxHeight && maxHeight !== undefined && this._textarea.scrollHeight > maxHeight) {
|
|
197
192
|
this._textarea.style.overflowY = 'auto'; // add scroll if scrollHeight exceeds maxHeight in pixels
|
|
198
193
|
} else if (this.props.height) {
|
|
199
194
|
if (this._textarea.value === '') {
|
|
200
195
|
height = this.props.height;
|
|
201
|
-
} else if ((0,
|
|
196
|
+
} else if ((0, _uiUtils.px)(this.props.height, this._container) > this._textarea.scrollHeight) {
|
|
202
197
|
this._textarea.style.overflowY = 'auto'; // add scroll if scrollHeight exceeds height in pixels
|
|
203
198
|
height = this.props.height;
|
|
204
199
|
}
|
|
@@ -206,7 +201,7 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
206
201
|
|
|
207
202
|
// preserve container height to prevent scroll jumping on long textareas,
|
|
208
203
|
// but make sure container doesn't exceed maxHeight prop
|
|
209
|
-
const heightExceedsMax = maxHeight !== undefined && (0,
|
|
204
|
+
const heightExceedsMax = maxHeight !== undefined && (0, _uiUtils.px)(height) > maxHeight;
|
|
210
205
|
if (!heightExceedsMax) {
|
|
211
206
|
this._container.style.minHeight = height;
|
|
212
207
|
}
|
|
@@ -250,7 +245,7 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
250
245
|
return this.props.id || this._defaultId;
|
|
251
246
|
}
|
|
252
247
|
get focused() {
|
|
253
|
-
return (0,
|
|
248
|
+
return (0, _uiDomUtils.isActiveElement)(this._textarea);
|
|
254
249
|
}
|
|
255
250
|
get value() {
|
|
256
251
|
return this._textarea.value;
|
|
@@ -272,7 +267,7 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
272
267
|
styles,
|
|
273
268
|
margin
|
|
274
269
|
} = this.props;
|
|
275
|
-
const props = (0,
|
|
270
|
+
const props = (0, _uiReactUtils.omitProps)(this.props, TextArea.allowedProps);
|
|
276
271
|
const style = {
|
|
277
272
|
width,
|
|
278
273
|
resize,
|
|
@@ -302,7 +297,7 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
302
297
|
css: this.props.styles?.textArea,
|
|
303
298
|
onChange: this.handleChange
|
|
304
299
|
});
|
|
305
|
-
const label = (0,
|
|
300
|
+
const label = (0, _uiA11yUtils.hasVisibleChildren)(this.props.label) ? (0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
306
301
|
children: [this.props.label, required && (0, _jsxRuntime.jsxs)("span", {
|
|
307
302
|
css: this.invalid ? styles?.requiredInvalid : {},
|
|
308
303
|
"aria-hidden": true,
|
|
@@ -310,7 +305,7 @@ let TextArea = exports.TextArea = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
310
305
|
})]
|
|
311
306
|
}) : this.props.label;
|
|
312
307
|
return (0, _jsxRuntime.jsx)(_v11_.FormField, {
|
|
313
|
-
...(0,
|
|
308
|
+
...(0, _uiReactUtils.pickProps)(this.props, _v11_.FormField.allowedProps),
|
|
314
309
|
label: label,
|
|
315
310
|
vAlign: "top",
|
|
316
311
|
id: this.id,
|
package/lib/TextArea/v2/index.js
CHANGED
|
@@ -7,16 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.TextArea = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _latest = require("@instructure/ui-form-field/latest");
|
|
10
|
-
var
|
|
11
|
-
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
12
|
-
var _requestAnimationFrame = require("@instructure/ui-dom-utils/lib/requestAnimationFrame.js");
|
|
13
|
-
var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
14
11
|
var _debounce = require("@instructure/debounce");
|
|
15
12
|
var _emotion = require("@instructure/emotion");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
19
|
-
var _useDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/useDeterministicId.js");
|
|
13
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
14
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
20
15
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
21
16
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
22
17
|
/*
|
|
@@ -75,7 +70,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
75
70
|
} = props;
|
|
76
71
|
|
|
77
72
|
// SSR-safe deterministic ID generation (stable across server/client render)
|
|
78
|
-
const defaultId = (0,
|
|
73
|
+
const defaultId = (0, _uiReactUtils.useDeterministicId)('TextArea')();
|
|
79
74
|
const id = propId || defaultId;
|
|
80
75
|
|
|
81
76
|
// Use refs for mutable values
|
|
@@ -151,13 +146,13 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
151
146
|
_textarea.current.style.height = 'auto';
|
|
152
147
|
_textarea.current.style.overflowY = 'hidden'; // hide scrollbars for autoGrow textareas
|
|
153
148
|
heightValue = _textarea.current.scrollHeight + offset + 'px';
|
|
154
|
-
const maxHeightPx = maxHeight ? (0,
|
|
149
|
+
const maxHeightPx = maxHeight ? (0, _uiUtils.px)(maxHeight, _container.current) : undefined;
|
|
155
150
|
if (maxHeight && maxHeightPx !== undefined && _textarea.current.scrollHeight > maxHeightPx) {
|
|
156
151
|
_textarea.current.style.overflowY = 'auto'; // add scroll if scrollHeight exceeds maxHeight in pixels
|
|
157
152
|
} else if (height) {
|
|
158
153
|
if (_textarea.current.value === '') {
|
|
159
154
|
heightValue = height;
|
|
160
|
-
} else if ((0,
|
|
155
|
+
} else if ((0, _uiUtils.px)(height, _container.current) > _textarea.current.scrollHeight) {
|
|
161
156
|
_textarea.current.style.overflowY = 'auto'; // add scroll if scrollHeight exceeds height in pixels
|
|
162
157
|
heightValue = height;
|
|
163
158
|
}
|
|
@@ -165,7 +160,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
165
160
|
|
|
166
161
|
// preserve container height to prevent scroll jumping on long textareas,
|
|
167
162
|
// but make sure container doesn't exceed maxHeight prop
|
|
168
|
-
const heightExceedsMax = maxHeightPx !== undefined && (0,
|
|
163
|
+
const heightExceedsMax = maxHeightPx !== undefined && (0, _uiUtils.px)(heightValue) > maxHeightPx;
|
|
169
164
|
if (!heightExceedsMax && _container.current) {
|
|
170
165
|
_container.current.style.minHeight = heightValue;
|
|
171
166
|
}
|
|
@@ -198,12 +193,12 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
198
193
|
});
|
|
199
194
|
}
|
|
200
195
|
if (!_listener.current) {
|
|
201
|
-
_listener.current = (0,
|
|
196
|
+
_listener.current = (0, _uiDomUtils.addEventListener)(window, 'resize', _debounced.current);
|
|
202
197
|
}
|
|
203
198
|
if (_textarea.current && !_textareaResizeListener.current) {
|
|
204
199
|
const {
|
|
205
200
|
height: origHeight
|
|
206
|
-
} = (0,
|
|
201
|
+
} = (0, _uiDomUtils.getBoundingClientRect)(_textarea.current);
|
|
207
202
|
_textareaResizeListener.current = new ResizeObserver(entries => {
|
|
208
203
|
for (const entry of entries) {
|
|
209
204
|
const {
|
|
@@ -216,7 +211,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
216
211
|
});
|
|
217
212
|
_textareaResizeListener.current.observe(_textarea.current);
|
|
218
213
|
}
|
|
219
|
-
_request.current = (0,
|
|
214
|
+
_request.current = (0, _uiDomUtils.requestAnimationFrame)(grow);
|
|
220
215
|
}
|
|
221
216
|
}, [autoGrow, grow, _textareaResize]);
|
|
222
217
|
|
|
@@ -254,12 +249,12 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
254
249
|
});
|
|
255
250
|
}
|
|
256
251
|
if (!_listener.current) {
|
|
257
|
-
_listener.current = (0,
|
|
252
|
+
_listener.current = (0, _uiDomUtils.addEventListener)(window, 'resize', _debounced.current);
|
|
258
253
|
}
|
|
259
254
|
if (_textarea.current && !_textareaResizeListener.current) {
|
|
260
255
|
const {
|
|
261
256
|
height: origHeight
|
|
262
|
-
} = (0,
|
|
257
|
+
} = (0, _uiDomUtils.getBoundingClientRect)(_textarea.current);
|
|
263
258
|
_textareaResizeListener.current = new ResizeObserver(entries => {
|
|
264
259
|
for (const entry of entries) {
|
|
265
260
|
const {
|
|
@@ -272,7 +267,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
272
267
|
});
|
|
273
268
|
_textareaResizeListener.current.observe(_textarea.current);
|
|
274
269
|
}
|
|
275
|
-
_request.current = (0,
|
|
270
|
+
_request.current = (0, _uiDomUtils.requestAnimationFrame)(grow);
|
|
276
271
|
}
|
|
277
272
|
}
|
|
278
273
|
if (typeof onChange === 'function') {
|
|
@@ -292,7 +287,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
292
287
|
return _textarea.current?.style.minHeight || '';
|
|
293
288
|
},
|
|
294
289
|
get focused() {
|
|
295
|
-
return (0,
|
|
290
|
+
return (0, _uiDomUtils.isActiveElement)(_textarea.current);
|
|
296
291
|
},
|
|
297
292
|
get invalid() {
|
|
298
293
|
return messages && messages.findIndex(message => message.type === 'error' || message.type === 'newError') >= 0;
|
|
@@ -309,7 +304,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
309
304
|
maxHeight
|
|
310
305
|
};
|
|
311
306
|
const textarea = (0, _jsxRuntime.jsx)("textarea", {
|
|
312
|
-
...(0,
|
|
307
|
+
...(0, _uiReactUtils.passthroughProps)(rest),
|
|
313
308
|
value: value,
|
|
314
309
|
defaultValue: defaultValue,
|
|
315
310
|
placeholder: placeholder,
|
|
@@ -334,7 +329,7 @@ const TextArea = exports.TextArea = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
334
329
|
onChange: handleChange
|
|
335
330
|
});
|
|
336
331
|
return (0, _jsxRuntime.jsx)(_latest.FormField, {
|
|
337
|
-
...(0,
|
|
332
|
+
...(0, _uiReactUtils.pickProps)(props, _latest.FormField.allowedProps),
|
|
338
333
|
label: label,
|
|
339
334
|
messagesId: messagesId,
|
|
340
335
|
labelId: labelId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-text-area",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
4
4
|
"description": "A styled HTML text area component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/debounce": "11.7.
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/shared-types": "11.7.
|
|
21
|
-
"@instructure/ui-
|
|
22
|
-
"@instructure/
|
|
23
|
-
"@instructure/ui-form-field": "11.7.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-utils": "11.7.
|
|
27
|
-
"@instructure/uid": "11.7.
|
|
18
|
+
"@instructure/debounce": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/emotion": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/ui-a11y-utils": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-form-field": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-themes": "11.7.9-snapshot-1",
|
|
25
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1",
|
|
26
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
27
|
+
"@instructure/uid": "11.7.9-snapshot-1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vitest": "^5.0.0",
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-
|
|
31
|
+
"@instructure/ui-axe-check": "11.7.9-snapshot-1",
|
|
32
|
+
"@instructure/ui-color-utils": "11.7.9-snapshot-1",
|
|
33
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=18 <=19"
|