2022-02-03 11:57:50 +00:00
|
|
|
import { Meta, Story, ArgsTable, Canvas } from "@storybook/addon-docs/blocks";
|
2022-03-06 19:35:31 +00:00
|
|
|
import EmailChips from "./";
|
|
|
|
import * as stories from "./email-chips.stories.js";
|
2022-02-03 11:57:50 +00:00
|
|
|
|
|
|
|
<Meta
|
2022-03-06 19:35:31 +00:00
|
|
|
title="Components/EmailChips"
|
|
|
|
component={EmailChips}
|
2022-02-03 11:57:50 +00:00
|
|
|
argTypes={{
|
2022-02-17 11:37:44 +00:00
|
|
|
onChange: { required: true },
|
2022-02-03 11:57:50 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
2022-03-06 19:35:31 +00:00
|
|
|
# EmailChips
|
2022-02-03 11:57:50 +00:00
|
|
|
|
2022-03-06 19:35:31 +00:00
|
|
|
Custom email-chips
|
2022-02-03 11:57:50 +00:00
|
|
|
|
2022-02-03 12:37:10 +00:00
|
|
|
### Usage
|
2022-02-03 11:57:50 +00:00
|
|
|
|
|
|
|
```js
|
2022-03-06 19:35:31 +00:00
|
|
|
import EmailChips from "@appserver/components/email-chips";
|
2022-02-03 11:57:50 +00:00
|
|
|
```
|
|
|
|
|
2022-03-06 19:35:31 +00:00
|
|
|
### EmailChips - Default
|
2022-02-03 11:57:50 +00:00
|
|
|
|
|
|
|
<Canvas>
|
|
|
|
<Story story={stories.Default} name="Default" />
|
|
|
|
</Canvas>
|
|
|
|
|
|
|
|
#### Properties
|
|
|
|
|
|
|
|
<ArgsTable story="Default" />
|
|
|
|
|
|
|
|
#### Options - an array of objects that contains the following fields:
|
|
|
|
|
|
|
|
```js
|
|
|
|
const options = [
|
|
|
|
{
|
2022-03-06 19:35:31 +00:00
|
|
|
name: "Ivan Petrov",
|
|
|
|
email: "myname@gmul.com",
|
|
|
|
isValid: true,
|
2022-02-03 11:57:50 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
```
|
|
|
|
|
|
|
|
Options have options:
|
|
|
|
|
2022-03-06 19:35:31 +00:00
|
|
|
- name - Display text
|
|
|
|
- email - Email address
|
|
|
|
- isValid - Displays whether the email is valid
|
2022-02-03 11:57:50 +00:00
|
|
|
|
2022-03-06 19:35:31 +00:00
|
|
|
### EmailChips - Empty
|
2022-02-03 11:57:50 +00:00
|
|
|
|
|
|
|
<Canvas>
|
|
|
|
<Story story={stories.Empty} name="Empty" />
|
|
|
|
</Canvas>
|
|
|
|
|
|
|
|
#### Properties
|
|
|
|
|
|
|
|
<ArgsTable story="Empty" />
|
|
|
|
|
|
|
|
#### Actions that can be performed on chips and input:
|
|
|
|
|
|
|
|
- Enter a chip into the input (chips are checked for a valid email, and the same chips).
|
|
|
|
- Add chips by pressing Enter or NumpadEnter.
|
2022-02-18 10:27:07 +00:00
|
|
|
- By double-clicking on the mouse button or pressing enter on a specific selected chip, you can switch to the chip editing mode.
|
2022-03-06 19:35:31 +00:00
|
|
|
- You can exit the editing mode by pressing Escape, Enter, NumpadEnter or by clicking ouside.
|
2022-02-03 11:57:50 +00:00
|
|
|
- Remove the chips by clicking on the button in the form of a cross.
|
|
|
|
- Click on the chip once, thereby highlighting it.
|
|
|
|
- Hold down the shift button by moving the arrows to the left, right or clicking the mouse on the chips, thereby highlighting several chips.
|
2022-02-18 10:27:07 +00:00
|
|
|
- The highlighted chip(s) can be removed by clicking on the button Backspace or Delete.
|
2022-02-03 11:57:50 +00:00
|
|
|
- The selected chip(s) can be copied to the clipboard by pressing "ctrl + c".
|
2022-02-08 13:41:29 +00:00
|
|
|
- You can remove all chips by clicking on the button "Clear list".
|