@dartech/arsenal-ui 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +13 -0
- package/.eslintrc.json +22 -0
- package/{index.d.ts → index.ts} +5 -5
- package/jest.config.ts +11 -0
- package/package.json +3 -12
- package/project.json +94 -0
- package/rollup.config.js +146 -0
- package/src/assets/chevron_left_gray.svg +3 -0
- package/src/consts/index.ts +13 -0
- package/src/interfaces/common.ts +18 -0
- package/src/interfaces/definition.ts +143 -0
- package/src/interfaces/{index.d.ts → index.ts} +3 -3
- package/src/interfaces/ui.ts +80 -0
- package/src/lib/Alert/Alert.tsx +108 -0
- package/src/lib/Alert/index.ts +1 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +16 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.tsx +40 -0
- package/src/lib/Breadcrumbs/{index.d.ts → index.ts} +1 -1
- package/src/lib/ContentLayout/ContentLayout.tsx +31 -0
- package/src/lib/ContentLayout/index.ts +1 -0
- package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +78 -0
- package/src/lib/Definition/CreateDefinition/{index.d.ts → index.ts} +1 -1
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +71 -0
- package/src/lib/Definition/DefinitionFiller/{index.d.ts → index.ts} +1 -1
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +54 -0
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +67 -0
- package/src/lib/Definition/DefinitionValueView/{index.d.ts → index.ts} +1 -1
- package/src/lib/Definition/{index.d.ts → index.ts} +3 -3
- package/src/lib/Forms/BackButton.tsx +46 -0
- package/src/lib/Forms/ControlAceEditor.tsx +125 -0
- package/src/lib/Forms/ControlAutocomplete.tsx +145 -0
- package/src/lib/Forms/ControlCheckbox.tsx +113 -0
- package/src/lib/Forms/ControlDate.tsx +75 -0
- package/src/lib/Forms/ControlDateTime.tsx +77 -0
- package/src/lib/Forms/ControlDebouncedInput.tsx +80 -0
- package/src/lib/Forms/ControlInput.tsx +111 -0
- package/src/lib/Forms/ControlNumberInput.tsx +121 -0
- package/src/lib/Forms/ControlQueryAutocomplete.tsx +197 -0
- package/src/lib/Forms/ControlRadio.tsx +136 -0
- package/src/lib/Forms/ControlSelect.tsx +164 -0
- package/src/lib/Forms/ControlSwitch.tsx +71 -0
- package/src/lib/Forms/ControlTime.tsx +93 -0
- package/src/lib/Forms/CopyButton.tsx +46 -0
- package/src/lib/Forms/{index.d.ts → index.ts} +15 -15
- package/src/lib/Forms/useAutocomplete.tsx +47 -0
- package/src/lib/InfoItem/InfoItem.tsx +40 -0
- package/src/lib/InfoItem/{index.d.ts → index.ts} +1 -1
- package/src/lib/InfoItem/styles.ts +17 -0
- package/src/lib/JsonPathPicker/JsonPathPicker.tsx +73 -0
- package/src/lib/JsonPathPicker/PropertyStep.tsx +70 -0
- package/src/lib/JsonPathPicker/{index.d.ts → index.ts} +1 -1
- package/src/lib/JsonView/JsonView.tsx +41 -0
- package/src/lib/JsonView/{index.d.ts → index.ts} +1 -1
- package/src/lib/Loader/Loader.tsx +41 -0
- package/src/lib/Loader/{index.d.ts → index.ts} +1 -1
- package/src/lib/Modals/JsonModalView.tsx +53 -0
- package/src/lib/Modals/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/PropertyFiller/JsonEditor.tsx +58 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +129 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +85 -0
- package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +199 -0
- package/src/lib/Property/PropertyFiller/{index.d.ts → index.ts} +2 -2
- package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +72 -0
- package/src/lib/Property/PropertyFiller/useStyles.ts +12 -0
- package/src/lib/Property/PropertyValidator/NodeValidator.tsx +92 -0
- package/src/lib/Property/PropertyValidator/NodesList.tsx +26 -0
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +59 -0
- package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +42 -0
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +4 -0
- package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +36 -0
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +62 -0
- package/src/lib/Property/PropertyValidator/index.ts +1 -0
- package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +49 -0
- package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +58 -0
- package/src/lib/Property/PropertyValueField/DateValueField.tsx +58 -0
- package/src/lib/Property/PropertyValueField/JsonValueField.tsx +65 -0
- package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +49 -0
- package/src/lib/Property/PropertyValueField/StringValueField.tsx +50 -0
- package/src/lib/Property/PropertyValueField/TimeValueField.tsx +67 -0
- package/src/lib/Property/PropertyValueField/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +115 -0
- package/src/lib/Property/PropertyWidget/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +148 -0
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +158 -0
- package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +40 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +41 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +27 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +133 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +46 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +52 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +103 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/UpsertProperty/{index.d.ts → index.ts} +2 -2
- package/src/lib/Property/UpsertProperty/useCustomFields.ts +22 -0
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +37 -0
- package/src/lib/Property/ViewPropertiesList/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +40 -0
- package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +48 -0
- package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +148 -0
- package/src/lib/Property/ViewProperty/PropertyItem.tsx +43 -0
- package/src/lib/Property/ViewProperty/ViewProperty.tsx +52 -0
- package/src/lib/Property/ViewProperty/{index.d.ts → index.ts} +1 -1
- package/src/lib/Property/{index.d.ts → index.ts} +5 -5
- package/src/lib/Sidebar/Sidebar.styled.tsx +157 -0
- package/src/lib/Sidebar/Sidebar.tsx +27 -0
- package/src/lib/Sidebar/SidebarContext.tsx +37 -0
- package/src/lib/Sidebar/SidebarDrawer.tsx +50 -0
- package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +16 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +54 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +54 -0
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +62 -0
- package/src/lib/Sidebar/SidebarLink/{index.d.ts → index.ts} +2 -2
- package/src/lib/Sidebar/index.ts +2 -0
- package/src/lib/Status/Status.tsx +16 -0
- package/src/lib/Status/{index.d.ts → index.ts} +1 -1
- package/src/lib/Status/styles.ts +21 -0
- package/src/lib/StepperView/StepperView.tsx +73 -0
- package/src/lib/StepperView/{index.d.ts → index.ts} +1 -1
- package/src/lib/Table/DataGrid/JsonTypeCell.tsx +51 -0
- package/src/lib/Table/DataGrid/Table.tsx +117 -0
- package/src/lib/Table/DataGrid/TableAction.tsx +43 -0
- package/src/lib/Table/DataGrid/TableColumnMenu.tsx +12 -0
- package/src/lib/Table/DataGrid/TablePagination.tsx +42 -0
- package/src/lib/Table/DataGrid/index.ts +2 -0
- package/src/lib/Table/DataGrid/styles.ts +59 -0
- package/src/lib/Table/DataGrid/usePagination.ts +15 -0
- package/src/lib/Table/DataGrid/useTableQueryPagination.ts +47 -0
- package/src/lib/Table/DataGrid/useTableQuerySorting.ts +47 -0
- package/src/lib/Table/SimpleTable/SimpleTable.tsx +138 -0
- package/src/lib/Table/SimpleTable/TableActionCell.tsx +67 -0
- package/src/lib/Table/SimpleTable/index.ts +2 -0
- package/src/lib/Table/SimpleTable/useTablePagination.ts +54 -0
- package/src/lib/Table/SimpleTable/useTableSorting.ts +50 -0
- package/src/lib/Table/index.ts +2 -0
- package/src/lib/Tabs/RouteTabs.tsx +54 -0
- package/src/lib/Tabs/TabPanel.tsx +42 -0
- package/src/lib/Tabs/{index.d.ts → index.ts} +2 -2
- package/src/lib/{index.d.ts → index.ts} +16 -16
- package/src/theme/baseTheme.ts +128 -0
- package/src/theme/fonts.d.ts +2 -0
- package/src/theme/index.ts +126 -0
- package/src/theme/inputThemeOptions.ts +126 -0
- package/src/theme/stepperThemeOptions.ts +20 -0
- package/src/theme/tableThemeOptions.ts +50 -0
- package/src/theme/typographyThemeOptions.ts +32 -0
- package/src/utils/common.ts +73 -0
- package/src/utils/dem.ts +431 -0
- package/src/utils/hooks.ts +41 -0
- package/src/utils/{index.d.ts → index.ts} +5 -5
- package/src/utils/ui-utils.tsx +102 -0
- package/src/utils/validators.ts +14 -0
- package/tsconfig.json +25 -0
- package/tsconfig.lib.json +23 -0
- package/tsconfig.spec.json +20 -0
- package/index.js +0 -1
- package/src/consts/index.d.ts +0 -12
- package/src/interfaces/common.d.ts +0 -17
- package/src/interfaces/definition.d.ts +0 -107
- package/src/interfaces/ui.d.ts +0 -70
- package/src/lib/Alert/Alert.d.ts +0 -53
- package/src/lib/Alert/index.d.ts +0 -1
- package/src/lib/Breadcrumbs/Breadcrumbs.d.ts +0 -9
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.d.ts +0 -2
- package/src/lib/ContentLayout/ContentLayout.d.ts +0 -9
- package/src/lib/ContentLayout/index.d.ts +0 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +0 -11
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +0 -10
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +0 -8
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +0 -9
- package/src/lib/Forms/BackButton.d.ts +0 -7
- package/src/lib/Forms/ControlAceEditor.d.ts +0 -24
- package/src/lib/Forms/ControlAutocomplete.d.ts +0 -69
- package/src/lib/Forms/ControlCheckbox.d.ts +0 -51
- package/src/lib/Forms/ControlDate.d.ts +0 -18
- package/src/lib/Forms/ControlDateTime.d.ts +0 -18
- package/src/lib/Forms/ControlDebouncedInput.d.ts +0 -4
- package/src/lib/Forms/ControlInput.d.ts +0 -59
- package/src/lib/Forms/ControlNumberInput.d.ts +0 -51
- package/src/lib/Forms/ControlQueryAutocomplete.d.ts +0 -16
- package/src/lib/Forms/ControlRadio.d.ts +0 -66
- package/src/lib/Forms/ControlSelect.d.ts +0 -67
- package/src/lib/Forms/ControlSwitch.d.ts +0 -19
- package/src/lib/Forms/ControlTime.d.ts +0 -18
- package/src/lib/Forms/CopyButton.d.ts +0 -20
- package/src/lib/Forms/useAutocomplete.d.ts +0 -10
- package/src/lib/InfoItem/InfoItem.d.ts +0 -10
- package/src/lib/InfoItem/styles.d.ts +0 -12
- package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +0 -10
- package/src/lib/JsonPathPicker/PropertyStep.d.ts +0 -11
- package/src/lib/JsonView/JsonView.d.ts +0 -7
- package/src/lib/Loader/Loader.d.ts +0 -21
- package/src/lib/Modals/JsonModalView.d.ts +0 -10
- package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +0 -10
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +0 -12
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +0 -11
- package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +0 -12
- package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +0 -24
- package/src/lib/Property/PropertyFiller/useStyles.d.ts +0 -12
- package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +0 -6
- package/src/lib/Property/PropertyValidator/NodesList.d.ts +0 -6
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +0 -8
- package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +0 -6
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +0 -3
- package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +0 -8
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +0 -7
- package/src/lib/Property/PropertyValidator/index.d.ts +0 -1
- package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +0 -7
- package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/DateValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +0 -10
- package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/StringValueField.d.ts +0 -9
- package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +0 -9
- package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +0 -13
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +0 -13
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +0 -10
- package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +0 -7
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +0 -6
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +0 -7
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +0 -8
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +0 -6
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +0 -10
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +0 -6
- package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +0 -6
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +0 -8
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +0 -7
- package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +0 -8
- package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +0 -7
- package/src/lib/Property/ViewProperty/PropertyItem.d.ts +0 -9
- package/src/lib/Property/ViewProperty/ViewProperty.d.ts +0 -9
- package/src/lib/Sidebar/Sidebar.d.ts +0 -10
- package/src/lib/Sidebar/Sidebar.styled.d.ts +0 -117
- package/src/lib/Sidebar/SidebarContext.d.ts +0 -11
- package/src/lib/Sidebar/SidebarDrawer.d.ts +0 -9
- package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +0 -7
- package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +0 -7
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +0 -8
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +0 -10
- package/src/lib/Sidebar/index.d.ts +0 -2
- package/src/lib/Status/Status.d.ts +0 -8
- package/src/lib/Status/styles.d.ts +0 -12
- package/src/lib/StepperView/StepperView.d.ts +0 -11
- package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +0 -7
- package/src/lib/Table/DataGrid/Table.d.ts +0 -49
- package/src/lib/Table/DataGrid/TableAction.d.ts +0 -13
- package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +0 -3
- package/src/lib/Table/DataGrid/TablePagination.d.ts +0 -3
- package/src/lib/Table/DataGrid/index.d.ts +0 -2
- package/src/lib/Table/DataGrid/styles.d.ts +0 -12
- package/src/lib/Table/DataGrid/usePagination.d.ts +0 -5
- package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +0 -11
- package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +0 -6
- package/src/lib/Table/SimpleTable/SimpleTable.d.ts +0 -17
- package/src/lib/Table/SimpleTable/TableActionCell.d.ts +0 -10
- package/src/lib/Table/SimpleTable/index.d.ts +0 -2
- package/src/lib/Table/SimpleTable/useTablePagination.d.ts +0 -7
- package/src/lib/Table/SimpleTable/useTableSorting.d.ts +0 -6
- package/src/lib/Table/index.d.ts +0 -2
- package/src/lib/Tabs/RouteTabs.d.ts +0 -11
- package/src/lib/Tabs/TabPanel.d.ts +0 -25
- package/src/theme/baseTheme.d.ts +0 -2
- package/src/theme/index.d.ts +0 -1
- package/src/theme/inputThemeOptions.d.ts +0 -117
- package/src/theme/stepperThemeOptions.d.ts +0 -16
- package/src/theme/tableThemeOptions.d.ts +0 -47
- package/src/theme/typographyThemeOptions.d.ts +0 -29
- package/src/utils/common.d.ts +0 -7
- package/src/utils/dem.d.ts +0 -27
- package/src/utils/hooks.d.ts +0 -7
- package/src/utils/ui-utils.d.ts +0 -8
- package/src/utils/validators.d.ts +0 -5
@@ -0,0 +1,121 @@
|
|
1
|
+
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
2
|
+
import { useController, Control, useWatch } from 'react-hook-form';
|
3
|
+
import { floatsOnly, digitsOnly } from '../../utils';
|
4
|
+
import { ValidateFunc } from '../../interfaces';
|
5
|
+
|
6
|
+
type Props = TextFieldProps & {
|
7
|
+
/**
|
8
|
+
* React Hook Form control `name` propery
|
9
|
+
*/
|
10
|
+
name: string;
|
11
|
+
/**
|
12
|
+
* Label for MUI TextField component
|
13
|
+
*/
|
14
|
+
label?: string;
|
15
|
+
/**
|
16
|
+
* React Hook Form `control`
|
17
|
+
*/
|
18
|
+
control: Control;
|
19
|
+
/**
|
20
|
+
* Is input required flag
|
21
|
+
*/
|
22
|
+
required?: boolean;
|
23
|
+
/**
|
24
|
+
* React Hook Form `defaultValue`
|
25
|
+
*/
|
26
|
+
defaultValue?: number;
|
27
|
+
/**
|
28
|
+
* Is disabled input flag
|
29
|
+
*/
|
30
|
+
disabled?: boolean;
|
31
|
+
/**
|
32
|
+
* React Hook Form validate function
|
33
|
+
* ```typescript
|
34
|
+
* type ValidateFunc = (value: string) => boolean | string;
|
35
|
+
* ```
|
36
|
+
*/
|
37
|
+
validate?: ValidateFunc | Record<string, ValidateFunc>;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Hide error message flag
|
41
|
+
*/
|
42
|
+
hideErrorMessage?: boolean;
|
43
|
+
/**
|
44
|
+
* Custom onChange function
|
45
|
+
*/
|
46
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
47
|
+
/**
|
48
|
+
* Is number decimal or integer flag
|
49
|
+
*/
|
50
|
+
decimal?: boolean;
|
51
|
+
};
|
52
|
+
|
53
|
+
export const ControlNumberInput = ({
|
54
|
+
control,
|
55
|
+
validate,
|
56
|
+
name = '',
|
57
|
+
label = '',
|
58
|
+
required = false,
|
59
|
+
defaultValue,
|
60
|
+
disabled = false,
|
61
|
+
hideErrorMessage = false,
|
62
|
+
onChange: customOnChange,
|
63
|
+
decimal = false,
|
64
|
+
...textFieldProps
|
65
|
+
}: Props) => {
|
66
|
+
const {
|
67
|
+
field: { ref, onChange },
|
68
|
+
fieldState: { error },
|
69
|
+
} = useController({
|
70
|
+
name,
|
71
|
+
control,
|
72
|
+
defaultValue,
|
73
|
+
rules: {
|
74
|
+
required: required && 'Please, fill this field',
|
75
|
+
validate: (val) => {
|
76
|
+
if (decimal && !floatsOnly.test(val)) {
|
77
|
+
return 'Not valid number';
|
78
|
+
} else if (!decimal && !digitsOnly.test(val)) {
|
79
|
+
return 'Not valid integer';
|
80
|
+
}
|
81
|
+
return true;
|
82
|
+
},
|
83
|
+
},
|
84
|
+
});
|
85
|
+
const value = useWatch({ control, name });
|
86
|
+
|
87
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
88
|
+
const lastData = event.nativeEvent['data'] || event.target.value;
|
89
|
+
if (!isNaN(lastData) || (decimal && lastData === '.') || lastData === '-' || lastData === '+') {
|
90
|
+
if (customOnChange) {
|
91
|
+
customOnChange(event);
|
92
|
+
} else {
|
93
|
+
onChange(event.target.value);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
};
|
97
|
+
|
98
|
+
return (
|
99
|
+
<TextField
|
100
|
+
fullWidth
|
101
|
+
size="small"
|
102
|
+
variant="outlined"
|
103
|
+
type="text"
|
104
|
+
inputRef={ref}
|
105
|
+
name={name}
|
106
|
+
label={label}
|
107
|
+
error={!!error}
|
108
|
+
helperText={!hideErrorMessage && error?.message}
|
109
|
+
disabled={disabled}
|
110
|
+
value={value ?? ''}
|
111
|
+
{...textFieldProps}
|
112
|
+
onChange={handleChange}
|
113
|
+
inputProps={{
|
114
|
+
...(textFieldProps?.inputProps ?? {}),
|
115
|
+
value: value ?? '',
|
116
|
+
}}
|
117
|
+
/>
|
118
|
+
);
|
119
|
+
};
|
120
|
+
|
121
|
+
export default ControlNumberInput;
|
@@ -0,0 +1,197 @@
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
2
|
+
import TextField from '@mui/material/TextField';
|
3
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
4
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
5
|
+
|
6
|
+
import { useController, useWatch } from 'react-hook-form';
|
7
|
+
import { useQuery } from '@tanstack/react-query';
|
8
|
+
import qs from 'qs';
|
9
|
+
import { useDebounce } from '../../utils/hooks';
|
10
|
+
import useAutocomplete from './useAutocomplete';
|
11
|
+
|
12
|
+
import { ControlAutocompleteProps } from './ControlAutocomplete';
|
13
|
+
import { PaginateData } from '../../interfaces';
|
14
|
+
|
15
|
+
type PaginateParams = {
|
16
|
+
page: string;
|
17
|
+
size: string;
|
18
|
+
[key: string]: string;
|
19
|
+
};
|
20
|
+
|
21
|
+
type ControlQueryAutocompleteProps<T> = Omit<ControlAutocompleteProps, 'options'> & {
|
22
|
+
searchBy: string;
|
23
|
+
sortBy?: string;
|
24
|
+
queryFunction: (params: PaginateParams) => Promise<PaginateData<T>>;
|
25
|
+
itemQueryFunction?: (valueKey: string) => Promise<T>;
|
26
|
+
};
|
27
|
+
|
28
|
+
export function ControlQueryAutocomplete<T>({
|
29
|
+
name,
|
30
|
+
label,
|
31
|
+
control,
|
32
|
+
required = false,
|
33
|
+
searchBy,
|
34
|
+
labelKey,
|
35
|
+
multiple = false,
|
36
|
+
disabled,
|
37
|
+
valueKey,
|
38
|
+
sortBy = '',
|
39
|
+
hideErrorMessage,
|
40
|
+
disableCloseOnSelect,
|
41
|
+
textFieldProps,
|
42
|
+
onChange,
|
43
|
+
queryFunction,
|
44
|
+
validate,
|
45
|
+
itemQueryFunction,
|
46
|
+
...autocompleteProps
|
47
|
+
}: ControlQueryAutocompleteProps<T>) {
|
48
|
+
const {
|
49
|
+
field: { ref, onChange: setFieldValue },
|
50
|
+
fieldState: { error, isDirty },
|
51
|
+
} = useController({ control, name, rules: { required: required && 'Please, fill this field', validate } });
|
52
|
+
const formValue = useWatch({ control, name, defaultValue: multiple ? [] : null });
|
53
|
+
|
54
|
+
const { getOptionLabel, isOptionEqualToValue, renderOption } = useAutocomplete({ valueKey, labelKey });
|
55
|
+
|
56
|
+
const [open, setOpen] = useState(false);
|
57
|
+
const [inputValue, setInputValue] = useState('');
|
58
|
+
const [searchValue, setSearchValue] = useState('');
|
59
|
+
const [totalItems, setTotalItems] = useState(0);
|
60
|
+
const [page, setPage] = useState(0);
|
61
|
+
const [options, setOptions] = useState<unknown[]>([]);
|
62
|
+
|
63
|
+
const debouncedChange = useDebounce((val) => {
|
64
|
+
setPage(0);
|
65
|
+
setSearchValue(val);
|
66
|
+
setOptions([]);
|
67
|
+
}, 500);
|
68
|
+
|
69
|
+
const handleInputChange = useCallback(
|
70
|
+
(_, value) => {
|
71
|
+
setInputValue(value);
|
72
|
+
debouncedChange(value);
|
73
|
+
},
|
74
|
+
[debouncedChange]
|
75
|
+
);
|
76
|
+
|
77
|
+
const handleValueChange = useCallback(
|
78
|
+
(event, value) => {
|
79
|
+
setFieldValue(value);
|
80
|
+
if (onChange) {
|
81
|
+
onChange(event, value);
|
82
|
+
}
|
83
|
+
},
|
84
|
+
[setFieldValue, onChange]
|
85
|
+
);
|
86
|
+
|
87
|
+
useEffect(() => {
|
88
|
+
if (!isDirty && formValue && itemQueryFunction) {
|
89
|
+
let requestValue = formValue;
|
90
|
+
|
91
|
+
if (typeof formValue === 'object' && valueKey in formValue) {
|
92
|
+
requestValue = formValue[valueKey];
|
93
|
+
}
|
94
|
+
|
95
|
+
itemQueryFunction(requestValue)
|
96
|
+
.then((item) => {
|
97
|
+
setFieldValue(item);
|
98
|
+
setInputValue(item[labelKey]);
|
99
|
+
})
|
100
|
+
.catch();
|
101
|
+
}
|
102
|
+
}, [formValue, isDirty, valueKey, labelKey, itemQueryFunction, setFieldValue]);
|
103
|
+
|
104
|
+
const handleOnScroll = useCallback(
|
105
|
+
(event: React.SyntheticEvent) => {
|
106
|
+
const listboxNode = event.currentTarget;
|
107
|
+
if (
|
108
|
+
listboxNode.scrollHeight - listboxNode.scrollTop - listboxNode.clientHeight <= 1 &&
|
109
|
+
options.length < totalItems
|
110
|
+
) {
|
111
|
+
setPage((page) => page + 1);
|
112
|
+
}
|
113
|
+
},
|
114
|
+
[totalItems, options]
|
115
|
+
);
|
116
|
+
|
117
|
+
const handleOpen = () => {
|
118
|
+
setOpen(true);
|
119
|
+
};
|
120
|
+
|
121
|
+
const handleClose = () => {
|
122
|
+
setOpen(false);
|
123
|
+
setSearchValue('');
|
124
|
+
};
|
125
|
+
|
126
|
+
const { data, isFetching } = useQuery(['options', page, searchValue], () => {
|
127
|
+
const params = qs.parse(
|
128
|
+
{
|
129
|
+
page: `${page}`,
|
130
|
+
size: '20',
|
131
|
+
sort: sortBy,
|
132
|
+
...(searchValue ? { [searchBy]: searchValue } : {}),
|
133
|
+
},
|
134
|
+
{ ignoreQueryPrefix: true }
|
135
|
+
);
|
136
|
+
return queryFunction(params as PaginateParams);
|
137
|
+
});
|
138
|
+
|
139
|
+
useEffect(() => {
|
140
|
+
if (data) {
|
141
|
+
setOptions((prevOptions) => [...prevOptions, ...data.collection]);
|
142
|
+
setTotalItems(data.totalItems);
|
143
|
+
}
|
144
|
+
}, [data]);
|
145
|
+
|
146
|
+
return (
|
147
|
+
<Autocomplete
|
148
|
+
fullWidth
|
149
|
+
disablePortal
|
150
|
+
size="small"
|
151
|
+
readOnly={disabled}
|
152
|
+
options={options}
|
153
|
+
multiple={multiple}
|
154
|
+
getOptionLabel={getOptionLabel}
|
155
|
+
isOptionEqualToValue={isOptionEqualToValue}
|
156
|
+
disableCloseOnSelect={disableCloseOnSelect || multiple}
|
157
|
+
filterSelectedOptions={multiple}
|
158
|
+
inputValue={inputValue}
|
159
|
+
value={formValue}
|
160
|
+
onChange={handleValueChange}
|
161
|
+
loading={isFetching}
|
162
|
+
clearOnBlur={false}
|
163
|
+
open={open}
|
164
|
+
filterOptions={(x) => x}
|
165
|
+
onOpen={handleOpen}
|
166
|
+
onClose={handleClose}
|
167
|
+
onInputChange={handleInputChange}
|
168
|
+
ListboxProps={{
|
169
|
+
onScroll: handleOnScroll,
|
170
|
+
}}
|
171
|
+
renderOption={renderOption}
|
172
|
+
renderInput={(params) => (
|
173
|
+
<TextField
|
174
|
+
{...params}
|
175
|
+
label={label}
|
176
|
+
variant="outlined"
|
177
|
+
error={!!error}
|
178
|
+
inputRef={ref}
|
179
|
+
helperText={!hideErrorMessage && error?.message}
|
180
|
+
InputProps={{
|
181
|
+
...params.InputProps,
|
182
|
+
endAdornment: (
|
183
|
+
<React.Fragment>
|
184
|
+
{isFetching ? <CircularProgress color="inherit" size={20} /> : null}
|
185
|
+
{params.InputProps.endAdornment}
|
186
|
+
</React.Fragment>
|
187
|
+
),
|
188
|
+
}}
|
189
|
+
{...textFieldProps}
|
190
|
+
/>
|
191
|
+
)}
|
192
|
+
{...autocompleteProps}
|
193
|
+
/>
|
194
|
+
);
|
195
|
+
}
|
196
|
+
|
197
|
+
export default ControlQueryAutocomplete;
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import Radio from '@mui/material/Radio';
|
2
|
+
import RadioGroup from '@mui/material/RadioGroup';
|
3
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
4
|
+
import FormControl from '@mui/material/FormControl';
|
5
|
+
import FormLabel from '@mui/material/FormLabel';
|
6
|
+
|
7
|
+
import { Control, useController, useWatch } from 'react-hook-form';
|
8
|
+
import { ValidateFunc } from '../../interfaces';
|
9
|
+
import { useCallback } from 'react';
|
10
|
+
import FormHelperText from '@mui/material/FormHelperText';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* This interface is referencing the [[ControlRadioBtn]] component props.
|
14
|
+
* @category Forms
|
15
|
+
*/
|
16
|
+
export interface ControlRadioProps {
|
17
|
+
/**
|
18
|
+
* React Hook Form `control`
|
19
|
+
*/
|
20
|
+
control: Control<any>;
|
21
|
+
/**
|
22
|
+
* React Hook Form control `name` propery
|
23
|
+
*/
|
24
|
+
name: string;
|
25
|
+
/**
|
26
|
+
* Label for component
|
27
|
+
*/
|
28
|
+
label?: string;
|
29
|
+
/**
|
30
|
+
* Radio group values
|
31
|
+
*/
|
32
|
+
values: string[] | unknown[];
|
33
|
+
/**
|
34
|
+
* Is input required flag
|
35
|
+
*/
|
36
|
+
required?: boolean;
|
37
|
+
/**
|
38
|
+
* React Hook Form `defaultValue`
|
39
|
+
*/
|
40
|
+
defaultValue?: unknown;
|
41
|
+
/**
|
42
|
+
* Is disabled input flag
|
43
|
+
*/
|
44
|
+
disabled?: boolean;
|
45
|
+
/**
|
46
|
+
* Hide error message flag
|
47
|
+
*/
|
48
|
+
hideErrorMessage?: boolean;
|
49
|
+
/**
|
50
|
+
* Custom onChange functionƒ
|
51
|
+
*/
|
52
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
53
|
+
/**
|
54
|
+
* React Hook Form validate function
|
55
|
+
* ```typescript
|
56
|
+
* type ValidateFunc = (value: string) => boolean | string;
|
57
|
+
* ```
|
58
|
+
*/
|
59
|
+
validate?: ValidateFunc | Record<string, ValidateFunc>;
|
60
|
+
/**
|
61
|
+
* Key for option label
|
62
|
+
*/
|
63
|
+
labelKey?: string;
|
64
|
+
/**
|
65
|
+
* Key for option value
|
66
|
+
*/
|
67
|
+
valueKey?: string;
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Material UI `Radio` controlled component. Used with react-hook-form
|
72
|
+
* @category Forms
|
73
|
+
*/
|
74
|
+
export const ControlRadio = ({
|
75
|
+
name,
|
76
|
+
label,
|
77
|
+
values = [],
|
78
|
+
control,
|
79
|
+
required,
|
80
|
+
defaultValue,
|
81
|
+
disabled,
|
82
|
+
hideErrorMessage,
|
83
|
+
labelKey,
|
84
|
+
valueKey,
|
85
|
+
validate,
|
86
|
+
onChange: customOnChange,
|
87
|
+
}: ControlRadioProps) => {
|
88
|
+
const {
|
89
|
+
field: { ref, onChange },
|
90
|
+
fieldState: { error },
|
91
|
+
} = useController({
|
92
|
+
name,
|
93
|
+
control,
|
94
|
+
defaultValue,
|
95
|
+
rules: {
|
96
|
+
required: required && 'Please, fill this field',
|
97
|
+
validate,
|
98
|
+
},
|
99
|
+
});
|
100
|
+
const value = useWatch({ control, name });
|
101
|
+
|
102
|
+
const getValue = useCallback(
|
103
|
+
(option) => {
|
104
|
+
if (typeof option === 'string') return option;
|
105
|
+
return valueKey ? option[valueKey] : option.value;
|
106
|
+
},
|
107
|
+
[valueKey]
|
108
|
+
);
|
109
|
+
const getLabel = useCallback(
|
110
|
+
(option) => {
|
111
|
+
if (typeof option === 'string') return option;
|
112
|
+
return labelKey ? option[labelKey] : option.label;
|
113
|
+
},
|
114
|
+
[labelKey]
|
115
|
+
);
|
116
|
+
|
117
|
+
return (
|
118
|
+
<FormControl disabled={disabled} error={!!error}>
|
119
|
+
<FormLabel id="radio-buttons-group">{label}</FormLabel>
|
120
|
+
<RadioGroup
|
121
|
+
aria-labelledby="radio-buttons-group"
|
122
|
+
ref={ref}
|
123
|
+
name={name}
|
124
|
+
value={value}
|
125
|
+
onChange={customOnChange ? customOnChange : onChange}
|
126
|
+
>
|
127
|
+
{values.map((item) => (
|
128
|
+
<FormControlLabel value={getValue(item)} control={<Radio />} label={getLabel(item)} />
|
129
|
+
))}
|
130
|
+
</RadioGroup>
|
131
|
+
{!hideErrorMessage && error?.message && <FormHelperText>{error.message}</FormHelperText>}
|
132
|
+
</FormControl>
|
133
|
+
);
|
134
|
+
};
|
135
|
+
|
136
|
+
export default ControlRadio;
|
@@ -0,0 +1,164 @@
|
|
1
|
+
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
2
|
+
import MenuItem from '@mui/material/MenuItem';
|
3
|
+
import ClearIcon from '@mui/icons-material/Clear';
|
4
|
+
|
5
|
+
import { useCallback } from 'react';
|
6
|
+
import { useController, Control, useWatch } from 'react-hook-form';
|
7
|
+
import { ValidateFunc } from '../../interfaces';
|
8
|
+
import IconButton from '@mui/material/IconButton';
|
9
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
10
|
+
|
11
|
+
/**
|
12
|
+
* This interface is referencing the [[ControlSelect]] component props.
|
13
|
+
* @category Forms
|
14
|
+
*/
|
15
|
+
export type ControlSelectProps = TextFieldProps & {
|
16
|
+
/**
|
17
|
+
* React Hook Form control `name` propery
|
18
|
+
*/
|
19
|
+
name: string;
|
20
|
+
/**
|
21
|
+
* Label for MUI TextField select component
|
22
|
+
*/
|
23
|
+
label?: string;
|
24
|
+
/**
|
25
|
+
* React Hook Form `control`
|
26
|
+
*/
|
27
|
+
control: Control<any>;
|
28
|
+
/**
|
29
|
+
* Is input required flag
|
30
|
+
*/
|
31
|
+
required?: boolean;
|
32
|
+
/**
|
33
|
+
* React Hook Form `defaultValue`
|
34
|
+
*/
|
35
|
+
defaultValue?: unknown;
|
36
|
+
/**
|
37
|
+
* Is disabled input flag
|
38
|
+
*/
|
39
|
+
disabled?: boolean;
|
40
|
+
/**
|
41
|
+
* React Hook Form validate function
|
42
|
+
* ```typescript
|
43
|
+
* type ValidateFunc = (value: string) => boolean | string;
|
44
|
+
* ```
|
45
|
+
*/
|
46
|
+
validate?: ValidateFunc | Record<string, ValidateFunc>;
|
47
|
+
/**
|
48
|
+
* Hide error message flag
|
49
|
+
*/
|
50
|
+
hideErrorMessage?: boolean;
|
51
|
+
/**
|
52
|
+
* Custom onChange functionƒ
|
53
|
+
*/
|
54
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
55
|
+
/**
|
56
|
+
* Key for option label
|
57
|
+
*/
|
58
|
+
labelKey?: string;
|
59
|
+
/**
|
60
|
+
* Key for option value
|
61
|
+
*/
|
62
|
+
valueKey?: string;
|
63
|
+
/**
|
64
|
+
* Select options
|
65
|
+
*/
|
66
|
+
options: string[] | unknown[];
|
67
|
+
};
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Material UI `Select` controlled component. Used with react-hook-form
|
71
|
+
* @category Forms
|
72
|
+
*/
|
73
|
+
export const ControlSelect = ({
|
74
|
+
control,
|
75
|
+
validate,
|
76
|
+
name = '',
|
77
|
+
label = '',
|
78
|
+
required = false,
|
79
|
+
defaultValue = '',
|
80
|
+
disabled = false,
|
81
|
+
hideErrorMessage = false,
|
82
|
+
onChange: customOnChange,
|
83
|
+
labelKey,
|
84
|
+
valueKey,
|
85
|
+
options = [],
|
86
|
+
...textFieldProps
|
87
|
+
}: ControlSelectProps) => {
|
88
|
+
const {
|
89
|
+
field: { ref, onChange },
|
90
|
+
fieldState: { error },
|
91
|
+
} = useController({
|
92
|
+
name,
|
93
|
+
control,
|
94
|
+
defaultValue,
|
95
|
+
rules: {
|
96
|
+
required: required && 'Please, fill this field',
|
97
|
+
validate,
|
98
|
+
},
|
99
|
+
});
|
100
|
+
const value = useWatch({ control, name });
|
101
|
+
|
102
|
+
const getValue = useCallback(
|
103
|
+
(option) => {
|
104
|
+
if (typeof option === 'string') return option;
|
105
|
+
return valueKey ? option[valueKey] : option.value;
|
106
|
+
},
|
107
|
+
[valueKey]
|
108
|
+
);
|
109
|
+
const getLabel = useCallback(
|
110
|
+
(option) => {
|
111
|
+
if (typeof option === 'string') return option;
|
112
|
+
return labelKey ? option[labelKey] : option.label;
|
113
|
+
},
|
114
|
+
[labelKey]
|
115
|
+
);
|
116
|
+
|
117
|
+
const handleClear = useCallback(() => {
|
118
|
+
if (customOnChange) {
|
119
|
+
customOnChange(null);
|
120
|
+
} else onChange(null);
|
121
|
+
}, [onChange, customOnChange]);
|
122
|
+
|
123
|
+
return (
|
124
|
+
<TextField
|
125
|
+
select
|
126
|
+
fullWidth
|
127
|
+
size="small"
|
128
|
+
variant="outlined"
|
129
|
+
type="text"
|
130
|
+
inputRef={ref}
|
131
|
+
name={name}
|
132
|
+
label={label}
|
133
|
+
error={!!error}
|
134
|
+
helperText={!hideErrorMessage && error?.message}
|
135
|
+
disabled={disabled}
|
136
|
+
value={value ?? ''}
|
137
|
+
onChange={customOnChange ? customOnChange : onChange}
|
138
|
+
{...textFieldProps}
|
139
|
+
inputProps={{
|
140
|
+
...(textFieldProps?.inputProps ?? {}),
|
141
|
+
value: value ?? '',
|
142
|
+
}}
|
143
|
+
InputProps={{
|
144
|
+
endAdornment:
|
145
|
+
!required && value ? (
|
146
|
+
<InputAdornment position="end" sx={{ mr: 2 }}>
|
147
|
+
<IconButton onClick={handleClear} size="small">
|
148
|
+
<ClearIcon fontSize="small" />
|
149
|
+
</IconButton>
|
150
|
+
</InputAdornment>
|
151
|
+
) : null,
|
152
|
+
...textFieldProps?.InputProps,
|
153
|
+
}}
|
154
|
+
>
|
155
|
+
{options.map((option, index) => (
|
156
|
+
<MenuItem key={index} value={getValue(option)}>
|
157
|
+
{getLabel(option)}
|
158
|
+
</MenuItem>
|
159
|
+
))}
|
160
|
+
</TextField>
|
161
|
+
);
|
162
|
+
};
|
163
|
+
|
164
|
+
export default ControlSelect;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import Switch, { SwitchProps } from '@mui/material/Switch';
|
2
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
3
|
+
import { Control, useController, useWatch } from 'react-hook-form';
|
4
|
+
import { useEffect, useMemo } from 'react';
|
5
|
+
|
6
|
+
type Props = SwitchProps & {
|
7
|
+
/**
|
8
|
+
* React Hook Form `control`
|
9
|
+
*/
|
10
|
+
control: Control<any>;
|
11
|
+
/**
|
12
|
+
* React Hook Form control `name` propery
|
13
|
+
*/
|
14
|
+
name: string;
|
15
|
+
/**
|
16
|
+
* Material-UI FormControlLabel `label` prop
|
17
|
+
*/
|
18
|
+
label?: string;
|
19
|
+
};
|
20
|
+
|
21
|
+
export const ControlSwitch = ({ control, name, label, ...switchProps }: Props) => {
|
22
|
+
const {
|
23
|
+
field: { ref, onChange },
|
24
|
+
} = useController({ control, name });
|
25
|
+
const value = useWatch({ control, name });
|
26
|
+
|
27
|
+
const checked = useMemo(() => {
|
28
|
+
if (typeof value === 'boolean') {
|
29
|
+
return value;
|
30
|
+
} else if (typeof value === 'string') {
|
31
|
+
if (value === 'false') {
|
32
|
+
onChange(false);
|
33
|
+
return false;
|
34
|
+
} else if (value === 'true') {
|
35
|
+
onChange(true);
|
36
|
+
return true;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return false;
|
40
|
+
}, [value, onChange]);
|
41
|
+
|
42
|
+
useEffect(() => {
|
43
|
+
if (value === null) {
|
44
|
+
onChange(false);
|
45
|
+
}
|
46
|
+
}, [value, onChange]);
|
47
|
+
|
48
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
49
|
+
const { checked } = event.target;
|
50
|
+
onChange(checked);
|
51
|
+
};
|
52
|
+
|
53
|
+
return (
|
54
|
+
<FormControlLabel
|
55
|
+
label={label}
|
56
|
+
name={name}
|
57
|
+
control={
|
58
|
+
<Switch
|
59
|
+
color="primary"
|
60
|
+
size="small"
|
61
|
+
inputRef={ref}
|
62
|
+
onChange={handleChange}
|
63
|
+
checked={checked}
|
64
|
+
{...switchProps}
|
65
|
+
/>
|
66
|
+
}
|
67
|
+
/>
|
68
|
+
);
|
69
|
+
};
|
70
|
+
|
71
|
+
export default ControlSwitch;
|