@verma-consulting/design-library 0.1.42 → 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 +58 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
{
|
|
@@ -1412,8 +1449,22 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1412
1449
|
},
|
|
1413
1450
|
slotProps: {
|
|
1414
1451
|
popper: {
|
|
1415
|
-
//
|
|
1416
|
-
placement: "
|
|
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
|
|
1417
1468
|
},
|
|
1418
1469
|
paper: {
|
|
1419
1470
|
sx: {
|
|
@@ -1421,10 +1472,12 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1421
1472
|
backdropFilter: "blur(12px) saturate(150%)",
|
|
1422
1473
|
border: `1px solid ${(0, import_styles13.alpha)("#FFFFFF", theme.palette.mode === "dark" ? 0.16 : 0.55)}`,
|
|
1423
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%",
|
|
1424
1478
|
overflow: "hidden",
|
|
1425
1479
|
display: "flex",
|
|
1426
1480
|
flexDirection: "column",
|
|
1427
|
-
maxHeight: "min(55vh, calc(100dvh - 96px))",
|
|
1428
1481
|
"& .MuiAutocomplete-option": {
|
|
1429
1482
|
"&[aria-selected='true']": {
|
|
1430
1483
|
backgroundColor: (0, import_styles13.alpha)(
|
|
@@ -1444,9 +1497,10 @@ var SearchableSelect = import_react6.default.memo(
|
|
|
1444
1497
|
},
|
|
1445
1498
|
ListboxProps: {
|
|
1446
1499
|
sx: {
|
|
1500
|
+
// Override MUI default maxHeight: 40vh so the panel height comes from the Popper modifier only.
|
|
1501
|
+
maxHeight: "none",
|
|
1447
1502
|
flex: "1 1 auto",
|
|
1448
1503
|
minHeight: 0,
|
|
1449
|
-
maxHeight: "min(50vh, calc(100dvh - 120px))",
|
|
1450
1504
|
overflowY: "auto",
|
|
1451
1505
|
WebkitOverflowScrolling: "touch",
|
|
1452
1506
|
overscrollBehavior: "contain",
|