@kingsy/headlessui-vue 1.7.23-alpha.0
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/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/components/combobox/combobox.d.ts +323 -0
- package/dist/components/combobox/combobox.js +1 -0
- package/dist/components/description/description.d.ts +32 -0
- package/dist/components/description/description.js +1 -0
- package/dist/components/dialog/dialog.d.ts +202 -0
- package/dist/components/dialog/dialog.js +1 -0
- package/dist/components/disclosure/disclosure.d.ts +105 -0
- package/dist/components/disclosure/disclosure.js +1 -0
- package/dist/components/focus-trap/focus-trap.d.ts +151 -0
- package/dist/components/focus-trap/focus-trap.js +1 -0
- package/dist/components/label/label.d.ts +41 -0
- package/dist/components/label/label.js +1 -0
- package/dist/components/listbox/listbox.d.ts +229 -0
- package/dist/components/listbox/listbox.js +1 -0
- package/dist/components/menu/menu.d.ts +131 -0
- package/dist/components/menu/menu.js +1 -0
- package/dist/components/popover/popover.d.ts +151 -0
- package/dist/components/popover/popover.js +1 -0
- package/dist/components/portal/portal.d.ts +45 -0
- package/dist/components/portal/portal.js +1 -0
- package/dist/components/radio-group/radio-group.d.ts +184 -0
- package/dist/components/radio-group/radio-group.js +1 -0
- package/dist/components/switch/switch.d.ts +166 -0
- package/dist/components/switch/switch.js +1 -0
- package/dist/components/tabs/tabs.d.ts +177 -0
- package/dist/components/tabs/tabs.js +1 -0
- package/dist/components/transitions/transition.d.ts +234 -0
- package/dist/components/transitions/transition.js +1 -0
- package/dist/components/transitions/utils/transition.d.ts +5 -0
- package/dist/components/transitions/utils/transition.js +1 -0
- package/dist/headlessui.dev.cjs +8042 -0
- package/dist/headlessui.esm.js +1 -0
- package/dist/headlessui.esm.js.map +7 -0
- package/dist/headlessui.prod.cjs +7 -0
- package/dist/hooks/__mocks__/use-id.d.ts +1 -0
- package/dist/hooks/document-overflow/adjust-scrollbar-padding.d.ts +2 -0
- package/dist/hooks/document-overflow/adjust-scrollbar-padding.js +1 -0
- package/dist/hooks/document-overflow/handle-ios-locking.d.ts +6 -0
- package/dist/hooks/document-overflow/handle-ios-locking.js +1 -0
- package/dist/hooks/document-overflow/overflow-store.d.ts +19 -0
- package/dist/hooks/document-overflow/overflow-store.js +1 -0
- package/dist/hooks/document-overflow/prevent-scroll.d.ts +2 -0
- package/dist/hooks/document-overflow/prevent-scroll.js +1 -0
- package/dist/hooks/document-overflow/use-document-overflow.d.ts +3 -0
- package/dist/hooks/document-overflow/use-document-overflow.js +1 -0
- package/dist/hooks/use-controllable.d.ts +2 -0
- package/dist/hooks/use-controllable.js +1 -0
- package/dist/hooks/use-disposables.d.ts +25 -0
- package/dist/hooks/use-disposables.js +1 -0
- package/dist/hooks/use-document-event.d.ts +2 -0
- package/dist/hooks/use-document-event.js +1 -0
- package/dist/hooks/use-event-listener.d.ts +1 -0
- package/dist/hooks/use-event-listener.js +1 -0
- package/dist/hooks/use-frame-debounce.d.ts +8 -0
- package/dist/hooks/use-frame-debounce.js +1 -0
- package/dist/hooks/use-id.d.ts +1 -0
- package/dist/hooks/use-id.js +1 -0
- package/dist/hooks/use-inert.d.ts +2 -0
- package/dist/hooks/use-inert.js +1 -0
- package/dist/hooks/use-outside-click.d.ts +6 -0
- package/dist/hooks/use-outside-click.js +1 -0
- package/dist/hooks/use-resolve-button-type.d.ts +5 -0
- package/dist/hooks/use-resolve-button-type.js +1 -0
- package/dist/hooks/use-root-containers.d.ts +19 -0
- package/dist/hooks/use-root-containers.js +1 -0
- package/dist/hooks/use-store.d.ts +2 -0
- package/dist/hooks/use-store.js +1 -0
- package/dist/hooks/use-tab-direction.d.ts +5 -0
- package/dist/hooks/use-tab-direction.js +1 -0
- package/dist/hooks/use-text-value.d.ts +2 -0
- package/dist/hooks/use-text-value.js +1 -0
- package/dist/hooks/use-tracked-pointer.d.ts +4 -0
- package/dist/hooks/use-tracked-pointer.js +1 -0
- package/dist/hooks/use-tree-walker.d.ts +9 -0
- package/dist/hooks/use-tree-walker.js +1 -0
- package/dist/hooks/use-window-event.d.ts +2 -0
- package/dist/hooks/use-window-event.js +1 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -0
- package/dist/internal/dom-containers.d.ts +1 -0
- package/dist/internal/dom-containers.js +1 -0
- package/dist/internal/focus-sentinel.d.ts +13 -0
- package/dist/internal/focus-sentinel.js +1 -0
- package/dist/internal/hidden.d.ts +32 -0
- package/dist/internal/hidden.js +1 -0
- package/dist/internal/open-closed.d.ts +10 -0
- package/dist/internal/open-closed.js +1 -0
- package/dist/internal/portal-force-root.d.ts +27 -0
- package/dist/internal/portal-force-root.js +1 -0
- package/dist/internal/stack-context.d.ts +14 -0
- package/dist/internal/stack-context.js +1 -0
- package/dist/keyboard.d.ts +16 -0
- package/dist/keyboard.js +1 -0
- package/dist/mouse.d.ts +4 -0
- package/dist/mouse.js +1 -0
- package/dist/utils/active-element-history.d.ts +1 -0
- package/dist/utils/active-element-history.js +1 -0
- package/dist/utils/calculate-active-index.d.ts +25 -0
- package/dist/utils/calculate-active-index.js +1 -0
- package/dist/utils/disposables.d.ts +12 -0
- package/dist/utils/disposables.js +1 -0
- package/dist/utils/document-ready.d.ts +1 -0
- package/dist/utils/document-ready.js +1 -0
- package/dist/utils/dom.d.ts +4 -0
- package/dist/utils/dom.js +1 -0
- package/dist/utils/env.d.ts +13 -0
- package/dist/utils/env.js +1 -0
- package/dist/utils/focus-management.d.ts +38 -0
- package/dist/utils/focus-management.js +1 -0
- package/dist/utils/form.d.ts +4 -0
- package/dist/utils/form.js +1 -0
- package/dist/utils/get-text-value.d.ts +1 -0
- package/dist/utils/get-text-value.js +1 -0
- package/dist/utils/match.d.ts +1 -0
- package/dist/utils/match.js +1 -0
- package/dist/utils/micro-task.d.ts +1 -0
- package/dist/utils/micro-task.js +1 -0
- package/dist/utils/once.d.ts +1 -0
- package/dist/utils/once.js +1 -0
- package/dist/utils/owner.d.ts +2 -0
- package/dist/utils/owner.js +1 -0
- package/dist/utils/pipeline.d.ts +4 -0
- package/dist/utils/pipeline.js +1 -0
- package/dist/utils/platform.d.ts +3 -0
- package/dist/utils/platform.js +1 -0
- package/dist/utils/render.d.ts +39 -0
- package/dist/utils/render.js +4 -0
- package/dist/utils/resolve-prop-value.d.ts +1 -0
- package/dist/utils/resolve-prop-value.js +1 -0
- package/dist/utils/store.d.ts +11 -0
- package/dist/utils/store.js +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Tailwind Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<h3 align="center">
|
|
2
|
+
@headlessui/vue
|
|
3
|
+
</h3>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
A set of completely unstyled, fully accessible UI components for Vue 3, designed to integrate
|
|
7
|
+
beautifully with Tailwind CSS.
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://www.npmjs.com/package/@headlessui/vue"><img src="https://img.shields.io/npm/dt/@headlessui/vue.svg" alt="Total Downloads"></a>
|
|
12
|
+
<a href="https://github.com/tailwindlabs/headlessui/releases"><img src="https://img.shields.io/npm/v/@headlessui/vue.svg" alt="Latest Release"></a>
|
|
13
|
+
<a href="https://github.com/tailwindlabs/headlessui/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@headlessui/vue.svg" alt="License"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Please note that **this library only supports Vue 3**.
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install @headlessui/vue
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
For full documentation, visit [headlessui.com](https://headlessui.com/v1/vue).
|
|
27
|
+
|
|
28
|
+
## Community
|
|
29
|
+
|
|
30
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
|
31
|
+
|
|
32
|
+
[Discuss Headless UI on GitHub](https://github.com/tailwindlabs/headlessui/discussions)
|
|
33
|
+
|
|
34
|
+
For casual chit-chat with others using the library:
|
|
35
|
+
|
|
36
|
+
[Join the Tailwind CSS Discord Server](https://discord.gg/7NF8GNe)
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
export declare let Combobox: import("vue").DefineComponent<{
|
|
3
|
+
as: {
|
|
4
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
disabled: {
|
|
8
|
+
type: BooleanConstructor[];
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
by: {
|
|
12
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
13
|
+
nullable: boolean;
|
|
14
|
+
default: null;
|
|
15
|
+
};
|
|
16
|
+
modelValue: {
|
|
17
|
+
type: PropType<string | number | boolean | object | null>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
defaultValue: {
|
|
21
|
+
type: PropType<string | number | boolean | object | null>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
form: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
optional: boolean;
|
|
27
|
+
};
|
|
28
|
+
name: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
optional: boolean;
|
|
31
|
+
};
|
|
32
|
+
nullable: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
multiple: {
|
|
37
|
+
type: BooleanConstructor[];
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
immediate: {
|
|
41
|
+
type: BooleanConstructor[];
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
virtual: {
|
|
45
|
+
type: PropType<{
|
|
46
|
+
options: unknown[];
|
|
47
|
+
disabled?: ((value: unknown) => boolean) | undefined;
|
|
48
|
+
} | null>;
|
|
49
|
+
default: null;
|
|
50
|
+
};
|
|
51
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
54
|
+
'update:modelValue': (_value: any) => true;
|
|
55
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
|
+
as: {
|
|
57
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
disabled: {
|
|
61
|
+
type: BooleanConstructor[];
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
by: {
|
|
65
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
66
|
+
nullable: boolean;
|
|
67
|
+
default: null;
|
|
68
|
+
};
|
|
69
|
+
modelValue: {
|
|
70
|
+
type: PropType<string | number | boolean | object | null>;
|
|
71
|
+
default: undefined;
|
|
72
|
+
};
|
|
73
|
+
defaultValue: {
|
|
74
|
+
type: PropType<string | number | boolean | object | null>;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
form: {
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
optional: boolean;
|
|
80
|
+
};
|
|
81
|
+
name: {
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
optional: boolean;
|
|
84
|
+
};
|
|
85
|
+
nullable: {
|
|
86
|
+
type: BooleanConstructor;
|
|
87
|
+
default: boolean;
|
|
88
|
+
};
|
|
89
|
+
multiple: {
|
|
90
|
+
type: BooleanConstructor[];
|
|
91
|
+
default: boolean;
|
|
92
|
+
};
|
|
93
|
+
immediate: {
|
|
94
|
+
type: BooleanConstructor[];
|
|
95
|
+
default: boolean;
|
|
96
|
+
};
|
|
97
|
+
virtual: {
|
|
98
|
+
type: PropType<{
|
|
99
|
+
options: unknown[];
|
|
100
|
+
disabled?: ((value: unknown) => boolean) | undefined;
|
|
101
|
+
} | null>;
|
|
102
|
+
default: null;
|
|
103
|
+
};
|
|
104
|
+
}>> & {
|
|
105
|
+
"onUpdate:modelValue"?: ((_value: any) => any) | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
as: string | Record<string, any>;
|
|
108
|
+
disabled: boolean;
|
|
109
|
+
by: string | Function;
|
|
110
|
+
modelValue: string | number | boolean | object | null;
|
|
111
|
+
defaultValue: string | number | boolean | object | null;
|
|
112
|
+
nullable: boolean;
|
|
113
|
+
multiple: boolean;
|
|
114
|
+
immediate: boolean;
|
|
115
|
+
virtual: {
|
|
116
|
+
options: unknown[];
|
|
117
|
+
disabled?: ((value: unknown) => boolean) | undefined;
|
|
118
|
+
} | null;
|
|
119
|
+
}>;
|
|
120
|
+
export declare let ComboboxLabel: import("vue").DefineComponent<{
|
|
121
|
+
as: {
|
|
122
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
123
|
+
default: string;
|
|
124
|
+
};
|
|
125
|
+
id: {
|
|
126
|
+
type: StringConstructor;
|
|
127
|
+
default: () => string;
|
|
128
|
+
};
|
|
129
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
130
|
+
[key: string]: any;
|
|
131
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
132
|
+
[key: string]: any;
|
|
133
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
134
|
+
as: {
|
|
135
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
136
|
+
default: string;
|
|
137
|
+
};
|
|
138
|
+
id: {
|
|
139
|
+
type: StringConstructor;
|
|
140
|
+
default: () => string;
|
|
141
|
+
};
|
|
142
|
+
}>>, {
|
|
143
|
+
id: string;
|
|
144
|
+
as: string | Record<string, any>;
|
|
145
|
+
}>;
|
|
146
|
+
export declare let ComboboxButton: import("vue").DefineComponent<{
|
|
147
|
+
as: {
|
|
148
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
149
|
+
default: string;
|
|
150
|
+
};
|
|
151
|
+
id: {
|
|
152
|
+
type: StringConstructor;
|
|
153
|
+
default: () => string;
|
|
154
|
+
};
|
|
155
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
156
|
+
[key: string]: any;
|
|
157
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
158
|
+
[key: string]: any;
|
|
159
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
160
|
+
as: {
|
|
161
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
162
|
+
default: string;
|
|
163
|
+
};
|
|
164
|
+
id: {
|
|
165
|
+
type: StringConstructor;
|
|
166
|
+
default: () => string;
|
|
167
|
+
};
|
|
168
|
+
}>>, {
|
|
169
|
+
id: string;
|
|
170
|
+
as: string | Record<string, any>;
|
|
171
|
+
}>;
|
|
172
|
+
export declare let ComboboxInput: import("vue").DefineComponent<{
|
|
173
|
+
as: {
|
|
174
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
175
|
+
default: string;
|
|
176
|
+
};
|
|
177
|
+
static: {
|
|
178
|
+
type: BooleanConstructor;
|
|
179
|
+
default: boolean;
|
|
180
|
+
};
|
|
181
|
+
unmount: {
|
|
182
|
+
type: BooleanConstructor;
|
|
183
|
+
default: boolean;
|
|
184
|
+
};
|
|
185
|
+
displayValue: {
|
|
186
|
+
type: PropType<(item: unknown) => string>;
|
|
187
|
+
};
|
|
188
|
+
defaultValue: {
|
|
189
|
+
type: StringConstructor;
|
|
190
|
+
default: undefined;
|
|
191
|
+
};
|
|
192
|
+
id: {
|
|
193
|
+
type: StringConstructor;
|
|
194
|
+
default: () => string;
|
|
195
|
+
};
|
|
196
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
197
|
+
[key: string]: any;
|
|
198
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
199
|
+
[key: string]: any;
|
|
200
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
201
|
+
change: (_value: Event & {
|
|
202
|
+
target: HTMLInputElement;
|
|
203
|
+
}) => true;
|
|
204
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
205
|
+
as: {
|
|
206
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
207
|
+
default: string;
|
|
208
|
+
};
|
|
209
|
+
static: {
|
|
210
|
+
type: BooleanConstructor;
|
|
211
|
+
default: boolean;
|
|
212
|
+
};
|
|
213
|
+
unmount: {
|
|
214
|
+
type: BooleanConstructor;
|
|
215
|
+
default: boolean;
|
|
216
|
+
};
|
|
217
|
+
displayValue: {
|
|
218
|
+
type: PropType<(item: unknown) => string>;
|
|
219
|
+
};
|
|
220
|
+
defaultValue: {
|
|
221
|
+
type: StringConstructor;
|
|
222
|
+
default: undefined;
|
|
223
|
+
};
|
|
224
|
+
id: {
|
|
225
|
+
type: StringConstructor;
|
|
226
|
+
default: () => string;
|
|
227
|
+
};
|
|
228
|
+
}>> & {
|
|
229
|
+
onChange?: ((_value: Event & {
|
|
230
|
+
target: HTMLInputElement;
|
|
231
|
+
}) => any) | undefined;
|
|
232
|
+
}, {
|
|
233
|
+
id: string;
|
|
234
|
+
as: string | Record<string, any>;
|
|
235
|
+
unmount: boolean;
|
|
236
|
+
static: boolean;
|
|
237
|
+
defaultValue: string;
|
|
238
|
+
}>;
|
|
239
|
+
export declare let ComboboxOptions: import("vue").DefineComponent<{
|
|
240
|
+
as: {
|
|
241
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
242
|
+
default: string;
|
|
243
|
+
};
|
|
244
|
+
static: {
|
|
245
|
+
type: BooleanConstructor;
|
|
246
|
+
default: boolean;
|
|
247
|
+
};
|
|
248
|
+
unmount: {
|
|
249
|
+
type: BooleanConstructor;
|
|
250
|
+
default: boolean;
|
|
251
|
+
};
|
|
252
|
+
hold: {
|
|
253
|
+
type: BooleanConstructor[];
|
|
254
|
+
default: boolean;
|
|
255
|
+
};
|
|
256
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
257
|
+
[key: string]: any;
|
|
258
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
259
|
+
[key: string]: any;
|
|
260
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
261
|
+
as: {
|
|
262
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
263
|
+
default: string;
|
|
264
|
+
};
|
|
265
|
+
static: {
|
|
266
|
+
type: BooleanConstructor;
|
|
267
|
+
default: boolean;
|
|
268
|
+
};
|
|
269
|
+
unmount: {
|
|
270
|
+
type: BooleanConstructor;
|
|
271
|
+
default: boolean;
|
|
272
|
+
};
|
|
273
|
+
hold: {
|
|
274
|
+
type: BooleanConstructor[];
|
|
275
|
+
default: boolean;
|
|
276
|
+
};
|
|
277
|
+
}>>, {
|
|
278
|
+
as: string | Record<string, any>;
|
|
279
|
+
unmount: boolean;
|
|
280
|
+
static: boolean;
|
|
281
|
+
hold: boolean;
|
|
282
|
+
}>;
|
|
283
|
+
export declare let ComboboxOption: import("vue").DefineComponent<{
|
|
284
|
+
as: {
|
|
285
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
286
|
+
default: string;
|
|
287
|
+
};
|
|
288
|
+
value: {
|
|
289
|
+
type: PropType<string | number | boolean | object | null>;
|
|
290
|
+
};
|
|
291
|
+
disabled: {
|
|
292
|
+
type: BooleanConstructor;
|
|
293
|
+
default: boolean;
|
|
294
|
+
};
|
|
295
|
+
order: {
|
|
296
|
+
type: NumberConstructor[];
|
|
297
|
+
default: null;
|
|
298
|
+
};
|
|
299
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
300
|
+
[key: string]: any;
|
|
301
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
302
|
+
[key: string]: any;
|
|
303
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
304
|
+
as: {
|
|
305
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
306
|
+
default: string;
|
|
307
|
+
};
|
|
308
|
+
value: {
|
|
309
|
+
type: PropType<string | number | boolean | object | null>;
|
|
310
|
+
};
|
|
311
|
+
disabled: {
|
|
312
|
+
type: BooleanConstructor;
|
|
313
|
+
default: boolean;
|
|
314
|
+
};
|
|
315
|
+
order: {
|
|
316
|
+
type: NumberConstructor[];
|
|
317
|
+
default: null;
|
|
318
|
+
};
|
|
319
|
+
}>>, {
|
|
320
|
+
as: string | Record<string, any>;
|
|
321
|
+
disabled: boolean;
|
|
322
|
+
order: number;
|
|
323
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useVirtualizer as re}from"@tanstack/vue-virtual";import{Fragment as de,cloneVNode as se,computed as b,defineComponent as j,h as W,inject as ee,nextTick as H,onMounted as X,onUnmounted as ve,provide as te,reactive as fe,ref as A,toRaw as L,watch as q,watchEffect as Y}from"vue";import{useControllable as pe}from'../../hooks/use-controllable.js';import{useFrameDebounce as be}from'../../hooks/use-frame-debounce.js';import{useId as z}from'../../hooks/use-id.js';import{useOutsideClick as ce}from'../../hooks/use-outside-click.js';import{useResolveButtonType as me}from'../../hooks/use-resolve-button-type.js';import{useTrackedPointer as xe}from'../../hooks/use-tracked-pointer.js';import{useTreeWalker as ge}from'../../hooks/use-tree-walker.js';import{Hidden as Se,Features as Oe}from'../../internal/hidden.js';import{State as G,useOpenClosed as Ce,useOpenClosedProvider as Re}from'../../internal/open-closed.js';import{Keys as k}from'../../keyboard.js';import{MouseButton as ye}from'../../mouse.js';import{history as oe}from'../../utils/active-element-history.js';import{Focus as w,calculateActiveIndex as le}from'../../utils/calculate-active-index.js';import{disposables as ae}from'../../utils/disposables.js';import{dom as x}from'../../utils/dom.js';import{sortByDomNode as Te}from'../../utils/focus-management.js';import{objectToFormEntries as Ie}from'../../utils/form.js';import{match as $}from'../../utils/match.js';import{getOwnerDocument as he}from'../../utils/owner.js';import{isMobile as Pe}from'../../utils/platform.js';import{Features as Q,compact as we,omit as Z,render as U}from'../../utils/render.js';function De(a,I){return a===I}var Ve=(u=>(u[u.Open=0]="Open",u[u.Closed=1]="Closed",u))(Ve||{}),Ee=(u=>(u[u.Single=0]="Single",u[u.Multi=1]="Multi",u))(Ee||{}),Ae=(O=>(O[O.Pointer=0]="Pointer",O[O.Focus=1]="Focus",O[O.Other=2]="Other",O))(Ae||{});let ne=Symbol("ComboboxContext");function N(a){let I=ee(ne,null);if(I===null){let u=new Error(`<${a} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(u,N),u}return I}let ie=Symbol("VirtualContext"),Fe=j({name:"VirtualProvider",setup(a,{slots:I}){let u=N("VirtualProvider"),O=b(()=>{let r=x(u.optionsRef);if(!r)return{start:0,end:0};let v=window.getComputedStyle(r);return{start:parseFloat(v.paddingBlockStart||v.paddingTop),end:parseFloat(v.paddingBlockEnd||v.paddingBottom)}}),t=re(b(()=>({scrollPaddingStart:O.value.start,scrollPaddingEnd:O.value.end,count:u.virtual.value.options.length,estimateSize(){return 40},getScrollElement(){return x(u.optionsRef)},overscan:12}))),e=b(()=>{var r;return(r=u.virtual.value)==null?void 0:r.options}),C=A(0);return q([e],()=>{C.value+=1}),te(ie,u.virtual.value?t:null),()=>[W("div",{style:{position:"relative",width:"100%",height:`${t.value.getTotalSize()}px`},ref:r=>{r&&u.activationTrigger.value!==0&&u.activeOptionIndex.value!==null&&u.virtual.value.options.length>u.activeOptionIndex.value&&t.value.scrollToIndex(u.activeOptionIndex.value)}},t.value.getVirtualItems().map(r=>se(I.default({option:u.virtual.value.options[r.index],open:u.comboboxState.value===0})[0],{key:`${C.value}-${r.index}`,"data-index":r.index,"aria-setsize":u.virtual.value.options.length,"aria-posinset":r.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${r.start}px)`,overflowAnchor:"none"}})))]}}),lt=j({name:"Combobox",emits:{"update:modelValue":a=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],nullable:!0,default:null},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},form:{type:String,optional:!0},name:{type:String,optional:!0},nullable:{type:Boolean,default:!1},multiple:{type:[Boolean],default:!1},immediate:{type:[Boolean],default:!1},virtual:{type:Object,default:null}},inheritAttrs:!1,setup(a,{slots:I,attrs:u,emit:O}){let t=A(1),e=A(null),C=A(null),r=A(null),v=A(null),p=A({static:!1,hold:!1}),c=A([]),g=A(null),P=A(2),D=A(!1);function E(l=i=>i){let i=g.value!==null?c.value[g.value]:null,s=l(c.value.slice()),f=s.length>0&&s[0].dataRef.order.value!==null?s.sort((y,F)=>y.dataRef.order.value-F.dataRef.order.value):Te(s,y=>x(y.dataRef.domRef)),R=i?f.indexOf(i):null;return R===-1&&(R=null),{options:f,activeOptionIndex:R}}let M=b(()=>a.multiple?1:0),K=b(()=>a.nullable),[B,d]=pe(b(()=>a.modelValue),l=>O("update:modelValue",l),b(()=>a.defaultValue)),o=b(()=>B.value===void 0?$(M.value,{[1]:[],[0]:void 0}):B.value),m=null,S=null;function h(l){return $(M.value,{[0](){return d==null?void 0:d(l)},[1]:()=>{let i=L(n.value.value).slice(),s=L(l),f=i.findIndex(R=>n.compare(s,L(R)));return f===-1?i.push(s):i.splice(f,1),d==null?void 0:d(i)}})}let T=b(()=>{var l;return(l=a.virtual)==null?void 0:l.options});q([T],([l],[i])=>{if(n.virtual.value&&l&&i&&g.value!==null){let s=l.indexOf(i[g.value]);s!==-1?g.value=s:g.value=null}});let n={comboboxState:t,value:o,mode:M,compare(l,i){if(typeof a.by=="string"){let s=a.by;return(l==null?void 0:l[s])===(i==null?void 0:i[s])}return a.by===null?De(l,i):a.by(l,i)},calculateIndex(l){return n.virtual.value?a.by===null?n.virtual.value.options.indexOf(l):n.virtual.value.options.findIndex(i=>n.compare(i,l)):c.value.findIndex(i=>n.compare(i.dataRef.value,l))},defaultValue:b(()=>a.defaultValue),nullable:K,immediate:b(()=>a.immediate),virtual:b(()=>{var l;return a.virtual?{options:a.virtual.options,disabled:(l=a.virtual.disabled)!=null?l:()=>!1}:null}),inputRef:C,labelRef:e,buttonRef:r,optionsRef:v,disabled:b(()=>a.disabled),options:c,change(l){d(l)},activeOptionIndex:b(()=>{if(D.value&&g.value===null&&(n.virtual.value?n.virtual.value.options.length>0:c.value.length>0)){if(n.virtual.value){let i=n.virtual.value.options.findIndex(s=>{var f;return!((f=n.virtual.value)!=null&&f.disabled(s))});if(i!==-1)return i}let l=c.value.findIndex(i=>!i.dataRef.disabled);if(l!==-1)return l}return g.value}),activationTrigger:P,optionsPropsRef:p,closeCombobox(){D.value=!1,!a.disabled&&t.value!==1&&(t.value=1,g.value=null)},openCombobox(){if(D.value=!0,!a.disabled&&t.value!==0){if(n.value.value){let l=n.calculateIndex(n.value.value);l!==-1&&(g.value=l)}t.value=0}},setActivationTrigger(l){P.value=l},goToOption(l,i,s){D.value=!1,m!==null&&cancelAnimationFrame(m),m=requestAnimationFrame(()=>{if(a.disabled||v.value&&!p.value.static&&t.value===1)return;if(n.virtual.value){g.value=l===w.Specific?i:le({focus:l},{resolveItems:()=>n.virtual.value.options,resolveActiveIndex:()=>{var y,F;return(F=(y=n.activeOptionIndex.value)!=null?y:n.virtual.value.options.findIndex(J=>{var _;return!((_=n.virtual.value)!=null&&_.disabled(J))}))!=null?F:null},resolveDisabled:y=>n.virtual.value.disabled(y),resolveId(){throw new Error("Function not implemented.")}}),P.value=s!=null?s:2;return}let f=E();if(f.activeOptionIndex===null){let y=f.options.findIndex(F=>!F.dataRef.disabled);y!==-1&&(f.activeOptionIndex=y)}let R=l===w.Specific?i:le({focus:l},{resolveItems:()=>f.options,resolveActiveIndex:()=>f.activeOptionIndex,resolveId:y=>y.id,resolveDisabled:y=>y.dataRef.disabled});g.value=R,P.value=s!=null?s:2,c.value=f.options})},selectOption(l){let i=c.value.find(f=>f.id===l);if(!i)return;let{dataRef:s}=i;h(s.value)},selectActiveOption(){if(n.activeOptionIndex.value!==null){if(n.virtual.value)h(n.virtual.value.options[n.activeOptionIndex.value]);else{let{dataRef:l}=c.value[n.activeOptionIndex.value];h(l.value)}n.goToOption(w.Specific,n.activeOptionIndex.value)}},registerOption(l,i){let s=fe({id:l,dataRef:i});if(n.virtual.value){c.value.push(s);return}S&&cancelAnimationFrame(S);let f=E(R=>(R.push(s),R));g.value===null&&n.isSelected(i.value.value)&&(f.activeOptionIndex=f.options.indexOf(s)),c.value=f.options,g.value=f.activeOptionIndex,P.value=2,f.options.some(R=>!x(R.dataRef.domRef))&&(S=requestAnimationFrame(()=>{let R=E();c.value=R.options,g.value=R.activeOptionIndex}))},unregisterOption(l,i){if(m!==null&&cancelAnimationFrame(m),i&&(D.value=!0),n.virtual.value){c.value=c.value.filter(f=>f.id!==l);return}let s=E(f=>{let R=f.findIndex(y=>y.id===l);return R!==-1&&f.splice(R,1),f});c.value=s.options,g.value=s.activeOptionIndex,P.value=2},isSelected(l){return $(M.value,{[0]:()=>n.compare(L(n.value.value),L(l)),[1]:()=>L(n.value.value).some(i=>n.compare(L(i),L(l)))})},isActive(l){return g.value===n.calculateIndex(l)}};ce([C,r,v],()=>n.closeCombobox(),b(()=>t.value===0)),te(ne,n),Re(b(()=>$(t.value,{[0]:G.Open,[1]:G.Closed})));let V=b(()=>{var l;return(l=x(C))==null?void 0:l.closest("form")});return X(()=>{q([V],()=>{if(!V.value||a.defaultValue===void 0)return;function l(){n.change(a.defaultValue)}return V.value.addEventListener("reset",l),()=>{var i;(i=V.value)==null||i.removeEventListener("reset",l)}},{immediate:!0})}),()=>{var y,F,J;let{name:l,disabled:i,form:s,...f}=a,R={open:t.value===0,disabled:i,activeIndex:n.activeOptionIndex.value,activeOption:n.activeOptionIndex.value===null?null:n.virtual.value?n.virtual.value.options[(y=n.activeOptionIndex.value)!=null?y:0]:(J=(F=n.options.value[n.activeOptionIndex.value])==null?void 0:F.dataRef.value)!=null?J:null,value:o.value};return W(de,[...l!=null&&o.value!=null?Ie({[l]:o.value}).map(([_,ue])=>W(Se,we({features:Oe.Hidden,key:_,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:i,name:_,value:ue}))):[],U({theirProps:{...u,...Z(f,["by","defaultValue","immediate","modelValue","multiple","nullable","onUpdate:modelValue","virtual"])},ourProps:{},slot:R,slots:I,attrs:u,name:"Combobox"})])}}}),at=j({name:"ComboboxLabel",props:{as:{type:[Object,String],default:"label"},id:{type:String,default:()=>`headlessui-combobox-label-${z()}`}},setup(a,{attrs:I,slots:u}){let O=N("ComboboxLabel");function t(){var e;(e=x(O.inputRef))==null||e.focus({preventScroll:!0})}return()=>{let e={open:O.comboboxState.value===0,disabled:O.disabled.value},{id:C,...r}=a,v={id:C,ref:O.labelRef,onClick:t};return U({ourProps:v,theirProps:r,slot:e,attrs:I,slots:u,name:"ComboboxLabel"})}}}),nt=j({name:"ComboboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:()=>`headlessui-combobox-button-${z()}`}},setup(a,{attrs:I,slots:u,expose:O}){let t=N("ComboboxButton");O({el:t.buttonRef,$el:t.buttonRef});function e(v){t.disabled.value||(t.comboboxState.value===0?t.closeCombobox():(v.preventDefault(),t.openCombobox()),H(()=>{var p;return(p=x(t.inputRef))==null?void 0:p.focus({preventScroll:!0})}))}function C(v){switch(v.key){case k.ArrowDown:v.preventDefault(),v.stopPropagation(),t.comboboxState.value===1&&t.openCombobox(),H(()=>{var p;return(p=t.inputRef.value)==null?void 0:p.focus({preventScroll:!0})});return;case k.ArrowUp:v.preventDefault(),v.stopPropagation(),t.comboboxState.value===1&&(t.openCombobox(),H(()=>{t.value.value||t.goToOption(w.Last)})),H(()=>{var p;return(p=t.inputRef.value)==null?void 0:p.focus({preventScroll:!0})});return;case k.Escape:if(t.comboboxState.value!==0)return;v.preventDefault(),t.optionsRef.value&&!t.optionsPropsRef.value.static&&v.stopPropagation(),t.closeCombobox(),H(()=>{var p;return(p=t.inputRef.value)==null?void 0:p.focus({preventScroll:!0})});return}}let r=me(b(()=>({as:a.as,type:I.type})),t.buttonRef);return()=>{var P,D;let v={open:t.comboboxState.value===0,disabled:t.disabled.value,value:t.value.value},{id:p,...c}=a,g={ref:t.buttonRef,id:p,type:r.value,tabindex:"-1","aria-haspopup":"listbox","aria-controls":(P=x(t.optionsRef))==null?void 0:P.id,"aria-expanded":t.comboboxState.value===0,"aria-labelledby":t.labelRef.value?[(D=x(t.labelRef))==null?void 0:D.id,p].join(" "):void 0,disabled:t.disabled.value===!0?!0:void 0,onKeydown:C,onClick:e};return U({ourProps:g,theirProps:c,slot:v,attrs:I,slots:u,name:"ComboboxButton"})}}}),it=j({name:"ComboboxInput",props:{as:{type:[Object,String],default:"input"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},displayValue:{type:Function},defaultValue:{type:String,default:void 0},id:{type:String,default:()=>`headlessui-combobox-input-${z()}`}},emits:{change:a=>!0},setup(a,{emit:I,attrs:u,slots:O,expose:t}){let e=N("ComboboxInput"),C=b(()=>he(x(e.inputRef))),r={value:!1};t({el:e.inputRef,$el:e.inputRef});function v(){e.change(null);let o=x(e.optionsRef);o&&(o.scrollTop=0),e.goToOption(w.Nothing)}let p=b(()=>{var m;let o=e.value.value;return x(e.inputRef)?typeof a.displayValue!="undefined"&&o!==void 0?(m=a.displayValue(o))!=null?m:"":typeof o=="string"?o:"":""});X(()=>{q([p,e.comboboxState,C],([o,m],[S,h])=>{if(r.value)return;let T=x(e.inputRef);T&&((h===0&&m===1||o!==S)&&(T.value=o),requestAnimationFrame(()=>{var l;if(r.value||!T||((l=C.value)==null?void 0:l.activeElement)!==T)return;let{selectionStart:n,selectionEnd:V}=T;Math.abs((V!=null?V:0)-(n!=null?n:0))===0&&n===0&&T.setSelectionRange(T.value.length,T.value.length)}))},{immediate:!0}),q([e.comboboxState],([o],[m])=>{if(o===0&&m===1){if(r.value)return;let S=x(e.inputRef);if(!S)return;let h=S.value,{selectionStart:T,selectionEnd:n,selectionDirection:V}=S;S.value="",S.value=h,V!==null?S.setSelectionRange(T,n,V):S.setSelectionRange(T,n)}})});let c=A(!1);function g(){c.value=!0}function P(){ae().nextFrame(()=>{c.value=!1})}let D=be();function E(o){switch(r.value=!0,D(()=>{c.value||(r.value=!1)}),o.key){case k.Enter:if(r.value=!1,e.comboboxState.value!==0||c.value)return;if(o.preventDefault(),o.stopPropagation(),e.activeOptionIndex.value===null){e.closeCombobox();return}e.selectActiveOption(),e.mode.value===0&&e.closeCombobox();break;case k.ArrowDown:return r.value=!1,o.preventDefault(),o.stopPropagation(),$(e.comboboxState.value,{[0]:()=>e.goToOption(w.Next),[1]:()=>e.openCombobox()});case k.ArrowUp:return r.value=!1,o.preventDefault(),o.stopPropagation(),$(e.comboboxState.value,{[0]:()=>e.goToOption(w.Previous),[1]:()=>{e.openCombobox(),H(()=>{e.value.value||e.goToOption(w.Last)})}});case k.Home:if(o.shiftKey)break;return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.First);case k.PageUp:return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.First);case k.End:if(o.shiftKey)break;return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.Last);case k.PageDown:return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.Last);case k.Escape:if(r.value=!1,e.comboboxState.value!==0)return;o.preventDefault(),e.optionsRef.value&&!e.optionsPropsRef.value.static&&o.stopPropagation(),e.nullable.value&&e.mode.value===0&&e.value.value===null&&v(),e.closeCombobox();break;case k.Tab:if(r.value=!1,e.comboboxState.value!==0)return;e.mode.value===0&&e.activationTrigger.value!==1&&e.selectActiveOption(),e.closeCombobox();break}}function M(o){I("change",o),e.nullable.value&&e.mode.value===0&&o.target.value===""&&v(),e.openCombobox()}function K(o){var S,h,T;let m=(S=o.relatedTarget)!=null?S:oe.find(n=>n!==o.currentTarget);if(r.value=!1,!((h=x(e.optionsRef))!=null&&h.contains(m))&&!((T=x(e.buttonRef))!=null&&T.contains(m))&&e.comboboxState.value===0)return o.preventDefault(),e.mode.value===0&&(e.nullable.value&&e.value.value===null?v():e.activationTrigger.value!==1&&e.selectActiveOption()),e.closeCombobox()}function B(o){var S,h,T;let m=(S=o.relatedTarget)!=null?S:oe.find(n=>n!==o.currentTarget);(h=x(e.buttonRef))!=null&&h.contains(m)||(T=x(e.optionsRef))!=null&&T.contains(m)||e.disabled.value||e.immediate.value&&e.comboboxState.value!==0&&(e.openCombobox(),ae().nextFrame(()=>{e.setActivationTrigger(1)}))}let d=b(()=>{var o,m,S,h;return(h=(S=(m=a.defaultValue)!=null?m:e.defaultValue.value!==void 0?(o=a.displayValue)==null?void 0:o.call(a,e.defaultValue.value):null)!=null?S:e.defaultValue.value)!=null?h:""});return()=>{var V,l,i,s,f,R,y;let o={open:e.comboboxState.value===0},{id:m,displayValue:S,onChange:h,...T}=a,n={"aria-controls":(V=e.optionsRef.value)==null?void 0:V.id,"aria-expanded":e.comboboxState.value===0,"aria-activedescendant":e.activeOptionIndex.value===null?void 0:e.virtual.value?(l=e.options.value.find(F=>!e.virtual.value.disabled(F.dataRef.value)&&e.compare(F.dataRef.value,e.virtual.value.options[e.activeOptionIndex.value])))==null?void 0:l.id:(i=e.options.value[e.activeOptionIndex.value])==null?void 0:i.id,"aria-labelledby":(R=(s=x(e.labelRef))==null?void 0:s.id)!=null?R:(f=x(e.buttonRef))==null?void 0:f.id,"aria-autocomplete":"list",id:m,onCompositionstart:g,onCompositionend:P,onKeydown:E,onInput:M,onFocus:B,onBlur:K,role:"combobox",type:(y=u.type)!=null?y:"text",tabIndex:0,ref:e.inputRef,defaultValue:d.value,disabled:e.disabled.value===!0?!0:void 0};return U({ourProps:n,theirProps:T,slot:o,attrs:u,slots:O,features:Q.RenderStrategy|Q.Static,name:"ComboboxInput"})}}}),ut=j({name:"ComboboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},hold:{type:[Boolean],default:!1}},setup(a,{attrs:I,slots:u,expose:O}){let t=N("ComboboxOptions"),e=`headlessui-combobox-options-${z()}`;O({el:t.optionsRef,$el:t.optionsRef}),Y(()=>{t.optionsPropsRef.value.static=a.static}),Y(()=>{t.optionsPropsRef.value.hold=a.hold});let C=Ce(),r=b(()=>C!==null?(C.value&G.Open)===G.Open:t.comboboxState.value===0);ge({container:b(()=>x(t.optionsRef)),enabled:b(()=>t.comboboxState.value===0),accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}});function v(p){p.preventDefault()}return()=>{var P,D,E;let p={open:t.comboboxState.value===0},c={"aria-labelledby":(E=(P=x(t.labelRef))==null?void 0:P.id)!=null?E:(D=x(t.buttonRef))==null?void 0:D.id,id:e,ref:t.optionsRef,role:"listbox","aria-multiselectable":t.mode.value===1?!0:void 0,onMousedown:v},g=Z(a,["hold"]);return U({ourProps:c,theirProps:g,slot:p,attrs:I,slots:t.virtual.value&&t.comboboxState.value===0?{...u,default:()=>[W(Fe,{},u.default)]}:u,features:Q.RenderStrategy|Q.Static,visible:r.value,name:"ComboboxOptions"})}}}),rt=j({name:"ComboboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},order:{type:[Number],default:null}},setup(a,{slots:I,attrs:u,expose:O}){let t=N("ComboboxOption"),e=`headlessui-combobox-option-${z()}`,C=A(null),r=b(()=>{var d;return a.disabled||((d=t.virtual.value)==null?void 0:d.disabled(a.value))});O({el:C,$el:C});let v=b(()=>{var d;return t.virtual.value?t.activeOptionIndex.value===t.calculateIndex(a.value):t.activeOptionIndex.value===null?!1:((d=t.options.value[t.activeOptionIndex.value])==null?void 0:d.id)===e}),p=b(()=>t.isSelected(a.value)),c=ee(ie,null),g=b(()=>({disabled:a.disabled,value:a.value,domRef:C,order:b(()=>a.order)}));X(()=>t.registerOption(e,g)),ve(()=>t.unregisterOption(e,v.value)),Y(()=>{let d=x(C);d&&(c==null||c.value.measureElement(d))}),Y(()=>{t.comboboxState.value===0&&v.value&&(t.virtual.value||t.activationTrigger.value!==0&&H(()=>{var d,o;return(o=(d=x(C))==null?void 0:d.scrollIntoView)==null?void 0:o.call(d,{block:"nearest"})}))});function P(d){d.preventDefault(),d.button===ye.Left&&(r.value||(t.selectOption(e),Pe()||requestAnimationFrame(()=>{var o;return(o=x(t.inputRef))==null?void 0:o.focus({preventScroll:!0})}),t.mode.value===0&&t.closeCombobox()))}function D(){var o;if(a.disabled||(o=t.virtual.value)!=null&&o.disabled(a.value))return t.goToOption(w.Nothing);let d=t.calculateIndex(a.value);t.goToOption(w.Specific,d)}let E=xe();function M(d){E.update(d)}function K(d){var m;if(!E.wasMoved(d)||a.disabled||(m=t.virtual.value)!=null&&m.disabled(a.value)||v.value)return;let o=t.calculateIndex(a.value);t.goToOption(w.Specific,o,0)}function B(d){var o;E.wasMoved(d)&&(a.disabled||(o=t.virtual.value)!=null&&o.disabled(a.value)||v.value&&(t.optionsPropsRef.value.hold||t.goToOption(w.Nothing)))}return()=>{let{disabled:d}=a,o={active:v.value,selected:p.value,disabled:d},m={id:e,ref:C,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":p.value,disabled:void 0,onMousedown:P,onFocus:D,onPointerenter:M,onMouseenter:M,onPointermove:K,onMousemove:K,onPointerleave:B,onMouseleave:B},S=Z(a,["order","value"]);return U({ourProps:m,theirProps:S,slot:o,attrs:u,slots:I,name:"ComboboxOption"})}}});export{lt as Combobox,nt as ComboboxButton,it as ComboboxInput,at as ComboboxLabel,rt as ComboboxOption,ut as ComboboxOptions};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
2
|
+
export declare function useDescriptions({ slot, name, props, }?: {
|
|
3
|
+
slot?: Ref<Record<string, unknown>>;
|
|
4
|
+
name?: string;
|
|
5
|
+
props?: Record<string, unknown>;
|
|
6
|
+
}): ComputedRef<string | undefined>;
|
|
7
|
+
export declare let Description: import("vue").DefineComponent<{
|
|
8
|
+
as: {
|
|
9
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
id: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: () => string;
|
|
15
|
+
};
|
|
16
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
as: {
|
|
22
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
id: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: () => string;
|
|
28
|
+
};
|
|
29
|
+
}>>, {
|
|
30
|
+
id: string;
|
|
31
|
+
as: string | Record<string, any>;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{computed as m,defineComponent as x,inject as y,onMounted as R,onUnmounted as v,provide as D,ref as p,unref as j}from"vue";import{useId as C}from'../../hooks/use-id.js';import{render as h}from'../../utils/render.js';let u=Symbol("DescriptionContext");function b(){let t=y(u,null);if(t===null)throw new Error("Missing parent");return t}function S({slot:t=p({}),name:i="Description",props:o={}}={}){let e=p([]);function s(n){return e.value.push(n),()=>{let r=e.value.indexOf(n);r!==-1&&e.value.splice(r,1)}}return D(u,{register:s,slot:t,name:i,props:o}),m(()=>e.value.length>0?e.value.join(" "):void 0)}let k=x({name:"Description",props:{as:{type:[Object,String],default:"p"},id:{type:String,default:()=>`headlessui-description-${C()}`}},setup(t,{attrs:i,slots:o}){let e=b();return R(()=>v(e.register(t.id))),()=>{let{name:s="Description",slot:n=p({}),props:r={}}=e,{id:d,...l}=t,c={...Object.entries(r).reduce((f,[a,g])=>Object.assign(f,{[a]:j(g)}),{}),id:d};return h({ourProps:c,theirProps:l,slot:n.value,attrs:i,slots:o,name:s})}}});export{k as Description,S as useDescriptions};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
export declare let Dialog: import("vue").DefineComponent<{
|
|
3
|
+
as: {
|
|
4
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
static: {
|
|
8
|
+
type: BooleanConstructor;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
unmount: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
open: {
|
|
16
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
initialFocus: {
|
|
20
|
+
type: PropType<HTMLElement | null>;
|
|
21
|
+
default: null;
|
|
22
|
+
};
|
|
23
|
+
id: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: () => string;
|
|
26
|
+
};
|
|
27
|
+
role: {
|
|
28
|
+
type: PropType<"dialog" | "alertdialog">;
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
close: (_close: boolean) => true;
|
|
35
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
+
as: {
|
|
37
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
static: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
unmount: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
open: {
|
|
49
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
initialFocus: {
|
|
53
|
+
type: PropType<HTMLElement | null>;
|
|
54
|
+
default: null;
|
|
55
|
+
};
|
|
56
|
+
id: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: () => string;
|
|
59
|
+
};
|
|
60
|
+
role: {
|
|
61
|
+
type: PropType<"dialog" | "alertdialog">;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
}>> & {
|
|
65
|
+
onClose?: ((_close: boolean) => any) | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
id: string;
|
|
68
|
+
role: "dialog" | "alertdialog";
|
|
69
|
+
as: string | Record<string, any>;
|
|
70
|
+
unmount: boolean;
|
|
71
|
+
static: boolean;
|
|
72
|
+
open: string | boolean;
|
|
73
|
+
initialFocus: HTMLElement | null;
|
|
74
|
+
}>;
|
|
75
|
+
export declare let DialogOverlay: import("vue").DefineComponent<{
|
|
76
|
+
as: {
|
|
77
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
80
|
+
id: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: () => string;
|
|
83
|
+
};
|
|
84
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
89
|
+
as: {
|
|
90
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
91
|
+
default: string;
|
|
92
|
+
};
|
|
93
|
+
id: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
default: () => string;
|
|
96
|
+
};
|
|
97
|
+
}>>, {
|
|
98
|
+
id: string;
|
|
99
|
+
as: string | Record<string, any>;
|
|
100
|
+
}>;
|
|
101
|
+
export declare let DialogBackdrop: import("vue").DefineComponent<{
|
|
102
|
+
as: {
|
|
103
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
104
|
+
default: string;
|
|
105
|
+
};
|
|
106
|
+
id: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
default: () => string;
|
|
109
|
+
};
|
|
110
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
111
|
+
[key: string]: any;
|
|
112
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
113
|
+
as: {
|
|
114
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
115
|
+
default: string;
|
|
116
|
+
};
|
|
117
|
+
id: {
|
|
118
|
+
type: StringConstructor;
|
|
119
|
+
default: () => string;
|
|
120
|
+
};
|
|
121
|
+
}>>, {
|
|
122
|
+
id: string;
|
|
123
|
+
as: string | Record<string, any>;
|
|
124
|
+
}>;
|
|
125
|
+
export declare let DialogPanel: import("vue").DefineComponent<{
|
|
126
|
+
as: {
|
|
127
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
128
|
+
default: string;
|
|
129
|
+
};
|
|
130
|
+
id: {
|
|
131
|
+
type: StringConstructor;
|
|
132
|
+
default: () => string;
|
|
133
|
+
};
|
|
134
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
135
|
+
[key: string]: any;
|
|
136
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
139
|
+
as: {
|
|
140
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
141
|
+
default: string;
|
|
142
|
+
};
|
|
143
|
+
id: {
|
|
144
|
+
type: StringConstructor;
|
|
145
|
+
default: () => string;
|
|
146
|
+
};
|
|
147
|
+
}>>, {
|
|
148
|
+
id: string;
|
|
149
|
+
as: string | Record<string, any>;
|
|
150
|
+
}>;
|
|
151
|
+
export declare let DialogTitle: import("vue").DefineComponent<{
|
|
152
|
+
as: {
|
|
153
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
154
|
+
default: string;
|
|
155
|
+
};
|
|
156
|
+
id: {
|
|
157
|
+
type: StringConstructor;
|
|
158
|
+
default: () => string;
|
|
159
|
+
};
|
|
160
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
161
|
+
[key: string]: any;
|
|
162
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
163
|
+
[key: string]: any;
|
|
164
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
165
|
+
as: {
|
|
166
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
167
|
+
default: string;
|
|
168
|
+
};
|
|
169
|
+
id: {
|
|
170
|
+
type: StringConstructor;
|
|
171
|
+
default: () => string;
|
|
172
|
+
};
|
|
173
|
+
}>>, {
|
|
174
|
+
id: string;
|
|
175
|
+
as: string | Record<string, any>;
|
|
176
|
+
}>;
|
|
177
|
+
export declare let DialogDescription: import("vue").DefineComponent<{
|
|
178
|
+
as: {
|
|
179
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
180
|
+
default: string;
|
|
181
|
+
};
|
|
182
|
+
id: {
|
|
183
|
+
type: StringConstructor;
|
|
184
|
+
default: () => string;
|
|
185
|
+
};
|
|
186
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
187
|
+
[key: string]: any;
|
|
188
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
189
|
+
[key: string]: any;
|
|
190
|
+
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
191
|
+
as: {
|
|
192
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
193
|
+
default: string;
|
|
194
|
+
};
|
|
195
|
+
id: {
|
|
196
|
+
type: StringConstructor;
|
|
197
|
+
default: () => string;
|
|
198
|
+
};
|
|
199
|
+
}>>, {
|
|
200
|
+
id: string;
|
|
201
|
+
as: string | Record<string, any>;
|
|
202
|
+
}>;
|