@connectif/ui-components 5.1.1 → 5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.0
4
+
5
+ ### Fixed
6
+
7
+ - Fixed `Autocomplete` component error when `allowFreeText` option was enabled and clicking outside the dropdown after typing.
8
+
9
+ ### Added
10
+
11
+ - New `startIconId` prop in `Autocomplete` component
12
+
3
13
  ## [5.1.1] - 2026-01-26
4
14
 
5
15
  ### Fixed
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { AutocompleteOption, AutocompleteValue, TextFieldFilteredProps } from '../../../models/Autocomplete';
3
+ import { IconId } from '../../icon';
3
4
  export type AutocompleteProps<T extends string, Multiple extends boolean | undefined, Value = AutocompleteValue<T, Multiple>, Option = AutocompleteOption<T>> = {
4
5
  /**
5
6
  * The variant of the Autocomplete
@@ -100,6 +101,10 @@ export type AutocompleteProps<T extends string, Multiple extends boolean | undef
100
101
  * Disables clear button at the end of the component when field is dirty.
101
102
  */
102
103
  disableClear?: boolean;
104
+ /**
105
+ * start icon in autocomplete
106
+ */
107
+ startIconId?: IconId;
103
108
  /**
104
109
  * Ref to the inner HTMLInputElement
105
110
  */
@@ -108,5 +113,5 @@ export type AutocompleteProps<T extends string, Multiple extends boolean | undef
108
113
  /**
109
114
  * Powered TextField with the ability to select from a predefined list of options, allowing to select one or multiple values.
110
115
  */
111
- declare const Autocomplete: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ variant, value, multiple, textFieldProps, options, disabled, mode, isCaseSensitive, isDiacriticSensitive, onChange, renderLabel, isLoading, onSearch, loadingText, noOptionsText, allowFreeText, addNewValueText, closeOnSelect, maxValueLength, maxValues, maxValuesText, onClose, onOpen, disableClear }: AutocompleteProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
116
+ declare const Autocomplete: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ variant, value, multiple, textFieldProps, options, disabled, mode, isCaseSensitive, isDiacriticSensitive, onChange, renderLabel, isLoading, onSearch, loadingText, noOptionsText, allowFreeText, addNewValueText, closeOnSelect, maxValueLength, maxValues, maxValuesText, startIconId, onClose, onOpen, disableClear }: AutocompleteProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
112
117
  export default Autocomplete;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { AutocompleteValue, TextFieldFilteredProps } from '../../../models/Autocomplete';
3
+ import { IconId } from '../../icon';
3
4
  export type AutocompleteInputProps<T extends string, Multiple extends boolean | undefined, Value = AutocompleteValue<T, Multiple>> = {
4
5
  /**
5
6
  * The variant of the Autocomplete
@@ -48,11 +49,15 @@ export type AutocompleteInputProps<T extends string, Multiple extends boolean |
48
49
  */
49
50
  disableClear?: boolean;
50
51
  isOpenPopover: boolean;
52
+ /**
53
+ * start icon in input
54
+ */
55
+ startIconId?: IconId;
51
56
  /**
52
57
  * Ref to the outer HTMLDivElement
53
58
  */
54
- containerRef: React.RefObject<HTMLDivElement | null>;
55
- inputRef: React.RefObject<HTMLInputElement | null>;
59
+ containerRef?: React.RefObject<HTMLDivElement | null>;
60
+ inputRef?: React.RefObject<HTMLInputElement | null>;
56
61
  inputValue: string;
57
62
  setInputValue: (value: string) => void;
58
63
  placeholder: string;
@@ -65,5 +70,5 @@ export type AutocompleteInputProps<T extends string, Multiple extends boolean |
65
70
  /**
66
71
  * Powered TextField Input.
67
72
  */
68
- declare const AutocompleteInput: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ variant, value, multiple, textFieldProps, hasFilteredOptions, disabled, renderLabel, maxValueLength, canAddValues, maxValuesText, disableClear, containerRef, inputRef, onClosePopover, onOpenPopover, isOpenPopover, inputValue, setInputValue, placeholder, onSearchValueChange, onPressEnter, onRemoveValue }: AutocompleteInputProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
73
+ declare const AutocompleteInput: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ variant, value, multiple, textFieldProps, hasFilteredOptions, disabled, renderLabel, maxValueLength, canAddValues, maxValuesText, disableClear, containerRef, inputRef, onClosePopover, onOpenPopover, isOpenPopover, inputValue, setInputValue, placeholder, startIconId, onSearchValueChange, onPressEnter, onRemoveValue }: AutocompleteInputProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
69
74
  export default AutocompleteInput;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { AutocompleteValue } from '../../../models/Autocomplete';
