carbon-react 151.2.1 → 151.2.3
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/esm/__internal__/utils/helpers/events/events.d.ts +8 -0
- package/esm/__internal__/utils/helpers/events/events.js +12 -0
- package/esm/components/action-popover/action-popover.component.js +7 -2
- package/esm/components/date/__internal__/date-picker/date-picker.component.js +11 -2
- package/esm/components/date/date.component.d.ts +1 -1
- package/esm/components/flat-table/__internal__/flat-table.context.d.ts +3 -1
- package/esm/components/flat-table/__internal__/flat-table.context.js +2 -1
- package/esm/components/flat-table/flat-table.component.js +10 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +6 -1
- package/esm/components/popover-container/popover-container.component.js +7 -2
- package/esm/components/split-button/split-button.component.js +5 -0
- package/lib/__internal__/utils/helpers/events/events.d.ts +8 -0
- package/lib/__internal__/utils/helpers/events/events.js +12 -0
- package/lib/components/action-popover/action-popover.component.js +6 -1
- package/lib/components/date/__internal__/date-picker/date-picker.component.js +10 -1
- package/lib/components/date/date.component.d.ts +1 -1
- package/lib/components/flat-table/__internal__/flat-table.context.d.ts +3 -1
- package/lib/components/flat-table/__internal__/flat-table.context.js +2 -1
- package/lib/components/flat-table/flat-table.component.js +10 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +5 -0
- package/lib/components/popover-container/popover-container.component.js +6 -1
- package/lib/components/split-button/split-button.component.js +5 -0
- package/package.json +1 -1
|
@@ -71,6 +71,14 @@ declare const Events: {
|
|
|
71
71
|
* Determines if the key pressed is the end key
|
|
72
72
|
* */
|
|
73
73
|
isEndKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Determines if the key pressed is the page up key
|
|
76
|
+
* */
|
|
77
|
+
isPageUpKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Determines if the key pressed is the page down key
|
|
80
|
+
* */
|
|
81
|
+
isPageDownKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
74
82
|
/**
|
|
75
83
|
* Gets the event's path which is an array of the objects on which listeners will be invoked.
|
|
76
84
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
|
|
@@ -103,6 +103,18 @@ const Events = {
|
|
|
103
103
|
isEndKey: ev => {
|
|
104
104
|
return ev.key === "End";
|
|
105
105
|
},
|
|
106
|
+
/**
|
|
107
|
+
* Determines if the key pressed is the page up key
|
|
108
|
+
* */
|
|
109
|
+
isPageUpKey: ev => {
|
|
110
|
+
return ev.key === "PageUp";
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* Determines if the key pressed is the page down key
|
|
114
|
+
* */
|
|
115
|
+
isPageDownKey: ev => {
|
|
116
|
+
return ev.key === "PageDown";
|
|
117
|
+
},
|
|
106
118
|
/**
|
|
107
119
|
* Gets the event's path which is an array of the objects on which listeners will be invoked.
|
|
108
120
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useState, useCallback, useMemo, useEffect, useRef, useImperativeHandle, forwardRef } from "react";
|
|
2
|
+
import React, { useState, useCallback, useMemo, useEffect, useRef, useImperativeHandle, forwardRef, useContext } from "react";
|
|
3
3
|
import invariant from "invariant";
|
|
4
4
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
5
5
|
import { MenuButton, ButtonIcon, StyledButtonIcon } from "./action-popover.style";
|
|
@@ -13,6 +13,7 @@ import ActionPopoverDivider from "./action-popover-divider/action-popover-divide
|
|
|
13
13
|
import ActionPopoverContext from "./__internal__/action-popover.context";
|
|
14
14
|
import useModalManager from "../../hooks/__internal__/useModalManager";
|
|
15
15
|
import { findFirstFocusableItem, findLastFocusableItem, getItems, checkChildrenForString } from "./__internal__/action-popover-utils";
|
|
16
|
+
import FlatTableContext from "../flat-table/__internal__/flat-table.context";
|
|
16
17
|
const onOpenDefault = () => {};
|
|
17
18
|
const onCloseDefault = () => {};
|
|
18
19
|
export const ActionPopover = /*#__PURE__*/forwardRef(({
|
|
@@ -36,6 +37,9 @@ export const ActionPopover = /*#__PURE__*/forwardRef(({
|
|
|
36
37
|
const [guid] = useState(createGuid());
|
|
37
38
|
const buttonRef = useRef(null);
|
|
38
39
|
const menu = useRef(null);
|
|
40
|
+
const {
|
|
41
|
+
isInFlatTable
|
|
42
|
+
} = useContext(FlatTableContext);
|
|
39
43
|
const hasProperChildren = useMemo(() => {
|
|
40
44
|
const incorrectChild = React.Children.toArray(children).find(child => {
|
|
41
45
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
@@ -213,7 +217,8 @@ export const ActionPopover = /*#__PURE__*/forwardRef(({
|
|
|
213
217
|
}
|
|
214
218
|
}, isOpen && /*#__PURE__*/React.createElement(Popover, {
|
|
215
219
|
placement: mappedPlacement,
|
|
216
|
-
reference: buttonRef
|
|
220
|
+
reference: buttonRef,
|
|
221
|
+
disableBackgroundUI: isInFlatTable
|
|
217
222
|
}, /*#__PURE__*/React.createElement(ActionPopoverMenu, _extends({
|
|
218
223
|
"data-component": "action-popover",
|
|
219
224
|
ref: menu
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import { flip, offset } from "@floating-ui/dom";
|
|
3
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, useContext } from "react";
|
|
4
4
|
import { DayPicker, defaultLocale } from "react-day-picker";
|
|
5
5
|
import useLocale from "../../../../hooks/__internal__/useLocale";
|
|
6
6
|
import Popover from "../../../../__internal__/popover";
|
|
@@ -9,6 +9,7 @@ import Weekday from "../weekday";
|
|
|
9
9
|
import { getDisabledDays } from "../utils";
|
|
10
10
|
import { defaultFocusableSelectors } from "../../../../__internal__/focus-trap/focus-trap-utils";
|
|
11
11
|
import Events from "../../../../__internal__/utils/helpers/events";
|
|
12
|
+
import FlatTableContext from "../../../flat-table/__internal__/flat-table.context";
|
|
12
13
|
import StyledDayPicker from "./day-picker.style";
|
|
13
14
|
const popoverMiddleware = [offset(3), flip({
|
|
14
15
|
fallbackStrategy: "initialPlacement"
|
|
@@ -100,6 +101,13 @@ export const DatePicker = ({
|
|
|
100
101
|
}
|
|
101
102
|
}, 0);
|
|
102
103
|
};
|
|
104
|
+
const {
|
|
105
|
+
isInFlatTable,
|
|
106
|
+
setHasOpenDatePicker
|
|
107
|
+
} = useContext(FlatTableContext);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
setHasOpenDatePicker?.(!!open);
|
|
110
|
+
}, [open, setHasOpenDatePicker]);
|
|
103
111
|
useEffect(() => {
|
|
104
112
|
if (selectedDays) {
|
|
105
113
|
setFocusedMonth(selectedDays);
|
|
@@ -122,7 +130,8 @@ export const DatePicker = ({
|
|
|
122
130
|
placement: "bottom-start",
|
|
123
131
|
reference: inputElement,
|
|
124
132
|
middleware: popoverMiddleware,
|
|
125
|
-
disablePortal: disablePortal
|
|
133
|
+
disablePortal: disablePortal,
|
|
134
|
+
disableBackgroundUI: isInFlatTable
|
|
126
135
|
}, /*#__PURE__*/React.createElement(StyledDayPicker, {
|
|
127
136
|
id: "styled-day-picker",
|
|
128
137
|
"data-role": "date-picker",
|
|
@@ -29,7 +29,7 @@ export interface DateInputProps extends Omit<TextboxProps, "value" | "formattedV
|
|
|
29
29
|
value: string;
|
|
30
30
|
/**
|
|
31
31
|
* Pass any props that match the DayPickerProps interface to override default behaviors
|
|
32
|
-
* See [DayPickerProps](https://
|
|
32
|
+
* See [DayPickerProps](https://daypicker.dev/start) for a full list of available props
|
|
33
33
|
* */
|
|
34
34
|
pickerProps?: PickerProps;
|
|
35
35
|
/**
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import { FlatTableProps } from "../flat-table.component";
|
|
3
3
|
export interface FlatTableContextProps extends Pick<FlatTableProps, "colorTheme" | "size"> {
|
|
4
4
|
getTabStopElementId: () => string;
|
|
5
|
+
isInFlatTable?: boolean;
|
|
6
|
+
setHasOpenDatePicker?: Dispatch<SetStateAction<boolean>>;
|
|
5
7
|
}
|
|
6
8
|
declare const _default: React.Context<FlatTableContextProps>;
|
|
7
9
|
export default _default;
|
|
@@ -43,6 +43,7 @@ export const FlatTable = ({
|
|
|
43
43
|
const {
|
|
44
44
|
isInSidebar
|
|
45
45
|
} = useContext(DrawerSidebarContext);
|
|
46
|
+
const [hasOpenDatePicker, setHasOpenDatePicker] = useState(false);
|
|
46
47
|
useLayoutEffect(() => {
|
|
47
48
|
const findRow = (rows, isFirstCol) => rows.find((row, index) => {
|
|
48
49
|
const cells = Array.from(row.querySelectorAll("td, th"));
|
|
@@ -101,6 +102,12 @@ export const FlatTable = ({
|
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
104
|
const currentFocusIndex = focusableElementsArray.findIndex(el => el === document.activeElement);
|
|
105
|
+
if (hasOpenDatePicker && (hasStickyHead || hasStickyFooter)) {
|
|
106
|
+
if (Events.isPageUpKey(ev) || Events.isPageDownKey(ev) || Events.isHomeKey(ev) || Events.isEndKey(ev)) {
|
|
107
|
+
ev.preventDefault();
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
104
111
|
if (Events.isDownKey(ev)) {
|
|
105
112
|
ev.preventDefault();
|
|
106
113
|
if (currentFocusIndex !== -1 && currentFocusIndex < focusableElementsArray.length) {
|
|
@@ -183,7 +190,9 @@ export const FlatTable = ({
|
|
|
183
190
|
value: {
|
|
184
191
|
colorTheme,
|
|
185
192
|
size,
|
|
186
|
-
getTabStopElementId
|
|
193
|
+
getTabStopElementId,
|
|
194
|
+
isInFlatTable: true,
|
|
195
|
+
setHasOpenDatePicker
|
|
187
196
|
}
|
|
188
197
|
}, children))), footer && /*#__PURE__*/React.createElement(StyledFlatTableFooter, {
|
|
189
198
|
hasStickyFooter: hasStickyFooter,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useRef, forwardRef, useImperativeHandle } from "react";
|
|
2
|
+
import React, { useRef, forwardRef, useImperativeHandle, useContext } from "react";
|
|
3
3
|
import { flip, offset } from "@floating-ui/dom";
|
|
4
4
|
import useClickAwayListener from "../../hooks/__internal__/useClickAwayListener";
|
|
5
5
|
import SplitButtonContext from "../split-button/__internal__/split-button.context";
|
|
@@ -8,6 +8,7 @@ import Button from "../button";
|
|
|
8
8
|
import Popover from "../../__internal__/popover";
|
|
9
9
|
import { filterStyledSystemMarginProps, filterOutStyledSystemSpacingProps } from "../../style/utils";
|
|
10
10
|
import useChildButtons from "../../hooks/__internal__/useChildButtons";
|
|
11
|
+
import FlatTableContext from "../flat-table/__internal__/flat-table.context";
|
|
11
12
|
export const MultiActionButton = /*#__PURE__*/forwardRef(({
|
|
12
13
|
align = "left",
|
|
13
14
|
position = "left",
|
|
@@ -24,6 +25,9 @@ export const MultiActionButton = /*#__PURE__*/forwardRef(({
|
|
|
24
25
|
...rest
|
|
25
26
|
}, ref) => {
|
|
26
27
|
const buttonRef = useRef(null);
|
|
28
|
+
const {
|
|
29
|
+
isInFlatTable
|
|
30
|
+
} = useContext(FlatTableContext);
|
|
27
31
|
useImperativeHandle(ref, () => ({
|
|
28
32
|
focusMainButton() {
|
|
29
33
|
buttonRef.current?.focus();
|
|
@@ -58,6 +62,7 @@ export const MultiActionButton = /*#__PURE__*/forwardRef(({
|
|
|
58
62
|
...filterOutStyledSystemSpacingProps(rest)
|
|
59
63
|
};
|
|
60
64
|
const renderAdditionalButtons = () => /*#__PURE__*/React.createElement(Popover, {
|
|
65
|
+
disableBackgroundUI: isInFlatTable,
|
|
61
66
|
disablePortal: true,
|
|
62
67
|
placement: position === "left" ? "bottom-start" : /* istanbul ignore next */"bottom-end",
|
|
63
68
|
reference: buttonNode,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useCallback, useEffect, useRef, useState, useMemo, useImperativeHandle, forwardRef } from "react";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState, useMemo, useImperativeHandle, forwardRef, useContext } from "react";
|
|
3
3
|
import { CSSTransition } from "react-transition-group";
|
|
4
4
|
import { flip, offset } from "@floating-ui/dom";
|
|
5
5
|
import useMediaQuery from "../../hooks/useMediaQuery";
|
|
@@ -15,6 +15,7 @@ import ModalContext from "../modal/__internal__/modal.context";
|
|
|
15
15
|
import useFocusPortalContent from "../../hooks/__internal__/useFocusPortalContent";
|
|
16
16
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
17
17
|
import { defaultFocusableSelectors } from "../../__internal__/focus-trap/focus-trap-utils";
|
|
18
|
+
import FlatTableContext from "../flat-table/__internal__/flat-table.context";
|
|
18
19
|
export const renderOpen = ({
|
|
19
20
|
tabIndex,
|
|
20
21
|
onClick,
|
|
@@ -95,6 +96,9 @@ export const PopoverContainer = /*#__PURE__*/forwardRef(({
|
|
|
95
96
|
const isOpen = isControlled ? open : isOpenInternal;
|
|
96
97
|
const reduceMotion = !useMediaQuery("screen and (prefers-reduced-motion: no-preference)");
|
|
97
98
|
const popoverMiddleware = usePopoverMiddleware(shouldCoverButton);
|
|
99
|
+
const {
|
|
100
|
+
isInFlatTable
|
|
101
|
+
} = useContext(FlatTableContext);
|
|
98
102
|
const closePopover = useCallback(ev => {
|
|
99
103
|
/* istanbul ignore else */
|
|
100
104
|
if (!isControlled) setIsOpenInternal(false);
|
|
@@ -238,7 +242,8 @@ export const PopoverContainer = /*#__PURE__*/forwardRef(({
|
|
|
238
242
|
placement: position === "right" ? "bottom-start" : "bottom-end",
|
|
239
243
|
popoverStrategy: disableAnimation || reduceMotion ? "fixed" : "absolute",
|
|
240
244
|
middleware: popoverMiddleware,
|
|
241
|
-
childRefOverride: popoverContentNodeRef
|
|
245
|
+
childRefOverride: popoverContentNodeRef,
|
|
246
|
+
disableBackgroundUI: isInFlatTable
|
|
242
247
|
}, childrenToRender())));
|
|
243
248
|
});
|
|
244
249
|
export default PopoverContainer;
|
|
@@ -15,6 +15,7 @@ import { baseTheme } from "../../style/themes";
|
|
|
15
15
|
import useChildButtons from "../../hooks/__internal__/useChildButtons";
|
|
16
16
|
import SplitButtonContext from "./__internal__/split-button.context";
|
|
17
17
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
18
|
+
import FlatTableContext from "../flat-table/__internal__/flat-table.context";
|
|
18
19
|
const CONTENT_WIDTH_RATIO = 0.75;
|
|
19
20
|
export const SplitButton = /*#__PURE__*/forwardRef(({
|
|
20
21
|
align = "left",
|
|
@@ -38,6 +39,9 @@ export const SplitButton = /*#__PURE__*/forwardRef(({
|
|
|
38
39
|
const buttonLabelId = useRef(guid());
|
|
39
40
|
const mainButtonRef = useRef(null);
|
|
40
41
|
const toggleButtonRef = useRef(null);
|
|
42
|
+
const {
|
|
43
|
+
isInFlatTable
|
|
44
|
+
} = useContext(FlatTableContext);
|
|
41
45
|
useImperativeHandle(ref, () => ({
|
|
42
46
|
focusMainButton() {
|
|
43
47
|
mainButtonRef.current?.focus();
|
|
@@ -124,6 +128,7 @@ export const SplitButton = /*#__PURE__*/forwardRef(({
|
|
|
124
128
|
function renderAdditionalButtons() {
|
|
125
129
|
if (!showAdditionalButtons) return null;
|
|
126
130
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
131
|
+
disableBackgroundUI: isInFlatTable,
|
|
127
132
|
disablePortal: true,
|
|
128
133
|
placement: position === "left" ? /* istanbul ignore next */"bottom-start" : "bottom-end",
|
|
129
134
|
popoverStrategy: "fixed",
|
|
@@ -71,6 +71,14 @@ declare const Events: {
|
|
|
71
71
|
* Determines if the key pressed is the end key
|
|
72
72
|
* */
|
|
73
73
|
isEndKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Determines if the key pressed is the page up key
|
|
76
|
+
* */
|
|
77
|
+
isPageUpKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Determines if the key pressed is the page down key
|
|
80
|
+
* */
|
|
81
|
+
isPageDownKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
74
82
|
/**
|
|
75
83
|
* Gets the event's path which is an array of the objects on which listeners will be invoked.
|
|
76
84
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
|
|
@@ -109,6 +109,18 @@ const Events = {
|
|
|
109
109
|
isEndKey: ev => {
|
|
110
110
|
return ev.key === "End";
|
|
111
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* Determines if the key pressed is the page up key
|
|
114
|
+
* */
|
|
115
|
+
isPageUpKey: ev => {
|
|
116
|
+
return ev.key === "PageUp";
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Determines if the key pressed is the page down key
|
|
120
|
+
* */
|
|
121
|
+
isPageDownKey: ev => {
|
|
122
|
+
return ev.key === "PageDown";
|
|
123
|
+
},
|
|
112
124
|
/**
|
|
113
125
|
* Gets the event's path which is an array of the objects on which listeners will be invoked.
|
|
114
126
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
|
|
@@ -18,6 +18,7 @@ var _actionPopoverDivider = _interopRequireDefault(require("./action-popover-div
|
|
|
18
18
|
var _actionPopover2 = _interopRequireDefault(require("./__internal__/action-popover.context"));
|
|
19
19
|
var _useModalManager = _interopRequireDefault(require("../../hooks/__internal__/useModalManager"));
|
|
20
20
|
var _actionPopoverUtils = require("./__internal__/action-popover-utils");
|
|
21
|
+
var _flatTable = _interopRequireDefault(require("../flat-table/__internal__/flat-table.context"));
|
|
21
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -45,6 +46,9 @@ const ActionPopover = exports.ActionPopover = /*#__PURE__*/(0, _react.forwardRef
|
|
|
45
46
|
const [guid] = (0, _react.useState)((0, _guid.default)());
|
|
46
47
|
const buttonRef = (0, _react.useRef)(null);
|
|
47
48
|
const menu = (0, _react.useRef)(null);
|
|
49
|
+
const {
|
|
50
|
+
isInFlatTable
|
|
51
|
+
} = (0, _react.useContext)(_flatTable.default);
|
|
48
52
|
const hasProperChildren = (0, _react.useMemo)(() => {
|
|
49
53
|
const incorrectChild = _react.default.Children.toArray(children).find(child => {
|
|
50
54
|
if (! /*#__PURE__*/_react.default.isValidElement(child)) {
|
|
@@ -222,7 +226,8 @@ const ActionPopover = exports.ActionPopover = /*#__PURE__*/(0, _react.forwardRef
|
|
|
222
226
|
}
|
|
223
227
|
}, isOpen && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
224
228
|
placement: mappedPlacement,
|
|
225
|
-
reference: buttonRef
|
|
229
|
+
reference: buttonRef,
|
|
230
|
+
disableBackgroundUI: isInFlatTable
|
|
226
231
|
}, /*#__PURE__*/_react.default.createElement(_actionPopoverMenu.default, _extends({
|
|
227
232
|
"data-component": "action-popover",
|
|
228
233
|
ref: menu
|
|
@@ -14,6 +14,7 @@ var _weekday = _interopRequireDefault(require("../weekday"));
|
|
|
14
14
|
var _utils = require("../utils");
|
|
15
15
|
var _focusTrapUtils = require("../../../../__internal__/focus-trap/focus-trap-utils");
|
|
16
16
|
var _events = _interopRequireDefault(require("../../../../__internal__/utils/helpers/events"));
|
|
17
|
+
var _flatTable = _interopRequireDefault(require("../../../flat-table/__internal__/flat-table.context"));
|
|
17
18
|
var _dayPicker = _interopRequireDefault(require("./day-picker.style"));
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -109,6 +110,13 @@ const DatePicker = ({
|
|
|
109
110
|
}
|
|
110
111
|
}, 0);
|
|
111
112
|
};
|
|
113
|
+
const {
|
|
114
|
+
isInFlatTable,
|
|
115
|
+
setHasOpenDatePicker
|
|
116
|
+
} = (0, _react.useContext)(_flatTable.default);
|
|
117
|
+
(0, _react.useEffect)(() => {
|
|
118
|
+
setHasOpenDatePicker?.(!!open);
|
|
119
|
+
}, [open, setHasOpenDatePicker]);
|
|
112
120
|
(0, _react.useEffect)(() => {
|
|
113
121
|
if (selectedDays) {
|
|
114
122
|
setFocusedMonth(selectedDays);
|
|
@@ -131,7 +139,8 @@ const DatePicker = ({
|
|
|
131
139
|
placement: "bottom-start",
|
|
132
140
|
reference: inputElement,
|
|
133
141
|
middleware: popoverMiddleware,
|
|
134
|
-
disablePortal: disablePortal
|
|
142
|
+
disablePortal: disablePortal,
|
|
143
|
+
disableBackgroundUI: isInFlatTable
|
|
135
144
|
}, /*#__PURE__*/_react.default.createElement(_dayPicker.default, {
|
|
136
145
|
id: "styled-day-picker",
|
|
137
146
|
"data-role": "date-picker",
|
|
@@ -29,7 +29,7 @@ export interface DateInputProps extends Omit<TextboxProps, "value" | "formattedV
|
|
|
29
29
|
value: string;
|
|
30
30
|
/**
|
|
31
31
|
* Pass any props that match the DayPickerProps interface to override default behaviors
|
|
32
|
-
* See [DayPickerProps](https://
|
|
32
|
+
* See [DayPickerProps](https://daypicker.dev/start) for a full list of available props
|
|
33
33
|
* */
|
|
34
34
|
pickerProps?: PickerProps;
|
|
35
35
|
/**
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import { FlatTableProps } from "../flat-table.component";
|
|
3
3
|
export interface FlatTableContextProps extends Pick<FlatTableProps, "colorTheme" | "size"> {
|
|
4
4
|
getTabStopElementId: () => string;
|
|
5
|
+
isInFlatTable?: boolean;
|
|
6
|
+
setHasOpenDatePicker?: Dispatch<SetStateAction<boolean>>;
|
|
5
7
|
}
|
|
6
8
|
declare const _default: React.Context<FlatTableContextProps>;
|
|
7
9
|
export default _default;
|
|
@@ -7,5 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
var _default = exports.default = /*#__PURE__*/_react.default.createContext({
|
|
10
|
-
getTabStopElementId: () => ""
|
|
10
|
+
getTabStopElementId: () => "",
|
|
11
|
+
isInFlatTable: false
|
|
11
12
|
});
|
|
@@ -52,6 +52,7 @@ const FlatTable = ({
|
|
|
52
52
|
const {
|
|
53
53
|
isInSidebar
|
|
54
54
|
} = (0, _react.useContext)(_drawerSidebar.default);
|
|
55
|
+
const [hasOpenDatePicker, setHasOpenDatePicker] = (0, _react.useState)(false);
|
|
55
56
|
(0, _react.useLayoutEffect)(() => {
|
|
56
57
|
const findRow = (rows, isFirstCol) => rows.find((row, index) => {
|
|
57
58
|
const cells = Array.from(row.querySelectorAll("td, th"));
|
|
@@ -110,6 +111,12 @@ const FlatTable = ({
|
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
113
|
const currentFocusIndex = focusableElementsArray.findIndex(el => el === document.activeElement);
|
|
114
|
+
if (hasOpenDatePicker && (hasStickyHead || hasStickyFooter)) {
|
|
115
|
+
if (_events.default.isPageUpKey(ev) || _events.default.isPageDownKey(ev) || _events.default.isHomeKey(ev) || _events.default.isEndKey(ev)) {
|
|
116
|
+
ev.preventDefault();
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
113
120
|
if (_events.default.isDownKey(ev)) {
|
|
114
121
|
ev.preventDefault();
|
|
115
122
|
if (currentFocusIndex !== -1 && currentFocusIndex < focusableElementsArray.length) {
|
|
@@ -192,7 +199,9 @@ const FlatTable = ({
|
|
|
192
199
|
value: {
|
|
193
200
|
colorTheme,
|
|
194
201
|
size,
|
|
195
|
-
getTabStopElementId
|
|
202
|
+
getTabStopElementId,
|
|
203
|
+
isInFlatTable: true,
|
|
204
|
+
setHasOpenDatePicker
|
|
196
205
|
}
|
|
197
206
|
}, children))), footer && /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTableFooter, {
|
|
198
207
|
hasStickyFooter: hasStickyFooter,
|
|
@@ -13,6 +13,7 @@ var _button = _interopRequireDefault(require("../button"));
|
|
|
13
13
|
var _popover = _interopRequireDefault(require("../../__internal__/popover"));
|
|
14
14
|
var _utils = require("../../style/utils");
|
|
15
15
|
var _useChildButtons = _interopRequireDefault(require("../../hooks/__internal__/useChildButtons"));
|
|
16
|
+
var _flatTable = _interopRequireDefault(require("../flat-table/__internal__/flat-table.context"));
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -33,6 +34,9 @@ const MultiActionButton = exports.MultiActionButton = /*#__PURE__*/(0, _react.fo
|
|
|
33
34
|
...rest
|
|
34
35
|
}, ref) => {
|
|
35
36
|
const buttonRef = (0, _react.useRef)(null);
|
|
37
|
+
const {
|
|
38
|
+
isInFlatTable
|
|
39
|
+
} = (0, _react.useContext)(_flatTable.default);
|
|
36
40
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
37
41
|
focusMainButton() {
|
|
38
42
|
buttonRef.current?.focus();
|
|
@@ -67,6 +71,7 @@ const MultiActionButton = exports.MultiActionButton = /*#__PURE__*/(0, _react.fo
|
|
|
67
71
|
...(0, _utils.filterOutStyledSystemSpacingProps)(rest)
|
|
68
72
|
};
|
|
69
73
|
const renderAdditionalButtons = () => /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
74
|
+
disableBackgroundUI: isInFlatTable,
|
|
70
75
|
disablePortal: true,
|
|
71
76
|
placement: position === "left" ? "bottom-start" : /* istanbul ignore next */"bottom-end",
|
|
72
77
|
reference: buttonNode,
|
|
@@ -20,6 +20,7 @@ var _modal = _interopRequireDefault(require("../modal/__internal__/modal.context
|
|
|
20
20
|
var _useFocusPortalContent = _interopRequireDefault(require("../../hooks/__internal__/useFocusPortalContent"));
|
|
21
21
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
22
22
|
var _focusTrapUtils = require("../../__internal__/focus-trap/focus-trap-utils");
|
|
23
|
+
var _flatTable = _interopRequireDefault(require("../flat-table/__internal__/flat-table.context"));
|
|
23
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -106,6 +107,9 @@ const PopoverContainer = exports.PopoverContainer = /*#__PURE__*/(0, _react.forw
|
|
|
106
107
|
const isOpen = isControlled ? open : isOpenInternal;
|
|
107
108
|
const reduceMotion = !(0, _useMediaQuery.default)("screen and (prefers-reduced-motion: no-preference)");
|
|
108
109
|
const popoverMiddleware = usePopoverMiddleware(shouldCoverButton);
|
|
110
|
+
const {
|
|
111
|
+
isInFlatTable
|
|
112
|
+
} = (0, _react.useContext)(_flatTable.default);
|
|
109
113
|
const closePopover = (0, _react.useCallback)(ev => {
|
|
110
114
|
/* istanbul ignore else */
|
|
111
115
|
if (!isControlled) setIsOpenInternal(false);
|
|
@@ -249,7 +253,8 @@ const PopoverContainer = exports.PopoverContainer = /*#__PURE__*/(0, _react.forw
|
|
|
249
253
|
placement: position === "right" ? "bottom-start" : "bottom-end",
|
|
250
254
|
popoverStrategy: disableAnimation || reduceMotion ? "fixed" : "absolute",
|
|
251
255
|
middleware: popoverMiddleware,
|
|
252
|
-
childRefOverride: popoverContentNodeRef
|
|
256
|
+
childRefOverride: popoverContentNodeRef,
|
|
257
|
+
disableBackgroundUI: isInFlatTable
|
|
253
258
|
}, childrenToRender())));
|
|
254
259
|
});
|
|
255
260
|
var _default = exports.default = PopoverContainer;
|
|
@@ -20,6 +20,7 @@ var _themes = require("../../style/themes");
|
|
|
20
20
|
var _useChildButtons = _interopRequireDefault(require("../../hooks/__internal__/useChildButtons"));
|
|
21
21
|
var _splitButton2 = _interopRequireDefault(require("./__internal__/split-button.context"));
|
|
22
22
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
23
|
+
var _flatTable = _interopRequireDefault(require("../flat-table/__internal__/flat-table.context"));
|
|
23
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -47,6 +48,9 @@ const SplitButton = exports.SplitButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
47
48
|
const buttonLabelId = (0, _react.useRef)((0, _guid.default)());
|
|
48
49
|
const mainButtonRef = (0, _react.useRef)(null);
|
|
49
50
|
const toggleButtonRef = (0, _react.useRef)(null);
|
|
51
|
+
const {
|
|
52
|
+
isInFlatTable
|
|
53
|
+
} = (0, _react.useContext)(_flatTable.default);
|
|
50
54
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
51
55
|
focusMainButton() {
|
|
52
56
|
mainButtonRef.current?.focus();
|
|
@@ -133,6 +137,7 @@ const SplitButton = exports.SplitButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
133
137
|
function renderAdditionalButtons() {
|
|
134
138
|
if (!showAdditionalButtons) return null;
|
|
135
139
|
return /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
140
|
+
disableBackgroundUI: isInFlatTable,
|
|
136
141
|
disablePortal: true,
|
|
137
142
|
placement: position === "left" ? /* istanbul ignore next */"bottom-start" : "bottom-end",
|
|
138
143
|
popoverStrategy: "fixed",
|