@povio/ui 2.3.0-rc.17 → 2.3.0-rc.18

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.
@@ -4,12 +4,12 @@ import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
4
4
  import { SelectBaseProps } from './SelectBase';
5
5
  import { SelectItem } from './select.types';
6
6
  import { InputVariantProps } from '../../shared/input.cva';
7
- interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName" | "selectedTagsType" | "collapseAfter" | "isRequired" | "isDirty" | "fireBlurOnChange" | "leadingContent" | "trailingContent" | "onMouseEnter" | "onFocusCapture"> {
7
+ interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName" | "selectedTagsType" | "collapseAfter" | "isRequired" | "isDirty" | "leadingContent" | "trailingContent" | "onMouseEnter" | "onFocusCapture"> {
8
8
  isInvalid?: boolean;
9
9
  className?: string;
10
10
  fieldProps?: AriaFieldProps;
11
11
  headerProps?: FormFieldHeaderProps;
12
12
  onCloseComboBox?: (state: ComboBoxState<SelectItem> | null) => void;
13
13
  }
14
- export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
15
15
  export {};
@@ -17,8 +17,8 @@ import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
17
17
  import { useTranslation } from "react-i18next";
18
18
  //#region src/components/inputs/Selection/shared/SelectInput.tsx
19
19
  var SelectInput = (t0) => {
20
- const $0 = c(111);
21
- const { ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props } = t0;
20
+ const $0 = c(107);
21
+ const { ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props } = t0;
22
22
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
23
23
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
24
24
  const inputClearClassCva = UIStyle.useCva("input.clearClassCva", inputClearClass);
@@ -78,34 +78,28 @@ var SelectInput = (t0) => {
78
78
  }
79
79
  const labelProps = t3;
80
80
  let t4;
81
- if ($0[10] !== fieldState.inputValue || $0[11] !== fieldState.value || $0[12] !== fireBlurOnChange || $0[13] !== isLoading || $0[14] !== isMultiple || $0[15] !== listItems || $0[16] !== onBlur || $0[17] !== onChange || $0[18] !== onCloseComboBox || $0[19] !== state) {
81
+ if ($0[10] !== fieldState.inputValue || $0[11] !== fieldState.value || $0[12] !== isLoading || $0[13] !== isMultiple || $0[14] !== listItems || $0[15] !== onChange || $0[16] !== onCloseComboBox || $0[17] !== state) {
82
82
  t4 = (e) => {
83
83
  if (e.key === "Enter" && !isMultiple && !isLoading && listItems.length === 1 && !listItems[0].isDisabled) {
84
84
  e.preventDefault();
85
85
  onChange(listItems[0].id);
86
- if (fireBlurOnChange) onBlur?.({});
87
86
  onCloseComboBox?.(state);
88
87
  }
89
- if (e.key === "Backspace" && isMultiple && fieldState.inputValue === "" && Array.isArray(fieldState.value) && fieldState.value.length > 0) {
90
- onChange(fieldState.value.slice(0, -1));
91
- if (fireBlurOnChange) onBlur?.({});
92
- }
88
+ if (e.key === "Backspace" && isMultiple && fieldState.inputValue === "" && Array.isArray(fieldState.value) && fieldState.value.length > 0) onChange(fieldState.value.slice(0, -1));
93
89
  };
94
90
  $0[10] = fieldState.inputValue;
95
91
  $0[11] = fieldState.value;
96
- $0[12] = fireBlurOnChange;
97
- $0[13] = isLoading;
98
- $0[14] = isMultiple;
99
- $0[15] = listItems;
100
- $0[16] = onBlur;
101
- $0[17] = onChange;
102
- $0[18] = onCloseComboBox;
103
- $0[19] = state;
104
- $0[20] = t4;
105
- } else t4 = $0[20];
92
+ $0[12] = isLoading;
93
+ $0[13] = isMultiple;
94
+ $0[14] = listItems;
95
+ $0[15] = onChange;
96
+ $0[16] = onCloseComboBox;
97
+ $0[17] = state;
98
+ $0[18] = t4;
99
+ } else t4 = $0[18];
106
100
  const onKeyDown = t4;
107
101
  let t5;
108
- if ($0[21] !== isDisabled || $0[22] !== isOpen || $0[23] !== isSearchable || $0[24] !== setIsOpen) {
102
+ if ($0[19] !== isDisabled || $0[20] !== isOpen || $0[21] !== isSearchable || $0[22] !== setIsOpen) {
109
103
  t5 = () => {
110
104
  if (isDisabled) return;
111
105
  if (!isSearchable) {
@@ -114,12 +108,12 @@ var SelectInput = (t0) => {
114
108
  }
115
109
  inputRef.current?.focus();
116
110
  };
117
- $0[21] = isDisabled;
118
- $0[22] = isOpen;
119
- $0[23] = isSearchable;
120
- $0[24] = setIsOpen;
121
- $0[25] = t5;
122
- } else t5 = $0[25];
111
+ $0[19] = isDisabled;
112
+ $0[20] = isOpen;
113
+ $0[21] = isSearchable;
114
+ $0[22] = setIsOpen;
115
+ $0[23] = t5;
116
+ } else t5 = $0[23];
123
117
  const onClick = t5;
124
118
  const t6 = inputBaseCva({
125
119
  variant,
@@ -149,28 +143,28 @@ var SelectInput = (t0) => {
149
143
  ...props
150
144
  }));
151
145
  let t24;
152
- if ($0[26] !== as || $0[27] !== headerProps || $0[28] !== labelProps) {
146
+ if ($0[24] !== as || $0[25] !== headerProps || $0[26] !== labelProps) {
153
147
  t24 = as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
154
148
  as,
155
149
  ...headerProps,
156
150
  labelProps
157
151
  });
158
- $0[26] = as;
159
- $0[27] = headerProps;
160
- $0[28] = labelProps;
161
- $0[29] = t24;
162
- } else t24 = $0[29];
152
+ $0[24] = as;
153
+ $0[25] = headerProps;
154
+ $0[26] = labelProps;
155
+ $0[27] = t24;
156
+ } else t24 = $0[27];
163
157
  let t25;
