@connectif/ui-components 5.3.0 → 5.4.1

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,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.4.1] - 2026-02-25
4
+
5
+ ### Fixed
6
+
7
+ - Fixed selection in the `Select` component when is virtualized.
8
+ - Fixed unnecessary renders in `DebouncedTextField` component when set value.
9
+
10
+ ## [5.4.0] - 2026-02-20
11
+
12
+ ### Fixed
13
+
14
+ - Fixed a bug in the `Select` component when options had no label.
15
+ - Added scroll to the selected category in `CategorizedPicker`.
16
+ - Removed the background color in the `CategorizedPicker` component when it was focused.
17
+
18
+ ### Added
19
+
20
+ - Extended the `CategorizedPicker` component options to include an optional `onOpen` method that is triggered when the picker opens.
21
+
3
22
  ## [5.3.0] - 2026-02-18
4
23
 
5
24
  ### Added
@@ -8,7 +8,8 @@ export type CategorizedPickerProps<T extends CategorizedPickerBaseOption> = {
8
8
  disabled?: boolean;
9
9
  sx?: SxProps;
10
10
  dataTestId?: string;
11
+ onOpen?: () => void;
11
12
  onChange: (value: T, groupDataId?: string) => void;
12
13
  };
13
- declare const CategorizedPicker: <T extends CategorizedPickerBaseOption>({ value, options, categories, placeholder, disabled, sx, dataTestId, onChange }: CategorizedPickerProps<T>) => import("react/jsx-runtime").JSX.Element;
14
+ declare const CategorizedPicker: <T extends CategorizedPickerBaseOption>({ value, options, categories, placeholder, disabled, sx, dataTestId, onOpen, onChange }: CategorizedPickerProps<T>) => import("react/jsx-runtime").JSX.Element;
14
15
  export default CategorizedPicker;
package/dist/index.js CHANGED
@@ -19563,17 +19563,23 @@ var TextField_default = TextField;
19563
19563
  // src/components/input/DebouncedTextField.tsx
19564
19564
  import { jsx as jsx102 } from "react/jsx-runtime";
