@instructure/ui-text-input 8.56.2-pr-snapshot-1721749364069 → 8.56.2
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 +1 -1
- package/lib/TextInput/index.js +19 -15
- package/lib/TextInput/props.js +4 -4
- package/package.json +15 -15
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
|
6
|
+
## [8.56.2](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2) (2024-08-06)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-text-input
|
|
9
9
|
|
package/lib/TextInput/index.js
CHANGED
|
@@ -8,10 +8,14 @@ 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
|
|
11
|
+
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
12
|
+
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
13
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
14
|
+
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
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");
|
|
15
19
|
var _emotion = require("@instructure/emotion");
|
|
16
20
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
17
21
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -48,7 +52,7 @@ category: components
|
|
|
48
52
|
tags: form, field
|
|
49
53
|
---
|
|
50
54
|
**/
|
|
51
|
-
let TextInput = exports.TextInput = (_dec = (0,
|
|
55
|
+
let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TextInput extends _react.Component {
|
|
52
56
|
constructor(props) {
|
|
53
57
|
super(props);
|
|
54
58
|
this.ref = null;
|
|
@@ -117,7 +121,7 @@ let TextInput = exports.TextInput = (_dec = (0, _uiReactUtils.withDeterministicI
|
|
|
117
121
|
componentDidMount() {
|
|
118
122
|
var _this$props$makeStyle, _this$props;
|
|
119
123
|
if (this._input) {
|
|
120
|
-
this._focusListener = (0,
|
|
124
|
+
this._focusListener = (0, _addEventListener.addEventListener)(this._input, 'focus', this.handleFocus);
|
|
121
125
|
this.setState({
|
|
122
126
|
beforeElementHasWidth: this.getElementHasWidth(this._beforeElement),
|
|
123
127
|
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
@@ -142,9 +146,9 @@ let TextInput = exports.TextInput = (_dec = (0, _uiReactUtils.withDeterministicI
|
|
|
142
146
|
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
|
-
if ((0,
|
|
149
|
+
if ((0, _getInteraction.getInteraction)({
|
|
146
150
|
props: prevProps
|
|
147
|
-
}) !== 'disabled' && (0,
|
|
151
|
+
}) !== 'disabled' && (0, _getInteraction.getInteraction)({
|
|
148
152
|
props: this.props
|
|
149
153
|
}) === 'disabled') {
|
|
150
154
|
this.setState({
|
|
@@ -158,7 +162,7 @@ let TextInput = exports.TextInput = (_dec = (0, _uiReactUtils.withDeterministicI
|
|
|
158
162
|
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
159
163
|
}
|
|
160
164
|
get interaction() {
|
|
161
|
-
return (0,
|
|
165
|
+
return (0, _getInteraction.getInteraction)({
|
|
162
166
|
props: this.props
|
|
163
167
|
});
|
|
164
168
|
}
|
|
@@ -171,7 +175,7 @@ let TextInput = exports.TextInput = (_dec = (0, _uiReactUtils.withDeterministicI
|
|
|
171
175
|
}) >= 0;
|
|
172
176
|
}
|
|
173
177
|
get focused() {
|
|
174
|
-
return (0,
|
|
178
|
+
return (0, _isActiveElement.isActiveElement)(this._input);
|
|
175
179
|
}
|
|
176
180
|
get value() {
|
|
177
181
|
var _this$_input2;
|
|
@@ -194,7 +198,7 @@ let TextInput = exports.TextInput = (_dec = (0, _uiReactUtils.withDeterministicI
|
|
|
194
198
|
isRequired = _this$props3.isRequired,
|
|
195
199
|
onFocus = _this$props3.onFocus,
|
|
196
200
|
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
197
|
-
const props = (0,
|
|
201
|
+
const props = (0, _passthroughProps.passthroughProps)(rest);
|
|
198
202
|
const interaction = this.interaction;
|
|
199
203
|
let descriptionIds = '';
|
|
200
204
|
if (props['aria-describedby']) {
|
|
@@ -249,12 +253,12 @@ let TextInput = exports.TextInput = (_dec = (0, _uiReactUtils.withDeterministicI
|
|
|
249
253
|
messages = _this$props4.messages,
|
|
250
254
|
inputContainerRef = _this$props4.inputContainerRef,
|
|
251
255
|
styles = _this$props4.styles;
|
|
252
|
-
const beforeElement = renderBeforeInput ? (0,
|
|
253
|
-
const afterElement = renderAfterInput ? (0,
|
|
256
|
+
const beforeElement = renderBeforeInput ? (0, _callRenderProp.callRenderProp)(renderBeforeInput) : null;
|
|
257
|
+
const afterElement = renderAfterInput ? (0, _callRenderProp.callRenderProp)(renderAfterInput) : null;
|
|
254
258
|
const renderBeforeOrAfter = !!beforeElement || !!afterElement;
|
|
255
|
-
return (0, _emotion.jsx)(
|
|
259
|
+
return (0, _emotion.jsx)(_FormField.FormField, {
|
|
256
260
|
id: this.id,
|
|
257
|
-
label: (0,
|
|
261
|
+
label: (0, _callRenderProp.callRenderProp)(renderLabel),
|
|
258
262
|
messagesId: this._messagesId,
|
|
259
263
|
messages: messages,
|
|
260
264
|
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 _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
|
|
10
|
+
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
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, _controllable.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(_FormPropTypes.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.2
|
|
3
|
+
"version": "8.56.2",
|
|
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.2
|
|
27
|
-
"@instructure/ui-badge": "8.56.2
|
|
28
|
-
"@instructure/ui-color-utils": "8.56.2
|
|
29
|
-
"@instructure/ui-test-utils": "8.56.2
|
|
30
|
-
"@instructure/ui-themes": "8.56.2
|
|
26
|
+
"@instructure/ui-babel-preset": "8.56.2",
|
|
27
|
+
"@instructure/ui-badge": "8.56.2",
|
|
28
|
+
"@instructure/ui-color-utils": "8.56.2",
|
|
29
|
+
"@instructure/ui-test-utils": "8.56.2",
|
|
30
|
+
"@instructure/ui-themes": "8.56.2",
|
|
31
31
|
"react-dom": "^18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.23.2",
|
|
35
|
-
"@instructure/emotion": "8.56.2
|
|
36
|
-
"@instructure/shared-types": "8.56.2
|
|
37
|
-
"@instructure/ui-dom-utils": "8.56.2
|
|
38
|
-
"@instructure/ui-form-field": "8.56.2
|
|
39
|
-
"@instructure/ui-icons": "8.56.2
|
|
40
|
-
"@instructure/ui-prop-types": "8.56.2
|
|
41
|
-
"@instructure/ui-react-utils": "8.56.2
|
|
42
|
-
"@instructure/ui-tag": "8.56.2
|
|
43
|
-
"@instructure/ui-testable": "8.56.2
|
|
35
|
+
"@instructure/emotion": "8.56.2",
|
|
36
|
+
"@instructure/shared-types": "8.56.2",
|
|
37
|
+
"@instructure/ui-dom-utils": "8.56.2",
|
|
38
|
+
"@instructure/ui-form-field": "8.56.2",
|
|
39
|
+
"@instructure/ui-icons": "8.56.2",
|
|
40
|
+
"@instructure/ui-prop-types": "8.56.2",
|
|
41
|
+
"@instructure/ui-react-utils": "8.56.2",
|
|
42
|
+
"@instructure/ui-tag": "8.56.2",
|
|
43
|
+
"@instructure/ui-testable": "8.56.2",
|
|
44
44
|
"prop-types": "^15.8.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|