@react-spectrum/list 3.8.3 → 3.9.0

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.
@@ -59,12 +59,12 @@ $parcel$export(module.exports, "ListViewItem", () => $9eae7a1cb1535a6b$export$c6
59
59
 
60
60
 
61
61
  function $9eae7a1cb1535a6b$export$c6bde0c04b033c0e(props) {
62
- var _layout_getContentSize, _layout_virtualizer;
62
+ var _dragAndDropHooks_isVirtualDragging, _layout_getContentSize, _layout_virtualizer;
63
63
  let { item: item, isEmphasized: isEmphasized } = props;
64
64
  let { state: state, dragState: dragState, dropState: dropState, isListDraggable: isListDraggable, isListDroppable: isListDroppable, layout: layout, dragAndDropHooks: dragAndDropHooks, loadingState: loadingState } = (0, $5Mbbg$react.useContext)((0, $60684b441be8e84c$exports.ListViewContext));
65
65
  let { direction: direction } = (0, $5Mbbg$reactariai18n.useLocale)();
66
- let rowRef = (0, $5Mbbg$react.useRef)(undefined);
67
- let checkboxWrapperRef = (0, $5Mbbg$react.useRef)(undefined);
66
+ let rowRef = (0, $5Mbbg$react.useRef)(null);
67
+ let checkboxWrapperRef = (0, $5Mbbg$react.useRef)(null);
68
68
  let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = (0, $5Mbbg$reactariafocus.useFocusRing)({
69
69
  within: true
70
70
  });
@@ -74,7 +74,6 @@ function $9eae7a1cb1535a6b$export$c6bde0c04b033c0e(props) {
74
74
  isVirtualized: true,
75
75
  shouldSelectOnPressUp: isListDraggable
76
76
  }, state, rowRef);
77
- let isDroppable = isListDroppable && !isDisabled;
78
77
  let { hoverProps: hoverProps, isHovered: isHovered } = (0, $5Mbbg$reactariainteractions.useHover)({
79
78
  isDisabled: !allowsSelection && !hasAction
80
79
  });
@@ -82,32 +81,29 @@ function $9eae7a1cb1535a6b$export$c6bde0c04b033c0e(props) {
82
81
  key: item.key
83
82
  }, state);
84
83
  let hasDescription = (0, $5Mbbg$reactspectrumutils.useHasChild)(`.${(0, ($parcel$interopDefault($279507a6f189e509$exports)))['react-spectrum-ListViewItem-description']}`, rowRef);
85
- let draggableItem;
86
- if (isListDraggable) {
87
- // eslint-disable-next-line react-hooks/rules-of-hooks
84
+ let draggableItem = null;
85
+ if (isListDraggable && dragAndDropHooks && dragState) {
88
86
  draggableItem = dragAndDropHooks.useDraggableItem({
89
87
  key: item.key,
90
88
  hasDragButton: true
91
89
  }, dragState);
92
90
  if (isDisabled) draggableItem = null;
93
91
  }
94
- let droppableItem;
95
- let isDropTarget;
96
- let dropIndicator;
97
- let dropIndicatorRef = (0, $5Mbbg$react.useRef)(undefined);
98
- if (isListDroppable) {
92
+ let isDropTarget = false;
93
+ let dropIndicator = null;
94
+ let dropIndicatorRef = (0, $5Mbbg$react.useRef)(null);
95
+ if (isListDroppable && dragAndDropHooks && dropState) {
99
96
  let target = {
100
97
  type: 'item',
101
98
  key: item.key,
102
99
  dropPosition: 'on'
103
100
  };
104
101
  isDropTarget = dropState.isDropTarget(target);
105
- // eslint-disable-next-line react-hooks/rules-of-hooks
106
102
  dropIndicator = dragAndDropHooks.useDropIndicator({
107
103
  target: target
108
104
  }, dropState, dropIndicatorRef);
109
105
  }
110
- let dragButtonRef = (0, ($parcel$interopDefault($5Mbbg$react))).useRef(undefined);
106
+ let dragButtonRef = (0, ($parcel$interopDefault($5Mbbg$react))).useRef(null);
111
107
  let { buttonProps: buttonProps } = (0, $5Mbbg$reactariabutton.useButton)({
112
108
  ...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
113
109
  elementType: 'div'
@@ -127,27 +123,24 @@ function $9eae7a1cb1535a6b$export$c6bde0c04b033c0e(props) {
127
123
  });
128
124
  let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';
129
125
  let { visuallyHiddenProps: visuallyHiddenProps } = (0, $5Mbbg$reactariavisuallyhidden.useVisuallyHidden)();
130
- let dropProps = isDroppable ? droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps : {
131
- 'aria-hidden': droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps['aria-hidden']
132
- };
133
- const mergedProps = (0, $5Mbbg$reactariautils.mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, dropProps, hoverProps, focusWithinProps, focusProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
126
+ const mergedProps = (0, $5Mbbg$reactariautils.mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, hoverProps, focusWithinProps, focusProps);
127
+ // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
134
128
  // allowing for single swipe navigation between row drop indicator
135
- (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
136
- tabIndex: null
137
- });
129
+ if (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) mergedProps.tabIndex = undefined;
138
130
  let isFirstRow = item.prevKey == null;
139
131
  let isLastRow = item.nextKey == null;
140
132
  // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom
141
133
  // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap
142
134
  // with bottom border
143
135
  let isFlushWithContainerBottom = false;
136
+ var _layout_virtualizer_visibleRect_height;
144
137
  if (isLastRow && loadingState !== 'loadingMore') {
145
- if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
138
+ if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer_visibleRect_height = (_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height) !== null && _layout_virtualizer_visibleRect_height !== void 0 ? _layout_virtualizer_visibleRect_height : 0)) isFlushWithContainerBottom = true;
146
139
  }
147
140
  // previous item isn't selected
148
141
  // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview
149
- let roundTops = !state.selectionManager.isSelected(item.prevKey) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $5Mbbg$reactariainteractions.isFocusVisible)() && state.selectionManager.isFocused));
150
- let roundBottoms = !state.selectionManager.isSelected(item.nextKey) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $5Mbbg$reactariainteractions.isFocusVisible)() && state.selectionManager.isFocused));
142
+ let roundTops = !(item.prevKey != null && state.selectionManager.isSelected(item.prevKey)) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $5Mbbg$reactariainteractions.isFocusVisible)() && state.selectionManager.isFocused));
143
+ let roundBottoms = !(item.nextKey != null && state.selectionManager.isSelected(item.nextKey)) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $5Mbbg$reactariainteractions.isFocusVisible)() && state.selectionManager.isFocused));
151
144
  let content = typeof item.rendered === 'string' ? /*#__PURE__*/ (0, ($parcel$interopDefault($5Mbbg$react))).createElement((0, $5Mbbg$reactspectrumtext.Text), null, item.rendered) : item.rendered;
152
145
  if (isDisabled) content = /*#__PURE__*/ (0, ($parcel$interopDefault($5Mbbg$react))).createElement((0, $5Mbbg$reactspectrumprovider.Provider), {
153
146
  isDisabled: true
@@ -169,9 +162,9 @@ function $9eae7a1cb1535a6b$export$c6bde0c04b033c0e(props) {
169
162
  'is-hovered': isHovered,
170
163
  'is-selected': isSelected,
171
164
  'is-disabled': isDisabled,
172
- 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),
173
- 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
174
- 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),
165
+ 'is-prev-selected': item.prevKey != null && state.selectionManager.isSelected(item.prevKey),
166
+ 'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),
167
+ 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || item.nextKey != null && state.selectionManager.isSelected(item.nextKey)),
175
168
  'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,
176
169
  'react-spectrum-ListViewItem--firstRow': isFirstRow,
