@zag-js/combobox 1.17.3 → 1.17.4
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -11
- package/dist/index.mjs +6 -11
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -254,7 +254,6 @@ interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
|
|
|
254
254
|
currentPlacement?: Placement | undefined;
|
|
255
255
|
highlightedItem: T | null;
|
|
256
256
|
selectedItems: T[];
|
|
257
|
-
valueAsString: string;
|
|
258
257
|
};
|
|
259
258
|
computed: {
|
|
260
259
|
isCustomValue: boolean;
|
|
@@ -263,6 +262,7 @@ interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
|
|
|
263
262
|
autoComplete: boolean;
|
|
264
263
|
autoHighlight: boolean;
|
|
265
264
|
hasSelectedItems: boolean;
|
|
265
|
+
valueAsString: string;
|
|
266
266
|
};
|
|
267
267
|
event: EventObject;
|
|
268
268
|
action: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -254,7 +254,6 @@ interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
|
|
|
254
254
|
currentPlacement?: Placement | undefined;
|
|
255
255
|
highlightedItem: T | null;
|
|
256
256
|
selectedItems: T[];
|
|
257
|
-
valueAsString: string;
|
|
258
257
|
};
|
|
259
258
|
computed: {
|
|
260
259
|
isCustomValue: boolean;
|
|
@@ -263,6 +262,7 @@ interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
|
|
|
263
262
|
autoComplete: boolean;
|
|
264
263
|
autoHighlight: boolean;
|
|
265
264
|
hasSelectedItems: boolean;
|
|
265
|
+
valueAsString: string;
|
|
266
266
|
};
|
|
267
267
|
event: EventObject;
|
|
268
268
|
action: string;
|
package/dist/index.js
CHANGED
|
@@ -102,7 +102,7 @@ function connect(service, normalize) {
|
|
|
102
102
|
highlightedValue,
|
|
103
103
|
highlightedItem: context.get("highlightedItem"),
|
|
104
104
|
value: context.get("value"),
|
|
105
|
-
valueAsString:
|
|
105
|
+
valueAsString: computed("valueAsString"),
|
|
106
106
|
hasSelectedItems: computed("hasSelectedItems"),
|
|
107
107
|
selectedItems: context.get("selectedItems"),
|
|
108
108
|
collection: prop("collection"),
|
|
@@ -528,7 +528,6 @@ var machine = createMachine({
|
|
|
528
528
|
return item || collection2.find(v);
|
|
529
529
|
});
|
|
530
530
|
context.set("selectedItems", nextItems);
|
|
531
|
-
context.set("valueAsString", collection2.stringifyItems(nextItems));
|
|
532
531
|
prop("onValueChange")?.({ value, items: nextItems });
|
|
533
532
|
}
|
|
534
533
|
})),
|
|
@@ -568,11 +567,6 @@ var machine = createMachine({
|
|
|
568
567
|
const value = prop("value") || prop("defaultValue") || [];
|
|
569
568
|
const selectedItems = prop("collection").findMany(value);
|
|
570
569
|
return { defaultValue: selectedItems };
|
|
571
|
-
}),
|
|
572
|
-
valueAsString: bindable(() => {
|
|
573
|
-
const value = prop("value") || prop("defaultValue") || [];
|
|
574
|
-
const valueAsString = prop("collection").stringifyMany(value);
|
|
575
|
-
return { sync: true, defaultValue: valueAsString };
|
|
576
570
|
})
|
|
577
571
|
};
|
|
578
572
|
},
|
|
@@ -582,7 +576,8 @@ var machine = createMachine({
|
|
|
582
576
|
autoComplete: ({ prop }) => prop("inputBehavior") === "autocomplete",
|
|
583
577
|
autoHighlight: ({ prop }) => prop("inputBehavior") === "autohighlight",
|
|
584
578
|
hasSelectedItems: ({ context }) => context.get("value").length > 0,
|
|
585
|
-
|
|
579
|
+
valueAsString: ({ context, prop }) => prop("collection").stringifyItems(context.get("selectedItems")),
|
|
580
|
+
isCustomValue: ({ context, computed }) => context.get("inputValue") !== computed("valueAsString")
|
|
586
581
|
},
|
|
587
582
|
watch({ context, prop, track, action }) {
|
|
588
583
|
track([() => context.hash("value")], () => {
|
|
@@ -1297,7 +1292,7 @@ var machine = createMachine({
|
|
|
1297
1292
|
revertInputValue({ context, prop, computed }) {
|
|
1298
1293
|
const selectionBehavior = prop("selectionBehavior");
|
|
1299
1294
|
const inputValue = utils.match(selectionBehavior, {
|
|
1300
|
-
replace: computed("hasSelectedItems") ?
|
|
1295
|
+
replace: computed("hasSelectedItems") ? computed("valueAsString") : "",
|
|
1301
1296
|
preserve: context.get("inputValue"),
|
|
1302
1297
|
clear: ""
|
|
1303
1298
|
});
|
|
@@ -1435,10 +1430,10 @@ var machine = createMachine({
|
|
|
1435
1430
|
}
|
|
1436
1431
|
}
|
|
1437
1432
|
});
|
|
1438
|
-
function getInputValue({ context, prop }) {
|
|
1433
|
+
function getInputValue({ context, prop, computed }) {
|
|
1439
1434
|
return utils.match(prop("selectionBehavior"), {
|
|
1440
1435
|
preserve: context.get("inputValue"),
|
|
1441
|
-
replace:
|
|
1436
|
+
replace: computed("valueAsString"),
|
|
1442
1437
|
clear: ""
|
|
1443
1438
|
});
|
|
1444
1439
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -100,7 +100,7 @@ function connect(service, normalize) {
|
|
|
100
100
|
highlightedValue,
|
|
101
101
|
highlightedItem: context.get("highlightedItem"),
|
|
102
102
|
value: context.get("value"),
|
|
103
|
-
valueAsString:
|
|
103
|
+
valueAsString: computed("valueAsString"),
|
|
104
104
|
hasSelectedItems: computed("hasSelectedItems"),
|
|
105
105
|
selectedItems: context.get("selectedItems"),
|
|
106
106
|
collection: prop("collection"),
|
|
@@ -526,7 +526,6 @@ var machine = createMachine({
|
|
|
526
526
|
return item || collection2.find(v);
|
|
527
527
|
});
|
|
528
528
|
context.set("selectedItems", nextItems);
|
|
529
|
-
context.set("valueAsString", collection2.stringifyItems(nextItems));
|
|
530
529
|
prop("onValueChange")?.({ value, items: nextItems });
|
|
531
530
|
}
|
|
532
531
|
})),
|
|
@@ -566,11 +565,6 @@ var machine = createMachine({
|
|
|
566
565
|
const value = prop("value") || prop("defaultValue") || [];
|
|
567
566
|
const selectedItems = prop("collection").findMany(value);
|
|
568
567
|
return { defaultValue: selectedItems };
|
|
569
|
-
}),
|
|
570
|
-
valueAsString: bindable(() => {
|
|
571
|
-
const value = prop("value") || prop("defaultValue") || [];
|
|
572
|
-
const valueAsString = prop("collection").stringifyMany(value);
|
|
573
|
-
return { sync: true, defaultValue: valueAsString };
|
|
574
568
|
})
|
|
575
569
|
};
|
|
576
570
|
},
|
|
@@ -580,7 +574,8 @@ var machine = createMachine({
|
|
|
580
574
|
autoComplete: ({ prop }) => prop("inputBehavior") === "autocomplete",
|
|
581
575
|
autoHighlight: ({ prop }) => prop("inputBehavior") === "autohighlight",
|
|
582
576
|
hasSelectedItems: ({ context }) => context.get("value").length > 0,
|
|
583
|
-
|
|
577
|
+
valueAsString: ({ context, prop }) => prop("collection").stringifyItems(context.get("selectedItems")),
|
|
578
|
+
isCustomValue: ({ context, computed }) => context.get("inputValue") !== computed("valueAsString")
|
|
584
579
|
},
|
|
585
580
|
watch({ context, prop, track, action }) {
|
|
586
581
|
track([() => context.hash("value")], () => {
|
|
@@ -1295,7 +1290,7 @@ var machine = createMachine({
|
|
|
1295
1290
|
revertInputValue({ context, prop, computed }) {
|
|
1296
1291
|
const selectionBehavior = prop("selectionBehavior");
|
|
1297
1292
|
const inputValue = match(selectionBehavior, {
|
|
1298
|
-
replace: computed("hasSelectedItems") ?
|
|
1293
|
+
replace: computed("hasSelectedItems") ? computed("valueAsString") : "",
|
|
1299
1294
|
preserve: context.get("inputValue"),
|
|
1300
1295
|
clear: ""
|
|
1301
1296
|
});
|
|
@@ -1433,10 +1428,10 @@ var machine = createMachine({
|
|
|
1433
1428
|
}
|
|
1434
1429
|
}
|
|
1435
1430
|
});
|
|
1436
|
-
function getInputValue({ context, prop }) {
|
|
1431
|
+
function getInputValue({ context, prop, computed }) {
|
|
1437
1432
|
return match(prop("selectionBehavior"), {
|
|
1438
1433
|
preserve: context.get("inputValue"),
|
|
1439
|
-
replace:
|
|
1434
|
+
replace: computed("valueAsString"),
|
|
1440
1435
|
clear: ""
|
|
1441
1436
|
});
|
|
1442
1437
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/combobox",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.4",
|
|
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.17.
|
|
30
|
-
"@zag-js/aria-hidden": "1.17.
|
|
31
|
-
"@zag-js/collection": "1.17.
|
|
32
|
-
"@zag-js/core": "1.17.
|
|
33
|
-
"@zag-js/dismissable": "1.17.
|
|
34
|
-
"@zag-js/dom-query": "1.17.
|
|
35
|
-
"@zag-js/utils": "1.17.
|
|
36
|
-
"@zag-js/popper": "1.17.
|
|
37
|
-
"@zag-js/types": "1.17.
|
|
29
|
+
"@zag-js/anatomy": "1.17.4",
|
|
30
|
+
"@zag-js/aria-hidden": "1.17.4",
|
|
31
|
+
"@zag-js/collection": "1.17.4",
|
|
32
|
+
"@zag-js/core": "1.17.4",
|
|
33
|
+
"@zag-js/dismissable": "1.17.4",
|
|
34
|
+
"@zag-js/dom-query": "1.17.4",
|
|
35
|
+
"@zag-js/utils": "1.17.4",
|
|
36
|
+
"@zag-js/popper": "1.17.4",
|
|
37
|
+
"@zag-js/types": "1.17.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"clean-package": "2.2.0"
|