@instructure/ui-text-input 8.20.0 → 8.20.1-snapshot.19
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 +13 -3
- package/lib/TextInput/index.js +14 -2
- package/package.json +17 -16
- package/src/TextInput/index.tsx +15 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TextInput/index.d.ts +2 -0
- package/types/TextInput/index.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
|
@@ -30,7 +30,7 @@ var _dec, _dec2, _dec3, _class, _class2, _temp;
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import React, { Component } from 'react';
|
|
32
32
|
import { callRenderProp, getInteraction, passthroughProps, withDeterministicId } from '@instructure/ui-react-utils';
|
|
33
|
-
import { isActiveElement } from '@instructure/ui-dom-utils';
|
|
33
|
+
import { isActiveElement, addEventListener } from '@instructure/ui-dom-utils';
|
|
34
34
|
import { FormField } from '@instructure/ui-form-field';
|
|
35
35
|
import { testable } from '@instructure/ui-testable';
|
|
36
36
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
@@ -52,6 +52,7 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
52
52
|
this._input = null;
|
|
53
53
|
this._defaultId = void 0;
|
|
54
54
|
this._messagesId = void 0;
|
|
55
|
+
this._focusListener = null;
|
|
55
56
|
|
|
56
57
|
this.handleRef = el => {
|
|
57
58
|
const elementRef = this.props.elementRef;
|
|
@@ -116,6 +117,16 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
116
117
|
var _this$props$makeStyle, _this$props;
|
|
117
118
|
|
|
118
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());
|
|
120
|
+
|
|
121
|
+
if (this._input) {
|
|
122
|
+
this._focusListener = addEventListener(this._input, 'focus', this.handleFocus);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
componentWillUnmount() {
|
|
127
|
+
if (this._focusListener) {
|
|
128
|
+
this._focusListener.remove();
|
|
129
|
+
}
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
componentDidUpdate() {
|
|
@@ -202,8 +213,7 @@ let TextInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
202
213
|
"aria-describedby": descriptionIds !== '' ? descriptionIds : void 0,
|
|
203
214
|
size: htmlSize,
|
|
204
215
|
onChange: this.handleChange,
|
|
205
|
-
onBlur: this.handleBlur
|
|
206
|
-
onFocus: this.handleFocus
|
|
216
|
+
onBlur: this.handleBlur
|
|
207
217
|
}));
|
|
208
218
|
}
|
|
209
219
|
|
package/lib/TextInput/index.js
CHANGED
|
@@ -23,6 +23,8 @@ var _withDeterministicId = require("@instructure/ui-react-utils/lib/Deterministi
|
|
|
23
23
|
|
|
24
24
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
25
25
|
|
|
26
|
+
var _addEventListener = require("@instructure/ui-dom-utils/lib/addEventListener.js");
|
|
27
|
+
|
|
26
28
|
var _FormField = require("@instructure/ui-form-field/lib/FormField");
|
|
27
29
|
|
|
28
30
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
@@ -53,6 +55,7 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
53
55
|
this._input = null;
|
|
54
56
|
this._defaultId = void 0;
|
|
55
57
|
this._messagesId = void 0;
|
|
58
|
+
this._focusListener = null;
|
|
56
59
|
|
|
57
60
|
this.handleRef = el => {
|
|
58
61
|
const elementRef = this.props.elementRef;
|
|
@@ -117,6 +120,16 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
117
120
|
var _this$props$makeStyle, _this$props;
|
|
118
121
|
|
|
119
122
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
|
|
123
|
+
|
|
124
|
+
if (this._input) {
|
|
125
|
+
this._focusListener = (0, _addEventListener.addEventListener)(this._input, 'focus', this.handleFocus);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
componentWillUnmount() {
|
|
130
|
+
if (this._focusListener) {
|
|
131
|
+
this._focusListener.remove();
|
|
132
|
+
}
|
|
120
133
|
}
|
|
121
134
|
|
|
122
135
|
componentDidUpdate() {
|
|
@@ -202,8 +215,7 @@ let TextInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
202
215
|
"aria-describedby": descriptionIds !== '' ? descriptionIds : void 0,
|
|
203
216
|
size: htmlSize,
|
|
204
217
|
onChange: this.handleChange,
|
|
205
|
-
onBlur: this.handleBlur
|
|
206
|
-
onFocus: this.handleFocus
|
|
218
|
+
onBlur: this.handleBlur
|
|
207
219
|
}));
|
|
208
220
|
}
|
|
209
221
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-text-input",
|
|
3
|
-
"version": "8.20.
|
|
3
|
+
"version": "8.20.1-snapshot.19+002505b76",
|
|
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,23 +23,23 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.20.
|
|
27
|
-
"@instructure/ui-badge": "8.20.
|
|
28
|
-
"@instructure/ui-color-utils": "8.20.
|
|
29
|
-
"@instructure/ui-test-utils": "8.20.
|
|
30
|
-
"@instructure/ui-themes": "8.20.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.20.1-snapshot.19+002505b76",
|
|
27
|
+
"@instructure/ui-badge": "8.20.1-snapshot.19+002505b76",
|
|
28
|
+
"@instructure/ui-color-utils": "8.20.1-snapshot.19+002505b76",
|
|
29
|
+
"@instructure/ui-test-utils": "8.20.1-snapshot.19+002505b76",
|
|
30
|
+
"@instructure/ui-themes": "8.20.1-snapshot.19+002505b76"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.20.
|
|
35
|
-
"@instructure/shared-types": "8.20.
|
|
36
|
-
"@instructure/ui-dom-utils": "8.20.
|
|
37
|
-
"@instructure/ui-form-field": "8.20.
|
|
38
|
-
"@instructure/ui-icons": "8.20.
|
|
39
|
-
"@instructure/ui-prop-types": "8.20.
|
|
40
|
-
"@instructure/ui-react-utils": "8.20.
|
|
41
|
-
"@instructure/ui-tag": "8.20.
|
|
42
|
-
"@instructure/ui-testable": "8.20.
|
|
34
|
+
"@instructure/emotion": "8.20.1-snapshot.19+002505b76",
|
|
35
|
+
"@instructure/shared-types": "8.20.1-snapshot.19+002505b76",
|
|
36
|
+
"@instructure/ui-dom-utils": "8.20.1-snapshot.19+002505b76",
|
|
37
|
+
"@instructure/ui-form-field": "8.20.1-snapshot.19+002505b76",
|
|
38
|
+
"@instructure/ui-icons": "8.20.1-snapshot.19+002505b76",
|
|
39
|
+
"@instructure/ui-prop-types": "8.20.1-snapshot.19+002505b76",
|
|
40
|
+
"@instructure/ui-react-utils": "8.20.1-snapshot.19+002505b76",
|
|
41
|
+
"@instructure/ui-tag": "8.20.1-snapshot.19+002505b76",
|
|
42
|
+
"@instructure/ui-testable": "8.20.1-snapshot.19+002505b76",
|
|
43
43
|
"prop-types": "^15"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -48,5 +48,6 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"sideEffects": false
|
|
51
|
+
"sideEffects": false,
|
|
52
|
+
"gitHead": "002505b762a235d29c27eb3fc8b69bcaff7482c2"
|
|
52
53
|
}
|
package/src/TextInput/index.tsx
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
passthroughProps,
|
|
32
32
|
withDeterministicId
|
|
33
33
|
} from '@instructure/ui-react-utils'
|
|
34
|
-
import { isActiveElement } from '@instructure/ui-dom-utils'
|
|
34
|
+
import { isActiveElement, addEventListener } from '@instructure/ui-dom-utils'
|
|
35
35
|
import { FormField } from '@instructure/ui-form-field'
|
|
36
36
|
import { testable } from '@instructure/ui-testable'
|
|
37
37
|
import { withStyle, jsx } from '@instructure/emotion'
|
|
@@ -85,6 +85,7 @@ class TextInput extends Component<TextInputProps, TextInputState> {
|
|
|
85
85
|
private _input: HTMLInputElement | null = null
|
|
86
86
|
private _defaultId: string
|
|
87
87
|
private _messagesId: string
|
|
88
|
+
private _focusListener: { remove(): void } | null = null
|
|
88
89
|
|
|
89
90
|
handleRef = (el: Element | null) => {
|
|
90
91
|
const { elementRef } = this.props
|
|
@@ -97,6 +98,19 @@ class TextInput extends Component<TextInputProps, TextInputState> {
|
|
|
97
98
|
}
|
|
98
99
|
componentDidMount() {
|
|
99
100
|
this.props.makeStyles?.(this.makeStyleProps())
|
|
101
|
+
if (this._input) {
|
|
102
|
+
this._focusListener = addEventListener(
|
|
103
|
+
this._input,
|
|
104
|
+
'focus',
|
|
105
|
+
this.handleFocus
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
componentWillUnmount() {
|
|
111
|
+
if (this._focusListener) {
|
|
112
|
+
this._focusListener.remove()
|
|
113
|
+
}
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
componentDidUpdate() {
|
|
@@ -225,7 +239,6 @@ class TextInput extends Component<TextInputProps, TextInputState> {
|
|
|
225
239
|
size={htmlSize}
|
|
226
240
|
onChange={this.handleChange}
|
|
227
241
|
onBlur={this.handleBlur}
|
|
228
|
-
onFocus={this.handleFocus}
|
|
229
242
|
/>
|
|
230
243
|
)
|
|
231
244
|
}
|