@cloudscape-design/board-components 3.0.16 → 3.0.18

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 CHANGED
@@ -91,7 +91,7 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
91
91
  // If draggables can be of different types a check of some sort is required here.
92
92
  draggableItem: draggableItem,
93
93
  draggableRect: collisionRect,
94
- collisionIds: interactionType === "keyboard" || isElementOverBoard(collisionRect) ? collisionIds : [],
94
+ collisionIds: interactionType === "pointer" && isElementOverBoard(collisionRect) ? collisionIds : [],
95
95
  });
96
96
  autoScrollHandlers.addPointerEventHandlers();
97
97
  document.body.classList.add(styles[`current-operation-${operation}`]);
@@ -99,7 +99,7 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
99
99
  useDragSubscription("update", ({ interactionType, collisionIds, positionOffset, collisionRect }) => {
100
100
  dispatch({
101
101
  type: "update-with-pointer",
102
- collisionIds: interactionType === "keyboard" || isElementOverBoard(collisionRect) ? collisionIds : [],
102
+ collisionIds: interactionType === "pointer" && isElementOverBoard(collisionRect) ? collisionIds : [],
103
103
  positionOffset,
104
104
  draggableRect: collisionRect,
105
105
  });
@@ -47,14 +47,23 @@ function initTransition({ operation, interactionType, itemsLayout, draggableItem
47
47
  path: [],
48
48
  };
49
49
  const placeholdersLayout = getLayoutPlaceholders(transition);
50
- const itemBelongsToBoard = itemsLayout.items.find((it) => it.id === draggableItem.id);
51
- const collisionRect = getHoveredRect(collisionIds, placeholdersLayout.items);
52
- const appendPath = operation === "resize" ? appendResizePath : appendMovePath;
53
- const path = itemBelongsToBoard ? appendPath([], collisionRect) : [];
50
+ const layoutItem = itemsLayout.items.find((it) => it.id === draggableItem.id);
51
+ let path = [];
52
+ if (interactionType === "pointer" || operation === "insert") {
53
+ const collisionRect = getHoveredRect(collisionIds, placeholdersLayout.items);
54
+ const appendPath = operation === "resize" ? appendResizePath : appendMovePath;
55
+ path = layoutItem ? appendPath([], collisionRect) : [];
56
+ }
57
+ else if (layoutItem) {
58
+ path =
59
+ operation === "resize"
60
+ ? [new Position({ x: layoutItem.x + layoutItem.width, y: layoutItem.y + layoutItem.height })]
61
+ : [new Position({ x: layoutItem.x, y: layoutItem.y })];
62
+ }
54
63
  return {
55
64
  transition: { ...transition, path },
56
65
  removeTransition: null,
57
- announcement: itemBelongsToBoard ? { type: "dnd-started", item: draggableItem, operation } : null,
66
+ announcement: layoutItem ? { type: "dnd-started", item: draggableItem, operation } : null,
58
67
  };
59
68
  }
60
69
  function initRemoveTransition({ items, removedItem, itemsLayout }) {
@@ -1,8 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ import { isDevelopment, warnOnce } from "@cloudscape-design/component-toolkit/internal";
3
4
  import { ALWAYS_VISUAL_REFRESH } from "../environment";
4
- import { IS_DEV } from "../is-development";
5
- import { warnOnce } from "../logging";
6
5
  export const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useVisualRefreshDynamic;
7
6
  // We expect VR is to be set only once and before the application is rendered.
8
7
  let visualRefreshState = undefined;
@@ -13,7 +12,7 @@ function useVisualRefreshDynamic() {
13
12
  if (visualRefreshState === undefined) {
14
13
  visualRefreshState = detectVisualRefresh();
15
14
  }
16
- if (IS_DEV) {
15
+ if (isDevelopment) {
17
16
  const newVisualRefreshState = detectVisualRefresh();
18
17
  if (newVisualRefreshState !== visualRefreshState) {
19
18
  warnOnce("Visual Refresh", "Dynamic visual refresh change detected. This is not supported. " +
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "board-components";
2
- export var PACKAGE_VERSION = "3.0.0 (2a96deaa)";
2
+ export var PACKAGE_VERSION = "3.0.0 (c2e27bae)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "2a96deaaae4c967749f16563f62548f9b51329da"
2
+ "commit": "c2e27baea26a3916f51a16afdd60847ded5c5b02"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/board-components",
3
- "version": "3.0.16",
3
+ "version": "3.0.18",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudscape-design/board-components.git"
@@ -1,6 +0,0 @@
1
- /**
2
- * Whether the bundle is a development bundle.
3
- * Only use this in an if condition and on its own! This will help bundlers find
4
- * and remove the conditional statement for production bundles.
5
- */
6
- export declare const IS_DEV: boolean;
@@ -1,8 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * Whether the bundle is a development bundle.
5
- * Only use this in an if condition and on its own! This will help bundlers find
6
- * and remove the conditional statement for production bundles.
7
- */
8
- export const IS_DEV = process.env.NODE_ENV !== "production";
@@ -1 +0,0 @@
1
- export declare function warnOnce(component: string, message: string): void;
@@ -1,10 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- const messageCache = {};
4
- export function warnOnce(component, message) {
5
- const warning = `[${component}] ${message}`;
6
- if (!messageCache[warning]) {
7
- messageCache[warning] = true;
8
- console.warn(warning);
9
- }
10
- }