@connectif/ui-components 5.1.0 → 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 +16 -0
- package/dist/components/input/ColorPicker.d.ts +6 -0
- package/dist/components/input/autocomplete/Autocomplete.d.ts +6 -1
- package/dist/components/input/autocomplete/AutocompleteInput.d.ts +8 -3
- package/dist/components/input/autocomplete/AutocompleteInputSelection.d.ts +6 -1
- package/dist/index.js +38 -23
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
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
|
+
|
|
13
|
+
## [5.1.1] - 2026-01-26
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- ColorPicker component now converts rgb to hex properly. Also mode property (hex or auto) has been added.
|
|
18
|
+
|
|
3
19
|
## [5.1.0] - 2026-01-26
|
|
4
20
|
|
|
5
21
|
### Changed
|
|
@@ -47,6 +47,12 @@ export type ColorPickerProps = {
|
|
|
47
47
|
* (optional) The width of the input field
|
|
48
48
|
*/
|
|
49
49
|
inputWidthStyle?: string;
|
|
50
|
+
/**
|
|
51
|
+
* (optional) The color format mode, 'hex' to force hex format in the "onChange" call. 'auto' to switch between hex and rgba depending on user input.
|
|
52
|
+
* rgba will be used when alpha is allowed and the color has transparency even in hex mode.
|
|
53
|
+
* @default 'auto'
|
|
54
|
+
*/
|
|
55
|
+
mode?: 'hex' | 'auto';
|
|
50
56
|
/**
|
|
51
57
|
* A function to update color value
|
|
52
58
|
*/
|
|
@@ -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
|
|
55
|
-
inputRef
|
|
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
|
@@ -21651,6 +21651,7 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21651
21651
|
allowAlpha = false,
|
|
21652
21652
|
popoverZIndex,
|
|
21653
21653
|
inputWidthStyle = "150px",
|
|
21654
|
+
mode = "auto",
|
|
21654
21655
|
onChange
|
|
21655
21656
|
}, ref) {
|
|
21656
21657
|
const { t } = useTranslation();
|
|
@@ -21675,20 +21676,9 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21675
21676
|
setTextFieldValue(newValue);
|
|
21676
21677
|
if (isValidColor(newValue) || allowEmpty && newValue === "") {
|
|
21677
21678
|
setInternalPickerValue(newValue);
|
|
21678
|
-
onChange(newValue);
|
|
21679
|
+
onChange(mode === "hex" ? rgbToHex(newValue) : newValue);
|
|
21679
21680
|
}
|
|
21680
21681
|
};
|
|
21681
|
-
const normalizeBlack = (color2) => {
|
|
21682
|
-
const rgb = color2.match(/\d+/g);
|
|
21683
|
-
if (!rgb) {
|
|
21684
|
-
return color2;
|
|
21685
|
-
}
|
|
21686
|
-
const [r2, g, b] = rgb.map(Number);
|
|
21687
|
-
if (r2 <= 1 && g <= 1 && b <= 1) {
|
|
21688
|
-
return "rgb(0,0,0)";
|
|
21689
|
-
}
|
|
21690
|
-
return color2;
|
|
21691
|
-
};
|
|
21692
21682
|
const iconColor = /* @__PURE__ */ jsx117(
|
|
21693
21683
|
IconButton_default,
|
|
21694
21684
|
{
|
|
@@ -21703,8 +21693,8 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21703
21693
|
React62.useEffect(() => {
|
|
21704
21694
|
const handleInternalColorChange = (color2) => {
|
|
21705
21695
|
setPreviousColors((prev) => [color2, ...prev.slice(0, 17)]);
|
|
21706
|
-
setTextFieldValue(rgbToHex(color2));
|
|
21707
|
-
onChange(color2);
|
|
21696
|
+
setTextFieldValue(mode === "hex" ? rgbToHex(color2) : color2);
|
|
21697
|
+
onChange(mode === "hex" ? rgbToHex(color2) : color2);
|
|
21708
21698
|
setValidPickerChange(false);
|
|
21709
21699
|
setColorChangeOccurred(false);
|
|
21710
21700
|
};
|
|
@@ -21717,7 +21707,8 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21717
21707
|
onChange,
|
|
21718
21708
|
isValidPickerChange,
|
|
21719
21709
|
colorChangeOccurred,
|
|
21720
|
-
isPopoverInputFocused
|
|
21710
|
+
isPopoverInputFocused,
|
|
21711
|
+
mode
|
|
21721
21712
|
]);
|
|
21722
21713
|
React62.useEffect(() => {
|
|
21723
21714
|
const handleExternalColorChange = (color2) => {
|
|
@@ -21862,7 +21853,19 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21862
21853
|
});
|
|
21863
21854
|
var ColorPicker_default = ColorPicker;
|
|
21864
21855
|
var rgbToHex = (rgb) => {
|
|
21865
|
-
|
|
21856
|
+
if (/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(rgb) || !rgb.startsWith("rgb")) {
|
|
21857
|
+
return rgb;
|
|
21858
|
+
}
|
|
21859
|
+
if (rgb.includes("rgba")) {
|
|
21860
|
+
const alphaMatch = rgb.match(
|
|
21861
|
+
/rgba\(\d{1,3}, {0,1}\d{1,3}, {0,1}\d{1,3}, {0,1}([01]|0?\.\d+)\)/
|
|
21862
|
+
);
|
|
21863
|
+
if (alphaMatch && alphaMatch[1] === "0") {
|
|
21864
|
+
return "transparent";
|
|
21865
|
+
}
|
|
21866
|
+
}
|
|
21867
|
+
const normalized = normalizeBlack(rgb);
|
|
21868
|
+
const rgbValues = normalized.match(/\d+/g);
|
|
21866
21869
|
if (!rgbValues || rgbValues.length !== 3 && rgbValues.length !== 4) {
|
|
21867
21870
|
return rgb;
|
|
21868
21871
|
}
|
|
@@ -21871,6 +21874,17 @@ var rgbToHex = (rgb) => {
|
|
|
21871
21874
|
return hex.length === 1 ? "0" + hex : hex;
|
|
21872
21875
|
}).join("");
|
|
21873
21876
|
};
|
|
21877
|
+
var normalizeBlack = (color2) => {
|
|
21878
|
+
const rgb = color2.match(/\d+/g);
|
|
21879
|
+
if (!rgb) {
|
|
21880
|
+
return color2;
|
|
21881
|
+
}
|
|
21882
|
+
const [r2, g, b] = rgb.map(Number);
|
|
21883
|
+
if (r2 <= 1 && g <= 1 && b <= 1) {
|
|
21884
|
+
return "rgb(0,0,0)";
|
|
21885
|
+
}
|
|
21886
|
+
return color2;
|
|
21887
|
+
};
|
|
21874
21888
|
|
|
21875
21889
|
// src/components/input/UploadClickableArea.tsx
|
|
21876
21890
|
import { Box as Box3 } from "@mui/material";
|
|
@@ -22824,6 +22838,7 @@ var AutocompleteInputSelection = function AutocompleteInputSelection2({
|
|
|
22824
22838
|
value,
|
|
22825
22839
|
canAddValues,
|
|
22826
22840
|
disabled = false,
|
|
22841
|
+
startIconId,
|
|
22827
22842
|
renderLabel,
|
|
22828
22843
|
onOpenPopover,
|
|
22829
22844
|
onRemoveValue
|
|
@@ -22842,10 +22857,10 @@ var AutocompleteInputSelection = function AutocompleteInputSelection2({
|
|
|
22842
22857
|
maxWidth: `calc(100% - ${AUTOCOMPLETE_PADDING_RIGHT}px)`
|
|
22843
22858
|
},
|
|
22844
22859
|
children: [
|
|
22845
|
-
/* @__PURE__ */ jsx122(
|
|
22860
|
+
!!startIconId && /* @__PURE__ */ jsx122(
|
|
22846
22861
|
IconButton_default,
|
|
22847
22862
|
{
|
|
22848
|
-
iconId:
|
|
22863
|
+
iconId: startIconId,
|
|
22849
22864
|
size: "S",
|
|
22850
22865
|
disabled: disabled || !canAddValues,
|
|
22851
22866
|
sx: {
|
|
@@ -22910,6 +22925,7 @@ var AutocompleteInput = function AutocompleteInput2({
|
|
|
22910
22925
|
inputValue,
|
|
22911
22926
|
setInputValue,
|
|
22912
22927
|
placeholder,
|
|
22928
|
+
startIconId,
|
|
22913
22929
|
onSearchValueChange,
|
|
22914
22930
|
onPressEnter,
|
|
22915
22931
|
onRemoveValue
|
|
@@ -23001,6 +23017,7 @@ var AutocompleteInput = function AutocompleteInput2({
|
|
|
23001
23017
|
AutocompleteInputSelection_default,
|
|
23002
23018
|
{
|
|
23003
23019
|
value,
|
|
23020
|
+
startIconId,
|
|
23004
23021
|
canAddValues,
|
|
23005
23022
|
renderLabel,
|
|
23006
23023
|
onOpenPopover,
|
|
@@ -23272,6 +23289,7 @@ var Autocomplete = function Autocomplete2({
|
|
|
23272
23289
|
maxValueLength,
|
|
23273
23290
|
maxValues,
|
|
23274
23291
|
maxValuesText,
|
|
23292
|
+
startIconId,
|
|
23275
23293
|
onClose = () => ({}),
|
|
23276
23294
|
onOpen = () => ({}),
|
|
23277
23295
|
disableClear
|
|
@@ -23551,11 +23569,7 @@ var Autocomplete = function Autocomplete2({
|
|
|
23551
23569
|
anchorRef.current,
|
|
23552
23570
|
event.target
|
|
23553
23571
|
)) {
|
|
23554
|
-
|
|
23555
|
-
onSelectValueSingle(inputValue, event);
|
|
23556
|
-
} else {
|
|
23557
|
-
closePopover();
|
|
23558
|
-
}
|
|
23572
|
+
closePopover();
|
|
23559
23573
|
if (inputValue) {
|
|
23560
23574
|
onSearch && onSearch("");
|
|
23561
23575
|
} else {
|
|
@@ -23584,6 +23598,7 @@ var Autocomplete = function Autocomplete2({
|
|
|
23584
23598
|
},
|
|
23585
23599
|
disableClear,
|
|
23586
23600
|
disabled,
|
|
23601
|
+
startIconId,
|
|
23587
23602
|
hasFilteredOptions: options.length > 0,
|
|
23588
23603
|
value,
|
|
23589
23604
|
maxValueLength,
|