aidos-ui 4.0.4 → 4.0.5
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 +1 -1
- package/README.md +23 -3
- package/dist/index.d.ts +797 -68
- package/dist/index.js +3868 -68
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +6 -2
- package/dist/jsx-dev-runtime.js +87 -42
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/vite-plugin-jss-debug.d.ts +3 -1
- package/dist/vite-plugin-jss-debug.js +57 -74
- package/dist/vite-plugin-jss-debug.js.map +1 -1
- package/package.json +58 -27
- package/.prettierrc +0 -4
- package/CLAUDE.md +0 -72
- package/dist/Badge.d.ts +0 -6
- package/dist/Badge.js +0 -22
- package/dist/Badge.js.map +0 -1
- package/dist/BaseButton.d.ts +0 -14
- package/dist/BaseButton.js +0 -23
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.d.ts +0 -14
- package/dist/BaseInput.js +0 -15
- package/dist/BaseInput.js.map +0 -1
- package/dist/BaseLink.d.ts +0 -18
- package/dist/BaseLink.js +0 -29
- package/dist/BaseLink.js.map +0 -1
- package/dist/BaseList.d.ts +0 -6
- package/dist/BaseList.js +0 -14
- package/dist/BaseList.js.map +0 -1
- package/dist/BaseListAddOn.d.ts +0 -5
- package/dist/BaseListAddOn.js +0 -7
- package/dist/BaseListAddOn.js.map +0 -1
- package/dist/BaseListItem.d.ts +0 -26
- package/dist/BaseListItem.js +0 -29
- package/dist/BaseListItem.js.map +0 -1
- package/dist/BaseView.d.ts +0 -12
- package/dist/BaseView.js +0 -26
- package/dist/BaseView.js.map +0 -1
- package/dist/Box.d.ts +0 -4
- package/dist/Box.js +0 -6
- package/dist/Box.js.map +0 -1
- package/dist/Button.d.ts +0 -20
- package/dist/Button.js +0 -19
- package/dist/Button.js.map +0 -1
- package/dist/Calendar.d.ts +0 -18
- package/dist/Calendar.js +0 -57
- package/dist/Calendar.js.map +0 -1
- package/dist/Card.d.ts +0 -4
- package/dist/Card.js +0 -14
- package/dist/Card.js.map +0 -1
- package/dist/Checkbox.d.ts +0 -11
- package/dist/Checkbox.js +0 -32
- package/dist/Checkbox.js.map +0 -1
- package/dist/Circle.d.ts +0 -5
- package/dist/Circle.js +0 -12
- package/dist/Circle.js.map +0 -1
- package/dist/Column.d.ts +0 -6
- package/dist/Column.js +0 -7
- package/dist/Column.js.map +0 -1
- package/dist/DarkMode.d.ts +0 -13
- package/dist/DarkMode.js +0 -62
- package/dist/DarkMode.js.map +0 -1
- package/dist/DateInput.d.ts +0 -13
- package/dist/DateInput.js +0 -29
- package/dist/DateInput.js.map +0 -1
- package/dist/DatePicker.d.ts +0 -11
- package/dist/DatePicker.js +0 -34
- package/dist/DatePicker.js.map +0 -1
- package/dist/DatetimeInput.d.ts +0 -13
- package/dist/DatetimeInput.js +0 -31
- package/dist/DatetimeInput.js.map +0 -1
- package/dist/DesignBook.d.ts +0 -1
- package/dist/DesignBook.js +0 -55
- package/dist/DesignBook.js.map +0 -1
- package/dist/Dialog.d.ts +0 -17
- package/dist/Dialog.js +0 -92
- package/dist/Dialog.js.map +0 -1
- package/dist/Dropdown.d.ts +0 -14
- package/dist/Dropdown.js +0 -65
- package/dist/Dropdown.js.map +0 -1
- package/dist/Emitter.d.ts +0 -6
- package/dist/Emitter.js +0 -19
- package/dist/Emitter.js.map +0 -1
- package/dist/FlexLayout.d.ts +0 -11
- package/dist/FlexLayout.js +0 -18
- package/dist/FlexLayout.js.map +0 -1
- package/dist/Icon.d.ts +0 -12
- package/dist/Icon.js +0 -60
- package/dist/Icon.js.map +0 -1
- package/dist/IconButton.d.ts +0 -11
- package/dist/IconButton.js +0 -34
- package/dist/IconButton.js.map +0 -1
- package/dist/IconLink.d.ts +0 -9
- package/dist/IconLink.js +0 -32
- package/dist/IconLink.js.map +0 -1
- package/dist/IconType.d.ts +0 -1
- package/dist/IconType.js +0 -2
- package/dist/IconType.js.map +0 -1
- package/dist/Interactable.d.ts +0 -50
- package/dist/Interactable.js +0 -169
- package/dist/Interactable.js.map +0 -1
- package/dist/JSSComment.d.ts +0 -10
- package/dist/JSSComment.js +0 -52
- package/dist/JSSComment.js.map +0 -1
- package/dist/Link.d.ts +0 -22
- package/dist/Link.js +0 -29
- package/dist/Link.js.map +0 -1
- package/dist/List.d.ts +0 -15
- package/dist/List.js +0 -29
- package/dist/List.js.map +0 -1
- package/dist/ListButtonItem.d.ts +0 -14
- package/dist/ListButtonItem.js +0 -11
- package/dist/ListButtonItem.js.map +0 -1
- package/dist/ListDivider.d.ts +0 -1
- package/dist/ListDivider.js +0 -12
- package/dist/ListDivider.js.map +0 -1
- package/dist/ListHeaderItem.d.ts +0 -10
- package/dist/ListHeaderItem.js +0 -15
- package/dist/ListHeaderItem.js.map +0 -1
- package/dist/ListItem.d.ts +0 -9
- package/dist/ListItem.js +0 -9
- package/dist/ListItem.js.map +0 -1
- package/dist/ListLinkItem.d.ts +0 -16
- package/dist/ListLinkItem.js +0 -11
- package/dist/ListLinkItem.js.map +0 -1
- package/dist/ListSpacer.d.ts +0 -1
- package/dist/ListSpacer.js +0 -13
- package/dist/ListSpacer.js.map +0 -1
- package/dist/MenuIcon.d.ts +0 -5
- package/dist/MenuIcon.js +0 -31
- package/dist/MenuIcon.js.map +0 -1
- package/dist/NextJSRouter.d.ts +0 -1
- package/dist/NextJSRouter.js +0 -37
- package/dist/NextJSRouter.js.map +0 -1
- package/dist/NextJSRouterState.d.ts +0 -38
- package/dist/NextJSRouterState.js +0 -111
- package/dist/NextJSRouterState.js.map +0 -1
- package/dist/OnVisible.d.ts +0 -5
- package/dist/OnVisible.js +0 -28
- package/dist/OnVisible.js.map +0 -1
- package/dist/Popover.d.ts +0 -22
- package/dist/Popover.js +0 -90
- package/dist/Popover.js.map +0 -1
- package/dist/ProgressBar.d.ts +0 -7
- package/dist/ProgressBar.js +0 -42
- package/dist/ProgressBar.js.map +0 -1
- package/dist/ProgressCircle.d.ts +0 -5
- package/dist/ProgressCircle.js +0 -12
- package/dist/ProgressCircle.js.map +0 -1
- package/dist/Providers.d.ts +0 -9
- package/dist/Providers.js +0 -16
- package/dist/Providers.js.map +0 -1
- package/dist/RangeInput.d.ts +0 -14
- package/dist/RangeInput.js +0 -32
- package/dist/RangeInput.js.map +0 -1
- package/dist/ResultOrError.d.ts +0 -13
- package/dist/ResultOrError.js +0 -7
- package/dist/ResultOrError.js.map +0 -1
- package/dist/RootView.d.ts +0 -5
- package/dist/RootView.js +0 -35
- package/dist/RootView.js.map +0 -1
- package/dist/Row.d.ts +0 -6
- package/dist/Row.js +0 -7
- package/dist/Row.js.map +0 -1
- package/dist/Select.d.ts +0 -9
- package/dist/Select.js +0 -17
- package/dist/Select.js.map +0 -1
- package/dist/StackContext.d.ts +0 -8
- package/dist/StackContext.js +0 -25
- package/dist/StackContext.js.map +0 -1
- package/dist/StaticCheckbox.d.ts +0 -16
- package/dist/StaticCheckbox.js +0 -48
- package/dist/StaticCheckbox.js.map +0 -1
- package/dist/Storage.d.ts +0 -13
- package/dist/Storage.js +0 -146
- package/dist/Storage.js.map +0 -1
- package/dist/Stream.d.ts +0 -9
- package/dist/Stream.js +0 -36
- package/dist/Stream.js.map +0 -1
- package/dist/Sublist.d.ts +0 -12
- package/dist/Sublist.js +0 -18
- package/dist/Sublist.js.map +0 -1
- package/dist/SubmitIconInput.d.ts +0 -8
- package/dist/SubmitIconInput.js +0 -25
- package/dist/SubmitIconInput.js.map +0 -1
- package/dist/Tabs.d.ts +0 -23
- package/dist/Tabs.js +0 -39
- package/dist/Tabs.js.map +0 -1
- package/dist/Text.d.ts +0 -25
- package/dist/Text.js +0 -52
- package/dist/Text.js.map +0 -1
- package/dist/TextArea.d.ts +0 -11
- package/dist/TextArea.js +0 -27
- package/dist/TextArea.js.map +0 -1
- package/dist/TextInput.d.ts +0 -15
- package/dist/TextInput.js +0 -61
- package/dist/TextInput.js.map +0 -1
- package/dist/TextInputWithState.d.ts +0 -8
- package/dist/TextInputWithState.js +0 -14
- package/dist/TextInputWithState.js.map +0 -1
- package/dist/TextPairing.d.ts +0 -21
- package/dist/TextPairing.js +0 -26
- package/dist/TextPairing.js.map +0 -1
- package/dist/TimeInput.d.ts +0 -15
- package/dist/TimeInput.js +0 -58
- package/dist/TimeInput.js.map +0 -1
- package/dist/Tooltip.d.ts +0 -11
- package/dist/Tooltip.js +0 -73
- package/dist/Tooltip.js.map +0 -1
- package/dist/aria.d.ts +0 -8
- package/dist/aria.js +0 -42
- package/dist/aria.js.map +0 -1
- package/dist/guid.d.ts +0 -1
- package/dist/guid.js +0 -7
- package/dist/guid.js.map +0 -1
- package/dist/hash.d.ts +0 -1
- package/dist/hash.js +0 -20
- package/dist/hash.js.map +0 -1
- package/dist/isServer.d.ts +0 -1
- package/dist/isServer.js +0 -4
- package/dist/isServer.js.map +0 -1
- package/dist/jss.d.ts +0 -122
- package/dist/jss.js +0 -515
- package/dist/jss.js.map +0 -1
- package/dist/numberToBase.d.ts +0 -1
- package/dist/numberToBase.js +0 -44
- package/dist/numberToBase.js.map +0 -1
- package/dist/stateMachineContextFactory.d.ts +0 -36
- package/dist/stateMachineContextFactory.js +0 -48
- package/dist/stateMachineContextFactory.js.map +0 -1
- package/dist/useCookie.d.ts +0 -9
- package/dist/useCookie.js +0 -67
- package/dist/useCookie.js.map +0 -1
- package/dist/useKeyboard.d.ts +0 -8
- package/dist/useKeyboard.js +0 -26
- package/dist/useKeyboard.js.map +0 -1
- package/dist/useNavigation.d.ts +0 -5
- package/dist/useNavigation.js +0 -79
- package/dist/useNavigation.js.map +0 -1
- package/dist/usePromise.d.ts +0 -1
- package/dist/usePromise.js +0 -12
- package/dist/usePromise.js.map +0 -1
- package/dist/useRefEffect.d.ts +0 -1
- package/dist/useRefEffect.js +0 -15
- package/dist/useRefEffect.js.map +0 -1
- package/jss-debug-loader.mjs +0 -44
- package/next-env.d.ts +0 -6
- package/next.config.js +0 -33
- package/scripts/embeddings.js +0 -93
- package/scripts/openai_embeddings.js +0 -100
- package/scripts/publish.js +0 -28
- package/scripts/test_embeddings.js +0 -47
- package/src/Badge.tsx +0 -36
- package/src/BaseButton.tsx +0 -62
- package/src/BaseInput.tsx +0 -63
- package/src/BaseLink.tsx +0 -80
- package/src/BaseList.tsx +0 -26
- package/src/BaseListAddOn.tsx +0 -10
- package/src/BaseListItem.tsx +0 -119
- package/src/BaseView.tsx +0 -57
- package/src/Box.tsx +0 -20
- package/src/Button.tsx +0 -90
- package/src/Calendar.tsx +0 -123
- package/src/Card.tsx +0 -30
- package/src/Checkbox.tsx +0 -63
- package/src/Circle.tsx +0 -24
- package/src/Column.tsx +0 -12
- package/src/DarkMode.tsx +0 -100
- package/src/DateInput.tsx +0 -63
- package/src/DatePicker.tsx +0 -67
- package/src/DatetimeInput.tsx +0 -64
- package/src/DesignBook.tsx +0 -677
- package/src/Dialog.tsx +0 -150
- package/src/Dropdown.tsx +0 -146
- package/src/Emitter.ts +0 -26
- package/src/FlexLayout.tsx +0 -53
- package/src/Icon.tsx +0 -80
- package/src/IconButton.tsx +0 -81
- package/src/IconLink.tsx +0 -59
- package/src/IconType.ts +0 -787
- package/src/Interactable.tsx +0 -210
- package/src/JSSComment.tsx +0 -56
- package/src/Link.tsx +0 -110
- package/src/List.tsx +0 -58
- package/src/ListButtonItem.tsx +0 -69
- package/src/ListDivider.tsx +0 -13
- package/src/ListHeaderItem.tsx +0 -45
- package/src/ListItem.tsx +0 -24
- package/src/ListLinkItem.tsx +0 -76
- package/src/ListSpacer.tsx +0 -14
- package/src/MenuIcon.tsx +0 -50
- package/src/NextJSRouter.tsx +0 -60
- package/src/NextJSRouterState.tsx +0 -154
- package/src/OnVisible.tsx +0 -42
- package/src/Popover.tsx +0 -145
- package/src/ProgressBar.tsx +0 -63
- package/src/ProgressCircle.tsx +0 -38
- package/src/Providers.tsx +0 -33
- package/src/RangeInput.tsx +0 -82
- package/src/ResultOrError.ts +0 -15
- package/src/RootView.tsx +0 -55
- package/src/Row.tsx +0 -12
- package/src/Select.tsx +0 -39
- package/src/StackContext.tsx +0 -52
- package/src/StaticCheckbox.tsx +0 -72
- package/src/Storage.tsx +0 -198
- package/src/Stream.tsx +0 -50
- package/src/Sublist.tsx +0 -61
- package/src/SubmitIconInput.tsx +0 -45
- package/src/Tabs.tsx +0 -110
- package/src/Text.tsx +0 -111
- package/src/TextArea.tsx +0 -58
- package/src/TextInput.tsx +0 -123
- package/src/TextInputWithState.tsx +0 -32
- package/src/TextPairing.tsx +0 -115
- package/src/TimeInput.tsx +0 -109
- package/src/Tooltip.tsx +0 -109
- package/src/aria.ts +0 -72
- package/src/docs/mdx.tsx +0 -137
- package/src/docs/pages.ts +0 -115
- package/src/docs/searchIndex.ts +0 -1
- package/src/examples/ExampleDialog.tsx +0 -28
- package/src/guid.ts +0 -7
- package/src/hash.ts +0 -21
- package/src/index.ts +0 -68
- package/src/isServer.ts +0 -3
- package/src/jss.tsx +0 -712
- package/src/jsx-dev-runtime.ts +0 -74
- package/src/jsx-runtime.ts +0 -2
- package/src/numberToBase.ts +0 -52
- package/src/pages/Badge.mdx +0 -152
- package/src/pages/Button.mdx +0 -163
- package/src/pages/Calendar.mdx +0 -254
- package/src/pages/Card.mdx +0 -147
- package/src/pages/Checkbox.mdx +0 -131
- package/src/pages/Dialog.mdx +0 -197
- package/src/pages/FlexLayout.mdx +0 -211
- package/src/pages/Hashing.mdx +0 -211
- package/src/pages/Icon.mdx +0 -171
- package/src/pages/IconButton.mdx +0 -155
- package/src/pages/Link.mdx +0 -160
- package/src/pages/List.mdx +0 -262
- package/src/pages/ListHeader.mdx +0 -220
- package/src/pages/Popover.mdx +0 -223
- package/src/pages/ProgressBar.mdx +0 -200
- package/src/pages/ProgressCircle.mdx +0 -218
- package/src/pages/RangeInput.mdx +0 -237
- package/src/pages/Tabs.mdx +0 -281
- package/src/pages/Text.mdx +0 -154
- package/src/pages/TextInput.mdx +0 -235
- package/src/pages/TextPairing.mdx +0 -204
- package/src/pages/TimeInput.mdx +0 -178
- package/src/pages/Tooltip.mdx +0 -115
- package/src/pages/_app.tsx +0 -466
- package/src/pages/_document.tsx +0 -30
- package/src/pages/css-in-js.mdx +0 -240
- package/src/pages/index.mdx +0 -58
- package/src/pages/navigation.mdx +0 -158
- package/src/pages/prism.css +0 -3
- package/src/pages/useCookie.mdx +0 -176
- package/src/pages/useKeyboard.mdx +0 -257
- package/src/pages/useNavigation.mdx +0 -258
- package/src/pages/usePromise.mdx +0 -280
- package/src/pages/useRefEffect.mdx +0 -251
- package/src/stateMachineContextFactory.tsx +0 -111
- package/src/useCookie.tsx +0 -95
- package/src/useKeyboard.tsx +0 -43
- package/src/useNavigation.tsx +0 -89
- package/src/usePromise.tsx +0 -18
- package/src/useRefEffect.tsx +0 -18
- package/src/vite-plugin-jss-debug.ts +0 -77
- package/tsconfig.build.json +0 -23
- package/tsconfig.json +0 -38
package/src/pages/Tabs.mdx
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { Column } from "../Column";
|
|
2
|
-
import { Row } from "../Row";
|
|
3
|
-
import { Tabs } from "../Tabs";
|
|
4
|
-
import { Badge } from "../Badge";
|
|
5
|
-
import { Span } from "../Text";
|
|
6
|
-
import { cssVar } from "../jss";
|
|
7
|
-
|
|
8
|
-
# Tabs
|
|
9
|
-
|
|
10
|
-
A horizontal tab navigation component with full keyboard support and ARIA compliance. Tabs can render as links or buttons and support custom styling, add-ons, and label rendering.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Props
|
|
15
|
-
|
|
16
|
-
### Tabs
|
|
17
|
-
|
|
18
|
-
| Prop | Type | Default | Description |
|
|
19
|
-
|------|------|---------|-------------|
|
|
20
|
-
| `aria-controls` | `string` | Required | ID of the content panel this tab controls |
|
|
21
|
-
| `tabs` | `Tab[]` | Required | Array of tab configurations |
|
|
22
|
-
| `labelSize` | `Size` | `"large"` | Text size for tab labels |
|
|
23
|
-
| `tabPadding` | `Padding` | `"medium"` | Padding inside each tab |
|
|
24
|
-
| `gap` | `Gap` | `"none"` | Space between tabs |
|
|
25
|
-
| `jssTab` | `JSS \| (data) => JSS` | - | Custom styles for tabs (can be conditional on selected state) |
|
|
26
|
-
| `labelRenderer` | `(label: string) => ReactNode` | - | Custom label rendering function |
|
|
27
|
-
|
|
28
|
-
### Tab object
|
|
29
|
-
|
|
30
|
-
| Property | Type | Default | Description |
|
|
31
|
-
|----------|------|---------|-------------|
|
|
32
|
-
| `label` | `string` | Required | Tab display text |
|
|
33
|
-
| `href` | `string` | - | Link URL (renders as link if provided) |
|
|
34
|
-
| `onClick` | `() => void` | - | Click handler (renders as button if no href) |
|
|
35
|
-
| `selected` | `boolean` | `false` | Whether this tab is currently selected |
|
|
36
|
-
| `addOn` | `ReactNode` | - | Additional element (e.g., badge, icon) |
|
|
37
|
-
| `addOnPosition` | `"start" \| "end"` | `"start"` | Position of add-on relative to label |
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Basic usage
|
|
42
|
-
|
|
43
|
-
<Column gap="medium">
|
|
44
|
-
<Tabs
|
|
45
|
-
aria-controls="panel-1"
|
|
46
|
-
tabs={[
|
|
47
|
-
{ href: "/Tabs", selected: true, label: "Tab 1" },
|
|
48
|
-
{ href: "/Tabs", selected: false, label: "Tab 2" },
|
|
49
|
-
{ href: "/Tabs", selected: false, label: "Tab 3" },
|
|
50
|
-
]}
|
|
51
|
-
/>
|
|
52
|
-
</Column>
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
<Tabs
|
|
56
|
-
aria-controls="panel-1"
|
|
57
|
-
tabs={[
|
|
58
|
-
{ href: "/Tabs", selected: true, label: "Tab 1" },
|
|
59
|
-
{ href: "/Tabs", selected: false, label: "Tab 2" },
|
|
60
|
-
{ href: "/Tabs", selected: false, label: "Tab 3" },
|
|
61
|
-
]}
|
|
62
|
-
/>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## With add-ons
|
|
68
|
-
|
|
69
|
-
Add badges, icons, or other elements to tabs:
|
|
70
|
-
|
|
71
|
-
<Column gap="medium">
|
|
72
|
-
<Tabs
|
|
73
|
-
aria-controls="panel-2"
|
|
74
|
-
tabs={[
|
|
75
|
-
{ href: "/Tabs", selected: false, label: "Messages" },
|
|
76
|
-
{
|
|
77
|
-
href: "/Tabs",
|
|
78
|
-
selected: true,
|
|
79
|
-
label: "Notifications",
|
|
80
|
-
addOn: <Badge jss={{ margin: cssVar("--spacing-m") }} color="negative" size="small" />,
|
|
81
|
-
},
|
|
82
|
-
{ href: "/Tabs", selected: false, label: "Settings" },
|
|
83
|
-
]}
|
|
84
|
-
/>
|
|
85
|
-
<Tabs
|
|
86
|
-
aria-controls="panel-3"
|
|
87
|
-
tabs={[
|
|
88
|
-
{ href: "/Tabs", selected: false, label: "Overview" },
|
|
89
|
-
{ href: "/Tabs", selected: false, label: "Analytics" },
|
|
90
|
-
{
|
|
91
|
-
href: "/Tabs",
|
|
92
|
-
selected: true,
|
|
93
|
-
label: "New",
|
|
94
|
-
addOn: <Badge jss={{ margin: cssVar("--spacing-m") }} color="highlight" size="medium" />,
|
|
95
|
-
addOnPosition: "end",
|
|
96
|
-
},
|
|
97
|
-
]}
|
|
98
|
-
/>
|
|
99
|
-
</Column>
|
|
100
|
-
|
|
101
|
-
```js
|
|
102
|
-
// Badge before label (default)
|
|
103
|
-
<Tabs
|
|
104
|
-
aria-controls="panel"
|
|
105
|
-
tabs={[
|
|
106
|
-
{ href: "/messages", selected: false, label: "Messages" },
|
|
107
|
-
{
|
|
108
|
-
href: "/notifications",
|
|
109
|
-
selected: true,
|
|
110
|
-
label: "Notifications",
|
|
111
|
-
addOn: <Badge color="negative" size="small" />,
|
|
112
|
-
},
|
|
113
|
-
]}
|
|
114
|
-
/>
|
|
115
|
-
|
|
116
|
-
// Badge after label
|
|
117
|
-
<Tabs
|
|
118
|
-
aria-controls="panel"
|
|
119
|
-
tabs={[
|
|
120
|
-
{
|
|
121
|
-
href: "/new",
|
|
122
|
-
selected: true,
|
|
123
|
-
label: "New",
|
|
124
|
-
addOn: <Badge color="highlight" size="medium" />,
|
|
125
|
-
addOnPosition: "end",
|
|
126
|
-
},
|
|
127
|
-
]}
|
|
128
|
-
/>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Tabs as buttons
|
|
134
|
-
|
|
135
|
-
Omit `href` to render tabs as buttons. Useful for in-page tab switching:
|
|
136
|
-
|
|
137
|
-
<Column gap="medium">
|
|
138
|
-
<Tabs
|
|
139
|
-
aria-controls="panel-4"
|
|
140
|
-
tabs={[
|
|
141
|
-
{ selected: true, label: "Details" },
|
|
142
|
-
{ selected: false, label: "Reviews" },
|
|
143
|
-
{ selected: false, label: "Related" },
|
|
144
|
-
]}
|
|
145
|
-
/>
|
|
146
|
-
</Column>
|
|
147
|
-
|
|
148
|
-
```js
|
|
149
|
-
const [activeTab, setActiveTab] = useState("details");
|
|
150
|
-
|
|
151
|
-
<Tabs
|
|
152
|
-
aria-controls="content-panel"
|
|
153
|
-
tabs={[
|
|
154
|
-
{
|
|
155
|
-
selected: activeTab === "details",
|
|
156
|
-
label: "Details",
|
|
157
|
-
onClick: () => setActiveTab("details"),
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
selected: activeTab === "reviews",
|
|
161
|
-
label: "Reviews",
|
|
162
|
-
onClick: () => setActiveTab("reviews"),
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
selected: activeTab === "related",
|
|
166
|
-
label: "Related",
|
|
167
|
-
onClick: () => setActiveTab("related"),
|
|
168
|
-
},
|
|
169
|
-
]}
|
|
170
|
-
/>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Custom label rendering
|
|
176
|
-
|
|
177
|
-
Use `labelRenderer` to customize how tab labels are displayed:
|
|
178
|
-
|
|
179
|
-
<Column>
|
|
180
|
-
<Tabs
|
|
181
|
-
aria-controls="panel-5"
|
|
182
|
-
labelRenderer={(value) => value.split(" ").map((word, index) => index % 2 === 0 ? <strong key={index}>{word} </strong> : word + " ")}
|
|
183
|
-
tabs={[
|
|
184
|
-
{ href: "/Tabs", selected: true, label: "Bold Tab 1" },
|
|
185
|
-
{ href: "/Tabs", selected: false, label: "Bold Tab 2" },
|
|
186
|
-
{ href: "/Tabs", selected: false, label: "Bold Tab 3" },
|
|
187
|
-
]}
|
|
188
|
-
/>
|
|
189
|
-
</Column>
|
|
190
|
-
|
|
191
|
-
```js
|
|
192
|
-
<Tabs
|
|
193
|
-
aria-controls="panel"
|
|
194
|
-
labelRenderer={(label) => (
|
|
195
|
-
<>
|
|
196
|
-
<Icon icon="fa-star" size="small" />
|
|
197
|
-
{label}
|
|
198
|
-
</>
|
|
199
|
-
)}
|
|
200
|
-
tabs={[
|
|
201
|
-
{ href: "/featured", selected: true, label: "Featured" },
|
|
202
|
-
{ href: "/popular", selected: false, label: "Popular" },
|
|
203
|
-
]}
|
|
204
|
-
/>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## Custom tab styles
|
|
210
|
-
|
|
211
|
-
Use `jssTab` for custom styling. It can be a static style object or a function that receives the tab's selected state:
|
|
212
|
-
|
|
213
|
-
<Column>
|
|
214
|
-
<Tabs
|
|
215
|
-
aria-controls="panel-6"
|
|
216
|
-
jssTab={(data) => ({
|
|
217
|
-
borderBottom: data.selected ? "2px solid cyan" : "2px solid magenta",
|
|
218
|
-
})}
|
|
219
|
-
tabs={[
|
|
220
|
-
{ href: "/Tabs", selected: true, label: "Styled Tab 1" },
|
|
221
|
-
{ href: "/Tabs", selected: false, label: "Styled Tab 2" },
|
|
222
|
-
{ href: "/Tabs", selected: false, label: "Styled Tab 3" },
|
|
223
|
-
]}
|
|
224
|
-
/>
|
|
225
|
-
</Column>
|
|
226
|
-
|
|
227
|
-
```js
|
|
228
|
-
// Conditional styling based on selection
|
|
229
|
-
<Tabs
|
|
230
|
-
aria-controls="panel"
|
|
231
|
-
jssTab={(data) => ({
|
|
232
|
-
borderBottom: data.selected
|
|
233
|
-
? "3px solid var(--highlight)"
|
|
234
|
-
: "3px solid transparent",
|
|
235
|
-
backgroundColor: data.selected
|
|
236
|
-
? "var(--light-highlight)"
|
|
237
|
-
: "transparent",
|
|
238
|
-
})}
|
|
239
|
-
tabs={tabs}
|
|
240
|
-
/>
|
|
241
|
-
|
|
242
|
-
// Static styling for all tabs
|
|
243
|
-
<Tabs
|
|
244
|
-
aria-controls="panel"
|
|
245
|
-
jssTab={{ borderRadius: 8 }}
|
|
246
|
-
tabs={tabs}
|
|
247
|
-
/>
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## Keyboard navigation
|
|
253
|
-
|
|
254
|
-
Tabs support full keyboard navigation:
|
|
255
|
-
|
|
256
|
-
- **Arrow Left/Right**: Move focus between tabs
|
|
257
|
-
- **Enter/Space**: Activate the focused tab
|
|
258
|
-
- **Home**: Move to first tab
|
|
259
|
-
- **End**: Move to last tab
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
## Accessibility
|
|
264
|
-
|
|
265
|
-
The Tabs component follows WAI-ARIA tab patterns:
|
|
266
|
-
|
|
267
|
-
- Container has `role="tablist"`
|
|
268
|
-
- Each tab has `role="tab"` and `aria-controls` pointing to its panel
|
|
269
|
-
- Selected tab has `aria-selected="true"`
|
|
270
|
-
- Content panel should have `role="tabpanel"` and matching `id`
|
|
271
|
-
|
|
272
|
-
```js
|
|
273
|
-
<Tabs
|
|
274
|
-
aria-controls="settings-panel"
|
|
275
|
-
tabs={tabs}
|
|
276
|
-
/>
|
|
277
|
-
|
|
278
|
-
<div id="settings-panel" role="tabpanel">
|
|
279
|
-
{/* Panel content */}
|
|
280
|
-
</div>
|
|
281
|
-
```
|
package/src/pages/Text.mdx
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { Column } from "../Column";
|
|
2
|
-
import { Row } from "../Row";
|
|
3
|
-
import { Text, Span, P, H1, H2, H3, Li, Label } from "../Text";
|
|
4
|
-
|
|
5
|
-
# Text
|
|
6
|
-
|
|
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.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Props
|
|
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 |
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
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.
|
|
29
|
-
|
|
30
|
-
<Column gap="medium">
|
|
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>
|
|
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>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Sizes
|
|
55
|
-
|
|
56
|
-
Text sizes map to CSS custom properties, ensuring consistency with the theme system.
|
|
57
|
-
|
|
58
|
-
<Column gap="medium">
|
|
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>
|
|
66
|
-
</Column>
|
|
67
|
-
|
|
68
|
-
```js
|
|
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>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Colors
|
|
81
|
-
|
|
82
|
-
Semantic colors ensure text adapts correctly to light and dark themes.
|
|
83
|
-
|
|
84
|
-
<Column gap="medium">
|
|
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>
|
|
92
|
-
</Column>
|
|
93
|
-
|
|
94
|
-
```js
|
|
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>
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Bold text
|
|
105
|
-
|
|
106
|
-
<Row gap="large">
|
|
107
|
-
<Text bold>Bold text for emphasis</Text>
|
|
108
|
-
<Text>Regular weight text</Text>
|
|
109
|
-
</Row>
|
|
110
|
-
|
|
111
|
-
```js
|
|
112
|
-
<Text bold>Important information</Text>
|
|
113
|
-
<Text>Regular text</Text>
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## Ellipsis truncation
|
|
119
|
-
|
|
120
|
-
By default, `Span` and `Label` components truncate text with ellipsis. Other components wrap by default.
|
|
121
|
-
|
|
122
|
-
<Column gap="medium" jss={{ maxWidth: 300 }}>
|
|
123
|
-
<Span>
|
|
124
|
-
This span text will truncate with ellipsis when it overflows the container width
|
|
125
|
-
</Span>
|
|
126
|
-
<P>
|
|
127
|
-
This paragraph text will wrap to multiple lines when it exceeds the container width instead of truncating
|
|
128
|
-
</P>
|
|
129
|
-
</Column>
|
|
130
|
-
|
|
131
|
-
```js
|
|
132
|
-
// Truncates by default
|
|
133
|
-
<Span>Long text that will be truncated...</Span>
|
|
134
|
-
|
|
135
|
-
// Force truncation on any text component
|
|
136
|
-
<P ellipsis>This paragraph will truncate</P>
|
|
137
|
-
|
|
138
|
-
// Disable truncation on span
|
|
139
|
-
<Span ellipsis={false}>This span will wrap</Span>
|
|
140
|
-
```
|
|
141
|
-
|
|
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
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { Column } from "../Column";
|
|
2
|
-
import { Row } from "../Row";
|
|
3
|
-
import { Icon } from "../Icon";
|
|
4
|
-
import { TextInput } from "../TextInput";
|
|
5
|
-
|
|
6
|
-
# TextInput
|
|
7
|
-
|
|
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
|
-
|
|
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
|
|
35
|
-
|
|
36
|
-
<Column gap="medium">
|
|
37
|
-
<TextInput
|
|
38
|
-
value=""
|
|
39
|
-
placeholder="Enter your name"
|
|
40
|
-
onValueChange={() => {}}
|
|
41
|
-
/>
|
|
42
|
-
<TextInput
|
|
43
|
-
value="John Doe"
|
|
44
|
-
onValueChange={() => {}}
|
|
45
|
-
/>
|
|
46
|
-
</Column>
|
|
47
|
-
|
|
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
|
-
|
|
64
|
-
<Column gap="medium">
|
|
65
|
-
<TextInput
|
|
66
|
-
value="john@example.com"
|
|
67
|
-
addOn={<Icon icon="fa-envelope" color="primary" size="medium" />}
|
|
68
|
-
onValueChange={() => {}}
|
|
69
|
-
/>
|
|
70
|
-
<TextInput
|
|
71
|
-
value=""
|
|
72
|
-
placeholder="Search..."
|
|
73
|
-
addOn={<Icon icon="fa-search" color="secondary" size="medium" />}
|
|
74
|
-
onValueChange={() => {}}
|
|
75
|
-
/>
|
|
76
|
-
<TextInput
|
|
77
|
-
value="Secret"
|
|
78
|
-
placeholder="Password"
|
|
79
|
-
addOn={<Icon icon="fa-lock" color="secondary" size="medium" />}
|
|
80
|
-
addOnPosition="end"
|
|
81
|
-
type="password"
|
|
82
|
-
onValueChange={() => {}}
|
|
83
|
-
/>
|
|
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
|
-
/>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Bare variant
|
|
107
|
-
|
|
108
|
-
The `bare` variant removes the border for a minimal look. The background highlights on focus.
|
|
109
|
-
|
|
110
|
-
<Column gap="medium">
|
|
111
|
-
<TextInput
|
|
112
|
-
bare
|
|
113
|
-
value=""
|
|
114
|
-
placeholder="Minimal input"
|
|
115
|
-
onValueChange={() => {}}
|
|
116
|
-
/>
|
|
117
|
-
<TextInput
|
|
118
|
-
bare
|
|
119
|
-
value="With icon"
|
|
120
|
-
addOn={<Icon icon="fa-user" color="primary" size="medium" />}
|
|
121
|
-
onValueChange={() => {}}
|
|
122
|
-
/>
|
|
123
|
-
</Column>
|
|
124
|
-
|
|
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
|
-
|
|
141
|
-
<Column gap="medium">
|
|
142
|
-
<TextInput
|
|
143
|
-
size="small"
|
|
144
|
-
value=""
|
|
145
|
-
placeholder="Small input"
|
|
146
|
-
onValueChange={() => {}}
|
|
147
|
-
/>
|
|
148
|
-
<TextInput
|
|
149
|
-
size="medium"
|
|
150
|
-
value=""
|
|
151
|
-
placeholder="Medium input (default)"
|
|
152
|
-
onValueChange={() => {}}
|
|
153
|
-
/>
|
|
154
|
-
<TextInput
|
|
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
|
|
176
|
-
onValueChange={() => {}}
|
|
177
|
-
/>
|
|
178
|
-
</Column>
|
|
179
|
-
|
|
180
|
-
```js
|
|
181
|
-
<TextInput
|
|
182
|
-
value="Cannot edit"
|
|
183
|
-
disabled
|
|
184
|
-
onValueChange={() => {}}
|
|
185
|
-
/>
|
|
186
|
-
```
|
|
187
|
-
|
|
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
|
-
```
|