@instructure/ui-text-input 11.6.0 → 11.6.1-snapshot-129

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +47 -305
  2. package/es/TextInput/{index.js → v1/index.js} +2 -2
  3. package/es/TextInput/v2/index.js +308 -0
  4. package/es/TextInput/v2/props.js +26 -0
  5. package/es/TextInput/v2/styles.js +234 -0
  6. package/es/TextInput/v2/theme.js +73 -0
  7. package/es/{index.js → exports/a.js} +1 -1
  8. package/{src/index.ts → es/exports/b.js} +1 -2
  9. package/lib/TextInput/{index.js → v1/index.js} +3 -3
  10. package/lib/TextInput/v2/index.js +319 -0
  11. package/lib/TextInput/v2/props.js +31 -0
  12. package/lib/TextInput/v2/styles.js +239 -0
  13. package/lib/TextInput/v2/theme.js +79 -0
  14. package/lib/{index.js → exports/a.js} +2 -2
  15. package/lib/exports/b.js +12 -0
  16. package/package.json +45 -24
  17. package/src/TextInput/{index.tsx → v1/index.tsx} +2 -2
  18. package/src/TextInput/{props.ts → v1/props.ts} +1 -1
  19. package/src/TextInput/v2/README.md +334 -0
  20. package/src/TextInput/v2/index.tsx +406 -0
  21. package/src/TextInput/v2/props.ts +244 -0
  22. package/src/TextInput/v2/styles.ts +245 -0
  23. package/src/TextInput/v2/theme.ts +84 -0
  24. package/src/exports/a.ts +25 -0
  25. package/src/exports/b.ts +25 -0
  26. package/tsconfig.build.json +0 -3
  27. package/tsconfig.build.tsbuildinfo +1 -1
  28. package/types/TextInput/{index.d.ts → v1/index.d.ts} +1 -1
  29. package/types/TextInput/v1/index.d.ts.map +1 -0
  30. package/types/TextInput/{props.d.ts → v1/props.d.ts} +1 -1
  31. package/types/TextInput/v1/props.d.ts.map +1 -0
  32. package/types/TextInput/v1/styles.d.ts.map +1 -0
  33. package/types/TextInput/v1/theme.d.ts.map +1 -0
  34. package/types/TextInput/v2/index.d.ts +79 -0
  35. package/types/TextInput/v2/index.d.ts.map +1 -0
  36. package/types/TextInput/v2/props.d.ts +138 -0
  37. package/types/TextInput/v2/props.d.ts.map +1 -0
  38. package/types/TextInput/v2/styles.d.ts +16 -0
  39. package/types/TextInput/v2/styles.d.ts.map +1 -0
  40. package/types/TextInput/v2/theme.d.ts +10 -0
  41. package/types/TextInput/v2/theme.d.ts.map +1 -0
  42. package/types/exports/a.d.ts +3 -0
  43. package/types/exports/a.d.ts.map +1 -0
  44. package/types/exports/b.d.ts +3 -0
  45. package/types/exports/b.d.ts.map +1 -0
  46. package/types/TextInput/index.d.ts.map +0 -1
  47. package/types/TextInput/props.d.ts.map +0 -1
  48. package/types/TextInput/styles.d.ts.map +0 -1
  49. package/types/TextInput/theme.d.ts.map +0 -1
  50. package/types/index.d.ts +0 -3
  51. package/types/index.d.ts.map +0 -1
  52. /package/es/TextInput/{props.js → v1/props.js} +0 -0
  53. /package/es/TextInput/{styles.js → v1/styles.js} +0 -0
  54. /package/es/TextInput/{theme.js → v1/theme.js} +0 -0
  55. /package/lib/TextInput/{props.js → v1/props.js} +0 -0
  56. /package/lib/TextInput/{styles.js → v1/styles.js} +0 -0
  57. /package/lib/TextInput/{theme.js → v1/theme.js} +0 -0
  58. /package/src/TextInput/{README.md → v1/README.md} +0 -0
  59. /package/src/TextInput/{styles.ts → v1/styles.ts} +0 -0
  60. /package/src/TextInput/{theme.ts → v1/theme.ts} +0 -0
  61. /package/types/TextInput/{styles.d.ts → v1/styles.d.ts} +0 -0
  62. /package/types/TextInput/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * Generates the theme object for the component from the theme and provided additional information