177
170
  'react-spectrum-ListViewItem--lastRow': isLastRow,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6BM,SAAS,0CAAgB,KAA2B;QAyHnD,wBAAmC;IAxHzC,IAAI,QACF,IAAI,gBACJ,YAAY,EACb,GAAG;IACJ,IAAI,SACF,KAAK,aACL,SAAS,aACT,SAAS,mBACT,eAAe,mBACf,eAAe,UACf,MAAM,oBACN,gBAAgB,gBAChB,YAAY,EACb,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7B,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAkB;IACpC,IAAI,qBAAqB,CAAA,GAAA,mBAAK,EAAkB;IAChD,IAAI,EACF,gBAAgB,oBAAoB,EACpC,YAAY,gBAAgB,EAC7B,GAAG,CAAA,GAAA,kCAAW,EAAE;QAAC,QAAQ;IAAI;IAC9B,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAW;IAC9C,IAAI,YACF,QAAQ,iBACR,aAAa,aACb,SAAS,oBACT,gBAAgB,cAChB,UAAU,cACV,UAAU,mBACV,eAAe,aACf,SAAS,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AC,sCAAsC;YAAA;YAC1E,aAAa;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,0CAA0C;gBAAE,GAAG,gBAAgB;YAAA;YAC1G,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YACpF,OAAO;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YAC7E,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBAAE,SAAS;YAAI;YACjG,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;gBACT,SAAS;YACX;YACA,YAAY;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,yCAAyC;gBAAE,SAAS;YAAI;QACpG;OACC,uBACD,0DAAC,CAAA,GAAA,oCAAS,SACP;AAOf","sources":["packages/@react-spectrum/list/src/ListViewItem.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 */\nimport {Checkbox} from '@react-spectrum/checkbox';\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames, ClearSlots, SlotProvider, useHasChild} from '@react-spectrum/utils';\nimport {CSSTransition} from 'react-transition-group';\nimport type {DraggableItemResult, DropIndicatorAria, DroppableItemResult} from '@react-aria/dnd';\nimport {DropTarget, Node} from '@react-types/shared';\nimport {FocusRing, useFocusRing} from '@react-aria/focus';\nimport {Grid} from '@react-spectrum/layout';\nimport {isFocusVisible as isGlobalFocusVisible, useHover} from '@react-aria/interactions';\nimport ListGripper from '@spectrum-icons/ui/ListGripper';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider} from '@react-spectrum/provider';\nimport React, {useContext, useRef} from 'react';\nimport {Text} from '@react-spectrum/text';\nimport {useButton} from '@react-aria/button';\nimport {useGridListItem, useGridListSelectionCheckbox} from '@react-aria/gridlist';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface ListViewItemProps<T> {\n item: Node<T>,\n isEmphasized: boolean,\n hasActions: boolean\n}\n\nexport function ListViewItem<T>(props: ListViewItemProps<T>) {\n let {\n item,\n isEmphasized\n } = props;\n let {\n state,\n dragState,\n dropState,\n isListDraggable,\n isListDroppable,\n layout,\n dragAndDropHooks,\n loadingState\n } = useContext(ListViewContext);\n let {direction} = useLocale();\n let rowRef = useRef<HTMLDivElement>(undefined);\n let checkboxWrapperRef = useRef<HTMLDivElement>(undefined);\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n rowProps,\n gridCellProps,\n isPressed,\n descriptionProps,\n isSelected,\n isDisabled,\n allowsSelection,\n hasAction\n } = useGridListItem({\n node: item,\n isVirtualized: true,\n shouldSelectOnPressUp: isListDraggable\n }, state, rowRef);\n let isDroppable = isListDroppable && !isDisabled;\n let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});\n\n let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);\n let hasDescription = useHasChild(`.${listStyles['react-spectrum-ListViewItem-description']}`, rowRef);\n\n let draggableItem: DraggableItemResult;\n if (isListDraggable) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n draggableItem = dragAndDropHooks.useDraggableItem({key: item.key, hasDragButton: true}, dragState);\n if (isDisabled) {\n draggableItem = null;\n }\n }\n let droppableItem: DroppableItemResult;\n let isDropTarget: boolean;\n let dropIndicator: DropIndicatorAria;\n let dropIndicatorRef = useRef(undefined);\n if (isListDroppable) {\n let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;\n isDropTarget = dropState.isDropTarget(target);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n dropIndicator = dragAndDropHooks.useDropIndicator({target}, dropState, dropIndicatorRef);\n }\n\n let dragButtonRef = React.useRef(undefined);\n let {buttonProps} = useButton({\n ...draggableItem?.dragButtonProps,\n elementType: 'div'\n }, dragButtonRef);\n\n let chevron = direction === 'ltr'\n ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n )\n : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n );\n\n let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n let dropProps = isDroppable ? droppableItem?.dropProps : {'aria-hidden': droppableItem?.dropProps['aria-hidden']};\n const mergedProps = mergeProps(\n rowProps,\n draggableItem?.dragProps,\n dropProps,\n hoverProps,\n focusWithinProps,\n focusProps,\n // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,\n // allowing for single swipe navigation between row drop indicator\n dragAndDropHooks?.isVirtualDragging() && {tabIndex: null}\n );\n\n let isFirstRow = item.prevKey == null;\n let isLastRow = item.nextKey == null;\n // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom\n // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap\n // with bottom border\n let isFlushWithContainerBottom = false;\n if (isLastRow && loadingState !== 'loadingMore') {\n if (layout.getContentSize()?.height >= layout.virtualizer?.visibleRect.height) {\n isFlushWithContainerBottom = true;\n }\n }\n // previous item isn't selected\n // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview\n let roundTops = (!state.selectionManager.isSelected(item.prevKey)\n && (state.selectionManager.focusedKey !== item.prevKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n let roundBottoms = (!state.selectionManager.isSelected(item.nextKey)\n && (state.selectionManager.focusedKey !== item.nextKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n\n let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;\n if (isDisabled) {\n content = <Provider isDisabled>{content}</Provider>;\n }\n\n return (\n <div\n {...mergedProps}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListView-row',\n {\n 'focus-ring': isFocusVisible,\n 'round-tops':\n roundTops || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key),\n 'round-bottoms':\n roundBottoms || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key)\n }\n )\n }\n ref={rowRef}>\n <div\n // TODO: refactor the css here now that we are focusing the row?\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem',\n {\n 'is-active': isPressed,\n 'is-focused': isFocusVisibleWithin,\n 'focus-ring': isFocusVisible,\n 'is-hovered': isHovered,\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),\n 'is-next-selected': state.selectionManager.isSelected(item.nextKey),\n 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),\n 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,\n 'react-spectrum-ListViewItem--firstRow': isFirstRow,\n 'react-spectrum-ListViewItem--lastRow': isLastRow,\n 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,\n 'react-spectrum-ListViewItem--hasDescription': hasDescription\n }\n )\n }\n {...gridCellProps}>\n <Grid UNSAFE_className={listStyles['react-spectrum-ListViewItem-grid']}>\n {isListDraggable &&\n <div className={listStyles['react-spectrum-ListViewItem-draghandle-container']}>\n {!isDisabled &&\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <div\n {...buttonProps as React.HTMLAttributes<HTMLElement>}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-draghandle-button'\n )\n }\n style={!isFocusVisibleWithin ? {...visuallyHiddenProps.style} : {}}\n ref={dragButtonRef}\n draggable=\"true\">\n <ListGripper />\n </div>\n </FocusRing>\n }\n </div>\n }\n {isListDroppable && !dropIndicator?.isHidden &&\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n }\n <CSSTransition\n in={showCheckbox}\n unmountOnExit\n classNames={{\n enter: listStyles['react-spectrum-ListViewItem-checkbox--enter'],\n enterActive: listStyles['react-spectrum-ListViewItem-checkbox--enterActive'],\n exit: listStyles['react-spectrum-ListViewItem-checkbox--exit'],\n exitActive: listStyles['react-spectrum-ListViewItem-checkbox--exitActive']\n }}\n timeout={160}\n nodeRef={checkboxWrapperRef} >\n <div ref={checkboxWrapperRef} className={listStyles['react-spectrum-ListViewItem-checkboxWrapper']}>\n <Checkbox\n {...checkboxProps}\n UNSAFE_className={listStyles['react-spectrum-ListViewItem-checkbox']}\n isEmphasized={isEmphasized} />\n </div>\n </CSSTransition>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-content']},\n description: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-description'], ...descriptionProps},\n illustration: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n image: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n actionButton: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'], isQuiet: true},\n actionGroup: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true,\n density: 'compact'\n },\n actionMenu: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actionmenu'], isQuiet: true}\n }}>\n {content}\n <ClearSlots>\n {chevron}\n </ClearSlots>\n </SlotProvider>\n </Grid>\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListViewItem.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6BM,SAAS,0CAAgB,KAA2B;QA6GrD,qCAWE,wBAAoC;IAvH1C,IAAI,QACF,IAAI,gBACJ,YAAY,EACb,GAAG;IACJ,IAAI,SACF,KAAK,aACL,SAAS,aACT,SAAS,mBACT,eAAe,mBACf,eAAe,UACf,MAAM,oBACN,gBAAgB,gBAChB,YAAY,EACb,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7B,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAyB;IAC3C,IAAI,qBAAqB,CAAA,GAAA,mBAAK,EAAyB;IACvD,IAAI,EACF,gBAAgB,oBAAoB,EACpC,YAAY,gBAAgB,EAC7B,GAAG,CAAA,GAAA,kCAAW,EAAE;QAAC,QAAQ;IAAI;IAC9B,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAW;IAC9C,IAAI,YACF,QAAQ,iBACR,aAAa,aACb,SAAS,oBACT,gBAAgB,cAChB,UAAU,cACV,UAAU,mBACV,eAAe,aACf,SAAS,EACV,GAAG,CAAA,GAAA,wCAAc,EAAE;QAClB,MAAM;QACN,eAAe;QACf,uBAAuB;IACzB,GAAG,OAAO;IACV,I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sC;YAAA;YAC1E,aAAa;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,0CAA0C;gBAAE,GAAG,gBAAgB;YAAA;YAC1G,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YACpF,OAAO;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YAC7E,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBAAE,SAAS;YAAI;YACjG,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;gBACT,SAAS;YACX;YACA,YAAY;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,yCAAyC;gBAAE,SAAS;YAAI;QACpG;OACC,uBACD,0DAAC,CAAA,GAAA,oCAAS,SACP;AAOf","sources":["packages/@react-spectrum/list/src/ListViewItem.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 */\nimport {Checkbox} from '@react-spectrum/checkbox';\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames, ClearSlots, SlotProvider, useHasChild} from '@react-spectrum/utils';\nimport {CSSTransition} from 'react-transition-group';\nimport type {DraggableItemResult, DropIndicatorAria} from '@react-aria/dnd';\nimport {DropTarget, Node} from '@react-types/shared';\nimport {FocusRing, useFocusRing} from '@react-aria/focus';\nimport {Grid} from '@react-spectrum/layout';\nimport {isFocusVisible as isGlobalFocusVisible, useHover} from '@react-aria/interactions';\nimport ListGripper from '@spectrum-icons/ui/ListGripper';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider} from '@react-spectrum/provider';\nimport React, {useContext, useRef} from 'react';\nimport {Text} from '@react-spectrum/text';\nimport {useButton} from '@react-aria/button';\nimport {useGridListItem, useGridListSelectionCheckbox} from '@react-aria/gridlist';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface ListViewItemProps<T> {\n item: Node<T>,\n isEmphasized: boolean,\n hasActions: boolean\n}\n\nexport function ListViewItem<T>(props: ListViewItemProps<T>) {\n let {\n item,\n isEmphasized\n } = props;\n let {\n state,\n dragState,\n dropState,\n isListDraggable,\n isListDroppable,\n layout,\n dragAndDropHooks,\n loadingState\n } = useContext(ListViewContext)!;\n let {direction} = useLocale();\n let rowRef = useRef<HTMLDivElement | null>(null);\n let checkboxWrapperRef = useRef<HTMLDivElement | null>(null);\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n rowProps,\n gridCellProps,\n isPressed,\n descriptionProps,\n isSelected,\n isDisabled,\n allowsSelection,\n hasAction\n } = useGridListItem({\n node: item,\n isVirtualized: true,\n shouldSelectOnPressUp: isListDraggable\n }, state, rowRef);\n let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});\n\n let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);\n let hasDescription = useHasChild(`.${listStyles['react-spectrum-ListViewItem-description']}`, rowRef);\n\n let draggableItem: DraggableItemResult | null = null;\n if (isListDraggable && dragAndDropHooks && dragState) {\n \n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n if (isDisabled) {\n draggableItem = null;\n }\n }\n let isDropTarget = false;\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement | null>(null);\n if (isListDroppable && dragAndDropHooks && dropState) {\n let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;\n isDropTarget = dropState.isDropTarget(target);\n \n dropIndicator = dragAndDropHooks.useDropIndicator!({target}, dropState, dropIndicatorRef);\n }\n\n let dragButtonRef = React.useRef<HTMLDivElement | null>(null);\n let {buttonProps} = useButton({\n ...draggableItem?.dragButtonProps,\n elementType: 'div'\n }, dragButtonRef);\n\n let chevron = direction === 'ltr'\n ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n )\n : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n );\n\n let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n const mergedProps = mergeProps(\n rowProps,\n draggableItem?.dragProps,\n hoverProps,\n focusWithinProps,\n focusProps\n );\n \n // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,\n // allowing for single swipe navigation between row drop indicator\n if (dragAndDropHooks?.isVirtualDragging?.()) {\n mergedProps.tabIndex = undefined;\n }\n\n let isFirstRow = item.prevKey == null;\n let isLastRow = item.nextKey == null;\n // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom\n // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap\n // with bottom border\n let isFlushWithContainerBottom = false;\n if (isLastRow && loadingState !== 'loadingMore') {\n if (layout.getContentSize()?.height >= (layout.virtualizer?.visibleRect.height ?? 0)) {\n isFlushWithContainerBottom = true;\n }\n }\n // previous item isn't selected\n // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview\n let roundTops = (!(item.prevKey != null && state.selectionManager.isSelected(item.prevKey))\n && (state.selectionManager.focusedKey !== item.prevKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n let roundBottoms = (!(item.nextKey != null && state.selectionManager.isSelected(item.nextKey))\n && (state.selectionManager.focusedKey !== item.nextKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n\n let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;\n if (isDisabled) {\n content = <Provider isDisabled>{content}</Provider>;\n }\n\n return (\n <div\n {...mergedProps}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListView-row',\n {\n 'focus-ring': isFocusVisible,\n 'round-tops':\n roundTops || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key),\n 'round-bottoms':\n roundBottoms || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key)\n }\n )\n }\n ref={rowRef}>\n <div\n // TODO: refactor the css here now that we are focusing the row?\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem',\n {\n 'is-active': isPressed,\n 'is-focused': isFocusVisibleWithin,\n 'focus-ring': isFocusVisible,\n 'is-hovered': isHovered,\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-prev-selected': item.prevKey != null && state.selectionManager.isSelected(item.prevKey),\n 'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),\n 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || (item.nextKey != null && state.selectionManager.isSelected(item.nextKey))),\n 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,\n 'react-spectrum-ListViewItem--firstRow': isFirstRow,\n 'react-spectrum-ListViewItem--lastRow': isLastRow,\n 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,\n 'react-spectrum-ListViewItem--hasDescription': hasDescription\n }\n )\n }\n {...gridCellProps}>\n <Grid UNSAFE_className={listStyles['react-spectrum-ListViewItem-grid']}>\n {isListDraggable &&\n <div className={listStyles['react-spectrum-ListViewItem-draghandle-container']}>\n {!isDisabled &&\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <div\n {...buttonProps as React.HTMLAttributes<HTMLElement>}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-draghandle-button'\n )\n }\n style={!isFocusVisibleWithin ? {...visuallyHiddenProps.style} : {}}\n ref={dragButtonRef}\n draggable=\"true\">\n <ListGripper />\n </div>\n </FocusRing>\n }\n </div>\n }\n {isListDroppable && !dropIndicator?.isHidden &&\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n }\n <CSSTransition\n in={showCheckbox}\n unmountOnExit\n classNames={{\n enter: listStyles['react-spectrum-ListViewItem-checkbox--enter'],\n enterActive: listStyles['react-spectrum-ListViewItem-checkbox--enterActive'],\n exit: listStyles['react-spectrum-ListViewItem-checkbox--exit'],\n exitActive: listStyles['react-spectrum-ListViewItem-checkbox--exitActive']\n }}\n timeout={160}\n nodeRef={checkboxWrapperRef} >\n <div ref={checkboxWrapperRef} className={listStyles['react-spectrum-ListViewItem-checkboxWrapper']}>\n <Checkbox\n {...checkboxProps}\n UNSAFE_className={listStyles['react-spectrum-ListViewItem-checkbox']}\n isEmphasized={isEmphasized} />\n </div>\n </CSSTransition>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-content']},\n description: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-description'], ...descriptionProps},\n illustration: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n image: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n actionButton: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'], isQuiet: true},\n actionGroup: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true,\n density: 'compact'\n },\n actionMenu: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actionmenu'], isQuiet: true}\n }}>\n {content}\n <ClearSlots>\n {chevron}\n </ClearSlots>\n </SlotProvider>\n </Grid>\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListViewItem.main.js.map"}
@@ -53,12 +53,12 @@ function $parcel$interopDefault(a) {
53
53
 
54
54
 
55
55
  function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
56
- var _layout_getContentSize, _layout_virtualizer;
56
+ var _dragAndDropHooks_isVirtualDragging, _layout_getContentSize, _layout_virtualizer;
57
57
  let { item: item, isEmphasized: isEmphasized } = props;
58
58
  let { state: state, dragState: dragState, dropState: dropState, isListDraggable: isListDraggable, isListDroppable: isListDroppable, layout: layout, dragAndDropHooks: dragAndDropHooks, loadingState: loadingState } = (0, $asbps$useContext)((0, $f85fb77f9d4cbc6c$export$870039b0abfe3de0));
59
59
  let { direction: direction } = (0, $asbps$useLocale)();
60
- let rowRef = (0, $asbps$useRef)(undefined);
61
- let checkboxWrapperRef = (0, $asbps$useRef)(undefined);
60
+ let rowRef = (0, $asbps$useRef)(null);
61
+ let checkboxWrapperRef = (0, $asbps$useRef)(null);
62
62
  let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = (0, $asbps$useFocusRing)({
63
63
  within: true
64
64
  });
@@ -68,7 +68,6 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
68
68
  isVirtualized: true,
69
69
  shouldSelectOnPressUp: isListDraggable
70
70
  }, state, rowRef);
