@momentum-design/components 0.102.4 → 0.102.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@ declare const Input_base: import("../../utils/mixins/index.types").Constructor<i
22
22
  * @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
23
23
  * @event focus - (React: onFocus) This event is dispatched when the input receives focus.
24
24
  * @event blur - (React: onBlur) This event is dispatched when the input loses focus.
25
+ * @event clear - (React: onClear) This event is dispatched when the input text is cleared.
25
26
  *
26
27
  * @dependency mdc-icon
27
28
  * @dependency mdc-text
@@ -36,6 +36,7 @@ import styles from './input.styles';
36
36
  * @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
37
37
  * @event focus - (React: onFocus) This event is dispatched when the input receives focus.
38
38
  * @event blur - (React: onBlur) This event is dispatched when the input loses focus.
39
+ * @event clear - (React: onClear) This event is dispatched when the input text is cleared.
39
40
  *
40
41
  * @dependency mdc-icon
41
42
  * @dependency mdc-text
@@ -252,6 +253,7 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
252
253
  this.value = '';
253
254
  // focus the input field after clearing the text
254
255
  (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.focus();
256
+ this.dispatchEvent(new CustomEvent('clear', { bubbles: true, composed: true }));
255
257
  }
256
258
  /**
257
259
  * Renders the trailing button to clear the input field if the trailingButton is set to true.
@@ -1,12 +1,16 @@
1
- import type { ValueOf } from '../../utils/types';
1
+ import type { TypedEvent, ValueOf } from '../../utils/types';
2
+ import type Input from './input.component';
2
3
  import { AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_TYPE } from './input.constants';
3
4
  type AutoCapitalizeType = ValueOf<typeof AUTO_CAPITALIZE>;
4
5
  type AutoCompleteType = ValueOf<typeof AUTO_COMPLETE>;
5
6
  type InputType = ValueOf<typeof INPUT_TYPE>;
7
+ type InputClearEvent = TypedEvent<Input>;
8
+ type InputChangeEvent = TypedEvent<Input>;
6
9
  interface Events {
7
10
  onInputEvent: InputEvent;
8
- onChangeEvent: Event;
11
+ onChangeEvent: InputChangeEvent;
9
12
  onFocusEvent: FocusEvent;
10
13
  onBlurEvent: FocusEvent;
14
+ onClearEvent: InputClearEvent;
11
15
  }
12
- export type { AutoCapitalizeType, AutoCompleteType, InputType, Events };
16
+ export type { AutoCapitalizeType, AutoCompleteType, InputType, InputClearEvent, InputChangeEvent, Events };
@@ -1,7 +1,7 @@
1
1
  import { CSSResult } from 'lit';
2
2
  import Input from '../input/input.component';
3
3
  /**
4
- * searchfield component is used as an input field for search functionality.
4
+ * `mdc-searchfield` component is used as an input field for search functionality.
5
5
  *
6
6
  * It supports `mdc-inputchip` as filters.
7
7
  *
@@ -9,8 +9,13 @@ import Input from '../input/input.component';
9
9
  *
10
10
  * @tagname mdc-searchfield
11
11
  *
12
- * @slot filters - Slot for input chips
12
+ * @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
13
+ * @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
14
+ * @event focus - (React: onFocus) This event is dispatched when the input receives focus.
15
+ * @event blur - (React: onBlur) This event is dispatched when the input loses focus.
16
+ * @event clear - (React: onClear) This event is dispatched when the input text is cleared.
13
17
  *
18
+ * @slot filters - Slot for input chips
14
19
  */
15
20
  declare class Searchfield extends Input {
16
21
  inputChips?: Array<HTMLElement>;
@@ -15,7 +15,7 @@ import { KEYS } from '../../utils/keys';
15
15
  import styles from './searchfield.styles';
16
16
  import { DEFAULTS } from './searchfield.constants';
17
17
  /**
18
- * searchfield component is used as an input field for search functionality.
18
+ * `mdc-searchfield` component is used as an input field for search functionality.
19
19
  *
20
20
  * It supports `mdc-inputchip` as filters.
21
21
  *
@@ -23,8 +23,13 @@ import { DEFAULTS } from './searchfield.constants';
23
23
  *
24
24
  * @tagname mdc-searchfield
25
25
  *
26
- * @slot filters - Slot for input chips
26
+ * @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
27
+ * @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
28
+ * @event focus - (React: onFocus) This event is dispatched when the input receives focus.
29
+ * @event blur - (React: onBlur) This event is dispatched when the input loses focus.
30
+ * @event clear - (React: onClear) This event is dispatched when the input text is cleared.
27
31
  *
32
+ * @slot filters - Slot for input chips
28
33
  */
29
34
  class Searchfield extends Input {
30
35
  constructor() {
@@ -46,7 +51,7 @@ class Searchfield extends Input {
46
51
  */
47
52
  handleKeyDown(event) {
48
53
  super.handleKeyDown(event);
49
- if (event.key === 'Escape') {
54
+ if (event.key === KEYS.ESCAPE) {
50
55
  this.clearInputText();
51
56
  }
52
57
  }
@@ -0,0 +1,2 @@
1
+ import type { Events } from '../input/input.types';
2
+ export type { Events };
@@ -0,0 +1 @@
1
+ export {};