164
- if ($0[30] !== leadingContent) {
158
+ if ($0[28] !== leadingContent) {
165
159
  t25 = leadingContent && /* @__PURE__ */ jsx("div", {
166
160
  className: "ml-input-side-default flex shrink-0 items-center",
167
161
  children: leadingContent
168
162
  });
169
- $0[30] = leadingContent;
170
- $0[31] = t25;
171
- } else t25 = $0[31];
163
+ $0[28] = leadingContent;
164
+ $0[29] = t25;
165
+ } else t25 = $0[29];
172
166
  let t26;
173
- if ($0[32] !== as || $0[33] !== collapseAfter || $0[34] !== fieldProps || $0[35] !== inputClassName || $0[36] !== isDisabled || $0[37] !== isSearchable || $0[38] !== onBlur || $0[39] !== onKeyDown || $0[40] !== onRemove || $0[41] !== placeholder || $0[42] !== selectedItems || $0[43] !== selectedTagsType || $0[44] !== showTags) {
167
+ if ($0[30] !== as || $0[31] !== collapseAfter || $0[32] !== fieldProps || $0[33] !== inputClassName || $0[34] !== isDisabled || $0[35] !== isSearchable || $0[36] !== onBlur || $0[37] !== onKeyDown || $0[38] !== onRemove || $0[39] !== placeholder || $0[40] !== selectedItems || $0[41] !== selectedTagsType || $0[42] !== showTags) {
174
168
  t26 = (showTags || isSearchable) && /* @__PURE__ */ jsxs("div", {
175
169
  className: selectInputTagsContentWrapperCva({ isSearchable }),
176
170
  children: [showTags && /* @__PURE__ */ jsx(SelectInputTags, {
@@ -188,23 +182,23 @@ var SelectInput = (t0) => {
188
182
  ...fieldProps
189
183
  })]
190
184
  });
191
- $0[32] = as;
192
- $0[33] = collapseAfter;
193
- $0[34] = fieldProps;
194
- $0[35] = inputClassName;
195
- $0[36] = isDisabled;
196
- $0[37] = isSearchable;
197
- $0[38] = onBlur;
198
- $0[39] = onKeyDown;
199
- $0[40] = onRemove;
200
- $0[41] = placeholder;
201
- $0[42] = selectedItems;
202
- $0[43] = selectedTagsType;
203
- $0[44] = showTags;
204
- $0[45] = t26;
205
- } else t26 = $0[45];
185
+ $0[30] = as;
186
+ $0[31] = collapseAfter;
187
+ $0[32] = fieldProps;
188
+ $0[33] = inputClassName;
189
+ $0[34] = isDisabled;
190
+ $0[35] = isSearchable;
191
+ $0[36] = onBlur;
192
+ $0[37] = onKeyDown;
193
+ $0[38] = onRemove;
194
+ $0[39] = placeholder;
195
+ $0[40] = selectedItems;
196
+ $0[41] = selectedTagsType;
197
+ $0[42] = showTags;
198
+ $0[43] = t26;
199
+ } else t26 = $0[43];
206
200
  let t27;
207
- if ($0[46] !== as || $0[47] !== fieldProps || $0[48] !== isDisabled || $0[49] !== isEmpty || $0[50] !== isMultiple || $0[51] !== isOpen || $0[52] !== isSearchable || $0[53] !== onBlur || $0[54] !== placeholder || $0[55] !== selectedItems[0] || $0[56] !== setIsOpen || $0[57] !== showSelectionContent || $0[58] !== showTags) {
201
+ if ($0[44] !== as || $0[45] !== fieldProps || $0[46] !== isDisabled || $0[47] !== isEmpty || $0[48] !== isMultiple || $0[49] !== isOpen || $0[50] !== isSearchable || $0[51] !== onBlur || $0[52] !== placeholder || $0[53] !== selectedItems[0] || $0[54] !== setIsOpen || $0[55] !== showSelectionContent || $0[56] !== showTags) {
208
202
  t27 = !isSearchable && /* @__PURE__ */ jsxs(Button, {
209
203
  isDisabled,
210
204
  onPress: () => setIsOpen(!isOpen),
@@ -218,23 +212,23 @@ var SelectInput = (t0) => {
218
212
  children: [isEmpty && placeholder, !isEmpty && (showSelectionContent ? selectedItems[0].content : selectedItems[0].label)]
219
213
  })]
220
214
  });
221
- $0[46] = as;
222
- $0[47] = fieldProps;
223
- $0[48] = isDisabled;
224
- $0[49] = isEmpty;
225
- $0[50] = isMultiple;
226
- $0[51] = isOpen;
227
- $0[52] = isSearchable;
228
- $0[53] = onBlur;
229
- $0[54] = placeholder;
230
- $0[55] = selectedItems[0];
231
- $0[56] = setIsOpen;
232
- $0[57] = showSelectionContent;
233
- $0[58] = showTags;
234
- $0[59] = t27;
235
- } else t27 = $0[59];
215
+ $0[44] = as;
216
+ $0[45] = fieldProps;
217
+ $0[46] = isDisabled;
218
+ $0[47] = isEmpty;
219
+ $0[48] = isMultiple;
220
+ $0[49] = isOpen;
221
+ $0[50] = isSearchable;
222
+ $0[51] = onBlur;
223
+ $0[52] = placeholder;
224
+ $0[53] = selectedItems[0];
225
+ $0[54] = setIsOpen;
226
+ $0[55] = showSelectionContent;
227
+ $0[56] = showTags;
228
+ $0[57] = t27;
229
+ } else t27 = $0[57];
236
230
  let t28;
