atomos_next_genesis 0.0.9 → 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 CHANGED
@@ -64,10 +64,10 @@ __export(app_exports, {
64
64
  DropdownWithIcon: () => DropdownWithIcon_default,
65
65
  FileSelector: () => FileSelector_default,
66
66
  FileUpload: () => FileUpload_default,
67
+ FileUploadControl: () => FileUploadControl,
67
68
  FileUploadPreview: () => FileUploadPreview_default,
68
69
  GlobalNavigation: () => GlobalNavigation_default,
69
70
  HelperText: () => HelperText_default,
70
- ImageUploadControlled: () => ImageUploadControlled,
71
71
  Input: () => Input_default,
72
72
  Label: () => Label_default,
73
73
  ListPagination: () => ListPagination_default,
@@ -295,7 +295,7 @@ var Avatar = (0, import_react3.forwardRef)((props, ref) => {
295
295
  {
296
296
  ref,
297
297
  className: cn(
298
- "relative -z-10 ",
298
+ "relative",
299
299
  rounded && "rounded-full",
300
300
  border && "border border-gray-200",
301
301
  disabled && "opacity-50 pointer-events-none select-none",
@@ -311,7 +311,7 @@ var Avatar = (0, import_react3.forwardRef)((props, ref) => {
311
311
  "div",
312
312
  {
313
313
  className: cn(
314
- "relative -z-10 flex items-center justify-center",
314
+ "relative flex items-center justify-center",
315
315
  sizes[size],
316
316
  className
317
317
  ),
@@ -1133,7 +1133,8 @@ var Dropdown = (0, import_react17.forwardRef)(
1133
1133
  onApply,
1134
1134
  disabled = false,
1135
1135
  onReset,
1136
- footerAction
1136
+ footerAction,
1137
+ height = "200px"
1137
1138
  }, ref) => {
1138
1139
  var _a, _b;
1139
1140
  const [searchQuery, setSearchQuery] = (0, import_react17.useState)("");
@@ -1244,7 +1245,7 @@ var Dropdown = (0, import_react17.forwardRef)(
1244
1245
  }
1245
1246
  },
1246
1247
  className: cn(
1247
- "w-full hover:bg-gray-50 py-2 px-[14px] rounded-lg flex justify-between items-center text-gray-900 bg-gray-25 text-text-sm cursor-pointer",
1248
+ "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",
1248
1249
  dropdownMenu ? "border border-primary-600" : "border border-gray-200",
1249
1250
  disabled && "bg-gray-300 hover:bg-gray-300 cursor-not-allowed"
1250
1251
  )
@@ -1259,7 +1260,7 @@ var Dropdown = (0, import_react17.forwardRef)(
1259
1260
  "aria-multiselectable": multiple,
1260
1261
  "aria-labelledby": `${id}-label`,
1261
1262
  className: cn(
1262
- "max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-[16px] bg-white z-[1000] w-full transition-all duration-75 delay-100 ease-in",
1263
+ "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",
1263
1264
  position === "top" ? "top-10" : "bottom-10",
1264
1265
  dropdownMenu ? "border border-primary-600" : "border border-gray-200",
1265
1266
  dropdownMenu && "max-h-[360px] h-fit opacity-[1] transition-all ease-in duration-150"
@@ -1284,7 +1285,7 @@ var Dropdown = (0, import_react17.forwardRef)(
1284
1285
  type: "button",
1285
1286
  "aria-label": "Select all",
1286
1287
  onClick: handleSelectAll,
1287
- className: "text-text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
1288
+ className: "text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
1288
1289
  },
1289
1290
  "Select all"
1290
1291
  ), /* @__PURE__ */ import_react17.default.createElement(
@@ -1292,77 +1293,84 @@ var Dropdown = (0, import_react17.forwardRef)(
1292
1293
  {
1293
1294
  "aria-label": "Reset",
1294
1295
  type: "button",
1295
- className: "text-text-sm text-warning-500 hover:text-warning-600",
1296
+ className: "text-sm text-warning-500 hover:text-warning-600",
1296
1297
  onClick: handleReset
1297
1298
  },
1298
1299
  "Reset"
1299
1300
  )),
1300
- /* @__PURE__ */ import_react17.default.createElement("section", { className: "max-h-[200px] transition-all duration-75 delay-100 ease-in-out overflow-y-scroll" }, options ? memoizedFilteredOptions == null ? void 0 : memoizedFilteredOptions.map((option, i) => {
1301
- var _a2;
1302
- return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, { key: i }, multiple ? /* @__PURE__ */ import_react17.default.createElement(
1303
- Label_default,
1304
- {
1305
- className: cn(
1306
- "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",
1307
- (option == null ? void 0 : option.disabledOption) && "opacity-50 cursor-not-allowed hover:bg-white text-gray-300 select-none"
1308
- ),
1309
- htmlFor: `${id}-checkbox-${option.value}`,
1310
- key: i
1311
- },
1312
- /* @__PURE__ */ import_react17.default.createElement("section", { className: "flex items-center justify-between gap-2 w-full" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react17.default.createElement(
1313
- Checkbox_default,
1314
- {
1315
- id: `${id}-checkbox-${option.value}`,
1316
- checked: (selected == null ? void 0 : selected.some(
1317
- (item) => item.value === option.value
1318
- )) ?? false,
1319
- onChange: () => handleCheckboxChange(option),
1320
- disabled: option == null ? void 0 : option.disabledOption
1321
- }
1322
- ), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react17.default.createElement(
1323
- "div",
1301
+ /* @__PURE__ */ import_react17.default.createElement(
1302
+ "section",
1303
+ {
1304
+ style: { maxHeight: height },
1305
+ className: "z-[1000] transition-all duration-75 delay-100 ease-in-out overflow-y-scroll"
1306
+ },
1307
+ options ? memoizedFilteredOptions == null ? void 0 : memoizedFilteredOptions.map((option, i) => {
1308
+ var _a2;
1309
+ return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, { key: i }, multiple ? /* @__PURE__ */ import_react17.default.createElement(
1310
+ Label_default,
1324
1311
  {
1325
- style: {
1326
- color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
1327
- },
1328
1312
  className: cn(
1329
- "break-words",
1330
- (option == null ? void 0 : option.disabledOption) && "text-gray-300"
1331
- )
1313
+ "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",
1314
+ (option == null ? void 0 : option.disabledOption) && "opacity-50 cursor-not-allowed hover:bg-white text-gray-300 select-none"
1315
+ ),
1316
+ htmlFor: `${id}-checkbox-${option.value}`,
1317
+ key: i
1332
1318
  },
1333
- renderItem(option)
1334
- ))), /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-gray-500" }, option == null ? void 0 : option.info)),
1335
- /* @__PURE__ */ import_react17.default.createElement("span", { className: "pt-[2px] text-text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
1336
- ) : /* @__PURE__ */ import_react17.default.createElement(
1337
- Label_default,
1338
- {
1339
- key: i,
1340
- htmlFor: `${id}-checkbox-${option.value}`,
1341
- className: cn(
1342
- "flex justify-between py-[6px] px-[14px] hover:bg-gray-50 gap-2 items-center border-l-4 border-transparent cursor-pointer",
1319
+ /* @__PURE__ */ import_react17.default.createElement("section", { className: "flex items-center justify-between gap-2 w-full" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react17.default.createElement(
1320
+ Checkbox_default,
1343
1321
  {
1344
- "bg-primary-50 border-primary-600": selected && ((_a2 = selected[0]) == null ? void 0 : _a2.value) === option.value,
1345
- "opacity-50 cursor-not-allowed hover:bg-white text-gray-500": option == null ? void 0 : option.disabledOption
1322
+ id: `${id}-checkbox-${option.value}`,
1323
+ checked: (selected == null ? void 0 : selected.some(
1324
+ (item) => item.value === option.value
1325
+ )) ?? false,
1326
+ onChange: () => handleCheckboxChange(option),
1327
+ disabled: option == null ? void 0 : option.disabledOption
1346
1328
  }
1347
- ),
1348
- onClick: () => !(option == null ? void 0 : option.disabledOption) && toggleOption(option)
1349
- },
1350
- /* @__PURE__ */ import_react17.default.createElement(
1351
- "div",
1352
- {
1353
- style: {
1354
- color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
1329
+ ), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react17.default.createElement(
1330
+ "div",
1331
+ {
1332
+ style: {
1333
+ color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
1334
+ },
1335
+ className: cn(
1336
+ "break-words",
1337
+ (option == null ? void 0 : option.disabledOption) && "text-gray-300"
1338
+ )
1355
1339
  },
1340
+ renderItem(option)
1341
+ ))), /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-gray-500" }, option == null ? void 0 : option.info)),
1342
+ /* @__PURE__ */ import_react17.default.createElement("span", { className: "pt-[2px] text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
1343
+ ) : /* @__PURE__ */ import_react17.default.createElement(
1344
+ Label_default,
1345
+ {
1346
+ key: i,
1347
+ htmlFor: `${id}-checkbox-${option.value}`,
1356
1348
  className: cn(
1357
- "break-words",
1358
- (option == null ? void 0 : option.disabledOption) && "text-gray-300"
1359
- )
1349
+ "flex justify-between py-[6px] px-[14px] hover:bg-gray-50 gap-2 items-center border-l-4 border-transparent cursor-pointer",
1350
+ {
1351
+ "bg-primary-50 border-primary-600": selected && ((_a2 = selected[0]) == null ? void 0 : _a2.value) === option.value,
1352
+ "opacity-50 cursor-not-allowed hover:bg-white text-gray-500": option == null ? void 0 : option.disabledOption
1353
+ }
1354
+ ),
1355
+ onClick: () => !(option == null ? void 0 : option.disabledOption) && toggleOption(option)
1360
1356
  },
1361
- renderItem(option)
1362
- ),
1363
- /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-gray-500" }, info)
1364
- ));
1365
- }) : children),
1357
+ /* @__PURE__ */ import_react17.default.createElement(
1358
+ "div",
1359
+ {
1360
+ style: {
1361
+ color: (option == null ? void 0 : option.disabledOption) ? "#D1D5DB" : option.labelTextColor
1362
+ },
1363
+ className: cn(
1364
+ "break-words",
1365
+ (option == null ? void 0 : option.disabledOption) && "text-gray-300"
1366
+ )
1367
+ },
1368
+ renderItem(option)
1369
+ ),
1370
+ /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-gray-500" }, info)
1371
+ ));
1372
+ }) : children
1373
+ ),
1366
1374
  footerAction && /* @__PURE__ */ import_react17.default.createElement("div", { className: "py-2 mt-1 px-2 border-t" }, footerAction),
1367
1375
  dropdownFooter && /* @__PURE__ */ import_react17.default.createElement(
1368
1376
  DropdownFooter,
@@ -1382,7 +1390,7 @@ var DropdownFooter = ({
1382
1390
  onApply,
1383
1391
  setDropdownMenu
1384
1392
  }) => {
1385
- return /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-text-sm" }, /* @__PURE__ */ import_react17.default.createElement(
1393
+ return /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-sm" }, /* @__PURE__ */ import_react17.default.createElement(
1386
1394
  "button",
1387
1395
  {
1388
1396
  type: "button",
@@ -1405,8 +1413,9 @@ var Dropdown_default = Dropdown;
1405
1413
  // app/components/DropdownMenu.tsx
1406
1414
  var import_react19 = require("@remixicon/react");
1407
1415
  var import_react20 = __toESM(require("react"), 1);
1408
- var DropdownContext = import_react20.default.createContext(null);
1409
- function DropdownMenu({ children }) {
1416
+ function DropdownMenu({
1417
+ children
1418
+ }) {
1410
1419
  const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
1411
1420
  const [focusedIndex, setFocusedIndex] = (0, import_react20.useState)(-1);
1412
1421
  const triggerRef = (0, import_react20.useRef)(null);
@@ -1425,106 +1434,82 @@ function DropdownMenu({ children }) {
1425
1434
  (0, import_react20.useEffect)(() => {
1426
1435
  if (!isOpen)
1427
1436
  return;
1428
- const handleClickOutside = (e) => {
1437
+ const handler = (e) => {
1429
1438
  if (triggerRef.current && contentRef.current && !triggerRef.current.contains(e.target) && !contentRef.current.contains(e.target)) {
1430
1439
  closeMenu();
1431
1440
  }
1432
1441
  };
1433
- document.addEventListener("mousedown", handleClickOutside);
1434
- return () => document.removeEventListener("mousedown", handleClickOutside);
1442
+ document.addEventListener("mousedown", handler);
1443
+ return () => document.removeEventListener("mousedown", handler);
1435
1444
  }, [isOpen]);
1436
1445
  (0, import_react20.useEffect)(() => {
1437
1446
  if (!isOpen)
1438
1447
  return;
1439
- const handleKey = (event) => {
1448
+ const handler = (e) => {
1440
1449
  var _a;
1441
- switch (event.key) {
1450
+ switch (e.key) {
1442
1451
  case "Escape":
1443
- event.preventDefault();
1452
+ e.preventDefault();
1444
1453
  closeMenu();
1445
1454
  (_a = triggerRef.current) == null ? void 0 : _a.focus();
1446
1455
  break;
1447
1456
  case "ArrowDown":
1448
- event.preventDefault();
1457
+ e.preventDefault();
1449
1458
  setFocusedIndex(
1450
- (prev) => prev < itemsCountRef.current - 1 ? prev + 1 : 0
1459
+ (p) => p < itemsCountRef.current - 1 ? p + 1 : 0
1451
1460
  );
1452
1461
  break;
1453
1462
  case "ArrowUp":
1454
- event.preventDefault();
1463
+ e.preventDefault();
1455
1464
  setFocusedIndex(
1456
- (prev) => prev > 0 ? prev - 1 : itemsCountRef.current - 1
1465
+ (p) => p > 0 ? p - 1 : itemsCountRef.current - 1
1457
1466
  );
1458
1467
  break;
1459
1468
  case "Home":
1460
- event.preventDefault();
1461
1469
  setFocusedIndex(0);
1462
1470
  break;
1463
1471
  case "End":
1464
- event.preventDefault();
1465
1472
  setFocusedIndex(itemsCountRef.current - 1);
1466
1473
  break;
1467
1474
  }
1468
1475
  };
1469
- document.addEventListener("keydown", handleKey);
1476
+ document.addEventListener("keydown", handler);
1470
1477
  setFocusedIndex(0);
1471
- return () => document.removeEventListener("keydown", handleKey);
1478
+ return () => document.removeEventListener("keydown", handler);
1472
1479
  }, [isOpen]);
1473
1480
  (0, import_react20.useEffect)(() => {
1481
+ var _a;
1474
1482
  if (!isOpen)
1475
1483
  return;
1476
- const el = menuItemsRef.current[focusedIndex];
1477
- if (el)
1478
- el.focus();
1484
+ (_a = menuItemsRef.current[focusedIndex]) == null ? void 0 : _a.focus();
1479
1485
  }, [focusedIndex, isOpen]);
1480
- const contextValue = {
1481
- isOpen,
1482
- setIsOpen,
1483
- triggerRef,
1484
- contentRef,
1485
- focusedIndex,
1486
- setFocusedIndex,
1487
- itemsCount: itemsCountRef.current,
1488
- registerItem,
1489
- menuItemsRef
1490
- };
1491
- return /* @__PURE__ */ import_react20.default.createElement(DropdownContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative inline-block text-left" }, children));
1486
+ const childrenWithProps = import_react20.default.Children.map(children, (child) => {
1487
+ if (!import_react20.default.isValidElement(child))
1488
+ return child;
1489
+ return import_react20.default.cloneElement(child, {
1490
+ dropdownProps: {
1491
+ isOpen,
1492
+ setIsOpen,
1493
+ triggerRef,
1494
+ contentRef,
1495
+ registerItem,
1496
+ menuItemsRef
1497
+ }
1498
+ });
1499
+ });
1500
+ return /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative inline-block" }, childrenWithProps);
1492
1501
  }
1493
- function DropdownMenuTrigger({
1494
- children,
1495
- isOpen,
1496
- setIsOpen
1497
- }) {
1498
- const ctx = import_react20.default.useContext(DropdownContext);
1499
- const actualIsOpen = (ctx == null ? void 0 : ctx.isOpen) ?? isOpen;
1500
- const actualSetIsOpen = (ctx == null ? void 0 : ctx.setIsOpen) ?? setIsOpen;
1501
- const handleKey = (e) => {
1502
- switch (e.key) {
1503
- case "Enter":
1504
- case " ":
1505
- e.preventDefault();
1506
- actualSetIsOpen == null ? void 0 : actualSetIsOpen(!actualIsOpen);
1507
- break;
1508
- case "ArrowDown":
1509
- e.preventDefault();
1510
- actualSetIsOpen == null ? void 0 : actualSetIsOpen(true);
1511
- break;
1512
- case "ArrowUp":
1513
- e.preventDefault();
1514
- actualSetIsOpen == null ? void 0 : actualSetIsOpen(true);
1515
- break;
1516
- }
1517
- };
1502
+ function DropdownMenuTrigger({ children, dropdownProps }) {
1503
+ const { isOpen, setIsOpen, triggerRef } = dropdownProps ?? {};
1518
1504
  return /* @__PURE__ */ import_react20.default.createElement(
1519
1505
  "div",
1520
1506
  {
1521
- ref: ctx == null ? void 0 : ctx.triggerRef,
1507
+ ref: triggerRef,
1522
1508
  tabIndex: 0,
1523
1509
  role: "button",
1524
1510
  "aria-haspopup": "menu",
1525
- "aria-expanded": actualIsOpen,
1526
- onClick: () => actualSetIsOpen == null ? void 0 : actualSetIsOpen(!actualIsOpen),
1527
- onKeyDown: handleKey,
1511
+ "aria-expanded": isOpen,
1512
+ onClick: () => setIsOpen == null ? void 0 : setIsOpen(!isOpen),
1528
1513
  className: "cursor-pointer outline-none focus:ring-2 focus:ring-primary-500 rounded"
1529
1514
  },
1530
1515
  children
@@ -1532,30 +1517,29 @@ function DropdownMenuTrigger({
1532
1517
  }
1533
1518
  function DropdownMenuContent({
1534
1519
  children,
1535
- isOpen,
1536
1520
  align = "right",
1537
- className = ""
1521
+ className,
1522
+ dropdownProps
1538
1523
  }) {
1539
- const ctx = import_react20.default.useContext(DropdownContext);
1540
- const actualIsOpen = (ctx == null ? void 0 : ctx.isOpen) ?? isOpen;
1541
- const [visible, setVisible] = (0, import_react20.useState)(actualIsOpen);
1524
+ const { isOpen, contentRef } = dropdownProps ?? {};
1525
+ const [visible, setVisible] = (0, import_react20.useState)(isOpen);
1542
1526
  (0, import_react20.useEffect)(() => {
1543
- if (actualIsOpen)
1527
+ if (isOpen)
1544
1528
  setVisible(true);
1545
1529
  else
1546
1530
  setTimeout(() => setVisible(false), 150);
1547
- }, [actualIsOpen]);
1531
+ }, [isOpen]);
1548
1532
  if (!visible)
1549
1533
  return null;
1550
1534
  const pos = align === "left" || align === "start" ? "right-0" : align === "right" || align === "end" ? "left-0" : align === "center" ? "left-1/2 -translate-x-1/2" : "";
1551
1535
  return /* @__PURE__ */ import_react20.default.createElement(
1552
1536
  "div",
1553
1537
  {
1554
- ref: ctx == null ? void 0 : ctx.contentRef,
1538
+ ref: contentRef,
1555
1539
  role: "menu",
1556
1540
  className: cn(
1557
- "absolute w-56 mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-50 transition-all",
1558
- actualIsOpen ? "opacity-100" : "opacity-0 -translate-y-2",
1541
+ "absolute mt-2 w-56 rounded-md bg-white shadow-lg ring-1 ring-black/5 z-50 transition-all",
1542
+ isOpen ? "opacity-100" : "opacity-0 -translate-y-2",
1559
1543
  pos,
1560
1544
  className
1561
1545
  )
@@ -1563,45 +1547,46 @@ function DropdownMenuContent({
1563
1547
  children
1564
1548
  );
1565
1549
  }
1550
+ function DropdownMenuLabel({
1551
+ children
1552
+ }) {
1553
+ return /* @__PURE__ */ import_react20.default.createElement("div", { className: "px-4 py-2 text-sm font-semibold text-gray-700" }, children);
1554
+ }
1555
+ function DropdownMenuSeparator() {
1556
+ return /* @__PURE__ */ import_react20.default.createElement("div", { className: "my-1 border-t border-gray-100" });
1557
+ }
1566
1558
  function DropdownMenuItemWrapper({
1567
1559
  children,
1568
1560
  onClick,
1569
1561
  onKeyDown,
1570
1562
  disabled,
1571
- isSubTrigger,
1572
1563
  className,
1564
+ dropdownProps,
1573
1565
  "aria-expanded": ariaExpanded
1574
1566
  }) {
1575
- const ctx = import_react20.default.useContext(DropdownContext);
1576
- const [index] = (0, import_react20.useState)(() => (ctx == null ? void 0 : ctx.registerItem()) ?? -1);
1567
+ const [index] = (0, import_react20.useState)(() => {
1568
+ var _a;
1569
+ return ((_a = dropdownProps == null ? void 0 : dropdownProps.registerItem) == null ? void 0 : _a.call(dropdownProps)) ?? -1;
1570
+ });
1577
1571
  const ref = (0, import_react20.useRef)(null);
1578
1572
  (0, import_react20.useEffect)(() => {
1579
- if (ctx && index >= 0) {
1580
- ctx.menuItemsRef.current[index] = ref.current;
1581
- }
1582
- }, [index, ctx]);
1583
- const handleKey = (e) => {
1584
- if (onKeyDown)
1585
- onKeyDown(e);
1586
- if (e.key === "Enter" || e.key === " ") {
1587
- e.preventDefault();
1588
- if (!disabled)
1589
- onClick == null ? void 0 : onClick();
1573
+ if (index >= 0 && (dropdownProps == null ? void 0 : dropdownProps.menuItemsRef)) {
1574
+ dropdownProps.menuItemsRef.current[index] = ref.current;
1590
1575
  }
1591
- };
1576
+ }, [index, dropdownProps]);
1592
1577
  return /* @__PURE__ */ import_react20.default.createElement(
1593
1578
  "div",
1594
1579
  {
1595
1580
  ref,
1596
1581
  role: "menuitem",
1597
1582
  tabIndex: disabled ? -1 : 0,
1598
- "aria-disabled": disabled,
1599
1583
  "aria-expanded": ariaExpanded,
1584
+ "aria-disabled": disabled,
1600
1585
  onClick: () => !disabled && (onClick == null ? void 0 : onClick()),
1601
- onKeyDown: handleKey,
1586
+ onKeyDown,
1602
1587
  className: cn(
1603
- "px-4 py-2 flex items-center justify-between text-sm cursor-pointer rounded",
1604
- disabled ? "text-gray-400 cursor-not-allowed" : "hover:bg-gray-100",
1588
+ "px-4 py-2 text-sm flex justify-between cursor-pointer rounded",
1589
+ disabled ? "text-gray-400" : "hover:bg-gray-100",
1605
1590
  className
1606
1591
  )
1607
1592
  },
@@ -1610,78 +1595,68 @@ function DropdownMenuItemWrapper({
1610
1595
  }
1611
1596
  function DropdownMenuItem({
1612
1597
  children,
1613
- className = "",
1614
1598
  onClick,
1615
1599
  disabled,
1616
- shortcut
1600
+ dropdownProps
1617
1601
  }) {
1618
- const ctx = import_react20.default.useContext(DropdownContext);
1619
1602
  return /* @__PURE__ */ import_react20.default.createElement(
1620
1603
  DropdownMenuItemWrapper,
1621
1604
  {
1622
1605
  disabled,
1623
1606
  onClick: () => {
1624
- if (!disabled) {
1625
- onClick == null ? void 0 : onClick();
1626
- ctx == null ? void 0 : ctx.setIsOpen(false);
1627
- }
1607
+ onClick == null ? void 0 : onClick();
1608
+ dropdownProps == null ? void 0 : dropdownProps.setIsOpen(false);
1628
1609
  },
1629
- className
1610
+ dropdownProps
1630
1611
  },
1631
- /* @__PURE__ */ import_react20.default.createElement("span", null, children),
1632
- shortcut && /* @__PURE__ */ import_react20.default.createElement("kbd", { className: "text-xs text-gray-400" }, shortcut)
1612
+ children
1633
1613
  );
1634
1614
  }
1635
- function DropdownMenuLabel({ children }) {
1636
- return /* @__PURE__ */ import_react20.default.createElement("div", { className: "px-4 py-2 text-sm font-semibold text-gray-700" }, children);
1637
- }
1638
- function DropdownMenuSeparator() {
1639
- return /* @__PURE__ */ import_react20.default.createElement("div", { className: "border-t border-gray-100 my-1" });
1640
- }
1641
- var SubmenuContext = import_react20.default.createContext(null);
1642
1615
  function DropdownMenuSub({ children }) {
1643
1616
  const [isSubOpen, setIsSubOpen] = (0, import_react20.useState)(false);
1644
- return /* @__PURE__ */ import_react20.default.createElement(SubmenuContext.Provider, { value: { isSubOpen, setIsSubOpen } }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative" }, children));
1617
+ const childrenWithProps = import_react20.default.Children.map(children, (child) => {
1618
+ if (!import_react20.default.isValidElement(child))
1619
+ return child;
1620
+ return import_react20.default.cloneElement(child, {
1621
+ submenuProps: { isSubOpen, setIsSubOpen }
1622
+ });
1623
+ });
1624
+ return /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative" }, childrenWithProps);
1645
1625
  }
1646
- function DropdownMenuSubTrigger({ children }) {
1647
- const sub = import_react20.default.useContext(SubmenuContext);
1648
- const handleKey = (e) => {
1649
- if (e.key === "ArrowRight") {
1650
- e.preventDefault();
1651
- sub.setIsSubOpen(true);
1652
- } else if (e.key === "ArrowLeft") {
1653
- e.preventDefault();
1654
- sub.setIsSubOpen(false);
1655
- }
1656
- };
1626
+ function DropdownMenuSubTrigger({
1627
+ children,
1628
+ submenuProps,
1629
+ dropdownProps
1630
+ }) {
1657
1631
  return /* @__PURE__ */ import_react20.default.createElement(
1658
1632
  DropdownMenuItemWrapper,
1659
1633
  {
1660
- isSubTrigger: true,
1661
- "aria-expanded": sub.isSubOpen,
1662
- onClick: () => sub.setIsSubOpen(!sub.isSubOpen),
1663
- onKeyDown: handleKey
1634
+ dropdownProps,
1635
+ "aria-expanded": submenuProps == null ? void 0 : submenuProps.isSubOpen,
1636
+ onClick: () => submenuProps == null ? void 0 : submenuProps.setIsSubOpen(!(submenuProps == null ? void 0 : submenuProps.isSubOpen))
1664
1637
  },
1665
- /* @__PURE__ */ import_react20.default.createElement("span", { className: "flex-1" }, children),
1638
+ /* @__PURE__ */ import_react20.default.createElement("span", null, children),
1666
1639
  /* @__PURE__ */ import_react20.default.createElement(
1667
1640
  import_react19.RiArrowDownSLine,
1668
1641
  {
1669
1642
  className: cn(
1670
1643
  "w-4 h-4 transition-transform",
1671
- sub.isSubOpen && "rotate-180"
1644
+ (submenuProps == null ? void 0 : submenuProps.isSubOpen) && "rotate-180"
1672
1645
  )
1673
1646
  }
1674
1647
  )
1675
1648
  );
1676
1649
  }
1677
- function DropdownMenuSubContent({ children }) {
1678
- const sub = import_react20.default.useContext(SubmenuContext);
1650
+ function DropdownMenuSubContent({
1651
+ children,
1652
+ submenuProps
1653
+ }) {
1679
1654
  return /* @__PURE__ */ import_react20.default.createElement(
1680
1655
  "div",
1681
1656
  {
1682
1657
  className: cn(
1683
- "overflow-hidden bg-gray-50 transition-all",
1684
- sub.isSubOpen ? "max-h-[300px] opacity-100" : "max-h-0 opacity-0"
1658
+ "overflow-hidden transition-all",
1659
+ (submenuProps == null ? void 0 : submenuProps.isSubOpen) ? "max-h-[300px] opacity-100" : "max-h-0 opacity-0"
1685
1660
  )
1686
1661
  },
1687
1662
  children
@@ -1713,7 +1688,8 @@ var DropdownWithIcon = (0, import_react21.forwardRef)(
1713
1688
  onApply,
1714
1689
  disabled = false,
1715
1690
  onReset,
1716
- footerAction
1691
+ footerAction,
1692
+ height = "200px"
1717
1693
  }, ref) => {
1718
1694
  const [searchQuery, setSearchQuery] = (0, import_react21.useState)("");
1719
1695
  const localDropdownRef = (0, import_react21.useRef)(null);
@@ -1833,7 +1809,7 @@ var DropdownWithIcon = (0, import_react21.forwardRef)(
1833
1809
  "aria-labelledby": `${id}-label`,
1834
1810
  tabIndex: -1,
1835
1811
  className: cn(
1836
- "max-h-0 opacity-0 overflow-hidden shadow-sm mt-1 rounded absolute text-[16px] bg-white z-[1000] w-full transition-all duration-75 delay-100 ease-in",
1812
+ "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",
1837
1813
  dropdownMenu ? "border border-primary-600" : "border border-gray-200",
1838
1814
  position === "top" ? "top-10" : position === "bottom" ? "bottom-10" : position === "left" ? "left-0" : position === "right" ? "right-[90%]" : "top-10",
1839
1815
  dropdownMenu && "max-h-[360px] h-fit opacity-[1] transition-all ease-in duration-150"
@@ -1863,7 +1839,7 @@ var DropdownWithIcon = (0, import_react21.forwardRef)(
1863
1839
  type: "button",
1864
1840
  "aria-label": "Select all",
1865
1841
  onClick: handleSelectAll,
1866
- className: "text-text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
1842
+ className: "text-sm hover:text-primary-700 text-primary-600 cursor-pointer"
1867
1843
  },
1868
1844
  "Select all"
1869
1845
  ), /* @__PURE__ */ import_react21.default.createElement(
@@ -1871,12 +1847,12 @@ var DropdownWithIcon = (0, import_react21.forwardRef)(
1871
1847
  {
1872
1848
  "aria-label": "Reset",
1873
1849
  type: "button",
1874
- className: "text-text-sm text-warning-500 hover:text-warning-600",
1850
+ className: "text-sm text-warning-500 hover:text-warning-600",
1875
1851
  onClick: handleReset
1876
1852
  },
1877
1853
  "Reset"
1878
1854
  )),
1879
- /* @__PURE__ */ import_react21.default.createElement("section", { className: "max-h-[200px] z-[1000] transition-all duration-75 delay-100 ease-in-out overflow-y-scroll" }, options ? memoizedFilteredOptions == null ? void 0 : memoizedFilteredOptions.map((option, i) => {
1855
+ /* @__PURE__ */ import_react21.default.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) => {
1880
1856
  var _a;
1881
1857
  return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, { key: i }, multiple ? /* @__PURE__ */ import_react21.default.createElement(
1882
1858
  Label_default,
@@ -1911,7 +1887,7 @@ var DropdownWithIcon = (0, import_react21.forwardRef)(
1911
1887
  },
1912
1888
  renderItem(option)
1913
1889
  ))), /* @__PURE__ */ import_react21.default.createElement("span", { className: "text-gray-500" }, option == null ? void 0 : option.info)),
1914
- /* @__PURE__ */ import_react21.default.createElement("span", { className: "pt-[2px] text-text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
1890
+ /* @__PURE__ */ import_react21.default.createElement("span", { className: "pt-[2px] text-sm text-gray-500" }, option == null ? void 0 : option.addInfo)
1915
1891
  ) : /* @__PURE__ */ import_react21.default.createElement(
1916
1892
  Label_default,
1917
1893
  {
@@ -1961,7 +1937,7 @@ var DropdownFooter2 = ({
1961
1937
  onApply,
1962
1938
  setDropdownMenu
1963
1939
  }) => {
1964
- return /* @__PURE__ */ import_react21.default.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-text-sm" }, /* @__PURE__ */ import_react21.default.createElement(
1940
+ return /* @__PURE__ */ import_react21.default.createElement("div", { className: "flex justify-end border-t border-gray-200 px-[14px] py-[8px] text-sm" }, /* @__PURE__ */ import_react21.default.createElement(
1965
1941
  "button",
1966
1942
  {
1967
1943
  type: "button",
@@ -2446,7 +2422,7 @@ var noticeVariants = (0, import_class_variance_authority6.cva)("p-4 w-fit rounde
2446
2422
  position: {
2447
2423
  top: "top-4 transition-all duration-700 m-auto left-0 right-0",
2448
2424
  bottom: "bottom-4 transition-all duration-700 right-4",
2449
- center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 test"
2425
+ center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
2450
2426
  }
2451
2427
  }
2452
2428
  });
@@ -2774,7 +2750,7 @@ var Radio = (0, import_react41.forwardRef)(
2774
2750
  Radio.displayName = "Radio";
2775
2751
  var Radio_default = Radio;
2776
2752
 
2777
- // app/components/RazorPayFileUpload.tsx
2753
+ // app/components/FileUploadControl.tsx
2778
2754
  var import_react43 = __toESM(require("react"), 1);
2779
2755
  var import_react44 = require("@remixicon/react");
2780
2756
 
@@ -2827,7 +2803,7 @@ var Spinner = ({ size = "md", color = "primary" }) => {
2827
2803
  };
2828
2804
  var Spinner_default = Spinner;
2829
2805
 
2830
- // app/components/RazorPayFileUpload.tsx
2806
+ // app/components/FileUploadControl.tsx
2831
2807
  var fileSvg = () => {
2832
2808
  return /* @__PURE__ */ import_react43.default.createElement(
2833
2809
  "svg",
@@ -2932,7 +2908,7 @@ var defaultGetFileIcon = (fileName, fileType) => {
2932
2908
  }
2933
2909
  return /* @__PURE__ */ import_react43.default.createElement(import_react44.RiFileLine, { className: "w-5 h-5 text-white" });
2934
2910
  };
2935
- function ImageUploadControlled({
2911
+ function FileUploadControl({
2936
2912
  items,
2937
2913
  onAddFiles,
2938
2914
  onUpdateItem,
@@ -4499,10 +4475,10 @@ var Typography_default = Typography;
4499
4475
  DropdownWithIcon,
4500
4476
  FileSelector,
4501
4477
  FileUpload,
4478
+ FileUploadControl,
4502
4479
  FileUploadPreview,
4503
4480
  GlobalNavigation,
4504
4481
  HelperText,
4505
- ImageUploadControlled,
4506
4482
  Input,
4507
4483
  Label,
4508
4484
  ListPagination,