Skip to content

Commit

Permalink
fix: add custom-value-set event types [skip ci] (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Jan 8, 2021
1 parent 014657a commit f42ff80
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export type ComboBoxDataProvider = (
callback: ComboBoxDataProviderCallback
) => void;

/**
* Fired when the user sets a custom value.
*/
export type ComboBoxCustomValueSet = CustomEvent<string>;

/**
* Fired when the `opened` property changes.
*/
Expand All @@ -55,6 +60,8 @@ export type ComboBoxFilterChanged = CustomEvent<{ value: string }>;
export type ComboBoxSelectedItemChanged<T> = CustomEvent<{ value: T }>;

export interface ComboBoxElementEventMap {
'custom-value-set': ComboBoxCustomValueSet;

'opened-changed': ComboBoxOpenedChanged;

'filter-changed': ComboBoxFilterChanged;
Expand Down
1 change: 1 addition & 0 deletions src/vaadin-combo-box-light.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { ComboBoxEventMap } from './interfaces';
* ```
*
* @fires {Event} change - Fired when the user commits a value change.
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
* @fires {CustomEvent} filter-changed - Fired when the `filter` property changes.
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
Expand Down
1 change: 1 addition & 0 deletions src/vaadin-combo-box-light.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import './vaadin-combo-box-dropdown-wrapper.js';
* ```
*
* @fires {Event} change - Fired when the user commits a value change.
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
* @fires {CustomEvent} filter-changed - Fired when the `filter` property changes.
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
Expand Down
1 change: 1 addition & 0 deletions src/vaadin-combo-box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ import { ComboBoxEventMap } from './interfaces';
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)
*
* @fires {Event} change - Fired when the user commits a value change.
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
* @fires {CustomEvent} filter-changed - Fired when the `filter` property changes.
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
Expand Down
1 change: 1 addition & 0 deletions src/vaadin-combo-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixi
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)
*
* @fires {Event} change - Fired when the user commits a value change.
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
* @fires {CustomEvent} filter-changed - Fired when the `filter` property changes.
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
Expand Down
8 changes: 8 additions & 0 deletions test/typings/combo-box.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const assert = <T>(value: T) => value;

const comboBox = document.createElement('vaadin-combo-box');

comboBox.addEventListener('custom-value-set', (event) => {
assert<string>(event.detail);
});

comboBox.addEventListener('opened-changed', (event) => {
assert<boolean>(event.detail.value);
});
Expand All @@ -31,6 +35,10 @@ comboBox.addEventListener(

const light = document.createElement('vaadin-combo-box-light');

light.addEventListener('custom-value-set', (event) => {
assert<string>(event.detail);
});

light.addEventListener('opened-changed', (event) => {
assert<boolean>(event.detail.value);
});
Expand Down

0 comments on commit f42ff80

Please sign in to comment.