@@ -151,15 +151,15 @@ const MultiselectButtons = function (selectEl, params) {
151
151
selectEl . parentNode . appendChild ( span ) ;
152
152
153
153
// hide the original label/hint and create new ones for the new combobox
154
- const selectLabel = document . querySelector ( ` label[for=${ selectEl . id } ]` ) ;
154
+ const selectLabel = document . querySelector ( " label[for=" . concat ( selectEl . id , "]" ) ) ;
155
155
selectLabel . hidden = true ;
156
- const selectHint = document . querySelector ( ` #hint-${ selectEl . id } ` ) ;
156
+ const selectHint = document . querySelector ( " #hint-" . concat ( selectEl . id ) ) ;
157
157
if ( selectHint ) {
158
158
selectHint . hidden = true ;
159
159
}
160
160
const div = document . createElement ( 'div' ) ;
161
161
div . classList . add ( 'combo' ) ;
162
- div . id = ` ${ selectEl . id } -js-multi-buttons` ;
162
+ div . id = "" . concat ( selectEl . id , " -js-multi-buttons" ) ;
163
163
const divComboBox = document . createElement ( 'div' ) ;
164
164
divComboBox . setAttribute ( 'role' , 'combobox' ) ;
165
165
divComboBox . setAttribute ( 'aria-haspopup' , 'listbox' ) ;
@@ -172,7 +172,7 @@ const MultiselectButtons = function (selectEl, params) {
172
172
input . setAttribute ( 'aria-controls' , baseId + '-listbox' ) ;
173
173
input . id = baseId + "-input" ;
174
174
if ( selectHint ) {
175
- input . setAttribute ( 'aria-describedby' , ` hint-${ input . id } ` ) ;
175
+ input . setAttribute ( 'aria-describedby' , " hint-" . concat ( input . id ) ) ;
176
176
}
177
177
input . classList . add ( 'combo-input' ) ;
178
178
input . setAttribute ( 'autocomplete' , 'off' ) ;
@@ -191,7 +191,7 @@ const MultiselectButtons = function (selectEl, params) {
191
191
const hintComboBox = selectHint ? selectHint . cloneNode ( true ) : null ;
192
192
if ( selectHint ) {
193
193
hintComboBox . hidden = false ;
194
- hintComboBox . id = ` hint-${ input . id } ` ;
194
+ hintComboBox . id = " hint-" . concat ( input . id ) ;
195
195
}
196
196
const ulCombo = document . createElement ( 'ul' ) ;
197
197
ulCombo . setAttribute ( 'role' , 'listbox' ) ;
@@ -248,12 +248,12 @@ const MultiselectButtons = function (selectEl, params) {
248
248
const listItem = document . createElement ( 'li' ) ;
249
249
buttonEl . className = 'remove-option' ;
250
250
buttonEl . type = 'button' ;
251
- buttonEl . id = ` ${ this . idBase } -remove-${ index } ` ;
251
+ buttonEl . id = "" . concat ( this . idBase , " -remove-" ) . concat ( index ) ;
252
252
buttonEl . dataset . value = option . value ;
253
253
buttonEl . addEventListener ( 'click' , ( ) => {
254
254
this . removeOption ( option ) ;
255
255
} ) ;
256
- buttonEl . innerHTML = ` <span class="visuallyhidden">Remove </span>${ option . text } ` ;
256
+ buttonEl . innerHTML = " <span class=\ "visuallyhidden\ ">Remove </span>" . concat ( option . text , " " ) ;
257
257
listItem . appendChild ( buttonEl ) ;
258
258
this . selectedEl . appendChild ( listItem ) ;
259
259
} else {
@@ -281,7 +281,7 @@ MultiselectButtons.prototype.init = function () {
281
281
hint = document . createElement ( 'li' ) ;
282
282
hint . setAttribute ( 'role' , 'alert' ) ;
283
283
}
284
- hint . innerText = ` Please enter ${ this . minInput } or more characters` ;
284
+ hint . innerText = " Please enter " . concat ( this . minInput , " or more characters" ) ;
285
285
if ( ! alreadyExists ) {
286
286
this . listboxEl . prepend ( hint ) ;
287
287
}
@@ -320,7 +320,7 @@ MultiselectButtons.prototype.filterOptions = async function (value) {
320
320
optionEl . setAttribute ( 'aria-setsize' , count ) ;
321
321
optionEl . setAttribute ( 'aria-posinset' , k + 1 ) ;
322
322
}
323
- optionEl . id = ` ${ this . idBase } - ${ this . options . indexOf ( o ) } ` ;
323
+ optionEl . id = "" . concat ( this . idBase , "-" ) . concat ( this . options . indexOf ( o ) ) ;
324
324
optionEl . className = 'combo-option' ;
325
325
optionEl . setAttribute ( 'aria-selected' , alreadySelected ) ;
326
326
optionEl . dataset . value = o . value ;
@@ -356,15 +356,15 @@ MultiselectButtons.prototype.filterOptions = async function (value) {
356
356
} ;
357
357
MultiselectButtons . prototype . updateResults = async function ( ) {
358
358
const url = new URL ( this . source , window . location . protocol + '//' + window . location . host ) ;
359
- url . search = ` ${ url . search ? url . search + '&' : '?' } q= ${ this . inputEl . value } &page=${ this . page } ` ;
359
+ url . search = "" . concat ( url . search ? url . search + '&' : '?' , "q=" ) . concat ( this . inputEl . value , " &page=" ) . concat ( this . page ) ;
360
360
const response = await fetch ( url ) ;
361
361
const data = await response . json ( ) ;
362
362
if ( this . page === 1 ) {
363
363
this . options = [ ] ;
364
364
}
365
365
data . results . forEach ( c => {
366
366
this . ajaxResultCount = data . total ;
367
- if ( ! this . select . querySelector ( ` option[value=" ${ c . id } "]` ) ) {
367
+ if ( ! this . select . querySelector ( " option[value=\"" . concat ( c . id , "\"]" ) ) ) {
368
368
const o = document . createElement ( 'option' ) ;
369
369
o . value = c . id ;
370
370
o . innerText = c . text ;
@@ -395,10 +395,11 @@ MultiselectButtons.prototype.onInput = async function () {
395
395
await this . updateResults ( ) ;
396
396
hint . remove ( ) ;
397
397
} else {
398
+ var _hint ;
398
399
this . clearOptions ( ) ;
399
- hint ?? = document . createElement ( 'li' ) ;
400
+ ( _hint = hint ) !== null && _hint !== void 0 ? _hint : hint = document . createElement ( 'li' ) ;
400
401
hint . setAttribute ( 'role' , 'alert' ) ;
401
- hint . innerText = ` Please enter ${ this . minInput } or more characters` ;
402
+ hint . innerText = " Please enter " . concat ( this . minInput , " or more characters" ) ;
402
403
this . listboxEl . prepend ( hint ) ;
403
404
showHint = true ;
404
405
}
@@ -466,11 +467,11 @@ MultiselectButtons.prototype.onInputBlur = function () {
466
467
} ;
467
468
MultiselectButtons . prototype . onOptionChange = function ( index ) {
468
469
this . activeIndex = index ;
469
- this . inputEl . setAttribute ( 'aria-activedescendant' , ` ${ this . idBase } - ${ index } ` ) ;
470
+ this . inputEl . setAttribute ( 'aria-activedescendant' , "" . concat ( this . idBase , "-" ) . concat ( index ) ) ;
470
471
471
472
// update active style
472
473
const options = this . el . querySelectorAll ( '[role=option]' ) ;
473
- const currentOptions = this . el . querySelector ( ` [id=${ this . idBase } - ${ index } ]` ) ;
474
+ const currentOptions = this . el . querySelector ( " [id=" . concat ( this . idBase , "-" ) . concat ( index , "]" ) ) ;
474
475
[ ...options ] . forEach ( optionEl => {
475
476
optionEl . classList . remove ( 'option-current' ) ;
476
477
} ) ;
@@ -501,15 +502,15 @@ MultiselectButtons.prototype.removeOption = function (option) {
501
502
// const index = this.options.indexOf(option);
502
503
503
504
// update aria-selected
504
- const o = this . el . querySelector ( ` [data-value=" ${ option . value } "]` ) ;
505
+ const o = this . el . querySelector ( " [data-value=\"" . concat ( option . value , "\"]" ) ) ;
505
506
if ( o ) {
506
507
o . setAttribute ( 'aria-selected' , 'false' ) ;
507
508
o . classList . remove ( 'option-selected' ) ;
508
509
}
509
510
510
511
// remove button
511
512
if ( this . selectedEl ) {
512
- const buttonEl = this . selectedEl . querySelector ( ` [data-value=" ${ option . value } "]` ) ;
513
+ const buttonEl = this . selectedEl . querySelector ( " [data-value=\"" . concat ( option . value , "\"]" ) ) ;
513
514
this . selectedEl . removeChild ( buttonEl . parentElement ) ;
514
515
}
515
516
this . select . querySelector ( 'option[value="' + option . value + '"]' ) . removeAttribute ( 'selected' ) ;
@@ -520,7 +521,7 @@ MultiselectButtons.prototype.selectOption = function (option) {
520
521
this . activeIndex = index ;
521
522
522
523
// update aria-selected
523
- const o = this . el . querySelector ( ` [id=${ this . idBase } - ${ index } ]` ) ;
524
+ const o = this . el . querySelector ( " [id=" . concat ( this . idBase , "-" ) . concat ( index , "]" ) ) ;
524
525
o . setAttribute ( 'aria-selected' , 'true' ) ;
525
526
o . classList . add ( 'option-selected' ) ;
526
527
@@ -529,7 +530,7 @@ MultiselectButtons.prototype.selectOption = function (option) {
529
530
const listItem = document . createElement ( 'li' ) ;
530
531
buttonEl . className = 'remove-option' ;
531
532
buttonEl . type = 'button' ;
532
- buttonEl . id = ` ${ this . idBase } -remove-${ index } ` ;
533
+ buttonEl . id = "" . concat ( this . idBase , " -remove-" ) . concat ( index ) ;
533
534
buttonEl . dataset . value = selected . value ;
534
535
buttonEl . addEventListener ( 'click' , ( ) => {
535
536
const sibling = listItem . nextSibling ;
@@ -540,7 +541,7 @@ MultiselectButtons.prototype.selectOption = function (option) {
540
541
this . inputEl . focus ( ) ;
541
542
}
542
543
} ) ;
543
- buttonEl . innerHTML = ` <span class="visuallyhidden">Remove </span> ${ selected . text } ` ;
544
+ buttonEl . innerHTML = " <span class=\ "visuallyhidden\ ">Remove </span> " . concat ( selected . text , " " ) ;
544
545
listItem . appendChild ( buttonEl ) ;
545
546
if ( this . select . multiple ) {
546
547
this . selectedEl . appendChild ( listItem ) ;
@@ -551,7 +552,7 @@ MultiselectButtons.prototype.selectOption = function (option) {
551
552
this . select . querySelector ( 'option[value="' + option . value + '"]' ) . setAttribute ( 'selected' , 'selected' ) ;
552
553
} ;
553
554
MultiselectButtons . prototype . updateOption = function ( index ) {
554
- const optionEl = this . el . querySelector ( ` [id=${ this . idBase } - ${ index } ]` ) ;
555
+ const optionEl = this . el . querySelector ( " [id=" . concat ( this . idBase , "-" ) . concat ( index , "]" ) ) ;
555
556
const isSelected = optionEl . getAttribute ( 'aria-selected' ) === 'true' ;
556
557
this . inputEl . value = '' ;
557
558
if ( isSelected ) {
@@ -566,7 +567,7 @@ MultiselectButtons.prototype.updateOption = function (index) {
566
567
} ;
567
568
MultiselectButtons . prototype . updateMenuState = function ( open ) {
568
569
this . open = open ;
569
- this . comboEl . setAttribute ( 'aria-expanded' , ` ${ open } ` ) ;
570
+ this . comboEl . setAttribute ( 'aria-expanded' , "" . concat ( open ) ) ;
570
571
open ? this . el . classList . add ( 'open' ) : this . el . classList . remove ( 'open' ) ;
571
572
} ;
572
573
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ( MultiselectButtons ) ;
0 commit comments