@open-ui-kit/core 2.1.0 → 2.2.1

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/index.esm.js CHANGED
@@ -10,7 +10,7 @@ import DoneIcon from '@mui/icons-material/Done';
10
10
  import CloseIcon from '@mui/icons-material/Close';
11
11
  import { Timeline as Timeline$1, TimelineItem, TimelineSeparator, TimelineConnector, TimelineContent } from '@mui/lab';
12
12
  import * as React from 'react';
13
- import React__default, { useCallback, Children, isValidElement, useState, useEffect, useMemo, useRef, createElement, Fragment as Fragment$1 } from 'react';
13
+ import React__default, { useCallback, forwardRef, Children, isValidElement, useState, useEffect, useMemo, useRef, createElement, useLayoutEffect, Fragment as Fragment$1 } from 'react';
14
14
  import StarIcon from '@mui/icons-material/Star';
15
15
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
16
16
  import WarningIcon from '@mui/icons-material/Warning';
@@ -6291,6 +6291,13 @@ const StyledButton$1 = styled(Button$1)(({ theme }) => ({
6291
6291
  textTransform: "none",
6292
6292
  transition: "none",
6293
6293
  borderRadius: "4px",
6294
+ width: "max-content",
6295
+ maxWidth: "100%",
6296
+ whiteSpace: "normal",
6297
+ overflowWrap: "break-word",
6298
+ textAlign: "center",
6299
+ alignItems: "center",
6300
+ height: "auto",
6294
6301
  "& .MuiButton-startIcon": {
6295
6302
  marginLeft: "0px",
6296
6303
  },
@@ -6302,16 +6309,22 @@ const StyledButton$1 = styled(Button$1)(({ theme }) => ({
6302
6309
  padding: "8px",
6303
6310
  minWidth: "40px",
6304
6311
  width: "40px",
6312
+ height: "40px",
6313
+ minHeight: "40px",
6305
6314
  },
6306
6315
  "&.MuiButton-sizeMedium": {
6307
6316
  padding: "6px",
6308
6317
  minWidth: "32px",
6309
6318
  width: "32px",
6319
+ height: "32px",
6320
+ minHeight: "32px",
6310
6321
  },
6311
6322
  "&.MuiButton-sizeSmall": {
6312
6323
  padding: "2px",
6313
6324
  minWidth: "24px",
6314
6325
  width: "24px",
6326
+ height: "24px",
6327
+ minHeight: "24px",
6315
6328
  },
6316
6329
  },
6317
6330
  "&.MuiButton-sizeLarge": {
@@ -6319,7 +6332,8 @@ const StyledButton$1 = styled(Button$1)(({ theme }) => ({
6319
6332
  fontWeight: 600,
6320
6333
  fontSize: "16px",
6321
6334
  lineHeight: "125%",
6322
- height: "40px",
6335
+ minHeight: "40px",
6336
+ height: "auto",
6323
6337
  padding: "10px 16px",
6324
6338
  },
6325
6339
  "&.OuiButton-hasIcon.MuiButton-sizeLarge": {
@@ -6330,7 +6344,8 @@ const StyledButton$1 = styled(Button$1)(({ theme }) => ({
6330
6344
  fontWeight: 600,
6331
6345
  fontSize: "14px",
6332
6346
  lineHeight: "125%",
6333
- height: "32px",
6347
+ minHeight: "32px",
6348
+ height: "auto",
6334
6349
  padding: "7px 16px",
6335
6350
  },
6336
6351
  "&.MuiButton-sizeSmall": {
@@ -6338,7 +6353,8 @@ const StyledButton$1 = styled(Button$1)(({ theme }) => ({
6338
6353
  fontWeight: 600,
6339
6354
  fontSize: "14px",
6340
6355
  lineHeight: "125%",
6341
- height: "24px",
6356
+ minHeight: "24px",
6357
+ height: "auto",
6342
6358
  padding: "3px 12px",
6343
6359
  },
6344
6360
  "&.MuiButton-sizeLarge svg": {
@@ -6557,7 +6573,7 @@ const isIconOnlyChild = (children) => {
6557
6573
  }
6558
6574
  return child.props.children == null;
6559
6575
  };
6560
- const Button = (_a) => {
6576
+ const Button = forwardRef((_a, ref) => {
6561
6577
  var { children, className, disableRipple = true, endIcon, startIcon } = _a, props = __rest(_a, ["children", "className", "disableRipple", "endIcon", "startIcon"]);
6562
6578
  const hasIcon = Boolean(startIcon || endIcon);
6563
6579
  const isIconOnly = !hasIcon && isIconOnlyChild(children);
@@ -6568,8 +6584,9 @@ const Button = (_a) => {
6568
6584
  ]
6569
6585
  .filter(Boolean)
6570
6586
  .join(" ");
6571
- return (jsx(StyledButton$1, Object.assign({ className: buttonClassName || undefined, disableRipple: disableRipple, endIcon: endIcon, startIcon: startIcon }, props, { children: children })));
6572
- };
6587
+ return (jsx(StyledButton$1, Object.assign({ ref: ref, className: buttonClassName || undefined, disableRipple: disableRipple, endIcon: endIcon, startIcon: startIcon }, props, { children: children })));
6588
+ });
6589
+ Button.displayName = "Button";
6573
6590
 
6574
6591
  const getSpinnerWrapperStyles = (size) => ({
6575
6592
  position: "relative",
@@ -7588,18 +7605,48 @@ const SelectNodeListItem = ({ isLeaf, isSelectable = true, listItemProps = {}, o
7588
7605
  }, children: [selectNodeElement, selectableLeavesCount && (jsx(Typography, { variant: "body2", sx: { cursor: "pointer", color: theme.palette.vars.baseTextWeak }, children: selectableLeavesCount }))] })));
7589
7606
  };
7590
7607
 
7608
+ const TOOLTIP_ARROW_WIDTH = 10;
7609
+ const TOOLTIP_ARROW_HEIGHT = 6;
7591
7610
  const baseTooltipStyles = (theme) => (Object.assign(Object.assign({}, theme.typography.captionMedium), { backgroundColor: theme.palette.vars.inactiveBackgroundActive, borderRadius: "4px", boxSizing: "border-box", color: theme.palette.vars.baseTextInverse, maxWidth: "none" }));
7592
7611
  const tooltipArrowStyles = (theme) => ({
7593
7612
  color: theme.palette.vars.inactiveBackgroundActive,
7594
- height: "6px",
7595
- width: "10px",
7613
+ height: `${TOOLTIP_ARROW_HEIGHT}px`,
7614
+ width: `${TOOLTIP_ARROW_WIDTH}px`,
7596
7615
  "&::before": {
7597
7616
  backgroundColor: "currentColor",
7598
- borderRadius: "1px",
7599
- height: "6px",
7600
- width: "10px",
7617
+ display: "block",
7618
+ height: "100%",
7619
+ width: "100%",
7601
7620
  },
7602
7621
  });
7622
+ const tooltipPopperSx = {
7623
+ [`&[data-popper-placement*="bottom"] .MuiTooltip-arrow`]: {
7624
+ marginTop: `-${TOOLTIP_ARROW_HEIGHT}px`,
7625
+ },
7626
+ [`&[data-popper-placement*="top"] .MuiTooltip-arrow`]: {
7627
+ marginBottom: `-${TOOLTIP_ARROW_HEIGHT}px`,
7628
+ },
7629
+ [`&[data-popper-placement*="left"] .MuiTooltip-arrow, &[data-popper-placement*="right"] .MuiTooltip-arrow`]: {
7630
+ height: `${TOOLTIP_ARROW_WIDTH}px`,
7631
+ width: `${TOOLTIP_ARROW_HEIGHT}px`,
7632
+ },
7633
+ [`&[data-popper-placement*="right"] .MuiTooltip-arrow`]: {
7634
+ marginLeft: `-${TOOLTIP_ARROW_HEIGHT}px`,
7635
+ marginRight: 0,
7636
+ },
7637
+ [`&[data-popper-placement*="left"] .MuiTooltip-arrow`]: {
7638
+ marginRight: `-${TOOLTIP_ARROW_HEIGHT}px`,
7639
+ marginLeft: 0,
7640
+ },
7641
+ '[dir="rtl"] &[data-popper-placement*="right"] .MuiTooltip-arrow': {
7642
+ marginLeft: 0,
7643
+ marginRight: `-${TOOLTIP_ARROW_HEIGHT}px`,
7644
+ },
7645
+ '[dir="rtl"] &[data-popper-placement*="left"] .MuiTooltip-arrow': {
7646
+ marginRight: 0,
7647
+ marginLeft: `-${TOOLTIP_ARROW_HEIGHT}px`,
7648
+ },
7649
+ };
7603
7650
  const largeTooltipStyles = {
7604
7651
  height: "32px",
7605
7652
  padding: "8px 12px",
@@ -7624,12 +7671,7 @@ const tooltipPopper = {
7624
7671
  },
7625
7672
  },
7626
7673
  ],
7627
- sx: {
7628
- '&[data-popper-placement*="left"] .MuiTooltip-arrow, &[data-popper-placement*="right"] .MuiTooltip-arrow': {
7629
- height: "10px",
7630
- width: "6px",
7631
- },
7632
- },
7674
+ sx: tooltipPopperSx,
7633
7675
  };
7634
7676
  const tooltipSlotProps = {
7635
7677
  [TooltipSize.Medium]: {
@@ -13095,44 +13137,604 @@ const PickerItem = (_a) => {
13095
13137
  ], children: [jsx(Box, { className: "picker-icon", "aria-hidden": true, children: icon }), jsx(Box, { component: "span", className: "picker-label", children: label })] })));
13096
13138
  };
13097
13139
 
13140
+ var PopoverPlacementSide;
13141
+ (function (PopoverPlacementSide) {
13142
+ PopoverPlacementSide["Top"] = "top";
13143
+ PopoverPlacementSide["Bottom"] = "bottom";
13144
+ PopoverPlacementSide["Left"] = "left";
13145
+ PopoverPlacementSide["Right"] = "right";
13146
+ })(PopoverPlacementSide || (PopoverPlacementSide = {}));
13147
+ var PopoverPlacementAlign;
13148
+ (function (PopoverPlacementAlign) {
13149
+ PopoverPlacementAlign["Start"] = "start";
13150
+ PopoverPlacementAlign["End"] = "end";
13151
+ PopoverPlacementAlign["Center"] = "center";
13152
+ })(PopoverPlacementAlign || (PopoverPlacementAlign = {}));
13153
+ var PopoverPlacement;
13154
+ (function (PopoverPlacement) {
13155
+ PopoverPlacement["Top"] = "top";
13156
+ PopoverPlacement["TopStart"] = "top-start";
13157
+ PopoverPlacement["TopEnd"] = "top-end";
13158
+ PopoverPlacement["Bottom"] = "bottom";
13159
+ PopoverPlacement["BottomStart"] = "bottom-start";
13160
+ PopoverPlacement["BottomEnd"] = "bottom-end";
13161
+ PopoverPlacement["Left"] = "left";
13162
+ PopoverPlacement["LeftStart"] = "left-start";
13163
+ PopoverPlacement["LeftEnd"] = "left-end";
13164
+ PopoverPlacement["Right"] = "right";
13165
+ PopoverPlacement["RightStart"] = "right-start";
13166
+ PopoverPlacement["RightEnd"] = "right-end";
13167
+ })(PopoverPlacement || (PopoverPlacement = {}));
13168
+ const POPOVER_PLACEMENTS = [
13169
+ PopoverPlacement.BottomStart,
13170
+ PopoverPlacement.Bottom,
13171
+ PopoverPlacement.BottomEnd,
13172
+ PopoverPlacement.TopStart,
13173
+ PopoverPlacement.Top,
13174
+ PopoverPlacement.TopEnd,
13175
+ PopoverPlacement.LeftStart,
13176
+ PopoverPlacement.Left,
13177
+ PopoverPlacement.LeftEnd,
13178
+ PopoverPlacement.RightStart,
13179
+ PopoverPlacement.Right,
13180
+ PopoverPlacement.RightEnd,
13181
+ ];
13182
+ var PopoverVerticalPlacement;
13183
+ (function (PopoverVerticalPlacement) {
13184
+ PopoverVerticalPlacement["Above"] = "above";
13185
+ PopoverVerticalPlacement["Below"] = "below";
13186
+ })(PopoverVerticalPlacement || (PopoverVerticalPlacement = {}));
13187
+ var PopoverHorizontalPlacement;
13188
+ (function (PopoverHorizontalPlacement) {
13189
+ PopoverHorizontalPlacement["Left"] = "left";
13190
+ PopoverHorizontalPlacement["Center"] = "center";
13191
+ PopoverHorizontalPlacement["Right"] = "right";
13192
+ })(PopoverHorizontalPlacement || (PopoverHorizontalPlacement = {}));
13193
+ var PopoverSidePlacement;
13194
+ (function (PopoverSidePlacement) {
13195
+ PopoverSidePlacement["Left"] = "left";
13196
+ PopoverSidePlacement["Right"] = "right";
13197
+ })(PopoverSidePlacement || (PopoverSidePlacement = {}));
13198
+ var PopoverEdgeAlignment;
13199
+ (function (PopoverEdgeAlignment) {
13200
+ PopoverEdgeAlignment["Top"] = "top";
13201
+ PopoverEdgeAlignment["Center"] = "center";
13202
+ PopoverEdgeAlignment["Bottom"] = "bottom";
13203
+ })(PopoverEdgeAlignment || (PopoverEdgeAlignment = {}));
13204
+ var PopoverArrowAxisAlign;
13205
+ (function (PopoverArrowAxisAlign) {
13206
+ PopoverArrowAxisAlign["Left"] = "left";
13207
+ PopoverArrowAxisAlign["Right"] = "right";
13208
+ PopoverArrowAxisAlign["Top"] = "top";
13209
+ PopoverArrowAxisAlign["Bottom"] = "bottom";
13210
+ PopoverArrowAxisAlign["Center"] = "center";
13211
+ })(PopoverArrowAxisAlign || (PopoverArrowAxisAlign = {}));
13212
+
13213
+ const VIEWPORT_MARGIN = 16;
13214
+ const POPOVER_ARROW_HEIGHT = 8;
13215
+ const POPOVER_ARROW_WIDTH = POPOVER_ARROW_HEIGHT;
13216
+ const CENTER_PLACEMENTS = new Set([
13217
+ PopoverPlacement.Top,
13218
+ PopoverPlacement.Bottom,
13219
+ PopoverPlacement.Left,
13220
+ PopoverPlacement.Right,
13221
+ ]);
13222
+ const OPPOSITE_PLACEMENT_SIDE = {
13223
+ [PopoverPlacementSide.Top]: PopoverPlacementSide.Bottom,
13224
+ [PopoverPlacementSide.Bottom]: PopoverPlacementSide.Top,
13225
+ [PopoverPlacementSide.Left]: PopoverPlacementSide.Right,
13226
+ [PopoverPlacementSide.Right]: PopoverPlacementSide.Left,
13227
+ };
13228
+ const VERTICAL_CENTER_PLACEMENT = {
13229
+ [PopoverPlacementSide.Top]: PopoverPlacement.Top,
13230
+ [PopoverPlacementSide.Bottom]: PopoverPlacement.Bottom,
13231
+ };
13232
+ const SIDE_CENTER_PLACEMENT = {
13233
+ [PopoverSidePlacement.Left]: PopoverPlacement.Left,
13234
+ [PopoverSidePlacement.Right]: PopoverPlacement.Right,
13235
+ };
13236
+
13237
+ const getOppositePlacementSide = (side) => OPPOSITE_PLACEMENT_SIDE[side];
13238
+ const getPlacementSide = (placement) => placement.split("-")[0];
13239
+ const getPlacementAlign = (placement) => {
13240
+ if (CENTER_PLACEMENTS.has(placement)) {
13241
+ return PopoverPlacementAlign.Center;
13242
+ }
13243
+ if (placement.endsWith(`-${PopoverPlacementAlign.Start}`)) {
13244
+ return PopoverPlacementAlign.Start;
13245
+ }
13246
+ return PopoverPlacementAlign.End;
13247
+ };
13248
+ const getArrowAxisAlign = (placement) => {
13249
+ const side = getPlacementSide(placement);
13250
+ const align = getPlacementAlign(placement);
13251
+ if (side === PopoverPlacementSide.Top ||
13252
+ side === PopoverPlacementSide.Bottom) {
13253
+ if (align === PopoverPlacementAlign.Start) {
13254
+ return PopoverArrowAxisAlign.Left;
13255
+ }
13256
+ if (align === PopoverPlacementAlign.End) {
13257
+ return PopoverArrowAxisAlign.Right;
13258
+ }
13259
+ return PopoverArrowAxisAlign.Center;
13260
+ }
13261
+ if (align === PopoverPlacementAlign.Start) {
13262
+ return PopoverArrowAxisAlign.Top;
13263
+ }
13264
+ if (align === PopoverPlacementAlign.End) {
13265
+ return PopoverArrowAxisAlign.Bottom;
13266
+ }
13267
+ return PopoverArrowAxisAlign.Center;
13268
+ };
13269
+
13270
+ const toHorizontalOrigin = (align) => {
13271
+ if (align === PopoverPlacementAlign.Start) {
13272
+ return PopoverHorizontalPlacement.Left;
13273
+ }
13274
+ if (align === PopoverPlacementAlign.End) {
13275
+ return PopoverHorizontalPlacement.Right;
13276
+ }
13277
+ return PopoverHorizontalPlacement.Center;
13278
+ };
13279
+ const toVerticalOrigin = (align) => {
13280
+ if (align === PopoverPlacementAlign.Start) {
13281
+ return PopoverEdgeAlignment.Top;
13282
+ }
13283
+ if (align === PopoverPlacementAlign.End) {
13284
+ return PopoverEdgeAlignment.Bottom;
13285
+ }
13286
+ return PopoverEdgeAlignment.Center;
13287
+ };
13288
+ const getOriginsForPlacement = (placement) => {
13289
+ const side = getPlacementSide(placement);
13290
+ const align = getPlacementAlign(placement);
13291
+ if (side === PopoverPlacementSide.Top) {
13292
+ const horizontal = toHorizontalOrigin(align);
13293
+ return {
13294
+ anchorOrigin: {
13295
+ vertical: PopoverPlacementSide.Top,
13296
+ horizontal,
13297
+ },
13298
+ transformOrigin: {
13299
+ vertical: PopoverPlacementSide.Bottom,
13300
+ horizontal,
13301
+ },
13302
+ };
13303
+ }
13304
+ if (side === PopoverPlacementSide.Bottom) {
13305
+ const horizontal = toHorizontalOrigin(align);
13306
+ return {
13307
+ anchorOrigin: {
13308
+ vertical: PopoverPlacementSide.Bottom,
13309
+ horizontal,
13310
+ },
13311
+ transformOrigin: {
13312
+ vertical: PopoverPlacementSide.Top,
13313
+ horizontal,
13314
+ },
13315
+ };
13316
+ }
13317
+ if (side === PopoverPlacementSide.Left) {
13318
+ const vertical = toVerticalOrigin(align);
13319
+ return {
13320
+ anchorOrigin: {
13321
+ vertical,
13322
+ horizontal: PopoverPlacementSide.Left,
13323
+ },
13324
+ transformOrigin: {
13325
+ vertical,
13326
+ horizontal: PopoverPlacementSide.Right,
13327
+ },
13328
+ };
13329
+ }
13330
+ const vertical = toVerticalOrigin(align);
13331
+ return {
13332
+ anchorOrigin: {
13333
+ vertical,
13334
+ horizontal: PopoverPlacementSide.Right,
13335
+ },
13336
+ transformOrigin: {
13337
+ vertical,
13338
+ horizontal: PopoverPlacementSide.Left,
13339
+ },
13340
+ };
13341
+ };
13342
+ const getOriginsForVerticalPlacement = (placement, horizontal = PopoverHorizontalPlacement.Center) => {
13343
+ if (placement === PopoverVerticalPlacement.Above) {
13344
+ return {
13345
+ anchorOrigin: {
13346
+ vertical: PopoverPlacementSide.Top,
13347
+ horizontal,
13348
+ },
13349
+ transformOrigin: {
13350
+ vertical: PopoverPlacementSide.Bottom,
13351
+ horizontal,
13352
+ },
13353
+ };
13354
+ }
13355
+ return {
13356
+ anchorOrigin: {
13357
+ vertical: PopoverPlacementSide.Bottom,
13358
+ horizontal,
13359
+ },
13360
+ transformOrigin: {
13361
+ vertical: PopoverPlacementSide.Top,
13362
+ horizontal,
13363
+ },
13364
+ };
13365
+ };
13366
+ const getVerticalPreference = (anchorOrigin, transformOrigin) => {
13367
+ if (transformOrigin.vertical === PopoverPlacementSide.Bottom &&
13368
+ anchorOrigin.vertical === PopoverPlacementSide.Top) {
13369
+ return PopoverVerticalPlacement.Above;
13370
+ }
13371
+ if (transformOrigin.vertical === PopoverPlacementSide.Top &&
13372
+ anchorOrigin.vertical === PopoverPlacementSide.Bottom) {
13373
+ return PopoverVerticalPlacement.Below;
13374
+ }
13375
+ return PopoverVerticalPlacement.Above;
13376
+ };
13377
+ const getHorizontalPreference = (anchorOrigin, transformOrigin) => {
13378
+ var _a, _b;
13379
+ const anchor = (_a = anchorOrigin.horizontal) !== null && _a !== void 0 ? _a : PopoverHorizontalPlacement.Center;
13380
+ const transform = (_b = transformOrigin.horizontal) !== null && _b !== void 0 ? _b : PopoverHorizontalPlacement.Center;
13381
+ if (anchor === PopoverHorizontalPlacement.Left &&
13382
+ transform === PopoverHorizontalPlacement.Left) {
13383
+ return PopoverHorizontalPlacement.Left;
13384
+ }
13385
+ if (anchor === PopoverHorizontalPlacement.Right &&
13386
+ transform === PopoverHorizontalPlacement.Right) {
13387
+ return PopoverHorizontalPlacement.Right;
13388
+ }
13389
+ return PopoverHorizontalPlacement.Center;
13390
+ };
13391
+ const getSidePreference = (placement) => getPlacementSide(placement) === PopoverPlacementSide.Right
13392
+ ? PopoverSidePlacement.Right
13393
+ : PopoverSidePlacement.Left;
13394
+ const getEdgeAlignmentPreference = (placement) => {
13395
+ const align = getPlacementAlign(placement);
13396
+ if (align === PopoverPlacementAlign.Start) {
13397
+ return PopoverEdgeAlignment.Top;
13398
+ }
13399
+ if (align === PopoverPlacementAlign.End) {
13400
+ return PopoverEdgeAlignment.Bottom;
13401
+ }
13402
+ return PopoverEdgeAlignment.Center;
13403
+ };
13404
+
13405
+ const getPopoverHorizontalBounds = ({ anchorLeft, anchorRight, anchorWidth, popoverWidth, horizontal, }) => {
13406
+ switch (horizontal) {
13407
+ case PopoverHorizontalPlacement.Left:
13408
+ return { left: anchorLeft, right: anchorLeft + popoverWidth };
13409
+ case PopoverHorizontalPlacement.Right:
13410
+ return { left: anchorRight - popoverWidth, right: anchorRight };
13411
+ default: {
13412
+ const center = anchorLeft + anchorWidth / 2;
13413
+ return {
13414
+ left: center - popoverWidth / 2,
13415
+ right: center + popoverWidth / 2,
13416
+ };
13417
+ }
13418
+ }
13419
+ };
13420
+ const getPopoverVerticalBounds = ({ anchorTop, anchorBottom, anchorHeight, popoverHeight, vertical, }) => {
13421
+ switch (vertical) {
13422
+ case PopoverEdgeAlignment.Top:
13423
+ return { top: anchorTop, bottom: anchorTop + popoverHeight };
13424
+ case PopoverEdgeAlignment.Bottom:
13425
+ return { top: anchorBottom - popoverHeight, bottom: anchorBottom };
13426
+ default: {
13427
+ const center = anchorTop + anchorHeight / 2;
13428
+ return {
13429
+ top: center - popoverHeight / 2,
13430
+ bottom: center + popoverHeight / 2,
13431
+ };
13432
+ }
13433
+ }
13434
+ };
13435
+
13436
+ const resolveVerticalPlacement = ({ preferAbove, spaceAbove, spaceBelow, popoverHeight, hasArrow, margin = VIEWPORT_MARGIN, }) => {
13437
+ const clearance = hasArrow ? POPOVER_ARROW_HEIGHT : 0;
13438
+ const required = popoverHeight + clearance;
13439
+ const aboveRoom = spaceAbove - margin;
13440
+ const belowRoom = spaceBelow - margin;
13441
+ const fitsAbove = aboveRoom >= required;
13442
+ const fitsBelow = belowRoom >= required;
13443
+ if (preferAbove && fitsAbove)
13444
+ return PopoverVerticalPlacement.Above;
13445
+ if (!preferAbove && fitsBelow)
13446
+ return PopoverVerticalPlacement.Below;
13447
+ if (fitsAbove && !fitsBelow)
13448
+ return PopoverVerticalPlacement.Above;
13449
+ if (fitsBelow && !fitsAbove)
13450
+ return PopoverVerticalPlacement.Below;
13451
+ return aboveRoom >= belowRoom
13452
+ ? PopoverVerticalPlacement.Above
13453
+ : PopoverVerticalPlacement.Below;
13454
+ };
13455
+ const resolveHorizontalPlacement = ({ preferHorizontal, anchorLeft, anchorRight, anchorWidth, popoverWidth, margin = VIEWPORT_MARGIN, viewportWidth, }) => {
13456
+ const fits = (horizontal) => {
13457
+ const { left, right } = getPopoverHorizontalBounds({
13458
+ anchorLeft,
13459
+ anchorRight,
13460
+ anchorWidth,
13461
+ popoverWidth,
13462
+ horizontal,
13463
+ });
13464
+ return left >= margin && right <= viewportWidth - margin;
13465
+ };
13466
+ if (fits(preferHorizontal))
13467
+ return preferHorizontal;
13468
+ const alternatives = (() => {
13469
+ if (preferHorizontal === PopoverHorizontalPlacement.Center) {
13470
+ const { left } = getPopoverHorizontalBounds({
13471
+ anchorLeft,
13472
+ anchorRight,
13473
+ anchorWidth,
13474
+ popoverWidth,
13475
+ horizontal: PopoverHorizontalPlacement.Center,
13476
+ });
13477
+ return left < margin
13478
+ ? [PopoverHorizontalPlacement.Left, PopoverHorizontalPlacement.Right]
13479
+ : [PopoverHorizontalPlacement.Right, PopoverHorizontalPlacement.Left];
13480
+ }
13481
+ if (preferHorizontal === PopoverHorizontalPlacement.Left) {
13482
+ return [
13483
+ PopoverHorizontalPlacement.Right,
13484
+ PopoverHorizontalPlacement.Center,
13485
+ ];
13486
+ }
13487
+ return [PopoverHorizontalPlacement.Left, PopoverHorizontalPlacement.Center];
13488
+ })();
13489
+ for (const horizontal of alternatives) {
13490
+ if (fits(horizontal))
13491
+ return horizontal;
13492
+ }
13493
+ const overflow = (horizontal) => {
13494
+ const { left, right } = getPopoverHorizontalBounds({
13495
+ anchorLeft,
13496
+ anchorRight,
13497
+ anchorWidth,
13498
+ popoverWidth,
13499
+ horizontal,
13500
+ });
13501
+ const leftOverflow = Math.max(0, margin - left);
13502
+ const rightOverflow = Math.max(0, right - (viewportWidth - margin));
13503
+ return leftOverflow + rightOverflow;
13504
+ };
13505
+ const all = [
13506
+ PopoverHorizontalPlacement.Left,
13507
+ PopoverHorizontalPlacement.Center,
13508
+ PopoverHorizontalPlacement.Right,
13509
+ ];
13510
+ return all.reduce((best, current) => overflow(current) < overflow(best) ? current : best);
13511
+ };
13512
+ const resolveSidePlacement = ({ preferSide, spaceLeft, spaceRight, popoverWidth, hasArrow, margin = VIEWPORT_MARGIN, }) => {
13513
+ const clearance = POPOVER_ARROW_WIDTH ;
13514
+ const required = popoverWidth + clearance;
13515
+ const leftRoom = spaceLeft - margin;
13516
+ const rightRoom = spaceRight - margin;
13517
+ const fitsLeft = leftRoom >= required;
13518
+ const fitsRight = rightRoom >= required;
13519
+ if (preferSide === PopoverSidePlacement.Left && fitsLeft) {
13520
+ return PopoverSidePlacement.Left;
13521
+ }
13522
+ if (preferSide === PopoverSidePlacement.Right && fitsRight) {
13523
+ return PopoverSidePlacement.Right;
13524
+ }
13525
+ if (fitsLeft && !fitsRight)
13526
+ return PopoverSidePlacement.Left;
13527
+ if (fitsRight && !fitsLeft)
13528
+ return PopoverSidePlacement.Right;
13529
+ return leftRoom >= rightRoom
13530
+ ? PopoverSidePlacement.Left
13531
+ : PopoverSidePlacement.Right;
13532
+ };
13533
+ const resolveEdgeAlignment = ({ preferAlignment, anchorTop, anchorBottom, anchorHeight, popoverHeight, margin = VIEWPORT_MARGIN, viewportHeight, }) => {
13534
+ const fits = (vertical) => {
13535
+ const { top, bottom } = getPopoverVerticalBounds({
13536
+ anchorTop,
13537
+ anchorBottom,
13538
+ anchorHeight,
13539
+ popoverHeight,
13540
+ vertical,
13541
+ });
13542
+ return top >= margin && bottom <= viewportHeight - margin;
13543
+ };
13544
+ if (fits(preferAlignment))
13545
+ return preferAlignment;
13546
+ const alternatives = (() => {
13547
+ if (preferAlignment === PopoverEdgeAlignment.Center) {
13548
+ const { top } = getPopoverVerticalBounds({
13549
+ anchorTop,
13550
+ anchorBottom,
13551
+ anchorHeight,
13552
+ popoverHeight,
13553
+ vertical: PopoverEdgeAlignment.Center,
13554
+ });
13555
+ return top < margin
13556
+ ? [PopoverEdgeAlignment.Top, PopoverEdgeAlignment.Bottom]
13557
+ : [PopoverEdgeAlignment.Bottom, PopoverEdgeAlignment.Top];
13558
+ }
13559
+ if (preferAlignment === PopoverEdgeAlignment.Top) {
13560
+ return [PopoverEdgeAlignment.Bottom, PopoverEdgeAlignment.Center];
13561
+ }
13562
+ return [PopoverEdgeAlignment.Top, PopoverEdgeAlignment.Center];
13563
+ })();
13564
+ for (const vertical of alternatives) {
13565
+ if (fits(vertical))
13566
+ return vertical;
13567
+ }
13568
+ const overflow = (vertical) => {
13569
+ const { top, bottom } = getPopoverVerticalBounds({
13570
+ anchorTop,
13571
+ anchorBottom,
13572
+ anchorHeight,
13573
+ popoverHeight,
13574
+ vertical,
13575
+ });
13576
+ const topOverflow = Math.max(0, margin - top);
13577
+ const bottomOverflow = Math.max(0, bottom - (viewportHeight - margin));
13578
+ return topOverflow + bottomOverflow;
13579
+ };
13580
+ const all = [
13581
+ PopoverEdgeAlignment.Top,
13582
+ PopoverEdgeAlignment.Center,
13583
+ PopoverEdgeAlignment.Bottom,
13584
+ ];
13585
+ return all.reduce((best, current) => overflow(current) < overflow(best) ? current : best);
13586
+ };
13587
+
13588
+ const placementSideToSidePlacement = (side) => side === PopoverPlacementSide.Right
13589
+ ? PopoverSidePlacement.Right
13590
+ : PopoverSidePlacement.Left;
13591
+ const formatVerticalPlacement = (side, align) => {
13592
+ if (align === PopoverPlacementAlign.Center) {
13593
+ return VERTICAL_CENTER_PLACEMENT[side];
13594
+ }
13595
+ return `${side}-${align}`;
13596
+ };
13597
+ const formatSidePlacement = (side, align) => {
13598
+ if (align === PopoverPlacementAlign.Center) {
13599
+ return SIDE_CENTER_PLACEMENT[side];
13600
+ }
13601
+ return `${side}-${align}`;
13602
+ };
13603
+ const horizontalToPlacementAlign = (horizontal) => {
13604
+ if (horizontal === PopoverHorizontalPlacement.Left) {
13605
+ return PopoverPlacementAlign.Start;
13606
+ }
13607
+ if (horizontal === PopoverHorizontalPlacement.Right) {
13608
+ return PopoverPlacementAlign.End;
13609
+ }
13610
+ return PopoverPlacementAlign.Center;
13611
+ };
13612
+ const edgeToPlacementAlign = (edge) => {
13613
+ if (edge === PopoverEdgeAlignment.Top) {
13614
+ return PopoverPlacementAlign.Start;
13615
+ }
13616
+ if (edge === PopoverEdgeAlignment.Bottom) {
13617
+ return PopoverPlacementAlign.End;
13618
+ }
13619
+ return PopoverPlacementAlign.Center;
13620
+ };
13621
+ const placementForVerticalPlacement = (placement, verticalPlacement) => {
13622
+ const side = getPlacementSide(placement);
13623
+ if (side !== PopoverPlacementSide.Top &&
13624
+ side !== PopoverPlacementSide.Bottom) {
13625
+ return placement;
13626
+ }
13627
+ const align = getPlacementAlign(placement);
13628
+ return verticalPlacement === PopoverVerticalPlacement.Above
13629
+ ? formatVerticalPlacement(PopoverPlacementSide.Top, align)
13630
+ : formatVerticalPlacement(PopoverPlacementSide.Bottom, align);
13631
+ };
13632
+ const placementForHorizontalPlacement = (placement, horizontal) => {
13633
+ const side = getPlacementSide(placement);
13634
+ if (side !== PopoverPlacementSide.Top &&
13635
+ side !== PopoverPlacementSide.Bottom) {
13636
+ return placement;
13637
+ }
13638
+ return formatVerticalPlacement(side, horizontalToPlacementAlign(horizontal));
13639
+ };
13640
+ const placementForSidePlacement = (placement, side) => {
13641
+ const placementSide = getPlacementSide(placement);
13642
+ if (placementSide !== PopoverPlacementSide.Left &&
13643
+ placementSide !== PopoverPlacementSide.Right) {
13644
+ return placement;
13645
+ }
13646
+ return formatSidePlacement(side, getPlacementAlign(placement));
13647
+ };
13648
+ const placementForEdgeAlignment = (placement, align) => {
13649
+ const side = getPlacementSide(placement);
13650
+ if (side !== PopoverPlacementSide.Left &&
13651
+ side !== PopoverPlacementSide.Right) {
13652
+ return placement;
13653
+ }
13654
+ return formatSidePlacement(placementSideToSidePlacement(side), edgeToPlacementAlign(align));
13655
+ };
13656
+
13657
+ const getArrowEdgeSide = (placement) => getOppositePlacementSide(getPlacementSide(placement));
13098
13658
  const ARROW_SIZE = 16;
13099
13659
  const ARROW_HALF = ARROW_SIZE / 2;
13100
- const ARROW_HEIGHT = 8;
13660
+ const ARROW_HEIGHT = POPOVER_ARROW_HEIGHT;
13101
13661
  const ARROW_OFFSET = 12;
13102
13662
  const popoverWidthBySize = {
13103
13663
  medium: "228px",
13104
13664
  large: "360px",
13105
13665
  };
13106
- const getArrowPadding = (position) => {
13107
- if (!position)
13666
+ const popoverContentLayoutBySize = {
13667
+ medium: { padding: "12px 16px", gap: "16px" },
13668
+ large: { padding: "16px 20px", gap: "20px" },
13669
+ };
13670
+ const getPaperArrowOffset = (placement, anchorOrigin = {
13671
+ vertical: PopoverPlacementSide.Top,
13672
+ }, transformOrigin = {
13673
+ vertical: PopoverPlacementSide.Top,
13674
+ }) => {
13675
+ if (!placement)
13108
13676
  return {};
13109
- if (position.startsWith("top"))
13110
- return { paddingTop: `${ARROW_HEIGHT}px` };
13111
- return { paddingBottom: `${ARROW_HEIGHT}px` };
13677
+ const side = getPlacementSide(placement);
13678
+ if (side === PopoverPlacementSide.Top &&
13679
+ anchorOrigin.vertical === PopoverPlacementSide.Top &&
13680
+ transformOrigin.vertical === PopoverPlacementSide.Bottom) {
13681
+ return { marginTop: `-${ARROW_HEIGHT}px` };
13682
+ }
13683
+ if (side === PopoverPlacementSide.Bottom &&
13684
+ anchorOrigin.vertical === PopoverPlacementSide.Bottom &&
13685
+ transformOrigin.vertical === PopoverPlacementSide.Top) {
13686
+ return { marginTop: `${ARROW_HEIGHT}px` };
13687
+ }
13688
+ if (side === PopoverPlacementSide.Left &&
13689
+ anchorOrigin.horizontal === PopoverPlacementSide.Left &&
13690
+ transformOrigin.horizontal === PopoverPlacementSide.Right) {
13691
+ return { marginLeft: `-${ARROW_HEIGHT}px` };
13692
+ }
13693
+ if (side === PopoverPlacementSide.Right &&
13694
+ anchorOrigin.horizontal === PopoverPlacementSide.Right &&
13695
+ transformOrigin.horizontal === PopoverPlacementSide.Left) {
13696
+ return { marginLeft: `${ARROW_HEIGHT}px` };
13697
+ }
13698
+ return {};
13112
13699
  };
13113
- const getArrowStyles = (position, bg) => {
13700
+ const getArrowStyles = (placement, bg) => {
13701
+ const edgeSide = getArrowEdgeSide(placement);
13702
+ const align = getArrowAxisAlign(placement);
13114
13703
  const base = {
13115
13704
  position: "absolute",
13116
- width: `${ARROW_SIZE}px`,
13117
- height: `${ARROW_HEIGHT}px`,
13118
13705
  background: bg,
13119
- zIndex: 1,
13706
+ zIndex: 2,
13707
+ pointerEvents: "none",
13120
13708
  };
13121
- const horizontal = position.endsWith("center")
13709
+ const horizontal = align === PopoverArrowAxisAlign.Center
13122
13710
  ? { left: `calc(50% - ${ARROW_HALF}px)` }
13123
- : position.endsWith("left")
13711
+ : align === PopoverArrowAxisAlign.Left
13124
13712
  ? { left: `${ARROW_OFFSET}px` }
13125
13713
  : { right: `${ARROW_OFFSET}px` };
13126
- if (position.startsWith("bottom")) {
13127
- return Object.assign(Object.assign(Object.assign({}, base), horizontal), { bottom: 0, clipPath: `polygon(50% 100%, 0 0, 100% 0)` });
13714
+ const vertical = align === PopoverArrowAxisAlign.Center
13715
+ ? { top: `calc(50% - ${ARROW_HALF}px)` }
13716
+ : align === PopoverArrowAxisAlign.Top
13717
+ ? { top: `${ARROW_OFFSET}px` }
13718
+ : { bottom: `${ARROW_OFFSET}px` };
13719
+ if (edgeSide === PopoverPlacementSide.Bottom) {
13720
+ return Object.assign(Object.assign(Object.assign({}, base), horizontal), { width: `${ARROW_SIZE}px`, height: `${ARROW_HEIGHT}px`, bottom: `-${ARROW_HEIGHT}px`, clipPath: `polygon(50% 100%, 0 0, 100% 0)` });
13721
+ }
13722
+ if (edgeSide === PopoverPlacementSide.Top) {
13723
+ return Object.assign(Object.assign(Object.assign({}, base), horizontal), { width: `${ARROW_SIZE}px`, height: `${ARROW_HEIGHT}px`, top: `-${ARROW_HEIGHT}px`, clipPath: `polygon(0 100%, 50% 0, 100% 100%)` });
13128
13724
  }
13129
- return Object.assign(Object.assign(Object.assign({}, base), horizontal), { top: 0, clipPath: `polygon(0 100%, 50% 0, 100% 100%)` });
13725
+ if (edgeSide === PopoverPlacementSide.Left) {
13726
+ return Object.assign(Object.assign(Object.assign({}, base), vertical), { width: `${ARROW_HEIGHT}px`, height: `${ARROW_SIZE}px`, left: `-${ARROW_HEIGHT}px`, clipPath: `polygon(0 50%, 100% 0, 100% 100%)` });
13727
+ }
13728
+ return Object.assign(Object.assign(Object.assign({}, base), vertical), { width: `${ARROW_HEIGHT}px`, height: `${ARROW_SIZE}px`, right: `-${ARROW_HEIGHT}px`, clipPath: `polygon(100% 50%, 0 0, 0 100%)` });
13130
13729
  };
13131
13730
  const getPopoverPaperStyles = (theme, size = "medium") => {
13132
13731
  var _a;
13133
- return ({
13732
+ const width = popoverWidthBySize[size];
13733
+ return {
13134
13734
  boxSizing: "border-box",
13135
- width: popoverWidthBySize[size],
13735
+ width,
13736
+ minWidth: width,
13737
+ maxWidth: width,
13136
13738
  background: (_a = theme.palette.vars) === null || _a === void 0 ? void 0 : _a.controlBackgroundDefault,
13137
13739
  borderRadius: "6px",
13138
13740
  boxShadow: "none",
@@ -13140,25 +13742,34 @@ const getPopoverPaperStyles = (theme, size = "medium") => {
13140
13742
  ? `drop-shadow(${darkModeCardFloating})`
13141
13743
  : `drop-shadow(${lightModeCardFloating})`,
13142
13744
  overflow: "visible",
13143
- });
13745
+ overflowX: "visible",
13746
+ overflowY: "visible",
13747
+ };
13748
+ };
13749
+ const popoverSurfaceStyles = {
13750
+ position: "relative",
13751
+ boxSizing: "border-box",
13752
+ width: "100%",
13753
+ overflow: "visible",
13144
13754
  };
13145
- const getPopoverContentStyles = (theme, featureHighlight = false) => {
13755
+ const getPopoverContentStyles = (theme, featureHighlight = false, size = "medium") => {
13146
13756
  var _a, _b;
13147
- return ({
13757
+ const layout = popoverContentLayoutBySize[size];
13758
+ return {
13148
13759
  boxSizing: "border-box",
13149
13760
  display: "flex",
13150
13761
  flexDirection: "row",
13151
13762
  justifyContent: "flex-end",
13152
13763
  alignItems: "flex-start",
13153
- gap: "16px",
13154
- padding: "12px 16px",
13764
+ gap: layout.gap,
13765
+ padding: layout.padding,
13155
13766
  width: "100%",
13156
13767
  background: (_a = theme.palette.vars) === null || _a === void 0 ? void 0 : _a.controlBackgroundDefault,
13157
13768
  border: featureHighlight
13158
13769
  ? `2px solid ${(_b = theme.palette.vars) === null || _b === void 0 ? void 0 : _b.controlBorderActive}`
13159
13770
  : "0px solid transparent",
13160
13771
  borderRadius: "6px",
13161
- });
13772
+ };
13162
13773
  };
13163
13774
  const popoverColumnStyles = {
13164
13775
  display: "flex",
@@ -13210,10 +13821,15 @@ const popoverBodyStyles = (theme) => {
13210
13821
  const popoverActionsStyles = {
13211
13822
  display: "flex",
13212
13823
  flexDirection: "row",
13824
+ flexWrap: "wrap",
13213
13825
  justifyContent: "flex-end",
13214
13826
  alignItems: "center",
13215
13827
  gap: "12px",
13216
13828
  width: "100%",
13829
+ "& .MuiButton-root": {
13830
+ flexShrink: 0,
13831
+ whiteSpace: "nowrap",
13832
+ },
13217
13833
  };
13218
13834
  const closeButtonStyles = {
13219
13835
  padding: "2px",
@@ -13221,21 +13837,174 @@ const closeButtonStyles = {
13221
13837
  flexShrink: 0,
13222
13838
  };
13223
13839
 
13840
+ const resolveAnchorRect = (anchorEl) => {
13841
+ var _a, _b;
13842
+ if (!anchorEl)
13843
+ return null;
13844
+ const resolved = typeof anchorEl === "function" ? anchorEl() : anchorEl;
13845
+ return (_b = (_a = resolved === null || resolved === void 0 ? void 0 : resolved.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(resolved)) !== null && _b !== void 0 ? _b : null;
13846
+ };
13847
+ const resolvePlacementState = ({ anchorOrigin, transformOrigin, placement, }) => {
13848
+ if (placement) {
13849
+ const origins = getOriginsForPlacement(placement);
13850
+ return {
13851
+ anchorOrigin: origins.anchorOrigin,
13852
+ transformOrigin: origins.transformOrigin,
13853
+ placement,
13854
+ };
13855
+ }
13856
+ return { anchorOrigin, transformOrigin, placement };
13857
+ };
13858
+ const isSameResolvedState = (current, next) => current.placement === next.placement &&
13859
+ current.anchorOrigin.vertical === next.anchorOrigin.vertical &&
13860
+ current.anchorOrigin.horizontal === next.anchorOrigin.horizontal &&
13861
+ current.transformOrigin.vertical === next.transformOrigin.vertical &&
13862
+ current.transformOrigin.horizontal === next.transformOrigin.horizontal;
13863
+ const getPreferenceOrigins = ({ anchorOrigin, transformOrigin, placement, }) => placement
13864
+ ? getOriginsForPlacement(placement)
13865
+ : { anchorOrigin, transformOrigin };
13866
+ const useResolvedPopoverPlacement = ({ open, anchorEl, anchorOrigin, transformOrigin, placement, }) => {
13867
+ const paperRef = useRef(null);
13868
+ const [resolved, setResolved] = useState(() => resolvePlacementState({ anchorOrigin, transformOrigin, placement }));
13869
+ const updateResolved = (next) => {
13870
+ setResolved((current) => isSameResolvedState(current, next) ? current : next);
13871
+ };
13872
+ useLayoutEffect(() => {
13873
+ if (!open) {
13874
+ updateResolved(resolvePlacementState({ anchorOrigin, transformOrigin, placement }));
13875
+ return;
13876
+ }
13877
+ const anchorRect = resolveAnchorRect(anchorEl);
13878
+ if (!anchorRect)
13879
+ return;
13880
+ const { anchorOrigin: preferenceAnchorOrigin, transformOrigin: preferenceTransformOrigin, } = getPreferenceOrigins({ anchorOrigin, transformOrigin, placement });
13881
+ const measure = () => {
13882
+ const paper = paperRef.current;
13883
+ if (!paper)
13884
+ return;
13885
+ if (placement) {
13886
+ const placementSide = getPlacementSide(placement);
13887
+ if (placementSide === PopoverPlacementSide.Top ||
13888
+ placementSide === PopoverPlacementSide.Bottom) {
13889
+ const preferAbove = getVerticalPreference(preferenceAnchorOrigin, preferenceTransformOrigin) === "above";
13890
+ const preferHorizontal = getHorizontalPreference(preferenceAnchorOrigin, preferenceTransformOrigin);
13891
+ const verticalPlacement = resolveVerticalPlacement({
13892
+ preferAbove,
13893
+ spaceAbove: anchorRect.top,
13894
+ spaceBelow: window.innerHeight - anchorRect.bottom,
13895
+ popoverHeight: paper.offsetHeight,
13896
+ hasArrow: true,
13897
+ });
13898
+ const horizontalPlacement = resolveHorizontalPlacement({
13899
+ preferHorizontal,
13900
+ anchorLeft: anchorRect.left,
13901
+ anchorRight: anchorRect.right,
13902
+ anchorWidth: anchorRect.width,
13903
+ popoverWidth: paper.offsetWidth,
13904
+ viewportWidth: window.innerWidth,
13905
+ });
13906
+ const nextPlacement = placementForHorizontalPlacement(placementForVerticalPlacement(placement, verticalPlacement), horizontalPlacement);
13907
+ const origins = getOriginsForPlacement(nextPlacement);
13908
+ updateResolved({
13909
+ anchorOrigin: origins.anchorOrigin,
13910
+ transformOrigin: origins.transformOrigin,
13911
+ placement: nextPlacement,
13912
+ });
13913
+ return;
13914
+ }
13915
+ const preferSide = getSidePreference(placement);
13916
+ const preferAlignment = getEdgeAlignmentPreference(placement);
13917
+ const sidePlacement = resolveSidePlacement({
13918
+ preferSide,
13919
+ spaceLeft: anchorRect.left,
13920
+ spaceRight: window.innerWidth - anchorRect.right,
13921
+ popoverWidth: paper.offsetWidth,
13922
+ hasArrow: true,
13923
+ });
13924
+ const edgeAlignment = resolveEdgeAlignment({
13925
+ preferAlignment,
13926
+ anchorTop: anchorRect.top,
13927
+ anchorBottom: anchorRect.bottom,
13928
+ anchorHeight: anchorRect.height,
13929
+ popoverHeight: paper.offsetHeight,
13930
+ viewportHeight: window.innerHeight,
13931
+ });
13932
+ const nextPlacement = placementForEdgeAlignment(placementForSidePlacement(placement, sidePlacement), edgeAlignment);
13933
+ const origins = getOriginsForPlacement(nextPlacement);
13934
+ updateResolved({
13935
+ anchorOrigin: origins.anchorOrigin,
13936
+ transformOrigin: origins.transformOrigin,
13937
+ placement: nextPlacement,
13938
+ });
13939
+ return;
13940
+ }
13941
+ const preferAbove = getVerticalPreference(preferenceAnchorOrigin, preferenceTransformOrigin) === "above";
13942
+ const verticalPlacement = resolveVerticalPlacement({
13943
+ preferAbove,
13944
+ spaceAbove: anchorRect.top,
13945
+ spaceBelow: window.innerHeight - anchorRect.bottom,
13946
+ popoverHeight: paper.offsetHeight,
13947
+ hasArrow: false,
13948
+ });
13949
+ const horizontalPlacement = resolveHorizontalPlacement({
13950
+ preferHorizontal: getHorizontalPreference(preferenceAnchorOrigin, preferenceTransformOrigin),
13951
+ anchorLeft: anchorRect.left,
13952
+ anchorRight: anchorRect.right,
13953
+ anchorWidth: anchorRect.width,
13954
+ popoverWidth: paper.offsetWidth,
13955
+ viewportWidth: window.innerWidth,
13956
+ });
13957
+ const origins = getOriginsForVerticalPlacement(verticalPlacement, horizontalPlacement);
13958
+ updateResolved({
13959
+ anchorOrigin: origins.anchorOrigin,
13960
+ transformOrigin: origins.transformOrigin,
13961
+ placement,
13962
+ });
13963
+ };
13964
+ const frame = requestAnimationFrame(measure);
13965
+ return () => cancelAnimationFrame(frame);
13966
+ }, [open, anchorEl, anchorOrigin, transformOrigin, placement]);
13967
+ const paperOffsetSx = getPaperArrowOffset(resolved.placement, resolved.anchorOrigin, resolved.transformOrigin);
13968
+ return {
13969
+ paperRef,
13970
+ anchorOrigin: resolved.anchorOrigin,
13971
+ transformOrigin: resolved.transformOrigin,
13972
+ placement: resolved.placement,
13973
+ paperOffsetSx,
13974
+ };
13975
+ };
13976
+
13977
+ const DEFAULT_POPOVER_ANCHOR_ORIGIN = {
13978
+ vertical: PopoverPlacementSide.Top,
13979
+ horizontal: PopoverHorizontalPlacement.Left,
13980
+ };
13981
+ const DEFAULT_POPOVER_TRANSFORM_ORIGIN = {
13982
+ vertical: PopoverPlacementSide.Top,
13983
+ horizontal: PopoverHorizontalPlacement.Left,
13984
+ };
13224
13985
  const Popover = (_a) => {
13225
- var { title, body, actions, icon, showCloseButton = false, featureHighlight = false, size = "medium", arrowPosition, paperSx, onClose, children } = _a, props = __rest(_a, ["title", "body", "actions", "icon", "showCloseButton", "featureHighlight", "size", "arrowPosition", "paperSx", "onClose", "children"]);
13986
+ var { title, body, actions, icon, showCloseButton = false, featureHighlight = false, size = "medium", placement, paperSx, onClose, children, anchorOrigin = DEFAULT_POPOVER_ANCHOR_ORIGIN, transformOrigin = DEFAULT_POPOVER_TRANSFORM_ORIGIN, open = false, disableScrollLock = true } = _a, props = __rest(_a, ["title", "body", "actions", "icon", "showCloseButton", "featureHighlight", "size", "placement", "paperSx", "onClose", "children", "anchorOrigin", "transformOrigin", "open", "disableScrollLock"]);
13226
13987
  const theme = useTheme();
13988
+ const { paperRef, anchorOrigin: resolvedAnchorOrigin, transformOrigin: resolvedTransformOrigin, placement: resolvedPlacement, paperOffsetSx, } = useResolvedPopoverPlacement({
13989
+ open,
13990
+ anchorEl: props.anchorEl,
13991
+ anchorOrigin,
13992
+ transformOrigin,
13993
+ placement,
13994
+ });
13227
13995
  const bg = featureHighlight
13228
13996
  ? theme.palette.vars.controlBorderActive
13229
13997
  : theme.palette.vars.controlBackgroundDefault;
13230
- return (jsxs(Popover$1, Object.assign({}, props, { onClose: onClose, slotProps: {
13998
+ return (jsx(Popover$1, Object.assign({}, props, { open: open, disableScrollLock: disableScrollLock, marginThreshold: null, anchorOrigin: resolvedAnchorOrigin, transformOrigin: resolvedTransformOrigin, onClose: onClose, slotProps: {
13231
13999
  paper: {
14000
+ ref: paperRef,
13232
14001
  sx: [
13233
14002
  getPopoverPaperStyles(theme, size),
13234
- getArrowPadding(arrowPosition),
14003
+ paperOffsetSx,
13235
14004
  ...(Array.isArray(paperSx) ? paperSx : paperSx ? [paperSx] : []),
13236
14005
  ],
13237
14006
  },
13238
- }, children: [arrowPosition && (jsx(Box, { "aria-hidden": true, "data-slot": "popover-arrow", sx: getArrowStyles(arrowPosition, bg) })), children !== null && children !== void 0 ? children : (jsxs(Box, { sx: getPopoverContentStyles(theme, featureHighlight), children: [icon && jsx(Box, { sx: popoverIconStyles, children: icon }), jsxs(Box, { sx: popoverColumnStyles, children: [(title || body || showCloseButton) && (jsxs(Box, { sx: popoverTextStyles, children: [(title || showCloseButton) && (jsxs(Box, { sx: popoverHeaderStyles, children: [title && (jsx(Typography, { component: "div", sx: popoverTitleStyles(theme), children: title })), showCloseButton && (jsx(IconButton, { "aria-label": "Close popover", size: "small", onClick: () => onClose === null || onClose === void 0 ? void 0 : onClose({}, "escapeKeyDown"), sx: closeButtonStyles, children: jsx(CloseIcon, { fontSize: "small" }) }))] })), body && (jsx(Typography, { component: "div", sx: popoverBodyStyles(theme), children: body }))] })), actions && jsx(Box, { sx: popoverActionsStyles, children: actions })] })] }))] })));
14007
+ }, children: jsxs(Box, { sx: popoverSurfaceStyles, children: [resolvedPlacement && (jsx(Box, { "aria-hidden": true, "data-slot": "popover-arrow", sx: getArrowStyles(resolvedPlacement, bg) })), children !== null && children !== void 0 ? children : (jsxs(Box, { sx: getPopoverContentStyles(theme, featureHighlight, size), children: [icon && jsx(Box, { sx: popoverIconStyles, children: icon }), jsxs(Box, { sx: popoverColumnStyles, children: [(title || body || showCloseButton) && (jsxs(Box, { sx: popoverTextStyles, children: [(title || showCloseButton) && (jsxs(Box, { sx: popoverHeaderStyles, children: [title && (jsx(Typography, { component: "div", sx: popoverTitleStyles(theme), children: title })), showCloseButton && (jsx(IconButton, { "aria-label": "Close popover", size: "small", onClick: () => onClose === null || onClose === void 0 ? void 0 : onClose({}, "escapeKeyDown"), sx: closeButtonStyles, children: jsx(CloseIcon, { fontSize: "small" }) }))] })), body && (jsx(Typography, { component: "div", sx: popoverBodyStyles(theme), children: body }))] })), actions && jsx(Box, { sx: popoverActionsStyles, children: actions })] })] }))] }) })));
13239
14008
  };
13240
14009
 
13241
14010
  const getRadioButtonStyles = (theme) => ({
@@ -16450,5 +17219,5 @@ const gradientsPalette = {
16450
17219
  },
16451
17220
  };
16452
17221
 
16453
- export { Accordion, StyledAccordionSummary as AccordionSummary, ActionsDialog, ActivityTimeline, ActivityTimelineStepStatus, AddDomain, AddRepos, AnchorLinkMenu, AttackPathAnalysis, AttackPathAnalysisWalkThrough, Avatar, AvatarGroup, Backdrop, Badge, Banner, BarChart, BarGraph, BasePage, Breadcrumbs, Button, Card, CardActionArea, CardActions, CardContent, CardDescription, CardHeader, CardSubheader, Celebration, ChartType, ChartTypeComponents, ChartWidget, Checkbox, CiCd, Cloud, CloudSimple, CodeBlock, CopyButton, CreateTableInstance, Dashboard, Data, DatePicker, DateRangePicker, DateTimePicker, Dialog, DialogActions, DialogContent, DialogContentText, DialogSubtitle, DialogTitle, Divider, DonutChart, EMPTY_FUNCTION, EmptyData, EmptyState, FiltersBar, FiltersDrawer, FloatingButton, Footer, GaugeChart, GeneralSize, Git, GitSimple, GlobalSearchInput, Header, HorizontalBarChart, Icon, IconPosition, index as Icons, IndicatorBadge, Info, InputField, KeyValuePairs, Kubernetes, LabelAndChildrenTooltipContent, Layout, LineChart, Link, LinkColorEnum, LinkType, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, LoadingErrorState, LoadingStates, Menu, MenuItem, StyledMenuSubheader as MenuSubheader, Message, Navigation, NavigationDrawer, NavigationSubNavigation, Negative, NestedMenu, NestedMenuListbox, NoData, OS_LIGHT_COLORS, OverflowTooltip, PageTitle, Pagination, PathDisplay, PickerItem, Popover, Positive, RadioButton, RadioGroup, Recon, RemainingTags, SEVERITY_VALUE, ScrollArea, SearchInput, Select, SelectNode, SelectNodeListItem, Sent, Severity, SeverityBadge, SeverityBadgeLabel, SeverityBar, Shield, SideDrawer, Skeleton, Slider, SpiderChart, Spinner, StaticDatePicker, StaticDateTimePicker, StepperModal, StepperPanel, Success, Tab, Table, Tabs, Tag, TagAvatarSize, TagBackgroundColorVariants, TagStatus, Tags, ThemeMode, ThemeProvider, TimePicker, Toast, Toaster, Toggle, Tooltip, TooltipSize, Upload, ViewSwitcher, Warning, Widget, agentcyBlue, agentcyDarkBlue, agentcyYellow, augmentTreeData, blue100, blue200, blue300, blue400, blue50, blue500, blue600, blue700, blue800, blue900, blueAlpha10, blueAlpha40, blueFocusRingStrong, blueFocusRingWeak, bluePalette, brandColors, capitalize, darkModeCardFloating, darkModeCardLifted, darkModeCardRaised, darkModeCardSubtle, darkModeFooterBottom, darkModeSideDrawerLeft, darkModeSideDrawerRight, darkVars, deepCopyTree, flattenSelectTree, flattenSelectTreeWithSearch, flattenSelectTreeWithoutSearch, formatNodeValue, getAllSelectedLeaves, getAllSelectedParents, getChildrenOfTopLevelNode, getColorBySeverity, getLeafCounts, getTagStyle, gradientStopColors, gradientsPalette, green10, green100, green200, green300, green40, green400, green50, green500, green600, green700, green800, green900, greenPalette, grey0, grey100, grey200, grey300, grey400, grey50, grey500, grey600, grey700, grey800, grey900, greyAlpha10, greyAlpha40, greyPalette, illustrationGradientEnd, illustrationGradientStart, illustrationInfoGradientEnd, illustrationInfoGradientMiddle, illustrationInfoGradientStart, illustrationNegativeGradientStart, illustrationPositiveGradientEnd, illustrationPositiveGradientMiddle, illustrationPositiveGradientStart, illustrationRing, illustrationShell, illustrationStroke, illustrationSurface, illustrationSurfaceSubtle, illustrationWarningGradientEnd, illustrationWarningGradientStart, iocVars, isLeaf, lavender10, lavender100, lavender200, lavender300, lavender400, lavender50, lavender500, lavender600, lavender700, lavender800, lavender900, lavenderPalette, lightAlphaOrange10, lightAlphaOrange40, lightBlue100, lightBlue200, lightBlue300, lightBlue400, lightBlue50, lightBlue500, lightBlue600, lightBlue700, lightBlue800, lightBlue900, lightBlueAlpha10, lightBlueAlpha40, lightBluePalette, lightModeCardFloating, lightModeCardLifted, lightModeCardRaised, lightModeCardSubtle, lightModeFooterBottom, lightModeSideDrawer, lightModeSideDrawerLeft, lightModeSideDrawerRight, lightOrange100, lightOrange200, lightOrange300, lightOrange400, lightOrange50, lightOrange500, lightOrange600, lightOrange700, lightOrange800, lightOrange900, lightOrangePalette, lightVars, lime10, lime100, lime200, lime300, lime400, lime50, lime500, lime600, lime700, lime800, lime900, limePalette, mergeNodeChildrenValueToText, night10, night100, night200, night300, night400, night50, night500, night600, night700, night800, night900, nightPalette, normalizeSeverity, orange100, orange200, orange300, orange400, orange50, orange500, orange600, orange700, orange800, orange900, orangeAlpha10, orangeAlpha40, orangePalette, outshiftBlue, outshiftLogoDark, outshiftLogoGreen, outshiftLogoLightBlue, outshiftLogoLightOrange, outshiftLogoOrange, outshiftLogoWhite, outshiftMidnightBlue, outshiftOrange, pink10, pink100, pink200, pink300, pink400, pink50, pink500, pink600, pink700, pink800, pink900, pinkPalette, purple100, purple200, purple300, purple400, purple50, purple500, purple600, purple700, purple800, purple900, purpleAlpha10, purpleAlpha40, purplePalette, red100, red200, red300, red400, red50, red500, red600, red700, red800, red900, redAlpha10, redAlpha40, redPalette, selectTagStyle, setSelectedMainSkillCategories, sortBySeverity, sunset10, sunset100, sunset200, sunset300, sunset400, sunset50, sunset500, sunset600, sunset700, sunset800, sunset900, sunsetPalette, surfaceDark100, surfaceDark200, surfaceDark300, surfaceDark400, surfaceDark50, surfaceDark500, surfaceDark600, surfaceDark700, surfaceDark800, surfaceDark800Alpha40, surfaceDark900, surfaceDark900Alpha10, surfaceDark900Alpha40, surfaceDarkPalette, surfaceLight100, surfaceLight200, surfaceLight300, surfaceLight400, surfaceLight50, surfaceLight500, surfaceLight50Alpha40, surfaceLight600, surfaceLight700, surfaceLight800, surfaceLight800Alpha40, surfaceLight900, surfaceLight900Alpha10, surfaceLight900Alpha40, surfaceLightPalette, teal10, teal100, teal200, teal300, teal400, teal50, teal500, teal600, teal700, teal800, teal900, tealPalette, toast, upwardsPush, useNestedMenu, useThemeMode, yellow100, yellow200, yellow300, yellow400, yellow50, yellow500, yellow600, yellow700, yellow800, yellow900, yellowAlpha10, yellowAlpha40, yellowPalette };
17222
+ export { Accordion, StyledAccordionSummary as AccordionSummary, ActionsDialog, ActivityTimeline, ActivityTimelineStepStatus, AddDomain, AddRepos, AnchorLinkMenu, AttackPathAnalysis, AttackPathAnalysisWalkThrough, Avatar, AvatarGroup, Backdrop, Badge, Banner, BarChart, BarGraph, BasePage, Breadcrumbs, Button, Card, CardActionArea, CardActions, CardContent, CardDescription, CardHeader, CardSubheader, Celebration, ChartType, ChartTypeComponents, ChartWidget, Checkbox, CiCd, Cloud, CloudSimple, CodeBlock, CopyButton, CreateTableInstance, Dashboard, Data, DatePicker, DateRangePicker, DateTimePicker, Dialog, DialogActions, DialogContent, DialogContentText, DialogSubtitle, DialogTitle, Divider, DonutChart, EMPTY_FUNCTION, EmptyData, EmptyState, FiltersBar, FiltersDrawer, FloatingButton, Footer, GaugeChart, GeneralSize, Git, GitSimple, GlobalSearchInput, Header, HorizontalBarChart, Icon, IconPosition, index as Icons, IndicatorBadge, Info, InputField, KeyValuePairs, Kubernetes, LabelAndChildrenTooltipContent, Layout, LineChart, Link, LinkColorEnum, LinkType, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, LoadingErrorState, LoadingStates, Menu, MenuItem, StyledMenuSubheader as MenuSubheader, Message, Navigation, NavigationDrawer, NavigationSubNavigation, Negative, NestedMenu, NestedMenuListbox, NoData, OS_LIGHT_COLORS, OverflowTooltip, POPOVER_PLACEMENTS, PageTitle, Pagination, PathDisplay, PickerItem, Popover, PopoverPlacement, PopoverPlacementAlign, PopoverPlacementSide, Positive, RadioButton, RadioGroup, Recon, RemainingTags, SEVERITY_VALUE, ScrollArea, SearchInput, Select, SelectNode, SelectNodeListItem, Sent, Severity, SeverityBadge, SeverityBadgeLabel, SeverityBar, Shield, SideDrawer, Skeleton, Slider, SpiderChart, Spinner, StaticDatePicker, StaticDateTimePicker, StepperModal, StepperPanel, Success, Tab, Table, Tabs, Tag, TagAvatarSize, TagBackgroundColorVariants, TagStatus, Tags, ThemeMode, ThemeProvider, TimePicker, Toast, Toaster, Toggle, Tooltip, TooltipSize, Upload, ViewSwitcher, Warning, Widget, agentcyBlue, agentcyDarkBlue, agentcyYellow, augmentTreeData, blue100, blue200, blue300, blue400, blue50, blue500, blue600, blue700, blue800, blue900, blueAlpha10, blueAlpha40, blueFocusRingStrong, blueFocusRingWeak, bluePalette, brandColors, capitalize, darkModeCardFloating, darkModeCardLifted, darkModeCardRaised, darkModeCardSubtle, darkModeFooterBottom, darkModeSideDrawerLeft, darkModeSideDrawerRight, darkVars, deepCopyTree, flattenSelectTree, flattenSelectTreeWithSearch, flattenSelectTreeWithoutSearch, formatNodeValue, getAllSelectedLeaves, getAllSelectedParents, getChildrenOfTopLevelNode, getColorBySeverity, getLeafCounts, getTagStyle, gradientStopColors, gradientsPalette, green10, green100, green200, green300, green40, green400, green50, green500, green600, green700, green800, green900, greenPalette, grey0, grey100, grey200, grey300, grey400, grey50, grey500, grey600, grey700, grey800, grey900, greyAlpha10, greyAlpha40, greyPalette, illustrationGradientEnd, illustrationGradientStart, illustrationInfoGradientEnd, illustrationInfoGradientMiddle, illustrationInfoGradientStart, illustrationNegativeGradientStart, illustrationPositiveGradientEnd, illustrationPositiveGradientMiddle, illustrationPositiveGradientStart, illustrationRing, illustrationShell, illustrationStroke, illustrationSurface, illustrationSurfaceSubtle, illustrationWarningGradientEnd, illustrationWarningGradientStart, iocVars, isLeaf, lavender10, lavender100, lavender200, lavender300, lavender400, lavender50, lavender500, lavender600, lavender700, lavender800, lavender900, lavenderPalette, lightAlphaOrange10, lightAlphaOrange40, lightBlue100, lightBlue200, lightBlue300, lightBlue400, lightBlue50, lightBlue500, lightBlue600, lightBlue700, lightBlue800, lightBlue900, lightBlueAlpha10, lightBlueAlpha40, lightBluePalette, lightModeCardFloating, lightModeCardLifted, lightModeCardRaised, lightModeCardSubtle, lightModeFooterBottom, lightModeSideDrawer, lightModeSideDrawerLeft, lightModeSideDrawerRight, lightOrange100, lightOrange200, lightOrange300, lightOrange400, lightOrange50, lightOrange500, lightOrange600, lightOrange700, lightOrange800, lightOrange900, lightOrangePalette, lightVars, lime10, lime100, lime200, lime300, lime400, lime50, lime500, lime600, lime700, lime800, lime900, limePalette, mergeNodeChildrenValueToText, night10, night100, night200, night300, night400, night50, night500, night600, night700, night800, night900, nightPalette, normalizeSeverity, orange100, orange200, orange300, orange400, orange50, orange500, orange600, orange700, orange800, orange900, orangeAlpha10, orangeAlpha40, orangePalette, outshiftBlue, outshiftLogoDark, outshiftLogoGreen, outshiftLogoLightBlue, outshiftLogoLightOrange, outshiftLogoOrange, outshiftLogoWhite, outshiftMidnightBlue, outshiftOrange, pink10, pink100, pink200, pink300, pink400, pink50, pink500, pink600, pink700, pink800, pink900, pinkPalette, purple100, purple200, purple300, purple400, purple50, purple500, purple600, purple700, purple800, purple900, purpleAlpha10, purpleAlpha40, purplePalette, red100, red200, red300, red400, red50, red500, red600, red700, red800, red900, redAlpha10, redAlpha40, redPalette, selectTagStyle, setSelectedMainSkillCategories, sortBySeverity, sunset10, sunset100, sunset200, sunset300, sunset400, sunset50, sunset500, sunset600, sunset700, sunset800, sunset900, sunsetPalette, surfaceDark100, surfaceDark200, surfaceDark300, surfaceDark400, surfaceDark50, surfaceDark500, surfaceDark600, surfaceDark700, surfaceDark800, surfaceDark800Alpha40, surfaceDark900, surfaceDark900Alpha10, surfaceDark900Alpha40, surfaceDarkPalette, surfaceLight100, surfaceLight200, surfaceLight300, surfaceLight400, surfaceLight50, surfaceLight500, surfaceLight50Alpha40, surfaceLight600, surfaceLight700, surfaceLight800, surfaceLight800Alpha40, surfaceLight900, surfaceLight900Alpha10, surfaceLight900Alpha40, surfaceLightPalette, teal10, teal100, teal200, teal300, teal400, teal50, teal500, teal600, teal700, teal800, teal900, tealPalette, toast, upwardsPush, useNestedMenu, useThemeMode, yellow100, yellow200, yellow300, yellow400, yellow50, yellow500, yellow600, yellow700, yellow800, yellow900, yellowAlpha10, yellowAlpha40, yellowPalette };
16454
17223
  //# sourceMappingURL=index.esm.js.map