Fix ambigious clearing behaviour on SelectButton (#4107)

pull/4524/head
Quinten Coret 2023-10-09 11:36:37 +02:00 committed by GitHub
parent 0a08c56d3b
commit b666789c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 2 deletions

View File

@ -51,6 +51,12 @@ const SelectButtonProps = [
name: 'unselectable',
type: 'boolean',
default: 'false',
description: 'Whether selection can not be cleared.'
},
{
name: 'allowEmpty',
type: 'boolean',
default: 'true',
description: 'Whether selection can be cleared.'
},
{

View File

@ -16,6 +16,10 @@ export default {
type: Boolean,
default: false
},
allowEmpty: {
type: Boolean,
default: true
},
disabled: Boolean,
dataKey: null,
'aria-labelledby': {

View File

@ -155,10 +155,16 @@ export interface SelectButtonProps {
*/
dataKey?: string | undefined;
/**
* Whether selection can be cleared.
* Whether selection can not be cleared.
* @defaultValue false
* @deprecated Use 'allowEmpty' property instead.
*/
unselectable?: boolean | undefined;
/**
* Whether selection can be cleared.
* @defaultValue true
*/
allowEmpty?: boolean | undefined;
/**
* Identifier of the underlying element.
*/

View File

@ -81,7 +81,7 @@ export default {
let selected = this.isSelected(option);
if (selected && this.unselectable) {
if (selected && (this.unselectable || !this.allowEmpty)) {
return;
}

View File

@ -42662,6 +42662,15 @@
"readonly": false,
"type": "boolean",
"default": "false",
"description": "Whether selection can not be cleared.",
"deprecated": "Use 'allowEmpty' property instead."
},
{
"name": "allowEmpty",
"optional": true,
"readonly": false,
"type": "boolean",
"default": "true",
"description": "Whether selection can be cleared."
},
{