@connectif/ui-components 6.0.6 → 6.0.7

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.0.7] - 2026-04-09
4
+
5
+ ### Fixed
6
+
7
+ - Fixed crash when rendering a chip with a tooltip.
8
+
9
+ ### Changed
10
+
11
+ - `DateIntervalPicker` with input variant now supports selecting future dates.
12
+
3
13
  ## [6.0.6] - 2026-04-08
4
14
 
5
15
  ### Fixed
@@ -95,12 +95,16 @@ export type DateIntervalPickerProps = (DateIntervalPickerDefault | DateIntervalP
95
95
  disabled?: boolean;
96
96
  /**
97
97
  * The minimum date allowed to be selected in the date interval.
98
- * By default it will be the maxDate minus the maxSelectableDays
98
+ * By default:
99
+ * Input variant: it will allow selecting dates from 1900-01-01 in input.
100
+ * Other variant: it will be the maxDate minus the maxSelectableDays
99
101
  */
100
102
  minDate?: Date;
101
103
  /**
102
104
  * The maximum date allowed to be selected in the date interval.
103
- * By default it will be the current date
105
+ * By default:
106
+ * Input variant: it will be the current date, or 2100-12-31 when maxDate is not provided.
107
+ * Other variant: it will be the current date
104
108
  */
105
109
  maxDate?: Date;
106
110
  };
@@ -4,10 +4,12 @@ export type DateIntervalRangeSelectorProps = {
4
4
  color: string;
5
5
  minDate: Date;
6
6
  maxDate: Date;
7
+ maxSelectableDays: number;
8
+ handleSelectionLimits?: boolean;
7
9
  comparisonColor: string;
8
10
  intersectionColor: string;
9
11
  showTime: boolean;
10
12
  onChange: (state: DateIntervalPickerState) => void;
11
13
  };
12
- declare const DateIntervalRangeSelector: ({ state, color, minDate, maxDate, comparisonColor, intersectionColor, showTime, onChange }: DateIntervalRangeSelectorProps) => import("react/jsx-runtime").JSX.Element;
14
+ declare const DateIntervalRangeSelector: ({ state, color, minDate, maxDate, maxSelectableDays, handleSelectionLimits, comparisonColor, intersectionColor, showTime, onChange }: DateIntervalRangeSelectorProps) => import("react/jsx-runtime").JSX.Element;
13
15
  export default DateIntervalRangeSelector;
