@rehagro/ui 1.0.38 → 1.0.40

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/index.mjs CHANGED
@@ -1050,8 +1050,8 @@ var IconButton = forwardRef(function IconButton2({
1050
1050
  );
1051
1051
  });
1052
1052
  var statusClasses = {
1053
- default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring",
1054
- error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger"
1053
+ default: "rh-border-border focus-within:rh-border-primary focus-within:rh-ring-2 focus-within:rh-ring-gray-200",
1054
+ error: "rh-border-danger focus-within:rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-red-100"
1055
1055
  };
1056
1056
  var sizeClasses3 = {
1057
1057
  sm: "rh-h-input-sm rh-text-sm rh-px-input-x-sm",
@@ -1100,6 +1100,9 @@ var TextInput = forwardRef(function TextInput2({
1100
1100
  ...rest
1101
1101
  }, ref) {
1102
1102
  const inputId = id || React9.useId();
1103
+ const [isHelperDismissed, setIsHelperDismissed] = React9.useState(false);
1104
+ const { onChange, ...inputProps } = rest;
1105
+ const visualStatus = helperText && isHelperDismissed ? "default" : status;
1103
1106
  return /* @__PURE__ */ jsxs(
1104
1107
  "div",
1105
1108
  {
@@ -1117,7 +1120,7 @@ var TextInput = forwardRef(function TextInput2({
1117
1120
  "rh-border rh-bg-surface rh-font-body",
1118
1121
  "rh-transition-colors rh-duration-150",
1119
1122
  "rh-overflow-hidden",
1120
- statusClasses[status],
1123
+ statusClasses[visualStatus],
1121
1124
  radiusClasses3[radius],
1122
1125
  sizeClasses3[size],
1123
1126
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "",
@@ -1141,14 +1144,18 @@ var TextInput = forwardRef(function TextInput2({
1141
1144
  ref,
1142
1145
  id: inputId,
1143
1146
  disabled,
1144
- "aria-invalid": status === "error" || void 0,
1147
+ "aria-invalid": visualStatus === "error" || void 0,
1145
1148
  "aria-describedby": helperText ? `${inputId}-helper` : void 0,
1146
1149
  className: [
1147
1150
  "rh-flex-1 rh-min-w-0 rh-bg-transparent rh-outline-none",
1148
- "rh-text-text placeholder:rh-text-text-muted",
1151
+ "rh-text-text placeholder:rh-text-text-muted hover:placeholder:rh-text-text",
1149
1152
  disabled ? "rh-cursor-not-allowed" : ""
1150
1153
  ].filter(Boolean).join(" "),
1151
- ...rest
1154
+ onChange: (e) => {
1155
+ if (helperText) setIsHelperDismissed(true);
1156
+ onChange?.(e);
1157
+ },
1158
+ ...inputProps
1152
1159
  }
1153
1160
  ),
1154
1161
  rightIcon && /* @__PURE__ */ jsx(
@@ -1165,13 +1172,13 @@ var TextInput = forwardRef(function TextInput2({
1165
1172
  ]
1166
1173
  }
1167
1174
  ),
1168
- helperText && /* @__PURE__ */ jsxs(
1175
+ helperText && !isHelperDismissed && /* @__PURE__ */ jsxs(
1169
1176
  "span",
1170
1177
  {
1171
1178
  id: `${inputId}-helper`,
1172
1179
  className: [
1173
1180
  "rh-flex rh-items-center rh-gap-1 rh-text-xs",
1174
- helperStatusClasses[status]
1181
+ helperStatusClasses[visualStatus]
1175
1182
  ].join(" "),
1176
1183
  children: [
1177
1184
  /* @__PURE__ */ jsx(WarningCircleIcon, {}),
@@ -1464,8 +1471,8 @@ var RadioGroup = forwardRef(function RadioGroup2({
1464
1471
  );
1465
1472
  });
1466
1473
  var statusClasses2 = {
1467
- default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring focus-within:rh-ring-offset-2",
1468
- error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger focus-within:rh-ring-offset-2"
1474
+ default: "rh-border-border focus-within:rh-border-primary focus-within:rh-ring-2 focus-within:rh-ring-gray-200 ",
1475
+ error: "rh-border-danger focus-within:rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-red-100 "
1469
1476
  };
1470
1477
  var sizeClasses5 = {
1471
1478
  sm: "rh-min-h-[32px] rh-text-sm rh-px-input-x-sm",
@@ -1559,6 +1566,8 @@ var Select = forwardRef(function Select2(props, ref) {
1559
1566
  const helperId = React9.useId();
1560
1567
  const [isOpen, setIsOpen] = React9.useState(false);
1561
1568
  const [activeIndex, setActiveIndex] = React9.useState(-1);
1569
+ const [isHelperDismissed, setIsHelperDismissed] = React9.useState(false);
1570
+ React9.useRef({ query: "", lastAt: 0 });
1562
1571
  const wrapperRef = React9.useRef(null);
1563
1572
  const innerRef = React9.useRef(null);
1564
1573
  const listboxRef = React9.useRef(null);
@@ -1572,7 +1581,9 @@ var Select = forwardRef(function Select2(props, ref) {
1572
1581
  const isControlled = props.value !== void 0;
1573
1582
  const selectedValues = isControlled ? Array.isArray(props.value) ? props.value : props.value !== void 0 ? [props.value] : [] : internalValue;
1574
1583
  const enabledOptions = options.filter((o) => !o.disabled);
1584
+ const visualStatus = helperText && isHelperDismissed ? "default" : status;
1575
1585
  const handleSelect = (optionValue) => {
1586
+ if (helperText) setIsHelperDismissed(true);
1576
1587
  if (multiple) {
1577
1588
  const next = selectedValues.includes(optionValue) ? selectedValues.filter((v) => v !== optionValue) : [...selectedValues, optionValue];
1578
1589
  if (!isControlled) setInternalValue(next);
@@ -1722,17 +1733,17 @@ var Select = forwardRef(function Select2(props, ref) {
1722
1733
  "aria-controls": listboxId,
1723
1734
  "aria-labelledby": label ? `${triggerId}-label` : void 0,
1724
1735
  "aria-describedby": helperText ? helperId : void 0,
1725
- "aria-invalid": status === "error" || void 0,
1736
+ "aria-invalid": visualStatus === "error" || void 0,
1726
1737
  "aria-disabled": disabled || void 0,
1727
1738
  disabled,
1728
1739
  onClick: () => !disabled && setIsOpen((o) => !o),
1729
1740
  onKeyDown: handleKeyDown,
1730
1741
  className: [
1731
- "rh-flex rh-items-center rh-justify-between rh-gap-2",
1742
+ "rh-group rh-flex rh-items-center rh-justify-between rh-gap-2",
1732
1743
  "rh-border rh-bg-surface rh-font-body",
1733
1744
  "rh-transition-colors rh-duration-150",
1734
1745
  "rh-text-left rh-w-full",
1735
- statusClasses2[status],
1746
+ statusClasses2[visualStatus],
1736
1747
  radiusClasses4[radius],
1737
1748
  sizeClasses5[size],
1738
1749
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
@@ -1744,7 +1755,7 @@ var Select = forwardRef(function Select2(props, ref) {
1744
1755
  {
1745
1756
  className: [
1746
1757
  "rh-flex-1 rh-truncate",
1747
- displayText ? "rh-text-text" : "rh-text-text-muted"
1758
+ displayText ? "rh-text-text" : "rh-text-text-muted group-hover:rh-text-text"
1748
1759
  ].join(" "),
1749
1760
  children: displayText ?? placeholder
1750
1761
  }
@@ -1825,13 +1836,13 @@ var Select = forwardRef(function Select2(props, ref) {
1825
1836
  })
1826
1837
  }
1827
1838
  ),
1828
- helperText && /* @__PURE__ */ jsxs(
1839
+ helperText && !isHelperDismissed && /* @__PURE__ */ jsxs(
1829
1840
  "span",
1830
1841
  {
1831
1842
  id: helperId,
1832
1843
  className: [
1833
1844
  "rh-flex rh-items-center rh-gap-1 rh-text-xs",
1834
- helperStatusClasses2[status]
1845
+ helperStatusClasses2[visualStatus]
1835
1846
  ].join(" "),
1836
1847
  children: [
1837
1848
  /* @__PURE__ */ jsx(WarningCircleIcon, {}),