@connectif/ui-components 5.2.1 → 5.2.3

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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.2.3] - 2026-02-17
4
+
5
+ ### Added
6
+
7
+ - New prop `alignLeft` for optional alignment of the `Carousel` component.
8
+
9
+ ## [5.2.2] - 2026-02-11
10
+
11
+ ### Added
12
+
13
+ - New icon `map-marker-account`.
14
+ - New prop `showIcon` for optional icon in the `DonutChart` component.
15
+
3
16
  ## [5.2.1] - 2026-02-02
4
17
 
5
18
  ### Fixed
@@ -88,9 +88,13 @@ export type DonutChartProps = {
88
88
  * Function used to set specified tooltip.
89
89
  */
90
90
  getTooltip?: (param: CallbackDataParams) => React.ReactNode;
91
+ /**
92
+ * To show or not the icon.
93
+ */
94
+ showIcon?: boolean;
91
95
  };
92
96
  /**
93
97
  * A donut chart component to display numeric data grouped by categories and series.
94
98
  */
95
- declare const DonutChart: ({ style, isLoading, series, startAngle, innerWidth, tooltipEntryFormatter, getTooltip, onClick }: DonutChartProps) => import("react/jsx-runtime").JSX.Element;
99
+ declare const DonutChart: ({ style, isLoading, series, startAngle, innerWidth, tooltipEntryFormatter, getTooltip, onClick, showIcon }: DonutChartProps) => import("react/jsx-runtime").JSX.Element;
96
100
  export default DonutChart;