237
- if ($0[60] !== onClick || $0[61] !== t23 || $0[62] !== t24 || $0[63] !== t25 || $0[64] !== t26 || $0[65] !== t27) {
231
+ if ($0[58] !== onClick || $0[59] !== t23 || $0[60] !== t24 || $0[61] !== t25 || $0[62] !== t26 || $0[63] !== t27) {
238
232
  t28 = /* @__PURE__ */ jsxs("div", {
239
233
  className: t23,
240
234
  onClick,
@@ -245,44 +239,41 @@ var SelectInput = (t0) => {
245
239
  t27
246
240
  ]
247
241
  });
248
- $0[60] = onClick;
249
- $0[61] = t23;
250
- $0[62] = t24;
251
- $0[63] = t25;
252
- $0[64] = t26;
253
- $0[65] = t27;
254
- $0[66] = t28;
255
- } else t28 = $0[66];
242
+ $0[58] = onClick;
243
+ $0[59] = t23;
244
+ $0[60] = t24;
245
+ $0[61] = t25;
246
+ $0[62] = t26;
247
+ $0[63] = t27;
248
+ $0[64] = t28;
249
+ } else t28 = $0[64];
256
250
  let t29;
257
- if ($0[67] !== as || $0[68] !== fireBlurOnChange || $0[69] !== inputClearClassCva || $0[70] !== isClearable || $0[71] !== onBlur || $0[72] !== onClear || $0[73] !== showClearButton) {
251
+ if ($0[65] !== as || $0[66] !== inputClearClassCva || $0[67] !== isClearable || $0[68] !== onClear || $0[69] !== showClearButton) {
258
252
  t29 = isClearable && /* @__PURE__ */ jsx(InputClear, {
259
253
  onClear: () => {
260
254
  onClear();
261
- if (fireBlurOnChange) onBlur?.({});
262
255
  },
263
256
  className: inputClearClassCva({ as }),
264
257
  show: showClearButton
265
258
  });
266
- $0[67] = as;
267
- $0[68] = fireBlurOnChange;
268
- $0[69] = inputClearClassCva;
269
- $0[70] = isClearable;
270
- $0[71] = onBlur;
271
- $0[72] = onClear;
272
- $0[73] = showClearButton;
273
- $0[74] = t29;
274
- } else t29 = $0[74];
259
+ $0[65] = as;
260
+ $0[66] = inputClearClassCva;
261
+ $0[67] = isClearable;
262
+ $0[68] = onClear;
263
+ $0[69] = showClearButton;
264
+ $0[70] = t29;
265
+ } else t29 = $0[70];
275
266
  let t30;
