@ariakit/core
Advanced tools
Comparing version 0.4.2 to 0.4.3
# @ariakit/core | ||
## 0.4.3 | ||
- Fixed regression in `v0.4.2` that caused nested tabs to stop working. | ||
- Added new [`combobox`](https://ariakit.org/reference/tab-provider#combobox) property to tab store. | ||
- Improved JSDocs. | ||
- Fixed TypeScript error on `defaultValue`. | ||
## 0.4.2 | ||
@@ -4,0 +11,0 @@ |
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js"; | ||
import type { ComboboxStore } from "../combobox/combobox-store.js"; | ||
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js"; | ||
import type { Store, StoreOptions, StoreProps } from "../utils/store.js"; | ||
import type { SetState } from "../utils/types.js"; | ||
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore; | ||
export declare function createTabStore({ composite: parentComposite, combobox, ...props }?: TabStoreProps): TabStore; | ||
export interface TabStoreItem extends CompositeStoreItem { | ||
@@ -81,3 +82,3 @@ dimmed?: boolean; | ||
* A reference to another [composite | ||
* store](https://ariakit.org/reference/composite-store). This is used when | ||
* store](https://ariakit.org/reference/use-composite-store). This is used when | ||
* rendering tabs as part of another composite widget such as | ||
@@ -90,2 +91,9 @@ * [Combobox](https://ariakit.org/components/combobox) or | ||
/** | ||
* A reference to a [combobox | ||
* store](https://ariakit.org/reference/use-combobox-store). This is used when | ||
* rendering tabs inside a | ||
* [Combobox](https://ariakit.org/components/combobox). | ||
*/ | ||
combobox?: ComboboxStore | null; | ||
/** | ||
* The id of the tab whose panel is currently visible. If it's `undefined`, it | ||
@@ -92,0 +100,0 @@ * will be automatically set to the first enabled tab. |
@@ -124,6 +124,6 @@ import type { AnyFunction, AnyObject, SetStateAction } from "./types.js"; | ||
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>; | ||
type DefinedArray<T extends readonly any[]> = { | ||
[K in keyof T as undefined extends T[K] ? never : K]: undefined extends T[K] ? [Exclude<T[K], undefined>, never] : [T[K]]; | ||
}; | ||
type DefaultValue<T extends readonly any[]> = DefinedArray<T>[keyof DefinedArray<T>] extends [any, never] ? T[number] : DefinedArray<T>[keyof DefinedArray<T>][0]; | ||
type DefaultValue<T extends readonly any[], Other = never> = T extends [ | ||
infer Head, | ||
...infer Rest | ||
] ? Rest extends [] ? T[number] | Other : undefined extends Head ? DefaultValue<Rest, Exclude<Other | Head, undefined>> : Exclude<T[number], undefined> : never; | ||
export {}; |
import type { CollectionStore, CollectionStoreItem } from "../collection/collection-store.js"; | ||
import type { ComboboxStore } from "../combobox/combobox-store.js"; | ||
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js"; | ||
import type { Store, StoreOptions, StoreProps } from "../utils/store.js"; | ||
import type { SetState } from "../utils/types.js"; | ||
export declare function createTabStore({ composite: parentComposite, ...props }?: TabStoreProps): TabStore; | ||
export declare function createTabStore({ composite: parentComposite, combobox, ...props }?: TabStoreProps): TabStore; | ||
export interface TabStoreItem extends CompositeStoreItem { | ||
@@ -81,3 +82,3 @@ dimmed?: boolean; | ||
* A reference to another [composite | ||
* store](https://ariakit.org/reference/composite-store). This is used when | ||
* store](https://ariakit.org/reference/use-composite-store). This is used when | ||
* rendering tabs as part of another composite widget such as | ||
@@ -90,2 +91,9 @@ * [Combobox](https://ariakit.org/components/combobox) or | ||
/** | ||
* A reference to a [combobox | ||
* store](https://ariakit.org/reference/use-combobox-store). This is used when | ||
* rendering tabs inside a | ||
* [Combobox](https://ariakit.org/components/combobox). | ||
*/ | ||
combobox?: ComboboxStore | null; | ||
/** | ||
* The id of the tab whose panel is currently visible. If it's `undefined`, it | ||
@@ -92,0 +100,0 @@ * will be automatically set to the first enabled tab. |
@@ -30,18 +30,22 @@ "use client"; | ||
var _b = _a, { | ||
composite: parentComposite | ||
composite: parentComposite, | ||
combobox | ||
} = _b, props = __objRest(_b, [ | ||
"composite" | ||
"composite", | ||
"combobox" | ||
]); | ||
const independentKeys = [ | ||
"items", | ||
"renderedItems", | ||
"moves", | ||
"orientation", | ||
"baseElement", | ||
"focusLoop", | ||
"focusShift", | ||
"focusWrap" | ||
]; | ||
const store = mergeStore( | ||
props.store, | ||
omit(parentComposite, [ | ||
"items", | ||
"renderedItems", | ||
"moves", | ||
"orientation", | ||
"baseElement", | ||
"focusLoop", | ||
"focusShift", | ||
"focusWrap" | ||
]) | ||
omit(parentComposite, independentKeys), | ||
omit(combobox, independentKeys) | ||
); | ||
@@ -48,0 +52,0 @@ const syncState = store == null ? void 0 : store.getState(); |
@@ -124,6 +124,6 @@ import type { AnyFunction, AnyObject, SetStateAction } from "./types.js"; | ||
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>; | ||
type DefinedArray<T extends readonly any[]> = { | ||
[K in keyof T as undefined extends T[K] ? never : K]: undefined extends T[K] ? [Exclude<T[K], undefined>, never] : [T[K]]; | ||
}; | ||
type DefaultValue<T extends readonly any[]> = DefinedArray<T>[keyof DefinedArray<T>] extends [any, never] ? T[number] : DefinedArray<T>[keyof DefinedArray<T>][0]; | ||
type DefaultValue<T extends readonly any[], Other = never> = T extends [ | ||
infer Head, | ||
...infer Rest | ||
] ? Rest extends [] ? T[number] | Other : undefined extends Head ? DefaultValue<Rest, Exclude<Other | Head, undefined>> : Exclude<T[number], undefined> : never; | ||
export {}; |
{ | ||
"name": "@ariakit/core", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Ariakit core", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
501433
10168