Skip to content

Commit

Permalink
release prep
Browse files Browse the repository at this point in the history
  • Loading branch information
Xon committed Aug 27, 2024
1 parent f534235 commit b7a6c32
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 111 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## [11.0.0]
## [11.0.0] (2024-08-28)

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

### Bug Fixes (from 10.2.0)
* 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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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)

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

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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "choices.js",
"version": "11.0.0-rc8",
"version": "11.0.0",
"description": "A vanilla JS customisable text input/select box plugin",
"type": "module",
"main": "./public/assets/scripts/choices.js",
Expand Down
24 changes: 7 additions & 17 deletions public/assets/scripts/choices.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
Expand Down Expand Up @@ -3962,15 +3962,6 @@
else if (config.renderChoiceLimit > 0) {
renderLimit = config.renderChoiceLimit;
}
var groupLookup = [];
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
if (appendGroupInSearch) {
this._store.activeGroups.forEach(function (group) {
if (group.label) {
groupLookup[group.id] = group.label;
}
});
}
if (this._isSelectElement) {
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
if (backingOptions.length) {
Expand All @@ -3984,7 +3975,7 @@
});
};
var selectableChoices = this._isSelectOneElement;
var renderChoices = function (choices, withinGroup) {
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
// this additionally ensures fuseOptions.sortFn is not ignored
Expand All @@ -3998,8 +3989,7 @@
choiceLimit--;
choices.every(function (choice, index) {
// choiceEl being empty signals the contents has probably significantly changed
var dropdownItem = choice.choiceEl ||
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
Expand All @@ -4014,7 +4004,7 @@
}
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
// If we have a placeholder choice along with groups
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
}
// If we have grouped options
if (this._store.activeGroups.length && !isSearching) {
Expand All @@ -4030,12 +4020,12 @@
dropdownGroup.remove();
fragment.appendChild(dropdownGroup);
}
renderChoices(groupChoices, true);
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
}
});
}
else {
renderChoices(renderableChoices(this._store.activeChoices), false);
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
}
}
var notice = this._notice;
Expand Down Expand Up @@ -5173,7 +5163,7 @@
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
}
};
Choices.version = '11.0.0-rc8';
Choices.version = '11.0.0';
return Choices;
}());

Expand Down
4 changes: 2 additions & 2 deletions public/assets/scripts/choices.min.js

Large diffs are not rendered by default.

24 changes: 7 additions & 17 deletions public/assets/scripts/choices.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */

/******************************************************************************
Copyright (c) Microsoft Corporation.
Expand Down Expand Up @@ -3956,15 +3956,6 @@ var Choices = /** @class */ (function () {
else if (config.renderChoiceLimit > 0) {
renderLimit = config.renderChoiceLimit;
}
var groupLookup = [];
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
if (appendGroupInSearch) {
this._store.activeGroups.forEach(function (group) {
if (group.label) {
groupLookup[group.id] = group.label;
}
});
}
if (this._isSelectElement) {
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
if (backingOptions.length) {
Expand All @@ -3978,7 +3969,7 @@ var Choices = /** @class */ (function () {
});
};
var selectableChoices = this._isSelectOneElement;
var renderChoices = function (choices, withinGroup) {
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
// this additionally ensures fuseOptions.sortFn is not ignored
Expand All @@ -3992,8 +3983,7 @@ var Choices = /** @class */ (function () {
choiceLimit--;
choices.every(function (choice, index) {
// choiceEl being empty signals the contents has probably significantly changed
var dropdownItem = choice.choiceEl ||
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
Expand All @@ -4008,7 +3998,7 @@ var Choices = /** @class */ (function () {
}
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
// If we have a placeholder choice along with groups
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
}
// If we have grouped options
if (this._store.activeGroups.length && !isSearching) {
Expand All @@ -4024,12 +4014,12 @@ var Choices = /** @class */ (function () {
dropdownGroup.remove();
fragment.appendChild(dropdownGroup);
}
renderChoices(groupChoices, true);
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
}
});
}
else {
renderChoices(renderableChoices(this._store.activeChoices), false);
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
}
}
var notice = this._notice;
Expand Down Expand Up @@ -5167,7 +5157,7 @@ var Choices = /** @class */ (function () {
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
}
};
Choices.version = '11.0.0-rc8';
Choices.version = '11.0.0';
return Choices;
}());

Expand Down
24 changes: 7 additions & 17 deletions public/assets/scripts/choices.search-basic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
Expand Down Expand Up @@ -3480,15 +3480,6 @@
else if (config.renderChoiceLimit > 0) {
renderLimit = config.renderChoiceLimit;
}
var groupLookup = [];
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
if (appendGroupInSearch) {
this._store.activeGroups.forEach(function (group) {
if (group.label) {
groupLookup[group.id] = group.label;
}
});
}
if (this._isSelectElement) {
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
if (backingOptions.length) {
Expand All @@ -3502,7 +3493,7 @@
});
};
var selectableChoices = this._isSelectOneElement;
var renderChoices = function (choices, withinGroup) {
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
// this additionally ensures fuseOptions.sortFn is not ignored
Expand All @@ -3516,8 +3507,7 @@
choiceLimit--;
choices.every(function (choice, index) {
// choiceEl being empty signals the contents has probably significantly changed
var dropdownItem = choice.choiceEl ||
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
Expand All @@ -3532,7 +3522,7 @@
}
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
// If we have a placeholder choice along with groups
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
}
// If we have grouped options
if (this._store.activeGroups.length && !isSearching) {
Expand All @@ -3548,12 +3538,12 @@
dropdownGroup.remove();
fragment.appendChild(dropdownGroup);
}
renderChoices(groupChoices, true);
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
}
});
}
else {
renderChoices(renderableChoices(this._store.activeChoices), false);
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
}
}
var notice = this._notice;
Expand Down Expand Up @@ -4691,7 +4681,7 @@
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
}
};
Choices.version = '11.0.0-rc8';
Choices.version = '11.0.0';
return Choices;
}());

