@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.
Files changed (206) hide show
  1. package/dist/esm/adapters/standardSchemaAdapter.d.ts +7 -0
  2. package/dist/esm/adapters/standardSchemaAdapter.js +20 -0
  3. package/dist/esm/adapters/zodAdapter.d.ts +13 -0
  4. package/dist/esm/adapters/zodAdapter.js +74 -0
  5. package/dist/esm/components/action-bar/ActionBar.js +60 -62
  6. package/dist/esm/components/actionable/Actionable.d.ts +50 -3
  7. package/dist/esm/components/actionable/Actionable.js +58 -45
  8. package/dist/esm/components/app-layout/AppLayout.js +17 -17
  9. package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
  10. package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
  11. package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
  12. package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
  13. package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
  14. package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
  15. package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
  16. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
  17. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
  18. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
  19. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
  20. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
  21. package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
  22. package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
  23. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
  24. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
  25. package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
  26. package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
  27. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
  28. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
  29. package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
  30. package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +39 -40
  31. package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
  32. package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
  33. package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
  34. package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
  35. package/dist/esm/components/code/Code.d.ts +31 -1
  36. package/dist/esm/components/code/Code.js +39 -0
  37. package/dist/esm/components/code/copyToClipboard.js +10 -0
  38. package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
  39. package/dist/esm/components/data-table/DataTable.d.ts +76 -10
  40. package/dist/esm/components/data-table/DataTable.js +81 -78
  41. package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
  42. package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
  43. package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
  44. package/dist/esm/components/date-picker/DatePicker.js +64 -64
  45. package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
  46. package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
  47. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
  48. package/dist/esm/components/error-state/ErrorState.d.ts +208 -0
  49. package/dist/esm/components/error-state/ErrorState.js +194 -0
  50. package/dist/esm/components/error-state/initConfig.d.ts +16 -0
  51. package/dist/esm/components/error-state/initConfig.js +149 -0
  52. package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
  53. package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
  54. package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
  55. package/dist/esm/components/fieldset/Fieldset.js +32 -26
  56. package/dist/esm/components/flex/Flex.js +52 -37
  57. package/dist/esm/components/form/Form.d.ts +15 -9
  58. package/dist/esm/components/form/Form.js +53 -50
  59. package/dist/esm/components/form-field/FormField.js +18 -17
  60. package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
  61. package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
  62. package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
  63. package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
  64. package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
  65. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  66. package/dist/esm/components/icon/Icon.js +23 -19
  67. package/dist/esm/components/input/Input.js +28 -28
  68. package/dist/esm/components/label/Label.js +19 -19
  69. package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
  70. package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
  71. package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
  72. package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
  73. package/dist/esm/components/multi-select/MultiSelect.js +94 -94
  74. package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
  75. package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
  76. package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
  77. package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
  78. package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
  79. package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
  80. package/dist/esm/components/nav/parts/NavGroup.js +63 -52
  81. package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
  82. package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
  83. package/dist/esm/components/number-field/NumberField.d.ts +3 -3
  84. package/dist/esm/components/number-input/NumberInput.js +58 -58
  85. package/dist/esm/components/page/Page.js +1 -1
  86. package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
  87. package/dist/esm/components/page/parts/PageHeader.js +22 -20
  88. package/dist/esm/components/pagination/Pagination.d.ts +23 -44
  89. package/dist/esm/components/pagination/Pagination.js +89 -167
  90. package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
  91. package/dist/esm/components/pagination/PaginationContext.js +15 -0
  92. package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
  93. package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
  94. package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
  95. package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
  96. package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
  97. package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
  98. package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
  99. package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
  100. package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
  101. package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
  102. package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
  103. package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
  104. package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
  105. package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
  106. package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
  107. package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
  108. package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
  109. package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
  110. package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
  111. package/dist/esm/components/select/Select.js +63 -45
  112. package/dist/esm/components/select/parts/SelectOption.js +9 -9
  113. package/dist/esm/components/select-field/SelectField.d.ts +2 -2
  114. package/dist/esm/components/select-field/SelectField.js +4 -1
  115. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
  116. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
  117. package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
  118. package/dist/esm/components/skip-links/SkipLinks.js +1 -1
  119. package/dist/esm/components/table/Table.d.ts +1 -0
  120. package/dist/esm/components/table/Table.js +110 -98
  121. package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
  122. package/dist/esm/components/table/parts/TableBody.js +6 -6
  123. package/dist/esm/components/table/parts/TableCell.js +34 -31
  124. package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
  125. package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
  126. package/dist/esm/components/table/parts/TablePagination.js +61 -59
  127. package/dist/esm/components/table/parts/TableRow.js +21 -18
  128. package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
  129. package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
  130. package/dist/esm/components/tabs/parts/TabList.js +50 -54
  131. package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
  132. package/dist/esm/components/task-menu/parts/Content.js +24 -24
  133. package/dist/esm/components/task-menu/parts/Header.js +24 -24
  134. package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
  135. package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +74 -74
  136. package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
  137. package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +69 -69
  138. package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
  139. package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
  140. package/dist/esm/components/text/Text.js +30 -27
  141. package/dist/esm/components/text-area/TextArea.js +30 -31
  142. package/dist/esm/components/text-field/TextField.d.ts +2 -2
  143. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
  144. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
  145. package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
  146. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
  147. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
  148. package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
  149. package/dist/esm/hooks/use-container-query-level.js +33 -0
  150. package/dist/esm/hooks/use-form.d.ts +5 -5
  151. package/dist/esm/hooks/use-form.types.d.ts +2 -2
  152. package/dist/esm/hooks/use-resizable.js +13 -14
  153. package/dist/esm/index.d.ts +21 -10
  154. package/dist/esm/index.js +424 -396
  155. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
  156. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
  157. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
  158. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
  159. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
  160. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
  161. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
  162. package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
  163. package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
  164. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
  165. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
  166. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
  167. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
  168. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
  169. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
  170. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
  171. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
  172. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
  173. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
  174. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
  175. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
  176. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
  177. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
  178. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
  179. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
  180. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
  181. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
  182. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
  183. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
  184. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
  185. package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
  186. package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
  187. package/dist/esm/integrations/tanstack-router.js +34 -0
  188. package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
  189. package/dist/esm/providers/router/RouterProvider.js +14 -10
  190. package/dist/esm/types/DataAttributes.d.ts +1 -1
  191. package/dist/esm/types/schema.d.ts +8 -0
  192. package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
  193. package/dist/esm/utils/createSchemaAdapter.js +13 -0
  194. package/dist/esm/utils/platform.js +2 -3
  195. package/i18n/en-GB.json +16 -0
  196. package/i18n/es-ES.json +16 -0
  197. package/i18n/fr-FR.json +16 -0
  198. package/package.json +56 -31
  199. package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
  200. package/dist/esm/components/link/Link.d.ts +0 -93
  201. package/dist/esm/components/link/Link.js +0 -68
  202. package/dist/esm/components/nav/parts/NavItem.js +0 -95
  203. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
  204. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
  205. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
  206. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +0 -0