71
- let isDroppable = isListDroppable && !isDisabled;
72
71
  let { hoverProps: hoverProps, isHovered: isHovered } = (0, $asbps$useHover)({
73
72
  isDisabled: !allowsSelection && !hasAction
74
73
  });
@@ -76,32 +75,29 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
76
75
  key: item.key
77
76
  }, state);
78
77
  let hasDescription = (0, $asbps$useHasChild)(`.${(0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-description']}`, rowRef);
79
- let draggableItem;
80
- if (isListDraggable) {
81
- // eslint-disable-next-line react-hooks/rules-of-hooks
78
+ let draggableItem = null;
79
+ if (isListDraggable && dragAndDropHooks && dragState) {
82
80
  draggableItem = dragAndDropHooks.useDraggableItem({
83
81
  key: item.key,
84
82
  hasDragButton: true
85
83
  }, dragState);
86
84
  if (isDisabled) draggableItem = null;
87
85
  }
88
- let droppableItem;
89
- let isDropTarget;
90
- let dropIndicator;
91
- let dropIndicatorRef = (0, $asbps$useRef)(undefined);
92
- if (isListDroppable) {
86
+ let isDropTarget = false;
87
+ let dropIndicator = null;
88
+ let dropIndicatorRef = (0, $asbps$useRef)(null);
89
+ if (isListDroppable && dragAndDropHooks && dropState) {
93
90
  let target = {
94
91
  type: 'item',
95
92
  key: item.key,
96
93
  dropPosition: 'on'
97
94
  };
98
95
  isDropTarget = dropState.isDropTarget(target);
99
- // eslint-disable-next-line react-hooks/rules-of-hooks
100
96
  dropIndicator = dragAndDropHooks.useDropIndicator({
101
97
  target: target
102
98
  }, dropState, dropIndicatorRef);
103
99
  }
104
- let dragButtonRef = (0, $asbps$react).useRef(undefined);
100
+ let dragButtonRef = (0, $asbps$react).useRef(null);
105
101
  let { buttonProps: buttonProps } = (0, $asbps$useButton)({
106
102
  ...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
107
103
  elementType: 'div'
@@ -121,27 +117,24 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
121
117
  });
122
118
  let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';
123
119
  let { visuallyHiddenProps: visuallyHiddenProps } = (0, $asbps$useVisuallyHidden)();
124
- let dropProps = isDroppable ? droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps : {
125
- 'aria-hidden': droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps['aria-hidden']
126
- };
127
- const mergedProps = (0, $asbps$mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, dropProps, hoverProps, focusWithinProps, focusProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
120
+ const mergedProps = (0, $asbps$mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, hoverProps, focusWithinProps, focusProps);
121
+ // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
128
122
  // allowing for single swipe navigation between row drop indicator
129
- (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
130
- tabIndex: null
131
- });
123
+ if (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) mergedProps.tabIndex = undefined;
132
124
  let isFirstRow = item.prevKey == null;
133
125
  let isLastRow = item.nextKey == null;
134
126
  // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom
135
127
  // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap
136
128
  // with bottom border
137
129
  let isFlushWithContainerBottom = false;
130
+ var _layout_virtualizer_visibleRect_height;
138
131
  if (isLastRow && loadingState !== 'loadingMore') {
139
- if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
132
+ if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer_visibleRect_height = (_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height) !== null && _layout_virtualizer_visibleRect_height !== void 0 ? _layout_virtualizer_visibleRect_height : 0)) isFlushWithContainerBottom = true;
140
133
  }
