@cloudscape-design/board-components 3.0.32 → 3.0.34

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
@@ -10,7 +10,6 @@ import { useDragSubscription } from "../internal/dnd-controller/controller";
10
10
  import { useGlobalDragStateStyles } from "../internal/global-drag-state-styles";
11
11
  import Grid from "../internal/grid";
12
12
  import { ItemContainer } from "../internal/item-container";
13
- import { LayoutEngine } from "../internal/layout-engine/engine";
14
13
  import LiveRegion from "../internal/live-region";
15
14
  import { ScreenReaderGridNavigation } from "../internal/screenreader-grid-navigation";
16
15
  import { createPlaceholdersLayout, getDefaultColumnSpan, getDefaultRowSpan, getMinColumnSpan, getMinRowSpan, interpretItems, } from "../internal/utils/layout";
@@ -72,9 +71,10 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
72
71
  const removedItemIndex = items.findIndex((it) => it.id === removeTransition.removedItem.id);
73
72
  const nextIndexToFocus = removedItemIndex !== items.length - 1 ? removedItemIndex : items.length - 2;
74
73
  focusNextRenderIndexRef.current = nextIndexToFocus;
74
+ onItemsChange(createItemsChangeEvent(items, removeTransition.layoutShift));
75
75
  }, TRANSITION_DURATION_MS);
76
76
  return () => clearTimeout(timeoutId);
77
- }, [removeTransition, items]);
77
+ }, [removeTransition, items, onItemsChange]);
78
78
  const rows = selectTransitionRows(transitionState) || itemsLayout.rows;
79
79
  const placeholdersLayout = createPlaceholdersLayout(rows, itemsLayout.columns);
80
80
  function isElementOverBoard(rect) {
@@ -148,8 +148,6 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
148
148
  });
149
149
  const removeItemAction = (removedItem) => {
150
150
  dispatch({ type: "init-remove", items, itemsLayout, removedItem });
151
- const layoutShift = new LayoutEngine(itemsLayout).remove(removedItem.id);
152
- onItemsChange(createItemsChangeEvent(items, layoutShift));
153
151
  };
154
152
  function focusItem(itemId) {
155
153
  itemContainerRef.current[itemId].focusDragHandle();
@@ -1,10 +1,10 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "placeholder": "awsui_placeholder_1h7dk_1yaxu_1",
5
- "placeholder--active": "awsui_placeholder--active_1h7dk_1yaxu_5",
6
- "placeholder--hover": "awsui_placeholder--hover_1h7dk_1yaxu_8",
7
- "root": "awsui_root_1h7dk_1yaxu_12",
8
- "empty": "awsui_empty_1h7dk_1yaxu_16"
4
+ "placeholder": "awsui_placeholder_1h7dk_inx8o_1",
5
+ "placeholder--active": "awsui_placeholder--active_1h7dk_inx8o_5",
6
+ "placeholder--hover": "awsui_placeholder--hover_1h7dk_inx8o_8",
7
+ "root": "awsui_root_1h7dk_inx8o_12",
8
+ "empty": "awsui_empty_1h7dk_inx8o_16"
9
9
  };
10
10
 
