@ariakit/core 0.4.2 → 0.4.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/CHANGELOG.md +19 -0
- package/cjs/combobox/combobox-store.cjs +1 -2
- package/cjs/tab/tab-store.cjs +16 -12
- package/cjs/tab/tab-store.d.cts +10 -2
- package/cjs/tab/tab-store.d.ts +10 -2
- package/cjs/utils/misc.d.cts +4 -4
- package/cjs/utils/misc.d.ts +4 -4
- package/esm/combobox/combobox-store.js +2 -3
- package/esm/tab/tab-store.d.ts +10 -2
- package/esm/tab/tab-store.js +16 -12
- package/esm/utils/misc.d.ts +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.4.4
|
|
4
|
+
|
|
5
|
+
### Combobox `autoFocusOnHide` behavior
|
|
6
|
+
|
|
7
|
+
Previously, the [`autoFocusOnHide`](https://ariakit.org/reference/combobox-popover#autofocusonhide) feature on [`ComboboxPopover`](https://ariakit.org/reference/combobox-popover) was turned off by default. Most of the time, this didn't have any practical impact because the combobox input element was already focused when the popover was hidden.
|
|
8
|
+
|
|
9
|
+
Now, this feature is enabled by default and should work consistently even when [`virtualFocus`](https://ariakit.org/reference/combobox-provider#virtualfocus) is set to `false`.
|
|
10
|
+
|
|
11
|
+
### Other updates
|
|
12
|
+
|
|
13
|
+
- Improved JSDocs.
|
|
14
|
+
|
|
15
|
+
## 0.4.3
|
|
16
|
+
|
|
17
|
+
- Fixed regression in `v0.4.2` that caused nested tabs to stop working.
|
|
18
|
+
- Added new [`combobox`](https://ariakit.org/reference/tab-provider#combobox) property to tab store.
|
|
19
|
+
- Improved JSDocs.
|
|
20
|
+
- Fixed TypeScript error on `defaultValue`.
|
|
21
|
+
|
|
3
22
|
## 0.4.2
|
|
4
23
|
|
|
5
24
|
- Fixed [`Focusable`](https://ariakit.org/reference/focusable) to identify `summary` as a native tabbable element.
|
|
@@ -20,7 +20,6 @@ var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
|
|
|
20
20
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
var _7DU6YMLQcjs = require('../__chunks/7DU6YMLQ.cjs');
|
|
25
24
|
require('../__chunks/UKR6TQI3.cjs');
|
|
26
25
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
@@ -30,7 +29,7 @@ require('../__chunks/ULSPM3Y3.cjs');
|
|
|
30
29
|
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
31
30
|
|
|
32
31
|
// src/combobox/combobox-store.ts
|
|
33
|
-
var isSafariOnMobile = _7DU6YMLQcjs.isSafari.call(void 0, ) &&
|
|
32
|
+
var isSafariOnMobile = _7DU6YMLQcjs.isSafari.call(void 0, ) && matchMedia("(hover:none)").matches;
|
|
34
33
|
function createComboboxStore(props = {}) {
|
|
35
34
|
var _a;
|
|
36
35
|
_B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -27,22 +27,26 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
27
27
|
// src/tab/tab-store.ts
|
|
28
28
|
function createTabStore(_a = {}) {
|
|
29
29
|
var _b = _a, {
|
|
30
|
-
composite: parentComposite
|
|
30
|
+
composite: parentComposite,
|
|
31
|
+
combobox
|
|
31
32
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
32
|
-
"composite"
|
|
33
|
+
"composite",
|
|
34
|
+
"combobox"
|
|
33
35
|
]);
|
|
36
|
+
const independentKeys = [
|
|
37
|
+
"items",
|
|
38
|
+
"renderedItems",
|
|
39
|
+
"moves",
|
|
40
|
+
"orientation",
|
|
41
|
+
"baseElement",
|
|
42
|
+
"focusLoop",
|
|
43
|
+
"focusShift",
|
|
44
|
+
"focusWrap"
|
|
45
|
+
];
|
|
34
46
|
const store = _B4LYZ4EMcjs.mergeStore.call(void 0,
|
|
35
47
|
props.store,
|
|
36
|
-
_B4LYZ4EMcjs.omit.call(void 0, parentComposite,
|
|
37
|
-
|
|
38
|
-
"renderedItems",
|
|
39
|
-
"moves",
|
|
40
|
-
"orientation",
|
|
41
|
-
"baseElement",
|
|
42
|
-
"focusLoop",
|
|
43
|
-
"focusShift",
|
|
44
|
-
"focusWrap"
|
|
45
|
-
])
|
|
48
|
+
_B4LYZ4EMcjs.omit.call(void 0, parentComposite, independentKeys),
|
|
49
|
+
_B4LYZ4EMcjs.omit.call(void 0, combobox, independentKeys)
|
|
46
50
|
);
|
|
47
51
|
const syncState = store == null ? void 0 : store.getState();
|
|
48
52
|
const composite = _Y7KNI5NScjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
package/cjs/tab/tab-store.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
|
|
2
|
+
import type { ComboboxStore } from "../combobox/combobox-store.js";
|
|
2
3
|
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
5
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore;
|
|
6
|
+
export declare function createTabStore({ composite: parentComposite, combobox, ...props }?: TabStoreProps): TabStore;
|
|
6
7
|
export interface TabStoreItem extends CompositeStoreItem {
|
|
7
8
|
dimmed?: boolean;
|
|
8
9
|
}
|
|
@@ -78,13 +79,20 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
78
79
|
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
80
|
/**
|
|
80
81
|
* A reference to another [composite
|
|
81
|
-
* store](https://ariakit.org/reference/composite-store). This is used when
|
|
82
|
+
* store](https://ariakit.org/reference/use-composite-store). This is used when
|
|
82
83
|
* rendering tabs as part of another composite widget such as
|
|
83
84
|
* [Combobox](https://ariakit.org/components/combobox) or
|
|
84
85
|
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
85
86
|
* same state.
|
|
86
87
|
*/
|
|
87
88
|
composite?: CompositeStore | null;
|
|
89
|
+
/**
|
|
90
|
+
* A reference to a [combobox
|
|
91
|
+
* store](https://ariakit.org/reference/use-combobox-store). This is used when
|
|
92
|
+
* rendering tabs inside a
|
|
93
|
+
* [Combobox](https://ariakit.org/components/combobox).
|
|
94
|
+
*/
|
|
95
|
+
combobox?: ComboboxStore | null;
|
|
88
96
|
/**
|
|
89
97
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
90
98
|
* will be automatically set to the first enabled tab.
|
package/cjs/tab/tab-store.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
|
|
2
|
+
import type { ComboboxStore } from "../combobox/combobox-store.js";
|
|
2
3
|
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
5
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore;
|
|
6
|
+
export declare function createTabStore({ composite: parentComposite, combobox, ...props }?: TabStoreProps): TabStore;
|
|
6
7
|
export interface TabStoreItem extends CompositeStoreItem {
|
|
7
8
|
dimmed?: boolean;
|
|
8
9
|
}
|
|
@@ -78,13 +79,20 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
78
79
|
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
80
|
/**
|
|
80
81
|
* A reference to another [composite
|
|
81
|
-
* store](https://ariakit.org/reference/composite-store). This is used when
|
|
82
|
+
* store](https://ariakit.org/reference/use-composite-store). This is used when
|
|
82
83
|
* rendering tabs as part of another composite widget such as
|
|
83
84
|
* [Combobox](https://ariakit.org/components/combobox) or
|
|
84
85
|
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
85
86
|
* same state.
|
|
86
87
|
*/
|
|
87
88
|
composite?: CompositeStore | null;
|
|
89
|
+
/**
|
|
90
|
+
* A reference to a [combobox
|
|
91
|
+
* store](https://ariakit.org/reference/use-combobox-store). This is used when
|
|
92
|
+
* rendering tabs inside a
|
|
93
|
+
* [Combobox](https://ariakit.org/components/combobox).
|
|
94
|
+
*/
|
|
95
|
+
combobox?: ComboboxStore | null;
|
|
88
96
|
/**
|
|
89
97
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
90
98
|
* will be automatically set to the first enabled tab.
|
package/cjs/utils/misc.d.cts
CHANGED
|
@@ -121,8 +121,8 @@ export declare function removeUndefinedValues<T extends AnyObject>(obj: T): T;
|
|
|
121
121
|
* Returns the first value that is not `undefined`.
|
|
122
122
|
*/
|
|
123
123
|
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>;
|
|
124
|
-
type
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
type DefaultValue<T extends readonly any[], Other = never> = T extends [
|
|
125
|
+
infer Head,
|
|
126
|
+
...infer Rest
|
|
127
|
+
] ? Rest extends [] ? T[number] | Other : undefined extends Head ? DefaultValue<Rest, Exclude<Other | Head, undefined>> : Exclude<T[number], undefined> : never;
|
|
128
128
|
export {};
|
package/cjs/utils/misc.d.ts
CHANGED
|
@@ -121,8 +121,8 @@ export declare function removeUndefinedValues<T extends AnyObject>(obj: T): T;
|
|
|
121
121
|
* Returns the first value that is not `undefined`.
|
|
122
122
|
*/
|
|
123
123
|
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>;
|
|
124
|
-
type
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
type DefaultValue<T extends readonly any[], Other = never> = T extends [
|
|
125
|
+
infer Head,
|
|
126
|
+
...infer Rest
|
|
127
|
+
] ? Rest extends [] ? T[number] | Other : undefined extends Head ? DefaultValue<Rest, Exclude<Other | Head, undefined>> : Exclude<T[number], undefined> : never;
|
|
128
128
|
export {};
|
|
@@ -19,8 +19,7 @@ import {
|
|
|
19
19
|
defaultValue
|
|
20
20
|
} from "../__chunks/22HHDS5F.js";
|
|
21
21
|
import {
|
|
22
|
-
isSafari
|
|
23
|
-
isTouchDevice
|
|
22
|
+
isSafari
|
|
24
23
|
} from "../__chunks/VDNATJW2.js";
|
|
25
24
|
import "../__chunks/RRSZHCH6.js";
|
|
26
25
|
import "../__chunks/7PRQYBBV.js";
|
|
@@ -30,7 +29,7 @@ import {
|
|
|
30
29
|
} from "../__chunks/4R3V3JGP.js";
|
|
31
30
|
|
|
32
31
|
// src/combobox/combobox-store.ts
|
|
33
|
-
var isSafariOnMobile = isSafari() &&
|
|
32
|
+
var isSafariOnMobile = isSafari() && matchMedia("(hover:none)").matches;
|
|
34
33
|
function createComboboxStore(props = {}) {
|
|
35
34
|
var _a;
|
|
36
35
|
throwOnConflictingProps(props, props.store);
|
package/esm/tab/tab-store.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js";
|
|
2
|
+
import type { ComboboxStore } from "../combobox/combobox-store.js";
|
|
2
3
|
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
5
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore;
|
|
6
|
+
export declare function createTabStore({ composite: parentComposite, combobox, ...props }?: TabStoreProps): TabStore;
|
|
6
7
|
export interface TabStoreItem extends CompositeStoreItem {
|
|
7
8
|
dimmed?: boolean;
|
|
8
9
|
}
|
|
@@ -78,13 +79,20 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem>
|
|
|
78
79
|
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
80
|
/**
|
|
80
81
|
* A reference to another [composite
|
|
81
|
-
* store](https://ariakit.org/reference/composite-store). This is used when
|
|
82
|
+
* store](https://ariakit.org/reference/use-composite-store). This is used when
|
|
82
83
|
* rendering tabs as part of another composite widget such as
|
|
83
84
|
* [Combobox](https://ariakit.org/components/combobox) or
|
|
84
85
|
* [Select](https://ariakit.org/components/select). The stores will share the
|
|
85
86
|
* same state.
|
|
86
87
|
*/
|
|
87
88
|
composite?: CompositeStore | null;
|
|
89
|
+
/**
|
|
90
|
+
* A reference to a [combobox
|
|
91
|
+
* store](https://ariakit.org/reference/use-combobox-store). This is used when
|
|
92
|
+
* rendering tabs inside a
|
|
93
|
+
* [Combobox](https://ariakit.org/components/combobox).
|
|
94
|
+
*/
|
|
95
|
+
combobox?: ComboboxStore | null;
|
|
88
96
|
/**
|
|
89
97
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
90
98
|
* will be automatically set to the first enabled tab.
|
package/esm/tab/tab-store.js
CHANGED
|
@@ -27,22 +27,26 @@ import {
|
|
|
27
27
|
// src/tab/tab-store.ts
|
|
28
28
|
function createTabStore(_a = {}) {
|
|
29
29
|
var _b = _a, {
|
|
30
|
-
composite: parentComposite
|
|
30
|
+
composite: parentComposite,
|
|
31
|
+
combobox
|
|
31
32
|
} = _b, props = __objRest(_b, [
|
|
32
|
-
"composite"
|
|
33
|
+
"composite",
|
|
34
|
+
"combobox"
|
|
33
35
|
]);
|
|
36
|
+
const independentKeys = [
|
|
37
|
+
"items",
|
|
38
|
+
"renderedItems",
|
|
39
|
+
"moves",
|
|
40
|
+
"orientation",
|
|
41
|
+
"baseElement",
|
|
42
|
+
"focusLoop",
|
|
43
|
+
"focusShift",
|
|
44
|
+
"focusWrap"
|
|
45
|
+
];
|
|
34
46
|
const store = mergeStore(
|
|
35
47
|
props.store,
|
|
36
|
-
omit(parentComposite,
|
|
37
|
-
|
|
38
|
-
"renderedItems",
|
|
39
|
-
"moves",
|
|
40
|
-
"orientation",
|
|
41
|
-
"baseElement",
|
|
42
|
-
"focusLoop",
|
|
43
|
-
"focusShift",
|
|
44
|
-
"focusWrap"
|
|
45
|
-
])
|
|
48
|
+
omit(parentComposite, independentKeys),
|
|
49
|
+
omit(combobox, independentKeys)
|
|
46
50
|
);
|
|
47
51
|
const syncState = store == null ? void 0 : store.getState();
|
|
48
52
|
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
package/esm/utils/misc.d.ts
CHANGED
|
@@ -121,8 +121,8 @@ export declare function removeUndefinedValues<T extends AnyObject>(obj: T): T;
|
|
|
121
121
|
* Returns the first value that is not `undefined`.
|
|
122
122
|
*/
|
|
123
123
|
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>;
|
|
124
|
-
type
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
type DefaultValue<T extends readonly any[], Other = never> = T extends [
|
|
125
|
+
infer Head,
|
|
126
|
+
...infer Rest
|
|
127
|
+
] ? Rest extends [] ? T[number] | Other : undefined extends Head ? DefaultValue<Rest, Exclude<Other | Head, undefined>> : Exclude<T[number], undefined> : never;
|
|
128
128
|
export {};
|