@@ -1,42 +1,57 @@
1
- import { jsx as N } from "react/jsx-runtime";
2
- import { forwardRef as j } from "react";
3
- import { flex as k } from "./Flex.variants.js";
4
- const e = j(
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: o = "div",
7
- children: r,
8
- className: t,
9
- inline: s,
10
- direction: m,
11
- isReversed: a,
12
- wrap: l,
13
- gap: f,
14
- gapX: c,
15
- gapY: i,
16
- justify: n,
17
- align: p,
18
- alignContent: x,
19
- ...d
20
- }, y) => {
21
- const F = k({
22
- inline: s,
23
- direction: m,
24
- isReversed: a,
25
- wrap: l,
26
- gap: f,
27
- gapX: c,
28
- gapY: i,
29
- justify: n,
30
- align: p,
31
- alignContent: x,
32
- className: t
33
- });
34
- return /* @__PURE__ */ N(o, { ref: y, className: F, ...d, children: r });
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
- e.displayName = "Flex";
38
- const E = e;
52
+ N.displayName = "Flex";
53
+ const v = N;
39
54
  export {
40
- e as Flex,
41
- E as Stack
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, TForm extends TFormValues = ZodInfer<TSchema>, TActionResult = unknown> extends PropsWithChildren<AllowedAriaFormProps> {
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<TForm>;
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: TForm) => Promise<TActionResult> | TActionResult;
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: TForm) => void;
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: TForm) => void;
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: import('react').ForwardRefExoticComponent<FormProps<Schema, TFormValues, unknown> & import('react').RefAttributes<HTMLFormElement>>;
40
+ declare const Form: FormComponent;
35
41
  export { Form };
