@react-types/select 3.11.0 → 3.12.1

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/index.d.ts +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/select",
3
- "version": "3.11.0",
3
+ "version": "3.12.1",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "dependencies": {
12
- "@react-types/shared": "^3.32.1"
12
+ "@react-types/shared": "^3.33.0"
13
13
  },
14
14
  "peerDependencies": {
15
15
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
20
+ "gitHead": "66e51757606b43a89ed02c574ca24517323a2ab9"
21
21
  }
package/src/index.d.ts CHANGED
@@ -32,10 +32,11 @@ import {
32
32
  } from '@react-types/shared';
33
33
 
34
34
  export type SelectionMode = 'single' | 'multiple';
35
- export type ValueType<M extends SelectionMode> = M extends 'single' ? Key | null : Key[];
35
+ export type ValueType<M extends SelectionMode> = M extends 'single' ? Key | null : readonly Key[];
36
+ export type ChangeValueType<M extends SelectionMode> = M extends 'single' ? Key | null : Key[];
36
37
  type ValidationType<M extends SelectionMode> = M extends 'single' ? Key : Key[];
37
38
 
38
- export interface SelectProps<T, M extends SelectionMode = 'single'> extends CollectionBase<T>, Omit<InputBase, 'isReadOnly'>, ValueBase<ValueType<M>>, Validation<ValidationType<M>>, HelpTextProps, LabelableProps, TextInputBase, FocusableProps {
39
+ export interface SelectProps<T, M extends SelectionMode = 'single'> extends CollectionBase<T>, Omit<InputBase, 'isReadOnly'>, ValueBase<ValueType<M>, ChangeValueType<M>>, Validation<ValidationType<M>>, HelpTextProps, LabelableProps, TextInputBase, FocusableProps {
39
40
  /**
40
41
  * Whether single or multiple selection is enabled.
41
42
  * @default 'single'
@@ -61,7 +62,9 @@ export interface SelectProps<T, M extends SelectionMode = 'single'> extends Coll
61
62
  /** Sets the default open state of the menu. */
62
63
  defaultOpen?: boolean,
63
64
  /** Method that is called when the open state of the menu changes. */
64
- onOpenChange?: (isOpen: boolean) => void
65
+ onOpenChange?: (isOpen: boolean) => void,
66
+ /** Whether the select should be allowed to be open when the collection is empty. */
67
+ allowsEmptyCollection?: boolean
65
68
  }
66
69
 
67
70
  export interface AriaSelectProps<T, M extends SelectionMode = 'single'> extends SelectProps<T, M>, DOMProps, AriaLabelingProps, FocusableDOMProps {
@@ -81,7 +84,7 @@ export interface AriaSelectProps<T, M extends SelectionMode = 'single'> extends
81
84
  form?: string
82
85
  }
83
86
 
84
- export interface SpectrumPickerProps<T> extends Omit<AriaSelectProps<T>, 'selectionMode' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'value' | 'defaultValue' | 'onChange'>, Omit<SingleSelection, 'disallowEmptySelection'>, AsyncLoadable, SpectrumLabelableProps, StyleProps {
87
+ export interface SpectrumPickerProps<T> extends Omit<AriaSelectProps<T>, 'selectionMode' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'value' | 'defaultValue' | 'onChange' | 'allowsEmptyCollection'>, Omit<SingleSelection, 'disallowEmptySelection'>, AsyncLoadable, SpectrumLabelableProps, StyleProps {
85
88
  /** Whether the textfield should be displayed with a quiet style. */
86
89
  isQuiet?: boolean,
87
90
  /** Alignment of the menu relative to the input target.