@cloudscape-design/board-components 3.0.67 → 3.0.69

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.
Files changed (65) hide show
  1. package/board/interfaces.d.ts +3 -5
  2. package/board/interfaces.js.map +1 -1
  3. package/board/internal.js +4 -8
  4. package/board/internal.js.map +1 -1
  5. package/board/placeholder.js +1 -1
  6. package/board/placeholder.js.map +1 -1
  7. package/board/transition.js +1 -1
  8. package/board/transition.js.map +1 -1
  9. package/board-item/header.js +0 -2
  10. package/board-item/header.js.map +1 -1
  11. package/board-item/internal.js +2 -2
  12. package/board-item/internal.js.map +1 -1
  13. package/internal/api-docs/components/board.js +1 -1
  14. package/internal/api-docs/components/items-palette.js +1 -1
  15. package/internal/base-component/use-base-component.d.ts +1 -1
  16. package/internal/base-component/use-base-component.js.map +1 -1
  17. package/internal/base-component/use-telemetry.js.map +1 -1
  18. package/internal/base-component/use-visual-refresh.js.map +1 -1
  19. package/internal/dnd-controller/__mocks__/controller.js.map +1 -1
  20. package/internal/dnd-controller/controller.js +1 -1
  21. package/internal/dnd-controller/controller.js.map +1 -1
  22. package/internal/drag-handle/index.js +2 -2
  23. package/internal/drag-handle/index.js.map +1 -1
  24. package/internal/environment.js +1 -1
  25. package/internal/environment.json +1 -1
  26. package/internal/global-drag-state-styles/index.js.map +1 -1
  27. package/internal/grid/grid.js +2 -2
  28. package/internal/grid/grid.js.map +1 -1
  29. package/internal/grid/interfaces.js.map +1 -1
  30. package/internal/grid/item.js.map +1 -1
  31. package/internal/handle/index.js +1 -1
  32. package/internal/handle/index.js.map +1 -1
  33. package/internal/item-container/index.d.ts +1 -1
  34. package/internal/item-container/index.js +4 -4
  35. package/internal/item-container/index.js.map +1 -1
  36. package/internal/layout-engine/engine-step.js +1 -1
  37. package/internal/layout-engine/engine-step.js.map +1 -1
  38. package/internal/live-region/index.js.map +1 -1
  39. package/internal/manifest.json +1 -1
  40. package/internal/resize-handle/index.js +1 -3
  41. package/internal/resize-handle/index.js.map +1 -1
  42. package/internal/screenreader-only/index.js.map +1 -1
  43. package/internal/utils/coordinates.js.map +1 -1
  44. package/internal/utils/use-auto-scroll.js.map +1 -1
  45. package/items-palette/interfaces.d.ts +3 -5
  46. package/items-palette/interfaces.js.map +1 -1
  47. package/items-palette/internal.js +2 -11
  48. package/items-palette/internal.js.map +1 -1
  49. package/package.json +1 -1
  50. package/test-utils/dom/board/index.js +1 -1
  51. package/test-utils/dom/board/index.js.map +1 -1
  52. package/test-utils/dom/board-item/index.js.map +1 -1
  53. package/test-utils/dom/items-palette/index.js +1 -1
  54. package/test-utils/dom/items-palette/index.js.map +1 -1
  55. package/test-utils/dom/palette-item/index.js.map +1 -1
  56. package/test-utils/selectors/board/index.js +1 -1
  57. package/test-utils/selectors/board/index.js.map +1 -1
  58. package/test-utils/selectors/items-palette/index.js +1 -1
  59. package/test-utils/selectors/items-palette/index.js.map +1 -1
  60. package/internal/screenreader-grid-navigation/index.d.ts +0 -22
  61. package/internal/screenreader-grid-navigation/index.js +0 -43
  62. package/internal/screenreader-grid-navigation/index.js.map +0 -1
  63. package/internal/screenreader-grid-navigation/styles.css.js +0 -7
  64. package/internal/screenreader-grid-navigation/styles.scoped.css +0 -13
  65. package/internal/screenreader-grid-navigation/styles.selectors.js +0 -8
@@ -40,11 +40,6 @@ export interface BoardProps<D = DataFallbackType> {
40
40
  * * `liveAnnouncementDndDiscarded(BoardProps.DndOperationType): string` - the function to create a live announcement string to indicate commit of DnD ("reorder", "resize" or "insert").
41
41
  * * `liveAnnouncementDndCommitted(BoardProps.DndOperationType): string` - the function to create a live announcement string to indicate discard of DnD ("reorder", "resize" or "insert").
42
42
  * * `liveAnnouncementItemRemoved(BoardProps.OperationStateRemove<D>): string` - the function to create a live announcement string to indicate when item is removed.
43
- *
44
- * Navigation labels:
45
- * * `navigationAriaLabel` (string) - the ARIA label for the accessible board navigation element.
46
- * * `navigationAriaDescription` (string, optional) - the ARIA description for the accessible board navigation element.
47
- * * `navigationItemAriaLabel(null | BoardProps.Item<D>): string` - the function to create the ARIA label for a navigation board item or an empty slot.
48
43
  */
49
44
  i18nStrings: BoardProps.I18nStrings<D>;
50
45
  /**
@@ -86,8 +81,11 @@ export declare namespace BoardProps {
86
81
  liveAnnouncementDndCommitted: (operationType: DndOperationType) => string;
87
82
  liveAnnouncementDndDiscarded: (operationType: DndOperationType) => string;
88
83
  liveAnnouncementItemRemoved: (operation: ItemRemovedState<D>) => string;
84
+ /** @deprecated Has no effect. */
89
85
  navigationAriaLabel: string;
86
+ /** @deprecated Has no effect. */
90
87
  navigationAriaDescription?: string;
88
+ /** @deprecated Has no effect. */
91
89
  navigationItemAriaLabel: (item: null | BoardProps.Item<D>) => string;
92
90
  }
93
91
  type DndOperationType = "reorder" | "resize" | "insert";
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/board/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode } from \"react\";\nimport { InteractionType, Operation } from \"../internal/dnd-controller/controller\";\nimport {\n BoardItemDefinition,\n BoardItemDefinitionBase,\n DataFallbackType,\n Direction,\n GridLayout,\n GridLayoutItem,\n ItemId,\n Rect,\n} from \"../internal/interfaces\";\nimport { LayoutEngine } from \"../internal/layout-engine/engine\";\nimport { LayoutShift } from \"../internal/layout-engine/interfaces\";\nimport { NonCancelableEventHandler } from \"../internal/utils/events\";\nimport { Position } from \"../internal/utils/position\";\n\n/*\n Note:\n The component does not provide handling of items state (loading, error, loaded).\n It is the responsibility of the client to control it and provide the necessary\n ARIA-live announcements.\n*/\n\nexport interface BoardProps<D = DataFallbackType> {\n /**\n * Specifies the items displayed in the board. Each item includes its position on the board and\n * optional data. The content of an item is controlled by the `renderItem` property.\n *\n * The 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 */\n items: ReadonlyArray<BoardProps.Item<D>>;\n\n /**\n * Specifies a function to render content for board items. The return value must include board item component.\n *\n * The 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 */\n renderItem: (item: BoardProps.Item<D>, actions: BoardProps.ItemActions) => JSX.Element;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * Live 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 *\n * Navigation 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 */\n i18nStrings: BoardProps.I18nStrings<D>;\n\n /**\n * Called when a user modifies the size or position of board items.\n *\n * The change detail has the following properties:\n *\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 applicable.\n * * `removedItem`: (Item<D>, optional) - the item that was removed as part of the update, if applicable.\n * * `resizedItem`: (Item<D>, optional) - the item that was resized as part of the update, if applicable.\n * * `movedItem`: (Item<D>, optional) - the item that was moved as part of the update, if applicable.\n */\n onItemsChange: NonCancelableEventHandler<BoardProps.ItemsChangeDetail<D>>;\n\n /**\n * Rendered when the `items` array is empty.\n *\n * When items are loading the slot can be used to render the loading indicator.\n */\n empty: ReactNode;\n}\n\nexport namespace BoardProps {\n export type Item<D = DataFallbackType> = BoardItemDefinition<D>;\n\n export interface ItemActions {\n removeItem(): void;\n }\n\n export interface ItemsChangeDetail<D = DataFallbackType> {\n items: ReadonlyArray<Item<D>>;\n movedItem?: Item<D>;\n resizedItem?: Item<D>;\n addedItem?: Item<D>;\n removedItem?: Item<D>;\n }\n\n export interface I18nStrings<D> {\n liveAnnouncementDndStarted: (operationType: DndOperationType) => string;\n liveAnnouncementDndItemReordered: (operation: DndReorderState<D>) => string;\n liveAnnouncementDndItemResized: (operation: DndResizeState<D>) => string;\n liveAnnouncementDndItemInserted: (operation: DndInsertState<D>) => string;\n liveAnnouncementDndCommitted: (operationType: DndOperationType) => string;\n liveAnnouncementDndDiscarded: (operationType: DndOperationType) => string;\n liveAnnouncementItemRemoved: (operation: ItemRemovedState<D>) => string;\n navigationAriaLabel: string;\n navigationAriaDescription?: string;\n navigationItemAriaLabel: (item: null | BoardProps.Item<D>) => string;\n }\n\n export type DndOperationType = \"reorder\" | \"resize\" | \"insert\";\n\n export interface ItemPlacement {\n x: number;\n y: number;\n width: number;\n height: number;\n }\n\n export interface DndReorderState<D> {\n item: Item<D>;\n placement: ItemPlacement;\n direction: \"horizontal\" | \"vertical\";\n conflicts: readonly Item<D>[];\n disturbed: readonly Item<D>[];\n }\n\n export interface DndInsertState<D> {\n item: Item<D>;\n placement: ItemPlacement;\n conflicts: readonly Item<D>[];\n disturbed: readonly Item<D>[];\n }\n\n export interface DndResizeState<D> {\n item: Item<D>;\n placement: ItemPlacement;\n direction: \"horizontal\" | \"vertical\";\n isMinimalColumnsReached: boolean;\n isMinimalRowsReached: boolean;\n conflicts: readonly Item<D>[];\n disturbed: readonly Item<D>[];\n }\n\n export interface ItemRemovedState<D> {\n item: Item<D>;\n disturbed: readonly Item<D>[];\n }\n}\n\nexport interface Transition<D> {\n operation: Operation;\n interactionType: InteractionType;\n itemsLayout: GridLayout;\n layoutEngine: LayoutEngine;\n insertionDirection: null | Direction;\n draggableItem: BoardItemDefinitionBase<D>;\n draggableRect: Rect;\n acquiredItem: null | BoardItemDefinitionBase<D>;\n collisionIds: Set<ItemId>;\n layoutShift: null | LayoutShift;\n path: readonly Position[];\n acquiredItemElement?: ReactNode;\n}\n\nexport interface RemoveTransition<D> {\n items: readonly BoardProps.Item<D>[];\n removedItem: BoardItemDefinitionBase<D>;\n layoutShift: LayoutShift;\n}\n\nexport type TransitionAnnouncement =\n | DndStartedAnnouncement\n | DndActionAnnouncement\n | DndCommittedAnnouncement\n | DndDiscardedAnnouncement\n | ItemRemovedAnnouncement;\n\nexport interface DndStartedAnnouncement {\n type: \"dnd-started\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n}\nexport interface DndActionAnnouncement {\n type: \"dnd-action\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n placement: Omit<GridLayoutItem, \"id\">;\n direction: null | Direction;\n conflicts: Set<ItemId>;\n disturbed: Set<ItemId>;\n}\nexport interface DndCommittedAnnouncement {\n type: \"dnd-committed\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n}\nexport interface DndDiscardedAnnouncement {\n type: \"dnd-discarded\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n}\nexport interface ItemRemovedAnnouncement {\n type: \"item-removed\";\n item: BoardItemDefinitionBase<unknown>;\n disturbed: Set<ItemId>;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/board/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode } from \"react\";\n\nimport { InteractionType, Operation } from \"../internal/dnd-controller/controller\";\nimport {\n BoardItemDefinition,\n BoardItemDefinitionBase,\n DataFallbackType,\n Direction,\n GridLayout,\n GridLayoutItem,\n ItemId,\n Rect,\n} from \"../internal/interfaces\";\nimport { LayoutEngine } from \"../internal/layout-engine/engine\";\nimport { LayoutShift } from \"../internal/layout-engine/interfaces\";\nimport { NonCancelableEventHandler } from \"../internal/utils/events\";\nimport { Position } from \"../internal/utils/position\";\n\n/*\n Note:\n The component does not provide handling of items state (loading, error, loaded).\n It is the responsibility of the client to control it and provide the necessary\n ARIA-live announcements.\n*/\n\nexport interface BoardProps<D = DataFallbackType> {\n /**\n * Specifies the items displayed in the board. Each item includes its position on the board and\n * optional data. The content of an item is controlled by the `renderItem` property.\n *\n * The 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 */\n items: ReadonlyArray<BoardProps.Item<D>>;\n\n /**\n * Specifies a function to render content for board items. The return value must include board item component.\n *\n * The 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 */\n renderItem: (item: BoardProps.Item<D>, actions: BoardProps.ItemActions) => JSX.Element;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * Live 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 */\n i18nStrings: BoardProps.I18nStrings<D>;\n\n /**\n * Called when a user modifies the size or position of board items.\n *\n * The change detail has the following properties:\n *\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 applicable.\n * * `removedItem`: (Item<D>, optional) - the item that was removed as part of the update, if applicable.\n * * `resizedItem`: (Item<D>, optional) - the item that was resized as part of the update, if applicable.\n * * `movedItem`: (Item<D>, optional) - the item that was moved as part of the update, if applicable.\n */\n onItemsChange: NonCancelableEventHandler<BoardProps.ItemsChangeDetail<D>>;\n\n /**\n * Rendered when the `items` array is empty.\n *\n * When items are loading the slot can be used to render the loading indicator.\n */\n empty: ReactNode;\n}\n\nexport namespace BoardProps {\n export type Item<D = DataFallbackType> = BoardItemDefinition<D>;\n\n export interface ItemActions {\n removeItem(): void;\n }\n\n export interface ItemsChangeDetail<D = DataFallbackType> {\n items: ReadonlyArray<Item<D>>;\n movedItem?: Item<D>;\n resizedItem?: Item<D>;\n addedItem?: Item<D>;\n removedItem?: Item<D>;\n }\n\n export interface I18nStrings<D> {\n liveAnnouncementDndStarted: (operationType: DndOperationType) => string;\n liveAnnouncementDndItemReordered: (operation: DndReorderState<D>) => string;\n liveAnnouncementDndItemResized: (operation: DndResizeState<D>) => string;\n liveAnnouncementDndItemInserted: (operation: DndInsertState<D>) => string;\n liveAnnouncementDndCommitted: (operationType: DndOperationType) => string;\n liveAnnouncementDndDiscarded: (operationType: DndOperationType) => string;\n liveAnnouncementItemRemoved: (operation: ItemRemovedState<D>) => string;\n\n /** @deprecated Has no effect. */\n navigationAriaLabel: string;\n /** @deprecated Has no effect. */\n navigationAriaDescription?: string;\n /** @deprecated Has no effect. */\n navigationItemAriaLabel: (item: null | BoardProps.Item<D>) => string;\n }\n\n export type DndOperationType = \"reorder\" | \"resize\" | \"insert\";\n\n export interface ItemPlacement {\n x: number;\n y: number;\n width: number;\n height: number;\n }\n\n export interface DndReorderState<D> {\n item: Item<D>;\n placement: ItemPlacement;\n direction: \"horizontal\" | \"vertical\";\n conflicts: readonly Item<D>[];\n disturbed: readonly Item<D>[];\n }\n\n export interface DndInsertState<D> {\n item: Item<D>;\n placement: ItemPlacement;\n conflicts: readonly Item<D>[];\n disturbed: readonly Item<D>[];\n }\n\n export interface DndResizeState<D> {\n item: Item<D>;\n placement: ItemPlacement;\n direction: \"horizontal\" | \"vertical\";\n isMinimalColumnsReached: boolean;\n isMinimalRowsReached: boolean;\n conflicts: readonly Item<D>[];\n disturbed: readonly Item<D>[];\n }\n\n export interface ItemRemovedState<D> {\n item: Item<D>;\n disturbed: readonly Item<D>[];\n }\n}\n\nexport interface Transition<D> {\n operation: Operation;\n interactionType: InteractionType;\n itemsLayout: GridLayout;\n layoutEngine: LayoutEngine;\n insertionDirection: null | Direction;\n draggableItem: BoardItemDefinitionBase<D>;\n draggableRect: Rect;\n acquiredItem: null | BoardItemDefinitionBase<D>;\n collisionIds: Set<ItemId>;\n layoutShift: null | LayoutShift;\n path: readonly Position[];\n acquiredItemElement?: ReactNode;\n}\n\nexport interface RemoveTransition<D> {\n items: readonly BoardProps.Item<D>[];\n removedItem: BoardItemDefinitionBase<D>;\n layoutShift: LayoutShift;\n}\n\nexport type TransitionAnnouncement =\n | DndStartedAnnouncement\n | DndActionAnnouncement\n | DndCommittedAnnouncement\n | DndDiscardedAnnouncement\n | ItemRemovedAnnouncement;\n\nexport interface DndStartedAnnouncement {\n type: \"dnd-started\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n}\nexport interface DndActionAnnouncement {\n type: \"dnd-action\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n placement: Omit<GridLayoutItem, \"id\">;\n direction: null | Direction;\n conflicts: Set<ItemId>;\n disturbed: Set<ItemId>;\n}\nexport interface DndCommittedAnnouncement {\n type: \"dnd-committed\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n}\nexport interface DndDiscardedAnnouncement {\n type: \"dnd-discarded\";\n item: BoardItemDefinitionBase<unknown>;\n operation: Operation;\n}\nexport interface ItemRemovedAnnouncement {\n type: \"item-removed\";\n item: BoardItemDefinitionBase<unknown>;\n disturbed: Set<ItemId>;\n}\n"]}
package/board/internal.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import { getIsRtl } from "@cloudscape-design/component-toolkit/internal";
5
- import clsx from "clsx";
6
4
  import { useEffect, useRef } from "react";
