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