@react-spectrum/card 3.0.0-nightly.3201 → 3.0.0-nightly.3204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import "./main.css";
2
2
  import {useStyleProps as $8EWFi$useStyleProps, useDOMRef as $8EWFi$useDOMRef, classNames as $8EWFi$classNames, useUnwrapDOMRef as $8EWFi$useUnwrapDOMRef, useHasChild as $8EWFi$useHasChild, SlotProvider as $8EWFi$SlotProvider} from "@react-spectrum/utils";
3
3
  import {GridCollection as $8EWFi$GridCollection, useGridState as $8EWFi$useGridState} from "@react-stately/grid";
4
+ import {mergeProps as $8EWFi$mergeProps, useResizeObserver as $8EWFi$useResizeObserver, useLayoutEffect as $8EWFi$useLayoutEffect, filterDOMProps as $8EWFi$filterDOMProps, useSlotId as $8EWFi$useSlotId} from "@react-aria/utils";
4
5
  import {ProgressCircle as $8EWFi$ProgressCircle} from "@react-spectrum/progress";
5
6
  import $8EWFi$react, {useMemo as $8EWFi$useMemo, useCallback as $8EWFi$useCallback, useRef as $8EWFi$useRef, useState as $8EWFi$useState, useContext as $8EWFi$useContext, forwardRef as $8EWFi$forwardRef} from "react";
6
7
  import {useCollator as $8EWFi$useCollator, useMessageFormatter as $8EWFi$useMessageFormatter, useLocale as $8EWFi$useLocale} from "@react-aria/i18n";
@@ -9,7 +10,6 @@ import {useListState as $8EWFi$useListState} from "@react-stately/list";
9
10
  import {useProvider as $8EWFi$useProvider, useProviderProps as $8EWFi$useProviderProps} from "@react-spectrum/provider";
10
11
  import {VirtualizerItem as $8EWFi$VirtualizerItem, Virtualizer as $8EWFi$Virtualizer} from "@react-aria/virtualizer";
11
12
  import {Checkbox as $8EWFi$Checkbox} from "@react-spectrum/checkbox";
12
- import {useResizeObserver as $8EWFi$useResizeObserver, useLayoutEffect as $8EWFi$useLayoutEffect, mergeProps as $8EWFi$mergeProps, filterDOMProps as $8EWFi$filterDOMProps, useSlotId as $8EWFi$useSlotId} from "@react-aria/utils";
13
13
  import {getFocusableTreeWalker as $8EWFi$getFocusableTreeWalker, FocusRing as $8EWFi$FocusRing} from "@react-aria/focus";
14
14
  import {useHover as $8EWFi$useHover, useFocusWithin as $8EWFi$useFocusWithin} from "@react-aria/interactions";
15
15
  import {Size as $8EWFi$Size, Rect as $8EWFi$Rect, LayoutInfo as $8EWFi$LayoutInfo, Layout as $8EWFi$Layout} from "@react-stately/virtualizer";
@@ -480,6 +480,7 @@ $e24fb79fb8b63230$exports = {
480
480
 
481
481
 
482
482
 
483
+
483
484
  function $81a52da995c19652$var$CardView(props, ref) {
484
485
  let { scale: scale } = $8EWFi$useProvider();
485
486
  let { styleProps: styleProps } = $8EWFi$useStyleProps(props);
@@ -623,7 +624,7 @@ function $81a52da995c19652$var$InternalCard(props) {
623
624
  let rowRef = $8EWFi$useRef();
624
625
  let cellRef = $8EWFi$useRef();
625
626
  let unwrappedRef = $8EWFi$useUnwrapDOMRef(cellRef);
626
- let { rowProps: rowProps } = $8EWFi$useGridRow({
627
+ let { rowProps: gridRowProps } = $8EWFi$useGridRow({
627
628
  node: item,
628
629
  isVirtualized: true
629
630
  }, state, rowRef);
@@ -631,6 +632,15 @@ function $81a52da995c19652$var$InternalCard(props) {
631
632
  node: cellNode,
632
633
  focusMode: 'cell'
633
634
  }, state, unwrappedRef);
635
+ // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
636
+ let allowsInteraction = state.selectionManager.selectionMode !== 'none';
637
+ let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
638
+ let onKeyDown = (e)=>{
639
+ if (e.key === ' ' && isDisabled) e.preventDefault();
640
+ };
641
+ let rowProps = $8EWFi$mergeProps(gridRowProps, {
642
+ onKeyDown: onKeyDown
643
+ });
634
644
  if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
635
645
  if (layoutType !== 'grid') cardOrientation = 'vertical';
636
646
  // We don't want to focus the checkbox (or any other focusable elements) within the Card