@zag-js/collapsible
Advanced tools
Comparing version 0.0.0-dev-20240218121115 to 0.0.0-dev-20240218175520
import * as _zag_js_anatomy from '@zag-js/anatomy'; | ||
import { RequiredBy, PropTypes, DirectionProperty, CommonProperties, Context, NormalizeProps } from '@zag-js/types'; | ||
import { RequiredBy, PropTypes, DirectionProperty, CommonProperties, NormalizeProps } from '@zag-js/types'; | ||
import * as _zag_js_core from '@zag-js/core'; | ||
@@ -39,3 +39,4 @@ import { StateMachine } from '@zag-js/core'; | ||
type ComputedContext = Readonly<{}>; | ||
type PrivateContext = Context<{}>; | ||
interface PrivateContext { | ||
} | ||
type UserDefinedContext = RequiredBy<PublicContext, "id">; | ||
@@ -59,6 +60,2 @@ interface MachineContext extends PublicContext, PrivateContext, ComputedContext { | ||
/** | ||
* Whether the checkbox is focused | ||
*/ | ||
isFocused: boolean | undefined; | ||
/** | ||
* Function to open the collapsible. | ||
@@ -76,10 +73,3 @@ */ | ||
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): { | ||
isOpen: boolean; | ||
open(): void; | ||
close(): void; | ||
rootProps: T["element"]; | ||
contentProps: T["element"]; | ||
triggerProps: T["element"]; | ||
}; | ||
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T>; | ||
@@ -86,0 +76,0 @@ declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>; |
@@ -34,2 +34,5 @@ "use strict"; | ||
// src/collapsible.connect.ts | ||
var import_dom_query2 = require("@zag-js/dom-query"); | ||
// src/collapsible.dom.ts | ||
@@ -47,3 +50,2 @@ var import_dom_query = require("@zag-js/dom-query"); | ||
// src/collapsible.connect.ts | ||
var import_dom_query2 = require("@zag-js/dom-query"); | ||
function connect(state, send, normalize) { | ||
@@ -57,2 +59,3 @@ const isVisible = state.matches("open", "closing"); | ||
return { | ||
isDisabled: !!disabled, | ||
isOpen, | ||
@@ -59,0 +62,0 @@ open() { |
{ | ||
"name": "@zag-js/collapsible", | ||
"version": "0.0.0-dev-20240218121115", | ||
"version": "0.0.0-dev-20240218175520", | ||
"description": "Core logic for the collapsible widget implemented as a state machine", | ||
@@ -31,7 +31,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/anatomy": "0.0.0-dev-20240218121115", | ||
"@zag-js/core": "0.0.0-dev-20240218121115", | ||
"@zag-js/dom-query": "0.0.0-dev-20240218121115", | ||
"@zag-js/utils": "0.0.0-dev-20240218121115", | ||
"@zag-js/types": "0.0.0-dev-20240218121115" | ||
"@zag-js/anatomy": "0.0.0-dev-20240218175520", | ||
"@zag-js/core": "0.0.0-dev-20240218175520", | ||
"@zag-js/dom-query": "0.0.0-dev-20240218175520", | ||
"@zag-js/utils": "0.0.0-dev-20240218175520", | ||
"@zag-js/types": "0.0.0-dev-20240218175520" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
@@ -0,8 +1,8 @@ | ||
import { dataAttr } from "@zag-js/dom-query" | ||
import type { NormalizeProps, PropTypes } from "@zag-js/types" | ||
import { parts } from "./collapsible.anatomy" | ||
import { dom } from "./collapsible.dom" | ||
import type { Send, State } from "./collapsible.types" | ||
import { dataAttr } from "@zag-js/dom-query" | ||
import type { MachineApi, Send, State } from "./collapsible.types" | ||
export function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>) { | ||
export function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T> { | ||
const isVisible = state.matches("open", "closing") | ||
@@ -18,2 +18,3 @@ const isOpen = state.matches("open") | ||
return { | ||
isDisabled: !!disabled, | ||
isOpen, | ||
@@ -20,0 +21,0 @@ open() { |
import type { StateMachine as S } from "@zag-js/core" | ||
import type { CommonProperties, Context, DirectionProperty, PropTypes, RequiredBy } from "@zag-js/types" | ||
import type { CommonProperties, DirectionProperty, PropTypes, RequiredBy } from "@zag-js/types" | ||
@@ -47,3 +47,3 @@ /* ----------------------------------------------------------------------------- | ||
type PrivateContext = Context<{ | ||
interface PrivateContext { | ||
/** | ||
@@ -69,3 +69,3 @@ * @internal | ||
isMountAnimationPrevented: boolean | ||
}> | ||
} | ||
@@ -98,6 +98,2 @@ export type UserDefinedContext = RequiredBy<PublicContext, "id"> | ||
/** | ||
* Whether the checkbox is focused | ||
*/ | ||
isFocused: boolean | undefined | ||
/** | ||
* Function to open the collapsible. | ||
@@ -104,0 +100,0 @@ */ |
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
Sorry, the diff of this file is not supported yet
58751
823
+ Added@zag-js/anatomy@0.0.0-dev-20240218175520(transitive)
+ Added@zag-js/core@0.0.0-dev-20240218175520(transitive)
+ Added@zag-js/dom-query@0.0.0-dev-20240218175520(transitive)
+ Added@zag-js/store@0.0.0-dev-20240218175520(transitive)
+ Added@zag-js/types@0.0.0-dev-20240218175520(transitive)
+ Added@zag-js/utils@0.0.0-dev-20240218175520(transitive)
- Removed@zag-js/anatomy@0.0.0-dev-20240218121115(transitive)
- Removed@zag-js/core@0.0.0-dev-20240218121115(transitive)
- Removed@zag-js/dom-query@0.0.0-dev-20240218121115(transitive)
- Removed@zag-js/store@0.0.0-dev-20240218121115(transitive)
- Removed@zag-js/types@0.0.0-dev-20240218121115(transitive)
- Removed@zag-js/utils@0.0.0-dev-20240218121115(transitive)