@rehagro/ui 1.0.38 → 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.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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[
|
|
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":
|
|
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
1157
|
"rh-text-text placeholder:rh-text-text-muted",
|
|
1155
1158
|
disabled ? "rh-cursor-not-allowed" : ""
|
|
1156
1159
|
].filter(Boolean).join(" "),
|
|
1157
|
-
|
|
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[
|
|
1187
|
+
helperStatusClasses[visualStatus]
|
|
1181
1188
|
].join(" "),
|
|
1182
1189
|
children: [
|
|
1183
1190
|
/* @__PURE__ */ jsxRuntime.jsx(WarningCircleIcon, {}),
|
|
@@ -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,7 +1739,7 @@ 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":
|
|
1742
|
+
"aria-invalid": visualStatus === "error" || void 0,
|
|
1732
1743
|
"aria-disabled": disabled || void 0,
|
|
1733
1744
|
disabled,
|
|
1734
1745
|
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
@@ -1738,7 +1749,7 @@ var Select = React9.forwardRef(function Select2(props, ref) {
|
|
|
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[
|
|
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",
|
|
@@ -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[
|
|
1851
|
+
helperStatusClasses2[visualStatus]
|
|
1841
1852
|
].join(" "),
|
|
1842
1853
|
children: [
|
|
1843
1854
|
/* @__PURE__ */ jsxRuntime.jsx(WarningCircleIcon, {}),
|