@react-stately/combobox 3.0.2-nightly.3085 → 3.0.2-nightly.3086

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/main.js CHANGED
@@ -1,7 +1,7 @@
1
- var $6wEwz$reactstatelylist = require("@react-stately/list");
2
- var $6wEwz$reactstatelyutils = require("@react-stately/utils");
3
- var $6wEwz$react = require("react");
4
- var $6wEwz$reactstatelymenu = require("@react-stately/menu");
1
+ var $AY0Rf$reactstatelylist = require("@react-stately/list");
2
+ var $AY0Rf$reactstatelyutils = require("@react-stately/utils");
3
+ var $AY0Rf$react = require("react");
4
+ var $AY0Rf$reactstatelymenu = require("@react-stately/menu");
5
5
 
6
6
  function $parcel$exportWildcard(dest, source) {
7
7
  Object.keys(source).forEach(function(key) {
@@ -22,18 +22,18 @@ function $parcel$exportWildcard(dest, source) {
22
22
  function $parcel$export(e, n, v, s) {
23
23
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
24
24
  }
25
- var $1e7015be92cd531f$exports = {};
25
+ var $25f859eaf3f5343a$exports = {};
26
26
 
27
- $parcel$export($1e7015be92cd531f$exports, "useComboBoxState", () => $1e7015be92cd531f$export$b453a3bfd4a5fa9e);
27
+ $parcel$export($25f859eaf3f5343a$exports, "useComboBoxState", () => $25f859eaf3f5343a$export$b453a3bfd4a5fa9e);
28
28
 
29
29
 
30
30
 
31
31
 
32
- function $1e7015be92cd531f$export$b453a3bfd4a5fa9e(props) {
32
+ function $25f859eaf3f5343a$export$b453a3bfd4a5fa9e(props) {
33
33
  let { defaultFilter: defaultFilter , menuTrigger: menuTrigger = 'input' , allowsEmptyCollection: allowsEmptyCollection = false , allowsCustomValue: allowsCustomValue , shouldCloseOnBlur: shouldCloseOnBlur = true } = props;
34
- let [showAllItems, setShowAllItems] = $6wEwz$react.useState(false);
35
- let [isFocused1, setFocusedState] = $6wEwz$react.useState(false);
36
- let [inputValue, setInputValue] = $6wEwz$reactstatelyutils.useControlledState(props.inputValue, props.defaultInputValue ?? '', props.onInputChange);
34
+ let [showAllItems, setShowAllItems] = $AY0Rf$react.useState(false);
35
+ let [isFocused1, setFocusedState] = $AY0Rf$react.useState(false);
36
+ let [inputValue, setInputValue] = $AY0Rf$reactstatelyutils.useControlledState(props.inputValue, props.defaultInputValue ?? '', props.onInputChange);
37
37
  let onSelectionChange = (key)=>{
38
38
  if (props.onSelectionChange) props.onSelectionChange(key);
39
39
  // If key is the same, reset the inputValue and close the menu
@@ -43,15 +43,15 @@ function $1e7015be92cd531f$export$b453a3bfd4a5fa9e(props) {
43
43
  triggerState.close();
44
44
  }
45
45
  };
46
- let { collection: collection , selectionManager: selectionManager , selectedKey: selectedKey , setSelectedKey: setSelectedKey , selectedItem: selectedItem , disabledKeys: disabledKeys } = $6wEwz$reactstatelylist.useSingleSelectListState({
46
+ let { collection: collection , selectionManager: selectionManager , selectedKey: selectedKey , setSelectedKey: setSelectedKey , selectedItem: selectedItem , disabledKeys: disabledKeys } = $AY0Rf$reactstatelylist.useSingleSelectListState({
47
47
  ...props,
48
48
  onSelectionChange: onSelectionChange,
49
49
  items: props.items ?? props.defaultItems
50
50
  });
51
51
  // Preserve original collection so we can show all items on demand
52
52
  let originalCollection = collection;
53
- let filteredCollection = $6wEwz$react.useMemo(()=>// No default filter if items are controlled.
54
- props.items != null || !defaultFilter ? collection : $1e7015be92cd531f$var$filterCollection(collection, inputValue, defaultFilter)
53
+ let filteredCollection = $AY0Rf$react.useMemo(()=>// No default filter if items are controlled.
54
+ props.items != null || !defaultFilter ? collection : $25f859eaf3f5343a$var$filterCollection(collection, inputValue, defaultFilter)
55
55
  , [
56
56
  collection,
57
57
  inputValue,
@@ -59,11 +59,11 @@ function $1e7015be92cd531f$export$b453a3bfd4a5fa9e(props) {
59
59
  props.items
60
60
  ]);
61
61
  // Track what action is attempting to open the menu
62
- let menuOpenTrigger = $6wEwz$react.useRef('focus');
62
+ let menuOpenTrigger = $AY0Rf$react.useRef('focus');
63
63
  let onOpenChange = (open)=>{
64
64
  if (props.onOpenChange) props.onOpenChange(open, open ? menuOpenTrigger.current : undefined);
65
65
  };
66
- let triggerState = $6wEwz$reactstatelymenu.useMenuTriggerState({
66
+ let triggerState = $AY0Rf$reactstatelymenu.useMenuTriggerState({
67
67
  ...props,
68
68
  onOpenChange: onOpenChange,
69
69
  isOpen: undefined,
@@ -91,18 +91,18 @@ function $1e7015be92cd531f$export$b453a3bfd4a5fa9e(props) {
91
91
  if (!triggerState.isOpen) menuOpenTrigger.current = trigger;
92
92
  triggerState.toggle(focusStrategy);
93
93
  };
94
- let lastValue = $6wEwz$react.useRef(inputValue);
94
+ let lastValue = $AY0Rf$react.useRef(inputValue);
95
95
  let resetInputValue = ()=>{
96
96
  let itemText = collection.getItem(selectedKey)?.textValue ?? '';
97
97
  lastValue.current = itemText;
98
98
  setInputValue(itemText);
99
99
  };
100
- let isInitialRender = $6wEwz$react.useRef(true);
101
- let lastSelectedKey = $6wEwz$react.useRef((props.selectedKey ?? props.defaultSelectedKey) ?? null);
102
- let lastSelectedKeyText = $6wEwz$react.useRef(collection.getItem(selectedKey)?.textValue ?? '');
100
+ let isInitialRender = $AY0Rf$react.useRef(true);
101
+ let lastSelectedKey = $AY0Rf$react.useRef((props.selectedKey ?? props.defaultSelectedKey) ?? null);
102
+ let lastSelectedKeyText = $AY0Rf$react.useRef(collection.getItem(selectedKey)?.textValue ?? '');
103
103
  // intentional omit dependency array, want this to happen on every render
104
104
  // eslint-disable-next-line react-hooks/exhaustive-deps
105
- $6wEwz$react.useEffect(()=>{
105
+ $AY0Rf$react.useEffect(()=>{
106
106
  // Open and close menu automatically when the input value changes if the input is focused,
107
107
  // and there are items in the collection or allowEmptyCollection is true.
108
108
  if (isFocused1 && (filteredCollection.size > 0 || allowsEmptyCollection) && !triggerState.isOpen && inputValue !== lastValue.current && menuTrigger !== 'manual') open1(null, 'input');
@@ -141,7 +141,7 @@ function $1e7015be92cd531f$export$b453a3bfd4a5fa9e(props) {
141
141
  lastSelectedKey.current = selectedKey;
142
142
  lastSelectedKeyText.current = selectedItemText;
143
143
  });
144
- $6wEwz$react.useEffect(()=>{
144
+ $AY0Rf$react.useEffect(()=>{
145
145
  // Reset focused key when the menu closes
146
146
  if (!triggerState.isOpen) selectionManager.setFocusedKey(null);
147
147
  }, [
@@ -210,14 +210,14 @@ function $1e7015be92cd531f$export$b453a3bfd4a5fa9e(props) {
210
210
  revert: revert
211
211
  };
212
212
  }
213
- function $1e7015be92cd531f$var$filterCollection(collection, inputValue, filter) {
214
- return new $6wEwz$reactstatelylist.ListCollection($1e7015be92cd531f$var$filterNodes(collection, inputValue, filter));
213
+ function $25f859eaf3f5343a$var$filterCollection(collection, inputValue, filter) {
214
+ return new $AY0Rf$reactstatelylist.ListCollection($25f859eaf3f5343a$var$filterNodes(collection, inputValue, filter));
215
215
  }
216
- function $1e7015be92cd531f$var$filterNodes(nodes, inputValue, filter) {
216
+ function $25f859eaf3f5343a$var$filterNodes(nodes, inputValue, filter) {
217
217
  let filteredNode = [];
218
218
  for (let node of nodes){
219
219
  if (node.type === 'section' && node.hasChildNodes) {
220
- let filtered = $1e7015be92cd531f$var$filterNodes(node.childNodes, inputValue, filter);
220
+ let filtered = $25f859eaf3f5343a$var$filterNodes(node.childNodes, inputValue, filter);
221
221
  if ([
222
222
  ...filtered
223
223
  ].length > 0) filteredNode.push({
@@ -232,7 +232,7 @@ function $1e7015be92cd531f$var$filterNodes(nodes, inputValue, filter) {
232
232
  }
233
233
 
234
234
 
235
- $parcel$exportWildcard(module.exports, $1e7015be92cd531f$exports);
235
+ $parcel$exportWildcard(module.exports, $25f859eaf3f5343a$exports);
236
236
 
237
237
 
238
238
  //# sourceMappingURL=main.js.map
package/dist/module.js CHANGED
@@ -1,23 +1,23 @@
1
- import {useSingleSelectListState as $b3Vhr$useSingleSelectListState, ListCollection as $b3Vhr$ListCollection} from "@react-stately/list";
2
- import {useControlledState as $b3Vhr$useControlledState} from "@react-stately/utils";
3
- import {useState as $b3Vhr$useState, useMemo as $b3Vhr$useMemo, useRef as $b3Vhr$useRef, useEffect as $b3Vhr$useEffect} from "react";
4
- import {useMenuTriggerState as $b3Vhr$useMenuTriggerState} from "@react-stately/menu";
1
+ import {useSingleSelectListState as $jZKHO$useSingleSelectListState, ListCollection as $jZKHO$ListCollection} from "@react-stately/list";
2
+ import {useControlledState as $jZKHO$useControlledState} from "@react-stately/utils";
3
+ import {useState as $jZKHO$useState, useMemo as $jZKHO$useMemo, useRef as $jZKHO$useRef, useEffect as $jZKHO$useEffect} from "react";
4
+ import {useMenuTriggerState as $jZKHO$useMenuTriggerState} from "@react-stately/menu";
5
5
 
6
6
  function $parcel$export(e, n, v, s) {
7
7
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
8
  }
9
- var $8a266aa7013d42fb$exports = {};
9
+ var $6673426cab58817c$exports = {};
10
10
 
11
- $parcel$export($8a266aa7013d42fb$exports, "useComboBoxState", () => $8a266aa7013d42fb$export$b453a3bfd4a5fa9e);
11
+ $parcel$export($6673426cab58817c$exports, "useComboBoxState", () => $6673426cab58817c$export$b453a3bfd4a5fa9e);
12
12
 
13
13
 
14
14
 
15
15
 
16
- function $8a266aa7013d42fb$export$b453a3bfd4a5fa9e(props) {
16
+ function $6673426cab58817c$export$b453a3bfd4a5fa9e(props) {
17
17
  let { defaultFilter: defaultFilter , menuTrigger: menuTrigger = 'input' , allowsEmptyCollection: allowsEmptyCollection = false , allowsCustomValue: allowsCustomValue , shouldCloseOnBlur: shouldCloseOnBlur = true } = props;
18
- let [showAllItems, setShowAllItems] = $b3Vhr$useState(false);
19
- let [isFocused1, setFocusedState] = $b3Vhr$useState(false);
20
- let [inputValue, setInputValue] = $b3Vhr$useControlledState(props.inputValue, props.defaultInputValue ?? '', props.onInputChange);
18
+ let [showAllItems, setShowAllItems] = $jZKHO$useState(false);
19
+ let [isFocused1, setFocusedState] = $jZKHO$useState(false);
20
+ let [inputValue, setInputValue] = $jZKHO$useControlledState(props.inputValue, props.defaultInputValue ?? '', props.onInputChange);
21
21
  let onSelectionChange = (key)=>{
22
22
  if (props.onSelectionChange) props.onSelectionChange(key);
23
23
  // If key is the same, reset the inputValue and close the menu
@@ -27,15 +27,15 @@ function $8a266aa7013d42fb$export$b453a3bfd4a5fa9e(props) {
27
27
  triggerState.close();
28
28
  }
29
29
  };
30
- let { collection: collection , selectionManager: selectionManager , selectedKey: selectedKey , setSelectedKey: setSelectedKey , selectedItem: selectedItem , disabledKeys: disabledKeys } = $b3Vhr$useSingleSelectListState({
30
+ let { collection: collection , selectionManager: selectionManager , selectedKey: selectedKey , setSelectedKey: setSelectedKey , selectedItem: selectedItem , disabledKeys: disabledKeys } = $jZKHO$useSingleSelectListState({
31
31
  ...props,
32
32
  onSelectionChange: onSelectionChange,
33
33
  items: props.items ?? props.defaultItems
34
34
  });
35
35
  // Preserve original collection so we can show all items on demand
36
36
  let originalCollection = collection;
37
- let filteredCollection = $b3Vhr$useMemo(()=>// No default filter if items are controlled.
38
- props.items != null || !defaultFilter ? collection : $8a266aa7013d42fb$var$filterCollection(collection, inputValue, defaultFilter)
37
+ let filteredCollection = $jZKHO$useMemo(()=>// No default filter if items are controlled.
38
+ props.items != null || !defaultFilter ? collection : $6673426cab58817c$var$filterCollection(collection, inputValue, defaultFilter)
39
39
  , [
40
40
  collection,
41
41
  inputValue,
@@ -43,11 +43,11 @@ function $8a266aa7013d42fb$export$b453a3bfd4a5fa9e(props) {
43
43
  props.items
44
44
  ]);
45
45
  // Track what action is attempting to open the menu
46
- let menuOpenTrigger = $b3Vhr$useRef('focus');
46
+ let menuOpenTrigger = $jZKHO$useRef('focus');
47
47
  let onOpenChange = (open)=>{
48
48
  if (props.onOpenChange) props.onOpenChange(open, open ? menuOpenTrigger.current : undefined);
49
49
  };
50
- let triggerState = $b3Vhr$useMenuTriggerState({
50
+ let triggerState = $jZKHO$useMenuTriggerState({
51
51
  ...props,
52
52
  onOpenChange: onOpenChange,
53
53
  isOpen: undefined,
@@ -75,18 +75,18 @@ function $8a266aa7013d42fb$export$b453a3bfd4a5fa9e(props) {
75
75
  if (!triggerState.isOpen) menuOpenTrigger.current = trigger;
76
76
  triggerState.toggle(focusStrategy);
77
77
  };
78
- let lastValue = $b3Vhr$useRef(inputValue);
78
+ let lastValue = $jZKHO$useRef(inputValue);
79
79
  let resetInputValue = ()=>{
80
80
  let itemText = collection.getItem(selectedKey)?.textValue ?? '';
81
81
  lastValue.current = itemText;
82
82
  setInputValue(itemText);
83
83
  };
84
- let isInitialRender = $b3Vhr$useRef(true);
85
- let lastSelectedKey = $b3Vhr$useRef((props.selectedKey ?? props.defaultSelectedKey) ?? null);
86
- let lastSelectedKeyText = $b3Vhr$useRef(collection.getItem(selectedKey)?.textValue ?? '');
84
+ let isInitialRender = $jZKHO$useRef(true);
85
+ let lastSelectedKey = $jZKHO$useRef((props.selectedKey ?? props.defaultSelectedKey) ?? null);
86
+ let lastSelectedKeyText = $jZKHO$useRef(collection.getItem(selectedKey)?.textValue ?? '');
87
87
  // intentional omit dependency array, want this to happen on every render
88
88
  // eslint-disable-next-line react-hooks/exhaustive-deps
89
- $b3Vhr$useEffect(()=>{
89
+ $jZKHO$useEffect(()=>{
90
90
  // Open and close menu automatically when the input value changes if the input is focused,
91
91
  // and there are items in the collection or allowEmptyCollection is true.
92
92
  if (isFocused1 && (filteredCollection.size > 0 || allowsEmptyCollection) && !triggerState.isOpen && inputValue !== lastValue.current && menuTrigger !== 'manual') open1(null, 'input');
@@ -125,7 +125,7 @@ function $8a266aa7013d42fb$export$b453a3bfd4a5fa9e(props) {
125
125
  lastSelectedKey.current = selectedKey;
126
126
  lastSelectedKeyText.current = selectedItemText;
127
127
  });
128
- $b3Vhr$useEffect(()=>{
128
+ $jZKHO$useEffect(()=>{
129
129
  // Reset focused key when the menu closes
130
130
  if (!triggerState.isOpen) selectionManager.setFocusedKey(null);
131
131
  }, [
@@ -194,14 +194,14 @@ function $8a266aa7013d42fb$export$b453a3bfd4a5fa9e(props) {
194
194
  revert: revert
195
195
  };
196
196
  }
197
- function $8a266aa7013d42fb$var$filterCollection(collection, inputValue, filter) {
198
- return new $b3Vhr$ListCollection($8a266aa7013d42fb$var$filterNodes(collection, inputValue, filter));
197
+ function $6673426cab58817c$var$filterCollection(collection, inputValue, filter) {
198
+ return new $jZKHO$ListCollection($6673426cab58817c$var$filterNodes(collection, inputValue, filter));
199
199
  }
200
- function $8a266aa7013d42fb$var$filterNodes(nodes, inputValue, filter) {
200
+ function $6673426cab58817c$var$filterNodes(nodes, inputValue, filter) {
201
201
  let filteredNode = [];
202
202
  for (let node of nodes){
203
203
  if (node.type === 'section' && node.hasChildNodes) {
204
- let filtered = $8a266aa7013d42fb$var$filterNodes(node.childNodes, inputValue, filter);
204
+ let filtered = $6673426cab58817c$var$filterNodes(node.childNodes, inputValue, filter);
205
205
  if ([
206
206
  ...filtered
207
207
  ].length > 0) filteredNode.push({
@@ -218,5 +218,5 @@ function $8a266aa7013d42fb$var$filterNodes(nodes, inputValue, filter) {
218
218
 
219
219
 
220
220
 
221
- export {$8a266aa7013d42fb$export$b453a3bfd4a5fa9e as useComboBoxState};
221
+ export {$6673426cab58817c$export$b453a3bfd4a5fa9e as useComboBoxState};
222
222
  //# sourceMappingURL=module.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/combobox",
3
- "version": "3.0.2-nightly.3085+dfe72ee07",
3
+ "version": "3.0.2-nightly.3086+b2abc5d94",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-stately/list": "3.4.2-nightly.3085+dfe72ee07",
22
- "@react-stately/menu": "3.2.4-nightly.3085+dfe72ee07",
23
- "@react-stately/select": "3.1.4-nightly.3085+dfe72ee07",
24
- "@react-stately/utils": "3.0.0-nightly.1394+dfe72ee07",
25
- "@react-types/combobox": "3.2.2-nightly.3085+dfe72ee07",
26
- "@react-types/shared": "3.0.0-nightly.1394+dfe72ee07"
21
+ "@react-stately/list": "3.4.2-nightly.3086+b2abc5d94",
22
+ "@react-stately/menu": "3.2.4-nightly.3086+b2abc5d94",
23
+ "@react-stately/select": "3.1.4-nightly.3086+b2abc5d94",
24
+ "@react-stately/utils": "3.0.0-nightly.1395+b2abc5d94",
25
+ "@react-types/combobox": "3.2.2-nightly.3086+b2abc5d94",
26
+ "@react-types/shared": "3.0.0-nightly.1395+b2abc5d94"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "^16.8.0 || ^17.0.0-rc.1"
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "dfe72ee076f7ca27728d0b6b4c1ef86e11191ece"
34
+ "gitHead": "b2abc5d94162a7bd614fffcdf11e3d3754dc7d9f"
35
35
  }