Skip to content

Commit 7590d67

Browse files
committed
fix: typecheck
1 parent 6276c8b commit 7590d67

File tree

5 files changed

+46
-5
lines changed

5 files changed

+46
-5
lines changed

packages/machines/collapsible/src/collapsible.types.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,30 @@ export type ElementIds = Partial<{
1515
trigger: string
1616
}>
1717

18+
/* -----------------------------------------------------------------------------
19+
* Machine context
20+
* -----------------------------------------------------------------------------*/
21+
1822
export interface CollapsibleProps extends CommonProperties, DirectionProperty {
23+
/**
24+
* The ids of the elements in the collapsible. Useful for composition.
25+
*/
1926
ids?: ElementIds
27+
/**
28+
* Whether the collapsible is open.
29+
*/
2030
open?: boolean
31+
/**
32+
* The default open state of the collapsible.
33+
*/
2134
defaultOpen?: boolean
35+
/**
36+
* The callback invoked when the open state changes.
37+
*/
2238
onOpenChange?: (details: OpenChangeDetails) => void
39+
/**
40+
* The callback invoked when the exit animation completes.
41+
*/
2342
onExitComplete?: () => void
2443
}
2544

@@ -61,11 +80,30 @@ export interface CollapsibleSchema {
6180

6281
export type CollapsibleService = Service<CollapsibleSchema>
6382

83+
/* -----------------------------------------------------------------------------
84+
* Component API
85+
* -----------------------------------------------------------------------------*/
86+
6487
export interface CollapsibleApi<T extends PropTypes = PropTypes> {
88+
/**
89+
* Whether the collapsible is open.
90+
*/
6591
open: boolean
92+
/**
93+
* Whether the collapsible is visible (open or closing)
94+
*/
6695
visible: boolean
96+
/**
97+
* Whether the collapsible is disabled
98+
*/
6799
disabled: boolean
100+
/**
101+
* Function to open or close the collapsible.
102+
*/
68103
setOpen(open: boolean): void
104+
/**
105+
* Function to measure the size of the content.
106+
*/
69107
measureSize(): void
70108

71109
getRootProps(): T["element"]

packages/machines/file-upload/src/file-upload.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export interface FileUploadProps extends LocaleProperties, CommonProperties {
135135
invalid?: boolean | undefined
136136
}
137137

138-
type PropWithDefault = "minFileSize" | "maxFileSize" | "maxFiles" | "preventDocumentDrop" | "allowDrop"
138+
type PropWithDefault = "minFileSize" | "maxFileSize" | "maxFiles" | "preventDocumentDrop" | "allowDrop" | "translations"
139139

140140
interface Context {
141141
/**

packages/machines/slider/src/slider.dom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export const getValueFromPoint = (params: Params<SliderSchema>, point: Point) =>
3838
}
3939

4040
export const dispatchChangeEvent = (params: Params<SliderSchema>) => {
41-
const { prop, scope } = params
42-
const valueArray = Array.from(prop("value"))
41+
const { context, scope } = params
42+
const valueArray = Array.from(context.get("value"))
4343
valueArray.forEach((value, index) => {
4444
const inputEl = getHiddenInputEl(scope, index)
4545
if (!inputEl) return

packages/machines/slider/src/slider.types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { EventObject, Service } from "@zag-js/core"
2-
import type { CommonProperties, DirectionProperty, PropTypes } from "@zag-js/types"
2+
import type { CommonProperties, DirectionProperty, PropTypes, RequiredBy } from "@zag-js/types"
33

44
/* -----------------------------------------------------------------------------
55
* Callback details
@@ -139,6 +139,8 @@ export interface SliderProps extends DirectionProperty, CommonProperties {
139139
thumbSize?: { width: number; height: number } | undefined
140140
}
141141

142+
type PropsWithDefault = "min" | "max" | "step" | "orientation" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs"
143+
142144
type Computed = Readonly<{
143145
/**
144146
* @computed
@@ -200,7 +202,7 @@ interface Context {
200202

201203
export interface SliderSchema {
202204
state: "idle" | "dragging" | "focus"
203-
props: SliderProps
205+
props: RequiredBy<SliderProps, PropsWithDefault>
204206
context: Context
205207
computed: Computed
206208
event: EventObject

packages/machines/tags-input/src/tags-input.props.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const props = createProps<TagsInputProps>()([
3333
"validate",
3434
"value",
3535
"defaultValue",
36+
"defaultInputValue",
3637
])
3738

3839
export const splitProps = createSplitProps<Partial<TagsInputProps>>(props)

0 commit comments

Comments
 (0)