From 514b476b3fc6071388b14facccc77860076f0286 Mon Sep 17 00:00:00 2001 From: Megan Taylor Date: Thu, 28 Jul 2022 11:01:54 -0400 Subject: [PATCH 1/3] add element to input label proptype options --- packages/ra-ui-materialui/src/input/DateInput.tsx | 2 +- packages/ra-ui-materialui/src/input/DateTimeInput.tsx | 2 +- packages/ra-ui-materialui/src/input/FileInput.tsx | 2 +- packages/ra-ui-materialui/src/input/InputPropTypes.ts | 2 +- packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx | 2 +- packages/ra-ui-materialui/src/input/NumberInput.tsx | 2 +- packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx | 2 +- packages/ra-ui-materialui/src/input/SelectArrayInput.tsx | 2 +- packages/ra-ui-materialui/src/input/SelectInput.tsx | 2 +- packages/ra-ui-materialui/src/input/TextInput.tsx | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/ra-ui-materialui/src/input/DateInput.tsx b/packages/ra-ui-materialui/src/input/DateInput.tsx index 4e89164b092..893ad0ecb04 100644 --- a/packages/ra-ui-materialui/src/input/DateInput.tsx +++ b/packages/ra-ui-materialui/src/input/DateInput.tsx @@ -95,7 +95,7 @@ export const DateInput = ({ }; DateInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), resource: PropTypes.string, source: PropTypes.string, }; diff --git a/packages/ra-ui-materialui/src/input/DateTimeInput.tsx b/packages/ra-ui-materialui/src/input/DateTimeInput.tsx index ebe2d01b157..bd59afb1140 100644 --- a/packages/ra-ui-materialui/src/input/DateTimeInput.tsx +++ b/packages/ra-ui-materialui/src/input/DateTimeInput.tsx @@ -83,7 +83,7 @@ export const DateTimeInput = ({ }; DateTimeInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), resource: PropTypes.string, source: PropTypes.string, }; diff --git a/packages/ra-ui-materialui/src/input/FileInput.tsx b/packages/ra-ui-materialui/src/input/FileInput.tsx index 7189caf30e4..095c2bb693d 100644 --- a/packages/ra-ui-materialui/src/input/FileInput.tsx +++ b/packages/ra-ui-materialui/src/input/FileInput.tsx @@ -214,7 +214,7 @@ FileInput.propTypes = { className: PropTypes.string, id: PropTypes.string, isRequired: PropTypes.bool, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), labelMultiple: PropTypes.string, labelSingle: PropTypes.string, maxSize: PropTypes.number, diff --git a/packages/ra-ui-materialui/src/input/InputPropTypes.ts b/packages/ra-ui-materialui/src/input/InputPropTypes.ts index 79379f5db9e..0d3b8b99b6e 100644 --- a/packages/ra-ui-materialui/src/input/InputPropTypes.ts +++ b/packages/ra-ui-materialui/src/input/InputPropTypes.ts @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; * Common PropTypes for all react-admin inputs */ export const InputPropTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), resource: PropTypes.string, source: PropTypes.string, }; diff --git a/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx b/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx index fef331ecefc..60d288996d2 100644 --- a/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx +++ b/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx @@ -89,7 +89,7 @@ export const NullableBooleanInput = (props: NullableBooleanInputProps) => { }; NullableBooleanInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), options: PropTypes.object, resource: PropTypes.string, source: PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/NumberInput.tsx b/packages/ra-ui-materialui/src/input/NumberInput.tsx index 5404b614f76..6527b6fa0bd 100644 --- a/packages/ra-ui-materialui/src/input/NumberInput.tsx +++ b/packages/ra-ui-materialui/src/input/NumberInput.tsx @@ -152,7 +152,7 @@ export const NumberInput = ({ }; NumberInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), options: PropTypes.object, resource: PropTypes.string, source: PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx b/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx index 1ed5473adbc..9b7ecbbe330 100644 --- a/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx +++ b/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx @@ -202,7 +202,7 @@ export const RadioButtonGroupInput = (props: RadioButtonGroupInputProps) => { RadioButtonGroupInput.propTypes = { choices: PropTypes.arrayOf(PropTypes.any), - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), options: PropTypes.object, optionText: PropTypes.oneOfType([ PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx b/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx index f521e21598a..03f7d119864 100644 --- a/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx +++ b/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx @@ -302,7 +302,7 @@ SelectArrayInput.propTypes = { choices: PropTypes.arrayOf(PropTypes.object), className: PropTypes.string, children: PropTypes.node, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), options: PropTypes.object, optionText: PropTypes.oneOfType([ PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/SelectInput.tsx b/packages/ra-ui-materialui/src/input/SelectInput.tsx index 3ea2b003cf0..5910015f073 100644 --- a/packages/ra-ui-materialui/src/input/SelectInput.tsx +++ b/packages/ra-ui-materialui/src/input/SelectInput.tsx @@ -311,7 +311,7 @@ SelectInput.propTypes = { emptyValue: PropTypes.any, choices: PropTypes.arrayOf(PropTypes.object), className: PropTypes.string, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), options: PropTypes.object, optionText: PropTypes.oneOfType([ PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/TextInput.tsx b/packages/ra-ui-materialui/src/input/TextInput.tsx index f71eed45960..b47ff1e0b2b 100644 --- a/packages/ra-ui-materialui/src/input/TextInput.tsx +++ b/packages/ra-ui-materialui/src/input/TextInput.tsx @@ -89,7 +89,7 @@ export const TextInput = (props: TextInputProps) => { TextInput.propTypes = { className: PropTypes.string, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), + label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), options: PropTypes.object, resource: PropTypes.string, source: PropTypes.string, From bcc6591971c50668b15ac3b1f33e11257573acd5 Mon Sep 17 00:00:00 2001 From: Megan Taylor Date: Thu, 28 Jul 2022 11:03:33 -0400 Subject: [PATCH 2/3] fix imports in DatagridInput --- packages/ra-ui-materialui/src/input/DatagridInput.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/ra-ui-materialui/src/input/DatagridInput.tsx b/packages/ra-ui-materialui/src/input/DatagridInput.tsx index 87b69226e05..eb578ec09a0 100644 --- a/packages/ra-ui-materialui/src/input/DatagridInput.tsx +++ b/packages/ra-ui-materialui/src/input/DatagridInput.tsx @@ -8,11 +8,9 @@ import { useChoicesContext, useInput, } from 'ra-core'; -import { - CommonInputProps, - InputHelperText, - SupportCreateSuggestionOptions, -} from '.'; +import { CommonInputProps } from './CommonInputProps'; +import { InputHelperText } from './InputHelperText'; +import {SupportCreateSuggestionOptions} from "./useSupportCreateSuggestion"; import { Datagrid, DatagridProps } from '../list/datagrid'; import { FilterButton, FilterForm } from '../list/filter'; import { FilterContext } from '../list/FilterContext'; From ac37eefc6eac318d1638326cdf053c550a2f94b0 Mon Sep 17 00:00:00 2001 From: Megan Taylor Date: Thu, 28 Jul 2022 11:29:27 -0400 Subject: [PATCH 3/3] fix lint errors --- packages/ra-ui-materialui/src/input/DatagridInput.tsx | 2 +- packages/ra-ui-materialui/src/input/DateInput.tsx | 6 +++++- packages/ra-ui-materialui/src/input/DateTimeInput.tsx | 6 +++++- packages/ra-ui-materialui/src/input/FileInput.tsx | 6 +++++- packages/ra-ui-materialui/src/input/InputPropTypes.ts | 6 +++++- .../ra-ui-materialui/src/input/NullableBooleanInput.tsx | 6 +++++- packages/ra-ui-materialui/src/input/NumberInput.tsx | 6 +++++- .../ra-ui-materialui/src/input/RadioButtonGroupInput.tsx | 6 +++++- packages/ra-ui-materialui/src/input/SelectArrayInput.tsx | 6 +++++- packages/ra-ui-materialui/src/input/SelectInput.tsx | 6 +++++- packages/ra-ui-materialui/src/input/TextInput.tsx | 6 +++++- 11 files changed, 51 insertions(+), 11 deletions(-) diff --git a/packages/ra-ui-materialui/src/input/DatagridInput.tsx b/packages/ra-ui-materialui/src/input/DatagridInput.tsx index eb578ec09a0..c63a1de4217 100644 --- a/packages/ra-ui-materialui/src/input/DatagridInput.tsx +++ b/packages/ra-ui-materialui/src/input/DatagridInput.tsx @@ -10,7 +10,7 @@ import { } from 'ra-core'; import { CommonInputProps } from './CommonInputProps'; import { InputHelperText } from './InputHelperText'; -import {SupportCreateSuggestionOptions} from "./useSupportCreateSuggestion"; +import { SupportCreateSuggestionOptions } from './useSupportCreateSuggestion'; import { Datagrid, DatagridProps } from '../list/datagrid'; import { FilterButton, FilterForm } from '../list/filter'; import { FilterContext } from '../list/FilterContext'; diff --git a/packages/ra-ui-materialui/src/input/DateInput.tsx b/packages/ra-ui-materialui/src/input/DateInput.tsx index 893ad0ecb04..8d2dd82c8c1 100644 --- a/packages/ra-ui-materialui/src/input/DateInput.tsx +++ b/packages/ra-ui-materialui/src/input/DateInput.tsx @@ -95,7 +95,11 @@ export const DateInput = ({ }; DateInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), resource: PropTypes.string, source: PropTypes.string, }; diff --git a/packages/ra-ui-materialui/src/input/DateTimeInput.tsx b/packages/ra-ui-materialui/src/input/DateTimeInput.tsx index bd59afb1140..8345c61572e 100644 --- a/packages/ra-ui-materialui/src/input/DateTimeInput.tsx +++ b/packages/ra-ui-materialui/src/input/DateTimeInput.tsx @@ -83,7 +83,11 @@ export const DateTimeInput = ({ }; DateTimeInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), resource: PropTypes.string, source: PropTypes.string, }; diff --git a/packages/ra-ui-materialui/src/input/FileInput.tsx b/packages/ra-ui-materialui/src/input/FileInput.tsx index 095c2bb693d..3d28c37e377 100644 --- a/packages/ra-ui-materialui/src/input/FileInput.tsx +++ b/packages/ra-ui-materialui/src/input/FileInput.tsx @@ -214,7 +214,11 @@ FileInput.propTypes = { className: PropTypes.string, id: PropTypes.string, isRequired: PropTypes.bool, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), labelMultiple: PropTypes.string, labelSingle: PropTypes.string, maxSize: PropTypes.number, diff --git a/packages/ra-ui-materialui/src/input/InputPropTypes.ts b/packages/ra-ui-materialui/src/input/InputPropTypes.ts index 0d3b8b99b6e..e0ed83d520c 100644 --- a/packages/ra-ui-materialui/src/input/InputPropTypes.ts +++ b/packages/ra-ui-materialui/src/input/InputPropTypes.ts @@ -4,7 +4,11 @@ import PropTypes from 'prop-types'; * Common PropTypes for all react-admin inputs */ export const InputPropTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), resource: PropTypes.string, source: PropTypes.string, }; diff --git a/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx b/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx index 60d288996d2..bb3680b2e6d 100644 --- a/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx +++ b/packages/ra-ui-materialui/src/input/NullableBooleanInput.tsx @@ -89,7 +89,11 @@ export const NullableBooleanInput = (props: NullableBooleanInputProps) => { }; NullableBooleanInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), options: PropTypes.object, resource: PropTypes.string, source: PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/NumberInput.tsx b/packages/ra-ui-materialui/src/input/NumberInput.tsx index 6527b6fa0bd..8a5a9bb02ad 100644 --- a/packages/ra-ui-materialui/src/input/NumberInput.tsx +++ b/packages/ra-ui-materialui/src/input/NumberInput.tsx @@ -152,7 +152,11 @@ export const NumberInput = ({ }; NumberInput.propTypes = { - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), options: PropTypes.object, resource: PropTypes.string, source: PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx b/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx index 9b7ecbbe330..1102798c84b 100644 --- a/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx +++ b/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.tsx @@ -202,7 +202,11 @@ export const RadioButtonGroupInput = (props: RadioButtonGroupInputProps) => { RadioButtonGroupInput.propTypes = { choices: PropTypes.arrayOf(PropTypes.any), - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), options: PropTypes.object, optionText: PropTypes.oneOfType([ PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx b/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx index 03f7d119864..b9c20e14628 100644 --- a/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx +++ b/packages/ra-ui-materialui/src/input/SelectArrayInput.tsx @@ -302,7 +302,11 @@ SelectArrayInput.propTypes = { choices: PropTypes.arrayOf(PropTypes.object), className: PropTypes.string, children: PropTypes.node, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), options: PropTypes.object, optionText: PropTypes.oneOfType([ PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/SelectInput.tsx b/packages/ra-ui-materialui/src/input/SelectInput.tsx index 5910015f073..86b59c1434d 100644 --- a/packages/ra-ui-materialui/src/input/SelectInput.tsx +++ b/packages/ra-ui-materialui/src/input/SelectInput.tsx @@ -311,7 +311,11 @@ SelectInput.propTypes = { emptyValue: PropTypes.any, choices: PropTypes.arrayOf(PropTypes.object), className: PropTypes.string, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), options: PropTypes.object, optionText: PropTypes.oneOfType([ PropTypes.string, diff --git a/packages/ra-ui-materialui/src/input/TextInput.tsx b/packages/ra-ui-materialui/src/input/TextInput.tsx index b47ff1e0b2b..b12b96f1288 100644 --- a/packages/ra-ui-materialui/src/input/TextInput.tsx +++ b/packages/ra-ui-materialui/src/input/TextInput.tsx @@ -89,7 +89,11 @@ export const TextInput = (props: TextInputProps) => { TextInput.propTypes = { className: PropTypes.string, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.element]), + label: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.bool, + PropTypes.element, + ]), options: PropTypes.object, resource: PropTypes.string, source: PropTypes.string,