aidos-ui 3.0.31 → 4.0.1
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/.claude/settings.local.json +14 -1
- package/CLAUDE.md +72 -0
- package/README.md +43 -29
- package/dist/Badge.d.ts +2 -2
- package/dist/Badge.js.map +1 -1
- package/dist/BaseButton.d.ts +2 -2
- package/dist/BaseButton.js +2 -2
- package/dist/BaseButton.js.map +1 -1
- package/dist/BaseInput.d.ts +2 -2
- package/dist/BaseInput.js.map +1 -1
- package/dist/BaseLink.d.ts +2 -2
- package/dist/BaseLink.js +2 -2
- package/dist/BaseLink.js.map +1 -1
- package/dist/BaseListItem.d.ts +3 -3
- package/dist/BaseListItem.js.map +1 -1
- package/dist/BaseView.d.ts +2 -2
- package/dist/BaseView.js.map +1 -1
- package/dist/Calendar.d.ts +4 -4
- package/dist/DarkMode.js.map +1 -1
- package/dist/DateInput.d.ts +2 -2
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatetimeInput.d.ts +2 -2
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.d.ts +3 -3
- package/dist/Dropdown.js.map +1 -1
- package/dist/Icon.d.ts +3 -3
- package/dist/Icon.js +2 -21
- package/dist/Icon.js.map +1 -1
- package/dist/IconLink.js +2 -1
- package/dist/IconLink.js.map +1 -1
- package/dist/Interactable.d.ts +4 -4
- package/dist/Interactable.js +2 -2
- package/dist/Interactable.js.map +1 -1
- package/dist/ListButtonItem.js +2 -2
- package/dist/ListButtonItem.js.map +1 -1
- package/dist/ListLinkItem.js +2 -2
- package/dist/ListLinkItem.js.map +1 -1
- package/dist/MenuIcon.js.map +1 -1
- package/dist/NextJSRouter.js.map +1 -1
- package/dist/NextJSRouterState.js.map +1 -1
- package/dist/OnVisible.d.ts +1 -1
- package/dist/OnVisible.js.map +1 -1
- package/dist/Popover.d.ts +7 -7
- package/dist/Popover.js +2 -2
- package/dist/Popover.js.map +1 -1
- package/dist/ProgressBar.d.ts +2 -2
- package/dist/ProgressBar.js.map +1 -1
- package/dist/Providers.d.ts +2 -2
- package/dist/Providers.js +2 -2
- package/dist/Providers.js.map +1 -1
- package/dist/RangeInput.d.ts +3 -3
- package/dist/RangeInput.js +2 -2
- package/dist/RangeInput.js.map +1 -1
- package/dist/RootView.js.map +1 -1
- package/dist/Select.d.ts +2 -3
- package/dist/Select.js.map +1 -1
- package/dist/StaticCheckbox.js.map +1 -1
- package/dist/Storage.d.ts +2 -1
- package/dist/Storage.js.map +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/Sublist.d.ts +2 -2
- package/dist/Tabs.d.ts +4 -4
- package/dist/Tabs.js +2 -4
- package/dist/Tabs.js.map +1 -1
- package/dist/Text.d.ts +2 -2
- package/dist/Text.js.map +1 -1
- package/dist/TextArea.d.ts +2 -2
- package/dist/TextArea.js.map +1 -1
- package/dist/TextInput.d.ts +4 -3
- package/dist/TextInput.js +14 -5
- package/dist/TextInput.js.map +1 -1
- package/dist/TextPairing.d.ts +2 -2
- package/dist/TextPairing.js.map +1 -1
- package/dist/Tooltip.d.ts +4 -4
- package/dist/Tooltip.js.map +1 -1
- package/dist/aria.js.map +1 -1
- package/dist/hash.js.map +1 -1
- package/dist/jss.d.ts +21 -21
- package/dist/jss.js +6 -6
- package/dist/jss.js.map +1 -1
- package/dist/numberToBase.js.map +1 -1
- package/dist/stateMachineContextFactory.js.map +1 -1
- package/dist/useCookie.js.map +1 -1
- package/dist/useKeyboard.js.map +1 -1
- package/dist/useNavigation.js.map +1 -1
- package/dist/useRefEffect.js.map +1 -1
- package/next-env.d.ts +2 -1
- package/next.config.js +2 -1
- package/package.json +27 -20
- package/src/Badge.tsx +2 -2
- package/src/BaseButton.tsx +4 -4
- package/src/BaseInput.tsx +2 -2
- package/src/BaseLink.tsx +4 -4
- package/src/BaseListItem.tsx +3 -3
- package/src/BaseView.tsx +3 -3
- package/src/Calendar.tsx +4 -4
- package/src/DateInput.tsx +2 -2
- package/src/DatetimeInput.tsx +2 -2
- package/src/Dialog.tsx +3 -3
- package/src/Dropdown.tsx +4 -4
- package/src/Icon.tsx +4 -30
- package/src/IconLink.tsx +2 -1
- package/src/Interactable.tsx +4 -4
- package/src/ListButtonItem.tsx +2 -2
- package/src/ListLinkItem.tsx +2 -2
- package/src/MenuIcon.tsx +2 -2
- package/src/NextJSRouter.tsx +2 -2
- package/src/Popover.tsx +9 -9
- package/src/ProgressBar.tsx +3 -3
- package/src/Providers.tsx +4 -4
- package/src/RangeInput.tsx +5 -5
- package/src/Select.tsx +2 -2
- package/src/StaticCheckbox.tsx +2 -2
- package/src/Storage.tsx +1 -1
- package/src/Sublist.tsx +2 -2
- package/src/Tabs.tsx +4 -6
- package/src/Text.tsx +2 -2
- package/src/TextArea.tsx +2 -2
- package/src/TextInput.tsx +20 -8
- package/src/TextPairing.tsx +2 -2
- package/src/Tooltip.tsx +5 -5
- package/src/docs/mdx.tsx +40 -0
- package/src/docs/searchIndex.ts +1 -1
- package/src/jss.tsx +18 -18
- package/src/pages/Badge.mdx +136 -14
- package/src/pages/Button.mdx +121 -63
- package/src/pages/Calendar.mdx +196 -2
- package/src/pages/Card.mdx +123 -47
- package/src/pages/Checkbox.mdx +103 -28
- package/src/pages/Dialog.mdx +172 -7
- package/src/pages/FlexLayout.mdx +185 -51
- package/src/pages/Hashing.mdx +199 -8
- package/src/pages/Icon.mdx +150 -42
- package/src/pages/IconButton.mdx +127 -116
- package/src/pages/Link.mdx +118 -47
- package/src/pages/List.mdx +167 -283
- package/src/pages/ListHeader.mdx +157 -27
- package/src/pages/Popover.mdx +177 -55
- package/src/pages/ProgressBar.mdx +186 -6
- package/src/pages/ProgressCircle.mdx +196 -13
- package/src/pages/RangeInput.mdx +189 -61
- package/src/pages/Tabs.mdx +202 -346
- package/src/pages/Text.mdx +102 -81
- package/src/pages/TextInput.mdx +169 -44
- package/src/pages/TextPairing.mdx +164 -115
- package/src/pages/TimeInput.mdx +142 -37
- package/src/pages/Tooltip.mdx +99 -12
- package/src/pages/_app.tsx +14 -4
- package/src/pages/css-in-js.mdx +196 -83
- package/src/pages/navigation.mdx +122 -20
- package/src/pages/useCookie.mdx +168 -7
- package/src/pages/useKeyboard.mdx +242 -5
- package/src/pages/useNavigation.mdx +244 -16
- package/src/pages/usePromise.mdx +271 -6
- package/src/pages/useRefEffect.mdx +230 -28
- package/tsconfig.json +13 -4
package/src/pages/Text.mdx
CHANGED
|
@@ -1,133 +1,154 @@
|
|
|
1
1
|
import { Column } from "../Column";
|
|
2
|
-
import {
|
|
2
|
+
import { Row } from "../Row";
|
|
3
|
+
import { Text, Span, P, H1, H2, H3, Li, Label } from "../Text";
|
|
3
4
|
|
|
4
5
|
# Text
|
|
5
6
|
|
|
6
|
-
The `Text` component
|
|
7
|
+
The `Text` component is the foundation for all text rendering in the design system. It provides consistent typography with semantic color and size options.
|
|
7
8
|
|
|
8
9
|
---
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Props
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
|------|------|----------|---------|-------------|
|
|
15
|
+
| `children` | `ReactNode` | Yes | - | Text content |
|
|
16
|
+
| `color` | `TextColor` | No | `"primary"` | `"primary"`, `"secondary"`, `"highlight"`, `"negative"`, `"subtle"`, `"light"`, `"inherit"` |
|
|
17
|
+
| `size` | `Size` | No | `"medium"` | `"xsmall"`, `"small"`, `"medium"`, `"large"`, `"xlarge"`, `"xxlarge"`, `"xxxlarge"` |
|
|
18
|
+
| `bold` | `boolean` | No | `false` | Bold font weight |
|
|
19
|
+
| `ellipsis` | `boolean` | No | varies | Truncate text with ellipsis when overflow |
|
|
20
|
+
| `align` | `"center"` \| `"none"` | No | `"none"` | Text alignment |
|
|
21
|
+
| `type` | `TextType` | No | `"span"` | HTML element: `"span"`, `"p"`, `"h1"`, `"h2"`, `"h3"`, `"h4"`, `"li"`, `"label"` |
|
|
22
|
+
| `grow` | `boolean` | No | `false` | Allow text to grow in flex container |
|
|
13
23
|
|
|
14
|
-
|
|
15
|
-
<Span>Span</Span>
|
|
16
|
-
<P>P</P>
|
|
17
|
-
<H1 tag="h2">H1</H1>
|
|
18
|
-
<H2>H2</H2>
|
|
19
|
-
<H3>H3</H3>
|
|
20
|
-
<Li>Li</Li>
|
|
21
|
-
</Column>
|
|
24
|
+
---
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
accessibility.
|
|
26
|
+
## Semantic components
|
|
27
|
+
|
|
28
|
+
For most use cases, prefer the semantic wrapper components over the base `Text` component. They provide sensible defaults and render the appropriate HTML elements.
|
|
27
29
|
|
|
28
|
-
```js
|
|
29
30
|
<Column gap="medium">
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
<Li>Li</Li>
|
|
31
|
+
<H1 tag="h2">H1 - Page titles</H1>
|
|
32
|
+
<H2 tag="h3">H2 - Section headings</H2>
|
|
33
|
+
<H3 tag="h4">H3 - Subsection headings</H3>
|
|
34
|
+
<P>P - Paragraph text for body content</P>
|
|
35
|
+
<Span>Span - Inline text (truncates by default)</Span>
|
|
36
|
+
<Li>Li - List items</Li>
|
|
37
|
+
<Label>Label - Form labels</Label>
|
|
36
38
|
</Column>
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { H1, H2, H3, P, Span, Li, Label } from "aidos-ui";
|
|
42
|
+
|
|
43
|
+
<H1>Page Title</H1> // xxlarge, renders <h1>
|
|
44
|
+
<H2>Section Heading</H2> // xlarge, renders <h2>
|
|
45
|
+
<H3>Subsection</H3> // large, renders <h3>
|
|
46
|
+
<P>Body text paragraph</P> // medium, renders <p>
|
|
47
|
+
<Span>Inline text</Span> // medium, renders <span>, ellipsis enabled
|
|
48
|
+
<Li>List item</Li> // medium, renders <li>
|
|
49
|
+
<Label>Form label</Label> // medium, renders <label>
|
|
37
50
|
```
|
|
38
51
|
|
|
39
52
|
---
|
|
40
53
|
|
|
41
|
-
##
|
|
54
|
+
## Sizes
|
|
55
|
+
|
|
56
|
+
Text sizes map to CSS custom properties, ensuring consistency with the theme system.
|
|
42
57
|
|
|
43
58
|
<Column gap="medium">
|
|
44
|
-
<Text size="xsmall">
|
|
45
|
-
<Text size="small">
|
|
46
|
-
<Text size="medium">
|
|
47
|
-
<Text size="large">
|
|
48
|
-
<Text size="xlarge">
|
|
59
|
+
<Text size="xsmall">xsmall - Fine print, captions</Text>
|
|
60
|
+
<Text size="small">small - Secondary text, labels</Text>
|
|
61
|
+
<Text size="medium">medium - Body text (default)</Text>
|
|
62
|
+
<Text size="large">large - Emphasized text, H3</Text>
|
|
63
|
+
<Text size="xlarge">xlarge - Subheadings, H2</Text>
|
|
64
|
+
<Text size="xxlarge">xxlarge - Page titles, H1</Text>
|
|
65
|
+
<Text size="xxxlarge">xxxlarge - Hero text</Text>
|
|
49
66
|
</Column>
|
|
50
67
|
|
|
51
68
|
```js
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</
|
|
69
|
+
<Text size="xsmall">Fine print</Text>
|
|
70
|
+
<Text size="small">Secondary text</Text>
|
|
71
|
+
<Text size="medium">Body text</Text>
|
|
72
|
+
<Text size="large">Emphasized</Text>
|
|
73
|
+
<Text size="xlarge">Subheading</Text>
|
|
74
|
+
<Text size="xxlarge">Title</Text>
|
|
75
|
+
<Text size="xxxlarge">Hero</Text>
|
|
59
76
|
```
|
|
60
77
|
|
|
61
78
|
---
|
|
62
79
|
|
|
63
|
-
##
|
|
80
|
+
## Colors
|
|
81
|
+
|
|
82
|
+
Semantic colors ensure text adapts correctly to light and dark themes.
|
|
64
83
|
|
|
65
84
|
<Column gap="medium">
|
|
66
|
-
<Text color="primary">
|
|
67
|
-
<Text color="secondary">
|
|
68
|
-
<Text color="highlight">
|
|
69
|
-
<Text color="negative">
|
|
70
|
-
<Text color="subtle">
|
|
71
|
-
<Text color="light">
|
|
72
|
-
<Text color="inherit">
|
|
85
|
+
<Text color="primary">primary - Main content text</Text>
|
|
86
|
+
<Text color="secondary">secondary - Supporting text</Text>
|
|
87
|
+
<Text color="highlight">highlight - Links, accents, brand color</Text>
|
|
88
|
+
<Text color="negative">negative - Errors, warnings, destructive</Text>
|
|
89
|
+
<Text color="subtle">subtle - Disabled, placeholder text</Text>
|
|
90
|
+
<Text color="light">light - Text on dark backgrounds</Text>
|
|
91
|
+
<Text color="inherit">inherit - Inherits parent color</Text>
|
|
73
92
|
</Column>
|
|
74
93
|
|
|
75
94
|
```js
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<Text color="subtle">{"subtle"}</Text>
|
|
82
|
-
<Text color="light">{"light"}</Text>
|
|
83
|
-
<Text color="inherit">{"inherit"}</Text>
|
|
84
|
-
</Column>
|
|
95
|
+
<Text color="primary">Main content</Text>
|
|
96
|
+
<Text color="secondary">Supporting info</Text>
|
|
97
|
+
<Text color="highlight">Accent text</Text>
|
|
98
|
+
<Text color="negative">Error message</Text>
|
|
99
|
+
<Text color="subtle">Disabled text</Text>
|
|
85
100
|
```
|
|
86
101
|
|
|
87
102
|
---
|
|
88
103
|
|
|
89
|
-
## Bold
|
|
104
|
+
## Bold text
|
|
90
105
|
|
|
91
|
-
<
|
|
92
|
-
<Text bold>
|
|
93
|
-
<Text>
|
|
94
|
-
</
|
|
106
|
+
<Row gap="large">
|
|
107
|
+
<Text bold>Bold text for emphasis</Text>
|
|
108
|
+
<Text>Regular weight text</Text>
|
|
109
|
+
</Row>
|
|
95
110
|
|
|
96
111
|
```js
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
<Text>{"not bold"}</Text>
|
|
100
|
-
</Column>
|
|
112
|
+
<Text bold>Important information</Text>
|
|
113
|
+
<Text>Regular text</Text>
|
|
101
114
|
```
|
|
102
115
|
|
|
103
116
|
---
|
|
104
117
|
|
|
105
|
-
## Ellipsis
|
|
118
|
+
## Ellipsis truncation
|
|
106
119
|
|
|
107
|
-
By default
|
|
120
|
+
By default, `Span` and `Label` components truncate text with ellipsis. Other components wrap by default.
|
|
108
121
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
### Span
|
|
112
|
-
|
|
113
|
-
<Column>
|
|
122
|
+
<Column gap="medium" jss={{ maxWidth: 300 }}>
|
|
114
123
|
<Span>
|
|
115
|
-
|
|
116
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
117
|
-
}
|
|
124
|
+
This span text will truncate with ellipsis when it overflows the container width
|
|
118
125
|
</Span>
|
|
126
|
+
<P>
|
|
127
|
+
This paragraph text will wrap to multiple lines when it exceeds the container width instead of truncating
|
|
128
|
+
</P>
|
|
119
129
|
</Column>
|
|
120
130
|
|
|
121
|
-
|
|
131
|
+
```js
|
|
132
|
+
// Truncates by default
|
|
133
|
+
<Span>Long text that will be truncated...</Span>
|
|
122
134
|
|
|
123
|
-
|
|
135
|
+
// Force truncation on any text component
|
|
136
|
+
<P ellipsis>This paragraph will truncate</P>
|
|
124
137
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
129
|
-
}
|
|
130
|
-
</P>
|
|
131
|
-
</Column>
|
|
138
|
+
// Disable truncation on span
|
|
139
|
+
<Span ellipsis={false}>This span will wrap</Span>
|
|
140
|
+
```
|
|
132
141
|
|
|
133
142
|
---
|
|
143
|
+
|
|
144
|
+
## Custom HTML element
|
|
145
|
+
|
|
146
|
+
Override the rendered HTML element while keeping the same styling using the `type` prop.
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
// Render H1 styling but use h2 element (for accessibility)
|
|
150
|
+
<H1 type="h2">Visually large, semantically h2</H1>
|
|
151
|
+
|
|
152
|
+
// Render span styling as a label
|
|
153
|
+
<Span type="label" htmlFor="email">Email address</Span>
|
|
154
|
+
```
|
package/src/pages/TextInput.mdx
CHANGED
|
@@ -5,106 +5,231 @@ import { TextInput } from "../TextInput";
|
|
|
5
5
|
|
|
6
6
|
# TextInput
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
A styled text input field with support for icons and add-ons. Built on top of the native HTML input element with enhanced styling options.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
| Prop | Type | Required | Default | Description |
|
|
15
|
+
|------|------|----------|---------|-------------|
|
|
16
|
+
| `value` | `string` | Yes | - | Input value (controlled) |
|
|
17
|
+
| `onValueChange` | `(value: string) => void` | No | - | Callback when value changes |
|
|
18
|
+
| `placeholder` | `string` | No | - | Placeholder text |
|
|
19
|
+
| `addOn` | `ReactNode` | No | - | Element displayed inside the input (typically an icon) |
|
|
20
|
+
| `addOnPosition` | `"start"` \| `"end"` | No | `"start"` | Add-on placement |
|
|
21
|
+
| `bare` | `boolean` | No | `false` | Minimal styling without border |
|
|
22
|
+
| `size` | `Size` | No | `"medium"` | Font size (matches Button sizing) |
|
|
23
|
+
| `padding` | `Padding` | No | `"medium"` | Internal padding |
|
|
24
|
+
| `gap` | `Gap` | No | `"small"` | Space between add-on and input |
|
|
25
|
+
| `disabled` | `boolean` | No | `false` | Disables the input |
|
|
26
|
+
| `type` | `string` | No | `"text"` | HTML input type |
|
|
27
|
+
| `jss` | `JSS` | No | - | Custom styles for the input element |
|
|
28
|
+
| `jssRoot` | `JSS` | No | - | Custom styles for the container |
|
|
29
|
+
|
|
30
|
+
Also accepts all standard HTML input attributes (`name`, `id`, `autoFocus`, `maxLength`, etc.).
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Basic usage
|
|
11
35
|
|
|
12
36
|
<Column gap="medium">
|
|
13
37
|
<TextInput
|
|
14
38
|
value=""
|
|
15
|
-
placeholder="
|
|
39
|
+
placeholder="Enter your name"
|
|
16
40
|
onValueChange={() => {}}
|
|
17
41
|
/>
|
|
18
|
-
<TextInput value="Text input" onValueChange={() => {}} />
|
|
19
42
|
<TextInput
|
|
20
|
-
|
|
21
|
-
value="Text input"
|
|
22
|
-
onValueChange={() => {}}
|
|
23
|
-
/>
|
|
24
|
-
<TextInput
|
|
25
|
-
value="Text input"
|
|
26
|
-
addOn={<Icon icon="fa-user" color="primary" size="medium" />}
|
|
27
|
-
addOnPosition="end"
|
|
28
|
-
placeholder="Placeholder text input"
|
|
43
|
+
value="John Doe"
|
|
29
44
|
onValueChange={() => {}}
|
|
30
45
|
/>
|
|
31
46
|
</Column>
|
|
32
47
|
|
|
33
48
|
```js
|
|
49
|
+
const [name, setName] = useState("");
|
|
50
|
+
|
|
51
|
+
<TextInput
|
|
52
|
+
value={name}
|
|
53
|
+
placeholder="Enter your name"
|
|
54
|
+
onValueChange={setName}
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## With add-on
|
|
61
|
+
|
|
62
|
+
Add icons to provide visual context. Icons can be placed at the start or end of the input.
|
|
63
|
+
|
|
34
64
|
<Column gap="medium">
|
|
35
65
|
<TextInput
|
|
36
|
-
value=""
|
|
37
|
-
|
|
66
|
+
value="john@example.com"
|
|
67
|
+
addOn={<Icon icon="fa-envelope" color="primary" size="medium" />}
|
|
38
68
|
onValueChange={() => {}}
|
|
39
69
|
/>
|
|
40
|
-
<TextInput value="Text input" onValueChange={() => {}} />
|
|
41
70
|
<TextInput
|
|
42
|
-
|
|
43
|
-
|
|
71
|
+
value=""
|
|
72
|
+
placeholder="Search..."
|
|
73
|
+
addOn={<Icon icon="fa-search" color="secondary" size="medium" />}
|
|
44
74
|
onValueChange={() => {}}
|
|
45
75
|
/>
|
|
46
76
|
<TextInput
|
|
47
|
-
value="
|
|
48
|
-
|
|
77
|
+
value="Secret"
|
|
78
|
+
placeholder="Password"
|
|
79
|
+
addOn={<Icon icon="fa-lock" color="secondary" size="medium" />}
|
|
49
80
|
addOnPosition="end"
|
|
50
|
-
|
|
81
|
+
type="password"
|
|
51
82
|
onValueChange={() => {}}
|
|
52
83
|
/>
|
|
53
84
|
</Column>
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
// Icon at start (default)
|
|
88
|
+
<TextInput
|
|
89
|
+
value={email}
|
|
90
|
+
addOn={<Icon icon="fa-envelope" color="primary" size="medium" />}
|
|
91
|
+
onValueChange={setEmail}
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
// Icon at end
|
|
95
|
+
<TextInput
|
|
96
|
+
value={password}
|
|
97
|
+
addOn={<Icon icon="fa-lock" color="secondary" size="medium" />}
|
|
98
|
+
addOnPosition="end"
|
|
99
|
+
type="password"
|
|
100
|
+
onValueChange={setPassword}
|
|
101
|
+
/>
|
|
54
102
|
```
|
|
55
103
|
|
|
56
104
|
---
|
|
57
105
|
|
|
58
|
-
## Bare
|
|
106
|
+
## Bare variant
|
|
107
|
+
|
|
108
|
+
The `bare` variant removes the border for a minimal look. The background highlights on focus.
|
|
59
109
|
|
|
60
110
|
<Column gap="medium">
|
|
61
111
|
<TextInput
|
|
62
112
|
bare
|
|
63
113
|
value=""
|
|
64
|
-
placeholder="
|
|
114
|
+
placeholder="Minimal input"
|
|
65
115
|
onValueChange={() => {}}
|
|
66
116
|
/>
|
|
67
|
-
<TextInput bare value="Text input" onValueChange={() => {}} />
|
|
68
117
|
<TextInput
|
|
69
118
|
bare
|
|
119
|
+
value="With icon"
|
|
70
120
|
addOn={<Icon icon="fa-user" color="primary" size="medium" />}
|
|
71
|
-
value="Text input"
|
|
72
|
-
onValueChange={() => {}}
|
|
73
|
-
/>
|
|
74
|
-
<TextInput
|
|
75
|
-
bare
|
|
76
|
-
value="Text input"
|
|
77
|
-
addOn={<Icon icon="fa-user" color="primary" size="medium" />}
|
|
78
|
-
addOnPosition="end"
|
|
79
|
-
placeholder="Placeholder text input"
|
|
80
121
|
onValueChange={() => {}}
|
|
81
122
|
/>
|
|
82
123
|
</Column>
|
|
83
124
|
|
|
84
125
|
```js
|
|
126
|
+
<TextInput
|
|
127
|
+
bare
|
|
128
|
+
value={value}
|
|
129
|
+
placeholder="Search"
|
|
130
|
+
addOn={<Icon icon="fa-search" color="secondary" size="medium" />}
|
|
131
|
+
onValueChange={setValue}
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Sizes
|
|
138
|
+
|
|
139
|
+
The `size` prop controls font size and matches the Button component's sizing system.
|
|
140
|
+
|
|
85
141
|
<Column gap="medium">
|
|
86
142
|
<TextInput
|
|
87
|
-
|
|
143
|
+
size="small"
|
|
88
144
|
value=""
|
|
89
|
-
placeholder="
|
|
145
|
+
placeholder="Small input"
|
|
90
146
|
onValueChange={() => {}}
|
|
91
147
|
/>
|
|
92
|
-
<TextInput bare value="Text input" onValueChange={() => {}} />
|
|
93
148
|
<TextInput
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
149
|
+
size="medium"
|
|
150
|
+
value=""
|
|
151
|
+
placeholder="Medium input (default)"
|
|
97
152
|
onValueChange={() => {}}
|
|
98
153
|
/>
|
|
99
154
|
<TextInput
|
|
100
|
-
|
|
101
|
-
value="
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
155
|
+
size="large"
|
|
156
|
+
value=""
|
|
157
|
+
placeholder="Large input"
|
|
158
|
+
onValueChange={() => {}}
|
|
159
|
+
/>
|
|
160
|
+
</Column>
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
<TextInput size="small" ... />
|
|
164
|
+
<TextInput size="medium" ... /> // default
|
|
165
|
+
<TextInput size="large" ... />
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Disabled state
|
|
171
|
+
|
|
172
|
+
<Column gap="medium">
|
|
173
|
+
<TextInput
|
|
174
|
+
value="Disabled input"
|
|
175
|
+
disabled
|
|
105
176
|
onValueChange={() => {}}
|
|
106
177
|
/>
|
|
107
178
|
</Column>
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
<TextInput
|
|
182
|
+
value="Cannot edit"
|
|
183
|
+
disabled
|
|
184
|
+
onValueChange={() => {}}
|
|
185
|
+
/>
|
|
108
186
|
```
|
|
109
187
|
|
|
110
188
|
---
|
|
189
|
+
|
|
190
|
+
## Form integration
|
|
191
|
+
|
|
192
|
+
TextInput works with standard form patterns and can be used with refs for form libraries.
|
|
193
|
+
|
|
194
|
+
```js
|
|
195
|
+
import { useRef } from "react";
|
|
196
|
+
|
|
197
|
+
function Form() {
|
|
198
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
199
|
+
const [value, setValue] = useState("");
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<form onSubmit={handleSubmit}>
|
|
203
|
+
<TextInput
|
|
204
|
+
ref={inputRef}
|
|
205
|
+
name="email"
|
|
206
|
+
type="email"
|
|
207
|
+
value={value}
|
|
208
|
+
placeholder="Email address"
|
|
209
|
+
onValueChange={setValue}
|
|
210
|
+
addOn={<Icon icon="fa-envelope" color="primary" size="medium" />}
|
|
211
|
+
/>
|
|
212
|
+
</form>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Accessibility
|
|
220
|
+
|
|
221
|
+
- Uses native `<input>` element for full accessibility support
|
|
222
|
+
- Focus states are clearly visible
|
|
223
|
+
- Placeholder text is styled with sufficient contrast
|
|
224
|
+
- Works with form labels using `id` and `htmlFor`
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
<label htmlFor="email">Email</label>
|
|
228
|
+
<TextInput
|
|
229
|
+
id="email"
|
|
230
|
+
name="email"
|
|
231
|
+
type="email"
|
|
232
|
+
value={email}
|
|
233
|
+
onValueChange={setEmail}
|
|
234
|
+
/>
|
|
235
|
+
```
|