@zag-js/combobox 1.12.0 → 1.12.1
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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -35,8 +35,9 @@ interface ScrollToIndexDetails {
|
|
|
35
35
|
immediate?: boolean | undefined;
|
|
36
36
|
}
|
|
37
37
|
interface NavigateDetails {
|
|
38
|
-
value: string
|
|
38
|
+
value: string;
|
|
39
39
|
node: HTMLAnchorElement;
|
|
40
|
+
href: string;
|
|
40
41
|
}
|
|
41
42
|
interface SelectionDetails {
|
|
42
43
|
value: string[];
|
|
@@ -239,7 +240,7 @@ interface ComboboxProps<T extends CollectionItem = CollectionItem> extends Direc
|
|
|
239
240
|
/**
|
|
240
241
|
* Function to navigate to the selected item
|
|
241
242
|
*/
|
|
242
|
-
navigate?: ((details: NavigateDetails) => void) | undefined;
|
|
243
|
+
navigate?: ((details: NavigateDetails) => void) | null | undefined;
|
|
243
244
|
}
|
|
244
245
|
type PropsWithDefault = "openOnChange" | "openOnKeyPress" | "composite" | "navigate" | "loopFocus" | "positioning" | "openOnClick" | "openOnChange" | "inputBehavior" | "collection" | "selectionBehavior" | "closeOnSelect" | "translations" | "positioning";
|
|
245
246
|
interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
|
package/dist/index.d.ts
CHANGED
|
@@ -35,8 +35,9 @@ interface ScrollToIndexDetails {
|
|
|
35
35
|
immediate?: boolean | undefined;
|
|
36
36
|
}
|
|
37
37
|
interface NavigateDetails {
|
|
38
|
-
value: string
|
|
38
|
+
value: string;
|
|
39
39
|
node: HTMLAnchorElement;
|
|
40
|
+
href: string;
|
|
40
41
|
}
|
|
41
42
|
interface SelectionDetails {
|
|
42
43
|
value: string[];
|
|
@@ -239,7 +240,7 @@ interface ComboboxProps<T extends CollectionItem = CollectionItem> extends Direc
|
|
|
239
240
|
/**
|
|
240
241
|
* Function to navigate to the selected item
|
|
241
242
|
*/
|
|
242
|
-
navigate?: ((details: NavigateDetails) => void) | undefined;
|
|
243
|
+
navigate?: ((details: NavigateDetails) => void) | null | undefined;
|
|
243
244
|
}
|
|
244
245
|
type PropsWithDefault = "openOnChange" | "openOnKeyPress" | "composite" | "navigate" | "loopFocus" | "positioning" | "openOnClick" | "openOnChange" | "inputBehavior" | "collection" | "selectionBehavior" | "closeOnSelect" | "translations" | "positioning";
|
|
245
246
|
interface ComboboxSchema<T extends CollectionItem = CollectionItem> {
|
package/dist/index.js
CHANGED
|
@@ -53,7 +53,7 @@ var getTriggerEl = (ctx) => ctx.getById(getTriggerId(ctx));
|
|
|
53
53
|
var getClearTriggerEl = (ctx) => ctx.getById(getClearTriggerId(ctx));
|
|
54
54
|
var getItemEl = (ctx, value) => {
|
|
55
55
|
if (value == null) return;
|
|
56
|
-
const selector = `[role=option][data-value="${CSS.escape(value)}"`;
|
|
56
|
+
const selector = `[role=option][data-value="${CSS.escape(value)}"]`;
|
|
57
57
|
return domQuery.query(getContentEl(ctx), selector);
|
|
58
58
|
};
|
|
59
59
|
var focusInputEl = (ctx) => {
|
|
@@ -266,10 +266,10 @@ function connect(service, normalize) {
|
|
|
266
266
|
if (open) {
|
|
267
267
|
event3.preventDefault();
|
|
268
268
|
}
|
|
269
|
-
|
|
270
|
-
const itemEl = getItemEl(scope,
|
|
269
|
+
if (highlightedValue == null) return;
|
|
270
|
+
const itemEl = getItemEl(scope, highlightedValue);
|
|
271
271
|
if (domQuery.isAnchorElement(itemEl)) {
|
|
272
|
-
prop("navigate")({ value:
|
|
272
|
+
prop("navigate")?.({ value: highlightedValue, node: itemEl, href: itemEl.href });
|
|
273
273
|
}
|
|
274
274
|
},
|
|
275
275
|
Escape() {
|
package/dist/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ var getTriggerEl = (ctx) => ctx.getById(getTriggerId(ctx));
|
|
|
51
51
|
var getClearTriggerEl = (ctx) => ctx.getById(getClearTriggerId(ctx));
|
|
52
52
|
var getItemEl = (ctx, value) => {
|
|
53
53
|
if (value == null) return;
|
|
54
|
-
const selector = `[role=option][data-value="${CSS.escape(value)}"`;
|
|
54
|
+
const selector = `[role=option][data-value="${CSS.escape(value)}"]`;
|
|
55
55
|
return query(getContentEl(ctx), selector);
|
|
56
56
|
};
|
|
57
57
|
var focusInputEl = (ctx) => {
|
|
@@ -264,10 +264,10 @@ function connect(service, normalize) {
|
|
|
264
264
|
if (open) {
|
|
265
265
|
event3.preventDefault();
|
|
266
266
|
}
|
|
267
|
-
|
|
268
|
-
const itemEl = getItemEl(scope,
|
|
267
|
+
if (highlightedValue == null) return;
|
|
268
|
+
const itemEl = getItemEl(scope, highlightedValue);
|
|
269
269
|
if (isAnchorElement(itemEl)) {
|
|
270
|
-
prop("navigate")({ value:
|
|
270
|
+
prop("navigate")?.({ value: highlightedValue, node: itemEl, href: itemEl.href });
|
|
271
271
|
}
|
|
272
272
|
},
|
|
273
273
|
Escape() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/combobox",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.1",
|
|
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.12.
|
|
30
|
-
"@zag-js/aria-hidden": "1.12.
|
|
31
|
-
"@zag-js/collection": "1.12.
|
|
32
|
-
"@zag-js/core": "1.12.
|
|
33
|
-
"@zag-js/dismissable": "1.12.
|
|
34
|
-
"@zag-js/dom-query": "1.12.
|
|
35
|
-
"@zag-js/utils": "1.12.
|
|
36
|
-
"@zag-js/popper": "1.12.
|
|
37
|
-
"@zag-js/types": "1.12.
|
|
29
|
+
"@zag-js/anatomy": "1.12.1",
|
|
30
|
+
"@zag-js/aria-hidden": "1.12.1",
|
|
31
|
+
"@zag-js/collection": "1.12.1",
|
|
32
|
+
"@zag-js/core": "1.12.1",
|
|
33
|
+
"@zag-js/dismissable": "1.12.1",
|
|
34
|
+
"@zag-js/dom-query": "1.12.1",
|
|
35
|
+
"@zag-js/utils": "1.12.1",
|
|
36
|
+
"@zag-js/popper": "1.12.1",
|
|
37
|
+
"@zag-js/types": "1.12.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"clean-package": "2.2.0"
|