@connectif/ui-components 3.0.5 → 4.0.1

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,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.0.1] - 2026-01-13
4
+
5
+ ### Fixed
6
+
7
+ - Fixed bug in `Autocomplete` component, where the placeholder was hidden when multiple prop was enabled and no value was selected.
8
+
9
+ ## [4.0.0] - 2026-01-13
10
+
11
+ ### Added
12
+
13
+ - `ChipViewer` component has been added.
14
+
15
+ ### Fixed
16
+
17
+ - Fixed bug with select selection in `Select` component.
18
+
19
+ ### Changed
20
+
21
+ - `TextField` changes its background color for readonly state.
22
+
23
+ ### Deprecated
24
+
25
+ - `Autocomplete` component removes limitValueTags prop.
26
+
3
27
  ## [3.0.5] - 2025-12-29
4
28
 
5
29
  ### Added
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { ThemeTypography } from '../../theme';
3
+ export declare const DEFAULT_DATA_TEST_ID = "chip-container";
4
+ export declare const TOOLTIP_DATA_TEST_ID = "chip-container-tooltip";
5
+ export declare const COUNTER_LABEL_DATA_TEST_ID = "chip-counter-label";
6
+ export declare const PLACEHOLDER_DATA_TEST_ID = "chip-container-placeholder";
7
+ type ChipContainerProps = {
8
+ containerRef: React.MutableRefObject<HTMLDivElement | null>;
9
+ visibleChips: string[];
10
+ hiddenChips: string[];
11
+ gap: string;
12
+ height: string;
13
+ typographyVariant?: ThemeTypography.TypographyVariant;
14
+ reserveHeight?: true;
15
+ placeholder?: string;
16
+ clickable?: boolean;
17
+ preventHiddenChipsTooltip?: true;
18
+ isDeletable?: boolean;
19
+ dataTestId?: string;
20
+ renderChip: (data: {
21
+ chipName: string;
22
+ index?: number;
23
+ maxWidth?: string;
24
+ isCounterLabel?: boolean;
25
+ }) => React.ReactNode;
26
+ };
27
+ declare const ChipContainer: ({ containerRef, gap, visibleChips, hiddenChips, placeholder, isDeletable, height, typographyVariant, reserveHeight, clickable, preventHiddenChipsTooltip, dataTestId, renderChip }: ChipContainerProps) => import("react/jsx-runtime").JSX.Element;
28
+ export default ChipContainer;
@@ -0,0 +1,44 @@
1
+ import * as React from 'react';
2
+ import { ThemeTypography } from '../../theme';
3
+ import { ChipProps } from './Chip';
4
+ import { SxProps } from '@mui/material';
5
+ export declare const CHIP_DATA_TEST_ID = "chip-viewer-chip";
6
+ declare const chipViewerStyle: {
7
+ circle: {
8
+ borderRadius: string;
9
+ backgroundColor: string;
10
+ color: string;
11
+ };
12
+ square: {
13
+ borderRadius: string;
14
+ backgroundColor: string;
15
+ color: string;
16
+ };
17
+ };
18
+ export type ChipViewerProps = {
19
+ values: string[];
20
+ chipSx?: SxProps;
21
+ chipSize?: ChipProps['size'];
22
+ chipVariant?: ChipProps['variant'];
23
+ placeholder?: string;
24
+ numberLines?: number;
25
+ reserveHeight?: true;
26
+ variant?: keyof typeof chipViewerStyle;
27
+ typographyVariant?: ThemeTypography.TypographyVariant;
28
+ preventHiddenChipsTooltip?: true;
29
+ /**
30
+ * Property to adjust maximum width. If property is null, maxWidth will be containerRef.current.offsetWidth
31
+ */
32
+ maxWidth?: number;
33
+ /**
34
+ * Function to set custom chip name
35
+ * @param id
36
+ * @returns
37
+ */
38
+ renderChipLabel?: (chipName: string) => string;
39
+ onClickChip?: (chip: string) => void;
40
+ onRemoveChip?: (event: React.SyntheticEvent, id: string) => void;
41
+ onHasHiddenChipsChange?: (hasHiddenChips: boolean) => void;
42
+ };
43
+ declare const ChipViewer: ({ values, chipSx, chipSize, chipVariant, placeholder, numberLines, reserveHeight, variant, preventHiddenChipsTooltip, typographyVariant, maxWidth, renderChipLabel, onRemoveChip, onClickChip, onHasHiddenChipsChange }: ChipViewerProps) => import("react/jsx-runtime").JSX.Element;
44
+ export default ChipViewer;
@@ -1,6 +1,8 @@
1
1
  export { default as Chip } from './Chip';
