@danielgindi/selectbox 2.0.65 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,26 @@
1
1
  $spinner-transition-timing-function: cubic-bezier(1.0, 0.5, 0.8, 1.0);
2
2
  $spinner-transition-duration: .15s;
3
3
 
4
+ // Layout mirrors automatically through logical properties (`*-inline-start` / `*-inline-end`),
5
+ // which follow the element's computed `direction`. That comes from the `direction` option
6
+ // (`.selectbox__rtl` / `.selectbox__ltr`), or is inherited from the document.
7
+ //
8
+ // These mixins are only for the few things that have no logical equivalent (e.g. transforms).
9
+ // `:dir()` follows the nearest `dir` attribute; `:where()` keeps the specificity low, and its
10
+ // forgiving parsing just skips the `:dir()` branch in browsers that don't support it.
11
+ $selectbox-rtl-condition: ':where(.selectbox__rtl, :dir(rtl):not(.selectbox__ltr))';
12
+
13
+ /// Applies to the `.selectbox` element itself, when it is RTL.
4
14
  @mixin currentIsRtl {
5
- &.selectbox__rtl, [dir=rtl] &:not(.selectbox__ltr) {
15
+ &#{$selectbox-rtl-condition} {
6
16
  @content;
7
17
  }
8
18
  }
9
19
 
