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