@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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -9
- package/dist/index.mjs.map +1 -1
- package/dist/native.d.mts +4 -2
- package/dist/native.d.ts +4 -2
- package/dist/native.js +8 -0
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +8 -0
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -48,6 +48,8 @@ var TOKEN_MAP = {
|
|
|
48
48
|
inputPxSm: { var: "--rh-input-px-sm", isColor: false },
|
|
49
49
|
inputPxMd: { var: "--rh-input-px-md", isColor: false },
|
|
50
50
|
inputPxLg: { var: "--rh-input-px-lg", isColor: false },
|
|
51
|
+
buttonHeightXxs: { var: "--rh-button-height-xxs", isColor: false },
|
|
52
|
+
buttonHeightXs: { var: "--rh-button-height-xs", isColor: false },
|
|
51
53
|
buttonHeightSm: { var: "--rh-button-height-sm", isColor: false },
|
|
52
54
|
buttonHeightMd: { var: "--rh-button-height-md", isColor: false },
|
|
53
55
|
buttonHeightLg: { var: "--rh-button-height-lg", isColor: false },
|
|
@@ -809,6 +811,8 @@ function getArbitraryColorStyle(variant, color) {
|
|
|
809
811
|
return { color, borderColor: "transparent" };
|
|
810
812
|
}
|
|
811
813
|
var sizeClasses = {
|
|
814
|
+
xxs: "rh-text-2xs rh-leading-none rh-px-1.5 rh-h-button-xxs rh-gap-1",
|
|
815
|
+
xs: "rh-text-xs rh-leading-none rh-px-2 rh-h-button-xs rh-gap-1",
|
|
812
816
|
sm: "rh-text-sm rh-px-3 rh-h-button-sm",
|
|
813
817
|
md: "rh-text-sm rh-px-4 rh-h-button-md",
|
|
814
818
|
lg: "rh-text-base rh-px-5 rh-h-button-lg",
|
|
@@ -958,6 +962,8 @@ function getArbitraryColorStyle2(variant, color) {
|
|
|
958
962
|
return { color, borderColor: "transparent" };
|
|
959
963
|
}
|
|
960
964
|
var sizeClasses2 = {
|
|
965
|
+
xxs: "rh-h-4 rh-w-4 rh-text-2xs",
|
|
966
|
+
xs: "rh-h-6 rh-w-6 rh-text-xs",
|
|
961
967
|
sm: "rh-h-8 rh-w-8 rh-text-sm",
|
|
962
968
|
md: "rh-h-10 rh-w-10 rh-text-base",
|
|
963
969
|
lg: "rh-h-12 rh-w-12 rh-text-lg"
|
|
@@ -1094,6 +1100,9 @@ var TextInput = forwardRef(function TextInput2({
|
|
|
1094
1100
|
...rest
|
|
1095
1101
|
}, ref) {
|
|
1096
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;
|
|
1097
1106
|
return /* @__PURE__ */ jsxs(
|
|
1098
1107
|
"div",
|
|
1099
1108
|
{
|
|
@@ -1111,7 +1120,7 @@ var TextInput = forwardRef(function TextInput2({
|
|
|
1111
1120
|
"rh-border rh-bg-surface rh-font-body",
|
|
1112
1121
|
"rh-transition-colors rh-duration-150",
|
|
1113
1122
|
"rh-overflow-hidden",
|
|
1114
|
-
statusClasses[
|
|
1123
|
+
statusClasses[visualStatus],
|
|
1115
1124
|
radiusClasses3[radius],
|
|
1116
1125
|
sizeClasses3[size],
|
|
1117
1126
|
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "",
|
|
@@ -1135,14 +1144,18 @@ var TextInput = forwardRef(function TextInput2({
|
|
|
1135
1144
|
ref,
|
|
1136
1145
|
id: inputId,
|
|
1137
1146
|
disabled,
|
|
1138
|
-
"aria-invalid":
|
|
1147
|
+
"aria-invalid": visualStatus === "error" || void 0,
|
|
1139
1148
|
"aria-describedby": helperText ? `${inputId}-helper` : void 0,
|
|
1140
1149
|
className: [
|
|
1141
1150
|
"rh-flex-1 rh-min-w-0 rh-bg-transparent rh-outline-none",
|
|
1142
1151
|
"rh-text-text placeholder:rh-text-text-muted",
|
|
1143
1152
|
disabled ? "rh-cursor-not-allowed" : ""
|
|
1144
1153
|
].filter(Boolean).join(" "),
|
|
1145
|
-
|
|
1154
|
+
onChange: (e) => {
|
|
1155
|
+
if (helperText) setIsHelperDismissed(true);
|
|
1156
|
+
onChange?.(e);
|
|
1157
|
+
},
|
|
1158
|
+
...inputProps
|
|
1146
1159
|
}
|
|
1147
1160
|
),
|
|
1148
1161
|
rightIcon && /* @__PURE__ */ jsx(
|
|
@@ -1159,13 +1172,13 @@ var TextInput = forwardRef(function TextInput2({
|
|
|
1159
1172
|
]
|
|
1160
1173
|
}
|
|
1161
1174
|
),
|
|
1162
|
-
helperText && /* @__PURE__ */ jsxs(
|
|
1175
|
+
helperText && !isHelperDismissed && /* @__PURE__ */ jsxs(
|
|
1163
1176
|
"span",
|
|
1164
1177
|
{
|
|
1165
1178
|
id: `${inputId}-helper`,
|
|
1166
1179
|
className: [
|
|
1167
1180
|
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
1168
|
-
helperStatusClasses[
|
|
1181
|
+
helperStatusClasses[visualStatus]
|
|
1169
1182
|
].join(" "),
|
|
1170
1183
|
children: [
|
|
1171
1184
|
/* @__PURE__ */ jsx(WarningCircleIcon, {}),
|
|
@@ -1553,6 +1566,8 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
1553
1566
|
const helperId = React9.useId();
|
|
1554
1567
|
const [isOpen, setIsOpen] = React9.useState(false);
|
|
1555
1568
|
const [activeIndex, setActiveIndex] = React9.useState(-1);
|
|
1569
|
+
const [isHelperDismissed, setIsHelperDismissed] = React9.useState(false);
|
|
1570
|
+
React9.useRef({ query: "", lastAt: 0 });
|
|
1556
1571
|
const wrapperRef = React9.useRef(null);
|
|
1557
1572
|
const innerRef = React9.useRef(null);
|
|
1558
1573
|
const listboxRef = React9.useRef(null);
|
|
@@ -1566,7 +1581,9 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
1566
1581
|
const isControlled = props.value !== void 0;
|
|
1567
1582
|
const selectedValues = isControlled ? Array.isArray(props.value) ? props.value : props.value !== void 0 ? [props.value] : [] : internalValue;
|
|
1568
1583
|
const enabledOptions = options.filter((o) => !o.disabled);
|
|
1584
|
+
const visualStatus = helperText && isHelperDismissed ? "default" : status;
|
|
1569
1585
|
const handleSelect = (optionValue) => {
|
|
1586
|
+
if (helperText) setIsHelperDismissed(true);
|
|
1570
1587
|
if (multiple) {
|
|
1571
1588
|
const next = selectedValues.includes(optionValue) ? selectedValues.filter((v) => v !== optionValue) : [...selectedValues, optionValue];
|
|
1572
1589
|
if (!isControlled) setInternalValue(next);
|
|
@@ -1716,7 +1733,7 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
1716
1733
|
"aria-controls": listboxId,
|
|
1717
1734
|
"aria-labelledby": label ? `${triggerId}-label` : void 0,
|
|
1718
1735
|
"aria-describedby": helperText ? helperId : void 0,
|
|
1719
|
-
"aria-invalid":
|
|
1736
|
+
"aria-invalid": visualStatus === "error" || void 0,
|
|
1720
1737
|
"aria-disabled": disabled || void 0,
|
|
1721
1738
|
disabled,
|
|
1722
1739
|
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
@@ -1726,7 +1743,7 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
1726
1743
|
"rh-border rh-bg-surface rh-font-body",
|
|
1727
1744
|
"rh-transition-colors rh-duration-150",
|
|
1728
1745
|
"rh-text-left rh-w-full",
|
|
1729
|
-
statusClasses2[
|
|
1746
|
+
statusClasses2[visualStatus],
|
|
1730
1747
|
radiusClasses4[radius],
|
|
1731
1748
|
sizeClasses5[size],
|
|
1732
1749
|
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
|
|
@@ -1819,13 +1836,13 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
1819
1836
|
})
|
|
1820
1837
|
}
|
|
1821
1838
|
),
|
|
1822
|
-
helperText && /* @__PURE__ */ jsxs(
|
|
1839
|
+
helperText && !isHelperDismissed && /* @__PURE__ */ jsxs(
|
|
1823
1840
|
"span",
|
|
1824
1841
|
{
|
|
1825
1842
|
id: helperId,
|
|
1826
1843
|
className: [
|
|
1827
1844
|
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
1828
|
-
helperStatusClasses2[
|
|
1845
|
+
helperStatusClasses2[visualStatus]
|
|
1829
1846
|
].join(" "),
|
|
1830
1847
|
children: [
|
|
1831
1848
|
/* @__PURE__ */ jsx(WarningCircleIcon, {}),
|