@equinor/roma-framework 0.0.7-BETA.1 → 0.0.7-BETA.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.
@@ -62573,8 +62573,9 @@ var __privateMethod = (obj, member, method) => {
62573
62573
  }
62574
62574
  return result;
62575
62575
  });
62576
+ var mergeWithKey$1$1 = mergeWithKey$1;
62576
62577
  var mergeDeepWithKey$1 = /* @__PURE__ */ _curry3$1(function mergeDeepWithKey2(fn2, lObj, rObj) {
62577
- return mergeWithKey$1(function(k2, lVal, rVal) {
62578
+ return mergeWithKey$1$1(function(k2, lVal, rVal) {
62578
62579
  if (_isObject$1(lVal) && _isObject$1(rVal)) {
62579
62580
  return mergeDeepWithKey2(fn2, lVal, rVal);
62580
62581
  } else {
@@ -62582,8 +62583,9 @@ var __privateMethod = (obj, member, method) => {
62582
62583
  }
62583
62584
  }, lObj, rObj);
62584
62585
  });
62586
+ var mergeDeepWithKey$1$1 = mergeDeepWithKey$1;
62585
62587
  var mergeDeepRight$2 = /* @__PURE__ */ _curry2$1(function mergeDeepRight2(lObj, rObj) {
62586
- return mergeDeepWithKey$1(function(k2, lVal, rVal) {
62588
+ return mergeDeepWithKey$1$1(function(k2, lVal, rVal) {
62587
62589
  return rVal;
62588
62590
  }, lObj, rObj);
62589
62591
  });
@@ -63402,126 +63404,6 @@ var __privateMethod = (obj, member, method) => {
63402
63404
  bottom: spacingSmall$1
63403
63405
  }
63404
63406
  };
63405
- const min = Math.min;
63406
- const max = Math.max;
63407
- const round = Math.round;
63408
- const floor = Math.floor;
63409
- const createCoords = (v2) => ({
63410
- x: v2,
63411
- y: v2
63412
- });
63413
- const oppositeSideMap = {
63414
- left: "right",
63415
- right: "left",
63416
- bottom: "top",
63417
- top: "bottom"
63418
- };
63419
- const oppositeAlignmentMap = {
63420
- start: "end",
63421
- end: "start"
63422
- };
63423
- function clamp(start, value, end) {
63424
- return max(start, min(value, end));
63425
- }
63426
- function evaluate(value, param) {
63427
- return typeof value === "function" ? value(param) : value;
63428
- }
63429
- function getSide(placement) {
63430
- return placement.split("-")[0];
63431
- }
63432
- function getAlignment(placement) {
63433
- return placement.split("-")[1];
63434
- }
63435
- function getOppositeAxis(axis) {
63436
- return axis === "x" ? "y" : "x";
63437
- }
63438
- function getAxisLength(axis) {
63439
- return axis === "y" ? "height" : "width";
63440
- }
63441
- function getSideAxis(placement) {
63442
- return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
63443
- }
63444
- function getAlignmentAxis(placement) {
63445
- return getOppositeAxis(getSideAxis(placement));
63446
- }
63447
- function getAlignmentSides(placement, rects, rtl) {
63448
- if (rtl === void 0) {
63449
- rtl = false;
63450
- }
63451
- const alignment = getAlignment(placement);
63452
- const alignmentAxis = getAlignmentAxis(placement);
63453
- const length2 = getAxisLength(alignmentAxis);
63454
- let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
63455
- if (rects.reference[length2] > rects.floating[length2]) {
63456
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
63457
- }
63458
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
63459
- }
63460
- function getExpandedPlacements(placement) {
63461
- const oppositePlacement = getOppositePlacement(placement);
63462
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
63463
- }
63464
- function getOppositeAlignmentPlacement(placement) {
63465
- return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
63466
- }
63467
- function getSideList(side, isStart, rtl) {
63468
- const lr = ["left", "right"];
63469
- const rl = ["right", "left"];
63470
- const tb = ["top", "bottom"];
63471
- const bt = ["bottom", "top"];
63472
- switch (side) {
63473
- case "top":
63474
- case "bottom":
63475
- if (rtl)
63476
- return isStart ? rl : lr;
63477
- return isStart ? lr : rl;
63478
- case "left":
63479
- case "right":
63480
- return isStart ? tb : bt;
63481
- default:
63482
- return [];
63483
- }
63484
- }
63485
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
63486
- const alignment = getAlignment(placement);
63487
- let list = getSideList(getSide(placement), direction === "start", rtl);
63488
- if (alignment) {
63489
- list = list.map((side) => side + "-" + alignment);
63490
- if (flipAlignment) {
63491
- list = list.concat(list.map(getOppositeAlignmentPlacement));
63492
- }
63493
- }
63494
- return list;
63495
- }
63496
- function getOppositePlacement(placement) {
63497
- return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
63498
- }
63499
- function expandPaddingObject(padding) {
63500
- return {
63501
- top: 0,
63502
- right: 0,
63503
- bottom: 0,
63504
- left: 0,
63505
- ...padding
63506
- };
63507
- }
63508
- function getPaddingObject(padding) {
63509
- return typeof padding !== "number" ? expandPaddingObject(padding) : {
63510
- top: padding,
63511
- right: padding,
63512
- bottom: padding,
63513
- left: padding
63514
- };
63515
- }
63516
- function rectToClientRect(rect) {
63517
- return {
63518
- ...rect,
63519
- top: rect.y,
63520
- left: rect.x,
63521
- right: rect.x + rect.width,
63522
- bottom: rect.y + rect.height
63523
- };
63524
- }
63525
63407
  function getNodeName(node2) {
63526
63408
  if (isNode(node2)) {
63527
63409
  return (node2.nodeName || "").toLowerCase();
@@ -63643,8 +63525,8 @@ var __privateMethod = (obj, member, method) => {
63643
63525
  }
63644
63526
  function activeElement(doc) {
63645
63527
  let activeElement2 = doc.activeElement;
63646
- while (((_activeElement = activeElement2) == null ? void 0 : (_activeElement$shadow = _activeElement.shadowRoot) == null ? void 0 : _activeElement$shadow.activeElement) != null) {
63647
- var _activeElement, _activeElement$shadow;
63528
+ while (((_activeElement = activeElement2) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null) {
63529
+ var _activeElement;
63648
63530
  activeElement2 = activeElement2.shadowRoot.activeElement;
63649
63531
  }
63650
63532
  return activeElement2;
@@ -63688,23 +63570,20 @@ var __privateMethod = (obj, member, method) => {
63688
63570
  }
63689
63571
  return navigator.userAgent;
63690
63572
  }
63691
- function isVirtualClick(event) {
63692
- if (event.mozInputSource === 0 && event.isTrusted) {
63693
- return true;
63694
- }
63695
- const androidRe = /Android/i;
63696
- if ((androidRe.test(getPlatform()) || androidRe.test(getUserAgent())) && event.pointerType) {
63697
- return event.type === "click" && event.buttons === 1;
63698
- }
63699
- return event.detail === 0 && !event.pointerType;
63700
- }
63701
63573
  function isVirtualPointerEvent(event) {
63702
- return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType !== "mouse" || // iOS VoiceOver returns 0.333• for width/height.
63574
+ return !isAndroid() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
63703
63575
  event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0;
63704
63576
  }
63705
63577
  function isSafari() {
63706
63578
  return /apple/i.test(navigator.vendor);
63707
63579
  }
63580
+ function isAndroid() {
63581
+ const re2 = /android/i;
63582
+ return re2.test(getPlatform()) || re2.test(getUserAgent());
63583
+ }
63584
+ function isMac() {
63585
+ return getPlatform().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
63586
+ }
63708
63587
  function isMouseLikePointerType(pointerType, strict) {
63709
63588
  const values = ["mouse", "pen"];
63710
63589
  if (!strict) {
@@ -63737,6 +63616,130 @@ var __privateMethod = (obj, member, method) => {
63737
63616
  }
63738
63617
  return event.target;
63739
63618
  }
63619
+ const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
63620
+ function isTypeableElement(element) {
63621
+ return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
63622
+ }
63623
+ const min = Math.min;
63624
+ const max = Math.max;
63625
+ const round = Math.round;
63626
+ const floor = Math.floor;
63627
+ const createCoords = (v2) => ({
63628
+ x: v2,
63629
+ y: v2
63630
+ });
63631
+ const oppositeSideMap = {
63632
+ left: "right",
63633
+ right: "left",
63634
+ bottom: "top",
63635
+ top: "bottom"
63636
+ };
63637
+ const oppositeAlignmentMap = {
63638
+ start: "end",
63639
+ end: "start"
63640
+ };
63641
+ function clamp(start, value, end) {
63642
+ return max(start, min(value, end));
63643
+ }
63644
+ function evaluate(value, param) {
63645
+ return typeof value === "function" ? value(param) : value;
63646
+ }
63647
+ function getSide(placement) {
63648
+ return placement.split("-")[0];
63649
+ }
63650
+ function getAlignment(placement) {
63651
+ return placement.split("-")[1];
63652
+ }
63653
+ function getOppositeAxis(axis) {
63654
+ return axis === "x" ? "y" : "x";
63655
+ }
63656
+ function getAxisLength(axis) {
63657
+ return axis === "y" ? "height" : "width";
63658
+ }
63659
+ function getSideAxis(placement) {
63660
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
63661
+ }
63662
+ function getAlignmentAxis(placement) {
63663
+ return getOppositeAxis(getSideAxis(placement));
63664
+ }
63665
+ function getAlignmentSides(placement, rects, rtl) {
63666
+ if (rtl === void 0) {
63667
+ rtl = false;
63668
+ }
63669
+ const alignment = getAlignment(placement);
63670
+ const alignmentAxis = getAlignmentAxis(placement);
63671
+ const length2 = getAxisLength(alignmentAxis);
63672
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
63673
+ if (rects.reference[length2] > rects.floating[length2]) {
63674
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
63675
+ }
63676
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
63677
+ }
63678
+ function getExpandedPlacements(placement) {
63679
+ const oppositePlacement = getOppositePlacement(placement);
63680
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
63681
+ }
63682
+ function getOppositeAlignmentPlacement(placement) {
63683
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
63684
+ }
63685
+ function getSideList(side, isStart, rtl) {
63686
+ const lr = ["left", "right"];
63687
+ const rl = ["right", "left"];
63688
+ const tb = ["top", "bottom"];
63689
+ const bt = ["bottom", "top"];
63690
+ switch (side) {
63691
+ case "top":
63692
+ case "bottom":
63693
+ if (rtl)
63694
+ return isStart ? rl : lr;
63695
+ return isStart ? lr : rl;
63696
+ case "left":
63697
+ case "right":
63698
+ return isStart ? tb : bt;
63699
+ default:
63700
+ return [];
63701
+ }
63702
+ }
63703
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
63704
+ const alignment = getAlignment(placement);
63705
+ let list = getSideList(getSide(placement), direction === "start", rtl);
63706
+ if (alignment) {
63707
+ list = list.map((side) => side + "-" + alignment);
63708
+ if (flipAlignment) {
63709
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
63710
+ }
63711
+ }
63712
+ return list;
63713
+ }
63714
+ function getOppositePlacement(placement) {
63715
+ return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
63716
+ }
63717
+ function expandPaddingObject(padding) {
63718
+ return {
63719
+ top: 0,
63720
+ right: 0,
63721
+ bottom: 0,
63722
+ left: 0,
63723
+ ...padding
63724
+ };
63725
+ }
63726
+ function getPaddingObject(padding) {
63727
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
63728
+ top: padding,
63729
+ right: padding,
63730
+ bottom: padding,
63731
+ left: padding
63732
+ };
63733
+ }
63734
+ function rectToClientRect(rect) {
63735
+ return {
63736
+ ...rect,
63737
+ top: rect.y,
63738
+ left: rect.x,
63739
+ right: rect.x + rect.width,
63740
+ bottom: rect.y + rect.height
63741
+ };
63742
+ }
63740
63743
  function computeCoordsFromPlacement(_ref, placement, rtl) {
63741
63744
  let {
63742
63745
  reference,
@@ -65349,6 +65352,24 @@ var __privateMethod = (obj, member, method) => {
65349
65352
  }
65350
65353
  return sortByOrder(candidates);
65351
65354
  };
65355
+ const useInsertionEffect = React$1[/* @__PURE__ */ "useInsertionEffect".toString()];
65356
+ const useSafeInsertionEffect = useInsertionEffect || ((fn2) => fn2());
65357
+ function useEffectEvent(callback) {
65358
+ const ref = reactExports.useRef(() => {
65359
+ if (process.env.NODE_ENV !== "production") {
65360
+ throw new Error("Cannot call an event handler while rendering.");
65361
+ }
65362
+ });
65363
+ useSafeInsertionEffect(() => {
65364
+ ref.current = callback;
65365
+ });
65366
+ return reactExports.useCallback(function() {
65367
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
65368
+ args[_key] = arguments[_key];
65369
+ }
65370
+ return ref.current == null ? void 0 : ref.current(...args);
65371
+ }, []);
65372
+ }
65352
65373
  var index = typeof document !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect;
65353
65374
  function _extends$3() {
65354
65375
  _extends$3 = Object.assign ? Object.assign.bind() : function(target2) {
@@ -65388,7 +65409,7 @@ var __privateMethod = (obj, member, method) => {
65388
65409
  return {
65389
65410
  emit(event, data) {
65390
65411
  var _map$get;
65391
- (_map$get = map2.get(event)) == null ? void 0 : _map$get.forEach((handler) => handler(data));
65412
+ (_map$get = map2.get(event)) == null || _map$get.forEach((handler) => handler(data));
65392
65413
  },
65393
65414
  on(event, listener) {
65394
65415
  map2.set(event, [...map2.get(event) || [], listener]);
@@ -65470,14 +65491,19 @@ var __privateMethod = (obj, member, method) => {
65470
65491
  if (!enabled) {
65471
65492
  return;
65472
65493
  }
65473
- function onDismiss() {
65474
- clearTimeout(timeoutRef.current);
65475
- clearTimeout(restTimeoutRef.current);
65476
- blockMouseMoveRef.current = true;
65494
+ function onOpenChange2(_ref) {
65495
+ let {
65496
+ open: open2
65497
+ } = _ref;
65498
+ if (!open2) {
65499
+ clearTimeout(timeoutRef.current);
65500
+ clearTimeout(restTimeoutRef.current);
65501
+ blockMouseMoveRef.current = true;
65502
+ }
65477
65503
  }
65478
- events.on("dismiss", onDismiss);
65504
+ events.on("openchange", onOpenChange2);
65479
65505
  return () => {
65480
- events.off("dismiss", onDismiss);
65506
+ events.off("openchange", onOpenChange2);
65481
65507
  };
65482
65508
  }, [enabled, events]);
65483
65509
  reactExports.useEffect(() => {
@@ -65486,7 +65512,7 @@ var __privateMethod = (obj, member, method) => {
65486
65512
  }
65487
65513
  function onLeave(event) {
65488
65514
  if (isHoverOpen()) {
65489
- onOpenChange(false, event);
65515
+ onOpenChange(false, event, "hover");
65490
65516
  }
65491
65517
  }
65492
65518
  const html = getDocument(floating).documentElement;
@@ -65495,17 +65521,20 @@ var __privateMethod = (obj, member, method) => {
65495
65521
  html.removeEventListener("mouseleave", onLeave);
65496
65522
  };
65497
65523
  }, [floating, open, onOpenChange, enabled, handleCloseRef, dataRef, isHoverOpen]);
65498
- const closeWithDelay = reactExports.useCallback(function(event, runElseBranch) {
65524
+ const closeWithDelay = reactExports.useCallback(function(event, runElseBranch, reason) {
65499
65525
  if (runElseBranch === void 0) {
65500
65526
  runElseBranch = true;
65501
65527
  }
65528
+ if (reason === void 0) {
65529
+ reason = "hover";
65530
+ }
65502
65531
  const closeDelay = getDelay(delayRef.current, "close", pointerTypeRef.current);
65503
65532
  if (closeDelay && !handlerRef.current) {
65504
65533
  clearTimeout(timeoutRef.current);
65505
- timeoutRef.current = setTimeout(() => onOpenChange(false, event), closeDelay);
65534
+ timeoutRef.current = setTimeout(() => onOpenChange(false, event, reason), closeDelay);
65506
65535
  } else if (runElseBranch) {
65507
65536
  clearTimeout(timeoutRef.current);
65508
- onOpenChange(false, event);
65537
+ onOpenChange(false, event, reason);
65509
65538
  }
65510
65539
  }, [delayRef, onOpenChange]);
65511
65540
  const cleanupMouseMoveHandler = reactExports.useCallback(() => {
@@ -65536,10 +65565,10 @@ var __privateMethod = (obj, member, method) => {
65536
65565
  const openDelay = getDelay(delayRef.current, "open", pointerTypeRef.current);
65537
65566
  if (openDelay) {
65538
65567
  timeoutRef.current = setTimeout(() => {
65539
- onOpenChange(true, event);
65568
+ onOpenChange(true, event, "hover");
65540
65569
  }, openDelay);
65541
65570
  } else {
65542
- onOpenChange(true, event);
65571
+ onOpenChange(true, event, "hover");
65543
65572
  }
65544
65573
  }
65545
65574
  function onMouseLeave(event) {
@@ -65561,7 +65590,7 @@ var __privateMethod = (obj, member, method) => {
65561
65590
  onClose() {
65562
65591
  clearPointerEvents();
65563
65592
  cleanupMouseMoveHandler();
65564
- closeWithDelay(event);
65593
+ closeWithDelay(event, true, "safe-polygon");
65565
65594
  }
65566
65595
  });
65567
65596
  const handler = handlerRef.current;
@@ -65580,7 +65609,7 @@ var __privateMethod = (obj, member, method) => {
65580
65609
  if (isClickLikeOpenEvent()) {
65581
65610
  return;
65582
65611
  }
65583
- handleCloseRef.current == null ? void 0 : handleCloseRef.current({
65612
+ handleCloseRef.current == null || handleCloseRef.current({
65584
65613
  ...context2,
65585
65614
  tree,
65586
65615
  x: event.clientX,
@@ -65595,7 +65624,7 @@ var __privateMethod = (obj, member, method) => {
65595
65624
  if (isElement(domReference)) {
65596
65625
  const ref = domReference;
65597
65626
  open && ref.addEventListener("mouseleave", onScrollMouseLeave);
65598
- floating == null ? void 0 : floating.addEventListener("mouseleave", onScrollMouseLeave);
65627
+ floating == null || floating.addEventListener("mouseleave", onScrollMouseLeave);
65599
65628
  move && ref.addEventListener("mousemove", onMouseEnter, {
65600
65629
  once: true
65601
65630
  });
@@ -65603,7 +65632,7 @@ var __privateMethod = (obj, member, method) => {
65603
65632
  ref.addEventListener("mouseleave", onMouseLeave);
65604
65633
  return () => {
65605
65634
  open && ref.removeEventListener("mouseleave", onScrollMouseLeave);
65606
- floating == null ? void 0 : floating.removeEventListener("mouseleave", onScrollMouseLeave);
65635
+ floating == null || floating.removeEventListener("mouseleave", onScrollMouseLeave);
65607
65636
  move && ref.removeEventListener("mousemove", onMouseEnter);
65608
65637
  ref.removeEventListener("mouseenter", onMouseEnter);
65609
65638
  ref.removeEventListener("mouseleave", onMouseLeave);
@@ -65621,9 +65650,9 @@ var __privateMethod = (obj, member, method) => {
65621
65650
  body.style.pointerEvents = "none";
65622
65651
  performedPointerEventsMutationRef.current = true;
65623
65652
  if (isElement(domReference) && floating) {
65624
- var _tree$nodesRef$curren, _tree$nodesRef$curren2;
65653
+ var _tree$nodesRef$curren;
65625
65654
  const ref = domReference;
65626
- const parentFloating = tree == null ? void 0 : (_tree$nodesRef$curren = tree.nodesRef.current.find((node2) => node2.id === parentId)) == null ? void 0 : (_tree$nodesRef$curren2 = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren2.elements.floating;
65655
+ const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find((node2) => node2.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating;
65627
65656
  if (parentFloating) {
65628
65657
  parentFloating.style.pointerEvents = "";
65629
65658
  }
@@ -65669,7 +65698,7 @@ var __privateMethod = (obj, member, method) => {
65669
65698
  clearTimeout(restTimeoutRef.current);
65670
65699
  restTimeoutRef.current = setTimeout(() => {
65671
65700
  if (!blockMouseMoveRef.current) {
65672
- onOpenChange(true, event.nativeEvent);
65701
+ onOpenChange(true, event.nativeEvent, "hover");
65673
65702
  }
65674
65703
  }, restMs);
65675
65704
  }
@@ -65679,17 +65708,11 @@ var __privateMethod = (obj, member, method) => {
65679
65708
  clearTimeout(timeoutRef.current);
65680
65709
  },
65681
65710
  onMouseLeave(event) {
65682
- events.emit("dismiss", {
65683
- type: "mouseLeave",
65684
- data: {
65685
- returnFocus: false
65686
- }
65687
- });
65688
65711
  closeWithDelay(event.nativeEvent, false);
65689
65712
  }
65690
65713
  }
65691
65714
  };
65692
- }, [events, enabled, restMs, open, onOpenChange, closeWithDelay]);
65715
+ }, [enabled, restMs, open, onOpenChange, closeWithDelay]);
65693
65716
  }
65694
65717
  function getChildren(nodes, id) {
65695
65718
  let allChildren = nodes.filter((node2) => {
@@ -65817,7 +65840,7 @@ var __privateMethod = (obj, member, method) => {
65817
65840
  const dataRef = reactExports.useRef();
65818
65841
  index(() => {
65819
65842
  return () => {
65820
- portalNode == null ? void 0 : portalNode.remove();
65843
+ portalNode == null || portalNode.remove();
65821
65844
  };
65822
65845
  }, [portalNode, data]);
65823
65846
  index(() => {
@@ -65916,10 +65939,10 @@ var __privateMethod = (obj, member, method) => {
65916
65939
  onFocus: (event) => {
65917
65940
  if (isOutsideEvent(event, portalNode)) {
65918
65941
  var _beforeInsideRef$curr;
65919
- (_beforeInsideRef$curr = beforeInsideRef.current) == null ? void 0 : _beforeInsideRef$curr.focus();
65942
+ (_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus();
65920
65943
  } else {
65921
65944
  const prevTabbable = getPreviousTabbable() || (focusManagerState == null ? void 0 : focusManagerState.refs.domReference.current);
65922
- prevTabbable == null ? void 0 : prevTabbable.focus();
65945
+ prevTabbable == null || prevTabbable.focus();
65923
65946
  }
65924
65947
  }
65925
65948
  }), shouldRenderGuards && portalNode && /* @__PURE__ */ reactExports.createElement("span", {
@@ -65931,34 +65954,16 @@ var __privateMethod = (obj, member, method) => {
65931
65954
  onFocus: (event) => {
65932
65955
  if (isOutsideEvent(event, portalNode)) {
65933
65956
  var _afterInsideRef$curre;
65934
- (_afterInsideRef$curre = afterInsideRef.current) == null ? void 0 : _afterInsideRef$curre.focus();
65957
+ (_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus();
65935
65958
  } else {
65936
65959
  const nextTabbable = getNextTabbable() || (focusManagerState == null ? void 0 : focusManagerState.refs.domReference.current);
65937
- nextTabbable == null ? void 0 : nextTabbable.focus();
65960
+ nextTabbable == null || nextTabbable.focus();
65938
65961
  (focusManagerState == null ? void 0 : focusManagerState.closeOnFocusOut) && (focusManagerState == null ? void 0 : focusManagerState.onOpenChange(false, event.nativeEvent));
65939
65962
  }
65940
65963
  }
65941
65964
  }));
65942
65965
  }
65943
65966
  const usePortalContext = () => reactExports.useContext(PortalContext);
65944
- const useInsertionEffect = React$1[/* @__PURE__ */ "useInsertionEffect".toString()];
65945
- const useSafeInsertionEffect = useInsertionEffect || ((fn2) => fn2());
65946
- function useEffectEvent(callback) {
65947
- const ref = reactExports.useRef(() => {
65948
- if (process.env.NODE_ENV !== "production") {
65949
- throw new Error("Cannot call an event handler while rendering.");
65950
- }
65951
- });
65952
- useSafeInsertionEffect(() => {
65953
- ref.current = callback;
65954
- });
65955
- return reactExports.useCallback(function() {
65956
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
65957
- args[_key] = arguments[_key];
65958
- }
65959
- return ref.current == null ? void 0 : ref.current(...args);
65960
- }, []);
65961
- }
65962
65967
  const bubbleHandlerKeys = {
65963
65968
  pointerdown: "onPointerDown",
65964
65969
  mousedown: "onMouseDown",
@@ -65969,11 +65974,11 @@ var __privateMethod = (obj, member, method) => {
65969
65974
  mousedown: "onMouseDownCapture",
65970
65975
  click: "onClickCapture"
65971
65976
  };
65972
- const normalizeBubblesProp = (bubbles) => {
65973
- var _bubbles$escapeKey, _bubbles$outsidePress;
65977
+ const normalizeProp = (normalizable) => {
65978
+ var _normalizable$escapeK, _normalizable$outside;
65974
65979
  return {
65975
- escapeKeyBubbles: typeof bubbles === "boolean" ? bubbles : (_bubbles$escapeKey = bubbles == null ? void 0 : bubbles.escapeKey) != null ? _bubbles$escapeKey : false,
65976
- outsidePressBubbles: typeof bubbles === "boolean" ? bubbles : (_bubbles$outsidePress = bubbles == null ? void 0 : bubbles.outsidePress) != null ? _bubbles$outsidePress : true
65980
+ escapeKey: typeof normalizable === "boolean" ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,
65981
+ outsidePress: typeof normalizable === "boolean" ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true
65977
65982
  };
65978
65983
  };
65979
65984
  function useDismiss(context2, props) {
@@ -65983,7 +65988,6 @@ var __privateMethod = (obj, member, method) => {
65983
65988
  const {
65984
65989
  open,
65985
65990
  onOpenChange,
65986
- events,
65987
65991
  nodeId,
65988
65992
  elements: {
65989
65993
  reference,
@@ -66000,17 +66004,22 @@ var __privateMethod = (obj, member, method) => {
66000
66004
  referencePress = false,
66001
66005
  referencePressEvent = "pointerdown",
66002
66006
  ancestorScroll = false,
66003
- bubbles
66007
+ bubbles,
66008
+ capture
66004
66009
  } = props;
66005
66010
  const tree = useFloatingTree();
66006
- const nested = useFloatingParentNodeId() != null;
66007
66011
  const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === "function" ? unstable_outsidePress : () => false);
66008
66012
  const outsidePress = typeof unstable_outsidePress === "function" ? outsidePressFn : unstable_outsidePress;
66009
66013
  const insideReactTreeRef = reactExports.useRef(false);
66014
+ const endedOrStartedInsideRef = reactExports.useRef(false);
66015
+ const {
66016
+ escapeKey: escapeKeyBubbles,
66017
+ outsidePress: outsidePressBubbles
66018
+ } = normalizeProp(bubbles);
66010
66019
  const {
66011
- escapeKeyBubbles,
66012
- outsidePressBubbles
66013
- } = normalizeBubblesProp(bubbles);
66020
+ escapeKey: escapeKeyCapture,
66021
+ outsidePress: outsidePressCapture
66022
+ } = normalizeProp(capture);
66014
66023
  const closeOnEscapeKeyDown = useEffectEvent((event) => {
66015
66024
  if (!open || !enabled || !escapeKey || event.key !== "Escape") {
66016
66025
  return;
@@ -66032,19 +66041,25 @@ var __privateMethod = (obj, member, method) => {
66032
66041
  }
66033
66042
  }
66034
66043
  }
66035
- events.emit("dismiss", {
66036
- type: "escapeKey",
66037
- data: {
66038
- returnFocus: {
66039
- preventScroll: false
66040
- }
66041
- }
66042
- });
66043
- onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event);
66044
+ onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, "escape-key");
66045
+ });
66046
+ const closeOnEscapeKeyDownCapture = useEffectEvent((event) => {
66047
+ var _getTarget2;
66048
+ const callback = () => {
66049
+ var _getTarget;
66050
+ closeOnEscapeKeyDown(event);
66051
+ (_getTarget = getTarget(event)) == null || _getTarget.removeEventListener("keydown", callback);
66052
+ };
66053
+ (_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener("keydown", callback);
66044
66054
  });
66045
66055
  const closeOnPressOutside = useEffectEvent((event) => {
66046
66056
  const insideReactTree = insideReactTreeRef.current;
66047
66057
  insideReactTreeRef.current = false;
66058
+ const endedOrStartedInside = endedOrStartedInsideRef.current;
66059
+ endedOrStartedInsideRef.current = false;
66060
+ if (outsidePressEvent === "click" && endedOrStartedInside) {
66061
+ return;
66062
+ }
66048
66063
  if (insideReactTree) {
66049
66064
  return;
66050
66065
  }
@@ -66057,7 +66072,7 @@ var __privateMethod = (obj, member, method) => {
66057
66072
  let targetRootAncestor = isElement(target2) ? target2 : null;
66058
66073
  while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
66059
66074
  const nextParent = getParentNode(targetRootAncestor);
66060
- if (nextParent === getDocument(floating).body || !isElement(nextParent)) {
66075
+ if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
66061
66076
  break;
66062
66077
  } else {
66063
66078
  targetRootAncestor = nextParent;
@@ -66104,15 +66119,16 @@ var __privateMethod = (obj, member, method) => {
66104
66119
  return;
66105
66120
  }
66106
66121
  }
66107
- events.emit("dismiss", {
66108
- type: "outsidePress",
66109
- data: {
66110
- returnFocus: nested ? {
66111
- preventScroll: true
66112
- } : isVirtualClick(event) || isVirtualPointerEvent(event)
66113
- }
66114
- });
66115
- onOpenChange(false, event);
66122
+ onOpenChange(false, event, "outside-press");
66123
+ });
66124
+ const closeOnPressOutsideCapture = useEffectEvent((event) => {
66125
+ var _getTarget4;
66126
+ const callback = () => {
66127
+ var _getTarget3;
66128
+ closeOnPressOutside(event);
66129
+ (_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);
66130
+ };
66131
+ (_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);
66116
66132
  });
66117
66133
  reactExports.useEffect(() => {
66118
66134
  if (!open || !enabled) {
@@ -66121,11 +66137,11 @@ var __privateMethod = (obj, member, method) => {
66121
66137
  dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
66122
66138
  dataRef.current.__outsidePressBubbles = outsidePressBubbles;
66123
66139
  function onScroll(event) {
66124
- onOpenChange(false, event);
66140
+ onOpenChange(false, event, "ancestor-scroll");
66125
66141
  }
66126
66142
  const doc = getDocument(floating);
66127
- escapeKey && doc.addEventListener("keydown", closeOnEscapeKeyDown);
66128
- outsidePress && doc.addEventListener(outsidePressEvent, closeOnPressOutside);
66143
+ escapeKey && doc.addEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
66144
+ outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
66129
66145
  let ancestors = [];
66130
66146
  if (ancestorScroll) {
66131
66147
  if (isElement(domReference)) {
@@ -66148,13 +66164,13 @@ var __privateMethod = (obj, member, method) => {
66148
66164
  });
66149
66165
  });
66150
66166
  return () => {
66151
- escapeKey && doc.removeEventListener("keydown", closeOnEscapeKeyDown);
66152
- outsidePress && doc.removeEventListener(outsidePressEvent, closeOnPressOutside);
66167
+ escapeKey && doc.removeEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
66168
+ outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
66153
66169
  ancestors.forEach((ancestor) => {
66154
66170
  ancestor.removeEventListener("scroll", onScroll);
66155
66171
  });
66156
66172
  };
66157
- }, [dataRef, floating, domReference, reference, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, closeOnPressOutside]);
66173
+ }, [dataRef, floating, domReference, reference, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);
66158
66174
  reactExports.useEffect(() => {
66159
66175
  insideReactTreeRef.current = false;
66160
66176
  }, [outsidePress, outsidePressEvent]);
@@ -66167,24 +66183,24 @@ var __privateMethod = (obj, member, method) => {
66167
66183
  onKeyDown: closeOnEscapeKeyDown,
66168
66184
  [bubbleHandlerKeys[referencePressEvent]]: (event) => {
66169
66185
  if (referencePress) {
66170
- events.emit("dismiss", {
66171
- type: "referencePress",
66172
- data: {
66173
- returnFocus: false
66174
- }
66175
- });
66176
- onOpenChange(false, event.nativeEvent);
66186
+ onOpenChange(false, event.nativeEvent, "reference-press");
66177
66187
  }
66178
66188
  }
66179
66189
  },
66180
66190
  floating: {
66181
66191
  onKeyDown: closeOnEscapeKeyDown,
66192
+ onMouseDown() {
66193
+ endedOrStartedInsideRef.current = true;
66194
+ },
66195
+ onMouseUp() {
66196
+ endedOrStartedInsideRef.current = true;
66197
+ },
66182
66198
  [captureHandlerKeys[outsidePressEvent]]: () => {
66183
66199
  insideReactTreeRef.current = true;
66184
66200
  }
66185
66201
  }
66186
66202
  };
66187
- }, [enabled, events, referencePress, outsidePressEvent, referencePressEvent, onOpenChange, closeOnEscapeKeyDown]);
66203
+ }, [enabled, referencePress, outsidePressEvent, referencePressEvent, onOpenChange, closeOnEscapeKeyDown]);
66188
66204
  }
66189
66205
  let devMessageSet;
66190
66206
  if (process.env.NODE_ENV !== "production") {
@@ -66207,7 +66223,7 @@ var __privateMethod = (obj, member, method) => {
66207
66223
  var _devMessageSet;
66208
66224
  if (!((_devMessageSet = devMessageSet) != null && _devMessageSet.has(err))) {
66209
66225
  var _devMessageSet2;
66210
- (_devMessageSet2 = devMessageSet) == null ? void 0 : _devMessageSet2.add(err);
66226
+ (_devMessageSet2 = devMessageSet) == null || _devMessageSet2.add(err);
66211
66227
  console.error(err);
66212
66228
  }
66213
66229
  }
@@ -66216,11 +66232,18 @@ var __privateMethod = (obj, member, method) => {
66216
66232
  const domReference = ((_options$elements2 = options.elements) == null ? void 0 : _options$elements2.reference) || _domReference;
66217
66233
  const position2 = useFloating$1(options);
66218
66234
  const tree = useFloatingTree();
66219
- const onOpenChange = useEffectEvent((open2, event) => {
66235
+ const nested = useFloatingParentNodeId() != null;
66236
+ const onOpenChange = useEffectEvent((open2, event, reason) => {
66220
66237
  if (open2) {
66221
66238
  dataRef.current.openEvent = event;
66222
66239
  }
66223
- unstable_onOpenChange == null ? void 0 : unstable_onOpenChange(open2, event);
66240
+ events.emit("openchange", {
66241
+ open: open2,
66242
+ event,
66243
+ reason,
66244
+ nested
66245
+ });
66246
+ unstable_onOpenChange == null || unstable_onOpenChange(open2, event, reason);
66224
66247
  });
66225
66248
  const domReferenceRef = reactExports.useRef(null);
66226
66249
  const dataRef = reactExports.useRef({});
@@ -66286,7 +66309,6 @@ var __privateMethod = (obj, member, method) => {
66286
66309
  const {
66287
66310
  open,
66288
66311
  onOpenChange,
66289
- dataRef,
66290
66312
  events,
66291
66313
  refs,
66292
66314
  elements: {
@@ -66296,39 +66318,46 @@ var __privateMethod = (obj, member, method) => {
66296
66318
  } = context2;
66297
66319
  const {
66298
66320
  enabled = true,
66299
- keyboardOnly = true
66321
+ visibleOnly = true
66300
66322
  } = props;
66301
- const pointerTypeRef = reactExports.useRef("");
66302
66323
  const blockFocusRef = reactExports.useRef(false);
66303
66324
  const timeoutRef = reactExports.useRef();
66325
+ const keyboardModalityRef = reactExports.useRef(true);
66304
66326
  reactExports.useEffect(() => {
66305
66327
  if (!enabled) {
66306
66328
  return;
66307
66329
  }
66308
- const doc = getDocument(floating);
66309
- const win = doc.defaultView || window;
66330
+ const win = getWindow(domReference);
66310
66331
  function onBlur() {
66311
66332
  if (!open && isHTMLElement(domReference) && domReference === activeElement(getDocument(domReference))) {
66312
66333
  blockFocusRef.current = true;
66313
66334
  }
66314
66335
  }
66336
+ function onKeyDown() {
66337
+ keyboardModalityRef.current = true;
66338
+ }
66315
66339
  win.addEventListener("blur", onBlur);
66340
+ win.addEventListener("keydown", onKeyDown, true);
66316
66341
  return () => {
66317
66342
  win.removeEventListener("blur", onBlur);
66343
+ win.removeEventListener("keydown", onKeyDown, true);
66318
66344
  };
66319
66345
  }, [floating, domReference, open, enabled]);
66320
66346
  reactExports.useEffect(() => {
66321
66347
  if (!enabled) {
66322
66348
  return;
66323
66349
  }
66324
- function onDismiss(payload) {
66325
- if (payload.type === "referencePress" || payload.type === "escapeKey") {
66350
+ function onOpenChange2(_ref) {
66351
+ let {
66352
+ reason
66353
+ } = _ref;
66354
+ if (reason === "reference-press" || reason === "escape-key") {
66326
66355
  blockFocusRef.current = true;
66327
66356
  }
66328
66357
  }
66329
- events.on("dismiss", onDismiss);
66358
+ events.on("openchange", onOpenChange2);
66330
66359
  return () => {
66331
- events.off("dismiss", onDismiss);
66360
+ events.off("openchange", onOpenChange2);
66332
66361
  };
66333
66362
  }, [events, enabled]);
66334
66363
  reactExports.useEffect(() => {
@@ -66342,61 +66371,91 @@ var __privateMethod = (obj, member, method) => {
66342
66371
  }
66343
66372
  return {
66344
66373
  reference: {
66345
- onPointerDown(_ref) {
66346
- let {
66347
- pointerType
66348
- } = _ref;
66349
- pointerTypeRef.current = pointerType;
66350
- blockFocusRef.current = !!(pointerType && keyboardOnly);
66374
+ onPointerDown(event) {
66375
+ if (isVirtualPointerEvent(event.nativeEvent))
66376
+ return;
66377
+ keyboardModalityRef.current = false;
66351
66378
  },
66352
66379
  onMouseLeave() {
66353
66380
  blockFocusRef.current = false;
66354
66381
  },
66355
66382
  onFocus(event) {
66356
- var _dataRef$current$open;
66357
- if (blockFocusRef.current) {
66358
- return;
66359
- }
66360
- if (event.type === "focus" && ((_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type) === "mousedown" && isEventTargetWithin(dataRef.current.openEvent, domReference)) {
66383
+ if (blockFocusRef.current)
66361
66384
  return;
66385
+ const target2 = getTarget(event.nativeEvent);
66386
+ if (visibleOnly && isElement(target2)) {
66387
+ try {
66388
+ if (isSafari() && isMac())
66389
+ throw Error();
66390
+ if (!target2.matches(":focus-visible"))
66391
+ return;
66392
+ } catch (e2) {
66393
+ if (!keyboardModalityRef.current && !isTypeableElement(target2)) {
66394
+ return;
66395
+ }
66396
+ }
66362
66397
  }
66363
- onOpenChange(true, event.nativeEvent);
66398
+ onOpenChange(true, event.nativeEvent, "focus");
66364
66399
  },
66365
66400
  onBlur(event) {
66366
66401
  blockFocusRef.current = false;
66367
66402
  const relatedTarget = event.relatedTarget;
66368
66403
  const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
66369
- timeoutRef.current = setTimeout(() => {
66404
+ timeoutRef.current = window.setTimeout(() => {
66405
+ const activeEl = activeElement(domReference ? domReference.ownerDocument : document);
66406
+ if (!relatedTarget && activeEl === domReference)
66407
+ return;
66370
66408
  if (contains(refs.floating.current, relatedTarget) || contains(domReference, relatedTarget) || movedToFocusGuard) {
66371
66409
  return;
66372
66410
  }
66373
- onOpenChange(false, event.nativeEvent);
66411
+ onOpenChange(false, event.nativeEvent, "focus");
66374
66412
  });
66375
66413
  }
66376
66414
  }
66377
66415
  };
66378
- }, [enabled, keyboardOnly, domReference, refs, dataRef, onOpenChange]);
66416
+ }, [enabled, visibleOnly, domReference, refs, onOpenChange]);
66379
66417
  }
66418
+ const ACTIVE_KEY = "active";
66419
+ const SELECTED_KEY = "selected";
66380
66420
  function mergeProps(userProps, propsList, elementKey) {
66381
66421
  const map2 = /* @__PURE__ */ new Map();
66422
+ const isItem = elementKey === "item";
66423
+ let domUserProps = userProps;
66424
+ if (isItem && userProps) {
66425
+ const {
66426
+ [ACTIVE_KEY]: _2,
66427
+ [SELECTED_KEY]: __,
66428
+ ...validProps
66429
+ } = userProps;
66430
+ domUserProps = validProps;
66431
+ }
66382
66432
  return {
66383
66433
  ...elementKey === "floating" && {
66384
66434
  tabIndex: -1
66385
66435
  },
66386
- ...userProps,
66387
- ...propsList.map((value) => value ? value[elementKey] : null).concat(userProps).reduce((acc, props) => {
66436
+ ...domUserProps,
66437
+ ...propsList.map((value) => {
66438
+ const propsOrGetProps = value ? value[elementKey] : null;
66439
+ if (typeof propsOrGetProps === "function") {
66440
+ return userProps ? propsOrGetProps(userProps) : null;
66441
+ }
66442
+ return propsOrGetProps;
66443
+ }).concat(userProps).reduce((acc, props) => {
66388
66444
  if (!props) {
66389
66445
  return acc;
66390
66446
  }
66391
66447
  Object.entries(props).forEach((_ref) => {
66392
66448
  let [key, value] = _ref;
66449
+ if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {
66450
+ return;
66451
+ }
66393
66452
  if (key.indexOf("on") === 0) {
66394
66453
  if (!map2.has(key)) {
66395
66454
  map2.set(key, []);
66396
66455
  }
66397
66456
  if (typeof value === "function") {
66398
66457
  var _map$get;
66399
- (_map$get = map2.get(key)) == null ? void 0 : _map$get.push(value);
66458
+ (_map$get = map2.get(key)) == null || _map$get.push(value);
66400
66459
  acc[key] = function() {
66401
66460
  var _map$get2;
66402
66461
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -66443,7 +66502,9 @@ var __privateMethod = (obj, member, method) => {
66443
66502
  getItemProps
66444
66503
  }), [getReferenceProps, getFloatingProps, getItemProps]);
66445
66504
  }
66505
+ const componentRoleToAriaRoleMap = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", false]]);
66446
66506
  function useRole(context2, props) {
66507
+ var _componentRoleToAriaR;
66447
66508
  if (props === void 0) {
66448
66509
  props = {};
66449
66510
  }
@@ -66455,19 +66516,23 @@ var __privateMethod = (obj, member, method) => {
66455
66516
  enabled = true,
66456
66517
  role = "dialog"
66457
66518
  } = props;
66519
+ const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role;
66458
66520
  const referenceId = useId();
66521
+ const parentId = useFloatingParentNodeId();
66522
+ const isNested = parentId != null;
66459
66523
  return reactExports.useMemo(() => {
66524
+ if (!enabled)
66525
+ return {};
66460
66526
  const floatingProps = {
66461
66527
  id: floatingId,
66462
- role
66528
+ ...ariaRole && {
66529
+ role: ariaRole
66530
+ }
66463
66531
  };
66464
- if (!enabled) {
66465
- return {};
66466
- }
66467
- if (role === "tooltip") {
66532
+ if (ariaRole === "tooltip" || role === "label") {
66468
66533
  return {
66469
66534
  reference: {
66470
- "aria-describedby": open ? floatingId : void 0
66535
+ ["aria-" + (role === "label" ? "labelledby" : "describedby")]: open ? floatingId : void 0
66471
66536
  },
66472
66537
  floating: floatingProps
66473
66538
  };
@@ -66475,23 +66540,60 @@ var __privateMethod = (obj, member, method) => {
66475
66540
  return {
66476
66541
  reference: {
66477
66542
  "aria-expanded": open ? "true" : "false",
66478
- "aria-haspopup": role === "alertdialog" ? "dialog" : role,
66543
+ "aria-haspopup": ariaRole === "alertdialog" ? "dialog" : ariaRole,
66479
66544
  "aria-controls": open ? floatingId : void 0,
66480
- ...role === "listbox" && {
66545
+ ...ariaRole === "listbox" && {
66481
66546
  role: "combobox"
66482
66547
  },
66483
- ...role === "menu" && {
66548
+ ...ariaRole === "menu" && {
66484
66549
  id: referenceId
66550
+ },
66551
+ ...ariaRole === "menu" && isNested && {
66552
+ role: "menuitem"
66553
+ },
66554
+ ...role === "select" && {
66555
+ "aria-autocomplete": "none"
66556
+ },
66557
+ ...role === "combobox" && {
66558
+ "aria-autocomplete": "list"
66485
66559
  }
66486
66560
  },
66487
66561
  floating: {
66488
66562
  ...floatingProps,
66489
- ...role === "menu" && {
66563
+ ...ariaRole === "menu" && {
66490
66564
  "aria-labelledby": referenceId
66491
66565
  }
66566
+ },
66567
+ item(_ref) {
66568
+ let {
66569
+ active,
66570
+ selected
66571
+ } = _ref;
66572
+ const commonProps = {
66573
+ role: "option",
66574
+ ...active && {
66575
+ id: floatingId + "-option"
66576
+ }
66577
+ };
66578
+ switch (role) {
66579
+ case "select":
66580
+ return {
66581
+ ...commonProps,
66582
+ "aria-selected": active && selected
66583
+ };
66584
+ case "combobox": {
66585
+ return {
66586
+ ...commonProps,
66587
+ ...active && {
66588
+ "aria-selected": true
66589
+ }
66590
+ };
66591
+ }
66592
+ }
66593
+ return {};
66492
66594
  }
66493
66595
  };
66494
- }, [enabled, role, open, floatingId, referenceId]);
66596
+ }, [enabled, role, ariaRole, open, floatingId, referenceId, isNested]);
66495
66597
  }
66496
66598
  var _excluded$r = ["title", "placement", "children", "style", "enterDelay"];
66497
66599
  var StyledTooltip = st.div.withConfig({
@@ -66748,7 +66850,6 @@ var __privateMethod = (obj, member, method) => {
66748
66850
  "aria-hidden": true
66749
66851
  };
66750
66852
  var pathProps = {
66751
- d: icon2.svgPathData,
66752
66853
  $height: icon2.height ? parseInt(icon2.height) : size2,
66753
66854
  $size: size2 || parseInt(icon2.height)
66754
66855
  };
@@ -66767,9 +66868,15 @@ var __privateMethod = (obj, member, method) => {
66767
66868
  children: [title && /* @__PURE__ */ jsxRuntimeExports.jsx("title", {
66768
66869
  id: titleId,
66769
66870
  children: title
66770
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(StyledPath, _objectSpread2({
66871
+ }), Array.isArray(icon2.svgPathData) ? icon2.svgPathData.map(function(pathData) {
66872
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StyledPath, _objectSpread2(_objectSpread2({}, pathProps), {}, {
66873
+ d: pathData
66874
+ }), pathData);
66875
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StyledPath, _objectSpread2(_objectSpread2({
66771
66876
  "data-testid": "eds-icon-path"
66772
- }, pathProps))]
66877
+ }, pathProps), {}, {
66878
+ d: icon2.svgPathData
66879
+ }))]
66773
66880
  }));
66774
66881
  });
66775
66882
  var Icon = Icon$1;