@connectif/ui-components 5.4.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,12 @@
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
+
3
10
  ## [5.4.0] - 2026-02-20
4
11
 
5
12
  ### Fixed
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
@@ -22556,7 +22572,6 @@ var CategorizedPicker = function CategorizedPicker2({
22556
22572
  placeholder: t(
22557
22573
  "CATEGORIZED_PICKER.SEARCH_PLACEHOLDER"
22558
22574
  ),
22559
- value: "",
22560
22575
  onChange: onTypeSearch,
22561
22576
  startAdornment: /* @__PURE__ */ jsx126(Icon_default, { id: "magnify" }),
22562
22577
  "data-testid": dataTestId ? dataTestId + "-search-input" : void 0
@@ -27225,7 +27240,7 @@ import MuiTabs from "@mui/material/Tabs";
27225
27240
 
27226
27241
  // src/components/layout/SwipeableViews.tsx
27227
27242
  import * as React90 from "react";
27228
- 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";
27229
27244
  import { jsx as jsx162 } from "react/jsx-runtime";
27230
27245
  var styles = {
27231
27246
  container: {
@@ -27259,11 +27274,11 @@ function SwipeableViews({
27259
27274
  disableScroll = false,
27260
27275
  ...rootProps
27261
27276
  }) {
27262
- const containerRef = useRef29(null);
27263
- const scrollTimeout = useRef29(null);
27264
- const scrollingMethod = useRef29("none");
27277
+ const containerRef = useRef30(null);
27278
+ const scrollTimeout = useRef30(null);
27279
+ const scrollingMethod = useRef30("none");
27265
27280
  const [previousIndex, setPreviousIndex] = useState36(index);
27266
- const hideScrollAnimation = useRef29(true);
27281
+ const hideScrollAnimation = useRef30(true);
27267
27282
  useEffect25(() => {
27268
27283
  if (containerRef.current) {
27269
27284
  if (scrollingMethod.current === "manual") {
@@ -28426,31 +28441,31 @@ var MinimizableWindow = React95.forwardRef(function MinimizableWindow2({
28426
28441
  var MinimizableWindow_default = MinimizableWindow;
28427
28442
 
28428
28443
  // src/hooks/useFormatters.ts
28429
- import { useCallback as useCallback22, useContext as useContext16 } from "react";
28444
+ import { useCallback as useCallback23, useContext as useContext16 } from "react";
28430
28445
  var useFormatters = () => {
28431
28446
  const { locale, currency, timezone } = useContext16(IntlContext);
28432
28447
  return {
28433
- formatCompactNumber: useCallback22(
28448
+ formatCompactNumber: useCallback23(
28434
28449
  (value) => formatCompactNumber(value, locale),
28435
28450
  [locale]
28436
28451
  ),
28437
- formatNumber: useCallback22(
28452
+ formatNumber: useCallback23(
28438
28453
  (value, fractionSize) => formatNumber(value, locale, fractionSize),
28439
28454
  [locale]
28440
28455
  ),
28441
- formatPercentage: useCallback22(
28456
+ formatPercentage: useCallback23(
28442
28457
  (value, fractionSize) => formatPercentage(value, locale, fractionSize),
28443
28458
  [locale]
28444
28459
  ),
28445
- formatCurrency: useCallback22(
28460
+ formatCurrency: useCallback23(
28446
28461
  (value, notation) => formatCurrency(value, locale, currency, notation),
28447
28462
  [currency, locale]
28448
28463
  ),
28449
- formatDate: useCallback22(
28464
+ formatDate: useCallback23(
28450
28465
  (date, format2) => formatDate(date, locale, timezone, format2),
28451
28466
  [locale, timezone]
28452
28467
  ),
28453
- formatPhone: useCallback22(
28468
+ formatPhone: useCallback23(
28454
28469
  (phone, format2) => formatPhone(phone, format2),
28455
28470
  []
28456
28471
  )