@connectif/ui-components 5.0.1 → 5.0.2
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,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.0.2] - 2026-01-23
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fixed bug in `ColorPicker` component that prevented selecting and setting black color via mouse
|
|
8
|
+
- Fixed `Autocomplete` component overriding `data-testid` prop when passed through `textFieldProps`
|
|
9
|
+
|
|
3
10
|
## [5.0.1] - 2026-01-23
|
|
4
11
|
|
|
5
12
|
### Fixed
|
|
@@ -49,7 +49,7 @@ export type TextFieldContainerProps = React.PropsWithChildren<{
|
|
|
49
49
|
/**
|
|
50
50
|
* Settled directly in DOM element, for testing easy location purposes.
|
|
51
51
|
*/
|
|
52
|
-
'data-
|
|
52
|
+
'data-testid'?: string;
|
|
53
53
|
}>;
|
|
54
54
|
/**
|
|
55
55
|
* A TextFieldContainer is just a Box with the visual styles that uses the TextField component.
|
|
@@ -104,7 +104,7 @@ declare const TextFieldContainer: React.ForwardRefExoticComponent<{
|
|
|
104
104
|
/**
|
|
105
105
|
* Settled directly in DOM element, for testing easy location purposes.
|
|
106
106
|
*/
|
|
107
|
-
'data-
|
|
107
|
+
'data-testid'?: string;
|
|
108
108
|
} & {
|
|
109
109
|
children?: React.ReactNode | undefined;
|
|
110
110
|
} & React.RefAttributes<HTMLDivElement>>;
|
package/dist/index.js
CHANGED
|
@@ -18967,7 +18967,7 @@ var TextFieldContainer = React48.forwardRef(function TextFieldContainer2({
|
|
|
18967
18967
|
onClick,
|
|
18968
18968
|
className = "",
|
|
18969
18969
|
sx,
|
|
18970
|
-
"data-
|
|
18970
|
+
"data-testid": dataTestId,
|
|
18971
18971
|
onMouseEnter,
|
|
18972
18972
|
onMouseLeave
|
|
18973
18973
|
}, ref) {
|
|
@@ -19017,8 +19017,8 @@ var TextFieldContainer = React48.forwardRef(function TextFieldContainer2({
|
|
|
19017
19017
|
...sx
|
|
19018
19018
|
},
|
|
19019
19019
|
ref,
|
|
19020
|
-
...
|
|
19021
|
-
"data-
|
|
19020
|
+
...dataTestId && {
|
|
19021
|
+
"data-testid": dataTestId
|
|
19022
19022
|
},
|
|
19023
19023
|
onMouseEnter,
|
|
19024
19024
|
onMouseLeave,
|
|
@@ -19261,7 +19261,7 @@ var TextField = React51.forwardRef(function TextField2({
|
|
|
19261
19261
|
ref: containerRef,
|
|
19262
19262
|
className: `Cn-TextField ${className}`,
|
|
19263
19263
|
...dataTestId && {
|
|
19264
|
-
"data-
|
|
19264
|
+
"data-testid": `${dataTestId}-container`
|
|
19265
19265
|
},
|
|
19266
19266
|
onMouseEnter,
|
|
19267
19267
|
onMouseLeave,
|
|
@@ -21648,26 +21648,23 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21648
21648
|
const [internalPickerValue, setInternalPickerValue] = React62.useState(
|
|
21649
21649
|
value || white
|
|
21650
21650
|
);
|
|
21651
|
-
const [textFieldValue, setTextFieldValue] = React62.useState(
|
|
21651
|
+
const [textFieldValue, setTextFieldValue] = React62.useState(
|
|
21652
|
+
value ? allowAlpha ? value : rgbToHex(value) : ""
|
|
21653
|
+
);
|
|
21654
|
+
const [isValidPickerChange, setValidPickerChange] = React62.useState(false);
|
|
21655
|
+
const [colorChangeOccurred, setColorChangeOccurred] = React62.useState(false);
|
|
21656
|
+
const [isPopoverInputFocused, setIsPopoverInputFocused] = React62.useState(false);
|
|
21652
21657
|
const [anchorEl, setAnchorEl] = React62.useState();
|
|
21658
|
+
const containerRef = React62.useRef(null);
|
|
21653
21659
|
const handleTextFieldChange = (event) => {
|
|
21654
21660
|
const newValue = event.target.value;
|
|
21661
|
+
setValidPickerChange(false);
|
|
21655
21662
|
setTextFieldValue(newValue);
|
|
21656
21663
|
if (isValidColor(newValue) || allowEmpty && newValue === "") {
|
|
21657
21664
|
setInternalPickerValue(newValue);
|
|
21658
21665
|
onChange(newValue);
|
|
21659
21666
|
}
|
|
21660
21667
|
};
|
|
21661
|
-
const rgbToHex = (rgb) => {
|
|
21662
|
-
const rgbValues = rgb.match(/\d+/g);
|
|
21663
|
-
if (!rgbValues || rgbValues.length !== 3 && rgbValues.length !== 4) {
|
|
21664
|
-
return rgb;
|
|
21665
|
-
}
|
|
21666
|
-
return "#" + rgbValues.slice(0, 3).map((val) => {
|
|
21667
|
-
const hex = parseInt(val, 10).toString(16);
|
|
21668
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
21669
|
-
}).join("");
|
|
21670
|
-
};
|
|
21671
21668
|
const normalizeBlack = (color2) => {
|
|
21672
21669
|
const rgb = color2.match(/\d+/g);
|
|
21673
21670
|
if (!rgb) {
|
|
@@ -21679,13 +21676,6 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21679
21676
|
}
|
|
21680
21677
|
return color2;
|
|
21681
21678
|
};
|
|
21682
|
-
const commitColor = React62.useCallback(() => {
|
|
21683
|
-
const finalValue = allowAlpha ? internalPickerValue : rgbToHex(internalPickerValue);
|
|
21684
|
-
setInternalPickerValue(finalValue);
|
|
21685
|
-
setTextFieldValue(finalValue);
|
|
21686
|
-
setPreviousColors((prev) => [finalValue, ...prev.slice(0, 17)]);
|
|
21687
|
-
onChange(finalValue);
|
|
21688
|
-
}, [internalPickerValue, allowAlpha, onChange]);
|
|
21689
21679
|
const iconColor = /* @__PURE__ */ jsx117(
|
|
21690
21680
|
IconButton_default,
|
|
21691
21681
|
{
|
|
@@ -21697,6 +21687,56 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21697
21687
|
sx: { color: value || grey600 }
|
|
21698
21688
|
}
|
|
21699
21689
|
);
|
|
21690
|
+
React62.useEffect(() => {
|
|
21691
|
+
const handleColorChange = (color2) => {
|
|
21692
|
+
setPreviousColors((prev) => [color2, ...prev.slice(0, 17)]);
|
|
21693
|
+
setTextFieldValue(rgbToHex(color2));
|
|
21694
|
+
onChange(color2);
|
|
21695
|
+
setValidPickerChange(false);
|
|
21696
|
+
setColorChangeOccurred(false);
|
|
21697
|
+
};
|
|
21698
|
+
if (colorChangeOccurred && (isValidPickerChange || isPopoverInputFocused) && internalPickerValue && internalPickerValue !== value) {
|
|
21699
|
+
handleColorChange(internalPickerValue);
|
|
21700
|
+
}
|
|
21701
|
+
}, [
|
|
21702
|
+
value,
|
|
21703
|
+
internalPickerValue,
|
|
21704
|
+
onChange,
|
|
21705
|
+
isValidPickerChange,
|
|
21706
|
+
colorChangeOccurred,
|
|
21707
|
+
isPopoverInputFocused
|
|
21708
|
+
]);
|
|
21709
|
+
React62.useEffect(() => {
|
|
21710
|
+
if (anchorEl) {
|
|
21711
|
+
const handleFocus = () => {
|
|
21712
|
+
setIsPopoverInputFocused(true);
|
|
21713
|
+
};
|
|
21714
|
+
const handleBlur = () => {
|
|
21715
|
+
setIsPopoverInputFocused(false);
|
|
21716
|
+
};
|
|
21717
|
+
let inputs;
|
|
21718
|
+
const timeoutId = setTimeout(() => {
|
|
21719
|
+
if (containerRef.current) {
|
|
21720
|
+
inputs = containerRef.current.querySelectorAll(
|
|
21721
|
+
"input#rbgcp-input, input#rbgcp-hex-input"
|
|
21722
|
+
);
|
|
21723
|
+
inputs.forEach((input) => {
|
|
21724
|
+
input.addEventListener("focus", handleFocus);
|
|
21725
|
+
input.addEventListener("blur", handleBlur);
|
|
21726
|
+
});
|
|
21727
|
+
}
|
|
21728
|
+
}, 0);
|
|
21729
|
+
return () => {
|
|
21730
|
+
clearTimeout(timeoutId);
|
|
21731
|
+
if (inputs) {
|
|
21732
|
+
inputs.forEach((input) => {
|
|
21733
|
+
input.removeEventListener("focus", handleFocus);
|
|
21734
|
+
input.removeEventListener("blur", handleBlur);
|
|
21735
|
+
});
|
|
21736
|
+
}
|
|
21737
|
+
};
|
|
21738
|
+
}
|
|
21739
|
+
}, [anchorEl]);
|
|
21700
21740
|
return /* @__PURE__ */ jsxs53(Fragment23, { children: [
|
|
21701
21741
|
/* @__PURE__ */ jsx117(
|
|
21702
21742
|
TextField_default,
|
|
@@ -21729,11 +21769,13 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21729
21769
|
anchorEl,
|
|
21730
21770
|
onClose: () => setAnchorEl(void 0),
|
|
21731
21771
|
sx: { zIndex: popoverZIndex },
|
|
21732
|
-
onMouseUp:
|
|
21772
|
+
onMouseUp: () => setValidPickerChange(true),
|
|
21733
21773
|
children: /* @__PURE__ */ jsx117(
|
|
21734
21774
|
Box_default2,
|
|
21735
21775
|
{
|
|
21776
|
+
ref: containerRef,
|
|
21736
21777
|
className: "Cn-Color-Gradient-Box",
|
|
21778
|
+
onMouseUp: () => setValidPickerChange(true),
|
|
21737
21779
|
sx: {
|
|
21738
21780
|
"&.Cn-Color-Gradient-Box": {
|
|
21739
21781
|
backgroundColor: "white !important",
|
|
@@ -21783,7 +21825,7 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21783
21825
|
const normalized = normalizeBlack(newColor);
|
|
21784
21826
|
const preview = allowAlpha ? normalized : rgbToHex(normalized);
|
|
21785
21827
|
setInternalPickerValue(preview);
|
|
21786
|
-
|
|
21828
|
+
setColorChangeOccurred(true);
|
|
21787
21829
|
},
|
|
21788
21830
|
hideAdvancedSliders: true,
|
|
21789
21831
|
hideColorGuide: true,
|
|
@@ -21800,6 +21842,16 @@ var ColorPicker = React62.forwardRef(function ColorPickerWrapper({
|
|
|
21800
21842
|
] });
|
|
21801
21843
|
});
|
|
21802
21844
|
var ColorPicker_default = ColorPicker;
|
|
21845
|
+
var rgbToHex = (rgb) => {
|
|
21846
|
+
const rgbValues = rgb.match(/\d+/g);
|
|
21847
|
+
if (!rgbValues || rgbValues.length !== 3 && rgbValues.length !== 4) {
|
|
21848
|
+
return rgb;
|
|
21849
|
+
}
|
|
21850
|
+
return "#" + rgbValues.slice(0, 3).map((val) => {
|
|
21851
|
+
const hex = parseInt(val, 10).toString(16);
|
|
21852
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
21853
|
+
}).join("");
|
|
21854
|
+
};
|
|
21803
21855
|
|
|
21804
21856
|
// src/components/input/UploadClickableArea.tsx
|
|
21805
21857
|
import { Box as Box3 } from "@mui/material";
|
|
@@ -23009,8 +23061,7 @@ var AutocompleteInput = function AutocompleteInput2({
|
|
|
23009
23061
|
),
|
|
23010
23062
|
autoComplete: "off",
|
|
23011
23063
|
onMouseEnter: () => setIsHover(true),
|
|
23012
|
-
onMouseLeave: () => setIsHover(false)
|
|
23013
|
-
"data-testid": "autocomplete-input"
|
|
23064
|
+
onMouseLeave: () => setIsHover(false)
|
|
23014
23065
|
}
|
|
23015
23066
|
) });
|
|
23016
23067
|
};
|
|
@@ -26667,7 +26718,7 @@ import MuiTabs from "@mui/material/Tabs";
|
|
|
26667
26718
|
|
|
26668
26719
|
// src/components/layout/SwipeableViews.tsx
|
|
26669
26720
|
import * as React87 from "react";
|
|
26670
|
-
import { useEffect as
|
|
26721
|
+
import { useEffect as useEffect23, useRef as useRef27, useState as useState34 } from "react";
|
|
26671
26722
|
import { jsx as jsx155 } from "react/jsx-runtime";
|
|
26672
26723
|
var styles = {
|
|
26673
26724
|
container: {
|
|
@@ -26701,12 +26752,12 @@ function SwipeableViews({
|
|
|
26701
26752
|
disableScroll = false,
|
|
26702
26753
|
...rootProps
|
|
26703
26754
|
}) {
|
|
26704
|
-
const containerRef =
|
|
26705
|
-
const scrollTimeout =
|
|
26706
|
-
const scrollingMethod =
|
|
26755
|
+
const containerRef = useRef27(null);
|
|
26756
|
+
const scrollTimeout = useRef27();
|
|
26757
|
+
const scrollingMethod = useRef27("none");
|
|
26707
26758
|
const [previousIndex, setPreviousIndex] = useState34(index);
|
|
26708
|
-
const hideScrollAnimation =
|
|
26709
|
-
|
|
26759
|
+
const hideScrollAnimation = useRef27(true);
|
|
26760
|
+
useEffect23(() => {
|
|
26710
26761
|
if (containerRef.current) {
|
|
26711
26762
|
if (scrollingMethod.current === "manual") {
|
|
26712
26763
|
scrollingMethod.current = "none";
|
|
@@ -27866,31 +27917,31 @@ var MinimizableWindow = React92.forwardRef(function MinimizableWindow2({
|
|
|
27866
27917
|
var MinimizableWindow_default = MinimizableWindow;
|
|
27867
27918
|
|
|
27868
27919
|
// src/hooks/useFormatters.ts
|
|
27869
|
-
import { useCallback as
|
|
27920
|
+
import { useCallback as useCallback22, useContext as useContext16 } from "react";
|
|
27870
27921
|
var useFormatters = () => {
|
|
27871
27922
|
const { locale, currency, timezone } = useContext16(IntlContext);
|
|
27872
27923
|
return {
|
|
27873
|
-
formatCompactNumber:
|
|
27924
|
+
formatCompactNumber: useCallback22(
|
|
27874
27925
|
(value) => formatCompactNumber(value, locale),
|
|
27875
27926
|
[locale]
|
|
27876
27927
|
),
|
|
27877
|
-
formatNumber:
|
|
27928
|
+
formatNumber: useCallback22(
|
|
27878
27929
|
(value, fractionSize) => formatNumber(value, locale, fractionSize),
|
|
27879
27930
|
[locale]
|
|
27880
27931
|
),
|
|
27881
|
-
formatPercentage:
|
|
27932
|
+
formatPercentage: useCallback22(
|
|
27882
27933
|
(value, fractionSize) => formatPercentage(value, locale, fractionSize),
|
|
27883
27934
|
[locale]
|
|
27884
27935
|
),
|
|
27885
|
-
formatCurrency:
|
|
27936
|
+
formatCurrency: useCallback22(
|
|
27886
27937
|
(value, notation) => formatCurrency(value, locale, currency, notation),
|
|
27887
27938
|
[currency, locale]
|
|
27888
27939
|
),
|
|
27889
|
-
formatDate:
|
|
27940
|
+
formatDate: useCallback22(
|
|
27890
27941
|
(date, format2) => formatDate(date, locale, timezone, format2),
|
|
27891
27942
|
[locale, timezone]
|
|
27892
27943
|
),
|
|
27893
|
-
formatPhone:
|
|
27944
|
+
formatPhone: useCallback22(
|
|
27894
27945
|
(phone, format2) => formatPhone(phone, format2),
|
|
27895
27946
|
[]
|
|
27896
27947
|
)
|