Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@travelopia/web-components",
"version": "0.5.7",
"version": "0.5.8",
"description": "Accessible web components for the modern web",
"files": [
"dist"
Expand Down
10 changes: 8 additions & 2 deletions src/multi-select/tp-multi-select-option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ export class TPMultiSelectOptionElement extends HTMLElement {

if ( 'yes' !== this.getAttribute( 'selected' ) ) {
multiSelect?.select( value );
multiSelect?.dispatchEvent( new CustomEvent( 'select', { bubbles: true } ) );
multiSelect?.dispatchEvent( new CustomEvent( 'select', {
bubbles: true,
detail: { value },
} ) );
} else {
multiSelect?.unSelect( value );
multiSelect?.dispatchEvent( new CustomEvent( 'unselect', { bubbles: true } ) );
multiSelect?.dispatchEvent( new CustomEvent( 'unselect', {
bubbles: true,
detail: { value },
} ) );
}
multiSelect?.dispatchEvent( new CustomEvent( 'change', { bubbles: true } ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/multi-select/tp-multi-select-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class TPMultiSelectSearchElement extends HTMLElement {
let matchedOptionCount = 0;
// Hide and show options based on search.
options.forEach( ( option: TPMultiSelectOptionElement ): void => {
if ( option.getAttribute( 'value' )?.match( new RegExp( `.*${ search.value }.*` ) ) ) {
if ( option.getAttribute( 'label' )?.toLowerCase().match( new RegExp( `.*${ search.value.replace( /\s/g, '.*' ) }.*` ) ) ) {
option.removeAttribute( 'hidden' );
matchedOptionCount++;
} else {
Expand Down