@zag-js/combobox 1.23.0 → 1.24.0
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/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -180,6 +180,12 @@ interface ComboboxProps<T extends CollectionItem = CollectionItem> extends Direc
|
|
|
180
180
|
* Whether to allow typing custom values in the input
|
|
181
181
|
*/
|
|
182
182
|
allowCustomValue?: boolean | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Whether to always submit on Enter key press, even if popup is open.
|
|
185
|
+
* Useful for single-field autocomplete forms where Enter should submit the form.
|
|
186
|
+
* @default false
|
|
187
|
+
*/
|
|
188
|
+
alwaysSubmitOnEnter?: boolean | undefined;
|
|
183
189
|
/**
|
|
184
190
|
* Whether to loop the keyboard navigation through the items
|
|
185
191
|
* @default true
|
package/dist/index.d.ts
CHANGED
|
@@ -180,6 +180,12 @@ interface ComboboxProps<T extends CollectionItem = CollectionItem> extends Direc
|
|
|
180
180
|
* Whether to allow typing custom values in the input
|
|
181
181
|
*/
|
|
182
182
|
allowCustomValue?: boolean | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Whether to always submit on Enter key press, even if popup is open.
|
|
185
|
+
* Useful for single-field autocomplete forms where Enter should submit the form.
|
|
186
|
+
* @default false
|
|
187
|
+
*/
|
|
188
|
+
alwaysSubmitOnEnter?: boolean | undefined;
|
|
183
189
|
/**
|
|
184
190
|
* Whether to loop the keyboard navigation through the items
|
|
185
191
|
* @default true
|
package/dist/index.js
CHANGED
|
@@ -269,7 +269,9 @@ function connect(service, normalize) {
|
|
|
269
269
|
Enter(event3) {
|
|
270
270
|
send({ type: "INPUT.ENTER", keypress, src: "item-select" });
|
|
271
271
|
const submittable = computed("isCustomValue") && prop("allowCustomValue");
|
|
272
|
-
|
|
272
|
+
const hasHighlight = highlightedValue != null;
|
|
273
|
+
const alwaysSubmit = prop("alwaysSubmitOnEnter");
|
|
274
|
+
if (open && !submittable && !alwaysSubmit && hasHighlight) {
|
|
273
275
|
event3.preventDefault();
|
|
274
276
|
}
|
|
275
277
|
if (highlightedValue == null) return;
|
|
@@ -486,6 +488,7 @@ var machine = createMachine({
|
|
|
486
488
|
defaultValue: [],
|
|
487
489
|
closeOnSelect: !props2.multiple,
|
|
488
490
|
allowCustomValue: false,
|
|
491
|
+
alwaysSubmitOnEnter: false,
|
|
489
492
|
inputBehavior: "none",
|
|
490
493
|
selectionBehavior: props2.multiple ? "clear" : "replace",
|
|
491
494
|
openOnKeyPress: true,
|
|
@@ -1552,7 +1555,8 @@ var props = types.createProps()([
|
|
|
1552
1555
|
"scrollToIndexFn",
|
|
1553
1556
|
"selectionBehavior",
|
|
1554
1557
|
"translations",
|
|
1555
|
-
"value"
|
|
1558
|
+
"value",
|
|
1559
|
+
"alwaysSubmitOnEnter"
|
|
1556
1560
|
]);
|
|
1557
1561
|
var splitProps = utils.createSplitProps(props);
|
|
1558
1562
|
var itemGroupLabelProps = types.createProps()(["htmlFor"]);
|
package/dist/index.mjs
CHANGED
|
@@ -267,7 +267,9 @@ function connect(service, normalize) {
|
|
|
267
267
|
Enter(event3) {
|
|
268
268
|
send({ type: "INPUT.ENTER", keypress, src: "item-select" });
|
|
269
269
|
const submittable = computed("isCustomValue") && prop("allowCustomValue");
|
|
270
|
-
|
|
270
|
+
const hasHighlight = highlightedValue != null;
|
|
271
|
+
const alwaysSubmit = prop("alwaysSubmitOnEnter");
|
|
272
|
+
if (open && !submittable && !alwaysSubmit && hasHighlight) {
|
|
271
273
|
event3.preventDefault();
|
|
272
274
|
}
|
|
273
275
|
if (highlightedValue == null) return;
|
|
@@ -484,6 +486,7 @@ var machine = createMachine({
|
|
|
484
486
|
defaultValue: [],
|
|
485
487
|
closeOnSelect: !props2.multiple,
|
|
486
488
|
allowCustomValue: false,
|
|
489
|
+
alwaysSubmitOnEnter: false,
|
|
487
490
|
inputBehavior: "none",
|
|
488
491
|
selectionBehavior: props2.multiple ? "clear" : "replace",
|
|
489
492
|
openOnKeyPress: true,
|
|
@@ -1550,7 +1553,8 @@ var props = createProps()([
|
|
|
1550
1553
|
"scrollToIndexFn",
|
|
1551
1554
|
"selectionBehavior",
|
|
1552
1555
|
"translations",
|
|
1553
|
-
"value"
|
|
1556
|
+
"value",
|
|
1557
|
+
"alwaysSubmitOnEnter"
|
|
1554
1558
|
]);
|
|
1555
1559
|
var splitProps = createSplitProps(props);
|
|
1556
1560
|
var itemGroupLabelProps = createProps()(["htmlFor"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/combobox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Core logic for the combobox widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@zag-js/anatomy": "1.
|
|
30
|
-
"@zag-js/aria-hidden": "1.
|
|
31
|
-
"@zag-js/collection": "1.
|
|
32
|
-
"@zag-js/core": "1.
|
|
33
|
-
"@zag-js/dismissable": "1.
|
|
34
|
-
"@zag-js/dom-query": "1.
|
|
35
|
-
"@zag-js/utils": "1.
|
|
36
|
-
"@zag-js/popper": "1.
|
|
37
|
-
"@zag-js/types": "1.
|
|
29
|
+
"@zag-js/anatomy": "1.24.0",
|
|
30
|
+
"@zag-js/aria-hidden": "1.24.0",
|
|
31
|
+
"@zag-js/collection": "1.24.0",
|
|
32
|
+
"@zag-js/core": "1.24.0",
|
|
33
|
+
"@zag-js/dismissable": "1.24.0",
|
|
34
|
+
"@zag-js/dom-query": "1.24.0",
|
|
35
|
+
"@zag-js/utils": "1.24.0",
|
|
36
|
+
"@zag-js/popper": "1.24.0",
|
|
37
|
+
"@zag-js/types": "1.24.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"clean-package": "2.2.0"
|