276
- if ($0[75] !== trailingContent) {
267
+ if ($0[71] !== trailingContent) {
277
268
  t30 = trailingContent && /* @__PURE__ */ jsx("div", {
278
269
  className: "flex shrink-0 items-center",
279
270
  children: trailingContent
280
271
  });
281
- $0[75] = trailingContent;
282
- $0[76] = t30;
283
- } else t30 = $0[76];
272
+ $0[71] = trailingContent;
273
+ $0[72] = t30;
274
+ } else t30 = $0[72];
284
275
  let t31;
285
- if ($0[77] !== hideDropdownIcon || $0[78] !== inputSizeCva || $0[79] !== isDisabled || $0[80] !== isOpen || $0[81] !== isSearchable || $0[82] !== setIsOpen || $0[83] !== size || $0[84] !== t) {
276
+ if ($0[73] !== hideDropdownIcon || $0[74] !== inputSizeCva || $0[75] !== isDisabled || $0[76] !== isOpen || $0[77] !== isSearchable || $0[78] !== setIsOpen || $0[79] !== size || $0[80] !== t) {
286
277
  t31 = !hideDropdownIcon && /* @__PURE__ */ jsx(Button, {
287
278
  excludeFromTabOrder: true,
288
279
  "aria-label": t(($) => isOpen ? $.ui.closeAlt : $.ui.openAlt),
@@ -296,18 +287,18 @@ var SelectInput = (t0) => {
296
287
  "aria-hidden": "true"
297
288
  })
298
289
  });
299
- $0[77] = hideDropdownIcon;
300
- $0[78] = inputSizeCva;
301
- $0[79] = isDisabled;
302
- $0[80] = isOpen;
303
- $0[81] = isSearchable;
304
- $0[82] = setIsOpen;
305
- $0[83] = size;
306
- $0[84] = t;
307
- $0[85] = t31;
308
- } else t31 = $0[85];
290
+ $0[73] = hideDropdownIcon;
291
+ $0[74] = inputSizeCva;
292
+ $0[75] = isDisabled;
293
+ $0[76] = isOpen;
294
+ $0[77] = isSearchable;
295
+ $0[78] = setIsOpen;
296
+ $0[79] = size;
297
+ $0[80] = t;
298
+ $0[81] = t31;
299
+ } else t31 = $0[81];
309
300
  let t32;