33
+ * @param {Object} theme The actual theme object.
34
+ * @return {Object} The final theme object with the overrides and component variables
35
+ */
36
+ const generateComponentTheme = theme => {
37
+ var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8;
38
+ const colors = theme.colors,
39
+ typography = theme.typography,
40
+ borders = theme.borders,
41
+ spacing = theme.spacing,
42
+ forms = theme.forms,
43
+ themeName = theme.key;
44
+ const themeSpecificStyle = {
45
+ canvas: {
46
+ color: theme['ic-brand-font-color-dark'],
47
+ focusOutlineColor: theme['ic-brand-primary']
48
+ }
49
+ };
50
+ const componentVariables = {
51
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
52
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
53
+ borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
54
+ borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
55
+ borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey3045,
56
+ borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
57
+ color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey125125,
58
+ background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.white1010,
59
+ requiredInvalidColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.red5782,
60
+ padding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
61
+ focusOutlineWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
62
+ focusOutlineStyle: borders === null || borders === void 0 ? void 0 : borders.style,
63
+ focusOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.blue4570,
64
+ errorBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.red4570,
65
+ errorOutlineColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.red4570,
66
+ placeholderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.grey4570,
67
+ smallFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
68
+ smallHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightSmall,
69
+ mediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
70
+ mediumHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightMedium,
71
+ largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
72
+ largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge
73
+ };
74
+ return {
75
+ ...componentVariables,
76
+ ...themeSpecificStyle[themeName]
77
+ };
78
+ };
79
+ var _default = exports.default = generateComponentTheme;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "TextInput", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _TextInput.TextInput;
9
+ return _v.TextInput;
10
10
  }
11
11
  });
