orcs-design-system 3.2.16 → 3.2.18

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.
@@ -6,6 +6,7 @@ import { themeGet } from "@styled-system/theme-get";
6
6
  import { commonKeys } from "../../hooks/keypress";
7
7
  import useActionMenu from "./useActionMenu";
8
8
  import { FloatingFocusManager, FloatingPortal, useMergeRefs } from "@floating-ui/react";
9
+ import { getFloatingUiRootElement, getFloatingUiZIndex } from "../../utils/floatingUiHelpers";
9
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
11
  const ActionMenuContext = /*#__PURE__*/createContext({});
11
12
  const crossTransform1 = keyframes(["0%{transform:translate(0,-6px);border-radius:2px;}50%{transform:translate(0,0);border-radius:2px;}75%{transform:rotate(-45deg) translate(0,0);border-radius:2px;}100%{transform:rotate(-45deg) translate(0,0) scaleX(4);border-radius:0;}"]);
@@ -102,6 +103,7 @@ export const ActionsMenuBody = _ref => {
102
103
  onTriggerFocus,
103
104
  closeMenu,
104
105
  closeOnClick = false,
106
+ "data-testid": dataTestId,
105
107
  ...props
106
108
  } = _ref;
107
109
  const id = useId();
@@ -127,7 +129,8 @@ export const ActionsMenuBody = _ref => {
127
129
  ref: triggerRef,
128
130
  ...props,
129
131
  ...children.props,
130
- "data-state": actionMenu.open ? "open" : "closed"
132
+ "data-state": actionMenu.open ? "open" : "closed",
133
+ "data-testid": dataTestId
131
134
  })
132
135
  };
133
136
  let triggerComponent = /*#__PURE__*/_jsx(Control, {
@@ -153,6 +156,7 @@ export const ActionsMenuBody = _ref => {
153
156
  children: /*#__PURE__*/_jsxs(Wrapper, {
154
157
  ...props,
155
158
  children: [triggerComponent, actionMenu.context.open && /*#__PURE__*/_jsx(FloatingPortal, {
159
+ root: getFloatingUiRootElement(actionMenu.refs.reference),
156
160
  children: /*#__PURE__*/_jsx(FloatingFocusManager, {
157
161
  context: actionMenu.context,
158
162
  modal: actionMenu.modal,
@@ -160,7 +164,7 @@ export const ActionsMenuBody = _ref => {
160
164
  ref: ref,
161
165
  style: {
162
166
  ...actionMenu.floatingStyles,
163
- zIndex: 1100
167
+ zIndex: getFloatingUiZIndex(actionMenu.refs.reference)
164
168
  },
165
169
  "aria-labelledby": actionMenu.labelId,
166
170
  ...actionMenu.getFloatingProps(props),
@@ -134,6 +134,7 @@ const Modal = _ref => {
134
134
  onDeactivate: onClose
135
135
  },
136
136
  children: /*#__PURE__*/_jsx("div", {
137
+ id: "modal",
137
138
  role: "dialog",
138
139
  "aria-modal": "true",
139
140
  "aria-label": ariaLabel,
@@ -5,6 +5,7 @@ import styled from "styled-components";
5
5
  import Icon from "../Icon";
6
6
  import { PropTypes } from "prop-types";
7
7
  import Box from "../Box";
8
+ import { getFloatingUiRootElement, getFloatingUiZIndex } from "../../utils/floatingUiHelpers";
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const DIRECTIONS_MAP = {
10
11
  topLeft: "top-start",
@@ -105,13 +106,14 @@ export default function Popover(_ref) {
105
106
  return /*#__PURE__*/_jsxs(Box, {
106
107
  ...props,
107
108
  children: [triggerComponent, /*#__PURE__*/_jsx(FloatingPortal, {
109
+ root: getFloatingUiRootElement(context.refs.reference),
108
110
  preserveTabOrder: true,
109
111
  children: text && /*#__PURE__*/_jsx(StyledPopoverContainer, {
110
112
  className: "Tooltip popover ".concat(visible ? "visible" : ""),
111
113
  ref: refs.setFloating,
112
114
  style: {
113
115
  ...floatingStyles,
114
- zIndex: 1100
116
+ zIndex: getFloatingUiZIndex(context.refs.reference)
115
117
  },
116
118
  ...getFloatingProps(),
117
119
  children: /*#__PURE__*/_jsx(FloatingFocusManager, {
@@ -0,0 +1,18 @@
1
+ const getFloatingUiZIndex = triggerRef => {
2
+ var _activeModalRef$conta;
3
+ const activeModalRef = document.getElementById("modal-overlay");
4
+ if (activeModalRef && triggerRef.current && activeModalRef !== null && activeModalRef !== void 0 && (_activeModalRef$conta = activeModalRef.contains) !== null && _activeModalRef$conta !== void 0 && _activeModalRef$conta.call(activeModalRef, triggerRef.current)) {
5
+ return 1100;
6
+ }
7
+ return 900;
8
+ };
9
+ const getFloatingUiRootElement = triggerRef => {
10
+ var _activeModalRef$conta2;
11
+ const activeModalRef = document.getElementById("modal-overlay");
12
+ const isRenderedInModal = activeModalRef === null || activeModalRef === void 0 || (_activeModalRef$conta2 = activeModalRef.contains) === null || _activeModalRef$conta2 === void 0 ? void 0 : _activeModalRef$conta2.call(activeModalRef, triggerRef.current);
13
+ if (isRenderedInModal) {
14
+ return document.getElementById("modal");
15
+ }
16
+ return undefined;
17
+ };
18
+ export { getFloatingUiZIndex, getFloatingUiRootElement };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.2.16",
3
+ "version": "3.2.18",
4
4
  "engines": {
5
5
  "node": "20.12.2"
6
6
  },