@react-types/autocomplete 3.0.0-alpha.11 → 3.0.0-alpha.13

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 +5 -5
  2. package/src/index.d.ts +18 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/autocomplete",
3
- "version": "3.0.0-alpha.11",
3
+ "version": "3.0.0-alpha.13",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -9,9 +9,9 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "dependencies": {
12
- "@react-types/combobox": "^3.5.5",
13
- "@react-types/searchfield": "^3.3.6",
14
- "@react-types/shared": "^3.16.0"
12
+ "@react-types/combobox": "^3.6.1",
13
+ "@react-types/searchfield": "^3.4.1",
14
+ "@react-types/shared": "^3.18.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
@@ -19,5 +19,5 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
- "gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
22
+ "gitHead": "9d1ba9bd8ebcd63bf3495ade16d349bcb71795ce"
23
23
  }
package/src/index.d.ts CHANGED
@@ -10,12 +10,12 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {AriaSearchFieldProps} from '@react-types/searchfield';
14
- import {AsyncLoadable, CollectionBase, LoadingState, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps} from '@react-types/shared';
13
+ import {AriaLabelingProps, AsyncLoadable, CollectionBase, DOMProps, LoadingState, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps} from '@react-types/shared';
15
14
  import {Key, ReactElement} from 'react';
16
15
  import {MenuTriggerAction} from '@react-types/combobox';
16
+ import {SearchFieldProps} from '@react-types/searchfield';
17
17
 
18
- export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<AriaSearchFieldProps, 'onSubmit'> {
18
+ export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<SearchFieldProps, 'onSubmit' | 'defaultValue' | 'value'> {
19
19
  /** The list of SearchAutocomplete items (uncontrolled). */
20
20
  defaultItems?: Iterable<T>,
21
21
  /** The list of SearchAutocomplete items (controlled). */
@@ -33,12 +33,20 @@ export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<Aria
33
33
  * @default 'input'
34
34
  */
35
35
  menuTrigger?: MenuTriggerAction,
36
- onSubmit?: (value: string | null, key: Key | null) => void,
37
- /** An icon to display at the start of the input. */
38
- icon?: ReactElement | null
36
+ /** Handler that is called when the SearchAutocomplete is submitted.
37
+ *
38
+ * A `value` will be passed if the submission is a custom value (e.g. a user types then presses enter).
39
+ * If the input is a selected item, `value` will be null.
40
+ *
41
+ * A `key` will be passed if the submission is a selected item (e.g. a user clicks or presses enter on an option).
42
+ * If the input is a custom value, `key` will be null.
43
+ */
44
+ onSubmit?: (value: string | null, key: Key | null) => void
39
45
  }
40
46
 
41
- export interface SpectrumSearchAutocompleteProps<T> extends SpectrumTextInputBase, Omit<SearchAutocompleteProps<T>, 'menuTrigger'>, SpectrumLabelableProps, StyleProps, Omit<AsyncLoadable, 'isLoading'> {
47
+ export interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T>, DOMProps, AriaLabelingProps {}
48
+
49
+ export interface SpectrumSearchAutocompleteProps<T> extends SpectrumTextInputBase, Omit<AriaSearchAutocompleteProps<T>, 'menuTrigger'>, SpectrumLabelableProps, StyleProps, Omit<AsyncLoadable, 'isLoading'> {
42
50
  /**
43
51
  * The interaction required to display the SearchAutocomplete menu. Note that this prop has no effect on the mobile SearchAutocomplete experience.
44
52
  * @default 'input'
@@ -58,5 +66,7 @@ export interface SpectrumSearchAutocompleteProps<T> extends SpectrumTextInputBas
58
66
  * @default true
59
67
  */
60
68
  shouldFlip?: boolean,
61
- onLoadMore?: () => void
69
+ onLoadMore?: () => void,
70
+ /** An icon to display at the start of the input. */
71
+ icon?: ReactElement | null
62
72
  }