orcs-design-system 3.2.32 → 3.2.34
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.
|
@@ -5,7 +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
|
+
import { getFloatingUiRootElement, getFloatingUiZIndex, isRenderedInReactSelectMenu } from "../../utils/floatingUiHelpers";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const DIRECTIONS_MAP = {
|
|
11
11
|
topLeft: "top-start",
|
|
@@ -26,7 +26,7 @@ const StyledPopover = styled.div.withConfig({
|
|
|
26
26
|
componentId: "sc-1bwoak-1"
|
|
27
27
|
})(["font-size:", ";line-height:", ";font-weight:", ";text-align:", ";word-break:break-word;color:", ";outline:0;padding:", ";border-radius:", ";width:", ";background:", ";border:1px solid ", ";box-shadow:", ";user-select:", ";pointer-events:none;opacity:0;visibility:hidden;&.visible{opacity:1;pointer-events:auto;visibility:visible;}& a{font-size:", ";}&:before{content:\"\";z-index:2;height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;border-color:transparent;border-right-color:", ";left:-6px;top:50%;margin-top:-6px;position:absolute;}&:after{content:\"\";z-index:1;position:absolute;border-color:transparent;border-right-color:", ";height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;left:-7px;top:50%;margin-top:-6px;}&.top{&:before{left:50%;top:auto;margin-top:0;bottom:-9px;margin-left:-3px;transform:rotate(-90deg);}&:after{left:50%;top:auto;margin-top:0;bottom:-10px;margin-left:-3px;transform:rotate(-90deg);}}&.topRight,&.top-end{&:before{left:1px;top:auto;margin-top:0;bottom:-5px;margin-left:-6px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}&:after{left:1px;top:auto;margin-top:0;bottom:-6px;margin-left:-7px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}}&.bottomRight,&.bottom-end{&:before{left:1px;bottom:auto;margin-top:0;top:-5px;margin-left:-6px;transform:rotate(45deg);border-width:5px 10px 5px 0;}&:after{left:1px;bottom:auto;margin-top:0;top:-6px;margin-left:-7px;transform:rotate(45deg);border-width:5px 10px 5px 0;}}&.bottom{&:before{left:50%;top:-9px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}&:after{left:50%;top:-10px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}}&.bottomLeft,&.bottom-start{&:before{right:1px;left:auto;bottom:auto;margin-top:0;top:-5px;margin-right:-6px;transform:rotate(135deg);border-width:5px 10px 5px 0;}&:after{right:1px;left:auto;bottom:auto;margin-top:0;top:-6px;margin-right:-7px;transform:rotate(135deg);border-width:5px 10px 5px 0;}}&.left{&:before{left:auto;right:-6px;transform:rotate(180deg);}&:after{left:auto;right:-7px;transform:rotate(180deg);top:50%;margin-top:-6px;}}&.topLeft,&.top-start{&:before{right:1px;left:auto;top:auto;margin-top:0;bottom:-5px;margin-right:-6px;transform:rotate(225deg);border-width:5px 10px 5px 0;}&:after{right:1px;left:auto;top:auto;margin-top:0;bottom:-6px;margin-right:-7px;transform:rotate(225deg);border-width:5px 10px 5px 0;}}"], themeGet("fontSizes.0"), themeGet("fontSizes.1"), themeGet("fontWeights.1"), props => props.textAlign ? props.textAlign : "left", themeGet("colors.greyDarkest"), themeGet("space.3"), themeGet("radii.1"), props => props.width ? props.width : "200px", themeGet("colors.white"), themeGet("colors.greyLight"), themeGet("shadows.boxDefault"), props => props.enableSelectAll ? "all" : "auto", themeGet("fontSizes.0"), themeGet("colors.white"), themeGet("colors.greyMid"));
|
|
28
28
|
export default function Popover(_ref) {
|
|
29
|
-
var _children$type;
|
|
29
|
+
var _children$type, _refs$floating;
|
|
30
30
|
let {
|
|
31
31
|
children,
|
|
32
32
|
direction = "right",
|
|
@@ -124,17 +124,19 @@ export default function Popover(_ref) {
|
|
|
124
124
|
ariaLabel: ariaLabel,
|
|
125
125
|
children: text
|
|
126
126
|
});
|
|
127
|
+
const containsLinks = (_refs$floating = refs.floating) === null || _refs$floating === void 0 || (_refs$floating = _refs$floating.current) === null || _refs$floating === void 0 ? void 0 : _refs$floating.querySelectorAll("a").length;
|
|
127
128
|
return /*#__PURE__*/_jsxs(Box, {
|
|
128
129
|
...props,
|
|
129
130
|
"aria-describedby": context.floatingId,
|
|
130
131
|
children: [text && (visible ? /*#__PURE__*/_jsx(FloatingPortal, {
|
|
131
132
|
root: getFloatingUiRootElement(context.refs.reference),
|
|
132
133
|
preserveTabOrder: true,
|
|
133
|
-
children: /*#__PURE__*/_jsx(FloatingFocusManager, {
|
|
134
|
+
children: containsLinks ? /*#__PURE__*/_jsx(FloatingFocusManager, {
|
|
134
135
|
context: context,
|
|
135
136
|
modal: false,
|
|
137
|
+
initialFocus: isRenderedInReactSelectMenu(context.refs.reference) && -1,
|
|
136
138
|
children: Popover
|
|
137
|
-
})
|
|
139
|
+
}) : Popover
|
|
138
140
|
}) : Popover
|
|
139
141
|
/*
|
|
140
142
|
* HACK: Fixing all the broken tests in teamform-app-ui is too time consuming
|
|
@@ -6,6 +6,7 @@ import Flex from "../Flex";
|
|
|
6
6
|
import { get } from "lodash";
|
|
7
7
|
import styled from "styled-components";
|
|
8
8
|
import { PropTypes } from "prop-types";
|
|
9
|
+
import { DEFAULT_COLUMN_SIZE } from "./const";
|
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
const StyledHighlight = styled.span.withConfig({
|
|
11
12
|
displayName: "getExpandColumnConfig__StyledHighlight",
|
|
@@ -101,6 +102,9 @@ export default ((firstCol, tableConfig) => ({
|
|
|
101
102
|
})]
|
|
102
103
|
}),
|
|
103
104
|
enableResizing: true,
|
|
104
|
-
size:
|
|
105
|
+
size: firstCol.size || DEFAULT_COLUMN_SIZE,
|
|
106
|
+
...(firstCol.grow ? {
|
|
107
|
+
grow: firstCol.grow
|
|
108
|
+
} : {})
|
|
105
109
|
}
|
|
106
110
|
}));
|
|
@@ -6,6 +6,11 @@ const getFloatingUiZIndex = triggerRef => {
|
|
|
6
6
|
}
|
|
7
7
|
return 900;
|
|
8
8
|
};
|
|
9
|
+
const REACT_SELECT_MENU = "react-select-menu";
|
|
10
|
+
const isRenderedInReactSelectMenu = triggerRef => {
|
|
11
|
+
var _document$getElementB, _document$getElementB2;
|
|
12
|
+
return (_document$getElementB = document.getElementById(REACT_SELECT_MENU)) === null || _document$getElementB === void 0 || (_document$getElementB2 = _document$getElementB.contains) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.call(_document$getElementB, triggerRef.current);
|
|
13
|
+
};
|
|
9
14
|
const getFloatingUiRootElement = triggerRef => {
|
|
10
15
|
var _activeModalRef$conta2;
|
|
11
16
|
const activeModalRef = document.getElementById("modal-overlay");
|
|
@@ -13,6 +18,9 @@ const getFloatingUiRootElement = triggerRef => {
|
|
|
13
18
|
if (isRenderedInModal) {
|
|
14
19
|
return document.getElementById("modal");
|
|
15
20
|
}
|
|
21
|
+
if (isRenderedInReactSelectMenu(triggerRef)) {
|
|
22
|
+
return document.getElementById(REACT_SELECT_MENU).firstChild;
|
|
23
|
+
}
|
|
16
24
|
return undefined;
|
|
17
25
|
};
|
|
18
|
-
export { getFloatingUiZIndex, getFloatingUiRootElement };
|
|
26
|
+
export { getFloatingUiZIndex, getFloatingUiRootElement, isRenderedInReactSelectMenu };
|