@@ -1,54 +1,57 @@
1
- import { jsx as m, jsxs as v, Fragment as x } from "react/jsx-runtime";
2
- import { forwardRef as F, Suspense as P, lazy as j } from "react";
3
- import { FormProvider as n } from "react-hook-form";
4
- import { UnityFormProvider as u } from "./Form.context.js";
5
- const D = j(
6
- () => import("@hookform/devtools").then((e) => ({ default: e.DevTool }))
7
- ), T = F(
8
- ({
9
- form: e,
10
- schema: f,
11
- onSuccess: r,
12
- onError: i,
13
- onInvalid: l,
14
- action: p,
15
- children: a,
16
- className: d,
17
- onReset: h,
18
- debug: s = !1,
19
- ...b
20
- }, c) => {
21
- const y = e.handleSubmit(
22
- (t) => {
23
- Promise.resolve().then(() => p(t)).then((o) => {
24
- r == null || r(o, t);
25
- }).catch((o) => {
26
- i == null || i(o, t);
27
- });
28
- },
29
- (t) => {
30
- l == null || l(t);
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
- return /* @__PURE__ */ m(u, { schema: f, children: /* @__PURE__ */ v(n, { ...e, children: [
34
- s && /* @__PURE__ */ m(P, { fallback: /* @__PURE__ */ m(x, {}), children: /* @__PURE__ */ m(D, { control: e.control }) }),
35
- /* @__PURE__ */ m(
36
- "form",
37
- {
38
- ...b,
39
- ref: c,
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 a, { forwardRef as H, useMemo as d } from "react";
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 P } from "react-hook-form";
5
- import S from "../../hooks/use-id.js";
6
- import { useUnityFormProvider as g } from "../form/Form.context.js";
7
- import { FormFieldProvider as j } from "./FormField.context.js";
8
- import { FormContextualLink as D } from "./parts/FormContextualLink.js";
9
- import { FormHelperText as E } from "./parts/FormHelperText.js";
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 = S(), { schema: t } = g(), { formState: i } = P({ name: r, control: f }), C = d(
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, l = !1;
31
- const m = (v) => {
32
- a.Children.forEach(v, (n) => {
33
- if (!a.isValidElement(n)) return;
34
- const e = n;
35
- e.type === E ? s = !0 : e.type === D && (l = !0), e.props && typeof e.props == "object" && "children" in e.props && m(e.props.children);
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 m(o), { hasHelperText: s, hasContextualLink: l };
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(j, { ...k, children: o }) });
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";
@@ -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 FormContextualLink: import('react').ForwardRefExoticComponent<PropsWithChildren<FormContextualLinkProps | FormContextualLinkActionProps> & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
20
- export { FormContextualLink };
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 { ZodObject, ZodRawShape } from 'zod';
1
+ import { StandardSchema } from '../../../types/schema.js';
2
2
  /**
3
- * Determines if a field is required based on its path in a Zod schema
4
- * @param schema - The Zod schema object
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: ZodObject<ZodRawShape> | null | undefined, fieldPath: string): boolean;
8
+ export declare function isFieldRequired(schema: StandardSchema | null | undefined, fieldPath: string): boolean;
@@ -1,23 +1,8 @@
1
- import { z as f } from "zod";
2
- function p(r, s) {
3
- try {
4
- if (!r) return !1;
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
- p as isFieldRequired
7
+ l as isFieldRequired
23
8
  };
@@ -1,32 +1,32 @@
1
- import { jsxs as l, Fragment as u, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as h } from "react";
3
- import { uyTv as p } from "@payfit/unity-themes";
4
- import { useBreakpointListener as t } from "../../../hooks/use-breakpoint-listener.js";
5
- const b = p({
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
- }), w = h(
8
- ({ renderNext: y, renderPrevious: a, renderOptionalActions: m, ...g }, x) => {
9
- const f = t(), c = f === "xs" || f === "sm";
10
- return /* @__PURE__ */ l(
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: x,
13
+ ref: r,
14
14
  "data-dd-privacy": "allow",
15
- ...g,
16
- className: b(),
15
+ ...t,
16
+ className: d(),
17
17
  role: "group",
18
18
  "data-unity-component": "FunnelPageActions",
19
19
  children: [
20
- c && /* @__PURE__ */ l(u, { children: [
21
- y(),
22
- a == null ? void 0 : a(),
23
- m == null ? void 0 : m()
20
+ i && /* @__PURE__ */ e(l, { children: [
21
+ a(),
22
+ n?.(),
23
+ o?.()
24
24
  ] }),
25
- !c && /* @__PURE__ */ l(u, { children: [
26
- /* @__PURE__ */ s("div", { className: "uy:flex uy:gap-100", children: m == null ? void 0 : m() }),
27
- /* @__PURE__ */ l("div", { className: "uy:flex uy:gap-100", children: [
28
- a == null ? void 0 : a(),
29
- y()
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
- w.displayName = "FunnelPageActions";
37
+ f.displayName = "FunnelPageActions";
38
38
  export {
39
- w as FunnelPageActions,
40
- b as funnelPageActions
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
- * <Task>
35
+ * <RawTask>
36
36
  * <TaskTitle>Task 1</TaskTitle>
37
- * </Task>
37
+ * </RawTask>
38
38
  * </TaskMenu>
39
39
  * </FunnelSidebar>
40
40
  * )
@@ -1,7 +1,8 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { IconSprite as i } from "@payfit/unity-icons";
3
- import { uyTv as d } from "@payfit/unity-themes";
4
- const l = d({
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 f({
91
- alt: n,
92
- color: o,
93
- size: c,
94
- src: r,
95
- role: a = "img",
96
- display: s = "block",
97
- ...t
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 = l({ size: c, color: o, display: s });
100
- return /* @__PURE__ */ e(
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
- ...t,
105
- role: a,
106
- "aria-label": t["aria-labelledby"] ? void 0 : n,
107
- children: /* @__PURE__ */ e(i, { className: u, src: r })
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
- f as Icon
116
+ b as Icon
113
117
  };