@connectif/ui-components 5.7.2 → 6.0.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 +17 -0
- package/dist/components/chip/Chip.d.ts +8 -0
- package/dist/components/chip/ChipContainer.d.ts +2 -1
- package/dist/components/chip/ChipHiddenCounter.d.ts +2 -1
- package/dist/components/chip/ChipViewer.d.ts +5 -1
- package/dist/components/input/ItemSelector.d.ts +3 -4
- package/dist/index.js +279 -247
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/DateUtils.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11091,6 +11091,7 @@ var Chip = React28.forwardRef(function Chip2({
|
|
|
11091
11091
|
iconColor,
|
|
11092
11092
|
iconRight = false,
|
|
11093
11093
|
iconSize,
|
|
11094
|
+
iconTooltip,
|
|
11094
11095
|
onClick,
|
|
11095
11096
|
onDelete,
|
|
11096
11097
|
onHover,
|
|
@@ -11118,18 +11119,19 @@ var Chip = React28.forwardRef(function Chip2({
|
|
|
11118
11119
|
};
|
|
11119
11120
|
const iconSizeCurrent = iconSize ?? iconSizes3[size];
|
|
11120
11121
|
const variantStyles3 = getVariantStyles(theme2, variant);
|
|
11121
|
-
const
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
cursor: !onClick ? "default" : void 0
|
|
11130
|
-
}
|
|
11122
|
+
const getIcon = (iconId2) => /* @__PURE__ */ jsx55(Tooltip_default, { title: iconTooltip || "", children: /* @__PURE__ */ jsx55(
|
|
11123
|
+
Icon_default,
|
|
11124
|
+
{
|
|
11125
|
+
id: iconId2,
|
|
11126
|
+
size: iconSizeCurrent,
|
|
11127
|
+
sx: {
|
|
11128
|
+
color: iconColor ?? variantStyles3.iconColor,
|
|
11129
|
+
cursor: !onClick ? "default" : void 0
|
|
11131
11130
|
}
|
|
11132
|
-
|
|
11131
|
+
}
|
|
11132
|
+
) });
|
|
11133
|
+
const deleteIcon = /* @__PURE__ */ jsxs21(Stack_default, { direction: "row", alignItems: "center", children: [
|
|
11134
|
+
iconId && iconRight && getIcon(iconId),
|
|
11133
11135
|
isDeleteable && onDelete && /* @__PURE__ */ jsx55(
|
|
11134
11136
|
IconButton_default,
|
|
11135
11137
|
{
|
|
@@ -11165,7 +11167,7 @@ var Chip = React28.forwardRef(function Chip2({
|
|
|
11165
11167
|
{
|
|
11166
11168
|
label,
|
|
11167
11169
|
component,
|
|
11168
|
-
icon: iconId && !iconRight ?
|
|
11170
|
+
icon: iconId && !iconRight ? getIcon(iconId) : void 0,
|
|
11169
11171
|
sx: {
|
|
11170
11172
|
boxSizing: "border-box",
|
|
11171
11173
|
backgroundColor: !transparentBackgroundColor ? variantStyles3.backgroundColor : void 0,
|
|
@@ -11551,12 +11553,14 @@ import { Fragment as Fragment7, jsx as jsx62, jsxs as jsxs24 } from "react/jsx-r
|
|
|
11551
11553
|
var TOOLTIP_DATA_TEST_ID = "chip-container-tooltip";
|
|
11552
11554
|
var COUNTER_LABEL_DATA_TEST_ID = "chip-counter-label";
|
|
11553
11555
|
var MAX_TOOLTIP_WIDTH = 362;
|
|
11556
|
+
var WIDTH_ALERT_BUTTON = 20;
|
|
11554
11557
|
var WIDTH_DELETABLE_BUTTON = 20;
|
|
11555
11558
|
var ChipHiddenCounter = ({
|
|
11556
11559
|
hiddenChips,
|
|
11557
11560
|
isDeletable,
|
|
11558
11561
|
preventHiddenChipsTooltip,
|
|
11559
|
-
renderChip
|
|
11562
|
+
renderChip,
|
|
11563
|
+
getWarningTooltip
|
|
11560
11564
|
}) => {
|
|
11561
11565
|
const counterRef = React30.useRef(null);
|
|
11562
11566
|
const popperRef = React30.useRef(null);
|
|
@@ -11574,6 +11578,11 @@ var ChipHiddenCounter = ({
|
|
|
11574
11578
|
const closePopover = () => {
|
|
11575
11579
|
setIsOpenPopover(false);
|
|
11576
11580
|
};
|
|
11581
|
+
const getRenderChipWidth = (chipName) => {
|
|
11582
|
+
const warningTooltip = getWarningTooltip && getWarningTooltip(chipName);
|
|
11583
|
+
const alertButtonWidth = !warningTooltip ? 0 : WIDTH_ALERT_BUTTON;
|
|
11584
|
+
return !isDeletable ? `${MAX_TOOLTIP_WIDTH - alertButtonWidth}px` : `${MAX_TOOLTIP_WIDTH - WIDTH_DELETABLE_BUTTON - alertButtonWidth}px`;
|
|
11585
|
+
};
|
|
11577
11586
|
return /* @__PURE__ */ jsx62(Fragment7, { children: hiddenChips.length > 0 && /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
11578
11587
|
/* @__PURE__ */ jsx62(
|
|
11579
11588
|
Box_default2,
|
|
@@ -11593,6 +11602,30 @@ var ChipHiddenCounter = ({
|
|
|
11593
11602
|
Popper,
|
|
11594
11603
|
{
|
|
11595
11604
|
ref: popperRef,
|
|
11605
|
+
modifiers: [
|
|
11606
|
+
{
|
|
11607
|
+
name: "offset",
|
|
11608
|
+
options: {
|
|
11609
|
+
offset: ({
|
|
11610
|
+
placement
|
|
11611
|
+
}) => {
|
|
11612
|
+
if (placement.startsWith("bottom")) {
|
|
11613
|
+
return [0, -2];
|
|
11614
|
+
}
|
|
11615
|
+
if (placement.startsWith("top")) {
|
|
11616
|
+
return [0, 2];
|
|
11617
|
+
}
|
|
11618
|
+
if (placement.startsWith("left")) {
|
|
11619
|
+
return [2, 0];
|
|
11620
|
+
}
|
|
11621
|
+
if (placement.startsWith("right")) {
|
|
11622
|
+
return [-2, 0];
|
|
11623
|
+
}
|
|
11624
|
+
return [0, 0];
|
|
11625
|
+
}
|
|
11626
|
+
}
|
|
11627
|
+
}
|
|
11628
|
+
],
|
|
11596
11629
|
onMouseEnter: openPopover,
|
|
11597
11630
|
onMouseLeave: closePopover,
|
|
11598
11631
|
anchorEl: counterRef.current,
|
|
@@ -11627,7 +11660,7 @@ var ChipHiddenCounter = ({
|
|
|
11627
11660
|
(value, index) => renderChip({
|
|
11628
11661
|
chipName: value,
|
|
11629
11662
|
index,
|
|
11630
|
-
maxWidth:
|
|
11663
|
+
maxWidth: getRenderChipWidth(value)
|
|
11631
11664
|
})
|
|
11632
11665
|
)
|
|
11633
11666
|
}
|
|
@@ -11657,7 +11690,8 @@ var ChipContainer = ({
|
|
|
11657
11690
|
clickable,
|
|
11658
11691
|
preventHiddenChipsTooltip,
|
|
11659
11692
|
dataTestId = DEFAULT_DATA_TEST_ID,
|
|
11660
|
-
renderChip
|
|
11693
|
+
renderChip,
|
|
11694
|
+
getWarningTooltip
|
|
11661
11695
|
}) => /* @__PURE__ */ jsxs25(
|
|
11662
11696
|
Stack_default,
|
|
11663
11697
|
{
|
|
@@ -11696,7 +11730,8 @@ var ChipContainer = ({
|
|
|
11696
11730
|
hiddenChips,
|
|
11697
11731
|
renderChip,
|
|
11698
11732
|
isDeletable,
|
|
11699
|
-
preventHiddenChipsTooltip: !!preventHiddenChipsTooltip
|
|
11733
|
+
preventHiddenChipsTooltip: !!preventHiddenChipsTooltip,
|
|
11734
|
+
getWarningTooltip
|
|
11700
11735
|
}
|
|
11701
11736
|
)
|
|
11702
11737
|
]
|
|
@@ -11738,7 +11773,8 @@ var ChipViewer = ({
|
|
|
11738
11773
|
renderChipLabel,
|
|
11739
11774
|
onRemoveChip,
|
|
11740
11775
|
onClickChip,
|
|
11741
|
-
onHasHiddenChipsChange
|
|
11776
|
+
onHasHiddenChipsChange,
|
|
11777
|
+
getWarningTooltip
|
|
11742
11778
|
}) => {
|
|
11743
11779
|
const rootNodeRef = React31.useRef(null);
|
|
11744
11780
|
const containerRef = React31.useRef(null);
|
|
@@ -11940,47 +11976,57 @@ var ChipViewer = ({
|
|
|
11940
11976
|
index,
|
|
11941
11977
|
maxWidth: maxWidth2,
|
|
11942
11978
|
isCounterLabel
|
|
11943
|
-
}) =>
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11979
|
+
}) => {
|
|
11980
|
+
const warningTooltip = getWarningTooltip && getWarningTooltip(chipName);
|
|
11981
|
+
return /* @__PURE__ */ jsx64(
|
|
11982
|
+
Chip_default,
|
|
11983
|
+
{
|
|
11984
|
+
variant: chipVariant,
|
|
11985
|
+
...!!warningTooltip && {
|
|
11986
|
+
iconId: "alert",
|
|
11987
|
+
iconColor: complementary600,
|
|
11988
|
+
iconRight: true,
|
|
11989
|
+
iconSize: "XS",
|
|
11990
|
+
iconTooltip: warningTooltip
|
|
11950
11991
|
},
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11992
|
+
sx: {
|
|
11993
|
+
"& > span": {
|
|
11994
|
+
padding: "8px"
|
|
11995
|
+
},
|
|
11996
|
+
border: "none",
|
|
11997
|
+
cursor: onClickChip ? "pointer" : "default",
|
|
11998
|
+
...chipViewerStyle[variant],
|
|
11999
|
+
paddingRight: "8px",
|
|
12000
|
+
"& .MuiChip-label": {
|
|
12001
|
+
paddingRight: !warningTooltip ? "4px" : "8px"
|
|
12002
|
+
},
|
|
12003
|
+
"& .MuiChip-deleteIcon > button": {
|
|
12004
|
+
padding: 0,
|
|
12005
|
+
color: Colors_exports.grey800
|
|
12006
|
+
},
|
|
12007
|
+
...chipSx && { ...chipSx }
|
|
11957
12008
|
},
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
12009
|
+
size: chipSize,
|
|
12010
|
+
label: /* @__PURE__ */ jsx64(
|
|
12011
|
+
TextEllipsis_default,
|
|
12012
|
+
{
|
|
12013
|
+
lines: 1,
|
|
12014
|
+
typographyVariant,
|
|
12015
|
+
text: renderChipLabel && !isCounterLabel ? renderChipLabel(chipName) : chipName,
|
|
12016
|
+
...maxWidth2 && { maxWidth: maxWidth2 }
|
|
12017
|
+
}
|
|
12018
|
+
),
|
|
12019
|
+
onClick: onClickChip ? () => onClickChip(chipName) : void 0,
|
|
12020
|
+
isDeleteable: !!onRemoveChip && !isCounterLabel,
|
|
12021
|
+
...onRemoveChip && {
|
|
12022
|
+
onDelete: (event) => onRemoveChip(event, chipName)
|
|
11961
12023
|
},
|
|
11962
|
-
|
|
12024
|
+
"data-testid": CHIP_DATA_TEST_ID,
|
|
12025
|
+
disableDeleteRipple: true
|
|
11963
12026
|
},
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
{
|
|
11968
|
-
lines: 1,
|
|
11969
|
-
typographyVariant,
|
|
11970
|
-
text: renderChipLabel && !isCounterLabel ? renderChipLabel(chipName) : chipName,
|
|
11971
|
-
...maxWidth2 && { maxWidth: maxWidth2 }
|
|
11972
|
-
}
|
|
11973
|
-
),
|
|
11974
|
-
onClick: onClickChip ? () => onClickChip(chipName) : void 0,
|
|
11975
|
-
isDeleteable: !!onRemoveChip && !isCounterLabel,
|
|
11976
|
-
...onRemoveChip && {
|
|
11977
|
-
onDelete: (event) => onRemoveChip(event, chipName)
|
|
11978
|
-
},
|
|
11979
|
-
"data-testid": CHIP_DATA_TEST_ID,
|
|
11980
|
-
disableDeleteRipple: true
|
|
11981
|
-
},
|
|
11982
|
-
`chip-${index}`
|
|
11983
|
-
);
|
|
12027
|
+
`chip-${index}`
|
|
12028
|
+
);
|
|
12029
|
+
};
|
|
11984
12030
|
return /* @__PURE__ */ jsx64(Stack4, { ref: rootNodeRef, "data-testid": CHIP_VIEWER_ROOT_ID, children: /* @__PURE__ */ jsx64(
|
|
11985
12031
|
ChipContainer_default,
|
|
11986
12032
|
{
|
|
@@ -11995,7 +12041,8 @@ var ChipViewer = ({
|
|
|
11995
12041
|
renderChip: getRenderChip,
|
|
11996
12042
|
clickable: !!onClickChip,
|
|
11997
12043
|
isDeletable: !!onRemoveChip,
|
|
11998
|
-
preventHiddenChipsTooltip
|
|
12044
|
+
preventHiddenChipsTooltip,
|
|
12045
|
+
getWarningTooltip
|
|
11999
12046
|
}
|
|
12000
12047
|
) });
|
|
12001
12048
|
};
|
|
@@ -15021,9 +15068,9 @@ __export(en_exports6, {
|
|
|
15021
15068
|
default: () => en_default6
|
|
15022
15069
|
});
|
|
15023
15070
|
var MINIMIZABLE_WINDOW = {
|
|
15024
|
-
CLOSE: "
|
|
15025
|
-
GO_BACK: "
|
|
15026
|
-
MINIMIZE: "
|
|
15071
|
+
CLOSE: "Close",
|
|
15072
|
+
GO_BACK: "Go back",
|
|
15073
|
+
MINIMIZE: "Minimize"
|
|
15027
15074
|
};
|
|
15028
15075
|
var en_default6 = {
|
|
15029
15076
|
MINIMIZABLE_WINDOW
|
|
@@ -16857,6 +16904,9 @@ function getDisplayEndDate(date, timezone, includeTime) {
|
|
|
16857
16904
|
return tz(date, timezone).subtract(1, "day").toDate();
|
|
16858
16905
|
}
|
|
16859
16906
|
function applyTimeToDate(date, time) {
|
|
16907
|
+
if (!time) {
|
|
16908
|
+
return date;
|
|
16909
|
+
}
|
|
16860
16910
|
if (isNaN(date.getTime()) || isNaN(time.getTime())) {
|
|
16861
16911
|
return /* @__PURE__ */ new Date(NaN);
|
|
16862
16912
|
}
|
|
@@ -20824,11 +20874,7 @@ var DateIntervalPickerPopover = ({
|
|
|
20824
20874
|
timezone,
|
|
20825
20875
|
{ includeTime: !!showTime }
|
|
20826
20876
|
);
|
|
20827
|
-
const displayEndDate2 = getDisplayEndDate(
|
|
20828
|
-
result.endDate,
|
|
20829
|
-
timezone,
|
|
20830
|
-
!!showTime
|
|
20831
|
-
);
|
|
20877
|
+
const displayEndDate2 = variant !== "input" ? getDisplayEndDate(result.endDate, timezone, !!showTime) : result.endDate;
|
|
20832
20878
|
return {
|
|
20833
20879
|
startDate: dateInputFormatter(result.startDate),
|
|
20834
20880
|
endDate: dateInputFormatter(displayEndDate2),
|
|
@@ -20882,17 +20928,17 @@ var DateIntervalPickerPopover = ({
|
|
|
20882
20928
|
)
|
|
20883
20929
|
};
|
|
20884
20930
|
};
|
|
20885
|
-
const displayEndDate = endDate ? getDisplayEndDate(endDate, timezone, !!showTime) : void 0;
|
|
20931
|
+
const displayEndDate = endDate ? variant !== "input" ? getDisplayEndDate(endDate, timezone, !!showTime) : endDate : void 0;
|
|
20886
20932
|
const displayComparisonEndDate = comparisonEndDate && getDisplayEndDate(comparisonEndDate, timezone, !!showTime);
|
|
20887
20933
|
const initialState = {
|
|
20888
20934
|
interval,
|
|
20889
20935
|
highlightedInput: "startDate",
|
|
20890
20936
|
focusedDateInCalendar: dateToSimpleDate(startDate, timezone),
|
|
20891
20937
|
startDate: startDate ? dateInputFormatter(startDate) : void 0,
|
|
20892
|
-
startTime: startDate,
|
|
20938
|
+
startTime: showTime ? startDate : void 0,
|
|
20893
20939
|
startSimpleDate: dateToSimpleDate(startDate, timezone),
|
|
20894
20940
|
endDate: displayEndDate ? dateInputFormatter(displayEndDate) : displayEndDate,
|
|
20895
|
-
endTime: displayEndDate,
|
|
20941
|
+
endTime: showTime ? displayEndDate : void 0,
|
|
20896
20942
|
endSimpleDate: dateToSimpleDate(displayEndDate, timezone),
|
|
20897
20943
|
comparisonInterval: comparisonInterval ?? "previousPeriod",
|
|
20898
20944
|
comparisonStartDate: comparisonStartDate ? dateInputFormatter(comparisonStartDate) : "",
|
|
@@ -20923,7 +20969,13 @@ var DateIntervalPickerPopover = ({
|
|
|
20923
20969
|
if (!dateString || !simpleDate) {
|
|
20924
20970
|
throw new Error("Invalid date state");
|
|
20925
20971
|
}
|
|
20926
|
-
const parsed = parseDate(dateString)
|
|
20972
|
+
const parsed = variant !== "input" ? parseDate(dateString) : new Date(
|
|
20973
|
+
Date.UTC(
|
|
20974
|
+
simpleDate.year,
|
|
20975
|
+
simpleDate.month,
|
|
20976
|
+
simpleDate.day
|
|
20977
|
+
)
|
|
20978
|
+
);
|
|
20927
20979
|
if (isNaN(parsed.getTime()) || parsed < minDate || parsed > maxDate) {
|
|
20928
20980
|
return tz5(
|
|
20929
20981
|
{
|
|
@@ -20938,17 +20990,17 @@ var DateIntervalPickerPopover = ({
|
|
|
20938
20990
|
};
|
|
20939
20991
|
const parseEndDateSafe = (dateString, simpleDate) => {
|
|
20940
20992
|
const parsed = safeParseDate(dateString, simpleDate);
|
|
20941
|
-
return !showTime ? tz5(parsed, timezone).add(1, "day").toDate() : parsed;
|
|
20993
|
+
return variant !== "input" && !showTime ? tz5(parsed, timezone).add(1, "day").toDate() : parsed;
|
|
20942
20994
|
};
|
|
20943
20995
|
onApply({
|
|
20944
20996
|
interval: state.interval ?? "custom",
|
|
20945
20997
|
startDate: applyTimeToDate(
|
|
20946
20998
|
safeParseDate(state.startDate, state.startSimpleDate),
|
|
20947
|
-
state.startTime
|
|
20999
|
+
state.startTime
|
|
20948
21000
|
),
|
|
20949
21001
|
endDate: applyTimeToDate(
|
|
20950
21002
|
parseEndDateSafe(state.endDate, state.endSimpleDate),
|
|
20951
|
-
state.endTime
|
|
21003
|
+
state.endTime
|
|
20952
21004
|
),
|
|
20953
21005
|
comparisonInterval: state.isComparing ? state.comparisonInterval : null,
|
|
20954
21006
|
comparisonStartDate: state.isComparing ? applyTimeToDate(
|
|
@@ -21340,11 +21392,7 @@ var DateIntervalPicker = ({
|
|
|
21340
21392
|
};
|
|
21341
21393
|
const internalMaxDate = maxDate ?? tz7(timezone).toDate();
|
|
21342
21394
|
const internalMinDate = minDate ?? tz7(internalMaxDate, timezone).subtract(maxSelectableDays - 1, "days").toDate();
|
|
21343
|
-
const displayEndDate = rest.endDate !== void 0 ? getDisplayEndDate(
|
|
21344
|
-
rest.endDate,
|
|
21345
|
-
timezone,
|
|
21346
|
-
rest.variant !== "input" ? !!rest.showTime : false
|
|
21347
|
-
) : void 0;
|
|
21395
|
+
const displayEndDate = rest.endDate !== void 0 ? rest.variant !== "input" ? getDisplayEndDate(rest.endDate, timezone, !!rest.showTime) : rest.endDate : void 0;
|
|
21348
21396
|
const isEndDateVisible = displayEndDate !== void 0 && !isSameDate(rest.startDate, displayEndDate);
|
|
21349
21397
|
return /* @__PURE__ */ jsxs54("div", { style: { display: "inline-flex" }, children: [
|
|
21350
21398
|
rest.variant !== "input" && /* @__PURE__ */ jsx116(
|
|
@@ -21856,6 +21904,11 @@ var Select = function Select2({
|
|
|
21856
21904
|
{
|
|
21857
21905
|
className: `Cn-Select ${className}`,
|
|
21858
21906
|
sx: {
|
|
21907
|
+
...variant !== "transparent" && {
|
|
21908
|
+
"&.Mui-focused": {
|
|
21909
|
+
backgroundColor: "white"
|
|
21910
|
+
}
|
|
21911
|
+
},
|
|
21859
21912
|
...variant === "transparent" && {
|
|
21860
21913
|
backgroundColor: "transparent",
|
|
21861
21914
|
borderColor: "transparent",
|
|
@@ -23239,6 +23292,7 @@ var SelectPopover = function SelectPopover2({
|
|
|
23239
23292
|
)
|
|
23240
23293
|
}
|
|
23241
23294
|
),
|
|
23295
|
+
itemsTitle,
|
|
23242
23296
|
/* @__PURE__ */ jsx130(
|
|
23243
23297
|
InfiniteScroll,
|
|
23244
23298
|
{
|
|
@@ -23282,7 +23336,6 @@ var SelectPopover = function SelectPopover2({
|
|
|
23282
23336
|
}
|
|
23283
23337
|
},
|
|
23284
23338
|
children: [
|
|
23285
|
-
itemsTitle,
|
|
23286
23339
|
currentItems.map(
|
|
23287
23340
|
(item) => maxSelectedItems ? getItemElement({
|
|
23288
23341
|
item: {
|
|
@@ -23411,8 +23464,6 @@ var ItemSelector = function ItemSelector2({
|
|
|
23411
23464
|
disabled,
|
|
23412
23465
|
helperText,
|
|
23413
23466
|
isError,
|
|
23414
|
-
limitItemChips = 2,
|
|
23415
|
-
itemChipWidth = 150,
|
|
23416
23467
|
isLoading,
|
|
23417
23468
|
isLoadingSubtitle2,
|
|
23418
23469
|
hasMore,
|
|
@@ -23427,6 +23478,7 @@ var ItemSelector = function ItemSelector2({
|
|
|
23427
23478
|
selectableItemComponent,
|
|
23428
23479
|
renderChipLabel = (item) => item.id,
|
|
23429
23480
|
renderItem = (item) => ({
|
|
23481
|
+
...item,
|
|
23430
23482
|
title: item.id,
|
|
23431
23483
|
subtitle1: "",
|
|
23432
23484
|
subtitle2: ""
|
|
@@ -23434,12 +23486,14 @@ var ItemSelector = function ItemSelector2({
|
|
|
23434
23486
|
onChange,
|
|
23435
23487
|
onLoadMore,
|
|
23436
23488
|
onSearch,
|
|
23437
|
-
onClose
|
|
23489
|
+
onClose,
|
|
23490
|
+
getWarningTooltip
|
|
23438
23491
|
}) {
|
|
23439
23492
|
const [anchorEl, setAnchorEl] = React71.useState();
|
|
23440
23493
|
const [searchText, setSearchText] = React71.useState("");
|
|
23441
23494
|
const allShownItemsRef = React71.useRef(items);
|
|
23442
23495
|
const selectRef = React71.useRef(null);
|
|
23496
|
+
const { t } = useTranslation();
|
|
23443
23497
|
React71.useEffect(() => {
|
|
23444
23498
|
if (anchorEl) {
|
|
23445
23499
|
onSearch(searchText);
|
|
@@ -23455,32 +23509,6 @@ var ItemSelector = function ItemSelector2({
|
|
|
23455
23509
|
)
|
|
23456
23510
|
);
|
|
23457
23511
|
}, [items]);
|
|
23458
|
-
const ItemChip = ({
|
|
23459
|
-
item
|
|
23460
|
-
}) => {
|
|
23461
|
-
const [ref, { contentWidth: width2 }] = useResizeObserver();
|
|
23462
|
-
return /* @__PURE__ */ jsx131(
|
|
23463
|
-
Chip_default,
|
|
23464
|
-
{
|
|
23465
|
-
ref,
|
|
23466
|
-
sx: {
|
|
23467
|
-
maxWidth: `${itemChipWidth}px`
|
|
23468
|
-
},
|
|
23469
|
-
label: renderChipLabel(item),
|
|
23470
|
-
size: "S",
|
|
23471
|
-
variant: "dark",
|
|
23472
|
-
tooltip: width2 >= itemChipWidth ? renderChipLabel(item) : void 0,
|
|
23473
|
-
isDeleteable: !disabled && !item.hideDeleteChip,
|
|
23474
|
-
onDelete: () => {
|
|
23475
|
-
onChange(selectedItems.filter((i) => i.id !== item.id));
|
|
23476
|
-
},
|
|
23477
|
-
onMouseDownDelete: (event) => {
|
|
23478
|
-
event.stopPropagation();
|
|
23479
|
-
event.preventDefault();
|
|
23480
|
-
}
|
|
23481
|
-
}
|
|
23482
|
-
);
|
|
23483
|
-
};
|
|
23484
23512
|
const isMultiple = () => !maxSelectedItems || maxSelectedItems > 1;
|
|
23485
23513
|
const getSelectedValue = () => {
|
|
23486
23514
|
if (isMultiple()) {
|
|
@@ -23491,155 +23519,151 @@ var ItemSelector = function ItemSelector2({
|
|
|
23491
23519
|
};
|
|
23492
23520
|
return /* @__PURE__ */ jsxs61(Fragment30, { children: [
|
|
23493
23521
|
/* @__PURE__ */ jsx131(
|
|
23494
|
-
|
|
23522
|
+
Stack_default,
|
|
23495
23523
|
{
|
|
23496
|
-
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
|
|
23502
|
-
|
|
23503
|
-
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
|
|
23507
|
-
|
|
23508
|
-
|
|
23509
|
-
|
|
23510
|
-
|
|
23511
|
-
|
|
23512
|
-
|
|
23513
|
-
|
|
23514
|
-
|
|
23515
|
-
|
|
23516
|
-
|
|
23517
|
-
|
|
23518
|
-
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
|
|
23522
|
-
|
|
23523
|
-
|
|
23524
|
-
|
|
23525
|
-
|
|
23526
|
-
|
|
23527
|
-
|
|
23528
|
-
|
|
23529
|
-
|
|
23530
|
-
|
|
23524
|
+
onClick: () => selectRef.current && setAnchorEl(selectRef.current),
|
|
23525
|
+
children: /* @__PURE__ */ jsx131(
|
|
23526
|
+
Select_default,
|
|
23527
|
+
{
|
|
23528
|
+
ref: selectRef,
|
|
23529
|
+
open: false,
|
|
23530
|
+
multiple: isMultiple(),
|
|
23531
|
+
variant,
|
|
23532
|
+
disabled,
|
|
23533
|
+
options: selectedItems.map((item) => ({
|
|
23534
|
+
value: item.id,
|
|
23535
|
+
label: renderChipLabel(item)
|
|
23536
|
+
})),
|
|
23537
|
+
value: getSelectedValue(),
|
|
23538
|
+
renderValue: (value) => {
|
|
23539
|
+
let component;
|
|
23540
|
+
if (!value || !Array.isArray(value) || value.length === 0) {
|
|
23541
|
+
component = /* @__PURE__ */ jsx131(Fragment30, { children: /* @__PURE__ */ jsx131(
|
|
23542
|
+
Stack_default,
|
|
23543
|
+
{
|
|
23544
|
+
direction: "row",
|
|
23545
|
+
flexWrap: "wrap",
|
|
23546
|
+
padding: "6px 0",
|
|
23547
|
+
children: /* @__PURE__ */ jsx131(
|
|
23548
|
+
Typography_default,
|
|
23549
|
+
{
|
|
23550
|
+
variant: "body2",
|
|
23551
|
+
color: grey600,
|
|
23552
|
+
children: placeholder
|
|
23553
|
+
}
|
|
23554
|
+
)
|
|
23555
|
+
}
|
|
23556
|
+
) });
|
|
23557
|
+
} else {
|
|
23558
|
+
component = /* @__PURE__ */ jsxs61(
|
|
23559
|
+
Stack_default,
|
|
23560
|
+
{
|
|
23561
|
+
direction: "row",
|
|
23562
|
+
alignItems: "center",
|
|
23563
|
+
gap: "8px",
|
|
23564
|
+
width: "100%",
|
|
23565
|
+
justifyContent: "space-between",
|
|
23566
|
+
children: [
|
|
23567
|
+
/* @__PURE__ */ jsx131(Stack_default, { flex: 1, children: /* @__PURE__ */ jsx131(
|
|
23568
|
+
ChipViewer_default,
|
|
23569
|
+
{
|
|
23570
|
+
chipSx: {
|
|
23571
|
+
alignSelf: "center"
|
|
23572
|
+
},
|
|
23573
|
+
chipVariant: "dark",
|
|
23574
|
+
values: value,
|
|
23575
|
+
...!disabled && {
|
|
23576
|
+
onRemoveChip: (event, id) => {
|
|
23577
|
+
onChange(
|
|
23578
|
+
selectedItems.filter(
|
|
23579
|
+
(i) => i.id !== id
|
|
23580
|
+
)
|
|
23581
|
+
);
|
|
23582
|
+
event.stopPropagation();
|
|
23583
|
+
}
|
|
23584
|
+
},
|
|
23585
|
+
numberLines: 1,
|
|
23586
|
+
renderChipLabel: (id) => {
|
|
23587
|
+
const item = selectedItems.find(
|
|
23588
|
+
(i) => i.id === id
|
|
23589
|
+
);
|
|
23590
|
+
return item ? renderChipLabel(item) : "";
|
|
23591
|
+
},
|
|
23592
|
+
getWarningTooltip: (chipId) => {
|
|
23593
|
+
if (getWarningTooltip) {
|
|
23594
|
+
const selectedItem = selectedItems.find(
|
|
23595
|
+
(selectedItem2) => selectedItem2.id === chipId
|
|
23596
|
+
);
|
|
23597
|
+
if (selectedItem) {
|
|
23598
|
+
return getWarningTooltip(
|
|
23599
|
+
selectedItem
|
|
23600
|
+
);
|
|
23601
|
+
}
|
|
23602
|
+
}
|
|
23603
|
+
return "";
|
|
23604
|
+
},
|
|
23605
|
+
forceRecalculate: disabled
|
|
23606
|
+
}
|
|
23607
|
+
) }),
|
|
23608
|
+
!disabled && isMultiple() && value.length > 1 && /* @__PURE__ */ jsx131(
|
|
23609
|
+
Tooltip_default,
|
|
23610
|
+
{
|
|
23611
|
+
title: t("AUTOCOMPLETE.CLEAR"),
|
|
23612
|
+
children: /* @__PURE__ */ jsx131(
|
|
23613
|
+
IconButton_default,
|
|
23614
|
+
{
|
|
23615
|
+
iconId: "close",
|
|
23616
|
+
size: "M",
|
|
23617
|
+
sx: {
|
|
23618
|
+
padding: 0
|
|
23619
|
+
},
|
|
23620
|
+
onClick: (event) => {
|
|
23621
|
+
onChange([]);
|
|
23622
|
+
event.stopPropagation();
|
|
23623
|
+
event.preventDefault();
|
|
23624
|
+
},
|
|
23625
|
+
"data-test": "clear-autocomplete"
|
|
23626
|
+
}
|
|
23627
|
+
)
|
|
23628
|
+
}
|
|
23629
|
+
)
|
|
23630
|
+
]
|
|
23631
|
+
}
|
|
23632
|
+
);
|
|
23633
|
+
}
|
|
23634
|
+
return /* @__PURE__ */ jsxs61(
|
|
23531
23635
|
Stack_default,
|
|
23532
23636
|
{
|
|
23533
23637
|
direction: "row",
|
|
23534
|
-
|
|
23535
|
-
padding: "3px 0",
|
|
23536
|
-
overflow: "hidden",
|
|
23638
|
+
justifyContent: "space-between",
|
|
23537
23639
|
alignItems: "center",
|
|
23538
|
-
|
|
23640
|
+
height: "100%",
|
|
23539
23641
|
children: [
|
|
23540
|
-
|
|
23541
|
-
|
|
23542
|
-
|
|
23543
|
-
);
|
|
23544
|
-
return item ? /* @__PURE__ */ jsx131(
|
|
23545
|
-
ItemChip,
|
|
23546
|
-
{
|
|
23547
|
-
item: {
|
|
23548
|
-
...item,
|
|
23549
|
-
hideDeleteChip: !isMultiple()
|
|
23550
|
-
}
|
|
23551
|
-
},
|
|
23552
|
-
id
|
|
23553
|
-
) : /* @__PURE__ */ jsx131(Fragment30, {});
|
|
23554
|
-
}),
|
|
23555
|
-
value.length - limitItemChips > 0 ? /* @__PURE__ */ jsx131(
|
|
23556
|
-
Tooltip_default,
|
|
23642
|
+
component,
|
|
23643
|
+
/* @__PURE__ */ jsx131(
|
|
23644
|
+
Divider_default,
|
|
23557
23645
|
{
|
|
23558
|
-
|
|
23559
|
-
|
|
23560
|
-
|
|
23561
|
-
Stack_default,
|
|
23562
|
-
{
|
|
23563
|
-
direction: "row",
|
|
23564
|
-
sx: {
|
|
23565
|
-
gap: "8px",
|
|
23566
|
-
alignItems: "center",
|
|
23567
|
-
maxWidth: "300px",
|
|
23568
|
-
flexWrap: "wrap"
|
|
23569
|
-
},
|
|
23570
|
-
children: value.slice(
|
|
23571
|
-
limitItemChips,
|
|
23572
|
-
value.length
|
|
23573
|
-
).map((id) => {
|
|
23574
|
-
const item = selectedItems.find(
|
|
23575
|
-
(i) => i.id === id
|
|
23576
|
-
);
|
|
23577
|
-
return item ? /* @__PURE__ */ jsx131(
|
|
23578
|
-
ItemChip,
|
|
23579
|
-
{
|
|
23580
|
-
item
|
|
23581
|
-
},
|
|
23582
|
-
id
|
|
23583
|
-
) : /* @__PURE__ */ jsx131(Fragment30, {});
|
|
23584
|
-
})
|
|
23585
|
-
}
|
|
23586
|
-
),
|
|
23587
|
-
children: /* @__PURE__ */ jsx131(Typography_default, { variant: "body2", children: `+${value.length - limitItemChips}` })
|
|
23646
|
+
variant: "middle",
|
|
23647
|
+
orientation: "vertical",
|
|
23648
|
+
flexItem: true
|
|
23588
23649
|
}
|
|
23589
|
-
)
|
|
23650
|
+
)
|
|
23590
23651
|
]
|
|
23591
23652
|
}
|
|
23592
|
-
)
|
|
23593
|
-
|
|
23594
|
-
|
|
23595
|
-
|
|
23596
|
-
|
|
23597
|
-
|
|
23598
|
-
|
|
23599
|
-
|
|
23600
|
-
|
|
23601
|
-
|
|
23602
|
-
|
|
23603
|
-
event.preventDefault();
|
|
23604
|
-
onChange([]);
|
|
23605
|
-
},
|
|
23606
|
-
onMouseDown: (event) => {
|
|
23607
|
-
event.stopPropagation();
|
|
23608
|
-
event.preventDefault();
|
|
23609
|
-
}
|
|
23610
|
-
}
|
|
23611
|
-
),
|
|
23612
|
-
/* @__PURE__ */ jsx131(
|
|
23613
|
-
Divider_default,
|
|
23614
|
-
{
|
|
23615
|
-
variant: "middle",
|
|
23616
|
-
orientation: "vertical",
|
|
23617
|
-
flexItem: true
|
|
23618
|
-
}
|
|
23619
|
-
)
|
|
23620
|
-
] })
|
|
23621
|
-
] });
|
|
23622
|
-
}
|
|
23623
|
-
return /* @__PURE__ */ jsx131(
|
|
23624
|
-
Stack_default,
|
|
23625
|
-
{
|
|
23626
|
-
direction: "row",
|
|
23627
|
-
justifyContent: "space-between",
|
|
23628
|
-
alignItems: "center",
|
|
23629
|
-
children: component
|
|
23653
|
+
);
|
|
23654
|
+
},
|
|
23655
|
+
sx: {
|
|
23656
|
+
"& .MuiInputBase-input.MuiSelect-select": {
|
|
23657
|
+
height: "34px",
|
|
23658
|
+
lineHeight: "24px"
|
|
23659
|
+
},
|
|
23660
|
+
width: "100%",
|
|
23661
|
+
...isError ? {
|
|
23662
|
+
borderColor: errorMain
|
|
23663
|
+
} : {}
|
|
23630
23664
|
}
|
|
23631
|
-
|
|
23632
|
-
|
|
23633
|
-
onOpen: () => selectRef.current && setAnchorEl(selectRef.current),
|
|
23634
|
-
sx: {
|
|
23635
|
-
"& .MuiInputBase-input.MuiSelect-select": {
|
|
23636
|
-
height: "34px",
|
|
23637
|
-
lineHeight: "24px"
|
|
23638
|
-
},
|
|
23639
|
-
...isError ? {
|
|
23640
|
-
borderColor: errorMain
|
|
23641
|
-
} : {}
|
|
23642
|
-
}
|
|
23665
|
+
}
|
|
23666
|
+
)
|
|
23643
23667
|
}
|
|
23644
23668
|
),
|
|
23645
23669
|
helperText && /* @__PURE__ */ jsx131(InputHelperText_default, { severity: isError ? "error" : "info", children: helperText }),
|
|
@@ -23662,11 +23686,18 @@ var ItemSelector = function ItemSelector2({
|
|
|
23662
23686
|
isLoading,
|
|
23663
23687
|
isLoadingSubtitle2,
|
|
23664
23688
|
onApply: (itemIds) => {
|
|
23665
|
-
|
|
23666
|
-
|
|
23667
|
-
|
|
23668
|
-
|
|
23689
|
+
const shownItems = allShownItemsRef.current;
|
|
23690
|
+
const shownItemsIds = new Set(
|
|
23691
|
+
allShownItemsRef.current.map((item) => item.id)
|
|
23692
|
+
);
|
|
23693
|
+
const itemIdsSet = new Set(itemIds);
|
|
23694
|
+
const notShownSelectedItems = selectedItems.filter(
|
|
23695
|
+
(item) => !shownItemsIds.has(item.id)
|
|
23696
|
+
);
|
|
23697
|
+
const shownSelectedItems = shownItems.filter(
|
|
23698
|
+
(item) => itemIdsSet.has(item.id)
|
|
23669
23699
|
);
|
|
23700
|
+
onChange([...notShownSelectedItems, ...shownSelectedItems]);
|
|
23670
23701
|
setAnchorEl(void 0);
|
|
23671
23702
|
setSearchText("");
|
|
23672
23703
|
onClose && onClose();
|
|
@@ -25245,6 +25276,7 @@ var PhoneField = React79.forwardRef(function PhoneField2({
|
|
|
25245
25276
|
options: countryCodeOptions,
|
|
25246
25277
|
onChange: onChangeCountryCode,
|
|
25247
25278
|
variant: "rounded",
|
|
25279
|
+
disabled: rest.disabled,
|
|
25248
25280
|
sx: {
|
|
25249
25281
|
":not(:hover)": {
|
|
25250
25282
|
borderRight: "1px solid transparent"
|