Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 5deaa7a

Browse files
committed
feat(textfield): adding keypress eventHandler
1 parent c200072 commit 5deaa7a

File tree

7 files changed

+45
-9
lines changed

7 files changed

+45
-9
lines changed

packages/api-generator/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api-generator/src/TextField.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,16 @@
396396
"visibility": "public",
397397
"description": "",
398398
"keywords": []
399+
},
400+
{
401+
"name": "keypress",
402+
"parent": "input",
403+
"modificators": [],
404+
"locations": null,
405+
"loc": null,
406+
"visibility": "public",
407+
"description": "",
408+
"keywords": []
399409
}
400410
],
401411
"slots": [

packages/api-generator/src/all.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"names": [
33
"Alert",
44
"AppBar",
5-
"Badge",
65
"Avatar",
6+
"Badge",
77
"Breadcrumbs",
88
"Button",
99
"ButtonGroup",
@@ -13,8 +13,6 @@
1313
"CardSubtitle",
1414
"CardText",
1515
"CardTitle",
16-
"Carousel",
17-
"CarouselItem",
1816
"Checkbox",
1917
"Chip",
2018
"Dialog",
@@ -51,8 +49,8 @@
5149
"Tab",
5250
"TabContent",
5351
"Tabs",
54-
"Textarea",
5552
"TextField",
53+
"Textarea",
5654
"Tooltip",
5755
"VirtualList",
5856
"Window",

packages/api-generator/src/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export { default as all } from './all.json';
22
export { default as Alert } from './Alert.json';
33
export { default as AppBar } from './AppBar.json';
4-
export { default as Badge } from './Badge.json';
54
export { default as Avatar } from './Avatar.json';
5+
export { default as Badge } from './Badge.json';
66
export { default as Breadcrumbs } from './Breadcrumbs.json';
77
export { default as Button } from './Button.json';
88
export { default as ButtonGroup } from './ButtonGroup.json';
@@ -12,8 +12,6 @@ export { default as CardActions } from './CardActions.json';
1212
export { default as CardSubtitle } from './CardSubtitle.json';
1313
export { default as CardText } from './CardText.json';
1414
export { default as CardTitle } from './CardTitle.json';
15-
export { default as Carousel } from './Carousel.json';
16-
export { default as CarouselItem } from './CarouselItem.json';
1715
export { default as Checkbox } from './Checkbox.json';
1816
export { default as Chip } from './Chip.json';
1917
export { default as Dialog } from './Dialog.json';
@@ -50,8 +48,8 @@ export { default as Table } from './Table.json';
5048
export { default as Tab } from './Tab.json';
5149
export { default as TabContent } from './TabContent.json';
5250
export { default as Tabs } from './Tabs.json';
53-
export { default as Textarea } from './Textarea.json';
5451
export { default as TextField } from './TextField.json';
52+
export { default as Textarea } from './Textarea.json';
5553
export { default as Tooltip } from './Tooltip.json';
5654
export { default as VirtualList } from './VirtualList.json';
5755
export { default as Window } from './Window.json';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<script>
2+
import { TextField, Overlay, ProgressCircular, Icon } from 'svelte-materialify/src';
3+
4+
let active = false;
5+
</script>
6+
7+
<TextField
8+
on:keypress={(e) => {
9+
if (e.key === 'Enter') active = true;
10+
}}>
11+
Email
12+
<div slot="prepend">
13+
<Icon class="mdi mdi-email" />
14+
</div>
15+
</TextField>
16+
17+
<Overlay
18+
{active}
19+
on:click={() => {
20+
active = false;
21+
}}>
22+
<ProgressCircular color="primary" indeterminate size={128} />
23+
</Overlay>

packages/docs/src/routes/components/text-field.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,9 @@ const rules = [
7575
```
7676

7777
<Components.Example file="TextField/validation" />
78+
79+
### EventHandler
80+
81+
Text field provides eventHandler like `on:keypress` to perform actions while pressing keys.
82+
83+
<Components.Example file="TextField/actions" />

packages/svelte-materialify/src/components/TextField/TextField.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
on:blur
100100
on:input
101101
on:change
102+
on:keypress
102103
{...$$restProps} />
103104
</div>
104105

0 commit comments

Comments
 (0)