@cloudscape-design/board-components 3.0.0
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/Config +23 -0
- package/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README-cloudscape.md +20 -0
- package/README-open-source.md +0 -0
- package/README.md +20 -0
- package/board/index.d.ts +4 -0
- package/board/index.js +11 -0
- package/board/interfaces.d.ts +167 -0
- package/board/interfaces.js +1 -0
- package/board/internal.d.ts +4 -0
- package/board/internal.js +199 -0
- package/board/placeholder.d.ts +10 -0
- package/board/placeholder.js +24 -0
- package/board/styles.css.js +10 -0
- package/board/styles.scoped.css +23 -0
- package/board/styles.selectors.js +11 -0
- package/board/transition.d.ts +50 -0
- package/board/transition.js +211 -0
- package/board/utils/announcements.d.ts +10 -0
- package/board/utils/announcements.js +98 -0
- package/board/utils/create-transforms.d.ts +7 -0
- package/board/utils/create-transforms.js +22 -0
- package/board/utils/events.d.ts +3 -0
- package/board/utils/events.js +14 -0
- package/board/utils/get-hovered-rect.d.ts +10 -0
- package/board/utils/get-hovered-rect.js +19 -0
- package/board/utils/layout.d.ts +19 -0
- package/board/utils/layout.js +77 -0
- package/board/utils/path.d.ts +10 -0
- package/board/utils/path.js +73 -0
- package/board-item/header.d.ts +7 -0
- package/board-item/header.js +8 -0
- package/board-item/index.d.ts +4 -0
- package/board-item/index.js +11 -0
- package/board-item/interfaces.d.ts +42 -0
- package/board-item/interfaces.js +1 -0
- package/board-item/internal.d.ts +4 -0
- package/board-item/internal.js +20 -0
- package/board-item/styles.css.js +15 -0
- package/board-item/styles.scoped.css +41 -0
- package/board-item/styles.selectors.js +16 -0
- package/index.d.ts +6 -0
- package/index.js +5 -0
- package/internal/api-docs/components/board-item.js +68 -0
- package/internal/api-docs/components/board.js +117 -0
- package/internal/api-docs/components/index.js +5 -0
- package/internal/api-docs/components/items-palette.js +58 -0
- package/internal/api-docs/test-utils-doc/dom.js +4 -0
- package/internal/api-docs/test-utils-doc/selectors.js +4 -0
- package/internal/base-component/use-base-component.d.ts +12 -0
- package/internal/base-component/use-base-component.js +16 -0
- package/internal/base-component/use-telemetry.d.ts +1 -0
- package/internal/base-component/use-telemetry.js +9 -0
- package/internal/base-component/use-visual-refresh.d.ts +1 -0
- package/internal/base-component/use-visual-refresh.js +24 -0
- package/internal/breakpoints.d.ts +2 -0
- package/internal/breakpoints.js +18 -0
- package/internal/constants.d.ts +3 -0
- package/internal/constants.js +5 -0
- package/internal/debug-tools/converters.d.ts +4 -0
- package/internal/debug-tools/converters.js +21 -0
- package/internal/debug-tools/generators.d.ts +25 -0
- package/internal/debug-tools/generators.js +258 -0
- package/internal/debug-tools/index.d.ts +8 -0
- package/internal/debug-tools/index.js +10 -0
- package/internal/debug-tools/interfaces.d.ts +2 -0
- package/internal/debug-tools/interfaces.js +3 -0
- package/internal/debug-tools/parsers.d.ts +8 -0
- package/internal/debug-tools/parsers.js +66 -0
- package/internal/dnd-controller/__mocks__/controller.d.ts +13 -0
- package/internal/dnd-controller/__mocks__/controller.js +33 -0
- package/internal/dnd-controller/collision.d.ts +17 -0
- package/internal/dnd-controller/collision.js +32 -0
- package/internal/dnd-controller/controller.d.ts +64 -0
- package/internal/dnd-controller/controller.js +131 -0
- package/internal/dnd-controller/event-emitter.d.ts +9 -0
- package/internal/dnd-controller/event-emitter.js +22 -0
- package/internal/drag-handle/icon.d.ts +4 -0
- package/internal/drag-handle/icon.js +12 -0
- package/internal/drag-handle/index.d.ts +9 -0
- package/internal/drag-handle/index.js +11 -0
- package/internal/drag-handle/styles.css.js +6 -0
- package/internal/drag-handle/styles.scoped.css +7 -0
- package/internal/drag-handle/styles.selectors.js +7 -0
- package/internal/environment.d.ts +4 -0
- package/internal/environment.js +4 -0
- package/internal/generated/styles/tokens.d.ts +0 -0
- package/internal/generated/styles/tokens.js +0 -0
- package/internal/grid/grid.d.ts +3 -0
- package/internal/grid/grid.js +28 -0
- package/internal/grid/index.d.ts +2 -0
- package/internal/grid/index.js +3 -0
- package/internal/grid/interfaces.d.ts +14 -0
- package/internal/grid/interfaces.js +3 -0
- package/internal/grid/item.d.ts +8 -0
- package/internal/grid/item.js +10 -0
- package/internal/grid/styles.css.js +7 -0
- package/internal/grid/styles.scoped.css +221 -0
- package/internal/grid/styles.selectors.js +8 -0
- package/internal/handle/index.d.ts +3 -0
- package/internal/handle/index.js +17 -0
- package/internal/handle/styles.css.js +6 -0
- package/internal/handle/styles.scoped.css +32 -0
- package/internal/handle/styles.selectors.js +7 -0
- package/internal/interfaces.d.ts +50 -0
- package/internal/interfaces.js +3 -0
- package/internal/is-development.d.ts +6 -0
- package/internal/is-development.js +8 -0
- package/internal/item-container/get-next-droppable.d.ts +7 -0
- package/internal/item-container/get-next-droppable.js +15 -0
- package/internal/item-container/index.d.ts +48 -0
- package/internal/item-container/index.js +262 -0
- package/internal/item-container/styles.css.js +12 -0
- package/internal/item-container/styles.scoped.css +33 -0
- package/internal/item-container/styles.selectors.js +13 -0
- package/internal/layout-engine/engine-conflicts.d.ts +4 -0
- package/internal/layout-engine/engine-conflicts.js +53 -0
- package/internal/layout-engine/engine-step.d.ts +5 -0
- package/internal/layout-engine/engine-step.js +307 -0
- package/internal/layout-engine/engine.d.ts +19 -0
- package/internal/layout-engine/engine.js +105 -0
- package/internal/layout-engine/grid.d.ts +28 -0
- package/internal/layout-engine/grid.js +140 -0
- package/internal/layout-engine/interfaces.d.ts +30 -0
- package/internal/layout-engine/interfaces.js +3 -0
- package/internal/layout-engine/utils.d.ts +12 -0
- package/internal/layout-engine/utils.js +79 -0
- package/internal/live-region/index.d.ts +44 -0
- package/internal/live-region/index.js +85 -0
- package/internal/logging.d.ts +1 -0
- package/internal/logging.js +10 -0
- package/internal/manifest.json +3 -0
- package/internal/resize-handle/icon.d.ts +4 -0
- package/internal/resize-handle/icon.js +12 -0
- package/internal/resize-handle/index.d.ts +8 -0
- package/internal/resize-handle/index.js +7 -0
- package/internal/resize-handle/styles.css.js +6 -0
- package/internal/resize-handle/styles.scoped.css +3 -0
- package/internal/resize-handle/styles.selectors.js +7 -0
- package/internal/screenreader-grid-navigation/index.d.ts +22 -0
- package/internal/screenreader-grid-navigation/index.js +42 -0
- package/internal/screenreader-grid-navigation/styles.css.js +7 -0
- package/internal/screenreader-grid-navigation/styles.scoped.css +12 -0
- package/internal/screenreader-grid-navigation/styles.selectors.js +8 -0
- package/internal/screenreader-only/index.d.ts +21 -0
- package/internal/screenreader-only/index.js +23 -0
- package/internal/screenreader-only/styles.css.js +6 -0
- package/internal/screenreader-only/styles.scoped.css +9 -0
- package/internal/screenreader-only/styles.selectors.js +7 -0
- package/internal/utils/apply-display-name.d.ts +1 -0
- package/internal/utils/apply-display-name.js +5 -0
- package/internal/utils/coordinates.d.ts +14 -0
- package/internal/utils/coordinates.js +20 -0
- package/internal/utils/events.d.ts +2 -0
- package/internal/utils/events.js +18 -0
- package/internal/utils/layout.d.ts +18 -0
- package/internal/utils/layout.js +132 -0
- package/internal/utils/position.d.ts +9 -0
- package/internal/utils/position.js +9 -0
- package/internal/utils/rects.d.ts +6 -0
- package/internal/utils/rects.js +76 -0
- package/internal/utils/screen.d.ts +1 -0
- package/internal/utils/screen.js +17 -0
- package/internal/utils/stack-set.d.ts +8 -0
- package/internal/utils/stack-set.js +23 -0
- package/internal/utils/throttle.d.ts +5 -0
- package/internal/utils/throttle.js +51 -0
- package/internal/utils/use-auto-scroll.d.ts +5 -0
- package/internal/utils/use-auto-scroll.js +62 -0
- package/internal/utils/use-last-interaction.d.ts +1 -0
- package/internal/utils/use-last-interaction.js +22 -0
- package/internal/utils/use-merge-refs.d.ts +9 -0
- package/internal/utils/use-merge-refs.js +29 -0
- package/internal/utils/use-stable-event-handler.d.ts +9 -0
- package/internal/utils/use-stable-event-handler.js +19 -0
- package/internal/utils/use-throttled-event-handler.d.ts +1 -0
- package/internal/utils/use-throttled-event-handler.js +11 -0
- package/internal/utils/zip-arrays.d.ts +1 -0
- package/internal/utils/zip-arrays.js +8 -0
- package/items-palette/index.d.ts +4 -0
- package/items-palette/index.js +11 -0
- package/items-palette/interfaces.d.ts +49 -0
- package/items-palette/interfaces.js +3 -0
- package/items-palette/internal.d.ts +4 -0
- package/items-palette/internal.js +73 -0
- package/items-palette/styles.css.js +6 -0
- package/items-palette/styles.scoped.css +3 -0
- package/items-palette/styles.selectors.js +7 -0
- package/package.json +43 -0
- package/test-utils/dom/board/index.d.ts +6 -0
- package/test-utils/dom/board/index.js +15 -0
- package/test-utils/dom/board/index.js.map +1 -0
- package/test-utils/dom/board-item/index.d.ts +10 -0
- package/test-utils/dom/board-item/index.js +33 -0
- package/test-utils/dom/board-item/index.js.map +1 -0
- package/test-utils/dom/index.d.ts +19 -0
- package/test-utils/dom/index.js +41 -0
- package/test-utils/dom/index.js.map +1 -0
- package/test-utils/dom/items-palette/index.d.ts +7 -0
- package/test-utils/dom/items-palette/index.js +18 -0
- package/test-utils/dom/items-palette/index.js.map +1 -0
- package/test-utils/dom/palette-item/index.d.ts +5 -0
- package/test-utils/dom/palette-item/index.js +15 -0
- package/test-utils/dom/palette-item/index.js.map +1 -0
- package/test-utils/selectors/board/index.d.ts +6 -0
- package/test-utils/selectors/board/index.js +15 -0
- package/test-utils/selectors/board/index.js.map +1 -0
- package/test-utils/selectors/board-item/index.d.ts +10 -0
- package/test-utils/selectors/board-item/index.js +33 -0
- package/test-utils/selectors/board-item/index.js.map +1 -0
- package/test-utils/selectors/index.d.ts +19 -0
- package/test-utils/selectors/index.js +41 -0
- package/test-utils/selectors/index.js.map +1 -0
- package/test-utils/selectors/items-palette/index.d.ts +7 -0
- package/test-utils/selectors/items-palette/index.js +18 -0
- package/test-utils/selectors/items-palette/index.js.map +1 -0
- package/test-utils/selectors/palette-item/index.d.ts +5 -0
- package/test-utils/selectors/palette-item/index.js +15 -0
- package/test-utils/selectors/palette-item/index.js.map +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a mapping of between items and transforms to be applied while in transition.
|
|
3
|
+
*/
|
|
4
|
+
export function createTransforms(grid, moves, gridContext) {
|
|
5
|
+
const transforms = {};
|
|
6
|
+
for (const move of moves) {
|
|
7
|
+
const item = grid.items.find((prev) => prev.id === move.itemId);
|
|
8
|
+
if (move.type === "REMOVE") {
|
|
9
|
+
transforms[move.itemId] = { type: "remove" };
|
|
10
|
+
}
|
|
11
|
+
else if (item) {
|
|
12
|
+
transforms[item.id] = {
|
|
13
|
+
type: "move",
|
|
14
|
+
x: gridContext.getColOffset(move.x - item.x),
|
|
15
|
+
y: gridContext.getRowOffset(move.y - item.y),
|
|
16
|
+
width: gridContext.getWidth(move.width),
|
|
17
|
+
height: gridContext.getHeight(move.height),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return transforms;
|
|
22
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LayoutShift } from "../../internal/layout-engine/interfaces";
|
|
2
|
+
import { BoardProps } from "../interfaces";
|
|
3
|
+
export declare function createItemsChangeEvent<D>(items: readonly BoardProps.Item<D>[], layoutShift: LayoutShift): CustomEvent<BoardProps.ItemsChangeDetail<D>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { createCustomEvent } from "../../internal/utils/events";
|
|
4
|
+
import { transformItems } from "../../internal/utils/layout";
|
|
5
|
+
export function createItemsChangeEvent(items, layoutShift) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7
|
+
const insertTarget = (_b = (_a = layoutShift.moves.find((move) => move.type === "INSERT")) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : null;
|
|
8
|
+
const removeTarget = (_d = (_c = layoutShift.moves.find((move) => move.type === "REMOVE")) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : null;
|
|
9
|
+
const resizeTarget = (_f = (_e = layoutShift.moves.find((move) => move.type === "RESIZE")) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : null;
|
|
10
|
+
const newItems = transformItems(items, layoutShift.next, resizeTarget !== null && resizeTarget !== void 0 ? resizeTarget : insertTarget);
|
|
11
|
+
const addedItem = newItems.find((it) => it.id === insertTarget);
|
|
12
|
+
const removedItem = newItems.find((it) => it.id === removeTarget);
|
|
13
|
+
return createCustomEvent({ items: newItems, addedItem, removedItem });
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GridLayoutItem, ItemId } from "../../internal/interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a minimal hovered rectangle (in grid units) that contains all collided placeholders.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getHoveredRect(collisionsIds: readonly ItemId[], placeholders: readonly GridLayoutItem[]): {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
right: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Creates a minimal hovered rectangle (in grid units) that contains all collided placeholders.
|
|
5
|
+
*/
|
|
6
|
+
export function getHoveredRect(collisionsIds, placeholders) {
|
|
7
|
+
const hoveredPlaceholders = collisionsIds.map((id) => placeholders.find((p) => p.id === id));
|
|
8
|
+
return hoveredPlaceholders.reduce((rect, collision) => ({
|
|
9
|
+
top: Math.min(rect.top, collision.y),
|
|
10
|
+
left: Math.min(rect.left, collision.x),
|
|
11
|
+
bottom: Math.max(rect.bottom, collision.y + collision.height),
|
|
12
|
+
right: Math.max(rect.right, collision.x + collision.width),
|
|
13
|
+
}), {
|
|
14
|
+
top: Number.POSITIVE_INFINITY,
|
|
15
|
+
left: Number.POSITIVE_INFINITY,
|
|
16
|
+
bottom: Number.NEGATIVE_INFINITY,
|
|
17
|
+
right: Number.NEGATIVE_INFINITY,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Direction } from "../../internal/interfaces";
|
|
2
|
+
import { LayoutShift } from "../../internal/layout-engine/interfaces";
|
|
3
|
+
import { Coordinates } from "../../internal/utils/coordinates";
|
|
4
|
+
import { Position } from "../../internal/utils/position";
|
|
5
|
+
import { Transition } from "../interfaces";
|
|
6
|
+
export declare function getLayoutColumns<D>(transition: Transition<D>): number;
|
|
7
|
+
export declare function getLayoutRows<D>(transition: Transition<D>): number;
|
|
8
|
+
export declare function getLayoutPlaceholders<D>(transition: Transition<D>): import("../../internal/interfaces").GridLayout;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves direction from where the inserting item comes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getInsertionDirection(cursorOffset: Coordinates): Direction;
|
|
13
|
+
/**
|
|
14
|
+
* Applies transition operation (reorder/move/insert) and retrieves an object that describes the updated
|
|
15
|
+
* layout and the moves to be made including and not including items float to top.
|
|
16
|
+
*
|
|
17
|
+
* The layout shift w/o refloat is used for rendering and w/ refloat is used for live announcements.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getLayoutShift<D>(transition: Transition<D>, path: readonly Position[], insertionDirection?: Direction): null | LayoutShift;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { LayoutEngine } from "../../internal/layout-engine/engine";
|
|
4
|
+
import { createPlaceholdersLayout, getDefaultColumnSpan, getDefaultRowSpan } from "../../internal/utils/layout";
|
|
5
|
+
import { normalizeInsertionPath } from "./path";
|
|
6
|
+
export function getLayoutColumns(transition) {
|
|
7
|
+
return transition.itemsLayout.columns;
|
|
8
|
+
}
|
|
9
|
+
// The rows can be overridden during transition to create more drop targets at the bottom.
|
|
10
|
+
export function getLayoutRows(transition) {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const layout = (_b = (_a = transition.layoutShift) === null || _a === void 0 ? void 0 : _a.next) !== null && _b !== void 0 ? _b : transition.itemsLayout;
|
|
13
|
+
const layoutItem = layout.items.find((it) => it.id === transition.draggableItem.id);
|
|
14
|
+
const itemHeight = (_c = layoutItem === null || layoutItem === void 0 ? void 0 : layoutItem.height) !== null && _c !== void 0 ? _c : getDefaultRowSpan(transition.draggableItem);
|
|
15
|
+
// Add extra row for resize when already at the bottom.
|
|
16
|
+
if (transition.operation === "resize") {
|
|
17
|
+
return Math.max(layout.rows, layoutItem ? layoutItem.y + layoutItem.height + 1 : 0);
|
|
18
|
+
}
|
|
19
|
+
// Add extra row(s) for reorder/insert based on item's height.
|
|
20
|
+
else {
|
|
21
|
+
return Math.max(layout.rows, transition.itemsLayout.rows + itemHeight);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function getLayoutPlaceholders(transition) {
|
|
25
|
+
const rows = getLayoutRows(transition);
|
|
26
|
+
const columns = getLayoutColumns(transition);
|
|
27
|
+
return createPlaceholdersLayout(rows, columns);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves direction from where the inserting item comes.
|
|
31
|
+
*/
|
|
32
|
+
export function getInsertionDirection(cursorOffset) {
|
|
33
|
+
if (cursorOffset.x < 0) {
|
|
34
|
+
return "right";
|
|
35
|
+
}
|
|
36
|
+
if (cursorOffset.x > 0) {
|
|
37
|
+
return "left";
|
|
38
|
+
}
|
|
39
|
+
if (cursorOffset.y < 0) {
|
|
40
|
+
return "down";
|
|
41
|
+
}
|
|
42
|
+
if (cursorOffset.y > 0) {
|
|
43
|
+
return "up";
|
|
44
|
+
}
|
|
45
|
+
return "right";
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Applies transition operation (reorder/move/insert) and retrieves an object that describes the updated
|
|
49
|
+
* layout and the moves to be made including and not including items float to top.
|
|
50
|
+
*
|
|
51
|
+
* The layout shift w/o refloat is used for rendering and w/ refloat is used for live announcements.
|
|
52
|
+
*/
|
|
53
|
+
export function getLayoutShift(transition, path, insertionDirection) {
|
|
54
|
+
if (path.length === 0) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const engine = new LayoutEngine(transition.itemsLayout);
|
|
58
|
+
const width = getDefaultColumnSpan(transition.draggableItem, getLayoutColumns(transition));
|
|
59
|
+
const height = getDefaultRowSpan(transition.draggableItem);
|
|
60
|
+
const rows = getLayoutRows(transition);
|
|
61
|
+
const columns = getLayoutColumns(transition);
|
|
62
|
+
switch (transition.operation) {
|
|
63
|
+
case "resize":
|
|
64
|
+
return engine.resize({ itemId: transition.draggableItem.id, path }).getLayoutShift();
|
|
65
|
+
case "reorder":
|
|
66
|
+
return engine.move({ itemId: transition.draggableItem.id, path }).getLayoutShift();
|
|
67
|
+
case "insert":
|
|
68
|
+
return engine
|
|
69
|
+
.insert({
|
|
70
|
+
itemId: transition.draggableItem.id,
|
|
71
|
+
width,
|
|
72
|
+
height,
|
|
73
|
+
path: normalizeInsertionPath(path, insertionDirection !== null && insertionDirection !== void 0 ? insertionDirection : "right", columns, rows),
|
|
74
|
+
})
|
|
75
|
+
.getLayoutShift();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Direction } from "../../internal/interfaces";
|
|
2
|
+
import { Rect } from "../../internal/interfaces";
|
|
3
|
+
import { Position } from "../../internal/utils/position";
|
|
4
|
+
/**
|
|
5
|
+
* The insertion operation is similar to reorder yet the first path entry is treated differently.
|
|
6
|
+
* The normalization removes leading path entries if on the same edge to optimize UX.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeInsertionPath(path: readonly Position[], insertionDirection: Direction, columns: number, rows: number): Position[];
|
|
9
|
+
export declare function appendMovePath(prevPath: readonly Position[], collisionRect: Rect): Position[];
|
|
10
|
+
export declare function appendResizePath(prevPath: readonly Position[], collisionRect: Rect): Position[];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Position } from "../../internal/utils/position";
|
|
2
|
+
/**
|
|
3
|
+
* The insertion operation is similar to reorder yet the first path entry is treated differently.
|
|
4
|
+
* The normalization removes leading path entries if on the same edge to optimize UX.
|
|
5
|
+
*/
|
|
6
|
+
export function normalizeInsertionPath(path, insertionDirection, columns, rows) {
|
|
7
|
+
let edgeIndex = -1;
|
|
8
|
+
for (let i = 0; i < path.length; i++) {
|
|
9
|
+
switch (insertionDirection) {
|
|
10
|
+
case "left": {
|
|
11
|
+
if (path[i].x === 0) {
|
|
12
|
+
edgeIndex = i;
|
|
13
|
+
}
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
case "right": {
|
|
17
|
+
if (path[i].x === columns - 1) {
|
|
18
|
+
edgeIndex = i;
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case "up": {
|
|
23
|
+
if (path[i].y === 0) {
|
|
24
|
+
edgeIndex = i;
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case "down": {
|
|
29
|
+
if (path[i].y === rows - 1) {
|
|
30
|
+
edgeIndex = i;
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return path.slice(edgeIndex);
|
|
37
|
+
}
|
|
38
|
+
export function appendMovePath(prevPath, collisionRect) {
|
|
39
|
+
return appendPath(prevPath, new Position({ x: collisionRect.left, y: collisionRect.top }));
|
|
40
|
+
}
|
|
41
|
+
export function appendResizePath(prevPath, collisionRect) {
|
|
42
|
+
return appendPath(prevPath, new Position({ x: collisionRect.right, y: collisionRect.bottom }));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The operation path must be strictly incremental (each dx + dy == 1). However, the actual collisions
|
|
46
|
+
* data can have gaps due to pointer events throttling or other factors.
|
|
47
|
+
*
|
|
48
|
+
* The function produces next path from previous path and the target position by incrementally adding steps.
|
|
49
|
+
*/
|
|
50
|
+
function appendPath(prevPath, nextPosition) {
|
|
51
|
+
const path = [...prevPath];
|
|
52
|
+
const lastPosition = prevPath[prevPath.length - 1];
|
|
53
|
+
if (!lastPosition) {
|
|
54
|
+
return [nextPosition];
|
|
55
|
+
}
|
|
56
|
+
const vx = Math.sign(nextPosition.x - lastPosition.x);
|
|
57
|
+
const vy = Math.sign(nextPosition.y - lastPosition.y);
|
|
58
|
+
let { x, y } = lastPosition;
|
|
59
|
+
let safetyCounter = 0;
|
|
60
|
+
while (x !== nextPosition.x || y !== nextPosition.y) {
|
|
61
|
+
if (++safetyCounter === 100) {
|
|
62
|
+
throw new Error("Infinite loop in appendPath.");
|
|
63
|
+
}
|
|
64
|
+
if (x !== nextPosition.x) {
|
|
65
|
+
x += vx;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
y += vy;
|
|
69
|
+
}
|
|
70
|
+
path.push(new Position({ x, y }));
|
|
71
|
+
}
|
|
72
|
+
return path;
|
|
73
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface WidgetContainerHeaderProps {
|
|
3
|
+
handle: ReactNode;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
settings?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export default function WidgetContainerHeader({ handle, children, settings }: WidgetContainerHeaderProps): JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import styles from "./styles.css.js";
|
|
6
|
+
export default function WidgetContainerHeader({ handle, children, settings }) {
|
|
7
|
+
return (_jsxs("div", { className: styles.header, 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
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import useBaseComponent from "../internal/base-component/use-base-component";
|
|
5
|
+
import { applyDisplayName } from "../internal/utils/apply-display-name";
|
|
6
|
+
import { InternalBoardItem } from "./internal";
|
|
7
|
+
export default function BoardItem(props) {
|
|
8
|
+
const baseComponentProps = useBaseComponent("BoardItem");
|
|
9
|
+
return _jsx(InternalBoardItem, { ...props, ...baseComponentProps });
|
|
10
|
+
}
|
|
11
|
+
applyDisplayName(BoardItem, "BoardItem");
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface BoardItemProps {
|
|
3
|
+
/**
|
|
4
|
+
* Heading element of the item. Use the [header component](/components/header/).
|
|
5
|
+
*/
|
|
6
|
+
header?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Main content of the item.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Determines whether the main content of the item has padding. If `true`, removes the default padding
|
|
13
|
+
* from the content area.
|
|
14
|
+
*/
|
|
15
|
+
disableContentPaddings?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Footer of the item.
|
|
18
|
+
*/
|
|
19
|
+
footer?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Additional slot next to the heading. Use it to render an overflow actions menu in the form of a button dropdown.
|
|
22
|
+
*/
|
|
23
|
+
settings?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* An object containing all the necessary localized strings required by the component.
|
|
26
|
+
*
|
|
27
|
+
* ARIA labels:
|
|
28
|
+
* * `dragHandleAriaLabel` (string) - the ARIA label for the drag handle.
|
|
29
|
+
* * `dragHandleAriaDescription` (string, optional) - the ARIA description for the drag handle.
|
|
30
|
+
* * `resizeHandleAriaLabel` (string) - the ARIA label for the resize handle.
|
|
31
|
+
* * `resizeHandleAriaDescription` (string, optional) - the ARIA description for the resize handle.
|
|
32
|
+
*/
|
|
33
|
+
i18nStrings: BoardItemProps.I18nStrings;
|
|
34
|
+
}
|
|
35
|
+
export declare namespace BoardItemProps {
|
|
36
|
+
interface I18nStrings {
|
|
37
|
+
dragHandleAriaLabel: string;
|
|
38
|
+
dragHandleAriaDescription?: string;
|
|
39
|
+
resizeHandleAriaLabel: string;
|
|
40
|
+
resizeHandleAriaDescription?: string;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InternalBaseComponentProps } from "../internal/base-component/use-base-component";
|
|
3
|
+
import type { BoardItemProps } from "./interfaces";
|
|
4
|
+
export declare function InternalBoardItem({ children, header, settings, disableContentPaddings, footer, i18nStrings, __internalRootRef, }: BoardItemProps & InternalBaseComponentProps): JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import Container from "@cloudscape-design/components/container";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { useId } from "react";
|
|
7
|
+
import DragHandle from "../internal/drag-handle";
|
|
8
|
+
import { useItemContext } from "../internal/item-container";
|
|
9
|
+
import ResizeHandle from "../internal/resize-handle";
|
|
10
|
+
import ScreenreaderOnly from "../internal/screenreader-only";
|
|
11
|
+
import WidgetContainerHeader from "./header";
|
|
12
|
+
import styles from "./styles.css.js";
|
|
13
|
+
export function InternalBoardItem({ children, header, settings, disableContentPaddings, footer, i18nStrings, __internalRootRef, }) {
|
|
14
|
+
const { dragHandle, resizeHandle, isActive } = useItemContext();
|
|
15
|
+
const dragHandleAriaLabelledBy = useId();
|
|
16
|
+
const dragHandleAriaDescribedBy = useId();
|
|
17
|
+
const resizeHandleAriaLabelledBy = useId();
|
|
18
|
+
const resizeHandleAriaDescribedBy = useId();
|
|
19
|
+
return (_jsxs("div", { ref: __internalRootRef, className: styles.root, children: [_jsx(Container, { fitHeight: true, disableHeaderPaddings: true, header: _jsx(WidgetContainerHeader, { handle: _jsx(DragHandle, { ref: dragHandle.ref, ariaLabelledBy: dragHandleAriaLabelledBy, ariaDescribedBy: dragHandleAriaDescribedBy, onPointerDown: dragHandle.onPointerDown, onKeyDown: dragHandle.onKeyDown }), settings: settings, children: header }), footer: footer, disableContentPaddings: disableContentPaddings, className: clsx(styles["container-override"], isActive && styles.active), children: children }), resizeHandle && (_jsx("div", { className: styles.resizer, children: _jsx(ResizeHandle, { ariaLabelledBy: resizeHandleAriaLabelledBy, ariaDescribedBy: resizeHandleAriaDescribedBy, onPointerDown: resizeHandle.onPointerDown, onKeyDown: resizeHandle.onKeyDown }) })), _jsx(ScreenreaderOnly, { id: dragHandleAriaLabelledBy, children: i18nStrings.dragHandleAriaLabel }), _jsx(ScreenreaderOnly, { id: dragHandleAriaDescribedBy, children: i18nStrings.dragHandleAriaDescription }), _jsx(ScreenreaderOnly, { id: resizeHandleAriaLabelledBy, children: i18nStrings.resizeHandleAriaLabel }), _jsx(ScreenreaderOnly, { id: resizeHandleAriaDescribedBy, children: i18nStrings.resizeHandleAriaDescription })] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import './styles.scoped.css';
|
|
3
|
+
export default {
|
|
4
|
+
"root": "awsui_root_9ckv7_1jt4k_1",
|
|
5
|
+
"container-override": "awsui_container-override_9ckv7_1jt4k_6",
|
|
6
|
+
"active": "awsui_active_9ckv7_1jt4k_6",
|
|
7
|
+
"header": "awsui_header_9ckv7_1jt4k_10",
|
|
8
|
+
"flexible": "awsui_flexible_9ckv7_1jt4k_16",
|
|
9
|
+
"handle": "awsui_handle_9ckv7_1jt4k_20",
|
|
10
|
+
"header-content": "awsui_header-content_9ckv7_1jt4k_24",
|
|
11
|
+
"settings": "awsui_settings_9ckv7_1jt4k_28",
|
|
12
|
+
"fixed": "awsui_fixed_9ckv7_1jt4k_33",
|
|
13
|
+
"resizer": "awsui_resizer_9ckv7_1jt4k_37"
|
|
14
|
+
};
|
|
15
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.awsui_root_9ckv7_1jt4k_1:not(#\9) {
|
|
2
|
+
display: contents;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* TODO: use container API instead of styles override */
|
|
6
|
+
.awsui_container-override_9ckv7_1jt4k_6.awsui_active_9ckv7_1jt4k_6:not(#\9) {
|
|
7
|
+
box-shadow: var(--shadow-container-active-h4jsj2, 0px 4px 8px rgba(0, 28, 36, 0.45));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.awsui_header_9ckv7_1jt4k_10:not(#\9) {
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-items: center;
|
|
13
|
+
padding: var(--space-scaled-s-cu1hzn, 12px) calc(var(--space-container-horizontal-tlw03i, 20px) - var(--space-scaled-xs-6859qs, 8px));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.awsui_flexible_9ckv7_1jt4k_16:not(#\9) {
|
|
17
|
+
flex: 1 1 min-content;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.awsui_handle_9ckv7_1jt4k_20:not(#\9) {
|
|
21
|
+
margin-top: var(--space-scaled-xxs-95dhkm, 4px);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.awsui_header-content_9ckv7_1jt4k_24:not(#\9) {
|
|
25
|
+
margin-left: var(--space-scaled-xxs-95dhkm, 4px);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.awsui_settings_9ckv7_1jt4k_28:not(#\9) {
|
|
29
|
+
margin-top: var(--space-scaled-xxxs-b6dm8t, 2px);
|
|
30
|
+
margin-left: var(--space-static-xs-9adq92, 8px);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.awsui_fixed_9ckv7_1jt4k_33:not(#\9) {
|
|
34
|
+
flex: 0 0 auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.awsui_resizer_9ckv7_1jt4k_37:not(#\9) {
|
|
38
|
+
position: absolute;
|
|
39
|
+
bottom: calc(var(--space-scaled-s-cu1hzn, 12px) - var(--space-scaled-xxs-95dhkm, 4px));
|
|
40
|
+
right: calc(var(--space-scaled-s-cu1hzn, 12px) - var(--space-scaled-xxs-95dhkm, 4px));
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
// es-module interop with Babel and Typescript
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
module.exports.default = {
|
|
5
|
+
"root": "awsui_root_9ckv7_1jt4k_1",
|
|
6
|
+
"container-override": "awsui_container-override_9ckv7_1jt4k_6",
|
|
7
|
+
"active": "awsui_active_9ckv7_1jt4k_6",
|
|
8
|
+
"header": "awsui_header_9ckv7_1jt4k_10",
|
|
9
|
+
"flexible": "awsui_flexible_9ckv7_1jt4k_16",
|
|
10
|
+
"handle": "awsui_handle_9ckv7_1jt4k_20",
|
|
11
|
+
"header-content": "awsui_header-content_9ckv7_1jt4k_24",
|
|
12
|
+
"settings": "awsui_settings_9ckv7_1jt4k_28",
|
|
13
|
+
"fixed": "awsui_fixed_9ckv7_1jt4k_33",
|
|
14
|
+
"resizer": "awsui_resizer_9ckv7_1jt4k_37"
|
|
15
|
+
};
|
|
16
|
+
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Board } from "./board";
|
|
2
|
+
export type { BoardProps } from "./board";
|
|
3
|
+
export { default as ItemsPalette } from "./items-palette";
|
|
4
|
+
export type { ItemsPaletteProps } from "./items-palette";
|
|
5
|
+
export { default as BoardItem } from "./board-item";
|
|
6
|
+
export type { BoardItemProps } from "./board-item";
|
package/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export { default as Board } from "./board";
|
|
4
|
+
export { default as ItemsPalette } from "./items-palette";
|
|
5
|
+
export { default as BoardItem } from "./board-item";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"name": "BoardItem",
|
|
3
|
+
"releaseStatus": "stable",
|
|
4
|
+
"regions": [
|
|
5
|
+
{
|
|
6
|
+
"name": "children",
|
|
7
|
+
"description": "Main content of the item.",
|
|
8
|
+
"isDefault": true
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "footer",
|
|
12
|
+
"description": "Footer of the item.",
|
|
13
|
+
"isDefault": false
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "header",
|
|
17
|
+
"description": "Heading element of the item. Use the [header component](/components/header/).",
|
|
18
|
+
"isDefault": false
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "settings",
|
|
22
|
+
"description": "Additional slot next to the heading. Use it to render an overflow actions menu in the form of a button dropdown.",
|
|
23
|
+
"isDefault": false
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"functions": [],
|
|
27
|
+
"properties": [
|
|
28
|
+
{
|
|
29
|
+
"name": "disableContentPaddings",
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"optional": true,
|
|
32
|
+
"description": "Determines whether the main content of the item has padding. If `true`, removes the default padding\nfrom the content area."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "i18nStrings",
|
|
36
|
+
"type": "BoardItemProps.I18nStrings",
|
|
37
|
+
"inlineType": {
|
|
38
|
+
"name": "BoardItemProps.I18nStrings",
|
|
39
|
+
"type": "object",
|
|
40
|
+
"properties": [
|
|
41
|
+
{
|
|
42
|
+
"name": "dragHandleAriaDescription",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "dragHandleAriaLabel",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"optional": false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "resizeHandleAriaDescription",
|
|
53
|
+
"type": "string",
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "resizeHandleAriaLabel",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"optional": false
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"optional": false,
|
|
64
|
+
"description": "An object containing all the necessary localized strings required by the component.\nARIA labels:\n* `dragHandleAriaLabel` (string) - the ARIA label for the drag handle.\n* `dragHandleAriaDescription` (string, optional) - the ARIA description for the drag handle.\n* `resizeHandleAriaLabel` (string) - the ARIA label for the resize handle.\n* `resizeHandleAriaDescription` (string, optional) - the ARIA description for the resize handle.\n"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"events": []
|
|
68
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"name": "Board",
|
|
3
|
+
"releaseStatus": "stable",
|
|
4
|
+
"regions": [
|
|
5
|
+
{
|
|
6
|
+
"name": "empty",
|
|
7
|
+
"description": "Rendered when the `items` array is empty.\nWhen items are loading the slot can be used to render the loading indicator.\n",
|
|
8
|
+
"isDefault": false
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"functions": [],
|
|
12
|
+
"properties": [
|
|
13
|
+
{
|
|
14
|
+
"name": "i18nStrings",
|
|
15
|
+
"type": "BoardProps.I18nStrings<D>",
|
|
16
|
+
"inlineType": {
|
|
17
|
+
"name": "BoardProps.I18nStrings",
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": [
|
|
20
|
+
{
|
|
21
|
+
"name": "liveAnnouncementDndCommitted",
|
|
22
|
+
"type": "(operationType: BoardProps.DndOperationType) => string",
|
|
23
|
+
"optional": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "liveAnnouncementDndDiscarded",
|
|
27
|
+
"type": "(operationType: BoardProps.DndOperationType) => string",
|
|
28
|
+
"optional": false
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "liveAnnouncementDndItemInserted",
|
|
32
|
+
"type": "(operation: BoardProps.DndInsertState<D>) => string",
|
|
33
|
+
"optional": false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "liveAnnouncementDndItemReordered",
|
|
37
|
+
"type": "(operation: BoardProps.DndReorderState<D>) => string",
|
|
38
|
+
"optional": false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "liveAnnouncementDndItemResized",
|
|
42
|
+
"type": "(operation: BoardProps.DndResizeState<D>) => string",
|
|
43
|
+
"optional": false
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "liveAnnouncementDndStarted",
|
|
47
|
+
"type": "(operationType: BoardProps.DndOperationType) => string",
|
|
48
|
+
"optional": false
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "liveAnnouncementItemRemoved",
|
|
52
|
+
"type": "(operation: BoardProps.ItemRemovedState<D>) => string",
|
|
53
|
+
"optional": false
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "navigationAriaDescription",
|
|
57
|
+
"type": "string",
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "navigationAriaLabel",
|
|
62
|
+
"type": "string",
|
|
63
|
+
"optional": false
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "navigationItemAriaLabel",
|
|
67
|
+
"type": "(item: BoardProps.Item<D> | null) => string",
|
|
68
|
+
"optional": false
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"optional": false,
|
|
73
|
+
"description": "An object containing all the necessary localized strings required by the component.\nLive announcements:\n* `liveAnnouncementDndStarted(BoardProps.DndOperationType): string` - the function to create a live announcement string to indicate start of DnD (\"reorder\", \"resize\" or \"insert\").\n* `liveAnnouncementDndItemReordered(BoardProps.DndReorderState<D>): string` - the function to create a live announcement string to indicate when DnD reorder is performed.\n* `liveAnnouncementDndItemResized(BoardProps.DndResizeState<D>): string` - the function to create a live announcement string to indicate when DnD resize is performed.\n* `liveAnnouncementDndItemInserted(BoardProps.DndInsertState<D>): string` - the function to create a live announcement string to indicate when DnD insert is performed.\n* `liveAnnouncementDndDiscarded(BoardProps.DndOperationType): string` - the function to create a live announcement string to indicate commit of DnD (\"reorder\", \"resize\" or \"insert\").\n* `liveAnnouncementDndCommitted(BoardProps.DndOperationType): string` - the function to create a live announcement string to indicate discard of DnD (\"reorder\", \"resize\" or \"insert\").\n* `liveAnnouncementItemRemoved(BoardProps.OperationStateRemove<D>): string` - the function to create a live announcement string to indicate when item is removed.\n\nNavigation labels:\n* `navigationAriaLabel` (string) - the ARIA label for the accessible board navigation element.\n* `navigationAriaDescription` (string, optional) - the ARIA description for the accessible board navigation element.\n* `navigationItemAriaLabel(null | BoardProps.Item<D>): string` - the function to create the ARIA label for a navigation board item or an empty slot.\n"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "items",
|
|
77
|
+
"type": "ReadonlyArray<BoardProps.Item<D>>",
|
|
78
|
+
"optional": false,
|
|
79
|
+
"description": "Specifies the items displayed in the board. Each item includes its position on the board and\noptional data. The content of an item is controlled by the `renderItem` property.\nThe BoardProps.Item includes:\n* `id` (string) - the unique item identifier. The IDs of any two items in a page must be different.\n* `definition.minRowSpan` (number, optional) - the minimal number of rows the item is allowed to take. It can't be less than two. Defaults to two.\n* `definition.minColumnSpan` (number, optional) - the minimal number of columns the item is allowed to take. It can't be less than one. Defaults to one.\n* `definition.defaultRowSpan` (number, optional) - the number or rows the item will take when inserted to the board. It can't be less than `definition.minRowSpan`.\n* `definition.defaultColumnSpan` (number, optional) - the number or columns the item will take when inserted in the board. It can't be less than `definition.minColumnSpan`.\n* `columnOffset` (mapping, optional) - the item's offset from the first column (per layout) starting from zero. The value is updated by `onItemsChange` after an update is committed.\n* `rowSpan` (number, optional) - the item's vertical size starting from two. The value is updated by `onItemsChange` after an update is committed.\n* `columnSpan` (number, optional) - the item's horizontal size starting from one. The value is updated by `onItemsChange` after an update is committed.\n* `data` (D) - optional item data which can include the specific configurations of an item, such as its title.\n"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "renderItem",
|
|
83
|
+
"type": "(item: BoardProps.Item<D>, actions: BoardProps.ItemActions) => Element",
|
|
84
|
+
"optional": false,
|
|
85
|
+
"description": "Specifies a function to render content for board items. The return value must include board item component.\nThe function takes the item and its associated actions (BoardProps.ItemActions) that include:\n* `removeItem(): void` - the callback to issue the item's removal. Once issued, the `onItemsChange` will fire to update the state.\n"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"events": [
|
|
89
|
+
{
|
|
90
|
+
"name": "onItemsChange",
|
|
91
|
+
"description": "Fired when a user interaction changes size or position of board items.\nThe change detail has the following properties:\n* `items`: (readonly Item<D>[]) - the updated items array.\n* `addedItem`: (Item<D>, optional) - the item that was added as part of the update, if available.\n* `removedItem`: (Item<D>, optional) - the item that was removed as part of the update, if available.\n",
|
|
92
|
+
"cancelable": false,
|
|
93
|
+
"detailType": "BoardProps.ItemsChangeDetail<D>",
|
|
94
|
+
"detailInlineType": {
|
|
95
|
+
"name": "BoardProps.ItemsChangeDetail",
|
|
96
|
+
"type": "object",
|
|
97
|
+
"properties": [
|
|
98
|
+
{
|
|
99
|
+
"name": "addedItem",
|
|
100
|
+
"type": "BoardProps.Item<D>",
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "items",
|
|
105
|
+
"type": "ReadonlyArray<BoardProps.Item<D>>",
|
|
106
|
+
"optional": false
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "removedItem",
|
|
110
|
+
"type": "BoardProps.Item<D>",
|
|
111
|
+
"optional": true
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
};
|