@rehagro/ui 1.0.37 → 1.0.39

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.d.mts CHANGED
@@ -131,6 +131,8 @@ type RehagroTheme = {
131
131
  inputPxMd?: string;
132
132
  inputPxLg?: string;
133
133
  /** Button heights */
134
+ buttonHeightXxs?: string;
135
+ buttonHeightXs?: string;
134
136
  buttonHeightSm?: string;
135
137
  buttonHeightMd?: string;
136
138
  buttonHeightLg?: string;
@@ -150,7 +152,7 @@ type RehagroProviderProps = {
150
152
  declare function RehagroProvider({ theme, toastPosition, children }: RehagroProviderProps): react_jsx_runtime.JSX.Element;
151
153
 
152
154
  type ButtonVariant = "solid" | "outline" | "ghost";
153
- type ButtonSize = "sm" | "md" | "lg" | "xl";
155
+ type ButtonSize = "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
154
156
  type ButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
155
157
  type ButtonHoverStyle = {
156
158
  /** Background on hover */
@@ -204,7 +206,7 @@ declare const Button: React__default.ForwardRefExoticComponent<React__default.Bu
204
206
  } & React__default.RefAttributes<HTMLButtonElement>>;
205
207
 
206
208
  type IconButtonVariant = "solid" | "outline" | "ghost";
207
- type IconButtonSize = "sm" | "md" | "lg";
209
+ type IconButtonSize = "xxs" | "xs" | "sm" | "md" | "lg";
208
210
  type IconButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
209
211
  type IconButtonColor = ButtonColor;
210
212
  type IconButtonProps = React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
package/dist/index.d.ts CHANGED
@@ -131,6 +131,8 @@ type RehagroTheme = {
131
131
  inputPxMd?: string;
132
132
  inputPxLg?: string;
133
133
  /** Button heights */
134
+ buttonHeightXxs?: string;
135
+ buttonHeightXs?: string;
134
136
  buttonHeightSm?: string;
135
137
  buttonHeightMd?: string;
136
138
  buttonHeightLg?: string;
@@ -150,7 +152,7 @@ type RehagroProviderProps = {
150
152
  declare function RehagroProvider({ theme, toastPosition, children }: RehagroProviderProps): react_jsx_runtime.JSX.Element;
151
153
 
152
154
  type ButtonVariant = "solid" | "outline" | "ghost";
153
- type ButtonSize = "sm" | "md" | "lg" | "xl";
155
+ type ButtonSize = "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
154
156
  type ButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
155
157
  type ButtonHoverStyle = {
156
158
  /** Background on hover */
@@ -204,7 +206,7 @@ declare const Button: React__default.ForwardRefExoticComponent<React__default.Bu
204
206
  } & React__default.RefAttributes<HTMLButtonElement>>;
205
207
 
206
208
  type IconButtonVariant = "solid" | "outline" | "ghost";
207
- type IconButtonSize = "sm" | "md" | "lg";
209
+ type IconButtonSize = "xxs" | "xs" | "sm" | "md" | "lg";
208
210
  type IconButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
209
211
  type IconButtonColor = ButtonColor;
210
212
  type IconButtonProps = React__default.ButtonHTMLAttributes<HTMLButtonElement> & {
package/dist/index.js CHANGED
@@ -54,6 +54,8 @@ var TOKEN_MAP = {
54
54
  inputPxSm: { var: "--rh-input-px-sm", isColor: false },
55
55
  inputPxMd: { var: "--rh-input-px-md", isColor: false },
56
56
  inputPxLg: { var: "--rh-input-px-lg", isColor: false },
57
+ buttonHeightXxs: { var: "--rh-button-height-xxs", isColor: false },
58
+ buttonHeightXs: { var: "--rh-button-height-xs", isColor: false },
57
59
  buttonHeightSm: { var: "--rh-button-height-sm", isColor: false },
58
60
  buttonHeightMd: { var: "--rh-button-height-md", isColor: false },
59
61
  buttonHeightLg: { var: "--rh-button-height-lg", isColor: false },
@@ -815,6 +817,8 @@ function getArbitraryColorStyle(variant, color) {
815
817
  return { color, borderColor: "transparent" };
816
818
  }
817
819
  var sizeClasses = {
820
+ xxs: "rh-text-2xs rh-leading-none rh-px-1.5 rh-h-button-xxs rh-gap-1",
821
+ xs: "rh-text-xs rh-leading-none rh-px-2 rh-h-button-xs rh-gap-1",
818
822
  sm: "rh-text-sm rh-px-3 rh-h-button-sm",
819
823
  md: "rh-text-sm rh-px-4 rh-h-button-md",
820
824
  lg: "rh-text-base rh-px-5 rh-h-button-lg",
@@ -964,6 +968,8 @@ function getArbitraryColorStyle2(variant, color) {
964
968
  return { color, borderColor: "transparent" };
965
969
  }
966
970
  var sizeClasses2 = {
971
+ xxs: "rh-h-4 rh-w-4 rh-text-2xs",
972
+ xs: "rh-h-6 rh-w-6 rh-text-xs",
967
973
  sm: "rh-h-8 rh-w-8 rh-text-sm",
968
974
  md: "rh-h-10 rh-w-10 rh-text-base",
969
975
  lg: "rh-h-12 rh-w-12 rh-text-lg"
@@ -1100,6 +1106,9 @@ var TextInput = React9.forwardRef(function TextInput2({
1100
1106
  ...rest
1101
1107
  }, ref) {
1102
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;
1103
1112
  return /* @__PURE__ */ jsxRuntime.jsxs(
1104
1113
  "div",
1105
1114
  {
@@ -1117,7 +1126,7 @@ var TextInput = React9.forwardRef(function TextInput2({
1117
1126
  "rh-border rh-bg-surface rh-font-body",
1118
1127
  "rh-transition-colors rh-duration-150",
1119
1128
  "rh-overflow-hidden",
1120
- statusClasses[status],
1129
+ statusClasses[visualStatus],
1121
1130
  radiusClasses3[radius],
1122
1131
  sizeClasses3[size],
1123
1132
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "",
@@ -1141,14 +1150,18 @@ var TextInput = React9.forwardRef(function TextInput2({
1141
1150
  ref,
1142
1151
  id: inputId,
1143
1152
  disabled,
1144
- "aria-invalid": status === "error" || void 0,
1153
+ "aria-invalid": visualStatus === "error" || void 0,
1145
1154
  "aria-describedby": helperText ? `${inputId}-helper` : void 0,
1146
1155
  className: [
1147
1156
  "rh-flex-1 rh-min-w-0 rh-bg-transparent rh-outline-none",
1148
1157
  "rh-text-text placeholder:rh-text-text-muted",
1149
1158
  disabled ? "rh-cursor-not-allowed" : ""
1150
1159
  ].filter(Boolean).join(" "),
1151
- ...rest
1160
+ onChange: (e) => {
1161
+ if (helperText) setIsHelperDismissed(true);
1162
+ onChange?.(e);
1163
+ },
1164
+ ...inputProps
1152
1165
  }
1153
1166
  ),
1154
1167
  rightIcon && /* @__PURE__ */ jsxRuntime.jsx(
@@ -1165,13 +1178,13 @@ var TextInput = React9.forwardRef(function TextInput2({
1165
1178
  ]
1166
1179
  }
1167
1180
  ),
1168
- helperText && /* @__PURE__ */ jsxRuntime.jsxs(
1181
+ helperText && !isHelperDismissed && /* @__PURE__ */ jsxRuntime.jsxs(
1169
1182
  "span",
1170
1183
  {
1171
1184
  id: `${inputId}-helper`,
1172
1185
  className: [
1173
1186
  "rh-flex rh-items-center rh-gap-1 rh-text-xs",
1174
- helperStatusClasses[status]
1187
+ helperStatusClasses[visualStatus]
1175
1188
  ].join(" "),
1176
1189
  children: [
1177
1190
  /* @__PURE__ */ jsxRuntime.jsx(WarningCircleIcon, {}),
@@ -1559,6 +1572,8 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1559
1572
  const helperId = React9__default.default.useId();
1560
1573
  const [isOpen, setIsOpen] = React9__default.default.useState(false);
1561
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 });
1562
1577
  const wrapperRef = React9__default.default.useRef(null);
1563
1578
  const innerRef = React9__default.default.useRef(null);
1564
1579
  const listboxRef = React9__default.default.useRef(null);
@@ -1572,7 +1587,9 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1572
1587
  const isControlled = props.value !== void 0;
1573
1588
  const selectedValues = isControlled ? Array.isArray(props.value) ? props.value : props.value !== void 0 ? [props.value] : [] : internalValue;
1574
1589
  const enabledOptions = options.filter((o) => !o.disabled);
1590
+ const visualStatus = helperText && isHelperDismissed ? "default" : status;
1575
1591
  const handleSelect = (optionValue) => {
1592
+ if (helperText) setIsHelperDismissed(true);
1576
1593
  if (multiple) {
1577
1594
  const next = selectedValues.includes(optionValue) ? selectedValues.filter((v) => v !== optionValue) : [...selectedValues, optionValue];
1578
1595
  if (!isControlled) setInternalValue(next);
@@ -1722,7 +1739,7 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1722
1739
  "aria-controls": listboxId,
1723
1740
  "aria-labelledby": label ? `${triggerId}-label` : void 0,
1724
1741
  "aria-describedby": helperText ? helperId : void 0,
1725
- "aria-invalid": status === "error" || void 0,
1742
+ "aria-invalid": visualStatus === "error" || void 0,
1726
1743
  "aria-disabled": disabled || void 0,
1727
1744
  disabled,
1728
1745
  onClick: () => !disabled && setIsOpen((o) => !o),
@@ -1732,7 +1749,7 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1732
1749
  "rh-border rh-bg-surface rh-font-body",
1733
1750
  "rh-transition-colors rh-duration-150",
1734
1751
  "rh-text-left rh-w-full",
1735
- statusClasses2[status],
1752
+ statusClasses2[visualStatus],
1736
1753
  radiusClasses4[radius],
1737
1754
  sizeClasses5[size],
1738
1755
  disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
@@ -1825,13 +1842,13 @@ var Select = React9.forwardRef(function Select2(props, ref) {
1825
1842
  })
1826
1843
  }
1827
1844
  ),
1828
- helperText && /* @__PURE__ */ jsxRuntime.jsxs(
1845
+ helperText && !isHelperDismissed && /* @__PURE__ */ jsxRuntime.jsxs(
1829
1846
  "span",
1830
1847
  {
1831
1848
  id: helperId,
1832
1849
  className: [
1833
1850
  "rh-flex rh-items-center rh-gap-1 rh-text-xs",
1834
- helperStatusClasses2[status]
1851
+ helperStatusClasses2[visualStatus]
1835
1852
  ].join(" "),
1836
1853
  children: [
1837
1854
  /* @__PURE__ */ jsxRuntime.jsx(WarningCircleIcon, {}),