5
+ import clsx from "clsx";
6
+ import { getIsRtl } from "@cloudscape-design/component-toolkit/internal";
7
7
  import { getDataAttributes } from "../internal/base-component/get-data-attributes";
8
8
  import { useContainerColumns } from "../internal/breakpoints";
9
9
  import { TRANSITION_DURATION_MS } from "../internal/constants";
@@ -12,17 +12,16 @@ import { useGlobalDragStateStyles } from "../internal/global-drag-state-styles";
12
12
  import Grid from "../internal/grid";
13
13
  import { ItemContainer } from "../internal/item-container";
14
14
  import LiveRegion from "../internal/live-region";
15
- import { ScreenReaderGridNavigation } from "../internal/screenreader-grid-navigation";
16
15
  import { createPlaceholdersLayout, getDefaultColumnSpan, getDefaultRowSpan, getMinColumnSpan, getMinRowSpan, interpretItems, } from "../internal/utils/layout";
17
16
  import { Position } from "../internal/utils/position";
18
17
  import { useAutoScroll } from "../internal/utils/use-auto-scroll";
19
18
  import { useMergeRefs } from "../internal/utils/use-merge-refs";
20
19
  import Placeholder from "./placeholder";
21
- import styles from "./styles.css.js";
22
20
  import { selectTransitionRows, useTransition } from "./transition";
23
21
  import { announcementToString } from "./utils/announcements";
24
22
  import { createTransforms } from "./utils/create-transforms";
25
23
  import { createItemsChangeEvent } from "./utils/events";
