Skip to content

Commit b7a6c32

Browse files
committed
release prep
1 parent f534235 commit b7a6c32

12 files changed

+52
-111
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Changelog
22

3-
## [11.0.0]
3+
## [11.0.0] (2024-08-28)
44

55
### ⚠ BREAKING CHANGES
66
* Update polyfills to include `Element.prototype.replaceChildren`
7+
* Number of internal APIs have changed
78

89
### Bug Fixes (from 10.2.0)
910
* Reduce work done for `unhighlightAll` during on-click handler (batching in v11.0.0-rc8 would also have helped) [#522](https://github.com/Choices-js/Choices/issues/522) [#599](https://github.com/Choices-js/Choices/issues/599)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Choices.js [![Actions Status](https://github.com/jshjohnson/Choices/workflows/Build%20and%20test/badge.svg)](https://github.com/jshjohnson/Choices/actions) [![Actions Status](https://github.com/jshjohnson/Choices/workflows/Bundle%20size%20checks/badge.svg)](https://github.com/jshjohnson/Choices/actions) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js)
22

3-
A vanilla, lightweight (~19.9kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
3+
A vanilla, lightweight (~20kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
44

55
[Demo](https://choices-js.github.io/Choices/)
66

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "choices.js",
3-
"version": "11.0.0-rc8",
3+
"version": "11.0.0",
44
"description": "A vanilla JS customisable text input/select box plugin",
55
"type": "module",
66
"main": "./public/assets/scripts/choices.js",

public/assets/scripts/choices.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
1+
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
22

33
(function (global, factory) {
44
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -3962,15 +3962,6 @@
39623962
else if (config.renderChoiceLimit > 0) {
39633963
renderLimit = config.renderChoiceLimit;
39643964
}
3965-
var groupLookup = [];
3966-
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
3967-
if (appendGroupInSearch) {
3968-
this._store.activeGroups.forEach(function (group) {
3969-
if (group.label) {
3970-
groupLookup[group.id] = group.label;
3971-
}
3972-
});
3973-
}
39743965
if (this._isSelectElement) {
39753966
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
39763967
if (backingOptions.length) {
@@ -3984,7 +3975,7 @@
39843975
});
39853976
};
39863977
var selectableChoices = this._isSelectOneElement;
3987-
var renderChoices = function (choices, withinGroup) {
3978+
var renderChoices = function (choices, withinGroup, groupLabel) {
39883979
if (isSearching) {
39893980
// sortByRank is used to ensure stable sorting, as scores are non-unique
39903981
// this additionally ensures fuseOptions.sortFn is not ignored
@@ -3998,8 +3989,7 @@
39983989
choiceLimit--;
39993990
choices.every(function (choice, index) {
40003991
// choiceEl being empty signals the contents has probably significantly changed
4001-
var dropdownItem = choice.choiceEl ||
4002-
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
3992+
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
40033993
choice.choiceEl = dropdownItem;
40043994
fragment.appendChild(dropdownItem);
40053995
if (isSearching || !choice.selected) {
@@ -4014,7 +4004,7 @@
40144004
}
40154005
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
40164006
// If we have a placeholder choice along with groups
4017-
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
4007+
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
40184008
}
40194009
// If we have grouped options
40204010
if (this._store.activeGroups.length && !isSearching) {
@@ -4030,12 +4020,12 @@
40304020
dropdownGroup.remove();
40314021
fragment.appendChild(dropdownGroup);
40324022
}
4033-
renderChoices(groupChoices, true);
4023+
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
40344024
}
40354025
});
40364026
}
40374027
else {
4038-
renderChoices(renderableChoices(this._store.activeChoices), false);
4028+
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
40394029
}
40404030
}
40414031
var notice = this._notice;
@@ -5173,7 +5163,7 @@
51735163
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
51745164
}
51755165
};
5176-
Choices.version = '11.0.0-rc8';
5166+
Choices.version = '11.0.0';
51775167
return Choices;
51785168
}());
51795169

public/assets/scripts/choices.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/assets/scripts/choices.mjs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
1+
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
22