3
+ import { IconId } from '../../icon';
3
4
  export type AutocompleteInputSelectionProps<T extends string, Multiple extends boolean | undefined, Value = AutocompleteValue<T, Multiple>> = {
4
5
  /**
5
6
  * The value handled by this Autocomplete component. If multiple=true, it should be an array of ids.
@@ -14,6 +15,10 @@ export type AutocompleteInputSelectionProps<T extends string, Multiple extends b
14
15
  * Whether the autocomplete is disabled or not.
15
16
  */
16
17
  disabled?: boolean;
18
+ /**
19
+ * start icon in input
20
+ */
21
+ startIconId?: IconId;
17
22
  /**
18
23
  * Use this function to render the desired text for each id. Leave it empty if the id is also the label.
19
24
  */
@@ -21,5 +26,5 @@ export type AutocompleteInputSelectionProps<T extends string, Multiple extends b
21
26
  onOpenPopover: () => void;
22
27
  onRemoveValue: (event: React.SyntheticEvent, value: Value) => void;
23
28
  };
24
- declare const AutocompleteInputSelection: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ value, canAddValues, disabled, renderLabel, onOpenPopover, onRemoveValue }: AutocompleteInputSelectionProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
29
+ declare const AutocompleteInputSelection: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ value, canAddValues, disabled, startIconId, renderLabel, onOpenPopover, onRemoveValue }: AutocompleteInputSelectionProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
25
30
  export default AutocompleteInputSelection;
package/dist/index.js CHANGED
@@ -22838,6 +22838,7 @@ var AutocompleteInputSelection = function AutocompleteInputSelection2({
22838
22838
  value,
22839
22839
  canAddValues,
22840
22840
  disabled = false,
22841
+ startIconId,
22841
22842
  renderLabel,
22842
22843
  onOpenPopover,
22843
22844
  onRemoveValue
@@ -22856,10 +22857,10 @@ var AutocompleteInputSelection = function AutocompleteInputSelection2({
22856
22857
  maxWidth: `calc(100% - ${AUTOCOMPLETE_PADDING_RIGHT}px)`
22857
22858
  },
22858
22859
  children: [
22859
- /* @__PURE__ */ jsx122(
22860
+ !!startIconId && /* @__PURE__ */ jsx122(
22860
22861
  IconButton_default,
22861
22862
  {
22862
- iconId: "plus",
22863
+ iconId: startIconId,
22863
22864
  size: "S",
22864
22865
  disabled: disabled || !canAddValues,
22865
22866
  sx: {
@@ -22924,6 +22925,7 @@ var AutocompleteInput = function AutocompleteInput2({
22924
22925
  inputValue,
22925
22926
  setInputValue,
22926
22927
  placeholder,
22928
+ startIconId,
22927
22929
  onSearchValueChange,
22928
22930
  onPressEnter,
22929
22931
  onRemoveValue
@@ -23015,6 +23017,7 @@ var AutocompleteInput = function AutocompleteInput2({
23015
23017
  AutocompleteInputSelection_default,
23016
23018
  {
23017
23019
  value,
23020
+ startIconId,
23018
23021
  canAddValues,
23019
23022
  renderLabel,
23020
23023
  onOpenPopover,
@@ -23286,6 +23289,7 @@ var Autocomplete = function Autocomplete2({
23286
23289
  maxValueLength,
23287
23290
  maxValues,
23288
23291
  maxValuesText,
23292
+ startIconId,
23289
23293
  onClose = () => ({}),
23290
23294
  onOpen = () => ({}),
23291
23295
  disableClear
@@ -23565,11 +23569,7 @@ var Autocomplete = function Autocomplete2({
23565
23569
  anchorRef.current,
23566
23570
  event.target
23567
23571
  )) {
23568
- if (allowFreeText && inputValue) {
23569
- onSelectValueSingle(inputValue, event);
23570
- } else {
23571
- closePopover();
23572
- }
23572
+ closePopover();
23573
23573
  if (inputValue) {
23574
23574
  onSearch && onSearch("");
23575
23575
  } else {
@@ -23598,6 +23598,7 @@ var Autocomplete = function Autocomplete2({
23598
23598
  },
23599
23599
  disableClear,
23600
23600
  disabled,
23601
+ startIconId,
23601
23602
  hasFilteredOptions: options.length > 0,
23602
23603
  value,
23603
23604
  maxValueLength,