atomos_next_genesis 1.0.1 → 1.0.2
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.cjs +181 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -48
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +12 -18
- package/dist/index.d.ts +12 -18
- package/dist/index.js +180 -204
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1038,7 +1038,8 @@ var Dropdown = forwardRef5(
|
|
|
1038
1038
|
onApply,
|
|
1039
1039
|
disabled = false,
|
|
1040
1040
|
onReset,
|
|
1041
|
-
footerAction
|
|
1041
|
+
footerAction,
|
|
1042
|
+
height = "200px"
|
|
1042
1043
|
}, ref) => {
|
|
1043
1044
|
var _a, _b;
|
|
1044
1045
|
const [searchQuery, setSearchQuery] = useState2("");
|
|
@@ -1149,7 +1150,7 @@ var Dropdown = forwardRef5(
|
|
|
1149
1150
|
}
|
|
1150
1151
|
},
|
|
1151
1152
|
className: cn(
|
|
1152
|
-
"w-full hover:bg-gray-50 py-2 px-[14px] rounded-lg flex justify-between items-center text-gray-900 bg-gray-25 text-
|
|
1153
|
+
"w-full hover:bg-gray-50 py-2 px-[14px] rounded-lg flex justify-between items-center text-gray-900 bg-gray-25 text-sm cursor-pointer",
|
|
1153
1154
|
dropdownMenu ? "border border-primary-600" : "border border-gray-200",
|
|
1154
1155
|
disabled && "bg-gray-300 hover:bg-gray-300 cursor-not-allowed"
|
|
1155
1156
|
)
|
|
@@ -1164,7 +1165,7 @@ var Dropdown = forwardRef5(
|
|
|
1164
1165
|
"aria-multiselectable": multiple,
|
|
1165
1166
|
"aria-labelledby": `${id}-label`,
|
|
1166
1167
|
className: cn(
|
|
1167
|
-
"max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-
|
|
1168
|
+
"max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-sm bg-white z-[1000] w-full transition-all duration-75 delay-100 ease-in",
|
|
1168
1169
|
position === "top" ? "top-10" : "bottom-10",
|
|
1169
1170
|
dropdownMenu ? "border border-primary-600" : "border border-gray-200",
|
|
1170
1171
|
dropdownMenu && "max-h-[360px] h-fit opacity-[1] transition-all ease-in duration-150"
|
|
@@ -1189,7 +1190,7 @@ var Dropdown = forwardRef5(
|
|
|
1189
1190
|
type: "button",
|
|
1190
1191
|
"aria-label": "Select all",
|
|
1191
1192
|
onClick: handleSelectAll,
|
|
1192
|
-
className: "text-
|
|
1193
|
+
className: "text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
|
|
1193
1194
|
},
|
|
1194
1195
|
"Select all"
|
|
1195
1196
|
), /* @__PURE__ */ React15.createElement(
|
|
@@ -1197,77 +1198,84 @@ var Dropdown = forwardRef5(
|
|
|
1197
1198
|
{
|
|
1198
1199
|
"aria-label": "Reset",
|
|
1199
1200
|
type: "button",
|
|
1200
|
-
className: "text-
|
|
1201
|
+
className: "text-sm text-warning-500 hover:text-warning-600",
|
|
1201
1202
|
onClick: handleReset
|
|
1202
1203
|
},
|
|
1203
1204
|
"Reset"
|
|
1204
1205
|
)),
|
|
1205
|
-
/* @__PURE__ */ React15.createElement(
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
key: i
|
|
1216
|
-
},
|
|
1217
|
-
/* @__PURE__ */ React15.createElement("section", { className: "flex items-center justify-between gap-2 w-full" }, /* @__PURE__ */ React15.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React15.createElement(
|
|
1218
|
-
Checkbox_default,
|
|
1219
|
-
{
|
|
1220
|
-
id: `${id}-checkbox-${option.value}`,
|
|
1221
|
-
checked: (selected == null ? void 0 : selected.some(
|
|
1222
|
-
(item) => item.value === option.value
|
|
1223
|
-
)) ?? false,
|
|
1224
|
-
onChange: () => handleCheckboxChange(option),
|
|
1225
|
-
disabled: option == null ? void 0 : option.disabledOption
|
|
1226
|
-
}
|
|
1227
|
-
), /* @__PURE__ */ React15.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React15.createElement(
|
|
1228
|
-
"div",
|
|
1206
|
+
/* @__PURE__ */ React15.createElement(
|
|
1207
|
+
"section",
|
|
1208
|
+
{
|
|
1209
|
+
style: { maxHeight: height },
|
|
1210
|
+
className: "z-[1000] transition-all duration-75 delay-100 ease-in-out overflow-y-scroll"
|
|
1211
|
+
},
|
|
1212
|
+
options ? memoizedFilteredOptions == null ? void 0 : memoizedFilteredOptions.map((option, i) => {
|
|
1213
|
+
var _a2;
|
|
1214
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, { key: i }, multiple ? /* @__PURE__ */ React15.createElement(
|
|
1215
|
+
Label_default,
|
|
1229
1216
|
{
|
|
1230
|
-
style: {
|
|
1231
|
-
color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
|
|
1232
|
-
},
|
|
1233
1217
|
className: cn(
|
|
1234
|
-
"
|
|
1235
|
-
(option == null ? void 0 : option.disabledOption) && "text-gray-300"
|
|
1236
|
-
)
|
|
1218
|
+
"has-[:checked]:bg-primary-50 has-[:checked]:border-primary-600 hover:bg-gray-50 flex flex-col py-[6px] px-[14px] cursor-pointer border-l-4 border-transparent",
|
|
1219
|
+
(option == null ? void 0 : option.disabledOption) && "opacity-50 cursor-not-allowed hover:bg-white text-gray-300 select-none"
|
|
1220
|
+
),
|
|
1221
|
+
htmlFor: `${id}-checkbox-${option.value}`,
|
|
1222
|
+
key: i
|
|
1237
1223
|
},
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
/* @__PURE__ */ React15.createElement("span", { className: "pt-[2px] text-text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
|
|
1241
|
-
) : /* @__PURE__ */ React15.createElement(
|
|
1242
|
-
Label_default,
|
|
1243
|
-
{
|
|
1244
|
-
key: i,
|
|
1245
|
-
htmlFor: `${id}-checkbox-${option.value}`,
|
|
1246
|
-
className: cn(
|
|
1247
|
-
"flex justify-between py-[6px] px-[14px] hover:bg-gray-50 gap-2 items-center border-l-4 border-transparent cursor-pointer",
|
|
1224
|
+
/* @__PURE__ */ React15.createElement("section", { className: "flex items-center justify-between gap-2 w-full" }, /* @__PURE__ */ React15.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React15.createElement(
|
|
1225
|
+
Checkbox_default,
|
|
1248
1226
|
{
|
|
1249
|
-
|
|
1250
|
-
|
|
1227
|
+
id: `${id}-checkbox-${option.value}`,
|
|
1228
|
+
checked: (selected == null ? void 0 : selected.some(
|
|
1229
|
+
(item) => item.value === option.value
|
|
1230
|
+
)) ?? false,
|
|
1231
|
+
onChange: () => handleCheckboxChange(option),
|
|
1232
|
+
disabled: option == null ? void 0 : option.disabledOption
|
|
1251
1233
|
}
|
|
1252
|
-
),
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1234
|
+
), /* @__PURE__ */ React15.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React15.createElement(
|
|
1235
|
+
"div",
|
|
1236
|
+
{
|
|
1237
|
+
style: {
|
|
1238
|
+
color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
|
|
1239
|
+
},
|
|
1240
|
+
className: cn(
|
|
1241
|
+
"break-words",
|
|
1242
|
+
(option == null ? void 0 : option.disabledOption) && "text-gray-300"
|
|
1243
|
+
)
|
|
1260
1244
|
},
|
|
1245
|
+
renderItem(option)
|
|
1246
|
+
))), /* @__PURE__ */ React15.createElement("span", { className: "text-gray-500" }, option == null ? void 0 : option.info)),
|
|
1247
|
+
/* @__PURE__ */ React15.createElement("span", { className: "pt-[2px] text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
|
|
1248
|
+
) : /* @__PURE__ */ React15.createElement(
|
|
1249
|
+
Label_default,
|
|
1250
|
+
{
|
|
1251
|
+
key: i,
|
|
1252
|
+
htmlFor: `${id}-checkbox-${option.value}`,
|
|
1261
1253
|
className: cn(
|
|
1262
|
-
"
|
|
1263
|
-
|
|
1264
|
-
|
|
1254
|
+
"flex justify-between py-[6px] px-[14px] hover:bg-gray-50 gap-2 items-center border-l-4 border-transparent cursor-pointer",
|
|
1255
|
+
{
|
|
1256
|
+
"bg-primary-50 border-primary-600": selected && ((_a2 = selected[0]) == null ? void 0 : _a2.value) === option.value,
|
|
1257
|
+
"opacity-50 cursor-not-allowed hover:bg-white text-gray-500": option == null ? void 0 : option.disabledOption
|
|
1258
|
+
}
|
|
1259
|
+
),
|
|
1260
|
+
onClick: () => !(option == null ? void 0 : option.disabledOption) && toggleOption(option)
|
|
1265
1261
|
},
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1262
|
+
/* @__PURE__ */ React15.createElement(
|
|
1263
|
+
"div",
|
|
1264
|
+
{
|
|
1265
|
+
style: {
|
|
1266
|
+
color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
|
|
1267
|
+
},
|
|
1268
|
+
className: cn(
|
|
1269
|
+
"break-words",
|
|
1270
|
+
(option == null ? void 0 : option.disabledOption) && "text-gray-300"
|
|
1271
|
+
)
|
|
1272
|
+
},
|
|
1273
|
+
renderItem(option)
|
|
1274
|
+
),
|
|
1275
|
+
/* @__PURE__ */ React15.createElement("span", { className: "text-gray-500" }, info)
|
|
1276
|
+
));
|
|
1277
|
+
}) : children
|
|
1278
|
+
),
|
|
1271
1279
|
footerAction && /* @__PURE__ */ React15.createElement("div", { className: "py-2 mt-1 px-2 border-t" }, footerAction),
|
|
1272
1280
|
dropdownFooter && /* @__PURE__ */ React15.createElement(
|
|
1273
1281
|
DropdownFooter,
|
|
@@ -1287,7 +1295,7 @@ var DropdownFooter = ({
|
|
|
1287
1295
|
onApply,
|
|
1288
1296
|
setDropdownMenu
|
|
1289
1297
|
}) => {
|
|
1290
|
-
return /* @__PURE__ */ React15.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-
|
|
1298
|
+
return /* @__PURE__ */ React15.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-sm" }, /* @__PURE__ */ React15.createElement(
|
|
1291
1299
|
"button",
|
|
1292
1300
|
{
|
|
1293
1301
|
type: "button",
|
|
@@ -1310,8 +1318,9 @@ var Dropdown_default = Dropdown;
|
|
|
1310
1318
|
// app/components/DropdownMenu.tsx
|
|
1311
1319
|
import { RiArrowDownSLine as RiArrowDownSLine3 } from "@remixicon/react";
|
|
1312
1320
|
import React16, { useState as useState3, useRef as useRef2, useEffect as useEffect4, useCallback as useCallback3 } from "react";
|
|
1313
|
-
|
|
1314
|
-
|
|
1321
|
+
function DropdownMenu({
|
|
1322
|
+
children
|
|
1323
|
+
}) {
|
|
1315
1324
|
const [isOpen, setIsOpen] = useState3(false);
|
|
1316
1325
|
const [focusedIndex, setFocusedIndex] = useState3(-1);
|
|
1317
1326
|
const triggerRef = useRef2(null);
|
|
@@ -1330,106 +1339,82 @@ function DropdownMenu({ children }) {
|
|
|
1330
1339
|
useEffect4(() => {
|
|
1331
1340
|
if (!isOpen)
|
|
1332
1341
|
return;
|
|
1333
|
-
const
|
|
1342
|
+
const handler = (e) => {
|
|
1334
1343
|
if (triggerRef.current && contentRef.current && !triggerRef.current.contains(e.target) && !contentRef.current.contains(e.target)) {
|
|
1335
1344
|
closeMenu();
|
|
1336
1345
|
}
|
|
1337
1346
|
};
|
|
1338
|
-
document.addEventListener("mousedown",
|
|
1339
|
-
return () => document.removeEventListener("mousedown",
|
|
1347
|
+
document.addEventListener("mousedown", handler);
|
|
1348
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
1340
1349
|
}, [isOpen]);
|
|
1341
1350
|
useEffect4(() => {
|
|
1342
1351
|
if (!isOpen)
|
|
1343
1352
|
return;
|
|
1344
|
-
const
|
|
1353
|
+
const handler = (e) => {
|
|
1345
1354
|
var _a;
|
|
1346
|
-
switch (
|
|
1355
|
+
switch (e.key) {
|
|
1347
1356
|
case "Escape":
|
|
1348
|
-
|
|
1357
|
+
e.preventDefault();
|
|
1349
1358
|
closeMenu();
|
|
1350
1359
|
(_a = triggerRef.current) == null ? void 0 : _a.focus();
|
|
1351
1360
|
break;
|
|
1352
1361
|
case "ArrowDown":
|
|
1353
|
-
|
|
1362
|
+
e.preventDefault();
|
|
1354
1363
|
setFocusedIndex(
|
|
1355
|
-
(
|
|
1364
|
+
(p) => p < itemsCountRef.current - 1 ? p + 1 : 0
|
|
1356
1365
|
);
|
|
1357
1366
|
break;
|
|
1358
1367
|
case "ArrowUp":
|
|
1359
|
-
|
|
1368
|
+
e.preventDefault();
|
|
1360
1369
|
setFocusedIndex(
|
|
1361
|
-
(
|
|
1370
|
+
(p) => p > 0 ? p - 1 : itemsCountRef.current - 1
|
|
1362
1371
|
);
|
|
1363
1372
|
break;
|
|
1364
1373
|
case "Home":
|
|
1365
|
-
event.preventDefault();
|
|
1366
1374
|
setFocusedIndex(0);
|
|
1367
1375
|
break;
|
|
1368
1376
|
case "End":
|
|
1369
|
-
event.preventDefault();
|
|
1370
1377
|
setFocusedIndex(itemsCountRef.current - 1);
|
|
1371
1378
|
break;
|
|
1372
1379
|
}
|
|
1373
1380
|
};
|
|
1374
|
-
document.addEventListener("keydown",
|
|
1381
|
+
document.addEventListener("keydown", handler);
|
|
1375
1382
|
setFocusedIndex(0);
|
|
1376
|
-
return () => document.removeEventListener("keydown",
|
|
1383
|
+
return () => document.removeEventListener("keydown", handler);
|
|
1377
1384
|
}, [isOpen]);
|
|
1378
1385
|
useEffect4(() => {
|
|
1386
|
+
var _a;
|
|
1379
1387
|
if (!isOpen)
|
|
1380
1388
|
return;
|
|
1381
|
-
|
|
1382
|
-
if (el)
|
|
1383
|
-
el.focus();
|
|
1389
|
+
(_a = menuItemsRef.current[focusedIndex]) == null ? void 0 : _a.focus();
|
|
1384
1390
|
}, [focusedIndex, isOpen]);
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1391
|
+
const childrenWithProps = React16.Children.map(children, (child) => {
|
|
1392
|
+
if (!React16.isValidElement(child))
|
|
1393
|
+
return child;
|
|
1394
|
+
return React16.cloneElement(child, {
|
|
1395
|
+
dropdownProps: {
|
|
1396
|
+
isOpen,
|
|
1397
|
+
setIsOpen,
|
|
1398
|
+
triggerRef,
|
|
1399
|
+
contentRef,
|
|
1400
|
+
registerItem,
|
|
1401
|
+
menuItemsRef
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
});
|
|
1405
|
+
return /* @__PURE__ */ React16.createElement("div", { className: "relative inline-block" }, childrenWithProps);
|
|
1397
1406
|
}
|
|
1398
|
-
function DropdownMenuTrigger({
|
|
1399
|
-
|
|
1400
|
-
isOpen,
|
|
1401
|
-
setIsOpen
|
|
1402
|
-
}) {
|
|
1403
|
-
const ctx = React16.useContext(DropdownContext);
|
|
1404
|
-
const actualIsOpen = (ctx == null ? void 0 : ctx.isOpen) ?? isOpen;
|
|
1405
|
-
const actualSetIsOpen = (ctx == null ? void 0 : ctx.setIsOpen) ?? setIsOpen;
|
|
1406
|
-
const handleKey = (e) => {
|
|
1407
|
-
switch (e.key) {
|
|
1408
|
-
case "Enter":
|
|
1409
|
-
case " ":
|
|
1410
|
-
e.preventDefault();
|
|
1411
|
-
actualSetIsOpen == null ? void 0 : actualSetIsOpen(!actualIsOpen);
|
|
1412
|
-
break;
|
|
1413
|
-
case "ArrowDown":
|
|
1414
|
-
e.preventDefault();
|
|
1415
|
-
actualSetIsOpen == null ? void 0 : actualSetIsOpen(true);
|
|
1416
|
-
break;
|
|
1417
|
-
case "ArrowUp":
|
|
1418
|
-
e.preventDefault();
|
|
1419
|
-
actualSetIsOpen == null ? void 0 : actualSetIsOpen(true);
|
|
1420
|
-
break;
|
|
1421
|
-
}
|
|
1422
|
-
};
|
|
1407
|
+
function DropdownMenuTrigger({ children, dropdownProps }) {
|
|
1408
|
+
const { isOpen, setIsOpen, triggerRef } = dropdownProps ?? {};
|
|
1423
1409
|
return /* @__PURE__ */ React16.createElement(
|
|
1424
1410
|
"div",
|
|
1425
1411
|
{
|
|
1426
|
-
ref:
|
|
1412
|
+
ref: triggerRef,
|
|
1427
1413
|
tabIndex: 0,
|
|
1428
1414
|
role: "button",
|
|
1429
1415
|
"aria-haspopup": "menu",
|
|
1430
|
-
"aria-expanded":
|
|
1431
|
-
onClick: () =>
|
|
1432
|
-
onKeyDown: handleKey,
|
|
1416
|
+
"aria-expanded": isOpen,
|
|
1417
|
+
onClick: () => setIsOpen == null ? void 0 : setIsOpen(!isOpen),
|
|
1433
1418
|
className: "cursor-pointer outline-none focus:ring-2 focus:ring-primary-500 rounded"
|
|
1434
1419
|
},
|
|
1435
1420
|
children
|
|
@@ -1437,30 +1422,29 @@ function DropdownMenuTrigger({
|
|
|
1437
1422
|
}
|
|
1438
1423
|
function DropdownMenuContent({
|
|
1439
1424
|
children,
|
|
1440
|
-
isOpen,
|
|
1441
1425
|
align = "right",
|
|
1442
|
-
className
|
|
1426
|
+
className,
|
|
1427
|
+
dropdownProps
|
|
1443
1428
|
}) {
|
|
1444
|
-
const
|
|
1445
|
-
const
|
|
1446
|
-
const [visible, setVisible] = useState3(actualIsOpen);
|
|
1429
|
+
const { isOpen, contentRef } = dropdownProps ?? {};
|
|
1430
|
+
const [visible, setVisible] = useState3(isOpen);
|
|
1447
1431
|
useEffect4(() => {
|
|
1448
|
-
if (
|
|
1432
|
+
if (isOpen)
|
|
1449
1433
|
setVisible(true);
|
|
1450
1434
|
else
|
|
1451
1435
|
setTimeout(() => setVisible(false), 150);
|
|
1452
|
-
}, [
|
|
1436
|
+
}, [isOpen]);
|
|
1453
1437
|
if (!visible)
|
|
1454
1438
|
return null;
|
|
1455
1439
|
const pos = align === "left" || align === "start" ? "right-0" : align === "right" || align === "end" ? "left-0" : align === "center" ? "left-1/2 -translate-x-1/2" : "";
|
|
1456
1440
|
return /* @__PURE__ */ React16.createElement(
|
|
1457
1441
|
"div",
|
|
1458
1442
|
{
|
|
1459
|
-
ref:
|
|
1443
|
+
ref: contentRef,
|
|
1460
1444
|
role: "menu",
|
|
1461
1445
|
className: cn(
|
|
1462
|
-
"absolute w-56
|
|
1463
|
-
|
|
1446
|
+
"absolute mt-2 w-56 rounded-md bg-white shadow-lg ring-1 ring-black/5 z-50 transition-all",
|
|
1447
|
+
isOpen ? "opacity-100" : "opacity-0 -translate-y-2",
|
|
1464
1448
|
pos,
|
|
1465
1449
|
className
|
|
1466
1450
|
)
|
|
@@ -1468,45 +1452,46 @@ function DropdownMenuContent({
|
|
|
1468
1452
|
children
|
|
1469
1453
|
);
|
|
1470
1454
|
}
|
|
1455
|
+
function DropdownMenuLabel({
|
|
1456
|
+
children
|
|
1457
|
+
}) {
|
|
1458
|
+
return /* @__PURE__ */ React16.createElement("div", { className: "px-4 py-2 text-sm font-semibold text-gray-700" }, children);
|
|
1459
|
+
}
|
|
1460
|
+
function DropdownMenuSeparator() {
|
|
1461
|
+
return /* @__PURE__ */ React16.createElement("div", { className: "my-1 border-t border-gray-100" });
|
|
1462
|
+
}
|
|
1471
1463
|
function DropdownMenuItemWrapper({
|
|
1472
1464
|
children,
|
|
1473
1465
|
onClick,
|
|
1474
1466
|
onKeyDown,
|
|
1475
1467
|
disabled,
|
|
1476
|
-
isSubTrigger,
|
|
1477
1468
|
className,
|
|
1469
|
+
dropdownProps,
|
|
1478
1470
|
"aria-expanded": ariaExpanded
|
|
1479
1471
|
}) {
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1472
|
+
const [index] = useState3(() => {
|
|
1473
|
+
var _a;
|
|
1474
|
+
return ((_a = dropdownProps == null ? void 0 : dropdownProps.registerItem) == null ? void 0 : _a.call(dropdownProps)) ?? -1;
|
|
1475
|
+
});
|
|
1482
1476
|
const ref = useRef2(null);
|
|
1483
1477
|
useEffect4(() => {
|
|
1484
|
-
if (
|
|
1485
|
-
|
|
1486
|
-
}
|
|
1487
|
-
}, [index, ctx]);
|
|
1488
|
-
const handleKey = (e) => {
|
|
1489
|
-
if (onKeyDown)
|
|
1490
|
-
onKeyDown(e);
|
|
1491
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1492
|
-
e.preventDefault();
|
|
1493
|
-
if (!disabled)
|
|
1494
|
-
onClick == null ? void 0 : onClick();
|
|
1478
|
+
if (index >= 0 && (dropdownProps == null ? void 0 : dropdownProps.menuItemsRef)) {
|
|
1479
|
+
dropdownProps.menuItemsRef.current[index] = ref.current;
|
|
1495
1480
|
}
|
|
1496
|
-
};
|
|
1481
|
+
}, [index, dropdownProps]);
|
|
1497
1482
|
return /* @__PURE__ */ React16.createElement(
|
|
1498
1483
|
"div",
|
|
1499
1484
|
{
|
|
1500
1485
|
ref,
|
|
1501
1486
|
role: "menuitem",
|
|
1502
1487
|
tabIndex: disabled ? -1 : 0,
|
|
1503
|
-
"aria-disabled": disabled,
|
|
1504
1488
|
"aria-expanded": ariaExpanded,
|
|
1489
|
+
"aria-disabled": disabled,
|
|
1505
1490
|
onClick: () => !disabled && (onClick == null ? void 0 : onClick()),
|
|
1506
|
-
onKeyDown
|
|
1491
|
+
onKeyDown,
|
|
1507
1492
|
className: cn(
|
|
1508
|
-
"px-4 py-2 flex
|
|
1509
|
-
disabled ? "text-gray-400
|
|
1493
|
+
"px-4 py-2 text-sm flex justify-between cursor-pointer rounded",
|
|
1494
|
+
disabled ? "text-gray-400" : "hover:bg-gray-100",
|
|
1510
1495
|
className
|
|
1511
1496
|
)
|
|
1512
1497
|
},
|
|
@@ -1515,78 +1500,68 @@ function DropdownMenuItemWrapper({
|
|
|
1515
1500
|
}
|
|
1516
1501
|
function DropdownMenuItem({
|
|
1517
1502
|
children,
|
|
1518
|
-
className = "",
|
|
1519
1503
|
onClick,
|
|
1520
1504
|
disabled,
|
|
1521
|
-
|
|
1505
|
+
dropdownProps
|
|
1522
1506
|
}) {
|
|
1523
|
-
const ctx = React16.useContext(DropdownContext);
|
|
1524
1507
|
return /* @__PURE__ */ React16.createElement(
|
|
1525
1508
|
DropdownMenuItemWrapper,
|
|
1526
1509
|
{
|
|
1527
1510
|
disabled,
|
|
1528
1511
|
onClick: () => {
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
ctx == null ? void 0 : ctx.setIsOpen(false);
|
|
1532
|
-
}
|
|
1512
|
+
onClick == null ? void 0 : onClick();
|
|
1513
|
+
dropdownProps == null ? void 0 : dropdownProps.setIsOpen(false);
|
|
1533
1514
|
},
|
|
1534
|
-
|
|
1515
|
+
dropdownProps
|
|
1535
1516
|
},
|
|
1536
|
-
|
|
1537
|
-
shortcut && /* @__PURE__ */ React16.createElement("kbd", { className: "text-xs text-gray-400" }, shortcut)
|
|
1517
|
+
children
|
|
1538
1518
|
);
|
|
1539
1519
|
}
|
|
1540
|
-
function DropdownMenuLabel({ children }) {
|
|
1541
|
-
return /* @__PURE__ */ React16.createElement("div", { className: "px-4 py-2 text-sm font-semibold text-gray-700" }, children);
|
|
1542
|
-
}
|
|
1543
|
-
function DropdownMenuSeparator() {
|
|
1544
|
-
return /* @__PURE__ */ React16.createElement("div", { className: "border-t border-gray-100 my-1" });
|
|
1545
|
-
}
|
|
1546
|
-
var SubmenuContext = React16.createContext(null);
|
|
1547
1520
|
function DropdownMenuSub({ children }) {
|
|
1548
1521
|
const [isSubOpen, setIsSubOpen] = useState3(false);
|
|
1549
|
-
|
|
1522
|
+
const childrenWithProps = React16.Children.map(children, (child) => {
|
|
1523
|
+
if (!React16.isValidElement(child))
|
|
1524
|
+
return child;
|
|
1525
|
+
return React16.cloneElement(child, {
|
|
1526
|
+
submenuProps: { isSubOpen, setIsSubOpen }
|
|
1527
|
+
});
|
|
1528
|
+
});
|
|
1529
|
+
return /* @__PURE__ */ React16.createElement("div", { className: "relative" }, childrenWithProps);
|
|
1550
1530
|
}
|
|
1551
|
-
function DropdownMenuSubTrigger({
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
sub.setIsSubOpen(true);
|
|
1557
|
-
} else if (e.key === "ArrowLeft") {
|
|
1558
|
-
e.preventDefault();
|
|
1559
|
-
sub.setIsSubOpen(false);
|
|
1560
|
-
}
|
|
1561
|
-
};
|
|
1531
|
+
function DropdownMenuSubTrigger({
|
|
1532
|
+
children,
|
|
1533
|
+
submenuProps,
|
|
1534
|
+
dropdownProps
|
|
1535
|
+
}) {
|
|
1562
1536
|
return /* @__PURE__ */ React16.createElement(
|
|
1563
1537
|
DropdownMenuItemWrapper,
|
|
1564
1538
|
{
|
|
1565
|
-
|
|
1566
|
-
"aria-expanded":
|
|
1567
|
-
onClick: () =>
|
|
1568
|
-
onKeyDown: handleKey
|
|
1539
|
+
dropdownProps,
|
|
1540
|
+
"aria-expanded": submenuProps == null ? void 0 : submenuProps.isSubOpen,
|
|
1541
|
+
onClick: () => submenuProps == null ? void 0 : submenuProps.setIsSubOpen(!(submenuProps == null ? void 0 : submenuProps.isSubOpen))
|
|
1569
1542
|
},
|
|
1570
|
-
/* @__PURE__ */ React16.createElement("span",
|
|
1543
|
+
/* @__PURE__ */ React16.createElement("span", null, children),
|
|
1571
1544
|
/* @__PURE__ */ React16.createElement(
|
|
1572
1545
|
RiArrowDownSLine3,
|
|
1573
1546
|
{
|
|
1574
1547
|
className: cn(
|
|
1575
1548
|
"w-4 h-4 transition-transform",
|
|
1576
|
-
|
|
1549
|
+
(submenuProps == null ? void 0 : submenuProps.isSubOpen) && "rotate-180"
|
|
1577
1550
|
)
|
|
1578
1551
|
}
|
|
1579
1552
|
)
|
|
1580
1553
|
);
|
|
1581
1554
|
}
|
|
1582
|
-
function DropdownMenuSubContent({
|
|
1583
|
-
|
|
1555
|
+
function DropdownMenuSubContent({
|
|
1556
|
+
children,
|
|
1557
|
+
submenuProps
|
|
1558
|
+
}) {
|
|
1584
1559
|
return /* @__PURE__ */ React16.createElement(
|
|
1585
1560
|
"div",
|
|
1586
1561
|
{
|
|
1587
1562
|
className: cn(
|
|
1588
|
-
"overflow-hidden
|
|
1589
|
-
|
|
1563
|
+
"overflow-hidden transition-all",
|
|
1564
|
+
(submenuProps == null ? void 0 : submenuProps.isSubOpen) ? "max-h-[300px] opacity-100" : "max-h-0 opacity-0"
|
|
1590
1565
|
)
|
|
1591
1566
|
},
|
|
1592
1567
|
children
|
|
@@ -1626,7 +1601,8 @@ var DropdownWithIcon = forwardRef6(
|
|
|
1626
1601
|
onApply,
|
|
1627
1602
|
disabled = false,
|
|
1628
1603
|
onReset,
|
|
1629
|
-
footerAction
|
|
1604
|
+
footerAction,
|
|
1605
|
+
height = "200px"
|
|
1630
1606
|
}, ref) => {
|
|
1631
1607
|
const [searchQuery, setSearchQuery] = useState4("");
|
|
1632
1608
|
const localDropdownRef = useRef3(null);
|
|
@@ -1746,7 +1722,7 @@ var DropdownWithIcon = forwardRef6(
|
|
|
1746
1722
|
"aria-labelledby": `${id}-label`,
|
|
1747
1723
|
tabIndex: -1,
|
|
1748
1724
|
className: cn(
|
|
1749
|
-
"max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-
|
|
1725
|
+
"max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-sm bg-white z-[1000] w-full transition-all duration-75 delay-100 ease-in",
|
|
1750
1726
|
dropdownMenu ? "border border-primary-600" : "border border-gray-200",
|
|
1751
1727
|
position === "top" ? "top-10" : position === "bottom" ? "bottom-10" : position === "left" ? "left-0" : position === "right" ? "right-[90%]" : "top-10",
|
|
1752
1728
|
dropdownMenu && "max-h-[360px] h-fit opacity-[1] transition-all ease-in duration-150"
|
|
@@ -1776,7 +1752,7 @@ var DropdownWithIcon = forwardRef6(
|
|
|
1776
1752
|
type: "button",
|
|
1777
1753
|
"aria-label": "Select all",
|
|
1778
1754
|
onClick: handleSelectAll,
|
|
1779
|
-
className: "text-
|
|
1755
|
+
className: "text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
|
|
1780
1756
|
},
|
|
1781
1757
|
"Select all"
|
|
1782
1758
|
), /* @__PURE__ */ React17.createElement(
|
|
@@ -1784,12 +1760,12 @@ var DropdownWithIcon = forwardRef6(
|
|
|
1784
1760
|
{
|
|
1785
1761
|
"aria-label": "Reset",
|
|
1786
1762
|
type: "button",
|
|
1787
|
-
className: "text-
|
|
1763
|
+
className: "text-sm text-warning-500 hover:text-warning-600",
|
|
1788
1764
|
onClick: handleReset
|
|
1789
1765
|
},
|
|
1790
1766
|
"Reset"
|
|
1791
1767
|
)),
|
|
1792
|
-
/* @__PURE__ */ React17.createElement("section", { className: "
|
|
1768
|
+
/* @__PURE__ */ React17.createElement("section", { style: { maxHeight: height }, className: "z-[1000] transition-all duration-75 delay-100 ease-in-out overflow-y-scroll" }, options ? memoizedFilteredOptions == null ? void 0 : memoizedFilteredOptions.map((option, i) => {
|
|
1793
1769
|
var _a;
|
|
1794
1770
|
return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: i }, multiple ? /* @__PURE__ */ React17.createElement(
|
|
1795
1771
|
Label_default,
|
|
@@ -1824,7 +1800,7 @@ var DropdownWithIcon = forwardRef6(
|
|
|
1824
1800
|
},
|
|
1825
1801
|
renderItem(option)
|
|
1826
1802
|
))), /* @__PURE__ */ React17.createElement("span", { className: "text-gray-500" }, option == null ? void 0 : option.info)),
|
|
1827
|
-
/* @__PURE__ */ React17.createElement("span", { className: "pt-[2px] text-
|
|
1803
|
+
/* @__PURE__ */ React17.createElement("span", { className: "pt-[2px] text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
|
|
1828
1804
|
) : /* @__PURE__ */ React17.createElement(
|
|
1829
1805
|
Label_default,
|
|
1830
1806
|
{
|
|
@@ -1874,7 +1850,7 @@ var DropdownFooter2 = ({
|
|
|
1874
1850
|
onApply,
|
|
1875
1851
|
setDropdownMenu
|
|
1876
1852
|
}) => {
|
|
1877
|
-
return /* @__PURE__ */ React17.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-
|
|
1853
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-sm" }, /* @__PURE__ */ React17.createElement(
|
|
1878
1854
|
"button",
|
|
1879
1855
|
{
|
|
1880
1856
|
type: "button",
|
|
@@ -2377,7 +2353,7 @@ var noticeVariants = cva6("p-4 w-fit rounded-[6px]", {
|
|
|
2377
2353
|
position: {
|
|
2378
2354
|
top: "top-4 transition-all duration-700 m-auto left-0 right-0",
|
|
2379
2355
|
bottom: "bottom-4 transition-all duration-700 right-4",
|
|
2380
|
-
center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2
|
|
2356
|
+
center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
2381
2357
|
}
|
|
2382
2358
|
}
|
|
2383
2359
|
});
|
|
@@ -2712,7 +2688,7 @@ var Radio = forwardRef10(
|
|
|
2712
2688
|
Radio.displayName = "Radio";
|
|
2713
2689
|
var Radio_default = Radio;
|
|
2714
2690
|
|
|
2715
|
-
// app/components/
|
|
2691
|
+
// app/components/FileUploadControl.tsx
|
|
2716
2692
|
import React32, { useRef as useRef7, useState as useState9 } from "react";
|
|
2717
2693
|
import {
|
|
2718
2694
|
RiDeleteBin6Line,
|
|
@@ -2780,7 +2756,7 @@ var Spinner = ({ size = "md", color = "primary" }) => {
|
|
|
2780
2756
|
};
|
|
2781
2757
|
var Spinner_default = Spinner;
|
|
2782
2758
|
|
|
2783
|
-
// app/components/
|
|
2759
|
+
// app/components/FileUploadControl.tsx
|
|
2784
2760
|
var fileSvg = () => {
|
|
2785
2761
|
return /* @__PURE__ */ React32.createElement(
|
|
2786
2762
|
"svg",
|
|
@@ -2885,7 +2861,7 @@ var defaultGetFileIcon = (fileName, fileType) => {
|
|
|
2885
2861
|
}
|
|
2886
2862
|
return /* @__PURE__ */ React32.createElement(RiFileLine2, { className: "w-5 h-5 text-white" });
|
|
2887
2863
|
};
|
|
2888
|
-
function
|
|
2864
|
+
function FileUploadControl({
|
|
2889
2865
|
items,
|
|
2890
2866
|
onAddFiles,
|
|
2891
2867
|
onUpdateItem,
|
|
@@ -4456,10 +4432,10 @@ export {
|
|
|
4456
4432
|
DropdownWithIcon_default as DropdownWithIcon,
|
|
4457
4433
|
FileSelector_default as FileSelector,
|
|
4458
4434
|
FileUpload_default as FileUpload,
|
|
4435
|
+
FileUploadControl,
|
|
4459
4436
|
FileUploadPreview_default as FileUploadPreview,
|
|
4460
4437
|
GlobalNavigation_default as GlobalNavigation,
|
|
4461
4438
|
HelperText_default as HelperText,
|
|
4462
|
-
ImageUploadControlled,
|
|
4463
4439
|
Input_default as Input,
|
|
4464
4440
|
Label_default as Label,
|
|
4465
4441
|
ListPagination_default as ListPagination,
|