141
134
  // previous item isn't selected
142
135
  // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview
143
- let roundTops = !state.selectionManager.isSelected(item.prevKey) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
144
- let roundBottoms = !state.selectionManager.isSelected(item.nextKey) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
136
+ let roundTops = !(item.prevKey != null && state.selectionManager.isSelected(item.prevKey)) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
137
+ let roundBottoms = !(item.nextKey != null && state.selectionManager.isSelected(item.nextKey)) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
145
138
  let content = typeof item.rendered === 'string' ? /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Text), null, item.rendered) : item.rendered;
146
139
  if (isDisabled) content = /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Provider), {
147
140
  isDisabled: true
@@ -163,9 +156,9 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
163
156
  'is-hovered': isHovered,
164
157
  'is-selected': isSelected,
165
158
  'is-disabled': isDisabled,
166
- 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),
167
- 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
168
- 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),
159
+ 'is-prev-selected': item.prevKey != null && state.selectionManager.isSelected(item.prevKey),
160
+ 'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),
161
+ 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || item.nextKey != null && state.selectionManager.isSelected(item.nextKey)),
169
162
  'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,
170
163
  'react-spectrum-ListViewItem--firstRow': isFirstRow,
171
164
  'react-spectrum-ListViewItem--lastRow': isLastRow,