19565
19565
  var DebouncedTextField = React53.forwardRef(function DebouncedTextField2({ value, onChange, debounce = 100, ...rest }, ref) {
19566
- const [text, setText] = useState17(value);
19566
+ const [text, setText] = useState17(value ?? "");
19567
+ const expectedChangeRef = React53.useRef(void 0);
19567
19568
  const onChangeDebounced = useDebouncedCallback(
19568
19569
  (e) => {
19569
19570
  if (onChange) {
19570
19571
  onChange(e);
19572
+ expectedChangeRef.current = e.target.value;
19571
19573
  }
19572
19574
  },
19573
19575
  debounce
19574
19576
  );
19575
19577
  useEffect12(() => {
19576
- setText(value);
19578
+ if (expectedChangeRef.current === value) {
19579
+ expectedChangeRef.current = void 0;
19580
+ } else {
19581
+ setText(value ?? "");
19582
+ }
19577
19583
  }, [value]);
19578
19584
  return /* @__PURE__ */ jsx102(
19579
19585
  TextField_default,
@@ -21234,7 +21240,9 @@ import * as React60 from "react";
21234
21240
  import { styled as styled7 } from "@mui/material/styles";
21235
21241
  import MuiSelect from "@mui/material/Select";
21236
21242
  import InputBase from "@mui/material/InputBase";
21237
- import { FixedSizeList as FixedSizeList2 } from "react-window";
21243
+ import {
21244
+ FixedSizeList as FixedSizeList2
21245
+ } from "react-window";
21238
21246
  import AutoSizer4 from "react-virtualized-auto-sizer";
21239
21247
  import { jsx as jsx115 } from "react/jsx-runtime";
21240
21248
  var BootstrapInput = styled7(InputBase, {
@@ -21353,6 +21361,14 @@ var Select = function Select2({
21353
21361
  const valueIndex = options.findIndex(
21354
21362
  (op) => op.value === currentValue
21355
21363
  );
21364
+ const listCallbackRef = React60.useCallback(
21365
+ (list) => {
21366
+ if (list && valueIndex >= 0) {
21367
+ list.scrollToItem(valueIndex, "auto");
21368
+ }
21369
+ },
21370
+ [valueIndex]
21371
+ );
21356
21372
  const defaultVirtualizedProps = {
21357
21373
  width: 250,
21358
21374
  overscanCount: 3,
@@ -21388,7 +21404,7 @@ var Select = function Select2({
21388
21404
  ...style3
21389
21405
  },
21390
21406
  baseSx: {
21391
- backgroundColor: isSelected ? menuColors?.selectedColor : "transparent",
21407
+ backgroundColor: isSelected ? menuColors?.selectedColor ?? primary50 : "transparent",
21392
21408
  color: menuColors?.color
21393
21409
  },
21394
21410
  ...rest2
@@ -21486,10 +21502,10 @@ var Select = function Select2({
21486
21502
  children: /* @__PURE__ */ jsx115(AutoSizer4, { disableWidth: true, children: ({ height: height2 }) => /* @__PURE__ */ jsx115(
21487
21503
  FixedSizeList2,
21488
21504
  {
21505
+ ref: listCallbackRef,
21489
21506
  height: height2,
21490
21507
  itemCount: options.length,
21491
21508
  className: "Slim-Vertical-Scroll",
21492
- initialScrollOffset: valueIndex * itemSize,
21493
21509
  ...defaultVirtualizedProps,
21494
21510
  ...virtualizedProps,
21495
21511
  children: ListItemButtonWrapper
@@ -21597,7 +21613,7 @@ var Select = function Select2({
21597
21613
  return /* @__PURE__ */ jsx115(
21598
21614
  SelectOption,
21599
21615
  {
21600
- label: label ?? value?.toString() ?? "",
21616
+ label: label ?? optionValue?.toString() ?? "",
21601
21617
  value: optionValue,
21602
21618
  id: optionValue,
21603
21619
  colors: !menuColors?.selectedColor ? {
@@ -22381,9 +22397,13 @@ var CategorizedPicker = function CategorizedPicker2({
22381
22397
  disabled = false,
22382
22398
  sx,
22383
22399
  dataTestId,
22400
+ onOpen,
22384
22401
  onChange
22385
22402
  }) {
22386
22403
  const { t } = useTranslation();
22404
+ const categoryRefs = React66.useRef(
22405
+ {}
22406
+ );
22387
22407
  const anchorRef = React66.useRef(null);
22388
22408
  const [open, setOpen] = React66.useState(false);
22389
22409
  const [search, setSearch] = React66.useState("");
@@ -22414,7 +22434,8 @@ var CategorizedPicker = function CategorizedPicker2({
22414
22434
  setOpen(true);
22415
22435
  setSearch("");
22416
22436
  setSelectedCategory(getDefaultSelectedCategory());
22417
- }, [getDefaultSelectedCategory]);
22437
+ onOpen?.();
22438
+ }, [getDefaultSelectedCategory, onOpen]);
22418
22439
  const closePopover = React66.useCallback(() => {
22419
22440
  setOpen(false);
22420
22441
  }, []);
@@ -22471,6 +22492,9 @@ var CategorizedPicker = function CategorizedPicker2({
22471
22492
  height: "34px",
22472
22493
  lineHeight: "34px"
22473
22494
  },
22495
+ "&.MuiInputBase-root.Mui-focused": {
22496
+ background: white
22497
+ },
22474
22498
  ...sx
22475
22499
  },
22476
22500
  value: value?.name || "",
@@ -22507,6 +22531,19 @@ var CategorizedPicker = function CategorizedPicker2({
22507
22531
  vertical: "top",
22508
22532
  horizontal: "left"
22509
22533
  },
22534
+ slotProps: {
22535
+ transition: {
22536
+ onEntered: () => {
22537
+ if (!selectedCategory) {
22538
+ return;
22539
+ }
22540
+ const el = categoryRefs.current[selectedCategory.name];
22541
+ el?.scrollIntoView({
22542
+ behavior: "smooth"
22543
+ });
22544
+ }
22545
+ }
22546
+ },
22510
22547
  transformOrigin: {
22511
22548
  vertical: "top",
22512
22549
  horizontal: "left"
@@ -22535,7 +22572,6 @@ var CategorizedPicker = function CategorizedPicker2({
22535
22572
  placeholder: t(
22536
22573
  "CATEGORIZED_PICKER.SEARCH_PLACEHOLDER"
22537
22574
  ),
22538
- value: "",
22539
22575
  onChange: onTypeSearch,
22540
22576
  startAdornment: /* @__PURE__ */ jsx126(Icon_default, { id: "magnify" }),
22541
22577
  "data-testid": dataTestId ? dataTestId + "-search-input" : void 0
@@ -22555,6 +22591,9 @@ var CategorizedPicker = function CategorizedPicker2({
22555
22591
  children: /* @__PURE__ */ jsx126(Stack11, { children: filteredCategories.map((category, idx) => /* @__PURE__ */ jsx126(
22556
22592
  ListItemButton_default,
22557
22593
  {
22594
+ ref: (el) => {
22595
+ categoryRefs.current[category.name] = el;
22596
+ },
22558
22597
  selected: selectedCategory === category,
22559
22598
  onClick: () => {
22560
22599
  setSelectedCategory(category);
@@ -27201,7 +27240,7 @@ import MuiTabs from "@mui/material/Tabs";
27201
27240
 
27202
27241
  // src/components/layout/SwipeableViews.tsx
27203
27242
  import * as React90 from "react";
27204
- import { useEffect as useEffect25, useRef as useRef29, useState as useState36 } from "react";
27243
+ import { useEffect as useEffect25, useRef as useRef30, useState as useState36 } from "react";
27205
27244
  import { jsx as jsx162 } from "react/jsx-runtime";
27206
27245
  var styles = {
27207
27246
  container: {
@@ -27235,11 +27274,11 @@ function SwipeableViews({
27235
27274
  disableScroll = false,
27236
27275
  ...rootProps
27237
27276
  }) {
27238
- const containerRef = useRef29(null);
27239
- const scrollTimeout = useRef29(null);
27240
- const scrollingMethod = useRef29("none");
27277
+ const containerRef = useRef30(null);
27278
+ const scrollTimeout = useRef30(null);
27279
+ const scrollingMethod = useRef30("none");
27241
27280
  const [previousIndex, setPreviousIndex] = useState36(index);
27242
- const hideScrollAnimation = useRef29(true);
27281
+ const hideScrollAnimation = useRef30(true);
27243
27282
  useEffect25(() => {
27244
27283
  if (containerRef.current) {
27245
27284
  if (scrollingMethod.current === "manual") {
@@ -28402,31 +28441,31 @@ var MinimizableWindow = React95.forwardRef(function MinimizableWindow2({
28402
28441
  var MinimizableWindow_default = MinimizableWindow;
28403
28442
 
28404
28443
  // src/hooks/useFormatters.ts
28405
- import { useCallback as useCallback22, useContext as useContext16 } from "react";
28444
+ import { useCallback as useCallback23, useContext as useContext16 } from "react";
28406
28445
  var useFormatters = () => {
28407
28446
  const { locale, currency, timezone } = useContext16(IntlContext);
28408
28447
  return {
28409
- formatCompactNumber: useCallback22(
28448
+ formatCompactNumber: useCallback23(
28410
28449
  (value) => formatCompactNumber(value, locale),
28411
28450
  [locale]
28412
28451
  ),
28413
- formatNumber: useCallback22(
28452
+ formatNumber: useCallback23(
28414
28453
  (value, fractionSize) => formatNumber(value, locale, fractionSize),
28415
28454
  [locale]
28416
28455
  ),
28417
- formatPercentage: useCallback22(
28456
+ formatPercentage: useCallback23(
28418
28457
  (value, fractionSize) => formatPercentage(value, locale, fractionSize),
28419
28458
  [locale]
28420
28459
  ),
28421
- formatCurrency: useCallback22(
28460
+ formatCurrency: useCallback23(
28422
28461
  (value, notation) => formatCurrency(value, locale, currency, notation),
28423
28462
  [currency, locale]
28424
28463
  ),
28425
- formatDate: useCallback22(
28464
+ formatDate: useCallback23(
28426
28465
  (date, format2) => formatDate(date, locale, timezone, format2),
28427
28466
  [locale, timezone]
28428
28467
  ),
28429
- formatPhone: useCallback22(
28468
+ formatPhone: useCallback23(
28430
28469
  (phone, format2) => formatPhone(phone, format2),
28431
28470
  []
28432
28471
  )