@dxos/react-ui-mosaic 0.8.4-main.6fa680abb7 → 0.8.4-main.74a063c4e0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-75KCPN67.mjs → chunk-6R7CESWM.mjs} +209 -158
- package/dist/lib/browser/chunk-6R7CESWM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +46 -42
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/playwright/index.mjs +18 -8
- package/dist/lib/browser/playwright/index.mjs.map +3 -3
- package/dist/lib/browser/testing/index.mjs +13 -9
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-XYWWHOXN.mjs → chunk-U7G2WXDG.mjs} +209 -158
- package/dist/lib/node-esm/chunk-U7G2WXDG.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +46 -42
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/playwright/index.mjs +18 -8
- package/dist/lib/node-esm/playwright/index.mjs.map +3 -3
- package/dist/lib/node-esm/testing/index.mjs +13 -9
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/Board/Board.d.ts +13 -6
- package/dist/types/src/components/Board/Board.d.ts.map +1 -1
- package/dist/types/src/components/Board/Board.stories.d.ts +5 -5
- package/dist/types/src/components/Board/Board.stories.d.ts.map +1 -1
- package/dist/types/src/components/Board/Column.d.ts +16 -8
- package/dist/types/src/components/Board/Column.d.ts.map +1 -1
- package/dist/types/src/components/Board/Item.d.ts +3 -0
- package/dist/types/src/components/Board/Item.d.ts.map +1 -1
- package/dist/types/src/components/Focus/Focus.d.ts +1 -25
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Container.d.ts +17 -9
- package/dist/types/src/components/Mosaic/Container.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Mosaic.d.ts +16 -21
- package/dist/types/src/components/Mosaic/Mosaic.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Placeholder.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Stack.d.ts +6 -6
- package/dist/types/src/components/Mosaic/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Stack.stories.d.ts +11 -0
- package/dist/types/src/components/Mosaic/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Tile.d.ts +19 -9
- package/dist/types/src/components/Mosaic/Tile.d.ts.map +1 -1
- package/dist/types/src/hooks/useDefaultColumnEventHandler.d.ts.map +1 -1
- package/dist/types/src/playwright/board-manager.d.ts.map +1 -1
- package/dist/types/src/testing/DefaultStackTile.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -26
- package/src/AUDIT.md +106 -0
- package/src/components/Board/Board.stories.tsx +10 -11
- package/src/components/Board/Board.tsx +5 -7
- package/src/components/Board/Column.tsx +41 -40
- package/src/components/Board/Item.tsx +23 -24
- package/src/components/Focus/Focus.tsx +2 -102
- package/src/components/Mosaic/Container.tsx +46 -16
- package/src/components/Mosaic/Placeholder.tsx +1 -1
- package/src/components/Mosaic/Stack.stories.tsx +125 -69
- package/src/components/Mosaic/Stack.tsx +139 -50
- package/src/components/Mosaic/Tile.tsx +41 -34
- package/src/hooks/useContainerDebug.tsx +1 -1
- package/src/hooks/useDefaultColumnEventHandler.ts +0 -1
- package/src/playwright/board-manager.ts +18 -13
- package/src/playwright/smoke.spec.ts +10 -5
- package/src/testing/CardContainer.tsx +2 -2
- package/src/testing/DefaultStackTile.tsx +22 -19
- package/src/translations.ts +3 -3
- package/dist/lib/browser/chunk-75KCPN67.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XYWWHOXN.mjs.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useVisibleItems.ts", "../../../src/components/Focus/Focus.tsx", "../../../src/components/Mosaic/styles.ts", "../../../src/components/Mosaic/types.ts", "../../../src/components/Mosaic/Root.tsx", "../../../src/components/Mosaic/Container.tsx", "../../../src/components/Mosaic/Tile.tsx", "../../../src/components/Mosaic/Placeholder.tsx", "../../../src/components/Mosaic/Stack.tsx", "../../../src/components/Mosaic/Mosaic.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { type GetId, type MosaicTileData } from '../components';\n\nexport type UseVisibleItemsProps<TItem = any> = {\n /** Container id. */\n id: string;\n\n /** Current items. */\n items?: readonly TItem[] | TItem[];\n\n /** Currently dragging item. */\n dragging: MosaicTileData<TItem> | undefined;\n\n /** ID getter */\n getId: GetId<TItem>;\n};\n\n/**\n * Returns items with the dragging item removed.\n */\nexport const useVisibleItems = <TItem = any>({\n id,\n items,\n dragging,\n getId,\n}: UseVisibleItemsProps<TItem>): readonly TItem[] | TItem[] => {\n const visibleItems = useMemo(() => {\n if (!items || !dragging || id !== dragging.containerId) {\n return items ?? [];\n }\n\n const idx = items.findIndex((item) => getId(item) === dragging.id);\n if (idx === -1) {\n return items;\n }\n\n const visibleItems = items.slice();\n visibleItems.splice(idx, 1);\n return visibleItems;\n }, [id, items, dragging, getId]);\n\n return visibleItems;\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// Re-export from @dxos/react-ui.\nexport { Focus, useFocus, type FocusGroupProps, type FocusItemProps } from '@dxos/react-ui';\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { type ClassNameValue } from '@dxos/react-ui';\n\nexport const styles = {\n placeholder: {\n root: [\n 'group opacity-0',\n 'group-data-[mosaic-debug=\"true\"]:opacity-100',\n 'group-data-[mosaic-debug=\"true\"]:bg-orange-500',\n 'data-[mosaic-placeholder-state=active]:opacity-100',\n 'data-[mosaic-placeholder-orientation=vertical]:snap-start', // TODO(burdon): Option.\n 'data-[mosaic-placeholder-orientation=vertical]:py-1',\n 'data-[mosaic-placeholder-orientation=vertical]:data-[mosaic-placeholder-state=active]:py-2.5',\n 'data-[mosaic-placeholder-orientation=horizontal]:px-1',\n 'data-[mosaic-placeholder-orientation=horizontal]:data-[mosaic-placeholder-state=active]:px-2.5',\n ],\n content: [\n 'transition-all duration-0',\n // TODO(burdon): Don't animate open if placeholder is the source.\n // TODO(burdon): Flickers when start to drag since source is removed and then the placeholder shows up.\n // - Use absolute positioning?\n // 'group-data-[mosaic-placeholder-state=active]:duration-200',\n 'group-data-[mosaic-placeholder-orientation=vertical]:h-0',\n 'group-data-[mosaic-placeholder-orientation=vertical]:group-data-[mosaic-placeholder-state=active]:h-[var(--mosaic-placeholder-height)]',\n 'group-data-[mosaic-placeholder-orientation=horizontal]:w-0',\n 'group-data-[mosaic-placeholder-orientation=horizontal]:group-data-[mosaic-placeholder-state=active]:w-[var(--mosaic-placeholder-width)]',\n ],\n },\n} satisfies Record<string, Record<string, ClassNameValue>>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\n\nexport type GetId<TData = any> = (data: TData) => string;\n\n/**\n * NOTE: Must implement value equivalence.\n */\nexport type LocationType = string | number;\n\n/**\n * Get the source data from the drag payload.\n */\nexport const getSourceData = <TData = any, TLocation = any>(\n source: ElementDragPayload,\n): MosaicTileData<TData, TLocation> | null => {\n return source.data.type === 'tile' ? (source.data as MosaicTileData<TData, TLocation>) : null;\n};\n\n/**\n * Draggable item.\n * Tiles may contain arbitrary data (which may not be an ECHO object; e.g., search result).\n */\nexport type MosaicTileData<TData = any, TLocation = any> = {\n type: 'tile';\n containerId: string;\n id: string;\n data: TData;\n location: TLocation;\n bounds?: DOMRect;\n};\n\n/**\n * Drop target placeholder.\n */\nexport type MosaicPlaceholderData<TLocation = any> = {\n type: 'placeholder';\n containerId: string;\n location: TLocation;\n};\n\n/**\n * Drop target container.\n */\nexport type MosaicContainerData = {\n type: 'container';\n id: string;\n};\n\nexport type MosaicData = MosaicTileData | MosaicPlaceholderData | MosaicContainerData;\n\nexport type MosaicTargetData = MosaicTileData | MosaicPlaceholderData;\n\n/**\n * Handler implemented by drop containers.\n */\nexport interface MosaicEventHandler<TData = any, TObject = any> {\n /**\n * Container identifier.\n */\n id: string;\n\n /**\n * Determine if the item can be dropped into this container.\n * NOTE: This is continuously called while dragging (doesn't require mouse movement).\n */\n canDrop?: (props: { source: MosaicTileData<TData> }) => boolean;\n\n /**\n * Called during drag for custom visualization.\n */\n onDrag?: (props: { source: MosaicTileData<TData>; position: { x: number; y: number } }) => void;\n\n /**\n * Insert/rearrange the item at the given location.\n */\n onDrop?: (props: { source: MosaicTileData<TData>; target?: MosaicData }) => void;\n\n /**\n * Request the object to be dropped.\n * This allows the source container to clone/mutate/swap the object before it is dropped.\n * If the callback returns true, then the callback may decide to remove the item from the source container,\n * completing the transfer.\n */\n onTake?: (props: { source: MosaicTileData<TData> }, cb: (object: TObject) => Promise<boolean>) => void;\n\n /**\n * Dragging ended.\n */\n onCancel?: () => void;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';\nimport { type ElementDragPayload, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { type DragLocationHistory } from '@atlaskit/pragmatic-drag-and-drop/types';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { type PropsWithChildren, forwardRef, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { log } from '@dxos/log';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { type MosaicData, type MosaicEventHandler, type MosaicTileData } from './types';\n\n//\n// Context\n//\n\ntype MosaicDraggingSource = {\n data: MosaicTileData;\n handler?: MosaicEventHandler;\n container?: Element;\n};\n\ntype MosaicDraggingTarget = {\n data: MosaicData;\n handler?: MosaicEventHandler;\n};\n\ntype MosaicDraggingState = {\n source: MosaicDraggingSource;\n target?: MosaicDraggingTarget;\n};\n\ntype MosaicRootContextValue = {\n containers: Record<string, MosaicEventHandler>;\n addContainer: (container: MosaicEventHandler) => void;\n removeContainer: (id: string) => void;\n dragging?: MosaicDraggingState;\n};\n\nconst [MosaicRootContextProvider, useMosaicRootContext] = createContext<MosaicRootContextValue>('MosaicRoot');\n\n//\n// Root\n//\n\nconst MOSAIC_ROOT_NAME = 'Mosaic.Root';\n\n// State attribute: [&:has(>_[data-mosaic-debug=true])]\nconst MOSAIC_ROOT_DEBUG_ATTR = 'mosaic-debug';\n\ntype MosaicRootProps = ThemedClassName<\n PropsWithChildren<{\n asChild?: boolean;\n debug?: boolean;\n }>\n>;\n\nconst MosaicRoot = forwardRef<HTMLDivElement, MosaicRootProps>(\n ({ classNames, children, asChild, debug }, forwardedRef) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs<HTMLDivElement>(rootRef, forwardedRef);\n const Comp = asChild ? Slot : Primitive.div;\n\n const [handlers, setHandlers] = useState<Record<string, MosaicEventHandler>>({});\n const [dragging, setDragging] = useState<MosaicDraggingState | undefined>();\n\n const getSourceHandler = useCallback(\n (source: ElementDragPayload): { data: MosaicTileData; handler?: MosaicEventHandler } => {\n const data = source.data as MosaicTileData;\n return { data, handler: handlers[data.containerId] };\n },\n [handlers],\n );\n\n const getTargetHandler = useCallback(\n (location: DragLocationHistory): { data?: MosaicData; handler?: MosaicEventHandler } => {\n for (const target of location.current.dropTargets) {\n const data = target.data as MosaicData;\n let containerId: string;\n switch (data.type) {\n case 'tile':\n case 'placeholder':\n containerId = data.containerId;\n break;\n case 'container':\n containerId = data.id;\n break;\n }\n\n const handler = handlers[containerId];\n if (handler) {\n return { data, handler };\n }\n }\n\n return {};\n },\n [handlers],\n );\n\n useEffect(() => {\n const handleChange = ({ source, location }: { source: ElementDragPayload; location: DragLocationHistory }) => {\n const { data: sourceData } = getSourceHandler(source);\n const { data: targetData, handler } = getTargetHandler(location);\n setDragging((dragging) => {\n dragging?.target?.handler?.onCancel?.();\n return {\n source: {\n data: sourceData,\n handler: handlers[sourceData.containerId],\n // TOOD(burdon): Check id matches.\n container: location.initial.dropTargets.find((target) => target.data.type === 'container')?.element,\n },\n target: targetData && {\n data: targetData,\n handler,\n },\n };\n });\n };\n\n const handleCancel = () => {\n setDragging((dragging) => {\n requestAnimationFrame(() => {\n dragging?.target?.handler?.onCancel?.();\n dragging?.source?.container?.dispatchEvent(new CustomEvent('dnd:cancel', { bubbles: true }));\n });\n\n return undefined;\n });\n };\n\n let noTargetTimeout: NodeJS.Timeout;\n\n // Main controller.\n return combine(\n monitorForElements({\n /**\n * Dragging started within any container.\n */\n onDragStart: ({ source, location }) => {\n log('Root.onDragStart', {\n source: source.data,\n location: location.current.dropTargets.map((target) => target.data),\n });\n\n handleChange({ source, location });\n },\n\n /**\n * Dragging entered a new container.\n */\n onDropTargetChange: ({ source, location }) => {\n clearTimeout(noTargetTimeout);\n log('Root.onDropTargetChange', {\n source: source.data,\n location: location.current.dropTargets.map((target) => target.data),\n });\n\n // Stop dragging if there are no drop targets (or we are cancelling).\n if (location.current.dropTargets.length === 0) {\n noTargetTimeout = setTimeout(() => setDragging(undefined), 1_000);\n } else {\n handleChange({ source, location });\n }\n },\n\n /**\n * Dragging within any container.\n */\n onDrag: ({ source, location }) => {\n const { data } = getSourceHandler(source);\n const { handler } = getTargetHandler(location);\n if (handler) {\n const { clientX: x, clientY: y } = location.current.input;\n handler.onDrag?.({ source: data, position: { x, y } });\n }\n },\n\n /**\n * Dragging ended.\n */\n onDrop: ({ source, location }) => {\n log.info('Root.onDrop', {\n source: source.data,\n location: location.current.dropTargets.map((target) => target.data),\n });\n\n // Get the source container.\n const { data: sourceData, handler: sourceHandler } = getSourceHandler(source);\n if (!sourceHandler) {\n log.warn('invalid source', {\n source: sourceData,\n handlers: Object.keys(handlers),\n });\n return;\n }\n\n // NOTE: When dragging is cancelled (e.g., user presses ESC) onDrop is only called after a subsequent event.\n // NOTE: pDND blocks ESC event propagation while dragging.\n // - ESC only flips internal state.\n // - Completion happens on the next processed input event.\n // - This avoids reentrancy and keeps pointer/keyboard behavior consistent.\n // - We set dragging to undefined in onDropTargetChange after a delay if there are no drop targets.\n try {\n if (location.current.dropTargets.length === 0) {\n log.info('cancelled');\n } else {\n // Get the target container.\n const { data: targetData, handler: targetHandler } = getTargetHandler(location);\n if (!targetHandler) {\n log.warn('invalid target', {\n source: sourceData,\n location,\n handlers: Object.keys(handlers),\n });\n return;\n }\n\n // TODO(burdon): Check object doesn't already exist in the collection.\n if (sourceHandler === targetHandler) {\n targetHandler.onDrop?.({\n source: sourceData,\n target: targetData,\n });\n } else {\n if (!sourceHandler.onTake) {\n log.warn('invalid source', { source: sourceData });\n return;\n }\n\n sourceHandler.onTake?.({ source: sourceData }, async (object) => {\n targetHandler.onDrop?.({\n source: { ...sourceData, data: object },\n target: targetData,\n });\n\n return true;\n });\n }\n }\n } finally {\n handleCancel();\n }\n },\n }),\n );\n }, [handlers, getSourceHandler, getTargetHandler]);\n\n return (\n <MosaicRootContextProvider\n containers={handlers}\n addContainer={(container) =>\n setHandlers((containers) => ({\n ...containers,\n [container.id]: container,\n }))\n }\n removeContainer={(id) =>\n setHandlers((containers) => {\n delete containers[id];\n return { ...containers };\n })\n }\n dragging={dragging}\n >\n <Comp\n className={mx('group', classNames)}\n {...{\n [`data-${MOSAIC_ROOT_DEBUG_ATTR}`]: debug,\n }}\n ref={composedRef}\n >\n {children}\n </Comp>\n </MosaicRootContextProvider>\n );\n },\n);\n\nMosaicRoot.displayName = MOSAIC_ROOT_NAME;\n\nexport { MosaicRoot, useMosaicRootContext };\n\nexport type { MosaicRootProps, MosaicDraggingState };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';\nimport { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';\nimport { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport { bind } from 'bind-event-listener';\nimport React, {\n type CSSProperties,\n type PropsWithChildren,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type AllowedAxis } from '@dxos/react-ui';\nimport { composable, composableProps, mx } from '@dxos/ui-theme';\nimport { isTruthy } from '@dxos/util';\n\nimport { useFocus } from '../Focus';\nimport { type MosaicDraggingState, useMosaicRootContext } from './Root';\nimport {\n type LocationType,\n type MosaicContainerData,\n type MosaicEventHandler,\n type MosaicTileData,\n getSourceData,\n} from './types';\n\n//\n// Container\n//\n\nconst MOSAIC_CONTAINER_NAME = 'Mosaic.Container';\n\ntype MosaicContainerState = { type: 'idle' } | { type: 'active'; bounds?: DOMRect };\n\ntype MosaicContainerContextValue<TData = any, Location = LocationType> = {\n id: string;\n eventHandler: MosaicEventHandler<TData>;\n orientation?: AllowedAxis;\n dragging?: MosaicDraggingState;\n scrolling?: boolean;\n state: MosaicContainerState;\n\n /** Active drop location. */\n activeLocation?: Location;\n setActiveLocation: (location: Location | undefined) => void;\n\n /** ID of the current (aria-current) item. */\n currentId?: string;\n /** Set the current item by ID. */\n setCurrentId: (id: string | undefined) => void;\n\n /** Register a scroll-to-item callback (provided by Stack/VirtualStack). */\n registerScrollTo: (fn: ((id: string) => void) | undefined) => void;\n};\n\nconst [MosaicContainerContextProvider, useMosaicContainerContext] =\n createContext<MosaicContainerContextValue>('MosaicContainer');\n\n// State attribute: [&:has(>_[data-mosaic-container-state=active])]\nconst MOSAIC_CONTAINER_STATE_ATTR = 'mosaic-container-state';\n\n// CSS variables: [var(--mosaic-placeholder-xxx)]\nconst MOSAIC_CONTAINER_PLACEHOLDER_WIDTH = '--mosaic-placeholder-width';\nconst MOSAIC_CONTAINER_PLACEHOLDER_HEIGHT = '--mosaic-placeholder-height';\n\nlet counter = 0;\n\ntype MosaicContainerProps = PropsWithChildren<\n Partial<Pick<MosaicContainerContextValue, 'eventHandler' | 'orientation'>> & {\n asChild?: boolean;\n /** Support autoscrolling container when dragging. */\n autoScroll?: HTMLElement | null;\n withFocus?: boolean;\n /** Controlled current-item ID. */\n currentId?: string;\n /** Called when a tile requests to become current. */\n onCurrentChange?: (id: string | undefined) => void;\n debug?: () => ReactNode;\n }\n>;\n\n// TODO(burdon): Make generic.\nconst MosaicContainer = composable<HTMLDivElement, MosaicContainerProps>(\n (\n {\n children,\n eventHandler: eventHandlerProp,\n orientation = 'vertical',\n asChild,\n autoScroll: autoscrollElement,\n withFocus,\n currentId,\n onCurrentChange,\n debug,\n ...props\n },\n forwardedRef,\n ) => {\n const { className, ...rest } = composableProps(props);\n const Comp = asChild ? Slot : Primitive.div;\n const rootRef = useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs<HTMLDivElement>(rootRef, forwardedRef);\n\n // Handler.\n const eventHandler = useMemo(\n () =>\n eventHandlerProp ?? {\n id: `mosaic-container-${counter++}`,\n },\n [eventHandlerProp],\n );\n\n // State.\n const { dragging } = useMosaicRootContext(MOSAIC_CONTAINER_NAME);\n const [state, setState] = useState<MosaicContainerState>({ type: 'idle' });\n const [activeLocation, setActiveLocation] = useState<LocationType | undefined>();\n const [scrolling, setScrolling] = useState(false);\n const setCurrentId = useCallback((id: string | undefined) => onCurrentChange?.(id), [onCurrentChange]);\n\n // Scroll-to-item: Stack/VirtualStack registers its implementation.\n const scrollToRef = useRef<((id: string) => void) | undefined>(undefined);\n const registerScrollTo = useCallback((fn: ((id: string) => void) | undefined) => {\n scrollToRef.current = fn;\n }, []);\n\n // When currentId changes, scroll the matching item into view.\n useEffect(() => {\n if (currentId) {\n scrollToRef.current?.(currentId);\n }\n }, [currentId]);\n\n // Focus container.\n const { setFocus } = useFocus();\n useEffect(() => {\n if (withFocus) {\n setFocus?.(state.type === 'active' ? 'active' : undefined);\n }\n }, [setFocus, withFocus, state]);\n\n // Register handler.\n const { addContainer, removeContainer } = useMosaicRootContext(eventHandler.id);\n useEffect(() => {\n addContainer(eventHandler);\n return () => removeContainer(eventHandler.id);\n }, [eventHandler]);\n\n const data = useMemo<MosaicContainerData>(\n () =>\n ({\n type: 'container',\n id: eventHandler.id,\n }) satisfies MosaicContainerData,\n [eventHandler.id],\n );\n\n useEffect(() => {\n if (!rootRef.current) {\n return;\n }\n\n // Determine if scrolling (pause drag/drop handlers).\n let timeout: ReturnType<typeof setTimeout>;\n const handleScroll = () => {\n setScrolling(true);\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n setScrolling(false);\n }, 500);\n };\n\n return combine(\n ...[\n /**\n * Custom event for dragging cancellation.\n */\n bind(rootRef.current, {\n type: 'dnd:cancel',\n listener: () => {\n setState({ type: 'idle' });\n },\n }),\n\n // Target.\n dropTargetForElements({\n element: rootRef.current,\n getData: () => data,\n\n /**\n * Test if permitted to drop here.\n * NOTE: Contained Tile and Placeholder elements do the same.\n */\n canDrop: ({ source }) => {\n const data = getSourceData(source);\n return (data && eventHandler.canDrop?.({ source: data })) || false;\n },\n\n // TODO(burdon): Provide semantic intent to onDrop.\n // getDropEffect: () => {\n // return 'move';\n // },\n\n /**\n * Dragging started in this container.\n */\n onDragStart: ({ source }) => {\n const sourceData = source.data as MosaicTileData;\n setState({ type: 'active', bounds: sourceData.bounds });\n },\n /**\n * Dragging entered this container.\n */\n onDragEnter: ({ source }) => {\n const sourceData = source.data as MosaicTileData;\n setState({ type: 'active', bounds: sourceData.bounds });\n },\n /**\n * Dragging left this container.\n * NOTE: If the container isn't full-height, then when the dragged item is temporarily removed the container will shrink,\n * triggering `onDragLeave`, which then causes the item to be added and removed continually (flickering).\n */\n onDragLeave: ({ source }) => {\n const sourceData = source.data as MosaicTileData;\n if (sourceData.containerId !== eventHandler.id) {\n setState({ type: 'idle' });\n }\n },\n /**\n * Dropped in this container.\n */\n onDrop: () => {\n setState({ type: 'idle' });\n },\n }),\n\n // Autoscroll.\n // NOTE: When used with Scrollable we get a spurious warning (in dev mode).\n // \"Auto scrolling has been attached to an element that appears not to be scrollable.\"\n autoscrollElement && [\n autoScrollForElements({\n element: autoscrollElement,\n // canScroll: ({ element: _ }) => {\n // return true;\n // },\n getAllowedAxis: () => orientation,\n getConfiguration: () => ({\n maxScrollSpeed: 'fast',\n }),\n }),\n\n bind(autoscrollElement, {\n type: 'scroll',\n listener: handleScroll,\n }),\n\n () => setScrolling(false),\n ],\n ]\n .filter(isTruthy)\n .flatMap((x) => x),\n );\n }, [rootRef, eventHandler, data, autoscrollElement]);\n\n return (\n <MosaicContainerContextProvider\n id={eventHandler.id}\n eventHandler={eventHandler}\n orientation={orientation}\n state={state}\n dragging={state.type === 'active' ? dragging : undefined}\n scrolling={scrolling}\n activeLocation={activeLocation}\n setActiveLocation={setActiveLocation}\n currentId={currentId}\n setCurrentId={setCurrentId}\n registerScrollTo={registerScrollTo}\n >\n <Comp\n className={mx('h-full', className)}\n style={\n {\n [MOSAIC_CONTAINER_PLACEHOLDER_WIDTH]:\n state.type === 'active' && state.bounds ? `${state.bounds.width}px` : '0px',\n [MOSAIC_CONTAINER_PLACEHOLDER_HEIGHT]:\n state.type === 'active' && state.bounds ? `${state.bounds.height}px` : '0px',\n } as CSSProperties\n }\n {...rest}\n {...{\n [`data-${MOSAIC_CONTAINER_STATE_ATTR}`]: state.type,\n }}\n ref={composedRef}\n >\n {children}\n </Comp>\n {debug?.()}\n </MosaicContainerContextProvider>\n );\n },\n);\n\nMosaicContainer.displayName = MOSAIC_CONTAINER_NAME;\n\nexport { MosaicContainer, useMosaicContainerContext };\n\nexport type { MosaicContainerProps, MosaicContainerState };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n type Edge,\n attachClosestEdge,\n extractClosestEdge,\n} from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\nimport { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';\nimport {\n type ElementDragPayload,\n draggable,\n dropTargetForElements,\n} from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { preserveOffsetOnSource } from '@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source';\nimport { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';\nimport { type DropTargetRecord } from '@atlaskit/pragmatic-drag-and-drop/types';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { type PropsWithChildren, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { composableProps, slottable } from '@dxos/ui-theme';\n\nimport { useMosaicContainerContext } from './Container';\nimport { type LocationType, type MosaicTileData, getSourceData } from './types';\n\n//\n// Tile\n//\n\nconst MOSAIC_TILE_NAME = 'Mosaic.Tile';\n\ntype MosaicTileState =\n | { type: 'idle' }\n | { type: 'preview'; container: HTMLElement; rect: DOMRect }\n | { type: 'dragging' }\n | { type: 'target'; closestEdge: Edge | null };\n\ntype MosaicTileContextValue = {\n state: MosaicTileState;\n};\n\nconst [MosaicTileContextProvider, useMosaicTileContext] = createContext<MosaicTileContextValue>('MosaicTile');\n\n// State attribute: data-[mosaic-tile-state=dragging]\nconst MOSAIC_TILE_STATE_ATTR = 'mosaic-tile-state';\n\ntype MosaicTileProps<TData = any, TLocation = LocationType> = ThemedClassName<\n PropsWithChildren<{\n className?: string;\n dragHandle?: HTMLElement | null;\n allowedEdges?: Edge[];\n id: string;\n data: TData;\n location: TLocation;\n draggable?: boolean;\n /** Whether this tile is the current (aria-current) item. */\n current?: boolean;\n debug?: boolean;\n }>\n>;\n\nconst MosaicTile = slottable<HTMLDivElement, MosaicTileProps>(\n (\n {\n children,\n asChild,\n dragHandle,\n allowedEdges: allowedEdgesProp,\n location,\n id,\n data: dataProp,\n draggable: draggableProp,\n current: _current,\n debug: _,\n ...props\n },\n forwardedRef,\n ) => {\n const Comp = asChild ? Slot : Primitive.div;\n const rootRef = useRef<HTMLDivElement>(null);\n const composedRef = composeRefs<HTMLDivElement>(rootRef, forwardedRef);\n\n // State.\n const {\n id: containerId,\n eventHandler,\n orientation,\n scrolling,\n setActiveLocation,\n } = useMosaicContainerContext(MOSAIC_TILE_NAME);\n const [state, setState] = useState<MosaicTileState>({ type: 'idle' });\n\n const allowedEdges = useMemo<Edge[]>(\n () => allowedEdgesProp || (orientation === 'vertical' ? ['top', 'bottom'] : ['left', 'right']),\n [allowedEdgesProp, orientation],\n );\n\n const data = useMemo<MosaicTileData>(\n () =>\n ({\n type: 'tile',\n id,\n containerId,\n data: dataProp,\n location,\n }) satisfies MosaicTileData,\n [containerId, location, dataProp],\n );\n\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!draggableProp || !root || !containerId || scrolling) {\n return;\n }\n\n const handleChange = ({ self, source }: { self: DropTargetRecord; source: ElementDragPayload }) => {\n if (source.data.id !== dataProp.id) {\n const closestEdge = extractClosestEdge(self.data);\n const location = data.location + (closestEdge === 'top' || closestEdge === 'left' ? -0.5 : 0.5);\n setActiveLocation(location);\n setState({ type: 'target', closestEdge });\n }\n };\n\n return combine(\n // Source.\n draggable({\n element: root,\n dragHandle: dragHandle && state.type !== 'preview' ? dragHandle : undefined,\n canDrag: () => true,\n getInitialData: () => data,\n onGenerateDragPreview: ({ location, nativeSetDragImage }) => {\n setCustomNativeDragPreview({\n nativeSetDragImage,\n getOffset: preserveOffsetOnSource({\n element: root,\n input: location.current.input,\n }),\n render: ({ container }) => {\n data.bounds = root.getBoundingClientRect();\n setState({\n type: 'preview',\n container,\n rect: root.getBoundingClientRect(),\n });\n return () => setState({ type: 'dragging' });\n },\n });\n },\n\n onDragStart: () => {\n setState({ type: 'dragging' });\n },\n onDrop: () => {\n setState({ type: 'idle' });\n },\n }),\n\n // Target.\n dropTargetForElements({\n element: root,\n getData: ({ input, element }) => attachClosestEdge(data, { input, element, allowedEdges }),\n canDrop: ({ source }) => {\n const data = getSourceData(source);\n return (data && eventHandler.canDrop?.({ source: data })) || false;\n },\n onDragEnter: ({ self, source }) => {\n handleChange({ self, source });\n },\n onDragLeave: () => {\n setState({ type: 'idle' });\n setActiveLocation(undefined);\n },\n onDrag: ({ self, source }) => {\n handleChange({ self, source });\n },\n onDrop: () => {\n setState({ type: 'idle' });\n setActiveLocation(undefined);\n },\n }),\n );\n }, [\n rootRef,\n forwardedRef,\n containerId,\n dragHandle,\n eventHandler,\n data,\n scrolling,\n allowedEdges,\n setActiveLocation,\n ]);\n\n const { className, ...rest } = composableProps(props, { classNames: 'relative outline-none' });\n\n // NOTE: Ensure no gaps between cells (prevent drop indicators flickering).\n // NOTE: Ensure padding doesn't change position of cursor when dragging (no margins).\n return (\n <MosaicTileContextProvider state={state}>\n <Comp\n {...rest}\n {...{\n 'data-mosaic-tile-id': id,\n [`data-${MOSAIC_TILE_STATE_ATTR}`]: state.type,\n }}\n role='listitem'\n className={className}\n ref={composedRef}\n >\n {children}\n </Comp>\n\n {/* Dragging preview. */}\n {state.type === 'preview' &&\n createPortal(\n <Comp\n {...{\n // NOTE: Use to control appearance while dragging.\n [`data-${MOSAIC_TILE_STATE_ATTR}`]: state.type,\n }}\n className={className}\n style={{\n width: `${state.rect.width}px`,\n height: `${state.rect.height}px`,\n }}\n >\n {children}\n </Comp>,\n state.container,\n )}\n </MosaicTileContextProvider>\n );\n },\n);\n\nMosaicTile.displayName = MOSAIC_TILE_NAME;\n\nexport { MosaicTile, useMosaicTileContext };\n\nexport type { MosaicTileProps, MosaicTileState };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n DropIndicator as NaturalDropIndicator,\n type DropIndicatorProps as NaturalDropIndicatorProps,\n} from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';\nimport { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { type PropsWithChildren, useLayoutEffect, useMemo, useRef } from 'react';\n\nimport { type Axis, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { useMosaicContainerContext } from './Container';\nimport { useMosaicTileContext } from './Tile';\nimport { type LocationType, type MosaicPlaceholderData, getSourceData } from './types';\n\n//\n// Placeholder\n//\n\nconst MOSAIC_PLACEHOLDER_NAME = 'Mosaic.Placeholder';\n\n// Orientation: data-[mosaic-placeholder-orientation=vertical]\nconst MOSAIC_PLACEHOLDER_ORIENTATION_ATTR = 'mosaic-placeholder-orientation';\n\n// State attribute: data-[mosaic-placeholder-state=active]\nconst MOSAIC_PLACEHOLDER_STATE_ATTR = 'mosaic-placeholder-state';\n\ntype MosaicPlaceholderProps<Location = LocationType> = ThemedClassName<\n PropsWithChildren<{\n asChild?: boolean;\n orientation?: Axis;\n location: Location;\n }>\n>;\n\nconst MosaicPlaceholder = <Location extends LocationType = LocationType>({\n classNames,\n children,\n asChild,\n orientation = 'vertical',\n location,\n}: MosaicPlaceholderProps<Location>) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const Comp = asChild ? Slot : Primitive.div;\n const {\n id: containerId,\n eventHandler,\n scrolling,\n activeLocation,\n setActiveLocation,\n } = useMosaicContainerContext(MOSAIC_PLACEHOLDER_NAME);\n const data = useMemo<MosaicPlaceholderData<Location>>(\n () =>\n ({\n type: 'placeholder',\n containerId,\n location,\n }) satisfies MosaicPlaceholderData<Location>,\n [containerId, location],\n );\n\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root || scrolling) {\n return;\n }\n\n return dropTargetForElements({\n element: root,\n getData: () => data,\n canDrop: ({ source }) => {\n const data = getSourceData(source);\n return (data && eventHandler.canDrop?.({ source: data })) || false;\n },\n onDragEnter: () => {\n setActiveLocation(data.location);\n },\n onDragLeave: () => {\n setActiveLocation(undefined);\n },\n onDrop: () => {\n setActiveLocation(undefined);\n },\n });\n }, [rootRef, data, scrolling, setActiveLocation]);\n\n return (\n <Comp\n {...{\n [`data-${MOSAIC_PLACEHOLDER_ORIENTATION_ATTR}`]: orientation,\n [`data-${MOSAIC_PLACEHOLDER_STATE_ATTR}`]: data.location === activeLocation ? 'active' : 'idle',\n }}\n role='none'\n className={mx('relative', classNames)}\n ref={rootRef}\n >\n {children}\n </Comp>\n );\n};\n\nMosaicPlaceholder.displayName = MOSAIC_PLACEHOLDER_NAME;\n\n//\n// DropIndicator\n// TODO(burdon): Support DropIndicator or Placeholder variants.\n//\n\nconst DROP_INDICATOR_NAME = 'Mosaic.DropIndicator';\n\ntype MosaicDropIndicatorProps = Omit<NaturalDropIndicatorProps, 'edge'>;\n\nconst MosaicDropIndicator = (props: MosaicDropIndicatorProps) => {\n const { state } = useMosaicTileContext(DROP_INDICATOR_NAME);\n return state.type === 'target' && state.closestEdge ? (\n <NaturalDropIndicator {...props} edge={state.closestEdge} />\n ) : null;\n};\n\nMosaicDropIndicator.displayName = DROP_INDICATOR_NAME;\n\n//\n// Exports\n//\n\nexport { MosaicPlaceholder, MosaicDropIndicator };\n\nexport type { MosaicPlaceholderProps, MosaicDropIndicatorProps };\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { type ReactVirtualizerOptions, useVirtualizer } from '@tanstack/react-virtual';\nimport React, {\n type FC,\n forwardRef,\n Fragment,\n type ReactElement,\n type Ref,\n useCallback,\n useEffect,\n useRef,\n} from 'react';\n\nimport { invariant } from '@dxos/invariant';\nimport { type Axis, type ThemedClassName } from '@dxos/react-ui';\nimport { composable, composableProps, mx } from '@dxos/ui-theme';\n\nimport { useVisibleItems } from '../../hooks';\nimport { useMosaicContainerContext } from './Container';\nimport { MosaicPlaceholder, type MosaicPlaceholderProps } from './Placeholder';\nimport { styles } from './styles';\nimport { type MosaicTileProps } from './Tile';\nimport { type GetId } from './types';\n\n//\n// Mosaic Drag-and-drop\n//\n// Drop targets:\n// - Placeholders exist to allow gaps but prevent deadspace when dragging within a container.\n// - When dragging over a Tile, the placeholder next to the closest edge is activated.\n// - Placeholders expand when active; event handlers are disabled while the container is scrolling.\n//\n// [Container]\n// - [Placeholder 0.5]\n// - [Tile 1 ]\n// - [Placeholder 1.5]\n// - [Tile 2 ]\n// - [Placeholder 2.5]\n// - [Tile 3 ]\n// - [Placeholder 3.5]\n//\n// Implementation Notes\n// - We use [Radix composition](https://www.radix-ui.com/primitives/docs/guides/composition) to factor out composible aspects (e.g., Focus, Mosaic, etc.)\n// - NOTE: Use Slottable only if needed to disambiguate; otherwise a suspected Radix bug causes compositional problems.\n\nconst MOSAIC_STACK_NAME = 'MosaicStack';\n\ntype MosaicStackTileComponent<TData = any> = FC<MosaicTileProps<TData>>;\n\ntype MosaicStackProps<TData = any> = ThemedClassName<\n {\n role?: string;\n getId: GetId<TData>;\n orientation?: Axis;\n items?: readonly TData[];\n Tile: MosaicStackTileComponent<TData>;\n } & Pick<MosaicTileProps<TData>, 'draggable' | 'debug'>\n>;\n\n/**\n * Linear layout of Mosaic tiles.\n * NOTE: This is a low-level component and should be wrapped by a scrollable container.\n */\nconst MosaicStackInner = composable<HTMLDivElement, MosaicStackProps>(\n (\n { getId, orientation: orientationProp = 'vertical', items, Tile, draggable = true, debug, ...props },\n forwardedRef,\n ) => {\n invariant(Tile);\n const {\n id,\n orientation = orientationProp,\n dragging,\n currentId,\n registerScrollTo,\n } = useMosaicContainerContext(MOSAIC_STACK_NAME);\n const visibleItems = useVisibleItems({ id, items, dragging: dragging?.source.data, getId });\n invariant(orientation === 'vertical' || orientation === 'horizontal', `Invalid orientation: ${orientation}`);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const scrollToId = useCallback((targetId: string) => {\n const el = rootRef.current?.querySelector<HTMLElement>(`[data-mosaic-tile-id=\"${CSS.escape(targetId)}\"]`);\n el?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }, []);\n\n useEffect(() => {\n registerScrollTo(scrollToId);\n return () => registerScrollTo(undefined);\n }, [registerScrollTo, scrollToId]);\n\n const composedRef = useComposedRefs(rootRef, forwardedRef);\n return (\n <div\n {...composableProps(props, {\n role: 'list',\n classNames: [\n 'flex',\n orientation === 'horizontal' && 'h-full [&>*]:shrink-0',\n orientation === 'vertical' && 'flex-col',\n ],\n })}\n ref={composedRef}\n >\n {draggable && <InternalPlaceholder orientation={orientation} location={0.5} />}\n {visibleItems?.map((item, index) => (\n <Fragment key={getId(item)}>\n <Tile\n id={getId(item)}\n data={item}\n location={index + 1}\n draggable={draggable}\n current={getId(item) === currentId}\n debug={debug}\n />\n {draggable && <InternalPlaceholder orientation={orientation} location={index + 1.5} />}\n </Fragment>\n ))}\n </div>\n );\n },\n);\n\nMosaicStackInner.displayName = MOSAIC_STACK_NAME;\n\nconst MosaicStack = MosaicStackInner as <TData = any>(\n props: MosaicStackProps<TData> & { ref?: Ref<HTMLDivElement> },\n) => ReactElement;\n\n//\n// VirtualStack\n//\n\nconst MOSAIC_VIRTUAL_STACK_NAME = 'MosaicVirtualStack';\n\ntype MosaicVirtualStackProps<TData = any> = MosaicStackProps<TData> &\n Pick<\n ReactVirtualizerOptions<HTMLElement, HTMLDivElement>,\n 'estimateSize' | 'gap' | 'getScrollElement' | 'overscan' | 'onChange'\n >;\n\nconst MosaicVirtualStackInner = forwardRef<HTMLDivElement, MosaicVirtualStackProps>(\n (\n {\n orientation = 'vertical',\n items,\n getId,\n Tile,\n estimateSize,\n getScrollElement,\n overscan = 8,\n gap,\n onChange,\n draggable = true,\n debug,\n ...props\n },\n forwardedRef,\n ) => {\n invariant(Tile);\n const { id, dragging, currentId, registerScrollTo } = useMosaicContainerContext(MOSAIC_VIRTUAL_STACK_NAME);\n const visibleItems = useVisibleItems({ id, items, dragging: dragging?.source.data, getId });\n // In draggable mode virtual indices alternate: even=placeholder, odd=tile.\n // Wrap estimateSize so placeholders get 0 (their actual negligible height) and\n // tile slots receive the caller's estimate at the correct tile index.\n // This keeps getTotalSize() stable as items are measured → no scrollbar drift.\n const wrappedEstimateSize = draggable\n ? (index: number) => (index % 2 === 0 ? 0 : estimateSize(Math.floor(index / 2)))\n : estimateSize;\n\n const virtualizer = useVirtualizer({\n // NOTE: When draggable we double the number of items to allow for placeholders.\n count: draggable ? visibleItems.length * 2 + 1 : visibleItems.length,\n estimateSize: wrappedEstimateSize,\n gap,\n // Key measurements by stable item ID so the size cache survives scrolling;\n // without this, measurements are indexed by position and are lost when items reorder.\n getItemKey: draggable\n ? (index) => (index % 2 === 0 ? `ph-${index}` : getId(visibleItems![Math.floor(index / 2)]))\n : (index) => getId(visibleItems![index]),\n getScrollElement,\n overscan,\n onChange,\n });\n\n // Register scroll-to-item via virtualizer index lookup.\n const scrollToId = useCallback(\n (targetId: string) => {\n const itemIndex = visibleItems.findIndex((item) => getId(item) === targetId);\n if (itemIndex >= 0) {\n const virtualIndex = draggable ? itemIndex * 2 + 1 : itemIndex;\n virtualizer.scrollToIndex(virtualIndex, { align: 'start', behavior: 'smooth' });\n }\n },\n [visibleItems, getId, draggable, virtualizer],\n );\n\n useEffect(() => {\n registerScrollTo(scrollToId);\n return () => registerScrollTo(undefined);\n }, [registerScrollTo, scrollToId]);\n\n const virtualItems = virtualizer.getVirtualItems();\n const getData = (index: number): { data?: any; location: number } => {\n if (draggable) {\n if (index % 2 === 0) {\n return { location: Math.floor(index / 2) + 0.5 };\n } else {\n return { data: visibleItems![Math.floor(index / 2)], location: Math.floor(index / 2) + 1 };\n }\n } else {\n return { data: visibleItems![index], location: index + 1 };\n }\n };\n\n return (\n <div\n {...composableProps(props, {\n role: 'list',\n classNames: [\n // shrink-0 is required: this div sets an explicit height via inline style (getTotalSize).\n // Without it, a parent flex container (e.g. ScrollArea.Viewport) would shrink this div\n // to the viewport height, collapsing the scroll content and causing scrollbar drift.\n 'flex shrink-0',\n orientation === 'horizontal' && 'h-full [&>*]:shrink-0',\n orientation === 'vertical' && 'flex-col',\n ],\n })}\n style={{\n position: 'relative',\n ...(orientation === 'vertical'\n ? {\n width: '100%',\n height: virtualizer.getTotalSize(),\n }\n : {\n width: virtualizer.getTotalSize(),\n height: '100%',\n }),\n }}\n ref={forwardedRef}\n >\n {virtualItems.map(({ key, index, start }) => {\n const { data, location } = getData(index);\n return (\n <div\n key={key}\n data-index={index}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n ...(orientation === 'vertical'\n ? {\n width: '100%',\n transform: `translateY(${start}px)`,\n }\n : {\n height: '100%',\n transform: `translateX(${start}px)`,\n }),\n }}\n ref={virtualizer.measureElement}\n >\n {data ? (\n <Tile\n id={getId(data)}\n data={data}\n location={location}\n draggable={draggable}\n current={getId(data) === currentId}\n debug={debug}\n />\n ) : (\n <InternalPlaceholder orientation={orientation} location={location} />\n )}\n </div>\n );\n })}\n </div>\n );\n },\n);\n\nMosaicVirtualStackInner.displayName = MOSAIC_VIRTUAL_STACK_NAME;\n\nconst MosaicVirtualStack = MosaicVirtualStackInner as <TData = any>(\n props: MosaicVirtualStackProps<TData> & { ref?: Ref<HTMLDivElement> },\n) => ReactElement;\n(MosaicVirtualStack as any)[Symbol.for('dxos.composable')] = true;\n\n//\n// InternalPlaceholder\n//\n\nconst InternalPlaceholder = (props: MosaicPlaceholderProps<number>) => {\n return (\n <MosaicPlaceholder {...props} classNames={styles.placeholder.root}>\n <div\n className={mx(\n 'flex h-full bg-base-surface border border-dashed border-separator rounded-xs',\n styles.placeholder.content,\n )}\n />\n </MosaicPlaceholder>\n );\n};\n\nInternalPlaceholder.displayName = 'InternalPlaceholder';\n\n//\n// Exports\n//\n\nexport { MosaicStack, MosaicVirtualStack };\n\nexport type { MosaicStackTileComponent, MosaicStackProps, MosaicVirtualStackProps };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n MosaicContainer,\n type MosaicContainerProps,\n type MosaicContainerState,\n useMosaicContainerContext,\n} from './Container';\nimport {\n MosaicDropIndicator,\n type MosaicDropIndicatorProps,\n MosaicPlaceholder,\n type MosaicPlaceholderProps,\n} from './Placeholder';\nimport { MosaicRoot, type MosaicRootProps, useMosaicRootContext } from './Root';\nimport { MosaicStack, type MosaicStackProps, type MosaicStackTileComponent, MosaicVirtualStack } from './Stack';\nimport { MosaicTile, type MosaicTileProps, type MosaicTileState, useMosaicTileContext } from './Tile';\n\n//\n// Mosaic\n//\n\nexport const Mosaic = {\n Root: MosaicRoot,\n Container: MosaicContainer,\n Tile: MosaicTile,\n Placeholder: MosaicPlaceholder,\n DropIndicator: MosaicDropIndicator,\n Stack: MosaicStack,\n VirtualStack: MosaicVirtualStack,\n};\n\nexport type {\n MosaicRootProps,\n MosaicContainerProps,\n MosaicContainerState,\n MosaicTileProps,\n MosaicTileState,\n MosaicPlaceholderProps,\n MosaicDropIndicatorProps,\n MosaicStackProps,\n MosaicStackTileComponent,\n};\n\nexport {\n useMosaicRootContext as useMosaic,\n useMosaicContainerContext as useMosaicContainer,\n useMosaicTileContext as useMosaicTile,\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,eAAe;AAqBjB,IAAMC,kBAAkB,CAAc,EAC3CC,IACAC,OACAC,UACAC,MAAK,MACuB;AAC5B,QAAMC,eAAeC,QAAQ,MAAA;AAC3B,QAAI,CAACJ,SAAS,CAACC,YAAYF,OAAOE,SAASI,aAAa;AACtD,aAAOL,SAAS,CAAA;IAClB;AAEA,UAAMM,MAAMN,MAAMO,UAAU,CAACC,SAASN,MAAMM,IAAAA,MAAUP,SAASF,EAAE;AACjE,QAAIO,QAAQ,IAAI;AACd,aAAON;IACT;AAEA,UAAMG,gBAAeH,MAAMS,MAAK;AAChCN,IAAAA,cAAaO,OAAOJ,KAAK,CAAA;AACzB,WAAOH;EACT,GAAG;IAACJ;IAAIC;IAAOC;IAAUC;GAAM;AAE/B,S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,aAChB;UACE4E,OAAO;UACPO,WAAW,cAAcJ,KAAAA;QAC3B,IACA;UACEF,QAAQ;UACRM,WAAW,cAAcJ,KAAAA;QAC3B;MACN;MACAvC,KAAKqB,YAAYuB;OAEhBnE,OACC,gBAAAkB,OAAA,cAAChC,MAAAA;MACCM,IAAIV,MAAMkB,IAAAA;MACVA;MACAyB;MACAtC,WAAWA;MACXoB,SAASzB,MAAMkB,IAAAA,MAAUN;MACzBN;SAGF,gBAAA8B,OAAA,cAACM,qBAAAA;MAAoBzC;MAA0B0C;;EAIvD,CAAA,CAAA;AAGN,CAAA;AAGFS,wBAAwBH,cAAcE;AAEtC,IAAMmC,qBAAqBlC;AAG1BkC,mBAA2BC,uBAAOC,IAAI,iBAAA,CAAA,IAAsB;AAM7D,IAAM9C,sBAAsB,CAACnC,UAAAA;AAC3B,SACE,gBAAA6B,OAAA,cAACqD,mBAAAA;IAAmB,GAAGlF;IAAOiC,YAAYkD,OAAOC,YAAYC;KAC3D,gBAAAxD,OAAA,cAACC,OAAAA;IACCwD,WAAWC,IACT,gFACAJ,OAAOC,YAAYI,OAAO;;AAKpC;AAEArD,oBAAoBO,cAAc;;;AC/R3B,IAAM+C,SAAS;EACpBC,MAAMC;EACNC,WAAWC;EACXC,MAAMC;EACNC,aAAaC;EACbC,eAAeC;EACfC,OAAOC;EACPC,cAAcC;AAChB;",
|
|
6
|
+
"names": ["useMemo", "useVisibleItems", "id", "items", "dragging", "getId", "visibleItems", "useMemo", "containerId", "idx", "findIndex", "item", "slice", "splice", "Focus", "useFocus", "styles", "placeholder", "root", "content", "getSourceData", "source", "data", "type", "combine", "monitorForElements", "useComposedRefs", "createContext", "Primitive", "Slot", "React", "forwardRef", "useCallback", "useEffect", "useRef", "useState", "log", "mx", "MosaicRootContextProvider", "useMosaicRootContext", "MOSAIC_ROOT_NAME", "MOSAIC_ROOT_DEBUG_ATTR", "MosaicRoot", "classNames", "children", "asChild", "debug", "forwardedRef", "rootRef", "composedRef", "Comp", "div", "handlers", "setHandlers", "dragging", "setDragging", "getSourceHandler", "source", "data", "handler", "containerId", "getTargetHandler", "location", "target", "current", "dropTargets", "type", "id", "handleChange", "sourceData", "targetData", "onCancel", "container", "initial", "find", "element", "handleCancel", "requestAnimationFrame", "dispatchEvent", "CustomEvent", "bubbles", "undefined", "noTargetTimeout", "onDragStart", "map", "onDropTargetChange", "clearTimeout", "length", "setTimeout", "onDrag", "clientX", "x", "clientY", "y", "input", "position", "onDrop", "info", "sourceHandler", "warn", "Object", "keys", "targetHandler", "onTake", "object", "containers", "addContainer", "removeContainer", "className", "ref", "displayName", "autoScrollForElements", "combine", "dropTargetForElements", "useComposedRefs", "createContext", "Primitive", "Slot", "bind", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "composable", "composableProps", "mx", "isTruthy", "MOSAIC_CONTAINER_NAME", "MosaicContainerContextProvider", "useMosaicContainerContext", "createContext", "MOSAIC_CONTAINER_STATE_ATTR", "MOSAIC_CONTAINER_PLACEHOLDER_WIDTH", "MOSAIC_CONTAINER_PLACEHOLDER_HEIGHT", "counter", "MosaicContainer", "composable", "children", "eventHandler", "eventHandlerProp", "orientation", "asChild", "autoScroll", "autoscrollElement", "withFocus", "currentId", "onCurrentChange", "debug", "props", "forwardedRef", "className", "rest", "composableProps", "Comp", "Slot", "Primitive", "div", "rootRef", "useRef", "composedRef", "useComposedRefs", "useMemo", "id", "dragging", "useMosaicRootContext", "state", "setState", "useState", "type", "activeLocation", "setActiveLocation", "scrolling", "setScrolling", "setCurrentId", "useCallback", "scrollToRef", "undefined", "registerScrollTo", "fn", "current", "useEffect", "setFocus", "useFocus", "addContainer", "removeContainer", "data", "timeout", "handleScroll", "clearTimeout", "setTimeout", "combine", "bind", "listener", "dropTargetForElements", "element", "getData", "canDrop", "source", "getSourceData", "onDragStart", "sourceData", "bounds", "onDragEnter", "onDragLeave", "containerId", "onDrop", "autoScrollForElements", "getAllowedAxis", "getConfiguration", "maxScrollSpeed", "filter", "isTruthy", "flatMap", "x", "React", "mx", "style", "width", "height", "ref", "displayName", "attachClosestEdge", "extractClosestEdge", "combine", "draggable", "dropTargetForElements", "preserveOffsetOnSource", "setCustomNativeDragPreview", "composeRefs", "createContext", "Primitive", "Slot", "React", "useLayoutEffect", "useMemo", "useRef", "useState", "createPortal", "composableProps", "slottable", "MOSAIC_TILE_NAME", "MosaicTileContextProvider", "useMosaicTileContext", "createContext", "MOSAIC_TILE_STATE_ATTR", "MosaicTile", "slottable", "children", "asChild", "dragHandle", "allowedEdges", "allowedEdgesProp", "location", "id", "data", "dataProp", "draggable", "draggableProp", "current", "_current", "debug", "_", "props", "forwardedRef", "Comp", "Slot", "Primitive", "div", "rootRef", "useRef", "composedRef", "composeRefs", "containerId", "eventHandler", "orientation", "scrolling", "setActiveLocation", "useMosaicContainerContext", "state", "setState", "useState", "type", "useMemo", "useLayoutEffect", "root", "handleChange", "self", "source", "closestEdge", "extractClosestEdge", "combine", "element", "undefined", "canDrag", "getInitialData", "onGenerateDragPreview", "nativeSetDragImage", "setCustomNativeDragPreview", "getOffset", "preserveOffsetOnSource", "input", "render", "container", "bounds", "getBoundingClientRect", "rect", "onDragStart", "onDrop", "dropTargetForElements", "getData", "attachClosestEdge", "canDrop", "getSourceData", "onDragEnter", "onDragLeave", "onDrag", "className", "rest", "composableProps", "classNames", "React", "role", "ref", "createPortal", "style", "width", "height", "displayName", "DropIndicator", "NaturalDropIndicator", "dropTargetForElements", "Primitive", "Slot", "React", "useLayoutEffect", "useMemo", "useRef", "mx", "MOSAIC_PLACEHOLDER_NAME", "MOSAIC_PLACEHOLDER_ORIENTATION_ATTR", "MOSAIC_PLACEHOLDER_STATE_ATTR", "MosaicPlaceholder", "classNames", "children", "asChild", "orientation", "location", "rootRef", "useRef", "Comp", "Slot", "Primitive", "div", "id", "containerId", "eventHandler", "scrolling", "activeLocation", "setActiveLocation", "useMosaicContainerContext", "data", "useMemo", "type", "useLayoutEffect", "root", "current", "dropTargetForElements", "element", "getData", "canDrop", "source", "getSourceData", "onDragEnter", "onDragLeave", "undefined", "onDrop", "React", "role", "className", "mx", "ref", "displayName", "DROP_INDICATOR_NAME", "MosaicDropIndicator", "props", "state", "useMosaicTileContext", "closestEdge", "NaturalDropIndicator", "edge", "useComposedRefs", "useVirtualizer", "React", "forwardRef", "Fragment", "useCallback", "useEffect", "useRef", "invariant", "composable", "composableProps", "mx", "MOSAIC_STACK_NAME", "MosaicStackInner", "composable", "getId", "orientation", "orientationProp", "items", "Tile", "draggable", "debug", "props", "forwardedRef", "invariant", "id", "dragging", "currentId", "registerScrollTo", "useMosaicContainerContext", "visibleItems", "useVisibleItems", "source", "data", "rootRef", "useRef", "scrollToId", "useCallback", "targetId", "el", "current", "querySelector", "CSS", "escape", "scrollIntoView", "block", "behavior", "useEffect", "undefined", "composedRef", "useComposedRefs", "React", "div", "composableProps", "role", "classNames", "ref", "InternalPlaceholder", "location", "map", "item", "index", "Fragment", "key", "displayName", "MosaicStack", "MOSAIC_VIRTUAL_STACK_NAME", "MosaicVirtualStackInner", "forwardRef", "estimateSize", "getScrollElement", "overscan", "gap", "onChange", "wrappedEstimateSize", "Math", "floor", "virtualizer", "useVirtualizer", "count", "length", "getItemKey", "itemIndex", "findIndex", "virtualIndex", "scrollToIndex", "align", "virtualItems", "getVirtualItems", "getData", "style", "position", "width", "height", "getTotalSize", "start", "data-index", "top", "left", "transform", "measureElement", "MosaicVirtualStack", "Symbol", "for", "MosaicPlaceholder", "styles", "placeholder", "root", "className", "mx", "content", "Mosaic", "Root", "MosaicRoot", "Container", "MosaicContainer", "Tile", "MosaicTile", "Placeholder", "MosaicPlaceholder", "DropIndicator", "MosaicDropIndicator", "Stack", "MosaicStack", "VirtualStack", "MosaicVirtualStack"]
|
|
7
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useMosaicRootContext,
|
|
9
9
|
useMosaicTileContext,
|
|
10
10
|
useVisibleItems
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6R7CESWM.mjs";
|
|
12
12
|
|
|
13
13
|
// src/components/Board/Board.tsx
|
|
14
14
|
import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
@@ -16,7 +16,7 @@ import { createContext as createContext2 } from "@radix-ui/react-context";
|
|
|
16
16
|
import React4, { forwardRef as forwardRef4, useRef as useRef4, useState as useState2 } from "react";
|
|
17
17
|
import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
|
|
18
18
|
import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
|
|
19
|
-
import { composableProps, mx as mx3 } from "@dxos/ui-theme";
|
|
19
|
+
import { composable as composable2, composableProps as composableProps2, mx as mx3 } from "@dxos/ui-theme";
|
|
20
20
|
|
|
21
21
|
// src/hooks/useContainerDebug.tsx
|
|
22
22
|
import React, { forwardRef, useMemo, useRef } from "react";
|
|
@@ -49,7 +49,7 @@ var CONTAINER_INFO_NAME = "ContainerInfo";
|
|
|
49
49
|
var ContainerInfo = /* @__PURE__ */ forwardRef(({ classNames }, forwardedRef) => {
|
|
50
50
|
const { id, state, activeLocation, scrolling } = useMosaicContainerContext(CONTAINER_INFO_NAME);
|
|
51
51
|
const counter = useRef(0);
|
|
52
|
-
return /* @__PURE__ */ React.createElement(Json, {
|
|
52
|
+
return /* @__PURE__ */ React.createElement(Json.Data, {
|
|
53
53
|
data: {
|
|
54
54
|
id,
|
|
55
55
|
activeLocation,
|
|
@@ -271,7 +271,7 @@ import { Obj as Obj2, Ref } from "@dxos/echo";
|
|
|
271
271
|
import { useObject } from "@dxos/react-client/echo";
|
|
272
272
|
import { IconButton, ScrollArea, Toolbar as Toolbar2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
273
273
|
import { Menu as Menu2, createMenuAction as createMenuAction2 } from "@dxos/react-ui-menu";
|
|
274
|
-
import { mx as mx2 } from "@dxos/ui-theme";
|
|
274
|
+
import { composable, composableProps, mx as mx2 } from "@dxos/ui-theme";
|
|
275
275
|
|
|
276
276
|
// src/translations.ts
|
|
277
277
|
var translationKey = "@dxos/react-ui-mosaic";
|
|
@@ -279,9 +279,9 @@ var translations = [
|
|
|
279
279
|
{
|
|
280
280
|
"en-US": {
|
|
281
281
|
[translationKey]: {
|
|
282
|
-
"action
|
|
283
|
-
"add
|
|
284
|
-
"delete
|
|
282
|
+
"action-menu.label": "Actions",
|
|
283
|
+
"add-item.label": "Add item",
|
|
284
|
+
"delete-menu.label": "Delete"
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -304,7 +304,7 @@ var BoardItemInner = /* @__PURE__ */ forwardRef2(({ classNames, data, location,
|
|
|
304
304
|
const column = useBoardColumn();
|
|
305
305
|
const items = useMemo3(() => column != null && model.onItemDelete ? [
|
|
306
306
|
createMenuAction("delete-item", () => model.onItemDelete?.(column, data), {
|
|
307
|
-
label: t("delete
|
|
307
|
+
label: t("delete-menu.label"),
|
|
308
308
|
icon: "ph--trash--regular"
|
|
309
309
|
})
|
|
310
310
|
] : [], [
|
|
@@ -318,36 +318,40 @@ var BoardItemInner = /* @__PURE__ */ forwardRef2(({ classNames, data, location,
|
|
|
318
318
|
}
|
|
319
319
|
const label = Obj.getLabel(data);
|
|
320
320
|
const description = Obj.getDescription(data);
|
|
321
|
-
return /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
|
|
321
|
+
return /* @__PURE__ */ React2.createElement(Menu.Root, null, /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
|
|
322
|
+
ref: rootRef,
|
|
322
323
|
asChild: true,
|
|
323
324
|
dragHandle: dragHandleRef.current,
|
|
324
325
|
id: data.id,
|
|
325
326
|
data,
|
|
326
327
|
location,
|
|
327
328
|
debug
|
|
328
|
-
}, /* @__PURE__ */ React2.createElement(Focus.
|
|
329
|
+
}, /* @__PURE__ */ React2.createElement(Focus.Item, {
|
|
329
330
|
asChild: true
|
|
330
|
-
}, /* @__PURE__ */ React2.createElement(
|
|
331
|
+
}, /* @__PURE__ */ React2.createElement(Card.Root, {
|
|
331
332
|
classNames,
|
|
332
333
|
"data-testid": "board-item",
|
|
333
|
-
|
|
334
|
-
|
|
334
|
+
ref: composedRef,
|
|
335
|
+
onClick: (event) => event.currentTarget.focus()
|
|
335
336
|
}, /* @__PURE__ */ React2.createElement(Card.Toolbar, null, /* @__PURE__ */ React2.createElement(Card.DragHandle, {
|
|
336
|
-
ref: dragHandleRef
|
|
337
|
-
|
|
337
|
+
ref: dragHandleRef,
|
|
338
|
+
testId: "mosaicBoard.cardDragHandle"
|
|
339
|
+
}), /* @__PURE__ */ React2.createElement(Card.Title, {
|
|
340
|
+
"data-testid": "mosaicBoard.cardTitle"
|
|
341
|
+
}, label), /* @__PURE__ */ React2.createElement(Menu.Trigger, {
|
|
338
342
|
asChild: true,
|
|
339
343
|
disabled: !items?.length
|
|
340
344
|
}, /* @__PURE__ */ React2.createElement(Toolbar.IconButton, {
|
|
341
345
|
iconOnly: true,
|
|
342
346
|
variant: "ghost",
|
|
343
347
|
icon: "ph--dots-three-vertical--regular",
|
|
344
|
-
label: t("action
|
|
348
|
+
label: t("action-menu.label")
|
|
345
349
|
})), /* @__PURE__ */ React2.createElement(Menu.Content, {
|
|
346
350
|
items
|
|
347
351
|
})), /* @__PURE__ */ React2.createElement(Card.Row, {
|
|
348
352
|
icon: "ph--note--regular",
|
|
349
353
|
classNames: "text-description"
|
|
350
|
-
}, description), /* @__PURE__ */ React2.createElement(Card.Row, {
|
|
354
|
+
}, /* @__PURE__ */ React2.createElement(Card.Text, null, description)), /* @__PURE__ */ React2.createElement(Card.Row, {
|
|
351
355
|
icon: "ph--tag--regular"
|
|
352
356
|
}, label && /* @__PURE__ */ React2.createElement("div", {
|
|
353
357
|
role: "none",
|
|
@@ -367,7 +371,7 @@ function useBoardColumn() {
|
|
|
367
371
|
return value?.column;
|
|
368
372
|
}
|
|
369
373
|
var BOARD_COLUMN_ROOT_NAME = "Board.Column.Root";
|
|
370
|
-
var BoardColumnRootInner =
|
|
374
|
+
var BoardColumnRootInner = composable(({ classNames, children, location, data, debug, dragHandleRef: dragHandleRefProp, ...rest }, forwardedRef) => {
|
|
371
375
|
const { model } = useBoard(BOARD_COLUMN_ROOT_NAME);
|
|
372
376
|
const internalRef = useRef3(null);
|
|
373
377
|
const dragHandleRef = dragHandleRefProp ?? internalRef;
|
|
@@ -381,11 +385,8 @@ var BoardColumnRootInner = /* @__PURE__ */ forwardRef3(({ classNames, children,
|
|
|
381
385
|
}, /* @__PURE__ */ React3.createElement(Focus.Group, {
|
|
382
386
|
...rest,
|
|
383
387
|
"data-testid": "board-column",
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
"group/column h-full overflow-hidden w-[calc(100vw-2px)] md:w-card-default-width snap-center bg-deck-surface",
|
|
387
|
-
classNames
|
|
388
|
-
),
|
|
388
|
+
border: true,
|
|
389
|
+
classNames: mx2("group/column", "h-full w-full md:w-card-default-width snap-center bg-deck-surface", "overflow-hidden", classNames),
|
|
389
390
|
ref: forwardedRef
|
|
390
391
|
}, /* @__PURE__ */ React3.createElement(BoardColumnProvider, {
|
|
391
392
|
column: data
|
|
@@ -394,13 +395,13 @@ var BoardColumnRootInner = /* @__PURE__ */ forwardRef3(({ classNames, children,
|
|
|
394
395
|
BoardColumnRootInner.displayName = BOARD_COLUMN_ROOT_NAME;
|
|
395
396
|
var BoardColumnRoot = BoardColumnRootInner;
|
|
396
397
|
var BOARD_COLUMN_HEADER_NAME = "Board.Column.Header";
|
|
397
|
-
var BoardColumnHeader =
|
|
398
|
+
var BoardColumnHeader = composable(({ label, dragHandleRef, ...props }, forwardedRef) => {
|
|
398
399
|
const { t } = useTranslation2(translationKey);
|
|
399
400
|
const { model } = useBoard(BOARD_COLUMN_HEADER_NAME);
|
|
400
401
|
const column = useBoardColumn();
|
|
401
402
|
const columnMenuItems = useMemo4(() => column != null && model.onColumnDelete ? [
|
|
402
403
|
createMenuAction2("delete-column", () => model.onColumnDelete?.(column), {
|
|
403
|
-
label: t("delete
|
|
404
|
+
label: t("delete-menu.label"),
|
|
404
405
|
icon: "ph--trash--regular"
|
|
405
406
|
})
|
|
406
407
|
] : [], [
|
|
@@ -409,40 +410,45 @@ var BoardColumnHeader = /* @__PURE__ */ forwardRef3(({ classNames, label, dragHa
|
|
|
409
410
|
t
|
|
410
411
|
]);
|
|
411
412
|
return /* @__PURE__ */ React3.createElement(Menu2.Root, null, /* @__PURE__ */ React3.createElement(Toolbar2.Root, {
|
|
412
|
-
|
|
413
|
+
...composableProps(props),
|
|
413
414
|
"data-testid": "board-column-header",
|
|
414
415
|
ref: forwardedRef
|
|
415
416
|
}, /* @__PURE__ */ React3.createElement(Toolbar2.DragHandle, {
|
|
416
|
-
ref: dragHandleRef
|
|
417
|
-
|
|
417
|
+
ref: dragHandleRef,
|
|
418
|
+
testId: "mosaicBoard.columnDragHandle"
|
|
419
|
+
}), /* @__PURE__ */ React3.createElement(Toolbar2.Text, {
|
|
420
|
+
"data-testid": "mosaicBoard.columnTitle"
|
|
421
|
+
}, label), /* @__PURE__ */ React3.createElement(Menu2.Trigger, {
|
|
418
422
|
asChild: true,
|
|
419
423
|
disabled: !columnMenuItems?.length
|
|
420
424
|
}, /* @__PURE__ */ React3.createElement(Toolbar2.IconButton, {
|
|
421
425
|
iconOnly: true,
|
|
422
426
|
variant: "ghost",
|
|
423
427
|
icon: "ph--dots-three-vertical--regular",
|
|
424
|
-
label: t("action
|
|
428
|
+
label: t("action-menu.label")
|
|
425
429
|
})), /* @__PURE__ */ React3.createElement(Menu2.Content, {
|
|
426
430
|
items: columnMenuItems
|
|
427
431
|
})));
|
|
428
432
|
});
|
|
429
433
|
BoardColumnHeader.displayName = BOARD_COLUMN_HEADER_NAME;
|
|
430
434
|
var BOARD_COLUMN_BODY_NAME = "Board.Column.Body";
|
|
431
|
-
var BoardColumnBody = ({ data, eventHandler, Tile = BoardItem, debug }) => {
|
|
435
|
+
var BoardColumnBody = composable(({ data, eventHandler, Tile = BoardItem, debug, ...props }, forwardedRef) => {
|
|
432
436
|
const { model } = useBoard(BOARD_COLUMN_BODY_NAME);
|
|
433
437
|
const [viewport, setViewport] = useState(null);
|
|
434
438
|
const items = useAtomValue(model.items(data));
|
|
435
439
|
return /* @__PURE__ */ React3.createElement(Mosaic.Container, {
|
|
440
|
+
...composableProps(props),
|
|
436
441
|
asChild: true,
|
|
437
442
|
withFocus: true,
|
|
438
443
|
orientation: "vertical",
|
|
439
444
|
autoScroll: viewport,
|
|
440
445
|
eventHandler,
|
|
441
|
-
debug
|
|
446
|
+
debug,
|
|
447
|
+
ref: forwardedRef
|
|
442
448
|
}, /* @__PURE__ */ React3.createElement(ScrollArea.Root, {
|
|
443
449
|
orientation: "vertical",
|
|
444
450
|
thin: true,
|
|
445
|
-
|
|
451
|
+
centered: true,
|
|
446
452
|
padding: true
|
|
447
453
|
}, /* @__PURE__ */ React3.createElement(ScrollArea.Viewport, {
|
|
448
454
|
classNames: "snap-y md:snap-none",
|
|
@@ -452,7 +458,7 @@ var BoardColumnBody = ({ data, eventHandler, Tile = BoardItem, debug }) => {
|
|
|
452
458
|
getId: model.getItemId,
|
|
453
459
|
Tile
|
|
454
460
|
}))));
|
|
455
|
-
};
|
|
461
|
+
});
|
|
456
462
|
BoardColumnBody.displayName = BOARD_COLUMN_BODY_NAME;
|
|
457
463
|
var BOARD_COLUMN_FOOTER_NAME = "Board.Column.Footer";
|
|
458
464
|
var BoardColumnFooter = /* @__PURE__ */ forwardRef3(({ classNames, data, onAdd }, forwardedRef) => {
|
|
@@ -468,7 +474,7 @@ var BoardColumnFooter = /* @__PURE__ */ forwardRef3(({ classNames, data, onAdd }
|
|
|
468
474
|
variant: "ghost",
|
|
469
475
|
icon: "ph--plus--regular",
|
|
470
476
|
iconOnly: true,
|
|
471
|
-
label: t("add
|
|
477
|
+
label: t("add-item.label"),
|
|
472
478
|
onClick: handleAdd
|
|
473
479
|
}));
|
|
474
480
|
});
|
|
@@ -535,16 +541,15 @@ var BoardRootInner = ({ model, children }) => {
|
|
|
535
541
|
BoardRootInner.displayName = BOARD_ROOT_NAME;
|
|
536
542
|
var BoardRoot = BoardRootInner;
|
|
537
543
|
var BOARD_CONTENT_NAME = "Board.Content";
|
|
538
|
-
var BoardContentInner =
|
|
539
|
-
const { className, ...rest } = composableProps(props);
|
|
544
|
+
var BoardContentInner = composable2(({ id: _id, debug, eventHandler, Tile = DefaultBoardColumn, ...props }, forwardedRef) => {
|
|
540
545
|
const { model } = useBoardContext(BOARD_CONTENT_NAME);
|
|
541
546
|
const [DebugInfo, debugHandler] = useContainerDebug(debug);
|
|
542
547
|
const [viewport, setViewport] = useState2(null);
|
|
543
548
|
const items = useAtomValue2(model.columns);
|
|
544
549
|
return /* @__PURE__ */ React4.createElement("div", {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
550
|
+
...composableProps2(props, {
|
|
551
|
+
classNames: "dx-container"
|
|
552
|
+
}),
|
|
548
553
|
ref: forwardedRef
|
|
549
554
|
}, /* @__PURE__ */ React4.createElement(Focus.Group, {
|
|
550
555
|
asChild: true,
|
|
@@ -558,8 +563,7 @@ var BoardContentInner = /* @__PURE__ */ forwardRef4(({ id: _id, debug, eventHand
|
|
|
558
563
|
debug: debugHandler
|
|
559
564
|
}, /* @__PURE__ */ React4.createElement(ScrollArea2.Root, {
|
|
560
565
|
orientation: "horizontal",
|
|
561
|
-
|
|
562
|
-
margin: true,
|
|
566
|
+
centered: true,
|
|
563
567
|
padding: true
|
|
564
568
|
}, /* @__PURE__ */ React4.createElement(ScrollArea2.Viewport, {
|
|
565
569
|
classNames: "snap-mandatory snap-x md:snap-none",
|
|
@@ -587,7 +591,7 @@ var BOARD_DEBUG_NAME = "Board.Debug";
|
|
|
587
591
|
var BoardDebug = /* @__PURE__ */ forwardRef4(({ classNames }, forwardedRef) => {
|
|
588
592
|
const { containers, dragging } = useMosaicRootContext(BOARD_DEBUG_NAME);
|
|
589
593
|
const counter = useRef4(0);
|
|
590
|
-
return /* @__PURE__ */ React4.createElement(Json2, {
|
|
594
|
+
return /* @__PURE__ */ React4.createElement(Json2.Data, {
|
|
591
595
|
data: {
|
|
592
596
|
containers,
|
|
593
597
|
dragging,
|