@verma-consulting/design-library 0.1.41 → 0.1.43

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 CHANGED
@@ -1285,6 +1285,39 @@ var useStyles2 = (0, import_styles14.makeStyles)((theme) => ({
1285
1285
  whiteSpace: "pre-wrap"
1286
1286
  }
1287
1287
  }));
1288
+ function createSearchableSelectPopperOptions() {
1289
+ return {
1290
+ modifiers: [
1291
+ {
1292
+ name: "searchableSelectViewportMaxHeight",
1293
+ enabled: true,
1294
+ phase: "beforeWrite",
1295
+ requires: ["computeStyles"],
1296
+ fn({ state }) {
1297
+ if (typeof window === "undefined") return;
1298
+ const padding = 12;
1299
+ const vh = window.innerHeight;
1300
+ const ref = state.rects.reference;
1301
+ const refBottom = ref.y + ref.height;
1302
+ const spaceBelow = vh - refBottom - padding;
1303
+ const spaceAbove = ref.y - padding;
1304
+ const placement = state.placement || "bottom-start";
1305
+ const isTop = placement.startsWith("top");
1306
+ const available = Math.max(0, isTop ? spaceAbove : spaceBelow);
1307
+ const maxH = Math.min(available, vh * 0.7);
1308
+ state.styles.popper = state.styles.popper || {};
1309
+ Object.assign(state.styles.popper, {
1310
+ display: "flex",
1311
+ flexDirection: "column",
1312
+ minHeight: 0,
1313
+ maxHeight: `${maxH}px`,
1314
+ overflow: "hidden"
1315
+ });
1316
+ }
1317
+ }
1318
+ ]
1319
+ };
1320
+ }
1288
1321
  var SearchableSelect = import_react6.default.memo(
1289
1322
  ({
1290
1323
  name,
@@ -1354,6 +1387,10 @@ var SearchableSelect = import_react6.default.memo(
1354
1387
  }, [selected, multiple]);
1355
1388
  const isValueEmpty = !value.trim();
1356
1389
  const showClear = onClear != null;
1390
+ const searchableSelectPopperOptions = (0, import_react6.useMemo)(
1391
+ () => createSearchableSelectPopperOptions(),
1392
+ []
1393
+ );
1357
1394
  return editMode ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.FormControl, { fullWidth: true, style, disabled, size, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1358
1395
  import_material13.Autocomplete,
1359
1396
  {
@@ -1411,12 +1448,36 @@ var SearchableSelect = import_react6.default.memo(
1411
1448
  }
1412
1449
  },
1413
1450
  slotProps: {
1451
+ popper: {
1452
+ // Align with field width; only flip vertically (never left/right like placement "auto").
1453
+ placement: "bottom-start",
1454
+ modifiers: [
1455
+ {
1456
+ name: "flip",
1457
+ options: {
1458
+ fallbackPlacements: [
1459
+ "top-start",
1460
+ "top",
1461
+ "bottom-start",
1462
+ "bottom"
1463
+ ]
1464
+ }
1465
+ }
1466
+ ],
1467
+ popperOptions: searchableSelectPopperOptions
1468
+ },
1414
1469
  paper: {
1415
1470
  sx: {
1416
1471
  background: glassBackground,
1417
1472
  backdropFilter: "blur(12px) saturate(150%)",
1418
1473
  border: `1px solid ${(0, import_styles13.alpha)("#FFFFFF", theme.palette.mode === "dark" ? 0.16 : 0.55)}`,
1419
1474
  boxShadow: theme.palette.mode === "dark" ? "rgba(0, 0, 0, 0.34) 0px 10px 26px" : "rgba(15, 23, 42, 0.16) 0px 8px 24px",
1475
+ flex: 1,
1476
+ minHeight: 0,
1477
+ maxHeight: "100%",
1478
+ overflow: "hidden",
1479
+ display: "flex",
1480
+ flexDirection: "column",
1420
1481
  "& .MuiAutocomplete-option": {
1421
1482
  "&[aria-selected='true']": {
1422
1483
  backgroundColor: (0, import_styles13.alpha)(
@@ -1434,6 +1495,18 @@ var SearchableSelect = import_react6.default.memo(
1434
1495
  }
1435
1496
  }
1436
1497
  },
1498
+ ListboxProps: {
1499
+ sx: {
1500
+ // Override MUI default maxHeight: 40vh so the panel height comes from the Popper modifier only.
1501
+ maxHeight: "none",
1502
+ flex: "1 1 auto",
1503
+ minHeight: 0,
1504
+ overflowY: "auto",
1505
+ WebkitOverflowScrolling: "touch",
1506
+ overscrollBehavior: "contain",
1507
+ touchAction: "pan-y"
1508
+ }
1509
+ },
1437
1510
  renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1438
1511
  import_material13.TextField,
1439
1512
  {