@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,13 +1,13 @@
1
1
  import { jsx as a, jsxs as r } from "react/jsx-runtime";
2
2
  import { useState as m } from "react";
3
- import { today as I, getLocalTimeZone as p, isToday as T } from "@internationalized/date";
3
+ import { today as I, getLocalTimeZone as f, isToday as T } from "@internationalized/date";
4
4
  import { uyTv as k } from "@payfit/unity-themes";
5
- import { Calendar as B, Heading as M, CalendarGrid as O, CalendarGridHeader as W, CalendarHeaderCell as P, CalendarGridBody as R, CalendarCell as Z } from "react-aria-components";
6
- import { IconButton as h } from "../icon-button/IconButton.js";
7
- import { useMonthsList as $ } from "./hooks/useMonthsList.js";
8
- import { useYearsList as q } from "./hooks/useYearsList.js";
9
- import { DateSegmentSelect as v } from "./parts/DateSegmentSelect.js";
10
- const z = k({
5
+ import { Calendar as B, Heading as F, CalendarGrid as M, CalendarGridHeader as O, CalendarHeaderCell as W, CalendarGridBody as P, CalendarCell as R } from "react-aria-components";
6
+ import { IconButton as b } from "../icon-button/IconButton.js";
7
+ import { useMonthsList as Z } from "./hooks/useMonthsList.js";
8
+ import { useYearsList as $ } from "./hooks/useYearsList.js";
9
+ import { DateSegmentSelect as h } from "./parts/DateSegmentSelect.js";
10
+ const q = k({
11
11
  slots: {
12
12
  base: "",
13
13
  calendarWrapper: "uy:flex uy:flex-col uy:gap-100",
@@ -39,80 +39,80 @@ const z = k({
39
39
  isDisabled: !1
40
40
  }
41
41
  });
42
- function A({
43
- value: c,
44
- defaultValue: l,
45
- minValue: d,
46
- maxValue: s,
47
- onChange: o,
48
- onFocusChange: i,
42
+ function z({
43
+ value: n,
44
+ defaultValue: d,
45
+ minValue: i,
46
+ maxValue: u,
47
+ onChange: p,
48
+ onFocusChange: g,
49
49
  ...t
50
50
  }) {
51
- const f = I(p()), [g, x] = m(
52
- c ?? l ?? f
53
- ), [n, u] = m(
54
- c ?? l ?? f
55
- ), D = $(), C = q({
56
- startYear: d == null ? void 0 : d.year,
57
- endYear: s == null ? void 0 : s.year
51
+ const y = I(f()), [v, C] = m(
52
+ n ?? d ?? y
53
+ ), [l, s] = m(
54
+ n ?? d ?? y
55
+ ), x = Z(), D = $({
56
+ startYear: i?.year,
57
+ endYear: u?.year
58
58
  }), N = (e) => {
59
- u(
60
- (y) => y.set({ month: parseInt(e, 10) })
59
+ s(
60
+ (o) => o.set({ month: parseInt(e, 10) })
61
61
  );
62
62
  }, H = (e) => {
63
- u(
64
- (y) => y.set({ year: parseInt(e, 10) })
63
+ s(
64
+ (o) => o.set({ year: parseInt(e, 10) })
65
65
  );
66
66
  }, {
67
67
  base: w,
68
68
  calendarWrapper: G,
69
69
  dialogHeader: L,
70
- dialogHeaderGroup: b,
70
+ dialogHeaderGroup: c,
71
71
  calendarGrid: S,
72
72
  calendarHeaderCell: Y,
73
73
  calendarCell: j
74
- } = z({ isDisabled: t.isDisabled });
74
+ } = q({ isDisabled: t.isDisabled });
75
75
  return /* @__PURE__ */ a("div", { className: w(), "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
76
76
  B,
77
77
  {
78
78
  ...t,
79
- minValue: d,
80
- maxValue: s,
81
- value: g,
82
- defaultValue: l,
79
+ minValue: i,
80
+ maxValue: u,
81
+ value: v,
82
+ defaultValue: d,
83
83
  onChange: (e) => {
84
- x(e), o == null || o(e);
84
+ C(e), p?.(e);
85
85
  },
86
- focusedValue: n,
86
+ focusedValue: l,
87
87
  onFocusChange: (e) => {
88
- u(e), i == null || i(e);
88
+ s(e), g?.(e);
89
89
  },
90
90
  children: /* @__PURE__ */ r("div", { className: G(), children: [
91
91
  /* @__PURE__ */ r("header", { className: L(), children: [
92
- /* @__PURE__ */ a(M, { className: "uy:sr-only" }),
92
+ /* @__PURE__ */ a(F, { className: "uy:sr-only" }),
93
93
  /* @__PURE__ */ r(
94
94
  "div",
95
95
  {
96
- className: b({
96
+ className: c({
97
97
  className: "uy:pl-100 uy:gap-200"
98
98
  }),
99
99
  children: [
100
100
  /* @__PURE__ */ a(
101
- v,
101
+ h,
102
102
  {
103
103
  type: "month",
104
- items: D,
105
- value: n.month.toString(),
104
+ items: x,
105
+ value: l.month.toString(),
106
106
  onChange: N,
107
107
  isDisabled: t.isDisabled
108
108
  }
109
109
  ),
110
110
  /* @__PURE__ */ a(
111
- v,
111
+ h,
112
112
  {
113
113
  type: "year",
114
- items: C,
115
- value: n.year.toString(),
114
+ items: D,
115
+ value: l.year.toString(),
116
116
  onChange: H,
117
117
  isDisabled: t.isDisabled
118
118
  }
@@ -123,12 +123,12 @@ function A({
123
123
  /* @__PURE__ */ r(
124
124
  "div",
125
125
  {
126
- className: b({
126
+ className: c({
127
127
  className: "uy:ml-auto uy:gap-100"
128
128
  }),
129
129
  children: [
130
130
  /* @__PURE__ */ a(
131
- h,
131
+ b,
132
132
  {
133
133
  slot: "previous",
134
134
  icon: "CaretLeftOutlined",
@@ -139,7 +139,7 @@ function A({
139
139
  }
140
140
  ),
141
141
  /* @__PURE__ */ a(
142
- h,
142
+ b,
143
143
  {
144
144
  slot: "next",
145
145
  icon: "CaretRightOutlined",
@@ -153,13 +153,13 @@ function A({
153
153
  }
154
154
  )
155
155
  ] }),
156
- /* @__PURE__ */ r(O, { className: S(), weekdayStyle: "short", children: [
157
- /* @__PURE__ */ a(W, { children: (e) => /* @__PURE__ */ a(P, { className: Y(), children: e }) }),
158
- /* @__PURE__ */ a(R, { children: (e) => /* @__PURE__ */ a(
159
- Z,
156
+ /* @__PURE__ */ r(M, { className: S(), weekdayStyle: "short", children: [
157
+ /* @__PURE__ */ a(O, { children: (e) => /* @__PURE__ */ a(W, { className: Y(), children: e }) }),
158
+ /* @__PURE__ */ a(P, { children: (e) => /* @__PURE__ */ a(
159
+ R,
160
160
  {
161
161
  date: e,
162
- "data-today": T(e, p()) ? !0 : void 0,
162
+ "data-today": T(e, f()) ? !0 : void 0,
163
163
  className: j()
164
164
  }
165
165
  ) })
@@ -168,7 +168,7 @@ function A({
168
168
  }
169
169
  ) });
170
170
  }
171
- A.displayName = "DateCalendar";
171
+ z.displayName = "DateCalendar";
172
172
  export {
173
- A as DateCalendar
173
+ z as DateCalendar
174
174
  };
@@ -1,29 +1,26 @@
1
- import { jsxs as v, jsx as n } from "react/jsx-runtime";
2
- import { useState as $ } from "react";
3
- import { IconSprite as w } from "@payfit/unity-icons";
4
- import { useId as x } from "react-aria";
5
- import { useIntl as I } from "react-intl";
6
- function N({
7
- items: o,
8
- value: i,
9
- onChange: y,
1
+ import { jsxs as b, jsx as n } from "react/jsx-runtime";
2
+ import { useState as I } from "react";
3
+ import { IconSprite as v } from "@payfit/unity-icons";
4
+ import { useId as $ } from "react-aria";
5
+ import { useIntl as w } from "react-intl";
6
+ function x({
7
+ items: a,
8
+ value: o,
9
+ onChange: m,
10
10
  type: e,
11
- isDisabled: s = !1
11
+ isDisabled: i = !1
12
12
  }) {
13
- const l = (t) => () => {
14
- const a = o.find((b) => b.id === t);
15
- return (a == null ? void 0 : a.name) ?? Array.from({ length: 3 }).join("\0");
16
- }, r = x(), c = I(), [p, f] = $(l(i)), d = `${r}-calendar-${e}-select-label`, u = `${r}-calendar-${e}-select`, m = `${r}-calendar-${e}-select-description`, h = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:label" : "unity:component:form-field:date-picker:segment-select:year:label", g = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:description" : "unity:component:form-field:date-picker:segment-select:year:description";
17
- return /* @__PURE__ */ v("div", { className: "uy:isolation-isolate uy:relative uy:inline-flex uy:items-center uy:cursor-pointer", children: [
13
+ const s = (t) => () => a.find((g) => g.id === t)?.name ?? Array.from({ length: 3 }).join("\0"), r = $(), l = w(), [y, p] = I(s(o)), c = `${r}-calendar-${e}-select-label`, d = `${r}-calendar-${e}-select`, u = `${r}-calendar-${e}-select-description`, f = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:label" : "unity:component:form-field:date-picker:segment-select:year:label", h = e === "month" ? "unity:component:form-field:date-picker:segment-select:month:description" : "unity:component:form-field:date-picker:segment-select:year:description";
14
+ return /* @__PURE__ */ b("div", { className: "uy:isolation-isolate uy:relative uy:inline-flex uy:items-center uy:cursor-pointer", children: [
18
15
  /* @__PURE__ */ n(
19
16
  "label",
20
17
  {
21
- id: d,
22
- htmlFor: u,
18
+ id: c,
19
+ htmlFor: d,
23
20
  className: "uy:sr-only",
24
21
  "aria-hidden": "true",
25
- children: c.formatMessage({
26
- id: h,
22
+ children: l.formatMessage({
23
+ id: f,
27
24
  defaultMessage: `Change current ${e}`
28
25
  })
29
26
  }
@@ -31,39 +28,39 @@ function N({
31
28
  /* @__PURE__ */ n(
32
29
  "select",
33
30
  {
34
- id: u,
35
- value: i,
31
+ id: d,
32
+ value: o,
36
33
  onChange: (t) => {
37
- y(t.target.value), f(l(t.target.value));
34
+ m(t.target.value), p(s(t.target.value));
38
35
  },
39
- disabled: s,
36
+ disabled: i,
40
37
  className: "uy:appearance-none uy:box-border uy:w-[var(--uy-selected-item-width)] uy:bg-transparent uy:border-none uy:rounded-50 uy:capitalize uy:text-content-form-enabled uy:typography-action-large uy:cursor-pointer uy:pr-300 uy:disabled:text-content-form-disabled uy:focus-visible:outline-2 uy:focus-visible:outline-offset-2 uy:focus-visible:outline-utility-focus-ring [-webkit-tap-highlight-color:transparent] [background-color:transparent]",
41
38
  style: {
42
- "--uy-selected-item-width": `calc(var(--uy-spacing-300) + ${p.length}ch)`
39
+ "--uy-selected-item-width": `calc(var(--uy-spacing-300) + ${y.length}ch)`
43
40
  },
44
- "aria-labelledby": d,
45
- "aria-describedby": m,
46
- children: o.map((t) => /* @__PURE__ */ n("option", { value: t.id, children: t.name }, t.id))
41
+ "aria-labelledby": c,
42
+ "aria-describedby": u,
43
+ children: a.map((t) => /* @__PURE__ */ n("option", { value: t.id, children: t.name }, t.id))
47
44
  }
48
45
  ),
49
46
  /* @__PURE__ */ n("div", { className: "uy:absolute uy:right-0 uy:pointer-events-none uy:text-content-neutral-low", children: /* @__PURE__ */ n(
50
- w,
47
+ v,
51
48
  {
52
49
  src: "CaretDownOutlined",
53
50
  width: 20,
54
51
  height: 20,
55
52
  color: "inherit",
56
53
  role: "presentation",
57
- className: s ? "uy:text-content-form-disabled" : ""
54
+ className: i ? "uy:text-content-form-disabled" : ""
58
55
  }
59
56
  ) }),
60
- /* @__PURE__ */ n("span", { id: m, className: "uy:sr-only", "aria-hidden": "true", children: c.formatMessage({
61
- id: g,
57
+ /* @__PURE__ */ n("span", { id: u, className: "uy:sr-only", "aria-hidden": "true", children: l.formatMessage({
58
+ id: h,
62
59
  defaultMessage: `Press Enter or Space to change ${e}, then use up and down arrows to select a ${e}`
63
60
  }) })
64
61
  ] });
65
62
  }
66
- N.displayName = "DateSegmentSelect";
63
+ x.displayName = "DateSegmentSelect";
67
64
  export {
68
- N as DateSegmentSelect
65
+ x as DateSegmentSelect
69
66
  };
@@ -1,15 +1,15 @@
1
- import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as W } from "react";
3
- import { uyTv as m } from "@payfit/unity-themes";
4
- import { DatePicker as I, Group as P, Button as U, Popover as j, Dialog as E } from "react-aria-components";
5
- import { useIntl as M } from "react-intl";
6
- import { DateCalendar as O } from "../date-calendar/DateCalendar.js";
7
- import { Icon as R } from "../icon/Icon.js";
8
- import { DateInput as G } from "./parts/DateInput.js";
9
- const T = m({
1
+ import { jsxs as f, jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as V } from "react";
3
+ import { uyTv as b } from "@payfit/unity-themes";
4
+ import { DatePicker as N, Group as O, Button as W, Popover as I, Dialog as U } from "react-aria-components";
5
+ import { useIntl as B } from "react-intl";
6
+ import { DateCalendar as j } from "../date-calendar/DateCalendar.js";
7
+ import { Icon as E } from "../icon/Icon.js";
8
+ import { DateInput as M } from "./parts/DateInput.js";
9
+ const R = b({
10
10
  slots: {
11
11
  base: [
12
- "uy:group uy:flex uy:h-500 uy:border uy:border-solid uy:rounded-100",
12
+ "uy:group uy:flex uy:h-500 uy:border uy:border-solid uy:rounded-75",
13
13
  "uy:active:border-border-form-active uy:data-[focus-visible]:border-border-form-active"
14
14
  ],
15
15
  inputWrapper: [
@@ -20,7 +20,7 @@ const T = m({
20
20
  "uy:group-[:has(button:focus)]:data-[focus-within]:outline-none uy:group-[:has(button:focus)]:data-[focus-within]:outline-offset-0 uy:group-[:has(button:focus)]:data-[focus-within]:outline-transparent"
21
21
  ],
22
22
  suffix: [
23
- "uy:flex-grow-0 uy:content-center uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:border-l uy:border-solid uy:rounded-r-100 uy:text-content-neutral-low",
23
+ "uy:flex-grow-0 uy:content-center uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:border-l uy:border-solid uy:rounded-r-75 uy:text-content-neutral-low",
24
24
  "uy:hover:bg-surface-neutral-hover uy:active:bg-surface-neutral-pressed uy:active:border-border-form-active uy:data-[pressed]:bg-surface-neutral-pressed uy:data-[pressed]:border-border-form-active",
25
25
  "uy:focus-visible:outline-2 uy:focus-visible:outline-utility-focus-ring uy:focus-visible:outline-offset-[3px]"
26
26
  ]
@@ -58,7 +58,7 @@ const T = m({
58
58
  }
59
59
  }
60
60
  ]
61
- }), $ = m({
61
+ }), G = b({
62
62
  base: "uy:overflow-auto uy:shadow-floating uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral uy:rounded-75",
63
63
  variants: {
64
64
  isEntering: {
@@ -68,68 +68,68 @@ const T = m({
68
68
  true: "uy:animate-out uy:fade-out uy:data-[placement-bottom]:slide-out-to-top-1 uy:data-[placement-top]:slide-out-to-bottom-1 uy:duration-150 uy:ease-in"
69
69
  }
70
70
  }
71
- }), q = W(
71
+ }), T = V(
72
72
  ({
73
- value: f,
74
- defaultValue: n,
75
- isInvalid: b,
76
- isLoading: p,
77
- isDisabled: t,
78
- isReadOnly: u,
79
- onClearButtonPress: d,
80
- onBlur: o,
81
- onFocus: i,
82
- onChange: s,
83
- onOpenChange: l,
84
- id: v,
73
+ value: u,
74
+ defaultValue: i,
75
+ isInvalid: n,
76
+ isLoading: y,
77
+ isDisabled: o,
78
+ isReadOnly: t,
79
+ onClearButtonPress: c,
80
+ onBlur: s,
81
+ onFocus: d,
82
+ onChange: m,
83
+ onOpenChange: p,
84
+ id: g,
85
85
  ...e
86
- }, z) => {
87
- const g = M(), { base: x, inputWrapper: h, suffix: D } = T({
88
- isInvalid: !!b,
89
- isReadOnly: !!u,
90
- isDisabled: !!t
91
- }), y = (r) => {
92
- s == null || s(r);
86
+ }, $) => {
87
+ const h = B(), { base: v, inputWrapper: x, suffix: D } = R({
88
+ isInvalid: !!n,
89
+ isReadOnly: !!t,
90
+ isDisabled: !!o
91
+ }), l = (r) => {
92
+ m?.(r);
93
93
  }, w = (r) => {
94
- l == null || l(r), r ? i == null || i() : o == null || o();
95
- }, k = (r) => e.isDateUnavailable ? e.isDateUnavailable(r) : !1, V = () => {
96
- d == null || d();
94
+ p?.(r), r ? d?.() : s?.();
95
+ }, k = (r) => e.isDateUnavailable ? e.isDateUnavailable(r) : !1, C = () => {
96
+ c?.();
97
97
  };
98
- return /* @__PURE__ */ c(
99
- I,
98
+ return /* @__PURE__ */ f(
99
+ N,
100
100
  {
101
101
  "data-dd-privacy": "mask",
102
102
  ...e,
103
- className: x(),
104
- value: f,
105
- defaultValue: n,
103
+ className: v(),
104
+ value: u,
105
+ defaultValue: i,
106
106
  minValue: e.minValue,
107
107
  maxValue: e.maxValue,
108
- isReadOnly: !!u,
109
- isDisabled: !!t,
110
- onChange: y,
111
- onFocus: i,
112
- onBlur: o,
108
+ isReadOnly: !!t,
109
+ isDisabled: !!o,
110
+ onChange: l,
111
+ onFocus: d,
112
+ onBlur: s,
113
113
  onOpenChange: w,
114
114
  isDateUnavailable: k,
115
115
  children: [
116
- /* @__PURE__ */ c(P, { className: h(), id: v, children: [
116
+ /* @__PURE__ */ f(O, { className: x(), id: g, children: [
117
117
  /* @__PURE__ */ a(
118
- G,
118
+ M,
119
119
  {
120
- isLoading: p,
121
- isDisabled: t,
122
- isReadOnly: u,
123
- isInvalid: b,
124
- onClearButtonPress: V
120
+ isLoading: y,
121
+ isDisabled: o,
122
+ isReadOnly: t,
123
+ isInvalid: n,
124
+ onClearButtonPress: C
125
125
  }
126
126
  ),
127
- /* @__PURE__ */ a(U, { className: D(), isDisabled: u || t, children: /* @__PURE__ */ a(
128
- R,
127
+ /* @__PURE__ */ a(W, { className: D(), isDisabled: t || o, children: /* @__PURE__ */ a(
128
+ E,
129
129
  {
130
130
  src: "CalendarBlankOutlined",
131
131
  color: "inherit",
132
- alt: g.formatMessage({
132
+ alt: h.formatMessage({
133
133
  id: "unity:component:form-field:date-picker:calendar-button",
134
134
  defaultMessage: "Open Calendar"
135
135
  })
@@ -137,17 +137,17 @@ const T = m({
137
137
  ) })
138
138
  ] }),
139
139
  /* @__PURE__ */ a(
140
- j,
140
+ I,
141
141
  {
142
- className: ({ isEntering: r, isExiting: N }) => $({ isEntering: r, isExiting: N }),
143
- children: /* @__PURE__ */ a(E, { className: "uy:p-150", "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
144
- O,
142
+ className: ({ isEntering: r, isExiting: P }) => G({ isEntering: r, isExiting: P }),
143
+ children: /* @__PURE__ */ a(U, { className: "uy:p-150", "data-dd-privacy": "mask", children: /* @__PURE__ */ a(
144
+ j,
145
145
  {
146
- value: f,
147
- defaultValue: n,
146
+ value: u,
147
+ defaultValue: i,
148
148
  minValue: e.minValue,
149
149
  maxValue: e.maxValue,
150
- onChange: y,
150
+ onChange: l,
151
151
  firstDayOfWeek: e.firstDayOfWeek
152
152
  }
153
153
  ) })
@@ -158,7 +158,7 @@ const T = m({
158
158
  );
159
159
  }
160
160
  );
161
- q.displayName = "DatePicker";
161
+ T.displayName = "DatePicker";
162
162
  export {
163
- q as DatePicker
163
+ T as DatePicker
164
164
  };
@@ -1,12 +1,12 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
2
  import { useContext as b } from "react";
3
- import { uyTv as d } from "@payfit/unity-themes";
3
+ import { uyTv as i } from "@payfit/unity-themes";
4
4
  import { DatePickerStateContext as g, DateInput as x, DateSegment as v } from "react-aria-components";
5
5
  import { useIntl as I } from "react-intl";
6
6
  import { CircularIconButton as h } from "../../icon-button/CircularIconButton.js";
7
7
  import { Icon as D } from "../../icon/Icon.js";
8
- import { Spinner as M } from "../../spinner/Spinner.js";
9
- const N = d({
8
+ import { Spinner as C } from "../../spinner/Spinner.js";
9
+ const M = i({
10
10
  base: "uy:group uy:box-content uy:rounded-25 uy:px-25 uy:text-end uy:tabular-nums! uy:outline-none uy:typography-body uy:focus:bg-surface-form-active uy:focus:rounded-25 uy:focus:text-content-inverted uy:data-[disabled]:text-content-form-disabled",
11
11
  variants: {
12
12
  isPlaceholder: {
@@ -18,7 +18,7 @@ const N = d({
18
18
  false: ""
19
19
  }
20
20
  }
21
- }), w = d({
21
+ }), N = i({
22
22
  slots: {
23
23
  base: "uy:flex uy:gap-50 uy:flex-grow uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:rounded-100",
24
24
  input: "uy:flex uy:gap-25 uy:w-fit uy:grow",
@@ -54,47 +54,47 @@ const N = d({
54
54
  }
55
55
  ]
56
56
  });
57
- function O({
58
- isLoading: n,
59
- isInvalid: u,
60
- isReadOnly: s,
61
- isDisabled: l,
62
- onClearButtonPress: a
57
+ function P({
58
+ isLoading: r,
59
+ isInvalid: o,
60
+ isReadOnly: n,
61
+ isDisabled: s,
62
+ onClearButtonPress: d
63
63
  }) {
64
- const o = I(), t = b(g), { dateValue: c } = t, { base: m, input: y, state: f } = w({
65
- isInvalid: !!u,
66
- isReadOnly: !!s,
67
- isDisabled: !!l
68
- }), p = c && !n && !s && !l;
69
- return /* @__PURE__ */ i("div", { className: m(), children: [
70
- /* @__PURE__ */ e(x, { className: y(), children: (r) => /* @__PURE__ */ e(
64
+ const t = I(), u = b(g), { dateValue: c } = u, { base: m, input: y, state: f } = N({
65
+ isInvalid: !!o,
66
+ isReadOnly: !!n,
67
+ isDisabled: !!s
68
+ }), p = c && !r && !n && !s;
69
+ return /* @__PURE__ */ l("div", { className: m(), children: [
70
+ /* @__PURE__ */ e(x, { className: y(), children: (a) => /* @__PURE__ */ e(
71
71
  v,
72
72
  {
73
- segment: r,
74
- className: N({
75
- isPlaceholder: r.isPlaceholder,
76
- isLiteral: r.type === "literal"
73
+ segment: a,
74
+ className: M({
75
+ isPlaceholder: a.isPlaceholder,
76
+ isLiteral: a.type === "literal"
77
77
  })
78
78
  }
79
79
  ) }),
80
- /* @__PURE__ */ i("div", { className: f(), children: [
81
- n && /* @__PURE__ */ e(
82
- M,
80
+ /* @__PURE__ */ l("div", { className: f(), children: [
81
+ r && /* @__PURE__ */ e(
82
+ C,
83
83
  {
84
84
  color: "inherit",
85
85
  size: "small",
86
- label: o.formatMessage({
86
+ label: t.formatMessage({
87
87
  id: "unity:component:common:loading:label",
88
88
  defaultMessage: "Loading..."
89
89
  })
90
90
  }
91
91
  ),
92
- u && /* @__PURE__ */ e(
92
+ o && /* @__PURE__ */ e(
93
93
  D,
94
94
  {
95
95
  src: "WarningCircleOutlined",
96
96
  color: "content.form.invalid",
97
- alt: o.formatMessage({
97
+ alt: t.formatMessage({
98
98
  id: "unity:component:form-field:form-input:error:alt",
99
99
  defaultMessage: "Error"
100
100
  })
@@ -104,21 +104,21 @@ function O({
104
104
  h,
105
105
  {
106
106
  slot: null,
107
- title: o.formatMessage({
107
+ title: t.formatMessage({
108
108
  id: "unity:component:common:clear:title",
109
109
  defaultMessage: "Clear"
110
110
  }),
111
111
  icon: "CloseOutlined",
112
112
  onPress: () => {
113
- t == null || t.setValue(null), a == null || a();
113
+ u?.setValue(null), d?.();
114
114
  }
115
115
  }
116
116
  )
117
117
  ] })
118
118
  ] });
119
119
  }
120
- O.displayName = "DateInput";
120
+ P.displayName = "DateInput";
121
121
  export {
122
- O as DateInput,
123
- w as dateInput
122
+ P as DateInput,
123
+ N as dateInput
124
124
  };
@@ -1,7 +1,7 @@
1
1
  import { CalendarDate } from '@internationalized/date';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
3
  import { ForwardedRef, ReactNode } from 'react';
3
4
  import { FieldPath, FieldValues } from 'react-hook-form';
4
- import { infer as ZodInfer } from 'zod';
5
5
  import { Schema } from '../../hooks/use-form.types.js';
6
6
  import { DatePickerProps } from '../date-picker/DatePicker.js';
7
7
  import { LabelProps } from '../label/Label.js';
@@ -45,7 +45,7 @@ export type TypedDatePickerFieldProps<TFieldValues extends FieldValues = FieldVa
45
45
  name: TName;
46
46
  };
47
47
  type DatePickerFieldComponent = {
48
- <TSchema extends Schema>(props: TypedDatePickerFieldProps<ZodInfer<TSchema>> & {
48
+ <TSchema extends Schema>(props: TypedDatePickerFieldProps<StandardSchemaV1.InferOutput<TSchema>> & {
49
49
  ref?: ForwardedRef<HTMLDivElement>;
50
50
  }): React.JSX.Element;
51
51
  displayName?: string;