@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.
- package/LICENSE.md +27 -0
- package/es/TextInput/index.js +32 -19
- package/es/TextInput/props.js +1 -104
- package/lib/TextInput/index.js +34 -19
- package/lib/TextInput/props.js +1 -104
- package/package.json +19 -18
- package/src/TextInput/index.tsx +34 -52
- package/src/TextInput/props.ts +108 -76
- package/types/TextInput/index.d.ts +34 -35
- package/types/TextInput/index.d.ts.map +1 -1
- package/types/TextInput/props.d.ts +97 -12
- package/types/TextInput/props.d.ts.map +1 -1
|
@@ -1,36 +1,121 @@
|
|
|
1
1
|
import React, { InputHTMLAttributes } from 'react';
|
|
2
2
|
import type { InteractionType } from '@instructure/ui-react-utils';
|
|
3
|
-
import type { FormMessage } from '@instructure/ui-form-field';
|
|
3
|
+
import type { FormFieldProps, FormMessage } from '@instructure/ui-form-field';
|
|
4
4
|
import type { OtherHTMLAttributes, PropValidators, TextInputTheme } from '@instructure/shared-types';
|
|
5
5
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
|
|
6
6
|
declare type TextInputOwnProps = {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The form field label.
|
|
9
|
+
*/
|
|
10
|
+
renderLabel?: React.ReactNode | (() => React.ReactNode);
|
|
11
|
+
/**
|
|
12
|
+
* Determines the underlying native HTML `<input>` element's `type`.
|
|
13
|
+
*
|
|
14
|
+
* For more see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url
|
|
15
|
+
*/
|
|
8
16
|
type?: 'text' | 'email' | 'url' | 'tel' | 'search' | 'password';
|
|
17
|
+
/**
|
|
18
|
+
* The id of the text input. One is generated if not supplied.
|
|
19
|
+
*/
|
|
9
20
|
id?: string;
|
|
10
|
-
|
|
21
|
+
/**
|
|
22
|
+
* the selected value (must be accompanied by an `onChange` prop)
|
|
23
|
+
*/
|
|
24
|
+
value?: string;
|
|
25
|
+
/**
|
|
26
|
+
* value to set on initial render
|
|
27
|
+
*/
|
|
11
28
|
defaultValue?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
31
|
+
* When "disabled", the input changes visibly to indicate that it cannot
|
|
32
|
+
* receive user interactions. When "readonly" the input still cannot receive
|
|
33
|
+
* user interactions but it keeps the same styles as if it were enabled.
|
|
34
|
+
*/
|
|
12
35
|
interaction?: InteractionType;
|
|
36
|
+
/**
|
|
37
|
+
* Array of objects with shape: `{
|
|
38
|
+
* text: React.ReactNode,
|
|
39
|
+
* type: One of ['error', 'hint', 'success', 'screenreader-only']
|
|
40
|
+
* }`
|
|
41
|
+
*/
|
|
13
42
|
messages?: FormMessage[];
|
|
43
|
+
/**
|
|
44
|
+
* The size of the text input.
|
|
45
|
+
*/
|
|
14
46
|
size?: 'small' | 'medium' | 'large';
|
|
47
|
+
/**
|
|
48
|
+
* The text alignment of the input.
|
|
49
|
+
*/
|
|
15
50
|
textAlign?: 'start' | 'center';
|
|
51
|
+
/**
|
|
52
|
+
* The width of the input.
|
|
53
|
+
*/
|
|
16
54
|
width?: string;
|
|
17
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The width of the input (integer value 0 or higher), if a width is not explicitly
|
|
57
|
+
* provided via the `width` prop.
|
|
58
|
+
*
|
|
59
|
+
* Only applicable if `display="inline-block"`.
|
|
60
|
+
*
|
|
61
|
+
* For more see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/size
|
|
62
|
+
*/
|
|
63
|
+
htmlSize?: number;
|
|
64
|
+
/**
|
|
65
|
+
* The display of the root element.
|
|
66
|
+
*/
|
|
18
67
|
display?: 'inline-block' | 'block';
|
|
68
|
+
/**
|
|
69
|
+
* Prevents the default behavior of wrapping the input and rendered content
|
|
70
|
+
* when available space is exceeded.
|
|
71
|
+
*/
|
|
19
72
|
shouldNotWrap?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Html placeholder text to display when the input has no value. This should be hint text, not a label replacement.
|
|
75
|
+
*/
|
|
20
76
|
placeholder?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Whether or not the text input is required.
|
|
79
|
+
*/
|
|
21
80
|
isRequired?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* provides a reference to the underlying html root element
|
|
83
|
+
*/
|
|
22
84
|
elementRef?: (element: Element | null) => void;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
85
|
+
/**
|
|
86
|
+
* a function that provides a reference to the actual input element
|
|
87
|
+
*/
|
|
88
|
+
inputRef?: (inputElement: HTMLInputElement | null) => void;
|
|
89
|
+
/**
|
|
90
|
+
* a function that provides a reference a parent of the input element
|
|
91
|
+
*/
|
|
92
|
+
inputContainerRef?: (element: Element | null) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Content to display before the input text, such as an icon
|
|
95
|
+
*/
|
|
96
|
+
renderBeforeInput?: React.ReactNode | (() => React.ReactNode);
|
|
97
|
+
/**
|
|
98
|
+
* Content to display after the input text, such as an icon
|
|
99
|
+
*/
|
|
100
|
+
renderAfterInput?: React.ReactNode | (() => React.ReactNode);
|
|
101
|
+
/**
|
|
102
|
+
* Callback executed when the input fires a change event.
|
|
103
|
+
* @param {Object} event - the event object
|
|
104
|
+
* @param {string} value - the string value of the input
|
|
105
|
+
*/
|
|
106
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Callback fired when input loses focus.
|
|
109
|
+
*/
|
|
110
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Callback fired when input receives focus.
|
|
113
|
+
*/
|
|
114
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
30
115
|
};
|
|
31
116
|
declare type PropKeys = keyof TextInputOwnProps;
|
|
32
117
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
33
|
-
declare type TextInputProps = TextInputOwnProps & WithStyleProps<TextInputTheme, TextInputStyle> & OtherHTMLAttributes<TextInputOwnProps, InputHTMLAttributes<TextInputOwnProps
|
|
118
|
+
declare type TextInputProps = TextInputOwnProps & WithStyleProps<TextInputTheme, TextInputStyle> & OtherHTMLAttributes<TextInputOwnProps, InputHTMLAttributes<TextInputOwnProps>> & Pick<FormFieldProps, 'layout'>;
|
|
34
119
|
declare type TextInputStyle = ComponentStyle<'textInput' | 'facade' | 'layout' | 'beforeElement' | 'innerWrapper' | 'inputLayout' | 'afterElement'>;
|
|
35
120
|
declare const propTypes: PropValidators<PropKeys>;
|
|
36
121
|
declare const allowedProps: AllowedPropKeys;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/TextInput/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAMlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/TextInput/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAMlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1E,aAAK,iBAAiB,GAAG;IACvB;;OAEG;IACH,WAAW,CAAC,EAA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