lecom-ui 5.3.78 → 5.3.80

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/README.md CHANGED
@@ -1 +1 @@
1
- lecom-ui
1
+ lecom-ui
@@ -69,7 +69,7 @@ const comboboxItemVariants = cva(
69
69
  false: ""
70
70
  },
71
71
  selected: {
72
- true: "bg-grey-100 font-medium text-grey-900",
72
+ true: "bg-grey-100 text-grey-900",
73
73
  false: ""
74
74
  }
75
75
  },
@@ -241,7 +241,7 @@ const ComboboxTriggerButton = React.forwardRef(
241
241
  disabled: disabled ?? false,
242
242
  ...props
243
243
  },
244
- /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 truncate max-w-[calc(100%-2.5rem)]" }, selectedPrefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center shrink-0" }, selectedPrefix), /* @__PURE__ */ React.createElement(
244
+ /* @__PURE__ */ React.createElement("div", { className: cn("flex items-center gap-2 truncate min-w-[calc(100%-2.25rem)]", selectedPrefix && "min-w-[calc(100%-4.75rem)]") }, selectedPrefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center shrink-0" }, selectedPrefix), /* @__PURE__ */ React.createElement(
245
245
  Typography,
246
246
  {
247
247
  className: cn("truncate", colorClass),
@@ -249,13 +249,13 @@ const ComboboxTriggerButton = React.forwardRef(
249
249
  },
250
250
  selectedLabel
251
251
  )),
252
- /* @__PURE__ */ React.createElement(
252
+ /* @__PURE__ */ React.createElement("div", { className: "w-5" }, /* @__PURE__ */ React.createElement(
253
253
  ChevronIcon,
254
254
  {
255
- className: cn("ml-2 shrink-0", colorClass),
255
+ className: cn("shrink-0", colorClass),
256
256
  size: ICON_SIZE
257
257
  }
258
- )
258
+ ))
259
259
  );
260
260
  }
261
261
  );
@@ -10,13 +10,36 @@ import { X, ChevronUp, ChevronDown, Check, Minus } from 'lucide-react';
10
10
  import { initializeI18n } from '../../i18n/index.js';
11
11
 
12
12
  initializeI18n();
