@instructure/ui-text-input 10.13.0 → 10.13.1-pr-snapshot-1741357986437
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
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
|
+
## [10.13.1-pr-snapshot-1741357986437](https://github.com/instructure/instructure-ui/compare/v10.13.0...v10.13.1-pr-snapshot-1741357986437) (2025-03-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-text-input
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [10.13.0](https://github.com/instructure/instructure-ui/compare/v10.12.0...v10.13.0) (2025-03-06)
|
|
7
15
|
|
|
8
16
|
|
|
@@ -6,7 +6,7 @@ var _react2 = require("@testing-library/react");
|
|
|
6
6
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
7
7
|
var _vitest = require("vitest");
|
|
8
8
|
require("@testing-library/jest-dom");
|
|
9
|
-
var
|
|
9
|
+
var _uiAxeCheck = require("@instructure/ui-axe-check");
|
|
10
10
|
var _index = require("../index");
|
|
11
11
|
var _TextInput, _TextInput2, _TextInput3, _TextInput4, _TextInput5, _TextInput6, _TextInput7;
|
|
12
12
|
/*
|
|
@@ -177,7 +177,7 @@ describe('<TextInput/>', () => {
|
|
|
177
177
|
renderLabel: "Name"
|
|
178
178
|
}))),
|
|
179
179
|
container = _render2.container;
|
|
180
|
-
const axeCheck = await (0,
|
|
180
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container);
|
|
181
181
|
expect(axeCheck).toBe(true);
|
|
182
182
|
});
|
|
183
183
|
it('should set aria-invalid when errors prop is set', async () => {
|
package/lib/TextInput/index.js
CHANGED
|
@@ -8,16 +8,12 @@ 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
|
-
var
|
|
16
|
+
var _uiA11yUtils = require("@instructure/ui-a11y-utils");
|
|
21
17
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
22
18
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
23
19
|
var _props = require("./props");
|
|
@@ -53,7 +49,7 @@ category: components
|
|
|
53
49
|
tags: form, field
|
|
54
50
|
---
|
|
55
51
|
**/
|
|
56
|
-
let TextInput = exports.TextInput = (_dec = (0,
|
|
52
|
+
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 = (_TextInput = class TextInput extends _react.Component {
|
|
57
53
|
constructor(props) {
|
|
58
54
|
super(props);
|
|
59
55
|
this.ref = null;
|
|
@@ -119,7 +115,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
119
115
|
componentDidMount() {
|
|
120
116
|
var _this$props$makeStyle, _this$props;
|
|
121
117
|
if (this._input) {
|
|
122
|
-
this._focusListener = (0,
|
|
118
|
+
this._focusListener = (0, _uiDomUtils.addEventListener)(this._input, 'focus', this.handleFocus);
|
|
123
119
|
this.setState({
|
|
124
120
|
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
125
121
|
});
|
|
@@ -138,9 +134,9 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
138
134
|
afterElementHasWidth: this.getElementHasWidth(this._afterElement)
|
|
139
135
|
});
|
|
140
136
|
}
|
|
141
|
-
if ((0,
|
|
137
|
+
if ((0, _uiReactUtils.getInteraction)({
|
|
142
138
|
props: prevProps
|
|
143
|
-
}) !== 'disabled' && (0,
|
|
139
|
+
}) !== 'disabled' && (0, _uiReactUtils.getInteraction)({
|
|
144
140
|
props: this.props
|
|
145
141
|
}) === 'disabled') {
|
|
146
142
|
this.setState({
|
|
@@ -154,7 +150,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
154
150
|
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
155
151
|
}
|
|
156
152
|
get interaction() {
|
|
157
|
-
return (0,
|
|
153
|
+
return (0, _uiReactUtils.getInteraction)({
|
|
158
154
|
props: this.props
|
|
159
155
|
});
|
|
160
156
|
}
|
|
@@ -167,7 +163,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
167
163
|
}) >= 0;
|
|
168
164
|
}
|
|
169
165
|
get focused() {
|
|
170
|
-
return (0,
|
|
166
|
+
return (0, _uiDomUtils.isActiveElement)(this._input);
|
|
171
167
|
}
|
|
172
168
|
get value() {
|
|
173
169
|
var _this$_input2;
|
|
@@ -190,7 +186,7 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
190
186
|
isRequired = _this$props3.isRequired,
|
|
191
187
|
onFocus = _this$props3.onFocus,
|
|
192
188
|
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
193
|
-
const props = (0,
|
|
189
|
+
const props = (0, _uiReactUtils.passthroughProps)(rest);
|
|
194
190
|
const interaction = this.interaction;
|
|
195
191
|
let descriptionIds = '';
|
|
196
192
|
if (props['aria-describedby']) {
|
|
@@ -243,15 +239,15 @@ let TextInput = exports.TextInput = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
243
239
|
inputContainerRef = _this$props4.inputContainerRef,
|
|
244
240
|
isRequired = _this$props4.isRequired,
|
|
245
241
|
styles = _this$props4.styles;
|
|
246
|
-
const beforeElement = renderBeforeInput ? (0,
|
|
247
|
-
const afterElement = renderAfterInput ? (0,
|
|
242
|
+
const beforeElement = renderBeforeInput ? (0, _uiReactUtils.callRenderProp)(renderBeforeInput) : null;
|
|
243
|
+
const afterElement = renderAfterInput ? (0, _uiReactUtils.callRenderProp)(renderAfterInput) : null;
|
|
248
244
|
const renderBeforeOrAfter = !!beforeElement || !!afterElement;
|
|
249
|
-
const rawLabel = (0,
|
|
250
|
-
const label = (0,
|
|
245
|
+
const rawLabel = (0, _uiReactUtils.callRenderProp)(renderLabel);
|
|
246
|
+
const label = (0, _uiA11yUtils.hasVisibleChildren)(rawLabel) ? (0, _emotion.jsx)(_react.default.Fragment, null, rawLabel, isRequired && (0, _emotion.jsx)("span", {
|
|
251
247
|
css: this.invalid ? styles === null || styles === void 0 ? void 0 : styles.requiredInvalid : {},
|
|
252
248
|
"aria-hidden": true
|
|
253
249
|
}, ' ', "*")) : rawLabel;
|
|
254
|
-
return (0, _emotion.jsx)(
|
|
250
|
+
return (0, _emotion.jsx)(_uiFormField.FormField, {
|
|
255
251
|
id: this.id,
|
|
256
252
|
label: label,
|
|
257
253
|
messagesId: this._messagesId,
|
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": "10.13.
|
|
3
|
+
"version": "10.13.1-pr-snapshot-1741357986437",
|
|
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,12 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "10.13.
|
|
27
|
-
"@instructure/ui-babel-preset": "10.13.
|
|
28
|
-
"@instructure/ui-badge": "10.13.
|
|
29
|
-
"@instructure/ui-color-utils": "10.13.
|
|
30
|
-
"@instructure/ui-test-utils": "10.13.
|
|
31
|
-
"@instructure/ui-themes": "10.13.
|
|
26
|
+
"@instructure/ui-axe-check": "10.13.1-pr-snapshot-1741357986437",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.13.1-pr-snapshot-1741357986437",
|
|
28
|
+
"@instructure/ui-badge": "10.13.1-pr-snapshot-1741357986437",
|
|
29
|
+
"@instructure/ui-color-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
30
|
+
"@instructure/ui-test-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
31
|
+
"@instructure/ui-themes": "10.13.1-pr-snapshot-1741357986437",
|
|
32
32
|
"@testing-library/jest-dom": "^6.6.3",
|
|
33
33
|
"@testing-library/react": "^16.0.1",
|
|
34
34
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/runtime": "^7.26.0",
|
|
39
|
-
"@instructure/emotion": "10.13.
|
|
40
|
-
"@instructure/shared-types": "10.13.
|
|
41
|
-
"@instructure/ui-dom-utils": "10.13.
|
|
42
|
-
"@instructure/ui-form-field": "10.13.
|
|
43
|
-
"@instructure/ui-icons": "10.13.
|
|
44
|
-
"@instructure/ui-prop-types": "10.13.
|
|
45
|
-
"@instructure/ui-react-utils": "10.13.
|
|
46
|
-
"@instructure/ui-tag": "10.13.
|
|
47
|
-
"@instructure/ui-testable": "10.13.
|
|
39
|
+
"@instructure/emotion": "10.13.1-pr-snapshot-1741357986437",
|
|
40
|
+
"@instructure/shared-types": "10.13.1-pr-snapshot-1741357986437",
|
|
41
|
+
"@instructure/ui-dom-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
42
|
+
"@instructure/ui-form-field": "10.13.1-pr-snapshot-1741357986437",
|
|
43
|
+
"@instructure/ui-icons": "10.13.1-pr-snapshot-1741357986437",
|
|
44
|
+
"@instructure/ui-prop-types": "10.13.1-pr-snapshot-1741357986437",
|
|
45
|
+
"@instructure/ui-react-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
46
|
+
"@instructure/ui-tag": "10.13.1-pr-snapshot-1741357986437",
|
|
47
|
+
"@instructure/ui-testable": "10.13.1-pr-snapshot-1741357986437",
|
|
48
48
|
"prop-types": "^15.8.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|