import React, { useState, useCallback } from 'react';
import GraphemeSplitter from 'grapheme-splitter';
import { isFunction, isString } from 'lodash';
import {
Input,
InputGroup,
TextArea,
TimePicker,
DatePicker,
AutoComplete,
Cascader,
Select,
TagInput,
Tree,
TreeSelect,
Icon,
TabPane,
Tabs,
Button,
Typography,
Switch,
Form,
Space,
Radio,
InputNumber
} from '../../index';
import './input.scss';
import RTLWrapper from '../../configProvider/_story/RTLDirection/RTLWrapper';
import { IconSearch, IconCopy, IconClear, IconStar } from '@douyinfe/semi-icons';
export default {
title: 'Input',
parameters: {
chromatic: { disableSnapshot: true },
}
}
const { Title, Text } = Typography;
const log = (...args) => console.log(...args);
export const _Input = () => (
);
_Input.parameters = {
chromatic: { disableSnapshot: false },
};
export const InputAutofocus = () => (
);
InputAutofocus.story = {
name: 'Input autofocus',
};
export const InputPlaceholder = () => (
);
InputPlaceholder.story = {
name: 'Input placeholder',
};
export const InputDisabled = () => (
);
InputDisabled.parameters = {
chromatic: { disableSnapshot: false },
};
InputDisabled.story = {
name: 'Input disabled',
};
export const InputClearable = () => (
);
InputClearable.story = {
name: 'Input clearable',
};
export const InputPrefixSuffixDemo = () => (
pre} showClear defaultValue="Semi Design" />
pre} showClear defaultValue="Semi Design" />
} autofocus showClear defaultValue="Semi Design">
Suffix
}
showClear
defaultValue="Semi Design"
>
);
InputPrefixSuffixDemo.story = {
name: '前缀/后缀 Input prefix suffix',
};
InputPrefixSuffixDemo.parameters = {
chromatic: { disableSnapshot: false },
};
export const InputAddonBeforeAddonAfter = () => (
);
InputAddonBeforeAddonAfter.story = {
name: '前置/后置标签 Input addonBefore addonAfter',
};
InputAddonBeforeAddonAfter.parameters = {
chromatic: { disableSnapshot: false },
};
export const InputPassword = () => (
);
InputPassword.story = {
name: 'Input password',
};
InputPassword.parameters = {
chromatic: { disableSnapshot: false },
};
export const ControlInput = () => {
const [value, setValue] = useState('initString');
return (
);
};
ControlInput.story = { name: '受控组件' };
export const UnControlInput = () => (
console.log(v)} defaultValue="initString" />
);
UnControlInput.story = { name: '非受控组件' };
export const Password = () => (
);
Password.story = {
name: 'password',
};
const treeData = [
{
label: '亚洲',
value: 'Asia',
key: '0',
children: [
{
label: '中国',
value: 'China',
key: '0-0',
children: [
{
label: '北京',
value: 'Beijing',
key: '0-0-0',
},
{
label: '上海',
value: 'Shanghai',
key: '0-0-1',
},
],
},
],
},
{
label: '北美洲',
value: 'North America',
key: '1',
},
];
export const Group = () => (
);
Group.story = {
name: 'group',
};
Group.parameters = {
chromatic: { disableSnapshot: false },
};
export const Textarea = () =>