@bluemarble/bm-components 0.0.11 → 0.0.12
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 +24 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Checkbox/index.d.ts +0 -1
- package/dist/esm/types/components/Grid/Grid.d.ts +1 -1
- package/dist/esm/types/components/LargeButton/index.d.ts +3 -2
- package/dist/esm/types/components/Radio/index.d.ts +0 -1
- package/dist/esm/types/components/Switch/index.d.ts +0 -1
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/index.d.ts +11 -5
- package/package.json +1 -1
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 } 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, InputLabel, FormControlLabel, Checkbox as Checkbox$1, Switch as Switch$1, FormLabel, RadioGroup, Radio as Radio$1, CircularProgress } from '@mui/material';
|
|
4
4
|
import emStyled from '@emotion/styled';
|
|
5
5
|
import '@emotion/react';
|
|
6
6
|
import { Field, useField } from 'formik';
|
|
@@ -4019,7 +4019,7 @@ const Grid = (props) => {
|
|
|
4019
4019
|
horizontal: "right",
|
|
4020
4020
|
} },
|
|
4021
4021
|
React__default.createElement(Box$2, { sx: { minWidth: 300, padding: 2 } },
|
|
4022
|
-
React__default.createElement(Typography, { fontWeight: "bold", variant: "
|
|
4022
|
+
React__default.createElement(Typography, { fontWeight: "bold", variant: "body2" }, "Filtrar por:"),
|
|
4023
4023
|
React__default.createElement(Autocomplete$1, { value: selectedTitle || "", onChange: ({ target }) => {
|
|
4024
4024
|
!target.innerHTML.includes("path")
|
|
4025
4025
|
? setSelectedTitle(target.innerHTML)
|
|
@@ -14772,8 +14772,8 @@ const BaseInput$1 = (props) => {
|
|
|
14772
14772
|
const FormikInput = (_a) => {
|
|
14773
14773
|
var { name } = _a, rest = __rest(_a, ["name"]);
|
|
14774
14774
|
return (React__default.createElement(Field, { name: name }, (_a) => {
|
|
14775
|
-
var _b = _a.field, field = __rest(_b, ["value"]);
|
|
14776
|
-
return (React__default.createElement(BaseInput$1, Object.assign({}, field, rest)));
|
|
14775
|
+
var _b = _a.field, { value } = _b, field = __rest(_b, ["value"]);
|
|
14776
|
+
return (React__default.createElement(BaseInput$1, Object.assign({}, field, rest, { defaultValue: value })));
|
|
14777
14777
|
}));
|
|
14778
14778
|
};
|
|
14779
14779
|
|
|
@@ -14800,15 +14800,20 @@ const BaseInputMask = (_a) => {
|
|
|
14800
14800
|
function FormikInputMask(_a) {
|
|
14801
14801
|
var { mask, defaultValue, name } = _a, rest = __rest(_a, ["mask", "defaultValue", "name"]);
|
|
14802
14802
|
const { ref, value, unmaskedValue, setValue } = useIMask(mask);
|
|
14803
|
+
const initialValue = useRef();
|
|
14803
14804
|
useEffect(() => {
|
|
14804
14805
|
if (!value && defaultValue)
|
|
14805
14806
|
setValue(String(defaultValue));
|
|
14807
|
+
else if (initialValue.current) {
|
|
14808
|
+
setValue(String(initialValue.current));
|
|
14809
|
+
}
|
|
14806
14810
|
}, [defaultValue]);
|
|
14807
14811
|
const onChange = (setFieldValue) => {
|
|
14808
14812
|
setFieldValue(name, unmaskedValue);
|
|
14809
14813
|
};
|
|
14810
14814
|
return (React__default.createElement(Field, { name: name }, (_a) => {
|
|
14811
|
-
var _b = _a.field, field = __rest(_b, ["value"]), { form: { setFieldValue } } = _a;
|
|
14815
|
+
var _b = _a.field, { value } = _b, field = __rest(_b, ["value"]), { form: { setFieldValue } } = _a;
|
|
14816
|
+
initialValue.current = value;
|
|
14812
14817
|
return (React__default.createElement(BaseInput$1, Object.assign({}, rest, field, { onChange: () => onChange(setFieldValue), inputRef: ref })));
|
|
14813
14818
|
}));
|
|
14814
14819
|
}
|
|
@@ -14831,7 +14836,7 @@ const BaseSelect = (_a) => {
|
|
|
14831
14836
|
};
|
|
14832
14837
|
const FormikSelect = (_a) => {
|
|
14833
14838
|
var { name, label, children, FormControlProps, InputLabelProps } = _a, rest = __rest(_a, ["name", "label", "children", "FormControlProps", "InputLabelProps"]);
|
|
14834
|
-
const [_b, meta, { setValue }] = useField({ name }), field = __rest(_b, ["value"]);
|
|
14839
|
+
const [_b, meta, { setValue }] = useField({ name }), { value } = _b, field = __rest(_b, ["value"]);
|
|
14835
14840
|
const onChange = (_, { props: { value } }) => {
|
|
14836
14841
|
setValue(value);
|
|
14837
14842
|
};
|
|
@@ -14839,7 +14844,7 @@ const FormikSelect = (_a) => {
|
|
|
14839
14844
|
React__default.createElement(CustomInputLabel, Object.assign({}, InputLabelProps), label),
|
|
14840
14845
|
React__default.createElement(Select$1, Object.assign({ inputProps: {
|
|
14841
14846
|
name,
|
|
14842
|
-
}, label: label }, rest, field, { onChange: onChange }), children)));
|
|
14847
|
+
}, label: label }, rest, field, { defaultValue: value, onChange: onChange }), children)));
|
|
14843
14848
|
};
|
|
14844
14849
|
|
|
14845
14850
|
function Autocomplete(_a) {
|
|
@@ -14855,7 +14860,9 @@ function BaseInput(props) {
|
|
|
14855
14860
|
}
|
|
14856
14861
|
function FormikAutocomplete(_a) {
|
|
14857
14862
|
var { getOptionValue } = _a, props = __rest(_a, ["getOptionValue"]);
|
|
14858
|
-
const [_b, , { setValue }] = useField({
|
|
14863
|
+
const [_b, , { setValue }] = useField({
|
|
14864
|
+
name: props.name,
|
|
14865
|
+
}), { value: defaultValue } = _b, field = __rest(_b, ["value"]);
|
|
14859
14866
|
const onChange = (_, newValue) => {
|
|
14860
14867
|
if (getOptionValue) {
|
|
14861
14868
|
setValue(getOptionValue(newValue));
|
|
@@ -14863,7 +14870,7 @@ function FormikAutocomplete(_a) {
|
|
|
14863
14870
|
else
|
|
14864
14871
|
setValue(newValue);
|
|
14865
14872
|
};
|
|
14866
|
-
return (React__default.createElement(Autocomplete$1, Object.assign({}, props, { renderInput: (params) => (React__default.createElement(TextField, Object.assign({}, params, field, { label: props.label }))), onChange: onChange })));
|
|
14873
|
+
return (React__default.createElement(Autocomplete$1, Object.assign({}, props, { renderInput: (params) => (React__default.createElement(TextField, Object.assign({}, params, field, { label: props.label }))), defaultValue: props.options.find((option) => Object.values(option)[0] === defaultValue), onChange: onChange })));
|
|
14867
14874
|
}
|
|
14868
14875
|
|
|
14869
14876
|
const Checkbox = (_a) => {
|
|
@@ -14881,11 +14888,11 @@ const FormikCheckbox = (_a) => {
|
|
|
14881
14888
|
var { label, name, FormControlLabelProps } = _a, props = __rest(_a, ["label", "name", "FormControlLabelProps"]);
|
|
14882
14889
|
const [_b, , { setValue }] = useField({
|
|
14883
14890
|
name,
|
|
14884
|
-
}), field = __rest(_b, ["value", "onChange"]);
|
|
14891
|
+
}), { value, onChange: unused } = _b, field = __rest(_b, ["value", "onChange"]);
|
|
14885
14892
|
const onChange = (_, value) => {
|
|
14886
14893
|
setValue(value);
|
|
14887
14894
|
};
|
|
14888
|
-
return (React__default.createElement(FormControlLabel, Object.assign({ label: label, onChange: onChange, control: React__default.createElement(Checkbox$1, Object.assign({}, props)) }, field, FormControlLabelProps)));
|
|
14895
|
+
return (React__default.createElement(FormControlLabel, Object.assign({ label: label, onChange: onChange, control: React__default.createElement(Checkbox$1, Object.assign({}, props, { defaultChecked: value })) }, field, FormControlLabelProps)));
|
|
14889
14896
|
};
|
|
14890
14897
|
|
|
14891
14898
|
const Switch = (_a) => {
|
|
@@ -14903,11 +14910,11 @@ const FormikSwitch = (_a) => {
|
|
|
14903
14910
|
var { label, name, FormControlLabelProps } = _a, props = __rest(_a, ["label", "name", "FormControlLabelProps"]);
|
|
14904
14911
|
const [_b, , { setValue }] = useField({
|
|
14905
14912
|
name,
|
|
14906
|
-
}), field = __rest(_b, ["value", "onChange"]);
|
|
14913
|
+
}), { value, onChange: unused } = _b, field = __rest(_b, ["value", "onChange"]);
|
|
14907
14914
|
const onChange = (_, value) => {
|
|
14908
14915
|
setValue(value);
|
|
14909
14916
|
};
|
|
14910
|
-
return (React__default.createElement(FormControlLabel, Object.assign({ label: label, onChange: onChange, control: React__default.createElement(Switch$1, Object.assign({}, props)) }, field, FormControlLabelProps)));
|
|
14917
|
+
return (React__default.createElement(FormControlLabel, Object.assign({ label: label, onChange: onChange, control: React__default.createElement(Switch$1, Object.assign({}, props, { defaultChecked: value })) }, field, FormControlLabelProps)));
|
|
14911
14918
|
};
|
|
14912
14919
|
|
|
14913
14920
|
const Radio = (_a) => {
|
|
@@ -14928,14 +14935,14 @@ const FormikRadio = (_a) => {
|
|
|
14928
14935
|
const onChange = (setFieldValue, value) => {
|
|
14929
14936
|
setFieldValue(name, value);
|
|
14930
14937
|
};
|
|
14931
|
-
return (React__default.createElement(Field, null, ({ form: { setFieldValue } }) => (React__default.createElement(FormControl, null,
|
|
14938
|
+
return (React__default.createElement(Field, null, ({ field: { value }, form: { setFieldValue } }) => (React__default.createElement(FormControl, null,
|
|
14932
14939
|
label && React__default.createElement(FormLabel, null, label),
|
|
14933
|
-
React__default.createElement(RadioGroup, Object.assign({ onChange: (_, value) => onChange(setFieldValue, value) }, rest), options.map((option) => (React__default.createElement(FormControlLabel, { key: String(option.value), value: option.value, label: option.label, control: React__default.createElement(Radio$1, null) }))))))));
|
|
14940
|
+
React__default.createElement(RadioGroup, Object.assign({ defaultValue: value, onChange: (_, value) => onChange(setFieldValue, value) }, rest), options.map((option) => (React__default.createElement(FormControlLabel, { key: String(option.value), value: option.value, label: option.label, control: React__default.createElement(Radio$1, null) }))))))));
|
|
14934
14941
|
};
|
|
14935
14942
|
|
|
14936
14943
|
const LargeButton = (_a) => {
|
|
14937
|
-
var { loading, children } = _a, rest = __rest(_a, ["loading", "children"]);
|
|
14938
|
-
return (React__default.createElement(Button, Object.assign({ variant: "contained", fullWidth: true, sx: Object.assign({ color: "#fff", fontWeight: "bold" }, rest.sx) }, rest), children));
|
|
14944
|
+
var { loading, children, CircularProgressProps } = _a, rest = __rest(_a, ["loading", "children", "CircularProgressProps"]);
|
|
14945
|
+
return (React__default.createElement(Button, Object.assign({ variant: "contained", fullWidth: true, sx: Object.assign({ color: "#fff", fontWeight: "bold" }, rest.sx), disabled: rest.disabled || loading }, rest), loading ? (React__default.createElement(CircularProgress, Object.assign({ size: 25, color: "inherit" }, CircularProgressProps))) : (children)));
|
|
14939
14946
|
};
|
|
14940
14947
|
|
|
14941
14948
|
export { Autocomplete, Checkbox, EditableTableCell, Grid, Input, InputMask, LargeButton, Radio, Select, Switch, Td, Tr, filterData };
|