Socket
Socket
Sign inDemoInstall

@react-stately/selection

Package Overview
Dependencies
Maintainers
2
Versions
781
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-stately/selection - npm Package Compare versions

Comparing version 3.0.0-nightly.932 to 3.0.0-nightly.935

20

dist/main.js

@@ -57,2 +57,3 @@ var {

let focusedKeyRef = useRef(null);
let childFocusStrategyRef = useRef(null);
let [, setFocusedKey] = useState(null);

@@ -80,4 +81,13 @@ let selectedKeysProp = useMemo(() => $e792d6adfd95a7ce87c6dd8b719ea117$var$convertSelection(props.selectedKeys), [props.selectedKeys]);

setFocusedKey(k) {
get childFocusStrategy() {
return childFocusStrategyRef.current;
},
setFocusedKey(k, childFocusStrategy) {
if (childFocusStrategy === void 0) {
childFocusStrategy = 'first';
}
focusedKeyRef.current = k;
childFocusStrategyRef.current = childFocusStrategy;
setFocusedKey(k);

@@ -158,2 +168,6 @@ },

}
get childFocusStrategy() {
return this.state.childFocusStrategy;
}
/**

@@ -164,4 +178,4 @@ * Sets the focused key.

setFocusedKey(key) {
this.state.setFocusedKey(key);
setFocusedKey(key, childFocusStrategy) {
this.state.setFocusedKey(key, childFocusStrategy);
}

@@ -168,0 +182,0 @@ /**

@@ -50,2 +50,3 @@ import { useControlledState } from "@react-stately/utils";

let focusedKeyRef = useRef(null);
let childFocusStrategyRef = useRef(null);
let [, setFocusedKey] = useState(null);

@@ -73,4 +74,13 @@ let selectedKeysProp = useMemo(() => $c86d35e876e048ac11515eee40c7$var$convertSelection(props.selectedKeys), [props.selectedKeys]);

setFocusedKey(k) {
get childFocusStrategy() {
return childFocusStrategyRef.current;
},
setFocusedKey(k, childFocusStrategy) {
if (childFocusStrategy === void 0) {
childFocusStrategy = 'first';
}
focusedKeyRef.current = k;
childFocusStrategyRef.current = childFocusStrategy;
setFocusedKey(k);

@@ -149,2 +159,6 @@ },

}
get childFocusStrategy() {
return this.state.childFocusStrategy;
}
/**

@@ -155,4 +169,4 @@ * Sets the focused key.

setFocusedKey(key) {
this.state.setFocusedKey(key);
setFocusedKey(key, childFocusStrategy) {
this.state.setFocusedKey(key, childFocusStrategy);
}

@@ -159,0 +173,0 @@ /**

11

dist/types.d.ts

@@ -0,3 +1,3 @@

import { FocusStrategy, PressEvent, Selection, SelectionMode, MultipleSelection, Collection, Node } from "@react-types/shared";
import { Key } from "react";
import { PressEvent, Selection, SelectionMode, MultipleSelection, Collection, Node } from "@react-types/shared";
export interface FocusState {

@@ -10,4 +10,6 @@ /** Whether the collection is currently focused. */

readonly focusedKey: Key;
/** Sets the focused key. */
setFocusedKey(key: Key): void;
/** Whether the first or last child of the focused key should receive focus. */
readonly childFocusStrategy: FocusStrategy;
/** Sets the focused key, and optionally, whether the first or last child of that key should receive focus. */
setFocusedKey(key: Key, child?: FocusStrategy): void;
}

@@ -101,6 +103,7 @@ export interface SingleSelectionState extends FocusState {

get focusedKey(): Key;
get childFocusStrategy(): FocusStrategy;
/**
* Sets the focused key.
*/
setFocusedKey(key: Key): void;
setFocusedKey(key: Key, childFocusStrategy?: FocusStrategy): void;
/**

@@ -107,0 +110,0 @@ * The currently selected keys in the collection.

{
"name": "@react-stately/selection",
"version": "3.0.0-nightly.932+dfdf27ea",
"version": "3.0.0-nightly.935+e706b29d",
"description": "Spectrum UI components in React",

@@ -21,5 +21,5 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@react-stately/collections": "3.0.0-nightly.932+dfdf27ea",
"@react-stately/utils": "3.0.0-nightly.932+dfdf27ea",
"@react-types/shared": "3.0.0-nightly.932+dfdf27ea"
"@react-stately/collections": "3.0.0-nightly.935+e706b29d",
"@react-stately/utils": "3.0.0-nightly.935+e706b29d",
"@react-types/shared": "3.0.0-nightly.935+e706b29d"
},

@@ -32,3 +32,3 @@ "peerDependencies": {

},
"gitHead": "dfdf27ea3ceaaaeedd411da6e0454e08eb584c7f"
"gitHead": "e706b29dad382de94cffbfd943004fc90b808f8f"
}

@@ -13,3 +13,3 @@ /*

import {Collection, Node, PressEvent, SelectionMode} from '@react-types/shared';
import {Collection, FocusStrategy, Node, PressEvent, SelectionMode} from '@react-types/shared';
import {Key} from 'react';

@@ -74,7 +74,11 @@ import {MultipleSelectionManager, MultipleSelectionState} from './types';

get childFocusStrategy(): FocusStrategy {
return this.state.childFocusStrategy;
}
/**
* Sets the focused key.
*/
setFocusedKey(key: Key) {
this.state.setFocusedKey(key);
setFocusedKey(key: Key, childFocusStrategy?: FocusStrategy) {
this.state.setFocusedKey(key, childFocusStrategy);
}

@@ -81,0 +85,0 @@

@@ -13,4 +13,4 @@ /*

import {FocusStrategy, PressEvent, Selection, SelectionMode} from '@react-types/shared';
import {Key} from 'react';
import {PressEvent, Selection, SelectionMode} from '@react-types/shared';

@@ -24,4 +24,6 @@ export interface FocusState {

readonly focusedKey: Key,
/** Sets the focused key. */
setFocusedKey(key: Key): void
/** Whether the first or last child of the focused key should receive focus. */
readonly childFocusStrategy: FocusStrategy,
/** Sets the focused key, and optionally, whether the first or last child of that key should receive focus. */
setFocusedKey(key: Key, child?: FocusStrategy): void
}

@@ -28,0 +30,0 @@

@@ -33,2 +33,3 @@ /*

let focusedKeyRef = useRef(null);
let childFocusStrategyRef = useRef(null);
let [, setFocusedKey] = useState(null);

@@ -59,4 +60,8 @@ let selectedKeysProp = useMemo(() => convertSelection(props.selectedKeys), [props.selectedKeys]);

},
setFocusedKey(k) {
get childFocusStrategy() {
return childFocusStrategyRef.current;
},
setFocusedKey(k, childFocusStrategy = 'first') {
focusedKeyRef.current = k;
childFocusStrategyRef.current = childFocusStrategy;
setFocusedKey(k);

@@ -63,0 +68,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc