@payfit/unity-components 3.29.59 → 3.29.61
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/dist/esm/core/components/action-bar/parts/ActionBarOverflowMenu.d.ts +1 -1
- package/dist/esm/core/components/action-bar/parts/ActionBarPrefixArea.d.ts +1 -1
- package/dist/esm/core/components/actionable/Actionable.js +13 -13
- package/dist/esm/core/components/alert/parts/AlertActions.d.ts +1 -1
- package/dist/esm/core/components/anchor/Anchor.d.ts +1 -1
- package/dist/esm/core/components/app-menu/parts/AppMenu.context.d.ts +1 -1
- package/dist/esm/core/components/autocomplete/Autocomplete.d.ts +1 -1
- package/dist/esm/core/components/autocomplete/parts/AutocompleteItem.d.ts +1 -1
- package/dist/esm/core/components/autocomplete/parts/AutocompleteItemGroup.d.ts +1 -1
- package/dist/esm/core/components/autocomplete/parts/AutocompletePanel.d.ts +1 -1
- package/dist/esm/core/components/avatar/Avatar.d.ts +1 -1
- package/dist/esm/core/components/avatar/Avatar.js +7 -7
- package/dist/esm/core/components/avatar/AvatarWithTooltip.js +4 -4
- package/dist/esm/core/components/avatar/InteractiveAvatar.js +4 -4
- package/dist/esm/core/components/avatar/parts/AvatarPair.d.ts +1 -1
- package/dist/esm/core/components/badge/Badge.d.ts +1 -1
- package/dist/esm/core/components/badge/parts/BadgeDot.d.ts +1 -1
- package/dist/esm/core/components/bottom-sheet/BottomSheet.d.ts +1 -1
- package/dist/esm/core/components/bottom-sheet/parts/BottomSheetContent.d.ts +1 -1
- package/dist/esm/core/components/bottom-sheet/parts/BottomSheetFooter.d.ts +1 -1
- package/dist/esm/core/components/bottom-sheet/parts/BottomSheetHeader.d.ts +1 -1
- package/dist/esm/core/components/bottom-sheet/test-utils.d.ts +1 -1
- package/dist/esm/core/components/breadcrumbs/Breadcrumbs.context.d.ts +1 -1
- package/dist/esm/core/components/breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/esm/core/components/button/Button.d.ts +1 -1
- package/dist/esm/core/components/card/Card.d.ts +1 -1
- package/dist/esm/core/components/card/parts/CardContent.d.ts +1 -1
- package/dist/esm/core/components/checkbox-group/CheckboxGroup.d.ts +1 -1
- package/dist/esm/core/components/client-side-pagination/ClientSidePagination.d.ts +1 -1
- package/dist/esm/core/components/client-side-pagination/parts/PaginationEllipsis.d.ts +1 -1
- package/dist/esm/core/components/client-side-pagination/parts/PaginationJumpDialog.js +8 -8
- package/dist/esm/core/components/client-side-pagination/parts/RawPaginationLink.d.ts +1 -1
- package/dist/esm/core/components/collapsible/Collapsible.d.ts +1 -1
- package/dist/esm/core/components/collapsible/parts/CollapsibleContent.d.ts +1 -1
- package/dist/esm/core/components/collapsible-group/CollapsibleGroup.d.ts +1 -1
- package/dist/esm/core/components/dialog/Dialog.d.ts +1 -1
- package/dist/esm/core/components/dialog/parts/DialogActions/DialogButton.d.ts +1 -1
- package/dist/esm/core/components/dropzone/DropzoneOverlay.js +6 -6
- package/dist/esm/core/components/error-state/ErrorState.d.ts +1 -1
- package/dist/esm/core/components/error-state/initConfig.d.ts +2 -2
- package/dist/esm/core/components/error-state/initConfig.js +7 -7
- package/dist/esm/core/components/fieldset/Fieldset.d.ts +1 -1
- package/dist/esm/core/components/filter/Filter.types.d.ts +1 -1
- package/dist/esm/core/components/filter/parts/FilterButton.d.ts +2 -2
- package/dist/esm/core/components/filter/parts/FilterPopover.d.ts +1 -1
- package/dist/esm/core/components/filter-toolbar/parts/AddFilter.d.ts +1 -1
- package/dist/esm/core/components/filter-toolbar/parts/AddFilterItem.d.ts +1 -1
- package/dist/esm/core/components/funnel-layout/FunnelLayout.context.d.ts +1 -1
- package/dist/esm/core/components/funnel-layout/parts/FunnelBody.d.ts +1 -1
- package/dist/esm/core/components/funnel-layout/parts/FunnelPage.d.ts +1 -1
- package/dist/esm/core/components/funnel-layout/parts/FunnelPageContent.d.ts +1 -1
- package/dist/esm/core/components/funnel-layout/parts/FunnelPageFooter.d.ts +1 -1
- package/dist/esm/core/components/funnel-layout/parts/FunnelPageHeader.d.ts +1 -1
- package/dist/esm/core/components/funnel-layout/parts/FunnelSidebar.d.ts +1 -1
- package/dist/esm/core/components/icon/Icon.d.ts +1 -1
- package/dist/esm/core/components/icon-button/CircularIconButton.d.ts +1 -1
- package/dist/esm/core/components/icon-button/IconButton.d.ts +1 -1
- package/dist/esm/core/components/link/RawLink.d.ts +1 -1
- package/dist/esm/core/components/link-button/RawLinkButton.d.ts +1 -1
- package/dist/esm/core/components/menu/parts/MenuHeader.d.ts +1 -1
- package/dist/esm/core/components/menu/parts/MenuTrigger.d.ts +1 -1
- package/dist/esm/core/components/multi-select/MultiSelect.js +8 -8
- package/dist/esm/core/components/nav/parts/RawNavItem.d.ts +1 -1
- package/dist/esm/core/components/number-input/NumberInput.d.ts +1 -1
- package/dist/esm/core/components/page/Page.d.ts +1 -1
- package/dist/esm/core/components/page/parts/PageHeader.d.ts +1 -1
- package/dist/esm/core/components/pagination/Pagination.d.ts +1 -1
- package/dist/esm/core/components/pagination/parts/PaginationContent.d.ts +1 -1
- package/dist/esm/core/components/pagination/parts/PaginationEllipsis.d.ts +1 -1
- package/dist/esm/core/components/pagination/parts/RawPaginationLink.d.ts +1 -1
- package/dist/esm/core/components/pagination/parts/RawPaginationNext.d.ts +1 -1
- package/dist/esm/core/components/pagination/parts/RawPaginationPrevious.d.ts +1 -1
- package/dist/esm/core/components/phone-number/parts/PhoneNumberItem.d.ts +1 -1
- package/dist/esm/core/components/pill/Pill.d.ts +1 -1
- package/dist/esm/core/components/progress-bar/ProgressBar.d.ts +1 -1
- package/dist/esm/core/components/promo-dialog/PromoDialog.d.ts +1 -1
- package/dist/esm/core/components/radio-button-group/parts/RadioButton.d.ts +1 -1
- package/dist/esm/core/components/radio-button-group/parts/RadioIndicator.d.ts +1 -1
- package/dist/esm/core/components/search/Search.d.ts +1 -1
- package/dist/esm/core/components/segmented-button-group/parts/ToggleButton.d.ts +1 -1
- package/dist/esm/core/components/segmented-button-group/parts/ToggleButton.js +4 -4
- package/dist/esm/core/components/select-list/parts/SelectedItemsSection.d.ts +1 -1
- package/dist/esm/core/components/selectable-button-group/SelectableButtonGroup.d.ts +1 -1
- package/dist/esm/core/components/selectable-button-group/parts/SelectableButton.js +7 -7
- package/dist/esm/core/components/selectable-card/selectable-card-checkbox-group/parts/SelectableCardCheckbox.d.ts +1 -1
- package/dist/esm/core/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.d.ts +1 -1
- package/dist/esm/core/components/side-panel/SidePanel.d.ts +1 -1
- package/dist/esm/core/components/side-panel/parts/SidePanelContent.d.ts +1 -1
- package/dist/esm/core/components/side-panel/parts/SidePanelFooter.d.ts +1 -1
- package/dist/esm/core/components/side-panel/parts/SidePanelHeader.d.ts +1 -1
- package/dist/esm/core/components/stepper/Stepper.context.d.ts +1 -1
- package/dist/esm/core/components/table/parts/TableEmptyState.d.ts +3 -3
- package/dist/esm/core/components/table/parts/TablePagination.d.ts +1 -1
- package/dist/esm/core/components/tabs/Tabs.context.d.ts +1 -1
- package/dist/esm/core/components/tabs/Tabs.d.ts +1 -1
- package/dist/esm/core/components/task-menu/TaskMenu.d.ts +1 -1
- package/dist/esm/core/components/task-menu/parts/RawTask.d.ts +1 -1
- package/dist/esm/core/components/text/Text.d.ts +1 -1
- package/dist/esm/core/components/timeline/Timeline.d.ts +1 -1
- package/dist/esm/core/components/toast/UnityToast.d.ts +1 -1
- package/dist/esm/core/components/toast/parts/ToastAction.d.ts +1 -1
- package/dist/esm/core/components/toggle-switch/ToggleSwitch.d.ts +1 -1
- package/dist/esm/core/components/toggle-switch-group/ToggleSwitchGroup.d.ts +1 -1
- package/dist/esm/docs/reference/catalog/CatalogCard.d.ts +1 -1
- package/dist/esm/modules/ai-kit/components/ai-button/AIButton.d.ts +1 -1
- package/dist/esm/modules/ai-kit/components/ai-composer/parts/AIComposerActions.d.ts +1 -1
- package/dist/esm/modules/ai-kit/components/ai-composer/parts/AIComposerAttachment.d.ts +1 -1
- package/dist/esm/modules/ai-kit/components/ai-outcome-card/parts/AIOutcomeCardActions.d.ts +1 -1
- package/dist/esm/modules/ai-kit/components/ai-structured-input/hooks/use-ai-structured-input-navigation.d.ts +1 -4
- package/dist/esm/modules/ai-kit/components/proposal-card/ProposalCard.d.ts +1 -1
- package/dist/esm/modules/ai-kit/index.d.ts +4 -4
- package/dist/esm/modules/tanstack-form/components/checkbox-field/TanstackCheckboxField.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/checkbox-group-field/TanstackCheckGroupField.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/date-picker-field/TanstackDatePickerField.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/date-range-picker-field/TanstackDateRangePickerField.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/inline-field/parts/InlineFieldReadView.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/inline-field-group/parts/InlineFieldGroupReadView.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/password-field/parts/PasswordFieldDetails.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/password-field/parts/ValidationRuleItem.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/components/text-field/TanstackTextField.d.ts +1 -1
- package/dist/esm/modules/tanstack-form/hooks/tanstack-form-default-values.d.ts +1 -4
- package/dist/esm/modules/tanstack-table/components/data-table/DataTable.d.ts +1 -1
- package/dist/esm/modules/tanstack-table/components/data-table/DataTable.js +7 -7
- package/package.json +6 -6
- package/skills/unity-data-table/SKILL.md +9 -10
- package/skills/unity-data-table/references/patterns.md +28 -30
- package/skills/unity-find-component/SKILL.md +23 -26
- package/skills/unity-layout/SKILL.md +16 -4
- package/skills/unity-layout/references/patterns.md +10 -2
- package/skills/unity-migrate-from-midnight/SKILL.md +8 -2
- package/skills/unity-navigation/SKILL.md +3 -2
- package/skills/unity-navigation/references/patterns.md +9 -7
- package/skills/unity-overlays/SKILL.md +8 -2
- package/skills/unity-overlays/references/patterns.md +21 -22
- package/skills/unity-tanstack-form/SKILL.md +18 -15
- package/skills/unity-tanstack-form/references/patterns.md +3 -5
|
@@ -7,7 +7,12 @@ alignment.
|
|
|
7
7
|
|
|
8
8
|
```tsx
|
|
9
9
|
import { Flex, FlexItem } from '@payfit/unity-components'
|
|
10
|
-
;<Flex
|
|
10
|
+
;<Flex
|
|
11
|
+
direction="row"
|
|
12
|
+
gap="200"
|
|
13
|
+
justify="between"
|
|
14
|
+
align="center"
|
|
15
|
+
>
|
|
11
16
|
<FlexItem grow="1">Left</FlexItem>
|
|
12
17
|
<FlexItem>Right</FlexItem>
|
|
13
18
|
</Flex>
|
|
@@ -23,7 +28,10 @@ with either `area` or the column props; do not combine the two strategies.
|
|
|
23
28
|
|
|
24
29
|
```tsx
|
|
25
30
|
import { Grid, GridItem } from '@payfit/unity-components'
|
|
26
|
-
;<Grid
|
|
31
|
+
;<Grid
|
|
32
|
+
cols={12}
|
|
33
|
+
className="uy:gap-200"
|
|
34
|
+
>
|
|
27
35
|
<GridItem colSpan={8}>Main</GridItem>
|
|
28
36
|
<GridItem colSpan={4}>Aside</GridItem>
|
|
29
37
|
</Grid>
|
|
@@ -117,7 +117,10 @@ Source: libs/shared/unity/components/src/core/components/tooltip/Tooltip.tsx
|
|
|
117
117
|
Wrong:
|
|
118
118
|
|
|
119
119
|
```tsx
|
|
120
|
-
<Button
|
|
120
|
+
<Button
|
|
121
|
+
visual="danger"
|
|
122
|
+
onClick={handleDelete}
|
|
123
|
+
>
|
|
121
124
|
Delete
|
|
122
125
|
</Button>
|
|
123
126
|
```
|
|
@@ -125,7 +128,10 @@ Wrong:
|
|
|
125
128
|
Correct:
|
|
126
129
|
|
|
127
130
|
```tsx
|
|
128
|
-
<Button
|
|
131
|
+
<Button
|
|
132
|
+
color="danger"
|
|
133
|
+
onPress={handleDelete}
|
|
134
|
+
>
|
|
129
135
|
Delete
|
|
130
136
|
</Button>
|
|
131
137
|
```
|
|
@@ -35,6 +35,8 @@ integration entry. No `RouterProvider` is required — the integration uses
|
|
|
35
35
|
Tanstack hooks directly.
|
|
36
36
|
|
|
37
37
|
```tsx
|
|
38
|
+
import { Outlet } from '@tanstack/react-router'
|
|
39
|
+
|
|
38
40
|
import {
|
|
39
41
|
Breadcrumb,
|
|
40
42
|
BreadcrumbLink,
|
|
@@ -45,7 +47,6 @@ import {
|
|
|
45
47
|
TabPanel,
|
|
46
48
|
Tabs,
|
|
47
49
|
} from '@payfit/unity-components/integrations/tanstack-router'
|
|
48
|
-
import { Outlet } from '@tanstack/react-router'
|
|
49
50
|
|
|
50
51
|
export function EmployeesShell() {
|
|
51
52
|
return (
|
|
@@ -199,7 +200,7 @@ Correct:
|
|
|
199
200
|
|
|
200
201
|
```tsx
|
|
201
202
|
<RouterProvider
|
|
202
|
-
isActive={path => router.isActive(path)}
|
|
203
|
+
isActive={(path) => router.isActive(path)}
|
|
203
204
|
navigate={router.navigate}
|
|
204
205
|
>
|
|
205
206
|
<App>
|
|
@@ -61,9 +61,12 @@ export function CompositionExamples({
|
|
|
61
61
|
onPageChange={onPageChange}
|
|
62
62
|
>
|
|
63
63
|
<PaginationContent>
|
|
64
|
-
{Array.from({ length: pageCount }, (_, i) => i + 1).map(n => (
|
|
64
|
+
{Array.from({ length: pageCount }, (_, i) => i + 1).map((n) => (
|
|
65
65
|
<PaginationItem key={n}>
|
|
66
|
-
<RawPaginationLink
|
|
66
|
+
<RawPaginationLink
|
|
67
|
+
value={n}
|
|
68
|
+
isActive={n === page}
|
|
69
|
+
>
|
|
67
70
|
{n}
|
|
68
71
|
</RawPaginationLink>
|
|
69
72
|
</PaginationItem>
|
|
@@ -92,20 +95,19 @@ client-side navigation work. The Tanstack integration entry does NOT need
|
|
|
92
95
|
this — it reads from Tanstack hooks directly.
|
|
93
96
|
|
|
94
97
|
```tsx
|
|
95
|
-
import { RouterProvider } from '@payfit/unity-components'
|
|
96
98
|
import { matchPath, useLocation, useNavigate } from 'react-router-dom'
|
|
97
99
|
|
|
100
|
+
import { RouterProvider } from '@payfit/unity-components'
|
|
101
|
+
|
|
98
102
|
export function UnityRouterBridge({ children }: { children: React.ReactNode }) {
|
|
99
103
|
const navigate = useNavigate()
|
|
100
104
|
const location = useLocation()
|
|
101
105
|
|
|
102
106
|
return (
|
|
103
107
|
<RouterProvider
|
|
104
|
-
navigate={to => navigate(to)}
|
|
108
|
+
navigate={(to) => navigate(to)}
|
|
105
109
|
isActive={(to, isExact) =>
|
|
106
|
-
Boolean(
|
|
107
|
-
matchPath({ path: to, end: Boolean(isExact) }, location.pathname),
|
|
108
|
-
)
|
|
110
|
+
Boolean(matchPath({ path: to, end: Boolean(isExact) }, location.pathname))
|
|
109
111
|
}
|
|
110
112
|
>
|
|
111
113
|
{children}
|
|
@@ -49,7 +49,10 @@ export function ConfirmDelete({ onConfirm }: { onConfirm: () => void }) {
|
|
|
49
49
|
<DialogContent>This cannot be undone.</DialogContent>
|
|
50
50
|
<DialogActions>
|
|
51
51
|
<DialogButton variant="close">Cancel</DialogButton>
|
|
52
|
-
<DialogButton
|
|
52
|
+
<DialogButton
|
|
53
|
+
variant="danger"
|
|
54
|
+
onPress={onConfirm}
|
|
55
|
+
>
|
|
53
56
|
Delete
|
|
54
57
|
</DialogButton>
|
|
55
58
|
</DialogActions>
|
|
@@ -185,7 +188,10 @@ Correct:
|
|
|
185
188
|
|
|
186
189
|
```tsx
|
|
187
190
|
// Let Dialog manage focus; use autoFocus on a specific element inside if needed:
|
|
188
|
-
<Dialog
|
|
191
|
+
<Dialog
|
|
192
|
+
isOpen={open}
|
|
193
|
+
onOpenChange={setOpen}
|
|
194
|
+
>
|
|
189
195
|
<input autoFocus />
|
|
190
196
|
</Dialog>
|
|
191
197
|
```
|
|
@@ -20,12 +20,14 @@ export function ArchiveDialog({ onArchive }: { onArchive: () => void }) {
|
|
|
20
20
|
<Dialog size="md">
|
|
21
21
|
<DialogTitle>Archive this employee?</DialogTitle>
|
|
22
22
|
<DialogContent>
|
|
23
|
-
They will no longer appear in active lists. You can restore them
|
|
24
|
-
later.
|
|
23
|
+
They will no longer appear in active lists. You can restore them later.
|
|
25
24
|
</DialogContent>
|
|
26
25
|
<DialogActions>
|
|
27
26
|
<DialogButton variant="close">Cancel</DialogButton>
|
|
28
|
-
<DialogButton
|
|
27
|
+
<DialogButton
|
|
28
|
+
variant="confirm"
|
|
29
|
+
onPress={onArchive}
|
|
30
|
+
>
|
|
29
31
|
Archive
|
|
30
32
|
</DialogButton>
|
|
31
33
|
</DialogActions>
|
|
@@ -54,14 +56,20 @@ export function EmployeeDetailPanel({ employee }: { employee: Employee }) {
|
|
|
54
56
|
return (
|
|
55
57
|
<>
|
|
56
58
|
<Button onPress={() => setIsOpen(true)}>View details</Button>
|
|
57
|
-
<SidePanel
|
|
59
|
+
<SidePanel
|
|
60
|
+
isOpen={isOpen}
|
|
61
|
+
onOpenChange={setIsOpen}
|
|
62
|
+
>
|
|
58
63
|
<SidePanelHeader>{employee.name}</SidePanelHeader>
|
|
59
64
|
<SidePanelContent>
|
|
60
65
|
<p>{employee.position}</p>
|
|
61
66
|
<p>{employee.team}</p>
|
|
62
67
|
</SidePanelContent>
|
|
63
68
|
<SidePanelFooter>
|
|
64
|
-
<Button
|
|
69
|
+
<Button
|
|
70
|
+
variant="secondary"
|
|
71
|
+
onPress={() => setIsOpen(false)}
|
|
72
|
+
>
|
|
65
73
|
Close
|
|
66
74
|
</Button>
|
|
67
75
|
</SidePanelFooter>
|
|
@@ -86,8 +94,8 @@ export function HelpPopover() {
|
|
|
86
94
|
<Button variant="tertiary">What is a working agreement?</Button>
|
|
87
95
|
<Popover title="Working agreement">
|
|
88
96
|
<p>
|
|
89
|
-
A working agreement defines when, where and how an employee works. See
|
|
90
|
-
|
|
97
|
+
A working agreement defines when, where and how an employee works. See the{' '}
|
|
98
|
+
<a href="/handbook/working-agreement">handbook</a> for details.
|
|
91
99
|
</p>
|
|
92
100
|
</Popover>
|
|
93
101
|
</PopoverTrigger>
|
|
@@ -101,25 +109,16 @@ export function HelpPopover() {
|
|
|
101
109
|
`MenuTrigger` / `MenuContent` / `RawMenuItem` for the standard composition.
|
|
102
110
|
|
|
103
111
|
```tsx
|
|
104
|
-
import {
|
|
105
|
-
IconButton,
|
|
106
|
-
Menu,
|
|
107
|
-
MenuContent,
|
|
108
|
-
MenuTrigger,
|
|
109
|
-
RawMenuItem,
|
|
110
|
-
} from '@payfit/unity-components'
|
|
112
|
+
import { IconButton, Menu, MenuContent, MenuTrigger, RawMenuItem } from '@payfit/unity-components'
|
|
111
113
|
|
|
112
|
-
export function RowActions({
|
|
113
|
-
onEdit,
|
|
114
|
-
onArchive,
|
|
115
|
-
}: {
|
|
116
|
-
onEdit: () => void
|
|
117
|
-
onArchive: () => void
|
|
118
|
-
}) {
|
|
114
|
+
export function RowActions({ onEdit, onArchive }: { onEdit: () => void; onArchive: () => void }) {
|
|
119
115
|
return (
|
|
120
116
|
<Menu>
|
|
121
117
|
<MenuTrigger>
|
|
122
|
-
<IconButton
|
|
118
|
+
<IconButton
|
|
119
|
+
icon="MoreFilled"
|
|
120
|
+
title="Actions"
|
|
121
|
+
/>
|
|
123
122
|
</MenuTrigger>
|
|
124
123
|
<MenuContent>
|
|
125
124
|
<RawMenuItem onAction={onEdit}>Edit</RawMenuItem>
|
|
@@ -28,9 +28,10 @@ historical migration context, not a supported API.
|
|
|
28
28
|
## Setup
|
|
29
29
|
|
|
30
30
|
```tsx
|
|
31
|
+
import { z } from 'zod'
|
|
32
|
+
|
|
31
33
|
import { Button } from '@payfit/unity-components'
|
|
32
34
|
import { useTanstackUnityForm } from '@payfit/unity-components/forms'
|
|
33
|
-
import { z } from 'zod'
|
|
34
35
|
|
|
35
36
|
const schema = z.object({
|
|
36
37
|
email: z.email({ message: 'Invalid email' }),
|
|
@@ -50,12 +51,20 @@ export function SignInForm() {
|
|
|
50
51
|
<form.AppForm>
|
|
51
52
|
<form.Form className="uy:space-y-200">
|
|
52
53
|
<form.AppField name="email">
|
|
53
|
-
{field =>
|
|
54
|
+
{(field) => (
|
|
55
|
+
<field.TextField
|
|
56
|
+
label="Email"
|
|
57
|
+
type="email"
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
54
60
|
</form.AppField>
|
|
55
61
|
<form.AppField name="password">
|
|
56
|
-
{field => <field.PasswordField label="Password" />}
|
|
62
|
+
{(field) => <field.PasswordField label="Password" />}
|
|
57
63
|
</form.AppField>
|
|
58
|
-
<Button
|
|
64
|
+
<Button
|
|
65
|
+
variant="primary"
|
|
66
|
+
type="submit"
|
|
67
|
+
>
|
|
59
68
|
Sign in
|
|
60
69
|
</Button>
|
|
61
70
|
</form.Form>
|
|
@@ -109,9 +118,7 @@ Wrong:
|
|
|
109
118
|
|
|
110
119
|
```tsx
|
|
111
120
|
<form.Form>
|
|
112
|
-
<form.AppField name="email">
|
|
113
|
-
{field => <field.TextField label="Email" />}
|
|
114
|
-
</form.AppField>
|
|
121
|
+
<form.AppField name="email">{(field) => <field.TextField label="Email" />}</form.AppField>
|
|
115
122
|
</form.Form>
|
|
116
123
|
```
|
|
117
124
|
|
|
@@ -120,9 +127,7 @@ Correct:
|
|
|
120
127
|
```tsx
|
|
121
128
|
<form.AppForm>
|
|
122
129
|
<form.Form>
|
|
123
|
-
<form.AppField name="email">
|
|
124
|
-
{field => <field.TextField label="Email" />}
|
|
125
|
-
</form.AppField>
|
|
130
|
+
<form.AppField name="email">{(field) => <field.TextField label="Email" />}</form.AppField>
|
|
126
131
|
</form.Form>
|
|
127
132
|
</form.AppForm>
|
|
128
133
|
```
|
|
@@ -136,16 +141,14 @@ Source: src/modules/tanstack-form/components/form/TanstackForm.tsx; src/modules/
|
|
|
136
141
|
Wrong:
|
|
137
142
|
|
|
138
143
|
```tsx
|
|
139
|
-
<form.Subscribe>
|
|
140
|
-
{state => <div>Length: {state.values.password.length}</div>}
|
|
141
|
-
</form.Subscribe>
|
|
144
|
+
<form.Subscribe>{(state) => <div>Length: {state.values.password.length}</div>}</form.Subscribe>
|
|
142
145
|
```
|
|
143
146
|
|
|
144
147
|
Correct:
|
|
145
148
|
|
|
146
149
|
```tsx
|
|
147
|
-
<form.Subscribe selector={s => s.values.password}>
|
|
148
|
-
{password => <div>Length: {password.length}</div>}
|
|
150
|
+
<form.Subscribe selector={(s) => s.values.password}>
|
|
151
|
+
{(password) => <div>Length: {password.length}</div>}
|
|
149
152
|
</form.Subscribe>
|
|
150
153
|
```
|
|
151
154
|
|
|
@@ -34,15 +34,13 @@ Reach for Atomic when you need to interleave custom content between the label an
|
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
36
|
<form.AppField name="password">
|
|
37
|
-
{field => (
|
|
37
|
+
{(field) => (
|
|
38
38
|
<field.Field>
|
|
39
39
|
<field.FieldLabel isRequired>Password</field.FieldLabel>
|
|
40
40
|
<field.FieldHelperText>Enter a strong password</field.FieldHelperText>
|
|
41
41
|
<field.TextInput type="password" />
|
|
42
|
-
<form.Subscribe selector={s => s.values.password}>
|
|
43
|
-
{password =>
|
|
44
|
-
<Text variant="bodySmallStrong">Length: {password.length}</Text>
|
|
45
|
-
)}
|
|
42
|
+
<form.Subscribe selector={(s) => s.values.password}>
|
|
43
|
+
{(password) => <Text variant="bodySmallStrong">Length: {password.length}</Text>}
|
|
46
44
|
</form.Subscribe>
|
|
47
45
|
<field.FieldFeedbackText />
|
|
48
46
|
</field.Field>
|