UNPKG

@eureca/eureca-ui

Version:

UI component library of Eureca's user and admin apps

98 lines (84 loc) 2.35 kB
import { Meta, Story, Preview, Title, Subtitle, Description, Props, } from '@storybook/addon-docs/blocks'; import { withKnobs } from '@storybook/addon-knobs'; import { Box, ThemeProvider } from '@material-ui/core'; import MuiTheme from '../../../theme/mui'; import { Flex } from '../../Flex'; import { TextInput } from '../'; import { DefaultInput } from './text-input.stories.js'; <Meta title='Material/Inputs' component={TextInput} decorators={[withKnobs]}/> <Title>Input</Title> <Description> Input básico dos aplicativos Eureca, extendido do `TextField` do `Material-UI`. </Description> <Description> Contém todas as props definidas no [Material-UI](https://material-ui.com/components/text-fields/#text-field) e tem estilo definido pelo tema desta biblioteca. </Description> <Preview> <Story name="Text Input"> <DefaultInput /> </Story> </Preview> <Subtitle>Props</Subtitle> | Nome | Descrição | Default | |:-------:|:-------------------------------:|:-----------:| | name | Nome do input do Material-UI <br /> string | - | | label | Label input do Material-UI <br /> string | - | | helperText | Texto localizado na parte inferior do input do Material-UI <br /> string | - | | value | Valor do input do Material-UI <br /> string \| number | - | | onChange | Função de onChange do input do Material-UI <br /> func| - | | props | Todas as props aceitas pelo TextField do Material-UI <br /> | - | <Subtitle>Tamanhos</Subtitle> <Preview> <ThemeProvider theme={MuiTheme}> <TextInput label='Small' size='small' /> <Box width={300} mt={3}> <TextInput label='Largura definida' size='small' /> </Box> </ThemeProvider> </Preview> <Subtitle>Variações</Subtitle> <Preview> <ThemeProvider theme={MuiTheme}> <TextInput label='Filled' variant='filled' /> <Box my={2}> <TextInput label='Outlined' variant='outlined' /> </Box> <TextInput label='Standard' variant='standard' /> </ThemeProvider> </Preview> <Subtitle>Exemplo de Aplicação</Subtitle> ```jsx <TextInput name='input-name' label="Label" value={value} variant={variant} onChange={handleChange} helperText='Helper text' disabled={isDisabled} error={hasError} /> ```