12
- var _TextInput = require("./TextInput");
12
+ var _v = require("../TextInput/v1");
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "TextInput", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.TextInput;
10
+ }
11
+ });
12
+ var _v = require("../TextInput/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-text-input",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "A styled HTML text input component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -13,27 +13,26 @@
13
13
  "homepage": "https://instructure.github.io/instructure-ui/",
14
14
  "bugs": "https://github.com/instructure/instructure-ui/issues",
15
15
  "license": "MIT",
16
- "dependencies": {
17
- "@babel/runtime": "^7.27.6",
18
- "@instructure/emotion": "11.6.0",
19
- "@instructure/shared-types": "11.6.0",
20
- "@instructure/ui-a11y-utils": "11.6.0",
21
- "@instructure/ui-dom-utils": "11.6.0",
22
- "@instructure/ui-form-field": "11.6.0",
23
- "@instructure/ui-icons": "11.6.0",
24
- "@instructure/ui-react-utils": "11.6.0",
25
- "@instructure/ui-tag": "11.6.0"
26
- },
27
16
  "devDependencies": {
28
17
  "@testing-library/jest-dom": "^6.6.3",
29
18
  "@testing-library/react": "15.0.7",
30
19
  "@testing-library/user-event": "^14.6.1",
31
20
  "vitest": "^3.2.2",
32
- "@instructure/ui-axe-check": "11.6.0",
33
- "@instructure/ui-badge": "11.6.0",
34
- "@instructure/ui-color-utils": "11.6.0",
35
- "@instructure/ui-babel-preset": "11.6.0",
36
- "@instructure/ui-themes": "11.6.0"
21
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
22
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
23
+ "@instructure/ui-badge": "11.6.1-snapshot-129",
24
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129"
25
+ },
26
+ "dependencies": {
27
+ "@babel/runtime": "^7.27.6",
28
+ "@instructure/emotion": "11.6.1-snapshot-129",
29
+ "@instructure/shared-types": "11.6.1-snapshot-129",
30
+ "@instructure/ui-a11y-utils": "11.6.1-snapshot-129",
31
+ "@instructure/ui-dom-utils": "11.6.1-snapshot-129",
32
+ "@instructure/ui-form-field": "11.6.1-snapshot-129",
33
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
34
+ "@instructure/ui-themes": "11.6.1-snapshot-129",
35
+ "@instructure/ui-tag": "11.6.1-snapshot-129"
37
36
  },
38
37
  "peerDependencies": {
39
38
  "react": ">=18 <=19"
@@ -43,17 +42,39 @@
43
42
  },
44
43
  "sideEffects": false,
45
44
  "exports": {
46
- ".": {
47
- "types": "./types/index.d.ts",
48
- "import": "./es/index.js",
49
- "require": "./lib/index.js",
50
- "default": "./es/index.js"
51
- },
52
45
  "./lib/*": "./lib/*",
53
46
  "./es/*": "./es/*",
54
47
  "./types/*": "./types/*",
55
48
  "./package.json": "./package.json",
56
- "./src/*": "./src/*"
49
+ "./src/*": "./src/*",
50
+ ".": {
51
+ "src": "./src/exports/a.ts",
52
+ "types": "./types/exports/a.d.ts",
53
+ "import": "./es/exports/a.js",
54
+ "require": "./lib/exports/a.js",
55
+ "default": "./es/exports/a.js"
56
+ },
57
+ "./v11_6": {
58
+ "src": "./src/exports/a.ts",
59
+ "types": "./types/exports/a.d.ts",
60
+ "import": "./es/exports/a.js",
61
+ "require": "./lib/exports/a.js",
62
+ "default": "./es/exports/a.js"
63
+ },
64
+ "./v11_7": {
65
+ "src": "./src/exports/b.ts",
66
+ "types": "./types/exports/b.d.ts",
67
+ "import": "./es/exports/b.js",
68
+ "require": "./lib/exports/b.js",
69
+ "default": "./es/exports/b.js"
70
+ },
71
+ "./latest": {
72
+ "src": "./src/exports/b.ts",
73
+ "types": "./types/exports/b.d.ts",
74
+ "import": "./es/exports/b.js",
75
+ "require": "./lib/exports/b.js",
76
+ "default": "./es/exports/b.js"
77
+ }
57
78
  },
58
79
  "scripts": {
59
80
  "lint": "ui-scripts lint",
@@ -35,8 +35,8 @@ import {
35
35
  addEventListener,
36
36
  getCSSStyleDeclaration
37
37
  } from '@instructure/ui-dom-utils'
38
- import { FormField } from '@instructure/ui-form-field'
39
- import { withStyle } from '@instructure/emotion'
38
+ import { FormField } from '@instructure/ui-form-field/v11_6'
39
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
40
40
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
41
41
 
42
42
  import generateStyle from './styles'
@@ -24,7 +24,7 @@
24
24
 
25
25
  import { InputHTMLAttributes } from 'react'
26
26
 
27
- import type { FormFieldProps, FormMessage } from '@instructure/ui-form-field'
27
+ import type { FormFieldProps, FormMessage } from '@instructure/ui-form-field/v11_6'
28
28
  import type {
29
29
  OtherHTMLAttributes,
30
30
  TextInputTheme
@@ -0,0 +1,334 @@
1
+ ---
2
+ describes: TextInput
3
+ ---
4
+
5
+ `TextInput` is a custom styled `input` element. It supports the following types: `text` (default) / `email` / `url` / `tel` / `search` / `password`
6
+
7
+ ### Uncontrolled TextInput
8
+
9
+ ```js
10
+ ---
11
+ type: example
12
+ ---
13
+ <TextInput
14
+ renderLabel="Name"
15
+ placeholder="Doe, John Doe"
16
+ onChange={(event, value) => { console.log(value) }}
17
+ />
18
+ ```
19
+
20
+ #### Controlled TextInput
21
+
22
+ ```js
23
+ ---
24
+ type: example
25
+ ---
26
+ const ControlledTextInputExample = () => {
27
+ const [value, setValue] = useState('Supertramp')
28
+ const [disabled, setDisabled] = useState(false)
29
+ const [readOnly, setReadOnly] = useState(false)
30
+ const [inline, setInline] = useState(false)
31
+ const [messages, setMessages] = useState(null)
32
+
33
+ const handleChange = (e, value) => {
34
+ setValue(value)
35
+ setMessages(null)
36
+ }
37
+
38
+ const handleBlur = (e) => {
39
+ if (value === 'Supertramp') {
40
+ setMessages([
41
+ {
42
+ text: "Come on. There's no way your favorite band is really Supertramp.",
43
+ type: 'error'
44
+ }
45
+ ])
46
+ }
47
+ }
48
+
49
+ const toggleDisabled = () => setDisabled((prev) => !prev)
50
+ const toggleReadOnly = () => setReadOnly((prev) => !prev)
51
+ const toggleInline = () => setInline((prev) => !prev)
52
+
53
+ return (
54
+ <div>
55
+ <FormFieldGroup
56
+ description="Controlled TextInput state"
57
+ layout="columns"
58
+ >
59
+ <Checkbox
60
+ checked={disabled}
61
+ label="disabled"
62
+ onChange={toggleDisabled}
63
+ />
64
+ <Checkbox
65
+ checked={readOnly}
66
+ label="readOnly"
67
+ onChange={toggleReadOnly}
68
+ />
69
+ <Checkbox
70
+ checked={inline}
71
+ label="inline display"
72
+ onChange={toggleInline}
73
+ />
74
+ </FormFieldGroup>
75
+ <View display="block" margin="medium 0 0">
76
+ <TextInput
77
+ renderLabel="What is your favorite band?"
78
+ display={inline ? 'inline-block' : null}
79
+ value={value}
80
+ onChange={handleChange}
81
+ onBlur={handleBlur}
82
+ interaction={
83
+ disabled ? 'disabled' : readOnly ? 'readonly' : 'enabled'
84
+ }
85
+ messages={messages}
86
+ renderAfterInput={<HeartInstUIIcon />}
87
+ />
88
+ </View>
89
+ </div>
90
+ )
91
+ }
92
+
93
+ render(<ControlledTextInputExample />)
94
+ ```
95
+
96
+ ### Prepending and appending content
97
+
98
+ TextInput accepts focusable and non-focusable content before and/or after
99
+ the input text. A common use case is adding an icon or avatar to the input.
100
+ Focusable content will be focused separately from the input itself.
101
+
102
+ ```js
103
+ ---
104
+ type: example
105
+ ---
106
+ class ExtraContentExample extends React.Component {
107
+ constructor(props) {
108
+ super(props)
109
+
110
+ this.state = {
111
+ value: ''
112
+ }
113
+ }
114
+
115
+ handleChange = (e, value) => this.setState({ value })
116
+
117
+ render() {
118
+ return (
119
+ <View as="div">
120
+ <TextInput
121
+ renderLabel="What are Paula Panda's favorite ice cream flavors?"
122
+ value={this.state.value}
123
+ onChange={this.handleChange}
124
+ renderBeforeInput={
125
+ <>
126
+ {this.state.value !== '' && (
127
+ <Tag
128
+ text={this.state.value}
129
+ margin="xxx-small xx-small xxx-small none"
130
+ onClick={() => console.log(this.state.value)}
131
+ />
132
+ )}
133
+ <Tag
134
+ text="Rocky road"
135
+ margin="xxx-small xx-small xxx-small none"
136
+ onClick={() => console.log('Rocky road')}
137
+ />
138
+ <Tag
139
+ text="Vanilla"
140
+ margin="xxx-small xx-small xxx-small none"
141
+ onClick={() => console.log('Vanilla')}
142
+ />
143
+ <Tag
144
+ text="Coffee"
145
+ margin="xxx-small xx-small xxx-small none"
146
+ onClick={() => console.log('Coffee')}
147
+ />
148
+ <Tag
149
+ text="Strawberry"
150
+ margin="xxx-small xx-small xxx-small none"
151
+ onClick={() => console.log('Strawberry')}
152
+ />
153
+ </>
154
+ }
155
+ renderAfterInput={() => (
156
+ <Avatar name="Paula Panda" src={avatarSquare} size="x-small" />
157
+ )}
158
+ />
159
+ </View>
160
+ )
161
+ }
162
+ }
163
+
164
+ render(<ExtraContentExample />)
165
+ ```
166
+
167
+ Another common usecase is to add an `IconButton` at the end of a TextInput, e.g. for revealing the content of a password field. In these cases, please use the `withBorder={false}` and `withBackground={false}` props for the IconButton.
168
+
169
+ ```js
170
+ ---
171
+ type: example
172
+ ---
173
+ const InputsWithButtonsExample = () => {
174
+ const [passwordValue, setPasswordValue] = useState('')
175
+ const [showPassword, setShowPassword] = useState(false)
176
+ return (
177
+ <TextInput
178
+ renderLabel="Password"
179
+ type={showPassword ? 'text' : 'password'}
180
+ placeholder="Find something..."
181
+ value={passwordValue}
182
+ onChange={(e, newValue) => setPasswordValue(newValue)}
183
+ renderAfterInput={
184
+ <IconButton withBorder={false} withBackground={false} onClick={() => setShowPassword(prevState => !prevState)} screenReaderLabel={showPassword ? 'Hide password' : 'Show password'}>
185
+ {showPassword ? <IconOffLine/> : <IconEyeLine/>}
186
+ </IconButton>
187
+ }
188
+ />
189
+ )
190
+ }
191
+ render(<InputsWithButtonsExample />)
192
+ ```
193
+
194
+ ### Setting width and display
195
+
196
+ To make the component display inline, set the `display` property to `inline-block`. To constrain the
197
+ size of the component, use `width`.
198
+
199
+ ```js
200
+ ---
201
+ type: example
202
+ ---
203
+ <div>
204
+ <TextInput
205
+ renderLabel={<ScreenReaderContent>I am a hidden label</ScreenReaderContent>}
206
+ display="inline-block"
207
+ width="4rem"
208
+ />
209
+ &nbsp;
210
+ <Button>I Am Inline Content</Button>
211
+ </div>
212
+ ```
213
+
214
+ ### `shouldNotWrap`
215
+
216
+ If there is content rendered before the input (via `renderBeforeInput`), the
217
+ input will wrap to a new line when the browser determines it does
218
+ not have enough room (for most browsers, this is 20 characters). Wrapping allows
219
+ the component to accommodate large lists of [Tags](Tag), for example.
220
+
221
+ If not desired, this behavior can be overridden by setting the `shouldNotWrap`
222
+ boolean prop to `true`.
223
+
224
+ ```js
225
+ ---
226
+ type: example
227
+ ---
228
+ <View as="div" maxWidth="250px">
229
+ <TextInput
230
+ renderLabel="I will not wrap"
231
+ renderBeforeInput={() => (<IconSearchLine inline={false} />)}
232
+ renderAfterInput={<Avatar name="Paula Panda" src={avatarSquare} size="x-small" />}
233
+ shouldNotWrap
234
+ />
235
+ <View as="div" margin="medium none none">
236
+ <TextInput
237
+ renderLabel="I will wrap"
238
+ renderBeforeInput={
239
+ <>
240
+ <Tag
241
+ text="English 101"
242
+ margin="xx-small xxx-small"
243
+ />
244
+ <Tag
245
+ text="History 205"
246
+ margin="xx-small xxx-small"
247
+ />
248
+ </>
249
+ }
250
+ renderAfterInput={<Avatar name="Paula Panda" src={avatarSquare} size="x-small" />}
251
+ />
252
+ </View>
253
+ </View>
254
+ ```
255
+
256
+ You can see here most of the visual states of the component:
257
+
258
+ ```js
259
+ ---
260
+ type: example
261
+ ---
262
+ <Flex gap='medium' direction='column'>
263
+ <TextInput
264
+ size="small"
265
+ renderAfterInput={<AlarmClockInstUIIcon />}
266
+ renderBeforeInput={<AlarmClockInstUIIcon />}
267
+ renderLabel='small'
268
+ placeholder="placeholder"
269
+ />
270
+ <TextInput
271
+ renderAfterInput={<AlarmClockInstUIIcon />}
272
+ renderBeforeInput={<AlarmClockInstUIIcon />}
273
+ renderLabel='normal'
274
+ placeholder="placeholder"
275
+ />
276
+ <TextInput
277
+ size="large"
278
+ renderAfterInput={<AlarmClockInstUIIcon />}
279
+ renderBeforeInput={<AlarmClockInstUIIcon />}
280
+ renderLabel='large'
281
+ placeholder="placeholder"
282
+ />
283
+ <TextInput
284
+ interaction='disabled'
285
+ renderLabel='disabled'
286
+ placeholder="placeholder"
287
+ />
288
+ <TextInput
289
+ interaction='readonly'
290
+ renderLabel='readonly'
291
+ placeholder="placeholder"
292
+ />
293
+ <TextInput
294
+ renderLabel='with error message'
295
+ placeholder="placeholder"
296
+ messages={[{ text: 'This is an error.', type: 'error' }]}
297
+ />
298
+ <TextInput
299
+ renderLabel='with success message'
300
+ placeholder="placeholder"
301
+ messages={[{ text: 'Great success!', type: 'success' }]}
302
+ />
303
+ <TextInput
304
+ renderLabel='large size (default is "medium")'
305
+ placeholder="placeholder"
306
+ size='large'
307
+ />
308
+ <TextInput
309
+ renderLabel='small size (default is "medium")'
310
+ placeholder="placeholder"
311
+ size='small'
312
+ />
313
+ </Flex>
314
+ ```
315
+
316
+ ### Guidelines
317
+
318
+ ```js
319
+ ---
320
+ type: embed
321
+ ---
322
+ <Guidelines>
323
+ <Figure recommendation="yes" title="Do">
324
+ <Figure.Item>Left align text (exceptions may apply)</Figure.Item>
325
+ <Figure.Item>Place labels on top or to the left (inline)</Figure.Item>
326
+ <Figure.Item>Make placeholder text different than the label</Figure.Item>
327
+ <Figure.Item>Use React fragments for <code>renderBeforeInput</code>. This will nicely float the text input box to the remaining space</Figure.Item>
328
+ </Figure>
329
+ <Figure recommendation="no" title="Don't">
330
+ <Figure.Item>Place labels to the right of the input</Figure.Item>
331
+ <Figure.Item>Place inputs in the middle of sentences or phrases</Figure.Item>
332
+ </Figure>
333
+ </Guidelines>
334
+ ```