13
+ const TRIGGER_HEIGHT_CLASSES = {
14
+ small: "!h-8",
15
+ medium: "!h-10",
16
+ large: "!h-12"
17
+ };
18
+ const SEARCH_INPUT_HEIGHT_CLASSES = {
19
+ small: "h-7",
20
+ medium: "h-8",
21
+ large: "h-9"
22
+ };
23
+ const SEARCH_INPUT_CLASSES = {
24
+ small: "[&_[cmdk-input]]:h-7 [&_[cmdk-input]]:body-small-400 [&_svg]:text-grey-800 [&_svg]:opacity-100 [&_svg]:h-4 [&_svg]:w-4",
25
+ medium: "[&_[cmdk-input]]:h-8 [&_[cmdk-input]]:body-medium-400 [&_svg]:text-grey-800 [&_svg]:opacity-100 [&_svg]:h-4 [&_svg]:w-4",
26
+ large: "[&_[cmdk-input]]:h-9 [&_[cmdk-input]]:body-large-400 [&_svg]:text-grey-800 [&_svg]:opacity-100 [&_svg]:h-4 [&_svg]:w-4"
27
+ };
28
+ const getFontVariant = (size) => {
29
+ const sizeMap = {
30
+ small: "body-small-400",
31
+ medium: "body-medium-400",
32
+ large: "body-large-400"
33
+ };
34
+ return sizeMap[size ?? "medium"];
35
+ };
13
36
  const MultiSelect = React.forwardRef(
14
37
  ({
15
38
  options = [],
16
39
  onValueChange,
17
40
  value = [],
18
41
  placeholder = "Select options",
19
- maxCount = 3,
42
+ maxCount,
20
43
  modalPopover = false,
21
44
  className,
22
45
  side = "bottom",
@@ -32,12 +55,15 @@ const MultiSelect = React.forwardRef(
32
55
  highlightMatches = true,
33
56
  allowTypoDistance = 0,
34
57
  groupedOptions,
35
- classNameContent
58
+ classNameContent,
59
+ size = "medium"
36
60
  }, ref) => {
37
61
  const { t } = useTranslation();
38
62
  const [selectedValues, setSelectedValues] = React.useState(value);
39
63
  const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
40
64
  const [query, setQuery] = React.useState("");
65
+ const [dynamicMaxCount, setDynamicMaxCount] = React.useState(selectedValues.length || 1);
66
+ const buttonRef = React.useRef(null);
41
67
  React.useEffect(() => {
42
68
  const shallowEqual = (a, b) => {
43
69
  if (a === b) return true;
@@ -47,6 +73,88 @@ const MultiSelect = React.forwardRef(
47
73
  };
48
74
  setSelectedValues((prev) => shallowEqual(prev, value) ? prev : value);
49
75
  }, [value]);
76
+ React.useEffect(() => {
77
+ if (maxCount !== void 0) {
78
+ setDynamicMaxCount(maxCount);
79
+ return;
80
+ }
81
+ if (selectedValues.length === 0) return;
82
+ const calculateMaxCount = () => {
83
+ if (!buttonRef.current) {
84
+ setTimeout(() => calculateMaxCount(), 10);
85
+ return;
86
+ }
87
+ const buttonWidth = buttonRef.current.offsetWidth;
88
+ if (buttonWidth === 0) {
89
+ setTimeout(() => calculateMaxCount(), 10);
90
+ return;
91
+ }
92
+ const CONTROLS_WIDTH = 80;
93
+ const COUNTER_TAG_WIDTH = 41;
94
+ const TAG_GAP = 4;
95
+ const CONTAINER_PADDING = 8;
96
+ const AVG_CHAR_WIDTH = 8;
97
+ const TAG_PADDING = 24;
98
+ const availableWidth = buttonWidth - CONTAINER_PADDING * 2 - CONTROLS_WIDTH;
99
+ if (availableWidth <= 0) {
100
+ setDynamicMaxCount(1);
101
+ return;
102
+ }
103
+ const getTreeLabel = (val) => {
104
+ if (!treeOptions) return void 0;
105
+ const stack = [...treeOptions];
106
+ while (stack.length) {
107
+ const n = stack.pop();
108
+ if (n.value === val) return n.label;
109
+ if (n.children) stack.push(...n.children);
110
+ }
111
+ return void 0;
112
+ };
113
+ const estimatedWidths = [];
114
+ for (let i = 0; i < selectedValues.length; i++) {
115
+ const label = getTreeLabel(selectedValues[i]) || options.find((o) => o.value === selectedValues[i])?.label || selectedValues[i];
116
+ const estimatedWidth = Math.min(
117
+ label.length * AVG_CHAR_WIDTH + TAG_PADDING,
118
+ 250
119
+ );
120
+ estimatedWidths.push(estimatedWidth);
121
+ }
122
+ let totalWidth = 0;
123
+ for (let i = 0; i < estimatedWidths.length; i++) {
124
+ totalWidth += estimatedWidths[i] + (i > 0 ? TAG_GAP : 0);
125
+ }
126
+ if (totalWidth <= availableWidth) {
127
+ setDynamicMaxCount(selectedValues.length);
128
+ return;
129
+ }
130
+ const availableWithCounter = availableWidth - COUNTER_TAG_WIDTH - TAG_GAP;
131
+ let count = 0;
132
+ totalWidth = 0;
133
+ for (let i = 0; i < estimatedWidths.length; i++) {
134
+ const tagWidth = estimatedWidths[i] + (i > 0 ? TAG_GAP : 0);
135
+ if (totalWidth + tagWidth <= availableWithCounter) {
136
+ totalWidth += tagWidth;
137
+ count++;
138
+ } else {
139
+ break;
140
+ }
141
+ }
142
+ setDynamicMaxCount(Math.max(1, count));
143
+ };
144
+ const rafId = requestAnimationFrame(() => {
145
+ calculateMaxCount();
146
+ });
147
+ const resizeObserver = new ResizeObserver(() => {
148
+ calculateMaxCount();
149
+ });
150
+ if (buttonRef.current) {
151
+ resizeObserver.observe(buttonRef.current);
152
+ }
153
+ return () => {
154
+ cancelAnimationFrame(rafId);
155
+ resizeObserver.disconnect();
156
+ };
157
+ }, [maxCount, selectedValues, treeOptions, options]);
50
158
  const handleInputKeyDown = (event) => {
51
159
  if (event.key === "Enter") {
52
160
  setIsPopoverOpen(true);
@@ -69,11 +177,6 @@ const MultiSelect = React.forwardRef(
69
177
  const handleTogglePopover = () => {
70
178
  setIsPopoverOpen((prev) => !prev);
71
179
  };
72
- const clearExtraOptions = () => {
73
- const newSelectedValues = selectedValues.slice(0, maxCount);
74
- setSelectedValues(newSelectedValues);
75
- onValueChange(newSelectedValues);
76
- };
77
180
  const toggleAll = () => {
78
181
  if (treeOptions && treeOptions.length) {
79
182
  const gather = (acc, nodes) => {
@@ -320,7 +423,8 @@ const MultiSelect = React.forwardRef(
320
423
  "div",
321
424
  {
322
425
  className: cn(
323
- "flex items-center gap-2 px-2 py-1 cursor-pointer rounded-sm text-grey-800 hover:bg-grey-100 text-sm",
426
+ "flex items-center gap-2 px-2 py-1 cursor-pointer rounded-sm text-grey-800 hover:bg-grey-100",
427
+ getFontVariant(size),
324
428
  (fully || isSelectedLeaf) && "bg-blue-50"
325
429
  ),
326
430
  style: { paddingLeft: depth * 14 + 8 }
@@ -337,13 +441,13 @@ const MultiSelect = React.forwardRef(
337
441
  toggleTreeNode(n);
338
442
  }
339
443
  },
340
- fully && /* @__PURE__ */ React.createElement(Check, { className: "h-3 w-3" }),
444
+ fully && /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 }),
341
445
  partial && !fully && /* @__PURE__ */ React.createElement(Minus, { className: "h-3 w-3 text-blue-600" })
342
446
  ),
343
447
  /* @__PURE__ */ React.createElement(
344
448
  "span",
345
449
  {
346
- className: "text-sm flex-1 truncate cursor-pointer overflow-hidden",
450
+ className: "flex-1 truncate cursor-pointer overflow-hidden",
347
451
  onClick: (e) => {
348
452
  e.stopPropagation();
349
453
  toggleTreeNode(n);
@@ -364,25 +468,34 @@ const MultiSelect = React.forwardRef(
364
468
  /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
365
469
  "button",
366
470
  {
367
- ref,
471
+ ref: (node) => {
472
+ buttonRef.current = node;
473
+ if (typeof ref === "function") {
474
+ ref(node);
475
+ } else if (ref) {
476
+ ref.current = node;
477
+ }
478
+ },
368
479
  onClick: handleTogglePopover,
369
480
  className: cn(
370
- `flex w-full p-1 rounded-[4px] min-h-8 h-auto items-center justify-between bg-background
481
+ `flex w-full p-1 rounded-sm h-auto items-center justify-between bg-background
371
482
  border border-grey-400
372
483
  hover:border-grey-500 focus:border-grey-400 focus:ring-grey-600 focus:ring-opacity-15 focus:ring-4
373
484
  transition-all duration-300 outline-none
374
485
  [&_svg]:pointer-events-auto`,
486
+ TRIGGER_HEIGHT_CLASSES[size],
375
487
  className
376
488
  ),
377
489
  "aria-expanded": isPopoverOpen
378
490
  },
379
- selectedValues.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center w-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-1" }, selectedValues.slice(0, maxCount).map((value2) => {
491
+ selectedValues.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center w-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-1" }, selectedValues.slice(0, dynamicMaxCount).map((value2) => {
380
492
  const label = findTreeLabel(value2) || options.find((o) => o.value === value2)?.label || value2;
381
- return /* @__PURE__ */ React.createElement(Tag, { key: value2, color: "blue", className: "focus:ring-0" }, /* @__PURE__ */ React.createElement(
493
+ return /* @__PURE__ */ React.createElement(Tag, { key: value2, color: "blue", className: "focus:ring-0 max-w-[15.625rem]" }, /* @__PURE__ */ React.createElement(
382
494
  Typography,
383
495
  {
384
- variant: "body-small-400",
385
- textColor: "text-blue-600"
496
+ variant: getFontVariant(size),
497
+ textColor: "text-blue-600",
498
+ className: "truncate"
386
499
  },
387
500
  label
388
501
  ), /* @__PURE__ */ React.createElement(
@@ -395,19 +508,10 @@ const MultiSelect = React.forwardRef(
395
508
  }
396
509
  }
397
510
  ));
398
- }), selectedValues.length > maxCount && /* @__PURE__ */ React.createElement(Tag, { color: "blue", className: "focus:ring-0" }, /* @__PURE__ */ React.createElement(Typography, { variant: "body-small-400", className: "text-blue-600" }, `+ ${selectedValues.length - maxCount}`), /* @__PURE__ */ React.createElement(
511
+ }), selectedValues.length > dynamicMaxCount && /* @__PURE__ */ React.createElement(Tag, { color: "blue", className: "focus:ring-0" }, /* @__PURE__ */ React.createElement(Typography, { variant: getFontVariant(size), className: "text-blue-600" }, `+ ${selectedValues.length - dynamicMaxCount}`))), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement(
399
512
  X,
400
513
  {
401
- className: "h-4 w-4 cursor-pointer flex-shrink-0",
402
- onClick: (event) => {
403
- event.stopPropagation();
404
- clearExtraOptions();
405
- }
406
- }
407
- ))), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement(
408
- X,
409
- {
410
- className: "h-4 mx-2 cursor-pointer text-grey-800",
514
+ className: "h-4 w-4 cursor-pointer text-grey-800",
411
515
  onClick: (event) => {
412
516
  event.stopPropagation();
413
517
  handleClear();
@@ -417,9 +521,16 @@ const MultiSelect = React.forwardRef(
417
521
  Separator,
418
522
  {
419
523
  orientation: "vertical",
420
- className: "flex min-h-4 h-full"
524
+ className: "flex min-h-4 mx-1 h-full"
421
525
  }
422
- ), isPopoverOpen ? /* @__PURE__ */ React.createElement(ChevronUp, { className: "h-4 mx-2 cursor-pointer text-grey-800" }) : /* @__PURE__ */ React.createElement(ChevronDown, { className: "h-4 mx-2 cursor-pointer text-grey-800" }))) : /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between w-full mx-auto" }, /* @__PURE__ */ React.createElement("span", { className: "text-sm text-grey-800 mx-3" }, placeholder), isPopoverOpen ? /* @__PURE__ */ React.createElement(ChevronUp, { className: "h-4 cursor-pointer text-grey-800 mx-2" }) : /* @__PURE__ */ React.createElement(ChevronDown, { className: "h-4 cursor-pointer text-grey-800 mx-2" }))
526
+ ), isPopoverOpen ? /* @__PURE__ */ React.createElement(ChevronUp, { className: "h-4 w-4 cursor-pointer text-grey-800" }) : /* @__PURE__ */ React.createElement(ChevronDown, { className: "h-4 w-4 cursor-pointer text-grey-800" }))) : /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between w-full mx-auto" }, /* @__PURE__ */ React.createElement(
527
+ Typography,
528
+ {
529
+ variant: getFontVariant(size),
530
+ className: "text-grey-800 mx-3"
531
+ },
532
+ placeholder
533
+ ), isPopoverOpen ? /* @__PURE__ */ React.createElement(ChevronUp, { className: "h-4 cursor-pointer text-grey-800 mx-2" }) : /* @__PURE__ */ React.createElement(ChevronDown, { className: "h-4 cursor-pointer text-grey-800 mx-2" }))
423
534
  )),
424
535
  /* @__PURE__ */ React.createElement(
425
536
  PopoverContent,
@@ -433,7 +544,7 @@ const MultiSelect = React.forwardRef(
433
544
  align: "start",
434
545
  onEscapeKeyDown: () => setIsPopoverOpen(false)
435
546
  },
436
- !isTree && /* @__PURE__ */ React.createElement(Command, { shouldFilter: false }, /* @__PURE__ */ React.createElement(
547
+ !isTree && /* @__PURE__ */ React.createElement(Command, { shouldFilter: false, className: SEARCH_INPUT_CLASSES[size] }, /* @__PURE__ */ React.createElement(
437
548
  CommandInput,
438
549
  {
439
550
  placeholder: treeSearchPlaceholder || t("multiSelect.search"),
@@ -441,7 +552,7 @@ const MultiSelect = React.forwardRef(
441
552
  value: query,
442
553
  onValueChange: (v) => setQuery(v)
443
554
  }
444
- ), /* @__PURE__ */ React.createElement(CommandList, null, (!filteredOptions || filteredOptions.length === 0) && /* @__PURE__ */ React.createElement(CommandEmpty, { className: "p-4 body-medium-400 text-center text-grey-800" }, t("multiSelect.empty")), /* @__PURE__ */ React.createElement(CommandGroup, null, !query && /* @__PURE__ */ React.createElement(
555
+ ), /* @__PURE__ */ React.createElement(CommandList, null, (!filteredOptions || filteredOptions.length === 0) && /* @__PURE__ */ React.createElement(CommandEmpty, { className: cn("p-4 text-center text-grey-800", getFontVariant(size)) }, t("multiSelect.empty")), /* @__PURE__ */ React.createElement(CommandGroup, null, !query && /* @__PURE__ */ React.createElement(
445
556
  CommandItem,
446
557
  {
447
558
  key: "all",
@@ -452,13 +563,20 @@ const MultiSelect = React.forwardRef(
452
563
  "div",
453
564
  {
454
565
  className: cn(
455
- "flex h-4 w-4 items-center justify-center rounded-sm border-2 border-grey-400",
566
+ "flex h-4 w-4 items-center justify-center rounded-sm border border-grey-800",
456
567
  selectedValues.length > 0 ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
457
568
  )
458
569
  },
459
- selectedValues.length === effectiveOptions.length ? /* @__PURE__ */ React.createElement(Check, { className: "h-4 w-4" }) : /* @__PURE__ */ React.createElement(Minus, { className: "h-4 w-4" })
570
+ selectedValues.length === effectiveOptions.length ? /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 }) : /* @__PURE__ */ React.createElement(Minus, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
460
571
  ),
461
- /* @__PURE__ */ React.createElement("span", { className: "text-grey-800" }, selectAllLabel ?? t("multiSelect.selectAll"))
572
+ /* @__PURE__ */ React.createElement(
573
+ Typography,
574
+ {
575
+ variant: getFontVariant(size),
576
+ className: "text-grey-800"
577
+ },
578
+ selectAllLabel ?? t("multiSelect.selectAll")
579
+ )
462
580
  ), isGrouped ? Object.entries(groupedOptions).map(
463
581
  ([categoryName, categoryOptions]) => {
464
582
  const filtered = categoryOptions.filter(
@@ -488,11 +606,12 @@ const MultiSelect = React.forwardRef(
488
606
  isSelected ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
489
607
  )
490
608
  },
491
- /* @__PURE__ */ React.createElement(Check, { className: "h-4 w-4" })
609
+ /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
492
610
  ),
493
611
  /* @__PURE__ */ React.createElement(
494
- "span",
612
+ Typography,
495
613
  {
614
+ variant: getFontVariant(size),
496
615
  className: "text-grey-800 truncate overflow-hidden",
497
616
  title: option.label
498
617
  },
@@ -516,15 +635,16 @@ const MultiSelect = React.forwardRef(
516
635
  "div",
517
636
  {
518
637
  className: cn(
519
- "flex h-4 w-4 items-center justify-center rounded-sm border-2 border-grey-400 flex-shrink-0",
638
+ "flex h-4 w-4 items-center justify-center rounded-sm border border-grey-800 flex-shrink-0",
520
639
  isSelected ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
521
640
  )
522
641
  },
523
- /* @__PURE__ */ React.createElement(Check, { className: "h-4 w-4" })
642
+ /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
524
643
  ),
525
644
  /* @__PURE__ */ React.createElement(
526
- "span",
645
+ Typography,
527
646
  {
647
+ variant: getFontVariant(size),
528
648
  className: "text-grey-800 truncate overflow-hidden",
529
649
  title: option.label
530
650
  },
@@ -545,7 +665,7 @@ const MultiSelect = React.forwardRef(
545
665
  {
546
666
  strokeLinecap: "round",
547
667
  strokeLinejoin: "round",
548
- strokeWidth: 2,
668
+ strokeWidth: 3,
549
669
  d: "M21 21l-4.35-4.35m0 0A7.5 7.5 0 1 0 5.25 5.25a7.5 7.5 0 0 0 11.4 11.4z"
550
670
  }
551
671
  )
@@ -556,19 +676,23 @@ const MultiSelect = React.forwardRef(
556
676
  value: treeQuery,
557
677
  onChange: (e) => setTreeQuery(e.target.value),
558
678
  placeholder: treeSearchPlaceholder || t("multiSelect.search"),
559
- className: "w-full h-9 pl-9 pr-3 text-sm border-0 focus:outline-none focus:ring-0 bg-transparent placeholder:text-muted-foreground"
679
+ className: cn(
680
+ "w-full pl-9 pr-3 border-0 focus:outline-none focus:ring-0 bg-transparent placeholder:text-muted-foreground",
681
+ getFontVariant(size),
682
+ SEARCH_INPUT_HEIGHT_CLASSES[size]
683
+ )
560
684
  }
561
685
  ))), /* @__PURE__ */ React.createElement("div", { className: "px-2 pb-1 overflow-y-auto overflow-x-hidden" }, !treeQuery && /* @__PURE__ */ React.createElement(
562
686
  "div",
563
687
  {
564
- className: "flex items-center gap-2 px-2 py-1 cursor-pointer rounded-sm hover:bg-accent text-sm",
688
+ className: "flex items-center gap-2 px-2 py-1 cursor-pointer rounded-sm hover:bg-accent",
565
689
  onClick: toggleAll
566
690
  },
567
691
  /* @__PURE__ */ React.createElement(
568
692
  "div",
569
693
  {
570
694
  className: cn(
571
- "flex h-4 w-4 items-center justify-center rounded-sm border-2 border-grey-400",
695
+ "flex h-4 w-4 items-center justify-center rounded-sm border border-grey-800",
572
696
  selectedValues.length > 0 ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
573
697
  )
574
698
  },
@@ -582,9 +706,16 @@ const MultiSelect = React.forwardRef(
582
706
  acc += treeSelectionStrategy === "all" ? 1 + countAll(n.children) : countAll(n.children);
583
707
  }
584
708
  return acc;
585
- }(treeOptions) ? /* @__PURE__ */ React.createElement(Check, { className: "h-4 w-4" }) : /* @__PURE__ */ React.createElement(Minus, { className: "h-4 w-4" })
709
+ }(treeOptions) ? /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 }) : /* @__PURE__ */ React.createElement(Minus, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
586
710
  ),
587
- /* @__PURE__ */ React.createElement("span", { className: "text-grey-800" }, selectAllLabel ?? t("multiSelect.selectAll"))
711
+ /* @__PURE__ */ React.createElement(
712
+ Typography,
713
+ {
714
+ variant: getFontVariant(size),
715
+ className: "text-grey-800"
716
+ },
717
+ selectAllLabel ?? t("multiSelect.selectAll")
718
+ )
588
719
  ), treeOptions && renderTree(displayedTree)))
589
720
  )
590
721
  );
@@ -11,7 +11,7 @@ const NumberControl = ({
11
11
  onChange,
12
12
  placeholder,
13
13
  required = false,
14
- min,
14
+ min = 0,
15
15
  max,
16
16
  maxDigits,
17
17
  className = "",
@@ -21,34 +21,39 @@ const NumberControl = ({
21
21
  }) => {
22
22
  const defaultPlaceholder = maxDigits ? "0".repeat(maxDigits) : "0";
23
23
  const finalPlaceholder = placeholder ?? defaultPlaceholder;
24
+ value.toString();
24
25
  const handleIncrement = () => {
25
- const current = typeof value === "number" ? value : parseInt(value, 10) || 0;
26
- if (max === void 0 || current < max) {
27
- const newValue = (current + 1).toString();
28
- onChange(newValue);
26
+ const current = typeof value === "number" ? value : parseInt(value, 10) || min;
27
+ if (max !== void 0 && current >= max) {
28
+ return;
29
29
  }
30
+ const newValue = (current + 1).toString();
31
+ onChange(newValue);
30
32
  };
31
33
  const handleDecrement = () => {
32
- const current = typeof value === "number" ? value : parseInt(value, 10) || 0;
33
- if (min === void 0 || current > min) {
34
- const newValue = (current - 1).toString();
35
- onChange(newValue);
34
+ const current = typeof value === "number" ? value : parseInt(value, 10) || min;
35
+ if (current <= min) {
36
+ return;
36
37
  }
38
+ const newValue = (current - 1).toString();
39
+ onChange(newValue);
37
40
  };
38
41
  const handleInputChange = (inputValue) => {
39
42
  const numbersOnly = inputValue.replace(/[^0-9]/g, "");
40
- if (numbersOnly === "") {
41
- onChange("");
43
+ if (numbersOnly === "" || numbersOnly === "0".repeat(numbersOnly.length)) {
44
+ onChange(min.toString());
42
45
  return;
43
46
  }
44
47
  if (maxDigits && numbersOnly.length > maxDigits) {
45
48
  return;
46
49
  }
47
50
  const numValue = parseInt(numbersOnly, 10);
48
- const isAboveMin = min === void 0 || numValue >= min;
51
+ const isAboveMin = numValue >= min;
49
52
  const isBelowMax = max === void 0 || numValue <= max;
50
53
  if (isAboveMin && isBelowMax) {
51
- onChange(numbersOnly);
54
+ onChange(numValue.toString());
55
+ } else if (!isBelowMax && max !== void 0) {
56
+ onChange(max.toString());
52
57
  }
53
58
  };
54
59
  const labelElement = /* @__PURE__ */ React__default.createElement(