10
- @mixin insideRtlSelectBox {
11
- .selectbox__rtl &, [dir=rtl] .selectbox:not(.selectbox__ltr) & {
20
+ /// Applies to an element inside an RTL `.selectbox`.
21
+ /// @param {String} $modifiers - extra classes the `.selectbox` must have, e.g. `'.selectbox__open_list'`
22
+ @mixin insideRtlSelectBox($modifiers: '') {
23
+ .selectbox#{$modifiers}#{$selectbox-rtl-condition} & {
12
24
  @content;
13
25
  }
14
26
  }
@@ -37,9 +49,29 @@ $spinner-transition-duration: .15s;
37
49
  --selectbox-multi-item-bottom-padding: 0.2em;
38
50
  --selectbox-multi-search-top-offset: 0px;
39
51
 
52
+ --selectbox-text-color: #000;
53
+ --selectbox-background-color: #fff;
54
+ --selectbox-border-color: #aaa;
55
+ --selectbox-disabled-background-color: #eee;
56
+ --selectbox-disabled-border-color: #aaa;
57
+ --selectbox-focus-border-color: #66afe9;
58
+ --selectbox-focus-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
59
+ --selectbox-open-indicator-color: #9d9d9d;
60
+ --selectbox-clear-color: buttontext;
61
+ --selectbox-clear-focus-color: red;
62
+ --selectbox-spinner-color: rgba(60, 60, 60, 0.45);
63
+ --selectbox-spinner-track-color: rgba(100, 100, 100, 0.1);
64
+ --selectbox-multi-item-background-color: #e4e4e4;
65
+ --selectbox-multi-item-border-color: #aaa;
66
+ --selectbox-multi-item-focus-background-color: #ccc;
67
+ --selectbox-multi-item-remove-color: #999;
68
+
69
+ // A row of [content][controls]: the controls take their own room, so nothing has to reserve it.
70
+ // For a block-level box, override with `display: flex` (not `block`).
40
71
  position: relative;
41
72
  box-sizing: border-box;
42
- display: inline-block;
73
+ display: inline-flex;
74
+ align-items: center;
43
75
  cursor: default;
44
76
  outline: 0;
45
77
  line-height: 1.2;
@@ -47,22 +79,26 @@ $spinner-transition-duration: .15s;
47
79
  user-select: none;
48
80
  -webkit-user-select: none;
49
81
 
50
- color: #000;
51
- background-color: #fff;
82
+ color: var(--selectbox-text-color);
83
+ background-color: var(--selectbox-background-color);
52
84
  border-radius: var(--selectbox-border-radius);
53
- border: solid #aaa 1px;
85
+ border: solid var(--selectbox-border-color) 1px;
54
86
 
55
87
  &.selectbox__rtl {
56
88
  direction: rtl;
57
89
  }
58
90
 
91
+ &.selectbox__ltr {
92
+ direction: ltr;
93
+ }
94
+
59
95
  &.selectbox__searchable {
60
96
  cursor: text;
61
97
  }
62
98
 
63
99
  &[aria-disabled=true] {
64
- border: solid #aaa 1px;
65
- background-color: #eee;
100
+ border: solid var(--selectbox-disabled-border-color) 1px;
101
+ background-color: var(--selectbox-disabled-background-color);
66
102
  cursor: default;
67
103
 
68
104
  * {
@@ -88,69 +124,6 @@ $spinner-transition-duration: .15s;
88
124
  border-bottom-right-radius: 0;
89
125
  }
90
126
 
91
- &.selectbox__has_open_indicator:not(.selectbox__has_clear):not(.selectbox__has_spinner) {
92
- padding-right: var(--selectbox-open-indicator-width);
93
-
94
- @include currentIsRtl {
95
- padding-right: 0;
96
- padding-left: var(--selectbox-open-indicator-width);
97
- }
98
- }
99
-
100
- &.selectbox__has_clear:not(.selectbox__has_open_indicator):not(.selectbox__has_spinner) {
101
- padding-right: var(--selectbox-clear-width);
102
-
103
- @include currentIsRtl {
104
- padding-right: 0;
105
- padding-left: var(--selectbox-clear-width);
106
- }
107
- }
108
-
109
- &.selectbox__has_spinner:not(.selectbox__has_open_indicator):not(.selectbox__has_clear) {
110
- padding-right: var(--selectbox-spinner-width);
111
-
112
- @include currentIsRtl {
113
- padding-right: 0;
114
- padding-left: var(--selectbox-clear-width);
115
- }
116
- }
117
-
118
- &.selectbox__has_open_indicator.selectbox__has_spinner:not(.selectbox__has_clear) {
119
- padding-right: calc(var(--selectbox-open-indicator-width) + var(--selectbox-spinner-width));
120
-
121
- @include currentIsRtl {
122
- padding-right: 0;
123
- padding-left: calc(var(--selectbox-open-indicator-width) + var(--selectbox-spinner-width));
124
- }
125
- }
126
-
127
- &.selectbox__has_open_indicator.selectbox__has_clear:not(.selectbox__has_spinner) {
128
- padding-right: calc(var(--selectbox-open-indicator-width) + var(--selectbox-clear-width));
129
-
130
- @include currentIsRtl {
131
- padding-right: 0;
132
- padding-left: calc(var(--selectbox-open-indicator-width) + var(--selectbox-clear-width));
133
- }
134
- }
135
-
136
- &.selectbox__has_clear.selectbox__has_spinner:not(.selectbox__has_open_indicator) {
137
- padding-right: calc(var(--selectbox-clear-width) + var(--selectbox-spinner-width));
138
-
139
- @include currentIsRtl {
140
- padding-right: 0;
141
- padding-left: calc(var(--selectbox-clear-width) + var(--selectbox-spinner-width));
142
- }
143
- }
144
-
145
- &.selectbox__has_open_indicator.selectbox__has_clear.selectbox__has_spinner {
146
- padding-right: calc(var(--selectbox-open-indicator-width) + var(--selectbox-clear-width) + var(--selectbox-spinner-width));
147
-
148
- @include currentIsRtl {
149
- padding-right: 0;
150
- padding-left: calc(var(--selectbox-open-indicator-width) + var(--selectbox-clear-width) + var(--selectbox-spinner-width));
151
- }
152
- }
153
-
154
127
  &.selectbox__multi {
155
128
  padding-top: var(--selectbox-multi-vert-padding);
156
129
  padding-bottom: var(--selectbox-multi-vert-padding);
@@ -158,49 +131,72 @@ $spinner-transition-duration: .15s;
158
131
  }
159
132
 
160
133
  .selectbox__focus {
161
- border-color: #66afe9;
134
+ border-color: var(--selectbox-focus-border-color);
162
135
  outline: 0;
163
- $shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
164
- box-shadow: $shadow;
136
+ box-shadow: var(--selectbox-focus-shadow);
165
137
  }
166
138
 
167
139
  .selectbox__list {
168
140
  box-sizing: border-box;
169
141
  list-style: none none;
170
- display: inline-block;
171
- vertical-align: top;
142
+ display: flex;
143
+ flex-wrap: wrap;
144
+ align-items: flex-start;
145
+ gap: var(--selectbox-multi-item-vert-spacing) var(--selectbox-multi-item-horz-spacing);
172
146
 
173
- width: 100%;
174
- margin: calc(0px - var(--selectbox-multi-item-vert-spacing)) 0 0;
147
+ flex: 1 1 auto;
148
+ min-width: 0;
149
+ margin: 0;
175
150
  padding: 0 var(--selectbox-horz-padding);
176
151
 
177
152
  text-overflow: ellipsis;
178
153
  white-space: nowrap;
154
+ }
179
155
 
180
- @include insideRtlSelectBox {
181
- &::before {
182
- float: left;
183
- }
156
+ // Each control takes at least its `--*-width`, and sits `--*-spacing` away from the inline-end of that room.
157
+ // Above the content, as the single-mode search field is absolutely positioned and may run under them.
158
+ // Zero height: the controls never make the box taller, they overflow evenly around its vertical center.
159
+ .selectbox__controls {
160
+ flex: none;
161
+ display: flex;
162
+ align-items: center;
163
+ height: 0;
164
+ position: relative;
165
+ z-index: 2;
166
+
167
+ &:empty {
168
+ display: none;
184
169
  }
185
170
  }
186
171
 
172
+ .selectbox__open_indicator,
173
+ .selectbox__clear,
174
+ .selectbox__spinner {
175
+ flex: none;
176
+ box-sizing: border-box;
177
+ }
178
+
179
+ .selectbox__clear,
180
+ .selectbox__spinner {
181
+ display: flex;
182
+ justify-content: flex-end;
183
+ }
184
+
187
185
  .selectbox__open_indicator {
188
- position: absolute;
189
- right: var(--selectbox-open-indicator-spacing);
190
- top: 50%;
191
- transform: translateY(-50%);
192
- z-index: 2;
186
+ // The arrow is drawn in a 1em box: the rest of the width is split around it
187
+ padding-inline-start: max(0px, calc(var(--selectbox-open-indicator-width) - 1em - var(--selectbox-open-indicator-spacing)));
188
+ margin-inline-end: var(--selectbox-open-indicator-spacing);
193
189
  font-size: 1em;
190
+ box-sizing: content-box;
194
191
  width: 1em;
195
192
  height: 0.5em;
196
193
  overflow: hidden;
197
- direction: ltr;
198
194
  text-align: left;
199
195
  cursor: pointer;
200
196
 
201
197
  &::before {
202
198
  border-style: solid;
203
- border-color: #9d9d9d;
199
+ border-color: var(--selectbox-open-indicator-color);
204
200
  border-width: 1.5px 1.5px 0 0;
205
201
  content: '';
206
202
  display: inline-block;
@@ -208,7 +204,9 @@ $spinner-transition-duration: .15s;
208
204
  left: 0.2em;
209
205
  position: relative;
210
206
  top: -0.18em;
211
- transform: rotate(135deg);
207
+ // Keep the same transform functions in every state: then the angles interpolate as written,
208
+ // instead of through a matrix (where the browser picks the turn direction itself).
209
+ transform: translateY(0) rotate(135deg);
212
210
  vertical-align: top;
213
211
  width: 0.45em;
214
212
  transition: transform 150ms cubic-bezier(1, -0.115, 0.975, 0.855);
@@ -218,16 +216,8 @@ $spinner-transition-duration: .15s;
218
216
  transform: translateY(50%) rotate(-45deg);
219
217
  }
220
218
 
221
- .selectbox__rtl &, [dir=rtl] .selectbox:not(.selectbox__ltr) & {
222
- right: auto;
223
- left: var(--selectbox-open-indicator-spacing);
224
-
225
- &::before {
226
- transform: rotate(-225deg);
227
- }
228
- }
229
-
230
- .selectbox__rtl.selectbox__open_list &, [dir=rtl] .selectbox.selectbox__open_list:not(.selectbox__ltr) & {
219
+ // Same end pose as LTR (315deg = -45deg), reached by turning the mirrored way: 135deg -> 315deg
220
+ @include insideRtlSelectBox('.selectbox__open_list') {
231
221
  &::before {
232
222
  transform: translateY(50%) rotate(315deg);
233
223
  }
@@ -235,11 +225,8 @@ $spinner-transition-duration: .15s;
235
225
  }
236
226
 
237
227
  .selectbox__clear {
238
- position: absolute;
239
- right: var(--selectbox-clear-spacing);
240
- top: 50%;
241
- transform: translateY(-50%);
242
- z-index: 2;
228
+ min-width: var(--selectbox-clear-width);
229
+ padding-inline-end: var(--selectbox-clear-spacing);
243
230
 
244
231
  > button {
245
232
  box-sizing: border-box;
@@ -254,6 +241,7 @@ $spinner-transition-duration: .15s;
254
241
  padding: 0;
255
242
  border: 0;
256
243
  background: none;
244
+ color: var(--selectbox-clear-color);
257
245
 
258
246
  &:before {
259
247
  content: '×';
@@ -261,36 +249,19 @@ $spinner-transition-duration: .15s;
261
249
 
262
250
  &:focus {
263
251
  outline: none;
264
- color: red;
252
+ color: var(--selectbox-clear-focus-color);
265
253
  }
266
254
  }
267
255
 
268
- @include insideRtlSelectBox {
269
- right: auto;
270
- left: var(--selectbox-clear-spacing);
271
- }
272
-
273
- .selectbox__has_open_indicator.selectbox__has_clear & {
274
- right: calc(var(--selectbox-clear-spacing) + var(--selectbox-open-indicator-width));
275
- }
276
-
277
- .selectbox__has_open_indicator.selectbox__has_clear.selectbox__rtl &,
278
- [dir=rtl] .selectbox.selectbox__has_open_indicator.selectbox__has_clear:not(.selectbox__ltr) & {
279
- right: auto;
280
- left: calc(var(--selectbox-clear-spacing) + var(--selectbox-open-indicator-width));
281
- }
282
-
283
- .selectbox[aria-disabled=true] > &, .selectbox[aria-readonly=true] > & {
256
+ .selectbox[aria-disabled=true] > .selectbox__controls > &,
257
+ .selectbox[aria-readonly=true] > .selectbox__controls > & {
284
258
  display: none;
285
259
  }
286
260
  }
287
261
 
288
262
  .selectbox__spinner {
289
- position: absolute;
290
- right: var(--selectbox-spinner-spacing);
291
- top: 50%;
292
- transform: translateY(-50%);
293
- z-index: 2;
263
+ min-width: var(--selectbox-spinner-width);
264
+ padding-inline-end: var(--selectbox-spinner-spacing);
294
265
 
295
266
  &::before {
296
267
  content: '';
@@ -300,64 +271,28 @@ $spinner-transition-duration: .15s;
300
271
  height: 1em;
301
272
  text-indent: -9999em;
302
273
  overflow: hidden;
303
- border-top: 0.3em solid rgba(100, 100, 100, 0.1);
304
- border-right: 0.3em solid rgba(100, 100, 100, 0.1);
305
- border-bottom: 0.3em solid rgba(100, 100, 100, 0.1);
306
- border-left: 0.3em solid rgba(60, 60, 60, 0.45);
274
+ border-top: 0.3em solid var(--selectbox-spinner-track-color);
275
+ border-right: 0.3em solid var(--selectbox-spinner-track-color);
276
+ border-bottom: 0.3em solid var(--selectbox-spinner-track-color);
277
+ border-left: 0.3em solid var(--selectbox-spinner-color);
307
278
  border-radius: 50%;
308
279
  transform: translateZ(0);
309
280
  animation: selectbox__spinner_anim 1.1s infinite linear;
310
281
  transition: opacity .1s;
311
282
  }
312
-
313
- @include insideRtlSelectBox {
314
- right: auto;
315
- left: var(--selectbox-spinner-spacing);
316
- }
317
-
318
- .selectbox__has_spinner.selectbox__has_open_indicator:not(.selectbox__has_clear) & {
319
- right: calc(var(--selectbox-spinner-spacing) + var(--selectbox-open-indicator-width));
320
- }
321
-
322
- .selectbox__has_spinner.selectbox__has_clear:not(.selectbox__has_open_indicator) & {
323
- right: calc(var(--selectbox-spinner-spacing) + var(--selectbox-clear-width));
324
- }
325
-
326
- .selectbox__has_spinner.selectbox__has_open_indicator.selectbox__has_clear & {
327
- right: calc(var(--selectbox-spinner-spacing) + var(--selectbox-clear-width) + var(--selectbox-open-indicator-width) + var(--selectbox-spinner-width));
328
- }
329
-
330
- .selectbox__has_spinner.selectbox__has_open_indicator:not(.selectbox__has_clear).selectbox__rtl &,
331
- [dir=rtl] .selectbox.selectbox__has_spinner.selectbox__has_open_indicator:not(.selectbox__has_clear):not(.selectbox__ltr) & {
332
- right: auto;
333
- left: calc(var(--selectbox-spinner-spacing) + var(--selectbox-open-indicator-width));
334
- }
335
-
336
- .selectbox__has_spinner.selectbox__has_clear:not(.selectbox__has_open_indicator).selectbox__rtl &,
337
- [dir=rtl] .selectbox.selectbox__has_spinner.selectbox__has_clear:not(.selectbox__has_open_indicator):not(.selectbox__ltr) & {
338
- right: auto;
339
- left: calc(var(--selectbox-spinner-spacing) + var(--selectbox-clear-width));
340
- }
341
-
342
- .selectbox__has_spinner.selectbox__has_clear.selectbox__has_open_indicator.selectbox__rtl &,
343
- [dir=rtl] .selectbox.selectbox__has_spinner.selectbox__has_clearselectbox__has_open_indicator:not(.selectbox__ltr) & {
344
- right: auto;
345
- left: calc(var(--selectbox-spinner-spacing) + var(--selectbox-clear-width) + var(--selectbox-open-indicator-width));
346
- }
347
283
  }
348
284
 
349
285
  .selectbox__item {
350
286
  box-sizing: border-box;
351
- float: left;
352
287
  cursor: default;
353
288
 
354
- background-color: #e4e4e4;
355
- border: var(--selectbox-multi-item-border-width) solid #aaa;
289
+ background-color: var(--selectbox-multi-item-background-color);
290
+ border: var(--selectbox-multi-item-border-width) solid var(--selectbox-multi-item-border-color);
356
291
  border-radius: var(--selectbox-multi-item-border-radius);
357
292
 
358
- margin-left: 0;
359
- margin-right: var(--selectbox-multi-item-horz-spacing);
360
- margin-top: var(--selectbox-multi-item-vert-spacing);
293
+ overflow: hidden;
294
+ text-overflow: ellipsis;
295
+ margin: 0;
361
296
  padding: var(--selectbox-multi-item-top-padding) var(--selectbox-multi-item-horz-padding) var(--selectbox-multi-item-bottom-padding);
362
297
  line-height: inherit;
363
298
 
@@ -366,19 +301,13 @@ $spinner-transition-duration: .15s;
366
301
  }
367
302
 
368
303
  &:focus {
369
- background-color: #ccc;
304
+ background-color: var(--selectbox-multi-item-focus-background-color);
370
305
  outline: 0;
371
306
  }
372
-
373
- @include insideRtlSelectBox {
374
- float: right;
375
- margin-left: var(--selectbox-multi-item-horz-spacing);
376
- margin-right: 0;
377
- }
378
307
  }
379
308
 
380
309
  .selectbox__item_remove {
381
- color: #999;
310
+ color: var(--selectbox-multi-item-remove-color);
382
311
  cursor: pointer;
383
312
  display: inline-block;
384
313
  font-weight: bold;
@@ -390,28 +319,18 @@ $spinner-transition-duration: .15s;
390
319
  }
391
320
 
392
321
  &:first-child {
393
- margin-right: var(--selectbox-multi-item-remove-spacing);
322
+ margin-inline-end: var(--selectbox-multi-item-remove-spacing);
394
323
  }
395
324
 
396
325
  &:last-child {
397
- margin-left: var(--selectbox-multi-item-remove-spacing);
398
- }
399
-
400
- @include insideRtlSelectBox {
401
- &:first-child {
402
- margin-left: var(--selectbox-multi-item-remove-spacing);
403
- margin-right: 0;
404
- }
405
-
406
- &:last-child {
407
- margin-right: var(--selectbox-multi-item-remove-spacing);
408
- margin-left: 0;
409
- }
326
+ margin-inline-start: var(--selectbox-multi-item-remove-spacing);
410
327
  }
411
328
  }
412
329
 
413
330
  .selectbox__single_wrapper {
414
331
  position: relative;
332
+ flex: 1 1 auto;
333
+ min-width: 0;
415
334
  min-height: 1em;
416
335
  max-width: 100%;
417
336
  margin: 0;
@@ -438,30 +357,23 @@ $spinner-transition-duration: .15s;
438
357
  max-width: 100%;
439
358
 
440
359
  .selectbox__multi & {
441
- float: left;
442
- margin-top: calc(var(--selectbox-multi-item-vert-spacing) +
443
- var(--selectbox-multi-item-border-width) +
360
+ flex: 0 1 auto;
361
+ min-width: 0;
362
+ margin-top: calc(var(--selectbox-multi-item-border-width) +
444
363
  var(--selectbox-multi-item-top-padding) +
445
364
  var(--selectbox-multi-search-top-offset));
365
+
366
+ &:first-child {
367
+ flex-grow: 1;
368
+ }
446
369
  }
447
370
 
448
371
  .selectbox__single & {
449
372
  position: absolute;
450
373
  z-index: 1;
451
- left: 0;
374
+ inset-inline-start: 0;
452
375
  top: var(--selectbox-single-top-padding);
453
376
  }
454
-
455
- .selectbox__multi.selectbox__rtl &,
456
- [dir=rtl] .selectbox.selectbox__multi:not(.selectbox__ltr) & {
457
- float: right;
458
- }
459
-
460
- .selectbox__single.selectbox__rtl &,
461
- [dir=rtl] .selectbox.selectbox__single:not(.selectbox__ltr) & {
462
- right: 0;
463
- left: auto;
464
- }
465
377
  }
466
378
 
467
379
  input.selectbox__search_field {
@@ -522,6 +434,10 @@ input.selectbox__search_field {
522
434
  padding: 0;
523
435
  }
524
436
 
437
+ .selectbox__multi .selectbox__search_wrapper:first-child input.selectbox__search_field {
438
+ width: 100%;
439
+ }
440
+
525
441
  .selectbox.has_droplist_above {
526
442
  border-top-left-radius: 0;
527
443
  border-top-right-radius: 0;
@@ -0,0 +1,29 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { defineConfig } from 'vite';
3
+ import vue from '@vitejs/plugin-vue';
4
+
5
+ const src = path => fileURLToPath(new URL(path, import.meta.url));
6
+
7
+ // Serves/builds the docs & demo page in `example/`
8
+ export default defineConfig({
9
+ root: 'example',
10
+ base: './',
11
+ plugins: [vue()],
12
+ resolve: {
13
+ // Demos import the package by name, exactly like consumers do
14
+ alias: [
15
+ { find: /^@danielgindi\/selectbox\/vue$/, replacement: src('./src/vue/index.ts') },
16
+ { find: /^@danielgindi\/selectbox$/, replacement: src('./src/lib/index.ts') },
17
+ ],
18
+ },
19
+ optimizeDeps: {
20
+ include: ['fast-deep-equal'],
21
+ },
22
+ build: {
23
+ outDir: '../dist-docs',
24
+ emptyOutDir: true,
25
+ },
26
+ server: {
27
+ open: true,
28
+ },
29
+ });
package/vue/DropList.vue CHANGED
@@ -6,8 +6,7 @@
6
6
  import { DropList, DropListDefaultOptions as DefaultOptions } from '@danielgindi/selectbox';
7
7
  import DomEventsSink from '@danielgindi/dom-utils/lib/DomEventsSink';
8
8
  import { createSlotBasedRenderFunc, createSlotBasedUnrenderFunc } from './utils/slots.js';
9
- import { defineComponent, version } from 'vue';
10
- const isVue3 = version > '3.';
9
+ import { defineComponent } from 'vue';
11
10
  export const PropTypes = {
12
11
  baseClassName: {
13
12
  type: String
@@ -140,7 +139,7 @@ export const PropTypes = {
140
139
  type: Array,
141
140
  default: ()=>[]
142
141
  },
143
- [isVue3 ? 'modelValue' : 'value']: {
142
+ modelValue: {
144
143
  type: [
145
144
  Number,
146
145
  String,
@@ -154,9 +153,23 @@ export const PropTypes = {
154
153
  unrenderItem: {
155
154
  type: Function
156
155
  },
156
+ renderNoResultsItem: {
157
+ type: Function
158
+ },
159
+ unrenderNoResultsItem: {
160
+ type: Function
161
+ },
157
162
  positionOptions: {
158
163
  type: Object
159
164
  },
165
+ zIndex: {
166
+ type: [
167
+ Number,
168
+ String,
169
+ Function
170
+ ],
171
+ default: undefined
172
+ },
160
173
  autoRelayoutOnItemsChange: {
161
174
  type: Boolean,
162
175
  default: true
@@ -254,6 +267,9 @@ export default defineComponent({
254
267
  if (typeof this.filterFn === 'function') {
255
268
  opts.filterFn = this.filterFn;
256
269
  }
270
+ if (this.zIndex !== undefined) {
271
+ opts.zIndex = this.zIndex;
272
+ }
257
273
  opts.searchPlaceholder = this.searchPlaceholder;
258
274
  opts.renderItem = this.renderItem ?? createSlotBasedRenderFunc(this, 'item');
259
275
  opts.unrenderItem = this.unrenderItem;
@@ -263,8 +279,8 @@ export default defineComponent({
263
279
  opts.unrenderItem = (item, el)=>fn(el);
264
280
  }
265
281
  }
266
- opts.renderNoResultsItem = this.computedRenderNoResultsItem ?? createSlotBasedRenderFunc(this, 'no-results-item');
267
- opts.unrenderNoResultsItem = this.computedUnrenderNoResultsItem;
282
+ opts.renderNoResultsItem = this.renderNoResultsItem ?? createSlotBasedRenderFunc(this, 'no-results-item');
283
+ opts.unrenderNoResultsItem = this.unrenderNoResultsItem;
268
284
  if (!opts.unrenderNoResultsItem) {
269
285
  let fn = createSlotBasedUnrenderFunc(this, 'no-results-item');
270
286
  if (fn) {
@@ -288,7 +304,7 @@ export default defineComponent({
288
304
  if (this.autoRelayoutOnItemsChange && instance.isVisible()) instance.relayout();
289
305
  }
290
306
  },
291
- [isVue3 ? 'modelValue' : 'value'] (value, old) {
307
+ modelValue (value, old) {
292
308
  if (Array.isArray(value) && Array.isArray(old) && value.length === old && value.every((v, i)=>old[i] === v)) return;
293
309
  if (this.nonReactive.instance) {
294
310
  if (this.multi) {
@@ -327,6 +343,9 @@ export default defineComponent({
327
343
  onError () {
328
344
  if (this.nonReactive.instance) this.nonReactive.instance.setOnError(this.onError);
329
345
  },
346
+ zIndex (value) {
347
+ if (this.nonReactive.instance) this.nonReactive.instance.setZIndex(value === undefined ? DefaultOptions.zIndex : value);
348
+ },
330
349
  renderItem () {
331
350
  this._recreateList();
332
351
  },
@@ -360,11 +379,6 @@ export default defineComponent({
360
379
  this.relayout();
361
380
  }
362
381
  },
363
- ...isVue3 ? {} : {
364
- $scopedSlots () {
365
- this._recreateList();
366
- }
367
- },
368
382
  $slots () {
369
383
  this._recreateList();
370
384
  }
@@ -372,13 +386,13 @@ export default defineComponent({
372
386
  mounted () {
373
387
  this._createList();
374
388
  },
375
- [isVue3 ? 'unmounted' : 'destroyed'] () {
389
+ unmounted () {
376
390
  this._destroyList();
377
391
  },
378
392
  methods: {
379
393
  _handleListEvents (event, data) {
380
- if (event === 'select' && !this.multi || event === 'check' && !event.isCheckingGroup || event === 'groupcheck') {
381
- this.$emit(isVue3 ? 'update:modelValue' : 'input', event === 'select' ? data.value : this.nonReactive.instance.getCheckedValues(false));
394
+ if (event === 'select' && !this.multi || event === 'check' && !data?.isCheckingGroup && !data?.isGroup || event === 'groupcheck') {
395
+ this.$emit('update:modelValue', event === 'select' ? data.value : this.nonReactive.instance.getCheckedValues(false));
382
396
  }
383
397
  if (event === 'hide') {
384
398
  this._clearAutoRelayout();
@@ -420,7 +434,7 @@ export default defineComponent({
420
434
  this.$emit('keydown', evt);
421
435
  }, true);
422
436
  if (Array.isArray(this.items)) list.addItems(this.items);
423
- const modelValue = isVue3 ? this.modelValue : this.value;
437
+ const modelValue = this.modelValue;
424
438
  if (this.multi) {
425
439
  list.setCheckedValues(Array.isArray(modelValue) ? modelValue : modelValue == null ? [] : [
426
440
  modelValue