mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
|
{"version":3,"file":"index.js","sources":["../src/TextField.tsx","../src/Switch.tsx","../src/Checkbox.tsx","../src/CheckboxWithLabel.tsx","../src/Select.tsx","../src/SimpleFileUpload.tsx","../src/RadioGroup.tsx","../src/InputBase.tsx"],"sourcesContent":["import * as React from 'react';\nimport MuiTextField, {\n TextFieldProps as MuiTextFieldProps,\n} from '@material-ui/core/TextField';\nimport { FieldProps, getIn } from 'formik';\n\nexport interface TextFieldProps\n extends FieldProps,\n Omit<MuiTextFieldProps, 'name' | 'value' | 'error'> {}\n\nexport function fieldToTextField({\n disabled,\n field: { onBlur: fieldOnBlur, ...field },\n form: { isSubmitting, touched, errors },\n onBlur,\n helperText,\n ...props\n}: TextFieldProps): MuiTextFieldProps {\n const fieldError = getIn(errors, field.name);\n const showError = getIn(touched, field.name) && !!fieldError;\n\n return {\n variant: props.variant,\n error: showError,\n helperText: showError ? fieldError : helperText,\n disabled: disabled ?? isSubmitting,\n onBlur:\n onBlur ??\n function (e) {\n fieldOnBlur(e ?? field.name);\n },\n ...field,\n ...props,\n };\n}\n\nexport function TextField({ children, ...props }: TextFieldProps) {\n return <MuiTextField {...fieldToTextField(props)}>{children}</MuiTextField>;\n}\n\nTextField.displayName = 'FormikMaterialUITextField';\n","import * as React from 'react';\nimport MuiSwitch, {\n SwitchProps as MuiSwitchProps,\n} from '@material-ui/core/Switch';\nimport { FieldProps } from 'formik';\nimport invariant from 'tiny-warning';\n\nexport interface SwitchProps\n extends FieldProps,\n Omit<\n MuiSwitchProps,\n | 'checked'\n | 'name'\n | 'value'\n | 'defaultChecked'\n | 'form'\n // Excluded for conflict with Field type\n | 'type'\n > {\n type?: string;\n}\n\nexport function fieldToSwitch({\n disabled,\n field: { onBlur: fieldOnBlur, ...field },\n form: { isSubmitting },\n type,\n onBlur,\n ...props\n}: SwitchProps): MuiSwitchProps {\n if (process.env.NODE_ENV !== 'production') {\n invariant(\n type === 'checkbox',\n `property type=checkbox is missing from field ${field.name}, this can caused unexpected behaviour`\n );\n }\n\n return {\n disabled: disabled ?? isSubmitting,\n onBlur:\n onBlur ??\n function (e) {\n fieldOnBlur(e ?? field.name);\n },\n ...field,\n ...props,\n };\n}\n\nexport function Switch(props: SwitchProps) {\n return <MuiSwitch {...fieldToSwitch(props)} />;\n}\n\nSwitch.displayName = 'FormikMaterialUISwitch';\n","import * as React from 'react';\nimport MuiCheckbox, {\n CheckboxProps as MuiCheckboxProps,\n} from '@material-ui/core/Checkbox';\nimport { FieldProps } from 'formik';\nimport invariant from 'tiny-warning';\n\nexport interface CheckboxProps\n extends FieldProps,\n Omit<\n MuiCheckboxProps,\n | 'name'\n | 'value'\n | 'error'\n | 'form'\n | 'checked'\n | 'defaultChecked'\n // Excluded for conflict with Field type\n | 'type'\n > {\n type?: string;\n}\n\nexport function fieldToCheckbox({\n disabled,\n field: { onBlur: fieldOnBlur, ...field },\n form: { isSubmitting },\n type,\n onBlur,\n ...props\n}: CheckboxProps): MuiCheckboxProps {\n const indeterminate = !Array.isArray(field.value) && field.value == null;\n\n if (process.env.NODE_ENV !== 'production') {\n invariant(\n type === 'checkbox',\n `property type=checkbox is missing from field ${field.name}, this can caused unexpected behaviour`\n );\n }\n\n return {\n disabled: disabled ?? isSubmitting,\n indeterminate,\n onBlur:\n onBlur ??\n function (e) {\n fieldOnBlur(e ?? field.name);\n },\n ...field,\n ...props,\n };\n}\n\nexport function Checkbox(props: CheckboxProps) {\n return <MuiCheckbox {...fieldToCheckbox(props)} />;\n}\n\nCheckbox.displayName = 'FormikMaterialUICheckbox';\n","import * as React from 'react';\nimport MuiCheckbox from '@material-ui/core/Checkbox';\nimport F
|