@destyler/combobox 0.0.3 → 0.0.5
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/README.md +7 -0
- package/dist/component.cjs +326 -361
- package/dist/component.d.cts +150 -83
- package/dist/component.d.mts +150 -83
- package/dist/component.d.ts +150 -83
- package/dist/component.mjs +295 -346
- package/dist/index.cjs +34 -17
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +5 -3
- package/dist/resolver.cjs +20 -6
- package/dist/resolver.d.cts +3 -3
- package/dist/resolver.d.mts +3 -3
- package/dist/resolver.d.ts +3 -3
- package/dist/resolver.mjs +19 -5
- package/dist/shared/combobox.d5de67c5.d.cts +1800 -0
- package/dist/shared/combobox.d5de67c5.d.mts +1800 -0
- package/dist/shared/combobox.d5de67c5.d.ts +1800 -0
- package/package.json +21 -24
- package/dist/shared/combobox.27206b6f.d.cts +0 -1290
- package/dist/shared/combobox.27206b6f.d.mts +0 -1290
- package/dist/shared/combobox.27206b6f.d.ts +0 -1290
package/dist/component.mjs
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import { defineComponent, h, mergeProps, toRefs, ref,
|
|
2
|
-
import {
|
|
3
|
-
import { useForwardExpose, useDirection, useVModel, useFormControl,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import isEqual from '
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { defineComponent, h, mergeProps, toRefs, ref, watch, computed, nextTick, onMounted, withDirectives, withKeys } from 'vue';
|
|
2
|
+
import { primitiveProps, Primitive } from '@destyler/primitive';
|
|
3
|
+
import { useForwardExpose, useDirection, useVModel, useFormControl, useBodyScrollLock, useHideOthers, useForwardProps, useForwardPropsEmits, useId, useMutationObserver } from '@destyler/composition';
|
|
4
|
+
import { PopperAnchor, PopperRoot, popperContentProps, PopperContent, PopperArrow } from '@destyler/popper';
|
|
5
|
+
import { popperArrowProps } from '@destyler/popper/component';
|
|
6
|
+
import { createContext, isEqual, handleAndDispatchCustomEvent } from '@destyler/shared';
|
|
7
|
+
import { VisuallyHiddenInput } from '@destyler/visually-hidden/component';
|
|
8
|
+
import { createCollection } from '@destyler/collection/composition';
|
|
9
|
+
import { CollectionSlot, CollectionItem } from '@destyler/collection';
|
|
10
|
+
import { dismissableLayerProps, DismissableLayer } from '@destyler/dismissable-layer';
|
|
11
|
+
import { dismissableLayerEmits } from '@destyler/dismissable-layer/component';
|
|
10
12
|
import { BindOnceDirective } from '@destyler/directives';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
+
import { Presence } from '@destyler/presence';
|
|
14
|
+
import { teleportPrimitiveProps, TeleportPrimitive } from '@destyler/teleport';
|
|
13
15
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
type: [String, Object],
|
|
17
|
-
required: false,
|
|
18
|
-
default: "div"
|
|
19
|
-
},
|
|
20
|
-
asChild: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
required: false,
|
|
23
|
-
default: false
|
|
24
|
-
}
|
|
16
|
+
const comboboxAnchorProps = {
|
|
17
|
+
...primitiveProps
|
|
25
18
|
};
|
|
26
|
-
const
|
|
19
|
+
const ComboboxAnchor = defineComponent({
|
|
27
20
|
name: "DestylerComboboxAnchor",
|
|
28
|
-
props:
|
|
21
|
+
props: comboboxAnchorProps,
|
|
29
22
|
setup() {
|
|
30
23
|
const { forwardRef } = useForwardExpose();
|
|
31
24
|
return {
|
|
@@ -33,10 +26,10 @@ const DestylerComboboxAnchor = defineComponent({
|
|
|
33
26
|
};
|
|
34
27
|
},
|
|
35
28
|
render() {
|
|
36
|
-
return h(
|
|
29
|
+
return h(PopperAnchor, {
|
|
37
30
|
asChild: true
|
|
38
31
|
}, () => {
|
|
39
|
-
return h(
|
|
32
|
+
return h(Primitive, mergeProps(this.$attrs, {
|
|
40
33
|
ref: (el) => this.forwardRef(el),
|
|
41
34
|
as: this.$props.as,
|
|
42
35
|
asChild: this.$props.asChild
|
|
@@ -47,68 +40,124 @@ const DestylerComboboxAnchor = defineComponent({
|
|
|
47
40
|
}
|
|
48
41
|
});
|
|
49
42
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type: Boolean,
|
|
58
|
-
required: false,
|
|
59
|
-
default: false
|
|
60
|
-
},
|
|
43
|
+
const comboboxRootProps = {
|
|
44
|
+
...primitiveProps,
|
|
45
|
+
/**
|
|
46
|
+
* The controlled value of the Combobox. Can be binded-with with `v-model`.
|
|
47
|
+
*
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
61
50
|
modelValue: {
|
|
62
|
-
type: [String, Number, Boolean, Object],
|
|
63
|
-
required: false
|
|
51
|
+
type: [String, Number, Boolean, Object, Array],
|
|
52
|
+
required: false,
|
|
53
|
+
default: void 0
|
|
64
54
|
},
|
|
55
|
+
/**
|
|
56
|
+
* The value of the combobox when initially rendered.
|
|
57
|
+
* Use when you do not need to control the state of the Combobox
|
|
58
|
+
*
|
|
59
|
+
* @default undefined
|
|
60
|
+
*/
|
|
65
61
|
defaultValue: {
|
|
66
|
-
type: [String, Number, Boolean, Object],
|
|
67
|
-
required: false
|
|
62
|
+
type: [String, Number, Boolean, Object, Array],
|
|
63
|
+
required: false,
|
|
64
|
+
default: void 0
|
|
68
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* The controlled open state of the Combobox. Can be binded-with with `v-model:open`.
|
|
68
|
+
*
|
|
69
|
+
* @default undefined
|
|
70
|
+
*/
|
|
69
71
|
open: {
|
|
70
72
|
type: Boolean,
|
|
71
73
|
required: false,
|
|
72
74
|
default: void 0
|
|
73
75
|
},
|
|
76
|
+
/**
|
|
77
|
+
* The open state of the combobox when it is initially rendered.
|
|
78
|
+
* Use when you do not need to control its open state.
|
|
79
|
+
*/
|
|
74
80
|
defaultOpen: {
|
|
75
81
|
type: Boolean,
|
|
76
82
|
required: false
|
|
77
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* The controlled search term of the Combobox.
|
|
86
|
+
* Can be binded-with with `v-model:searchTerm`.
|
|
87
|
+
*/
|
|
78
88
|
searchTerm: {
|
|
79
89
|
type: String,
|
|
80
90
|
required: false
|
|
81
91
|
},
|
|
92
|
+
/**
|
|
93
|
+
* Whether multiple options can be selected or not.
|
|
94
|
+
*
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
82
97
|
multiple: {
|
|
83
98
|
type: Boolean,
|
|
84
|
-
required: false
|
|
99
|
+
required: false,
|
|
100
|
+
default: false
|
|
85
101
|
},
|
|
102
|
+
/**
|
|
103
|
+
* When `true`, prevents the user from interacting with Combobox.
|
|
104
|
+
*
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
86
107
|
disabled: {
|
|
87
108
|
type: Boolean,
|
|
88
|
-
required: false
|
|
109
|
+
required: false,
|
|
110
|
+
default: false
|
|
89
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* The name of the Combobox. Submitted with its owning form as part of a name/value pair.
|
|
114
|
+
*/
|
|
90
115
|
name: {
|
|
91
116
|
type: String,
|
|
92
117
|
required: false
|
|
93
118
|
},
|
|
119
|
+
/**
|
|
120
|
+
* The reading direction of the combobox when applicable.
|
|
121
|
+
*/
|
|
94
122
|
dir: {
|
|
95
123
|
type: String,
|
|
96
124
|
required: false
|
|
97
125
|
},
|
|
126
|
+
/**
|
|
127
|
+
* The custom filter function for filtering `ComboboxItem`.
|
|
128
|
+
*/
|
|
98
129
|
filterFunction: {
|
|
99
130
|
type: Function,
|
|
100
131
|
required: false
|
|
101
132
|
},
|
|
133
|
+
/**
|
|
134
|
+
* The display value of input for selected item. Does not work with `multiple`.
|
|
135
|
+
*/
|
|
102
136
|
displayValue: {
|
|
103
137
|
type: Function,
|
|
104
138
|
required: false
|
|
105
139
|
}
|
|
106
140
|
};
|
|
141
|
+
const comboboxRootEmits = {
|
|
142
|
+
/**
|
|
143
|
+
* Event handler called when the value changes.
|
|
144
|
+
*/
|
|
145
|
+
"update:modelValue": (_value) => true,
|
|
146
|
+
/**
|
|
147
|
+
* Event handler called when the open state of the combobox changes.
|
|
148
|
+
*/
|
|
149
|
+
"update:open": (_value) => true,
|
|
150
|
+
/**
|
|
151
|
+
* Event handler called when the searchTerm of the combobox changes.
|
|
152
|
+
*/
|
|
153
|
+
"update:searchTerm": (_value) => true
|
|
154
|
+
};
|
|
107
155
|
const [injectComboboxRootContext, provideComboboxRootContext] = createContext("DestylerComboboxRoot");
|
|
108
|
-
const
|
|
156
|
+
const ComboboxRoot = defineComponent({
|
|
109
157
|
name: "DestylerComboboxRoot",
|
|
110
|
-
props:
|
|
111
|
-
emits:
|
|
158
|
+
props: comboboxRootProps,
|
|
159
|
+
emits: comboboxRootEmits,
|
|
160
|
+
slots: Object,
|
|
112
161
|
setup(props, { emit }) {
|
|
113
162
|
const { multiple, disabled, dir: propDir } = toRefs(props);
|
|
114
163
|
const dir = useDirection(propDir);
|
|
@@ -126,11 +175,11 @@ const DestylerComboboxRoot = defineComponent({
|
|
|
126
175
|
passive: props.open === void 0
|
|
127
176
|
});
|
|
128
177
|
const selectedValue = ref();
|
|
129
|
-
const isUserInputted = ref(false);
|
|
130
178
|
const inputElement = ref();
|
|
131
179
|
const contentElement = ref();
|
|
132
180
|
const { forwardRef, currentElement: parentElement } = useForwardExpose();
|
|
133
181
|
const { getItems, reactiveItems, itemMapSize } = createCollection("data-destyler-combobox-item");
|
|
182
|
+
const isUserInputted = ref(false);
|
|
134
183
|
async function onOpenChange(val) {
|
|
135
184
|
open.value = val;
|
|
136
185
|
await nextTick();
|
|
@@ -157,20 +206,22 @@ const DestylerComboboxRoot = defineComponent({
|
|
|
157
206
|
onOpenChange(false);
|
|
158
207
|
}
|
|
159
208
|
}
|
|
160
|
-
const options =
|
|
161
|
-
|
|
162
|
-
|
|
209
|
+
const options = ref([]);
|
|
210
|
+
watch(() => itemMapSize.value, () => {
|
|
211
|
+
options.value = getItems().map((i) => i.value);
|
|
212
|
+
}, { immediate: true });
|
|
163
213
|
const filteredOptions = computed(() => {
|
|
164
214
|
if (isUserInputted.value) {
|
|
165
215
|
if (props.filterFunction)
|
|
166
216
|
return props.filterFunction(options.value, searchTerm.value);
|
|
167
|
-
|
|
168
|
-
|
|
217
|
+
const optionsWithTypeString = options.value.filter((i) => typeof i === "string");
|
|
218
|
+
if (optionsWithTypeString.length)
|
|
219
|
+
return optionsWithTypeString.filter((i) => i.toLowerCase().includes(searchTerm.value?.toLowerCase()));
|
|
169
220
|
}
|
|
170
221
|
return options.value;
|
|
171
222
|
});
|
|
172
223
|
function resetSearchTerm() {
|
|
173
|
-
if (!multiple.value && modelValue.value) {
|
|
224
|
+
if (!multiple.value && modelValue.value && !Array.isArray(modelValue.value)) {
|
|
174
225
|
if (props.displayValue)
|
|
175
226
|
searchTerm.value = props.displayValue(modelValue.value);
|
|
176
227
|
else if (typeof modelValue.value !== "object")
|
|
@@ -185,7 +236,9 @@ const DestylerComboboxRoot = defineComponent({
|
|
|
185
236
|
const selectedElement = computed(() => {
|
|
186
237
|
return reactiveItems.value.find((i) => i.value === selectedValue.value)?.ref;
|
|
187
238
|
});
|
|
188
|
-
|
|
239
|
+
const stringifiedModelValue = computed(() => JSON.stringify(modelValue.value));
|
|
240
|
+
watch(stringifiedModelValue, async () => {
|
|
241
|
+
await nextTick();
|
|
189
242
|
await nextTick();
|
|
190
243
|
resetSearchTerm();
|
|
191
244
|
}, { immediate: true });
|
|
@@ -210,7 +263,7 @@ const DestylerComboboxRoot = defineComponent({
|
|
|
210
263
|
open,
|
|
211
264
|
onOpenChange,
|
|
212
265
|
filteredOptions,
|
|
213
|
-
contentId:
|
|
266
|
+
contentId: "",
|
|
214
267
|
inputElement,
|
|
215
268
|
onInputElementChange: (val) => inputElement.value = val,
|
|
216
269
|
onInputNavigation: async (val) => {
|
|
@@ -244,9 +297,9 @@ const DestylerComboboxRoot = defineComponent({
|
|
|
244
297
|
};
|
|
245
298
|
},
|
|
246
299
|
render() {
|
|
247
|
-
return h(
|
|
300
|
+
return h(PopperRoot, null, {
|
|
248
301
|
default: () => {
|
|
249
|
-
return h(
|
|
302
|
+
return h(Primitive, mergeProps(this.$attrs, {
|
|
250
303
|
ref: (el) => this.forwardRef(el),
|
|
251
304
|
style: {
|
|
252
305
|
pointerEvents: this.open ? "auto" : void 0
|
|
@@ -258,7 +311,7 @@ const DestylerComboboxRoot = defineComponent({
|
|
|
258
311
|
default: () => {
|
|
259
312
|
return [
|
|
260
313
|
this.$slots.default?.({ open: this.open, modelValue: this.modelValue }),
|
|
261
|
-
this.isFormControl && this.$props.name ? h(
|
|
314
|
+
this.isFormControl && this.$props.name ? h(VisuallyHiddenInput, {
|
|
262
315
|
name: this.$props.name,
|
|
263
316
|
value: this.modelValue
|
|
264
317
|
}) : null
|
|
@@ -270,111 +323,47 @@ const DestylerComboboxRoot = defineComponent({
|
|
|
270
323
|
}
|
|
271
324
|
});
|
|
272
325
|
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
},
|
|
284
|
-
side: {
|
|
285
|
-
type: String,
|
|
286
|
-
required: false,
|
|
287
|
-
default: "bottom"
|
|
288
|
-
},
|
|
289
|
-
sideOffset: {
|
|
290
|
-
type: Number,
|
|
291
|
-
required: false,
|
|
292
|
-
default: 0
|
|
293
|
-
},
|
|
294
|
-
align: {
|
|
295
|
-
type: String,
|
|
296
|
-
required: false,
|
|
297
|
-
default: "center"
|
|
298
|
-
},
|
|
299
|
-
alignOffset: {
|
|
300
|
-
type: Number,
|
|
301
|
-
required: false,
|
|
302
|
-
default: 0
|
|
303
|
-
},
|
|
304
|
-
avoidCollisions: {
|
|
305
|
-
type: Boolean,
|
|
306
|
-
required: false,
|
|
307
|
-
default: true
|
|
308
|
-
},
|
|
309
|
-
collisionBoundary: {
|
|
310
|
-
type: [Object, Array, null],
|
|
311
|
-
required: false,
|
|
312
|
-
default: () => []
|
|
313
|
-
},
|
|
314
|
-
collisionPadding: {
|
|
315
|
-
type: [Number, Object],
|
|
316
|
-
required: false,
|
|
317
|
-
default: 0
|
|
318
|
-
},
|
|
319
|
-
arrowPadding: {
|
|
320
|
-
type: Number,
|
|
321
|
-
required: false,
|
|
322
|
-
default: 0
|
|
323
|
-
},
|
|
324
|
-
sticky: {
|
|
325
|
-
type: String,
|
|
326
|
-
required: false,
|
|
327
|
-
default: "partial"
|
|
328
|
-
},
|
|
329
|
-
hideWhenDetached: {
|
|
330
|
-
type: Boolean,
|
|
331
|
-
required: false,
|
|
332
|
-
default: false
|
|
333
|
-
},
|
|
334
|
-
updatePositionStrategy: {
|
|
335
|
-
type: String,
|
|
336
|
-
required: false,
|
|
337
|
-
default: "optimized"
|
|
338
|
-
},
|
|
339
|
-
onPlaced: {
|
|
340
|
-
type: Function,
|
|
341
|
-
required: false
|
|
342
|
-
},
|
|
343
|
-
prioritizePosition: {
|
|
344
|
-
type: Boolean,
|
|
345
|
-
required: false,
|
|
346
|
-
default: false
|
|
347
|
-
},
|
|
348
|
-
disableOutsidePointerEvents: {
|
|
349
|
-
type: Boolean,
|
|
350
|
-
required: false,
|
|
351
|
-
default: false
|
|
352
|
-
},
|
|
353
|
-
isDismissable: {
|
|
354
|
-
type: Boolean,
|
|
355
|
-
required: false,
|
|
356
|
-
default: true
|
|
357
|
-
},
|
|
326
|
+
const comboboxContentImplProps = {
|
|
327
|
+
...dismissableLayerProps,
|
|
328
|
+
...popperContentProps,
|
|
329
|
+
/**
|
|
330
|
+
* The positioning mode to use, <br>
|
|
331
|
+
* `inline` is the default and you can control the position using CSS. <br>
|
|
332
|
+
* `popper` positions content in the same way as our other primitives, for example `Popover` or `DropdownMenu`.
|
|
333
|
+
*
|
|
334
|
+
* @default inline
|
|
335
|
+
*/
|
|
358
336
|
position: {
|
|
359
337
|
type: String,
|
|
360
338
|
required: false,
|
|
361
339
|
default: "inline"
|
|
362
340
|
},
|
|
341
|
+
/**
|
|
342
|
+
* The document.body will be lock, and scrolling will be disabled.
|
|
343
|
+
*/
|
|
363
344
|
bodyLock: {
|
|
364
345
|
type: Boolean,
|
|
365
346
|
required: false
|
|
366
347
|
},
|
|
348
|
+
/**
|
|
349
|
+
* Allow component to be dismissableLayer.
|
|
350
|
+
*
|
|
351
|
+
* @default true
|
|
352
|
+
*/
|
|
367
353
|
dismissable: {
|
|
368
354
|
type: Boolean,
|
|
369
355
|
required: false,
|
|
370
356
|
default: true
|
|
371
357
|
}
|
|
372
358
|
};
|
|
359
|
+
const comboboxContentImplEmits = {
|
|
360
|
+
...dismissableLayerEmits
|
|
361
|
+
};
|
|
373
362
|
const [injectComboboxContentContext, provideComboboxContentContext] = createContext("DestylerComboboxContent");
|
|
374
|
-
const
|
|
363
|
+
const ComboboxContentImpl = defineComponent({
|
|
375
364
|
name: "DestylerComboboxContentImpl",
|
|
376
|
-
props:
|
|
377
|
-
emits:
|
|
365
|
+
props: comboboxContentImplProps,
|
|
366
|
+
emits: comboboxContentImplEmits,
|
|
378
367
|
setup(props) {
|
|
379
368
|
const { position } = toRefs(props);
|
|
380
369
|
const rootContext = injectComboboxRootContext();
|
|
@@ -396,26 +385,27 @@ const DestylerComboboxContentImpl = defineComponent({
|
|
|
396
385
|
});
|
|
397
386
|
const popperStyle = {
|
|
398
387
|
"boxSizing": "border-box",
|
|
399
|
-
"--
|
|
400
|
-
"--
|
|
401
|
-
"--
|
|
402
|
-
"--
|
|
403
|
-
"--
|
|
388
|
+
"--destyler-combobox-content-transform-origin": "var(--destyler-popper-transform-origin)",
|
|
389
|
+
"--destyler-combobox-content-available-width": "var(--destyler-popper-available-width)",
|
|
390
|
+
"--destyler-combobox-content-available-height": "var(--destyler-popper-available-height)",
|
|
391
|
+
"--destyler-combobox-trigger-width": "var(--destyler-popper-anchor-width)",
|
|
392
|
+
"--destyler-combobox-trigger-height": "var(--destyler-popper-anchor-height)"
|
|
404
393
|
};
|
|
405
394
|
provideComboboxContentContext({ position });
|
|
406
395
|
return {
|
|
407
396
|
rootContext,
|
|
408
397
|
popperStyle,
|
|
409
398
|
forwardedProps,
|
|
399
|
+
pickedProps,
|
|
410
400
|
forwardRef,
|
|
411
401
|
handleLeave
|
|
412
402
|
};
|
|
413
403
|
},
|
|
414
404
|
render() {
|
|
415
|
-
return h(
|
|
405
|
+
return h(CollectionSlot, null, {
|
|
416
406
|
default: () => {
|
|
417
407
|
return [
|
|
418
|
-
this.$props.dismissable ? h(
|
|
408
|
+
this.$props.dismissable ? h(DismissableLayer, {
|
|
419
409
|
asChild: true,
|
|
420
410
|
disableOutsidePointerEvents: this.$props.disableOutsidePointerEvents,
|
|
421
411
|
onDismiss: () => {
|
|
@@ -437,9 +427,9 @@ const DestylerComboboxContentImpl = defineComponent({
|
|
|
437
427
|
event.preventDefault();
|
|
438
428
|
this.$emit("pointerDownOutside", event);
|
|
439
429
|
}
|
|
440
|
-
}
|
|
430
|
+
}, {
|
|
441
431
|
default: () => {
|
|
442
|
-
return withDirectives(h(this.$props.position === "popper" ?
|
|
432
|
+
return withDirectives(h(this.$props.position === "popper" ? PopperContent : Primitive, mergeProps(this.$attrs, this.forwardedProps, {
|
|
443
433
|
"ref": (el) => this.forwardRef(el),
|
|
444
434
|
"role": "listbox",
|
|
445
435
|
"data-state": this.rootContext.open.value ? "open" : "closed",
|
|
@@ -452,13 +442,13 @@ const DestylerComboboxContentImpl = defineComponent({
|
|
|
452
442
|
"onPointerleave": () => {
|
|
453
443
|
this.handleLeave();
|
|
454
444
|
}
|
|
455
|
-
}, {
|
|
445
|
+
}), {
|
|
456
446
|
default: () => this.$slots.default?.()
|
|
457
447
|
}), [
|
|
458
448
|
[BindOnceDirective, { id: this.rootContext.contentId }]
|
|
459
449
|
]);
|
|
460
450
|
}
|
|
461
|
-
}) : withDirectives(h(this.$props.position === "popper" ?
|
|
451
|
+
}) : withDirectives(h(this.$props.position === "popper" ? PopperContent : Primitive, mergeProps(this.$attrs, this.pickedProps, {
|
|
462
452
|
"ref": (el) => this.forwardRef(el),
|
|
463
453
|
"role": "listbox",
|
|
464
454
|
"data-state": this.rootContext.open.value ? "open" : "closed",
|
|
@@ -471,7 +461,7 @@ const DestylerComboboxContentImpl = defineComponent({
|
|
|
471
461
|
"onPointerleave": () => {
|
|
472
462
|
this.handleLeave();
|
|
473
463
|
}
|
|
474
|
-
}, {
|
|
464
|
+
}), {
|
|
475
465
|
default: () => this.$slots.default?.()
|
|
476
466
|
}), [
|
|
477
467
|
[BindOnceDirective, { id: this.rootContext.contentId }]
|
|
@@ -482,31 +472,12 @@ const DestylerComboboxContentImpl = defineComponent({
|
|
|
482
472
|
}
|
|
483
473
|
});
|
|
484
474
|
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
type: Boolean,
|
|
488
|
-
required: false,
|
|
489
|
-
default: false
|
|
490
|
-
},
|
|
491
|
-
width: {
|
|
492
|
-
type: Number,
|
|
493
|
-
required: false,
|
|
494
|
-
default: 10
|
|
495
|
-
},
|
|
496
|
-
height: {
|
|
497
|
-
type: Number,
|
|
498
|
-
required: false,
|
|
499
|
-
default: 5
|
|
500
|
-
},
|
|
501
|
-
as: {
|
|
502
|
-
type: [String, Object],
|
|
503
|
-
required: false,
|
|
504
|
-
default: "svg"
|
|
505
|
-
}
|
|
475
|
+
const comboboxArrowProps = {
|
|
476
|
+
...popperArrowProps
|
|
506
477
|
};
|
|
507
|
-
const
|
|
478
|
+
const ComboboxArrow = defineComponent({
|
|
508
479
|
name: "DestylerComboboxArrow",
|
|
509
|
-
props:
|
|
480
|
+
props: comboboxArrowProps,
|
|
510
481
|
setup() {
|
|
511
482
|
useForwardExpose();
|
|
512
483
|
const rootContext = injectComboboxRootContext();
|
|
@@ -518,25 +489,25 @@ const DestylerComboboxArrow = defineComponent({
|
|
|
518
489
|
},
|
|
519
490
|
render() {
|
|
520
491
|
if (this.rootContext.open.value && this.contentContext.position.value === "popper")
|
|
521
|
-
return h(
|
|
492
|
+
return h(PopperArrow, this.$props, () => this.$slots.default?.());
|
|
493
|
+
else
|
|
494
|
+
return null;
|
|
522
495
|
}
|
|
523
496
|
});
|
|
524
497
|
|
|
525
|
-
const
|
|
498
|
+
const comboboxCancelProps = {
|
|
499
|
+
...primitiveProps,
|
|
500
|
+
/**
|
|
501
|
+
* @default button
|
|
502
|
+
*/
|
|
526
503
|
as: {
|
|
527
|
-
|
|
528
|
-
required: false,
|
|
504
|
+
...primitiveProps.as,
|
|
529
505
|
default: "button"
|
|
530
|
-
},
|
|
531
|
-
asChild: {
|
|
532
|
-
type: Boolean,
|
|
533
|
-
required: false,
|
|
534
|
-
default: false
|
|
535
506
|
}
|
|
536
507
|
};
|
|
537
|
-
const
|
|
508
|
+
const ComboboxCancel = defineComponent({
|
|
538
509
|
name: "DestylerComboboxCancel",
|
|
539
|
-
props:
|
|
510
|
+
props: comboboxCancelProps,
|
|
540
511
|
setup() {
|
|
541
512
|
useForwardExpose();
|
|
542
513
|
const rootContext = injectComboboxRootContext();
|
|
@@ -550,7 +521,7 @@ const DestylerComboboxCancel = defineComponent({
|
|
|
550
521
|
};
|
|
551
522
|
},
|
|
552
523
|
render() {
|
|
553
|
-
return h(
|
|
524
|
+
return h(Primitive, mergeProps(this.$props, {
|
|
554
525
|
type: this.$props.as === "button" ? "button" : void 0,
|
|
555
526
|
tabindex: "-1",
|
|
556
527
|
onClick: () => {
|
|
@@ -560,21 +531,29 @@ const DestylerComboboxCancel = defineComponent({
|
|
|
560
531
|
}
|
|
561
532
|
});
|
|
562
533
|
|
|
563
|
-
const
|
|
564
|
-
...
|
|
534
|
+
const comboboxContentProps = {
|
|
535
|
+
...comboboxContentImplProps,
|
|
536
|
+
/**
|
|
537
|
+
* Used to force mounting when more control is needed.
|
|
538
|
+
* Useful when controlling animation with Vue animation libraries.
|
|
539
|
+
*/
|
|
565
540
|
forceMount: {
|
|
566
541
|
type: Boolean,
|
|
567
542
|
required: false
|
|
568
543
|
}
|
|
569
544
|
};
|
|
570
|
-
const
|
|
545
|
+
const comboboxContentEmits = {
|
|
546
|
+
...comboboxContentImplEmits
|
|
547
|
+
};
|
|
548
|
+
const ComboboxContent = defineComponent({
|
|
571
549
|
name: "DestylerComboboxContent",
|
|
572
|
-
props:
|
|
573
|
-
emits:
|
|
550
|
+
props: comboboxContentProps,
|
|
551
|
+
emits: comboboxContentEmits,
|
|
574
552
|
setup(props, { emit }) {
|
|
575
553
|
const forwarded = useForwardPropsEmits(props, emit);
|
|
576
554
|
const { forwardRef } = useForwardExpose();
|
|
577
555
|
const rootContext = injectComboboxRootContext();
|
|
556
|
+
rootContext.contentId || (rootContext.contentId = useId(void 0, "destyler-combobox-content"));
|
|
578
557
|
return {
|
|
579
558
|
forwardRef,
|
|
580
559
|
forwarded,
|
|
@@ -582,29 +561,20 @@ const DestylerComboboxContent = defineComponent({
|
|
|
582
561
|
};
|
|
583
562
|
},
|
|
584
563
|
render() {
|
|
585
|
-
return h(
|
|
564
|
+
return h(Presence, {
|
|
586
565
|
present: this.$props.forceMount || this.rootContext.open.value
|
|
587
|
-
}, () => h(
|
|
566
|
+
}, () => h(ComboboxContentImpl, mergeProps(this.$attrs, this.forwarded, {
|
|
588
567
|
ref: (el) => this.forwardRef(el)
|
|
589
568
|
}), () => this.$slots.default?.()));
|
|
590
569
|
}
|
|
591
570
|
});
|
|
592
571
|
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
type: [String, Object],
|
|
596
|
-
required: false,
|
|
597
|
-
default: "button"
|
|
598
|
-
},
|
|
599
|
-
asChild: {
|
|
600
|
-
type: Boolean,
|
|
601
|
-
required: false,
|
|
602
|
-
default: false
|
|
603
|
-
}
|
|
572
|
+
const comboboxEmptyProps = {
|
|
573
|
+
...primitiveProps
|
|
604
574
|
};
|
|
605
|
-
const
|
|
575
|
+
const ComboboxEmpty = defineComponent({
|
|
606
576
|
name: "DestylerComboboxEmpty",
|
|
607
|
-
props:
|
|
577
|
+
props: comboboxEmptyProps,
|
|
608
578
|
setup() {
|
|
609
579
|
useForwardExpose();
|
|
610
580
|
const rootContext = injectComboboxRootContext();
|
|
@@ -616,32 +586,23 @@ const DestylerComboboxEmpty = defineComponent({
|
|
|
616
586
|
},
|
|
617
587
|
render() {
|
|
618
588
|
if (this.isEmpty) {
|
|
619
|
-
return h(
|
|
589
|
+
return h(Primitive, this.$props, {
|
|
620
590
|
default: () => this.$slots.default ? this.$slots.default?.() : "No options"
|
|
621
591
|
});
|
|
622
592
|
}
|
|
623
593
|
}
|
|
624
594
|
});
|
|
625
595
|
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
type: [String, Object],
|
|
629
|
-
required: false,
|
|
630
|
-
default: "div"
|
|
631
|
-
},
|
|
632
|
-
asChild: {
|
|
633
|
-
type: Boolean,
|
|
634
|
-
required: false,
|
|
635
|
-
default: false
|
|
636
|
-
}
|
|
596
|
+
const comboboxGroupProps = {
|
|
597
|
+
...primitiveProps
|
|
637
598
|
};
|
|
638
599
|
const [injectComboboxGroupContext, provideComboboxGroupContext] = createContext("DestylerComboboxGroup");
|
|
639
|
-
const
|
|
600
|
+
const ComboboxGroup = defineComponent({
|
|
640
601
|
name: "DestylerComboboxGroup",
|
|
641
|
-
props:
|
|
602
|
+
props: comboboxGroupProps,
|
|
642
603
|
setup() {
|
|
643
604
|
const { currentRef, currentElement } = useForwardExpose();
|
|
644
|
-
const id = useId();
|
|
605
|
+
const id = useId(void 0, "destyler-combobox-group");
|
|
645
606
|
const rootContext = injectComboboxRootContext();
|
|
646
607
|
const hasOptions = ref(false);
|
|
647
608
|
function checkCollectionItem() {
|
|
@@ -652,12 +613,16 @@ const DestylerComboboxGroup = defineComponent({
|
|
|
652
613
|
}
|
|
653
614
|
useMutationObserver(currentElement, () => {
|
|
654
615
|
checkCollectionItem();
|
|
655
|
-
}, {
|
|
616
|
+
}, {
|
|
617
|
+
childList: true
|
|
618
|
+
});
|
|
656
619
|
watch(() => rootContext.searchTerm.value, () => {
|
|
657
620
|
nextTick(() => {
|
|
658
621
|
checkCollectionItem();
|
|
659
622
|
});
|
|
660
|
-
}, {
|
|
623
|
+
}, {
|
|
624
|
+
immediate: true
|
|
625
|
+
});
|
|
661
626
|
provideComboboxGroupContext({
|
|
662
627
|
id
|
|
663
628
|
});
|
|
@@ -668,7 +633,7 @@ const DestylerComboboxGroup = defineComponent({
|
|
|
668
633
|
};
|
|
669
634
|
},
|
|
670
635
|
render() {
|
|
671
|
-
return h(
|
|
636
|
+
return h(Primitive, mergeProps(this.$props, {
|
|
672
637
|
"ref": "currentRef",
|
|
673
638
|
"role": "group",
|
|
674
639
|
"aria-labelledby": this.id,
|
|
@@ -679,34 +644,45 @@ const DestylerComboboxGroup = defineComponent({
|
|
|
679
644
|
}
|
|
680
645
|
});
|
|
681
646
|
|
|
682
|
-
const
|
|
647
|
+
const comboboxInputProps = {
|
|
648
|
+
...primitiveProps,
|
|
649
|
+
/**
|
|
650
|
+
* @default input
|
|
651
|
+
*/
|
|
683
652
|
as: {
|
|
684
|
-
|
|
685
|
-
required: false,
|
|
653
|
+
...primitiveProps.as,
|
|
686
654
|
default: "input"
|
|
687
655
|
},
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
656
|
+
/**
|
|
657
|
+
* Native input type
|
|
658
|
+
*
|
|
659
|
+
* @default text
|
|
660
|
+
*/
|
|
693
661
|
type: {
|
|
694
662
|
type: String,
|
|
695
663
|
required: false,
|
|
696
664
|
default: "text"
|
|
697
665
|
},
|
|
666
|
+
/**
|
|
667
|
+
* When `true`, prevents the user from interacting with item
|
|
668
|
+
*/
|
|
698
669
|
disabled: {
|
|
699
670
|
type: Boolean,
|
|
700
671
|
required: false
|
|
701
672
|
},
|
|
673
|
+
/**
|
|
674
|
+
* Focus on element when mounted.
|
|
675
|
+
*
|
|
676
|
+
* @default false
|
|
677
|
+
*/
|
|
702
678
|
autoFocus: {
|
|
703
679
|
type: Boolean,
|
|
704
680
|
required: false
|
|
705
681
|
}
|
|
706
682
|
};
|
|
707
|
-
const
|
|
683
|
+
const ComboboxInput = defineComponent({
|
|
708
684
|
name: "DestylerComboboxInput",
|
|
709
|
-
props:
|
|
685
|
+
props: comboboxInputProps,
|
|
710
686
|
setup(props) {
|
|
711
687
|
const rootContext = injectComboboxRootContext();
|
|
712
688
|
const { forwardRef, currentElement } = useForwardExpose();
|
|
@@ -748,7 +724,7 @@ const DestylerComboboxInput = defineComponent({
|
|
|
748
724
|
};
|
|
749
725
|
},
|
|
750
726
|
render() {
|
|
751
|
-
return h(
|
|
727
|
+
return h(Primitive, {
|
|
752
728
|
"ref": (el) => this.forwardRef(el),
|
|
753
729
|
"as": this.$props.as,
|
|
754
730
|
"asChild": this.$props.asChild,
|
|
@@ -788,41 +764,45 @@ const DestylerComboboxInput = defineComponent({
|
|
|
788
764
|
});
|
|
789
765
|
|
|
790
766
|
const COMBOBOX_SELECT = "combobox.select";
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
},
|
|
797
|
-
asChild: {
|
|
798
|
-
type: Boolean,
|
|
799
|
-
required: false,
|
|
800
|
-
default: false
|
|
801
|
-
},
|
|
767
|
+
const comboboxItemProps = {
|
|
768
|
+
...primitiveProps,
|
|
769
|
+
/**
|
|
770
|
+
* The value given as data when submitted with a `name`.
|
|
771
|
+
*/
|
|
802
772
|
value: {
|
|
803
773
|
type: [String, Number, Boolean, Object],
|
|
804
774
|
required: true
|
|
805
775
|
},
|
|
776
|
+
/**
|
|
777
|
+
* When true, prevents the user from interacting with the `item`.
|
|
778
|
+
*/
|
|
806
779
|
disabled: {
|
|
807
780
|
type: Boolean,
|
|
808
781
|
required: false
|
|
809
782
|
}
|
|
810
783
|
};
|
|
784
|
+
const comboboxItemEmits = {
|
|
785
|
+
/**
|
|
786
|
+
* Event handler called when the selecting item. <br>
|
|
787
|
+
* It can be prevented by calling `event.preventDefault`.
|
|
788
|
+
*/
|
|
789
|
+
select: (_ev) => true
|
|
790
|
+
};
|
|
811
791
|
const [injectComboboxItemContext, provideComboboxItemContext] = createContext("DestylerComboboxItem");
|
|
812
|
-
const
|
|
792
|
+
const ComboboxItem = defineComponent({
|
|
813
793
|
name: "DestylerComboboxItem",
|
|
814
|
-
props:
|
|
815
|
-
emits:
|
|
794
|
+
props: comboboxItemProps,
|
|
795
|
+
emits: comboboxItemEmits,
|
|
816
796
|
setup(props, { emit }) {
|
|
817
797
|
const { disabled } = toRefs(props);
|
|
818
798
|
const rootContext = injectComboboxRootContext();
|
|
819
799
|
injectComboboxGroupContext({ id: "", options: ref([]) });
|
|
820
800
|
const { forwardRef } = useForwardExpose();
|
|
821
801
|
const isSelected = computed(
|
|
822
|
-
() => rootContext.multiple.value && Array.isArray(rootContext.modelValue.value) ? rootContext.modelValue.value?.
|
|
802
|
+
() => rootContext.multiple.value && Array.isArray(rootContext.modelValue.value) ? rootContext.modelValue.value?.some((val) => isEqual(val, props.value)) : isEqual(rootContext.modelValue?.value, props.value)
|
|
823
803
|
);
|
|
824
804
|
const isFocused = computed(() => isEqual(rootContext.selectedValue.value, props.value));
|
|
825
|
-
const textId = useId();
|
|
805
|
+
const textId = useId(void 0, "destyler-combobox-item");
|
|
826
806
|
const isInOption = computed(() => rootContext.isUserInputted.value ? rootContext.searchTerm.value === "" || !!rootContext.filteredOptions.value.find((i) => isEqual(i, props.value)) : true);
|
|
827
807
|
async function handleSelect(ev) {
|
|
828
808
|
emit("select", ev);
|
|
@@ -862,9 +842,9 @@ const DestylerComboboxItem = defineComponent({
|
|
|
862
842
|
};
|
|
863
843
|
},
|
|
864
844
|
render() {
|
|
865
|
-
return h(
|
|
845
|
+
return h(CollectionItem, null, {
|
|
866
846
|
default: () => {
|
|
867
|
-
return h(
|
|
847
|
+
return h(Primitive, {
|
|
868
848
|
"ref": (el) => this.forwardRef(el),
|
|
869
849
|
"role": "option",
|
|
870
850
|
"tabindex": "-1",
|
|
@@ -892,21 +872,19 @@ const DestylerComboboxItem = defineComponent({
|
|
|
892
872
|
}
|
|
893
873
|
});
|
|
894
874
|
|
|
895
|
-
const
|
|
875
|
+
const comboboxItemIndicatorProps = {
|
|
876
|
+
...primitiveProps,
|
|
877
|
+
/**
|
|
878
|
+
* @default span
|
|
879
|
+
*/
|
|
896
880
|
as: {
|
|
897
|
-
|
|
898
|
-
required: false,
|
|
881
|
+
...primitiveProps.as,
|
|
899
882
|
default: "span"
|
|
900
|
-
},
|
|
901
|
-
asChild: {
|
|
902
|
-
type: Boolean,
|
|
903
|
-
required: false,
|
|
904
|
-
default: false
|
|
905
883
|
}
|
|
906
884
|
};
|
|
907
|
-
const
|
|
885
|
+
const ComboboxItemIndicator = defineComponent({
|
|
908
886
|
name: "DestylerComboboxItemIndicator",
|
|
909
|
-
props:
|
|
887
|
+
props: comboboxItemIndicatorProps,
|
|
910
888
|
setup() {
|
|
911
889
|
useForwardExpose();
|
|
912
890
|
const itemContext = injectComboboxItemContext();
|
|
@@ -916,7 +894,7 @@ const DestylerComboboxItemIndicator = defineComponent({
|
|
|
916
894
|
},
|
|
917
895
|
render() {
|
|
918
896
|
if (this.itemContext.isSelected.value) {
|
|
919
|
-
return h(
|
|
897
|
+
return h(Primitive, mergeProps(this.$props, {
|
|
920
898
|
"aria-hidden": ""
|
|
921
899
|
}), {
|
|
922
900
|
default: () => this.$slots.default?.()
|
|
@@ -925,25 +903,19 @@ const DestylerComboboxItemIndicator = defineComponent({
|
|
|
925
903
|
}
|
|
926
904
|
});
|
|
927
905
|
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
},
|
|
934
|
-
asChild: {
|
|
935
|
-
type: Boolean,
|
|
936
|
-
required: false,
|
|
937
|
-
default: false
|
|
938
|
-
},
|
|
906
|
+
const comboboxLabelProps = {
|
|
907
|
+
...primitiveProps,
|
|
908
|
+
/**
|
|
909
|
+
* The id of the element the label is associated with.
|
|
910
|
+
*/
|
|
939
911
|
for: {
|
|
940
912
|
type: String,
|
|
941
913
|
required: false
|
|
942
914
|
}
|
|
943
915
|
};
|
|
944
|
-
const
|
|
916
|
+
const ComboboxLabel = defineComponent({
|
|
945
917
|
name: "DestylerComboboxLabel",
|
|
946
|
-
props:
|
|
918
|
+
props: comboboxLabelProps,
|
|
947
919
|
setup() {
|
|
948
920
|
useForwardExpose();
|
|
949
921
|
const groupContext = injectComboboxGroupContext({ id: "" });
|
|
@@ -952,7 +924,7 @@ const DestylerComboboxLabel = defineComponent({
|
|
|
952
924
|
};
|
|
953
925
|
},
|
|
954
926
|
render() {
|
|
955
|
-
return withDirectives(h(
|
|
927
|
+
return withDirectives(h(Primitive, this.$props, {
|
|
956
928
|
default: () => this.$slots.default?.()
|
|
957
929
|
}), [
|
|
958
930
|
[BindOnceDirective, { id: this.groupContext.id }]
|
|
@@ -960,77 +932,55 @@ const DestylerComboboxLabel = defineComponent({
|
|
|
960
932
|
}
|
|
961
933
|
});
|
|
962
934
|
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
type: [String, Object],
|
|
966
|
-
required: false,
|
|
967
|
-
default: "body"
|
|
968
|
-
},
|
|
969
|
-
disabled: {
|
|
970
|
-
type: Boolean,
|
|
971
|
-
required: false,
|
|
972
|
-
default: false
|
|
973
|
-
},
|
|
974
|
-
forceMount: {
|
|
975
|
-
type: Boolean,
|
|
976
|
-
required: false,
|
|
977
|
-
default: false
|
|
978
|
-
}
|
|
935
|
+
const comboboxPortalProps = {
|
|
936
|
+
...teleportPrimitiveProps
|
|
979
937
|
};
|
|
980
|
-
const
|
|
938
|
+
const ComboboxPortal = defineComponent({
|
|
981
939
|
name: "DestylerComboboxPortal",
|
|
982
|
-
props:
|
|
940
|
+
props: comboboxPortalProps,
|
|
983
941
|
render() {
|
|
984
|
-
return h(
|
|
942
|
+
return h(TeleportPrimitive, this.$props, {
|
|
985
943
|
default: () => this.$slots.default?.()
|
|
986
944
|
});
|
|
987
945
|
}
|
|
988
946
|
});
|
|
989
947
|
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
type: [String, Object],
|
|
993
|
-
required: false,
|
|
994
|
-
default: "div"
|
|
995
|
-
},
|
|
996
|
-
asChild: {
|
|
997
|
-
type: Boolean,
|
|
998
|
-
required: false,
|
|
999
|
-
default: false
|
|
1000
|
-
}
|
|
948
|
+
const comboboxSeparatorProps = {
|
|
949
|
+
...primitiveProps
|
|
1001
950
|
};
|
|
1002
|
-
const
|
|
951
|
+
const ComboboxSeparator = defineComponent({
|
|
1003
952
|
name: "DestylerComboboxSeparator",
|
|
1004
|
-
props:
|
|
953
|
+
props: comboboxSeparatorProps,
|
|
1005
954
|
setup() {
|
|
1006
955
|
useForwardExpose();
|
|
1007
956
|
},
|
|
1008
957
|
render() {
|
|
1009
|
-
return h(
|
|
958
|
+
return h(Primitive, mergeProps(this.$props, {
|
|
1010
959
|
"aria-hidden": ""
|
|
1011
|
-
}));
|
|
960
|
+
}), () => this.$slots.default?.());
|
|
1012
961
|
}
|
|
1013
962
|
});
|
|
1014
963
|
|
|
1015
|
-
const
|
|
964
|
+
const comboboxTriggerProps = {
|
|
965
|
+
...primitiveProps,
|
|
966
|
+
/**
|
|
967
|
+
* @default button
|
|
968
|
+
*/
|
|
1016
969
|
as: {
|
|
1017
|
-
|
|
1018
|
-
required: false,
|
|
970
|
+
...primitiveProps.as,
|
|
1019
971
|
default: "button"
|
|
1020
972
|
},
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
default: false
|
|
1025
|
-
},
|
|
973
|
+
/**
|
|
974
|
+
* When `true`, prevents the user from interacting with item.
|
|
975
|
+
*/
|
|
1026
976
|
disabled: {
|
|
1027
977
|
type: Boolean,
|
|
1028
978
|
required: false
|
|
1029
979
|
}
|
|
1030
980
|
};
|
|
1031
|
-
const
|
|
981
|
+
const ComboboxTrigger = defineComponent({
|
|
1032
982
|
name: "DestylerComboboxTrigger",
|
|
1033
|
-
props:
|
|
983
|
+
props: comboboxTriggerProps,
|
|
1034
984
|
setup(props) {
|
|
1035
985
|
useForwardExpose();
|
|
1036
986
|
const rootContext = injectComboboxRootContext();
|
|
@@ -1041,7 +991,7 @@ const DestylerComboboxTrigger = defineComponent({
|
|
|
1041
991
|
};
|
|
1042
992
|
},
|
|
1043
993
|
render() {
|
|
1044
|
-
return h(
|
|
994
|
+
return h(Primitive, mergeProps(this.$props, {
|
|
1045
995
|
"type": this.$props.as === "button" ? "button" : void 0,
|
|
1046
996
|
"tabindex": "-1",
|
|
1047
997
|
"aria-label": "Show popup",
|
|
@@ -1061,21 +1011,19 @@ const DestylerComboboxTrigger = defineComponent({
|
|
|
1061
1011
|
}
|
|
1062
1012
|
});
|
|
1063
1013
|
|
|
1064
|
-
const
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
required: false,
|
|
1073
|
-
default: false
|
|
1014
|
+
const comboboxViewportProps = {
|
|
1015
|
+
...primitiveProps,
|
|
1016
|
+
/**
|
|
1017
|
+
* Will add `nonce` attribute to the style tag which can be used by Content Security Policy.
|
|
1018
|
+
*/
|
|
1019
|
+
nonce: {
|
|
1020
|
+
type: String,
|
|
1021
|
+
required: false
|
|
1074
1022
|
}
|
|
1075
1023
|
};
|
|
1076
|
-
const
|
|
1024
|
+
const ComboboxViewport = defineComponent({
|
|
1077
1025
|
name: "DestylerComboboxViewport",
|
|
1078
|
-
props:
|
|
1026
|
+
props: comboboxViewportProps,
|
|
1079
1027
|
inheritAttrs: false,
|
|
1080
1028
|
setup() {
|
|
1081
1029
|
const { forwardRef } = useForwardExpose();
|
|
@@ -1085,7 +1033,7 @@ const DestylerComboboxViewport = defineComponent({
|
|
|
1085
1033
|
},
|
|
1086
1034
|
render() {
|
|
1087
1035
|
return [
|
|
1088
|
-
h(
|
|
1036
|
+
h(Primitive, mergeProps(this.$attrs, this.$props, {
|
|
1089
1037
|
"ref": (el) => this.forwardRef(el),
|
|
1090
1038
|
"data-destyler-combobox-viewport": "",
|
|
1091
1039
|
"role": "presentation",
|
|
@@ -1095,8 +1043,9 @@ const DestylerComboboxViewport = defineComponent({
|
|
|
1095
1043
|
overflow: "auto"
|
|
1096
1044
|
}
|
|
1097
1045
|
}), () => this.$slots.default?.()),
|
|
1098
|
-
h(
|
|
1099
|
-
as: "style"
|
|
1046
|
+
h(Primitive, {
|
|
1047
|
+
as: "style",
|
|
1048
|
+
nonce: this.$props.nonce
|
|
1100
1049
|
}, () => `
|
|
1101
1050
|
/* Hide scrollbars cross-browser and enable momentum scroll for touch devices */
|
|
1102
1051
|
[data-destyler-combobox-viewport] {
|
|
@@ -1112,4 +1061,4 @@ const DestylerComboboxViewport = defineComponent({
|
|
|
1112
1061
|
}
|
|
1113
1062
|
});
|
|
1114
1063
|
|
|
1115
|
-
export {
|
|
1064
|
+
export { ComboboxAnchor, ComboboxArrow, ComboboxCancel, ComboboxContent, ComboboxContentImpl, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxPortal, ComboboxRoot, ComboboxSeparator, ComboboxTrigger, ComboboxViewport, comboboxAnchorProps, comboboxArrowProps, comboboxCancelProps, comboboxContentEmits, comboboxContentImplEmits, comboboxContentImplProps, comboboxContentProps, comboboxEmptyProps, comboboxGroupProps, comboboxInputProps, comboboxItemEmits, comboboxItemIndicatorProps, comboboxItemProps, comboboxLabelProps, comboboxPortalProps, comboboxRootEmits, comboboxRootProps, comboboxSeparatorProps, comboboxTriggerProps, comboboxViewportProps };
|