2
2
  export { default as ChipList } from './ChipList';
3
3
  export { default as MenuChip } from './MenuChip';
4
+ export { default as ChipViewer } from './ChipViewer';
4
5
  export type { ChipProps } from './Chip';
5
6
  export type { ChipListProps } from './ChipList';
6
7
  export type { MenuChipProps } from './MenuChip';
8
+ export type { ChipViewerProps } from './ChipViewer';
@@ -133,6 +133,14 @@ export type TextFieldProps = {
133
133
  * Called when text area scroll.
134
134
  */
135
135
  onScroll?: (scrollTop: number) => void;
136
+ /**
137
+ * Called when mouse enters in text field.
138
+ */
139
+ onMouseEnter?: () => void;
140
+ /**
141
+ * Called when mouse leaves in text field.
142
+ */
143
+ onMouseLeave?: () => void;
136
144
  /**
137
145
  * Set if input is readonly
138
146
  */
@@ -37,6 +37,14 @@ export type TextFieldContainerProps = React.PropsWithChildren<{
37
37
  * Called on click on this component
38
38
  */
39
39
  onClick?: BoxProps['onClick'];
40
+ /**
41
+ * Called when mouse enters in text field.
42
+ */
43
+ onMouseEnter?: () => void;
44
+ /**
45
+ * Called when mouse leaves in text field.
46
+ */
47
+ onMouseLeave?: () => void;
40
48
  className?: string;
41
49
  /**
42
50
  * Settled directly in DOM element, for testing easy location purposes.
@@ -84,6 +92,14 @@ declare const TextFieldContainer: React.ForwardRefExoticComponent<{
84
92
  * Called on click on this component
85
93
  */
86
94
  onClick?: BoxProps["onClick"];
95
+ /**
96
+ * Called when mouse enters in text field.
97
+ */
98
+ onMouseEnter?: () => void;
99
+ /**
100
+ * Called when mouse leaves in text field.
101
+ */
102
+ onMouseLeave?: () => void;
87
103
  className?: string;
88
104
  /**
89
105
  * Settled directly in DOM element, for testing easy location purposes.
@@ -1,10 +1,5 @@
1
1
  import * as React from 'react';
2
- import { DebouncedTextFieldProps } from './DebouncedTextField';
3
- export type AutocompleteValue<T, Multiple> = Multiple extends undefined | false ? T | '' : T[];
4
- type TextFieldFilteredProps = Pick<DebouncedTextFieldProps, 'autoFocus' | 'activeColor' | 'data-testid' | 'helperText' | 'highlighted' | 'iconId' | 'isError' | 'label' | 'placeholder' | 'debounce' | 'sx' | 'inputSx' | 'maxLength' | 'id' | 'endAdornment'>;
5
- export type AutocompleteOption<T extends string> = {
6
- readonly id: T;
7
- };
2
+ import { AutocompleteOption, AutocompleteValue, TextFieldFilteredProps } from '../../../models/Autocomplete';
8
3
  export type AutocompleteProps<T extends string, Multiple extends boolean | undefined, Value = AutocompleteValue<T, Multiple>, Option = AutocompleteOption<T>> = {
9
4
  /**
10
5
  * The variant of the Autocomplete
@@ -93,10 +88,6 @@ export type AutocompleteProps<T extends string, Multiple extends boolean | undef
93
88
  * Custom text to be shown when number of values reaches maxValues.
94
89
  */
95
90
  maxValuesText?: string;
96
- /**
97
- * Number of selected values to be shown when multiple is enabled. Default value is 0, which shows all selected values tags.
98
- */
99
- limitValueTags?: number;
100
91
  /**
101
92
  * Callback when options list popover is opened.
102
93
  */
@@ -117,6 +108,5 @@ export type AutocompleteProps<T extends string, Multiple extends boolean | undef
117
108
  /**
118
109
  * Powered TextField with the ability to select from a predefined list of options, allowing to select one or multiple values.
119
110
  */
120
- 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, limitValueTags, onClose, onOpen, disableClear }: AutocompleteProps<T, Multiple, Value>, ref: React.Ref<HTMLInputElement>) => import("react/jsx-runtime").JSX.Element;
121
- declare const _default: typeof Autocomplete;
122
- export default _default;
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;
112
+ export default Autocomplete;
@@ -0,0 +1,69 @@
1
+ import * as React from 'react';
2
+ import { AutocompleteValue, TextFieldFilteredProps } from '../../../models/Autocomplete';
3
+ export type AutocompleteInputProps<T extends string, Multiple extends boolean | undefined, Value = AutocompleteValue<T, Multiple>> = {
4
+ /**
5
+ * The variant of the Autocomplete
6
+ */
7
+ variant?: 'default' | 'text';
8
+ /**
9
+ * The value handled by this Autocomplete component. If multiple=true, it should be an array of ids.
10
+ * If multiple=false (by default) it should be a string.
11
+ */
12
+ value: Value;
13
+ /**
14
+ * If has filtered options in dropdown
15
+ */
16
+ hasFilteredOptions: boolean;
17
+ /**
18
+ * Whether the autocomplete is disabled or not.
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * Whether this component is working in multiple mode or single mode. By default it is single mode.
23
+ * See `value` prop description for more info.
24
+ */
25
+ multiple?: Multiple;
26
+ /**
27
+ * Properties to be pass through inner TextField component.
28
+ */
29
+ textFieldProps?: TextFieldFilteredProps;
30
+ /**
31
+ * Use this function to render the desired text for each id. Leave it empty if the id is also the label.
32
+ */
33
+ renderLabel: (id: T) => string;
34
+ /**
35
+ * Maximum length for allowFreeText value
36
+ */
37
+ maxValueLength?: number;
38
+ /**
39
+ * Maximum amount of values allowed when multiple is enabled. If not set, there is no limit.
40
+ */
41
+ maxValues?: number;
42
+ /**
43
+ * Custom text to be shown when number of values reaches maxValues.
44
+ */
45
+ maxValuesText?: string;
46
+ /**
47
+ * Disables clear button at the end of the component when field is dirty.
48
+ */
49
+ disableClear?: boolean;
50
+ isOpenPopover: boolean;
51
+ /**
52
+ * Ref to the outer HTMLDivElement
53
+ */
54
+ containerRef: React.RefObject<HTMLDivElement>;
55
+ inputRef: React.RefObject<HTMLInputElement>;
56
+ inputValue: string;
57
+ setInputValue: (value: string) => void;
58
+ placeholder: string;
59
+ onClosePopover: () => void;
60
+ onOpenPopover: () => void;
61
+ onSearchValueChange: (event: React.SyntheticEvent, searchValue: string) => void;
62
+ onPressEnter: (event: React.SyntheticEvent, inputValue: string) => void;
63
+ onRemoveValue: (event: React.SyntheticEvent, value: Value) => void;
64
+ };
65
+ /**
66
+ * Powered TextField Input.
67
+ */
68
+ declare const AutocompleteInput: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ variant, value, multiple, textFieldProps, hasFilteredOptions, disabled, renderLabel, maxValueLength, maxValues, maxValuesText, disableClear, containerRef, inputRef, onClosePopover, onOpenPopover, isOpenPopover, inputValue, setInputValue, placeholder, onSearchValueChange, onPressEnter, onRemoveValue }: AutocompleteInputProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
69
+ export default AutocompleteInput;
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { AutocompleteValue } from '../../../models/Autocomplete';
3
+ export type AutocompleteInputSelectionProps<T extends string, Multiple extends boolean | undefined, Value = AutocompleteValue<T, Multiple>> = {
4
+ /**
5
+ * The value handled by this Autocomplete component. If multiple=true, it should be an array of ids.
6
+ * If multiple=false (by default) it should be a string.
7
+ */
8
+ value: Value;
9
+ /**
10
+ * Whether the autocomplete is disabled or not.
11
+ */
12
+ disabled?: boolean;
13
+ /**
14
+ * Use this function to render the desired text for each id. Leave it empty if the id is also the label.
15
+ */
16
+ renderLabel: (id: T) => string;
17
+ /**
18
+ * Disables clear button at the end of the component when field is dirty.
19
+ */
20
+ disableClear?: boolean;
21
+ isOpenPopover: boolean;
22
+ inputValue: string;
23
+ isHover: boolean;
24
+ onOpenPopover: () => void;
25
+ onRemoveValue: (event: React.SyntheticEvent, value: Value) => void;
26
+ };
27
+ declare const AutocompleteInputSelection: <T extends string, Multiple extends boolean | undefined = undefined, Value = AutocompleteValue<T, Multiple>>({ value, disabled, renderLabel, disableClear, onOpenPopover, isOpenPopover, inputValue, isHover, onRemoveValue }: AutocompleteInputSelectionProps<T, Multiple, Value>) => import("react/jsx-runtime").JSX.Element;
28
+ export default AutocompleteInputSelection;
@@ -0,0 +1,39 @@
1
+ import * as React from 'react';
2
+ import { FixedSizeList } from 'react-window';
3
+ import { AutocompleteLabeledOption, AutocompleteOption, SelectedIndex } from '../../../models/Autocomplete';
4
+ type AutocompleteListProps<T extends string, Multiple extends boolean | undefined, Option = AutocompleteOption<T>> = {
5
+ /**
6
+ * The available options to be shown on dropdown
7
+ */
8
+ options: readonly Option[];
9
+ filteredOptions: AutocompleteLabeledOption<T>[];
10
+ /**
11
+ * Whether the autocomplete options are loading or not. Use only on initial load or if using async search approach
12
+ */
13
+ isLoading?: boolean;
14
+ /**
15
+ * Custom text to be shown when autocomplete options are loading by the `isLoading` prop.
16
+ */
17
+ loadingText?: string;
18
+ /**
19
+ * Custom text to be shown when no options are available to be selected.
20
+ */
21
+ noOptionsText?: string;
22
+ /**
23
+ * Custom text to be shown when allowFreeText feature is enabled and written text is a new value to add.
24
+ */
25
+ addNewValueText?: string;
26
+ inputContainerRef: React.RefObject<HTMLDivElement>;
27
+ virtualListRef: React.RefObject<FixedSizeList<unknown>>;
28
+ listRef: React.RefObject<HTMLDivElement>;
29
+ isOpen: boolean;
30
+ selectedIndex: SelectedIndex<Multiple>;
31
+ highlightedIndex: number;
32
+ onAddSelectedValue: (event: React.MouseEvent<HTMLElement, MouseEvent>, option: AutocompleteLabeledOption<T>) => void;
33
+ onClickAwayPopover: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
34
+ };
35
+ /**
36
+ * Powered autocomplete list.
37
+ */
38
+ declare const AutocompleteList: <T extends string, Multiple extends boolean | undefined = undefined>({ options, isLoading, loadingText, noOptionsText, addNewValueText, inputContainerRef, isOpen, selectedIndex, highlightedIndex, virtualListRef, listRef, filteredOptions, onAddSelectedValue, onClickAwayPopover }: AutocompleteListProps<T, Multiple>) => import("react/jsx-runtime").JSX.Element;
39
+ export default AutocompleteList;
@@ -20,7 +20,7 @@ export { default as CategorizedPicker } from './CategorizedPicker';
20
20
  export type { CategorizedPickerProps } from './CategorizedPicker';
21
21
  export { default as ItemSelector } from './ItemSelector';
22
22
  export type { ItemSelectorProps, ItemSelectorItem } from './ItemSelector';
23
- export { default as Autocomplete } from './Autocomplete';
23
+ export { default as Autocomplete } from './autocomplete/Autocomplete';
24
24
  export { default as Select } from './Select';
25
25
  export { default as Switch } from './Switch';
26
26
  export { default as TextField } from './TextField';
@@ -35,7 +35,7 @@ export { default as SelectPopover } from './SelectPopover';
35
35
  export { default as Checkbox } from './Checkbox';
36
36
  export { default as Radio } from './Radio';
37
37
  export { default as PageSelector } from './PageSelector';
38
- export type { AutocompleteProps } from './Autocomplete';
38
+ export type { AutocompleteProps } from './autocomplete/Autocomplete';
39
39
  export type { SelectProps } from './Select';
40
40
  export type { SwitchProps } from './Switch';
41
41
  export type { TextFieldProps } from './TextField';