@cloudscape-design/board-components 3.0.169 → 3.0.170

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.
@@ -199,7 +199,7 @@ function updateTransitionWithKeyboardEvent(state, { direction }, { isRtl }) {
199
199
  announcement: createOperationAnnouncement(nextTransition, direction),
200
200
  };
201
201
  }
202
- catch {
202
+ catch (e) {
203
203
  // Can't create next layout because the next path is out of bounds.
204
204
  return state;
205
205
  }
@@ -1 +1 @@
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,CA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AAc;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 return { transition: null, removeTransition: null, announcement: null };\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 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(\"Invariant violation: can't discard remove transition.\");\n }\n\n if (!transition) {\n return { transition: null, removeTransition: null, announcement: null };\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 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 return { transition: null, removeTransition: null, announcement: null };\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 return { transition: null, removeTransition: null, announcement: null };\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 {\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 return { transition: null, removeTransition: null, announcement: null };\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;IACl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jG,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 return { transition: null, removeTransition: null, announcement: null };\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 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(\"Invariant violation: can't discard remove transition.\");\n }\n\n if (!transition) {\n return { transition: null, removeTransition: null, announcement: null };\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 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 return { transition: null, removeTransition: null, announcement: null };\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 return { transition: null, removeTransition: null, announcement: null };\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 return { transition: null, removeTransition: null, announcement: null };\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,5 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "board-components";
2
- export var PACKAGE_VERSION = "3.0.0 (80bebb14)";
2
+ export var PACKAGE_VERSION = "3.0.0 (6b481f8b)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
  export var SYSTEM = "core";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "board-components",
3
- "PACKAGE_VERSION": "3.0.0 (80bebb14)",
3
+ "PACKAGE_VERSION": "3.0.0 (6b481f8b)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true,
6
6
  "SYSTEM": "core"
@@ -325,7 +325,6 @@ export const colorBackgroundInputDefault: string;
325
325
  export const colorBackgroundInputDisabled: string;
326
326
  export const colorBackgroundItemSelected: string;
327
327
  export const colorBackgroundLayoutMain: string;
328
- export const colorBackgroundDrawer: string;
329
328
  export const colorBackgroundLayoutMobilePanel: string;
330
329
  export const colorBackgroundLayoutPanelContent: string;
331
330
  export const colorBackgroundLayoutPanelHover: string;
@@ -325,7 +325,6 @@ export var colorBackgroundInputDefault = "var(--color-background-input-default-i
325
325
  export var colorBackgroundInputDisabled = "var(--color-background-input-disabled-dihaja, #ebebf0)";
326
326
  export var colorBackgroundItemSelected = "var(--color-background-item-selected-9gppru, #f0fbff)";
327
327
  export var colorBackgroundLayoutMain = "var(--color-background-layout-main-5ilwcb, #ffffff)";
328
- export var colorBackgroundDrawer = "var(--color-background-drawer-5hs0eh, #ffffff)";
329
328
  export var colorBackgroundLayoutMobilePanel = "var(--color-background-layout-mobile-panel-ed0ava, #0f141a)";
330
329
  export var colorBackgroundLayoutPanelContent = "var(--color-background-layout-panel-content-xto15e, #ffffff)";
331
330
  export var colorBackgroundLayoutPanelHover = "var(--color-background-layout-panel-hover-tguulw, #ebebf0)";
@@ -1347,10 +1347,6 @@ module.exports.preset = {
1347
1347
  "light": "{colorWhite}",
1348
1348
  "dark": "{colorNeutral850}"
1349
1349
  },
1350
- "colorBackgroundDrawer": {
1351
- "light": "{colorBackgroundLayoutPanelContent}",
1352
- "dark": "{colorBackgroundLayoutPanelContent}"
1353
- },
1354
1350
  "colorBackgroundLayoutMobilePanel": {
1355
1351
  "light": "{colorNeutral950}",
1356
1352
  "dark": "{colorNeutral950}"
@@ -3925,10 +3921,6 @@ module.exports.preset = {
3925
3921
  "light": "{colorNeutral850}",
3926
3922
  "dark": "{colorNeutral850}"
3927
3923
  },
3928
- "colorBackgroundDrawer": {
3929
- "light": "{colorBackgroundLayoutPanelContent}",
3930
- "dark": "{colorBackgroundLayoutPanelContent}"
3931
- },
3932
3924
  "colorBackgroundLayoutMobilePanel": {
3933
3925
  "light": "{colorNeutral950}",
3934
3926
  "dark": "{colorNeutral950}"
@@ -5374,10 +5366,6 @@ module.exports.preset = {
5374
5366
  "light": "{colorNeutral950}",
5375
5367
  "dark": "{colorNeutral950}"
5376
5368
  },
5377
- "colorBackgroundDrawer": {
5378
- "light": "{colorBackgroundLayoutPanelContent}",
5379
- "dark": "{colorBackgroundLayoutPanelContent}"
5380
- },
5381
5369
  "colorBackgroundLayoutMobilePanel": {
5382
5370
  "light": "{colorNeutral950}",
5383
5371
  "dark": "{colorNeutral950}"
@@ -6751,10 +6739,6 @@ module.exports.preset = {
6751
6739
  "light": "{colorWhite}",
6752
6740
  "dark": "{colorNeutral850}"
6753
6741
  },
6754
- "colorBackgroundDrawer": {
6755
- "light": "{colorBackgroundLayoutPanelContent}",
6756
- "dark": "{colorBackgroundLayoutPanelContent}"
6757
- },
6758
6742
  "colorBackgroundLayoutMobilePanel": {
6759
6743
  "light": "{colorNeutral950}",
6760
6744
  "dark": "{colorNeutral950}"
@@ -8013,10 +7997,6 @@ module.exports.preset = {
8013
7997
  "light": "{colorWhite}",
8014
7998
  "dark": "{colorNeutral850}"
8015
7999
  },
8016
- "colorBackgroundDrawer": {
8017
- "light": "{colorBackgroundLayoutPanelContent}",
8018
- "dark": "{colorBackgroundLayoutPanelContent}"
8019
- },
8020
8000
  "colorBackgroundLayoutMobilePanel": {
8021
8001
  "light": "{colorNeutral950}",
8022
8002
  "dark": "{colorNeutral950}"
@@ -9275,10 +9255,6 @@ module.exports.preset = {
9275
9255
  "light": "{colorWhite}",
9276
9256
  "dark": "{colorNeutral850}"
9277
9257
  },
9278
- "colorBackgroundDrawer": {
9279
- "light": "{colorBackgroundLayoutPanelContent}",
9280
- "dark": "{colorBackgroundLayoutPanelContent}"
9281
- },
9282
9258
  "colorBackgroundLayoutMobilePanel": {
9283
9259
  "light": "{colorNeutral950}",
9284
9260
  "dark": "{colorNeutral950}"
@@ -10539,10 +10515,6 @@ module.exports.preset = {
10539
10515
  "light": "{colorNeutral850}",
10540
10516
  "dark": "{colorNeutral850}"
10541
10517
  },
10542
- "colorBackgroundDrawer": {
10543
- "light": "{colorBackgroundLayoutPanelContent}",
10544
- "dark": "{colorBackgroundLayoutPanelContent}"
10545
- },
10546
10518
  "colorBackgroundLayoutMobilePanel": {
10547
10519
  "light": "{colorNeutral950}",
10548
10520
  "dark": "{colorNeutral950}"
@@ -11912,7 +11884,6 @@ module.exports.preset = {
11912
11884
  "colorBackgroundInputDisabled": "color",
11913
11885
  "colorBackgroundItemSelected": "color",
11914
11886
  "colorBackgroundLayoutMain": "color",
11915
- "colorBackgroundDrawer": "color",
11916
11887
  "colorBackgroundLayoutMobilePanel": "color",
11917
11888
  "colorBackgroundLayoutPanelContent": "color",
11918
11889
  "colorBackgroundLayoutPanelHover": "color",
@@ -13693,7 +13664,6 @@ module.exports.preset = {
13693
13664
  "colorBackgroundInputDisabled": "color-background-input-disabled",
13694
13665
  "colorBackgroundItemSelected": "color-background-item-selected",
13695
13666
  "colorBackgroundLayoutMain": "color-background-layout-main",
13696
- "colorBackgroundDrawer": "color-background-drawer",
13697
13667
  "colorBackgroundLayoutMobilePanel": "color-background-layout-mobile-panel",
13698
13668
  "colorBackgroundLayoutPanelContent": "color-background-layout-panel-content",
13699
13669
  "colorBackgroundLayoutPanelHover": "color-background-layout-panel-hover",
@@ -14584,7 +14554,6 @@ module.exports.preset = {
14584
14554
  "colorBackgroundInputDisabled": "--color-background-input-disabled-dihaja",
14585
14555
  "colorBackgroundItemSelected": "--color-background-item-selected-9gppru",
14586
14556
  "colorBackgroundLayoutMain": "--color-background-layout-main-5ilwcb",
14587
- "colorBackgroundDrawer": "--color-background-drawer-5hs0eh",
14588
14557
  "colorBackgroundLayoutMobilePanel": "--color-background-layout-mobile-panel-ed0ava",
14589
14558
  "colorBackgroundLayoutPanelContent": "--color-background-layout-panel-content-xto15e",
14590
14559
  "colorBackgroundLayoutPanelHover": "--color-background-layout-panel-hover-tguulw",
@@ -1347,10 +1347,6 @@ export var preset = {
1347
1347
  "light": "{colorWhite}",
1348
1348
  "dark": "{colorNeutral850}"
1349
1349
  },
1350
- "colorBackgroundDrawer": {
1351
- "light": "{colorBackgroundLayoutPanelContent}",
1352
- "dark": "{colorBackgroundLayoutPanelContent}"
1353
- },
1354
1350
  "colorBackgroundLayoutMobilePanel": {
1355
1351
  "light": "{colorNeutral950}",
1356
1352
  "dark": "{colorNeutral950}"
@@ -3925,10 +3921,6 @@ export var preset = {
3925
3921
  "light": "{colorNeutral850}",
3926
3922
  "dark": "{colorNeutral850}"
3927
3923
  },
3928
- "colorBackgroundDrawer": {
3929
- "light": "{colorBackgroundLayoutPanelContent}",
3930
- "dark": "{colorBackgroundLayoutPanelContent}"
3931
- },
3932
3924
  "colorBackgroundLayoutMobilePanel": {
3933
3925
  "light": "{colorNeutral950}",
3934
3926
  "dark": "{colorNeutral950}"
@@ -5374,10 +5366,6 @@ export var preset = {
5374
5366
  "light": "{colorNeutral950}",
5375
5367
  "dark": "{colorNeutral950}"
5376
5368
  },
5377
- "colorBackgroundDrawer": {
5378
- "light": "{colorBackgroundLayoutPanelContent}",
5379
- "dark": "{colorBackgroundLayoutPanelContent}"
5380
- },
5381
5369
  "colorBackgroundLayoutMobilePanel": {
5382
5370
  "light": "{colorNeutral950}",
5383
5371
  "dark": "{colorNeutral950}"
@@ -6751,10 +6739,6 @@ export var preset = {
6751
6739
  "light": "{colorWhite}",
6752
6740
  "dark": "{colorNeutral850}"
6753
6741
  },
6754
- "colorBackgroundDrawer": {
6755
- "light": "{colorBackgroundLayoutPanelContent}",
6756
- "dark": "{colorBackgroundLayoutPanelContent}"
6757
- },
6758
6742
  "colorBackgroundLayoutMobilePanel": {
6759
6743
  "light": "{colorNeutral950}",
6760
6744
  "dark": "{colorNeutral950}"
@@ -8013,10 +7997,6 @@ export var preset = {
8013
7997
  "light": "{colorWhite}",
8014
7998
  "dark": "{colorNeutral850}"
8015
7999
  },
8016
- "colorBackgroundDrawer": {
8017
- "light": "{colorBackgroundLayoutPanelContent}",
8018
- "dark": "{colorBackgroundLayoutPanelContent}"
8019
- },
8020
8000
  "colorBackgroundLayoutMobilePanel": {
8021
8001
  "light": "{colorNeutral950}",
8022
8002
  "dark": "{colorNeutral950}"
@@ -9275,10 +9255,6 @@ export var preset = {
9275
9255
  "light": "{colorWhite}",
9276
9256
  "dark": "{colorNeutral850}"
9277
9257
  },
9278
- "colorBackgroundDrawer": {
9279
- "light": "{colorBackgroundLayoutPanelContent}",
9280
- "dark": "{colorBackgroundLayoutPanelContent}"
9281
- },
9282
9258
  "colorBackgroundLayoutMobilePanel": {
9283
9259
  "light": "{colorNeutral950}",
9284
9260
  "dark": "{colorNeutral950}"
@@ -10539,10 +10515,6 @@ export var preset = {
10539
10515
  "light": "{colorNeutral850}",
10540
10516
  "dark": "{colorNeutral850}"
10541
10517
  },
10542
- "colorBackgroundDrawer": {
10543
- "light": "{colorBackgroundLayoutPanelContent}",
10544
- "dark": "{colorBackgroundLayoutPanelContent}"
10545
- },
10546
10518
  "colorBackgroundLayoutMobilePanel": {
10547
10519
  "light": "{colorNeutral950}",
10548
10520
  "dark": "{colorNeutral950}"
@@ -11912,7 +11884,6 @@ export var preset = {
11912
11884
  "colorBackgroundInputDisabled": "color",
11913
11885
  "colorBackgroundItemSelected": "color",
11914
11886
  "colorBackgroundLayoutMain": "color",
11915
- "colorBackgroundDrawer": "color",
11916
11887
  "colorBackgroundLayoutMobilePanel": "color",
11917
11888
  "colorBackgroundLayoutPanelContent": "color",
11918
11889
  "colorBackgroundLayoutPanelHover": "color",
@@ -13693,7 +13664,6 @@ export var preset = {
13693
13664
  "colorBackgroundInputDisabled": "color-background-input-disabled",
13694
13665
  "colorBackgroundItemSelected": "color-background-item-selected",
13695
13666
  "colorBackgroundLayoutMain": "color-background-layout-main",
13696
- "colorBackgroundDrawer": "color-background-drawer",
13697
13667
  "colorBackgroundLayoutMobilePanel": "color-background-layout-mobile-panel",
13698
13668
  "colorBackgroundLayoutPanelContent": "color-background-layout-panel-content",
13699
13669
  "colorBackgroundLayoutPanelHover": "color-background-layout-panel-hover",
@@ -14584,7 +14554,6 @@ export var preset = {
14584
14554
  "colorBackgroundInputDisabled": "--color-background-input-disabled-dihaja",
14585
14555
  "colorBackgroundItemSelected": "--color-background-item-selected-9gppru",
14586
14556
  "colorBackgroundLayoutMain": "--color-background-layout-main-5ilwcb",
14587
- "colorBackgroundDrawer": "--color-background-drawer-5hs0eh",
14588
14557
  "colorBackgroundLayoutMobilePanel": "--color-background-layout-mobile-panel-ed0ava",
14589
14558
  "colorBackgroundLayoutPanelContent": "--color-background-layout-panel-content-xto15e",
14590
14559
  "colorBackgroundLayoutPanelHover": "--color-background-layout-panel-hover-tguulw",
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "80bebb14d5cab553cb091f16eb0f31b84f992cb6"
2
+ "commit": "6b481f8b41edf9d3b004cf27c19c57e3aeb861d0"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/board-components",
3
- "version": "3.0.169",
3
+ "version": "3.0.170",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudscape-design/board-components.git"
@@ -34,34 +34,31 @@
34
34
  "@cloudscape-design/global-styles": "^1.0.1",
35
35
  "@cloudscape-design/test-utils-converter": "^1.0.0",
36
36
  "@cloudscape-design/theming-build": "^1",
37
- "@eslint/compat": "^1.4.1",
38
- "@eslint/js": "^9.39.4",
39
37
  "@juggle/resize-observer": "^3.4.0",
40
38
  "@testing-library/jest-dom": "^5.16.5",
41
39
  "@testing-library/react": "^13.4.0",
42
- "@tony.ganchev/eslint-plugin-header": "^3.4.3",
40
+ "@tony.ganchev/eslint-plugin-header": "^3.3.1",
43
41
  "@types/jest-image-snapshot": "^6.1.0",
44
42
  "@types/lodash": "^4.14.191",
45
43
  "@types/node": "^18.19.4",
46
44
  "@types/react": "^18.0.26",
47
45
  "@types/react-dom": "^18.0.10",
48
- "@typescript-eslint/eslint-plugin": "^8.58.1",
49
- "@typescript-eslint/parser": "^8.58.1",
46
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
47
+ "@typescript-eslint/parser": "^5.48.0",
50
48
  "@vitejs/plugin-react": "^4.7.0",
51
49
  "@vitest/coverage-v8": "^3.2.4",
52
50
  "chokidar-cli": "^3.0.0",
53
51
  "deep-freeze-es6": "^1.4.1",
54
- "eslint": "^9.39.4",
52
+ "eslint": "^8.57.0",
55
53
  "eslint-config-prettier": "^9.1.0",
56
54
  "eslint-plugin-import": "^2.26.0",
57
- "eslint-plugin-no-unsanitized": "^4.1.5",
58
- "eslint-plugin-prettier": "^5.5.5",
59
- "eslint-plugin-react": "^7.37.5",
60
- "eslint-plugin-react-hooks": "^5.2.0",
55
+ "eslint-plugin-no-unsanitized": "^4.0.2",
56
+ "eslint-plugin-prettier": "^5.1.3",
57
+ "eslint-plugin-react": "^7.31.11",
58
+ "eslint-plugin-react-hooks": "^4.6.0",
61
59
  "eslint-plugin-simple-import-sort": "^12.1.1",
62
- "eslint-plugin-unicorn": "^60.0.0",
60
+ "eslint-plugin-unicorn": "^45.0.2",
63
61
  "execa": "^6.1.0",
64
- "globals": "^16.5.0",
65
62
  "globby": "^13.1.3",
66
63
  "husky": "^8.0.3",
67
64
  "jest-image-snapshot": "^6.1.0",
@@ -79,7 +76,6 @@
79
76
  "stylelint-config-recommended-scss": "^14.1.0",
80
77
  "stylelint-prettier": "^5.0.2",
81
78
  "typescript": "^4.9.4",
82
- "typescript-eslint": "^8.58.1",
83
79
  "vite": "^6.4.1",
84
80
  "vitest": "^3.2.4"
85
81
  },