@instructure/ui-text-input 8.13.0 → 8.13.1-snapshot.10
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/LICENSE.md +27 -0
- package/es/TextInput/index.js +32 -19
- package/es/TextInput/props.js +1 -104
- package/lib/TextInput/index.js +34 -19
- package/lib/TextInput/props.js +1 -104
- package/package.json +19 -18
- package/src/TextInput/index.tsx +34 -52
- package/src/TextInput/props.ts +108 -76
- package/types/TextInput/index.d.ts +34 -35
- package/types/TextInput/index.d.ts.map +1 -1
- package/types/TextInput/props.d.ts +97 -12
- package/types/TextInput/props.d.ts.map +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
package/es/TextInput/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
|
-
import { Component } from 'react';
|
|
31
|
+
import React, { Component } from 'react';
|
|
32
32
|
import { callRenderProp, getInteraction, passthroughProps } from '@instructure/ui-react-utils';
|
|
33
33
|
import { isActiveElement } from '@instructure/ui-dom-utils';
|
|
34
34
|
import { FormField } from '@instructure/ui-form-field';
|
|
@@ -43,12 +43,16 @@ import { allowedProps, propTypes } from './props';
|
|
|
43
43
|
category: components
|
|
44
44
|
tags: form, field
|
|
45
45
|
---
|
|
46
|
+
@tsProps
|
|
46
47
|
**/
|
|
47
48
|
|
|
48
49
|
let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class TextInput extends Component {
|
|
49
50
|
constructor(props) {
|
|
50
51
|
super(props);
|
|
51
52
|
this.ref = null;
|
|
53
|
+
this._input = null;
|
|
54
|
+
this._defaultId = void 0;
|
|
55
|
+
this._messagesId = void 0;
|
|
52
56
|
|
|
53
57
|
this.handleRef = el => {
|
|
54
58
|
const elementRef = this.props.elementRef;
|
|
@@ -70,22 +74,33 @@ let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
70
74
|
|
|
71
75
|
this.handleInputRef = node => {
|
|
72
76
|
this._input = node;
|
|
73
|
-
|
|
77
|
+
|
|
78
|
+
if (typeof this.props.inputRef === 'function') {
|
|
79
|
+
this.props.inputRef(node);
|
|
80
|
+
}
|
|
74
81
|
};
|
|
75
82
|
|
|
76
83
|
this.handleChange = event => {
|
|
77
|
-
this.props.onChange
|
|
84
|
+
if (typeof this.props.onChange === 'function') {
|
|
85
|
+
this.props.onChange(event, event.target.value);
|
|
86
|
+
}
|
|
78
87
|
};
|
|
79
88
|
|
|
80
89
|
this.handleBlur = event => {
|
|
81
|
-
this.props.onBlur
|
|
90
|
+
if (typeof this.props.onBlur === 'function') {
|
|
91
|
+
this.props.onBlur(event);
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
this.setState({
|
|
83
95
|
hasFocus: false
|
|
84
96
|
});
|
|
85
97
|
};
|
|
86
98
|
|
|
87
99
|
this.handleFocus = event => {
|
|
88
|
-
this.props.onFocus
|
|
100
|
+
if (typeof this.props.onFocus === 'function') {
|
|
101
|
+
this.props.onFocus(event);
|
|
102
|
+
}
|
|
103
|
+
|
|
89
104
|
this.setState({
|
|
90
105
|
hasFocus: true
|
|
91
106
|
});
|
|
@@ -104,14 +119,16 @@ let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
104
119
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
|
|
105
120
|
}
|
|
106
121
|
|
|
107
|
-
componentDidUpdate(
|
|
122
|
+
componentDidUpdate() {
|
|
108
123
|
var _this$props$makeStyle2, _this$props2;
|
|
109
124
|
|
|
110
125
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
|
|
111
126
|
}
|
|
112
127
|
|
|
113
128
|
focus() {
|
|
114
|
-
|
|
129
|
+
var _this$_input;
|
|
130
|
+
|
|
131
|
+
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
115
132
|
}
|
|
116
133
|
|
|
117
134
|
get interaction() {
|
|
@@ -121,7 +138,7 @@ let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
121
138
|
}
|
|
122
139
|
|
|
123
140
|
get hasMessages() {
|
|
124
|
-
return this.props.messages && this.props.messages.length > 0;
|
|
141
|
+
return !!this.props.messages && this.props.messages.length > 0;
|
|
125
142
|
}
|
|
126
143
|
|
|
127
144
|
get invalid() {
|
|
@@ -135,7 +152,9 @@ let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
135
152
|
}
|
|
136
153
|
|
|
137
154
|
get value() {
|
|
138
|
-
|
|
155
|
+
var _this$_input2;
|
|
156
|
+
|
|
157
|
+
return (_this$_input2 = this._input) === null || _this$_input2 === void 0 ? void 0 : _this$_input2.value;
|
|
139
158
|
}
|
|
140
159
|
|
|
141
160
|
get id() {
|
|
@@ -178,10 +197,10 @@ let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
178
197
|
type: type,
|
|
179
198
|
id: this.id,
|
|
180
199
|
required: isRequired,
|
|
181
|
-
"aria-invalid": this.invalid ? 'true' :
|
|
200
|
+
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
182
201
|
disabled: interaction === 'disabled',
|
|
183
202
|
readOnly: interaction === 'readonly',
|
|
184
|
-
"aria-describedby": descriptionIds !== '' ? descriptionIds :
|
|
203
|
+
"aria-describedby": descriptionIds !== '' ? descriptionIds : void 0,
|
|
185
204
|
size: htmlSize,
|
|
186
205
|
onChange: this.handleChange,
|
|
187
206
|
onBlur: this.handleBlur,
|
|
@@ -210,8 +229,7 @@ let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
210
229
|
inline: display === 'inline-block',
|
|
211
230
|
width: width,
|
|
212
231
|
inputContainerRef: inputContainerRef,
|
|
213
|
-
layout: this.props.layout
|
|
214
|
-
,
|
|
232
|
+
layout: this.props.layout,
|
|
215
233
|
elementRef: this.handleRef
|
|
216
234
|
}, jsx("span", {
|
|
217
235
|
css: styles === null || styles === void 0 ? void 0 : styles.facade
|
|
@@ -241,12 +259,7 @@ let TextInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
241
259
|
shouldNotWrap: false,
|
|
242
260
|
size: 'medium',
|
|
243
261
|
textAlign: 'start',
|
|
244
|
-
messages: []
|
|
245
|
-
inputRef: function (input) {},
|
|
246
|
-
inputContainerRef: function (container) {},
|
|
247
|
-
onChange: function (event, value) {},
|
|
248
|
-
onBlur: function (event) {},
|
|
249
|
-
onFocus: function (event) {}
|
|
262
|
+
messages: []
|
|
250
263
|
}, _temp)) || _class) || _class);
|
|
251
264
|
export default TextInput;
|
|
252
265
|
export { TextInput };
|
package/es/TextInput/props.js
CHANGED
|
@@ -25,131 +25,28 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { FormPropTypes } from '@instructure/ui-form-field';
|
|
26
26
|
import { controllable } from '@instructure/ui-prop-types';
|
|
27
27
|
const propTypes = {
|
|
28
|
-
/**
|
|
29
|
-
* The form field label.
|
|
30
|
-
*/
|
|
31
28
|
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Determines the underlying native HTML `<input>` element's `type`.
|
|
35
|
-
* For more see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url
|
|
36
|
-
*/
|
|
37
29
|
type: PropTypes.oneOf(['text', 'email', 'url', 'tel', 'search', 'password']),
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The id of the text input. One is generated if not supplied.
|
|
41
|
-
*/
|
|
42
30
|
id: PropTypes.string,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* the selected value (must be accompanied by an `onChange` prop)
|
|
46
|
-
*/
|
|
47
31
|
value: controllable(PropTypes.string),
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* value to set on initial render
|
|
51
|
-
*/
|
|
52
32
|
defaultValue: PropTypes.string,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
56
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
57
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
58
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
59
|
-
*/
|
|
60
33
|
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* object with shape: `{
|
|
64
|
-
* text: PropTypes.node,
|
|
65
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
66
|
-
* }`
|
|
67
|
-
*/
|
|
68
34
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The size of the text input.
|
|
72
|
-
*/
|
|
73
35
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* The text alignment of the input.
|
|
77
|
-
*/
|
|
78
36
|
textAlign: PropTypes.oneOf(['start', 'center']),
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* The width of the input.
|
|
82
|
-
*/
|
|
83
37
|
width: PropTypes.string,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The width of the input, in characters, if a width is not explicitly
|
|
87
|
-
* provided via the `width` prop. Only applicable if `isInline={true}`.
|
|
88
|
-
*/
|
|
89
|
-
htmlSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The display of the root element.
|
|
93
|
-
*/
|
|
38
|
+
htmlSize: PropTypes.number,
|
|
94
39
|
display: PropTypes.oneOf(['inline-block', 'block']),
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Prevents the default behavior of wrapping the input and rendered content
|
|
98
|
-
* when available space is exceeded.
|
|
99
|
-
*/
|
|
100
40
|
shouldNotWrap: PropTypes.bool,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Html placeholder text to display when the input has no value. This should be hint text, not a label
|
|
104
|
-
* replacement.
|
|
105
|
-
*/
|
|
106
41
|
placeholder: PropTypes.string,
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Whether or not the text input is required.
|
|
110
|
-
*/
|
|
111
42
|
isRequired: PropTypes.bool,
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* provides a reference to the underlying html root element
|
|
115
|
-
*/
|
|
116
43
|
elementRef: PropTypes.func,
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* a function that provides a reference to the actual input element
|
|
120
|
-
*/
|
|
121
44
|
inputRef: PropTypes.func,
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* a function that provides a reference a parent of the input element
|
|
125
|
-
*/
|
|
126
45
|
inputContainerRef: PropTypes.func,
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Content to display before the input text, such as an icon
|
|
130
|
-
*/
|
|
131
46
|
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Content to display after the input text, such as an icon
|
|
135
|
-
*/
|
|
136
47
|
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Callback executed when the input fires a change event.
|
|
140
|
-
* @param {Object} event - the event object
|
|
141
|
-
* @param {Object} value - the string value of the input
|
|
142
|
-
*/
|
|
143
48
|
onChange: PropTypes.func,
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Callback fired when input loses focus.
|
|
147
|
-
*/
|
|
148
49
|
onBlur: PropTypes.func,
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Callback fired when input receives focus.
|
|
152
|
-
*/
|
|
153
50
|
onFocus: PropTypes.func
|
|
154
51
|
};
|
|
155
52
|
const allowedProps = ['renderLabel', 'type', 'id', 'value', 'defaultValue', 'interaction', 'messages', 'size', 'textAlign', 'width', 'htmlSize', 'display', 'shouldNotWrap', 'placeholder', 'isRequired', 'elementRef', 'inputRef', 'inputContainerRef', 'renderBeforeInput', 'renderAfterInput', 'onChange', 'onBlur', 'onFocus'];
|
package/lib/TextInput/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -9,7 +11,7 @@ exports.default = exports.TextInput = void 0;
|
|
|
9
11
|
|
|
10
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
13
|
|
|
12
|
-
var _react = require("react");
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
15
17
|
|
|
@@ -42,11 +44,15 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
42
44
|
category: components
|
|
43
45
|
tags: form, field
|
|
44
46
|
---
|
|
47
|
+
@tsProps
|
|
45
48
|
**/
|
|
46
49
|
let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class TextInput extends _react.Component {
|
|
47
50
|
constructor(props) {
|
|
48
51
|
super(props);
|
|
49
52
|
this.ref = null;
|
|
53
|
+
this._input = null;
|
|
54
|
+
this._defaultId = void 0;
|
|
55
|
+
this._messagesId = void 0;
|
|
50
56
|
|
|
51
57
|
this.handleRef = el => {
|
|
52
58
|
const elementRef = this.props.elementRef;
|
|
@@ -68,22 +74,33 @@ let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
68
74
|
|
|
69
75
|
this.handleInputRef = node => {
|
|
70
76
|
this._input = node;
|
|
71
|
-
|
|
77
|
+
|
|
78
|
+
if (typeof this.props.inputRef === 'function') {
|
|
79
|
+
this.props.inputRef(node);
|
|
80
|
+
}
|
|
72
81
|
};
|
|
73
82
|
|
|
74
83
|
this.handleChange = event => {
|
|
75
|
-
this.props.onChange
|
|
84
|
+
if (typeof this.props.onChange === 'function') {
|
|
85
|
+
this.props.onChange(event, event.target.value);
|
|
86
|
+
}
|
|
76
87
|
};
|
|
77
88
|
|
|
78
89
|
this.handleBlur = event => {
|
|
79
|
-
this.props.onBlur
|
|
90
|
+
if (typeof this.props.onBlur === 'function') {
|
|
91
|
+
this.props.onBlur(event);
|
|
92
|
+
}
|
|
93
|
+
|
|
80
94
|
this.setState({
|
|
81
95
|
hasFocus: false
|
|
82
96
|
});
|
|
83
97
|
};
|
|
84
98
|
|
|
85
99
|
this.handleFocus = event => {
|
|
86
|
-
this.props.onFocus
|
|
100
|
+
if (typeof this.props.onFocus === 'function') {
|
|
101
|
+
this.props.onFocus(event);
|
|
102
|
+
}
|
|
103
|
+
|
|
87
104
|
this.setState({
|
|
88
105
|
hasFocus: true
|
|
89
106
|
});
|
|
@@ -102,14 +119,16 @@ let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
102
119
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
|
|
103
120
|
}
|
|
104
121
|
|
|
105
|
-
componentDidUpdate(
|
|
122
|
+
componentDidUpdate() {
|
|
106
123
|
var _this$props$makeStyle2, _this$props2;
|
|
107
124
|
|
|
108
125
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
focus() {
|
|
112
|
-
|
|
129
|
+
var _this$_input;
|
|
130
|
+
|
|
131
|
+
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
113
132
|
}
|
|
114
133
|
|
|
115
134
|
get interaction() {
|
|
@@ -119,7 +138,7 @@ let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
119
138
|
}
|
|
120
139
|
|
|
121
140
|
get hasMessages() {
|
|
122
|
-
return this.props.messages && this.props.messages.length > 0;
|
|
141
|
+
return !!this.props.messages && this.props.messages.length > 0;
|
|
123
142
|
}
|
|
124
143
|
|
|
125
144
|
get invalid() {
|
|
@@ -133,7 +152,9 @@ let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
133
152
|
}
|
|
134
153
|
|
|
135
154
|
get value() {
|
|
136
|
-
|
|
155
|
+
var _this$_input2;
|
|
156
|
+
|
|
157
|
+
return (_this$_input2 = this._input) === null || _this$_input2 === void 0 ? void 0 : _this$_input2.value;
|
|
137
158
|
}
|
|
138
159
|
|
|
139
160
|
get id() {
|
|
@@ -175,10 +196,10 @@ let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
175
196
|
type: type,
|
|
176
197
|
id: this.id,
|
|
177
198
|
required: isRequired,
|
|
178
|
-
"aria-invalid": this.invalid ? 'true' :
|
|
199
|
+
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
179
200
|
disabled: interaction === 'disabled',
|
|
180
201
|
readOnly: interaction === 'readonly',
|
|
181
|
-
"aria-describedby": descriptionIds !== '' ? descriptionIds :
|
|
202
|
+
"aria-describedby": descriptionIds !== '' ? descriptionIds : void 0,
|
|
182
203
|
size: htmlSize,
|
|
183
204
|
onChange: this.handleChange,
|
|
184
205
|
onBlur: this.handleBlur,
|
|
@@ -207,8 +228,7 @@ let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
207
228
|
inline: display === 'inline-block',
|
|
208
229
|
width: width,
|
|
209
230
|
inputContainerRef: inputContainerRef,
|
|
210
|
-
layout: this.props.layout
|
|
211
|
-
,
|
|
231
|
+
layout: this.props.layout,
|
|
212
232
|
elementRef: this.handleRef
|
|
213
233
|
}, (0, _emotion.jsx)("span", {
|
|
214
234
|
css: styles === null || styles === void 0 ? void 0 : styles.facade
|
|
@@ -238,12 +258,7 @@ let TextInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
238
258
|
shouldNotWrap: false,
|
|
239
259
|
size: 'medium',
|
|
240
260
|
textAlign: 'start',
|
|
241
|
-
messages: []
|
|
242
|
-
inputRef: function (input) {},
|
|
243
|
-
inputContainerRef: function (container) {},
|
|
244
|
-
onChange: function (event, value) {},
|
|
245
|
-
onBlur: function (event) {},
|
|
246
|
-
onFocus: function (event) {}
|
|
261
|
+
messages: []
|
|
247
262
|
}, _temp)) || _class) || _class);
|
|
248
263
|
exports.TextInput = TextInput;
|
|
249
264
|
var _default = TextInput;
|
package/lib/TextInput/props.js
CHANGED
|
@@ -37,131 +37,28 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
|
37
37
|
* SOFTWARE.
|
|
38
38
|
*/
|
|
39
39
|
const propTypes = {
|
|
40
|
-
/**
|
|
41
|
-
* The form field label.
|
|
42
|
-
*/
|
|
43
40
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Determines the underlying native HTML `<input>` element's `type`.
|
|
47
|
-
* For more see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url
|
|
48
|
-
*/
|
|
49
41
|
type: _propTypes.default.oneOf(['text', 'email', 'url', 'tel', 'search', 'password']),
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The id of the text input. One is generated if not supplied.
|
|
53
|
-
*/
|
|
54
42
|
id: _propTypes.default.string,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* the selected value (must be accompanied by an `onChange` prop)
|
|
58
|
-
*/
|
|
59
43
|
value: (0, _controllable.controllable)(_propTypes.default.string),
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* value to set on initial render
|
|
63
|
-
*/
|
|
64
44
|
defaultValue: _propTypes.default.string,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
68
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
69
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
70
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
71
|
-
*/
|
|
72
45
|
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* object with shape: `{
|
|
76
|
-
* text: PropTypes.node,
|
|
77
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
78
|
-
* }`
|
|
79
|
-
*/
|
|
80
46
|
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* The size of the text input.
|
|
84
|
-
*/
|
|
85
47
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The text alignment of the input.
|
|
89
|
-
*/
|
|
90
48
|
textAlign: _propTypes.default.oneOf(['start', 'center']),
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* The width of the input.
|
|
94
|
-
*/
|
|
95
49
|
width: _propTypes.default.string,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The width of the input, in characters, if a width is not explicitly
|
|
99
|
-
* provided via the `width` prop. Only applicable if `isInline={true}`.
|
|
100
|
-
*/
|
|
101
|
-
htmlSize: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* The display of the root element.
|
|
105
|
-
*/
|
|
50
|
+
htmlSize: _propTypes.default.number,
|
|
106
51
|
display: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Prevents the default behavior of wrapping the input and rendered content
|
|
110
|
-
* when available space is exceeded.
|
|
111
|
-
*/
|
|
112
52
|
shouldNotWrap: _propTypes.default.bool,
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Html placeholder text to display when the input has no value. This should be hint text, not a label
|
|
116
|
-
* replacement.
|
|
117
|
-
*/
|
|
118
53
|
placeholder: _propTypes.default.string,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Whether or not the text input is required.
|
|
122
|
-
*/
|
|
123
54
|
isRequired: _propTypes.default.bool,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* provides a reference to the underlying html root element
|
|
127
|
-
*/
|
|
128
55
|
elementRef: _propTypes.default.func,
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* a function that provides a reference to the actual input element
|
|
132
|
-
*/
|
|
133
56
|
inputRef: _propTypes.default.func,
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* a function that provides a reference a parent of the input element
|
|
137
|
-
*/
|
|
138
57
|
inputContainerRef: _propTypes.default.func,
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Content to display before the input text, such as an icon
|
|
142
|
-
*/
|
|
143
58
|
renderBeforeInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Content to display after the input text, such as an icon
|
|
147
|
-
*/
|
|
148
59
|
renderAfterInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Callback executed when the input fires a change event.
|
|
152
|
-
* @param {Object} event - the event object
|
|
153
|
-
* @param {Object} value - the string value of the input
|
|
154
|
-
*/
|
|
155
60
|
onChange: _propTypes.default.func,
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Callback fired when input loses focus.
|
|
159
|
-
*/
|
|
160
61
|
onBlur: _propTypes.default.func,
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Callback fired when input receives focus.
|
|
164
|
-
*/
|
|
165
62
|
onFocus: _propTypes.default.func
|
|
166
63
|
};
|
|
167
64
|
exports.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-text-input",
|
|
3
|
-
"version": "8.13.
|
|
3
|
+
"version": "8.13.1-snapshot.10+0ceb70745",
|
|
4
4
|
"description": "A styled HTML text input component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.13.
|
|
28
|
-
"@instructure/ui-badge": "8.13.
|
|
29
|
-
"@instructure/ui-color-utils": "8.13.
|
|
30
|
-
"@instructure/ui-test-utils": "8.13.
|
|
31
|
-
"@instructure/ui-themes": "8.13.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.13.1-snapshot.10+0ceb70745",
|
|
28
|
+
"@instructure/ui-badge": "8.13.1-snapshot.10+0ceb70745",
|
|
29
|
+
"@instructure/ui-color-utils": "8.13.1-snapshot.10+0ceb70745",
|
|
30
|
+
"@instructure/ui-test-utils": "8.13.1-snapshot.10+0ceb70745",
|
|
31
|
+
"@instructure/ui-themes": "8.13.1-snapshot.10+0ceb70745"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.13.10",
|
|
35
|
-
"@instructure/emotion": "8.13.
|
|
36
|
-
"@instructure/shared-types": "8.13.
|
|
37
|
-
"@instructure/ui-dom-utils": "8.13.
|
|
38
|
-
"@instructure/ui-form-field": "8.13.
|
|
39
|
-
"@instructure/ui-icons": "8.13.
|
|
40
|
-
"@instructure/ui-prop-types": "8.13.
|
|
41
|
-
"@instructure/ui-react-utils": "8.13.
|
|
42
|
-
"@instructure/ui-tag": "8.13.
|
|
43
|
-
"@instructure/ui-testable": "8.13.
|
|
44
|
-
"@instructure/ui-utils": "8.13.
|
|
45
|
-
"@instructure/uid": "8.13.
|
|
35
|
+
"@instructure/emotion": "8.13.1-snapshot.10+0ceb70745",
|
|
36
|
+
"@instructure/shared-types": "8.13.1-snapshot.10+0ceb70745",
|
|
37
|
+
"@instructure/ui-dom-utils": "8.13.1-snapshot.10+0ceb70745",
|
|
38
|
+
"@instructure/ui-form-field": "8.13.1-snapshot.10+0ceb70745",
|
|
39
|
+
"@instructure/ui-icons": "8.13.1-snapshot.10+0ceb70745",
|
|
40
|
+
"@instructure/ui-prop-types": "8.13.1-snapshot.10+0ceb70745",
|
|
41
|
+
"@instructure/ui-react-utils": "8.13.1-snapshot.10+0ceb70745",
|
|
42
|
+
"@instructure/ui-tag": "8.13.1-snapshot.10+0ceb70745",
|
|
43
|
+
"@instructure/ui-testable": "8.13.1-snapshot.10+0ceb70745",
|
|
44
|
+
"@instructure/ui-utils": "8.13.1-snapshot.10+0ceb70745",
|
|
45
|
+
"@instructure/uid": "8.13.1-snapshot.10+0ceb70745",
|
|
46
46
|
"prop-types": "^15"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -51,5 +51,6 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"sideEffects": false
|
|
54
|
+
"sideEffects": false,
|
|
55
|
+
"gitHead": "0ceb7074574b9c3a7249eecab3d1ac0e7175a5dd"
|
|
55
56
|
}
|