-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
types.ts
110 lines (100 loc) · 2.78 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import type { CreateSelectProps, SelectOptionProps } from "@melt-ui/svelte";
import type {
AsChild,
Expand,
HTMLDivAttributes,
OmitOpen,
OnChangeFn,
Transition,
TransitionProps
} from "$lib/internal/index.js";
import type {
EventHandler,
HTMLAttributes,
HTMLButtonAttributes,
HTMLInputAttributes
} from "svelte/elements";
import type { CustomEventHandler } from "$lib/index.js";
type Props = Expand<
OmitOpen<Omit<CreateSelectProps, "selected" | "defaultSelected" | "onSelectedChange">> & {
selected?: CreateSelectProps["defaultSelected"] & {};
onSelectedChange?: OnChangeFn<CreateSelectProps["defaultSelected"]>;
open?: boolean & {};
onOpenChange?: OnChangeFn<boolean>;
}
>;
type ContentProps<
T extends Transition = Transition,
In extends Transition = Transition,
Out extends Transition = Transition
> = Expand<TransitionProps<T, In, Out> & AsChild> & HTMLDivAttributes;
type GroupProps = AsChild & HTMLDivAttributes;
type InputProps = AsChild & HTMLInputAttributes;
type LabelProps = AsChild & HTMLDivAttributes;
type ItemProps = Expand<SelectOptionProps & AsChild> & HTMLDivAttributes;
type SeparatorProps = AsChild & HTMLDivAttributes;
type TriggerProps = AsChild & HTMLButtonAttributes;
type ValueProps = Expand<
{
placeholder?: string;
} & AsChild
> &
HTMLAttributes<HTMLSpanElement>;
type ArrowProps = Expand<
{
size?: number;
} & AsChild
> &
HTMLDivAttributes;
type ItemEvents<T extends Element = HTMLDivElement> = {
click: CustomEventHandler<MouseEvent, T>;
pointermove: CustomEventHandler<PointerEvent, T>;
focusin: EventHandler<FocusEvent, T>;
keydown: EventHandler<KeyboardEvent, T>;
focusout: EventHandler<FocusEvent, T>;
pointerleave: EventHandler<PointerEvent, T>;
};
type TriggerEvents<T extends Element = HTMLButtonElement> = {
click: CustomEventHandler<MouseEvent, T>;
keydown: CustomEventHandler<KeyboardEvent, T>;
};
type LabelEvents<T extends Element = HTMLSpanElement> = {
click: CustomEventHandler<MouseEvent, T>;
};
type ContentEvents<T extends Element = HTMLDivElement> = {
pointerleave: CustomEventHandler<PointerEvent, T>;
keydown: EventHandler<KeyboardEvent, T>;
};
export type {
Props,
ArrowProps,
ContentProps,
GroupProps,
InputProps,
LabelProps,
ItemProps,
SeparatorProps,
TriggerProps,
ValueProps,
//
Props as SelectProps,
ArrowProps as SelectArrowProps,
ContentProps as SelectContentProps,
GroupProps as SelectGroupProps,
InputProps as SelectInputProps,
LabelProps as SelectLabelProps,
ItemProps as SelectItemProps,
SeparatorProps as SelectSeparatorProps,
TriggerProps as SelectTriggerProps,
ValueProps as SelectValueProps,
//
ItemEvents,
ContentEvents,
TriggerEvents,
LabelEvents,
//
ItemEvents as SelectItemEvents,
ContentEvents as SelectContentEvents,
TriggerEvents as SelectTriggerEvents,
LabelEvents as SelectLabelEvents
};