@payfit/unity-components 1.1.0 → 1.2.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 (104) 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 +62 -64
  6. package/dist/esm/components/actionable/Actionable.d.ts +50 -3
  7. package/dist/esm/components/actionable/Actionable.js +49 -39
  8. package/dist/esm/components/app-menu/parts/AppMenuFooter.js +63 -63
  9. package/dist/esm/components/autocomplete/parts/AutocompleteClearButton.js +5 -5
  10. package/dist/esm/components/bottom-sheet/parts/BottomSheetDragIndicator.js +30 -31
  11. package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -2
  12. package/dist/esm/components/checkbox-field/CheckboxField.js +18 -17
  13. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -2
  14. package/dist/esm/components/checkbox-group-field/CheckboxGroupField.js +4 -1
  15. package/dist/esm/components/code/Code.d.ts +37 -0
  16. package/dist/esm/components/code/Code.js +39 -0
  17. package/dist/esm/components/code/copyToClipboard.d.ts +1 -0
  18. package/dist/esm/components/code/copyToClipboard.js +10 -0
  19. package/dist/esm/components/collapsible/Collapsible.d.ts +1 -1
  20. package/dist/esm/components/collapsible/Collapsible.js +14 -13
  21. package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +7 -7
  22. package/dist/esm/components/data-table/DataTable.d.ts +76 -10
  23. package/dist/esm/components/data-table/DataTable.js +81 -78
  24. package/dist/esm/components/data-table/parts/ColumnSortHeader.js +13 -13
  25. package/dist/esm/components/data-table/parts/DataTableBulkActions.js +20 -20
  26. package/dist/esm/components/date-calendar/DateCalendar.js +52 -52
  27. package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +30 -33
  28. package/dist/esm/components/date-picker/DatePicker.js +64 -64
  29. package/dist/esm/components/date-picker/parts/DateInput.js +33 -33
  30. package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -2
  31. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +12 -12
  32. package/dist/esm/components/error-state/ErrorState.d.ts +196 -0
  33. package/dist/esm/components/error-state/ErrorState.js +153 -0
  34. package/dist/esm/components/error-state/initConfig.d.ts +16 -0
  35. package/dist/esm/components/error-state/initConfig.js +149 -0
  36. package/dist/esm/components/error-state/parts/Collapsible.d.ts +59 -0
  37. package/dist/esm/components/error-state/parts/Collapsible.js +67 -0
  38. package/dist/esm/components/form/Form.d.ts +15 -9
  39. package/dist/esm/components/form/Form.js +53 -50
  40. package/dist/esm/components/form-field/FormField.js +24 -23
  41. package/dist/esm/components/form-field/utils/isFieldRequired.d.ts +4 -4
  42. package/dist/esm/components/form-field/utils/isFieldRequired.js +5 -20
  43. package/dist/esm/components/funnel-layout/FunnelLayout.d.ts +1 -1
  44. package/dist/esm/components/funnel-layout/FunnelLayout.js +61 -110
  45. package/dist/esm/components/funnel-layout/parts/FunnelPage.js +8 -9
  46. package/dist/esm/components/funnel-layout/parts/FunnelPageActions.js +24 -24
  47. package/dist/esm/components/funnel-layout/parts/FunnelPageFooter.js +6 -7
  48. package/dist/esm/components/funnel-layout/parts/FunnelPageHeader.d.ts +2 -2
  49. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  50. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.js +9 -10
  51. package/dist/esm/components/funnel-layout/parts/FunnelTopBar.js +0 -1
  52. package/dist/esm/components/input/Input.js +28 -28
  53. package/dist/esm/components/label/Label.js +19 -19
  54. package/dist/esm/components/multi-select/MultiSelect.js +94 -94
  55. package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +32 -32
  56. package/dist/esm/components/multi-select/parts/MultiSelectButton.js +38 -38
  57. package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +16 -16
  58. package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +2 -2
  59. package/dist/esm/components/multi-select-field/MultiSelectField.js +53 -53
  60. package/dist/esm/components/nav/parts/NavGroup.js +21 -21
  61. package/dist/esm/components/number-field/NumberField.d.ts +3 -3
  62. package/dist/esm/components/number-input/NumberInput.js +58 -58
  63. package/dist/esm/components/pagination/Pagination.js +97 -101
  64. package/dist/esm/components/pagination/parts/PaginationJumpDialog.js +39 -40
  65. package/dist/esm/components/popover/parts/PopoverHeader.js +8 -8
  66. package/dist/esm/components/radio-button-group/parts/RadioButton.js +11 -11
  67. package/dist/esm/components/select-field/SelectField.d.ts +2 -2
  68. package/dist/esm/components/select-field/SelectField.js +4 -1
  69. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +22 -23
  70. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -2
  71. package/dist/esm/components/side-panel/parts/SidePanelDragIndicator.js +30 -31
  72. package/dist/esm/components/skip-links/SkipLinks.js +50 -43
  73. package/dist/esm/components/table/Table.js +79 -76
  74. package/dist/esm/components/table/parts/TableBody.js +6 -6
  75. package/dist/esm/components/table/parts/TableCell.js +25 -25
  76. package/dist/esm/components/table/parts/TableColumnHeader.js +38 -38
  77. package/dist/esm/components/table/parts/TablePagination.js +61 -59
  78. package/dist/esm/components/table/parts/TableRow.js +16 -16
  79. package/dist/esm/components/tabs/parts/TabList.js +50 -54
  80. package/dist/esm/components/task-menu/parts/Content.js +24 -24
  81. package/dist/esm/components/task-menu/parts/Header.js +24 -24
  82. package/dist/esm/components/task-menu/parts/SubTask.js +74 -74
  83. package/dist/esm/components/task-menu/parts/Task.js +69 -69
  84. package/dist/esm/components/task-menu/parts/TaskGroup.js +45 -45
  85. package/dist/esm/components/text-area/TextArea.js +30 -31
  86. package/dist/esm/components/text-field/TextField.d.ts +2 -2
  87. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -2
  88. package/dist/esm/components/toggle-switch-field/ToggleSwitchField.js +4 -1
  89. package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +74 -74
  90. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -2
  91. package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.js +36 -32
  92. package/dist/esm/hooks/use-form.d.ts +5 -5
  93. package/dist/esm/hooks/use-form.types.d.ts +2 -2
  94. package/dist/esm/hooks/use-resizable.js +13 -14
  95. package/dist/esm/index.d.ts +1 -0
  96. package/dist/esm/index.js +22 -19
  97. package/dist/esm/types/schema.d.ts +8 -0
  98. package/dist/esm/utils/createSchemaAdapter.d.ts +7 -0
  99. package/dist/esm/utils/createSchemaAdapter.js +13 -0
  100. package/dist/esm/utils/platform.js +2 -3
  101. package/i18n/en-GB.json +16 -0
  102. package/i18n/es-ES.json +16 -0
  103. package/i18n/fr-FR.json +16 -0
  104. package/package.json +25 -19
