@cloudscape-design/board-components 3.0.25 → 3.0.27
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/board/internal.js +2 -3
- package/board/styles.css.js +5 -7
- package/board/styles.scoped.css +5 -13
- package/board/styles.selectors.js +5 -7
- package/board-item/header.js +3 -1
- package/board-item/styles.css.js +11 -10
- package/board-item/styles.scoped.css +18 -12
- package/board-item/styles.selectors.js +11 -10
- package/internal/environment.js +1 -1
- package/internal/global-drag-state-styles/index.d.ts +1 -0
- package/internal/global-drag-state-styles/index.js +32 -0
- package/internal/global-drag-state-styles/styles.css.js +8 -0
- package/internal/global-drag-state-styles/styles.scoped.css +12 -0
- package/internal/global-drag-state-styles/styles.selectors.js +9 -0
- package/internal/item-container/index.js +18 -3
- package/internal/item-container/styles.css.js +7 -7
- package/internal/item-container/styles.scoped.css +10 -10
- package/internal/item-container/styles.selectors.js +7 -7
- package/internal/manifest.json +1 -1
- package/internal/utils/use-auto-scroll.js +2 -1
- package/package.json +1 -1
- package/test-utils/dom/board/index.js +1 -1
- package/test-utils/dom/board/index.js.map +1 -1
- package/test-utils/selectors/board/index.js +1 -1
- package/test-utils/selectors/board/index.js.map +1 -1
package/board/internal.js
CHANGED
|
@@ -7,6 +7,7 @@ import { getDataAttributes } from "../internal/base-component/get-data-attribute
|
|
|
7
7
|
import { useContainerColumns } from "../internal/breakpoints";
|
|
8
8
|
import { TRANSITION_DURATION_MS } from "../internal/constants";
|
|
9
9
|
import { useDragSubscription } from "../internal/dnd-controller/controller";
|
|
10
|
+
import { useGlobalDragStateStyles } from "../internal/global-drag-state-styles";
|
|
10
11
|
import Grid from "../internal/grid";
|
|
11
12
|
import { ItemContainer } from "../internal/item-container";
|
|
12
13
|
import { LayoutEngine } from "../internal/layout-engine/engine";
|
|
@@ -28,6 +29,7 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
|
|
|
28
29
|
const [currentColumns, containerQueryRef] = useContainerColumns();
|
|
29
30
|
const containerRef = useMergeRefs(containerAccessRef, containerQueryRef);
|
|
30
31
|
const itemContainerRef = useRef({});
|
|
32
|
+
useGlobalDragStateStyles();
|
|
31
33
|
const autoScrollHandlers = useAutoScroll();
|
|
32
34
|
const [transitionState, dispatch] = useTransition();
|
|
33
35
|
const transition = transitionState.transition;
|
|
@@ -97,7 +99,6 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
|
|
|
97
99
|
collisionIds: interactionType === "pointer" && isElementOverBoard(collisionRect) ? collisionIds : [],
|
|
98
100
|
});
|
|
99
101
|
autoScrollHandlers.addPointerEventHandlers();
|
|
100
|
-
document.body.classList.add(styles[`current-operation-${operation}`]);
|
|
101
102
|
});
|
|
102
103
|
useDragSubscription("update", ({ interactionType, collisionIds, positionOffset, collisionRect }) => {
|
|
103
104
|
dispatch({
|
|
@@ -110,7 +111,6 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
|
|
|
110
111
|
useDragSubscription("submit", () => {
|
|
111
112
|
dispatch({ type: "submit" });
|
|
112
113
|
autoScrollHandlers.removePointerEventHandlers();
|
|
113
|
-
document.body.classList.remove(styles["current-operation-reorder"], styles["current-operation-resize"]);
|
|
114
114
|
if (!transition) {
|
|
115
115
|
throw new Error("Invariant violation: no transition.");
|
|
116
116
|
}
|
|
@@ -130,7 +130,6 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
|
|
|
130
130
|
});
|
|
131
131
|
useDragSubscription("discard", () => {
|
|
132
132
|
dispatch({ type: "discard" });
|
|
133
|
-
document.body.classList.remove(styles["current-operation-reorder"], styles["current-operation-resize"]);
|
|
134
133
|
autoScrollHandlers.removePointerEventHandlers();
|
|
135
134
|
});
|
|
136
135
|
useDragSubscription("acquire", ({ droppableId, draggableItem, acquiredItemElement }) => {
|
package/board/styles.css.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"placeholder": "
|
|
5
|
-
"placeholder--active": "awsui_placeholder--
|
|
6
|
-
"placeholder--hover": "awsui_placeholder--
|
|
7
|
-
"root": "
|
|
8
|
-
"empty": "
|
|
9
|
-
"current-operation-reorder": "awsui_current-operation-reorder_1h7dk_1vsa2_25",
|
|
10
|
-
"current-operation-resize": "awsui_current-operation-resize_1h7dk_1vsa2_29"
|
|
4
|
+
"placeholder": "awsui_placeholder_1h7dk_1yaxu_1",
|
|
5
|
+
"placeholder--active": "awsui_placeholder--active_1h7dk_1yaxu_5",
|
|
6
|
+
"placeholder--hover": "awsui_placeholder--hover_1h7dk_1yaxu_8",
|
|
7
|
+
"root": "awsui_root_1h7dk_1yaxu_12",
|
|
8
|
+
"empty": "awsui_empty_1h7dk_1yaxu_16"
|
|
11
9
|
};
|
|
12
10
|
|
package/board/styles.scoped.css
CHANGED
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
.
|
|
1
|
+
.awsui_placeholder_1h7dk_1yaxu_1:not(#\9) {
|
|
2
2
|
border-radius: var(--border-radius-container-pmtq2d, 16px);
|
|
3
3
|
height: 100%;
|
|
4
4
|
}
|
|
5
|
-
.awsui_placeholder--
|
|
5
|
+
.awsui_placeholder--active_1h7dk_1yaxu_5:not(#\9) {
|
|
6
6
|
background-color: var(--color-board-placeholder-active-kxfgmn, #e9ebed);
|
|
7
7
|
}
|
|
8
|
-
.awsui_placeholder--
|
|
8
|
+
.awsui_placeholder--hover_1h7dk_1yaxu_8:not(#\9) {
|
|
9
9
|
background-color: var(--color-board-placeholder-hover-8tcom5, #d3e7f9);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.
|
|
12
|
+
.awsui_root_1h7dk_1yaxu_12:not(#\9) {
|
|
13
13
|
/* used in test-utils */
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.
|
|
16
|
+
.awsui_empty_1h7dk_1yaxu_16:not(#\9) {
|
|
17
17
|
box-sizing: border-box;
|
|
18
18
|
width: 100%;
|
|
19
19
|
padding: var(--space-scaled-m-gxhdpl, 16px) var(--space-scaled-l-2rs0gk, 20px) var(--space-scaled-l-2rs0gk, 20px);
|
|
20
20
|
color: var(--color-text-empty-v5xueo, #5f6b7a);
|
|
21
21
|
display: flex;
|
|
22
22
|
justify-content: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.awsui_current-operation-reorder_1h7dk_1vsa2_25:not(#\9) {
|
|
26
|
-
cursor: grabbing;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.awsui_current-operation-resize_1h7dk_1vsa2_29:not(#\9) {
|
|
30
|
-
cursor: nwse-resize;
|
|
31
23
|
}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"placeholder": "
|
|
6
|
-
"placeholder--active": "awsui_placeholder--
|
|
7
|
-
"placeholder--hover": "awsui_placeholder--
|
|
8
|
-
"root": "
|
|
9
|
-
"empty": "
|
|
10
|
-
"current-operation-reorder": "awsui_current-operation-reorder_1h7dk_1vsa2_25",
|
|
11
|
-
"current-operation-resize": "awsui_current-operation-resize_1h7dk_1vsa2_29"
|
|
5
|
+
"placeholder": "awsui_placeholder_1h7dk_1yaxu_1",
|
|
6
|
+
"placeholder--active": "awsui_placeholder--active_1h7dk_1yaxu_5",
|
|
7
|
+
"placeholder--hover": "awsui_placeholder--hover_1h7dk_1yaxu_8",
|
|
8
|
+
"root": "awsui_root_1h7dk_1yaxu_12",
|
|
9
|
+
"empty": "awsui_empty_1h7dk_1yaxu_16"
|
|
12
10
|
};
|
|
13
11
|
|
package/board-item/header.js
CHANGED
|
@@ -2,7 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
+
import { useVisualRefresh } from "../internal/base-component/use-visual-refresh.js";
|
|
5
6
|
import styles from "./styles.css.js";
|
|
6
7
|
export default function WidgetContainerHeader({ handle, children, settings }) {
|
|
7
|
-
|
|
8
|
+
const isVisualRefresh = useVisualRefresh();
|
|
9
|
+
return (_jsxs("div", { className: clsx(styles.header, isVisualRefresh && styles.refresh), children: [_jsx("div", { className: clsx(styles.fixed, styles.handle), children: handle }), _jsx("div", { className: clsx(styles.flexible, styles["header-content"]), children: children }), settings ? _jsx("div", { className: clsx(styles.fixed, styles.settings), children: settings }) : null] }));
|
|
8
10
|
}
|
package/board-item/styles.css.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"container-override": "awsui_container-
|
|
6
|
-
"active": "
|
|
7
|
-
"header": "
|
|
8
|
-
"flexible": "
|
|
9
|
-
"handle": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
4
|
+
"root": "awsui_root_9ckv7_h85wa_1",
|
|
5
|
+
"container-override": "awsui_container-override_9ckv7_h85wa_6",
|
|
6
|
+
"active": "awsui_active_9ckv7_h85wa_6",
|
|
7
|
+
"header": "awsui_header_9ckv7_h85wa_31",
|
|
8
|
+
"flexible": "awsui_flexible_9ckv7_h85wa_37",
|
|
9
|
+
"handle": "awsui_handle_9ckv7_h85wa_41",
|
|
10
|
+
"refresh": "awsui_refresh_9ckv7_h85wa_44",
|
|
11
|
+
"header-content": "awsui_header-content_9ckv7_h85wa_48",
|
|
12
|
+
"settings": "awsui_settings_9ckv7_h85wa_52",
|
|
13
|
+
"fixed": "awsui_fixed_9ckv7_h85wa_60",
|
|
14
|
+
"resizer": "awsui_resizer_9ckv7_h85wa_64"
|
|
14
15
|
};
|
|
15
16
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
.
|
|
1
|
+
.awsui_root_9ckv7_h85wa_1:not(#\9) {
|
|
2
2
|
display: contents;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
/* TODO: use container API instead of styles override */
|
|
6
|
-
.awsui_container-
|
|
6
|
+
.awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
|
|
7
7
|
box-shadow: var(--shadow-container-active-x0fzbz, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
|
|
8
8
|
}
|
|
9
|
-
[data-awsui-focus-visible] .awsui_container-
|
|
9
|
+
[data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
|
|
10
10
|
position: relative;
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
outline: none;
|
|
13
13
|
}
|
|
14
|
-
[data-awsui-focus-visible] .awsui_container-
|
|
14
|
+
[data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
|
|
15
15
|
outline: 2px dotted transparent;
|
|
16
16
|
outline-offset: -1px;
|
|
17
17
|
}
|
|
18
|
-
[data-awsui-focus-visible] .awsui_container-
|
|
18
|
+
[data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9)::before {
|
|
19
19
|
content: " ";
|
|
20
20
|
display: block;
|
|
21
21
|
position: absolute;
|
|
@@ -28,34 +28,40 @@
|
|
|
28
28
|
border: 2px solid var(--color-border-item-focused-4t19h5, #0972d3);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.awsui_header_9ckv7_h85wa_31:not(#\9) {
|
|
32
32
|
display: flex;
|
|
33
33
|
justify-items: center;
|
|
34
34
|
padding: var(--space-scaled-s-913kwi, 12px) calc(var(--space-container-horizontal-jxdgil, 20px) - var(--space-scaled-xs-wbfgrv, 8px));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.
|
|
37
|
+
.awsui_flexible_9ckv7_h85wa_37:not(#\9) {
|
|
38
38
|
flex: 1 1 min-content;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.
|
|
41
|
+
.awsui_handle_9ckv7_h85wa_41:not(#\9) {
|
|
42
42
|
margin-top: calc(var(--space-scaled-xxs-t2t62i, 4px) + 1px);
|
|
43
43
|
}
|
|
44
|
+
.awsui_refresh_9ckv7_h85wa_44 > .awsui_handle_9ckv7_h85wa_41:not(#\9) {
|
|
45
|
+
margin-top: calc(var(--space-static-xxxs-b6tgp7, 2px) + 1px);
|
|
46
|
+
}
|
|
44
47
|
|
|
45
|
-
.awsui_header-
|
|
48
|
+
.awsui_header-content_9ckv7_h85wa_48:not(#\9) {
|
|
46
49
|
margin-left: var(--space-scaled-xxs-t2t62i, 4px);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
.
|
|
52
|
+
.awsui_settings_9ckv7_h85wa_52:not(#\9) {
|
|
50
53
|
margin-top: calc(var(--space-scaled-xxxs-jdgipl, 2px) + 1px);
|
|
51
54
|
margin-left: var(--space-static-xs-zgeph4, 8px);
|
|
52
55
|
}
|
|
56
|
+
.awsui_refresh_9ckv7_h85wa_44 > .awsui_settings_9ckv7_h85wa_52:not(#\9) {
|
|
57
|
+
margin-top: 0px;
|
|
58
|
+
}
|
|
53
59
|
|
|
54
|
-
.
|
|
60
|
+
.awsui_fixed_9ckv7_h85wa_60:not(#\9) {
|
|
55
61
|
flex: 0 0 auto;
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
.
|
|
64
|
+
.awsui_resizer_9ckv7_h85wa_64:not(#\9) {
|
|
59
65
|
position: absolute;
|
|
60
66
|
bottom: calc(var(--space-static-xs-zgeph4, 8px) - var(--space-static-xxxs-b6tgp7, 2px));
|
|
61
67
|
right: calc(var(--space-static-xs-zgeph4, 8px) - var(--space-static-xxxs-b6tgp7, 2px));
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"container-override": "awsui_container-
|
|
7
|
-
"active": "
|
|
8
|
-
"header": "
|
|
9
|
-
"flexible": "
|
|
10
|
-
"handle": "
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
5
|
+
"root": "awsui_root_9ckv7_h85wa_1",
|
|
6
|
+
"container-override": "awsui_container-override_9ckv7_h85wa_6",
|
|
7
|
+
"active": "awsui_active_9ckv7_h85wa_6",
|
|
8
|
+
"header": "awsui_header_9ckv7_h85wa_31",
|
|
9
|
+
"flexible": "awsui_flexible_9ckv7_h85wa_37",
|
|
10
|
+
"handle": "awsui_handle_9ckv7_h85wa_41",
|
|
11
|
+
"refresh": "awsui_refresh_9ckv7_h85wa_44",
|
|
12
|
+
"header-content": "awsui_header-content_9ckv7_h85wa_48",
|
|
13
|
+
"settings": "awsui_settings_9ckv7_h85wa_52",
|
|
14
|
+
"fixed": "awsui_fixed_9ckv7_h85wa_60",
|
|
15
|
+
"resizer": "awsui_resizer_9ckv7_h85wa_64"
|
|
15
16
|
};
|
|
16
17
|
|
package/internal/environment.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useGlobalDragStateStyles(): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useDragSubscription } from "../dnd-controller/controller";
|
|
4
|
+
import styles from "./styles.css.js";
|
|
5
|
+
function assertNever(value) {
|
|
6
|
+
throw new Error("Unexpected value: " + value);
|
|
7
|
+
}
|
|
8
|
+
function setup({ operation, interactionType }) {
|
|
9
|
+
switch (operation) {
|
|
10
|
+
case "insert":
|
|
11
|
+
case "reorder":
|
|
12
|
+
document.body.classList.add(styles["show-grab-cursor"]);
|
|
13
|
+
break;
|
|
14
|
+
case "resize":
|
|
15
|
+
document.body.classList.add(styles["show-resize-cursor"]);
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
// there will be a type error if not all operation types are handled
|
|
19
|
+
assertNever(operation);
|
|
20
|
+
}
|
|
21
|
+
if (interactionType === "pointer") {
|
|
22
|
+
document.body.classList.add(styles["disable-selection"]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function teardown() {
|
|
26
|
+
document.body.classList.remove(styles["show-grab-cursor"], styles["show-resize-cursor"], styles["disable-selection"]);
|
|
27
|
+
}
|
|
28
|
+
export function useGlobalDragStateStyles() {
|
|
29
|
+
useDragSubscription("start", setup);
|
|
30
|
+
useDragSubscription("discard", teardown);
|
|
31
|
+
useDragSubscription("submit", teardown);
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.awsui_show-grab-cursor_1fgk7_1nqmi_1 *:not(#\9) {
|
|
2
|
+
cursor: grabbing;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.awsui_show-resize-cursor_1fgk7_1nqmi_5 *:not(#\9) {
|
|
6
|
+
cursor: nwse-resize;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.awsui_disable-selection_1fgk7_1nqmi_9 *:not(#\9) {
|
|
10
|
+
-webkit-user-select: none;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
// es-module interop with Babel and Typescript
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
module.exports.default = {
|
|
5
|
+
"show-grab-cursor": "awsui_show-grab-cursor_1fgk7_1nqmi_1",
|
|
6
|
+
"show-resize-cursor": "awsui_show-resize-cursor_1fgk7_1nqmi_5",
|
|
7
|
+
"disable-selection": "awsui_disable-selection_1fgk7_1nqmi_9"
|
|
8
|
+
};
|
|
9
|
+
|
|
@@ -4,6 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { CSS as CSSUtil } from "@dnd-kit/utilities";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import { createContext, forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState, } from "react";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
7
8
|
import { useDragSubscription, useDraggable, } from "../dnd-controller/controller";
|
|
8
9
|
import { Coordinates } from "../utils/coordinates";
|
|
9
10
|
import { getNormalizedElementRect } from "../utils/screen";
|
|
@@ -99,6 +100,17 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
99
100
|
// draggableApi is not expected to change
|
|
100
101
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
102
|
}, [item.id, transitionInteractionType, transitionItemId]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (transitionInteractionType === "keyboard" && transitionItemId === item.id) {
|
|
105
|
+
const onPointerDown = () => draggableApi.submitTransition();
|
|
106
|
+
window.addEventListener("pointerdown", onPointerDown, true);
|
|
107
|
+
return () => {
|
|
108
|
+
window.removeEventListener("pointerdown", onPointerDown, true);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// draggableApi is not expected to change
|
|
112
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
+
}, [item.id, transitionInteractionType, transitionItemId]);
|
|
102
114
|
function onKeyboardTransitionToggle(operation) {
|
|
103
115
|
// The acquired item is a copy and does not have the transition state.
|
|
104
116
|
// However, pressing "Space" or "Enter" on the acquired item must submit the active transition.
|
|
@@ -175,11 +187,11 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
175
187
|
}
|
|
176
188
|
}
|
|
177
189
|
function onBlur() {
|
|
178
|
-
// When drag- or resize handle loses focus the transition must be
|
|
190
|
+
// When drag- or resize handle loses focus the transition must be submitted with two exceptions:
|
|
179
191
|
// 1. If the last interaction is not "keyboard" (the user clicked on another handle issuing a new transition);
|
|
180
192
|
// 2. If the item is borrowed (in that case the focus moves to the acquired item which is expected).
|
|
181
193
|
if (transition && transition.interactionType === "keyboard" && !transition.isBorrowed) {
|
|
182
|
-
draggableApi.
|
|
194
|
+
draggableApi.submitTransition();
|
|
183
195
|
}
|
|
184
196
|
}
|
|
185
197
|
function onDragHandlePointerDown(event) {
|
|
@@ -254,11 +266,13 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
254
266
|
focusDragHandle: () => { var _a; return (_a = dragHandleRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
255
267
|
}));
|
|
256
268
|
const isActive = (!!transition && !transition.isBorrowed) || !!acquired;
|
|
269
|
+
const shouldUsePortal = ((transition === null || transition === void 0 ? void 0 : transition.operation) === "insert" || (transition === null || transition === void 0 ? void 0 : transition.operation) === "reorder") &&
|
|
270
|
+
(transition === null || transition === void 0 ? void 0 : transition.interactionType) === "pointer";
|
|
257
271
|
const childrenRef = useRef(null);
|
|
258
272
|
if (!inTransition || isActive) {
|
|
259
273
|
childrenRef.current = children();
|
|
260
274
|
}
|
|
261
|
-
|
|
275
|
+
const content = (_jsx("div", { ref: itemRef, className: clsx(styles.root, ...itemTransitionClassNames), style: itemTransitionStyle, "data-item-id": item.id, onBlur: onBlur, children: _jsx(ItemContext.Provider, { value: {
|
|
262
276
|
isActive,
|
|
263
277
|
dragHandle: {
|
|
264
278
|
ref: dragHandleRef,
|
|
@@ -274,4 +288,5 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
274
288
|
}
|
|
275
289
|
: null,
|
|
276
290
|
}, children: childrenRef.current }) }));
|
|
291
|
+
return shouldUsePortal ? _jsx("div", { children: createPortal(content, document.body) }) : content;
|
|
277
292
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"inTransition": "
|
|
6
|
-
"transformed": "
|
|
7
|
-
"removed": "
|
|
8
|
-
"dragged": "
|
|
9
|
-
"resized": "
|
|
10
|
-
"borrowed": "
|
|
4
|
+
"root": "awsui_root_lljvd_1nttw_1",
|
|
5
|
+
"inTransition": "awsui_inTransition_lljvd_1nttw_7",
|
|
6
|
+
"transformed": "awsui_transformed_lljvd_1nttw_12",
|
|
7
|
+
"removed": "awsui_removed_lljvd_1nttw_17",
|
|
8
|
+
"dragged": "awsui_dragged_lljvd_1nttw_21",
|
|
9
|
+
"resized": "awsui_resized_lljvd_1nttw_26",
|
|
10
|
+
"borrowed": "awsui_borrowed_lljvd_1nttw_31"
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
.
|
|
1
|
+
.awsui_root_lljvd_1nttw_1:not(#\9) {
|
|
2
2
|
touch-action: none;
|
|
3
3
|
position: relative;
|
|
4
4
|
height: 100%;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.
|
|
7
|
+
.awsui_inTransition_lljvd_1nttw_7:not(#\9) {
|
|
8
8
|
transition: transform 200ms;
|
|
9
9
|
transition-timing-function: ease;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.
|
|
12
|
+
.awsui_transformed_lljvd_1nttw_12:not(#\9) {
|
|
13
13
|
position: absolute;
|
|
14
14
|
z-index: 1;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.
|
|
17
|
+
.awsui_removed_lljvd_1nttw_17:not(#\9) {
|
|
18
18
|
display: none;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.
|
|
22
|
-
z-index:
|
|
21
|
+
.awsui_dragged_lljvd_1nttw_21:not(#\9) {
|
|
22
|
+
z-index: 2000;
|
|
23
23
|
position: fixed;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
27
|
-
z-index:
|
|
26
|
+
.awsui_resized_lljvd_1nttw_26:not(#\9) {
|
|
27
|
+
z-index: 2000;
|
|
28
28
|
position: absolute;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
32
|
-
|
|
31
|
+
.awsui_borrowed_lljvd_1nttw_31:not(#\9) {
|
|
32
|
+
display: none;
|
|
33
33
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"inTransition": "
|
|
7
|
-
"transformed": "
|
|
8
|
-
"removed": "
|
|
9
|
-
"dragged": "
|
|
10
|
-
"resized": "
|
|
11
|
-
"borrowed": "
|
|
5
|
+
"root": "awsui_root_lljvd_1nttw_1",
|
|
6
|
+
"inTransition": "awsui_inTransition_lljvd_1nttw_7",
|
|
7
|
+
"transformed": "awsui_transformed_lljvd_1nttw_12",
|
|
8
|
+
"removed": "awsui_removed_lljvd_1nttw_17",
|
|
9
|
+
"dragged": "awsui_dragged_lljvd_1nttw_21",
|
|
10
|
+
"resized": "awsui_resized_lljvd_1nttw_26",
|
|
11
|
+
"borrowed": "awsui_borrowed_lljvd_1nttw_31"
|
|
12
12
|
};
|
|
13
13
|
|
package/internal/manifest.json
CHANGED
|
@@ -51,10 +51,11 @@ export function useAutoScroll() {
|
|
|
51
51
|
scrollIntoViewTimerRef.current && clearTimeout(scrollIntoViewTimerRef.current);
|
|
52
52
|
const activeElementBeforeDelay = document.activeElement;
|
|
53
53
|
scrollIntoViewTimerRef.current = setTimeout(() => {
|
|
54
|
+
var _a, _b;
|
|
54
55
|
if (document.activeElement &&
|
|
55
56
|
document.activeElement === activeElementBeforeDelay &&
|
|
56
57
|
getLastInteraction() === "keyboard") {
|
|
57
|
-
document.activeElement.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
58
|
+
(_b = (_a = document.activeElement).scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { behavior: "smooth", block: "nearest" });
|
|
58
59
|
}
|
|
59
60
|
}, delay);
|
|
60
61
|
}, [getLastInteraction]);
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ const styles_selectors_js_1 = require("../../../board/styles.selectors.js");
|
|
|
7
7
|
const board_item_1 = require("../board-item");
|
|
8
8
|
class BoardWrapper extends dom_1.ComponentWrapper {
|
|
9
9
|
findItemById(itemId) {
|
|
10
|
-
return
|
|
10
|
+
return (0, dom_1.createWrapper)().findComponent(`[data-item-id="${itemId}"]`, board_item_1.default);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.default = BoardWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/board/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/board/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAAyF;AACzF,4EAA6D;AAC7D,8CAA6C;AAE7C,MAAqB,YAAa,SAAQ,sBAAgB;IAGxD,YAAY,CAAC,MAAc;QACzB,OAAO,IAAA,mBAAa,GAAE,CAAC,aAAa,CAAC,kBAAkB,MAAM,IAAI,EAAE,oBAAgB,CAAC,CAAC;IACvF,CAAC;;AALH,+BAMC;AALQ,yBAAY,GAAW,6BAAW,CAAC,IAAI,CAAC"}
|
|
@@ -7,7 +7,7 @@ const styles_selectors_js_1 = require("../../../board/styles.selectors.js");
|
|
|
7
7
|
const board_item_1 = require("../board-item");
|
|
8
8
|
class BoardWrapper extends selectors_1.ComponentWrapper {
|
|
9
9
|
findItemById(itemId) {
|
|
10
|
-
return
|
|
10
|
+
return (0, selectors_1.createWrapper)().findComponent(`[data-item-id="${itemId}"]`, board_item_1.default);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.default = BoardWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/board/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/board/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,4EAA+F;AAC/F,4EAA6D;AAC7D,8CAA6C;AAC7C,MAAqB,YAAa,SAAQ,4BAAgB;IAExD,YAAY,CAAC,MAAc;QACzB,OAAO,IAAA,yBAAa,GAAE,CAAC,aAAa,CAAC,kBAAkB,MAAM,IAAI,EAAE,oBAAgB,CAAC,CAAC;IACvF,CAAC;;AAJH,+BAKC;AAJQ,yBAAY,GAAW,6BAAW,CAAC,IAAI,CAAC"}
|