Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-stately/select

Package Overview
Dependencies
Maintainers
2
Versions
784
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-stately/select - npm Package Compare versions

Comparing version 3.0.0-alpha.1 to 3.0.0-nightly-086ad3115-240911

dist/import.mjs

59

dist/main.js

@@ -1,49 +0,22 @@

var _babelRuntimeHelpersObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/objectSpread2"));
var $80ebb60e77198879$exports = require("./useSelectState.main.js");
var _babelRuntimeHelpersSlicedToArray = $parcel$interopDefault(require("@babel/runtime/helpers/slicedToArray"));
var useMemo = require("react").useMemo;
var useMenuTriggerState = require("@react-stately/menu").useMenuTriggerState;
var useControlledState = require("@react-stately/utils").useControlledState;
var useListState = require("@react-stately/list").useListState;
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
function useSelectState(props) {
var _useControlledState = useControlledState(props.selectedKey, props.defaultSelectedKey, props.onSelectionChange),
_useControlledState2 = _babelRuntimeHelpersSlicedToArray(_useControlledState, 2),
selectedKey = _useControlledState2[0],
setSelectedKey = _useControlledState2[1];
$parcel$export(module.exports, "useSelectState", () => $80ebb60e77198879$exports.useSelectState);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
var selectedKeys = useMemo(function () {
return selectedKey != null ? [selectedKey] : [];
}, [selectedKey]);
var triggerState = useMenuTriggerState(props);
var _useListState = useListState(_babelRuntimeHelpersObjectSpread({}, props, {
selectionMode: 'single',
selectedKeys: selectedKeys,
onSelectionChange: function onSelectionChange(keys) {
setSelectedKey(keys.values().next().value);
triggerState.setOpen(false);
}
})),
collection = _useListState.collection,
disabledKeys = _useListState.disabledKeys,
selectionManager = _useListState.selectionManager;
return _babelRuntimeHelpersObjectSpread({}, triggerState, {
collection: collection,
disabledKeys: disabledKeys,
selectionManager: selectionManager,
selectedKey: selectedKey,
setSelectedKey: setSelectedKey
});
}
exports.useSelectState = useSelectState;
//# sourceMappingURL=main.js.map

@@ -1,29 +0,17 @@

import _babelRuntimeHelpersEsmObjectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { useMemo } from "react";
import { useMenuTriggerState } from "@react-stately/menu";
import { useControlledState } from "@react-stately/utils";
import { useListState } from "@react-stately/list";
export function useSelectState(props) {
let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, props.defaultSelectedKey, props.onSelectionChange);
let selectedKeys = useMemo(() => selectedKey != null ? [selectedKey] : [], [selectedKey]);
let triggerState = useMenuTriggerState(props);
let {
collection,
disabledKeys,
selectionManager
} = useListState(_babelRuntimeHelpersEsmObjectSpread({}, props, {
selectionMode: 'single',
selectedKeys,
onSelectionChange: keys => {
setSelectedKey(keys.values().next().value);
triggerState.setOpen(false);
}
}));
return _babelRuntimeHelpersEsmObjectSpread({}, triggerState, {
collection,
disabledKeys,
selectionManager,
selectedKey,
setSelectedKey
});
}
import {useSelectState as $2bc3a590c5373a4e$export$5159ec8b34d4ec12} from "./useSelectState.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {$2bc3a590c5373a4e$export$5159ec8b34d4ec12 as useSelectState};
//# sourceMappingURL=module.js.map

@@ -1,15 +0,28 @@

import { Collection, Node } from "@react-stately/collections";
import { Key } from "react";
import { MenuTriggerState } from "@react-stately/menu";
import { SelectionManager } from "@react-stately/selection";
import { CollectionStateBase, FocusStrategy } from "@react-types/shared";
import { FormValidationState } from "@react-stately/form";
import { OverlayTriggerState } from "@react-stately/overlays";
import { SelectProps } from "@react-types/select";
export interface SelectState<T> extends MenuTriggerState {
collection: Collection<Node<T>>;
disabledKeys: Set<Key>;
selectionManager: SelectionManager;
selectedKey: Key;
setSelectedKey: (key: Key) => void;
import { SingleSelectListState } from "@react-stately/list";
export interface SelectStateOptions<T> extends Omit<SelectProps<T>, 'children'>, CollectionStateBase<T> {
}
export function useSelectState<T>(props: SelectProps<T>): SelectState<T>;
export interface SelectState<T> extends SingleSelectListState<T>, OverlayTriggerState, FormValidationState {
/** Whether the select is currently focused. */
readonly isFocused: boolean;
/** Sets whether the select is focused. */
setFocused(isFocused: boolean): void;
/** Controls which item will be auto focused when the menu opens. */
readonly focusStrategy: FocusStrategy | null;
/** Opens the menu. */
open(focusStrategy?: FocusStrategy | null): void;
/** Toggles the menu. */
toggle(focusStrategy?: FocusStrategy | null): void;
}
/**
* Provides state management for a select component. Handles building a collection
* of items from props, handles the open state for the popup menu, and manages
* multiple selection state.
*/
export function useSelectState<T extends object>(props: SelectStateOptions<T>): SelectState<T>;
export type { SelectProps } from '@react-types/select';
//# sourceMappingURL=types.d.ts.map
{
"name": "@react-stately/select",
"version": "3.0.0-alpha.1",
"version": "3.0.0-nightly-086ad3115-240911",
"description": "Spectrum UI components in React",

@@ -8,6 +8,12 @@ "license": "Apache-2.0",

"module": "dist/module.js",
"exports": {
"types": "./dist/types.d.ts",
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
"dist"
"dist",
"src"
],

@@ -17,15 +23,14 @@ "sideEffects": false,

"type": "git",
"url": "https://github.com/adobe-private/react-spectrum-v3"
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@babel/runtime": "^7.6.2",
"@react-stately/collections": "^3.0.0-alpha.1",
"@react-stately/list": "^3.0.0-alpha.1",
"@react-stately/menu": "^3.0.0-alpha.1",
"@react-stately/selection": "^3.0.0-alpha.1",
"@react-stately/utils": "^3.0.0-rc.2",
"@react-types/select": "^3.0.0-alpha.1"
"@react-stately/form": "^3.0.0-nightly-086ad3115-240911",
"@react-stately/list": "^3.0.0-nightly-086ad3115-240911",
"@react-stately/overlays": "^3.0.0-nightly-086ad3115-240911",
"@react-types/select": "^3.0.0-nightly-086ad3115-240911",
"@react-types/shared": "^3.0.0-nightly-086ad3115-240911",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},

@@ -35,3 +40,3 @@ "publishConfig": {

},
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410"
}
"stableVersion": "3.6.7"
}

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