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