@@ -1119,6 +1119,7 @@ export declare const icons: {
1119
1119
  mailbox: string;
1120
1120
  map: string;
1121
1121
  'map-marker': string;
1122
+ 'map-marker-account': string;
1122
1123
  'map-marker-circle': string;
1123
1124
  'map-marker-minus': string;
1124
1125
  'map-marker-multiple': string;
@@ -4,6 +4,7 @@ export type CarouselProps<T> = {
4
4
  renderItem: (item: T, index: number) => React.ReactNode;
5
5
  gap?: number;
6
6
  padding?: number;
7
+ alignment?: 'left' | 'center';
7
8
  };
8
- declare function Carousel<T>({ items, renderItem, gap, padding }: CarouselProps<T>): import("react/jsx-runtime").JSX.Element;
9
+ declare function Carousel<T>({ items, renderItem, gap, padding, alignment }: CarouselProps<T>): import("react/jsx-runtime").JSX.Element;
9
10
  export default Carousel;
package/dist/index.js CHANGED
@@ -1898,6 +1898,7 @@ import {
1898
1898
  mdiMailbox,
1899
1899
  mdiMap,
1900
1900
  mdiMapMarker,
1901
+ mdiMapMarkerAccount,
1901
1902
  mdiMapMarkerCircle,
1902
1903
  mdiMapMarkerMinus,
1903
1904
  mdiMapMarkerMultiple,
@@ -3779,6 +3780,7 @@ var icons = {
3779
3780
  mailbox: mdiMailbox,
3780
3781
  map: mdiMap,
3781
3782
  "map-marker": mdiMapMarker,
3783
+ "map-marker-account": mdiMapMarkerAccount,
3782
3784
  "map-marker-circle": mdiMapMarkerCircle,
3783
3785
  "map-marker-minus": mdiMapMarkerMinus,
3784
3786
  "map-marker-multiple": mdiMapMarkerMultiple,
@@ -12105,6 +12107,7 @@ var EnhancedCard = React32.forwardRef(
12105
12107
  const isCenterColumnAlone = !leftIconId && !rightIconId;
12106
12108
  const cardStyle = {
12107
12109
  ...getCardStyles(size),
12110
+ ...borderless && { border: "none" },
12108
12111
  ...disableHover ? {} : hoverCardStyle,
12109
12112
  cursor: cursor2,
12110
12113
  ...selected && {
@@ -13595,11 +13598,12 @@ var DonutChart = ({
13595
13598
  style: style3,
13596
13599
  isLoading,
13597
13600
  series = [],
13598
- startAngle,
13601
+ startAngle = 20,
13599
13602
  innerWidth,
13600
13603
  tooltipEntryFormatter,
13601
13604
  getTooltip,
13602
- onClick
13605
+ onClick,
13606
+ showIcon
13603
13607
  }) => {
13604
13608
  const mainMetricWidth = 20;
13605
13609
  const comparisonMetricWidth = 10;
@@ -13757,6 +13761,20 @@ var DonutChart = ({
13757
13761
  },
13758
13762
  children: isLoading ? /* @__PURE__ */ jsx75(Skeleton_default, { variant: "rectangular", height: "100%", width: "100%" }) : /* @__PURE__ */ jsxs33(Fragment13, { children: [
13759
13763
  /* @__PURE__ */ jsxs33(Box_default2, { sx: { flexGrow: 1, position: "relative" }, children: [
13764
+ showIcon && /* @__PURE__ */ jsx75(
13765
+ Icon_default,
13766
+ {
13767
+ id: "map-marker-account",
13768
+ size: "L",
13769
+ sx: {
13770
+ position: "absolute",
13771
+ top: 0,
13772
+ left: "50%",
13773
+ transform: "translate(-50%, -50%)",
13774
+ zIndex: 10
13775
+ }
13776
+ }
13777
+ ),
13760
13778
  title,
13761
13779
  /* @__PURE__ */ jsx75(
13762
13780
  ReactEChartsCore3,
@@ -26289,7 +26307,8 @@ function Carousel({
26289
26307
  items,
26290
26308
  renderItem,
26291
26309
  gap: gap2 = 8,
26292
- padding: padding2 = 8
26310
+ padding: padding2 = 8,
26311
+ alignment = "left"
26293
26312
  }) {
26294
26313
  const rootRef = React86.useRef(null);
26295
26314
  const containerRef = React86.useRef(null);
@@ -26300,7 +26319,6 @@ function Carousel({
26300
26319
  const [paddingElement, setPaddingElement] = React86.useState();
26301
26320
  const [visibleCount, setVisibleCount] = React86.useState();
26302
26321
  const showedElementsRef = React86.useRef(void 0);
26303
- const [showedElements, setShowedElements] = React86.useState();
26304
26322
  const updateArrows = React86.useCallback(() => {
26305
26323
  if (!showedElementsRef.current) {
26306
26324
  return;
@@ -26326,7 +26344,6 @@ function Carousel({
26326
26344
  (root, container) => {
26327
26345
  root.style.width = "";
26328
26346
  showedElementsRef.current = void 0;
26329
- setShowedElements(void 0);
26330
26347
  container.scrollTo({ left: 0, behavior: "instant" });
26331
26348
  },
26332
26349
  []
@@ -26339,7 +26356,7 @@ function Carousel({
26339
26356
  return;
26340
26357
  }
26341
26358
  const containerWidth = getUsableWidth(root);
26342
- const initialHorizontalPadding = padding2 * 2;
26359
+ const initialHorizontalPadding = alignment === "left" ? 0 : padding2 * 2;
26343
26360
  let count = 0;
26344
26361
  let accumulatedWidth = initialHorizontalPadding;
26345
26362
  let nextChild = children[nextElementsIndex.start];
@@ -26350,15 +26367,15 @@ function Carousel({
26350
26367
  }
26351
26368
  const addGap = nextElementsIndex.start + count < items.length;
26352
26369
  const diffWidth = containerWidth - accumulatedWidth + initialHorizontalPadding + (addGap ? gap2 : 0);
26353
- setPaddingElement(`${diffWidth / 2}px`);
26370
+ const shouldCenter = alignment === "center" && count === items.length;
26371
+ setPaddingElement(`${shouldCenter ? diffWidth / 2 : 0}px`);
26354
26372
  setVisibleCount(count);
26355
26373
  showedElementsRef.current = nextElementsIndex;
26356
- setShowedElements(nextElementsIndex);
26357
26374
  return {
26358
26375
  childrenWidth: accumulatedWidth
26359
26376
  };
26360
26377
  },
26361
- [gap2, getUsableWidth, items.length, padding2]
26378
+ [alignment, gap2, getUsableWidth, items.length, padding2]
26362
26379
  );
26363
26380
  const updateVisibleCount = React86.useCallback(() => {
26364
26381
  const root = rootRef.current;
@@ -26375,7 +26392,7 @@ function Carousel({
26375
26392
  return;
26376
26393
  }
26377
26394
  const containerWidth = getUsableWidth(root);
26378
- const initialHorizontalPadding = padding2 * 2;
26395
+ const initialHorizontalPadding = alignment === "left" ? 0 : padding2 * 2;
26379
26396
  let count = 0;
26380
26397
  let accumulatedWidth = initialHorizontalPadding;
26381
26398
  for (const child of children) {
@@ -26388,12 +26405,12 @@ function Carousel({
26388
26405
  }
26389
26406
  const addGap = count < items.length;
26390
26407
  const diffWidth = containerWidth - accumulatedWidth + initialHorizontalPadding + (addGap ? gap2 : 0);
26391
- const newPaddingSize = `${diffWidth / 2}px`;
26408
+ const shouldCenter = alignment === "center" && count === items.length;
26409
+ const newPaddingSize = `${shouldCenter ? diffWidth / 2 : 0}px`;
26392
26410
  setPaddingElement(newPaddingSize);
26393
26411
  setVisibleCount(count);
26394
26412
  const newVisible = { start: 0, end: count - 1 };
26395
26413
  showedElementsRef.current = newVisible;
26396
- setShowedElements(newVisible);
26397
26414
  if (root) {
26398
26415
  root.style.width = `${containerWidth}px`;
26399
26416
  }
@@ -26403,6 +26420,7 @@ function Carousel({
26403
26420
  padding2,
26404
26421
  items.length,
26405
26422
  gap2,
26423
+ alignment,
26406
26424
  updateArrows,
26407
26425
  resetCarousel
26408
26426
  ]);
@@ -26474,7 +26492,7 @@ function Carousel({
26474
26492
  };
26475
26493
  const scrollHorizontal = ({
26476
26494
  elementsIndex
26477
- }, direction) => {
26495
+ }) => {
26478
26496
  const container = containerRef.current;
26479
26497
  const root = rootRef.current;
26480
26498
  if (!container || !root) {
@@ -26482,17 +26500,13 @@ function Carousel({
26482
26500
  }
26483
26501
  const newMeasures = setMeasures(root, container, elementsIndex);
26484
26502
  if (newMeasures) {
26485
- const scrollLeft = (elementsIndex.end < items.length - 1 ? container.scrollLeft + container.clientWidth : container.scrollWidth - newMeasures.childrenWidth) + padding2 * 2;
26486
- const targetLeft = direction === "right" ? scrollLeft : Math.max(
26487
- container.scrollLeft - newMeasures.childrenWidth,
26488
- 0
26489
- );
26503
+ const targetItem = container.children[elementsIndex.start];
26504
+ const targetLeft = targetItem?.offsetLeft ?? 0;
26490
26505
  waitForSmoothScrollEnd(container, () => {
26491
26506
  isScrolling.current = false;
26492
26507
  updateArrows();
26493
26508
  });
26494
26509
  showedElementsRef.current = elementsIndex;
26495
- setShowedElements(elementsIndex);
26496
26510
  container.scrollTo({ left: targetLeft, behavior: "smooth" });
26497
26511
  }
26498
26512
  };
@@ -26527,7 +26541,7 @@ function Carousel({
26527
26541
  elementsIndex: { start, end }
26528
26542
  };
26529
26543
  }
26530
- scrollHorizontal(scrollData, direction);
26544
+ scrollHorizontal(scrollData);
26531
26545
  };
26532
26546
  return /* @__PURE__ */ jsx151(Box_default2, { ref: rootRef, width: "100%", children: /* @__PURE__ */ jsxs80(
26533
26547
  Box_default2,
@@ -26535,9 +26549,9 @@ function Carousel({
26535
26549
  sx: {
26536
26550
  position: "relative",
26537
26551
  alignSelf: "center",
26538
- padding: `${padding2}px`,
26539
- ...paddingElement && {
26540
- padding: `${padding2}px ${paddingElement}`
26552
+ padding: `${alignment === "left" ? 0 : padding2}px`,
26553
+ ...(paddingElement || alignment === "left") && {
26554
+ padding: `${alignment === "left" ? 0 : padding2}px ${paddingElement || "0px"}`
26541
26555
  }
26542
26556
  },
26543
26557
  children: [
@@ -26559,6 +26573,7 @@ function Carousel({
26559
26573
  {
26560
26574
  ref: containerRef,
26561
26575
  sx: {
26576
+ position: "relative",
26562
26577
  width: "100%",
26563
26578
  overflowX: "hidden",
26564
26579
  display: "flex",
@@ -26571,9 +26586,6 @@ function Carousel({
26571
26586
  Box_default2,
26572
26587
  {
26573
26588
  sx: {
26574
- ...showedElements && (index < showedElements.start || index > showedElements.end) && {
26575
- opacity: 0
26576
- },
26577
26589
  transition: "opacity 0.5s ease"
26578
26590
  },
26579
26591
  children: renderItem(item, index)