@cloudscape-design/board-components 3.0.60 → 3.0.62
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 +12 -7
- package/board/internal.js.map +1 -1
- package/board/styles.css.js +5 -5
- package/board/styles.scoped.css +10 -8
- package/board/styles.selectors.js +5 -5
- package/board/transition.d.ts +3 -1
- package/board/transition.js +32 -24
- package/board/transition.js.map +1 -1
- package/board-item/styles.css.js +11 -11
- package/board-item/styles.scoped.css +27 -26
- package/board-item/styles.selectors.js +11 -11
- package/internal/drag-handle/styles.css.js +2 -2
- package/internal/drag-handle/styles.scoped.css +9 -9
- package/internal/drag-handle/styles.selectors.js +2 -2
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/global-drag-state-styles/styles.css.js +3 -3
- package/internal/global-drag-state-styles/styles.scoped.css +6 -3
- package/internal/global-drag-state-styles/styles.selectors.js +3 -3
- package/internal/grid/grid.d.ts +1 -1
- package/internal/grid/grid.js +5 -2
- package/internal/grid/grid.js.map +1 -1
- package/internal/grid/interfaces.d.ts +1 -0
- package/internal/grid/interfaces.js.map +1 -1
- package/internal/handle/styles.css.js +1 -1
- package/internal/handle/styles.scoped.css +4 -3
- package/internal/handle/styles.selectors.js +1 -1
- package/internal/item-container/get-next-droppable.d.ts +6 -1
- package/internal/item-container/get-next-droppable.js +7 -2
- package/internal/item-container/get-next-droppable.js.map +1 -1
- package/internal/item-container/index.d.ts +1 -0
- package/internal/item-container/index.js +30 -17
- package/internal/item-container/index.js.map +1 -1
- package/internal/item-container/styles.css.js +7 -7
- package/internal/item-container/styles.scoped.css +8 -8
- package/internal/item-container/styles.selectors.js +7 -7
- package/internal/manifest.json +1 -1
- package/internal/resize-handle/styles.css.js +2 -2
- package/internal/resize-handle/styles.scoped.css +11 -8
- package/internal/resize-handle/styles.selectors.js +2 -2
- package/internal/screenreader-grid-navigation/styles.css.js +2 -2
- package/internal/screenreader-grid-navigation/styles.scoped.css +4 -3
- package/internal/screenreader-grid-navigation/styles.selectors.js +2 -2
- package/internal/screenreader-only/styles.css.js +1 -1
- package/internal/screenreader-only/styles.scoped.css +3 -3
- package/internal/screenreader-only/styles.selectors.js +1 -1
- package/internal/utils/coordinates.d.ts +3 -1
- package/internal/utils/coordinates.js +5 -2
- package/internal/utils/coordinates.js.map +1 -1
- package/internal/utils/rects.d.ts +6 -1
- package/internal/utils/rects.js +7 -1
- package/internal/utils/rects.js.map +1 -1
- package/internal/utils/screen.d.ts +8 -1
- package/internal/utils/screen.js +8 -9
- package/internal/utils/screen.js.map +1 -1
- package/items-palette/internal.js +3 -1
- package/items-palette/internal.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
.
|
|
1
|
+
.awsui_handle_umbhe_1vpmb_1:not(#\9) {
|
|
2
2
|
cursor: grab;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.
|
|
5
|
+
.awsui_handle_umbhe_1vpmb_1:not(#\9):active {
|
|
6
6
|
cursor: grabbing;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.
|
|
9
|
+
.awsui_handle_umbhe_1vpmb_1:not(#\9):not(.awsui_active_umbhe_1vpmb_9):focus-visible {
|
|
10
10
|
position: relative;
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
outline: 2px dotted transparent;
|
|
13
13
|
outline-offset: 3px;
|
|
14
14
|
}
|
|
15
|
-
.
|
|
15
|
+
.awsui_handle_umbhe_1vpmb_1:not(#\9):not(.awsui_active_umbhe_1vpmb_9):focus-visible::before {
|
|
16
16
|
content: " ";
|
|
17
17
|
display: block;
|
|
18
18
|
position: absolute;
|
|
19
19
|
box-sizing: border-box;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
inset-inline-start: calc(-1 * 4px);
|
|
21
|
+
inset-block-start: calc(-1 * 4px);
|
|
22
|
+
inline-size: calc(100% + 2 * 4px);
|
|
23
|
+
block-size: calc(100% + 2 * 4px);
|
|
24
24
|
border-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
|
|
25
25
|
border: 2px solid var(--color-border-item-focused-b2ntyl, #0972d3);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
28
|
+
.awsui_active_umbhe_1vpmb_9:not(#\9) {
|
|
29
29
|
outline: none;
|
|
30
30
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"handle": "
|
|
6
|
-
"active": "
|
|
5
|
+
"handle": "awsui_handle_umbhe_1vpmb_1",
|
|
6
|
+
"active": "awsui_active_umbhe_1vpmb_9"
|
|
7
7
|
};
|
|
8
8
|
|
package/internal/environment.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"show-grab-cursor": "awsui_show-grab-
|
|
5
|
-
"show-resize-cursor": "awsui_show-resize-
|
|
6
|
-
"disable-selection": "awsui_disable-
|
|
4
|
+
"show-grab-cursor": "awsui_show-grab-cursor_1fgk7_to1u8_1",
|
|
5
|
+
"show-resize-cursor": "awsui_show-resize-cursor_1fgk7_to1u8_5",
|
|
6
|
+
"disable-selection": "awsui_disable-selection_1fgk7_to1u8_12"
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
.awsui_show-grab-
|
|
1
|
+
.awsui_show-grab-cursor_1fgk7_to1u8_1 *:not(#\9) {
|
|
2
2
|
cursor: grabbing;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.awsui_show-resize-
|
|
5
|
+
.awsui_show-resize-cursor_1fgk7_to1u8_5 *:not(#\9) {
|
|
6
6
|
cursor: nwse-resize;
|
|
7
7
|
}
|
|
8
|
+
.awsui_show-resize-cursor_1fgk7_to1u8_5 *:not(#\9):dir(rtl) {
|
|
9
|
+
cursor: nesw-resize;
|
|
10
|
+
}
|
|
8
11
|
|
|
9
|
-
.awsui_disable-
|
|
12
|
+
.awsui_disable-selection_1fgk7_to1u8_12 *:not(#\9) {
|
|
10
13
|
-webkit-user-select: none;
|
|
11
14
|
user-select: none;
|
|
12
15
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"show-grab-cursor": "awsui_show-grab-
|
|
6
|
-
"show-resize-cursor": "awsui_show-resize-
|
|
7
|
-
"disable-selection": "awsui_disable-
|
|
5
|
+
"show-grab-cursor": "awsui_show-grab-cursor_1fgk7_to1u8_1",
|
|
6
|
+
"show-resize-cursor": "awsui_show-resize-cursor_1fgk7_to1u8_5",
|
|
7
|
+
"disable-selection": "awsui_disable-selection_1fgk7_to1u8_12"
|
|
8
8
|
};
|
|
9
9
|
|
package/internal/grid/grid.d.ts
CHANGED
package/internal/grid/grid.js
CHANGED
|
@@ -19,7 +19,7 @@ const ROWSPAN_HEIGHT = {
|
|
|
19
19
|
comfortable: 96,
|
|
20
20
|
compact: 76,
|
|
21
21
|
};
|
|
22
|
-
export default function Grid({ layout, children: render, columns }) {
|
|
22
|
+
export default function Grid({ layout, children: render, columns, isRtl }) {
|
|
23
23
|
const gridRef = useRef(null);
|
|
24
24
|
const [gridWidth, containerQueryRef] = useContainerQuery((entry) => entry.contentBoxWidth, []);
|
|
25
25
|
const densityMode = useDensityMode(gridRef);
|
|
@@ -32,7 +32,10 @@ export default function Grid({ layout, children: render, columns }) {
|
|
|
32
32
|
return colspan * cellWidth + (colspan - 1) * gridGap;
|
|
33
33
|
};
|
|
34
34
|
const getHeight = (rowspan) => rowspan * rowspanHeight + (rowspan - 1) * gridGap;
|
|
35
|
-
const getColOffset = (x) =>
|
|
35
|
+
const getColOffset = (x) => {
|
|
36
|
+
const offset = getWidth(x) + gridGap;
|
|
37
|
+
return !(isRtl === null || isRtl === void 0 ? void 0 : isRtl()) ? offset : -offset;
|
|
38
|
+
};
|
|
36
39
|
const getRowOffset = (y) => getHeight(y) + gridGap;
|
|
37
40
|
const gridContext = { getWidth, getHeight, getColOffset, getRowOffset };
|
|
38
41
|
const children = render === null || render === void 0 ? void 0 : render(gridContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../../src/internal/grid/grid.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,QAAQ,MAAM,QAAQ,CAAC;AAC9B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,8BAA8B;AAC9B,MAAM,QAAQ,GAAG;IACf,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,oCAAoC;AACpC,MAAM,cAAc,GAAG;IACrB,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAa;
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../../src/internal/grid/grid.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;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AQ,IAAe,IAAI,EAAE,IAAI,YAC/B,QAAQ,IADI,IAAI,CAAC,EAAE,CAEX,CACZ,CAAC,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContainerQuery } from \"@cloudscape-design/component-toolkit\";\nimport { useDensityMode } from \"@cloudscape-design/component-toolkit/internal\";\nimport clsx from \"clsx\";\nimport { Children, useRef } from \"react\";\nimport { useMergeRefs } from \"../utils/use-merge-refs\";\nimport { zipTwoArrays } from \"../utils/zip-arrays\";\n\nimport { GridProps } from \"./interfaces\";\nimport GridItem from \"./item\";\nimport styles from \"./styles.css.js\";\n\n/* Matches grid gap in CSS. */\nconst GRID_GAP = {\n comfortable: 20,\n compact: 16,\n};\n\n/* Matches grid-auto-rows in CSS. */\nconst ROWSPAN_HEIGHT = {\n comfortable: 96,\n compact: 76,\n};\n\nexport default function Grid({ layout, children: render, columns, isRtl }: GridProps) {\n const gridRef = useRef<HTMLDivElement>(null);\n const [gridWidth, containerQueryRef] = useContainerQuery((entry) => entry.contentBoxWidth, []);\n const densityMode = useDensityMode(gridRef);\n const gridGap = GRID_GAP[densityMode];\n const rowspanHeight = ROWSPAN_HEIGHT[densityMode];\n\n // The below getters translate relative grid units into size/offset values in pixels.\n const getWidth = (colspan: number) => {\n colspan = Math.min(columns, colspan);\n const cellWidth = ((gridWidth || 0) - (columns - 1) * gridGap) / columns;\n return colspan * cellWidth + (colspan - 1) * gridGap;\n };\n const getHeight = (rowspan: number) => rowspan * rowspanHeight + (rowspan - 1) * gridGap;\n const getColOffset = (x: number) => {\n const offset = getWidth(x) + gridGap;\n return !isRtl?.() ? offset : -offset;\n };\n const getRowOffset = (y: number) => getHeight(y) + gridGap;\n\n const gridContext = { getWidth, getHeight, getColOffset, getRowOffset };\n const children = render?.(gridContext);\n\n const zipped = zipTwoArrays(layout, Children.toArray(children));\n\n const ref = useMergeRefs(gridRef, containerQueryRef);\n return (\n <div ref={ref} className={clsx(styles.grid, styles[`grid-${densityMode}`], styles[`columns-${columns}`])}>\n {zipped.map(([item, children]) => (\n <GridItem key={item.id} item={item}>\n {children}\n </GridItem>\n ))}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/internal/grid/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ReactNode } from \"react\";\nimport { GridLayoutItem } from \"../interfaces\";\n\nexport interface GridProps {\n layout: GridLayoutItem[];\n columns: number;\n children?: (context: GridContext) => ReactNode;\n}\n\nexport interface GridContext {\n getWidth: (colspan: number) => number;\n getHeight: (rowspan: number) => number;\n getColOffset: (x: number) => number;\n getRowOffset: (y: number) => number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/internal/grid/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ReactNode } from \"react\";\nimport { GridLayoutItem } from \"../interfaces\";\n\nexport interface GridProps {\n layout: GridLayoutItem[];\n columns: number;\n children?: (context: GridContext) => ReactNode;\n isRtl?: () => boolean;\n}\n\nexport interface GridContext {\n getWidth: (colspan: number) => number;\n getHeight: (rowspan: number) => number;\n getColOffset: (x: number) => number;\n getRowOffset: (y: number) => number;\n}\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
.
|
|
1
|
+
.awsui_handle_cc1pu_1avwz_1:not(#\9) {
|
|
2
2
|
-webkit-appearance: none;
|
|
3
3
|
appearance: none;
|
|
4
4
|
background: transparent;
|
|
5
5
|
border: none;
|
|
6
|
-
padding: var(--space-scaled-xxs-7597g1, 4px);
|
|
6
|
+
padding-block: var(--space-scaled-xxs-7597g1, 4px);
|
|
7
|
+
padding-inline: var(--space-scaled-xxs-7597g1, 4px);
|
|
7
8
|
color: var(--color-text-interactive-default-lnx6lk, #414d5c);
|
|
8
9
|
}
|
|
9
|
-
.
|
|
10
|
+
.awsui_handle_cc1pu_1avwz_1:not(#\9):hover {
|
|
10
11
|
color: var(--color-text-interactive-hover-mj8add, #000716);
|
|
11
12
|
}
|
|
@@ -4,4 +4,9 @@ import { Direction, ItemId } from "../interfaces";
|
|
|
4
4
|
* Finds closest droppable to provided draggable element and direction.
|
|
5
5
|
* Returns null if there is no droppable in the given direction.
|
|
6
6
|
*/
|
|
7
|
-
export declare function getNextDroppable(draggableElement
|
|
7
|
+
export declare function getNextDroppable({ draggableElement, droppables, direction, isRtl, }: {
|
|
8
|
+
draggableElement: HTMLElement;
|
|
9
|
+
droppables: readonly [ItemId, Droppable][];
|
|
10
|
+
direction: Direction;
|
|
11
|
+
isRtl: boolean;
|
|
12
|
+
}): null | ItemId;
|
|
@@ -6,11 +6,16 @@ import { getNormalizedElementRect } from "../utils/screen";
|
|
|
6
6
|
* Finds closest droppable to provided draggable element and direction.
|
|
7
7
|
* Returns null if there is no droppable in the given direction.
|
|
8
8
|
*/
|
|
9
|
-
export function getNextDroppable(draggableElement, droppables, direction) {
|
|
9
|
+
export function getNextDroppable({ draggableElement, droppables, direction, isRtl, }) {
|
|
10
10
|
var _a;
|
|
11
11
|
const draggableRect = getNormalizedElementRect(draggableElement);
|
|
12
12
|
const sources = new Map(droppables.map(([id, d]) => [getNormalizedElementRect(d.element), id]));
|
|
13
|
-
const closest = getClosestNeighbor(
|
|
13
|
+
const closest = getClosestNeighbor({
|
|
14
|
+
target: draggableRect,
|
|
15
|
+
sources: [...sources.keys()],
|
|
16
|
+
direction,
|
|
17
|
+
isRtl,
|
|
18
|
+
});
|
|
14
19
|
return (_a = sources.get(closest)) !== null && _a !== void 0 ? _a : null;
|
|
15
20
|
}
|
|
16
21
|
//# sourceMappingURL=get-next-droppable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-next-droppable.js","sourceRoot":"","sources":["../../../../src/internal/item-container/get-next-droppable.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,
|
|
1
|
+
{"version":3,"file":"get-next-droppable.js","sourceRoot":"","sources":["../../../../src/internal/item-container/get-next-droppable.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,KAAK,GAMN;;IACC,MAAM,aAAa,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAChG,MAAM,OAAO,GAAG,kBAAkB,CAAC;QACjC,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IACH,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,OAAkB,CAAC,mCAAI,IAAI,CAAC;AACjD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Droppable } from \"../dnd-controller/controller\";\nimport { Direction, ItemId } from \"../interfaces\";\nimport { getClosestNeighbor } from \"../utils/rects\";\nimport { getNormalizedElementRect } from \"../utils/screen\";\n\n/**\n * Finds closest droppable to provided draggable element and direction.\n * Returns null if there is no droppable in the given direction.\n */\nexport function getNextDroppable({\n draggableElement,\n droppables,\n direction,\n isRtl,\n}: {\n draggableElement: HTMLElement;\n droppables: readonly [ItemId, Droppable][];\n direction: Direction;\n isRtl: boolean;\n}): null | ItemId {\n const draggableRect = getNormalizedElementRect(draggableElement);\n const sources = new Map(droppables.map(([id, d]) => [getNormalizedElementRect(d.element), id]));\n const closest = getClosestNeighbor({\n target: draggableRect,\n sources: [...sources.keys()],\n direction,\n isRtl,\n });\n return sources.get(closest as DOMRect) ?? null;\n}\n"]}
|
|
@@ -47,6 +47,7 @@ export interface ItemContainerProps {
|
|
|
47
47
|
};
|
|
48
48
|
onKeyMove?(direction: Direction): void;
|
|
49
49
|
children: (hasDropTarget: boolean) => ReactNode;
|
|
50
|
+
isRtl: () => boolean;
|
|
50
51
|
}
|
|
51
52
|
export declare const ItemContainer: import("react").ForwardRefExoticComponent<ItemContainerProps & import("react").RefAttributes<ItemContainerRef>>;
|
|
52
53
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } 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
|
+
import { getLogicalBoundingClientRect, getLogicalClientX } from "@cloudscape-design/component-toolkit/internal";
|
|
4
5
|
import { CSS as CSSUtil } from "@dnd-kit/utilities";
|
|
5
6
|
import clsx from "clsx";
|
|
6
7
|
import { createContext, forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState, } from "react";
|
|
@@ -21,7 +22,7 @@ export function useItemContext() {
|
|
|
21
22
|
return ctx;
|
|
22
23
|
}
|
|
23
24
|
export const ItemContainer = forwardRef(ItemContainerComponent);
|
|
24
|
-
function ItemContainerComponent({ item, placed, acquired, inTransition, transform, getItemSize, onKeyMove, children }, ref) {
|
|
25
|
+
function ItemContainerComponent({ item, placed, acquired, inTransition, transform, getItemSize, onKeyMove, children, isRtl }, ref) {
|
|
25
26
|
var _a, _b, _c, _d, _e, _f;
|
|
26
27
|
const originalSizeRef = useRef({ width: 0, height: 0 });
|
|
27
28
|
const pointerOffsetRef = useRef(new Coordinates({ x: 0, y: 0 }));
|
|
@@ -83,7 +84,7 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
83
84
|
useEffect(() => {
|
|
84
85
|
const onPointerMove = throttle((event) => {
|
|
85
86
|
var _a, _b, _c, _d;
|
|
86
|
-
const coordinates = Coordinates.fromEvent(event);
|
|
87
|
+
const coordinates = Coordinates.fromEvent(event, { isRtl: isRtl() });
|
|
87
88
|
draggableApi.updateTransition(new Coordinates({
|
|
88
89
|
x: Math.max(coordinates.x, (_b = (_a = pointerBoundariesRef.current) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : Number.NEGATIVE_INFINITY),
|
|
89
90
|
y: Math.max(coordinates.y, (_d = (_c = pointerBoundariesRef.current) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : Number.NEGATIVE_INFINITY),
|
|
@@ -146,7 +147,12 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
146
147
|
function handleInsert(direction) {
|
|
147
148
|
// Find the closest droppable (in the direction) to the item.
|
|
148
149
|
const droppables = draggableApi.getDroppables();
|
|
149
|
-
const nextDroppable = getNextDroppable(
|
|
150
|
+
const nextDroppable = getNextDroppable({
|
|
151
|
+
draggableElement: itemRef.current,
|
|
152
|
+
droppables,
|
|
153
|
+
direction,
|
|
154
|
+
isRtl: isRtl(),
|
|
155
|
+
});
|
|
150
156
|
if (!nextDroppable) {
|
|
151
157
|
// TODO: add announcement
|
|
152
158
|
// Context: the keyboard insertion only works when there is some droppable area in the specified direction.
|
|
@@ -202,28 +208,35 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
202
208
|
}
|
|
203
209
|
function onDragHandlePointerDown(event) {
|
|
204
210
|
// Calculate the offset between item's top-left corner and the pointer landing position.
|
|
205
|
-
const rect = itemRef.current
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
const rect = getLogicalBoundingClientRect(itemRef.current);
|
|
212
|
+
const clientX = getLogicalClientX(event, isRtl());
|
|
213
|
+
const clientY = event.clientY;
|
|
214
|
+
pointerOffsetRef.current = new Coordinates({
|
|
215
|
+
x: clientX - rect.insetInlineStart,
|
|
216
|
+
y: clientY - rect.insetBlockStart,
|
|
217
|
+
});
|
|
218
|
+
originalSizeRef.current = { width: rect.inlineSize, height: rect.blockSize };
|
|
208
219
|
pointerBoundariesRef.current = null;
|
|
209
|
-
draggableApi.start(!placed ? "insert" : "reorder", "pointer", Coordinates.fromEvent(event));
|
|
220
|
+
draggableApi.start(!placed ? "insert" : "reorder", "pointer", Coordinates.fromEvent(event, { isRtl: isRtl() }));
|
|
210
221
|
}
|
|
211
222
|
function onDragHandleKeyDown(event) {
|
|
212
223
|
onHandleKeyDown("drag", event);
|
|
213
224
|
}
|
|
214
225
|
function onResizeHandlePointerDown(event) {
|
|
215
226
|
// Calculate the offset between item's bottom-right corner and the pointer landing position.
|
|
216
|
-
const rect = itemRef.current
|
|
217
|
-
|
|
218
|
-
|
|
227
|
+
const rect = getLogicalBoundingClientRect(itemRef.current);
|
|
228
|
+
const clientX = getLogicalClientX(event, isRtl());
|
|
229
|
+
const clientY = event.clientY;
|
|
230
|
+
pointerOffsetRef.current = new Coordinates({ x: clientX - rect.insetInlineEnd, y: clientY - rect.insetBlockEnd });
|
|
231
|
+
originalSizeRef.current = { width: rect.inlineSize, height: rect.blockSize };
|
|
219
232
|
// Calculate boundaries below which the cursor cannot move.
|
|
220
233
|
const minWidth = getItemSize(null).minWidth;
|
|
221
234
|
const minHeight = getItemSize(null).minHeight;
|
|
222
235
|
pointerBoundariesRef.current = new Coordinates({
|
|
223
|
-
x:
|
|
224
|
-
y:
|
|
236
|
+
x: clientX - rect.inlineSize + minWidth,
|
|
237
|
+
y: clientY - rect.blockSize + minHeight,
|
|
225
238
|
});
|
|
226
|
-
draggableApi.start("resize", "pointer", Coordinates.fromEvent(event));
|
|
239
|
+
draggableApi.start("resize", "pointer", Coordinates.fromEvent(event, { isRtl: isRtl() }));
|
|
227
240
|
}
|
|
228
241
|
function onResizeHandleKeyDown(event) {
|
|
229
242
|
onHandleKeyDown("resize", event);
|
|
@@ -236,10 +249,10 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
|
|
|
236
249
|
if (transition && transition.interactionType === "pointer") {
|
|
237
250
|
// Adjust the dragged/resized item to the pointer's location.
|
|
238
251
|
itemTransitionClassNames.push(transition.operation === "resize" ? styles.resized : styles.dragged);
|
|
239
|
-
itemTransitionStyle.
|
|
240
|
-
itemTransitionStyle.
|
|
241
|
-
itemTransitionStyle.
|
|
242
|
-
itemTransitionStyle.
|
|
252
|
+
itemTransitionStyle.insetInlineStart = (_c = transition.positionTransform) === null || _c === void 0 ? void 0 : _c.x;
|
|
253
|
+
itemTransitionStyle.insetBlockStart = (_d = transition.positionTransform) === null || _d === void 0 ? void 0 : _d.y;
|
|
254
|
+
itemTransitionStyle.inlineSize = (_e = transition.sizeTransform) === null || _e === void 0 ? void 0 : _e.width;
|
|
255
|
+
itemTransitionStyle.blockSize = (_f = transition.sizeTransform) === null || _f === void 0 ? void 0 : _f.height;
|
|
243
256
|
itemTransitionStyle.pointerEvents = "none";
|
|
244
257
|
}
|
|
245
258
|
if (isHidden) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/item-container/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,GAAG,IAAI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Y,IAAI,QAAQ,EAAE;QAC7B,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,CAAA,CAAC,CAAC;KAC7D;IAED,MAAM,OAAO,GAAG,CACd,cACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,wBAAwB,CAAC,EACzD,KAAK,EAAE,mBAAmB,kBACZ,IAAI,CAAC,EAAE,EACrB,MAAM,EAAE,MAAM,YAEd,KAAC,WAAW,CAAC,QAAQ,IACnB,KAAK,EAAE;gBACL,QAAQ;gBACR,UAAU,EAAE;oBACV,GAAG,EAAE,aAAa;oBAClB,aAAa,EAAE,uBAAuB;oBACtC,SAAS,EAAE,mBAAmB;oBAC9B,QAAQ,EAAE,QAAQ,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,MAAK,SAAS;iBAC1D;gBACD,YAAY,EAAE,MAAM;oBAClB,CAAC,CAAC;wBACE,aAAa,EAAE,yBAAyB;wBACxC,SAAS,EAAE,qBAAqB;wBAChC,QAAQ,EAAE,QAAQ,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,MAAK,QAAQ;qBACzD;oBACH,CAAC,CAAC,IAAI;aACT,YAEA,WAAW,CAAC,OAAO,GACC,GACnB,CACP,CAAC;IAEF,OAAO,eAAe,CAAC,CAAC,CAAC,wBAAM,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { CSS as CSSUtil } from \"@dnd-kit/utilities\";\nimport clsx from \"clsx\";\nimport {\n CSSProperties,\n KeyboardEvent,\n ReactNode,\n PointerEvent as ReactPointerEvent,\n Ref,\n RefObject,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n DragAndDropData,\n DropTargetContext,\n InteractionType,\n Operation,\n useDragSubscription,\n useDraggable,\n} from \"../dnd-controller/controller\";\nimport { BoardItemDefinitionBase, Direction, ItemId, Transform } from \"../interfaces\";\nimport { Coordinates } from \"../utils/coordinates\";\nimport { getNormalizedElementRect } from \"../utils/screen\";\nimport { throttle } from \"../utils/throttle\";\nimport { getCollisionRect } from \"./get-collision-rect\";\nimport { getNextDroppable } from \"./get-next-droppable\";\nimport styles from \"./styles.css.js\";\n\nexport interface ItemContainerRef {\n focusDragHandle(): void;\n}\n\ninterface ItemContextType {\n isActive: boolean;\n dragHandle: {\n ref: RefObject<HTMLButtonElement>;\n onPointerDown(event: ReactPointerEvent): void;\n onKeyDown(event: KeyboardEvent): void;\n isActive: boolean;\n };\n resizeHandle: null | {\n onPointerDown(event: ReactPointerEvent): void;\n onKeyDown(event: KeyboardEvent): void;\n isActive: boolean;\n };\n}\n\nexport const ItemContext = createContext<ItemContextType | null>(null);\n\nexport function useItemContext() {\n const ctx = useContext(ItemContext);\n if (!ctx) {\n throw new Error(\"Unable to find BoardItem context.\");\n }\n return ctx;\n}\n\ninterface Transition {\n itemId: ItemId;\n operation: Operation;\n interactionType: InteractionType;\n sizeTransform: null | { width: number; height: number };\n positionTransform: null | { x: number; y: number };\n hasDropTarget?: boolean;\n}\n\n/**\n * Defines item's parameters and its relation with the layout.\n *\n * `item` - the unique board item base object to be used in d&d context.\n * `placed` - specifies if the item already belongs to the board.\n * `acquired` - specifies if the item is essentially a copy temporarily acquired by a droppable but not submitted yet.\n * `inTransition` - specifies if the item is currently being moved.\n * `transform` - specifies if the item's position needs to be altered.\n * `getItemSize` - item size getter that takes droppable context as argument.\n * `onKeyMove` - a callback that fires when arrow keys are pressed in drag- or resize handle.\n */\nexport interface ItemContainerProps {\n item: BoardItemDefinitionBase<unknown>;\n placed: boolean;\n acquired: boolean;\n inTransition: boolean;\n transform: Transform | undefined;\n getItemSize: (context: null | DropTargetContext) => {\n width: number;\n minWidth: number;\n maxWidth: number;\n height: number;\n minHeight: number;\n maxHeight: number;\n };\n onKeyMove?(direction: Direction): void;\n children: (hasDropTarget: boolean) => ReactNode;\n}\n\nexport const ItemContainer = forwardRef(ItemContainerComponent);\n\nfunction ItemContainerComponent(\n { item, placed, acquired, inTransition, transform, getItemSize, onKeyMove, children }: ItemContainerProps,\n ref: Ref<ItemContainerRef>,\n) {\n const originalSizeRef = useRef({ width: 0, height: 0 });\n const pointerOffsetRef = useRef(new Coordinates({ x: 0, y: 0 }));\n const pointerBoundariesRef = useRef<null | Coordinates>(null);\n const [transition, setTransition] = useState<null | Transition>(null);\n const [isHidden, setIsHidden] = useState(false);\n const muteEventsRef = useRef(false);\n const itemRef = useRef<HTMLDivElement>(null);\n const draggableApi = useDraggable({\n draggableItem: item,\n getCollisionRect: (operation, coordinates, dropTarget) => {\n const sizeOverride = operation === \"insert\" && dropTarget ? getItemSize(dropTarget) : null;\n return getCollisionRect(operation, itemRef.current!, coordinates, sizeOverride);\n },\n });\n\n function updateTransition({\n operation,\n interactionType,\n draggableItem,\n collisionRect,\n coordinates,\n dropTarget,\n }: DragAndDropData) {\n if (item.id === draggableItem.id) {\n const [width, height] = [collisionRect.right - collisionRect.left, collisionRect.bottom - collisionRect.top];\n const pointerOffset = pointerOffsetRef.current;\n\n if (operation === \"resize\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: {\n width: Math.max(getItemSize(null).minWidth, Math.min(getItemSize(null).maxWidth, width - pointerOffset.x)),\n height: Math.max(getItemSize(null).minHeight, height - pointerOffset.y),\n },\n positionTransform: null,\n });\n } else if (operation === \"insert\" || operation === \"reorder\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: dropTarget ? getItemSize(dropTarget) : originalSizeRef.current,\n positionTransform: { x: coordinates.x - pointerOffset.x, y: coordinates.y - pointerOffset.y },\n hasDropTarget: !!dropTarget,\n });\n }\n }\n }\n\n useDragSubscription(\"start\", (detail) => updateTransition(detail));\n useDragSubscription(\"update\", (detail) => updateTransition(detail));\n useDragSubscription(\"submit\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n useDragSubscription(\"discard\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n\n // During the transition listen to pointer move and pointer up events to update/submit transition.\n const transitionInteractionType = transition?.interactionType ?? null;\n const transitionItemId = transition?.itemId ?? null;\n useEffect(() => {\n const onPointerMove = throttle((event: PointerEvent) => {\n const coordinates = Coordinates.fromEvent(event);\n draggableApi.updateTransition(\n new Coordinates({\n x: Math.max(coordinates.x, pointerBoundariesRef.current?.x ?? Number.NEGATIVE_INFINITY),\n y: Math.max(coordinates.y, pointerBoundariesRef.current?.y ?? Number.NEGATIVE_INFINITY),\n }),\n );\n }, 10);\n const onPointerUp = () => {\n onPointerMove.cancel();\n draggableApi.submitTransition();\n };\n\n if (transitionInteractionType === \"pointer\" && transitionItemId === item.id) {\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n }\n return () => {\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n };\n // draggableApi is not expected to change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [item.id, transitionInteractionType, transitionItemId]);\n\n useEffect(() => {\n if (transitionInteractionType === \"keyboard\" && transitionItemId === item.id) {\n const onPointerDown = () => draggableApi.submitTransition();\n window.addEventListener(\"pointerdown\", onPointerDown, true);\n return () => {\n window.removeEventListener(\"pointerdown\", onPointerDown, true);\n };\n }\n // draggableApi is not expected to change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [item.id, transitionInteractionType, transitionItemId]);\n\n function onKeyboardTransitionToggle(operation: \"drag\" | \"resize\") {\n // The acquired item is a copy and does not have the transition state.\n // However, pressing \"Space\" or \"Enter\" on the acquired item must submit the active transition.\n if (acquired) {\n return draggableApi.submitTransition();\n }\n\n // Create new transition if missing.\n if (!transition) {\n const rect = getNormalizedElementRect(itemRef.current!);\n const coordinates = new Coordinates({\n x: operation === \"drag\" ? rect.left : rect.right,\n y: operation === \"drag\" ? rect.top : rect.bottom,\n });\n\n if (operation === \"drag\" && !placed) {\n draggableApi.start(\"insert\", \"keyboard\", coordinates);\n } else if (operation === \"drag\") {\n draggableApi.start(\"reorder\", \"keyboard\", coordinates);\n } else {\n draggableApi.start(\"resize\", \"keyboard\", coordinates);\n }\n }\n // Submit a transition if existing.\n else {\n draggableApi.submitTransition();\n }\n }\n\n function handleInsert(direction: Direction) {\n // Find the closest droppable (in the direction) to the item.\n const droppables = draggableApi.getDroppables();\n const nextDroppable = getNextDroppable(itemRef.current!, droppables, direction);\n\n if (!nextDroppable) {\n // TODO: add announcement\n // Context: the keyboard insertion only works when there is some droppable area in the specified direction.\n // That means that only some arrow keys might work which is confusing for a screen-reader user.\n // Alternatively, we can consider a multi-step insertion where the user would first explicitly select the desired board.\n return;\n }\n\n // Notify the respective droppable of the intention to insert the item in it.\n draggableApi.acquire(nextDroppable, () => children(true));\n setIsHidden(true);\n muteEventsRef.current = true;\n }\n\n function onHandleKeyDown(operation: \"drag\" | \"resize\", event: KeyboardEvent) {\n const canInsert = transition && operation === \"drag\" && !placed;\n const canNavigate = transition || operation === \"drag\";\n\n // The insert is handled by the item and the navigation is delegated to the containing layout.\n const move = (direction: Direction) => {\n if (canInsert) {\n handleInsert(direction);\n } else if (canNavigate) {\n onKeyMove?.(direction);\n }\n };\n\n const discard = () => {\n if (transition || acquired) {\n draggableApi.discardTransition();\n }\n };\n\n switch (event.key) {\n case \"ArrowUp\":\n return move(\"up\");\n case \"ArrowDown\":\n return move(\"down\");\n case \"ArrowLeft\":\n return move(\"left\");\n case \"ArrowRight\":\n return move(\"right\");\n case \" \":\n case \"Enter\":\n return onKeyboardTransitionToggle(operation);\n case \"Escape\":\n return discard();\n }\n }\n\n function onBlur() {\n // When drag- or resize handle on palette or board item loses focus the transition must be submitted with two exceptions:\n // 1. If the last interaction is not \"keyboard\" (the user clicked on another handle issuing a new transition);\n // 2. If the item is acquired by the board (in that case the focus moves to the board item which is expected, palette item is hidden and all events handlers must be muted).\n if (transition && transition.interactionType === \"keyboard\" && !muteEventsRef.current) {\n draggableApi.submitTransition();\n }\n }\n\n function onDragHandlePointerDown(event: ReactPointerEvent) {\n // Calculate the offset between item's top-left corner and the pointer landing position.\n const rect = itemRef.current!.getBoundingClientRect();\n pointerOffsetRef.current = new Coordinates({ x: event.clientX - rect.left, y: event.clientY - rect.top });\n originalSizeRef.current = { width: rect.width, height: rect.height };\n pointerBoundariesRef.current = null;\n\n draggableApi.start(!placed ? \"insert\" : \"reorder\", \"pointer\", Coordinates.fromEvent(event));\n }\n\n function onDragHandleKeyDown(event: KeyboardEvent) {\n onHandleKeyDown(\"drag\", event);\n }\n\n function onResizeHandlePointerDown(event: ReactPointerEvent) {\n // Calculate the offset between item's bottom-right corner and the pointer landing position.\n const rect = itemRef.current!.getBoundingClientRect();\n pointerOffsetRef.current = new Coordinates({ x: event.clientX - rect.right, y: event.clientY - rect.bottom });\n originalSizeRef.current = { width: rect.width, height: rect.height };\n\n // Calculate boundaries below which the cursor cannot move.\n const minWidth = getItemSize(null).minWidth;\n const minHeight = getItemSize(null).minHeight;\n pointerBoundariesRef.current = new Coordinates({\n x: event.clientX - rect.width + minWidth,\n y: event.clientY - rect.height + minHeight,\n });\n\n draggableApi.start(\"resize\", \"pointer\", Coordinates.fromEvent(event));\n }\n\n function onResizeHandleKeyDown(event: KeyboardEvent) {\n onHandleKeyDown(\"resize\", event);\n }\n\n const itemTransitionStyle: CSSProperties = {};\n const itemTransitionClassNames: string[] = [];\n\n if (inTransition) {\n itemTransitionClassNames.push(styles.inTransition);\n }\n\n if (transition && transition.interactionType === \"pointer\") {\n // Adjust the dragged/resized item to the pointer's location.\n itemTransitionClassNames.push(transition.operation === \"resize\" ? styles.resized : styles.dragged);\n itemTransitionStyle.left = transition.positionTransform?.x;\n itemTransitionStyle.top = transition.positionTransform?.y;\n itemTransitionStyle.width = transition.sizeTransform?.width;\n itemTransitionStyle.height = transition.sizeTransform?.height;\n itemTransitionStyle.pointerEvents = \"none\";\n }\n\n if (isHidden) {\n itemTransitionClassNames.push(styles.hidden);\n }\n\n if (transform) {\n // The moved items positions are altered with CSS transform.\n if (transform.type === \"move\") {\n itemTransitionClassNames.push(styles.transformed);\n itemTransitionStyle.transform = CSSUtil.Transform.toString({\n x: transform.x,\n y: transform.y,\n scaleX: 1,\n scaleY: 1,\n });\n itemTransitionStyle.width = transform.width + \"px\";\n itemTransitionStyle.height = transform.height + \"px\";\n }\n // The item is removed from the DOM after animations play.\n // During the animations the removed item is hidden with styles.\n if (transform.type === \"remove\") {\n itemTransitionClassNames.push(styles.removed);\n }\n }\n\n const dragHandleRef = useRef<HTMLButtonElement>(null);\n useImperativeHandle(ref, () => ({\n focusDragHandle: () => dragHandleRef.current?.focus(),\n }));\n\n const isActive = (!!transition && !isHidden) || !!acquired;\n const shouldUsePortal = transition?.operation === \"insert\" && transition?.interactionType === \"pointer\";\n const childrenRef = useRef<ReactNode>(null);\n if (!inTransition || isActive) {\n childrenRef.current = children(!!transition?.hasDropTarget);\n }\n\n const content = (\n <div\n ref={itemRef}\n className={clsx(styles.root, ...itemTransitionClassNames)}\n style={itemTransitionStyle}\n data-item-id={item.id}\n onBlur={onBlur}\n >\n <ItemContext.Provider\n value={{\n isActive,\n dragHandle: {\n ref: dragHandleRef,\n onPointerDown: onDragHandlePointerDown,\n onKeyDown: onDragHandleKeyDown,\n isActive: isActive && transition?.operation === \"reorder\",\n },\n resizeHandle: placed\n ? {\n onPointerDown: onResizeHandlePointerDown,\n onKeyDown: onResizeHandleKeyDown,\n isActive: isActive && transition?.operation === \"resize\",\n }\n : null,\n }}\n >\n {childrenRef.current}\n </ItemContext.Provider>\n </div>\n );\n\n return shouldUsePortal ? <div>{createPortal(content, document.body)}</div> : content;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/item-container/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAChH,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAOL,aAAa,EACb,UAAU,EACV,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAKL,mBAAmB,EACnB,YAAY,GACb,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAqBrC,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAyB,IAAI,CAAC,CAAC;AAEvE,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAyCD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAEhE,SAAS,sBAA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SAAS,MAAK,SAAS;iBAC1D;gBACD,YAAY,EAAE,MAAM;oBAClB,CAAC,CAAC;wBACE,aAAa,EAAE,yBAAyB;wBACxC,SAAS,EAAE,qBAAqB;wBAChC,QAAQ,EAAE,QAAQ,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,MAAK,QAAQ;qBACzD;oBACH,CAAC,CAAC,IAAI;aACT,YAEA,WAAW,CAAC,OAAO,GACC,GACnB,CACP,CAAC;IAEF,OAAO,eAAe,CAAC,CAAC,CAAC,wBAAM,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getLogicalBoundingClientRect, getLogicalClientX } from \"@cloudscape-design/component-toolkit/internal\";\nimport { CSS as CSSUtil } from \"@dnd-kit/utilities\";\nimport clsx from \"clsx\";\nimport {\n CSSProperties,\n KeyboardEvent,\n ReactNode,\n PointerEvent as ReactPointerEvent,\n Ref,\n RefObject,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n DragAndDropData,\n DropTargetContext,\n InteractionType,\n Operation,\n useDragSubscription,\n useDraggable,\n} from \"../dnd-controller/controller\";\nimport { BoardItemDefinitionBase, Direction, ItemId, Transform } from \"../interfaces\";\nimport { Coordinates } from \"../utils/coordinates\";\nimport { getNormalizedElementRect } from \"../utils/screen\";\n\nimport { throttle } from \"../utils/throttle\";\nimport { getCollisionRect } from \"./get-collision-rect\";\nimport { getNextDroppable } from \"./get-next-droppable\";\nimport styles from \"./styles.css.js\";\n\nexport interface ItemContainerRef {\n focusDragHandle(): void;\n}\n\ninterface ItemContextType {\n isActive: boolean;\n dragHandle: {\n ref: RefObject<HTMLButtonElement>;\n onPointerDown(event: ReactPointerEvent): void;\n onKeyDown(event: KeyboardEvent): void;\n isActive: boolean;\n };\n resizeHandle: null | {\n onPointerDown(event: ReactPointerEvent): void;\n onKeyDown(event: KeyboardEvent): void;\n isActive: boolean;\n };\n}\n\nexport const ItemContext = createContext<ItemContextType | null>(null);\n\nexport function useItemContext() {\n const ctx = useContext(ItemContext);\n if (!ctx) {\n throw new Error(\"Unable to find BoardItem context.\");\n }\n return ctx;\n}\n\ninterface Transition {\n itemId: ItemId;\n operation: Operation;\n interactionType: InteractionType;\n sizeTransform: null | { width: number; height: number };\n positionTransform: null | { x: number; y: number };\n hasDropTarget?: boolean;\n}\n\n/**\n * Defines item's parameters and its relation with the layout.\n *\n * `item` - the unique board item base object to be used in d&d context.\n * `placed` - specifies if the item already belongs to the board.\n * `acquired` - specifies if the item is essentially a copy temporarily acquired by a droppable but not submitted yet.\n * `inTransition` - specifies if the item is currently being moved.\n * `transform` - specifies if the item's position needs to be altered.\n * `getItemSize` - item size getter that takes droppable context as argument.\n * `onKeyMove` - a callback that fires when arrow keys are pressed in drag- or resize handle.\n */\nexport interface ItemContainerProps {\n item: BoardItemDefinitionBase<unknown>;\n placed: boolean;\n acquired: boolean;\n inTransition: boolean;\n transform: Transform | undefined;\n getItemSize: (context: null | DropTargetContext) => {\n width: number;\n minWidth: number;\n maxWidth: number;\n height: number;\n minHeight: number;\n maxHeight: number;\n };\n onKeyMove?(direction: Direction): void;\n children: (hasDropTarget: boolean) => ReactNode;\n isRtl: () => boolean;\n}\n\nexport const ItemContainer = forwardRef(ItemContainerComponent);\n\nfunction ItemContainerComponent(\n { item, placed, acquired, inTransition, transform, getItemSize, onKeyMove, children, isRtl }: ItemContainerProps,\n ref: Ref<ItemContainerRef>,\n) {\n const originalSizeRef = useRef({ width: 0, height: 0 });\n const pointerOffsetRef = useRef(new Coordinates({ x: 0, y: 0 }));\n const pointerBoundariesRef = useRef<null | Coordinates>(null);\n const [transition, setTransition] = useState<null | Transition>(null);\n const [isHidden, setIsHidden] = useState(false);\n const muteEventsRef = useRef(false);\n const itemRef = useRef<HTMLDivElement>(null);\n const draggableApi = useDraggable({\n draggableItem: item,\n getCollisionRect: (operation, coordinates, dropTarget) => {\n const sizeOverride = operation === \"insert\" && dropTarget ? getItemSize(dropTarget) : null;\n return getCollisionRect(operation, itemRef.current!, coordinates, sizeOverride);\n },\n });\n\n function updateTransition({\n operation,\n interactionType,\n draggableItem,\n collisionRect,\n coordinates,\n dropTarget,\n }: DragAndDropData) {\n if (item.id === draggableItem.id) {\n const [width, height] = [collisionRect.right - collisionRect.left, collisionRect.bottom - collisionRect.top];\n const pointerOffset = pointerOffsetRef.current;\n\n if (operation === \"resize\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: {\n width: Math.max(getItemSize(null).minWidth, Math.min(getItemSize(null).maxWidth, width - pointerOffset.x)),\n height: Math.max(getItemSize(null).minHeight, height - pointerOffset.y),\n },\n positionTransform: null,\n });\n } else if (operation === \"insert\" || operation === \"reorder\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: dropTarget ? getItemSize(dropTarget) : originalSizeRef.current,\n positionTransform: { x: coordinates.x - pointerOffset.x, y: coordinates.y - pointerOffset.y },\n hasDropTarget: !!dropTarget,\n });\n }\n }\n }\n\n useDragSubscription(\"start\", (detail) => updateTransition(detail));\n useDragSubscription(\"update\", (detail) => updateTransition(detail));\n useDragSubscription(\"submit\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n useDragSubscription(\"discard\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n\n // During the transition listen to pointer move and pointer up events to update/submit transition.\n const transitionInteractionType = transition?.interactionType ?? null;\n const transitionItemId = transition?.itemId ?? null;\n useEffect(() => {\n const onPointerMove = throttle((event: PointerEvent) => {\n const coordinates = Coordinates.fromEvent(event, { isRtl: isRtl() });\n draggableApi.updateTransition(\n new Coordinates({\n x: Math.max(coordinates.x, pointerBoundariesRef.current?.x ?? Number.NEGATIVE_INFINITY),\n y: Math.max(coordinates.y, pointerBoundariesRef.current?.y ?? Number.NEGATIVE_INFINITY),\n }),\n );\n }, 10);\n const onPointerUp = () => {\n onPointerMove.cancel();\n draggableApi.submitTransition();\n };\n\n if (transitionInteractionType === \"pointer\" && transitionItemId === item.id) {\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n }\n return () => {\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n };\n // draggableApi is not expected to change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [item.id, transitionInteractionType, transitionItemId]);\n\n useEffect(() => {\n if (transitionInteractionType === \"keyboard\" && transitionItemId === item.id) {\n const onPointerDown = () => draggableApi.submitTransition();\n window.addEventListener(\"pointerdown\", onPointerDown, true);\n return () => {\n window.removeEventListener(\"pointerdown\", onPointerDown, true);\n };\n }\n // draggableApi is not expected to change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [item.id, transitionInteractionType, transitionItemId]);\n\n function onKeyboardTransitionToggle(operation: \"drag\" | \"resize\") {\n // The acquired item is a copy and does not have the transition state.\n // However, pressing \"Space\" or \"Enter\" on the acquired item must submit the active transition.\n if (acquired) {\n return draggableApi.submitTransition();\n }\n\n // Create new transition if missing.\n if (!transition) {\n const rect = getNormalizedElementRect(itemRef.current!);\n const coordinates = new Coordinates({\n x: operation === \"drag\" ? rect.left : rect.right,\n y: operation === \"drag\" ? rect.top : rect.bottom,\n });\n\n if (operation === \"drag\" && !placed) {\n draggableApi.start(\"insert\", \"keyboard\", coordinates);\n } else if (operation === \"drag\") {\n draggableApi.start(\"reorder\", \"keyboard\", coordinates);\n } else {\n draggableApi.start(\"resize\", \"keyboard\", coordinates);\n }\n }\n // Submit a transition if existing.\n else {\n draggableApi.submitTransition();\n }\n }\n\n function handleInsert(direction: Direction) {\n // Find the closest droppable (in the direction) to the item.\n const droppables = draggableApi.getDroppables();\n const nextDroppable = getNextDroppable({\n draggableElement: itemRef.current!,\n droppables,\n direction,\n isRtl: isRtl(),\n });\n\n if (!nextDroppable) {\n // TODO: add announcement\n // Context: the keyboard insertion only works when there is some droppable area in the specified direction.\n // That means that only some arrow keys might work which is confusing for a screen-reader user.\n // Alternatively, we can consider a multi-step insertion where the user would first explicitly select the desired board.\n return;\n }\n\n // Notify the respective droppable of the intention to insert the item in it.\n draggableApi.acquire(nextDroppable, () => children(true));\n setIsHidden(true);\n muteEventsRef.current = true;\n }\n\n function onHandleKeyDown(operation: \"drag\" | \"resize\", event: KeyboardEvent) {\n const canInsert = transition && operation === \"drag\" && !placed;\n const canNavigate = transition || operation === \"drag\";\n\n // The insert is handled by the item and the navigation is delegated to the containing layout.\n const move = (direction: Direction) => {\n if (canInsert) {\n handleInsert(direction);\n } else if (canNavigate) {\n onKeyMove?.(direction);\n }\n };\n\n const discard = () => {\n if (transition || acquired) {\n draggableApi.discardTransition();\n }\n };\n\n switch (event.key) {\n case \"ArrowUp\":\n return move(\"up\");\n case \"ArrowDown\":\n return move(\"down\");\n case \"ArrowLeft\":\n return move(\"left\");\n case \"ArrowRight\":\n return move(\"right\");\n case \" \":\n case \"Enter\":\n return onKeyboardTransitionToggle(operation);\n case \"Escape\":\n return discard();\n }\n }\n\n function onBlur() {\n // When drag- or resize handle on palette or board item loses focus the transition must be submitted with two exceptions:\n // 1. If the last interaction is not \"keyboard\" (the user clicked on another handle issuing a new transition);\n // 2. If the item is acquired by the board (in that case the focus moves to the board item which is expected, palette item is hidden and all events handlers must be muted).\n if (transition && transition.interactionType === \"keyboard\" && !muteEventsRef.current) {\n draggableApi.submitTransition();\n }\n }\n\n function onDragHandlePointerDown(event: ReactPointerEvent) {\n // Calculate the offset between item's top-left corner and the pointer landing position.\n const rect = getLogicalBoundingClientRect(itemRef.current!);\n const clientX = getLogicalClientX(event, isRtl());\n const clientY = event.clientY;\n pointerOffsetRef.current = new Coordinates({\n x: clientX - rect.insetInlineStart,\n y: clientY - rect.insetBlockStart,\n });\n originalSizeRef.current = { width: rect.inlineSize, height: rect.blockSize };\n pointerBoundariesRef.current = null;\n\n draggableApi.start(!placed ? \"insert\" : \"reorder\", \"pointer\", Coordinates.fromEvent(event, { isRtl: isRtl() }));\n }\n\n function onDragHandleKeyDown(event: KeyboardEvent) {\n onHandleKeyDown(\"drag\", event);\n }\n\n function onResizeHandlePointerDown(event: ReactPointerEvent) {\n // Calculate the offset between item's bottom-right corner and the pointer landing position.\n const rect = getLogicalBoundingClientRect(itemRef.current!);\n const clientX = getLogicalClientX(event, isRtl());\n const clientY = event.clientY;\n pointerOffsetRef.current = new Coordinates({ x: clientX - rect.insetInlineEnd, y: clientY - rect.insetBlockEnd });\n originalSizeRef.current = { width: rect.inlineSize, height: rect.blockSize };\n\n // Calculate boundaries below which the cursor cannot move.\n const minWidth = getItemSize(null).minWidth;\n const minHeight = getItemSize(null).minHeight;\n pointerBoundariesRef.current = new Coordinates({\n x: clientX - rect.inlineSize + minWidth,\n y: clientY - rect.blockSize + minHeight,\n });\n\n draggableApi.start(\"resize\", \"pointer\", Coordinates.fromEvent(event, { isRtl: isRtl() }));\n }\n\n function onResizeHandleKeyDown(event: KeyboardEvent) {\n onHandleKeyDown(\"resize\", event);\n }\n\n const itemTransitionStyle: CSSProperties = {};\n const itemTransitionClassNames: string[] = [];\n\n if (inTransition) {\n itemTransitionClassNames.push(styles.inTransition);\n }\n\n if (transition && transition.interactionType === \"pointer\") {\n // Adjust the dragged/resized item to the pointer's location.\n itemTransitionClassNames.push(transition.operation === \"resize\" ? styles.resized : styles.dragged);\n itemTransitionStyle.insetInlineStart = transition.positionTransform?.x;\n itemTransitionStyle.insetBlockStart = transition.positionTransform?.y;\n itemTransitionStyle.inlineSize = transition.sizeTransform?.width;\n itemTransitionStyle.blockSize = transition.sizeTransform?.height;\n itemTransitionStyle.pointerEvents = \"none\";\n }\n\n if (isHidden) {\n itemTransitionClassNames.push(styles.hidden);\n }\n\n if (transform) {\n // The moved items positions are altered with CSS transform.\n if (transform.type === \"move\") {\n itemTransitionClassNames.push(styles.transformed);\n itemTransitionStyle.transform = CSSUtil.Transform.toString({\n x: transform.x,\n y: transform.y,\n scaleX: 1,\n scaleY: 1,\n });\n itemTransitionStyle.width = transform.width + \"px\";\n itemTransitionStyle.height = transform.height + \"px\";\n }\n // The item is removed from the DOM after animations play.\n // During the animations the removed item is hidden with styles.\n if (transform.type === \"remove\") {\n itemTransitionClassNames.push(styles.removed);\n }\n }\n\n const dragHandleRef = useRef<HTMLButtonElement>(null);\n useImperativeHandle(ref, () => ({\n focusDragHandle: () => dragHandleRef.current?.focus(),\n }));\n\n const isActive = (!!transition && !isHidden) || !!acquired;\n const shouldUsePortal = transition?.operation === \"insert\" && transition?.interactionType === \"pointer\";\n const childrenRef = useRef<ReactNode>(null);\n if (!inTransition || isActive) {\n childrenRef.current = children(!!transition?.hasDropTarget);\n }\n\n const content = (\n <div\n ref={itemRef}\n className={clsx(styles.root, ...itemTransitionClassNames)}\n style={itemTransitionStyle}\n data-item-id={item.id}\n onBlur={onBlur}\n >\n <ItemContext.Provider\n value={{\n isActive,\n dragHandle: {\n ref: dragHandleRef,\n onPointerDown: onDragHandlePointerDown,\n onKeyDown: onDragHandleKeyDown,\n isActive: isActive && transition?.operation === \"reorder\",\n },\n resizeHandle: placed\n ? {\n onPointerDown: onResizeHandlePointerDown,\n onKeyDown: onResizeHandleKeyDown,\n isActive: isActive && transition?.operation === \"resize\",\n }\n : null,\n }}\n >\n {childrenRef.current}\n </ItemContext.Provider>\n </div>\n );\n\n return shouldUsePortal ? <div>{createPortal(content, document.body)}</div> : content;\n}\n"]}
|
|
@@ -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
|
-
"hidden": "
|
|
4
|
+
"root": "awsui_root_lljvd_bapad_1",
|
|
5
|
+
"inTransition": "awsui_inTransition_lljvd_bapad_7",
|
|
6
|
+
"transformed": "awsui_transformed_lljvd_bapad_12",
|
|
7
|
+
"removed": "awsui_removed_lljvd_bapad_17",
|
|
8
|
+
"dragged": "awsui_dragged_lljvd_bapad_21",
|
|
9
|
+
"resized": "awsui_resized_lljvd_bapad_26",
|
|
10
|
+
"hidden": "awsui_hidden_lljvd_bapad_31"
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
.
|
|
1
|
+
.awsui_root_lljvd_bapad_1:not(#\9) {
|
|
2
2
|
touch-action: none;
|
|
3
3
|
position: relative;
|
|
4
|
-
|
|
4
|
+
block-size: 100%;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.
|
|
7
|
+
.awsui_inTransition_lljvd_bapad_7:not(#\9) {
|
|
8
8
|
transition: transform 200ms;
|
|
9
9
|
transition-timing-function: ease;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.
|
|
12
|
+
.awsui_transformed_lljvd_bapad_12:not(#\9) {
|
|
13
13
|
position: absolute;
|
|
14
14
|
z-index: 1;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.
|
|
17
|
+
.awsui_removed_lljvd_bapad_17:not(#\9) {
|
|
18
18
|
display: none;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.awsui_dragged_lljvd_bapad_21:not(#\9) {
|
|
22
22
|
z-index: 2000;
|
|
23
23
|
position: fixed;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
26
|
+
.awsui_resized_lljvd_bapad_26:not(#\9) {
|
|
27
27
|
z-index: 2000;
|
|
28
28
|
position: absolute;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.awsui_hidden_lljvd_bapad_31:not(#\9) {
|
|
32
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
|
-
"hidden": "
|
|
5
|
+
"root": "awsui_root_lljvd_bapad_1",
|
|
6
|
+
"inTransition": "awsui_inTransition_lljvd_bapad_7",
|
|
7
|
+
"transformed": "awsui_transformed_lljvd_bapad_12",
|
|
8
|
+
"removed": "awsui_removed_lljvd_bapad_17",
|
|
9
|
+
"dragged": "awsui_dragged_lljvd_bapad_21",
|
|
10
|
+
"resized": "awsui_resized_lljvd_bapad_26",
|
|
11
|
+
"hidden": "awsui_hidden_lljvd_bapad_31"
|
|
12
12
|
};
|
|
13
13
|
|
package/internal/manifest.json
CHANGED