@bluemarble/bm-components 0.0.82 → 0.0.83
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/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { memo, useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
3
|
-
import { TableHead, TableRow, TableCell, TableSortLabel, Chip, Tooltip, IconButton, Paper, LinearProgress, TableContainer, Table, TableBody, TablePagination, Popover, Box as Box$2, Typography, Autocomplete as Autocomplete$1, TextField, Button, FormControl, Select as Select$1, InputLabel, FormControlLabel, Checkbox as Checkbox$1, Switch as Switch$1, FormLabel, RadioGroup, Radio as Radio$1, CircularProgress, Stack, MenuItem, Modal as Modal$1, Dialog as Dialog$1, DialogTitle, DialogContentText, DialogActions } from '@mui/material';
|
|
3
|
+
import { TableHead, TableRow, TableCell, TableSortLabel, Chip, Tooltip, IconButton, Paper, LinearProgress, TableContainer, Table, TableBody, TablePagination, Popover, Box as Box$2, Typography, Autocomplete as Autocomplete$1, TextField, Button, FormControl, Select as Select$1, FormHelperText, InputLabel, FormControlLabel, Checkbox as Checkbox$1, Switch as Switch$1, FormLabel, RadioGroup, Radio as Radio$1, CircularProgress, Stack, MenuItem, Modal as Modal$1, Dialog as Dialog$1, DialogTitle, DialogContentText, DialogActions } from '@mui/material';
|
|
4
4
|
import emStyled from '@emotion/styled';
|
|
5
5
|
import '@emotion/react';
|
|
6
6
|
import { Field, useField } from 'formik';
|
|
@@ -14804,8 +14804,8 @@ const BaseInput$1 = (props) => {
|
|
|
14804
14804
|
const FormikInput = (_a) => {
|
|
14805
14805
|
var { name, shrink } = _a, rest = __rest(_a, ["name", "shrink"]);
|
|
14806
14806
|
return (React__default.createElement(Field, { name: name }, (_a) => {
|
|
14807
|
-
var _b = _a.field, { value } = _b, field = __rest(_b, ["value"]);
|
|
14808
|
-
return (React__default.createElement(BaseInput$1, Object.assign({ defaultValue: value }, field, rest, { InputLabelProps: Object.assign({ shrink }, rest.InputLabelProps) })));
|
|
14807
|
+
var _b = _a.field, { value } = _b, field = __rest(_b, ["value"]), { meta: { error } } = _a;
|
|
14808
|
+
return (React__default.createElement(BaseInput$1, Object.assign({ defaultValue: value, error: Boolean(error), helperText: error }, field, rest, { InputLabelProps: Object.assign({ shrink }, rest.InputLabelProps) })));
|
|
14809
14809
|
}));
|
|
14810
14810
|
};
|
|
14811
14811
|
|
|
@@ -14846,10 +14846,10 @@ function FormikInputMask(_a) {
|
|
|
14846
14846
|
formikSaveFunction.current(name, unmaskedValue);
|
|
14847
14847
|
}, [value]);
|
|
14848
14848
|
return (React__default.createElement(Field, { name: name }, (_a) => {
|
|
14849
|
-
var _b = _a.field, { value } = _b, field = __rest(_b, ["value"]), { form: { setFieldValue } } = _a;
|
|
14849
|
+
var _b = _a.field, { value } = _b, field = __rest(_b, ["value"]), { meta: { error }, form: { setFieldValue } } = _a;
|
|
14850
14850
|
initialValue.current = value;
|
|
14851
14851
|
formikSaveFunction.current = setFieldValue;
|
|
14852
|
-
return React__default.createElement(BaseInput$1, Object.assign({}, rest, field, { inputRef: ref }));
|
|
14852
|
+
return (React__default.createElement(BaseInput$1, Object.assign({}, rest, field, { inputRef: ref, error: Boolean(error), helperText: error })));
|
|
14853
14853
|
}));
|
|
14854
14854
|
}
|
|
14855
14855
|
|
|
@@ -14870,16 +14870,17 @@ const BaseSelect = (_a) => {
|
|
|
14870
14870
|
}, label: label }, rest), children)));
|
|
14871
14871
|
};
|
|
14872
14872
|
const FormikSelect = (_a) => {
|
|
14873
|
-
var { name, label, children, FormControlProps, InputLabelProps } = _a, rest = __rest(_a, ["name", "label", "children", "FormControlProps", "InputLabelProps"]);
|
|
14873
|
+
var { name, label, children, FormControlProps, InputLabelProps, helperText } = _a, rest = __rest(_a, ["name", "label", "children", "FormControlProps", "InputLabelProps", "helperText"]);
|
|
14874
14874
|
const [_b, meta, { setValue }] = useField({ name }), { value } = _b, field = __rest(_b, ["value"]);
|
|
14875
14875
|
const onChange = (_, { props: { value } }) => {
|
|
14876
14876
|
setValue(value);
|
|
14877
14877
|
};
|
|
14878
|
-
return (React__default.createElement(FormControl, Object.assign({ fullWidth: true }, FormControlProps),
|
|
14878
|
+
return (React__default.createElement(FormControl, Object.assign({ fullWidth: true }, FormControlProps, { error: Boolean(meta === null || meta === void 0 ? void 0 : meta.error) }),
|
|
14879
14879
|
React__default.createElement(CustomInputLabel, Object.assign({}, InputLabelProps), label),
|
|
14880
14880
|
React__default.createElement(Select$1, Object.assign({ inputProps: {
|
|
14881
14881
|
name
|
|
14882
|
-
}, label: label }, rest, field, { defaultValue: value, onChange: onChange }), children)
|
|
14882
|
+
}, label: label }, rest, field, { defaultValue: value, onChange: onChange }), children),
|
|
14883
|
+
React__default.createElement(FormHelperText, null, helperText || (meta === null || meta === void 0 ? void 0 : meta.error))));
|
|
14883
14884
|
};
|
|
14884
14885
|
|
|
14885
14886
|
function Autocomplete(_a) {
|
|
@@ -14895,7 +14896,7 @@ function BaseInput(props) {
|
|
|
14895
14896
|
}
|
|
14896
14897
|
function FormikAutocomplete(_a) {
|
|
14897
14898
|
var { getOptionValue, option } = _a, props = __rest(_a, ["getOptionValue", "option"]);
|
|
14898
|
-
const [_b, , { setValue }] = useField({
|
|
14899
|
+
const [_b, meta, { setValue }] = useField({
|
|
14899
14900
|
name: props.name
|
|
14900
14901
|
}), { value: defaultValue } = _b, field = __rest(_b, ["value"]);
|
|
14901
14902
|
const defaultOption = useMemo(() => {
|
|
@@ -14931,7 +14932,7 @@ function FormikAutocomplete(_a) {
|
|
|
14931
14932
|
return a[key] === b[key];
|
|
14932
14933
|
return Object.values(a)[0] === Object.values(b)[0];
|
|
14933
14934
|
};
|
|
14934
|
-
return (React__default.createElement(Autocomplete$1, Object.assign({ getOptionLabel: getOptionLabel, renderInput: (params) => (React__default.createElement(TextField, Object.assign({}, params, field, { label: props.label }))), defaultValue: defaultOption, onChange: onChange, isOptionEqualToValue: isOptionEqualToValue }, props)));
|
|
14935
|
+
return (React__default.createElement(Autocomplete$1, Object.assign({ getOptionLabel: getOptionLabel, renderInput: (params) => (React__default.createElement(TextField, Object.assign({ error: Boolean(meta === null || meta === void 0 ? void 0 : meta.error), helperText: meta === null || meta === void 0 ? void 0 : meta.error }, params, field, { label: props.label }))), defaultValue: defaultOption, onChange: onChange, isOptionEqualToValue: isOptionEqualToValue }, props)));
|
|
14935
14936
|
}
|
|
14936
14937
|
|
|
14937
14938
|
const Checkbox = (_a) => {
|
|
@@ -14953,7 +14954,7 @@ const FormikCheckbox = (_a) => {
|
|
|
14953
14954
|
const onChange = (_, value) => {
|
|
14954
14955
|
setValue(value);
|
|
14955
14956
|
};
|
|
14956
|
-
return (React__default.createElement(FormControlLabel, Object.assign({ label: label, onChange: onChange, control: React__default.createElement(Checkbox$1, Object.assign({}, props, { defaultChecked: value })) }, field, FormControlLabelProps)));
|
|
14957
|
+
return (React__default.createElement(FormControlLabel, Object.assign({ label: label, onChange: onChange, control: React__default.createElement(Checkbox$1, Object.assign({}, props, { defaultChecked: Boolean(value) })) }, field, FormControlLabelProps)));
|
|
14957
14958
|
};
|
|
14958
14959
|
|
|
14959
14960
|
const Switch = (_a) => {
|