@cloudscape-design/board-components 3.0.123 → 3.0.125

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.
@@ -262,14 +262,19 @@ function ItemContainerComponent({ item, placed, acquired, inTransition, transfor
262
262
  if (inTransition) {
263
263
  itemTransitionClassNames.push(styles.inTransition);
264
264
  }
265
- if (transition && transition.interactionType === "pointer") {
266
- // Adjust the dragged/resized item to the pointer's location.
267
- itemTransitionClassNames.push(transition.operation === "resize" ? styles.resized : styles.dragged);
268
- itemTransitionStyle.insetInlineStart = (_a = transition.positionTransform) === null || _a === void 0 ? void 0 : _a.x;
269
- itemTransitionStyle.insetBlockStart = (_b = transition.positionTransform) === null || _b === void 0 ? void 0 : _b.y;
270
- itemTransitionStyle.inlineSize = (_c = transition.sizeTransform) === null || _c === void 0 ? void 0 : _c.width;
271
- itemTransitionStyle.blockSize = (_d = transition.sizeTransform) === null || _d === void 0 ? void 0 : _d.height;
272
- itemTransitionStyle.pointerEvents = "none";
265
+ if (transition) {
266
+ if (transition.interactionType === "pointer") {
267
+ // Adjust the dragged/resized item to the pointer's location.
268
+ itemTransitionClassNames.push(transition.operation === "resize" ? styles.resized : styles.dragged);
269
+ itemTransitionStyle.insetInlineStart = (_a = transition.positionTransform) === null || _a === void 0 ? void 0 : _a.x;
270
+ itemTransitionStyle.insetBlockStart = (_b = transition.positionTransform) === null || _b === void 0 ? void 0 : _b.y;
271
+ itemTransitionStyle.inlineSize = (_c = transition.sizeTransform) === null || _c === void 0 ? void 0 : _c.width;
272
+ itemTransitionStyle.blockSize = (_d = transition.sizeTransform) === null || _d === void 0 ? void 0 : _d.height;
273
+ itemTransitionStyle.pointerEvents = "none";
274
+ }
275
+ if (transition.interactionType === "keyboard") {
276
+ itemTransitionClassNames.push(styles.keyboardDragged);
277
+ }
273
278
  }
274
279
  if (isHidden) {
275
280
  itemTransitionClassNames.push(styles.hidden);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","s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AAE,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,EAAE,QAAQ,CAAC;wBACtD,SAAS,EAAE,CAAC,KAAoB,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC;wBACrE,WAAW,EAAE,0BAA0B,CAAC;4BACtC,cAAc,EAAE,QAAQ;4BACxB,iBAAiB,EAAE,UAAU;4BAC7B,oBAAoB,EAAE,qBAAqB,CAAC,WAAW,CAAC,KAAK;4BAC7D,eAAe,EAAE,QAAQ;yBAC1B,CAAC;wBACF,gBAAgB,EAAE,yBAAyB;qBAC5C;oBACH,CAAC,CAAC,IAAI;aACT,YAEA,WAAW,CAAC,OAAO,GACC,GACnB,CACP,CAAC;IAEF,OAAO,eAAe,CAAC,CAAC,CAAC,wBAAM,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport {\n createContext,\n CSSProperties,\n forwardRef,\n KeyboardEvent,\n PointerEvent as ReactPointerEvent,\n ReactNode,\n Ref,\n RefObject,\n useContext,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { CSS as CSSUtil } from \"@dnd-kit/utilities\";\nimport clsx from \"clsx\";\n\nimport { createSingletonHandler, getLogicalBoundingClientRect } from \"@cloudscape-design/component-toolkit/internal\";\nimport {\n useInternalDragHandleInteractionState,\n UseInternalDragHandleInteractionStateProps,\n} from \"@cloudscape-design/components/internal/do-not-use/drag-handle\";\n\nimport {\n DragAndDropData,\n DropTargetContext,\n InteractionType,\n Operation,\n useDraggable,\n useDragSubscription,\n} from \"../dnd-controller/controller\";\nimport { BoardItemDefinitionBase, Direction, ItemId, Transform } from \"../interfaces\";\nimport { Coordinates } from \"../utils/coordinates\";\nimport { getNormalizedElementRect } from \"../utils/screen\";\nimport { throttle } from \"../utils/throttle\";\nimport { getCollisionRect } from \"./get-collision-rect\";\nimport { getNextDroppable } from \"./get-next-droppable\";\nimport {\n calculateInitialPointerData,\n determineHandleActiveState,\n getDndOperationType,\n hasPointerMovedBeyondThreshold,\n} from \"./utils\";\n\nimport styles from \"./styles.css.js\";\n\nexport interface ItemContainerRef {\n focusDragHandle(): void;\n}\n\nexport type HandleActiveState = null | \"pointer\" | \"uap\";\n\ninterface ItemContextType {\n /**\n * Flag indicating if a drag or resize interaction is currently active.\n */\n isActive: boolean;\n /**\n * Flag indicating if the item is currently hidden.\n * (When a board item is moved from the palette to the board and the transition is not submitted)\n */\n isHidden: boolean;\n dragHandle: {\n /**\n * Ref to the drag button. Used to focus the drag handle when moving an item\n * from the palette to the board via keyboard or UAP actions.\n */\n ref: RefObject<HTMLDivElement>;\n /**\n * Listen to pointerDown events on the drag handle.\n * Used to start a transition and attach global event handlers.\n */\n onPointerDown(event: ReactPointerEvent): void;\n /**\n * Listen to keyDown events on the drag handle.\n */\n onKeyDown(event: KeyboardEvent): void;\n /**\n * Indicating if drag handle is active.\n */\n activeState: HandleActiveState;\n /**\n * Listen to UAP direction button clicks.\n */\n onDirectionClick(direction: KeyboardEvent[\"key\"], operation: HandleOperation): void;\n /**\n * Flag indicating if the UAP buttons should be shown. E.g. when a item is moved from\n * the palette via keyboard or UAP to the board.\n */\n initialShowButtons?: boolean;\n };\n resizeHandle: null | {\n /**\n * Listen to pointerDown events on the drag handle.\n * Used to start a transition and attach global event handlers.\n */\n onPointerDown(event: ReactPointerEvent): void;\n /**\n * Listen to keyDown events on the drag handle.\n */\n onKeyDown(event: KeyboardEvent): void;\n /**\n * Indicating if resize handle is active.\n */\n activeState: HandleActiveState;\n /**\n * Listen to UAP direction button clicks.\n */\n onDirectionClick(direction: KeyboardEvent[\"key\"], operation: HandleOperation): void;\n };\n}\n\nexport interface Transition {\n itemId: ItemId;\n operation: Operation;\n interactionType: InteractionType;\n sizeTransform: null | { width: number; height: number };\n positionTransform: null | { x: number; y: number };\n hasDropTarget?: boolean;\n}\n\nexport type HandleOperation = \"drag\" | \"resize\";\n\nexport const ItemContext = createContext<ItemContextType | null>(null);\n\nexport function useItemContext() {\n const ctx = useContext(ItemContext);\n if (!ctx) {\n throw new Error(\"Invariant violation: no board item context.\");\n }\n return ctx;\n}\n\n/**\n * Defines item's parameters and its relation with the layout.\n *\n * `item` - the unique board item base object to be used in d&d context.\n * `placed` - specifies if the item already belongs to the board.\n * `acquired` - specifies if the item is essentially a copy temporarily acquired by a droppable but not submitted yet.\n * `inTransition` - specifies if the item is currently being moved.\n * `transform` - specifies if the item's position needs to be altered.\n * `getItemSize` - item size getter that takes droppable context as argument.\n * `onKeyMove` - a callback that fires when arrow keys are pressed in drag- or resize handle.\n */\nexport interface ItemContainerProps {\n item: BoardItemDefinitionBase<unknown>;\n placed: boolean;\n acquired: boolean;\n inTransition: boolean;\n transform: Transform | undefined;\n getItemSize: (context: null | DropTargetContext) => {\n width: number;\n minWidth: number;\n maxWidth: number;\n height: number;\n minHeight: number;\n maxHeight: number;\n };\n\n onKeyMove?(direction: Direction): void;\n\n children: (hasDropTarget: boolean) => ReactNode;\n isRtl: () => boolean;\n}\n\nexport const ItemContainer = forwardRef(ItemContainerComponent);\n\n// The amount of distance after pointer down that the cursor is allowed to\n// jitter for a subsequent mouseup to still register as a \"press\" instead of\n// a drag. A little allowance is needed for usability reasons, but this number\n// isn't set in stone.\nexport const CLICK_DRAG_THRESHOLD = 3;\n\n// We use singleton helper to avoid creating event listeners per each board item.\nconst usePointerEventListeners = createSingletonHandler<\n { type: \"move\"; event: PointerEvent } | { type: \"up\"; event: PointerEvent }\n>((setEvent) => {\n const handleGlobalPointerMove = (event: PointerEvent) => setEvent({ type: \"move\", event });\n const handleGlobalPointerUp = (event: PointerEvent) => setEvent({ type: \"up\", event });\n const controller = new AbortController();\n window.addEventListener(\"pointermove\", handleGlobalPointerMove, { signal: controller.signal });\n window.addEventListener(\"pointerup\", handleGlobalPointerUp, { signal: controller.signal });\n return () => controller.abort();\n});\n\nfunction ItemContainerComponent(\n { item, placed, acquired, inTransition, transform, getItemSize, onKeyMove, children, isRtl }: ItemContainerProps,\n ref: Ref<ItemContainerRef>,\n) {\n const originalSizeRef = useRef({ width: 0, height: 0 });\n const pointerOffsetRef = useRef(new Coordinates({ x: 0, y: 0 }));\n const pointerBoundariesRef = useRef<null | Coordinates>(null);\n const [transition, setTransition] = useState<null | Transition>(null);\n const [isHidden, setIsHidden] = useState(false);\n const muteEventsRef = useRef(false);\n const itemRef = useRef<HTMLDivElement>(null);\n // Keeps the starting position of active pointer-based d&d transition.\n // If undefined - it means the pointer-based d&d is not engaged.\n const initialPointerDownPosition = useRef<{ x: number; y: number } | undefined>();\n const draggableApi = useDraggable({\n draggableItem: item,\n getCollisionRect: (operation, coordinates, dropTarget) => {\n const sizeOverride = operation === \"insert\" && dropTarget ? getItemSize(dropTarget) : null;\n return getCollisionRect(operation, itemRef.current!, coordinates, sizeOverride);\n },\n });\n\n function updateTransition({\n operation,\n interactionType,\n draggableItem,\n collisionRect,\n coordinates,\n dropTarget,\n }: DragAndDropData) {\n if (item.id === draggableItem.id) {\n const [width, height] = [collisionRect.right - collisionRect.left, collisionRect.bottom - collisionRect.top];\n const pointerOffset = pointerOffsetRef.current;\n\n if (operation === \"resize\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: {\n width: Math.max(getItemSize(null).minWidth, Math.min(getItemSize(null).maxWidth, width - pointerOffset.x)),\n height: Math.max(getItemSize(null).minHeight, height - pointerOffset.y),\n },\n positionTransform: null,\n });\n } else if (operation === \"insert\" || operation === \"reorder\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: dropTarget ? getItemSize(dropTarget) : originalSizeRef.current,\n positionTransform: { x: coordinates.x - pointerOffset.x, y: coordinates.y - pointerOffset.y },\n hasDropTarget: !!dropTarget,\n });\n }\n }\n }\n\n useDragSubscription(\"start\", (detail) => updateTransition(detail));\n useDragSubscription(\"update\", (detail) => updateTransition(detail));\n useDragSubscription(\"submit\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n useDragSubscription(\"discard\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n\n // Handles incremental transition logic shared between different keyboard and UAP interactions.\n function handleIncrementalTransition(operation: HandleOperation, submitExisting = false) {\n // The acquired item is a copy and does not have the transition state.\n // However, pressing \"Space\" or \"Enter\" on the acquired item must submit the active transition.\n if (acquired) {\n return draggableApi.submitTransition();\n }\n\n // Submit existing transition if requested and one exists\n if (submitExisting && transition) {\n return draggableApi.submitTransition();\n }\n\n const rect = getNormalizedElementRect(itemRef.current!);\n const coordinates = new Coordinates({\n x: operation === \"drag\" ? rect.left : rect.right,\n y: operation === \"drag\" ? rect.top : rect.bottom,\n });\n\n if (operation === \"drag\" && !placed) {\n draggableApi.start(\"insert\", \"keyboard\", coordinates);\n } else if (operation === \"drag\") {\n draggableApi.start(\"reorder\", \"keyboard\", coordinates);\n } else {\n draggableApi.start(\"resize\", \"keyboard\", coordinates);\n }\n }\n\n function handleInsert(direction: Direction) {\n // Find the closest droppable (in the direction) to the item.\n const droppables = draggableApi.getDroppables();\n const nextDroppable = getNextDroppable({\n draggableElement: itemRef.current!,\n droppables,\n direction,\n isRtl: isRtl(),\n });\n\n if (!nextDroppable) {\n // TODO: add announcement\n // Context: the keyboard insertion only works when there is some droppable area in the specified direction.\n // That means that only some arrow keys might work which is confusing for a screen-reader user.\n // Alternatively, we can consider a multi-step insertion where the user would first explicitly select the desired board.\n return;\n }\n\n // Notify the respective droppable of the intention to insert the item in it.\n draggableApi.acquire(nextDroppable, () => children(true));\n setIsHidden(true);\n muteEventsRef.current = true;\n }\n\n function handleDirectionalMovement(direction: Direction, operation: HandleOperation) {\n const canInsert = transition && operation === \"drag\" && !placed;\n const canNavigate = transition || operation === \"drag\";\n if (canInsert) {\n handleInsert(direction);\n } else if (canNavigate) {\n onKeyMove?.(direction);\n }\n }\n\n function onHandleKeyDown(operation: HandleOperation, event: KeyboardEvent) {\n // We do not expect keyboard input when pointer-based d&d is performed.\n // Upon receiving any, we discard the current transition immediately.\n if (transition && initialPointerDownPosition.current) {\n initialPointerDownPosition.current = undefined;\n draggableApi.discardTransition();\n return;\n }\n\n const discard = () => {\n if (transition || acquired) {\n draggableApi.discardTransition();\n }\n };\n switch (event.key) {\n case \"ArrowUp\":\n return handleDirectionalMovement(\"up\", operation);\n case \"ArrowDown\":\n return handleDirectionalMovement(\"down\", operation);\n case \"ArrowLeft\":\n return handleDirectionalMovement(\"left\", operation);\n case \"ArrowRight\":\n return handleDirectionalMovement(\"right\", operation);\n case \" \":\n case \"Enter\":\n return handleIncrementalTransition(operation, true);\n case \"Escape\":\n return discard();\n }\n }\n\n function onBlur() {\n // When drag- or resize handle on palette or board item loses focus the transition must be submitted with two exceptions:\n // 1. If the last interaction is not \"keyboard\" (the user clicked on another handle issuing a new transition);\n // 2. If the item is acquired by the board (in that case the focus moves to the board item which is expected, palette item is hidden and all events handlers must be muted).\n selectedHook.current.processBlur();\n\n if (acquired || (transition && transition.interactionType === \"keyboard\" && !muteEventsRef.current)) {\n initialPointerDownPosition.current = undefined;\n draggableApi.submitTransition();\n }\n }\n\n // Pointer-down handler, added to each drag- and resize handle.\n function onHandlePointerDown(event: ReactPointerEvent, operation: HandleOperation) {\n // Prevent UI issues when right-clicking: in such a case the OS context menu will be shown and\n // the board while the board-item is active. Because of the context menu under the pointer,\n // onPointerUp is not called anymore. In such a case the board item would stuck in onPointerUp.\n if (event.button !== 0) {\n return;\n }\n initialPointerDownPosition.current = { x: event.clientX, y: event.clientY };\n\n if (operation === \"drag\") {\n selectedHook.current = dragInteractionHook;\n } else {\n selectedHook.current = resizeInteractionHook;\n }\n selectedHook.current.processPointerDown(event.nativeEvent);\n }\n // Global pointer-move and pointer-up handlers.\n usePointerEventListeners(({ type, event }) => {\n switch (type) {\n case \"move\": {\n if (hasPointerMovedBeyondThreshold(event, initialPointerDownPosition.current)) {\n selectedHook.current.processPointerMove(event);\n }\n break;\n }\n case \"up\": {\n if (initialPointerDownPosition.current) {\n selectedHook.current.processPointerUp(event);\n }\n initialPointerDownPosition.current = undefined;\n break;\n }\n }\n });\n\n function handlePointerInteractionStart(event: PointerEvent, operation: \"drag\" | \"resize\") {\n const currentItemElement = itemRef.current;\n if (!currentItemElement) {\n console.warn(\"ItemContainer: itemRef.current is not available on interaction start.\");\n return;\n }\n\n const rect = getLogicalBoundingClientRect(currentItemElement);\n originalSizeRef.current = { width: rect.inlineSize, height: rect.blockSize };\n\n const { pointerOffset, pointerBoundaries } = calculateInitialPointerData({\n event,\n operation,\n rect,\n getMinSize: () => getItemSize(null),\n isRtl: isRtl(),\n });\n pointerOffsetRef.current = pointerOffset;\n pointerBoundariesRef.current = pointerBoundaries;\n\n const dndOperation = getDndOperationType(operation, placed);\n const startCoordinates = Coordinates.fromEvent(event, { isRtl: isRtl() });\n draggableApi.start(dndOperation, \"pointer\", startCoordinates);\n }\n\n const onHandleDndTransitionActive = throttle((event: PointerEvent) => {\n const coordinates = Coordinates.fromEvent(event, { isRtl: isRtl() });\n draggableApi.updateTransition(\n new Coordinates({\n x: Math.max(coordinates.x, pointerBoundariesRef.current?.x ?? Number.NEGATIVE_INFINITY),\n y: Math.max(coordinates.y, pointerBoundariesRef.current?.y ?? Number.NEGATIVE_INFINITY),\n }),\n );\n }, 10) as (event: PointerEvent) => void;\n\n const itemTransitionStyle: CSSProperties = {};\n const itemTransitionClassNames: string[] = [];\n\n if (inTransition) {\n itemTransitionClassNames.push(styles.inTransition);\n }\n\n if (transition && transition.interactionType === \"pointer\") {\n // Adjust the dragged/resized item to the pointer's location.\n itemTransitionClassNames.push(transition.operation === \"resize\" ? styles.resized : styles.dragged);\n itemTransitionStyle.insetInlineStart = transition.positionTransform?.x;\n itemTransitionStyle.insetBlockStart = transition.positionTransform?.y;\n itemTransitionStyle.inlineSize = transition.sizeTransform?.width;\n itemTransitionStyle.blockSize = transition.sizeTransform?.height;\n itemTransitionStyle.pointerEvents = \"none\";\n }\n\n if (isHidden) {\n itemTransitionClassNames.push(styles.hidden);\n }\n\n if (transform) {\n // The moved items positions are altered with CSS transform.\n if (transform.type === \"move\") {\n itemTransitionClassNames.push(styles.transformed);\n itemTransitionStyle.transform = CSSUtil.Transform.toString({\n x: transform.x,\n y: transform.y,\n scaleX: 1,\n scaleY: 1,\n });\n itemTransitionStyle.width = transform.width + \"px\";\n itemTransitionStyle.height = transform.height + \"px\";\n }\n // The item is removed from the DOM after animations play.\n // During the animations the removed item is hidden with styles.\n if (transform.type === \"remove\") {\n itemTransitionClassNames.push(styles.removed);\n }\n }\n\n const dragHandleRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => ({\n focusDragHandle: () => {\n return dragHandleRef.current?.focus();\n },\n }));\n\n const dragHookProps: UseInternalDragHandleInteractionStateProps = {\n onDndStartAction: (event) => handlePointerInteractionStart(event, \"drag\"),\n onDndActiveAction: onHandleDndTransitionActive,\n onDndEndAction: () => transition && draggableApi.submitTransition(),\n onUapActionStartAction: () => handleIncrementalTransition(\"drag\"),\n };\n const resizeHookProps: UseInternalDragHandleInteractionStateProps = {\n onDndStartAction: (event) => handlePointerInteractionStart(event, \"resize\"),\n onDndActiveAction: onHandleDndTransitionActive,\n onDndEndAction: () => transition && draggableApi.submitTransition(),\n onUapActionStartAction: () => handleIncrementalTransition(\"resize\"),\n };\n\n // When d&d is active, either drag- or resize hook should be used.\n // We determine the correct one in the onHandlePointerDown handler, and store it to the selectedHook ref.\n const dragInteractionHook = useInternalDragHandleInteractionState(dragHookProps);\n const resizeInteractionHook = useInternalDragHandleInteractionState(resizeHookProps);\n const selectedHook = useRef(dragInteractionHook);\n\n const isActive = (!!transition && !isHidden) || !!acquired;\n const shouldUsePortal =\n transition?.operation === \"insert\" &&\n transition?.interactionType === \"pointer\" &&\n selectedHook.current.interaction.value === \"dnd-active\";\n const childrenRef = useRef<ReactNode>(null);\n if (!inTransition || isActive) {\n childrenRef.current = children(!!transition?.hasDropTarget);\n }\n\n const content = (\n <div\n ref={itemRef}\n className={clsx(styles.root, ...itemTransitionClassNames)}\n style={itemTransitionStyle}\n data-item-id={item.id}\n onBlur={onBlur}\n >\n <ItemContext.Provider\n value={{\n isActive,\n isHidden,\n dragHandle: {\n ref: dragHandleRef,\n onPointerDown: (e) => onHandlePointerDown(e, \"drag\"),\n onKeyDown: (event: KeyboardEvent) => onHandleKeyDown(\"drag\", event),\n activeState: determineHandleActiveState({\n isHandleActive: isActive,\n currentTransition: transition,\n interactionHookValue: dragInteractionHook.interaction.value,\n targetOperation: \"reorder\",\n }),\n onDirectionClick: handleDirectionalMovement,\n initialShowButtons:\n dragInteractionHook.interaction.value === \"uap-action-start\" || (inTransition && acquired),\n },\n resizeHandle: placed\n ? {\n onPointerDown: (e) => onHandlePointerDown(e, \"resize\"),\n onKeyDown: (event: KeyboardEvent) => onHandleKeyDown(\"resize\", event),\n activeState: determineHandleActiveState({\n isHandleActive: isActive,\n currentTransition: transition,\n interactionHookValue: resizeInteractionHook.interaction.value,\n targetOperation: \"resize\",\n }),\n onDirectionClick: handleDirectionalMovement,\n }\n : null,\n }}\n >\n {childrenRef.current}\n </ItemContext.Provider>\n </div>\n );\n\n return shouldUsePortal ? <div>{createPortal(content, document.body)}</div> : content;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/item-container/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EACL,aAAa,EAEb,UAAU,EAMV,UAAU,EACV,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB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Ac,EAAE,QAAQ;4BACxB,iBAAiB,EAAE,UAAU;4BAC7B,oBAAoB,EAAE,qBAAqB,CAAC,WAAW,CAAC,KAAK;4BAC7D,eAAe,EAAE,QAAQ;yBAC1B,CAAC;wBACF,gBAAgB,EAAE,yBAAyB;qBAC5C;oBACH,CAAC,CAAC,IAAI;aACT,YAEA,WAAW,CAAC,OAAO,GACC,GACnB,CACP,CAAC;IAEF,OAAO,eAAe,CAAC,CAAC,CAAC,wBAAM,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport {\n createContext,\n CSSProperties,\n forwardRef,\n KeyboardEvent,\n PointerEvent as ReactPointerEvent,\n ReactNode,\n Ref,\n RefObject,\n useContext,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { CSS as CSSUtil } from \"@dnd-kit/utilities\";\nimport clsx from \"clsx\";\n\nimport { createSingletonHandler, getLogicalBoundingClientRect } from \"@cloudscape-design/component-toolkit/internal\";\nimport {\n useInternalDragHandleInteractionState,\n UseInternalDragHandleInteractionStateProps,\n} from \"@cloudscape-design/components/internal/do-not-use/drag-handle\";\n\nimport {\n DragAndDropData,\n DropTargetContext,\n InteractionType,\n Operation,\n useDraggable,\n useDragSubscription,\n} from \"../dnd-controller/controller\";\nimport { BoardItemDefinitionBase, Direction, ItemId, Transform } from \"../interfaces\";\nimport { Coordinates } from \"../utils/coordinates\";\nimport { getNormalizedElementRect } from \"../utils/screen\";\nimport { throttle } from \"../utils/throttle\";\nimport { getCollisionRect } from \"./get-collision-rect\";\nimport { getNextDroppable } from \"./get-next-droppable\";\nimport {\n calculateInitialPointerData,\n determineHandleActiveState,\n getDndOperationType,\n hasPointerMovedBeyondThreshold,\n} from \"./utils\";\n\nimport styles from \"./styles.css.js\";\n\nexport interface ItemContainerRef {\n focusDragHandle(): void;\n}\n\nexport type HandleActiveState = null | \"pointer\" | \"uap\";\n\ninterface ItemContextType {\n /**\n * Flag indicating if a drag or resize interaction is currently active.\n */\n isActive: boolean;\n /**\n * Flag indicating if the item is currently hidden.\n * (When a board item is moved from the palette to the board and the transition is not submitted)\n */\n isHidden: boolean;\n dragHandle: {\n /**\n * Ref to the drag button. Used to focus the drag handle when moving an item\n * from the palette to the board via keyboard or UAP actions.\n */\n ref: RefObject<HTMLDivElement>;\n /**\n * Listen to pointerDown events on the drag handle.\n * Used to start a transition and attach global event handlers.\n */\n onPointerDown(event: ReactPointerEvent): void;\n /**\n * Listen to keyDown events on the drag handle.\n */\n onKeyDown(event: KeyboardEvent): void;\n /**\n * Indicating if drag handle is active.\n */\n activeState: HandleActiveState;\n /**\n * Listen to UAP direction button clicks.\n */\n onDirectionClick(direction: KeyboardEvent[\"key\"], operation: HandleOperation): void;\n /**\n * Flag indicating if the UAP buttons should be shown. E.g. when a item is moved from\n * the palette via keyboard or UAP to the board.\n */\n initialShowButtons?: boolean;\n };\n resizeHandle: null | {\n /**\n * Listen to pointerDown events on the drag handle.\n * Used to start a transition and attach global event handlers.\n */\n onPointerDown(event: ReactPointerEvent): void;\n /**\n * Listen to keyDown events on the drag handle.\n */\n onKeyDown(event: KeyboardEvent): void;\n /**\n * Indicating if resize handle is active.\n */\n activeState: HandleActiveState;\n /**\n * Listen to UAP direction button clicks.\n */\n onDirectionClick(direction: KeyboardEvent[\"key\"], operation: HandleOperation): void;\n };\n}\n\nexport interface Transition {\n itemId: ItemId;\n operation: Operation;\n interactionType: InteractionType;\n sizeTransform: null | { width: number; height: number };\n positionTransform: null | { x: number; y: number };\n hasDropTarget?: boolean;\n}\n\nexport type HandleOperation = \"drag\" | \"resize\";\n\nexport const ItemContext = createContext<ItemContextType | null>(null);\n\nexport function useItemContext() {\n const ctx = useContext(ItemContext);\n if (!ctx) {\n throw new Error(\"Invariant violation: no board item context.\");\n }\n return ctx;\n}\n\n/**\n * Defines item's parameters and its relation with the layout.\n *\n * `item` - the unique board item base object to be used in d&d context.\n * `placed` - specifies if the item already belongs to the board.\n * `acquired` - specifies if the item is essentially a copy temporarily acquired by a droppable but not submitted yet.\n * `inTransition` - specifies if the item is currently being moved.\n * `transform` - specifies if the item's position needs to be altered.\n * `getItemSize` - item size getter that takes droppable context as argument.\n * `onKeyMove` - a callback that fires when arrow keys are pressed in drag- or resize handle.\n */\nexport interface ItemContainerProps {\n item: BoardItemDefinitionBase<unknown>;\n placed: boolean;\n acquired: boolean;\n inTransition: boolean;\n transform: Transform | undefined;\n getItemSize: (context: null | DropTargetContext) => {\n width: number;\n minWidth: number;\n maxWidth: number;\n height: number;\n minHeight: number;\n maxHeight: number;\n };\n\n onKeyMove?(direction: Direction): void;\n\n children: (hasDropTarget: boolean) => ReactNode;\n isRtl: () => boolean;\n}\n\nexport const ItemContainer = forwardRef(ItemContainerComponent);\n\n// The amount of distance after pointer down that the cursor is allowed to\n// jitter for a subsequent mouseup to still register as a \"press\" instead of\n// a drag. A little allowance is needed for usability reasons, but this number\n// isn't set in stone.\nexport const CLICK_DRAG_THRESHOLD = 3;\n\n// We use singleton helper to avoid creating event listeners per each board item.\nconst usePointerEventListeners = createSingletonHandler<\n { type: \"move\"; event: PointerEvent } | { type: \"up\"; event: PointerEvent }\n>((setEvent) => {\n const handleGlobalPointerMove = (event: PointerEvent) => setEvent({ type: \"move\", event });\n const handleGlobalPointerUp = (event: PointerEvent) => setEvent({ type: \"up\", event });\n const controller = new AbortController();\n window.addEventListener(\"pointermove\", handleGlobalPointerMove, { signal: controller.signal });\n window.addEventListener(\"pointerup\", handleGlobalPointerUp, { signal: controller.signal });\n return () => controller.abort();\n});\n\nfunction ItemContainerComponent(\n { item, placed, acquired, inTransition, transform, getItemSize, onKeyMove, children, isRtl }: ItemContainerProps,\n ref: Ref<ItemContainerRef>,\n) {\n const originalSizeRef = useRef({ width: 0, height: 0 });\n const pointerOffsetRef = useRef(new Coordinates({ x: 0, y: 0 }));\n const pointerBoundariesRef = useRef<null | Coordinates>(null);\n const [transition, setTransition] = useState<null | Transition>(null);\n const [isHidden, setIsHidden] = useState(false);\n const muteEventsRef = useRef(false);\n const itemRef = useRef<HTMLDivElement>(null);\n // Keeps the starting position of active pointer-based d&d transition.\n // If undefined - it means the pointer-based d&d is not engaged.\n const initialPointerDownPosition = useRef<{ x: number; y: number } | undefined>();\n const draggableApi = useDraggable({\n draggableItem: item,\n getCollisionRect: (operation, coordinates, dropTarget) => {\n const sizeOverride = operation === \"insert\" && dropTarget ? getItemSize(dropTarget) : null;\n return getCollisionRect(operation, itemRef.current!, coordinates, sizeOverride);\n },\n });\n\n function updateTransition({\n operation,\n interactionType,\n draggableItem,\n collisionRect,\n coordinates,\n dropTarget,\n }: DragAndDropData) {\n if (item.id === draggableItem.id) {\n const [width, height] = [collisionRect.right - collisionRect.left, collisionRect.bottom - collisionRect.top];\n const pointerOffset = pointerOffsetRef.current;\n\n if (operation === \"resize\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: {\n width: Math.max(getItemSize(null).minWidth, Math.min(getItemSize(null).maxWidth, width - pointerOffset.x)),\n height: Math.max(getItemSize(null).minHeight, height - pointerOffset.y),\n },\n positionTransform: null,\n });\n } else if (operation === \"insert\" || operation === \"reorder\") {\n setTransition({\n operation,\n interactionType,\n itemId: draggableItem.id,\n sizeTransform: dropTarget ? getItemSize(dropTarget) : originalSizeRef.current,\n positionTransform: { x: coordinates.x - pointerOffset.x, y: coordinates.y - pointerOffset.y },\n hasDropTarget: !!dropTarget,\n });\n }\n }\n }\n\n useDragSubscription(\"start\", (detail) => updateTransition(detail));\n useDragSubscription(\"update\", (detail) => updateTransition(detail));\n useDragSubscription(\"submit\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n useDragSubscription(\"discard\", () => {\n setTransition(null);\n setIsHidden(false);\n muteEventsRef.current = false;\n });\n\n // Handles incremental transition logic shared between different keyboard and UAP interactions.\n function handleIncrementalTransition(operation: HandleOperation, submitExisting = false) {\n // The acquired item is a copy and does not have the transition state.\n // However, pressing \"Space\" or \"Enter\" on the acquired item must submit the active transition.\n if (acquired) {\n return draggableApi.submitTransition();\n }\n\n // Submit existing transition if requested and one exists\n if (submitExisting && transition) {\n return draggableApi.submitTransition();\n }\n\n const rect = getNormalizedElementRect(itemRef.current!);\n const coordinates = new Coordinates({\n x: operation === \"drag\" ? rect.left : rect.right,\n y: operation === \"drag\" ? rect.top : rect.bottom,\n });\n\n if (operation === \"drag\" && !placed) {\n draggableApi.start(\"insert\", \"keyboard\", coordinates);\n } else if (operation === \"drag\") {\n draggableApi.start(\"reorder\", \"keyboard\", coordinates);\n } else {\n draggableApi.start(\"resize\", \"keyboard\", coordinates);\n }\n }\n\n function handleInsert(direction: Direction) {\n // Find the closest droppable (in the direction) to the item.\n const droppables = draggableApi.getDroppables();\n const nextDroppable = getNextDroppable({\n draggableElement: itemRef.current!,\n droppables,\n direction,\n isRtl: isRtl(),\n });\n\n if (!nextDroppable) {\n // TODO: add announcement\n // Context: the keyboard insertion only works when there is some droppable area in the specified direction.\n // That means that only some arrow keys might work which is confusing for a screen-reader user.\n // Alternatively, we can consider a multi-step insertion where the user would first explicitly select the desired board.\n return;\n }\n\n // Notify the respective droppable of the intention to insert the item in it.\n draggableApi.acquire(nextDroppable, () => children(true));\n setIsHidden(true);\n muteEventsRef.current = true;\n }\n\n function handleDirectionalMovement(direction: Direction, operation: HandleOperation) {\n const canInsert = transition && operation === \"drag\" && !placed;\n const canNavigate = transition || operation === \"drag\";\n if (canInsert) {\n handleInsert(direction);\n } else if (canNavigate) {\n onKeyMove?.(direction);\n }\n }\n\n function onHandleKeyDown(operation: HandleOperation, event: KeyboardEvent) {\n // We do not expect keyboard input when pointer-based d&d is performed.\n // Upon receiving any, we discard the current transition immediately.\n if (transition && initialPointerDownPosition.current) {\n initialPointerDownPosition.current = undefined;\n draggableApi.discardTransition();\n return;\n }\n\n const discard = () => {\n if (transition || acquired) {\n draggableApi.discardTransition();\n }\n };\n switch (event.key) {\n case \"ArrowUp\":\n return handleDirectionalMovement(\"up\", operation);\n case \"ArrowDown\":\n return handleDirectionalMovement(\"down\", operation);\n case \"ArrowLeft\":\n return handleDirectionalMovement(\"left\", operation);\n case \"ArrowRight\":\n return handleDirectionalMovement(\"right\", operation);\n case \" \":\n case \"Enter\":\n return handleIncrementalTransition(operation, true);\n case \"Escape\":\n return discard();\n }\n }\n\n function onBlur() {\n // When drag- or resize handle on palette or board item loses focus the transition must be submitted with two exceptions:\n // 1. If the last interaction is not \"keyboard\" (the user clicked on another handle issuing a new transition);\n // 2. If the item is acquired by the board (in that case the focus moves to the board item which is expected, palette item is hidden and all events handlers must be muted).\n selectedHook.current.processBlur();\n\n if (acquired || (transition && transition.interactionType === \"keyboard\" && !muteEventsRef.current)) {\n initialPointerDownPosition.current = undefined;\n draggableApi.submitTransition();\n }\n }\n\n // Pointer-down handler, added to each drag- and resize handle.\n function onHandlePointerDown(event: ReactPointerEvent, operation: HandleOperation) {\n // Prevent UI issues when right-clicking: in such a case the OS context menu will be shown and\n // the board while the board-item is active. Because of the context menu under the pointer,\n // onPointerUp is not called anymore. In such a case the board item would stuck in onPointerUp.\n if (event.button !== 0) {\n return;\n }\n initialPointerDownPosition.current = { x: event.clientX, y: event.clientY };\n\n if (operation === \"drag\") {\n selectedHook.current = dragInteractionHook;\n } else {\n selectedHook.current = resizeInteractionHook;\n }\n selectedHook.current.processPointerDown(event.nativeEvent);\n }\n // Global pointer-move and pointer-up handlers.\n usePointerEventListeners(({ type, event }) => {\n switch (type) {\n case \"move\": {\n if (hasPointerMovedBeyondThreshold(event, initialPointerDownPosition.current)) {\n selectedHook.current.processPointerMove(event);\n }\n break;\n }\n case \"up\": {\n if (initialPointerDownPosition.current) {\n selectedHook.current.processPointerUp(event);\n }\n initialPointerDownPosition.current = undefined;\n break;\n }\n }\n });\n\n function handlePointerInteractionStart(event: PointerEvent, operation: \"drag\" | \"resize\") {\n const currentItemElement = itemRef.current;\n if (!currentItemElement) {\n console.warn(\"ItemContainer: itemRef.current is not available on interaction start.\");\n return;\n }\n\n const rect = getLogicalBoundingClientRect(currentItemElement);\n originalSizeRef.current = { width: rect.inlineSize, height: rect.blockSize };\n\n const { pointerOffset, pointerBoundaries } = calculateInitialPointerData({\n event,\n operation,\n rect,\n getMinSize: () => getItemSize(null),\n isRtl: isRtl(),\n });\n pointerOffsetRef.current = pointerOffset;\n pointerBoundariesRef.current = pointerBoundaries;\n\n const dndOperation = getDndOperationType(operation, placed);\n const startCoordinates = Coordinates.fromEvent(event, { isRtl: isRtl() });\n draggableApi.start(dndOperation, \"pointer\", startCoordinates);\n }\n\n const onHandleDndTransitionActive = throttle((event: PointerEvent) => {\n const coordinates = Coordinates.fromEvent(event, { isRtl: isRtl() });\n draggableApi.updateTransition(\n new Coordinates({\n x: Math.max(coordinates.x, pointerBoundariesRef.current?.x ?? Number.NEGATIVE_INFINITY),\n y: Math.max(coordinates.y, pointerBoundariesRef.current?.y ?? Number.NEGATIVE_INFINITY),\n }),\n );\n }, 10) as (event: PointerEvent) => void;\n\n const itemTransitionStyle: CSSProperties = {};\n const itemTransitionClassNames: string[] = [];\n\n if (inTransition) {\n itemTransitionClassNames.push(styles.inTransition);\n }\n\n if (transition) {\n if (transition.interactionType === \"pointer\") {\n // Adjust the dragged/resized item to the pointer's location.\n itemTransitionClassNames.push(transition.operation === \"resize\" ? styles.resized : styles.dragged);\n itemTransitionStyle.insetInlineStart = transition.positionTransform?.x;\n itemTransitionStyle.insetBlockStart = transition.positionTransform?.y;\n itemTransitionStyle.inlineSize = transition.sizeTransform?.width;\n itemTransitionStyle.blockSize = transition.sizeTransform?.height;\n itemTransitionStyle.pointerEvents = \"none\";\n }\n if (transition.interactionType === \"keyboard\") {\n itemTransitionClassNames.push(styles.keyboardDragged);\n }\n }\n\n if (isHidden) {\n itemTransitionClassNames.push(styles.hidden);\n }\n\n if (transform) {\n // The moved items positions are altered with CSS transform.\n if (transform.type === \"move\") {\n itemTransitionClassNames.push(styles.transformed);\n itemTransitionStyle.transform = CSSUtil.Transform.toString({\n x: transform.x,\n y: transform.y,\n scaleX: 1,\n scaleY: 1,\n });\n itemTransitionStyle.width = transform.width + \"px\";\n itemTransitionStyle.height = transform.height + \"px\";\n }\n // The item is removed from the DOM after animations play.\n // During the animations the removed item is hidden with styles.\n if (transform.type === \"remove\") {\n itemTransitionClassNames.push(styles.removed);\n }\n }\n\n const dragHandleRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => ({\n focusDragHandle: () => {\n return dragHandleRef.current?.focus();\n },\n }));\n\n const dragHookProps: UseInternalDragHandleInteractionStateProps = {\n onDndStartAction: (event) => handlePointerInteractionStart(event, \"drag\"),\n onDndActiveAction: onHandleDndTransitionActive,\n onDndEndAction: () => transition && draggableApi.submitTransition(),\n onUapActionStartAction: () => handleIncrementalTransition(\"drag\"),\n };\n const resizeHookProps: UseInternalDragHandleInteractionStateProps = {\n onDndStartAction: (event) => handlePointerInteractionStart(event, \"resize\"),\n onDndActiveAction: onHandleDndTransitionActive,\n onDndEndAction: () => transition && draggableApi.submitTransition(),\n onUapActionStartAction: () => handleIncrementalTransition(\"resize\"),\n };\n\n // When d&d is active, either drag- or resize hook should be used.\n // We determine the correct one in the onHandlePointerDown handler, and store it to the selectedHook ref.\n const dragInteractionHook = useInternalDragHandleInteractionState(dragHookProps);\n const resizeInteractionHook = useInternalDragHandleInteractionState(resizeHookProps);\n const selectedHook = useRef(dragInteractionHook);\n\n const isActive = (!!transition && !isHidden) || !!acquired;\n const shouldUsePortal =\n transition?.operation === \"insert\" &&\n transition?.interactionType === \"pointer\" &&\n selectedHook.current.interaction.value === \"dnd-active\";\n const childrenRef = useRef<ReactNode>(null);\n if (!inTransition || isActive) {\n childrenRef.current = children(!!transition?.hasDropTarget);\n }\n\n const content = (\n <div\n ref={itemRef}\n className={clsx(styles.root, ...itemTransitionClassNames)}\n style={itemTransitionStyle}\n data-item-id={item.id}\n onBlur={onBlur}\n >\n <ItemContext.Provider\n value={{\n isActive,\n isHidden,\n dragHandle: {\n ref: dragHandleRef,\n onPointerDown: (e) => onHandlePointerDown(e, \"drag\"),\n onKeyDown: (event: KeyboardEvent) => onHandleKeyDown(\"drag\", event),\n activeState: determineHandleActiveState({\n isHandleActive: isActive,\n currentTransition: transition,\n interactionHookValue: dragInteractionHook.interaction.value,\n targetOperation: \"reorder\",\n }),\n onDirectionClick: handleDirectionalMovement,\n initialShowButtons:\n dragInteractionHook.interaction.value === \"uap-action-start\" || (inTransition && acquired),\n },\n resizeHandle: placed\n ? {\n onPointerDown: (e) => onHandlePointerDown(e, \"resize\"),\n onKeyDown: (event: KeyboardEvent) => onHandleKeyDown(\"resize\", event),\n activeState: determineHandleActiveState({\n isHandleActive: isActive,\n currentTransition: transition,\n interactionHookValue: resizeInteractionHook.interaction.value,\n targetOperation: \"resize\",\n }),\n onDirectionClick: handleDirectionalMovement,\n }\n : null,\n }}\n >\n {childrenRef.current}\n </ItemContext.Provider>\n </div>\n );\n\n return shouldUsePortal ? <div>{createPortal(content, document.body)}</div> : content;\n}\n"]}
@@ -1,12 +1,13 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_lljvd_1evk7_5",
5
- "inTransition": "awsui_inTransition_lljvd_1evk7_11",
6
- "transformed": "awsui_transformed_lljvd_1evk7_16",
7
- "removed": "awsui_removed_lljvd_1evk7_21",
8
- "dragged": "awsui_dragged_lljvd_1evk7_25",
9
- "resized": "awsui_resized_lljvd_1evk7_30",
10
- "hidden": "awsui_hidden_lljvd_1evk7_35"
4
+ "root": "awsui_root_lljvd_1y0lv_5",
5
+ "inTransition": "awsui_inTransition_lljvd_1y0lv_11",
6
+ "transformed": "awsui_transformed_lljvd_1y0lv_16",
7
+ "removed": "awsui_removed_lljvd_1y0lv_21",
8
+ "dragged": "awsui_dragged_lljvd_1y0lv_25",
9
+ "keyboardDragged": "awsui_keyboardDragged_lljvd_1y0lv_30",
10
+ "resized": "awsui_resized_lljvd_1y0lv_34",
11
+ "hidden": "awsui_hidden_lljvd_1y0lv_39"
11
12
  };
12
13
 
@@ -2,36 +2,40 @@
2
2
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- .awsui_root_lljvd_1evk7_5:not(#\9) {
5
+ .awsui_root_lljvd_1y0lv_5:not(#\9) {
6
6
  touch-action: none;
7
7
  position: relative;
8
8
  block-size: 100%;
9
9
  }
10
10
 
11
- .awsui_inTransition_lljvd_1evk7_11:not(#\9) {
11
+ .awsui_inTransition_lljvd_1y0lv_11:not(#\9) {
12
12
  transition: transform 200ms;
13
13
  transition-timing-function: ease;
14
14
  }
15
15
 
16
- .awsui_transformed_lljvd_1evk7_16:not(#\9) {
16
+ .awsui_transformed_lljvd_1y0lv_16:not(#\9) {
17
17
  position: absolute;
18
18
  z-index: 1;
19
19
  }
20
20
 
21
- .awsui_removed_lljvd_1evk7_21:not(#\9) {
21
+ .awsui_removed_lljvd_1y0lv_21:not(#\9) {
22
22
  display: none;
23
23
  }
24
24
 
25
- .awsui_dragged_lljvd_1evk7_25:not(#\9) {
25
+ .awsui_dragged_lljvd_1y0lv_25:not(#\9) {
26
26
  z-index: 2000;
27
27
  position: fixed;
28
28
  }
29
29
 
30
- .awsui_resized_lljvd_1evk7_30:not(#\9) {
30
+ .awsui_transformed_lljvd_1y0lv_16.awsui_keyboardDragged_lljvd_1y0lv_30:not(#\9) {
31
+ z-index: 2000;
32
+ }
33
+
34
+ .awsui_resized_lljvd_1y0lv_34:not(#\9) {
31
35
  z-index: 2000;
32
36
  position: absolute;
33
37
  }
34
38
 
35
- .awsui_hidden_lljvd_1evk7_35:not(#\9) {
39
+ .awsui_hidden_lljvd_1y0lv_39:not(#\9) {
36
40
  display: none;
37
41
  }
@@ -2,12 +2,13 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_lljvd_1evk7_5",
6
- "inTransition": "awsui_inTransition_lljvd_1evk7_11",
7
- "transformed": "awsui_transformed_lljvd_1evk7_16",
8
- "removed": "awsui_removed_lljvd_1evk7_21",
9
- "dragged": "awsui_dragged_lljvd_1evk7_25",
10
- "resized": "awsui_resized_lljvd_1evk7_30",
11
- "hidden": "awsui_hidden_lljvd_1evk7_35"
5
+ "root": "awsui_root_lljvd_1y0lv_5",
6
+ "inTransition": "awsui_inTransition_lljvd_1y0lv_11",
7
+ "transformed": "awsui_transformed_lljvd_1y0lv_16",
8
+ "removed": "awsui_removed_lljvd_1y0lv_21",
9
+ "dragged": "awsui_dragged_lljvd_1y0lv_25",
10
+ "keyboardDragged": "awsui_keyboardDragged_lljvd_1y0lv_30",
11
+ "resized": "awsui_resized_lljvd_1y0lv_34",
12
+ "hidden": "awsui_hidden_lljvd_1y0lv_39"
12
13
  };
13
14
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "0ce808bbc5a3eef2efef414a8c38643fc9abe981"
2
+ "commit": "219c2858472b58bc8f65baba70fe6d9d4fd976a7"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/board-components",
3
- "version": "3.0.123",
3
+ "version": "3.0.125",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudscape-design/board-components.git"
@@ -76,7 +76,7 @@
76
76
  "stylelint-config-recommended-scss": "^14.1.0",
77
77
  "stylelint-prettier": "^5.0.2",
78
78
  "typescript": "^4.9.4",
79
- "vite": "^6.3.6",
79
+ "vite": "^6.4.1",
80
80
  "vitest": "^3.2.4"
81
81
  },
82
82
  "//": "ensure that typedoc uses latest typescript. It prints a warning, but works",