@@ -1,15 +1,15 @@
1
1
  import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as v } from "react";
3
- import { uyTv as w } from "@payfit/unity-themes";
4
- import { TextArea as M } from "react-aria-components";
5
- import { useIntl as z } from "react-intl";
6
- import { useResizable as L } from "../../hooks/use-resizable.js";
7
- import { Icon as D } from "../icon/Icon.js";
8
- import { Spinner as N } from "../spinner/Spinner.js";
9
- const W = w({
2
+ import { forwardRef as x } from "react";
3
+ import { uyTv as h } from "@payfit/unity-themes";
4
+ import { TextArea as v } from "react-aria-components";
5
+ import { useIntl as w } from "react-intl";
6
+ import { useResizable as M } from "../../hooks/use-resizable.js";
7
+ import { Icon as z } from "../icon/Icon.js";
8
+ import { Spinner as L } from "../spinner/Spinner.js";
9
+ const D = h({
10
10
  slots: {
11
- base: "uy:flex uy:border uy:border-solid uy:rounded-100 uy:focus-within:outline-none uy:focus-within:ring-2 uy:focus-within:ring-utility-focus-ring uy:focus-within:ring-offset-2 uy:active:border-border-form-active uy:overflow-hidden uy:relative",
12
- inputWrapper: "uy:flex uy:gap-50 uy:flex-grow uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:rounded-100",
11
+ base: "uy:flex uy:border uy:border-solid uy:rounded-75 uy:focus-within:outline-none uy:focus-within:ring-2 uy:focus-within:ring-utility-focus-ring uy:focus-within:ring-offset-2 uy:active:border-border-form-active uy:overflow-hidden uy:relative",
12
+ inputWrapper: "uy:flex uy:gap-50 uy:flex-grow uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:rounded-75",
13
13
  input: "uy:flex-grow uy:flex-shrink uy:outline-none uy:typography-body uy:placeholder:text-content-neutral-lowest uy:resize-none",
14
14
  state: "uy:flex uy:gap-50 uy:flex-shrink-0 uy:basis-250",
15
15
  resizeHandle: "uy:absolute uy:bottom-25 uy:right-25 uy:w-100 uy:h-100 uy:cursor-se-resize uy:flex uy:items-center uy:justify-center"
@@ -56,38 +56,38 @@ const W = w({
56
56
  isDisabled: !1,
57
57
  isReadOnly: !1
58
58
  }
59
- }), k = v(
59
+ }), N = x(
60
60
  ({
61
61
  isInvalid: n,
62
62
  isLoading: s,
63
63
  isDisabled: a,
64
64
  isReadOnly: r,
65
65
  isResizable: i = !1,
66
- ...y
67
- }, b) => {
68
- const o = z(), { containerRef: l, handleResizeStart: m } = L({
66
+ ...d
67
+ }, f) => {
68
+ const o = w(), { containerRef: l, handleResizeStart: y } = M({
69
69
  isDisabled: !i || a || r
70
- }), { base: c, inputWrapper: p, input: g, state: x, resizeHandle: h } = W({
70
+ }), { base: b, inputWrapper: m, input: c, state: p, resizeHandle: g } = D({
71
71
  isInvalid: n,
72
72
  isDisabled: a,
73
73
  isReadOnly: r
74
74
  });
75
- return /* @__PURE__ */ t("div", { ref: l, className: c(), children: [
76
- /* @__PURE__ */ t("div", { className: p(), children: [
75
+ return /* @__PURE__ */ t("div", { ref: l, className: b(), children: [
76
+ /* @__PURE__ */ t("div", { className: m(), children: [
77
77
  /* @__PURE__ */ e(
78
- M,
78
+ v,
79
79
  {
80
80
  "data-dd-privacy": "mask",
81
- ...y,
82
- ref: b,
83
- className: g(),
81
+ ...d,
82
+ ref: f,
83
+ className: c(),
84
84
  "aria-busy": s,
85
85
  readOnly: r
86
86
  }
87
87
  ),
88
- /* @__PURE__ */ t("div", { className: x(), children: [
88
+ /* @__PURE__ */ t("div", { className: p(), children: [
89
89
  s && /* @__PURE__ */ e(
90
- N,
90
+ L,
91
91
  {
92
92
  color: "inherit",
93
93
  size: "small",
@@ -98,7 +98,7 @@ const W = w({
98
98
  }
99
99
  ),
100
100
  n && /* @__PURE__ */ e(
101
- D,
101
+ z,
102
102
  {
103
103
  src: "WarningCircleOutlined",
104
104
  color: "content.form.invalid",
@@ -113,8 +113,8 @@ const W = w({
113
113
  i && !a && !r && /* @__PURE__ */ e(
114
114
  "div",
115
115
  {
116
- className: h(),
117
- onMouseDown: m,
116
+ className: g(),
117
+ onMouseDown: y,
118
118
  role: "button",
119
119
  tabIndex: 0,
120
120
  "aria-label": o.formatMessage({
@@ -122,8 +122,7 @@ const W = w({
122
122
  defaultMessage: "Resize textarea"
123
123
  }),
124
124
  onKeyDown: (u) => {
125
- var d, f;
126
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), (f = (d = l.current) == null ? void 0 : d.querySelector("textarea")) == null || f.focus());
125
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), l.current?.querySelector("textarea")?.focus());
127
126
  },
128
127
  children: /* @__PURE__ */ t(
129
128
  "svg",
@@ -156,8 +155,8 @@ const W = w({
156
155
  ] });
157
156
  }
158
157
  );
159
- k.displayName = "TextArea";
158
+ N.displayName = "TextArea";
160
159
  export {
161
- k as TextArea,
162
- W as textArea
160
+ N as TextArea,
161
+ D as textArea
163
162
  };
@@ -1,6 +1,6 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
1
2
  import { ForwardedRef, HTMLAttributes, JSX, ReactNode } from 'react';
2
3
  import { FieldPath, FieldValues } from 'react-hook-form';
3
- import { infer as ZodInfer } from 'zod';
4
4
  import { Schema } from '../../hooks/use-form.types.js';
5
5
  import { InputProps } from '../input/Input.js';
6
6
  import { LabelProps } from '../label/Label.js';
@@ -30,7 +30,7 @@ interface TextFieldWithTextAreaProps<TFieldValues extends FieldValues = FieldVal
30
30
  type?: never;
31
31
  }
32
32
  export type TextFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = TextFieldWithInputProps<TFieldValues, TName> | TextFieldWithTextAreaProps<TFieldValues, TName>;
33
- type TextFieldComponent = (<TSchema extends Schema>(props: TextFieldProps<ZodInfer<TSchema>> & {
33
+ type TextFieldComponent = (<TSchema extends Schema>(props: TextFieldProps<StandardSchemaV1.InferOutput<TSchema>> & {
34
34
  ref?: ForwardedRef<HTMLInputElement | HTMLTextAreaElement>;
35
35
  }) => JSX.Element) & {
36
36
  displayName?: string;
@@ -1,6 +1,6 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
1
2
  import { ForwardedRef, JSX } from 'react';
2
3
  import { FieldPath, FieldValues } from 'react-hook-form';
3
- import { infer as ZodInfer } from 'zod';
4
4
  import { Schema } from '../../hooks/use-form.types.js';
5
5
  interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
6
6
  /** The name of the field, which should match the form schema. */
@@ -23,7 +23,7 @@ interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName exten
23
23
  isLabelSrOnly?: boolean;
24
24
  }
25
25
  export type ToggleSwitchFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = FieldProps<TFieldValues, TName>;
26
- type ToggleSwitchFieldComponent = (<TSchema extends Schema>(props: ToggleSwitchFieldProps<ZodInfer<TSchema>> & {
26
+ type ToggleSwitchFieldComponent = (<TSchema extends Schema>(props: ToggleSwitchFieldProps<StandardSchemaV1.InferOutput<TSchema>> & {
27
27
  ref?: ForwardedRef<HTMLLabelElement>;
28
28
  }) => JSX.Element) & {
29
29
  displayName?: string;
@@ -49,7 +49,10 @@ function y({
49
49
  );
50
50
  }
51
51
  const j = u(function(r, e) {
52
- return y(r, e);
52
+ return y(
53
+ r,
54
+ e
55
+ );
53
56
  });
54
57
  j.displayName = "ToggleSwitchField";
55
58
  export {
@@ -1,99 +1,99 @@
1
- import { jsxs as A, jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as B, useState as H, useId as J, useRef as K, useCallback as Q, isValidElement as V, cloneElement as N, Children as U } from "react";
3
- import { uyTv as W } from "@payfit/unity-themes";
4
- import { Label as X } from "../label/Label.js";
5
- import { Text as R } from "../text/Text.js";
6
- const Y = W({
1
+ import { jsxs as k, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as q, useState as z, useId as A, useRef as H, useCallback as J, isValidElement as B, cloneElement as w, Children as K } from "react";
3
+ import { uyTv as Q } from "@payfit/unity-themes";
4
+ import { Label as U } from "../label/Label.js";
5
+ import { Text as j } from "../text/Text.js";
6
+ const W = Q({
7
7
  base: "uy:flex uy:flex-col uy:gap-50"
8
8
  });
9
- function Z(n) {
10
- if (!V(n)) return !1;
11
- const r = n.props;
12
- return typeof r == "object" && r !== null && "value" in r && typeof r.value == "string";
9
+ function X(i) {
10
+ if (!B(i)) return !1;
11
+ const o = i.props;
12
+ return typeof o == "object" && o !== null && "value" in o && typeof o.value == "string";
13
13
  }
14
- const _ = B(
14
+ const Y = q(
15
15
  ({
16
- label: n,
17
- helperText: r,
18
- feedbackText: l,
19
- isDisabled: b,
20
- isReadOnly: G,
21
- isInvalid: c,
22
- isRequired: S,
23
- children: I,
24
- requiredVariant: h,
25
- value: g,
26
- defaultValue: M,
27
- onChange: a,
28
- onFocus: u,
29
- onBlur: p,
30
- onFocusChange: t,
31
- ...O
32
- }, $) => {
33
- const f = g !== void 0, [x, D] = H(
34
- M ?? []
35
- ), s = f ? g : x, w = J(), j = r ? `${w}-helper` : void 0, y = c && l ? `${w}-feedback` : void 0, L = [j, y].filter(Boolean).join(" ") || void 0, E = K(!1), P = (e) => {
36
- E.current = !0, u == null || u(e), t == null || t(!0);
37
- }, k = (e) => {
38
- E.current = !1, p == null || p(e), t == null || t(!1);
39
- }, q = Q(
16
+ label: i,
17
+ helperText: o,
18
+ feedbackText: r,
19
+ isDisabled: f,
20
+ isReadOnly: E,
21
+ isInvalid: a,
22
+ isRequired: y,
23
+ children: N,
24
+ requiredVariant: R,
25
+ value: m,
26
+ defaultValue: V,
27
+ onChange: g,
28
+ onFocus: C,
29
+ onBlur: G,
30
+ onFocusChange: h,
31
+ ...I
32
+ }, F) => {
33
+ const c = m !== void 0, [M, O] = z(
34
+ V ?? []
35
+ ), n = c ? m : M, v = A(), b = o ? `${v}-helper` : void 0, d = a && r ? `${v}-feedback` : void 0, $ = [b, d].filter(Boolean).join(" ") || void 0, S = H(!1), x = (e) => {
36
+ S.current = !0, C?.(e), h?.(!0);
37
+ }, D = (e) => {
38
+ S.current = !1, G?.(e), h?.(!1);
39
+ }, L = J(
40
40
  (e) => {
41
- let i;
42
- s.includes(e) ? i = s.filter((o) => o !== e) : i = [...s, e], f || D(i), a == null || a(i);
41
+ let l;
42
+ n.includes(e) ? l = n.filter((s) => s !== e) : l = [...n, e], c || O(l), g?.(l);
43
43
  },
44
- [s, f, a]
45
- ), z = () => U.map(I, (e, i) => {
46
- if (!Z(e)) return e;
47
- const o = e, m = o.props, v = m.value;
48
- return N(o, {
49
- key: o.key ?? i,
50
- isSelected: s.includes(v),
51
- isDisabled: b ?? m.isDisabled,
52
- isReadOnly: G ?? m.isReadOnly,
53
- value: v,
44
+ [n, c, g]
45
+ ), P = () => K.map(N, (e, l) => {
46
+ if (!X(e)) return e;
47
+ const s = e, u = s.props, p = u.value;
48
+ return w(s, {
49
+ key: s.key ?? l,
50
+ isSelected: n.includes(p),
51
+ isDisabled: f ?? u.isDisabled,
52
+ isReadOnly: E ?? u.isReadOnly,
53
+ value: p,
54
54
  onChange: () => {
55
- q(v);
55
+ L(p);
56
56
  }
57
57
  });
58
58
  });
59
- return /* @__PURE__ */ A(
59
+ return /* @__PURE__ */ k(
60
60
  "fieldset",
61
61
  {
62
- ...O,
63
- ref: $,
64
- className: Y(),
65
- "aria-describedby": L,
66
- "aria-invalid": c || void 0,
67
- "aria-required": S || void 0,
68
- disabled: b,
69
- onFocus: P,
70
- onBlur: k,
62
+ ...I,
63
+ ref: F,
64
+ className: W(),
65
+ "aria-describedby": $,
66
+ "aria-invalid": a || void 0,
67
+ "aria-required": y || void 0,
68
+ disabled: f,
69
+ onFocus: x,
70
+ onBlur: D,
71
71
  children: [
72
- /* @__PURE__ */ d("legend", { className: "uy:mb-50", children: /* @__PURE__ */ d(X, { isRequired: S, requiredVariant: h, children: n }) }),
73
- r && /* @__PURE__ */ d(
74
- R,
72
+ /* @__PURE__ */ t("legend", { className: "uy:mb-50", children: /* @__PURE__ */ t(U, { isRequired: y, requiredVariant: R, children: i }) }),
73
+ o && /* @__PURE__ */ t(
74
+ j,
75
75
  {
76
- id: j,
76
+ id: b,
77
77
  variant: "bodySmall",
78
78
  color: "content.neutral.low",
79
79
  slot: "description",
80
- children: r
80
+ children: o
81
81
  }
82
82
  ),
83
- /* @__PURE__ */ d("div", { className: "uy:mt-100 uy:flex uy:flex-col uy:gap-150 uy:py-25", children: z() }),
84
- c && l && (typeof l == "string" ? /* @__PURE__ */ d(
85
- R,
83
+ /* @__PURE__ */ t("div", { className: "uy:mt-100 uy:flex uy:flex-col uy:gap-150 uy:py-25", children: P() }),
84
+ a && r && (typeof r == "string" ? /* @__PURE__ */ t(
85
+ j,
86
86
  {
87
- id: y,
87
+ id: d,
88
88
  variant: "bodySmallStrong",
89
89
  color: "content.form.invalid",
90
90
  slot: "errorMessage",
91
- children: l
91
+ children: r
92
92
  }
93
- ) : V(l) && N(
94
- l,
93
+ ) : B(r) && w(
94
+ r,
95
95
  {
96
- id: y,
96
+ id: d,
97
97
  slot: "errorMessage"
98
98
  }
99
99
  ))
@@ -102,8 +102,8 @@ const _ = B(
102
102
  );
103
103
  }
104
104
  );
105
- _.displayName = "ToggleSwitchGroup";
105
+ Y.displayName = "ToggleSwitchGroup";
106
106
  export {
107
- _ as ToggleSwitchGroup,
108
- Y as toggleSwitchGroup
107
+ Y as ToggleSwitchGroup,
108
+ W as toggleSwitchGroup
109
109
  };
@@ -1,6 +1,6 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
1
2
  import { ForwardedRef, JSX, PropsWithChildren, ReactNode } from 'react';
2
3
  import { FieldPath, FieldValues } from 'react-hook-form';
3
- import { infer as ZodInfer } from 'zod';
4
4
  import { Schema } from '../../hooks/use-form.types.js';
5
5
  import { LabelProps } from '../label/Label.js';
6
6
  import { ToggleSwitchGroupProps } from '../toggle-switch-group/ToggleSwitchGroup.js';
@@ -33,7 +33,7 @@ interface FieldProps<TFieldValues extends FieldValues = FieldValues, TName exten
33
33
  onFocusChange?: (isFocused: boolean) => void;
34
34
  }
35
35
  export type ToggleSwitchGroupFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = FieldProps<TFieldValues, TName>;
36
- type ToggleSwitchGroupFieldComponent = (<TSchema extends Schema>(props: ToggleSwitchGroupFieldProps<ZodInfer<TSchema>> & {
36
+ type ToggleSwitchGroupFieldComponent = (<TSchema extends Schema>(props: ToggleSwitchGroupFieldProps<StandardSchemaV1.InferOutput<TSchema>> & {
37
37
  ref?: ForwardedRef<HTMLFieldSetElement>;
38
38
  }) => JSX.Element) & {
39
39
  displayName?: string;
@@ -1,59 +1,63 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as T, jsx as i } from "react/jsx-runtime";
2
2
  import { forwardRef as x, useMemo as G } from "react";
3
3
  import { useFormContext as R } from "react-hook-form";
4
- import { FormField as q } from "../form-field/FormField.js";
5
- import { FormControl as y } from "../form-field/parts/FormControl.js";
6
- import { FormFeedbackText as P } from "../form-field/parts/FormFeedbackText.js";
7
- import { isFieldRequired as j } from "../form-field/utils/isFieldRequired.js";
8
- import { useUnityFormProvider as v } from "../form/Form.context.js";
9
- import { ToggleSwitchGroup as C } from "../toggle-switch-group/ToggleSwitchGroup.js";
10
- function U({
4
+ import { createSchemaAdapter as q } from "../../utils/createSchemaAdapter.js";
5
+ import { FormField as y } from "../form-field/FormField.js";
6
+ import { FormControl as P } from "../form-field/parts/FormControl.js";
7
+ import { FormFeedbackText as j } from "../form-field/parts/FormFeedbackText.js";
8
+ import { isFieldRequired as v } from "../form-field/utils/isFieldRequired.js";
9
+ import { useUnityFormProvider as C } from "../form/Form.context.js";
10
+ import { ToggleSwitchGroup as U } from "../toggle-switch-group/ToggleSwitchGroup.js";
11
+ function b({
11
12
  name: o,
12
13
  label: r,
13
- defaultValue: i,
14
+ defaultValue: e,
14
15
  helperText: m,
15
16
  contextualLink: c,
16
- isRequired: s,
17
- isInvalid: p,
17
+ isRequired: p,
18
+ isInvalid: s,
18
19
  isLoading: l,
19
20
  isDisabled: n,
20
- isReadOnly: u,
21
- requiredVariant: d,
21
+ isReadOnly: d,
22
+ requiredVariant: u,
22
23
  children: f,
23
24
  ...F
24
- }, g) {
25
- const { control: h, watch: w } = R(), { schema: t } = v(), S = G(
26
- () => j(t, o),
25
+ }, h) {
26
+ const { control: g, watch: a } = R(), { schema: t } = C(), w = G(
27
+ () => v(q(t), o),
27
28
  [t, o]
28
- ), T = w(o);
29
- return /* @__PURE__ */ a(q, { control: h, name: o, ...{
30
- isInvalid: p,
29
+ ), S = a(o);
30
+ return /* @__PURE__ */ T(y, { control: g, name: o, ...{
31
+ isInvalid: s,
31
32
  isLoading: l,
32
33
  isDisabled: n,
33
- isReadOnly: u
34
+ isReadOnly: d
34
35
  }, children: [
35
- /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
36
- C,
36
+ /* @__PURE__ */ i(P, { children: /* @__PURE__ */ i(
37
+ U,
37
38
  {
38
- ref: g,
39
+ ref: h,
39
40
  label: r,
40
- defaultValue: i,
41
- value: T,
41
+ defaultValue: e,
42
+ value: S,
42
43
  helperText: m,
43
- requiredVariant: d,
44
+ requiredVariant: u,
44
45
  ...F,
45
- isRequired: S ?? s,
46
+ isRequired: w ?? p,
46
47
  children: f
47
48
  }
48
49
  ) }),
49
- /* @__PURE__ */ e(P, {}),
50
+ /* @__PURE__ */ i(j, {}),
50
51
  c
51
52
  ] });
52
53
  }
53
- const b = x(function(r, i) {
54
- return U(r, i);
54
+ const k = x(function(r, e) {
55
+ return b(
56
+ r,
57
+ e
58
+ );
55
59
  });
56
- b.displayName = "ToggleSwitchGroupField";
60
+ k.displayName = "ToggleSwitchGroupField";
57
61
  export {
58
- b as ToggleSwitchGroupField
62
+ k as ToggleSwitchGroupField
59
63
  };
@@ -1,13 +1,13 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
1
2
  import { JSX, PropsWithChildren } from 'react';
2
3
  import { UseFormProps as UseHookFormProps, UseFormReturn as UseHookFormReturn } from 'react-hook-form';
3
- import { infer as ZodInfer } from 'zod';
4
4
  import { FormFieldProps } from '../components/form-field/FormField.js';
5
5
  import { FormProps } from '../components/form/Form.js';
6
6
  import { Schema } from './use-form.types.js';
7
7
  export type UseUnityFormReturn<TSchema extends Schema> = {
8
- methods: UseHookFormReturn<ZodInfer<TSchema>>;
9
- Form: (props: Omit<FormProps<TSchema>, 'form' | 'schema'>) => JSX.Element;
10
- FormField: (props: PropsWithChildren<Omit<FormFieldProps<ZodInfer<TSchema>>, 'control'>>) => JSX.Element;
8
+ methods: UseHookFormReturn<StandardSchemaV1.InferInput<TSchema>, any, StandardSchemaV1.InferOutput<TSchema>>;
9
+ Form: (props: Omit<FormProps<TSchema, StandardSchemaV1.InferInput<TSchema>, StandardSchemaV1.InferOutput<TSchema>>, 'form' | 'schema'>) => JSX.Element;
10
+ FormField: (props: PropsWithChildren<Omit<FormFieldProps<StandardSchemaV1.InferOutput<TSchema>>, 'control'>>) => JSX.Element;
11
11
  };
12
12
  /**
13
13
  * A hook to create `Form` and `FormField` components that are bound to a specific schema definition and form controller. The resulting components will have full type-safety based on the provided schema type.
@@ -45,4 +45,4 @@ export type UseUnityFormReturn<TSchema extends Schema> = {
45
45
  * @remarks
46
46
  * [API]() • [Demo]()
47
47
  */
48
- export declare function useUnityForm<TSchema extends Schema>(schema: TSchema, options?: Omit<UseHookFormProps<ZodInfer<TSchema>>, 'resolver'>): UseUnityFormReturn<TSchema>;
48
+ export declare function useUnityForm<TSchema extends Schema>(schema: TSchema, options?: Omit<UseHookFormProps<StandardSchemaV1.InferInput<TSchema>, any, StandardSchemaV1.InferOutput<TSchema>>, 'resolver'>): UseUnityFormReturn<TSchema>;
@@ -1,3 +1,3 @@
1
- import { ZodType, ZodTypeDef } from 'zod';
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  export type TFormValues = Record<string, unknown>;
3
- export type Schema = ZodType<TFormValues, ZodTypeDef, TFormValues>;
3
+ export type Schema = StandardSchemaV1<TFormValues>;
@@ -10,35 +10,34 @@ function x({
10
10
  startY: 0,
11
11
  startWidth: 0,
12
12
  startHeight: 0
13
- }), l = (r) => {
14
- var s;
13
+ }), l = (s) => {
15
14
  if (c) return;
16
- r.preventDefault();
17
- const n = (s = e.current) == null ? void 0 : s.querySelector("textarea");
18
- !e.current || !n || o({
15
+ s.preventDefault();
16
+ const r = e.current?.querySelector("textarea");
17
+ !e.current || !r || o({
19
18
  isResizing: !0,
20
- startX: r.clientX,
21
- startY: r.clientY,
19
+ startX: s.clientX,
20
+ startY: s.clientY,
22
21
  startWidth: e.current.offsetWidth,
23
- startHeight: n.offsetHeight
22
+ startHeight: r.offsetHeight
24
23
  });
25
24
  };
26
25
  return g(() => {
27
26
  if (!t.isResizing) return;
28
- const r = (s) => {
27
+ const s = (n) => {
29
28
  if (!e.current) return;
30
29
  const u = e.current.querySelector("textarea");
31
30
  if (!u) return;
32
- const d = s.clientX - t.startX, f = s.clientY - t.startY, h = Math.max(t.startWidth + d, i ?? 0), m = Math.max(
31
+ const d = n.clientX - t.startX, f = n.clientY - t.startY, h = Math.max(t.startWidth + d, i ?? 0), m = Math.max(
33
32
  t.startHeight + f,
34
33
  a ?? 0
35
34
  );
36
35
  e.current.style.width = `${h}px`, u.style.height = `${m}px`;
37
- }, n = () => {
38
- o((s) => ({ ...s, isResizing: !1 }));
36
+ }, r = () => {
37
+ o((n) => ({ ...n, isResizing: !1 }));
39
38
  };
40
- return document.addEventListener("mousemove", r), document.addEventListener("mouseup", n), () => {
41
- document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", n);
39
+ return document.addEventListener("mousemove", s), document.addEventListener("mouseup", r), () => {
40
+ document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", r);
42
41
  };
43
42
  }, [t, i, a]), {
44
43
  containerRef: e,
@@ -164,3 +164,4 @@ export * from './providers/router/RouterProvider.js';
164
164
  export * from './components/action-bar/ActionBar.js';
165
165
  export * from './components/action-bar/parts/ActionBarAction.js';
166
166
  export * from './components/action-bar/parts/ActionBarRoot.js';
167
+ export * from './components/error-state/ErrorState.js';