@@ -53,12 +53,12 @@ function $parcel$interopDefault(a) {
53
53
 
54
54
 
55
55
  function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
56
- var _layout_getContentSize, _layout_virtualizer;
56
+ var _dragAndDropHooks_isVirtualDragging, _layout_getContentSize, _layout_virtualizer;
57
57
  let { item: item, isEmphasized: isEmphasized } = props;
58
58
  let { state: state, dragState: dragState, dropState: dropState, isListDraggable: isListDraggable, isListDroppable: isListDroppable, layout: layout, dragAndDropHooks: dragAndDropHooks, loadingState: loadingState } = (0, $asbps$useContext)((0, $f85fb77f9d4cbc6c$export$870039b0abfe3de0));
59
59
  let { direction: direction } = (0, $asbps$useLocale)();
60
- let rowRef = (0, $asbps$useRef)(undefined);
61
- let checkboxWrapperRef = (0, $asbps$useRef)(undefined);
60
+ let rowRef = (0, $asbps$useRef)(null);
61
+ let checkboxWrapperRef = (0, $asbps$useRef)(null);
62
62
  let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = (0, $asbps$useFocusRing)({
63
63
  within: true
64
64
  });
@@ -68,7 +68,6 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
68
68
  isVirtualized: true,
69
69
  shouldSelectOnPressUp: isListDraggable
70
70
  }, state, rowRef);
71
- let isDroppable = isListDroppable && !isDisabled;
72
71
  let { hoverProps: hoverProps, isHovered: isHovered } = (0, $asbps$useHover)({
73
72
  isDisabled: !allowsSelection && !hasAction
74
73
  });
@@ -76,32 +75,29 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
76
75
  key: item.key
77
76
  }, state);
78
77
  let hasDescription = (0, $asbps$useHasChild)(`.${(0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-description']}`, rowRef);
79
- let draggableItem;
80
- if (isListDraggable) {
81
- // eslint-disable-next-line react-hooks/rules-of-hooks
78
+ let draggableItem = null;
79
+ if (isListDraggable && dragAndDropHooks && dragState) {
82
80
  draggableItem = dragAndDropHooks.useDraggableItem({
83
81
  key: item.key,
84
82
  hasDragButton: true
85
83
  }, dragState);
86
84
  if (isDisabled) draggableItem = null;
87
85
  }
88
- let droppableItem;
89
- let isDropTarget;
90
- let dropIndicator;
91
- let dropIndicatorRef = (0, $asbps$useRef)(undefined);
92
- if (isListDroppable) {
86
+ let isDropTarget = false;
87
+ let dropIndicator = null;
88
+ let dropIndicatorRef = (0, $asbps$useRef)(null);
89
+ if (isListDroppable && dragAndDropHooks && dropState) {
93
90
  let target = {
94
91
  type: 'item',
95
92
  key: item.key,
96
93
  dropPosition: 'on'
97
94
  };
98
95
  isDropTarget = dropState.isDropTarget(target);
99
- // eslint-disable-next-line react-hooks/rules-of-hooks
100
96
  dropIndicator = dragAndDropHooks.useDropIndicator({
101
97
  target: target
102
98
  }, dropState, dropIndicatorRef);
103
99
  }
104
- let dragButtonRef = (0, $asbps$react).useRef(undefined);
100
+ let dragButtonRef = (0, $asbps$react).useRef(null);
105
101
  let { buttonProps: buttonProps } = (0, $asbps$useButton)({
106
102
  ...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
107
103
  elementType: 'div'
@@ -121,27 +117,24 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
121
117
  });
122
118
  let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';
123
119
  let { visuallyHiddenProps: visuallyHiddenProps } = (0, $asbps$useVisuallyHidden)();
124
- let dropProps = isDroppable ? droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps : {
125
- 'aria-hidden': droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps['aria-hidden']
126
- };
127
- const mergedProps = (0, $asbps$mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, dropProps, hoverProps, focusWithinProps, focusProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
120
+ const mergedProps = (0, $asbps$mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, hoverProps, focusWithinProps, focusProps);
121
+ // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
128
122
  // allowing for single swipe navigation between row drop indicator
129
- (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
130
- tabIndex: null
131
- });
123
+ if (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) mergedProps.tabIndex = undefined;
132
124
  let isFirstRow = item.prevKey == null;
133
125
  let isLastRow = item.nextKey == null;
134
126
  // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom
135
127
  // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap
136
128
  // with bottom border
137
129
  let isFlushWithContainerBottom = false;
130
+ var _layout_virtualizer_visibleRect_height;
138
131
  if (isLastRow && loadingState !== 'loadingMore') {
139
- if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
132
+ if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer_visibleRect_height = (_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height) !== null && _layout_virtualizer_visibleRect_height !== void 0 ? _layout_virtualizer_visibleRect_height : 0)) isFlushWithContainerBottom = true;
140
133
  }
141
134
  // previous item isn't selected
142
135
  // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview
143
- let roundTops = !state.selectionManager.isSelected(item.prevKey) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
144
- let roundBottoms = !state.selectionManager.isSelected(item.nextKey) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
136
+ let roundTops = !(item.prevKey != null && state.selectionManager.isSelected(item.prevKey)) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
137
+ let roundBottoms = !(item.nextKey != null && state.selectionManager.isSelected(item.nextKey)) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
145
138
  let content = typeof item.rendered === 'string' ? /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Text), null, item.rendered) : item.rendered;
146
139
  if (isDisabled) content = /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Provider), {
147
140
  isDisabled: true
@@ -163,9 +156,9 @@ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
163
156
  'is-hovered': isHovered,
164
157
  'is-selected': isSelected,
165
158
  'is-disabled': isDisabled,
166
- 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),
167
- 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
168
- 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),
159
+ 'is-prev-selected': item.prevKey != null && state.selectionManager.isSelected(item.prevKey),
160
+ 'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),
161
+ 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || item.nextKey != null && state.selectionManager.isSelected(item.nextKey)),
169
162
  'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,
170
163
  'react-spectrum-ListViewItem--firstRow': isFirstRow,
