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AAA,GAAA,iBAAS,EAAE;IACzB,qBACE,gCAAC;QACC,MAAK;QACL,iBAAe,MAAM,UAAU,CAAC,IAAI,GAAG;QACvC,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAS,GAAG,2CAA2C;YAC3E,wDAAwD,MAAM,UAAU,CAAC,IAAI,GAAG;QAClF;qBACA,gCAAC;QAAI,MAAK;OAAY;AAG5B","sources":["packages/@adobe/react-spectrum/src/list/ListView.tsx"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaGridListProps, useGridList} from 'react-aria/useGridList';\n\nimport {\n  AsyncLoadable,\n  DOMRef,\n  Key,\n  LoadingState,\n  Node,\n  SpectrumSelectionProps,\n  StyleProps\n} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport type {DragAndDropHooks} from '../dnd/useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionResult} from 'react-aria/useDroppableCollection';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport InsertionIndicator from './InsertionIndicator';\nimport intlMessages from '../../intl/list/*.json';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, useListState} from 'react-stately/useListState';\nimport listStyles from './styles.css';\n// @ts-ignore\nimport {ListViewItem} from './ListViewItem';\nimport {ListViewLayout} from './ListViewLayout';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n  JSX,\n  ReactElement,\n  useCallback,\n  useContext,\n  useEffect,\n  useMemo,\n  useRef,\n  useState\n} from 'react';\nimport RootDropIndicator from './RootDropIndicator';\nimport {DragPreview as SpectrumDragPreview} from './DragPreview';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {Virtualizer} from 'react-aria/private/virtualizer/Virtualizer';\n\nexport interface SpectrumListViewProps<T>\n  extends\n    Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'>,\n    StyleProps,\n    SpectrumSelectionProps,\n    Omit<AsyncLoadable, 'isLoading'> {\n  /**\n   * Sets the amount of vertical padding within each cell.\n   *\n   * @default 'regular'\n   */\n  density?: 'compact' | 'regular' | 'spacious';\n  /** Whether the ListView should be displayed with a quiet style. */\n  isQuiet?: boolean;\n  /**\n   * The current loading state of the ListView. Determines whether or not the progress circle should\n   * be shown.\n   */\n  loadingState?: LoadingState;\n  /**\n   * Sets the text behavior for the row contents.\n   *\n   * @default 'truncate'\n   */\n  overflowMode?: 'truncate' | 'wrap';\n  /** Sets what the ListView should render when there is no content to display. */\n  renderEmptyState?: () => JSX.Element;\n  /**\n   * Handler that is called when a user performs an action on an item. The exact user event depends\n   * on the collection's `selectionStyle` prop and the interaction modality.\n   */\n  onAction?: (key: Key) => void;\n  /**\n   * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for\n   * the ListView.\n   */\n  dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'];\n}\n\ninterface ListViewContextValue<T> {\n  state: ListState<T>;\n  dragState: DraggableCollectionState | null;\n  dropState: DroppableCollectionState | null;\n  dragAndDropHooks?: DragAndDropHooks<T>['dragAndDropHooks'];\n  onAction?: (key: Key) => void;\n  isListDraggable: boolean;\n  isListDroppable: boolean;\n  layout: ListViewLayout<T>;\n  loadingState?: LoadingState;\n  renderEmptyState?: () => JSX.Element;\n}\n\nexport const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);\n\nconst ROW_HEIGHTS = {\n  compact: {\n    medium: 32,\n    large: 40\n  },\n  regular: {\n    medium: 40,\n    large: 50\n  },\n  spacious: {\n    medium: 48,\n    large: 60\n  }\n};\n\nfunction useListLayout<T>(\n  state: ListState<T>,\n  density: SpectrumListViewProps<T>['density'],\n  overflowMode: SpectrumListViewProps<T>['overflowMode']\n) {\n  let {scale} = useProvider();\n  let layout = useMemo(\n    () =>\n      new ListViewLayout<T>({\n        estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]\n      }),\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [scale, density, overflowMode]\n  );\n\n  return layout;\n}\n\n/**\n * A ListView displays a list of interactive items, and allows a user to navigate, select, or\n * perform an action.\n */\nexport const ListView = React.forwardRef(function ListView<T extends object>(\n  props: SpectrumListViewProps<T>,\n  ref: DOMRef<HTMLDivElement>\n) {\n  let {\n    density = 'regular',\n    loadingState,\n    onLoadMore,\n    isQuiet,\n    overflowMode = 'truncate',\n    onAction,\n    dragAndDropHooks,\n    renderEmptyState,\n    ...otherProps\n  } = props;\n  let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n  let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n  let dragHooksProvided = useRef(isListDraggable);\n  let dropHooksProvided = useRef(isListDroppable);\n  useEffect(() => {\n    if (dragHooksProvided.current !== isListDraggable && process.env.NODE_ENV !== 'production') {\n      console.warn(\n        'Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n      );\n    }\n    if (dropHooksProvided.current !== isListDroppable && process.env.NODE_ENV !== 'production') {\n      console.warn(\n        'Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n      );\n    }\n  }, [isListDraggable, isListDroppable]);\n\n  let domRef = useDOMRef(ref);\n  let state = useListState({\n    ...props,\n    selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'\n  });\n  let {collection, selectionManager} = state;\n  let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n\n  let {styleProps} = useStyleProps(props);\n  let dragState: DraggableCollectionState | null = null;\n  let preview = useRef(null);\n  if (isListDraggable && dragAndDropHooks) {\n    dragState = dragAndDropHooks.useDraggableCollectionState!({\n      collection,\n      selectionManager,\n      preview\n    });\n    dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);\n  }\n  let layout = useListLayout(state, props.density || 'regular', overflowMode);\n\n  let DragPreview = dragAndDropHooks?.DragPreview;\n  let dropState: DroppableCollectionState | null = null;\n  let droppableCollection: DroppableCollectionResult | null = null;\n  let isRootDropTarget = false;\n  if (isListDroppable && dragAndDropHooks) {\n    dropState = dragAndDropHooks.useDroppableCollectionState!({\n      collection,\n      selectionManager\n    });\n    droppableCollection = dragAndDropHooks.useDroppableCollection!(\n      {\n        keyboardDelegate: new ListKeyboardDelegate({\n          collection,\n          disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,\n          ref: domRef,\n          layoutDelegate: layout\n        }),\n        dropTargetDelegate: layout\n      },\n      dropState,\n      domRef\n    );\n\n    isRootDropTarget = dropState.isDropTarget({type: 'root'});\n  }\n\n  let {gridProps} = useGridList(\n    {\n      ...props,\n      isVirtualized: true,\n      layoutDelegate: layout,\n      onAction\n    },\n    state,\n    domRef\n  );\n\n  let focusedKey = selectionManager.focusedKey;\n  let dropTargetKey: Key | null = null;\n  if (dropState?.target?.type === 'item') {\n    dropTargetKey = dropState.target.key;\n    if (dropState.target.dropPosition === 'after') {\n      // Normalize to the \"before\" drop position since we only render those in the DOM.\n      dropTargetKey = state.collection.getKeyAfter(dropTargetKey) ?? dropTargetKey;\n    }\n  }\n\n  let persistedKeys = useMemo(() => {\n    return new Set([focusedKey, dropTargetKey].filter(k => k !== null));\n  }, [focusedKey, dropTargetKey]);\n\n  // wait for layout to get accurate measurements\n  let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = useState(false);\n  let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = useState(false);\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  useLayoutEffect(() => {\n    if (domRef.current) {\n      // 2 is the width of the border which is not part of the box size\n      setVerticalScollbarVisible(domRef.current.clientWidth + 2 < domRef.current.offsetWidth);\n      setHorizontalScollbarVisible(domRef.current.clientHeight + 2 < domRef.current.offsetHeight);\n    }\n  });\n\n  let hasAnyChildren = useMemo(\n    () => [...collection].some(item => item.hasChildNodes),\n    [collection]\n  );\n\n  return (\n    <ListViewContext.Provider\n      value={{\n        state,\n        dragState,\n        dropState,\n        dragAndDropHooks,\n        onAction,\n        isListDraggable,\n        isListDroppable,\n        layout,\n        loadingState,\n        renderEmptyState\n      }}>\n      <FocusScope>\n        <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n          <Virtualizer\n            {...mergeProps(\n              isListDroppable ? droppableCollection?.collectionProps : null,\n              gridProps\n            )}\n            {...filterDOMProps(otherProps)}\n            {...gridProps}\n            {...styleProps}\n            onScroll={undefined}\n            isLoading={isLoading}\n            onLoadMore={onLoadMore}\n            ref={domRef}\n            persistedKeys={persistedKeys}\n            scrollDirection=\"vertical\"\n            className={classNames(\n              listStyles,\n              'react-spectrum-ListView',\n              `react-spectrum-ListView--${density}`,\n              'react-spectrum-ListView--emphasized',\n              {\n                'react-spectrum-ListView--quiet': isQuiet,\n                'react-spectrum-ListView--loadingMore': loadingState === 'loadingMore',\n                'react-spectrum-ListView--draggable': !!isListDraggable,\n                'react-spectrum-ListView--dropTarget': !!isRootDropTarget,\n                'react-spectrum-ListView--isVerticalScrollbarVisible': isVerticalScrollbarVisible,\n                'react-spectrum-ListView--isHorizontalScrollbarVisible':\n                  isHorizontalScrollbarVisible,\n                'react-spectrum-ListView--hasAnyChildren': hasAnyChildren,\n                'react-spectrum-ListView--wrap': overflowMode === 'wrap'\n              },\n              styleProps.className\n            )}\n            layout={layout}\n            layoutOptions={useMemo(() => ({isLoading}), [isLoading])}\n            collection={collection}>\n            {useCallback((type, item: Node<T>) => {\n              if (type === 'item') {\n                return <Item item={item} />;\n              } else if (type === 'loader') {\n                return <LoadingView />;\n              } else if (type === 'placeholder') {\n                return <EmptyState />;\n              }\n            }, [])}\n          </Virtualizer>\n        </FocusRing>\n      </FocusScope>\n      {DragPreview && isListDraggable && dragAndDropHooks && dragState && (\n        <DragPreview ref={preview}>\n          {() => {\n            if (dragState.draggedKey == null) {\n              return null;\n            }\n            if (dragAndDropHooks.renderPreview) {\n              return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);\n            }\n            let item = state.collection.getItem(dragState.draggedKey);\n            if (!item) {\n              return null;\n            }\n            let itemCount = dragState.draggingKeys.size;\n            let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;\n            return (\n              <SpectrumDragPreview\n                item={item}\n                itemCount={itemCount}\n                itemHeight={itemHeight}\n                density={density}\n              />\n            );\n          }}\n        </DragPreview>\n      )}\n    </ListViewContext.Provider>\n  );\n}) as <T>(props: SpectrumListViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\nfunction Item({item}: {item: Node<unknown>}) {\n  let {isListDroppable, state, onAction} = useContext(ListViewContext)!;\n  return (\n    <>\n      {isListDroppable && state.collection.getKeyBefore(item.key) == null && (\n        <RootDropIndicator key=\"root\" />\n      )}\n      {isListDroppable && (\n        <InsertionIndicator\n          key={`${item.key}-before`}\n          target={{key: item.key, type: 'item', dropPosition: 'before'}}\n        />\n      )}\n      <ListViewItem item={item} isEmphasized hasActions={!!onAction} />\n      {isListDroppable && (\n        <InsertionIndicator\n          key={`${item.key}-after`}\n          target={{key: item.key, type: 'item', dropPosition: 'after'}}\n          isPresentationOnly={state.collection.getKeyAfter(item.key) != null}\n        />\n      )}\n    </>\n  );\n}\n\nfunction LoadingView() {\n  let {state} = useContext(ListViewContext)!;\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');\n  return (\n    <CenteredWrapper>\n      <ProgressCircle\n        isIndeterminate\n        aria-label={\n          state.collection.size > 0\n            ? stringFormatter.format('loadingMore')\n            : stringFormatter.format('loading')\n        }\n      />\n    </CenteredWrapper>\n  );\n}\n\nfunction EmptyState() {\n  let {renderEmptyState} = useContext(ListViewContext)!;\n  let emptyState = renderEmptyState ? renderEmptyState() : null;\n  if (emptyState == null) {\n    return null;\n  }\n\n  return <CenteredWrapper>{emptyState}</CenteredWrapper>;\n}\n\nfunction CenteredWrapper({children}) {\n  let {state} = useContext(ListViewContext)!;\n  return (\n    <div\n      role=\"row\"\n      aria-rowindex={state.collection.size + 1}\n      className={classNames(listStyles, 'react-spectrum-ListView-centeredWrapper', {\n        'react-spectrum-ListView-centeredWrapper--loadingMore': state.collection.size > 0\n      })}>\n      <div role=\"gridcell\">{children}</div>\n    </div>\n  );\n}\n"],"names":[],"version":3,"file":"ListView.mjs.map"}