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

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/main.js CHANGED
@@ -1,6 +1,7 @@
1
1
  require("./main.css");
2
2
  var $jpY3B$reactspectrumutils = require("@react-spectrum/utils");
3
3
  var $jpY3B$reactstatelygrid = require("@react-stately/grid");
4
+ var $jpY3B$reactariautils = require("@react-aria/utils");
4
5
  var $jpY3B$reactspectrumprogress = require("@react-spectrum/progress");
5
6
  var $jpY3B$react = require("react");
6
7
  var $jpY3B$reactariai18n = require("@react-aria/i18n");
@@ -9,7 +10,6 @@ var $jpY3B$reactstatelylist = require("@react-stately/list");
9
10
  var $jpY3B$reactspectrumprovider = require("@react-spectrum/provider");
10
11
  var $jpY3B$reactariavirtualizer = require("@react-aria/virtualizer");
11
12
  var $jpY3B$reactspectrumcheckbox = require("@react-spectrum/checkbox");
12
- var $jpY3B$reactariautils = require("@react-aria/utils");
13
13
  var $jpY3B$reactariafocus = require("@react-aria/focus");
14
14
  var $jpY3B$reactariainteractions = require("@react-aria/interactions");
15
15
  var $jpY3B$reactstatelyvirtualizer = require("@react-stately/virtualizer");
@@ -496,6 +496,7 @@ $dc38f0b958ac5018$exports = {
496
496
 
497
497
 
498
498
 
499
+
499
500
  function $514a55f6d91f25ef$var$CardView(props, ref) {
500
501
  let { scale: scale } = $jpY3B$reactspectrumprovider.useProvider();
501
502
  let { styleProps: styleProps } = $jpY3B$reactspectrumutils.useStyleProps(props);
@@ -639,7 +640,7 @@ function $514a55f6d91f25ef$var$InternalCard(props) {
639
640
  let rowRef = $jpY3B$react.useRef();
640
641
  let cellRef = $jpY3B$react.useRef();
641
642
  let unwrappedRef = $jpY3B$reactspectrumutils.useUnwrapDOMRef(cellRef);
642
- let { rowProps: rowProps } = $jpY3B$reactariagrid.useGridRow({
643
+ let { rowProps: gridRowProps } = $jpY3B$reactariagrid.useGridRow({
643
644
  node: item,
644
645
  isVirtualized: true
645
646
  }, state, rowRef);
@@ -647,6 +648,15 @@ function $514a55f6d91f25ef$var$InternalCard(props) {
647
648
  node: cellNode,
648
649
  focusMode: 'cell'
649
650
  }, state, unwrappedRef);
651
+ // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
652
+ let allowsInteraction = state.selectionManager.selectionMode !== 'none';
653
+ let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
654
+ let onKeyDown = (e)=>{
655
+ if (e.key === ' ' && isDisabled) e.preventDefault();
656
+ };
657
+ let rowProps = $jpY3B$reactariautils.mergeProps(gridRowProps, {
658
+ onKeyDown: onKeyDown
659
+ });
650
660
  if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
651
661
  if (layoutType !== 'grid') cardOrientation = 'vertical';
652
662
  // We don't want to focus the checkbox (or any other focusable elements) within the Card