@instructure/ui-text-input 8.56.1 → 8.56.2-pr-snapshot-1721749364069
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/TextInput/index.js +15 -19
- package/lib/TextInput/props.js +4 -4
- package/package.json +15 -15
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
|
+
## [8.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-text-input
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-text-input
|
package/lib/TextInput/index.js
CHANGED
|
@@ -8,14 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.TextInput = void 0;
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
16
|
-
var _addEventListener = require("@instructure/ui-dom-utils/lib/addEventListener.js");
|
|
17
|
-
var _FormField = require("@instructure/ui-form-field/lib/FormField");
|
|
18
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
13
|
+
var _uiFormField = require("@instructure/ui-form-field");
|
|
14
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
19
15
|
var _emotion = require("@instructure/emotion");
|
|
20
16
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
21
17
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -52,7 +48,7 @@ category: components
|
|
|
52
48
|
tags: form, field
|
|
53
49
|
---
|
|
54
50
|
**/
|
|
55
|
-
let TextInput = exports.TextInput = (_dec = (0,
|
|
51
|
+
let TextInput = exports.TextInput = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TextInput extends _react.Component {
|
|
56
52
|
constructor(props) {
|
|
57
53
|
super(props);
|
|
58
54
|
this.ref = null;
|
|
@@ -121,7 +117,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
121
117
|
componentDidMount() {
|
|
122
118
|
var _this$props$makeStyle, _this$props;
|
|
123
119
|
if (this._input) {
|
|
124
|
-
this._focusListener = (0,
|
|
120
|
+
this._focusListener = (0, _uiDomUtils.addEventListener)(this._input, 'focus', this.handleFocus);
|
|
125
121
|
this.setState({
|
|
126
122
|
beforeElementHasWidth: this.getElementHasWidth(this._beforeElement),
|
|
127
123
|
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
@@ -146,9 +142,9 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
146
142
|
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
147
143
|
});
|
|
148
144
|
}
|
|
149
|
-
if ((0,
|
|
145
|
+
if ((0, _uiReactUtils.getInteraction)({
|
|
150
146
|
props: prevProps
|
|
151
|
-
}) !== 'disabled' && (0,
|
|
147
|
+
}) !== 'disabled' && (0, _uiReactUtils.getInteraction)({
|
|
152
148
|
props: this.props
|
|
153
149
|
}) === 'disabled') {
|
|
154
150
|
this.setState({
|
|
@@ -162,7 +158,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
162
158
|
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
163
159
|
}
|
|
164
160
|
get interaction() {
|
|
165
|
-
return (0,
|
|
161
|
+
return (0, _uiReactUtils.getInteraction)({
|
|
166
162
|
props: this.props
|
|
167
163
|
});
|
|
168
164
|
}
|
|
@@ -175,7 +171,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
175
171
|
}) >= 0;
|
|
176
172
|
}
|
|
177
173
|
get focused() {
|
|
178
|
-
return (0,
|
|
174
|
+
return (0, _uiDomUtils.isActiveElement)(this._input);
|
|
179
175
|
}
|
|
180
176
|
get value() {
|
|
181
177
|
var _this$_input2;
|
|
@@ -198,7 +194,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
198
194
|
isRequired = _this$props3.isRequired,
|
|
199
195
|
onFocus = _this$props3.onFocus,
|
|
200
196
|
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
201
|
-
const props = (0,
|
|
197
|
+
const props = (0, _uiReactUtils.passthroughProps)(rest);
|
|
202
198
|
const interaction = this.interaction;
|
|
203
199
|
let descriptionIds = '';
|
|
204
200
|
if (props['aria-describedby']) {
|
|
@@ -253,12 +249,12 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
253
249
|
messages = _this$props4.messages,
|
|
254
250
|
inputContainerRef = _this$props4.inputContainerRef,
|
|
255
251
|
styles = _this$props4.styles;
|
|
256
|
-
const beforeElement = renderBeforeInput ? (0,
|
|
257
|
-
const afterElement = renderAfterInput ? (0,
|
|
252
|
+
const beforeElement = renderBeforeInput ? (0, _uiReactUtils.callRenderProp)(renderBeforeInput) : null;
|
|
253
|
+
const afterElement = renderAfterInput ? (0, _uiReactUtils.callRenderProp)(renderAfterInput) : null;
|
|
258
254
|
const renderBeforeOrAfter = !!beforeElement || !!afterElement;
|
|
259
|
-
return (0, _emotion.jsx)(
|
|
255
|
+
return (0, _emotion.jsx)(_uiFormField.FormField, {
|
|
260
256
|
id: this.id,
|
|
261
|
-
label: (0,
|
|
257
|
+
label: (0, _uiReactUtils.callRenderProp)(renderLabel),
|
|
262
258
|
messagesId: this._messagesId,
|
|
263
259
|
messages: messages,
|
|
264
260
|
inline: display === 'inline-block',
|
package/lib/TextInput/props.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _uiFormField = require("@instructure/ui-form-field");
|
|
10
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
13
13
|
*
|
|
@@ -36,10 +36,10 @@ const propTypes = exports.propTypes = {
|
|
|
36
36
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
37
37
|
type: _propTypes.default.oneOf(['text', 'email', 'url', 'tel', 'search', 'password']),
|
|
38
38
|
id: _propTypes.default.string,
|
|
39
|
-
value: (0,
|
|
39
|
+
value: (0, _uiPropTypes.controllable)(_propTypes.default.string),
|
|
40
40
|
defaultValue: _propTypes.default.string,
|
|
41
41
|
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
42
|
-
messages: _propTypes.default.arrayOf(
|
|
42
|
+
messages: _propTypes.default.arrayOf(_uiFormField.FormPropTypes.message),
|
|
43
43
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
44
44
|
textAlign: _propTypes.default.oneOf(['start', 'center']),
|
|
45
45
|
width: _propTypes.default.string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-text-input",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
4
4
|
"description": "A styled HTML text input component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
27
|
-
"@instructure/ui-badge": "8.56.
|
|
28
|
-
"@instructure/ui-color-utils": "8.56.
|
|
29
|
-
"@instructure/ui-test-utils": "8.56.
|
|
30
|
-
"@instructure/ui-themes": "8.56.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
27
|
+
"@instructure/ui-badge": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/ui-color-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069",
|
|
31
31
|
"react-dom": "^18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.23.2",
|
|
35
|
-
"@instructure/emotion": "8.56.
|
|
36
|
-
"@instructure/shared-types": "8.56.
|
|
37
|
-
"@instructure/ui-dom-utils": "8.56.
|
|
38
|
-
"@instructure/ui-form-field": "8.56.
|
|
39
|
-
"@instructure/ui-icons": "8.56.
|
|
40
|
-
"@instructure/ui-prop-types": "8.56.
|
|
41
|
-
"@instructure/ui-react-utils": "8.56.
|
|
42
|
-
"@instructure/ui-tag": "8.56.
|
|
43
|
-
"@instructure/ui-testable": "8.56.
|
|
35
|
+
"@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
|
|
36
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
37
|
+
"@instructure/ui-dom-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
38
|
+
"@instructure/ui-form-field": "8.56.2-pr-snapshot-1721749364069",
|
|
39
|
+
"@instructure/ui-icons": "8.56.2-pr-snapshot-1721749364069",
|
|
40
|
+
"@instructure/ui-prop-types": "8.56.2-pr-snapshot-1721749364069",
|
|
41
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
42
|
+
"@instructure/ui-tag": "8.56.2-pr-snapshot-1721749364069",
|
|
43
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
44
44
|
"prop-types": "^15.8.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|