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