@instructure/ui-text-input 8.13.0 → 8.13.1-snapshot.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.
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  /** @jsx jsx */
26
- import { Component } from 'react'
26
+ import React, { Component } from 'react'
27
27
 
28
28
  import {
29
29
  callRenderProp,
@@ -50,6 +50,7 @@ import { allowedProps, propTypes } from './props'
50
50
  category: components
51
51
  tags: form, field
52
52
  ---
53
+ @tsProps
53
54
  **/
54
55
  @withStyle(generateStyle, generateComponentTheme)
55
56
  @testable()
@@ -68,31 +69,22 @@ class TextInput extends Component<TextInputProps, TextInputState> {
68
69
  shouldNotWrap: false,
69
70
  size: 'medium',
70
71
  textAlign: 'start',
71
- messages: [],
72
- // @ts-expect-error ts-migrate(6133) FIXME: 'input' is declared but its value is never read.
73
- inputRef: function (input) {},
74
- // @ts-expect-error ts-migrate(6133) FIXME: 'container' is declared but its value is never rea... Remove this comment to see the full error message
75
- inputContainerRef: function (container) {},
76
- // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
77
- onChange: function (event, value) {},
78
- // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
79
- onBlur: function (event) {},
80
- // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
81
- onFocus: function (event) {}
72
+ messages: []
82
73
  }
83
74
 
84
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
85
- constructor(props) {
75
+ constructor(props: TextInputProps) {
86
76
  super(props)
87
77
  this.state = { hasFocus: false }
88
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_defaultId' does not exist on type 'Text... Remove this comment to see the full error message
89
78
  this._defaultId = uid('TextInput')
90
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_messagesId' does not exist on type 'Tex... Remove this comment to see the full error message
91
79
  this._messagesId = uid('TextInput-messages')
92
80
  }
93
81
 
94
82
  ref: Element | null = null
95
83
 
84
+ private _input: HTMLInputElement | null = null
85
+ private _defaultId: string
86
+ private _messagesId: string
87
+
96
88
  handleRef = (el: Element | null) => {
97
89
  const { elementRef } = this.props
98
90
 
@@ -106,8 +98,7 @@ class TextInput extends Component<TextInputProps, TextInputState> {
106
98
  this.props.makeStyles?.(this.makeStyleProps())
107
99
  }
108
100
 
109
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
110
- componentDidUpdate(prevProps, prevState, snapshot) {
101
+ componentDidUpdate() {
111
102
  this.props.makeStyles?.(this.makeStyleProps())
112
103
  }
113
104
 
@@ -121,8 +112,7 @@ class TextInput extends Component<TextInputProps, TextInputState> {
121
112
  }
122
113
 
123
114
  focus() {
124
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'TextInpu... Remove this comment to see the full error message
125
- this._input.focus()
115
+ this._input?.focus()
126
116
  }
127
117
 
128
118
  get interaction() {
@@ -130,7 +120,7 @@ class TextInput extends Component<TextInputProps, TextInputState> {
130
120
  }
131
121
 
132
122
  get hasMessages() {
133
- return this.props.messages && this.props.messages.length > 0
123
+ return !!this.props.messages && this.props.messages.length > 0
134
124
  }
135
125
 
136
126
  get invalid() {
@@ -143,47 +133,44 @@ class TextInput extends Component<TextInputProps, TextInputState> {
143
133
  }
144
134
 
145
135
  get focused() {
146
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'TextInpu... Remove this comment to see the full error message
147
136
  return isActiveElement(this._input)
148
137
  }
149
138
 
150
139
  get value() {
151
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'TextInpu... Remove this comment to see the full error message
152
- return this._input.value
140
+ return this._input?.value
153
141
  }
154
142
 
155
143
  get id() {
156
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_defaultId' does not exist on type 'Text... Remove this comment to see the full error message
157
144
  return this.props.id || this._defaultId
158
145
  }
159
146
 
160
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
161
- handleInputRef = (node) => {
162
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'TextInpu... Remove this comment to see the full error message
147
+ handleInputRef = (node: HTMLInputElement | null) => {
163
148
  this._input = node
164
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
165
- this.props.inputRef(node)
149
+
150
+ if (typeof this.props.inputRef === 'function') {
151
+ this.props.inputRef(node)
152
+ }
166
153
  }
167
154
 
168
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'event' implicitly has an 'any' type.
169
- handleChange = (event) => {
170
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
171
- this.props.onChange(event, event.target.value)
155
+ handleChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {
156
+ if (typeof this.props.onChange === 'function') {
157
+ this.props.onChange(event, event.target.value)
158
+ }
172
159
  }
173
160
 
174
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'event' implicitly has an 'any' type.
175
- handleBlur = (event) => {
176
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
177
- this.props.onBlur(event)
161
+ handleBlur: React.FocusEventHandler<HTMLInputElement> = (event) => {
162
+ if (typeof this.props.onBlur === 'function') {
163
+ this.props.onBlur(event)
164
+ }
178
165
  this.setState({
179
166
  hasFocus: false
180
167
  })
181
168
  }
182
169
 
183
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'event' implicitly has an 'any' type.
184
- handleFocus = (event) => {
185
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
186
- this.props.onFocus(event)
170
+ handleFocus: React.FocusEventHandler<HTMLInputElement> = (event) => {
171
+ if (typeof this.props.onFocus === 'function') {
172
+ this.props.onFocus(event)
173
+ }
187
174
  this.setState({
188
175
  hasFocus: true
189
176
  })
@@ -215,10 +202,8 @@ class TextInput extends Component<TextInputProps, TextInputState> {
215
202
  if (this.hasMessages) {
216
203
  descriptionIds =
217
204
  descriptionIds !== ''
218
- ? // @ts-expect-error ts-migrate(2339) FIXME: Property '_messagesId' does not exist on type 'Tex... Remove this comment to see the full error message
219
- `${descriptionIds} ${this._messagesId}`
220
- : // @ts-expect-error ts-migrate(2339) FIXME: Property '_messagesId' does not exist on type 'Tex... Remove this comment to see the full error message
221
- this._messagesId
205
+ ? `${descriptionIds} ${this._messagesId}`
206
+ : this._messagesId
222
207
  }
223
208
 
224
209
  return (
@@ -232,11 +217,10 @@ class TextInput extends Component<TextInputProps, TextInputState> {
232
217
  type={type}
233
218
  id={this.id}
234
219
  required={isRequired}
235
- aria-invalid={this.invalid ? 'true' : null}
220
+ aria-invalid={this.invalid ? 'true' : undefined}
236
221
  disabled={interaction === 'disabled'}
237
222
  readOnly={interaction === 'readonly'}
238
- aria-describedby={descriptionIds !== '' ? descriptionIds : null}
239
- //@ts-expect-error can't be string
223
+ aria-describedby={descriptionIds !== '' ? descriptionIds : undefined}
240
224
  size={htmlSize}
241
225
  onChange={this.handleChange}
242
226
  onBlur={this.handleBlur}
@@ -267,14 +251,12 @@ class TextInput extends Component<TextInputProps, TextInputState> {
267
251
  <FormField
268
252
  id={this.id}
269
253
  label={callRenderProp(renderLabel)}
270
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_messagesId' does not exist on type 'Tex... Remove this comment to see the full error message
271
254
  messagesId={this._messagesId}
272
255
  messages={messages}
273
256
  inline={display === 'inline-block'}
274
257
  width={width}
275
258
  inputContainerRef={inputContainerRef}
276
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'layout' does not exist on type 'Readonly... Remove this comment to see the full error message
277
- layout={this.props.layout} // eslint-disable-line react/prop-types
259
+ layout={this.props.layout}
278
260
  elementRef={this.handleRef}
279
261
  >
280
262
  <span css={styles?.facade}>
@@ -29,7 +29,7 @@ import { FormPropTypes } from '@instructure/ui-form-field'
29
29
  import { controllable } from '@instructure/ui-prop-types'
30
30
 
31
31
  import type { InteractionType } from '@instructure/ui-react-utils'
32
- import type { FormMessage } from '@instructure/ui-form-field'
32
+ import type { FormFieldProps, FormMessage } from '@instructure/ui-form-field'
33
33
  import type {
34
34
  OtherHTMLAttributes,
35
35
  PropValidators,
@@ -38,153 +38,185 @@ import type {
38
38
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
39
39
 
40
40
  type TextInputOwnProps = {
41
- renderLabel?: React.ReactNode | ((...args: any[]) => any)
42
- type?: 'text' | 'email' | 'url' | 'tel' | 'search' | 'password'
43
- id?: string
44
- value?: any // TODO: controllable(PropTypes.string)
45
- defaultValue?: string
46
- interaction?: InteractionType
47
- messages?: FormMessage[]
48
- size?: 'small' | 'medium' | 'large'
49
- textAlign?: 'start' | 'center'
50
- width?: string
51
- htmlSize?: string | number
52
- display?: 'inline-block' | 'block'
53
- shouldNotWrap?: boolean
54
- placeholder?: string
55
- isRequired?: boolean
56
- elementRef?: (element: Element | null) => void
57
- inputRef?: (...args: any[]) => any
58
- inputContainerRef?: (...args: any[]) => any
59
- renderBeforeInput?: React.ReactNode | ((...args: any[]) => any)
60
- renderAfterInput?: React.ReactNode | ((...args: any[]) => any)
61
- onChange?: (...args: any[]) => any
62
- onBlur?: (...args: any[]) => any
63
- onFocus?: (...args: any[]) => any
64
- }
65
-
66
- type PropKeys = keyof TextInputOwnProps
67
-
68
- type AllowedPropKeys = Readonly<Array<PropKeys>>
69
-
70
- type TextInputProps = TextInputOwnProps &
71
- WithStyleProps<TextInputTheme, TextInputStyle> &
72
- OtherHTMLAttributes<TextInputOwnProps, InputHTMLAttributes<TextInputOwnProps>>
73
-
74
- type TextInputStyle = ComponentStyle<
75
- | 'textInput'
76
- | 'facade'
77
- | 'layout'
78
- | 'beforeElement'
79
- | 'innerWrapper'
80
- | 'inputLayout'
81
- | 'afterElement'
82
- >
83
-
84
- const propTypes: PropValidators<PropKeys> = {
85
41
  /**
86
42
  * The form field label.
87
43
  */
88
- renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
44
+ renderLabel?: React.ReactNode | (() => React.ReactNode)
45
+
89
46
  /**
90
47
  * Determines the underlying native HTML `<input>` element's `type`.
48
+ *
91
49
  * For more see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url
92
50
  */
93
- type: PropTypes.oneOf(['text', 'email', 'url', 'tel', 'search', 'password']),
51
+ type?: 'text' | 'email' | 'url' | 'tel' | 'search' | 'password'
52
+
94
53
  /**
95
54
  * The id of the text input. One is generated if not supplied.
96
55
  */
97
- id: PropTypes.string,
56
+ id?: string
57
+
98
58
  /**
99
59
  * the selected value (must be accompanied by an `onChange` prop)
100
60
  */
101
- value: controllable(PropTypes.string),
61
+ value?: string // TODO: controllable(PropTypes.string)
62
+
102
63
  /**
103
64
  * value to set on initial render
104
65
  */
105
- defaultValue: PropTypes.string,
66
+ defaultValue?: string
67
+
106
68
  /**
107
69
  * Specifies if interaction with the input is enabled, disabled, or readonly.
108
70
  * When "disabled", the input changes visibly to indicate that it cannot
109
71
  * receive user interactions. When "readonly" the input still cannot receive
110
72
  * user interactions but it keeps the same styles as if it were enabled.
111
73
  */
112
- interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
74
+ interaction?: InteractionType
75
+
113
76
  /**
114
- * object with shape: `{
115
- * text: PropTypes.node,
116
- * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
117
- * }`
77
+ * Array of objects with shape: `{
78
+ * text: React.ReactNode,
79
+ * type: One of ['error', 'hint', 'success', 'screenreader-only']
80
+ * }`
118
81
  */
119
- messages: PropTypes.arrayOf(FormPropTypes.message),
82
+ messages?: FormMessage[]
83
+
120
84
  /**
121
85
  * The size of the text input.
122
86
  */
123
- size: PropTypes.oneOf(['small', 'medium', 'large']),
87
+ size?: 'small' | 'medium' | 'large'
88
+
124
89
  /**
125
90
  * The text alignment of the input.
126
91
  */
127
- textAlign: PropTypes.oneOf(['start', 'center']),
92
+ textAlign?: 'start' | 'center'
93
+
128
94
  /**
129
95
  * The width of the input.
130
96
  */
131
- width: PropTypes.string,
97
+ width?: string
98
+
132
99
  /**
133
- * The width of the input, in characters, if a width is not explicitly
134
- * provided via the `width` prop. Only applicable if `isInline={true}`.
100
+ * The width of the input (integer value 0 or higher), if a width is not explicitly
101
+ * provided via the `width` prop.
102
+ *
103
+ * Only applicable if `display="inline-block"`.
104
+ *
105
+ * For more see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/size
135
106
  */
136
- htmlSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
107
+ htmlSize?: number
108
+
137
109
  /**
138
110
  * The display of the root element.
139
111
  */
140
- display: PropTypes.oneOf(['inline-block', 'block']),
112
+ display?: 'inline-block' | 'block'
113
+
141
114
  /**
142
115
  * Prevents the default behavior of wrapping the input and rendered content
143
116
  * when available space is exceeded.
144
117
  */
145
- shouldNotWrap: PropTypes.bool,
118
+ shouldNotWrap?: boolean
119
+
146
120
  /**
147
- * Html placeholder text to display when the input has no value. This should be hint text, not a label
148
- * replacement.
121
+ * Html placeholder text to display when the input has no value. This should be hint text, not a label replacement.
149
122
  */
150
- placeholder: PropTypes.string,
123
+ placeholder?: string
124
+
151
125
  /**
152
126
  * Whether or not the text input is required.
153
127
  */
154
- isRequired: PropTypes.bool,
128
+ isRequired?: boolean
129
+
155
130
  /**
156
131
  * provides a reference to the underlying html root element
157
132
  */
158
- elementRef: PropTypes.func,
133
+ elementRef?: (element: Element | null) => void
134
+
159
135
  /**
160
136
  * a function that provides a reference to the actual input element
161
137
  */
162
- inputRef: PropTypes.func,
138
+ inputRef?: (inputElement: HTMLInputElement | null) => void
139
+
163
140
  /**
164
141
  * a function that provides a reference a parent of the input element
165
142
  */
166
- inputContainerRef: PropTypes.func,
143
+ inputContainerRef?: (element: Element | null) => void
144
+
167
145
  /**
168
146
  * Content to display before the input text, such as an icon
169
147
  */
170
- renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
148
+ renderBeforeInput?: React.ReactNode | (() => React.ReactNode)
149
+
171
150
  /**
172
151
  * Content to display after the input text, such as an icon
173
152
  */
174
- renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
153
+ renderAfterInput?: React.ReactNode | (() => React.ReactNode)
154
+
175
155
  /**
176
156
  * Callback executed when the input fires a change event.
177
157
  * @param {Object} event - the event object
178
- * @param {Object} value - the string value of the input
158
+ * @param {string} value - the string value of the input
179
159
  */
180
- onChange: PropTypes.func,
160
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void
161
+
181
162
  /**
182
163
  * Callback fired when input loses focus.
183
164
  */
184
- onBlur: PropTypes.func,
165
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void
166
+
185
167
  /**
186
168
  * Callback fired when input receives focus.
187
169
  */
170
+ onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void
171
+ }
172
+
173
+ type PropKeys = keyof TextInputOwnProps
174
+
175
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
176
+
177
+ type TextInputProps = TextInputOwnProps &
178
+ WithStyleProps<TextInputTheme, TextInputStyle> &
179
+ OtherHTMLAttributes<
180
+ TextInputOwnProps,
181
+ InputHTMLAttributes<TextInputOwnProps>
182
+ > &
183
+ // The component will handle pass this prop to FormField, but it shouldn't be
184
+ // listed as a prop
185
+ Pick<FormFieldProps, 'layout'>
186
+
187
+ type TextInputStyle = ComponentStyle<
188
+ | 'textInput'
189
+ | 'facade'
190
+ | 'layout'
191
+ | 'beforeElement'
192
+ | 'innerWrapper'
193
+ | 'inputLayout'
194
+ | 'afterElement'
195
+ >
196
+
197
+ const propTypes: PropValidators<PropKeys> = {
198
+ renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
199
+ type: PropTypes.oneOf(['text', 'email', 'url', 'tel', 'search', 'password']),
200
+ id: PropTypes.string,
201
+ value: controllable(PropTypes.string),
202
+ defaultValue: PropTypes.string,
203
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
204
+ messages: PropTypes.arrayOf(FormPropTypes.message),
205
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
206
+ textAlign: PropTypes.oneOf(['start', 'center']),
207
+ width: PropTypes.string,
208
+ htmlSize: PropTypes.number,
209
+ display: PropTypes.oneOf(['inline-block', 'block']),
210
+ shouldNotWrap: PropTypes.bool,
211
+ placeholder: PropTypes.string,
212
+ isRequired: PropTypes.bool,
213
+ elementRef: PropTypes.func,
214
+ inputRef: PropTypes.func,
215
+ inputContainerRef: PropTypes.func,
216
+ renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
217
+ renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
218
+ onChange: PropTypes.func,
219
+ onBlur: PropTypes.func,
188
220
  onFocus: PropTypes.func
189
221
  }
190
222
 
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { Component } from 'react';
2
+ import React, { Component } from 'react';
3
3
  import { jsx } from '@instructure/emotion';
4
4
  import type { TextInputProps, TextInputState, TextInputStyleProps } from './props';
5
5
  /**
@@ -7,58 +7,59 @@ import type { TextInputProps, TextInputState, TextInputStyleProps } from './prop
7
7
  category: components
8
8
  tags: form, field
9
9
  ---
10
+ @tsProps
10
11
  **/
11
12
  declare class TextInput extends Component<TextInputProps, TextInputState> {
12
13
  static readonly componentId = "TextInput";
13
14
  static allowedProps: readonly (keyof {
14
- renderLabel?: import("react").ReactNode | ((...args: any[]) => any);
15
+ renderLabel?: React.ReactNode | (() => React.ReactNode);
15
16
  type?: "text" | "email" | "url" | "tel" | "search" | "password" | undefined;
16
17
  id?: string | undefined;
17
- value?: any;
18
+ value?: string | undefined;
18
19
  defaultValue?: string | undefined;
19
20
  interaction?: import("@instructure/ui-react-utils").InteractionType | undefined;
20
21
  messages?: import("@instructure/ui-form-field/types/FormPropTypes").FormMessage[] | undefined;
21
22
  size?: "small" | "medium" | "large" | undefined;
22
23
  textAlign?: "start" | "center" | undefined;
23
24
  width?: string | undefined;
24
- htmlSize?: string | number | undefined;
25
+ htmlSize?: number | undefined;
25
26
  display?: "inline-block" | "block" | undefined;
26
27
  shouldNotWrap?: boolean | undefined;
27
28
  placeholder?: string | undefined;
28
29
  isRequired?: boolean | undefined;
29
30
  elementRef?: ((element: Element | null) => void) | undefined;
30
- inputRef?: ((...args: any[]) => any) | undefined;
31
- inputContainerRef?: ((...args: any[]) => any) | undefined;
32
- renderBeforeInput?: import("react").ReactNode | ((...args: any[]) => any);
33
- renderAfterInput?: import("react").ReactNode | ((...args: any[]) => any);
34
- onChange?: ((...args: any[]) => any) | undefined;
35
- onBlur?: ((...args: any[]) => any) | undefined;
36
- onFocus?: ((...args: any[]) => any) | undefined;
31
+ inputRef?: ((inputElement: HTMLInputElement | null) => void) | undefined;
32
+ inputContainerRef?: ((element: Element | null) => void) | undefined;
33
+ renderBeforeInput?: React.ReactNode | (() => React.ReactNode);
34
+ renderAfterInput?: React.ReactNode | (() => React.ReactNode);
35
+ onChange?: ((event: React.ChangeEvent<HTMLInputElement>, value: string) => void) | undefined;
36
+ onBlur?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
37
+ onFocus?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
37
38
  })[];
38
39
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
39
- renderLabel?: import("react").ReactNode | ((...args: any[]) => any);
40
+ renderLabel?: React.ReactNode | (() => React.ReactNode);
40
41
  type?: "text" | "email" | "url" | "tel" | "search" | "password" | undefined;
41
42
  id?: string | undefined;
42
- value?: any;
43
+ value?: string | undefined;
43
44
  defaultValue?: string | undefined;
44
45
  interaction?: import("@instructure/ui-react-utils").InteractionType | undefined;
45
46
  messages?: import("@instructure/ui-form-field/types/FormPropTypes").FormMessage[] | undefined;
46
47
  size?: "small" | "medium" | "large" | undefined;
47
48
  textAlign?: "start" | "center" | undefined;
48
49
  width?: string | undefined;
49
- htmlSize?: string | number | undefined;
50
+ htmlSize?: number | undefined;
50
51
  display?: "inline-block" | "block" | undefined;
51
52
  shouldNotWrap?: boolean | undefined;
52
53
  placeholder?: string | undefined;
53
54
  isRequired?: boolean | undefined;
54
55
  elementRef?: ((element: Element | null) => void) | undefined;
55
- inputRef?: ((...args: any[]) => any) | undefined;
56
- inputContainerRef?: ((...args: any[]) => any) | undefined;
57
- renderBeforeInput?: import("react").ReactNode | ((...args: any[]) => any);
58
- renderAfterInput?: import("react").ReactNode | ((...args: any[]) => any);
59
- onChange?: ((...args: any[]) => any) | undefined;
60
- onBlur?: ((...args: any[]) => any) | undefined;
61
- onFocus?: ((...args: any[]) => any) | undefined;
56
+ inputRef?: ((inputElement: HTMLInputElement | null) => void) | undefined;
57
+ inputContainerRef?: ((element: Element | null) => void) | undefined;
58
+ renderBeforeInput?: React.ReactNode | (() => React.ReactNode);
59
+ renderAfterInput?: React.ReactNode | (() => React.ReactNode);
60
+ onChange?: ((event: React.ChangeEvent<HTMLInputElement>, value: string) => void) | undefined;
61
+ onBlur?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
62
+ onFocus?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
62
63
  }>;
63
64
  static defaultProps: {
64
65
  type: string;
@@ -69,29 +70,27 @@ declare class TextInput extends Component<TextInputProps, TextInputState> {
69
70
  size: string;
70
71
  textAlign: string;
71
72
  messages: never[];
72
- inputRef: (input: any) => void;
73
- inputContainerRef: (container: any) => void;
74
- onChange: (event: any, value: any) => void;
75
- onBlur: (event: any) => void;
76
- onFocus: (event: any) => void;
77
73
  };
78
- constructor(props: any);
74
+ constructor(props: TextInputProps);
79
75
  ref: Element | null;
76
+ private _input;
77
+ private _defaultId;
78
+ private _messagesId;
80
79
  handleRef: (el: Element | null) => void;
81
80
  componentDidMount(): void;
82
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
81
+ componentDidUpdate(): void;
83
82
  makeStyleProps: () => TextInputStyleProps;
84
83
  focus(): void;
85
84
  get interaction(): import("@instructure/ui-react-utils").InteractionType;
86
- get hasMessages(): boolean | undefined;
85
+ get hasMessages(): boolean;
87
86
  get invalid(): boolean;
88
87
  get focused(): boolean;
89
- get value(): any;
90
- get id(): any;
91
- handleInputRef: (node: any) => void;
92
- handleChange: (event: any) => void;
93
- handleBlur: (event: any) => void;
94
- handleFocus: (event: any) => void;
88
+ get value(): string | undefined;
89
+ get id(): string;
90
+ handleInputRef: (node: HTMLInputElement | null) => void;
91
+ handleChange: React.ChangeEventHandler<HTMLInputElement>;
92
+ handleBlur: React.FocusEventHandler<HTMLInputElement>;
93
+ handleFocus: React.FocusEventHandler<HTMLInputElement>;
95
94
  renderInput(): jsx.JSX.Element;
96
95
  render(): jsx.JSX.Element;
97
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TextInput/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAWjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,mBAAmB,EACpB,MAAM,SAAS,CAAA;AAGhB;;;;;GAKG;AACH,cAEM,SAAU,SAAQ,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IAC/D,MAAM,CAAC,QAAQ,CAAC,WAAW,eAAc;IAEzC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;MAoBlB;gBAGW,KAAK,KAAA;IASjB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IACD,iBAAiB;IAKjB,kBAA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