@instructure/ui-text-input 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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/TextInput/v1/index.js +228 -296
- package/es/TextInput/v1/props.js +27 -26
- package/es/TextInput/v1/styles.js +158 -214
- package/es/TextInput/v1/theme.js +37 -73
- package/es/TextInput/v2/index.js +198 -252
- package/es/TextInput/v2/props.js +31 -26
- package/es/TextInput/v2/styles.js +202 -254
- package/es/exports/a.js +1 -24
- package/es/exports/b.js +1 -24
- package/package.json +15 -21
- package/tsconfig.build.json +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/TextInput/v1/index.js +0 -329
- package/lib/TextInput/v1/props.js +0 -31
- package/lib/TextInput/v1/styles.js +0 -224
- package/lib/TextInput/v1/theme.js +0 -80
- package/lib/TextInput/v2/index.js +0 -281
- package/lib/TextInput/v2/props.js +0 -31
- package/lib/TextInput/v2/styles.js +0 -262
- 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.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
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.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
### Bug Fixes
|
package/es/TextInput/v1/index.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
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 { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Fragment, Component } from 'react';
|
|
27
4
|
import { callRenderProp, getInteraction, passthroughProps, withDeterministicId } from '@instructure/ui-react-utils';
|
|
28
5
|
import { isActiveElement, addEventListener, getCSSStyleDeclaration } from '@instructure/ui-dom-utils';
|
|
@@ -32,289 +9,244 @@ import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
|
32
9
|
import generateStyle from './styles.js';
|
|
33
10
|
import generateComponentTheme from './theme.js';
|
|
34
11
|
import { allowedProps } from './props.js';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
12
|
+
class TextInput extends Component {
|
|
13
|
+
static{
|
|
14
|
+
this.displayName = 'TextInput';
|
|
15
|
+
}
|
|
16
|
+
static{
|
|
17
|
+
this.componentId = 'TextInput';
|
|
18
|
+
}
|
|
19
|
+
static{
|
|
20
|
+
this.allowedProps = allowedProps;
|
|
21
|
+
}
|
|
22
|
+
static{
|
|
23
|
+
this.defaultProps = {
|
|
24
|
+
type: 'text',
|
|
25
|
+
interaction: undefined,
|
|
26
|
+
isRequired: false,
|
|
27
|
+
display: 'block',
|
|
28
|
+
shouldNotWrap: false,
|
|
29
|
+
size: 'medium',
|
|
30
|
+
textAlign: 'start',
|
|
31
|
+
messages: []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
constructor(props){
|
|
35
|
+
super(props), this.ref = null, this._input = null, this._afterElement = null, this._focusListener = null, this.handleRef = (el)=>{
|
|
36
|
+
const { elementRef } = this.props;
|
|
37
|
+
this.ref = el;
|
|
38
|
+
if (typeof elementRef === 'function') {
|
|
39
|
+
elementRef(el);
|
|
40
|
+
}
|
|
41
|
+
}, this.makeStyleProps = ()=>{
|
|
42
|
+
const { interaction } = this;
|
|
43
|
+
const { hasFocus, afterElementHasWidth } = this.state;
|
|
44
|
+
const beforeElement = this.props.renderBeforeInput ? callRenderProp(this.props.renderBeforeInput) : null;
|
|
45
|
+
return {
|
|
46
|
+
disabled: interaction === 'disabled',
|
|
47
|
+
invalid: this.invalid,
|
|
48
|
+
focused: hasFocus,
|
|
49
|
+
afterElementHasWidth: afterElementHasWidth,
|
|
50
|
+
beforeElementExists: !!beforeElement
|
|
51
|
+
};
|
|
52
|
+
}, this.handleInputRef = (node)=>{
|
|
53
|
+
this._input = node;
|
|
54
|
+
if (typeof this.props.inputRef === 'function') {
|
|
55
|
+
this.props.inputRef(node);
|
|
56
|
+
}
|
|
57
|
+
}, this.handleChange = (event)=>{
|
|
58
|
+
if (typeof this.props.onChange === 'function') {
|
|
59
|
+
this.props.onChange(event, event.target.value);
|
|
60
|
+
}
|
|
61
|
+
}, this.handleBlur = (event)=>{
|
|
62
|
+
if (typeof this.props.onBlur === 'function') {
|
|
63
|
+
this.props.onBlur(event);
|
|
64
|
+
}
|
|
65
|
+
this.setState({
|
|
66
|
+
hasFocus: false
|
|
67
|
+
});
|
|
68
|
+
}, this.handleFocus = (event)=>{
|
|
69
|
+
if (typeof this.props.onFocus === 'function') {
|
|
70
|
+
this.props.onFocus(event);
|
|
71
|
+
}
|
|
72
|
+
this.setState({
|
|
73
|
+
hasFocus: true
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
this.state = {
|
|
77
|
+
hasFocus: false,
|
|
78
|
+
afterElementHasWidth: undefined
|
|
79
|
+
};
|
|
80
|
+
this._defaultId = props.deterministicId();
|
|
81
|
+
this._messagesId = props.deterministicId('TextInput-messages');
|
|
82
|
+
}
|
|
83
|
+
componentDidMount() {
|
|
84
|
+
if (this._input) {
|
|
85
|
+
this._focusListener = addEventListener(this._input, 'focus', this.handleFocus);
|
|
86
|
+
this.setState({
|
|
87
|
+
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
this.adjustAfterElementHeight();
|
|
91
|
+
this.props.makeStyles?.(this.makeStyleProps());
|
|
80
92
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.setState({
|
|
86
|
-
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
87
|
-
});
|
|
93
|
+
componentWillUnmount() {
|
|
94
|
+
if (this._focusListener) {
|
|
95
|
+
this._focusListener.remove();
|
|
96
|
+
}
|
|
88
97
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
componentDidUpdate(prevProps) {
|
|
99
|
+
if (prevProps.renderAfterInput !== this.props.renderAfterInput) {
|
|
100
|
+
this.setState({
|
|
101
|
+
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (getInteraction({
|
|
105
|
+
props: prevProps
|
|
106
|
+
}) !== 'disabled' && getInteraction({
|
|
107
|
+
props: this.props
|
|
108
|
+
}) === 'disabled') {
|
|
109
|
+
this.setState({
|
|
110
|
+
hasFocus: false
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
this.props.makeStyles?.(this.makeStyleProps());
|
|
95
114
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
115
|
+
adjustAfterElementHeight() {
|
|
116
|
+
const afterElementChild = this._afterElement?.firstElementChild;
|
|
117
|
+
const buttonContentSpan = afterElementChild?.tagName === 'BUTTON' ? afterElementChild.firstElementChild : null;
|
|
118
|
+
const popoverContentSpan = afterElementChild?.tagName === 'SPAN' && afterElementChild.firstElementChild?.tagName === 'BUTTON' ? afterElementChild.firstElementChild.firstElementChild : null;
|
|
119
|
+
const targetSpan = buttonContentSpan ?? popoverContentSpan;
|
|
120
|
+
if (targetSpan) {
|
|
121
|
+
targetSpan.style.height = '36px';
|
|
122
|
+
}
|
|
102
123
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}) !== 'disabled' && getInteraction({
|
|
106
|
-
props: this.props
|
|
107
|
-
}) === 'disabled') {
|
|
108
|
-
this.setState({
|
|
109
|
-
hasFocus: false
|
|
110
|
-
});
|
|
124
|
+
focus() {
|
|
125
|
+
this._input?.focus();
|
|
111
126
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// Check if the child is a button, then get the button's first child (the content span)
|
|
118
|
-
const buttonContentSpan = afterElementChild?.tagName === 'BUTTON' ? afterElementChild.firstElementChild : null;
|
|
119
|
-
|
|
120
|
-
// This is a necessary workaround for DateInput2 because it uses a Popover, which has a nested Button as an afterElement
|
|
121
|
-
// Check if the child is a Popover's inner span containing a button, then get the button's first child (the content span)
|
|
122
|
-
const popoverContentSpan = afterElementChild?.tagName === 'SPAN' && afterElementChild.firstElementChild?.tagName === 'BUTTON' ? afterElementChild.firstElementChild.firstElementChild : null;
|
|
123
|
-
const targetSpan = buttonContentSpan ?? popoverContentSpan;
|
|
124
|
-
if (targetSpan) {
|
|
125
|
-
// Set the height to 36px (the height of a medium TextInput) to avoid layout shift when the afterElement content changes
|
|
126
|
-
// this temporary workaround is necessary because otherwise the layout breaks, later on IconButton's default height will be adjusted to the TextInput size
|
|
127
|
-
// so this workaround will not be needed anymore
|
|
128
|
-
targetSpan.style.height = '36px';
|
|
127
|
+
get interaction() {
|
|
128
|
+
return getInteraction({
|
|
129
|
+
props: this.props
|
|
130
|
+
});
|
|
129
131
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const {
|
|
133
|
-
interaction
|
|
134
|
-
} = this;
|
|
135
|
-
const {
|
|
136
|
-
hasFocus,
|
|
137
|
-
afterElementHasWidth
|
|
138
|
-
} = this.state;
|
|
139
|
-
const beforeElement = this.props.renderBeforeInput ? callRenderProp(this.props.renderBeforeInput) : null;
|
|
140
|
-
return {
|
|
141
|
-
disabled: interaction === 'disabled',
|
|
142
|
-
invalid: this.invalid,
|
|
143
|
-
focused: hasFocus,
|
|
144
|
-
afterElementHasWidth: afterElementHasWidth,
|
|
145
|
-
beforeElementExists: !!beforeElement
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
focus() {
|
|
149
|
-
this._input?.focus();
|
|
150
|
-
}
|
|
151
|
-
get interaction() {
|
|
152
|
-
return getInteraction({
|
|
153
|
-
props: this.props
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
get hasMessages() {
|
|
157
|
-
return !!this.props.messages && this.props.messages.length > 0;
|
|
158
|
-
}
|
|
159
|
-
get invalid() {
|
|
160
|
-
return !!this.props.messages && this.props.messages.findIndex(message => {
|
|
161
|
-
return message.type === 'error' || message.type === 'newError';
|
|
162
|
-
}) >= 0;
|
|
163
|
-
}
|
|
164
|
-
get focused() {
|
|
165
|
-
return isActiveElement(this._input);
|
|
166
|
-
}
|
|
167
|
-
get value() {
|
|
168
|
-
return this._input?.value;
|
|
169
|
-
}
|
|
170
|
-
get id() {
|
|
171
|
-
return this.props.id || this._defaultId;
|
|
172
|
-
}
|
|
173
|
-
handleInputRef = node => {
|
|
174
|
-
this._input = node;
|
|
175
|
-
if (typeof this.props.inputRef === 'function') {
|
|
176
|
-
this.props.inputRef(node);
|
|
132
|
+
get hasMessages() {
|
|
133
|
+
return !!this.props.messages && this.props.messages.length > 0;
|
|
177
134
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
135
|
+
get invalid() {
|
|
136
|
+
return !!this.props.messages && this.props.messages.findIndex((message)=>{
|
|
137
|
+
return message.type === 'error' || message.type === 'newError';
|
|
138
|
+
}) >= 0;
|
|
182
139
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (typeof this.props.onBlur === 'function') {
|
|
186
|
-
this.props.onBlur(event);
|
|
140
|
+
get focused() {
|
|
141
|
+
return isActiveElement(this._input);
|
|
187
142
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
handleFocus = event => {
|
|
193
|
-
if (typeof this.props.onFocus === 'function') {
|
|
194
|
-
this.props.onFocus(event);
|
|
143
|
+
get value() {
|
|
144
|
+
return this._input?.value;
|
|
195
145
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
renderInput() {
|
|
201
|
-
const {
|
|
202
|
-
type,
|
|
203
|
-
size,
|
|
204
|
-
htmlSize,
|
|
205
|
-
display,
|
|
206
|
-
textAlign,
|
|
207
|
-
placeholder,
|
|
208
|
-
value,
|
|
209
|
-
defaultValue,
|
|
210
|
-
isRequired,
|
|
211
|
-
onFocus,
|
|
212
|
-
...rest
|
|
213
|
-
} = this.props;
|
|
214
|
-
const props = passthroughProps(rest);
|
|
215
|
-
const {
|
|
216
|
-
interaction
|
|
217
|
-
} = this;
|
|
218
|
-
let descriptionIds = '';
|
|
219
|
-
if (props['aria-describedby']) {
|
|
220
|
-
descriptionIds = `${props['aria-describedby']}`;
|
|
146
|
+
get id() {
|
|
147
|
+
return this.props.id || this._defaultId;
|
|
221
148
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
149
|
+
renderInput() {
|
|
150
|
+
const { type, size, htmlSize, display, textAlign, placeholder, value, defaultValue, isRequired, onFocus, ...rest } = this.props;
|
|
151
|
+
const props = passthroughProps(rest);
|
|
152
|
+
const { interaction } = this;
|
|
153
|
+
let descriptionIds = '';
|
|
154
|
+
if (props['aria-describedby']) {
|
|
155
|
+
descriptionIds = `${props['aria-describedby']}`;
|
|
156
|
+
}
|
|
157
|
+
return /*#__PURE__*/ _jsx("input", {
|
|
158
|
+
...props,
|
|
159
|
+
css: this.props.styles?.textInput,
|
|
160
|
+
defaultValue: defaultValue,
|
|
161
|
+
value: value,
|
|
162
|
+
placeholder: placeholder,
|
|
163
|
+
ref: this.handleInputRef,
|
|
164
|
+
type: type,
|
|
165
|
+
id: this.id,
|
|
166
|
+
required: isRequired,
|
|
167
|
+
"aria-invalid": this.invalid ? 'true' : undefined,
|
|
168
|
+
disabled: interaction === 'disabled',
|
|
169
|
+
readOnly: interaction === 'readonly',
|
|
170
|
+
"aria-describedby": descriptionIds !== '' ? descriptionIds : undefined,
|
|
171
|
+
size: htmlSize,
|
|
172
|
+
onChange: this.handleChange,
|
|
173
|
+
onBlur: this.handleBlur
|
|
174
|
+
});
|
|
244
175
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
176
|
+
getElementHasWidth(element) {
|
|
177
|
+
if (!element) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
const computedStyle = getCSSStyleDeclaration(element);
|
|
181
|
+
if (!computedStyle) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
const { width, paddingInlineStart, paddingInlineEnd } = computedStyle;
|
|
185
|
+
if (width === 'auto' || width === '') {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
const elementWidth = parseFloat(width) - parseFloat(paddingInlineStart) - parseFloat(paddingInlineEnd);
|
|
189
|
+
return elementWidth > 0;
|
|
248
190
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
191
|
+
render() {
|
|
192
|
+
const { width, display, renderLabel, renderBeforeInput, renderAfterInput, messages, inputContainerRef, isRequired, styles } = this.props;
|
|
193
|
+
const beforeElement = renderBeforeInput ? callRenderProp(renderBeforeInput) : null;
|
|
194
|
+
const afterElement = renderAfterInput ? callRenderProp(renderAfterInput) : null;
|
|
195
|
+
const renderBeforeOrAfter = !!beforeElement || !!afterElement || renderBeforeInput !== undefined || renderAfterInput !== undefined;
|
|
196
|
+
const rawLabel = callRenderProp(renderLabel);
|
|
197
|
+
const label = hasVisibleChildren(rawLabel) ? /*#__PURE__*/ _jsxs(Fragment, {
|
|
198
|
+
children: [
|
|
199
|
+
rawLabel,
|
|
200
|
+
isRequired && /*#__PURE__*/ _jsxs("span", {
|
|
201
|
+
css: this.invalid ? styles?.requiredInvalid : {},
|
|
202
|
+
"aria-hidden": true,
|
|
203
|
+
children: [
|
|
204
|
+
' ',
|
|
205
|
+
"*"
|
|
206
|
+
]
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
}) : rawLabel;
|
|
210
|
+
return /*#__PURE__*/ _jsx(FormField, {
|
|
211
|
+
id: this.id,
|
|
212
|
+
label: label,
|
|
213
|
+
messagesId: this._messagesId,
|
|
214
|
+
messages: messages,
|
|
215
|
+
inline: display === 'inline-block',
|
|
216
|
+
width: width,
|
|
217
|
+
inputContainerRef: inputContainerRef,
|
|
218
|
+
layout: this.props.layout,
|
|
219
|
+
elementRef: this.handleRef,
|
|
220
|
+
margin: this.props.margin,
|
|
221
|
+
"data-cid": "TextInput",
|
|
222
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
223
|
+
css: styles?.facade,
|
|
224
|
+
children: renderBeforeOrAfter ? /*#__PURE__*/ _jsxs("span", {
|
|
225
|
+
css: styles?.layout,
|
|
226
|
+
children: [
|
|
227
|
+
beforeElement,
|
|
228
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
229
|
+
css: styles?.inputLayout,
|
|
230
|
+
children: [
|
|
231
|
+
this.renderInput(),
|
|
232
|
+
afterElement && /*#__PURE__*/ _jsx("span", {
|
|
233
|
+
css: styles?.afterElement,
|
|
234
|
+
ref: (e)=>{
|
|
235
|
+
this._afterElement = e;
|
|
236
|
+
},
|
|
237
|
+
children: afterElement
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
}) : this.renderInput()
|
|
243
|
+
})
|
|
244
|
+
});
|
|
260
245
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
width,
|
|
267
|
-
display,
|
|
268
|
-
renderLabel,
|
|
269
|
-
renderBeforeInput,
|
|
270
|
-
renderAfterInput,
|
|
271
|
-
messages,
|
|
272
|
-
inputContainerRef,
|
|
273
|
-
isRequired,
|
|
274
|
-
styles
|
|
275
|
-
} = this.props;
|
|
276
|
-
const beforeElement = renderBeforeInput ? callRenderProp(renderBeforeInput) : null;
|
|
277
|
-
const afterElement = renderAfterInput ? callRenderProp(renderAfterInput) : null;
|
|
278
|
-
const renderBeforeOrAfter = !!beforeElement || !!afterElement || renderBeforeInput !== undefined || renderAfterInput !== undefined;
|
|
279
|
-
const rawLabel = callRenderProp(renderLabel);
|
|
280
|
-
const label = hasVisibleChildren(rawLabel) ? _jsxs(Fragment, {
|
|
281
|
-
children: [rawLabel, isRequired && _jsxs("span", {
|
|
282
|
-
css: this.invalid ? styles?.requiredInvalid : {},
|
|
283
|
-
"aria-hidden": true,
|
|
284
|
-
children: [' ', "*"]
|
|
285
|
-
})]
|
|
286
|
-
}) : rawLabel;
|
|
287
|
-
return _jsx(FormField, {
|
|
288
|
-
id: this.id,
|
|
289
|
-
label: label,
|
|
290
|
-
messagesId: this._messagesId,
|
|
291
|
-
messages: messages,
|
|
292
|
-
inline: display === 'inline-block',
|
|
293
|
-
width: width,
|
|
294
|
-
inputContainerRef: inputContainerRef,
|
|
295
|
-
layout: this.props.layout,
|
|
296
|
-
elementRef: this.handleRef,
|
|
297
|
-
margin: this.props.margin,
|
|
298
|
-
"data-cid": "TextInput",
|
|
299
|
-
children: _jsx("span", {
|
|
300
|
-
css: styles?.facade,
|
|
301
|
-
children: renderBeforeOrAfter ? _jsxs("span", {
|
|
302
|
-
css: styles?.layout,
|
|
303
|
-
children: [beforeElement, _jsxs("span", {
|
|
304
|
-
css: styles?.inputLayout,
|
|
305
|
-
children: [this.renderInput(), afterElement && _jsx("span", {
|
|
306
|
-
css: styles?.afterElement,
|
|
307
|
-
ref: e => {
|
|
308
|
-
this._afterElement = e;
|
|
309
|
-
},
|
|
310
|
-
children: afterElement
|
|
311
|
-
})]
|
|
312
|
-
})]
|
|
313
|
-
}) : (/* If no prepended or appended content, don't render Flex layout */
|
|
314
|
-
this.renderInput())
|
|
315
|
-
})
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
}) || _class) || _class);
|
|
246
|
+
}
|
|
247
|
+
TextInput = _ts_decorate([
|
|
248
|
+
withDeterministicId(),
|
|
249
|
+
withStyle(generateStyle, generateComponentTheme)
|
|
250
|
+
], TextInput);
|
|
319
251
|
export default TextInput;
|
|
320
|
-
export { TextInput };
|
|
252
|
+
export { TextInput };
|
package/es/TextInput/v1/props.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
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
|
-
|
|
26
|
-
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'renderLabel',
|
|
3
|
+
'type',
|
|
4
|
+
'id',
|
|
5
|
+
'value',
|
|
6
|
+
'defaultValue',
|
|
7
|
+
'interaction',
|
|
8
|
+
'messages',
|
|
9
|
+
'size',
|
|
10
|
+
'textAlign',
|
|
11
|
+
'width',
|
|
12
|
+
'htmlSize',
|
|
13
|
+
'display',
|
|
14
|
+
'shouldNotWrap',
|
|
15
|
+
'placeholder',
|
|
16
|
+
'isRequired',
|
|
17
|
+
'elementRef',
|
|
18
|
+
'inputRef',
|
|
19
|
+
'inputContainerRef',
|
|
20
|
+
'renderBeforeInput',
|
|
21
|
+
'renderAfterInput',
|
|
22
|
+
'onChange',
|
|
23
|
+
'onBlur',
|
|
24
|
+
'onFocus',
|
|
25
|
+
'margin'
|
|
26
|
+
];
|
|
27
|
+
export { allowedProps };
|