UNPKG

@itwin/itwinui-react

Version:

A react component library for iTwinUI

54 lines (53 loc) 1.3 kB
import * as React from 'react'; import cx from 'classnames'; import { SvgUpload, Box } from '../../utils/index.js'; import { Anchor } from '../Typography/Anchor.js'; export const FileUploadTemplate = React.forwardRef((props, ref) => { let { onChange, acceptMultiple = true, acceptType, label = 'Choose a file', subtitle = 'or drag & drop it here.', children, className, ...rest } = props; return React.createElement( Box, { className: cx('iui-file-upload-template', className), ref: ref, ...rest, }, React.createElement(SvgUpload, { className: 'iui-template-icon', 'aria-hidden': true, }), React.createElement( Box, { className: 'iui-template-text', }, React.createElement( Anchor, { as: 'label', }, React.createElement(Box, { as: 'input', className: 'iui-browse-input', type: 'file', onChange: onChange, multiple: acceptMultiple, accept: acceptType, }), label, ), React.createElement('div', null, subtitle), children, ), ); }); if ('development' === process.env.NODE_ENV) FileUploadTemplate.displayName = 'FileUploadTemplate';