Expand Down
4 changes: 2 additions & 2 deletions public/assets/scripts/choices.search-basic.min.js

Large diffs are not rendered by default.

24 changes: 7 additions & 17 deletions public/assets/scripts/choices.search-basic.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! choices.js v11.0.0-rc8 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! choices.js v11.0.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */

/******************************************************************************
Copyright (c) Microsoft Corporation.
Expand Down Expand Up @@ -3474,15 +3474,6 @@ var Choices = /** @class */ (function () {
else if (config.renderChoiceLimit > 0) {
renderLimit = config.renderChoiceLimit;
}
var groupLookup = [];
var appendGroupInSearch = config.appendGroupInSearch && isSearching;
if (appendGroupInSearch) {
this._store.activeGroups.forEach(function (group) {
if (group.label) {
groupLookup[group.id] = group.label;
}
});
}
if (this._isSelectElement) {
var backingOptions = this._store.activeChoices.filter(function (choice) { return !choice.element; });
if (backingOptions.length) {
Expand All @@ -3496,7 +3487,7 @@ var Choices = /** @class */ (function () {
});
};
var selectableChoices = this._isSelectOneElement;
var renderChoices = function (choices, withinGroup) {
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
// this additionally ensures fuseOptions.sortFn is not ignored
Expand All @@ -3510,8 +3501,7 @@ var Choices = /** @class */ (function () {
choiceLimit--;
choices.every(function (choice, index) {
// choiceEl being empty signals the contents has probably significantly changed
var dropdownItem = choice.choiceEl ||
_this._templates.choice(config, choice, config.itemSelectText, appendGroupInSearch && choice.groupId ? groupLookup[choice.groupId] : undefined);
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
Expand All @@ -3526,7 +3516,7 @@ var Choices = /** @class */ (function () {
}
if (!this._hasNonChoicePlaceholder && !isSearching && this._isSelectOneElement) {
// If we have a placeholder choice along with groups
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false);
renderChoices(this._store.activeChoices.filter(function (choice) { return choice.placeholder && !choice.groupId; }), false, undefined);
}
// If we have grouped options
if (this._store.activeGroups.length && !isSearching) {
Expand All @@ -3542,12 +3532,12 @@ var Choices = /** @class */ (function () {
dropdownGroup.remove();
fragment.appendChild(dropdownGroup);
}
renderChoices(groupChoices, true);
renderChoices(groupChoices, true, config.appendGroupInSearch && isSearching ? group.label : undefined);
}
});
}
else {
renderChoices(renderableChoices(this._store.activeChoices), false);
renderChoices(renderableChoices(this._store.activeChoices), false, undefined);
}
}
var notice = this._notice;
Expand Down Expand Up @@ -4685,7 +4675,7 @@ var Choices = /** @class */ (function () {
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
}
};
Choices.version = '11.0.0-rc8';
Choices.version = '11.0.0';
return Choices;
}());

Expand Down
Loading

0 comments on commit b7a6c32

Please sign in to comment.