33
/******************************************************************************
44
Copyright (c) Microsoft Corporation.
@@ -3956,15 +3956,6 @@ var Choices = /** @class */ (function () {
39563956
else if (config.renderChoiceLimit > 0) {
39573957
renderLimit = config.renderChoiceLimit;
39583958
}
3959-
var groupLookup = [];
3960-
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
3961-
if (appendGroupInSearch) {
3962-
this._store.activeGroups.forEach(function (group) {
3963-
if (group.label) {
3964-
groupLookup[group.id] = group.label;
3965-
}
3966-
});
3967-
}
39683959
if (this._isSelectElement) {
39693960
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
39703961
if (backingOptions.length) {
@@ -3978,7 +3969,7 @@ var Choices = /** @class */ (function () {
39783969
});
39793970
};
39803971
var selectableChoices = this._isSelectOneElement;
3981-
var renderChoices = function (choices, withinGroup) {
3972+
var renderChoices = function (choices, withinGroup, groupLabel) {
39823973
if (isSearching) {
39833974
// sortByRank is used to ensure stable sorting, as scores are non-unique
39843975
// this additionally ensures fuseOptions.sortFn is not ignored
@@ -3992,8 +3983,7 @@ var Choices = /** @class */ (function () {
39923983
choiceLimit--;
39933984
choices.every(function (choice, index) {
39943985
// choiceEl being empty signals the contents has probably significantly changed
3995-
var dropdownItem = choice.choiceEl ||
3996-
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
3986+
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
39973987
choice.choiceEl = dropdownItem;
39983988
fragment.appendChild(dropdownItem);
39993989
if (isSearching || !choice.selected) {
@@ -4008,7 +3998,7 @@ var Choices = /** @class */ (function () {
40083998
}
40093999
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
40104000
// If we have a placeholder choice along with groups
4011-
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
4001+
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
40124002
}
40134003
// If we have grouped options
40144004
if (this._store.activeGroups.length && !isSearching) {
@@ -4024,12 +4014,12 @@ var Choices = /** @class */ (function () {
40244014
dropdownGroup.remove();
40254015
fragment.appendChild(dropdownGroup);
40264016
}
4027-
renderChoices(groupChoices, true);
4017+
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
40284018
}
40294019
});
40304020
}
40314021
else {
4032-
renderChoices(renderableChoices(this._store.activeChoices), false);
4022+
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
40334023
}
40344024
}
40354025
var notice = this._notice;
@@ -5167,7 +5157,7 @@ var Choices = /** @class */ (function () {
51675157
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
51685158
}
51695159
};
5170-
Choices.version = '11.0.0-rc8';
5160+
Choices.version = '11.0.0';
51715161
return Choices;
51725162
}());
51735163

public/assets/scripts/choices.search-basic.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
1+
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
22

33
(function (global, factory) {
44
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -3480,15 +3480,6 @@
34803480
else if (config.renderChoiceLimit > 0) {
34813481
renderLimit = config.renderChoiceLimit;
34823482
}
3483-
var groupLookup = [];
3484-
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
3485-
if (appendGroupInSearch) {
3486-
this._store.activeGroups.forEach(function (group) {
3487-
if (group.label) {
3488-
groupLookup[group.id] = group.label;
3489-
}
3490-
});
3491-
}
34923483
if (this._isSelectElement) {
34933484
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
34943485
if (backingOptions.length) {
@@ -3502,7 +3493,7 @@
35023493
});
35033494
};
35043495
var selectableChoices = this._isSelectOneElement;
3505-
var renderChoices = function (choices, withinGroup) {
3496+
var renderChoices = function (choices, withinGroup, groupLabel) {
35063497
if (isSearching) {
35073498
// sortByRank is used to ensure stable sorting, as scores are non-unique
35083499
// this additionally ensures fuseOptions.sortFn is not ignored
@@ -3516,8 +3507,7 @@
35163507
choiceLimit--;
35173508
choices.every(function (choice, index) {
35183509
// choiceEl being empty signals the contents has probably significantly changed
3519-
var dropdownItem = choice.choiceEl ||
3520-
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
3510+
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
35213511
choice.choiceEl = dropdownItem;
35223512
fragment.appendChild(dropdownItem);
35233513
if (isSearching || !choice.selected) {
@@ -3532,7 +3522,7 @@
35323522
}
35333523
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
35343524
// If we have a placeholder choice along with groups
3535-
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
3525+
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
35363526
}
35373527
// If we have grouped options
35383528
if (this._store.activeGroups.length && !isSearching) {
@@ -3548,12 +3538,12 @@
35483538
dropdownGroup.remove();
35493539
fragment.appendChild(dropdownGroup);
35503540
}
3551-
renderChoices(groupChoices, true);
3541+
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
35523542
}
35533543
});
35543544
}
35553545
else {
3556-
renderChoices(renderableChoices(this._store.activeChoices), false);
3546+
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
35573547
}
35583548
}
35593549
var notice = this._notice;
@@ -4691,7 +4681,7 @@
46914681
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
46924682
}
46934683
};
4694-
Choices.version = '11.0.0-rc8';
4684+
Choices.version = '11.0.0';
46954685
return Choices;
46964686
}());
46974687

public/assets/scripts/choices.search-basic.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/assets/scripts/choices.search-basic.mjs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
1+
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
22

33
/******************************************************************************
44
Copyright (c) Microsoft Corporation.
@@ -3474,15 +3474,6 @@ var Choices = /** @class */ (function () {
34743474
else if (config.renderChoiceLimit > 0) {
34753475
renderLimit = config.renderChoiceLimit;
34763476
}
3477-
var groupLookup = [];
3478-
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
3479-
if (appendGroupInSearch) {
3480-
this._store.activeGroups.forEach(function (group) {
3481-
if (group.label) {
3482-
groupLookup[group.id] = group.label;
3483-
}
3484-
});
3485-
}
34863477
if (this._isSelectElement) {
34873478
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
34883479
if (backingOptions.length) {
@@ -3496,7 +3487,7 @@ var Choices = /** @class */ (function () {
34963487
});
34973488
};
34983489
var selectableChoices = this._isSelectOneElement;
3499-
var renderChoices = function (choices, withinGroup) {
3490+
var renderChoices = function (choices, withinGroup, groupLabel) {
35003491
if (isSearching) {
35013492
// sortByRank is used to ensure stable sorting, as scores are non-unique
35023493
// this additionally ensures fuseOptions.sortFn is not ignored
@@ -3510,8 +3501,7 @@ var Choices = /** @class */ (function () {
35103501
choiceLimit--;
35113502
choices.every(function (choice, index) {
35123503
// choiceEl being empty signals the contents has probably significantly changed
3513-
var dropdownItem = choice.choiceEl ||
3514-
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
3504+
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
35153505
choice.choiceEl = dropdownItem;
35163506
fragment.appendChild(dropdownItem);
35173507
if (isSearching || !choice.selected) {
@@ -3526,7 +3516,7 @@ var Choices = /** @class */ (function () {
35263516
}
35273517
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
35283518
// If we have a placeholder choice along with groups
3529-
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
3519+
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
35303520
}
35313521
// If we have grouped options
35323522
if (this._store.activeGroups.length && !isSearching) {
@@ -3542,12 +3532,12 @@ var Choices = /** @class */ (function () {
35423532
dropdownGroup.remove();
35433533
fragment.appendChild(dropdownGroup);
35443534
}
3545-
renderChoices(groupChoices, true);
3535+
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
35463536
}
35473537
});
35483538
}
35493539
else {
3550-
renderChoices(renderableChoices(this._store.activeChoices), false);
3540+
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
35513541
}
35523542
}
35533543
var notice = this._notice;
@@ -4685,7 +4675,7 @@ var Choices = /** @class */ (function () {
46854675
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
46864676
}
46874677
};
4688-
Choices.version = '11.0.0-rc8';
4678+
Choices.version = '11.0.0';
46894679
return Choices;
46904680
}());
46914681

0 commit comments

Comments
 (0)