@@ -1,23 +1,23 @@
1
- .awsui_placeholder_1h7dk_1yaxu_1:not(#\9) {
2
- border-radius: var(--border-radius-container-pmtq2d, 16px);
1
+ .awsui_placeholder_1h7dk_inx8o_1:not(#\9) {
2
+ border-radius: var(--border-radius-container-wqv1zi, 16px);
3
3
  height: 100%;
4
4
  }
5
- .awsui_placeholder--active_1h7dk_1yaxu_5:not(#\9) {
6
- background-color: var(--color-board-placeholder-active-kxfgmn, #e9ebed);
5
+ .awsui_placeholder--active_1h7dk_inx8o_5:not(#\9) {
6
+ background-color: var(--color-board-placeholder-active-jh49z8, #e9ebed);
7
7
  }
8
- .awsui_placeholder--hover_1h7dk_1yaxu_8:not(#\9) {
9
- background-color: var(--color-board-placeholder-hover-8tcom5, #d3e7f9);
8
+ .awsui_placeholder--hover_1h7dk_inx8o_8:not(#\9) {
9
+ background-color: var(--color-board-placeholder-hover-ombmcs, #d3e7f9);
10
10
  }
11
11
 
12
- .awsui_root_1h7dk_1yaxu_12:not(#\9) {
12
+ .awsui_root_1h7dk_inx8o_12:not(#\9) {
13
13
  /* used in test-utils */
14
14
  }
15
15
 
16
- .awsui_empty_1h7dk_1yaxu_16:not(#\9) {
16
+ .awsui_empty_1h7dk_inx8o_16:not(#\9) {
17
17
  box-sizing: border-box;
18
18
  width: 100%;
19
- padding: var(--space-scaled-m-gxhdpl, 16px) var(--space-scaled-l-2rs0gk, 20px) var(--space-scaled-l-2rs0gk, 20px);
20
- color: var(--color-text-empty-v5xueo, #5f6b7a);
19
+ padding: var(--space-scaled-m-mo5yse, 16px) var(--space-scaled-l-0hpmd7, 20px) var(--space-scaled-l-0hpmd7, 20px);
20
+ color: var(--color-text-empty-2wfcyr, #5f6b7a);
21
21
  display: flex;
22
22
  justify-content: center;
23
23
  }
@@ -2,10 +2,10 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "placeholder": "awsui_placeholder_1h7dk_1yaxu_1",
6
- "placeholder--active": "awsui_placeholder--active_1h7dk_1yaxu_5",
7
- "placeholder--hover": "awsui_placeholder--hover_1h7dk_1yaxu_8",
8
- "root": "awsui_root_1h7dk_1yaxu_12",
9
- "empty": "awsui_empty_1h7dk_1yaxu_16"
5
+ "placeholder": "awsui_placeholder_1h7dk_inx8o_1",
6
+ "placeholder--active": "awsui_placeholder--active_1h7dk_inx8o_5",
7
+ "placeholder--hover": "awsui_placeholder--hover_1h7dk_inx8o_8",
8
+ "root": "awsui_root_1h7dk_inx8o_12",
9
+ "empty": "awsui_empty_1h7dk_inx8o_16"
10
10
  };
11
11
 
@@ -1,16 +1,16 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_9ckv7_h85wa_1",
5
- "container-override": "awsui_container-override_9ckv7_h85wa_6",
6
- "active": "awsui_active_9ckv7_h85wa_6",
7
- "header": "awsui_header_9ckv7_h85wa_31",
8
- "flexible": "awsui_flexible_9ckv7_h85wa_37",
9
- "handle": "awsui_handle_9ckv7_h85wa_41",
10
- "refresh": "awsui_refresh_9ckv7_h85wa_44",
11
- "header-content": "awsui_header-content_9ckv7_h85wa_48",
12
- "settings": "awsui_settings_9ckv7_h85wa_52",
13
- "fixed": "awsui_fixed_9ckv7_h85wa_60",
14
- "resizer": "awsui_resizer_9ckv7_h85wa_64"
4
+ "root": "awsui_root_9ckv7_1p0lm_1",
5
+ "container-override": "awsui_container-override_9ckv7_1p0lm_6",
6
+ "active": "awsui_active_9ckv7_1p0lm_6",
7
+ "header": "awsui_header_9ckv7_1p0lm_31",
8
+ "flexible": "awsui_flexible_9ckv7_1p0lm_37",
9
+ "handle": "awsui_handle_9ckv7_1p0lm_41",
10
+ "refresh": "awsui_refresh_9ckv7_1p0lm_44",
11
+ "header-content": "awsui_header-content_9ckv7_1p0lm_48",
12
+ "settings": "awsui_settings_9ckv7_1p0lm_52",
13
+ "fixed": "awsui_fixed_9ckv7_1p0lm_60",
14
+ "resizer": "awsui_resizer_9ckv7_1p0lm_64"
15
15
  };
16
16
 
@@ -1,21 +1,21 @@
1
- .awsui_root_9ckv7_h85wa_1:not(#\9) {
1
+ .awsui_root_9ckv7_1p0lm_1:not(#\9) {
2
2
  display: contents;
3
3
  }
4
4
 
5
5
  /* TODO: use container API instead of styles override */
6
- .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
7
- box-shadow: var(--shadow-container-active-x0fzbz, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
6
+ .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9) {
7
+ box-shadow: var(--shadow-container-active-7yvi6w, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
8
8
  }
9
- [data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
9
+ [data-awsui-focus-visible] .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9) {
10
10
  position: relative;
11
11
  box-sizing: border-box;
12
12
  outline: none;
13
13
  }
14
- [data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
14
+ [data-awsui-focus-visible] .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9) {
15
15
  outline: 2px dotted transparent;
16
16
  outline-offset: -1px;
17
17
  }
18
- [data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9)::before {
18
+ [data-awsui-focus-visible] .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9)::before {
19
19
  content: " ";
20
20
  display: block;
21
21
  position: absolute;
@@ -24,45 +24,45 @@
24
24
  top: calc(-1 * 0px);
25
25
  width: calc(100% + 2 * 0px);
26
26
  height: calc(100% + 2 * 0px);
27
- border-radius: var(--border-radius-container-pmtq2d, 16px);
28
- border: 2px solid var(--color-border-item-focused-4t19h5, #0972d3);
27
+ border-radius: var(--border-radius-container-wqv1zi, 16px);
28
+ border: 2px solid var(--color-border-item-focused-b2ntyl, #0972d3);
29
29
  }
30
30
 
31
- .awsui_header_9ckv7_h85wa_31:not(#\9) {
31
+ .awsui_header_9ckv7_1p0lm_31:not(#\9) {
32
32
  display: flex;
33
33
  justify-items: center;
34
- padding: var(--space-scaled-s-913kwi, 12px) calc(var(--space-container-horizontal-jxdgil, 20px) - var(--space-scaled-xs-wbfgrv, 8px));
34
+ padding: var(--space-scaled-s-aqzyko, 12px) calc(var(--space-container-horizontal-wfukh3, 20px) - var(--space-scaled-xs-26e2du, 8px));
35
35
  }
36
36
 
37
- .awsui_flexible_9ckv7_h85wa_37:not(#\9) {
37
+ .awsui_flexible_9ckv7_1p0lm_37:not(#\9) {
38
38
  flex: 1 1 min-content;
39
39
  }
40
40
 
41
- .awsui_handle_9ckv7_h85wa_41:not(#\9) {
42
- margin-top: calc(var(--space-scaled-xxs-t2t62i, 4px) + 1px);
41
+ .awsui_handle_9ckv7_1p0lm_41:not(#\9) {
42
+ margin-top: calc(var(--space-scaled-xxs-7597g1, 4px) + 1px);
43
43
  }
44
- .awsui_refresh_9ckv7_h85wa_44 > .awsui_handle_9ckv7_h85wa_41:not(#\9) {
45
- margin-top: calc(var(--space-static-xxxs-b6tgp7, 2px) + 1px);
44
+ .awsui_refresh_9ckv7_1p0lm_44 > .awsui_handle_9ckv7_1p0lm_41:not(#\9) {
45
+ margin-top: calc(var(--space-static-xxxs-3gu9os, 2px) + 1px);
46
46
  }
47
47
 
48
- .awsui_header-content_9ckv7_h85wa_48:not(#\9) {
49
- margin-left: var(--space-scaled-xxs-t2t62i, 4px);
48
+ .awsui_header-content_9ckv7_1p0lm_48:not(#\9) {
49
+ margin-left: var(--space-scaled-xxs-7597g1, 4px);
50
50
  }
51
51
 
52
- .awsui_settings_9ckv7_h85wa_52:not(#\9) {
53
- margin-top: calc(var(--space-scaled-xxxs-jdgipl, 2px) + 1px);
54
- margin-left: var(--space-static-xs-zgeph4, 8px);
52
+ .awsui_settings_9ckv7_1p0lm_52:not(#\9) {
53
+ margin-top: calc(var(--space-scaled-xxxs-27y4hv, 2px) + 1px);
54
+ margin-left: var(--space-static-xs-7sfb63, 8px);
55
55
  }
56
- .awsui_refresh_9ckv7_h85wa_44 > .awsui_settings_9ckv7_h85wa_52:not(#\9) {
56
+ .awsui_refresh_9ckv7_1p0lm_44 > .awsui_settings_9ckv7_1p0lm_52:not(#\9) {
57
57
  margin-top: 0px;
58
58
  }
59
59
 
60
- .awsui_fixed_9ckv7_h85wa_60:not(#\9) {
60
+ .awsui_fixed_9ckv7_1p0lm_60:not(#\9) {
61
61
  flex: 0 0 auto;
62
62
  }
63
63
 
64
- .awsui_resizer_9ckv7_h85wa_64:not(#\9) {
64
+ .awsui_resizer_9ckv7_1p0lm_64:not(#\9) {
65
65
  position: absolute;
66
- bottom: calc(var(--space-static-xs-zgeph4, 8px) - var(--space-static-xxxs-b6tgp7, 2px));
67
- right: calc(var(--space-static-xs-zgeph4, 8px) - var(--space-static-xxxs-b6tgp7, 2px));
66
+ bottom: calc(var(--space-static-xs-7sfb63, 8px) - var(--space-static-xxxs-3gu9os, 2px));
67
+ right: calc(var(--space-static-xs-7sfb63, 8px) - var(--space-static-xxxs-3gu9os, 2px));
68
68
  }
@@ -2,16 +2,16 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_9ckv7_h85wa_1",
6
- "container-override": "awsui_container-override_9ckv7_h85wa_6",
7
- "active": "awsui_active_9ckv7_h85wa_6",
8
- "header": "awsui_header_9ckv7_h85wa_31",
9
- "flexible": "awsui_flexible_9ckv7_h85wa_37",
10
- "handle": "awsui_handle_9ckv7_h85wa_41",
11
- "refresh": "awsui_refresh_9ckv7_h85wa_44",
12
- "header-content": "awsui_header-content_9ckv7_h85wa_48",
13
- "settings": "awsui_settings_9ckv7_h85wa_52",
14
- "fixed": "awsui_fixed_9ckv7_h85wa_60",
15
- "resizer": "awsui_resizer_9ckv7_h85wa_64"
5
+ "root": "awsui_root_9ckv7_1p0lm_1",
6
+ "container-override": "awsui_container-override_9ckv7_1p0lm_6",
7
+ "active": "awsui_active_9ckv7_1p0lm_6",
8
+ "header": "awsui_header_9ckv7_1p0lm_31",
9
+ "flexible": "awsui_flexible_9ckv7_1p0lm_37",
10
+ "handle": "awsui_handle_9ckv7_1p0lm_41",
11
+ "refresh": "awsui_refresh_9ckv7_1p0lm_44",
12
+ "header-content": "awsui_header-content_9ckv7_1p0lm_48",
13
+ "settings": "awsui_settings_9ckv7_1p0lm_52",
14
+ "fixed": "awsui_fixed_9ckv7_1p0lm_60",
15
+ "resizer": "awsui_resizer_9ckv7_1p0lm_64"
16
16
  };
17
17
 
@@ -1,8 +1,8 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ import { useStableCallback } from "@cloudscape-design/component-toolkit/internal";
3
4
  import { useEffect } from "react";
4
5
  import { Coordinates } from "../utils/coordinates";
5
- import { useStableEventHandler } from "../utils/use-stable-event-handler";
6
6
  import { EventEmitter } from "./event-emitter";
7
7
  import { getHoveredDroppables } from "./get-hovered-droppables";
8
8
  class DragAndDropController extends EventEmitter {
@@ -98,7 +98,7 @@ class DragAndDropController extends EventEmitter {
98
98
  // Controller is a singleton and is shared between all d&d elements.
99
99
  const controller = new DragAndDropController();
100
100
  export function useDragSubscription(event, handler) {
101
- const stableHandler = useStableEventHandler(handler);
101
+ const stableHandler = useStableCallback(handler);
102
102
  useEffect(() => controller.on(event, stableHandler), [event, stableHandler]);
103
103
  }
104
104
  export function useDraggable({ draggableItem, getCollisionRect, }) {
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "board-components";
2
- export var PACKAGE_VERSION = "3.0.0 (4a7c9c80)";
2
+ export var PACKAGE_VERSION = "3.0.0 (b095e397)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "board-components",
3
- "PACKAGE_VERSION": "3.0.0 (4a7c9c80)",
3
+ "PACKAGE_VERSION": "3.0.0 (b095e397)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true
6
6
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "handle": "awsui_handle_cc1pu_1yi9f_1"
4
+ "handle": "awsui_handle_cc1pu_y0i9t_1"
5
5
  };
6
6
 
@@ -1,11 +1,11 @@
1
- .awsui_handle_cc1pu_1yi9f_1:not(#\9) {
1
+ .awsui_handle_cc1pu_y0i9t_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-t2t62i, 4px);
7
- color: var(--color-text-interactive-default-2sml2m, #414d5c);
6
+ padding: var(--space-scaled-xxs-7597g1, 4px);
7
+ color: var(--color-text-interactive-default-lnx6lk, #414d5c);
8
8
  }
9
- .awsui_handle_cc1pu_1yi9f_1:not(#\9):hover {
10
- color: var(--color-text-interactive-hover-8bpozs, #000716);
9
+ .awsui_handle_cc1pu_y0i9t_1:not(#\9):hover {
10
+ color: var(--color-text-interactive-hover-mj8add, #000716);
11
11
  }
@@ -2,6 +2,6 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "handle": "awsui_handle_cc1pu_1yi9f_1"
5
+ "handle": "awsui_handle_cc1pu_y0i9t_1"
6
6
  };
7
7
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "4a7c9c80e8d3f01df0e46772e037635bd3aee13c"
2
+ "commit": "b095e3972410e6135f434232cab514cd9af8fd8a"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/board-components",
3
- "version": "3.0.32",
3
+ "version": "3.0.34",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudscape-design/board-components.git"
@@ -1,9 +0,0 @@
1
- /**
2
- * A callback that stays stable between renders even as the dependencies change.
3
- * Not a recommended React pattern, so it should be used sparingly and only if
4
- * the callback is an event handler (i.e. not used during rendering) and causing
5
- * clear performance issues.
6
- *
7
- * @see https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
8
- */
9
- export declare function useStableEventHandler<T extends (...args: any[]) => any>(fn: T): T;
@@ -1,19 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { useCallback, useEffect, useRef } from "react";
4
- // The code is copied from https://github.com/cloudscape-design/components/blob/main/src/internal/hooks/use-stable-event-handler/index.ts
5
- /**
6
- * A callback that stays stable between renders even as the dependencies change.
7
- * Not a recommended React pattern, so it should be used sparingly and only if
8
- * the callback is an event handler (i.e. not used during rendering) and causing
9
- * clear performance issues.
10
- *
11
- * @see https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
12
- */
13
- export function useStableEventHandler(fn) {
14
- const ref = useRef();
15
- useEffect(() => {
16
- ref.current = fn;
17
- });
18
- return useCallback((...args) => { var _a; return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.apply(undefined, args); }, []);
19
- }