@momentum-design/components 0.22.0 → 0.22.1
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.
@@ -175,6 +175,12 @@ declare class Input extends Input_base {
|
|
175
175
|
* @param event - Event which contains information about the value change.
|
176
176
|
*/
|
177
177
|
private onChange;
|
178
|
+
/**
|
179
|
+
* Handles the keydown event of the input field.
|
180
|
+
* If the key pressed is 'Enter', it submits the form.
|
181
|
+
* @param event - Keyboard event
|
182
|
+
*/
|
183
|
+
private handleKeyDown;
|
178
184
|
/**
|
179
185
|
* Renders the leading icon before the input field.
|
180
186
|
* If the leading icon is not set, it will not be displayed.
|
@@ -212,6 +212,17 @@ class Input extends DataAriaLabelMixin(ValueMixin(NameMixin(FormfieldWrapper)))
|
|
212
212
|
const EventConstructor = event.constructor;
|
213
213
|
this.dispatchEvent(new EventConstructor(event.type, event));
|
214
214
|
}
|
215
|
+
/**
|
216
|
+
* Handles the keydown event of the input field.
|
217
|
+
* If the key pressed is 'Enter', it submits the form.
|
218
|
+
* @param event - Keyboard event
|
219
|
+
*/
|
220
|
+
handleKeyDown(event) {
|
221
|
+
var _a;
|
222
|
+
if (event.key === 'Enter') {
|
223
|
+
(_a = this.internals.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
|
224
|
+
}
|
225
|
+
}
|
215
226
|
/**
|
216
227
|
* Renders the leading icon before the input field.
|
217
228
|
* If the leading icon is not set, it will not be displayed.
|
@@ -319,6 +330,7 @@ class Input extends DataAriaLabelMixin(ValueMixin(NameMixin(FormfieldWrapper)))
|
|
319
330
|
size=${ifDefined(this.size)}
|
320
331
|
@input=${this.onInput}
|
321
332
|
@change=${this.onChange}
|
333
|
+
@keydown=${this.handleKeyDown}
|
322
334
|
/>
|
323
335
|
</slot>
|
324
336
|
</div>
|
@@ -3518,6 +3518,21 @@
|
|
3518
3518
|
],
|
3519
3519
|
"description": "Handles the change event of the input field.\nUpdates the value and sets the validity of the input field.\n\nThe 'change' event does not bubble up through the shadow DOM as it was not composed.\nTherefore, we need to re-dispatch the same event to ensure it is propagated correctly.\nRead more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed"
|
3520
3520
|
},
|
3521
|
+
{
|
3522
|
+
"kind": "method",
|
3523
|
+
"name": "handleKeyDown",
|
3524
|
+
"privacy": "private",
|
3525
|
+
"parameters": [
|
3526
|
+
{
|
3527
|
+
"name": "event",
|
3528
|
+
"type": {
|
3529
|
+
"text": "KeyboardEvent"
|
3530
|
+
},
|
3531
|
+
"description": "Keyboard event"
|
3532
|
+
}
|
3533
|
+
],
|
3534
|
+
"description": "Handles the keydown event of the input field.\nIf the key pressed is 'Enter', it submits the form."
|
3535
|
+
},
|
3521
3536
|
{
|
3522
3537
|
"kind": "method",
|
3523
3538
|
"name": "renderLeadingIcon",
|
package/package.json
CHANGED