@ttoss/ui 5.11.1 → 6.0.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/dist/esm/index.js CHANGED
@@ -384,8 +384,6 @@ var InfiniteLinearProgress = /* @__PURE__ */__name(() => {
384
384
  }, "InfiniteLinearProgress");
385
385
 
386
386
  // src/components/Input.tsx
387
- import { Icon as Icon4 } from "@ttoss/react-icons";
388
- import * as React7 from "react";
389
387
  import { Input as InputUI } from "theme-ui";
390
388
  var isInputIconConfig = /* @__PURE__ */__name(icon => {
391
389
  return icon !== void 0 && typeof icon === "object" && "icon" in icon && (typeof icon.icon === "string" || typeof icon.icon === "object" && "body" in icon.icon);
@@ -418,10 +416,7 @@ var Input = /* @__PURE__ */__name(({
418
416
  } : normalizedTrailingIconProp;
419
417
  const isWarning = !isInvalid && trailingIcon?.icon === "warning-alt";
420
418
  const wrapperClassName = [className, isWarning && "is-warning"].filter(Boolean).join(" ");
421
- const id = React7.useId();
422
- const leadingTooltipId = `${id}-leading-tooltip`;
423
- const trailingTooltipId = `${id}-trailing-tooltip`;
424
- return /* @__PURE__ */React7.createElement(Flex, {
419
+ return /* @__PURE__ */React.createElement(Flex, {
425
420
  className: wrapperClassName,
426
421
  sx: {
427
422
  ...sx,
@@ -429,24 +424,17 @@ var Input = /* @__PURE__ */__name(({
429
424
  padding: 0,
430
425
  border: "none"
431
426
  }
432
- }, normalizedLeadingIcon && /* @__PURE__ */React7.createElement(React7.Fragment, null, /* @__PURE__ */React7.createElement(Text, {
427
+ }, normalizedLeadingIcon && /* @__PURE__ */React.createElement(TooltipIcon, {
428
+ ...normalizedLeadingIcon,
433
429
  "data-testid": "input-leading-icon",
434
- "data-tooltip-id": normalizedLeadingIcon.tooltip ? leadingTooltipId : void 0,
430
+ variant: normalizedLeadingIcon.variant ?? "info",
435
431
  sx: {
436
432
  position: "absolute",
437
433
  alignSelf: "center",
438
434
  left: "1rem",
439
- cursor: normalizedLeadingIcon.onClick ? "pointer" : "default"
440
- },
441
- onClick: normalizedLeadingIcon.onClick,
442
- variant: "leading-icon"
443
- }, /* @__PURE__ */React7.createElement(Icon4, {
444
- inline: true,
445
- icon: normalizedLeadingIcon.icon
446
- })), normalizedLeadingIcon.tooltip && /* @__PURE__ */React7.createElement(Tooltip, {
447
- id: leadingTooltipId,
448
- ...normalizedLeadingIcon.tooltipProps
449
- }, normalizedLeadingIcon.tooltip)), /* @__PURE__ */React7.createElement(InputUI, {
435
+ ...normalizedLeadingIcon.sx
436
+ }
437
+ }), /* @__PURE__ */React.createElement(InputUI, {
450
438
  sx: {
451
439
  fontFamily: "body",
452
440
  paddingY: "3",
@@ -458,33 +446,26 @@ var Input = /* @__PURE__ */__name(({
458
446
  },
459
447
  className,
460
448
  ...inputProps
461
- }), trailingIcon && /* @__PURE__ */React7.createElement(React7.Fragment, null, /* @__PURE__ */React7.createElement(Text, {
449
+ }), trailingIcon && /* @__PURE__ */React.createElement(TooltipIcon, {
450
+ ...trailingIcon,
462
451
  "data-testid": "input-trailing-icon",
463
- "data-tooltip-id": trailingIcon.tooltip ? trailingTooltipId : void 0,
452
+ variant: trailingIcon.variant ?? "info",
464
453
  sx: {
465
454
  position: "absolute",
466
455
  right: "1rem",
467
456
  alignSelf: "center",
468
457
  color: isWarning ? "feedback.text.caution.default" : void 0,
469
- cursor: trailingIcon.onClick ? "pointer" : "default",
470
- fontSize: "xl"
471
- },
472
- variant: "trailing-icon",
473
- onClick: trailingIcon.onClick
474
- }, /* @__PURE__ */React7.createElement(Icon4, {
475
- inline: true,
476
- icon: trailingIcon.icon
477
- })), trailingIcon.tooltip && /* @__PURE__ */React7.createElement(Tooltip, {
478
- id: trailingTooltipId,
479
- ...trailingIcon.tooltipProps
480
- }, trailingIcon.tooltip)));
458
+ fontSize: "xl",
459
+ ...trailingIcon.sx
460
+ }
461
+ }));
481
462
  }, "Input");
482
463
 
483
464
  // src/components/InputNumber.tsx
484
- import { Icon as Icon5 } from "@ttoss/react-icons";
485
- import * as React8 from "react";
465
+ import { Icon as Icon4 } from "@ttoss/react-icons";
466
+ import * as React7 from "react";
486
467
  import { Input as Input2 } from "theme-ui";
487
- var InputNumber = /* @__PURE__ */React8.forwardRef(({
468
+ var InputNumber = /* @__PURE__ */React7.forwardRef(({
488
469
  sx,
489
470
  value,
490
471
  infoIcon,
@@ -492,7 +473,7 @@ var InputNumber = /* @__PURE__ */React8.forwardRef(({
492
473
  onClickInfoIcon,
493
474
  ...inputProps
494
475
  }, ref) => {
495
- const sxProps = React8.useMemo(() => {
476
+ const sxProps = React7.useMemo(() => {
496
477
  const size = String(typeof value === "undefined" ? 0 : value).length;
497
478
  if (inputProps["aria-invalid"] === "true") {
498
479
  return {
@@ -544,7 +525,7 @@ var InputNumber = /* @__PURE__ */React8.forwardRef(({
544
525
  }
545
526
  onChange(value + 1);
546
527
  }, "handleChangeDown");
547
- return /* @__PURE__ */React8.createElement(Flex, {
528
+ return /* @__PURE__ */React7.createElement(Flex, {
548
529
  sx: {
549
530
  width: "fit-content",
550
531
  ...sx,
@@ -554,7 +535,7 @@ var InputNumber = /* @__PURE__ */React8.forwardRef(({
554
535
  },
555
536
  ref,
556
537
  "aria-invalid": inputProps["aria-invalid"]
557
- }, /* @__PURE__ */React8.createElement(Input2, {
538
+ }, /* @__PURE__ */React7.createElement(Input2, {
558
539
  ref,
559
540
  variant: "forms.inputNumber",
560
541
  sx: sxProps,
@@ -564,7 +545,7 @@ var InputNumber = /* @__PURE__ */React8.forwardRef(({
564
545
  }, "onChange"),
565
546
  value,
566
547
  ...inputProps
567
- }), /* @__PURE__ */React8.createElement(Text, {
548
+ }), /* @__PURE__ */React7.createElement(Text, {
568
549
  sx: {
569
550
  position: "absolute",
570
551
  alignSelf: "center",
@@ -573,9 +554,9 @@ var InputNumber = /* @__PURE__ */React8.forwardRef(({
573
554
  cursor: "pointer"
574
555
  },
575
556
  onClick: handleChangeUp
576
- }, /* @__PURE__ */React8.createElement(Icon5, {
557
+ }, /* @__PURE__ */React7.createElement(Icon4, {
577
558
  icon: "picker-down"
578
- })), infoIcon && /* @__PURE__ */React8.createElement(Text, {
559
+ })), infoIcon && /* @__PURE__ */React7.createElement(Text, {
579
560
  sx: {
580
561
  position: "absolute",
581
562
  alignSelf: "center",
@@ -584,9 +565,9 @@ var InputNumber = /* @__PURE__ */React8.forwardRef(({
584
565
  cursor: onClickInfoIcon ? "pointer" : "default"
585
566
  },
586
567
  onClick: onClickInfoIcon
587
- }, /* @__PURE__ */React8.createElement(Icon5, {
568
+ }, /* @__PURE__ */React7.createElement(Icon4, {
588
569
  icon: "info"
589
- })), /* @__PURE__ */React8.createElement(Text, {
570
+ })), /* @__PURE__ */React7.createElement(Text, {
590
571
  sx: {
591
572
  position: "absolute",
592
573
  alignSelf: "center",
@@ -595,23 +576,23 @@ var InputNumber = /* @__PURE__ */React8.forwardRef(({
595
576
  cursor: "pointer"
596
577
  },
597
578
  onClick: handleChangeDown
598
- }, /* @__PURE__ */React8.createElement(Icon5, {
579
+ }, /* @__PURE__ */React7.createElement(Icon4, {
599
580
  icon: "picker-up"
600
581
  })));
601
582
  });
602
583
  InputNumber.displayName = "InputNumber";
603
584
 
604
585
  // src/components/InputPassword.tsx
605
- import * as React9 from "react";
586
+ import * as React8 from "react";
606
587
  var InputPassword = /* @__PURE__ */__name(({
607
588
  showPasswordByDefault = false,
608
589
  ...inputPasswordProps
609
590
  }) => {
610
- const [hidePass, setHidePass] = React9.useState(Boolean(!showPasswordByDefault));
591
+ const [hidePass, setHidePass] = React8.useState(Boolean(!showPasswordByDefault));
611
592
  const {
612
593
  icon,
613
594
  inputType
614
- } = React9.useMemo(() => {
595
+ } = React8.useMemo(() => {
615
596
  return {
616
597
  icon: hidePass ? "view-off" : "view-on",
617
598
  inputType: hidePass ? "password" : "text"
@@ -622,7 +603,7 @@ var InputPassword = /* @__PURE__ */__name(({
622
603
  return !prev;
623
604
  });
624
605
  }, "handleClick");
625
- return /* @__PURE__ */React9.createElement(Input, {
606
+ return /* @__PURE__ */React8.createElement(Input, {
626
607
  ...inputPasswordProps,
627
608
  trailingIcon: {
628
609
  icon,
@@ -633,8 +614,8 @@ var InputPassword = /* @__PURE__ */__name(({
633
614
  }, "InputPassword");
634
615
 
635
616
  // src/components/Label.tsx
636
- import { Icon as Icon6 } from "@ttoss/react-icons";
637
- import * as React10 from "react";
617
+ import { Icon as Icon5 } from "@ttoss/react-icons";
618
+ import * as React9 from "react";
638
619
  import { Label as LabelUi } from "theme-ui";
639
620
 
640
621
  // src/components/Tooltip.tsx
@@ -716,9 +697,9 @@ var Label = /* @__PURE__ */__name(({
716
697
  sx,
717
698
  ...props
718
699
  }) => {
719
- const id = React10.useId();
700
+ const id = React9.useId();
720
701
  const tooltipId = `${id}-tooltip`;
721
- return /* @__PURE__ */React10.createElement(LabelUi, {
702
+ return /* @__PURE__ */React9.createElement(LabelUi, {
722
703
  sx: {
723
704
  alignItems: "center",
724
705
  fontSize: "sm",
@@ -728,7 +709,7 @@ var Label = /* @__PURE__ */__name(({
728
709
  ...sx
729
710
  },
730
711
  ...props
731
- }, children, tooltip && /* @__PURE__ */React10.createElement(Text, {
712
+ }, children, tooltip && /* @__PURE__ */React9.createElement(Text, {
732
713
  "data-tooltip-id": tooltipId,
733
714
  sx: {
734
715
  color: "currentcolor",
@@ -736,23 +717,23 @@ var Label = /* @__PURE__ */__name(({
736
717
  marginLeft: "1"
737
718
  },
738
719
  "aria-label": TOOLTIP_LABEL
739
- }, /* @__PURE__ */React10.createElement(Icon6, {
720
+ }, /* @__PURE__ */React9.createElement(Icon5, {
740
721
  icon: "info"
741
- }), /* @__PURE__ */React10.createElement(Tooltip, {
742
- ...tooltip,
743
- id: tooltipId
722
+ }), /* @__PURE__ */React9.createElement(Tooltip, {
723
+ id: tooltipId,
724
+ ...tooltip
744
725
  })));
745
726
  }, "Label");
746
727
 
747
728
  // src/components/Link.tsx
748
- import * as React11 from "react";
729
+ import * as React10 from "react";
749
730
  import { Link as LinkUi } from "theme-ui";
750
- var Link = /* @__PURE__ */React11.forwardRef(({
731
+ var Link = /* @__PURE__ */React10.forwardRef(({
751
732
  quiet,
752
733
  className,
753
734
  ...props
754
735
  }, ref) => {
755
- return /* @__PURE__ */React11.createElement(LinkUi, {
736
+ return /* @__PURE__ */React10.createElement(LinkUi, {
756
737
  className: `${quiet ? "quiet" : ""} ${className ?? ""}`,
757
738
  ...props,
758
739
  ref
@@ -767,7 +748,7 @@ import { Paragraph } from "theme-ui";
767
748
  import { Radio } from "theme-ui";
768
749
 
769
750
  // src/components/SegmentedControl.tsx
770
- import * as React12 from "react";
751
+ import * as React11 from "react";
771
752
  import { Box as Box3, Flex as Flex2 } from "theme-ui";
772
753
  var SegmentedControl = /* @__PURE__ */__name(({
773
754
  options,
@@ -779,8 +760,8 @@ var SegmentedControl = /* @__PURE__ */__name(({
779
760
  sx,
780
761
  ...rest
781
762
  }) => {
782
- const [internalValue, setInternalValue] = React12.useState(propValue || defaultValue);
783
- React12.useEffect(() => {
763
+ const [internalValue, setInternalValue] = React11.useState(propValue || defaultValue);
764
+ React11.useEffect(() => {
784
765
  if (propValue !== void 0) {
785
766
  setInternalValue(propValue);
786
767
  }
@@ -798,7 +779,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
798
779
  } : option;
799
780
  });
800
781
  const currentValue = propValue !== void 0 ? propValue : internalValue;
801
- return /* @__PURE__ */React12.createElement(Flex2, {
782
+ return /* @__PURE__ */React11.createElement(Flex2, {
802
783
  className,
803
784
  sx: {
804
785
  width: "100%",
@@ -881,18 +862,18 @@ var SegmentedControl = /* @__PURE__ */__name(({
881
862
  ...sx
882
863
  },
883
864
  ...rest
884
- }, /* @__PURE__ */React12.createElement("div", {
865
+ }, /* @__PURE__ */React11.createElement("div", {
885
866
  className: "rc-segmented"
886
- }, /* @__PURE__ */React12.createElement(Flex2, {
867
+ }, /* @__PURE__ */React11.createElement(Flex2, {
887
868
  className: "rc-segmented-group custom-segmented-group"
888
869
  }, normalizedOptions.map((option, index) => {
889
870
  const isSelected = option.value === currentValue;
890
871
  const isLastItem = index === normalizedOptions.length - 1;
891
872
  const isItemDisabled = disabled || option.disabled;
892
873
  const showDivider = !isLastItem && option.value !== currentValue && normalizedOptions[index + 1].value !== currentValue;
893
- return /* @__PURE__ */React12.createElement(React12.Fragment, {
874
+ return /* @__PURE__ */React11.createElement(React11.Fragment, {
894
875
  key: `${index}-${option.value}`
895
- }, /* @__PURE__ */React12.createElement(Box3, {
876
+ }, /* @__PURE__ */React11.createElement(Box3, {
896
877
  as: "label",
897
878
  className: `rc-segmented-item ${isSelected ? "rc-segmented-item-selected" : ""} ${isItemDisabled ? "rc-segmented-item-disabled" : ""}`,
898
879
  onClick: /* @__PURE__ */__name(() => {
@@ -900,7 +881,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
900
881
  handleChange(option.value);
901
882
  }
902
883
  }, "onClick")
903
- }, /* @__PURE__ */React12.createElement("input", {
884
+ }, /* @__PURE__ */React11.createElement("input", {
904
885
  type: "radio",
905
886
  value: option.value,
906
887
  checked: isSelected,
@@ -910,9 +891,9 @@ var SegmentedControl = /* @__PURE__ */__name(({
910
891
  handleChange(option.value);
911
892
  }
912
893
  }, "onChange")
913
- }), /* @__PURE__ */React12.createElement("div", {
894
+ }), /* @__PURE__ */React11.createElement("div", {
914
895
  className: "rc-segmented-item-label"
915
- }, option.label)), showDivider && /* @__PURE__ */React12.createElement(Box3, {
896
+ }, option.label)), showDivider && /* @__PURE__ */React11.createElement(Box3, {
916
897
  className: "segmented-divider",
917
898
  sx: {
918
899
  height: "60%",
@@ -923,7 +904,7 @@ var SegmentedControl = /* @__PURE__ */__name(({
923
904
  zIndex: 3
924
905
  }
925
906
  }));
926
- }), currentValue !== void 0 && /* @__PURE__ */React12.createElement("div", {
907
+ }), currentValue !== void 0 && /* @__PURE__ */React11.createElement("div", {
927
908
  className: "rc-segmented-thumb",
928
909
  style: {
929
910
  width: `${100 / normalizedOptions.length}%`,
@@ -935,8 +916,8 @@ var SegmentedControl = /* @__PURE__ */__name(({
935
916
  }, "SegmentedControl");
936
917
 
937
918
  // src/components/Select.tsx
938
- import { Icon as Icon7 } from "@ttoss/react-icons";
939
- import * as React13 from "react";
919
+ import { Icon as Icon6 } from "@ttoss/react-icons";
920
+ import * as React12 from "react";
940
921
  import ReactSelect, { components } from "react-select";
941
922
  var Control = /* @__PURE__ */__name(props => {
942
923
  const isDisabled = props.selectProps.isDisabled;
@@ -956,7 +937,7 @@ var Control = /* @__PURE__ */__name(props => {
956
937
  }
957
938
  return "display.background.secondary.default";
958
939
  })();
959
- return /* @__PURE__ */React13.createElement(Box, {
940
+ return /* @__PURE__ */React12.createElement(Box, {
960
941
  sx: {
961
942
  ".react-select__control": {
962
943
  borderColor,
@@ -965,7 +946,7 @@ var Control = /* @__PURE__ */__name(props => {
965
946
  paddingY: "3"
966
947
  }
967
948
  }
968
- }, /* @__PURE__ */React13.createElement(components.Control, props));
949
+ }, /* @__PURE__ */React12.createElement(components.Control, props));
969
950
  }, "Control");
970
951
  var DropdownIndicator = /* @__PURE__ */__name(props => {
971
952
  const isDisabled = props.selectProps.isDisabled;
@@ -975,7 +956,7 @@ var DropdownIndicator = /* @__PURE__ */__name(props => {
975
956
  }
976
957
  return "text";
977
958
  })();
978
- return /* @__PURE__ */React13.createElement(Text, {
959
+ return /* @__PURE__ */React12.createElement(Text, {
979
960
  sx: {
980
961
  fontSize: "md",
981
962
  color,
@@ -983,14 +964,14 @@ var DropdownIndicator = /* @__PURE__ */__name(props => {
983
964
  display: "flex",
984
965
  alignItems: "center"
985
966
  }
986
- }, /* @__PURE__ */React13.createElement(Icon7, {
967
+ }, /* @__PURE__ */React12.createElement(Icon6, {
987
968
  icon: "picker-down"
988
969
  }));
989
970
  }, "DropdownIndicator");
990
971
  var IndicatorsContainer = /* @__PURE__ */__name(({
991
972
  children
992
973
  }) => {
993
- return /* @__PURE__ */React13.createElement(Box, {
974
+ return /* @__PURE__ */React12.createElement(Box, {
994
975
  sx: {
995
976
  marginLeft: "4",
996
977
  border: "none"
@@ -1000,7 +981,7 @@ var IndicatorsContainer = /* @__PURE__ */__name(({
1000
981
  var Placeholder = /* @__PURE__ */__name(({
1001
982
  children
1002
983
  }) => {
1003
- return /* @__PURE__ */React13.createElement(Text, {
984
+ return /* @__PURE__ */React12.createElement(Text, {
1004
985
  sx: {
1005
986
  color: "onMuted",
1006
987
  alignSelf: "center"
@@ -1018,10 +999,10 @@ var SelectContainer = /* @__PURE__ */__name(({
1018
999
  return (
1019
1000
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1020
1001
  /* @__PURE__ */
1021
- React13.createElement(Box, {
1002
+ React12.createElement(Box, {
1022
1003
  sx,
1023
1004
  css: css2
1024
- }, /* @__PURE__ */React13.createElement(components.SelectContainer, props, children))
1005
+ }, /* @__PURE__ */React12.createElement(components.SelectContainer, props, children))
1025
1006
  );
1026
1007
  }, "SelectContainer");
1027
1008
  var ValueContainer = /* @__PURE__ */__name(({
@@ -1047,26 +1028,26 @@ var ValueContainer = /* @__PURE__ */__name(({
1047
1028
  }
1048
1029
  return leadingIcon || "search";
1049
1030
  })();
1050
- return /* @__PURE__ */React13.createElement(Flex, {
1031
+ return /* @__PURE__ */React12.createElement(Flex, {
1051
1032
  sx: {
1052
1033
  gap: "4",
1053
1034
  flex: 1
1054
1035
  }
1055
- }, finalLeadingIcon && /* @__PURE__ */React13.createElement(Text, {
1036
+ }, finalLeadingIcon && /* @__PURE__ */React12.createElement(Text, {
1056
1037
  sx: {
1057
1038
  alignSelf: "center",
1058
1039
  pointerEvents: "none",
1059
1040
  lineHeight: 0,
1060
1041
  fontSize: "md"
1061
1042
  }
1062
- }, /* @__PURE__ */React13.createElement(Icon7, {
1043
+ }, /* @__PURE__ */React12.createElement(Icon6, {
1063
1044
  icon: finalLeadingIcon
1064
- })), /* @__PURE__ */React13.createElement(Flex, {
1045
+ })), /* @__PURE__ */React12.createElement(Flex, {
1065
1046
  sx: {
1066
1047
  flex: 1,
1067
1048
  alignItems: "center"
1068
1049
  }
1069
- }, children), (trailingIcon || hasError) && /* @__PURE__ */React13.createElement(Text, {
1050
+ }, children), (trailingIcon || hasError) && /* @__PURE__ */React12.createElement(Text, {
1070
1051
  className: hasError ? "error-icon" : "",
1071
1052
  sx: {
1072
1053
  alignSelf: "center",
@@ -1075,11 +1056,11 @@ var ValueContainer = /* @__PURE__ */__name(({
1075
1056
  fontSize: "md",
1076
1057
  color: trailingIconColor
1077
1058
  }
1078
- }, /* @__PURE__ */React13.createElement(Icon7, {
1059
+ }, /* @__PURE__ */React12.createElement(Icon6, {
1079
1060
  icon: hasError ? "warning-alt" : trailingIcon
1080
1061
  })));
1081
1062
  }, "ValueContainer");
1082
- var Select = /* @__PURE__ */React13.forwardRef(({
1063
+ var Select = /* @__PURE__ */React12.forwardRef(({
1083
1064
  ...props
1084
1065
  }, ref) => {
1085
1066
  const value = props.options?.find(option => {
@@ -1088,7 +1069,7 @@ var Select = /* @__PURE__ */React13.forwardRef(({
1088
1069
  }
1089
1070
  return false;
1090
1071
  });
1091
- return /* @__PURE__ */React13.createElement(ReactSelect, {
1072
+ return /* @__PURE__ */React12.createElement(ReactSelect, {
1092
1073
  ref,
1093
1074
  /**
1094
1075
  * https://react-select.com/components
@@ -1170,7 +1151,7 @@ var Switch = /* @__PURE__ */__name(props => {
1170
1151
  }, "Switch");
1171
1152
 
1172
1153
  // src/components/Tag.tsx
1173
- import * as React14 from "react";
1154
+ import * as React13 from "react";
1174
1155
  var tagVariantMap = {
1175
1156
  positive: {
1176
1157
  bg: "feedback.background.positive.default",
@@ -1227,7 +1208,7 @@ var Tag = /* @__PURE__ */__name(({
1227
1208
  alignItems: "center"
1228
1209
  };
1229
1210
  if (Array.isArray(children)) {
1230
- return /* @__PURE__ */React14.createElement(Box, {
1211
+ return /* @__PURE__ */React13.createElement(Box, {
1231
1212
  as: "span",
1232
1213
  sx: {
1233
1214
  ml: 2,
@@ -1237,7 +1218,7 @@ var Tag = /* @__PURE__ */__name(({
1237
1218
  ...sx
1238
1219
  }
1239
1220
  }, children.map((child, i) => {
1240
- return /* @__PURE__ */React14.createElement(Box, {
1221
+ return /* @__PURE__ */React13.createElement(Box, {
1241
1222
  key: i,
1242
1223
  as: "span",
1243
1224
  sx: {
@@ -1251,7 +1232,7 @@ var Tag = /* @__PURE__ */__name(({
1251
1232
  }, child);
1252
1233
  }));
1253
1234
  }
1254
- return /* @__PURE__ */React14.createElement(Box, {
1235
+ return /* @__PURE__ */React13.createElement(Box, {
1255
1236
  as: "span",
1256
1237
  sx: {
1257
1238
  ...baseStyles,
@@ -1261,16 +1242,16 @@ var Tag = /* @__PURE__ */__name(({
1261
1242
  }, "Tag");
1262
1243
 
1263
1244
  // src/components/Textarea.tsx
1264
- import { Icon as Icon8 } from "@ttoss/react-icons";
1265
- import * as React15 from "react";
1245
+ import { Icon as Icon7 } from "@ttoss/react-icons";
1246
+ import * as React14 from "react";
1266
1247
  import { Textarea as TextareaUI } from "theme-ui";
1267
- var Textarea = /* @__PURE__ */React15.forwardRef(({
1248
+ var Textarea = /* @__PURE__ */React14.forwardRef(({
1268
1249
  trailingIcon,
1269
1250
  className,
1270
1251
  sx,
1271
1252
  ...textareaProps
1272
1253
  }, ref) => {
1273
- return /* @__PURE__ */React15.createElement(Flex, {
1254
+ return /* @__PURE__ */React14.createElement(Flex, {
1274
1255
  className,
1275
1256
  sx: {
1276
1257
  ...sx,
@@ -1278,7 +1259,7 @@ var Textarea = /* @__PURE__ */React15.forwardRef(({
1278
1259
  padding: 0,
1279
1260
  border: "none"
1280
1261
  }
1281
- }, /* @__PURE__ */React15.createElement(TextareaUI, {
1262
+ }, /* @__PURE__ */React14.createElement(TextareaUI, {
1282
1263
  ref,
1283
1264
  sx: {
1284
1265
  fontFamily: "body",
@@ -1290,19 +1271,51 @@ var Textarea = /* @__PURE__ */React15.forwardRef(({
1290
1271
  },
1291
1272
  className,
1292
1273
  ...textareaProps
1293
- }), trailingIcon && /* @__PURE__ */React15.createElement(Text, {
1274
+ }), trailingIcon && /* @__PURE__ */React14.createElement(Text, {
1294
1275
  sx: {
1295
1276
  position: "absolute",
1296
1277
  right: "1.25rem",
1297
1278
  top: "0.75rem"
1298
1279
  }
1299
- }, /* @__PURE__ */React15.createElement(Icon8, {
1280
+ }, /* @__PURE__ */React14.createElement(Icon7, {
1300
1281
  inline: true,
1301
1282
  icon: trailingIcon
1302
1283
  })));
1303
1284
  });
1304
1285
  Textarea.displayName = "Textarea";
1305
1286
 
1287
+ // src/components/TooltipIcon.tsx
1288
+ import { Icon as Icon8 } from "@ttoss/react-icons";
1289
+ import * as React15 from "react";
1290
+ var TooltipIcon = /* @__PURE__ */__name(({
1291
+ icon,
1292
+ onClick,
1293
+ tooltip,
1294
+ "data-testid": dataTestId,
1295
+ variant,
1296
+ sx
1297
+ }) => {
1298
+ const id = React15.useId();
1299
+ const tooltipId = `${id}-tooltip`;
1300
+ return /* @__PURE__ */React15.createElement(React15.Fragment, null, /* @__PURE__ */React15.createElement(Text, {
1301
+ "data-testid": dataTestId,
1302
+ "data-tooltip-id": tooltip ? tooltipId : void 0,
1303
+ sx: {
1304
+ cursor: onClick ? "pointer" : "default",
1305
+ ...sx
1306
+ },
1307
+ onClick,
1308
+ variant
1309
+ }, /* @__PURE__ */React15.createElement(Icon8, {
1310
+ inline: true,
1311
+ icon
1312
+ })), tooltip && /* @__PURE__ */React15.createElement(Tooltip, {
1313
+ id: tooltipId,
1314
+ ...tooltip,
1315
+ variant
1316
+ }));
1317
+ }, "TooltipIcon");
1318
+
1306
1319
  // src/theme/ThemeProvider.tsx
1307
1320
  import { css, Global } from "@emotion/react";
1308
1321
  import { BruttalFonts, BruttalTheme } from "@ttoss/theme/Bruttal";
@@ -1332,4 +1345,4 @@ var useTheme = useThemeUI;
1332
1345
  import { keyframes } from "@emotion/react";
1333
1346
  import { useBreakpointIndex, useResponsiveValue } from "@theme-ui/match-media";
1334
1347
  import { BaseStyles, Global as Global2 } from "theme-ui";
1335
- export { ActionButton, Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Global2 as Global, Grid, Heading, HelpText, IconButton, Image, InfiniteLinearProgress, Input, InputNumber, InputPassword, Label, Progress as LinearProgress, Link, Paragraph, Radio, SegmentedControl, Select, Slider, Spinner, Stack, Switch, Tag, Text, Textarea, ThemeProvider, Tooltip, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
1348
+ export { ActionButton, Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Global2 as Global, Grid, Heading, HelpText, IconButton, Image, InfiniteLinearProgress, Input, InputNumber, InputPassword, Label, Progress as LinearProgress, Link, Paragraph, Radio, SegmentedControl, Select, Slider, Spinner, Stack, Switch, Tag, Text, Textarea, ThemeProvider, Tooltip, TooltipIcon, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
package/dist/index.d.ts CHANGED
@@ -64,15 +64,69 @@ declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
64
64
  type TooltipProps = ITooltip & SxProp;
65
65
  declare const Tooltip: ({ variant, sx, ...props }: TooltipProps) => react_jsx_runtime.JSX.Element;
66
66
 
67
- interface InputIconConfig {
67
+ /**
68
+ * Props for the TooltipIcon component.
69
+ */
70
+ interface TooltipIconProps {
71
+ /**
72
+ * The icon to display. Can be a string identifier or an icon object from @ttoss/react-icons.
73
+ */
68
74
  icon: IconType;
75
+ /**
76
+ * Optional click handler for the icon.
77
+ */
69
78
  onClick?: () => void;
70
- tooltip?: string;
71
- tooltipProps?: Omit<TooltipProps, 'children' | 'anchorSelect'>;
79
+ /**
80
+ * Optional tooltip configuration.
81
+ * Pass tooltip props to display a tooltip when hovering over the icon.
82
+ * The 'variant' prop is excluded as it's controlled by the component's variant prop.
83
+ */
84
+ tooltip?: Omit<TooltipProps, 'variant'>;
85
+ /**
86
+ * Test ID for testing purposes.
87
+ */
88
+ 'data-testid'?: string;
89
+ /**
90
+ * Visual variant for both the text wrapper and tooltip.
91
+ * @default 'info'
92
+ */
93
+ variant?: 'info' | 'success' | 'warning' | 'error';
94
+ /**
95
+ * Additional styles to apply to the Text wrapper component.
96
+ */
97
+ sx?: Record<string, unknown>;
72
98
  }
99
+ /**
100
+ * TooltipIcon component renders an icon with an optional tooltip.
101
+ *
102
+ * This component is useful for displaying icons with explanatory tooltips,
103
+ * especially in contexts where space is limited or additional information
104
+ * should be revealed on hover.
105
+ *
106
+ * @example
107
+ * ```tsx
108
+ * <TooltipIcon
109
+ * icon="info-circle"
110
+ * tooltip={{ children: 'Additional information' }}
111
+ * variant="info"
112
+ * />
113
+ * ```
114
+ *
115
+ * @example
116
+ * ```tsx
117
+ * <TooltipIcon
118
+ * icon="warning-alt"
119
+ * tooltip={{ children: 'Warning message', place: 'top' }}
120
+ * variant="warning"
121
+ * onClick={() => console.log('Clicked')}
122
+ * />
123
+ * ```
124
+ */
125
+ declare const TooltipIcon: ({ icon, onClick, tooltip, "data-testid": dataTestId, variant, sx, }: TooltipIconProps) => react_jsx_runtime.JSX.Element;
126
+
73
127
  interface InputProps extends InputProps$1 {
74
- leadingIcon?: InputIconConfig | IconType;
75
- trailingIcon?: InputIconConfig | IconType;
128
+ leadingIcon?: TooltipIconProps | IconType;
129
+ trailingIcon?: TooltipIconProps | IconType;
76
130
  }
77
131
  declare const Input: ({ leadingIcon, trailingIcon: trailingIconProp, className, sx, ...inputProps }: InputProps) => react_jsx_runtime.JSX.Element;
78
132
 
@@ -181,4 +235,4 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
181
235
 
182
236
  declare const useTheme: () => theme_ui.ThemeUIContextValue;
183
237
 
184
- export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Card, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, type IconButtonProps, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Tag, type TagProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, type TooltipProps, useTheme };
238
+ export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Card, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, type IconButtonProps, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Switch, Tag, type TagProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipIcon, type TooltipIconProps, type TooltipProps, useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "5.11.1",
3
+ "version": "6.0.1",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -29,12 +29,12 @@
29
29
  "react-select": "^5.10.2",
30
30
  "react-tooltip": "^5.30.0",
31
31
  "theme-ui": "^0.17.2",
32
- "@ttoss/theme": "^2.7.0"
32
+ "@ttoss/theme": "^2.7.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@emotion/react": "^11",
36
36
  "react": ">=16.8.0",
37
- "@ttoss/react-icons": "^0.5.3"
37
+ "@ttoss/react-icons": "^0.5.4"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@emotion/react": "^11.14.0",
@@ -45,8 +45,8 @@
45
45
  "react": "^19.2.0",
46
46
  "tsup": "^8.5.1",
47
47
  "@ttoss/config": "^1.35.12",
48
- "@ttoss/test-utils": "^3.0.4",
49
- "@ttoss/react-icons": "^0.5.3"
48
+ "@ttoss/react-icons": "^0.5.4",
49
+ "@ttoss/test-utils": "^4.0.0"
50
50
  },
51
51
  "keywords": [
52
52
  "React",