🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@react-stately/selection

Package Overview
Dependencies
Maintainers
2
Versions
1041
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

to
3.4.0

22

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,8 @@ },

}
/** Whether the first or last child of the focused key should receive focus. */
get childFocusStrategy() {
return this.state.childFocusStrategy;
}
/**

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

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

@@ -168,0 +184,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,8 @@ },

}
/** Whether the first or last child of the focused key should receive focus. */
get childFocusStrategy() {
return this.state.childFocusStrategy;
}
/**

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

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

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

12

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,8 @@ export interface SingleSelectionState extends FocusState {

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

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

{
"name": "@react-stately/selection",
"version": "3.3.0",
"version": "3.4.0",
"description": "Spectrum UI components in React",

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

"@babel/runtime": "^7.6.2",
"@react-stately/collections": "^3.2.1",
"@react-stately/collections": "^3.3.1",
"@react-stately/utils": "^3.1.1",
"@react-types/shared": "^3.3.0"
"@react-types/shared": "^3.5.0"
},

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

},
"gitHead": "9f738a06ea4e256c8d975f00502b4b0bbabb8f65"
"gitHead": "9920ffaa2596a03c4498a15cb940bd2f4ba5cd6a"
}

@@ -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,12 @@ import {MultipleSelectionManager, MultipleSelectionState} from './types';

/** Whether the first or last child of the focused key should receive focus. */
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 +86,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