@zag-js/combobox 1.15.3 → 1.15.5

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 CHANGED
@@ -257,6 +257,7 @@ interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
257
257
  valueAsString: string;
258
258
  };
259
259
  computed: {
260
+ isCustomValue: boolean;
260
261
  isInputValueEmpty: boolean;
261
262
  isInteractive: boolean;
262
263
  autoComplete: boolean;
package/dist/index.d.ts CHANGED
@@ -257,6 +257,7 @@ interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
257
257
  valueAsString: string;
258
258
  };
259
259
  computed: {
260
+ isCustomValue: boolean;
260
261
  isInputValueEmpty: boolean;
261
262
  isInteractive: boolean;
262
263
  autoComplete: boolean;
package/dist/index.js CHANGED
@@ -263,7 +263,8 @@ function connect(service, normalize) {
263
263
  },
264
264
  Enter(event3) {
265
265
  send({ type: "INPUT.ENTER", keypress });
266
- if (open) {
266
+ const submittable = computed("isCustomValue") && prop("allowCustomValue");
267
+ if (open && !submittable) {
267
268
  event3.preventDefault();
268
269
  }
269
270
  if (highlightedValue == null) return;
@@ -577,7 +578,8 @@ var machine = createMachine({
577
578
  isInteractive: ({ prop }) => !(prop("readOnly") || prop("disabled")),
578
579
  autoComplete: ({ prop }) => prop("inputBehavior") === "autocomplete",
579
580
  autoHighlight: ({ prop }) => prop("inputBehavior") === "autohighlight",
580
- hasSelectedItems: ({ context }) => context.get("value").length > 0
581
+ hasSelectedItems: ({ context }) => context.get("value").length > 0,
582
+ isCustomValue: ({ context }) => context.get("inputValue") !== context.get("valueAsString")
581
583
  },
582
584
  watch({ context, prop, track, action }) {
583
585
  track([() => context.hash("value")], () => {
@@ -1112,7 +1114,7 @@ var machine = createMachine({
1112
1114
  autoHighlight: ({ computed }) => computed("autoHighlight"),
1113
1115
  isFirstItemHighlighted: ({ prop, context }) => prop("collection").firstValue === context.get("highlightedValue"),
1114
1116
  isLastItemHighlighted: ({ prop, context }) => prop("collection").lastValue === context.get("highlightedValue"),
1115
- isCustomValue: ({ context }) => context.get("inputValue") !== context.get("valueAsString"),
1117
+ isCustomValue: ({ computed }) => computed("isCustomValue"),
1116
1118
  allowCustomValue: ({ prop }) => !!prop("allowCustomValue"),
1117
1119
  hasHighlightedItem: ({ context }) => context.get("highlightedValue") != null,
1118
1120
  closeOnSelect: ({ prop }) => !!prop("closeOnSelect"),
package/dist/index.mjs CHANGED
@@ -261,7 +261,8 @@ function connect(service, normalize) {
261
261
  },
262
262
  Enter(event3) {
263
263
  send({ type: "INPUT.ENTER", keypress });
264
- if (open) {
264
+ const submittable = computed("isCustomValue") && prop("allowCustomValue");
265
+ if (open && !submittable) {
265
266
  event3.preventDefault();
266
267
  }
267
268
  if (highlightedValue == null) return;
@@ -575,7 +576,8 @@ var machine = createMachine({
575
576
  isInteractive: ({ prop }) => !(prop("readOnly") || prop("disabled")),
576
577
  autoComplete: ({ prop }) => prop("inputBehavior") === "autocomplete",
577
578
  autoHighlight: ({ prop }) => prop("inputBehavior") === "autohighlight",
578
- hasSelectedItems: ({ context }) => context.get("value").length > 0
579
+ hasSelectedItems: ({ context }) => context.get("value").length > 0,
580
+ isCustomValue: ({ context }) => context.get("inputValue") !== context.get("valueAsString")
579
581
  },
580
582
  watch({ context, prop, track, action }) {
581
583
  track([() => context.hash("value")], () => {
@@ -1110,7 +1112,7 @@ var machine = createMachine({
1110
1112
  autoHighlight: ({ computed }) => computed("autoHighlight"),
1111
1113
  isFirstItemHighlighted: ({ prop, context }) => prop("collection").firstValue === context.get("highlightedValue"),
1112
1114
  isLastItemHighlighted: ({ prop, context }) => prop("collection").lastValue === context.get("highlightedValue"),
1113
- isCustomValue: ({ context }) => context.get("inputValue") !== context.get("valueAsString"),
1115
+ isCustomValue: ({ computed }) => computed("isCustomValue"),
1114
1116
  allowCustomValue: ({ prop }) => !!prop("allowCustomValue"),
1115
1117
  hasHighlightedItem: ({ context }) => context.get("highlightedValue") != null,
1116
1118
  closeOnSelect: ({ prop }) => !!prop("closeOnSelect"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/combobox",
3
- "version": "1.15.3",
3
+ "version": "1.15.5",
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.15.3",
30
- "@zag-js/aria-hidden": "1.15.3",
31
- "@zag-js/collection": "1.15.3",
32
- "@zag-js/core": "1.15.3",
33
- "@zag-js/dismissable": "1.15.3",
34
- "@zag-js/dom-query": "1.15.3",
35
- "@zag-js/utils": "1.15.3",
36
- "@zag-js/popper": "1.15.3",
37
- "@zag-js/types": "1.15.3"
29
+ "@zag-js/anatomy": "1.15.5",
30
+ "@zag-js/aria-hidden": "1.15.5",
31
+ "@zag-js/collection": "1.15.5",
32
+ "@zag-js/core": "1.15.5",
33
+ "@zag-js/dismissable": "1.15.5",
34
+ "@zag-js/dom-query": "1.15.5",
35
+ "@zag-js/utils": "1.15.5",
36
+ "@zag-js/popper": "1.15.5",
37
+ "@zag-js/types": "1.15.5"
38
38
  },
39
39
  "devDependencies": {
40
40
  "clean-package": "2.2.0"