310
- if ($0[86] !== focusWithinProps || $0[87] !== hoverProps || $0[88] !== onFocusCapture || $0[89] !== onMouseEnter || $0[90] !== ref || $0[91] !== t10 || $0[92] !== t11 || $0[93] !== t12 || $0[94] !== t13 || $0[95] !== t14 || $0[96] !== t15 || $0[97] !== t16 || $0[98] !== t17 || $0[99] !== t18 || $0[100] !== t19 || $0[101] !== t20 || $0[102] !== t21 || $0[103] !== t28 || $0[104] !== t29 || $0[105] !== t30 || $0[106] !== t31 || $0[107] !== t6 || $0[108] !== t8 || $0[109] !== t9) {
301
+ if ($0[82] !== focusWithinProps || $0[83] !== hoverProps || $0[84] !== onFocusCapture || $0[85] !== onMouseEnter || $0[86] !== ref || $0[87] !== t10 || $0[88] !== t11 || $0[89] !== t12 || $0[90] !== t13 || $0[91] !== t14 || $0[92] !== t15 || $0[93] !== t16 || $0[94] !== t17 || $0[95] !== t18 || $0[96] !== t19 || $0[97] !== t20 || $0[98] !== t21 || $0[99] !== t28 || $0[100] !== t29 || $0[101] !== t30 || $0[102] !== t31 || $0[103] !== t6 || $0[104] !== t8 || $0[105] !== t9) {
311
302
  t32 = /* @__PURE__ */ jsxs("div", {
312
303
  ref,
313
304
  className: t6,
@@ -338,32 +329,32 @@ var SelectInput = (t0) => {
338
329
  t31
339
330
  ]
340
331
  });
341
- $0[86] = focusWithinProps;
342
- $0[87] = hoverProps;
343
- $0[88] = onFocusCapture;
344
- $0[89] = onMouseEnter;
345
- $0[90] = ref;
346
- $0[91] = t10;
347
- $0[92] = t11;
348
- $0[93] = t12;
349
- $0[94] = t13;
350
- $0[95] = t14;
351
- $0[96] = t15;
352
- $0[97] = t16;
353
- $0[98] = t17;
354
- $0[99] = t18;
355
- $0[100] = t19;
356
- $0[101] = t20;
357
- $0[102] = t21;
358
- $0[103] = t28;
359
- $0[104] = t29;
360
- $0[105] = t30;
361
- $0[106] = t31;
362
- $0[107] = t6;
363
- $0[108] = t8;
364
- $0[109] = t9;
365
- $0[110] = t32;
366
- } else t32 = $0[110];
332
+ $0[82] = focusWithinProps;
333
+ $0[83] = hoverProps;
334
+ $0[84] = onFocusCapture;
335
+ $0[85] = onMouseEnter;
336
+ $0[86] = ref;
337
+ $0[87] = t10;
338
+ $0[88] = t11;
339
+ $0[89] = t12;
340
+ $0[90] = t13;
341
+ $0[91] = t14;
342
+ $0[92] = t15;
343
+ $0[93] = t16;
344
+ $0[94] = t17;
345
+ $0[95] = t18;
346
+ $0[96] = t19;
347
+ $0[97] = t20;
348
+ $0[98] = t21;
349
+ $0[99] = t28;
350
+ $0[100] = t29;
351
+ $0[101] = t30;
352
+ $0[102] = t31;
353
+ $0[103] = t6;
354
+ $0[104] = t8;
355
+ $0[105] = t9;
356
+ $0[106] = t32;
357
+ } else t32 = $0[106];
367
358
  return t32;
