@instructure/ui-text-area 11.7.10 → 11.7.11-pr-snapshot-1794841957152
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 +13 -0
- package/es/TextArea/v1/index.js +232 -304
- package/es/TextArea/v1/props.js +23 -26
- package/es/TextArea/v1/styles.js +82 -120
- package/es/TextArea/v1/theme.js +40 -76
- package/es/TextArea/v2/index.js +247 -327
- package/es/TextArea/v2/props.js +23 -26
- package/es/TextArea/v2/styles.js +87 -128
- package/es/TextArea/v2/theme.js +40 -76
- package/es/exports/a.js +1 -24
- package/es/exports/b.js +1 -24
- package/package.json +16 -22
- package/src/TextArea/v1/index.tsx +6 -3
- package/tsconfig.build.json +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TextArea/v1/index.d.ts +3 -1
- package/types/TextArea/v1/index.d.ts.map +1 -1
- package/lib/TextArea/v1/index.js +0 -335
- package/lib/TextArea/v1/props.js +0 -31
- package/lib/TextArea/v1/styles.js +0 -127
- package/lib/TextArea/v1/theme.js +0 -83
- package/lib/TextArea/v2/index.js +0 -354
- package/lib/TextArea/v2/props.js +0 -31
- package/lib/TextArea/v2/styles.js +0 -138
- package/lib/TextArea/v2/theme.js +0 -83
- package/lib/exports/a.js +0 -12
- package/lib/exports/b.js +0 -12
- package/lib/package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.11-pr-snapshot-1794841957152](https://github.com/instructure/instructure-ui/compare/v11.7.10...v11.7.11-pr-snapshot-1794841957152) (2026-11-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([9c2e562](https://github.com/instructure/instructure-ui/commit/9c2e5629e7c509fdfc0d1770d1b81e70e60e083b))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.10](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.10) (2026-10-14)
|
|
7
20
|
|
|
8
21
|
### Bug Fixes
|
package/es/TextArea/v1/index.js
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/*
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
26
2
|
import { Fragment, Component } from 'react';
|
|
27
3
|
import { FormField } from '@instructure/ui-form-field/v11_6';
|
|
28
4
|
import { addEventListener, isActiveElement, requestAnimationFrame, getBoundingClientRect } from '@instructure/ui-dom-utils';
|
|
@@ -34,298 +10,250 @@ import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
|
34
10
|
import generateStyle from './styles.js';
|
|
35
11
|
import generateComponentTheme from './theme.js';
|
|
36
12
|
import { allowedProps } from './props.js';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
category: components
|
|
41
|
-
---
|
|
42
|
-
**/
|
|
43
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
44
|
-
let TextArea = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = class TextArea extends Component {
|
|
45
|
-
static displayName = 'TextArea';
|
|
46
|
-
static componentId = 'TextArea';
|
|
47
|
-
static allowedProps = allowedProps;
|
|
48
|
-
static defaultProps = {
|
|
49
|
-
size: 'medium',
|
|
50
|
-
autoGrow: true,
|
|
51
|
-
resize: 'none',
|
|
52
|
-
inline: false,
|
|
53
|
-
messages: [],
|
|
54
|
-
disabled: false,
|
|
55
|
-
readOnly: false,
|
|
56
|
-
layout: 'stacked',
|
|
57
|
-
required: false
|
|
58
|
-
};
|
|
59
|
-
_listener;
|
|
60
|
-
_request;
|
|
61
|
-
_defaultId;
|
|
62
|
-
_textareaResizeListener;
|
|
63
|
-
_debounced;
|
|
64
|
-
_textarea = null;
|
|
65
|
-
_container = null;
|
|
66
|
-
_height;
|
|
67
|
-
_manuallyResized = false;
|
|
68
|
-
_highlightRef = null;
|
|
69
|
-
myObserver = null;
|
|
70
|
-
resizeTimeout;
|
|
71
|
-
ref = null;
|
|
72
|
-
constructor(props) {
|
|
73
|
-
super(props);
|
|
74
|
-
this._defaultId = props.deterministicId();
|
|
75
|
-
|
|
76
|
-
//mock ResizeObserver for ssr
|
|
77
|
-
if (typeof window === 'undefined') {
|
|
78
|
-
globalThis.ResizeObserver = class ResizeObserver {
|
|
79
|
-
observe() {
|
|
80
|
-
// do nothing
|
|
81
|
-
}
|
|
82
|
-
unobserve() {
|
|
83
|
-
// do nothing
|
|
84
|
-
}
|
|
85
|
-
disconnect() {
|
|
86
|
-
// do nothing
|
|
87
|
-
}
|
|
88
|
-
};
|
|
13
|
+
export class TextAreaBase extends Component {
|
|
14
|
+
static{
|
|
15
|
+
this.displayName = 'TextArea';
|
|
89
16
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.myObserver = new ResizeObserver(entries => {
|
|
93
|
-
for (const entry of entries) {
|
|
94
|
-
if (this._highlightRef) {
|
|
95
|
-
const entryStyle = window.getComputedStyle(entry.target);
|
|
96
|
-
this._highlightRef.style.transition = 'none';
|
|
97
|
-
this._highlightRef.style.width = `calc(${entryStyle.width} + 0.5rem)`;
|
|
98
|
-
this._highlightRef.style.height = `calc(${entryStyle.height} + 0.5rem)`;
|
|
99
|
-
clearTimeout(this.resizeTimeout);
|
|
100
|
-
this.resizeTimeout = setTimeout(() => {
|
|
101
|
-
if (this._highlightRef) {
|
|
102
|
-
this._highlightRef.style.transition = 'all 0.2s';
|
|
103
|
-
}
|
|
104
|
-
}, 500);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
this.autoGrow();
|
|
109
|
-
this.props.makeStyles?.();
|
|
110
|
-
}
|
|
111
|
-
componentDidUpdate() {
|
|
112
|
-
this.autoGrow();
|
|
113
|
-
this.props.makeStyles?.();
|
|
114
|
-
}
|
|
115
|
-
componentWillUnmount() {
|
|
116
|
-
if (this._listener) {
|
|
117
|
-
this._listener.remove();
|
|
17
|
+
static{
|
|
18
|
+
this.componentId = 'TextArea';
|
|
118
19
|
}
|
|
119
|
-
|
|
120
|
-
|
|
20
|
+
static{
|
|
21
|
+
this.allowedProps = allowedProps;
|
|
121
22
|
}
|
|
122
|
-
|
|
123
|
-
|
|
23
|
+
static{
|
|
24
|
+
this.defaultProps = {
|
|
25
|
+
size: 'medium',
|
|
26
|
+
autoGrow: true,
|
|
27
|
+
resize: 'none',
|
|
28
|
+
inline: false,
|
|
29
|
+
messages: [],
|
|
30
|
+
disabled: false,
|
|
31
|
+
readOnly: false,
|
|
32
|
+
layout: 'stacked',
|
|
33
|
+
required: false
|
|
34
|
+
};
|
|
124
35
|
}
|
|
125
|
-
|
|
126
|
-
|
|
36
|
+
constructor(props){
|
|
37
|
+
super(props), this._textarea = null, this._container = null, this._manuallyResized = false, this._highlightRef = null, this.myObserver = null, this.ref = null, this._textareaResize = ()=>{
|
|
38
|
+
const textareaHeight = this._textarea.style.height;
|
|
39
|
+
if (textareaHeight !== '' && textareaHeight !== this._height) {
|
|
40
|
+
this._manuallyResized = true;
|
|
41
|
+
this._textarea.style.overflowY = 'auto';
|
|
42
|
+
this._container.style.minHeight = textareaHeight;
|
|
43
|
+
}
|
|
44
|
+
}, this.grow = ()=>{
|
|
45
|
+
if (!this._textarea || this._manuallyResized) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const offset = this._textarea.offsetHeight - this._textarea.clientHeight;
|
|
49
|
+
let height = '';
|
|
50
|
+
this._textarea.style.height = 'auto';
|
|
51
|
+
this._textarea.style.overflowY = 'hidden';
|
|
52
|
+
height = this._textarea.scrollHeight + offset + 'px';
|
|
53
|
+
const maxHeight = this.props.maxHeight ? px(this.props.maxHeight, this._container) : undefined;
|
|
54
|
+
if (this.props.maxHeight && maxHeight !== undefined && this._textarea.scrollHeight > maxHeight) {
|
|
55
|
+
this._textarea.style.overflowY = 'auto';
|
|
56
|
+
} else if (this.props.height) {
|
|
57
|
+
if (this._textarea.value === '') {
|
|
58
|
+
height = this.props.height;
|
|
59
|
+
} else if (px(this.props.height, this._container) > this._textarea.scrollHeight) {
|
|
60
|
+
this._textarea.style.overflowY = 'auto';
|
|
61
|
+
height = this.props.height;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const heightExceedsMax = maxHeight !== undefined && px(height) > maxHeight;
|
|
65
|
+
if (!heightExceedsMax) {
|
|
66
|
+
this._container.style.minHeight = height;
|
|
67
|
+
}
|
|
68
|
+
this._height = height;
|
|
69
|
+
this._textarea.style.height = height;
|
|
70
|
+
}, this.handleChange = (event)=>{
|
|
71
|
+
const { onChange, value, disabled, readOnly } = this.props;
|
|
72
|
+
if (disabled || readOnly) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (typeof value === 'undefined') {
|
|
77
|
+
this.autoGrow();
|
|
78
|
+
}
|
|
79
|
+
if (typeof onChange === 'function') {
|
|
80
|
+
onChange(event);
|
|
81
|
+
}
|
|
82
|
+
}, this.handleContainerRef = (node)=>{
|
|
83
|
+
this._container = node;
|
|
84
|
+
};
|
|
85
|
+
this._defaultId = props.deterministicId();
|
|
86
|
+
if (typeof window === 'undefined') {
|
|
87
|
+
globalThis.ResizeObserver = class ResizeObserver1 {
|
|
88
|
+
observe() {}
|
|
89
|
+
unobserve() {}
|
|
90
|
+
disconnect() {}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
127
93
|
}
|
|
128
|
-
|
|
129
|
-
|
|
94
|
+
componentDidMount() {
|
|
95
|
+
this.myObserver = new ResizeObserver((entries)=>{
|
|
96
|
+
for (const entry of entries){
|
|
97
|
+
if (this._highlightRef) {
|
|
98
|
+
const entryStyle = window.getComputedStyle(entry.target);
|
|
99
|
+
this._highlightRef.style.transition = 'none';
|
|
100
|
+
this._highlightRef.style.width = `calc(${entryStyle.width} + 0.5rem)`;
|
|
101
|
+
this._highlightRef.style.height = `calc(${entryStyle.height} + 0.5rem)`;
|
|
102
|
+
clearTimeout(this.resizeTimeout);
|
|
103
|
+
this.resizeTimeout = setTimeout(()=>{
|
|
104
|
+
if (this._highlightRef) {
|
|
105
|
+
this._highlightRef.style.transition = 'all 0.2s';
|
|
106
|
+
}
|
|
107
|
+
}, 500);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
this.autoGrow();
|
|
112
|
+
this.props.makeStyles?.();
|
|
130
113
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (textareaHeight !== '' && textareaHeight !== this._height) {
|
|
135
|
-
this._manuallyResized = true;
|
|
136
|
-
this._textarea.style.overflowY = 'auto';
|
|
137
|
-
|
|
138
|
-
// update container minHeight to ensure focus ring always wraps input
|
|
139
|
-
this._container.style.minHeight = textareaHeight;
|
|
114
|
+
componentDidUpdate() {
|
|
115
|
+
this.autoGrow();
|
|
116
|
+
this.props.makeStyles?.();
|
|
140
117
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
118
|
+
componentWillUnmount() {
|
|
119
|
+
if (this._listener) {
|
|
120
|
+
this._listener.remove();
|
|
121
|
+
}
|
|
122
|
+
if (this._textareaResizeListener) {
|
|
123
|
+
this._textareaResizeListener.disconnect();
|
|
124
|
+
}
|
|
125
|
+
if (this._request) {
|
|
126
|
+
this._request.cancel();
|
|
127
|
+
}
|
|
128
|
+
if (this._debounced) {
|
|
129
|
+
this._debounced.cancel();
|
|
130
|
+
}
|
|
131
|
+
if (this.myObserver) {
|
|
132
|
+
this.myObserver.disconnect();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
autoGrow() {
|
|
136
|
+
if (this.props.autoGrow) {
|
|
137
|
+
if (!this._debounced) {
|
|
138
|
+
this._debounced = debounce(this.grow, 200, {
|
|
139
|
+
leading: false,
|
|
140
|
+
trailing: true
|
|
141
|
+
});
|
|
164
142
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
143
|
+
if (!this._listener) {
|
|
144
|
+
this._listener = addEventListener(window, 'resize', this._debounced);
|
|
145
|
+
}
|
|
146
|
+
if (this._textarea && !this._textareaResizeListener) {
|
|
147
|
+
const { height: origHeight } = getBoundingClientRect(this._textarea);
|
|
148
|
+
this._textareaResizeListener = new ResizeObserver((entries)=>{
|
|
149
|
+
for (const entry of entries){
|
|
150
|
+
const { height } = entry.contentRect;
|
|
151
|
+
if (origHeight !== height) {
|
|
152
|
+
this._textareaResize();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
this._textareaResizeListener.observe(this._textarea);
|
|
157
|
+
}
|
|
158
|
+
this._request = requestAnimationFrame(this.grow);
|
|
159
|
+
}
|
|
170
160
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (!this._textarea || this._manuallyResized) {
|
|
174
|
-
return;
|
|
161
|
+
focus() {
|
|
162
|
+
this._textarea.focus();
|
|
175
163
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
// Notes:
|
|
180
|
-
// 1. height has to be reset to `auto` every time this method runs, or scrollHeight will not reset
|
|
181
|
-
// 2. `this._textarea.scrollHeight` will not reset if assigned to a variable; it needs to be written out each time
|
|
182
|
-
this._textarea.style.height = 'auto';
|
|
183
|
-
this._textarea.style.overflowY = 'hidden'; // hide scrollbars for autoGrow textareas
|
|
184
|
-
height = this._textarea.scrollHeight + offset + 'px';
|
|
185
|
-
const maxHeight = this.props.maxHeight ? px(this.props.maxHeight, this._container) : undefined;
|
|
186
|
-
if (this.props.maxHeight && maxHeight !== undefined && this._textarea.scrollHeight > maxHeight) {
|
|
187
|
-
this._textarea.style.overflowY = 'auto'; // add scroll if scrollHeight exceeds maxHeight in pixels
|
|
188
|
-
} else if (this.props.height) {
|
|
189
|
-
if (this._textarea.value === '') {
|
|
190
|
-
height = this.props.height;
|
|
191
|
-
} else if (px(this.props.height, this._container) > this._textarea.scrollHeight) {
|
|
192
|
-
this._textarea.style.overflowY = 'auto'; // add scroll if scrollHeight exceeds height in pixels
|
|
193
|
-
height = this.props.height;
|
|
194
|
-
}
|
|
164
|
+
get minHeight() {
|
|
165
|
+
return this._textarea.style.minHeight;
|
|
195
166
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (!heightExceedsMax) {
|
|
201
|
-
this._container.style.minHeight = height;
|
|
167
|
+
get invalid() {
|
|
168
|
+
return this.props.messages && this.props.messages.findIndex((message)=>{
|
|
169
|
+
return message.type === 'error' || message.type === 'newError';
|
|
170
|
+
}) >= 0;
|
|
202
171
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
206
|
-
focus() {
|
|
207
|
-
this._textarea.focus();
|
|
208
|
-
}
|
|
209
|
-
handleChange = event => {
|
|
210
|
-
const {
|
|
211
|
-
onChange,
|
|
212
|
-
value,
|
|
213
|
-
disabled,
|
|
214
|
-
readOnly
|
|
215
|
-
} = this.props;
|
|
216
|
-
if (disabled || readOnly) {
|
|
217
|
-
event.preventDefault();
|
|
218
|
-
return;
|
|
172
|
+
get id() {
|
|
173
|
+
return this.props.id || this._defaultId;
|
|
219
174
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
this.autoGrow();
|
|
175
|
+
get focused() {
|
|
176
|
+
return isActiveElement(this._textarea);
|
|
223
177
|
}
|
|
224
|
-
|
|
225
|
-
|
|
178
|
+
get value() {
|
|
179
|
+
return this._textarea.value;
|
|
226
180
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
label: label,
|
|
305
|
-
vAlign: "top",
|
|
306
|
-
id: this.id,
|
|
307
|
-
elementRef: el => {
|
|
308
|
-
this.ref = el;
|
|
309
|
-
},
|
|
310
|
-
margin: margin,
|
|
311
|
-
"data-cid": "TextArea",
|
|
312
|
-
children: _jsxs("div", {
|
|
313
|
-
css: this.props.styles?.textAreaLayout,
|
|
314
|
-
style: {
|
|
315
|
-
width,
|
|
316
|
-
maxHeight
|
|
317
|
-
},
|
|
318
|
-
ref: this.handleContainerRef,
|
|
319
|
-
children: [textarea, !disabled && !readOnly ? _jsx("span", {
|
|
320
|
-
css: this.props.styles?.textAreaOutline,
|
|
321
|
-
"aria-hidden": "true",
|
|
322
|
-
ref: e => {
|
|
323
|
-
this._highlightRef = e;
|
|
324
|
-
}
|
|
325
|
-
}) : null]
|
|
326
|
-
})
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
}) || _class) || _class);
|
|
181
|
+
render() {
|
|
182
|
+
const { autoGrow, placeholder, value, defaultValue, disabled, readOnly, required, width, height, maxHeight, textareaRef, resize, styles, margin } = this.props;
|
|
183
|
+
const props = omitProps(this.props, TextArea.allowedProps);
|
|
184
|
+
const style = {
|
|
185
|
+
width,
|
|
186
|
+
resize,
|
|
187
|
+
height: !autoGrow ? height : undefined,
|
|
188
|
+
maxHeight
|
|
189
|
+
};
|
|
190
|
+
const textarea = /*#__PURE__*/ _jsx("textarea", {
|
|
191
|
+
...props,
|
|
192
|
+
value: value,
|
|
193
|
+
defaultValue: defaultValue,
|
|
194
|
+
placeholder: placeholder,
|
|
195
|
+
ref: (textarea)=>{
|
|
196
|
+
if (textarea) {
|
|
197
|
+
this.myObserver?.observe(textarea);
|
|
198
|
+
}
|
|
199
|
+
this._textarea = textarea;
|
|
200
|
+
if (typeof textareaRef === 'function') {
|
|
201
|
+
textareaRef(textarea);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
style: style,
|
|
205
|
+
id: this.id,
|
|
206
|
+
required: required,
|
|
207
|
+
"aria-required": required,
|
|
208
|
+
"aria-invalid": this.invalid ? 'true' : undefined,
|
|
209
|
+
disabled: disabled || readOnly,
|
|
210
|
+
css: this.props.styles?.textArea,
|
|
211
|
+
onChange: this.handleChange
|
|
212
|
+
});
|
|
213
|
+
const label = hasVisibleChildren(this.props.label) ? /*#__PURE__*/ _jsxs(Fragment, {
|
|
214
|
+
children: [
|
|
215
|
+
this.props.label,
|
|
216
|
+
required && /*#__PURE__*/ _jsxs("span", {
|
|
217
|
+
css: this.invalid ? styles?.requiredInvalid : {},
|
|
218
|
+
"aria-hidden": true,
|
|
219
|
+
children: [
|
|
220
|
+
' ',
|
|
221
|
+
"*"
|
|
222
|
+
]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}) : this.props.label;
|
|
226
|
+
return /*#__PURE__*/ _jsx(FormField, {
|
|
227
|
+
...pickProps(this.props, FormField.allowedProps),
|
|
228
|
+
label: label,
|
|
229
|
+
vAlign: "top",
|
|
230
|
+
id: this.id,
|
|
231
|
+
elementRef: (el)=>{
|
|
232
|
+
this.ref = el;
|
|
233
|
+
},
|
|
234
|
+
margin: margin,
|
|
235
|
+
"data-cid": "TextArea",
|
|
236
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
237
|
+
css: this.props.styles?.textAreaLayout,
|
|
238
|
+
style: {
|
|
239
|
+
width,
|
|
240
|
+
maxHeight
|
|
241
|
+
},
|
|
242
|
+
ref: this.handleContainerRef,
|
|
243
|
+
children: [
|
|
244
|
+
textarea,
|
|
245
|
+
!disabled && !readOnly ? /*#__PURE__*/ _jsx("span", {
|
|
246
|
+
css: this.props.styles?.textAreaOutline,
|
|
247
|
+
"aria-hidden": "true",
|
|
248
|
+
ref: (e)=>{
|
|
249
|
+
this._highlightRef = e;
|
|
250
|
+
}
|
|
251
|
+
}) : null
|
|
252
|
+
]
|
|
253
|
+
})
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const TextArea = withDeterministicId()(withStyle(generateStyle, generateComponentTheme)(TextAreaBase));
|
|
330
258
|
export default TextArea;
|
|
331
|
-
export { TextArea };
|
|
259
|
+
export { TextArea };
|
package/es/TextArea/v1/props.js
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['label', 'id', 'size', 'layout', 'autoGrow', 'resize', 'width', 'height', 'maxHeight', 'messages', 'inline', 'placeholder', 'disabled', 'readOnly', 'required', 'textareaRef', 'defaultValue', 'value', 'onChange', 'margin'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'label',
|
|
3
|
+
'id',
|
|
4
|
+
'size',
|
|
5
|
+
'layout',
|
|
6
|
+
'autoGrow',
|
|
7
|
+
'resize',
|
|
8
|
+
'width',
|
|
9
|
+
'height',
|
|
10
|
+
'maxHeight',
|
|
11
|
+
'messages',
|
|
12
|
+
'inline',
|
|
13
|
+
'placeholder',
|
|
14
|
+
'disabled',
|
|
15
|
+
'readOnly',
|
|
16
|
+
'required',
|
|
17
|
+
'textareaRef',
|
|
18
|
+
'defaultValue',
|
|
19
|
+
'value',
|
|
20
|
+
'onChange',
|
|
21
|
+
'margin'
|
|
22
|
+
];
|
|
23
|
+
export { allowedProps };
|