171
164
  'react-spectrum-ListViewItem--lastRow': isLastRow,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6BM,SAAS,0CAAgB,KAA2B;QAyHnD,wBAAmC;IAxHzC,IAAI,QACF,IAAI,gBACJ,YAAY,EACb,GAAG;IACJ,IAAI,SACF,KAAK,aACL,SAAS,aACT,SAAS,mBACT,eAAe,mBACf,eAAe,UACf,MAAM,oBACN,gBAAgB,gBAChB,YAAY,EACb,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7B,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,SAAS,CAAA,GAAA,aAAK,EAAkB;IACpC,IAAI,qBAAqB,CAAA,GAAA,aAAK,EAAkB;IAChD,IAAI,EACF,gBAAgB,oBAAoB,EACpC,YAAY,gBAAgB,EAC7B,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,QAAQ;IAAI;IAC9B,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW;IAC9C,IAAI,YACF,QAAQ,iBACR,aAAa,aACb,SAAS,oBACT,gBAAgB,cAChB,UAAU,cACV,UAAU,mBACV,eAAe,aACf,SAAS,EACV,GAAG,CAAA,GAAA,sBAAc,EAAE;QAClB,MAAM;QACN,eAAe;QACf,uBAAuB;IACzB,GAAG,OAAO;IACV,IAAI,cAAc,mBAAmB,CAAC;IACtC,IAAI,cAAC,UAAU,aAAE,SAA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AAC,CAAC,wCAAwC;YAAA;YACpF,OAAO;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YAC7E,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBAAE,SAAS;YAAI;YACjG,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;gBACT,SAAS;YACX;YACA,YAAY;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,yCAAyC;gBAAE,SAAS;YAAI;QACpG;OACC,uBACD,gCAAC,CAAA,GAAA,iBAAS,SACP;AAOf","sources":["packages/@react-spectrum/list/src/ListViewItem.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 */\nimport {Checkbox} from '@react-spectrum/checkbox';\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames, ClearSlots, SlotProvider, useHasChild} from '@react-spectrum/utils';\nimport {CSSTransition} from 'react-transition-group';\nimport type {DraggableItemResult, DropIndicatorAria, DroppableItemResult} from '@react-aria/dnd';\nimport {DropTarget, Node} from '@react-types/shared';\nimport {FocusRing, useFocusRing} from '@react-aria/focus';\nimport {Grid} from '@react-spectrum/layout';\nimport {isFocusVisible as isGlobalFocusVisible, useHover} from '@react-aria/interactions';\nimport ListGripper from '@spectrum-icons/ui/ListGripper';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider} from '@react-spectrum/provider';\nimport React, {useContext, useRef} from 'react';\nimport {Text} from '@react-spectrum/text';\nimport {useButton} from '@react-aria/button';\nimport {useGridListItem, useGridListSelectionCheckbox} from '@react-aria/gridlist';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface ListViewItemProps<T> {\n item: Node<T>,\n isEmphasized: boolean,\n hasActions: boolean\n}\n\nexport function ListViewItem<T>(props: ListViewItemProps<T>) {\n let {\n item,\n isEmphasized\n } = props;\n let {\n state,\n dragState,\n dropState,\n isListDraggable,\n isListDroppable,\n layout,\n dragAndDropHooks,\n loadingState\n } = useContext(ListViewContext);\n let {direction} = useLocale();\n let rowRef = useRef<HTMLDivElement>(undefined);\n let checkboxWrapperRef = useRef<HTMLDivElement>(undefined);\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n rowProps,\n gridCellProps,\n isPressed,\n descriptionProps,\n isSelected,\n isDisabled,\n allowsSelection,\n hasAction\n } = useGridListItem({\n node: item,\n isVirtualized: true,\n shouldSelectOnPressUp: isListDraggable\n }, state, rowRef);\n let isDroppable = isListDroppable && !isDisabled;\n let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});\n\n let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);\n let hasDescription = useHasChild(`.${listStyles['react-spectrum-ListViewItem-description']}`, rowRef);\n\n let draggableItem: DraggableItemResult;\n if (isListDraggable) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n draggableItem = dragAndDropHooks.useDraggableItem({key: item.key, hasDragButton: true}, dragState);\n if (isDisabled) {\n draggableItem = null;\n }\n }\n let droppableItem: DroppableItemResult;\n let isDropTarget: boolean;\n let dropIndicator: DropIndicatorAria;\n let dropIndicatorRef = useRef(undefined);\n if (isListDroppable) {\n let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;\n isDropTarget = dropState.isDropTarget(target);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n dropIndicator = dragAndDropHooks.useDropIndicator({target}, dropState, dropIndicatorRef);\n }\n\n let dragButtonRef = React.useRef(undefined);\n let {buttonProps} = useButton({\n ...draggableItem?.dragButtonProps,\n elementType: 'div'\n }, dragButtonRef);\n\n let chevron = direction === 'ltr'\n ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n )\n : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n );\n\n let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n let dropProps = isDroppable ? droppableItem?.dropProps : {'aria-hidden': droppableItem?.dropProps['aria-hidden']};\n const mergedProps = mergeProps(\n rowProps,\n draggableItem?.dragProps,\n dropProps,\n hoverProps,\n focusWithinProps,\n focusProps,\n // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,\n // allowing for single swipe navigation between row drop indicator\n dragAndDropHooks?.isVirtualDragging() && {tabIndex: null}\n );\n\n let isFirstRow = item.prevKey == null;\n let isLastRow = item.nextKey == null;\n // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom\n // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap\n // with bottom border\n let isFlushWithContainerBottom = false;\n if (isLastRow && loadingState !== 'loadingMore') {\n if (layout.getContentSize()?.height >= layout.virtualizer?.visibleRect.height) {\n isFlushWithContainerBottom = true;\n }\n }\n // previous item isn't selected\n // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview\n let roundTops = (!state.selectionManager.isSelected(item.prevKey)\n && (state.selectionManager.focusedKey !== item.prevKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n let roundBottoms = (!state.selectionManager.isSelected(item.nextKey)\n && (state.selectionManager.focusedKey !== item.nextKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n\n let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;\n if (isDisabled) {\n content = <Provider isDisabled>{content}</Provider>;\n }\n\n return (\n <div\n {...mergedProps}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListView-row',\n {\n 'focus-ring': isFocusVisible,\n 'round-tops':\n roundTops || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key),\n 'round-bottoms':\n roundBottoms || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key)\n }\n )\n }\n ref={rowRef}>\n <div\n // TODO: refactor the css here now that we are focusing the row?\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem',\n {\n 'is-active': isPressed,\n 'is-focused': isFocusVisibleWithin,\n 'focus-ring': isFocusVisible,\n 'is-hovered': isHovered,\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),\n 'is-next-selected': state.selectionManager.isSelected(item.nextKey),\n 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),\n 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,\n 'react-spectrum-ListViewItem--firstRow': isFirstRow,\n 'react-spectrum-ListViewItem--lastRow': isLastRow,\n 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,\n 'react-spectrum-ListViewItem--hasDescription': hasDescription\n }\n )\n }\n {...gridCellProps}>\n <Grid UNSAFE_className={listStyles['react-spectrum-ListViewItem-grid']}>\n {isListDraggable &&\n <div className={listStyles['react-spectrum-ListViewItem-draghandle-container']}>\n {!isDisabled &&\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <div\n {...buttonProps as React.HTMLAttributes<HTMLElement>}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-draghandle-button'\n )\n }\n style={!isFocusVisibleWithin ? {...visuallyHiddenProps.style} : {}}\n ref={dragButtonRef}\n draggable=\"true\">\n <ListGripper />\n </div>\n </FocusRing>\n }\n </div>\n }\n {isListDroppable && !dropIndicator?.isHidden &&\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n }\n <CSSTransition\n in={showCheckbox}\n unmountOnExit\n classNames={{\n enter: listStyles['react-spectrum-ListViewItem-checkbox--enter'],\n enterActive: listStyles['react-spectrum-ListViewItem-checkbox--enterActive'],\n exit: listStyles['react-spectrum-ListViewItem-checkbox--exit'],\n exitActive: listStyles['react-spectrum-ListViewItem-checkbox--exitActive']\n }}\n timeout={160}\n nodeRef={checkboxWrapperRef} >\n <div ref={checkboxWrapperRef} className={listStyles['react-spectrum-ListViewItem-checkboxWrapper']}>\n <Checkbox\n {...checkboxProps}\n UNSAFE_className={listStyles['react-spectrum-ListViewItem-checkbox']}\n isEmphasized={isEmphasized} />\n </div>\n </CSSTransition>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-content']},\n description: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-description'], ...descriptionProps},\n illustration: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n image: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n actionButton: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'], isQuiet: true},\n actionGroup: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true,\n density: 'compact'\n },\n actionMenu: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actionmenu'], isQuiet: true}\n }}>\n {content}\n <ClearSlots>\n {chevron}\n </ClearSlots>\n </SlotProvider>\n </Grid>\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListViewItem.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6BM,SAAS,0CAAgB,KAA2B;QA6GrD,qCAWE,wBAAoC;IAvH1C,IAAI,QACF,IAAI,gBACJ,YAAY,EACb,GAAG;IACJ,IAAI,SACF,KAAK,aACL,SAAS,aACT,SAAS,mBACT,eAAe,mBACf,eAAe,UACf,MAAM,oBACN,gBAAgB,gBAChB,YAAY,EACb,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7B,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,SAAS,CAAA,GAAA,aAAK,EAAyB;IAC3C,IAAI,qBAAqB,CAAA,GAAA,aAAK,EAAyB;IACvD,IAAI,EACF,gBAAgB,oBAAoB,EACpC,YAAY,gBAAgB,EAC7B,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,QAAQ;IAAI;IAC9B,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW;IAC9C,IAAI,YACF,QAAQ,iBACR,aAAa,aACb,SAAS,oBACT,gBAAgB,cAChB,UAAU,cACV,UAAU,mBACV,eAAe,aACf,SAAS,EACV,GAAG,CAAA,GAAA,sBAAc,EAAE;QAClB,MAAM;QACN,eAAe;QACf,uBAAuB;IACzB,GAAG,OAAO;IACV,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAAC,YAAY,CAAC,mBAAmB,CAAC;IAAS;IAElF,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,mCAA2B,EAAE;QAAC,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ACpF,OAAO;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YAC7E,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBAAE,SAAS;YAAI;YACjG,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;gBACT,SAAS;YACX;YACA,YAAY;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,yCAAyC;gBAAE,SAAS;YAAI;QACpG;OACC,uBACD,gCAAC,CAAA,GAAA,iBAAS,SACP;AAOf","sources":["packages/@react-spectrum/list/src/ListViewItem.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 */\nimport {Checkbox} from '@react-spectrum/checkbox';\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames, ClearSlots, SlotProvider, useHasChild} from '@react-spectrum/utils';\nimport {CSSTransition} from 'react-transition-group';\nimport type {DraggableItemResult, DropIndicatorAria} from '@react-aria/dnd';\nimport {DropTarget, Node} from '@react-types/shared';\nimport {FocusRing, useFocusRing} from '@react-aria/focus';\nimport {Grid} from '@react-spectrum/layout';\nimport {isFocusVisible as isGlobalFocusVisible, useHover} from '@react-aria/interactions';\nimport ListGripper from '@spectrum-icons/ui/ListGripper';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider} from '@react-spectrum/provider';\nimport React, {useContext, useRef} from 'react';\nimport {Text} from '@react-spectrum/text';\nimport {useButton} from '@react-aria/button';\nimport {useGridListItem, useGridListSelectionCheckbox} from '@react-aria/gridlist';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface ListViewItemProps<T> {\n item: Node<T>,\n isEmphasized: boolean,\n hasActions: boolean\n}\n\nexport function ListViewItem<T>(props: ListViewItemProps<T>) {\n let {\n item,\n isEmphasized\n } = props;\n let {\n state,\n dragState,\n dropState,\n isListDraggable,\n isListDroppable,\n layout,\n dragAndDropHooks,\n loadingState\n } = useContext(ListViewContext)!;\n let {direction} = useLocale();\n let rowRef = useRef<HTMLDivElement | null>(null);\n let checkboxWrapperRef = useRef<HTMLDivElement | null>(null);\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n rowProps,\n gridCellProps,\n isPressed,\n descriptionProps,\n isSelected,\n isDisabled,\n allowsSelection,\n hasAction\n } = useGridListItem({\n node: item,\n isVirtualized: true,\n shouldSelectOnPressUp: isListDraggable\n }, state, rowRef);\n let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});\n\n let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);\n let hasDescription = useHasChild(`.${listStyles['react-spectrum-ListViewItem-description']}`, rowRef);\n\n let draggableItem: DraggableItemResult | null = null;\n if (isListDraggable && dragAndDropHooks && dragState) {\n \n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n if (isDisabled) {\n draggableItem = null;\n }\n }\n let isDropTarget = false;\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement | null>(null);\n if (isListDroppable && dragAndDropHooks && dropState) {\n let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;\n isDropTarget = dropState.isDropTarget(target);\n \n dropIndicator = dragAndDropHooks.useDropIndicator!({target}, dropState, dropIndicatorRef);\n }\n\n let dragButtonRef = React.useRef<HTMLDivElement | null>(null);\n let {buttonProps} = useButton({\n ...draggableItem?.dragButtonProps,\n elementType: 'div'\n }, dragButtonRef);\n\n let chevron = direction === 'ltr'\n ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n )\n : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n );\n\n let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n const mergedProps = mergeProps(\n rowProps,\n draggableItem?.dragProps,\n hoverProps,\n focusWithinProps,\n focusProps\n );\n \n // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,\n // allowing for single swipe navigation between row drop indicator\n if (dragAndDropHooks?.isVirtualDragging?.()) {\n mergedProps.tabIndex = undefined;\n }\n\n let isFirstRow = item.prevKey == null;\n let isLastRow = item.nextKey == null;\n // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom\n // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap\n // with bottom border\n let isFlushWithContainerBottom = false;\n if (isLastRow && loadingState !== 'loadingMore') {\n if (layout.getContentSize()?.height >= (layout.virtualizer?.visibleRect.height ?? 0)) {\n isFlushWithContainerBottom = true;\n }\n }\n // previous item isn't selected\n // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview\n let roundTops = (!(item.prevKey != null && state.selectionManager.isSelected(item.prevKey))\n && (state.selectionManager.focusedKey !== item.prevKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n let roundBottoms = (!(item.nextKey != null && state.selectionManager.isSelected(item.nextKey))\n && (state.selectionManager.focusedKey !== item.nextKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n\n let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;\n if (isDisabled) {\n content = <Provider isDisabled>{content}</Provider>;\n }\n\n return (\n <div\n {...mergedProps}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListView-row',\n {\n 'focus-ring': isFocusVisible,\n 'round-tops':\n roundTops || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key),\n 'round-bottoms':\n roundBottoms || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key)\n }\n )\n }\n ref={rowRef}>\n <div\n // TODO: refactor the css here now that we are focusing the row?\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem',\n {\n 'is-active': isPressed,\n 'is-focused': isFocusVisibleWithin,\n 'focus-ring': isFocusVisible,\n 'is-hovered': isHovered,\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-prev-selected': item.prevKey != null && state.selectionManager.isSelected(item.prevKey),\n 'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),\n 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || (item.nextKey != null && state.selectionManager.isSelected(item.nextKey))),\n 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,\n 'react-spectrum-ListViewItem--firstRow': isFirstRow,\n 'react-spectrum-ListViewItem--lastRow': isLastRow,\n 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,\n 'react-spectrum-ListViewItem--hasDescription': hasDescription\n }\n )\n }\n {...gridCellProps}>\n <Grid UNSAFE_className={listStyles['react-spectrum-ListViewItem-grid']}>\n {isListDraggable &&\n <div className={listStyles['react-spectrum-ListViewItem-draghandle-container']}>\n {!isDisabled &&\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <div\n {...buttonProps as React.HTMLAttributes<HTMLElement>}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-draghandle-button'\n )\n }\n style={!isFocusVisibleWithin ? {...visuallyHiddenProps.style} : {}}\n ref={dragButtonRef}\n draggable=\"true\">\n <ListGripper />\n </div>\n </FocusRing>\n }\n </div>\n }\n {isListDroppable && !dropIndicator?.isHidden &&\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n }\n <CSSTransition\n in={showCheckbox}\n unmountOnExit\n classNames={{\n enter: listStyles['react-spectrum-ListViewItem-checkbox--enter'],\n enterActive: listStyles['react-spectrum-ListViewItem-checkbox--enterActive'],\n exit: listStyles['react-spectrum-ListViewItem-checkbox--exit'],\n exitActive: listStyles['react-spectrum-ListViewItem-checkbox--exitActive']\n }}\n timeout={160}\n nodeRef={checkboxWrapperRef} >\n <div ref={checkboxWrapperRef} className={listStyles['react-spectrum-ListViewItem-checkboxWrapper']}>\n <Checkbox\n {...checkboxProps}\n UNSAFE_className={listStyles['react-spectrum-ListViewItem-checkbox']}\n isEmphasized={isEmphasized} />\n </div>\n </CSSTransition>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-content']},\n description: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-description'], ...descriptionProps},\n illustration: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n image: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n actionButton: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'], isQuiet: true},\n actionGroup: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true,\n density: 'compact'\n },\n actionMenu: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actionmenu'], isQuiet: true}\n }}>\n {content}\n <ClearSlots>\n {chevron}\n </ClearSlots>\n </SlotProvider>\n </Grid>\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListViewItem.module.js.map"}
@@ -29,7 +29,8 @@ class $a0cb8c9f009bf274$export$dab781655dfbb7d3 extends (0, $gyQtY$reactstatelyl
29
29
  let nodes = super.buildCollection();
30
30
  let y = this.contentSize.height;
31
31
  if (this.isLoading) {
32
- let rect = new (0, $gyQtY$reactstatelyvirtualizer.Rect)(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);
32
+ var _this_estimatedRowHeight;
33
+ let rect = new (0, $gyQtY$reactstatelyvirtualizer.Rect)(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : (_this_estimatedRowHeight = this.estimatedRowHeight) !== null && _this_estimatedRowHeight !== void 0 ? _this_estimatedRowHeight : 48);
33
34
  let loader = new (0, $gyQtY$reactstatelyvirtualizer.LayoutInfo)('loader', 'loader', rect);
34
35
  let node = {
35
36
  layoutInfo: loader,
@@ -60,8 +61,7 @@ class $a0cb8c9f009bf274$export$dab781655dfbb7d3 extends (0, $gyQtY$reactstatelyl
60
61
  return res;
61
62
  }
62
63
  constructor(...args){
63
- super(...args);
64
- this.isLoading = false;
64
+ super(...args), this.isLoading = false;
65
65
  }
66
66
  }
67
67
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AASM,MAAM,kDAA0B,CAAA,GAAA,oCAAS;IAG9C,OAAO,mBAA6D,EAAQ;YACzD;QAAjB,IAAI,CAAC,SAAS,GAAG,EAAA,qCAAA,oBAAoB,aAAa,cAAjC,yDAAA,mCAAmC,SAAS,KAAI;QACjE,KAAK,CAAC,OAAO;IACf;IAEU,kBAAgC;QACxC,IAAI,QAAQ,KAAK,CAAC;QAClB,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM;QAE/B,IAAI,IAAI,CAAC,SAAS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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 */\nimport {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout} from '@react-stately/layout';\nimport {Node} from '@react-types/shared';\n\ninterface ListViewLayoutProps {\n isLoading?: boolean\n}\n\nexport class ListViewLayout<T> extends ListLayout<T, ListViewLayoutProps> {\n private isLoading: boolean = false;\n\n update(invalidationContext: InvalidationContext<ListViewLayoutProps>): void {\n this.isLoading = invalidationContext.layoutOptions?.isLoading || false;\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n let nodes = super.buildCollection();\n let y = this.contentSize.height;\n\n if (this.isLoading) {\n let rect = new Rect(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);\n let loader = new LayoutInfo('loader', 'loader', rect);\n let node = {\n layoutInfo: loader,\n validRect: loader.rect\n };\n nodes.push(node);\n this.layoutNodes.set(loader.key, node);\n y = loader.rect.maxY;\n }\n\n if (nodes.length === 0) {\n let rect = new Rect(0, y, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n let node = {\n layoutInfo: placeholder,\n validRect: placeholder.rect\n };\n nodes.push(node);\n this.layoutNodes.set(placeholder.key, node);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize.height = y;\n return nodes;\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let res = super.buildItem(node, x, y);\n // allow overflow so the focus ring/selection ring can extend outside to overlap with the adjacent items borders\n res.layoutInfo.allowOverflow = true;\n return res;\n }\n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M,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,GAAG,EAAE;YACtC,IAAI,YAAY,IAAI,CAAC,IAAI;QAC3B;QAEA,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG;QAC1B,OAAO;IACT;IAEU,UAAU,IAAa,EAAE,CAAS,EAAE,CAAS,EAAc;QACnE,IAAI,MAAM,KAAK,CAAC,UAAU,MAAM,GAAG;QACnC,gHAAgH;QAChH,IAAI,UAAU,CAAC,aAAa,GAAG;QAC/B,OAAO;IACT;;6BA5CQ,YAAqB;;AA6C/B","sources":["packages/@react-spectrum/list/src/ListViewLayout.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout} from '@react-stately/layout';\nimport {Node} from '@react-types/shared';\n\ninterface ListViewLayoutProps {\n isLoading?: boolean\n}\n\nexport class ListViewLayout<T> extends ListLayout<T, ListViewLayoutProps> {\n private isLoading: boolean = false;\n\n update(invalidationContext: InvalidationContext<ListViewLayoutProps>): void {\n this.isLoading = invalidationContext.layoutOptions?.isLoading || false;\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n let nodes = super.buildCollection();\n let y = this.contentSize.height;\n\n if (this.isLoading) {\n let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, nodes.length === 0 ? this.virtualizer!.visibleRect.height : this.estimatedRowHeight ?? 48);\n let loader = new LayoutInfo('loader', 'loader', rect);\n let node = {\n layoutInfo: loader,\n validRect: loader.rect\n };\n nodes.push(node);\n this.layoutNodes.set(loader.key, node);\n y = loader.rect.maxY;\n }\n\n if (nodes.length === 0) {\n let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, this.virtualizer!.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n let node = {\n layoutInfo: placeholder,\n validRect: placeholder.rect\n };\n nodes.push(node);\n this.layoutNodes.set(placeholder.key, node);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize.height = y;\n return nodes;\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let res = super.buildItem(node, x, y);\n // allow overflow so the focus ring/selection ring can extend outside to overlap with the adjacent items borders\n res.layoutInfo.allowOverflow = true;\n return res;\n }\n}\n"],"names":[],"version":3,"file":"ListViewLayout.main.js.map"}
@@ -23,7 +23,8 @@ class $bc6cc67dd6240ebd$export$dab781655dfbb7d3 extends (0, $9jo3j$ListLayout) {
23
23
  let nodes = super.buildCollection();
24
24
  let y = this.contentSize.height;
25
25
  if (this.isLoading) {
26
- let rect = new (0, $9jo3j$Rect)(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);
26
+ var _this_estimatedRowHeight;
27
+ let rect = new (0, $9jo3j$Rect)(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : (_this_estimatedRowHeight = this.estimatedRowHeight) !== null && _this_estimatedRowHeight !== void 0 ? _this_estimatedRowHeight : 48);
27
28
  let loader = new (0, $9jo3j$LayoutInfo)('loader', 'loader', rect);
28
29
  let node = {
29
30
  layoutInfo: loader,
@@ -54,8 +55,7 @@ class $bc6cc67dd6240ebd$export$dab781655dfbb7d3 extends (0, $9jo3j$ListLayout) {
54
55
  return res;
55
56
  }
56
57
  constructor(...args){
57
- super(...args);
58
- this.isLoading = false;
58
+ super(...args), this.isLoading = false;
59
59
  }
60
60
  }
61
61