@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.js CHANGED
@@ -1056,8 +1056,8 @@ var IconButton = React9.forwardRef(function IconButton2({
1056
1056
  );
1057
1057
  });
1058
1058
  var statusClasses = {
1059
- default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring",
1060
- error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger"
1059
+ default: "rh-border-border focus-within:rh-border-primary focus-within:rh-ring-2 focus-within:rh-ring-gray-200",
1060
+ error: "rh-border-danger focus-within:rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-red-100"
1061
1061
  };
1062
1062
  var sizeClasses3 = {
1063
1063
  sm: "rh-h-input-sm rh-text-sm rh-px-input-x-sm",
@@ -1106,6 +1106,9 @@ var TextInput = React9.forwardRef(function TextInput2({
1106
1106
  ...rest
1107
1107
  }, ref) {
1108
1108
  const inputId = id || React9__default.default.useId();
1109
+ const [isHelperDismissed, setIsHelperDismissed] = React9__default.default.useState(false);
1110
+ const { onChange, ...inputProps } = rest;
1111
+ const visualStatus = helperText && isHelperDismissed ? "default" : status;
1109
1112
  return /* @__PURE__ */ jsxRuntime.jsxs(
1110
1113
  "div",
1111
1114
  {
@@ -1123,7 +1126,7 @@ var TextInput = React9.forwardRef(function TextInput2({
1123
1126
  "rh-border rh-bg-surface rh-font-body",
1124
1127
  "rh-transition-colors rh-duration-150",
1125
1128
  "rh-overflow-hidden",
1126
- statusClasses[status],
1129
+ statusClasses[visualStatus],
1127
1130
  radiusClasses3[radius],
1128
1131
  sizeClasses3[size],
1129
1132
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "",
@@ -1147,14 +1150,18 @@ var TextInput = React9.forwardRef(function TextInput2({
1147
1150
  ref,
1148
1151
  id: inputId,
1149
1152
  disabled,
1150
- "aria-invalid": status === "error" || void 0,
1153
+ "aria-invalid": visualStatus === "error" || void 0,
1151
1154
  "aria-describedby": helperText ? `${inputId}-helper` : void 0,
1152
1155
  className: [
1153
1156
  "rh-flex-1 rh-min-w-0 rh-bg-transparent rh-outline-none",
1154
- "rh-text-text placeholder:rh-text-text-muted",
1157
+ "rh-text-text placeholder:rh-text-text-muted hover:placeholder:rh-text-text",
1155
1158
  disabled ? "rh-cursor-not-allowed" : ""
1156
1159
  ].filter(Boolean).join(" "),
1157
- ...rest
1160
+ onChange: (e) => {
1161
+ if (helperText) setIsHelperDismissed(true);
1162
+ onChange?.(e);
1163
+ },
1164
+ ...inputProps
1158
1165
  }
1159
1166
  ),
1160
1167
  rightIcon && /* @__PURE__ */ jsxRuntime.jsx(
@@ -1171,13 +1178,13 @@ var TextInput = React9.forwardRef(function TextInput2({
1171
1178
  ]
1172
1179
  }
1173
1180
  ),
1174
- helperText && /* @__PURE__ */ jsxRuntime.jsxs(
1181
+ helperText && !isHelperDismissed && /* @__PURE__ */ jsxRuntime.jsxs(
1175
1182
  "span",
1176
1183
  {
1177
1184
  id: `${inputId}-helper`,
1178
1185
  className: [
1179
1186
  "rh-flex rh-items-center rh-gap-1 rh-text-xs",
1180
- helperStatusClasses[status]
1187
+ helperStatusClasses[visualStatus]
1181
1188
  ].join(" "),
1182
1189
  children: [
1183
1190
  /* @__PURE__ */ jsxRuntime.jsx(WarningCircleIcon, {}),
@@ -1470,8 +1477,8 @@ var RadioGroup = React9.forwardRef(function RadioGroup2({
1470
1477
  );
1471
1478
  });
1472
1479
  var statusClasses2 = {
1473
- default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring focus-within:rh-ring-offset-2",
1474
- error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger focus-within:rh-ring-offset-2"
1480
+ default: "rh-border-border focus-within:rh-border-primary focus-within:rh-ring-2 focus-within:rh-ring-gray-200 ",
1481
+ error: "rh-border-danger focus-within:rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-red-100 "
1475
1482
  };
1476
1483
  var sizeClasses5 = {
1477
1484
  sm: "rh-min-h-[32px] rh-text-sm rh-px-input-x-sm",
@@ -1565,6 +1572,8 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1565
1572
  const helperId = React9__default.default.useId();
1566
1573
  const [isOpen, setIsOpen] = React9__default.default.useState(false);
1567
1574
  const [activeIndex, setActiveIndex] = React9__default.default.useState(-1);
1575
+ const [isHelperDismissed, setIsHelperDismissed] = React9__default.default.useState(false);
1576
+ React9__default.default.useRef({ query: "", lastAt: 0 });
1568
1577
  const wrapperRef = React9__default.default.useRef(null);
1569
1578
  const innerRef = React9__default.default.useRef(null);
1570
1579
  const listboxRef = React9__default.default.useRef(null);
@@ -1578,7 +1587,9 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1578
1587
  const isControlled = props.value !== void 0;
1579
1588
  const selectedValues = isControlled ? Array.isArray(props.value) ? props.value : props.value !== void 0 ? [props.value] : [] : internalValue;
1580
1589
  const enabledOptions = options.filter((o) => !o.disabled);
1590
+ const visualStatus = helperText && isHelperDismissed ? "default" : status;
1581
1591
  const handleSelect = (optionValue) => {
1592
+ if (helperText) setIsHelperDismissed(true);
1582
1593
  if (multiple) {
1583
1594
  const next = selectedValues.includes(optionValue) ? selectedValues.filter((v) => v !== optionValue) : [...selectedValues, optionValue];
1584
1595
  if (!isControlled) setInternalValue(next);
@@ -1728,17 +1739,17 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1728
1739
  "aria-controls": listboxId,
1729
1740
  "aria-labelledby": label ? `${triggerId}-label` : void 0,
1730
1741
  "aria-describedby": helperText ? helperId : void 0,
1731
- "aria-invalid": status === "error" || void 0,
1742
+ "aria-invalid": visualStatus === "error" || void 0,
1732
1743
  "aria-disabled": disabled || void 0,
1733
1744
  disabled,
1734
1745
  onClick: () => !disabled && setIsOpen((o) => !o),
1735
1746
  onKeyDown: handleKeyDown,
1736
1747
  className: [
1737
- "rh-flex rh-items-center rh-justify-between rh-gap-2",
1748
+ "rh-group rh-flex rh-items-center rh-justify-between rh-gap-2",
1738
1749
  "rh-border rh-bg-surface rh-font-body",
1739
1750
  "rh-transition-colors rh-duration-150",
1740
1751
  "rh-text-left rh-w-full",
1741
- statusClasses2[status],
1752
+ statusClasses2[visualStatus],
1742
1753
  radiusClasses4[radius],
1743
1754
  sizeClasses5[size],
1744
1755
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
@@ -1750,7 +1761,7 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1750
1761
  {
1751
1762
  className: [
1752
1763
  "rh-flex-1 rh-truncate",
1753
- displayText ? "rh-text-text" : "rh-text-text-muted"
1764
+ displayText ? "rh-text-text" : "rh-text-text-muted group-hover:rh-text-text"
1754
1765
  ].join(" "),
1755
1766
  children: displayText ?? placeholder
1756
1767
  }
@@ -1831,13 +1842,13 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1831
1842
  })
1832
1843
  }
1833
1844
  ),
1834
- helperText && /* @__PURE__ */ jsxRuntime.jsxs(
1845
+ helperText && !isHelperDismissed && /* @__PURE__ */ jsxRuntime.jsxs(
1835
1846
  "span",
1836
1847
  {
1837
1848
  id: helperId,
1838
1849
  className: [
1839
1850
  "rh-flex rh-items-center rh-gap-1 rh-text-xs",
1840
- helperStatusClasses2[status]
1851
+ helperStatusClasses2[visualStatus]
1841
1852
  ].join(" "),
1842
1853
  children: [
1843
1854
  /* @__PURE__ */ jsxRuntime.jsx(WarningCircleIcon, {}),