@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
- import { jsx as u, jsxs as q } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as q } from "react/jsx-runtime";
2
2
  import { forwardRef as Se, useMemo as S, useCallback as d } from "react";
3
3
  import { ComboboxProvider as pe, SelectProvider as z } from "@ariakit/react";
4
4
  import { useComboboxFilter as he } from "./hooks/use-combobox-filter.js";
5
- import { useMultiSelectionState as ve } from "./hooks/use-multiselection-state.js";
5
+ import { useMultiSelectionState as Ve } from "./hooks/use-multiselection-state.js";
6
6
  import { MultiSelectContext as J } from "./Multiselect.context.js";
7
7
  import { MultiSelectButton as U } from "./parts/MultiSelectButton.js";
8
8
  import { MultiSelectPopover as W } from "./parts/MultiSelectPopover.js";
9
9
  function X(t) {
10
10
  return t instanceof Map;
11
11
  }
12
- function Ve(t) {
12
+ function ge(t) {
13
13
  return !Object.prototype.hasOwnProperty.call(t, "items");
14
14
  }
15
15
  function a(t) {
@@ -24,59 +24,59 @@ function Z(t) {
24
24
  function Y(t) {
25
25
  return new Set(Z(t));
26
26
  }
27
- const $ = (t, g) => {
28
- const o = Ve(t), w = (e) => {
27
+ const $ = (t, P) => {
28
+ const n = ge(t), A = (e) => {
29
29
  if (Object.hasOwnProperty.call(e, "value"))
30
30
  return e.value;
31
31
  if (Object.prototype.hasOwnProperty.call(e, "id"))
32
32
  return e.id;
33
33
  if (typeof e == "string")
34
34
  return e;
35
- const n = Object.keys(e)[0];
36
- return e[n];
37
- }, ee = o ? (e) => Array.from(e).map(String).join(", ") : (e) => Array.from(e).map((n) => w(n)).join(", "), m = t, C = t, c = S(
38
- () => o ? void 0 : m.items,
39
- [o, m.items]
40
- ), r = o ? void 0 : m.getItemValue ?? w, { children: v } = o ? C : m, te = o ? void 0 : m.searchOptions, { children: O } = C, {
35
+ const r = Object.keys(e)[0];
36
+ return e[r];
37
+ }, ee = n ? (e) => Array.from(e).map(String).join(", ") : (e) => Array.from(e).map((r) => A(r)).join(", "), m = t, w = t, c = S(
38
+ () => n ? void 0 : m.items,
39
+ [n, m.items]
40
+ ), s = n ? void 0 : m.getItemValue ?? A, { children: V } = n ? w : m, te = n ? void 0 : m.searchOptions, { children: C } = w, {
41
41
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
- children: Pe,
42
+ children: be,
43
43
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
- getItemValue: Ae,
45
- value: V,
44
+ getItemValue: Ke,
45
+ value: g,
46
46
  defaultValue: f,
47
- onChange: b,
48
- onBlur: M,
49
- isDisabled: x,
50
- isInvalid: j,
51
- isLoading: D,
52
- isReadOnly: I,
47
+ onChange: v,
48
+ onBlur: O,
49
+ isDisabled: M,
50
+ isInvalid: x,
51
+ isLoading: j,
52
+ isReadOnly: D,
53
53
  isSearchable: h,
54
54
  placeholder: R,
55
55
  onClearButtonPress: F,
56
56
  renderValue: re,
57
57
  maxVisibleItems: N = 7,
58
58
  ...B
59
- } = t, ne = re ?? ee, y = d(() => o || !c ? [] : X(c) ? Array.from(c.values()).flat() : Array.from(c), [c, o]), oe = d(() => {
59
+ } = t, ne = re ?? ee, y = d(() => n || !c ? [] : X(c) ? Array.from(c.values()).flat() : Array.from(c), [c, n]), oe = d(() => {
60
60
  if ("value" in t)
61
- return V ? Y(V) : /* @__PURE__ */ new Set();
62
- }, [t, V]), se = d(() => f ? Y(f) : /* @__PURE__ */ new Set(), [f]), le = d(
61
+ return g ? Y(g) : /* @__PURE__ */ new Set();
62
+ }, [t, g]), le = d(() => f ? Y(f) : /* @__PURE__ */ new Set(), [f]), ae = d(
63
63
  (e) => {
64
- if (!b) return;
65
- const n = new Set(
64
+ if (!v) return;
65
+ const r = new Set(
66
66
  Array.from(e).map((l) => p(l))
67
67
  );
68
- b(n);
68
+ v(r);
69
69
  },
70
- [b]
70
+ [v]
71
71
  ), {
72
- selectedKeys: i,
72
+ selectedKeys: u,
73
73
  selectKey: L,
74
74
  unselectKey: T
75
- } = ve({
75
+ } = Ve({
76
76
  selectedKeys: oe(),
77
- defaultSelectedKeys: se(),
78
- onSelectionChange: le
79
- }), ae = d(
77
+ defaultSelectedKeys: le(),
78
+ onSelectionChange: ae
79
+ }), se = d(
80
80
  (e) => {
81
81
  L(a(e));
82
82
  },
@@ -86,78 +86,78 @@ const $ = (t, g) => {
86
86
  T(a(e));
87
87
  },
88
88
  [T]
89
- ), { setSearchQuery: ie, matchingItems: K } = he({
89
+ ), { setSearchQuery: ue, matchingItems: I } = he({
90
90
  items: y(),
91
- extractSearchableText: (e) => o ? [""] : [
91
+ extractSearchableText: (e) => n ? [""] : [
92
92
  a(
93
- (r == null ? void 0 : r(e)) || ""
93
+ s?.(e) || ""
94
94
  )
95
95
  ],
96
96
  enabled: h,
97
97
  searchOptions: te
98
- }), ue = () => {
99
- if (o) return Array.from(i);
98
+ }), ie = () => {
99
+ if (n) return Array.from(u);
100
100
  const e = y();
101
- return Array.from(i).map((n) => {
101
+ return Array.from(u).map((r) => {
102
102
  const l = e.find(
103
- (s) => a(
104
- (r == null ? void 0 : r(s)) || ""
105
- ) === n
103
+ (o) => a(
104
+ s?.(o) || ""
105
+ ) === r
106
106
  );
107
- return l && r ? r(l) : p(n);
107
+ return l && s ? s(l) : p(r);
108
108
  });
109
109
  }, de = () => {
110
- if (o)
110
+ if (n)
111
111
  return new Set(
112
- Array.from(i).map((l) => p(l))
112
+ Array.from(u).map((l) => p(l))
113
113
  );
114
- const e = y(), n = /* @__PURE__ */ new Set();
115
- return Array.from(i).forEach((l) => {
116
- const s = e.find(
117
- (A) => a(
118
- (r == null ? void 0 : r(A)) || ""
114
+ const e = y(), r = /* @__PURE__ */ new Set();
115
+ return Array.from(u).forEach((l) => {
116
+ const o = e.find(
117
+ (K) => a(
118
+ s?.(K) || ""
119
119
  ) === l
120
120
  );
121
- s && n.add(s);
122
- }), n;
121
+ o && r.add(o);
122
+ }), r;
123
123
  }, fe = () => {
124
124
  if (f)
125
125
  return Z(f);
126
- }, P = S(ue, [
127
- i,
128
- o,
129
- r,
126
+ }, b = S(ie, [
127
+ u,
128
+ n,
129
+ s,
130
130
  y
131
131
  ]), _ = S(de, [
132
- i,
133
- o,
134
- r,
132
+ u,
133
+ n,
134
+ s,
135
135
  y
136
136
  ]), G = S(fe, [f]), k = (e) => {
137
- const n = new Set(e), l = new Set(
138
- P.map((s) => a(s))
137
+ const r = new Set(e), l = new Set(
138
+ b.map((o) => a(o))
139
139
  );
140
- for (const s of n)
141
- l.has(s) || ae(p(s));
142
- for (const s of l)
143
- n.has(s) || ce(p(s));
144
- }, E = d(() => o ? O : c ? X(c) ? Array.from(c.entries()).map(([e, n]) => {
145
- const l = n.filter(
146
- (s) => K.some((A) => {
147
- const me = (r == null ? void 0 : r(s)) || "", ye = (r == null ? void 0 : r(A)) || "";
140
+ for (const o of r)
141
+ l.has(o) || se(p(o));
142
+ for (const o of l)
143
+ r.has(o) || ce(p(o));
144
+ }, E = d(() => n ? C : c ? X(c) ? Array.from(c.entries()).map(([e, r]) => {
145
+ const l = r.filter(
146
+ (o) => I.some((K) => {
147
+ const me = s?.(o) || "", ye = s?.(K) || "";
148
148
  return a(ye) === a(me);
149
149
  })
150
150
  );
151
- return v(e, l);
152
- }) : K.map(
153
- (e) => v(
151
+ return V(e, l);
152
+ }) : I.map(
153
+ (e) => V(
154
154
  e
155
155
  )
156
- ) : null, [v, c, K, O, r, o]), H = S(() => E(), [E]), Q = ne;
157
- return h ? /* @__PURE__ */ u(pe, { resetValueOnHide: !0, setValue: ie, children: /* @__PURE__ */ u(
156
+ ) : null, [V, c, I, C, s, n]), H = S(() => E(), [E]), Q = ne;
157
+ return h ? /* @__PURE__ */ i(pe, { resetValueOnHide: !0, setValue: ue, children: /* @__PURE__ */ i(
158
158
  z,
159
159
  {
160
- value: P.map(
160
+ value: b.map(
161
161
  (e) => a(e)
162
162
  ),
163
163
  defaultValue: G,
@@ -166,32 +166,32 @@ const $ = (t, g) => {
166
166
  children: /* @__PURE__ */ q(
167
167
  J.Provider,
168
168
  {
169
- value: { isSearchable: h, maxVisibleItems: N, selectedKeys: i },
169
+ value: { isSearchable: h, maxVisibleItems: N, selectedKeys: u },
170
170
  children: [
171
- /* @__PURE__ */ u(
171
+ /* @__PURE__ */ i(
172
172
  U,
173
173
  {
174
- ref: g,
174
+ ref: P,
175
175
  placeholder: R,
176
- isDisabled: x,
177
- isReadOnly: I,
178
- isLoading: D,
179
- isInvalid: j,
176
+ isDisabled: M,
177
+ isReadOnly: D,
178
+ isLoading: j,
179
+ isInvalid: x,
180
180
  renderValue: Q,
181
181
  selectedItems: _,
182
182
  onClearButtonPress: F,
183
183
  ...B
184
184
  }
185
185
  ),
186
- /* @__PURE__ */ u(W, { onBlur: M, children: H })
186
+ /* @__PURE__ */ i(W, { onBlur: O, children: H })
187
187
  ]
188
188
  }
189
189
  )
190
190
  }
191
- ) }) : /* @__PURE__ */ u(
191
+ ) }) : /* @__PURE__ */ i(
192
192
  z,
193
193
  {
194
- value: P.map(
194
+ value: b.map(
195
195
  (e) => a(e)
196
196
  ),
197
197
  defaultValue: G,
@@ -200,24 +200,24 @@ const $ = (t, g) => {
200
200
  children: /* @__PURE__ */ q(
201
201
  J.Provider,
202
202
  {
203
- value: { isSearchable: h, maxVisibleItems: N, selectedKeys: i },
203
+ value: { isSearchable: h, maxVisibleItems: N, selectedKeys: u },
204
204
  children: [
205
- /* @__PURE__ */ u(
205
+ /* @__PURE__ */ i(
206
206
  U,
207
207
  {
208
- ref: g,
208
+ ref: P,
209
209
  placeholder: R,
210
- isDisabled: x,
211
- isReadOnly: I,
212
- isLoading: D,
213
- isInvalid: j,
210
+ isDisabled: M,
211
+ isReadOnly: D,
212
+ isLoading: j,
213
+ isInvalid: x,
214
214
  renderValue: Q,
215
215
  selectedItems: _,
216
216
  onClearButtonPress: F,
217
217
  ...B
218
218
  }
219
219
  ),
220
- /* @__PURE__ */ u(W, { onBlur: M, children: H })
220
+ /* @__PURE__ */ i(W, { onBlur: O, children: H })
221
221
  ]
222
222
  }
223
223
  )
@@ -225,9 +225,9 @@ const $ = (t, g) => {
225
225
  );
226
226
  };
227
227
  $.displayName = "MultiSelect";
228
- const Ie = Se(
228
+ const De = Se(
229
229
  $
230
230
  );
231
231
  export {
232
- Ie as MultiSelect
232
+ De as MultiSelect
233
233
  };
@@ -1,47 +1,47 @@
1
- import { useState as l } from "react";
2
- function I({
3
- selectedKeys: w,
4
- defaultSelectedKeys: y,
5
- onSelectionChange: t
1
+ import { useState as w } from "react";
2
+ function a({
3
+ selectedKeys: c,
4
+ defaultSelectedKeys: K,
5
+ onSelectionChange: d
6
6
  }) {
7
- const [f, u] = l(
8
- () => y ?? /* @__PURE__ */ new Set()
9
- ), K = w !== void 0, r = K ? w : f;
7
+ const [u, r] = w(
8
+ () => K ?? /* @__PURE__ */ new Set()
9
+ ), n = c !== void 0, l = n ? c : u;
10
10
  return {
11
- selectedKeys: r,
12
- isSelected: (e) => r.has(e),
13
- selectKey: (e) => {
14
- if (K && t) {
15
- const s = new Set(r);
16
- s.add(e), t(s);
11
+ selectedKeys: l,
12
+ isSelected: (t) => l.has(t),
13
+ selectKey: (t) => {
14
+ if (n && d) {
15
+ const e = new Set(l);
16
+ e.add(t), d(e);
17
17
  } else
18
- u((s) => {
19
- const d = new Set(s);
20
- return d.add(e), t == null || t(d), d;
18
+ r((e) => {
19
+ const s = new Set(e);
20
+ return s.add(t), d?.(s), s;
21
21
  });
22
22
  },
23
- unselectKey: (e) => {
24
- if (K && t) {
25
- const s = new Set(r);
26
- s.delete(e), t(s);
23
+ unselectKey: (t) => {
24
+ if (n && d) {
25
+ const e = new Set(l);
26
+ e.delete(t), d(e);
27
27
  } else
28
- u((s) => {
29
- const d = new Set(s);
30
- return d.delete(e), t == null || t(d), d;
28
+ r((e) => {
29
+ const s = new Set(e);
30
+ return s.delete(t), d?.(s), s;
31
31
  });
32
32
  },
33
- toggleKey: (e) => {
34
- if (K && t) {
35
- const s = new Set(r);
36
- s.has(e) ? s.delete(e) : s.add(e), t(s);
33
+ toggleKey: (t) => {
34
+ if (n && d) {
35
+ const e = new Set(l);
36
+ e.has(t) ? e.delete(t) : e.add(t), d(e);
37
37
  } else
38
- u((s) => {
39
- const d = new Set(s);
40
- return d.has(e) ? d.delete(e) : d.add(e), t == null || t(d), d;
38
+ r((e) => {
39
+ const s = new Set(e);
40
+ return s.has(t) ? s.delete(t) : s.add(t), d?.(s), s;
41
41
  });
42
42
  }
43
43
  };
44
44
  }
45
45
  export {
46
- I as useMultiSelectionState
46
+ a as useMultiSelectionState
47
47
  };
@@ -1,15 +1,15 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import { memo as j, forwardRef as E, useContext as k, useMemo as A } from "react";
3
3
  import { useSelectContext as D, useStoreState as K, Select as $ } from "@ariakit/react";
4
4
  import { uyTv as L } from "@payfit/unity-themes";
5
- import { useId as R } from "react-aria";
6
- import { useIntl as T } from "react-intl";
7
- import { Badge as U } from "../../badge/Badge.js";
8
- import { CircularIconButton as W } from "../../icon-button/CircularIconButton.js";
9
- import { Icon as p } from "../../icon/Icon.js";
10
- import { Spinner as q } from "../../spinner/Spinner.js";
11
- import { MultiSelectContext as F } from "../Multiselect.context.js";
12
- const G = L({
5
+ import { useId as P } from "react-aria";
6
+ import { useIntl as R } from "react-intl";
7
+ import { Badge as T } from "../../badge/Badge.js";
8
+ import { CircularIconButton as U } from "../../icon-button/CircularIconButton.js";
9
+ import { Icon as b } from "../../icon/Icon.js";
10
+ import { Spinner as W } from "../../spinner/Spinner.js";
11
+ import { MultiSelectContext as q } from "../Multiselect.context.js";
12
+ const F = L({
13
13
  slots: {
14
14
  base: "uy:h-500 uy:flex uy:items-center uy:justify-between uy:py-100 uy:px-150 uy:w-full 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:not([disabled]):border-border-form-active uy:pointer-events-auto!",
15
15
  inputValue: "uy:flex-1 uy:typography-body uy:text-content-form-enabled uy:text-left uy:line-clamp-1",
@@ -61,46 +61,46 @@ const G = L({
61
61
  }
62
62
  ]
63
63
  });
64
- function H({
64
+ function G({
65
65
  isDisabled: r,
66
66
  isReadOnly: t,
67
- isLoading: d,
67
+ isLoading: c,
68
68
  isInvalid: n,
69
69
  placeholder: u,
70
- selectedItems: g,
71
- renderValue: m,
72
- onClearButtonPress: i,
70
+ selectedItems: x,
71
+ renderValue: d,
72
+ onClearButtonPress: g,
73
73
  ...w
74
74
  }, h) {
75
- const f = R(), s = T(), S = D(), M = K(S, "open"), y = k(F), a = y.maxVisibleItems ?? 0, l = y.selectedKeys ?? /* @__PURE__ */ new Set(), o = Array.from(g), { base: v, inputValue: I, state: C, suffix: V } = G({
75
+ const m = P(), s = R(), S = D(), C = K(S, "open"), f = k(q), a = f.maxVisibleItems ?? 0, l = f.selectedKeys ?? /* @__PURE__ */ new Set(), o = Array.from(x), { base: M, inputValue: v, state: I, suffix: B } = F({
76
76
  isDisabled: !!r,
77
77
  isReadOnly: !!t,
78
78
  isInvalid: !!n,
79
79
  isEmpty: l.size === 0
80
- }), b = Math.max(
80
+ }), y = Math.max(
81
81
  o.length - a,
82
82
  0
83
- ), N = l.size > 0 && !r && !t && !d, B = A(() => {
83
+ ), V = l.size > 0 && !r && !t && !c, N = A(() => {
84
84
  if (o.length === 0) return u;
85
85
  const O = o.slice(0, a), z = new Set(O);
86
- return m(z);
87
- }, [o, a, m, u]);
88
- return /* @__PURE__ */ c(
86
+ return d(z);
87
+ }, [o, a, d, u]);
88
+ return /* @__PURE__ */ i(
89
89
  $,
90
90
  {
91
91
  ...w,
92
92
  ref: h,
93
- className: v(),
93
+ className: M(),
94
94
  disabled: r || t,
95
95
  "aria-invalid": n,
96
96
  "aria-readonly": t,
97
- "aria-labelledby": `${f}-select-button-label`,
97
+ "aria-labelledby": `${m}-select-button-label`,
98
98
  "data-dd-privacy": "mask",
99
99
  children: [
100
- /* @__PURE__ */ e("span", { id: `${f}-select-button-label`, className: I(), children: l.size > 0 ? B : u }),
101
- /* @__PURE__ */ c("div", { className: C(), children: [
102
- d && /* @__PURE__ */ e(
103
- q,
100
+ /* @__PURE__ */ e("span", { id: `${m}-select-button-label`, className: v(), children: l.size > 0 ? N : u }),
101
+ /* @__PURE__ */ i("div", { className: I(), children: [
102
+ c && /* @__PURE__ */ e(
103
+ W,
104
104
  {
105
105
  color: "inherit",
106
106
  size: "small",
@@ -111,7 +111,7 @@ function H({
111
111
  }
112
112
  ),
113
113
  n && /* @__PURE__ */ e(
114
- p,
114
+ b,
115
115
  {
116
116
  src: "WarningCircleOutlined",
117
117
  color: "content.form.invalid",
@@ -121,12 +121,12 @@ function H({
121
121
  })
122
122
  }
123
123
  ),
124
- b > 0 && /* @__PURE__ */ c(U, { variant: "numeric", children: [
124
+ y > 0 && /* @__PURE__ */ i(T, { variant: "numeric", children: [
125
125
  "+",
126
- b
126
+ y
127
127
  ] }),
128
- N && /* @__PURE__ */ e(
129
- W,
128
+ V && /* @__PURE__ */ e(
129
+ U,
130
130
  {
131
131
  title: s.formatMessage({
132
132
  id: "unity:component:common:clear:title",
@@ -135,17 +135,17 @@ function H({
135
135
  className: "uy:text-content-neutral-enabled",
136
136
  icon: "CloseOutlined",
137
137
  onPress: () => {
138
- i == null || i();
138
+ g?.();
139
139
  }
140
140
  }
141
141
  )
142
142
  ] }),
143
143
  /* @__PURE__ */ e(
144
- p,
144
+ b,
145
145
  {
146
146
  color: "content.neutral.low",
147
- className: V(),
148
- src: M ? "CaretUpOutlined" : "CaretDownOutlined",
147
+ className: B(),
148
+ src: C ? "CaretUpOutlined" : "CaretDownOutlined",
149
149
  role: "presentation"
150
150
  }
151
151
  )
@@ -153,9 +153,9 @@ function H({
153
153
  }
154
154
  );
155
155
  }
156
- const x = j(E(H));
157
- x.displayName = "MultiselectButton";
158
- const ne = x;
156
+ const p = j(E(G));
157
+ p.displayName = "MultiselectButton";
158
+ const ne = p;
159
159
  export {
160
160
  ne as MultiSelectButton
161
161
  };
@@ -1,15 +1,15 @@
1
- import { jsx as e, jsxs as r, Fragment as m } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as o, Fragment as m } from "react/jsx-runtime";
2
2
  import { memo as b, useContext as f } from "react";
3
3
  import { SelectPopover as h, Combobox as v, ComboboxList as x } from "@ariakit/react";
4
- import { uyTv as i } from "@payfit/unity-themes";
4
+ import { uyTv as t } from "@payfit/unity-themes";
5
5
  import { Icon as g } from "../../icon/Icon.js";
6
6
  import { MultiSelectContext as w } from "../Multiselect.context.js";
7
- const S = i({
7
+ const S = t({
8
8
  slots: {
9
9
  base: "uy:shadow-floating uy:absolute uy:top-full uy:left-0 uy:z-50 uy:w-full uy:rounded-75 uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral uy:overflow-auto uy:max-h-[min(var(--popover-available-height,300px),300px)] uy:outline-none",
10
10
  list: "uy:p-100"
11
11
  }
12
- }), N = i({
12
+ }), N = t({
13
13
  slots: {
14
14
  wrapper: "uy:sticky uy:top-0 uy:bg-surface-neutral uy:pt-100 uy:px-100",
15
15
  base: "uy:flex uy:w-full uy:gap-100 uy:h-500 uy:border uy:border-solid uy:rounded-75 uy:py-100 uy:border-border-form-enabled uy:bg-surface-form-enabled uy:px-150 uy:typography-body 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",
@@ -18,22 +18,22 @@ const S = i({
18
18
  }
19
19
  });
20
20
  function C({
21
- children: t,
22
- ...s
21
+ children: r,
22
+ ...l
23
23
  }) {
24
- const l = f(w), { base: n, list: u } = S(), { base: a, input: y, wrapper: c, divider: d } = N(), { onBlur: o, ...p } = s;
24
+ const i = f(w), { base: s, list: u } = S(), { base: n, input: a, wrapper: y, divider: c } = N(), { onBlur: d, ...p } = l;
25
25
  return /* @__PURE__ */ e(
26
26
  h,
27
27
  {
28
28
  portal: !0,
29
29
  sameWidth: !0,
30
30
  unmountOnHide: !0,
31
- className: n(),
32
- onClose: () => o == null ? void 0 : o(),
31
+ className: s(),
32
+ onClose: () => d?.(),
33
33
  ...p,
34
- children: l.isSearchable ? /* @__PURE__ */ r(m, { children: [
35
- /* @__PURE__ */ r("div", { className: c(), children: [
36
- /* @__PURE__ */ r("div", { className: a(), children: [
34
+ children: i.isSearchable ? /* @__PURE__ */ o(m, { children: [
35
+ /* @__PURE__ */ o("div", { className: y(), children: [
36
+ /* @__PURE__ */ o("div", { className: n(), children: [
37
37
  /* @__PURE__ */ e(
38
38
  g,
39
39
  {
@@ -47,14 +47,14 @@ function C({
47
47
  {
48
48
  autoSelect: !0,
49
49
  placeholder: "Search...",
50
- className: y()
50
+ className: a()
51
51
  }
52
52
  )
53
53
  ] }),
54
- /* @__PURE__ */ e("hr", { className: d() })
54
+ /* @__PURE__ */ e("hr", { className: c() })
55
55
  ] }),
56
- /* @__PURE__ */ e(x, { className: u(), children: t })
57
- ] }) : /* @__PURE__ */ e("div", { className: u(), children: t })
56
+ /* @__PURE__ */ e(x, { className: u(), children: r })
57
+ ] }) : /* @__PURE__ */ e("div", { className: u(), children: r })
58
58
  }
59
59
  );
60
60
  }
@@ -1,6 +1,6 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
1
2
  import { ForwardedRef, 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 { MultiSelectProps } from '../multi-select/Multiselect.types.js';
@@ -51,7 +51,7 @@ export type MultiSelectFieldProps<TFieldValues extends FieldValues = FieldValues
51
51
  * [API & Docs](https://unity-components.payfit.io/?path=/docs/forms-multiselectfield--docs) • [Design Guidelines](https://www.payfit.design/24f360409/p/928776-multiselect)
52
52
  */
53
53
  export declare const MultiSelectField: {
54
- <TSchema extends Schema, TItem = unknown>(props: MultiSelectFieldProps<ZodInfer<TSchema>, FieldPath<ZodInfer<TSchema>>, TItem, keyof TItem, TItem[keyof TItem] & Key> & {
54
+ <TSchema extends Schema, TItem = unknown>(props: MultiSelectFieldProps<StandardSchemaV1.InferOutput<TSchema>, FieldPath<StandardSchemaV1.InferOutput<TSchema>>, TItem, keyof TItem, TItem[keyof TItem] & Key> & {
55
55
  ref?: ForwardedRef<HTMLButtonElement>;
56
56
  }): React.JSX.Element;
57
57
  displayName?: string;