@react-stately/select 3.6.7 → 3.6.8-nightly.5014

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/types.d.ts CHANGED
@@ -11,7 +11,7 @@ export interface SelectState<T> extends SingleSelectListState<T>, OverlayTrigger
11
11
  /** Sets whether the select is focused. */
12
12
  setFocused(isFocused: boolean): void;
13
13
  /** Controls which item will be auto focused when the menu opens. */
14
- readonly focusStrategy: FocusStrategy;
14
+ readonly focusStrategy: FocusStrategy | null;
15
15
  /** Opens the menu. */
16
16
  open(focusStrategy?: FocusStrategy | null): void;
17
17
  /** Toggles the menu. */
@@ -1 +1 @@
1
- {"mappings":";;;;;AAmBA,oCAAoC,CAAC,CAAE,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,CAAC;CAAG;AAE1G,6BAA6B,CAAC,CAAE,SAAQ,sBAAsB,CAAC,CAAC,EAAE,mBAAmB,EAAE,mBAAmB;IACxG,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B,0CAA0C;IAC1C,UAAU,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAErC,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAEtC,sBAAsB;IACtB,IAAI,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;IAEjD,wBAAwB;IACxB,MAAM,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAAA;CACnD;AAED;;;;GAIG;AACH,+BAA+B,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CA2C7F;ACxED,YAAY,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-stately/select/src/packages/@react-stately/select/src/useSelectState.ts","packages/@react-stately/select/src/packages/@react-stately/select/src/index.ts","packages/@react-stately/select/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useSelectState} from './useSelectState';\n\nexport type {SelectProps} from '@react-types/select';\nexport type {SelectState, SelectStateOptions} from './useSelectState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;AAmBA,oCAAoC,CAAC,CAAE,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,CAAC;CAAG;AAE1G,6BAA6B,CAAC,CAAE,SAAQ,sBAAsB,CAAC,CAAC,EAAE,mBAAmB,EAAE,mBAAmB;IACxG,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B,0CAA0C;IAC1C,UAAU,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAErC,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAE7C,sBAAsB;IACtB,IAAI,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;IAEjD,wBAAwB;IACxB,MAAM,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAAA;CACnD;AAED;;;;GAIG;AACH,+BAA+B,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CA2C7F;ACxED,YAAY,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-stately/select/src/packages/@react-stately/select/src/useSelectState.ts","packages/@react-stately/select/src/packages/@react-stately/select/src/index.ts","packages/@react-stately/select/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useSelectState} from './useSelectState';\n\nexport type {SelectProps} from '@react-types/select';\nexport type {SelectState, SelectStateOptions} from './useSelectState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAiC,KAA4B;IAC3E,IAAI,eAAe,CAAA,GAAA,kDAAqB,EAAE;IAC1C,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAiB;IAChE,IAAI,YAAY,CAAA,GAAA,gDAAuB,EAAE;QACvC,GAAG,KAAK;QACR,mBAAmB,CAAC;YAClB,IAAI,MAAM,iBAAiB,IAAI,MAC7B,MAAM,iBAAiB,CAAC;YAG1B,aAAa,KAAK;YAClB,gBAAgB,gBAAgB;QAClC;IACF;IAEA,IAAI,kBAAkB,CAAA,GAAA,8CAAqB,EAAE;QAC3C,GAAG,KAAK;QACR,OAAO,UAAU,WAAW;IAC9B;IAEA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IAEvC,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,SAAS;QACZ,GAAG,YAAY;uBACf;QACA,MAAK,gBAA+B,IAAI;YACtC,yCAAyC;YACzC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,IAAI;YACnB;QACF;QACA,QAAO,gBAA+B,IAAI;YACxC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,MAAM;YACrB;QACF;mBACA;oBACA;IACF;AACF","sources":["packages/@react-stately/select/src/useSelectState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionStateBase, FocusStrategy} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '@react-stately/form';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {SelectProps} from '@react-types/select';\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {useState} from 'react';\n\nexport interface SelectStateOptions<T> extends Omit<SelectProps<T>, 'children'>, CollectionStateBase<T> {}\n\nexport interface SelectState<T> extends SingleSelectListState<T>, OverlayTriggerState, FormValidationState {\n /** Whether the select is currently focused. */\n readonly isFocused: boolean,\n\n /** Sets whether the select is focused. */\n setFocused(isFocused: boolean): void,\n\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy,\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void,\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void\n}\n\n/**\n * Provides state management for a select component. Handles building a collection\n * of items from props, handles the open state for the popup menu, and manages\n * multiple selection state.\n */\nexport function useSelectState<T extends object>(props: SelectStateOptions<T>): SelectState<T> {\n let triggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy>(null);\n let listState = useSingleSelectListState({\n ...props,\n onSelectionChange: (key) => {\n if (props.onSelectionChange != null) {\n props.onSelectionChange(key);\n }\n\n triggerState.close();\n validationState.commitValidation();\n }\n });\n\n let validationState = useFormValidationState({\n ...props,\n value: listState.selectedKey\n });\n\n let [isFocused, setFocused] = useState(false);\n\n return {\n ...validationState,\n ...listState,\n ...triggerState,\n focusStrategy,\n open(focusStrategy: FocusStrategy = null) {\n // Don't open if the collection is empty.\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.open();\n }\n },\n toggle(focusStrategy: FocusStrategy = null) {\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.toggle();\n }\n },\n isFocused,\n setFocused\n };\n}\n"],"names":[],"version":3,"file":"useSelectState.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAiC,KAA4B;IAC3E,IAAI,eAAe,CAAA,GAAA,kDAAqB,EAAE;IAC1C,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAiB;IAChE,IAAI,YAAY,CAAA,GAAA,gDAAuB,EAAE;QACvC,GAAG,KAAK;QACR,mBAAmB,CAAC;YAClB,IAAI,MAAM,iBAAiB,IAAI,MAC7B,MAAM,iBAAiB,CAAC;YAG1B,aAAa,KAAK;YAClB,gBAAgB,gBAAgB;QAClC;IACF;IAEA,IAAI,kBAAkB,CAAA,GAAA,8CAAqB,EAAE;QAC3C,GAAG,KAAK;QACR,OAAO,UAAU,WAAW;IAC9B;IAEA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IAEvC,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,SAAS;QACZ,GAAG,YAAY;uBACf;QACA,MAAK,gBAA+B,IAAI;YACtC,yCAAyC;YACzC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,IAAI;YACnB;QACF;QACA,QAAO,gBAA+B,IAAI;YACxC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,MAAM;YACrB;QACF;mBACA;oBACA;IACF;AACF","sources":["packages/@react-stately/select/src/useSelectState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionStateBase, FocusStrategy} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '@react-stately/form';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {SelectProps} from '@react-types/select';\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {useState} from 'react';\n\nexport interface SelectStateOptions<T> extends Omit<SelectProps<T>, 'children'>, CollectionStateBase<T> {}\n\nexport interface SelectState<T> extends SingleSelectListState<T>, OverlayTriggerState, FormValidationState {\n /** Whether the select is currently focused. */\n readonly isFocused: boolean,\n\n /** Sets whether the select is focused. */\n setFocused(isFocused: boolean): void,\n\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null,\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void,\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void\n}\n\n/**\n * Provides state management for a select component. Handles building a collection\n * of items from props, handles the open state for the popup menu, and manages\n * multiple selection state.\n */\nexport function useSelectState<T extends object>(props: SelectStateOptions<T>): SelectState<T> {\n let triggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy>(null);\n let listState = useSingleSelectListState({\n ...props,\n onSelectionChange: (key) => {\n if (props.onSelectionChange != null) {\n props.onSelectionChange(key);\n }\n\n triggerState.close();\n validationState.commitValidation();\n }\n });\n\n let validationState = useFormValidationState({\n ...props,\n value: listState.selectedKey\n });\n\n let [isFocused, setFocused] = useState(false);\n\n return {\n ...validationState,\n ...listState,\n ...triggerState,\n focusStrategy,\n open(focusStrategy: FocusStrategy = null) {\n // Don't open if the collection is empty.\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.open();\n }\n },\n toggle(focusStrategy: FocusStrategy = null) {\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.toggle();\n }\n },\n isFocused,\n setFocused\n };\n}\n"],"names":[],"version":3,"file":"useSelectState.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAiC,KAA4B;IAC3E,IAAI,eAAe,CAAA,GAAA,6BAAqB,EAAE;IAC1C,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAiB;IAChE,IAAI,YAAY,CAAA,GAAA,+BAAuB,EAAE;QACvC,GAAG,KAAK;QACR,mBAAmB,CAAC;YAClB,IAAI,MAAM,iBAAiB,IAAI,MAC7B,MAAM,iBAAiB,CAAC;YAG1B,aAAa,KAAK;YAClB,gBAAgB,gBAAgB;QAClC;IACF;IAEA,IAAI,kBAAkB,CAAA,GAAA,6BAAqB,EAAE;QAC3C,GAAG,KAAK;QACR,OAAO,UAAU,WAAW;IAC9B;IAEA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IAEvC,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,SAAS;QACZ,GAAG,YAAY;uBACf;QACA,MAAK,gBAA+B,IAAI;YACtC,yCAAyC;YACzC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,IAAI;YACnB;QACF;QACA,QAAO,gBAA+B,IAAI;YACxC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,MAAM;YACrB;QACF;mBACA;oBACA;IACF;AACF","sources":["packages/@react-stately/select/src/useSelectState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionStateBase, FocusStrategy} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '@react-stately/form';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {SelectProps} from '@react-types/select';\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {useState} from 'react';\n\nexport interface SelectStateOptions<T> extends Omit<SelectProps<T>, 'children'>, CollectionStateBase<T> {}\n\nexport interface SelectState<T> extends SingleSelectListState<T>, OverlayTriggerState, FormValidationState {\n /** Whether the select is currently focused. */\n readonly isFocused: boolean,\n\n /** Sets whether the select is focused. */\n setFocused(isFocused: boolean): void,\n\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy,\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void,\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void\n}\n\n/**\n * Provides state management for a select component. Handles building a collection\n * of items from props, handles the open state for the popup menu, and manages\n * multiple selection state.\n */\nexport function useSelectState<T extends object>(props: SelectStateOptions<T>): SelectState<T> {\n let triggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy>(null);\n let listState = useSingleSelectListState({\n ...props,\n onSelectionChange: (key) => {\n if (props.onSelectionChange != null) {\n props.onSelectionChange(key);\n }\n\n triggerState.close();\n validationState.commitValidation();\n }\n });\n\n let validationState = useFormValidationState({\n ...props,\n value: listState.selectedKey\n });\n\n let [isFocused, setFocused] = useState(false);\n\n return {\n ...validationState,\n ...listState,\n ...triggerState,\n focusStrategy,\n open(focusStrategy: FocusStrategy = null) {\n // Don't open if the collection is empty.\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.open();\n }\n },\n toggle(focusStrategy: FocusStrategy = null) {\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.toggle();\n }\n },\n isFocused,\n setFocused\n };\n}\n"],"names":[],"version":3,"file":"useSelectState.module.js.map"}
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAiC,KAA4B;IAC3E,IAAI,eAAe,CAAA,GAAA,6BAAqB,EAAE;IAC1C,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAiB;IAChE,IAAI,YAAY,CAAA,GAAA,+BAAuB,EAAE;QACvC,GAAG,KAAK;QACR,mBAAmB,CAAC;YAClB,IAAI,MAAM,iBAAiB,IAAI,MAC7B,MAAM,iBAAiB,CAAC;YAG1B,aAAa,KAAK;YAClB,gBAAgB,gBAAgB;QAClC;IACF;IAEA,IAAI,kBAAkB,CAAA,GAAA,6BAAqB,EAAE;QAC3C,GAAG,KAAK;QACR,OAAO,UAAU,WAAW;IAC9B;IAEA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IAEvC,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,SAAS;QACZ,GAAG,YAAY;uBACf;QACA,MAAK,gBAA+B,IAAI;YACtC,yCAAyC;YACzC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,IAAI;YACnB;QACF;QACA,QAAO,gBAA+B,IAAI;YACxC,IAAI,UAAU,UAAU,CAAC,IAAI,KAAK,GAAG;gBACnC,iBAAiB;gBACjB,aAAa,MAAM;YACrB;QACF;mBACA;oBACA;IACF;AACF","sources":["packages/@react-stately/select/src/useSelectState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionStateBase, FocusStrategy} from '@react-types/shared';\nimport {FormValidationState, useFormValidationState} from '@react-stately/form';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {SelectProps} from '@react-types/select';\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {useState} from 'react';\n\nexport interface SelectStateOptions<T> extends Omit<SelectProps<T>, 'children'>, CollectionStateBase<T> {}\n\nexport interface SelectState<T> extends SingleSelectListState<T>, OverlayTriggerState, FormValidationState {\n /** Whether the select is currently focused. */\n readonly isFocused: boolean,\n\n /** Sets whether the select is focused. */\n setFocused(isFocused: boolean): void,\n\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null,\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void,\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void\n}\n\n/**\n * Provides state management for a select component. Handles building a collection\n * of items from props, handles the open state for the popup menu, and manages\n * multiple selection state.\n */\nexport function useSelectState<T extends object>(props: SelectStateOptions<T>): SelectState<T> {\n let triggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy>(null);\n let listState = useSingleSelectListState({\n ...props,\n onSelectionChange: (key) => {\n if (props.onSelectionChange != null) {\n props.onSelectionChange(key);\n }\n\n triggerState.close();\n validationState.commitValidation();\n }\n });\n\n let validationState = useFormValidationState({\n ...props,\n value: listState.selectedKey\n });\n\n let [isFocused, setFocused] = useState(false);\n\n return {\n ...validationState,\n ...listState,\n ...triggerState,\n focusStrategy,\n open(focusStrategy: FocusStrategy = null) {\n // Don't open if the collection is empty.\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.open();\n }\n },\n toggle(focusStrategy: FocusStrategy = null) {\n if (listState.collection.size !== 0) {\n setFocusStrategy(focusStrategy);\n triggerState.toggle();\n }\n },\n isFocused,\n setFocused\n };\n}\n"],"names":[],"version":3,"file":"useSelectState.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/select",
3
- "version": "3.6.7",
3
+ "version": "3.6.8-nightly.5014+8f3c0ea09",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,11 +22,11 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-stately/form": "^3.0.5",
26
- "@react-stately/list": "^3.10.8",
27
- "@react-stately/overlays": "^3.6.10",
28
- "@react-types/select": "^3.9.6",
29
- "@react-types/shared": "^3.24.1",
25
+ "@react-stately/form": "3.0.6-nightly.5014+8f3c0ea09",
26
+ "@react-stately/list": "3.10.9-nightly.5014+8f3c0ea09",
27
+ "@react-stately/overlays": "3.6.11-nightly.5014+8f3c0ea09",
28
+ "@react-types/select": "3.9.7-nightly.5014+8f3c0ea09",
29
+ "@react-types/shared": "3.0.0-nightly.3086+8f3c0ea09",
30
30
  "@swc/helpers": "^0.5.0"
31
31
  },
32
32
  "peerDependencies": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "faf0e18467231422cb7a06eb92a74d04e271f1e8"
38
+ "gitHead": "8f3c0ea0931107eceba0127fb524b79b46eb838b"
39
39
  }
@@ -27,7 +27,7 @@ export interface SelectState<T> extends SingleSelectListState<T>, OverlayTrigger
27
27
  setFocused(isFocused: boolean): void,
28
28
 
29
29
  /** Controls which item will be auto focused when the menu opens. */
30
- readonly focusStrategy: FocusStrategy,
30
+ readonly focusStrategy: FocusStrategy | null,
31
31
 
32
32
  /** Opens the menu. */
33
33
  open(focusStrategy?: FocusStrategy | null): void,