package/dist/index.js CHANGED
@@ -11126,17 +11126,20 @@ var Chip = React28.forwardRef(function Chip2({
11126
11126
  };
11127
11127
  const iconSizeCurrent = iconSize ?? iconSizes3[size];
11128
11128
  const variantStyles3 = getVariantStyles(theme2, variant);
11129
- const getIcon = (iconId2) => /* @__PURE__ */ jsx55(Tooltip_default, { title: iconTooltip || "", children: /* @__PURE__ */ jsx55(
11130
- Icon_default,
11131
- {
11132
- id: iconId2,
11133
- size: iconSizeCurrent,
11134
- sx: {
11135
- color: iconColor ?? variantStyles3.iconColor,
11136
- cursor: !onClick ? "default" : void 0
11129
+ const getIcon = (iconId2) => {
11130
+ const icon = /* @__PURE__ */ jsx55(
11131
+ Icon_default,
11132
+ {
11133
+ id: iconId2,
11134
+ size: iconSizeCurrent,
11135
+ sx: {
11136
+ color: iconColor ?? variantStyles3.iconColor,
11137
+ cursor: !onClick ? "default" : void 0
11138
+ }
11137
11139
  }
11138
- }
11139
- ) });
11140
+ );
11141
+ return iconTooltip ? /* @__PURE__ */ jsx55(Tooltip_default, { title: iconTooltip, children: icon }) : icon;
11142
+ };
11140
11143
  const deleteIcon = /* @__PURE__ */ jsxs21(Stack_default, { direction: "row", alignItems: "center", children: [
11141
11144
  iconId && iconRight && getIcon(iconId),
11142
11145
  isDeleteable && onDelete && /* @__PURE__ */ jsx55(
@@ -20481,6 +20484,8 @@ var DateIntervalRangeSelector = ({
20481
20484
  color: color2,
20482
20485
  minDate,
20483
20486
  maxDate,
20487
+ maxSelectableDays,
20488
+ handleSelectionLimits = false,
20484
20489
  comparisonColor,
20485
20490
  intersectionColor,
20486
20491
  showTime,
@@ -20490,8 +20495,14 @@ var DateIntervalRangeSelector = ({
20490
20495
  const dateInputFormat = getDateInputFormatForLocale(locale);
20491
20496
  const { t } = useTranslation();
20492
20497
  const dateInputFormatPlaceholder = dateInputFormat.replace(/Y/g, t("DATE_COMPONENTS.YEAR_LETTER")).replace(/M/g, t("DATE_COMPONENTS.MONTH_LETTER")).replace(/D/g, t("DATE_COMPONENTS.DAY_LETTER"));
20493
- const minDateTz = tz4(minDate, timezone);
20494
- const maxDateTz = tz4(maxDate, timezone);
20498
+ const [minDateTz, setMinDateTz] = React58.useState(tz4(minDate, timezone));
20499
+ const [maxDateTz, setMaxDateTz] = React58.useState(tz4(maxDate, timezone));
20500
+ React58.useEffect(() => {
20501
+ setMinDateTz(tz4(minDate, timezone));
20502
+ }, [minDate, timezone]);
20503
+ React58.useEffect(() => {
20504
+ setMaxDateTz(tz4(maxDate, timezone));
20505
+ }, [maxDate, timezone]);
20495
20506
  const formatSimpleDate = (date) => tz4(
20496
20507
  { year: date.year, month: date.month, date: date.day },
20497
20508
  timezone
@@ -20701,7 +20712,25 @@ var DateIntervalRangeSelector = ({
20701
20712
  const date = getSimpleDateFromString(value);
20702
20713
  onChange(setDateOnFocusableInput(date, focusableInput));
20703
20714
  };
20715
+ const setLimitDates = (date) => {
20716
+ if (!date || !maxSelectableDays) {
20717
+ setMinDateTz(tz4(minDate, timezone));
20718
+ setMaxDateTz(tz4(maxDate, timezone));
20719
+ return;
20720
+ }
20721
+ const baseDate = tz4(
20722
+ { year: date.year, month: date.month, date: date.day },
20723
+ timezone
20724
+ );
20725
+ setMinDateTz(baseDate);
20726
+ setMaxDateTz(tz4(baseDate, timezone).add(maxSelectableDays - 1, "days"));
20727
+ };
20704
20728
  const handleSelectDate = (date) => {
20729
+ if (handleSelectionLimits) {
20730
+ setLimitDates(
20731
+ state.highlightedInput === "startDate" ? date : void 0
20732
+ );
20733
+ }
20705
20734
  const newState = setDateOnFocusableInput(date, state.highlightedInput);
20706
20735
  moveFocusToFollowingInput(newState);
20707
20736
  };
@@ -20859,7 +20888,7 @@ var DateIntervalRangeSelector = ({
20859
20888
  ] : []
20860
20889
  ],
20861
20890
  intersectionColor,
20862
- focusedDate: state.focusedDateInCalendar,
20891
+ focusedDate: state.focusedDateInCalendar ?? dateToSimpleDate(tz4(timezone).toDate(), timezone),
20863
20892
  onSelect: handleSelectDate
20864
20893
  }
20865
20894
  )
@@ -21160,6 +21189,8 @@ var DateIntervalPickerPopover = ({
21160
21189
  intersectionColor,
21161
21190
  maxDate,
21162
21191
  minDate,
21192
+ maxSelectableDays,
21193
+ handleSelectionLimits: variant === "input",
21163
21194
  showTime: !!showTime,
21164
21195
  onChange: setState
21165
21196
  }
@@ -21395,6 +21426,8 @@ var DateIntervalPickerInputButton_default = DateIntervalPickerInputButton;
21395
21426
 
21396
21427
  // src/components/input/date-interval-picker/DateIntervalPicker.tsx
21397
21428
  import { jsx as jsx116, jsxs as jsxs54 } from "react/jsx-runtime";
21429
+ var DEFAULT_MIN_DATE = { year: 1900, month: 0, date: 1 };
21430
+ var DEFAULT_MAX_DATE = { year: 2100, month: 11, date: 31 };
21398
21431
  var DateIntervalPicker = ({
21399
21432
  color: color2,
21400
21433
  maxSelectableDays,
@@ -21425,8 +21458,8 @@ var DateIntervalPicker = ({
21425
21458
  }
21426
21459
  setAnchorEl(null);
21427
21460
  };
21428
- const internalMaxDate = maxDate ?? tz7(timezone).toDate();
21429
- const internalMinDate = minDate ?? tz7(internalMaxDate, timezone).subtract(maxSelectableDays - 1, "days").toDate();
21461
+ const internalMaxDate = maxDate ?? (rest.variant !== "input" ? tz7(timezone).toDate() : tz7(DEFAULT_MAX_DATE, timezone).toDate());
21462
+ const internalMinDate = minDate ?? (rest.variant !== "input" ? tz7(internalMaxDate, timezone).subtract(maxSelectableDays - 1, "days").toDate() : tz7(DEFAULT_MIN_DATE, timezone).toDate());
21430
21463
  const displayEndDate = rest.endDate !== void 0 ? rest.variant !== "input" ? getDisplayEndDate(rest.endDate, timezone, !!rest.showTime) : rest.endDate : void 0;
21431
21464
  const isEndDateVisible = displayEndDate !== void 0 && !isSameDate(rest.startDate, displayEndDate);
21432
21465
  return /* @__PURE__ */ jsxs54("div", { style: { display: "inline-flex" }, children: [
@@ -23175,7 +23208,7 @@ import * as React71 from "react";
23175
23208
  // src/components/input/SelectPopover.tsx
23176
23209
  import * as React70 from "react";
23177
23210
  import { Grid as Grid4, Stack as Stack12 } from "@mui/material";
23178
- import { useState as useState27 } from "react";
23211
+ import { useState as useState28 } from "react";
23179
23212
  import InfiniteScroll from "react-infinite-scroll-component";
23180
23213
  import { jsx as jsx130, jsxs as jsxs60 } from "react/jsx-runtime";
23181
23214
  var defaultItemsColorStyles = {
@@ -23213,9 +23246,9 @@ var SelectPopover = function SelectPopover2({
23213
23246
  itemsTitle
23214
23247
  }) {
23215
23248
  const { t } = useTranslation();
23216
- const [searchText, setSearchText] = useState27("");
23217
- const [isScrollBottom, setIsScrollBottom] = useState27(false);
23218
- const [currentItems, setCurrentItems] = useState27([]);
23249
+ const [searchText, setSearchText] = useState28("");
23250
+ const [isScrollBottom, setIsScrollBottom] = useState28(false);
23251
+ const [currentItems, setCurrentItems] = useState28([]);
23219
23252
  const [currentSelectedItems, setCurrentSelectedItems] = React70.useState([]);
23220
23253
  const prevSelectedItemsIdsRef = React70.useRef([]);
23221
23254
  const onSearchTextChanged = (text) => {
@@ -27746,7 +27779,7 @@ import MuiTabs from "@mui/material/Tabs";
27746
27779
 
27747
27780
  // src/components/layout/SwipeableViews.tsx
27748
27781
  import * as React93 from "react";
27749
- import { useEffect as useEffect26, useRef as useRef32, useState as useState38 } from "react";
27782
+ import { useEffect as useEffect27, useRef as useRef32, useState as useState39 } from "react";
27750
27783
  import { jsx as jsx165 } from "react/jsx-runtime";
27751
27784
  var styles = {
27752
27785
  container: {
@@ -27783,9 +27816,9 @@ function SwipeableViews({
27783
27816
  const containerRef = useRef32(null);
27784
27817
  const scrollTimeout = useRef32(null);
27785
27818
  const scrollingMethod = useRef32("none");
27786
- const [previousIndex, setPreviousIndex] = useState38(index);
27819
+ const [previousIndex, setPreviousIndex] = useState39(index);
27787
27820
  const hideScrollAnimation = useRef32(true);
27788
- useEffect26(() => {
27821
+ useEffect27(() => {
27789
27822
  if (containerRef.current) {
27790
27823
  if (scrollingMethod.current === "manual") {
27791
27824
  scrollingMethod.current = "none";
@@ -28410,7 +28443,7 @@ var Toolbar_default = Toolbar;
28410
28443
 
28411
28444
  // src/components/toolbar/ToolbarTitle.tsx
28412
28445
  import * as React97 from "react";
28413
- import { useState as useState41 } from "react";
28446
+ import { useState as useState42 } from "react";
28414
28447
  import { jsx as jsx180, jsxs as jsxs87 } from "react/jsx-runtime";
28415
28448
  var ToolbarTitle = React97.forwardRef(function ToolbarTitle2({
28416
28449
  title,
@@ -28422,7 +28455,7 @@ var ToolbarTitle = React97.forwardRef(function ToolbarTitle2({
28422
28455
  const textElementRef = React97.useRef(
28423
28456
  null
28424
28457
  );
28425
- const [showHoverActions, setShowHoverActions] = useState41(false);
28458
+ const [showHoverActions, setShowHoverActions] = useState42(false);
28426
28459
  return /* @__PURE__ */ jsx180(Box_default2, { sx: { maxWidth: "100%" }, children: /* @__PURE__ */ jsx180(
28427
28460
  TextEllipsisTooltip_default,
28428
28461
  {