368
359
  };
369
360
  //#endregion
@@ -24,8 +24,8 @@ export declare namespace SelectContext {
24
24
  selectedIds: Key[];
25
25
  isMultiple: boolean;
26
26
  } & Pick<SelectBaseProps, "onInputChange" | "isLoading" | "hasLoadMore">;
27
- export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled" | "ignoreInputValueFiltering">;
28
- export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, children, mapInitialToSelectItem, ...props }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
27
+ export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled" | "ignoreInputValueFiltering" | "fireBlurOnChange" | "onBlur">;
28
+ export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, fireBlurOnChange, onBlur: fieldOnBlur, children, mapInitialToSelectItem, ...props }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
29
29
  export const useSelect: () => Type;
30
30
  export {};
31
31
  }
@@ -10,7 +10,7 @@ var SelectContext;
10
10
  id: item.id,
11
11
  label: item.label ?? item.name ?? ""
12
12
  });
13
- _SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
13
+ _SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, fireBlurOnChange, onBlur: fieldOnBlur, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
14
14
  const isMultiple = props.selectionMode === "multiple";
15
15
  const initialSelectedItems = useMemo(() => {
16
16
  if (!props.initialSelection) return null;
@@ -58,13 +58,15 @@ var SelectContext;
58
58
  }, [getItem_0]);
59
59
  const getValueIds = () => Array.isArray(valueRef.current) ? valueRef.current.map(({ id: id_3 }) => id_3) : valueRef.current?.id ?? null;
60
60
  const emitStateChanges = useCallback((changes, skipSelectionChange) => {
61
- if (JSON.stringify(changes.value) !== JSON.stringify(getValueIds())) {
61
+ const valueChanged = JSON.stringify(changes.value) !== JSON.stringify(getValueIds());
62
+ if (valueChanged) {
62
63
  updateValue(changes.value);
63
64
  if (!skipSelectionChange) if (isMultiple) props.onChange?.(changes.value);
64
65
  else props.onChange?.(changes.value);
65
66
  }
66
67
  if (changes.inputValue !== fieldState.inputValue) onInputChange?.(changes.inputValue);
67
68
  if (changes.searchValue !== fieldState.searchValue) onSearchChangeDebounced?.(changes.searchValue);
69
+ return valueChanged;
68
70
  }, [
69
71
  fieldState,
70
72
  isMultiple,
@@ -73,6 +75,9 @@ var SelectContext;
73
75
  onSearchChangeDebounced,
74
76
  updateValue
75
77
  ]);
78
+ const triggerBlurOnChange = useCallback(() => {
79
+ if (fireBlurOnChange) fieldOnBlur?.({});
80
+ }, [fireBlurOnChange, fieldOnBlur]);
76
81
  const syncFieldState = (value_1) => {
77
82
  const newFieldState = {
78
83
  value: value_1,
@@ -115,7 +120,7 @@ var SelectContext;
115
120
  searchValue: ""
116
121
  };
117
122
  setFieldState(newFieldState_1);
118
- emitStateChanges(newFieldState_1);
123
+ if (emitStateChanges(newFieldState_1)) triggerBlurOnChange();
119
124
  }
120
125
  if (!isMultiple) {
121
126
  setIsOpen(false);
@@ -126,7 +131,8 @@ var SelectContext;
126
131
  onNewItemOption,
127
132
  fieldState.inputValue,
128
133
  getItem_0,
129
- isMultiple
134
+ isMultiple,
135
+ triggerBlurOnChange
130
136
  ]);
131
137
  const onClear = useCallback(() => {
132
138
  if (!valueRef.current || Array.isArray(valueRef.current) && valueRef.current.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.3.0-rc.17",
3
+ "version": "2.3.0-rc.18",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",