@payfit/unity-components 1.1.1-beta.1 → 2.0.0
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/adapters/standardSchemaAdapter.d.ts +7 -0
- package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
- package/dist/esm/adapters/zodAdapter.d.ts +13 -0
- package/dist/esm/adapters/zodAdapter.js +74 -0
- package/dist/esm/components/action-bar/ActionBar.js +60 -62
- package/dist/esm/components/actionable/Actionable.d.ts +50 -3
- package/dist/esm/components/actionable/Actionable.js +58 -45
- package/dist/esm/components/app-layout/AppLayout.js +17 -17
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
- package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
- package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
- package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
- package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
- package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
- package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
- package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
- package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
- package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
- package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
- package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +39 -40
- package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
- package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
- package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
- package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
- package/dist/esm/components/code/Code.d.ts +31 -1
- package/dist/esm/components/code/Code.js +39 -0
- package/dist/esm/components/code/copyToClipboard.js +10 -0
- package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
- package/dist/esm/components/data-table/DataTable.d.ts +76 -10
- package/dist/esm/components/data-table/DataTable.js +81 -78
- package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
- package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
- package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
- package/dist/esm/components/date-picker/DatePicker.js +64 -64
- package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
- package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
- package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
- package/dist/esm/components/error-state/ErrorState.d.ts +208 -0
- package/dist/esm/components/error-state/ErrorState.js +194 -0
- package/dist/esm/components/error-state/initConfig.d.ts +16 -0
- package/dist/esm/components/error-state/initConfig.js +149 -0
- package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
- package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
- package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
- package/dist/esm/components/fieldset/Fieldset.js +32 -26
- package/dist/esm/components/flex/Flex.js +52 -37
- package/dist/esm/components/form/Form.d.ts +15 -9
- package/dist/esm/components/form/Form.js +53 -50
- package/dist/esm/components/form-field/FormField.js +18 -17
- package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
- package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
- package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
- package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
- package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/icon/Icon.js +23 -19
- package/dist/esm/components/input/Input.js +28 -28
- package/dist/esm/components/label/Label.js +19 -19
- package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
- package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
- package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
- package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
- package/dist/esm/components/multi-select/MultiSelect.js +94 -94
- package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
- package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
- package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
- package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
- package/dist/esm/components/nav/parts/NavGroup.js +63 -52
- package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
- package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
- package/dist/esm/components/number-field/NumberField.d.ts +3 -3
- package/dist/esm/components/number-input/NumberInput.js +58 -58
- package/dist/esm/components/page/Page.js +1 -1
- package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
- package/dist/esm/components/page/parts/PageHeader.js +22 -20
- package/dist/esm/components/pagination/Pagination.d.ts +23 -44
- package/dist/esm/components/pagination/Pagination.js +89 -167
- package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
- package/dist/esm/components/pagination/PaginationContext.js +15 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
- package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
- package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
- package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
- package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
- package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
- package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
- package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
- package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
- package/dist/esm/components/select/Select.js +63 -45
- package/dist/esm/components/select/parts/SelectOption.js +9 -9
- package/dist/esm/components/select-field/SelectField.d.ts +2 -2
- package/dist/esm/components/select-field/SelectField.js +4 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
- package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
- package/dist/esm/components/skip-links/SkipLinks.js +1 -1
- package/dist/esm/components/table/Table.d.ts +1 -0
- package/dist/esm/components/table/Table.js +110 -98
- package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
- package/dist/esm/components/table/parts/TableBody.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +34 -31
- package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
- package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
- package/dist/esm/components/table/parts/TablePagination.js +61 -59
- package/dist/esm/components/table/parts/TableRow.js +21 -18
- package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
- package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
- package/dist/esm/components/tabs/parts/TabList.js +50 -54
- package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
- package/dist/esm/components/task-menu/parts/Content.js +24 -24
- package/dist/esm/components/task-menu/parts/Header.js +24 -24
- package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +74 -74
- package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +69 -69
- package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
- package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
- package/dist/esm/components/text/Text.js +30 -27
- package/dist/esm/components/text-area/TextArea.js +30 -31
- package/dist/esm/components/text-field/TextField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
- package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
- package/dist/esm/hooks/use-container-query-level.js +33 -0
- package/dist/esm/hooks/use-form.d.ts +5 -5
- package/dist/esm/hooks/use-form.types.d.ts +2 -2
- package/dist/esm/hooks/use-resizable.js +13 -14
- package/dist/esm/index.d.ts +21 -10
- package/dist/esm/index.js +424 -396
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
- package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
- package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router.js +34 -0
- package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
- package/dist/esm/providers/router/RouterProvider.js +14 -10
- package/dist/esm/types/DataAttributes.d.ts +1 -1
- package/dist/esm/types/schema.d.ts +8 -0
- package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
- package/dist/esm/utils/createSchemaAdapter.js +13 -0
- package/dist/esm/utils/platform.js +2 -3
- package/i18n/en-GB.json +16 -0
- package/i18n/es-ES.json +16 -0
- package/i18n/fr-FR.json +16 -0
- package/package.json +56 -31
- package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
- package/dist/esm/components/link/Link.d.ts +0 -93
- package/dist/esm/components/link/Link.js +0 -68
- package/dist/esm/components/nav/parts/NavItem.js +0 -95
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +0 -0
|
@@ -1,42 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { flex as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as M, useMemo as S } from "react";
|
|
3
|
+
import { flex as b } from "./Flex.variants.js";
|
|
4
|
+
const N = M(
|
|
5
5
|
({
|
|
6
|
-
asElement:
|
|
7
|
-
children:
|
|
8
|
-
className:
|
|
9
|
-
inline:
|
|
10
|
-
direction:
|
|
11
|
-
isReversed:
|
|
12
|
-
wrap:
|
|
13
|
-
gap:
|
|
14
|
-
gapX:
|
|
15
|
-
gapY:
|
|
16
|
-
justify:
|
|
17
|
-
align:
|
|
18
|
-
alignContent:
|
|
19
|
-
...
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
asElement: a = "div",
|
|
7
|
+
children: d,
|
|
8
|
+
className: m,
|
|
9
|
+
inline: o,
|
|
10
|
+
direction: r,
|
|
11
|
+
isReversed: e,
|
|
12
|
+
wrap: f,
|
|
13
|
+
gap: s,
|
|
14
|
+
gapX: t,
|
|
15
|
+
gapY: x,
|
|
16
|
+
justify: l,
|
|
17
|
+
align: c,
|
|
18
|
+
alignContent: F,
|
|
19
|
+
...k
|
|
20
|
+
}, p) => {
|
|
21
|
+
const u = S(
|
|
22
|
+
() => b({
|
|
23
|
+
inline: o,
|
|
24
|
+
direction: r,
|
|
25
|
+
isReversed: e,
|
|
26
|
+
wrap: f,
|
|
27
|
+
gap: s,
|
|
28
|
+
gapX: t,
|
|
29
|
+
gapY: x,
|
|
30
|
+
justify: l,
|
|
31
|
+
align: c,
|
|
32
|
+
alignContent: F,
|
|
33
|
+
className: m
|
|
34
|
+
}),
|
|
35
|
+
[
|
|
36
|
+
c,
|
|
37
|
+
F,
|
|
38
|
+
m,
|
|
39
|
+
r,
|
|
40
|
+
s,
|
|
41
|
+
t,
|
|
42
|
+
x,
|
|
43
|
+
o,
|
|
44
|
+
e,
|
|
45
|
+
l,
|
|
46
|
+
f
|
|
47
|
+
]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ E(a, { ref: p, className: u, ...k, children: d });
|
|
35
50
|
}
|
|
36
51
|
);
|
|
37
|
-
|
|
38
|
-
const
|
|
52
|
+
N.displayName = "Flex";
|
|
53
|
+
const v = N;
|
|
39
54
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
N as Flex,
|
|
56
|
+
v as Stack
|
|
42
57
|
};
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { default as React, PropsWithChildren, Ref } from 'react';
|
|
2
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import { FormProps as AriaFormProps } from 'react-aria-components';
|
|
3
4
|
import { FieldErrors, UseFormReturn } from 'react-hook-form';
|
|
4
|
-
import { infer as ZodInfer } from 'zod';
|
|
5
5
|
import { Schema, TFormValues } from '../../hooks/use-form.types.js';
|
|
6
6
|
type AllowedAriaFormProps = Omit<AriaFormProps, 'action' | 'onSubmit' | 'method' | 'target' | 'validationErrors' | 'onInvalid'>;
|
|
7
|
-
export interface FormProps<TSchema extends Schema,
|
|
7
|
+
export interface FormProps<TSchema extends Schema, TFormInputValues extends TFormValues = StandardSchemaV1.InferInput<TSchema>, TFormOutputs extends TFormValues = StandardSchemaV1.InferOutput<TSchema>, TActionResult = unknown> extends PropsWithChildren<AllowedAriaFormProps> {
|
|
8
8
|
/** The form instance from react-hook-form */
|
|
9
|
-
form: UseFormReturn<
|
|
9
|
+
form: UseFormReturn<TFormInputValues, any, TFormOutputs>;
|
|
10
10
|
/** The schema to validate the form data */
|
|
11
11
|
schema: TSchema;
|
|
12
12
|
/** The operations to execute when the form is submitted and the input data is valid */
|
|
13
|
-
action: (values:
|
|
13
|
+
action: (values: TFormOutputs) => Promise<TActionResult> | TActionResult;
|
|
14
14
|
/** Handle successful form submission (when the `action` callback resolves its promise or does not throw an error) */
|
|
15
|
-
onSuccess?: (result: TActionResult, data:
|
|
15
|
+
onSuccess?: (result: TActionResult, data: TFormOutputs) => void;
|
|
16
16
|
/** Handle form submission errors (when the `action` callback rejects its promise or throws an error) */
|
|
17
|
-
onError?: (error: unknown, data:
|
|
17
|
+
onError?: (error: unknown, data: TFormOutputs) => void;
|
|
18
18
|
/** Handle form validation errors (when form data is invalid) */
|
|
19
|
-
onInvalid?: (errors: FieldErrors) => void;
|
|
19
|
+
onInvalid?: (errors: FieldErrors<TFormInputValues>) => void;
|
|
20
20
|
/** Enable or disable `react-hook-form`'s devtools (only in development mode) */
|
|
21
21
|
debug?: boolean;
|
|
22
22
|
}
|
|
23
|
+
type FormComponent = {
|
|
24
|
+
<TSchema extends Schema, TFormInputValues extends TFormValues = StandardSchemaV1.InferInput<TSchema>, TFormOutputs extends TFormValues = StandardSchemaV1.InferOutput<TSchema>, TActionResult = unknown>(props: FormProps<TSchema, TFormInputValues, TFormOutputs, TActionResult> & {
|
|
25
|
+
ref?: Ref<HTMLFormElement>;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
displayName?: string;
|
|
28
|
+
};
|
|
23
29
|
/**
|
|
24
30
|
* The `Form` component provides full state management for complex forms with validation by following a schema-based approach.
|
|
25
31
|
*
|
|
@@ -31,5 +37,5 @@ export interface FormProps<TSchema extends Schema, TForm extends TFormValues = Z
|
|
|
31
37
|
* $ yarn add zod react-hook-form
|
|
32
38
|
* ```
|
|
33
39
|
*/
|
|
34
|
-
declare const Form:
|
|
40
|
+
declare const Form: FormComponent;
|
|
35
41
|
export { Form };
|
|
@@ -1,54 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as F, Suspense as
|
|
3
|
-
import { FormProvider as
|
|
4
|
-
import { UnityFormProvider as
|
|
5
|
-
const
|
|
6
|
-
() => import("@hookform/devtools").then((
|
|
7
|
-
),
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
1
|
+
import { jsx as e, jsxs as v, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as F, Suspense as b, lazy as S } from "react";
|
|
3
|
+
import { FormProvider as x } from "react-hook-form";
|
|
4
|
+
import { UnityFormProvider as P } from "./Form.context.js";
|
|
5
|
+
const j = S(
|
|
6
|
+
() => import("@hookform/devtools").then((o) => ({ default: o.DevTool }))
|
|
7
|
+
), D = ({
|
|
8
|
+
form: o,
|
|
9
|
+
schema: t,
|
|
10
|
+
onSuccess: m,
|
|
11
|
+
onError: i,
|
|
12
|
+
onInvalid: l,
|
|
13
|
+
action: c,
|
|
14
|
+
children: s,
|
|
15
|
+
className: a,
|
|
16
|
+
onReset: d,
|
|
17
|
+
debug: f = !1,
|
|
18
|
+
...p
|
|
19
|
+
}, u) => {
|
|
20
|
+
const h = o.handleSubmit(
|
|
21
|
+
(r) => {
|
|
22
|
+
Promise.resolve().then(() => c(r)).then((n) => {
|
|
23
|
+
m?.(n, r);
|
|
24
|
+
}).catch((n) => {
|
|
25
|
+
i?.(n, r);
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
(r) => {
|
|
29
|
+
l?.(r);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
return /* @__PURE__ */ e(P, { schema: t, children: /* @__PURE__ */ v(x, { ...o, children: [
|
|
33
|
+
f && /* @__PURE__ */ e(b, { fallback: /* @__PURE__ */ e(y, {}), children: /* @__PURE__ */ e(j, { control: o.control }) }),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
"form",
|
|
36
|
+
{
|
|
37
|
+
...p,
|
|
38
|
+
ref: u,
|
|
39
|
+
onSubmit: (r) => {
|
|
40
|
+
h(r);
|
|
41
|
+
},
|
|
42
|
+
className: a,
|
|
43
|
+
onReset: d,
|
|
44
|
+
"data-dd-privacy": "mask",
|
|
45
|
+
children: s
|
|
31
46
|
}
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onSubmit: (t) => {
|
|
41
|
-
y(t);
|
|
42
|
-
},
|
|
43
|
-
className: d,
|
|
44
|
-
onReset: h,
|
|
45
|
-
"data-dd-privacy": "mask",
|
|
46
|
-
children: a
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
] }) });
|
|
50
|
-
}
|
|
51
|
-
);
|
|
47
|
+
)
|
|
48
|
+
] }) });
|
|
49
|
+
}, T = F(function(t, m) {
|
|
50
|
+
return D(
|
|
51
|
+
t,
|
|
52
|
+
m
|
|
53
|
+
);
|
|
54
|
+
});
|
|
52
55
|
T.displayName = "Form";
|
|
53
56
|
export {
|
|
54
57
|
T as Form
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import n, { forwardRef as H, useMemo as d } from "react";
|
|
3
3
|
import { uyTv as L } from "@payfit/unity-themes";
|
|
4
|
-
import { useController as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { FormHelperText as
|
|
4
|
+
import { useController as S } from "react-hook-form";
|
|
5
|
+
import P from "../../hooks/use-id.js";
|
|
6
|
+
import { createSchemaAdapter as g } from "../../utils/createSchemaAdapter.js";
|
|
7
|
+
import { useUnityFormProvider as j } from "../form/Form.context.js";
|
|
8
|
+
import { FormFieldProvider as w } from "./FormField.context.js";
|
|
9
|
+
import { FormHelperText as D } from "./parts/FormHelperText.js";
|
|
10
|
+
import { RawFormContextualLink as E } from "./parts/RawFormContextualLink.js";
|
|
10
11
|
import { isFieldRequired as I } from "./utils/isFieldRequired.js";
|
|
11
12
|
const N = L({
|
|
12
13
|
slots: {
|
|
@@ -23,19 +24,19 @@ const N = L({
|
|
|
23
24
|
isRequired: F,
|
|
24
25
|
isDisabled: h
|
|
25
26
|
}, y) => {
|
|
26
|
-
const b =
|
|
27
|
-
() => I(t, r),
|
|
27
|
+
const b = P(), { schema: t } = j(), { formState: i } = S({ name: r, control: f }), C = d(
|
|
28
|
+
() => I(g(t), r),
|
|
28
29
|
[t, r]
|
|
29
30
|
), { hasHelperText: R, hasContextualLink: T } = d(() => {
|
|
30
|
-
let s = !1,
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
if (!
|
|
34
|
-
const e =
|
|
35
|
-
e.type ===
|
|
31
|
+
let s = !1, m = !1;
|
|
32
|
+
const l = (v) => {
|
|
33
|
+
n.Children.forEach(v, (a) => {
|
|
34
|
+
if (!n.isValidElement(a)) return;
|
|
35
|
+
const e = a;
|
|
36
|
+
e.type === D ? s = !0 : e.type === E && (m = !0), e.props && typeof e.props == "object" && "children" in e.props && l(e.props.children);
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
|
-
return
|
|
39
|
+
return l(o), { hasHelperText: s, hasContextualLink: m };
|
|
39
40
|
}, [o]), k = {
|
|
40
41
|
name: r,
|
|
41
42
|
isLoading: u,
|
|
@@ -46,7 +47,7 @@ const N = L({
|
|
|
46
47
|
isRequired: F ?? C,
|
|
47
48
|
isDisabled: h ?? (i.isSubmitting || i.disabled)
|
|
48
49
|
}, { base: q } = N();
|
|
49
|
-
return /* @__PURE__ */ p("div", { ref: y, className: q({ className: x }), children: /* @__PURE__ */ p(
|
|
50
|
+
return /* @__PURE__ */ p("div", { ref: y, className: q({ className: x }), children: /* @__PURE__ */ p(w, { ...k, children: o }) });
|
|
50
51
|
}
|
|
51
52
|
);
|
|
52
53
|
_.displayName = "FormField";
|
package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts}
RENAMED
|
@@ -16,5 +16,5 @@ interface FormContextualLinkActionProps {
|
|
|
16
16
|
/**
|
|
17
17
|
* FormContextualLink is a component that displays a contextual link for a form field.
|
|
18
18
|
*/
|
|
19
|
-
declare const
|
|
20
|
-
export {
|
|
19
|
+
declare const RawFormContextualLink: import('react').ForwardRefExoticComponent<PropsWithChildren<FormContextualLinkProps | FormContextualLinkActionProps> & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
20
|
+
export { RawFormContextualLink };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d } from "react";
|
|
3
|
+
import { Button as m } from "react-aria-components";
|
|
4
|
+
import { RawLink as s } from "../../link/RawLink.js";
|
|
5
|
+
import { useFormField as u } from "../FormField.context.js";
|
|
6
|
+
const c = d((l, o) => {
|
|
7
|
+
const { children: t, href: a, onPress: e, ...r } = l, { formContextualLinkId: n } = u();
|
|
8
|
+
return a ? /* @__PURE__ */ i(
|
|
9
|
+
s,
|
|
10
|
+
{
|
|
11
|
+
id: n,
|
|
12
|
+
size: "small",
|
|
13
|
+
color: "secondary",
|
|
14
|
+
variant: "standalone",
|
|
15
|
+
"data-unity-slot": "contextual-link",
|
|
16
|
+
href: a,
|
|
17
|
+
ref: o,
|
|
18
|
+
"data-dd-privacy": "allow",
|
|
19
|
+
...r,
|
|
20
|
+
children: t
|
|
21
|
+
}
|
|
22
|
+
) : /* @__PURE__ */ i(
|
|
23
|
+
m,
|
|
24
|
+
{
|
|
25
|
+
id: n,
|
|
26
|
+
onPress: e,
|
|
27
|
+
"data-unity-slot": "contextual-link",
|
|
28
|
+
className: "uy:typography-body-small uy:w-fit",
|
|
29
|
+
ref: o,
|
|
30
|
+
"data-dd-privacy": "allow",
|
|
31
|
+
...r,
|
|
32
|
+
children: t
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
c.displayName = "RawFormContextualLink";
|
|
37
|
+
export {
|
|
38
|
+
c as RawFormContextualLink
|
|
39
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StandardSchema } from '../../../types/schema.js';
|
|
2
2
|
/**
|
|
3
|
-
* Determines if a field is required based on its path in a
|
|
4
|
-
* @param schema - The
|
|
3
|
+
* Determines if a field is required based on its path in a schema
|
|
4
|
+
* @param schema - The schema adapter object
|
|
5
5
|
* @param fieldPath - The path to the field (e.g., "preferences.marketing")
|
|
6
6
|
* @returns true if the field is required, false if optional or not found
|
|
7
7
|
*/
|
|
8
|
-
export declare function isFieldRequired(schema:
|
|
8
|
+
export declare function isFieldRequired(schema: StandardSchema | null | undefined, fieldPath: string): boolean;
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const n = s.split(".");
|
|
6
|
-
let a = r.shape, e;
|
|
7
|
-
for (let t = 0; t < n.length; t++) {
|
|
8
|
-
const l = n[t];
|
|
9
|
-
if (e = a[l], !e) return !1;
|
|
10
|
-
if (t < n.length - 1) {
|
|
11
|
-
const i = e instanceof f.ZodOptional ? e._def.innerType.shape : e.shape;
|
|
12
|
-
if (!i) return !1;
|
|
13
|
-
a = i;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return e ? !(e instanceof f.ZodOptional) : !1;
|
|
17
|
-
} catch {
|
|
18
|
-
return !1;
|
|
19
|
-
}
|
|
1
|
+
function l(e, t) {
|
|
2
|
+
if (!e) return !1;
|
|
3
|
+
const i = e.getField(t);
|
|
4
|
+
return i ? !i.isOptional : !1;
|
|
20
5
|
}
|
|
21
6
|
export {
|
|
22
|
-
|
|
7
|
+
l as isFieldRequired
|
|
23
8
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { useBreakpointListener as
|
|
5
|
-
const
|
|
1
|
+
import { jsxs as e, Fragment as l, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as u } from "react";
|
|
3
|
+
import { uyTv as m } from "@payfit/unity-themes";
|
|
4
|
+
import { useBreakpointListener as y } from "../../../hooks/use-breakpoint-listener.js";
|
|
5
|
+
const d = m({
|
|
6
6
|
base: "uy:flex uy:flex-col uy:gap-200 uy:md:flex-row uy:md:justify-between"
|
|
7
|
-
}),
|
|
8
|
-
({ renderNext:
|
|
9
|
-
const
|
|
10
|
-
return /* @__PURE__ */
|
|
7
|
+
}), f = u(
|
|
8
|
+
({ renderNext: a, renderPrevious: n, renderOptionalActions: o, ...t }, r) => {
|
|
9
|
+
const s = y(), i = s === "xs" || s === "sm";
|
|
10
|
+
return /* @__PURE__ */ e(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
ref:
|
|
13
|
+
ref: r,
|
|
14
14
|
"data-dd-privacy": "allow",
|
|
15
|
-
...
|
|
16
|
-
className:
|
|
15
|
+
...t,
|
|
16
|
+
className: d(),
|
|
17
17
|
role: "group",
|
|
18
18
|
"data-unity-component": "FunnelPageActions",
|
|
19
19
|
children: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
i && /* @__PURE__ */ e(l, { children: [
|
|
21
|
+
a(),
|
|
22
|
+
n?.(),
|
|
23
|
+
o?.()
|
|
24
24
|
] }),
|
|
25
|
-
!
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
!i && /* @__PURE__ */ e(l, { children: [
|
|
26
|
+
/* @__PURE__ */ c("div", { className: "uy:flex uy:gap-100", children: o?.() }),
|
|
27
|
+
/* @__PURE__ */ e("div", { className: "uy:flex uy:gap-100", children: [
|
|
28
|
+
n?.(),
|
|
29
|
+
a()
|
|
30
30
|
] })
|
|
31
31
|
] })
|
|
32
32
|
]
|
|
@@ -34,8 +34,8 @@ const b = p({
|
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
);
|
|
37
|
-
|
|
37
|
+
f.displayName = "FunnelPageActions";
|
|
38
38
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
f as FunnelPageActions,
|
|
40
|
+
d as funnelPageActions
|
|
41
41
|
};
|
|
@@ -32,9 +32,9 @@ export interface FunnelSidebarProps extends PropsWithChildren<VariantProps<typeo
|
|
|
32
32
|
* return (
|
|
33
33
|
* <FunnelSidebar>
|
|
34
34
|
* <TaskMenu>
|
|
35
|
-
* <
|
|
35
|
+
* <RawTask>
|
|
36
36
|
* <TaskTitle>Task 1</TaskTitle>
|
|
37
|
-
* </
|
|
37
|
+
* </RawTask>
|
|
38
38
|
* </TaskMenu>
|
|
39
39
|
* </FunnelSidebar>
|
|
40
40
|
* )
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as i } from "react";
|
|
3
|
+
import { IconSprite as d } from "@payfit/unity-icons";
|
|
4
|
+
import { uyTv as l } from "@payfit/unity-themes";
|
|
5
|
+
const y = l({
|
|
5
6
|
variants: {
|
|
6
7
|
size: {
|
|
7
8
|
20: "uy:w-250 uy:h-250",
|
|
@@ -87,27 +88,30 @@ const l = d({
|
|
|
87
88
|
display: "block"
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
|
-
function
|
|
91
|
-
alt:
|
|
92
|
-
color:
|
|
93
|
-
size:
|
|
94
|
-
src:
|
|
95
|
-
role:
|
|
96
|
-
display:
|
|
97
|
-
...
|
|
91
|
+
function b({
|
|
92
|
+
alt: r,
|
|
93
|
+
color: t,
|
|
94
|
+
size: e,
|
|
95
|
+
src: a,
|
|
96
|
+
role: s = "img",
|
|
97
|
+
display: n = "block",
|
|
98
|
+
...o
|
|
98
99
|
}) {
|
|
99
|
-
const u =
|
|
100
|
-
|
|
100
|
+
const u = i(
|
|
101
|
+
() => y({ size: e, color: t, display: n }),
|
|
102
|
+
[e, t, n]
|
|
103
|
+
);
|
|
104
|
+
return /* @__PURE__ */ c(
|
|
101
105
|
"span",
|
|
102
106
|
{
|
|
103
107
|
"data-dd-privacy": "allow",
|
|
104
|
-
...
|
|
105
|
-
role:
|
|
106
|
-
"aria-label":
|
|
107
|
-
children: /* @__PURE__ */
|
|
108
|
+
...o,
|
|
109
|
+
role: s,
|
|
110
|
+
"aria-label": o["aria-labelledby"] ? void 0 : r,
|
|
111
|
+
children: /* @__PURE__ */ c(d, { className: u, src: a })
|
|
108
112
|
}
|
|
109
113
|
);
|
|
110
114
|
}
|
|
111
115
|
export {
|
|
112
|
-
|
|
116
|
+
b as Icon
|
|
113
117
|
};
|