24
+ import styles from "./styles.css.js";
26
25
  export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStrings, __internalRootRef, ...rest }) {
27
26
  var _a, _b;
28
27
  const containerAccessRef = useRef(null);
@@ -154,9 +153,6 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
154
153
  const removeItemAction = (removedItem) => {
155
154
  dispatch({ type: "init-remove", items, itemsLayout, removedItem });
156
155
  };
157
- function focusItem(itemId) {
158
- itemContainerRef.current[itemId].focusDragHandle();
159
- }
160
156
  function onItemMove(direction) {
161
157
  if (transition) {
162
158
  dispatch({ type: "update-with-keyboard", direction });
@@ -166,7 +162,7 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
166
162
  const announcement = transitionAnnouncement
167
163
  ? announcementToString(transitionAnnouncement, items, i18nStrings, itemsLayout.columns)
168
164
  : "";
169
- return (_jsxs("div", { ref: __internalRootRef, ...getDataAttributes(rest), children: [_jsx(ScreenReaderGridNavigation, { items: items, itemsLayout: itemsLayout, ariaLabel: i18nStrings.navigationAriaLabel, ariaDescription: i18nStrings.navigationAriaDescription, itemAriaLabel: i18nStrings.navigationItemAriaLabel, onActivateItem: focusItem }), _jsx("div", { ref: containerRef, className: clsx(styles.root, { [styles.empty]: rows === 0 }), children: rows > 0 ? (_jsx(Grid, { isRtl: isRtl, columns: itemsLayout.columns, layout: [...placeholdersLayout.items, ...itemsLayout.items], children: (gridContext) => {
165
+ return (_jsxs("div", { ref: __internalRootRef, ...getDataAttributes(rest), children: [_jsx("div", { ref: containerRef, className: clsx(styles.root, { [styles.empty]: rows === 0 }), children: rows > 0 ? (_jsx(Grid, { isRtl: isRtl, columns: itemsLayout.columns, layout: [...placeholdersLayout.items, ...itemsLayout.items], children: (gridContext) => {
170
166
  var _a;
171
167
  const layoutShift = (_a = transition === null || transition === void 0 ? void 0 : transition.layoutShift) !== null && _a !== void 0 ? _a : removeTransition === null || removeTransition === void 0 ? void 0 : removeTransition.layoutShift;
172
168
  const transforms = layoutShift ? createTransforms(itemsLayout, layoutShift.moves, gridContext) : {};
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/board/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC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AE,CAAA,IAAI,mBAAmB;oCAClD,CAAC,CAAC,GAAG,EAAE,CAAC,mBAAmB;oCAC3B,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,IA1BnE,IAAI,CAAC,EAAE,CA2BE,CACjB,CAAC;wBACJ,CAAC,CAAC,CAAC;wBAEH,OAAO,QAAQ,CAAC;oBAClB,CAAC,GACI,CACR,CAAC,CAAC,CAAC,CACF,KAAK,CACN,GACG,EAEN,KAAC,UAAU,cAAE,YAAY,GAAc,IACnC,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getIsRtl } from \"@cloudscape-design/component-toolkit/internal\";\nimport clsx from \"clsx\";\nimport { ReactNode, useEffect, useRef } from \"react\";\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport { useContainerColumns } from \"../internal/breakpoints\";\nimport { TRANSITION_DURATION_MS } from \"../internal/constants\";\nimport { useDragSubscription } from \"../internal/dnd-controller/controller\";\nimport { useGlobalDragStateStyles } from \"../internal/global-drag-state-styles\";\nimport Grid from \"../internal/grid\";\nimport { BoardItemDefinition, BoardItemDefinitionBase, Direction, ItemId, Rect } from \"../internal/interfaces\";\nimport { ItemContainer, ItemContainerRef } from \"../internal/item-container\";\nimport LiveRegion from \"../internal/live-region\";\nimport { ScreenReaderGridNavigation } from \"../internal/screenreader-grid-navigation\";\nimport {\n createPlaceholdersLayout,\n getDefaultColumnSpan,\n getDefaultRowSpan,\n getMinColumnSpan,\n getMinRowSpan,\n interpretItems,\n} from \"../internal/utils/layout\";\nimport { Position } from \"../internal/utils/position\";\nimport { useAutoScroll } from \"../internal/utils/use-auto-scroll\";\nimport { useMergeRefs } from \"../internal/utils/use-merge-refs\";\n\nimport { BoardProps } from \"./interfaces\";\nimport Placeholder from \"./placeholder\";\nimport styles from \"./styles.css.js\";\nimport { selectTransitionRows, useTransition } from \"./transition\";\nimport { announcementToString } from \"./utils/announcements\";\nimport { createTransforms } from \"./utils/create-transforms\";\nimport { createItemsChangeEvent } from \"./utils/events\";\n\nexport function InternalBoard<D>({\n items,\n renderItem,\n onItemsChange,\n empty,\n i18nStrings,\n __internalRootRef,\n ...rest\n}: BoardProps<D> & InternalBaseComponentProps) {\n const containerAccessRef = useRef<HTMLDivElement>(null);\n const [currentColumns, containerQueryRef] = useContainerColumns();\n const containerRef = useMergeRefs(containerAccessRef, containerQueryRef);\n const itemContainerRef = useRef<{ [id: ItemId]: ItemContainerRef }>({});\n\n const isRtl = () => getIsRtl(containerAccessRef.current);\n\n useGlobalDragStateStyles();\n\n const autoScrollHandlers = useAutoScroll();\n\n const [transitionState, dispatch] = useTransition<D>({ isRtl });\n const transition = transitionState.transition;\n const removeTransition = transitionState.removeTransition;\n const transitionAnnouncement = transitionState.announcement;\n const acquiredItem = transition?.acquiredItem ?? null;\n const acquiredItemElement = transition?.acquiredItemElement;\n\n // Using cached columns from transition to ensure no unexpected changes in the process.\n const columns = transition ? transition.itemsLayout.columns : currentColumns;\n\n // Use previous items while remove transition is in progress.\n items = removeTransition?.items ?? items;\n\n // The acquired item is the one being inserting at the moment but not submitted yet.\n // It needs to be included to the layout to be a part of layout shifts and rendering.\n items = acquiredItem ? [...items, acquiredItem] : items;\n const itemsLayout = interpretItems(items, columns);\n\n const layoutItemById = new Map(itemsLayout.items.map((item) => [item.id, item]));\n const layoutItemIndexById = new Map(itemsLayout.items.map((item, index) => [item.id, index]));\n\n // Items and layout items must maintain the same order visually, in the DOM and in the data\n // to ensure on-change events and tab order work as expected.\n items = [...items].sort((a, b) => (layoutItemIndexById.get(a.id) ?? -1) - (layoutItemIndexById.get(b.id) ?? -1));\n\n // When an item gets acquired or removed the focus needs to be dispatched on the next render.\n const focusNextRenderIndexRef = useRef<null | number>(null);\n const focusNextRenderIdRef = useRef<null | ItemId>(null);\n useEffect(() => {\n const focusTarget = focusNextRenderIdRef.current ?? items[focusNextRenderIndexRef.current ?? -1]?.id;\n if (focusTarget) {\n itemContainerRef.current[focusTarget].focusDragHandle();\n }\n focusNextRenderIndexRef.current = null;\n focusNextRenderIdRef.current = null;\n });\n\n // Submit scheduled removal after a delay to let animations play.\n useEffect(() => {\n if (!removeTransition) {\n return;\n }\n\n const timeoutId = setTimeout(() => {\n dispatch({ type: \"submit\" });\n\n const removedItemIndex = items.findIndex((it) => it.id === removeTransition.removedItem.id);\n const nextIndexToFocus = removedItemIndex !== items.length - 1 ? removedItemIndex : items.length - 2;\n focusNextRenderIndexRef.current = nextIndexToFocus;\n onItemsChange(createItemsChangeEvent(items, removeTransition.layoutShift));\n }, TRANSITION_DURATION_MS);\n\n return () => clearTimeout(timeoutId);\n }, [removeTransition, items, onItemsChange]);\n\n const rows = selectTransitionRows(transitionState) || itemsLayout.rows;\n const placeholdersLayout = createPlaceholdersLayout(rows, itemsLayout.columns);\n\n function isElementOverBoard(rect: Rect) {\n const board = containerAccessRef.current!;\n const boardContains = (target: null | Element) => board === target || board.contains(target);\n const left = !isRtl() ? rect.left : document.documentElement.clientWidth - rect.left;\n const right = !isRtl() ? rect.right : document.documentElement.clientWidth - rect.right;\n const { top, bottom } = rect;\n return (\n boardContains(document.elementFromPoint(left, top)) ||\n boardContains(document.elementFromPoint(right, top)) ||\n boardContains(document.elementFromPoint(right, bottom)) ||\n boardContains(document.elementFromPoint(left, bottom))\n );\n }\n\n useDragSubscription(\"start\", ({ operation, interactionType, draggableItem, collisionRect, collisionIds }) => {\n dispatch({\n type: \"init\",\n operation,\n interactionType,\n itemsLayout,\n // TODO: resolve any\n // The code only works assuming the board can take any draggable.\n // If draggables can be of different types a check of some sort is required here.\n draggableItem: draggableItem as BoardItemDefinitionBase<any>,\n draggableRect: collisionRect,\n collisionIds: interactionType === \"pointer\" && isElementOverBoard(collisionRect) ? collisionIds : [],\n });\n\n autoScrollHandlers.addPointerEventHandlers();\n });\n\n useDragSubscription(\"update\", ({ interactionType, collisionIds, positionOffset, collisionRect }) => {\n dispatch({\n type: \"update-with-pointer\",\n collisionIds: interactionType === \"pointer\" && isElementOverBoard(collisionRect) ? collisionIds : [],\n positionOffset,\n draggableRect: collisionRect,\n });\n });\n\n useDragSubscription(\"submit\", () => {\n dispatch({ type: \"submit\" });\n\n autoScrollHandlers.removePointerEventHandlers();\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n if (\n !transition.layoutShift ||\n transition.layoutShift.conflicts.length > 0 ||\n transition.layoutShift.moves.length === 0\n ) {\n return null;\n }\n\n // Commit new layout for insert case.\n if (transition.operation === \"insert\") {\n onItemsChange(createItemsChangeEvent([...items, transition.draggableItem], transition.layoutShift));\n }\n // Commit new layout for reorder/resize case.\n else {\n onItemsChange(createItemsChangeEvent(items, transition.layoutShift));\n }\n });\n\n useDragSubscription(\"discard\", () => {\n dispatch({ type: \"discard\" });\n\n autoScrollHandlers.removePointerEventHandlers();\n });\n\n useDragSubscription(\"acquire\", ({ droppableId, draggableItem, renderAcquiredItem }) => {\n const placeholder = placeholdersLayout.items.find((it) => it.id === droppableId);\n\n // If missing then it does not belong to this board.\n if (!placeholder) {\n return;\n }\n\n dispatch({\n type: \"acquire-item\",\n position: new Position({ x: placeholder.x, y: placeholder.y }),\n layoutElement: containerAccessRef.current!,\n acquiredItemElement: renderAcquiredItem(),\n });\n\n focusNextRenderIdRef.current = draggableItem.id;\n });\n\n const removeItemAction = (removedItem: BoardItemDefinition<D>) => {\n dispatch({ type: \"init-remove\", items, itemsLayout, removedItem });\n };\n\n function focusItem(itemId: ItemId) {\n itemContainerRef.current[itemId].focusDragHandle();\n }\n\n function onItemMove(direction: Direction) {\n if (transition) {\n dispatch({ type: \"update-with-keyboard\", direction });\n autoScrollHandlers.scheduleActiveElementScrollIntoView(TRANSITION_DURATION_MS);\n }\n }\n\n const announcement = transitionAnnouncement\n ? announcementToString(transitionAnnouncement, items, i18nStrings, itemsLayout.columns)\n : \"\";\n\n return (\n <div ref={__internalRootRef} {...getDataAttributes(rest)}>\n <ScreenReaderGridNavigation\n items={items}\n itemsLayout={itemsLayout}\n ariaLabel={i18nStrings.navigationAriaLabel}\n ariaDescription={i18nStrings.navigationAriaDescription}\n itemAriaLabel={i18nStrings.navigationItemAriaLabel}\n onActivateItem={focusItem}\n />\n\n <div ref={containerRef} className={clsx(styles.root, { [styles.empty]: rows === 0 })}>\n {rows > 0 ? (\n <Grid\n isRtl={isRtl}\n columns={itemsLayout.columns}\n layout={[...placeholdersLayout.items, ...itemsLayout.items]}\n >\n {(gridContext) => {\n const layoutShift = transition?.layoutShift ?? removeTransition?.layoutShift;\n const transforms = layoutShift ? createTransforms(itemsLayout, layoutShift.moves, gridContext) : {};\n\n // Exclude drag target from transforms.\n if (transition && transition.interactionType === \"pointer\") {\n delete transforms[transition.draggableItem.id];\n }\n\n const children: ReactNode[] = [];\n\n /* Placeholders are rendered even when there is no transition to support the first collisions check. */\n placeholdersLayout.items.forEach((placeholder) =>\n children.push(\n <Placeholder\n key={placeholder.id}\n id={placeholder.id}\n state={transition ? (transition.collisionIds?.has(placeholder.id) ? \"hover\" : \"active\") : \"default\"}\n gridContext={gridContext}\n columns={itemsLayout.columns}\n />,\n ),\n );\n\n items.forEach((item) => {\n const layoutItem = layoutItemById.get(item.id);\n const isResizing = transition?.operation === \"resize\" && transition?.draggableItem.id === item.id;\n\n const itemSize = layoutItem ?? {\n width: getDefaultColumnSpan(item, itemsLayout.columns),\n height: getDefaultRowSpan(item),\n };\n\n const itemMaxSize =\n isResizing && layoutItem ? { width: itemsLayout.columns - layoutItem.x, height: 999 } : itemSize;\n\n children.push(\n <ItemContainer\n key={item.id}\n ref={(elem) => {\n if (elem) {\n itemContainerRef.current[item.id] = elem;\n } else {\n delete itemContainerRef.current[item.id];\n }\n }}\n item={item}\n transform={transforms[item.id]}\n inTransition={!!transition || !!removeTransition}\n placed={item.id !== acquiredItem?.id}\n acquired={item.id === acquiredItem?.id}\n getItemSize={() => ({\n width: gridContext.getWidth(itemSize.width),\n minWidth: gridContext.getWidth(getMinColumnSpan(item, itemsLayout.columns)),\n maxWidth: gridContext.getWidth(itemMaxSize.width),\n height: gridContext.getHeight(itemSize.height),\n minHeight: gridContext.getHeight(getMinRowSpan(item)),\n maxHeight: gridContext.getHeight(itemMaxSize.height),\n })}\n onKeyMove={onItemMove}\n isRtl={isRtl}\n >\n {item.id === acquiredItem?.id && acquiredItemElement\n ? () => acquiredItemElement\n : () => renderItem(item, { removeItem: () => removeItemAction(item) })}\n </ItemContainer>,\n );\n });\n\n return children;\n }}\n </Grid>\n ) : (\n empty\n )}\n </div>\n\n <LiveRegion>{announcement}</LiveRegion>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/board/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAoB,MAAM,4BAA4B,CAAC;AAC7E,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,gB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AAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;oCACrD,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC;iCACrD,CAAC,EACF,SAAS,EAAE,UAAU,EACrB,KAAK,EAAE,KAAK,YAEX,IAAI,CAAC,EAAE,MAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,EAAE,CAAA,IAAI,mBAAmB;oCAClD,CAAC,CAAC,GAAG,EAAE,CAAC,mBAAmB;oCAC3B,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,IA1BnE,IAAI,CAAC,EAAE,CA2BE,CACjB,CAAC;wBACJ,CAAC,CAAC,CAAC;wBAEH,OAAO,QAAQ,CAAC;oBAClB,CAAC,GACI,CACR,CAAC,CAAC,CAAC,CACF,KAAK,CACN,GACG,EAEN,KAAC,UAAU,cAAE,YAAY,GAAc,IACnC,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode, useEffect, useRef } from \"react\";\nimport clsx from \"clsx\";\n\nimport { getIsRtl } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport { useContainerColumns } from \"../internal/breakpoints\";\nimport { TRANSITION_DURATION_MS } from \"../internal/constants\";\nimport { useDragSubscription } from \"../internal/dnd-controller/controller\";\nimport { useGlobalDragStateStyles } from \"../internal/global-drag-state-styles\";\nimport Grid from \"../internal/grid\";\nimport { BoardItemDefinition, BoardItemDefinitionBase, Direction, ItemId, Rect } from \"../internal/interfaces\";\nimport { ItemContainer, ItemContainerRef } from \"../internal/item-container\";\nimport LiveRegion from \"../internal/live-region\";\nimport {\n createPlaceholdersLayout,\n getDefaultColumnSpan,\n getDefaultRowSpan,\n getMinColumnSpan,\n getMinRowSpan,\n interpretItems,\n} from \"../internal/utils/layout\";\nimport { Position } from \"../internal/utils/position\";\nimport { useAutoScroll } from \"../internal/utils/use-auto-scroll\";\nimport { useMergeRefs } from \"../internal/utils/use-merge-refs\";\nimport { BoardProps } from \"./interfaces\";\nimport Placeholder from \"./placeholder\";\nimport { selectTransitionRows, useTransition } from \"./transition\";\nimport { announcementToString } from \"./utils/announcements\";\nimport { createTransforms } from \"./utils/create-transforms\";\nimport { createItemsChangeEvent } from \"./utils/events\";\n\nimport styles from \"./styles.css.js\";\n\nexport function InternalBoard<D>({\n items,\n renderItem,\n onItemsChange,\n empty,\n i18nStrings,\n __internalRootRef,\n ...rest\n}: BoardProps<D> & InternalBaseComponentProps) {\n const containerAccessRef = useRef<HTMLDivElement>(null);\n const [currentColumns, containerQueryRef] = useContainerColumns();\n const containerRef = useMergeRefs(containerAccessRef, containerQueryRef);\n const itemContainerRef = useRef<{ [id: ItemId]: ItemContainerRef }>({});\n\n const isRtl = () => getIsRtl(containerAccessRef.current);\n\n useGlobalDragStateStyles();\n\n const autoScrollHandlers = useAutoScroll();\n\n const [transitionState, dispatch] = useTransition<D>({ isRtl });\n const transition = transitionState.transition;\n const removeTransition = transitionState.removeTransition;\n const transitionAnnouncement = transitionState.announcement;\n const acquiredItem = transition?.acquiredItem ?? null;\n const acquiredItemElement = transition?.acquiredItemElement;\n\n // Using cached columns from transition to ensure no unexpected changes in the process.\n const columns = transition ? transition.itemsLayout.columns : currentColumns;\n\n // Use previous items while remove transition is in progress.\n items = removeTransition?.items ?? items;\n\n // The acquired item is the one being inserting at the moment but not submitted yet.\n // It needs to be included to the layout to be a part of layout shifts and rendering.\n items = acquiredItem ? [...items, acquiredItem] : items;\n const itemsLayout = interpretItems(items, columns);\n\n const layoutItemById = new Map(itemsLayout.items.map((item) => [item.id, item]));\n const layoutItemIndexById = new Map(itemsLayout.items.map((item, index) => [item.id, index]));\n\n // Items and layout items must maintain the same order visually, in the DOM and in the data\n // to ensure on-change events and tab order work as expected.\n items = [...items].sort((a, b) => (layoutItemIndexById.get(a.id) ?? -1) - (layoutItemIndexById.get(b.id) ?? -1));\n\n // When an item gets acquired or removed the focus needs to be dispatched on the next render.\n const focusNextRenderIndexRef = useRef<null | number>(null);\n const focusNextRenderIdRef = useRef<null | ItemId>(null);\n useEffect(() => {\n const focusTarget = focusNextRenderIdRef.current ?? items[focusNextRenderIndexRef.current ?? -1]?.id;\n if (focusTarget) {\n itemContainerRef.current[focusTarget].focusDragHandle();\n }\n focusNextRenderIndexRef.current = null;\n focusNextRenderIdRef.current = null;\n });\n\n // Submit scheduled removal after a delay to let animations play.\n useEffect(() => {\n if (!removeTransition) {\n return;\n }\n\n const timeoutId = setTimeout(() => {\n dispatch({ type: \"submit\" });\n\n const removedItemIndex = items.findIndex((it) => it.id === removeTransition.removedItem.id);\n const nextIndexToFocus = removedItemIndex !== items.length - 1 ? removedItemIndex : items.length - 2;\n focusNextRenderIndexRef.current = nextIndexToFocus;\n onItemsChange(createItemsChangeEvent(items, removeTransition.layoutShift));\n }, TRANSITION_DURATION_MS);\n\n return () => clearTimeout(timeoutId);\n }, [removeTransition, items, onItemsChange]);\n\n const rows = selectTransitionRows(transitionState) || itemsLayout.rows;\n const placeholdersLayout = createPlaceholdersLayout(rows, itemsLayout.columns);\n\n function isElementOverBoard(rect: Rect) {\n const board = containerAccessRef.current!;\n const boardContains = (target: null | Element) => board === target || board.contains(target);\n const left = !isRtl() ? rect.left : document.documentElement.clientWidth - rect.left;\n const right = !isRtl() ? rect.right : document.documentElement.clientWidth - rect.right;\n const { top, bottom } = rect;\n return (\n boardContains(document.elementFromPoint(left, top)) ||\n boardContains(document.elementFromPoint(right, top)) ||\n boardContains(document.elementFromPoint(right, bottom)) ||\n boardContains(document.elementFromPoint(left, bottom))\n );\n }\n\n useDragSubscription(\"start\", ({ operation, interactionType, draggableItem, collisionRect, collisionIds }) => {\n dispatch({\n type: \"init\",\n operation,\n interactionType,\n itemsLayout,\n // TODO: resolve any\n // The code only works assuming the board can take any draggable.\n // If draggables can be of different types a check of some sort is required here.\n draggableItem: draggableItem as BoardItemDefinitionBase<any>,\n draggableRect: collisionRect,\n collisionIds: interactionType === \"pointer\" && isElementOverBoard(collisionRect) ? collisionIds : [],\n });\n\n autoScrollHandlers.addPointerEventHandlers();\n });\n\n useDragSubscription(\"update\", ({ interactionType, collisionIds, positionOffset, collisionRect }) => {\n dispatch({\n type: \"update-with-pointer\",\n collisionIds: interactionType === \"pointer\" && isElementOverBoard(collisionRect) ? collisionIds : [],\n positionOffset,\n draggableRect: collisionRect,\n });\n });\n\n useDragSubscription(\"submit\", () => {\n dispatch({ type: \"submit\" });\n\n autoScrollHandlers.removePointerEventHandlers();\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n if (\n !transition.layoutShift ||\n transition.layoutShift.conflicts.length > 0 ||\n transition.layoutShift.moves.length === 0\n ) {\n return null;\n }\n\n // Commit new layout for insert case.\n if (transition.operation === \"insert\") {\n onItemsChange(createItemsChangeEvent([...items, transition.draggableItem], transition.layoutShift));\n }\n // Commit new layout for reorder/resize case.\n else {\n onItemsChange(createItemsChangeEvent(items, transition.layoutShift));\n }\n });\n\n useDragSubscription(\"discard\", () => {\n dispatch({ type: \"discard\" });\n\n autoScrollHandlers.removePointerEventHandlers();\n });\n\n useDragSubscription(\"acquire\", ({ droppableId, draggableItem, renderAcquiredItem }) => {\n const placeholder = placeholdersLayout.items.find((it) => it.id === droppableId);\n\n // If missing then it does not belong to this board.\n if (!placeholder) {\n return;\n }\n\n dispatch({\n type: \"acquire-item\",\n position: new Position({ x: placeholder.x, y: placeholder.y }),\n layoutElement: containerAccessRef.current!,\n acquiredItemElement: renderAcquiredItem(),\n });\n\n focusNextRenderIdRef.current = draggableItem.id;\n });\n\n const removeItemAction = (removedItem: BoardItemDefinition<D>) => {\n dispatch({ type: \"init-remove\", items, itemsLayout, removedItem });\n };\n\n function onItemMove(direction: Direction) {\n if (transition) {\n dispatch({ type: \"update-with-keyboard\", direction });\n autoScrollHandlers.scheduleActiveElementScrollIntoView(TRANSITION_DURATION_MS);\n }\n }\n\n const announcement = transitionAnnouncement\n ? announcementToString(transitionAnnouncement, items, i18nStrings, itemsLayout.columns)\n : \"\";\n\n return (\n <div ref={__internalRootRef} {...getDataAttributes(rest)}>\n <div ref={containerRef} className={clsx(styles.root, { [styles.empty]: rows === 0 })}>\n {rows > 0 ? (\n <Grid\n isRtl={isRtl}\n columns={itemsLayout.columns}\n layout={[...placeholdersLayout.items, ...itemsLayout.items]}\n >\n {(gridContext) => {\n const layoutShift = transition?.layoutShift ?? removeTransition?.layoutShift;\n const transforms = layoutShift ? createTransforms(itemsLayout, layoutShift.moves, gridContext) : {};\n\n // Exclude drag target from transforms.\n if (transition && transition.interactionType === \"pointer\") {\n delete transforms[transition.draggableItem.id];\n }\n\n const children: ReactNode[] = [];\n\n /* Placeholders are rendered even when there is no transition to support the first collisions check. */\n placeholdersLayout.items.forEach((placeholder) =>\n children.push(\n <Placeholder\n key={placeholder.id}\n id={placeholder.id}\n state={transition ? (transition.collisionIds?.has(placeholder.id) ? \"hover\" : \"active\") : \"default\"}\n gridContext={gridContext}\n columns={itemsLayout.columns}\n />,\n ),\n );\n\n items.forEach((item) => {\n const layoutItem = layoutItemById.get(item.id);\n const isResizing = transition?.operation === \"resize\" && transition?.draggableItem.id === item.id;\n\n const itemSize = layoutItem ?? {\n width: getDefaultColumnSpan(item, itemsLayout.columns),\n height: getDefaultRowSpan(item),\n };\n\n const itemMaxSize =\n isResizing && layoutItem ? { width: itemsLayout.columns - layoutItem.x, height: 999 } : itemSize;\n\n children.push(\n <ItemContainer\n key={item.id}\n ref={(elem) => {\n if (elem) {\n itemContainerRef.current[item.id] = elem;\n } else {\n delete itemContainerRef.current[item.id];\n }\n }}\n item={item}\n transform={transforms[item.id]}\n inTransition={!!transition || !!removeTransition}\n placed={item.id !== acquiredItem?.id}\n acquired={item.id === acquiredItem?.id}\n getItemSize={() => ({\n width: gridContext.getWidth(itemSize.width),\n minWidth: gridContext.getWidth(getMinColumnSpan(item, itemsLayout.columns)),\n maxWidth: gridContext.getWidth(itemMaxSize.width),\n height: gridContext.getHeight(itemSize.height),\n minHeight: gridContext.getHeight(getMinRowSpan(item)),\n maxHeight: gridContext.getHeight(itemMaxSize.height),\n })}\n onKeyMove={onItemMove}\n isRtl={isRtl}\n >\n {item.id === acquiredItem?.id && acquiredItemElement\n ? () => acquiredItemElement\n : () => renderItem(item, { removeItem: () => removeItemAction(item) })}\n </ItemContainer>,\n );\n });\n\n return children;\n }}\n </Grid>\n ) : (\n empty\n )}\n </div>\n\n <LiveRegion>{announcement}</LiveRegion>\n </div>\n );\n}\n"]}
@@ -1,8 +1,8 @@
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 clsx from "clsx";
5
4
  import { useRef } from "react";
5
+ import clsx from "clsx";
6
6
  import { useDroppable } from "../internal/dnd-controller/controller";
7
7
  import { getDefaultColumnSpan, getDefaultRowSpan } from "../internal/utils/layout";
8
8
  import styles from "./styles.css.js";
@@ -1 +1 @@
1
- {"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../../src/board/placeholder.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAWrC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAoB;IACvF,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEzC,MAAM,iBAAiB,GAAG;QACxB,KAAK,EAAE,CAAC,IAAsC,EAAE,IAAwC,EAAE,EAAE;;YAC1F,MAAM,KAAK,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,mCAAI,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACjE,MAAM,MAAM,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACvD,OAAO;gBACL,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAClC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC;aACtC,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,OAAQ,EAAE,CAAC,CAAC;IAEzF,OAAO,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,gBAAgB,KAAK,EAAE,CAAC,CAAC,GAAI,CAAC;AACjG,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from \"clsx\";\nimport { useRef } from \"react\";\nimport { useDroppable } from \"../internal/dnd-controller/controller\";\nimport { GridContext } from \"../internal/grid/interfaces\";\nimport { BoardItemDefinitionBase } from \"../internal/interfaces\";\nimport { getDefaultColumnSpan, getDefaultRowSpan } from \"../internal/utils/layout\";\nimport styles from \"./styles.css.js\";\n\nexport type PlaceholderState = \"default\" | \"active\" | \"hover\";\n\nexport interface PlaceholderProps {\n id: string;\n state: PlaceholderState;\n gridContext: GridContext;\n columns: number;\n}\n\nexport default function Placeholder({ id, state, gridContext, columns }: PlaceholderProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n const dropTargetContext = {\n scale: (item: BoardItemDefinitionBase<unknown>, size?: { width: number; height: number }) => {\n const width = size?.width ?? getDefaultColumnSpan(item, columns);\n const height = size?.height ?? getDefaultRowSpan(item);\n return {\n width: gridContext.getWidth(width),\n height: gridContext.getHeight(height),\n };\n },\n };\n\n useDroppable({ itemId: id, context: dropTargetContext, getElement: () => ref.current! });\n\n return <div ref={ref} className={clsx(styles.placeholder, styles[`placeholder--${state}`])} />;\n}\n"]}
1
+ {"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../../src/board/placeholder.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAWrC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAoB;IACvF,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEzC,MAAM,iBAAiB,GAAG;QACxB,KAAK,EAAE,CAAC,IAAsC,EAAE,IAAwC,EAAE,EAAE;;YAC1F,MAAM,KAAK,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,mCAAI,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACjE,MAAM,MAAM,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACvD,OAAO;gBACL,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAClC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC;aACtC,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,OAAQ,EAAE,CAAC,CAAC;IAEzF,OAAO,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,gBAAgB,KAAK,EAAE,CAAC,CAAC,GAAI,CAAC;AACjG,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useRef } from \"react\";\nimport clsx from \"clsx\";\n\nimport { useDroppable } from \"../internal/dnd-controller/controller\";\nimport { GridContext } from \"../internal/grid/interfaces\";\nimport { BoardItemDefinitionBase } from \"../internal/interfaces\";\nimport { getDefaultColumnSpan, getDefaultRowSpan } from \"../internal/utils/layout\";\n\nimport styles from \"./styles.css.js\";\n\nexport type PlaceholderState = \"default\" | \"active\" | \"hover\";\n\nexport interface PlaceholderProps {\n id: string;\n state: PlaceholderState;\n gridContext: GridContext;\n columns: number;\n}\n\nexport default function Placeholder({ id, state, gridContext, columns }: PlaceholderProps) {\n const ref = useRef<HTMLDivElement>(null);\n\n const dropTargetContext = {\n scale: (item: BoardItemDefinitionBase<unknown>, size?: { width: number; height: number }) => {\n const width = size?.width ?? getDefaultColumnSpan(item, columns);\n const height = size?.height ?? getDefaultRowSpan(item);\n return {\n width: gridContext.getWidth(width),\n height: gridContext.getHeight(height),\n };\n },\n };\n\n useDroppable({ itemId: id, context: dropTargetContext, getElement: () => ref.current! });\n\n return <div ref={ref} className={clsx(styles.placeholder, styles[`placeholder--${state}`])} />;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { getLogicalBoundingClientRect } from "@cloudscape-design/component-toolkit/internal";
4
3
  import { useReducer } from "react";
4
+ import { getLogicalBoundingClientRect } from "@cloudscape-design/component-toolkit/internal";
5
5
  import { LayoutEngine } from "../internal/layout-engine/engine";
6
6
  import { Coordinates } from "../internal/utils/coordinates";
7
7
  import { getDefaultColumnSpan, getDefaultRowSpan, getMinColumnSpan, getMinRowSpan } from "../internal/utils/layout";
@@ -1 +1 @@
1
- {"version":3,"file":"transition.js","sourceRoot":"","sources":["../../../src/board/transition.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAuB,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAuDhE,MAAM,UAAU,aAAa,CAAI,EAAE,KAAK,EAA4B;IAClE,OAAO,UAAU,CAAC,uBAAuB,CAAI,EAAE,KAAK,EAAE,CAAC,EAAE;QACvD,UAAU,EAAE,IAAI;QAChB,gBAAgB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: Apache-2.0\nimport { getLogicalBoundingClientRect } from \"@cloudscape-design/component-toolkit/internal\";\nimport { Dispatch, ReactNode, useReducer } from \"react\";\nimport { InteractionType, Operation } from \"../internal/dnd-controller/controller\";\nimport { BoardItemDefinitionBase, Direction, GridLayout, ItemId, Rect } from \"../internal/interfaces\";\nimport { LayoutEngine } from \"../internal/layout-engine/engine\";\nimport { Coordinates } from \"../internal/utils/coordinates\";\nimport { getDefaultColumnSpan, getDefaultRowSpan, getMinColumnSpan, getMinRowSpan } from \"../internal/utils/layout\";\nimport { Position } from \"../internal/utils/position\";\nimport { BoardProps, RemoveTransition, Transition, TransitionAnnouncement } from \"./interfaces\";\nimport { createOperationAnnouncement } from \"./utils/announcements\";\nimport { getHoveredRect } from \"./utils/get-hovered-rect\";\nimport { getInsertionDirection, getLayoutPlaceholders, getLayoutRows, getLayoutShift } from \"./utils/layout\";\nimport { appendMovePath, appendResizePath } from \"./utils/path\";\n\nexport interface TransitionState<D> {\n transition: null | Transition<D>;\n removeTransition: null | RemoveTransition<D>;\n announcement: null | TransitionAnnouncement;\n}\n\nexport type Action<D> =\n | InitAction<D>\n | InitRemoveAction<D>\n | SubmitAction\n | DiscardAction\n | UpdateWithPointerAction\n | UpdateWithKeyboardAction\n | AcquireItemAction;\n\ninterface InitAction<D> {\n type: \"init\";\n operation: Operation;\n interactionType: InteractionType;\n itemsLayout: GridLayout;\n draggableItem: BoardItemDefinitionBase<D>;\n draggableRect: Rect;\n collisionIds: readonly ItemId[];\n}\ninterface InitRemoveAction<D> {\n type: \"init-remove\";\n items: readonly BoardProps.Item<D>[];\n removedItem: BoardItemDefinitionBase<D>;\n itemsLayout: GridLayout;\n}\ninterface SubmitAction {\n type: \"submit\";\n}\ninterface DiscardAction {\n type: \"discard\";\n}\ninterface UpdateWithPointerAction {\n type: \"update-with-pointer\";\n collisionIds: readonly ItemId[];\n positionOffset: Coordinates;\n draggableRect: Rect;\n}\ninterface UpdateWithKeyboardAction {\n type: \"update-with-keyboard\";\n direction: Direction;\n}\ninterface AcquireItemAction {\n type: \"acquire-item\";\n position: Position;\n layoutElement: HTMLElement;\n acquiredItemElement?: ReactNode;\n}\n\nexport function useTransition<D>({ isRtl }: { isRtl: () => boolean }): [TransitionState<D>, Dispatch<Action<D>>] {\n return useReducer(createTransitionReducer<D>({ isRtl }), {\n transition: null,\n removeTransition: null,\n announcement: null,\n });\n}\n\nexport function selectTransitionRows<D>(state: TransitionState<D>) {\n return state.transition ? getLayoutRows(state.transition) : 0;\n}\n\nfunction createTransitionReducer<D>({ isRtl }: { isRtl: () => boolean }) {\n return function transitionReducer(state: TransitionState<D>, action: Action<D>): TransitionState<D> {\n switch (action.type) {\n case \"init\":\n return initTransition(action);\n case \"init-remove\":\n return initRemoveTransition(action);\n case \"submit\":\n return submitTransition(state);\n case \"discard\":\n return discardTransition(state);\n case \"update-with-pointer\":\n return updateTransitionWithPointerEvent(state, action);\n case \"update-with-keyboard\":\n return updateTransitionWithKeyboardEvent(state, action, { isRtl });\n case \"acquire-item\":\n return acquireTransitionItem(state, action);\n }\n };\n}\n\nfunction initTransition<D>({\n operation,\n interactionType,\n itemsLayout,\n draggableItem,\n draggableRect,\n collisionIds,\n}: InitAction<D>): TransitionState<D> {\n const transition: Transition<D> = {\n operation,\n interactionType,\n itemsLayout,\n layoutEngine: new LayoutEngine(itemsLayout),\n insertionDirection: null,\n draggableItem,\n draggableRect,\n acquiredItem: null,\n collisionIds: new Set(),\n layoutShift: null,\n path: [],\n };\n\n const placeholdersLayout = getLayoutPlaceholders(transition);\n\n const layoutItem = itemsLayout.items.find((it) => it.id === draggableItem.id);\n\n let path: Position[] = [];\n if (interactionType === \"pointer\" || operation === \"insert\") {\n const collisionRect = getHoveredRect(collisionIds, placeholdersLayout.items);\n const appendPath = operation === \"resize\" ? appendResizePath : appendMovePath;\n path = layoutItem ? appendPath([], collisionRect) : [];\n } else if (layoutItem) {\n path =\n operation === \"resize\"\n ? [new Position({ x: layoutItem.x + layoutItem.width, y: layoutItem.y + layoutItem.height })]\n : [new Position({ x: layoutItem.x, y: layoutItem.y })];\n }\n\n return {\n transition: { ...transition, path },\n removeTransition: null,\n announcement: layoutItem ? { type: \"dnd-started\", item: draggableItem, operation } : null,\n };\n}\n\nfunction initRemoveTransition<D>({ items, removedItem, itemsLayout }: InitRemoveAction<D>): TransitionState<D> {\n const layoutShift = new LayoutEngine(itemsLayout).remove(removedItem.id);\n const removeTransition: RemoveTransition<D> = { items, removedItem, layoutShift };\n return { transition: null, removeTransition, announcement: null };\n}\n\nfunction submitTransition<D>(state: TransitionState<D>): TransitionState<D> {\n const { transition, removeTransition } = state;\n\n if (removeTransition) {\n const disturbed = new Set(removeTransition.layoutShift.moves.map((move) => move.itemId));\n disturbed.delete(removeTransition.removedItem.id);\n return {\n transition: null,\n removeTransition: null,\n announcement: { type: \"item-removed\", item: removeTransition.removedItem, disturbed },\n };\n }\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const { operation, itemsLayout, draggableItem: item, acquiredItem } = transition;\n const itemBelongsToBoard = item.id === acquiredItem?.id || itemsLayout.items.some((it) => it.id === item.id);\n\n return transition.layoutShift?.conflicts.length === 0\n ? {\n transition: null,\n removeTransition: null,\n announcement: itemBelongsToBoard ? { type: \"dnd-committed\", item, operation } : null,\n }\n : {\n transition: null,\n removeTransition: null,\n announcement: itemBelongsToBoard ? { type: \"dnd-discarded\", item, operation } : null,\n };\n}\n\nfunction discardTransition<D>(state: TransitionState<D>): TransitionState<D> {\n const { transition, removeTransition } = state;\n\n if (removeTransition) {\n throw new Error(\"Can't discard remove transition.\");\n }\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const { operation, itemsLayout, draggableItem: item, acquiredItem } = transition;\n const itemBelongsToBoard = item.id === acquiredItem?.id || itemsLayout.items.some((it) => it.id === item.id);\n\n return {\n transition: null,\n removeTransition: null,\n announcement: itemBelongsToBoard ? { type: \"dnd-discarded\", item, operation } : null,\n };\n}\n\nfunction updateTransitionWithPointerEvent<D>(\n state: TransitionState<D>,\n { collisionIds, positionOffset, draggableRect }: UpdateWithPointerAction,\n): TransitionState<D> {\n const { transition } = state;\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const layout = transition.layoutShift?.next ?? transition.itemsLayout;\n const layoutItem = layout.items.find((it) => it.id === transition.draggableItem.id);\n const itemWidth = layoutItem ? layoutItem.width : getDefaultColumnSpan(transition.draggableItem, layout.columns);\n const itemHeight = layoutItem ? layoutItem.height : getDefaultRowSpan(transition.draggableItem);\n const itemSize = itemWidth * itemHeight;\n\n const isOutOfBoundaries =\n transition.operation !== \"resize\" ? collisionIds.length < itemSize : collisionIds.length === 0;\n\n if (isOutOfBoundaries) {\n return {\n transition: {\n ...transition,\n draggableRect,\n collisionIds: new Set(),\n layoutShift: null,\n insertionDirection: null,\n },\n removeTransition: null,\n announcement: null,\n };\n }\n\n const placeholdersLayout = getLayoutPlaceholders(transition);\n const collisionRect = getHoveredRect(collisionIds, placeholdersLayout.items);\n const appendPath = transition.operation === \"resize\" ? appendResizePath : appendMovePath;\n const path = appendPath(transition.path, collisionRect);\n\n const insertionDirection = transition.insertionDirection ?? getInsertionDirection(positionOffset);\n const layoutShift = getLayoutShift(transition, path, insertionDirection);\n\n return {\n transition: {\n ...transition,\n draggableRect,\n collisionIds: new Set(collisionIds),\n layoutShift,\n path,\n insertionDirection,\n },\n removeTransition: null,\n announcement: null,\n };\n}\n\nfunction updateTransitionWithKeyboardEvent<D>(\n state: TransitionState<D>,\n { direction }: UpdateWithKeyboardAction,\n { isRtl }: { isRtl: () => boolean },\n): TransitionState<D> {\n const { transition } = state;\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const updateManualItemTransition = (transition: Transition<D>, direction: Direction): TransitionState<D> => {\n const xDelta = direction === \"left\" ? -1 : direction === \"right\" ? 1 : 0;\n const yDelta = direction === \"up\" ? -1 : direction === \"down\" ? 1 : 0;\n const lastPosition = transition.path[transition.path.length - 1];\n const nextPosition = new Position({ x: lastPosition.x + xDelta, y: lastPosition.y + yDelta });\n const nextPath = [...transition.path, nextPosition];\n\n // Check resizing below min size.\n const layout = transition.layoutShift?.next ?? transition.itemsLayout;\n const layoutItem = layout.items.find((it) => it.id === transition.draggableItem.id);\n const minWidth = getMinColumnSpan(transition.draggableItem, transition.itemsLayout.columns);\n const minHeight = getMinRowSpan(transition.draggableItem);\n if (\n transition.operation === \"resize\" &&\n layoutItem &&\n (layoutItem.width + xDelta < minWidth || layoutItem.height + yDelta < minHeight)\n ) {\n return state;\n }\n\n try {\n const layoutShift = getLayoutShift(transition, nextPath);\n const nextTransition = { ...transition, layoutShift, path: nextPath };\n return {\n transition: nextTransition,\n removeTransition: null,\n announcement: createOperationAnnouncement(nextTransition, direction),\n };\n } catch (e) {\n // Can't create next layout because the next path is out of bounds.\n return state;\n }\n };\n\n switch (direction) {\n case \"left\":\n return updateManualItemTransition(transition, !isRtl() ? \"left\" : \"right\");\n case \"right\":\n return updateManualItemTransition(transition, !isRtl() ? \"right\" : \"left\");\n case \"up\":\n return updateManualItemTransition(transition, \"up\");\n case \"down\":\n return updateManualItemTransition(transition, \"down\");\n }\n}\n\nfunction acquireTransitionItem<D>(\n state: TransitionState<D>,\n { position, layoutElement, acquiredItemElement }: AcquireItemAction,\n): TransitionState<D> {\n const { transition } = state;\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const { columns } = transition.itemsLayout;\n\n const layoutRect = getLogicalBoundingClientRect(layoutElement);\n const itemRect = transition.draggableRect;\n const coordinatesX = itemRect.left - layoutRect.insetInlineStart;\n const offset = new Coordinates({ x: coordinatesX, y: itemRect.top - layoutRect.insetBlockStart });\n const insertionDirection = getInsertionDirection(offset);\n\n // Update original insertion position if the item can't fit into the layout by width.\n const width = getDefaultColumnSpan(transition.draggableItem, columns);\n position = new Position({ x: Math.min(columns - width, position.x), y: position.y });\n\n const path = [...transition.path, position];\n\n const layoutShift = getLayoutShift(transition, path, insertionDirection);\n\n // The columnOffset, columnSpan and rowSpan are of no use as of being overridden by the layout shift.\n const acquiredItem = { ...transition.draggableItem, columnOffset: 0, columnSpan: 1, rowSpan: 1 };\n\n const nextTransition: Transition<D> = {\n ...transition,\n collisionIds: new Set(),\n layoutShift,\n path,\n acquiredItem,\n acquiredItemElement,\n };\n return {\n transition: nextTransition,\n removeTransition: null,\n announcement: createOperationAnnouncement(nextTransition, null),\n };\n}\n"]}
1
+ {"version":3,"file":"transition.js","sourceRoot":"","sources":["../../../src/board/transition.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAuB,UAAU,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAI7F,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAuDhE,MAAM,UAAU,aAAa,CAAI,EAAE,KAAK,EAA4B;IAClE,OAAO,UAAU,CAAC,uBAAuB,CAAI,EAAE,KAAK,EAAE,CAAC,EAAE;QACvD,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UA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AC;IACjE,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,CAAC,GAAG,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IAClG,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEzD,qFAAqF;IACrF,MAAM,KAAK,GAAG,oBAAoB,CAAC,UAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACtE,QAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAErF,MAAM,IAAI,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE5C,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAEzE,qGAAqG;IACrG,MAAM,YAAY,GAAG,EAAE,GAAG,UAAU,CAAC,aAAa,EAAE,YAAY,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAEjG,MAAM,cAAc,GAAkB;QACpC,GAAG,UAAU;QACb,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,WAAW;QACX,IAAI;QACJ,YAAY;QACZ,mBAAmB;KACpB,CAAC;IACF,OAAO;QACL,UAAU,EAAE,cAAc;QAC1B,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,2BAA2B,CAAC,cAAc,EAAE,IAAI,CAAC;KAChE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Dispatch, ReactNode, useReducer } from \"react\";\n\nimport { getLogicalBoundingClientRect } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { InteractionType, Operation } from \"../internal/dnd-controller/controller\";\nimport { BoardItemDefinitionBase, Direction, GridLayout, ItemId, Rect } from \"../internal/interfaces\";\nimport { LayoutEngine } from \"../internal/layout-engine/engine\";\nimport { Coordinates } from \"../internal/utils/coordinates\";\nimport { getDefaultColumnSpan, getDefaultRowSpan, getMinColumnSpan, getMinRowSpan } from \"../internal/utils/layout\";\nimport { Position } from \"../internal/utils/position\";\nimport { BoardProps, RemoveTransition, Transition, TransitionAnnouncement } from \"./interfaces\";\nimport { createOperationAnnouncement } from \"./utils/announcements\";\nimport { getHoveredRect } from \"./utils/get-hovered-rect\";\nimport { getInsertionDirection, getLayoutPlaceholders, getLayoutRows, getLayoutShift } from \"./utils/layout\";\nimport { appendMovePath, appendResizePath } from \"./utils/path\";\n\nexport interface TransitionState<D> {\n transition: null | Transition<D>;\n removeTransition: null | RemoveTransition<D>;\n announcement: null | TransitionAnnouncement;\n}\n\nexport type Action<D> =\n | InitAction<D>\n | InitRemoveAction<D>\n | SubmitAction\n | DiscardAction\n | UpdateWithPointerAction\n | UpdateWithKeyboardAction\n | AcquireItemAction;\n\ninterface InitAction<D> {\n type: \"init\";\n operation: Operation;\n interactionType: InteractionType;\n itemsLayout: GridLayout;\n draggableItem: BoardItemDefinitionBase<D>;\n draggableRect: Rect;\n collisionIds: readonly ItemId[];\n}\ninterface InitRemoveAction<D> {\n type: \"init-remove\";\n items: readonly BoardProps.Item<D>[];\n removedItem: BoardItemDefinitionBase<D>;\n itemsLayout: GridLayout;\n}\ninterface SubmitAction {\n type: \"submit\";\n}\ninterface DiscardAction {\n type: \"discard\";\n}\ninterface UpdateWithPointerAction {\n type: \"update-with-pointer\";\n collisionIds: readonly ItemId[];\n positionOffset: Coordinates;\n draggableRect: Rect;\n}\ninterface UpdateWithKeyboardAction {\n type: \"update-with-keyboard\";\n direction: Direction;\n}\ninterface AcquireItemAction {\n type: \"acquire-item\";\n position: Position;\n layoutElement: HTMLElement;\n acquiredItemElement?: ReactNode;\n}\n\nexport function useTransition<D>({ isRtl }: { isRtl: () => boolean }): [TransitionState<D>, Dispatch<Action<D>>] {\n return useReducer(createTransitionReducer<D>({ isRtl }), {\n transition: null,\n removeTransition: null,\n announcement: null,\n });\n}\n\nexport function selectTransitionRows<D>(state: TransitionState<D>) {\n return state.transition ? getLayoutRows(state.transition) : 0;\n}\n\nfunction createTransitionReducer<D>({ isRtl }: { isRtl: () => boolean }) {\n return function transitionReducer(state: TransitionState<D>, action: Action<D>): TransitionState<D> {\n switch (action.type) {\n case \"init\":\n return initTransition(action);\n case \"init-remove\":\n return initRemoveTransition(action);\n case \"submit\":\n return submitTransition(state);\n case \"discard\":\n return discardTransition(state);\n case \"update-with-pointer\":\n return updateTransitionWithPointerEvent(state, action);\n case \"update-with-keyboard\":\n return updateTransitionWithKeyboardEvent(state, action, { isRtl });\n case \"acquire-item\":\n return acquireTransitionItem(state, action);\n }\n };\n}\n\nfunction initTransition<D>({\n operation,\n interactionType,\n itemsLayout,\n draggableItem,\n draggableRect,\n collisionIds,\n}: InitAction<D>): TransitionState<D> {\n const transition: Transition<D> = {\n operation,\n interactionType,\n itemsLayout,\n layoutEngine: new LayoutEngine(itemsLayout),\n insertionDirection: null,\n draggableItem,\n draggableRect,\n acquiredItem: null,\n collisionIds: new Set(),\n layoutShift: null,\n path: [],\n };\n\n const placeholdersLayout = getLayoutPlaceholders(transition);\n\n const layoutItem = itemsLayout.items.find((it) => it.id === draggableItem.id);\n\n let path: Position[] = [];\n if (interactionType === \"pointer\" || operation === \"insert\") {\n const collisionRect = getHoveredRect(collisionIds, placeholdersLayout.items);\n const appendPath = operation === \"resize\" ? appendResizePath : appendMovePath;\n path = layoutItem ? appendPath([], collisionRect) : [];\n } else if (layoutItem) {\n path =\n operation === \"resize\"\n ? [new Position({ x: layoutItem.x + layoutItem.width, y: layoutItem.y + layoutItem.height })]\n : [new Position({ x: layoutItem.x, y: layoutItem.y })];\n }\n\n return {\n transition: { ...transition, path },\n removeTransition: null,\n announcement: layoutItem ? { type: \"dnd-started\", item: draggableItem, operation } : null,\n };\n}\n\nfunction initRemoveTransition<D>({ items, removedItem, itemsLayout }: InitRemoveAction<D>): TransitionState<D> {\n const layoutShift = new LayoutEngine(itemsLayout).remove(removedItem.id);\n const removeTransition: RemoveTransition<D> = { items, removedItem, layoutShift };\n return { transition: null, removeTransition, announcement: null };\n}\n\nfunction submitTransition<D>(state: TransitionState<D>): TransitionState<D> {\n const { transition, removeTransition } = state;\n\n if (removeTransition) {\n const disturbed = new Set(removeTransition.layoutShift.moves.map((move) => move.itemId));\n disturbed.delete(removeTransition.removedItem.id);\n return {\n transition: null,\n removeTransition: null,\n announcement: { type: \"item-removed\", item: removeTransition.removedItem, disturbed },\n };\n }\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const { operation, itemsLayout, draggableItem: item, acquiredItem } = transition;\n const itemBelongsToBoard = item.id === acquiredItem?.id || itemsLayout.items.some((it) => it.id === item.id);\n\n return transition.layoutShift?.conflicts.length === 0\n ? {\n transition: null,\n removeTransition: null,\n announcement: itemBelongsToBoard ? { type: \"dnd-committed\", item, operation } : null,\n }\n : {\n transition: null,\n removeTransition: null,\n announcement: itemBelongsToBoard ? { type: \"dnd-discarded\", item, operation } : null,\n };\n}\n\nfunction discardTransition<D>(state: TransitionState<D>): TransitionState<D> {\n const { transition, removeTransition } = state;\n\n if (removeTransition) {\n throw new Error(\"Can't discard remove transition.\");\n }\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const { operation, itemsLayout, draggableItem: item, acquiredItem } = transition;\n const itemBelongsToBoard = item.id === acquiredItem?.id || itemsLayout.items.some((it) => it.id === item.id);\n\n return {\n transition: null,\n removeTransition: null,\n announcement: itemBelongsToBoard ? { type: \"dnd-discarded\", item, operation } : null,\n };\n}\n\nfunction updateTransitionWithPointerEvent<D>(\n state: TransitionState<D>,\n { collisionIds, positionOffset, draggableRect }: UpdateWithPointerAction,\n): TransitionState<D> {\n const { transition } = state;\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const layout = transition.layoutShift?.next ?? transition.itemsLayout;\n const layoutItem = layout.items.find((it) => it.id === transition.draggableItem.id);\n const itemWidth = layoutItem ? layoutItem.width : getDefaultColumnSpan(transition.draggableItem, layout.columns);\n const itemHeight = layoutItem ? layoutItem.height : getDefaultRowSpan(transition.draggableItem);\n const itemSize = itemWidth * itemHeight;\n\n const isOutOfBoundaries =\n transition.operation !== \"resize\" ? collisionIds.length < itemSize : collisionIds.length === 0;\n\n if (isOutOfBoundaries) {\n return {\n transition: {\n ...transition,\n draggableRect,\n collisionIds: new Set(),\n layoutShift: null,\n insertionDirection: null,\n },\n removeTransition: null,\n announcement: null,\n };\n }\n\n const placeholdersLayout = getLayoutPlaceholders(transition);\n const collisionRect = getHoveredRect(collisionIds, placeholdersLayout.items);\n const appendPath = transition.operation === \"resize\" ? appendResizePath : appendMovePath;\n const path = appendPath(transition.path, collisionRect);\n\n const insertionDirection = transition.insertionDirection ?? getInsertionDirection(positionOffset);\n const layoutShift = getLayoutShift(transition, path, insertionDirection);\n\n return {\n transition: {\n ...transition,\n draggableRect,\n collisionIds: new Set(collisionIds),\n layoutShift,\n path,\n insertionDirection,\n },\n removeTransition: null,\n announcement: null,\n };\n}\n\nfunction updateTransitionWithKeyboardEvent<D>(\n state: TransitionState<D>,\n { direction }: UpdateWithKeyboardAction,\n { isRtl }: { isRtl: () => boolean },\n): TransitionState<D> {\n const { transition } = state;\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const updateManualItemTransition = (transition: Transition<D>, direction: Direction): TransitionState<D> => {\n const xDelta = direction === \"left\" ? -1 : direction === \"right\" ? 1 : 0;\n const yDelta = direction === \"up\" ? -1 : direction === \"down\" ? 1 : 0;\n const lastPosition = transition.path[transition.path.length - 1];\n const nextPosition = new Position({ x: lastPosition.x + xDelta, y: lastPosition.y + yDelta });\n const nextPath = [...transition.path, nextPosition];\n\n // Check resizing below min size.\n const layout = transition.layoutShift?.next ?? transition.itemsLayout;\n const layoutItem = layout.items.find((it) => it.id === transition.draggableItem.id);\n const minWidth = getMinColumnSpan(transition.draggableItem, transition.itemsLayout.columns);\n const minHeight = getMinRowSpan(transition.draggableItem);\n if (\n transition.operation === \"resize\" &&\n layoutItem &&\n (layoutItem.width + xDelta < minWidth || layoutItem.height + yDelta < minHeight)\n ) {\n return state;\n }\n\n try {\n const layoutShift = getLayoutShift(transition, nextPath);\n const nextTransition = { ...transition, layoutShift, path: nextPath };\n return {\n transition: nextTransition,\n removeTransition: null,\n announcement: createOperationAnnouncement(nextTransition, direction),\n };\n } catch (e) {\n // Can't create next layout because the next path is out of bounds.\n return state;\n }\n };\n\n switch (direction) {\n case \"left\":\n return updateManualItemTransition(transition, !isRtl() ? \"left\" : \"right\");\n case \"right\":\n return updateManualItemTransition(transition, !isRtl() ? \"right\" : \"left\");\n case \"up\":\n return updateManualItemTransition(transition, \"up\");\n case \"down\":\n return updateManualItemTransition(transition, \"down\");\n }\n}\n\nfunction acquireTransitionItem<D>(\n state: TransitionState<D>,\n { position, layoutElement, acquiredItemElement }: AcquireItemAction,\n): TransitionState<D> {\n const { transition } = state;\n\n if (!transition) {\n throw new Error(\"Invariant violation: no transition.\");\n }\n\n const { columns } = transition.itemsLayout;\n\n const layoutRect = getLogicalBoundingClientRect(layoutElement);\n const itemRect = transition.draggableRect;\n const coordinatesX = itemRect.left - layoutRect.insetInlineStart;\n const offset = new Coordinates({ x: coordinatesX, y: itemRect.top - layoutRect.insetBlockStart });\n const insertionDirection = getInsertionDirection(offset);\n\n // Update original insertion position if the item can't fit into the layout by width.\n const width = getDefaultColumnSpan(transition.draggableItem, columns);\n position = new Position({ x: Math.min(columns - width, position.x), y: position.y });\n\n const path = [...transition.path, position];\n\n const layoutShift = getLayoutShift(transition, path, insertionDirection);\n\n // The columnOffset, columnSpan and rowSpan are of no use as of being overridden by the layout shift.\n const acquiredItem = { ...transition.draggableItem, columnOffset: 0, columnSpan: 1, rowSpan: 1 };\n\n const nextTransition: Transition<D> = {\n ...transition,\n collisionIds: new Set(),\n layoutShift,\n path,\n acquiredItem,\n acquiredItemElement,\n };\n return {\n transition: nextTransition,\n removeTransition: null,\n announcement: createOperationAnnouncement(nextTransition, null),\n };\n}\n"]}
@@ -1,6 +1,4 @@
1
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
2
  import clsx from "clsx";
5
3
  import { useVisualRefresh } from "../internal/base-component/use-visual-refresh.js";
6
4
  import styles from "./styles.css.js";
@@ -1 +1 @@
1
- {"version":3,"file":"header.js","sourceRoot":"","sources":["../../../src/board-item/header.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAA8B;IACtG,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,OAAO,CACL,eAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,CAAC,aACpE,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,YAAG,MAAM,GAAO,EACjE,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,YAAG,QAAQ,GAAO,EAChF,QAAQ,CAAC,CAAC,CAAC,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAG,QAAQ,GAAO,CAAC,CAAC,CAAC,IAAI,IACpF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from \"clsx\";\nimport { ReactNode } from \"react\";\nimport { useVisualRefresh } from \"../internal/base-component/use-visual-refresh.js\";\nimport styles from \"./styles.css.js\";\n\nexport interface WidgetContainerHeaderProps {\n handle: ReactNode;\n children?: ReactNode;\n settings?: ReactNode;\n}\n\nexport default function WidgetContainerHeader({ handle, children, settings }: WidgetContainerHeaderProps) {\n const isVisualRefresh = useVisualRefresh();\n return (\n <div className={clsx(styles.header, isVisualRefresh && styles.refresh)}>\n <div className={clsx(styles.fixed, styles.handle)}>{handle}</div>\n <div className={clsx(styles.flexible, styles[\"header-content\"])}>{children}</div>\n {settings ? <div className={clsx(styles.fixed, styles.settings)}>{settings}</div> : null}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"header.js","sourceRoot":"","sources":["../../../src/board-item/header.tsx"],"names":[],"mappings":";AAGA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAA8B;IACtG,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,OAAO,CACL,eAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,CAAC,aACpE,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,YAAG,MAAM,GAAO,EACjE,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,YAAG,QAAQ,GAAO,EAChF,QAAQ,CAAC,CAAC,CAAC,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAG,QAAQ,GAAO,CAAC,CAAC,CAAC,IAAI,IACpF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode } from \"react\";\nimport clsx from \"clsx\";\n\nimport { useVisualRefresh } from \"../internal/base-component/use-visual-refresh.js\";\n\nimport styles from \"./styles.css.js\";\n\nexport interface WidgetContainerHeaderProps {\n handle: ReactNode;\n children?: ReactNode;\n settings?: ReactNode;\n}\n\nexport default function WidgetContainerHeader({ handle, children, settings }: WidgetContainerHeaderProps) {\n const isVisualRefresh = useVisualRefresh();\n return (\n <div className={clsx(styles.header, isVisualRefresh && styles.refresh)}>\n <div className={clsx(styles.fixed, styles.handle)}>{handle}</div>\n <div className={clsx(styles.flexible, styles[\"header-content\"])}>{children}</div>\n {settings ? <div className={clsx(styles.fixed, styles.settings)}>{settings}</div> : null}\n </div>\n );\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import Container from "@cloudscape-design/components/container";
5
- import clsx from "clsx";
6
4
  import { useId } from "react";
5
+ import clsx from "clsx";
6
+ import Container from "@cloudscape-design/components/container";
7
7
  import { getDataAttributes } from "../internal/base-component/get-data-attributes";
8
8
  import DragHandle from "../internal/drag-handle";
9
9
  import { useItemContext } from "../internal/item-container";
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/board-item/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,SAAS,M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EAAE,UAAU,CAAC,QAAQ,GAC7B,EAEJ,QAAQ,EAAE,QAAQ,YAEjB,MAAM,GACe,EAE1B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB,EAC9C,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,YAEvE,QAAQ,GACC,EACX,YAAY,IAAI,CACf,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAC5B,KAAC,YAAY,IACX,cAAc,EAAE,0BAA0B,EAC1C,eAAe,EAAE,2BAA2B,EAC5C,aAAa,EAAE,YAAY,CAAC,aAAa,EACzC,SAAS,EAAE,YAAY,CAAC,SAAS,EACjC,QAAQ,EAAE,YAAY,CAAC,QAAQ,GAC/B,GACE,CACP,EAED,KAAC,gBAAgB,IAAC,EAAE,EAAE,wBAAwB,YAAG,WAAW,CAAC,mBAAmB,GAAoB,EACpG,KAAC,gBAAgB,IAAC,EAAE,EAAE,yBAAyB,YAAG,WAAW,CAAC,yBAAyB,GAAoB,EAE3G,KAAC,gBAAgB,IAAC,EAAE,EAAE,0BAA0B,YAAG,WAAW,CAAC,qBAAqB,GAAoB,EACxG,KAAC,gBAAgB,IAAC,EAAE,EAAE,2BAA2B,YAAG,WAAW,CAAC,2BAA2B,GAAoB,IAC3G,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport Container from \"@cloudscape-design/components/container\";\nimport clsx from \"clsx\";\nimport { useId } from \"react\";\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport DragHandle from \"../internal/drag-handle\";\nimport { useItemContext } from \"../internal/item-container\";\nimport ResizeHandle from \"../internal/resize-handle\";\nimport ScreenreaderOnly from \"../internal/screenreader-only\";\nimport WidgetContainerHeader from \"./header\";\nimport type { BoardItemProps } from \"./interfaces\";\nimport styles from \"./styles.css.js\";\n\nexport function InternalBoardItem({\n children,\n header,\n settings,\n disableContentPaddings,\n footer,\n i18nStrings,\n __internalRootRef,\n ...rest\n}: BoardItemProps & InternalBaseComponentProps) {\n const { dragHandle, resizeHandle, isActive } = useItemContext();\n\n const dragHandleAriaLabelledBy = useId();\n const dragHandleAriaDescribedBy = useId();\n\n const resizeHandleAriaLabelledBy = useId();\n const resizeHandleAriaDescribedBy = useId();\n\n return (\n <div ref={__internalRootRef} className={styles.root} {...getDataAttributes(rest)}>\n <Container\n fitHeight={true}\n disableHeaderPaddings={true}\n header={\n <WidgetContainerHeader\n handle={\n <DragHandle\n ref={dragHandle.ref}\n ariaLabelledBy={dragHandleAriaLabelledBy}\n ariaDescribedBy={dragHandleAriaDescribedBy}\n onPointerDown={dragHandle.onPointerDown}\n onKeyDown={dragHandle.onKeyDown}\n isActive={dragHandle.isActive}\n />\n }\n settings={settings}\n >\n {header}\n </WidgetContainerHeader>\n }\n footer={footer}\n disableContentPaddings={disableContentPaddings}\n className={clsx(styles[\"container-override\"], isActive && styles.active)}\n >\n {children}\n </Container>\n {resizeHandle && (\n <div className={styles.resizer}>\n <ResizeHandle\n ariaLabelledBy={resizeHandleAriaLabelledBy}\n ariaDescribedBy={resizeHandleAriaDescribedBy}\n onPointerDown={resizeHandle.onPointerDown}\n onKeyDown={resizeHandle.onKeyDown}\n isActive={resizeHandle.isActive}\n />\n </div>\n )}\n\n <ScreenreaderOnly id={dragHandleAriaLabelledBy}>{i18nStrings.dragHandleAriaLabel}</ScreenreaderOnly>\n <ScreenreaderOnly id={dragHandleAriaDescribedBy}>{i18nStrings.dragHandleAriaDescription}</ScreenreaderOnly>\n\n <ScreenreaderOnly id={resizeHandleAriaLabelledBy}>{i18nStrings.resizeHandleAriaLabel}</ScreenreaderOnly>\n <ScreenreaderOnly id={resizeHandleAriaDescribedBy}>{i18nStrings.resizeHandleAriaDescription}</ScreenreaderOnly>\n </div>\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cAAc,EAAE,wBAAwB,EACxC,eAAe,EAAE,yBAAyB,EAC1C,aAAa,EAAE,UAAU,CAAC,aAAa,EACvC,SAAS,EAAE,UAAU,CAAC,SAAS,EAC/B,QAAQ,EAAE,UAAU,CAAC,QAAQ,GAC7B,EAEJ,QAAQ,EAAE,QAAQ,YAEjB,MAAM,GACe,EAE1B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB,EAC9C,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,YAEvE,QAAQ,GACC,EACX,YAAY,IAAI,CACf,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAC5B,KAAC,YAAY,IACX,cAAc,EAAE,0BAA0B,EAC1C,eAAe,EAAE,2BAA2B,EAC5C,aAAa,EAAE,YAAY,CAAC,aAAa,EACzC,SAAS,EAAE,YAAY,CAAC,SAAS,EACjC,QAAQ,EAAE,YAAY,CAAC,QAAQ,GAC/B,GACE,CACP,EAED,KAAC,gBAAgB,IAAC,EAAE,EAAE,wBAAwB,YAAG,WAAW,CAAC,mBAAmB,GAAoB,EACpG,KAAC,gBAAgB,IAAC,EAAE,EAAE,yBAAyB,YAAG,WAAW,CAAC,yBAAyB,GAAoB,EAE3G,KAAC,gBAAgB,IAAC,EAAE,EAAE,0BAA0B,YAAG,WAAW,CAAC,qBAAqB,GAAoB,EACxG,KAAC,gBAAgB,IAAC,EAAE,EAAE,2BAA2B,YAAG,WAAW,CAAC,2BAA2B,GAAoB,IAC3G,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useId } from \"react\";\nimport clsx from \"clsx\";\n\nimport Container from \"@cloudscape-design/components/container\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport DragHandle from \"../internal/drag-handle\";\nimport { useItemContext } from \"../internal/item-container\";\nimport ResizeHandle from \"../internal/resize-handle\";\nimport ScreenreaderOnly from \"../internal/screenreader-only\";\nimport WidgetContainerHeader from \"./header\";\nimport type { BoardItemProps } from \"./interfaces\";\n\nimport styles from \"./styles.css.js\";\n\nexport function InternalBoardItem({\n children,\n header,\n settings,\n disableContentPaddings,\n footer,\n i18nStrings,\n __internalRootRef,\n ...rest\n}: BoardItemProps & InternalBaseComponentProps) {\n const { dragHandle, resizeHandle, isActive } = useItemContext();\n\n const dragHandleAriaLabelledBy = useId();\n const dragHandleAriaDescribedBy = useId();\n\n const resizeHandleAriaLabelledBy = useId();\n const resizeHandleAriaDescribedBy = useId();\n\n return (\n <div ref={__internalRootRef} className={styles.root} {...getDataAttributes(rest)}>\n <Container\n fitHeight={true}\n disableHeaderPaddings={true}\n header={\n <WidgetContainerHeader\n handle={\n <DragHandle\n ref={dragHandle.ref}\n ariaLabelledBy={dragHandleAriaLabelledBy}\n ariaDescribedBy={dragHandleAriaDescribedBy}\n onPointerDown={dragHandle.onPointerDown}\n onKeyDown={dragHandle.onKeyDown}\n isActive={dragHandle.isActive}\n />\n }\n settings={settings}\n >\n {header}\n </WidgetContainerHeader>\n }\n footer={footer}\n disableContentPaddings={disableContentPaddings}\n className={clsx(styles[\"container-override\"], isActive && styles.active)}\n >\n {children}\n </Container>\n {resizeHandle && (\n <div className={styles.resizer}>\n <ResizeHandle\n ariaLabelledBy={resizeHandleAriaLabelledBy}\n ariaDescribedBy={resizeHandleAriaDescribedBy}\n onPointerDown={resizeHandle.onPointerDown}\n onKeyDown={resizeHandle.onKeyDown}\n isActive={resizeHandle.isActive}\n />\n </div>\n )}\n\n <ScreenreaderOnly id={dragHandleAriaLabelledBy}>{i18nStrings.dragHandleAriaLabel}</ScreenreaderOnly>\n <ScreenreaderOnly id={dragHandleAriaDescribedBy}>{i18nStrings.dragHandleAriaDescription}</ScreenreaderOnly>\n\n <ScreenreaderOnly id={resizeHandleAriaLabelledBy}>{i18nStrings.resizeHandleAriaLabel}</ScreenreaderOnly>\n <ScreenreaderOnly id={resizeHandleAriaDescribedBy}>{i18nStrings.resizeHandleAriaDescription}</ScreenreaderOnly>\n </div>\n );\n}\n"]}
@@ -70,7 +70,7 @@ module.exports = {
70
70
  ]
71
71
  },
72
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"
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"
74
74
  },
75
75
  {
76
76
  "name": "items",
@@ -39,7 +39,7 @@ module.exports = {
39
39
  ]
40
40
  },
41
41
  "optional": false,
42
- "description": "An object containing all the necessary localized strings required by the component.\nLive announcements:\n* `liveAnnouncementDndStarted` (string) - live announcement string to indicate start of DnD.\n* `liveAnnouncementDndDiscarded` (string) - live announcement string to indicate discard of DnD.\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.\n"
42
+ "description": "An object containing all the necessary localized strings required by the component.\nLive announcements:\n* `liveAnnouncementDndStarted` (string) - live announcement string to indicate start of DnD.\n* `liveAnnouncementDndDiscarded` (string) - live announcement string to indicate discard of DnD.\n"
43
43
  },
44
44
  {
45
45
  "name": "items",
@@ -1,5 +1,5 @@
1
- import { ComponentConfiguration } from "@cloudscape-design/component-toolkit/internal";
2
1
  import { MutableRefObject } from "react";
2
+ import { ComponentConfiguration } from "@cloudscape-design/component-toolkit/internal";
3
3
  export interface InternalBaseComponentProps {
4
4
  __internalRootRef?: MutableRefObject<any> | null;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-base-component.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-base-component.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,iBAAiB,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAMnD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAU,aAAqB,EAAE,MAA+B;IACtG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,oBAAoB,CAAI,aAAa,EAAE,eAAe,CAAC,CAAC;IAC3E,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComponentConfiguration,\n initAwsUiVersions,\n useComponentMetadata,\n} from \"@cloudscape-design/component-toolkit/internal\";\nimport { MutableRefObject } from \"react\";\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from \"../environment\";\nimport { useTelemetry } from \"./use-telemetry\";\n\ninitAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);\n\nexport interface InternalBaseComponentProps {\n __internalRootRef?: MutableRefObject<any> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(componentName: string, config?: ComponentConfiguration) {\n useTelemetry(componentName, config);\n const elementRef = useComponentMetadata<T>(componentName, PACKAGE_VERSION);\n return { __internalRootRef: elementRef };\n}\n"]}
1
+ {"version":3,"file":"use-base-component.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-base-component.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,iBAAiB,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAMnD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAU,aAAqB,EAAE,MAA+B;IACtG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,oBAAoB,CAAI,aAAa,EAAE,eAAe,CAAC,CAAC;IAC3E,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MutableRefObject } from \"react\";\n\nimport {\n ComponentConfiguration,\n initAwsUiVersions,\n useComponentMetadata,\n} from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from \"../environment\";\nimport { useTelemetry } from \"./use-telemetry\";\n\ninitAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);\n\nexport interface InternalBaseComponentProps {\n __internalRootRef?: MutableRefObject<any> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(componentName: string, config?: ComponentConfiguration) {\n useTelemetry(componentName, config);\n const elementRef = useComponentMetadata<T>(componentName, PACKAGE_VERSION);\n return { __internalRootRef: elementRef };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-telemetry.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-telemetry.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAA0B,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAC5G,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,UAAU,YAAY,CAAC,aAAqB,EAAE,MAA+B;IACjF,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAChD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;AACxH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ComponentConfiguration, useComponentMetrics } from \"@cloudscape-design/component-toolkit/internal\";\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from \"../environment\";\nimport { useVisualRefresh } from \"./use-visual-refresh\";\n\nexport function useTelemetry(componentName: string, config?: ComponentConfiguration) {\n const theme = useVisualRefresh() ? \"vr\" : THEME;\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n}\n"]}
1
+ {"version":3,"file":"use-telemetry.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-telemetry.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAA0B,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAE5G,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,UAAU,YAAY,CAAC,aAAqB,EAAE,MAA+B;IACjF,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAChD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;AACxH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ComponentConfiguration, useComponentMetrics } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from \"../environment\";\nimport { useVisualRefresh } from \"./use-visual-refresh\";\n\nexport function useTelemetry(componentName: string, config?: ComponentConfiguration) {\n const theme = useVisualRefresh() ? \"vr\" : THEME;\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-visual-refresh.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-visual-refresh.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useRuntimeVisualRefresh } from \"@cloudscape-design/component-toolkit/internal\";\nimport { ALWAYS_VISUAL_REFRESH } from \"../environment\";\n\nexport const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useRuntimeVisualRefresh;\n"]}
1
+ {"version":3,"file":"use-visual-refresh.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-visual-refresh.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAExF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useRuntimeVisualRefresh } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { ALWAYS_VISUAL_REFRESH } from \"../environment\";\n\nexport const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useRuntimeVisualRefresh;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../src/internal/dnd-controller/__mocks__/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,cAAe,SAAQ,YAA+B;IACnD,KAAK,CAAC,KAAsB;QACjC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,KAAsB;QAClC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,MAAM;QACX,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;IAEM,OAAO,CAAC,KAAkB;QAC/B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;AAEnD,MAAM,UAAU,mBAAmB,CAAoC,KAAQ,EAAE,OAA6B;IAC5G,SAAS,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;IACd,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;IACzB,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;IACzB,iBAAiB,EAAE,EAAE,CAAC,EAAE,EAAE;IAC1B,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;CAChB,CAAC;AAET,MAAM,UAAU,YAAY;IAC1B,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,KAAI,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect } from \"react\";\nimport { vi } from \"vitest\";\nimport { AcquireData, DragAndDropData, DragAndDropEvents } from \"../controller\";\nimport { EventEmitter } from \"../event-emitter\";\n\nclass MockController extends EventEmitter<DragAndDropEvents> {\n public start(event: DragAndDropData) {\n this.emit(\"start\", event);\n }\n\n public update(event: DragAndDropData) {\n this.emit(\"update\", event);\n }\n\n public submit() {\n this.emit(\"submit\");\n }\n\n public discard() {\n this.emit(\"discard\");\n }\n\n public acquire(event: AcquireData) {\n this.emit(\"acquire\", event);\n }\n}\n\nexport const mockController = new MockController();\n\nexport function useDragSubscription<K extends keyof DragAndDropEvents>(event: K, handler: DragAndDropEvents[K]) {\n useEffect(() => mockController.on(event, handler), [event, handler]);\n}\n\nexport const mockDraggable = {\n start: vi.fn(),\n updateTransition: vi.fn(),\n submitTransition: vi.fn(),\n discardTransition: vi.fn(),\n getDroppables: vi.fn(),\n} as any;\n\nexport function useDraggable() {\n return mockDraggable;\n}\n\nexport function useDroppable() {}\n"]}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../src/internal/dnd-controller/__mocks__/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,cAAe,SAAQ,YAA+B;IACnD,KAAK,CAAC,KAAsB;QACjC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,KAAsB;QAClC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,MAAM;QACX,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;IAEM,OAAO,CAAC,KAAkB;QAC/B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;AAEnD,MAAM,UAAU,mBAAmB,CAAoC,KAAQ,EAAE,OAA6B;IAC5G,SAAS,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;IACd,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;IACzB,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;IACzB,iBAAiB,EAAE,EAAE,CAAC,EAAE,EAAE;IAC1B,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;CAChB,CAAC;AAET,MAAM,UAAU,YAAY;IAC1B,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,KAAI,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect } from \"react\";\nimport { vi } from \"vitest\";\n\nimport { AcquireData, DragAndDropData, DragAndDropEvents } from \"../controller\";\nimport { EventEmitter } from \"../event-emitter\";\n\nclass MockController extends EventEmitter<DragAndDropEvents> {\n public start(event: DragAndDropData) {\n this.emit(\"start\", event);\n }\n\n public update(event: DragAndDropData) {\n this.emit(\"update\", event);\n }\n\n public submit() {\n this.emit(\"submit\");\n }\n\n public discard() {\n this.emit(\"discard\");\n }\n\n public acquire(event: AcquireData) {\n this.emit(\"acquire\", event);\n }\n}\n\nexport const mockController = new MockController();\n\nexport function useDragSubscription<K extends keyof DragAndDropEvents>(event: K, handler: DragAndDropEvents[K]) {\n useEffect(() => mockController.on(event, handler), [event, handler]);\n}\n\nexport const mockDraggable = {\n start: vi.fn(),\n updateTransition: vi.fn(),\n submitTransition: vi.fn(),\n discardTransition: vi.fn(),\n getDroppables: vi.fn(),\n} as any;\n\nexport function useDraggable() {\n return mockDraggable;\n}\n\nexport function useDroppable() {}\n"]}
@@ -1,7 +1,7 @@
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";
4
3
  import { useEffect } from "react";
4
+ import { useStableCallback } from "@cloudscape-design/component-toolkit/internal";
5
5
  import { Coordinates } from "../utils/coordinates";
6
6
  import { EventEmitter } from "./event-emitter";
7
7
  import { getHoveredDroppables } from "./get-hovered-droppables";