@rehagro/ui 1.0.12 → 1.0.13
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 +545 -614
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +545 -614
- package/dist/index.mjs.map +1 -1
- package/dist/native.js +15 -2
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +15 -2
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -353,27 +353,19 @@ var Toast = React8.forwardRef(function Toast2({
|
|
|
353
353
|
className: [
|
|
354
354
|
"rh-flex rh-items-start rh-gap-3",
|
|
355
355
|
"rh-w-80 rh-rounded-sm rh-border rh-p-4",
|
|
356
|
-
"rh-shadow-md rh-font-
|
|
356
|
+
"rh-shadow-md rh-font-body",
|
|
357
357
|
containerStyles[styleKey],
|
|
358
358
|
className
|
|
359
359
|
].filter(Boolean).join(" "),
|
|
360
360
|
...rest,
|
|
361
361
|
children: [
|
|
362
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-flex-shrink-0 rh-mt-0.5", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
363
|
-
Icon,
|
|
364
|
-
{
|
|
365
|
-
className: ["rh-w-5 rh-h-5", iconStyles[styleKey]].filter(Boolean).join(" ")
|
|
366
|
-
}
|
|
367
|
-
) }),
|
|
362
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-flex-shrink-0 rh-mt-0.5", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: ["rh-w-5 rh-h-5", iconStyles[styleKey]].filter(Boolean).join(" ") }) }),
|
|
368
363
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex-1 rh-min-w-0", children: [
|
|
369
364
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "rh-text-sm rh-font-semibold rh-leading-tight", children: title }),
|
|
370
365
|
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
371
366
|
"p",
|
|
372
367
|
{
|
|
373
|
-
className: [
|
|
374
|
-
"rh-mt-1 rh-text-sm rh-leading-normal",
|
|
375
|
-
descriptionStyles[styleKey]
|
|
376
|
-
].filter(Boolean).join(" "),
|
|
368
|
+
className: ["rh-mt-1 rh-text-sm rh-leading-normal", descriptionStyles[styleKey]].filter(Boolean).join(" "),
|
|
377
369
|
children: description
|
|
378
370
|
}
|
|
379
371
|
),
|
|
@@ -968,7 +960,7 @@ var TextInput = React8.forwardRef(function TextInput2({
|
|
|
968
960
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
969
961
|
"div",
|
|
970
962
|
{
|
|
971
|
-
className: ["rh-flex rh-flex-col rh-gap-[0.5rem] rh-font-
|
|
963
|
+
className: ["rh-flex rh-flex-col rh-gap-[0.5rem] rh-font-body", wrapperClassName].filter(Boolean).join(" "),
|
|
972
964
|
children: [
|
|
973
965
|
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: inputId, className: "rh-flex rh-items-baseline rh-gap-1", children: [
|
|
974
966
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `rh-text-sm ${labelWeightClasses[labelWeight]} rh-text-text`, children: label }),
|
|
@@ -979,7 +971,7 @@ var TextInput = React8.forwardRef(function TextInput2({
|
|
|
979
971
|
{
|
|
980
972
|
className: [
|
|
981
973
|
"rh-flex rh-items-center rh-gap-2",
|
|
982
|
-
"rh-border rh-bg-surface rh-font-
|
|
974
|
+
"rh-border rh-bg-surface rh-font-body",
|
|
983
975
|
"rh-transition-colors rh-duration-150",
|
|
984
976
|
statusClasses[status],
|
|
985
977
|
radiusClasses3[radius],
|
|
@@ -1117,7 +1109,7 @@ var Checkbox = React8.forwardRef(function Checkbox2({
|
|
|
1117
1109
|
{
|
|
1118
1110
|
htmlFor: inputId,
|
|
1119
1111
|
className: [
|
|
1120
|
-
"rh-inline-flex rh-items-center rh-gap-2 rh-font-
|
|
1112
|
+
"rh-inline-flex rh-items-center rh-gap-2 rh-font-body rh-select-none",
|
|
1121
1113
|
disabled ? "rh-cursor-not-allowed rh-opacity-50" : "rh-cursor-pointer",
|
|
1122
1114
|
className
|
|
1123
1115
|
].filter(Boolean).join(" "),
|
|
@@ -1236,319 +1228,307 @@ var CheckIcon2 = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
1236
1228
|
)
|
|
1237
1229
|
}
|
|
1238
1230
|
);
|
|
1239
|
-
var Select = React8.forwardRef(
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1231
|
+
var Select = React8.forwardRef(function Select2(props, ref) {
|
|
1232
|
+
const {
|
|
1233
|
+
options,
|
|
1234
|
+
label,
|
|
1235
|
+
subtitle,
|
|
1236
|
+
placeholder = "Select",
|
|
1237
|
+
status = "default",
|
|
1238
|
+
size = "md",
|
|
1239
|
+
radius = "xs",
|
|
1240
|
+
helperText,
|
|
1241
|
+
disabled = false,
|
|
1242
|
+
className = "",
|
|
1243
|
+
wrapperClassName = "",
|
|
1244
|
+
multiple = false
|
|
1245
|
+
} = props;
|
|
1246
|
+
const triggerId = React8__default.default.useId();
|
|
1247
|
+
const listboxId = React8__default.default.useId();
|
|
1248
|
+
const helperId = React8__default.default.useId();
|
|
1249
|
+
const [isOpen, setIsOpen] = React8__default.default.useState(false);
|
|
1250
|
+
const [activeIndex, setActiveIndex] = React8__default.default.useState(-1);
|
|
1251
|
+
const wrapperRef = React8__default.default.useRef(null);
|
|
1252
|
+
const innerRef = React8__default.default.useRef(null);
|
|
1253
|
+
const listboxRef = React8__default.default.useRef(null);
|
|
1254
|
+
React8__default.default.useImperativeHandle(ref, () => innerRef.current);
|
|
1255
|
+
const [internalValue, setInternalValue] = React8__default.default.useState(() => {
|
|
1256
|
+
if (props.defaultValue !== void 0) {
|
|
1257
|
+
return Array.isArray(props.defaultValue) ? props.defaultValue : [props.defaultValue];
|
|
1258
|
+
}
|
|
1259
|
+
return [];
|
|
1260
|
+
});
|
|
1261
|
+
const isControlled = props.value !== void 0;
|
|
1262
|
+
const selectedValues = isControlled ? Array.isArray(props.value) ? props.value : props.value !== void 0 ? [props.value] : [] : internalValue;
|
|
1263
|
+
const enabledOptions = options.filter((o) => !o.disabled);
|
|
1264
|
+
const handleSelect = (optionValue) => {
|
|
1265
|
+
if (multiple) {
|
|
1266
|
+
const next = selectedValues.includes(optionValue) ? selectedValues.filter((v) => v !== optionValue) : [...selectedValues, optionValue];
|
|
1267
|
+
if (!isControlled) setInternalValue(next);
|
|
1268
|
+
props.onChange?.(next);
|
|
1269
|
+
} else {
|
|
1270
|
+
const next = [optionValue];
|
|
1271
|
+
if (!isControlled) setInternalValue(next);
|
|
1272
|
+
props.onChange?.(optionValue);
|
|
1273
|
+
setIsOpen(false);
|
|
1274
|
+
innerRef.current?.focus();
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
const displayText = React8__default.default.useMemo(() => {
|
|
1278
|
+
if (selectedValues.length === 0) return null;
|
|
1279
|
+
if (!multiple) {
|
|
1280
|
+
return options.find((o) => o.value === selectedValues[0])?.label ?? null;
|
|
1281
|
+
}
|
|
1282
|
+
const selectedLabels = selectedValues.map((v) => options.find((o) => o.value === v)?.label).filter(Boolean);
|
|
1283
|
+
if (selectedLabels.length === 0) return null;
|
|
1284
|
+
if (selectedLabels.length === 1) return selectedLabels[0];
|
|
1285
|
+
return `${selectedLabels.length} selected`;
|
|
1286
|
+
}, [selectedValues, options, multiple]);
|
|
1287
|
+
React8__default.default.useEffect(() => {
|
|
1288
|
+
if (!isOpen) return;
|
|
1289
|
+
const handleClickOutside = (e) => {
|
|
1290
|
+
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
1291
|
+
setIsOpen(false);
|
|
1267
1292
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
if (!isControlled) setInternalValue(next);
|
|
1277
|
-
props.onChange?.(next);
|
|
1278
|
-
} else {
|
|
1279
|
-
const next = [optionValue];
|
|
1280
|
-
if (!isControlled) setInternalValue(next);
|
|
1281
|
-
props.onChange?.(optionValue);
|
|
1293
|
+
};
|
|
1294
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1295
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1296
|
+
}, [isOpen]);
|
|
1297
|
+
React8__default.default.useEffect(() => {
|
|
1298
|
+
if (!isOpen) return;
|
|
1299
|
+
const handleEscape = (e) => {
|
|
1300
|
+
if (e.key === "Escape") {
|
|
1282
1301
|
setIsOpen(false);
|
|
1283
1302
|
innerRef.current?.focus();
|
|
1284
1303
|
}
|
|
1285
1304
|
};
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
React8__default.default.useEffect(() => {
|
|
1318
|
-
if (!isOpen || activeIndex < 0) return;
|
|
1319
|
-
const listbox = listboxRef.current;
|
|
1320
|
-
if (!listbox) return;
|
|
1321
|
-
const activeEl = listbox.children[activeIndex];
|
|
1322
|
-
if (typeof activeEl?.scrollIntoView === "function") {
|
|
1323
|
-
activeEl.scrollIntoView({ block: "nearest" });
|
|
1324
|
-
}
|
|
1325
|
-
}, [activeIndex, isOpen]);
|
|
1326
|
-
React8__default.default.useEffect(() => {
|
|
1327
|
-
if (isOpen) {
|
|
1328
|
-
const firstSelectedIdx = options.findIndex(
|
|
1329
|
-
(o) => !o.disabled && selectedValues.includes(o.value)
|
|
1330
|
-
);
|
|
1331
|
-
setActiveIndex(firstSelectedIdx >= 0 ? firstSelectedIdx : 0);
|
|
1332
|
-
} else {
|
|
1333
|
-
setActiveIndex(-1);
|
|
1334
|
-
}
|
|
1335
|
-
}, [isOpen]);
|
|
1336
|
-
const handleKeyDown = (e) => {
|
|
1337
|
-
if (disabled) return;
|
|
1338
|
-
switch (e.key) {
|
|
1339
|
-
case "ArrowDown":
|
|
1340
|
-
case "Down": {
|
|
1341
|
-
e.preventDefault();
|
|
1342
|
-
if (!isOpen) {
|
|
1343
|
-
setIsOpen(true);
|
|
1344
|
-
return;
|
|
1345
|
-
}
|
|
1346
|
-
setActiveIndex((prev) => {
|
|
1347
|
-
for (let i = prev + 1; i < options.length; i++) {
|
|
1348
|
-
if (!options[i].disabled) return i;
|
|
1349
|
-
}
|
|
1350
|
-
return prev;
|
|
1351
|
-
});
|
|
1352
|
-
break;
|
|
1353
|
-
}
|
|
1354
|
-
case "ArrowUp":
|
|
1355
|
-
case "Up": {
|
|
1356
|
-
e.preventDefault();
|
|
1357
|
-
if (!isOpen) {
|
|
1358
|
-
setIsOpen(true);
|
|
1359
|
-
return;
|
|
1360
|
-
}
|
|
1361
|
-
setActiveIndex((prev) => {
|
|
1362
|
-
for (let i = prev - 1; i >= 0; i--) {
|
|
1363
|
-
if (!options[i].disabled) return i;
|
|
1364
|
-
}
|
|
1365
|
-
return prev;
|
|
1366
|
-
});
|
|
1367
|
-
break;
|
|
1305
|
+
document.addEventListener("keydown", handleEscape);
|
|
1306
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
1307
|
+
}, [isOpen]);
|
|
1308
|
+
React8__default.default.useEffect(() => {
|
|
1309
|
+
if (!isOpen || activeIndex < 0) return;
|
|
1310
|
+
const listbox = listboxRef.current;
|
|
1311
|
+
if (!listbox) return;
|
|
1312
|
+
const activeEl = listbox.children[activeIndex];
|
|
1313
|
+
if (typeof activeEl?.scrollIntoView === "function") {
|
|
1314
|
+
activeEl.scrollIntoView({ block: "nearest" });
|
|
1315
|
+
}
|
|
1316
|
+
}, [activeIndex, isOpen]);
|
|
1317
|
+
React8__default.default.useEffect(() => {
|
|
1318
|
+
if (isOpen) {
|
|
1319
|
+
const firstSelectedIdx = options.findIndex(
|
|
1320
|
+
(o) => !o.disabled && selectedValues.includes(o.value)
|
|
1321
|
+
);
|
|
1322
|
+
setActiveIndex(firstSelectedIdx >= 0 ? firstSelectedIdx : 0);
|
|
1323
|
+
} else {
|
|
1324
|
+
setActiveIndex(-1);
|
|
1325
|
+
}
|
|
1326
|
+
}, [isOpen]);
|
|
1327
|
+
const handleKeyDown = (e) => {
|
|
1328
|
+
if (disabled) return;
|
|
1329
|
+
switch (e.key) {
|
|
1330
|
+
case "ArrowDown":
|
|
1331
|
+
case "Down": {
|
|
1332
|
+
e.preventDefault();
|
|
1333
|
+
if (!isOpen) {
|
|
1334
|
+
setIsOpen(true);
|
|
1335
|
+
return;
|
|
1368
1336
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
if (!isOpen) {
|
|
1373
|
-
setIsOpen(true);
|
|
1374
|
-
} else if (activeIndex >= 0 && !options[activeIndex].disabled) {
|
|
1375
|
-
handleSelect(options[activeIndex].value);
|
|
1337
|
+
setActiveIndex((prev) => {
|
|
1338
|
+
for (let i = prev + 1; i < options.length; i++) {
|
|
1339
|
+
if (!options[i].disabled) return i;
|
|
1376
1340
|
}
|
|
1377
|
-
|
|
1341
|
+
return prev;
|
|
1342
|
+
});
|
|
1343
|
+
break;
|
|
1344
|
+
}
|
|
1345
|
+
case "ArrowUp":
|
|
1346
|
+
case "Up": {
|
|
1347
|
+
e.preventDefault();
|
|
1348
|
+
if (!isOpen) {
|
|
1349
|
+
setIsOpen(true);
|
|
1350
|
+
return;
|
|
1378
1351
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
const idx = enabledOptions.length > 0 ? options.indexOf(enabledOptions[0]) : 0;
|
|
1383
|
-
setActiveIndex(idx);
|
|
1352
|
+
setActiveIndex((prev) => {
|
|
1353
|
+
for (let i = prev - 1; i >= 0; i--) {
|
|
1354
|
+
if (!options[i].disabled) return i;
|
|
1384
1355
|
}
|
|
1385
|
-
|
|
1356
|
+
return prev;
|
|
1357
|
+
});
|
|
1358
|
+
break;
|
|
1359
|
+
}
|
|
1360
|
+
case "Enter":
|
|
1361
|
+
case " ": {
|
|
1362
|
+
e.preventDefault();
|
|
1363
|
+
if (!isOpen) {
|
|
1364
|
+
setIsOpen(true);
|
|
1365
|
+
} else if (activeIndex >= 0 && !options[activeIndex].disabled) {
|
|
1366
|
+
handleSelect(options[activeIndex].value);
|
|
1386
1367
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1368
|
+
break;
|
|
1369
|
+
}
|
|
1370
|
+
case "Home": {
|
|
1371
|
+
e.preventDefault();
|
|
1372
|
+
if (isOpen) {
|
|
1373
|
+
const idx = enabledOptions.length > 0 ? options.indexOf(enabledOptions[0]) : 0;
|
|
1374
|
+
setActiveIndex(idx);
|
|
1394
1375
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1378
|
+
case "End": {
|
|
1379
|
+
e.preventDefault();
|
|
1380
|
+
if (isOpen) {
|
|
1381
|
+
const idx = enabledOptions.length > 0 ? options.indexOf(enabledOptions[enabledOptions.length - 1]) : options.length - 1;
|
|
1382
|
+
setActiveIndex(idx);
|
|
1398
1383
|
}
|
|
1384
|
+
break;
|
|
1399
1385
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
{
|
|
1404
|
-
ref: wrapperRef,
|
|
1405
|
-
className: [
|
|
1406
|
-
"rh-relative rh-flex rh-flex-col rh-gap-1 rh-font-sans",
|
|
1407
|
-
wrapperClassName
|
|
1408
|
-
].filter(Boolean).join(" "),
|
|
1409
|
-
children: [
|
|
1410
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1411
|
-
"label",
|
|
1412
|
-
{
|
|
1413
|
-
id: `${triggerId}-label`,
|
|
1414
|
-
className: "rh-flex rh-items-baseline rh-gap-1",
|
|
1415
|
-
children: [
|
|
1416
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: label }),
|
|
1417
|
-
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-text-text-muted", children: subtitle })
|
|
1418
|
-
]
|
|
1419
|
-
}
|
|
1420
|
-
),
|
|
1421
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1422
|
-
"button",
|
|
1423
|
-
{
|
|
1424
|
-
ref: innerRef,
|
|
1425
|
-
id: triggerId,
|
|
1426
|
-
type: "button",
|
|
1427
|
-
role: "combobox",
|
|
1428
|
-
"aria-expanded": isOpen,
|
|
1429
|
-
"aria-haspopup": "listbox",
|
|
1430
|
-
"aria-controls": listboxId,
|
|
1431
|
-
"aria-labelledby": label ? `${triggerId}-label` : void 0,
|
|
1432
|
-
"aria-describedby": helperText ? helperId : void 0,
|
|
1433
|
-
"aria-invalid": status === "error" || void 0,
|
|
1434
|
-
"aria-disabled": disabled || void 0,
|
|
1435
|
-
disabled,
|
|
1436
|
-
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
1437
|
-
onKeyDown: handleKeyDown,
|
|
1438
|
-
className: [
|
|
1439
|
-
"rh-flex rh-items-center rh-justify-between rh-gap-2",
|
|
1440
|
-
"rh-border rh-bg-surface rh-font-sans",
|
|
1441
|
-
"rh-transition-colors rh-duration-150",
|
|
1442
|
-
"rh-text-left rh-w-full",
|
|
1443
|
-
statusClasses2[status],
|
|
1444
|
-
radiusClasses4[radius],
|
|
1445
|
-
sizeClasses5[size],
|
|
1446
|
-
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
|
|
1447
|
-
className
|
|
1448
|
-
].filter(Boolean).join(" "),
|
|
1449
|
-
children: [
|
|
1450
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1451
|
-
"span",
|
|
1452
|
-
{
|
|
1453
|
-
className: [
|
|
1454
|
-
"rh-flex-1 rh-truncate",
|
|
1455
|
-
displayText ? "rh-text-text" : "rh-text-text-muted"
|
|
1456
|
-
].join(" "),
|
|
1457
|
-
children: displayText ?? placeholder
|
|
1458
|
-
}
|
|
1459
|
-
),
|
|
1460
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1461
|
-
ChevronIcon,
|
|
1462
|
-
{
|
|
1463
|
-
className: [
|
|
1464
|
-
"rh-w-5 rh-h-5 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150",
|
|
1465
|
-
isOpen ? "rh-rotate-180" : ""
|
|
1466
|
-
].filter(Boolean).join(" ")
|
|
1467
|
-
}
|
|
1468
|
-
)
|
|
1469
|
-
]
|
|
1470
|
-
}
|
|
1471
|
-
),
|
|
1472
|
-
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1473
|
-
"ul",
|
|
1474
|
-
{
|
|
1475
|
-
ref: listboxRef,
|
|
1476
|
-
id: listboxId,
|
|
1477
|
-
role: "listbox",
|
|
1478
|
-
"aria-labelledby": label ? `${triggerId}-label` : triggerId,
|
|
1479
|
-
"aria-multiselectable": multiple || void 0,
|
|
1480
|
-
tabIndex: -1,
|
|
1481
|
-
className: [
|
|
1482
|
-
"rh-absolute rh-z-50 rh-w-full rh-mt-1",
|
|
1483
|
-
"rh-border rh-border-border rh-bg-surface",
|
|
1484
|
-
"rh-shadow-md rh-overflow-auto rh-max-h-60",
|
|
1485
|
-
"rh-py-1",
|
|
1486
|
-
dropdownRadiusClasses[radius]
|
|
1487
|
-
].filter(Boolean).join(" "),
|
|
1488
|
-
style: { top: "100%" },
|
|
1489
|
-
children: options.map((option, index) => {
|
|
1490
|
-
const isSelected = selectedValues.includes(option.value);
|
|
1491
|
-
const isActive = index === activeIndex;
|
|
1492
|
-
const isDisabled = option.disabled;
|
|
1493
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1494
|
-
"li",
|
|
1495
|
-
{
|
|
1496
|
-
id: `${listboxId}-option-${index}`,
|
|
1497
|
-
role: "option",
|
|
1498
|
-
"aria-selected": isSelected,
|
|
1499
|
-
"aria-disabled": isDisabled || void 0,
|
|
1500
|
-
onClick: () => {
|
|
1501
|
-
if (!isDisabled) handleSelect(option.value);
|
|
1502
|
-
},
|
|
1503
|
-
onMouseEnter: () => {
|
|
1504
|
-
if (!isDisabled) setActiveIndex(index);
|
|
1505
|
-
},
|
|
1506
|
-
className: [
|
|
1507
|
-
"rh-flex rh-items-center rh-justify-between rh-gap-2",
|
|
1508
|
-
"rh-transition-colors rh-duration-150",
|
|
1509
|
-
optionSizeClasses[size],
|
|
1510
|
-
isDisabled ? "rh-opacity-50 rh-cursor-not-allowed" : "rh-cursor-pointer",
|
|
1511
|
-
isActive && !isDisabled ? "rh-bg-background" : "",
|
|
1512
|
-
isSelected && !isActive ? "rh-bg-primary/5" : ""
|
|
1513
|
-
].filter(Boolean).join(" "),
|
|
1514
|
-
children: [
|
|
1515
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-flex-1 rh-truncate rh-text-text", children: option.label }),
|
|
1516
|
-
multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1517
|
-
"span",
|
|
1518
|
-
{
|
|
1519
|
-
className: [
|
|
1520
|
-
"rh-inline-flex rh-items-center rh-justify-center",
|
|
1521
|
-
"rh-w-5 rh-h-5 rh-shrink-0",
|
|
1522
|
-
"rh-border rh-rounded-xxs rh-transition-colors rh-duration-150",
|
|
1523
|
-
isSelected ? "rh-bg-primary rh-border-primary rh-text-surface" : "rh-border-border rh-bg-surface"
|
|
1524
|
-
].filter(Boolean).join(" "),
|
|
1525
|
-
"aria-hidden": "true",
|
|
1526
|
-
children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, { className: "rh-w-3 rh-h-3" })
|
|
1527
|
-
}
|
|
1528
|
-
) : isSelected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, { className: "rh-w-3.5 rh-h-3.5 rh-shrink-0 rh-text-primary" })
|
|
1529
|
-
]
|
|
1530
|
-
},
|
|
1531
|
-
option.value
|
|
1532
|
-
);
|
|
1533
|
-
})
|
|
1534
|
-
}
|
|
1535
|
-
),
|
|
1536
|
-
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1537
|
-
"span",
|
|
1538
|
-
{
|
|
1539
|
-
id: helperId,
|
|
1540
|
-
className: [
|
|
1541
|
-
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
1542
|
-
helperStatusClasses2[status]
|
|
1543
|
-
].join(" "),
|
|
1544
|
-
children: helperText
|
|
1545
|
-
}
|
|
1546
|
-
)
|
|
1547
|
-
]
|
|
1386
|
+
case "Tab": {
|
|
1387
|
+
if (isOpen) setIsOpen(false);
|
|
1388
|
+
break;
|
|
1548
1389
|
}
|
|
1549
|
-
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1393
|
+
"div",
|
|
1394
|
+
{
|
|
1395
|
+
ref: wrapperRef,
|
|
1396
|
+
className: ["rh-relative rh-flex rh-flex-col rh-gap-1 rh-font-body", wrapperClassName].filter(Boolean).join(" "),
|
|
1397
|
+
children: [
|
|
1398
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { id: `${triggerId}-label`, className: "rh-flex rh-items-baseline rh-gap-1", children: [
|
|
1399
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: label }),
|
|
1400
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-text-text-muted", children: subtitle })
|
|
1401
|
+
] }),
|
|
1402
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1403
|
+
"button",
|
|
1404
|
+
{
|
|
1405
|
+
ref: innerRef,
|
|
1406
|
+
id: triggerId,
|
|
1407
|
+
type: "button",
|
|
1408
|
+
role: "combobox",
|
|
1409
|
+
"aria-expanded": isOpen,
|
|
1410
|
+
"aria-haspopup": "listbox",
|
|
1411
|
+
"aria-controls": listboxId,
|
|
1412
|
+
"aria-labelledby": label ? `${triggerId}-label` : void 0,
|
|
1413
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
1414
|
+
"aria-invalid": status === "error" || void 0,
|
|
1415
|
+
"aria-disabled": disabled || void 0,
|
|
1416
|
+
disabled,
|
|
1417
|
+
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
1418
|
+
onKeyDown: handleKeyDown,
|
|
1419
|
+
className: [
|
|
1420
|
+
"rh-flex rh-items-center rh-justify-between rh-gap-2",
|
|
1421
|
+
"rh-border rh-bg-surface rh-font-body",
|
|
1422
|
+
"rh-transition-colors rh-duration-150",
|
|
1423
|
+
"rh-text-left rh-w-full",
|
|
1424
|
+
statusClasses2[status],
|
|
1425
|
+
radiusClasses4[radius],
|
|
1426
|
+
sizeClasses5[size],
|
|
1427
|
+
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
|
|
1428
|
+
className
|
|
1429
|
+
].filter(Boolean).join(" "),
|
|
1430
|
+
children: [
|
|
1431
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1432
|
+
"span",
|
|
1433
|
+
{
|
|
1434
|
+
className: [
|
|
1435
|
+
"rh-flex-1 rh-truncate",
|
|
1436
|
+
displayText ? "rh-text-text" : "rh-text-text-muted"
|
|
1437
|
+
].join(" "),
|
|
1438
|
+
children: displayText ?? placeholder
|
|
1439
|
+
}
|
|
1440
|
+
),
|
|
1441
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1442
|
+
ChevronIcon,
|
|
1443
|
+
{
|
|
1444
|
+
className: [
|
|
1445
|
+
"rh-w-5 rh-h-5 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150",
|
|
1446
|
+
isOpen ? "rh-rotate-180" : ""
|
|
1447
|
+
].filter(Boolean).join(" ")
|
|
1448
|
+
}
|
|
1449
|
+
)
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
),
|
|
1453
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1454
|
+
"ul",
|
|
1455
|
+
{
|
|
1456
|
+
ref: listboxRef,
|
|
1457
|
+
id: listboxId,
|
|
1458
|
+
role: "listbox",
|
|
1459
|
+
"aria-labelledby": label ? `${triggerId}-label` : triggerId,
|
|
1460
|
+
"aria-multiselectable": multiple || void 0,
|
|
1461
|
+
tabIndex: -1,
|
|
1462
|
+
className: [
|
|
1463
|
+
"rh-absolute rh-z-50 rh-w-full rh-mt-1",
|
|
1464
|
+
"rh-border rh-border-border rh-bg-surface",
|
|
1465
|
+
"rh-shadow-md rh-overflow-auto rh-max-h-60",
|
|
1466
|
+
"rh-py-1",
|
|
1467
|
+
dropdownRadiusClasses[radius]
|
|
1468
|
+
].filter(Boolean).join(" "),
|
|
1469
|
+
style: { top: "100%" },
|
|
1470
|
+
children: options.map((option, index) => {
|
|
1471
|
+
const isSelected = selectedValues.includes(option.value);
|
|
1472
|
+
const isActive = index === activeIndex;
|
|
1473
|
+
const isDisabled = option.disabled;
|
|
1474
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1475
|
+
"li",
|
|
1476
|
+
{
|
|
1477
|
+
id: `${listboxId}-option-${index}`,
|
|
1478
|
+
role: "option",
|
|
1479
|
+
"aria-selected": isSelected,
|
|
1480
|
+
"aria-disabled": isDisabled || void 0,
|
|
1481
|
+
onClick: () => {
|
|
1482
|
+
if (!isDisabled) handleSelect(option.value);
|
|
1483
|
+
},
|
|
1484
|
+
onMouseEnter: () => {
|
|
1485
|
+
if (!isDisabled) setActiveIndex(index);
|
|
1486
|
+
},
|
|
1487
|
+
className: [
|
|
1488
|
+
"rh-flex rh-items-center rh-justify-between rh-gap-2",
|
|
1489
|
+
"rh-transition-colors rh-duration-150",
|
|
1490
|
+
optionSizeClasses[size],
|
|
1491
|
+
isDisabled ? "rh-opacity-50 rh-cursor-not-allowed" : "rh-cursor-pointer",
|
|
1492
|
+
isActive && !isDisabled ? "rh-bg-background" : "",
|
|
1493
|
+
isSelected && !isActive ? "rh-bg-primary/5" : ""
|
|
1494
|
+
].filter(Boolean).join(" "),
|
|
1495
|
+
children: [
|
|
1496
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-flex-1 rh-truncate rh-text-text", children: option.label }),
|
|
1497
|
+
multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1498
|
+
"span",
|
|
1499
|
+
{
|
|
1500
|
+
className: [
|
|
1501
|
+
"rh-inline-flex rh-items-center rh-justify-center",
|
|
1502
|
+
"rh-w-5 rh-h-5 rh-shrink-0",
|
|
1503
|
+
"rh-border rh-rounded-xxs rh-transition-colors rh-duration-150",
|
|
1504
|
+
isSelected ? "rh-bg-primary rh-border-primary rh-text-surface" : "rh-border-border rh-bg-surface"
|
|
1505
|
+
].filter(Boolean).join(" "),
|
|
1506
|
+
"aria-hidden": "true",
|
|
1507
|
+
children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, { className: "rh-w-3 rh-h-3" })
|
|
1508
|
+
}
|
|
1509
|
+
) : isSelected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, { className: "rh-w-3.5 rh-h-3.5 rh-shrink-0 rh-text-primary" })
|
|
1510
|
+
]
|
|
1511
|
+
},
|
|
1512
|
+
option.value
|
|
1513
|
+
);
|
|
1514
|
+
})
|
|
1515
|
+
}
|
|
1516
|
+
),
|
|
1517
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1518
|
+
"span",
|
|
1519
|
+
{
|
|
1520
|
+
id: helperId,
|
|
1521
|
+
className: [
|
|
1522
|
+
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
1523
|
+
helperStatusClasses2[status]
|
|
1524
|
+
].join(" "),
|
|
1525
|
+
children: helperText
|
|
1526
|
+
}
|
|
1527
|
+
)
|
|
1528
|
+
]
|
|
1529
|
+
}
|
|
1530
|
+
);
|
|
1531
|
+
});
|
|
1552
1532
|
var variantClasses = {
|
|
1553
1533
|
light: "rh-bg-surface rh-text-text rh-border rh-border-border rh-shadow-md",
|
|
1554
1534
|
default: "rh-bg-primary/10 rh-text-text rh-border rh-border-primary/20 rh-shadow-md",
|
|
@@ -1990,228 +1970,121 @@ var addButtonSizeClasses = {
|
|
|
1990
1970
|
md: "rh-w-5 rh-h-5",
|
|
1991
1971
|
lg: "rh-w-5 rh-h-5"
|
|
1992
1972
|
};
|
|
1993
|
-
var TagInput = React8.forwardRef(
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
setIsOpen(false);
|
|
2016
|
-
}
|
|
2017
|
-
};
|
|
2018
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
2019
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2020
|
-
}, []);
|
|
2021
|
-
const handleRemoveTag = (tagValue) => {
|
|
2022
|
-
if (disabled) return;
|
|
2023
|
-
onChange(value.filter((tag) => tag.value !== tagValue));
|
|
2024
|
-
};
|
|
2025
|
-
const handleToggleOption = (option) => {
|
|
2026
|
-
if (disabled) return;
|
|
2027
|
-
const isSelected = value.some((v) => v.value === option.value);
|
|
2028
|
-
if (isSelected) {
|
|
2029
|
-
onChange(value.filter((v) => v.value !== option.value));
|
|
2030
|
-
} else {
|
|
2031
|
-
onChange([...value, option]);
|
|
1973
|
+
var TagInput = React8.forwardRef(function TagInput2({
|
|
1974
|
+
label,
|
|
1975
|
+
subtitle,
|
|
1976
|
+
options = [],
|
|
1977
|
+
value = [],
|
|
1978
|
+
onChange,
|
|
1979
|
+
placeholder,
|
|
1980
|
+
status = "default",
|
|
1981
|
+
size = "md",
|
|
1982
|
+
radius = "md",
|
|
1983
|
+
helperText,
|
|
1984
|
+
disabled,
|
|
1985
|
+
className = "",
|
|
1986
|
+
wrapperClassName = ""
|
|
1987
|
+
}, ref) {
|
|
1988
|
+
const inputId = React8__default.default.useId();
|
|
1989
|
+
const [isOpen, setIsOpen] = React8.useState(false);
|
|
1990
|
+
const containerRef = React8.useRef(null);
|
|
1991
|
+
React8.useEffect(() => {
|
|
1992
|
+
const handleClickOutside = (event) => {
|
|
1993
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
1994
|
+
setIsOpen(false);
|
|
2032
1995
|
}
|
|
2033
1996
|
};
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
children: [
|
|
2088
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-font-semibold rh-text-gray-700", children: tag.label }),
|
|
2089
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2090
|
-
"button",
|
|
2091
|
-
{
|
|
2092
|
-
type: "button",
|
|
2093
|
-
onClick: (e) => {
|
|
2094
|
-
e.stopPropagation();
|
|
2095
|
-
handleRemoveTag(tag.value);
|
|
2096
|
-
},
|
|
2097
|
-
disabled,
|
|
2098
|
-
className: [
|
|
2099
|
-
"rh-flex rh-items-center rh-justify-center",
|
|
2100
|
-
"rh-bg-white rh-rounded-full",
|
|
2101
|
-
"rh-cursor-pointer hover:rh-bg-gray-100",
|
|
2102
|
-
"disabled:rh-cursor-not-allowed disabled:rh-opacity-50",
|
|
2103
|
-
deleteButtonSizeClasses[size]
|
|
2104
|
-
].join(" "),
|
|
2105
|
-
"aria-label": `Remover ${tag.label}`,
|
|
2106
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2107
|
-
"svg",
|
|
2108
|
-
{
|
|
2109
|
-
viewBox: "0 0 8 8",
|
|
2110
|
-
fill: "none",
|
|
2111
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2112
|
-
className: "rh-w-[8px] rh-h-[8px]",
|
|
2113
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2114
|
-
"path",
|
|
2115
|
-
{
|
|
2116
|
-
d: "M6 2L2 6M2 2L6 6",
|
|
2117
|
-
stroke: "#374151",
|
|
2118
|
-
strokeWidth: "1.5",
|
|
2119
|
-
strokeLinecap: "round",
|
|
2120
|
-
strokeLinejoin: "round"
|
|
2121
|
-
}
|
|
2122
|
-
)
|
|
2123
|
-
}
|
|
2124
|
-
)
|
|
2125
|
-
}
|
|
2126
|
-
)
|
|
2127
|
-
]
|
|
2128
|
-
},
|
|
2129
|
-
tag.value
|
|
2130
|
-
))
|
|
2131
|
-
] }),
|
|
2132
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2133
|
-
"button",
|
|
2134
|
-
{
|
|
2135
|
-
type: "button",
|
|
2136
|
-
onClick: handleAddClick,
|
|
2137
|
-
disabled,
|
|
2138
|
-
className: [
|
|
2139
|
-
"rh-flex rh-items-center rh-justify-center rh-shrink-0",
|
|
2140
|
-
"rh-text-text-muted hover:rh-text-text",
|
|
2141
|
-
"rh-cursor-pointer",
|
|
2142
|
-
"disabled:rh-cursor-not-allowed disabled:rh-opacity-50",
|
|
2143
|
-
addButtonSizeClasses[size]
|
|
2144
|
-
].join(" "),
|
|
2145
|
-
"aria-label": "Adicionar",
|
|
2146
|
-
"aria-expanded": isOpen,
|
|
2147
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2148
|
-
"svg",
|
|
2149
|
-
{
|
|
2150
|
-
viewBox: "0 0 20 20",
|
|
2151
|
-
fill: "none",
|
|
2152
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2153
|
-
className: "rh-w-full rh-h-full",
|
|
2154
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2155
|
-
"path",
|
|
2156
|
-
{
|
|
2157
|
-
d: "M10 4V16M4 10H16",
|
|
2158
|
-
stroke: "currentColor",
|
|
2159
|
-
strokeWidth: "2",
|
|
2160
|
-
strokeLinecap: "round",
|
|
2161
|
-
strokeLinejoin: "round"
|
|
2162
|
-
}
|
|
2163
|
-
)
|
|
2164
|
-
}
|
|
2165
|
-
)
|
|
2166
|
-
}
|
|
2167
|
-
)
|
|
2168
|
-
]
|
|
2169
|
-
}
|
|
2170
|
-
),
|
|
2171
|
-
isOpen && options.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2172
|
-
"div",
|
|
2173
|
-
{
|
|
2174
|
-
className: [
|
|
2175
|
-
"rh-absolute rh-top-full rh-left-0 rh-right-0 rh-z-50",
|
|
2176
|
-
"rh-mt-1 rh-bg-surface rh-border rh-border-border",
|
|
2177
|
-
"rh-rounded-[8px] rh-shadow-lg rh-overflow-hidden"
|
|
2178
|
-
].join(" "),
|
|
2179
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "rh-max-h-[200px] rh-overflow-y-auto", children: options.map((option) => {
|
|
2180
|
-
const isSelected = value.some((v) => v.value === option.value);
|
|
2181
|
-
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2182
|
-
"button",
|
|
1997
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1998
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1999
|
+
}, []);
|
|
2000
|
+
const handleRemoveTag = (tagValue) => {
|
|
2001
|
+
if (disabled) return;
|
|
2002
|
+
onChange(value.filter((tag) => tag.value !== tagValue));
|
|
2003
|
+
};
|
|
2004
|
+
const handleToggleOption = (option) => {
|
|
2005
|
+
if (disabled) return;
|
|
2006
|
+
const isSelected = value.some((v) => v.value === option.value);
|
|
2007
|
+
if (isSelected) {
|
|
2008
|
+
onChange(value.filter((v) => v.value !== option.value));
|
|
2009
|
+
} else {
|
|
2010
|
+
onChange([...value, option]);
|
|
2011
|
+
}
|
|
2012
|
+
};
|
|
2013
|
+
const handleAddClick = () => {
|
|
2014
|
+
if (disabled) return;
|
|
2015
|
+
setIsOpen(!isOpen);
|
|
2016
|
+
};
|
|
2017
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2018
|
+
"div",
|
|
2019
|
+
{
|
|
2020
|
+
ref: (node) => {
|
|
2021
|
+
if (typeof ref === "function") ref(node);
|
|
2022
|
+
else if (ref) ref.current = node;
|
|
2023
|
+
containerRef.current = node;
|
|
2024
|
+
},
|
|
2025
|
+
className: ["rh-flex rh-flex-col rh-gap-2 rh-font-body rh-relative", wrapperClassName].filter(Boolean).join(" "),
|
|
2026
|
+
children: [
|
|
2027
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: inputId, className: "rh-flex rh-items-baseline rh-gap-1", children: [
|
|
2028
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-semibold rh-text-text", children: label }),
|
|
2029
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-text-text-muted", children: subtitle })
|
|
2030
|
+
] }),
|
|
2031
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2032
|
+
"div",
|
|
2033
|
+
{
|
|
2034
|
+
onClick: disabled ? void 0 : handleAddClick,
|
|
2035
|
+
className: [
|
|
2036
|
+
"rh-flex rh-flex-row rh-items-center rh-justify-between rh-gap-2",
|
|
2037
|
+
"rh-border rh-bg-surface rh-font-body",
|
|
2038
|
+
"rh-transition-colors rh-duration-150",
|
|
2039
|
+
statusClasses3[status],
|
|
2040
|
+
radiusClasses5[radius],
|
|
2041
|
+
sizeClasses9[size],
|
|
2042
|
+
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
|
|
2043
|
+
className
|
|
2044
|
+
].filter(Boolean).join(" "),
|
|
2045
|
+
children: [
|
|
2046
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-flex-row rh-flex-wrap rh-items-center rh-gap-2 rh-flex-1", children: [
|
|
2047
|
+
value.length === 0 && placeholder && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-text-muted", children: placeholder }),
|
|
2048
|
+
value.map((tag) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2049
|
+
"div",
|
|
2183
2050
|
{
|
|
2184
|
-
type: "button",
|
|
2185
|
-
onClick: () => handleToggleOption(option),
|
|
2186
2051
|
className: [
|
|
2187
|
-
"rh-
|
|
2188
|
-
"rh-
|
|
2189
|
-
|
|
2190
|
-
"hover:rh-bg-gray-50 rh-transition-colors",
|
|
2191
|
-
isSelected ? "rh-text-text" : "rh-text-text-muted"
|
|
2052
|
+
"rh-inline-flex rh-items-center rh-justify-center rh-gap-1",
|
|
2053
|
+
"rh-bg-gray-200 rh-border rh-border-gray-200 rh-rounded-[4px]",
|
|
2054
|
+
tagSizeClasses[size]
|
|
2192
2055
|
].join(" "),
|
|
2193
2056
|
children: [
|
|
2194
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-
|
|
2057
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-font-semibold rh-text-gray-700", children: tag.label }),
|
|
2195
2058
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2196
|
-
"
|
|
2059
|
+
"button",
|
|
2197
2060
|
{
|
|
2061
|
+
type: "button",
|
|
2062
|
+
onClick: (e) => {
|
|
2063
|
+
e.stopPropagation();
|
|
2064
|
+
handleRemoveTag(tag.value);
|
|
2065
|
+
},
|
|
2066
|
+
disabled,
|
|
2198
2067
|
className: [
|
|
2199
|
-
"rh-
|
|
2200
|
-
|
|
2068
|
+
"rh-flex rh-items-center rh-justify-center",
|
|
2069
|
+
"rh-bg-white rh-rounded-full",
|
|
2070
|
+
"rh-cursor-pointer hover:rh-bg-gray-100",
|
|
2071
|
+
"disabled:rh-cursor-not-allowed disabled:rh-opacity-50",
|
|
2072
|
+
deleteButtonSizeClasses[size]
|
|
2201
2073
|
].join(" "),
|
|
2202
|
-
|
|
2074
|
+
"aria-label": `Remover ${tag.label}`,
|
|
2075
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2203
2076
|
"svg",
|
|
2204
2077
|
{
|
|
2205
|
-
viewBox: "0 0
|
|
2078
|
+
viewBox: "0 0 8 8",
|
|
2206
2079
|
fill: "none",
|
|
2207
2080
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2208
|
-
className: "rh-w-
|
|
2081
|
+
className: "rh-w-[8px] rh-h-[8px]",
|
|
2209
2082
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2210
2083
|
"path",
|
|
2211
2084
|
{
|
|
2212
|
-
d: "
|
|
2213
|
-
stroke: "
|
|
2214
|
-
strokeWidth: "
|
|
2085
|
+
d: "M6 2L2 6M2 2L6 6",
|
|
2086
|
+
stroke: "#374151",
|
|
2087
|
+
strokeWidth: "1.5",
|
|
2215
2088
|
strokeLinecap: "round",
|
|
2216
2089
|
strokeLinejoin: "round"
|
|
2217
2090
|
}
|
|
@@ -2221,101 +2094,142 @@ var TagInput = React8.forwardRef(
|
|
|
2221
2094
|
}
|
|
2222
2095
|
)
|
|
2223
2096
|
]
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
"span",
|
|
2231
|
-
{
|
|
2232
|
-
id: `${inputId}-helper`,
|
|
2233
|
-
className: [
|
|
2234
|
-
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
2235
|
-
helperStatusClasses3[status]
|
|
2236
|
-
].join(" "),
|
|
2237
|
-
children: helperText
|
|
2238
|
-
}
|
|
2239
|
-
)
|
|
2240
|
-
]
|
|
2241
|
-
}
|
|
2242
|
-
);
|
|
2243
|
-
}
|
|
2244
|
-
);
|
|
2245
|
-
var ProgressBar = React8.forwardRef(
|
|
2246
|
-
function ProgressBar2({
|
|
2247
|
-
value,
|
|
2248
|
-
label,
|
|
2249
|
-
size = "sm",
|
|
2250
|
-
showPercentage = true,
|
|
2251
|
-
barColor,
|
|
2252
|
-
bgColor,
|
|
2253
|
-
className = ""
|
|
2254
|
-
}, ref) {
|
|
2255
|
-
const clampedValue = Math.min(100, Math.max(0, value));
|
|
2256
|
-
if (size === "lg") {
|
|
2257
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2258
|
-
"div",
|
|
2259
|
-
{
|
|
2260
|
-
ref,
|
|
2261
|
-
className: [
|
|
2262
|
-
"rh-flex rh-flex-col rh-items-start rh-gap-2 rh-font-sans",
|
|
2263
|
-
className
|
|
2264
|
-
].filter(Boolean).join(" "),
|
|
2265
|
-
children: [
|
|
2266
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-flex-row rh-justify-between rh-items-start rh-w-full", children: [
|
|
2267
|
-
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2268
|
-
"span",
|
|
2097
|
+
},
|
|
2098
|
+
tag.value
|
|
2099
|
+
))
|
|
2100
|
+
] }),
|
|
2101
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2102
|
+
"button",
|
|
2269
2103
|
{
|
|
2270
|
-
|
|
2271
|
-
|
|
2104
|
+
type: "button",
|
|
2105
|
+
onClick: handleAddClick,
|
|
2106
|
+
disabled,
|
|
2107
|
+
className: [
|
|
2108
|
+
"rh-flex rh-items-center rh-justify-center rh-shrink-0",
|
|
2109
|
+
"rh-text-text-muted hover:rh-text-text",
|
|
2110
|
+
"rh-cursor-pointer",
|
|
2111
|
+
"disabled:rh-cursor-not-allowed disabled:rh-opacity-50",
|
|
2112
|
+
addButtonSizeClasses[size]
|
|
2113
|
+
].join(" "),
|
|
2114
|
+
"aria-label": "Adicionar",
|
|
2115
|
+
"aria-expanded": isOpen,
|
|
2116
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2117
|
+
"svg",
|
|
2118
|
+
{
|
|
2119
|
+
viewBox: "0 0 20 20",
|
|
2120
|
+
fill: "none",
|
|
2121
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2122
|
+
className: "rh-w-full rh-h-full",
|
|
2123
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2124
|
+
"path",
|
|
2125
|
+
{
|
|
2126
|
+
d: "M10 4V16M4 10H16",
|
|
2127
|
+
stroke: "currentColor",
|
|
2128
|
+
strokeWidth: "2",
|
|
2129
|
+
strokeLinecap: "round",
|
|
2130
|
+
strokeLinejoin: "round"
|
|
2131
|
+
}
|
|
2132
|
+
)
|
|
2133
|
+
}
|
|
2134
|
+
)
|
|
2272
2135
|
}
|
|
2273
|
-
)
|
|
2274
|
-
|
|
2275
|
-
|
|
2136
|
+
)
|
|
2137
|
+
]
|
|
2138
|
+
}
|
|
2139
|
+
),
|
|
2140
|
+
isOpen && options.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2141
|
+
"div",
|
|
2142
|
+
{
|
|
2143
|
+
className: [
|
|
2144
|
+
"rh-absolute rh-top-full rh-left-0 rh-right-0 rh-z-50",
|
|
2145
|
+
"rh-mt-1 rh-bg-surface rh-border rh-border-border",
|
|
2146
|
+
"rh-rounded-[8px] rh-shadow-lg rh-overflow-hidden"
|
|
2147
|
+
].join(" "),
|
|
2148
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "rh-max-h-[200px] rh-overflow-y-auto", children: options.map((option) => {
|
|
2149
|
+
const isSelected = value.some((v) => v.value === option.value);
|
|
2150
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2151
|
+
"button",
|
|
2276
2152
|
{
|
|
2277
|
-
|
|
2153
|
+
type: "button",
|
|
2154
|
+
onClick: () => handleToggleOption(option),
|
|
2155
|
+
className: [
|
|
2156
|
+
"rh-w-full rh-flex rh-items-center rh-justify-between",
|
|
2157
|
+
"rh-px-3 rh-py-3 rh-text-left",
|
|
2158
|
+
"rh-border-b rh-border-border/50 last:rh-border-b-0",
|
|
2159
|
+
"hover:rh-bg-gray-50 rh-transition-colors",
|
|
2160
|
+
isSelected ? "rh-text-text" : "rh-text-text-muted"
|
|
2161
|
+
].join(" "),
|
|
2278
2162
|
children: [
|
|
2279
|
-
|
|
2280
|
-
|
|
2163
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-normal", children: option.label }),
|
|
2164
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2165
|
+
"span",
|
|
2166
|
+
{
|
|
2167
|
+
className: [
|
|
2168
|
+
"rh-w-5 rh-h-5 rh-rounded rh-border-2 rh-flex rh-items-center rh-justify-center",
|
|
2169
|
+
isSelected ? "rh-bg-primary rh-border-primary" : "rh-bg-white rh-border-gray-300"
|
|
2170
|
+
].join(" "),
|
|
2171
|
+
children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2172
|
+
"svg",
|
|
2173
|
+
{
|
|
2174
|
+
viewBox: "0 0 12 12",
|
|
2175
|
+
fill: "none",
|
|
2176
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2177
|
+
className: "rh-w-3 rh-h-3",
|
|
2178
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2179
|
+
"path",
|
|
2180
|
+
{
|
|
2181
|
+
d: "M2 6L5 9L10 3",
|
|
2182
|
+
stroke: "white",
|
|
2183
|
+
strokeWidth: "2",
|
|
2184
|
+
strokeLinecap: "round",
|
|
2185
|
+
strokeLinejoin: "round"
|
|
2186
|
+
}
|
|
2187
|
+
)
|
|
2188
|
+
}
|
|
2189
|
+
)
|
|
2190
|
+
}
|
|
2191
|
+
)
|
|
2281
2192
|
]
|
|
2282
2193
|
}
|
|
2283
|
-
)
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
)
|
|
2300
|
-
}
|
|
2301
|
-
)
|
|
2302
|
-
]
|
|
2303
|
-
}
|
|
2304
|
-
);
|
|
2194
|
+
) }, option.value);
|
|
2195
|
+
}) })
|
|
2196
|
+
}
|
|
2197
|
+
),
|
|
2198
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2199
|
+
"span",
|
|
2200
|
+
{
|
|
2201
|
+
id: `${inputId}-helper`,
|
|
2202
|
+
className: [
|
|
2203
|
+
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
2204
|
+
helperStatusClasses3[status]
|
|
2205
|
+
].join(" "),
|
|
2206
|
+
children: helperText
|
|
2207
|
+
}
|
|
2208
|
+
)
|
|
2209
|
+
]
|
|
2305
2210
|
}
|
|
2211
|
+
);
|
|
2212
|
+
});
|
|
2213
|
+
var ProgressBar = React8.forwardRef(function ProgressBar2({ value, label, size = "sm", showPercentage = true, barColor, bgColor, className = "" }, ref) {
|
|
2214
|
+
const clampedValue = Math.min(100, Math.max(0, value));
|
|
2215
|
+
if (size === "lg") {
|
|
2306
2216
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2307
2217
|
"div",
|
|
2308
2218
|
{
|
|
2309
2219
|
ref,
|
|
2310
|
-
className: [
|
|
2311
|
-
"rh-flex rh-flex-row rh-items-center rh-gap-2 rh-font-sans",
|
|
2312
|
-
className
|
|
2313
|
-
].filter(Boolean).join(" "),
|
|
2220
|
+
className: ["rh-flex rh-flex-col rh-items-start rh-gap-2 rh-font-body", className].filter(Boolean).join(" "),
|
|
2314
2221
|
children: [
|
|
2222
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-flex-row rh-justify-between rh-items-start rh-w-full", children: [
|
|
2223
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-font-sora rh-font-bold rh-text-base rh-leading-6 rh-text-[#374151] rh-flex-1", children: label }),
|
|
2224
|
+
showPercentage && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-font-inter rh-font-normal rh-text-sm rh-leading-5 rh-text-[#9CA3AF] rh-tracking-[0.025em] rh-text-right", children: [
|
|
2225
|
+
clampedValue,
|
|
2226
|
+
"%"
|
|
2227
|
+
] })
|
|
2228
|
+
] }),
|
|
2315
2229
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2316
2230
|
"div",
|
|
2317
2231
|
{
|
|
2318
|
-
className: "rh-
|
|
2232
|
+
className: "rh-w-full rh-h-1 rh-rounded-[40px] rh-overflow-hidden",
|
|
2319
2233
|
style: { backgroundColor: bgColor || "#E5E7EB" },
|
|
2320
2234
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2321
2235
|
"div",
|
|
@@ -2328,22 +2242,42 @@ var ProgressBar = React8.forwardRef(
|
|
|
2328
2242
|
}
|
|
2329
2243
|
)
|
|
2330
2244
|
}
|
|
2331
|
-
),
|
|
2332
|
-
showPercentage && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2333
|
-
"span",
|
|
2334
|
-
{
|
|
2335
|
-
className: "rh-font-inter rh-font-normal rh-text-sm rh-leading-5 rh-text-[#9CA3AF] rh-tracking-[0.025em] rh-text-right rh-min-w-[40px]",
|
|
2336
|
-
children: [
|
|
2337
|
-
clampedValue,
|
|
2338
|
-
"%"
|
|
2339
|
-
]
|
|
2340
|
-
}
|
|
2341
2245
|
)
|
|
2342
2246
|
]
|
|
2343
2247
|
}
|
|
2344
2248
|
);
|
|
2345
2249
|
}
|
|
2346
|
-
|
|
2250
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2251
|
+
"div",
|
|
2252
|
+
{
|
|
2253
|
+
ref,
|
|
2254
|
+
className: ["rh-flex rh-flex-row rh-items-center rh-gap-2 rh-font-body", className].filter(Boolean).join(" "),
|
|
2255
|
+
children: [
|
|
2256
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2257
|
+
"div",
|
|
2258
|
+
{
|
|
2259
|
+
className: "rh-flex-1 rh-h-1 rh-rounded-[40px] rh-overflow-hidden",
|
|
2260
|
+
style: { backgroundColor: bgColor || "#E5E7EB" },
|
|
2261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2262
|
+
"div",
|
|
2263
|
+
{
|
|
2264
|
+
className: "rh-h-full rh-rounded-[40px] rh-transition-all rh-duration-300",
|
|
2265
|
+
style: {
|
|
2266
|
+
width: `${clampedValue}%`,
|
|
2267
|
+
backgroundColor: barColor || "#538CC6"
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
)
|
|
2271
|
+
}
|
|
2272
|
+
),
|
|
2273
|
+
showPercentage && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-font-inter rh-font-normal rh-text-sm rh-leading-5 rh-text-[#9CA3AF] rh-tracking-[0.025em] rh-text-right rh-min-w-[40px]", children: [
|
|
2274
|
+
clampedValue,
|
|
2275
|
+
"%"
|
|
2276
|
+
] })
|
|
2277
|
+
]
|
|
2278
|
+
}
|
|
2279
|
+
);
|
|
2280
|
+
});
|
|
2347
2281
|
var PRESET_COLORS4 = /* @__PURE__ */ new Set([
|
|
2348
2282
|
"primary",
|
|
2349
2283
|
"secondary",
|
|
@@ -2471,7 +2405,7 @@ var Card = React8.forwardRef(function Card2({
|
|
|
2471
2405
|
tabIndex: isInteractive ? 0 : void 0,
|
|
2472
2406
|
"aria-disabled": disabled || void 0,
|
|
2473
2407
|
className: [
|
|
2474
|
-
"rh-font-
|
|
2408
|
+
"rh-font-body rh-transition-all rh-duration-150",
|
|
2475
2409
|
variantClasses3[variant],
|
|
2476
2410
|
radiusClasses7[radius],
|
|
2477
2411
|
paddingClasses[padding],
|
|
@@ -2660,10 +2594,7 @@ function TableInner({
|
|
|
2660
2594
|
"table",
|
|
2661
2595
|
{
|
|
2662
2596
|
ref,
|
|
2663
|
-
className: [
|
|
2664
|
-
"rh-w-full rh-border-collapse rh-font-sans",
|
|
2665
|
-
className
|
|
2666
|
-
].filter(Boolean).join(" "),
|
|
2597
|
+
className: ["rh-w-full rh-border-collapse rh-font-body", className].filter(Boolean).join(" "),
|
|
2667
2598
|
...rest,
|
|
2668
2599
|
children: [
|
|
2669
2600
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "rh-border-b rh-border-border", style: headerStyle, children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|