@symply.io/basic-components 1.0.0 → 1.0.2
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/Autocomplete/index.js
CHANGED
@@ -27,12 +27,12 @@ import TextField from "@mui/material/TextField";
|
|
27
27
|
import useInteractions from "./useInteractions";
|
28
28
|
import useCustomTheme from "../useCustomTheme";
|
29
29
|
function CustomAutocomplete(props) {
|
30
|
-
var size = props.size, value = props.value, options = props.options, multiple = props.multiple, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["size", "value", "options", "multiple", "primaryColor", "secondaryColor", "onChange"]);
|
30
|
+
var size = props.size, value = props.value, options = props.options, multiple = props.multiple, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, required = props.required, rest = __rest(props, ["size", "value", "options", "multiple", "primaryColor", "secondaryColor", "onChange", "required"]);
|
31
31
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
32
32
|
var _a = useInteractions(), inputValue = _a.inputValue, onInputChange = _a.onInputChange;
|
33
33
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, options: options, multiple: multiple, onChange: function (_, val) {
|
34
34
|
onChange(val);
|
35
|
-
}, isOptionEqualToValue: function (opt, val) { return opt.label === val.label; }, value: value, inputValue: inputValue, onInputChange: onInputChange, renderInput: function (params) { return _jsx(TextField, __assign({}, params, rest, { size: size })); } }) })));
|
35
|
+
}, isOptionEqualToValue: function (opt, val) { return opt.label === val.label; }, value: value, inputValue: inputValue, onInputChange: onInputChange, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { required: required, size: size, inputProps: __assign(__assign({}, params.inputProps), { required: required && (Array.isArray(value) ? value.length === 0 : !value) }) }))); } }) })));
|
36
36
|
}
|
37
37
|
export default CustomAutocomplete;
|
38
38
|
export * from "./types";
|
package/Autocomplete/types.d.ts
CHANGED
@@ -6,7 +6,7 @@ export declare type AutocompleteOptionType<T = {
|
|
6
6
|
label: string;
|
7
7
|
};
|
8
8
|
export declare type AutocompleteValueType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteOptionType<T> | null : Array<AutocompleteOptionType<T>>;
|
9
|
-
export interface AutocompleteProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange"> {
|
9
|
+
export interface AutocompleteProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange" | "value"> {
|
10
10
|
multiple?: multiple;
|
11
11
|
options: Array<AutocompleteOptionType<T>>;
|
12
12
|
value: AutocompleteValueType<T, multiple>;
|
@@ -31,7 +31,7 @@ import useCustomTheme from "../useCustomTheme";
|
|
31
31
|
var icon = _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
32
32
|
var checkedIcon = _jsx(CheckBoxIcon, { fontSize: "small" });
|
33
33
|
function AutocompleteWithFilter(props) {
|
34
|
-
var size = props.size, value = props.value, options = props.options, multiple = props.multiple, disableCloseOnSelect = props.disableCloseOnSelect, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["size", "value", "options", "multiple", "disableCloseOnSelect", "primaryColor", "secondaryColor", "onChange"]);
|
34
|
+
var size = props.size, value = props.value, options = props.options, multiple = props.multiple, disableCloseOnSelect = props.disableCloseOnSelect, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, required = props.required, rest = __rest(props, ["size", "value", "options", "multiple", "disableCloseOnSelect", "primaryColor", "secondaryColor", "onChange", "required"]);
|
35
35
|
var filter = createFilterOptions({
|
36
36
|
ignoreCase: true,
|
37
37
|
ignoreAccents: true,
|
@@ -46,7 +46,7 @@ function AutocompleteWithFilter(props) {
|
|
46
46
|
}, renderOption: function (props, option, _a) {
|
47
47
|
var selected = _a.selected;
|
48
48
|
return (_jsxs("li", __assign({}, props, { children: [_jsx(Checkbox, { icon: icon, color: "primary", checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), option.label || ""] })));
|
49
|
-
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { variant: "outlined" }))); } }) })));
|
49
|
+
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { variant: "outlined", required: required, inputProps: __assign(__assign({}, params.inputProps), { required: required && (Array.isArray(value) ? value.length === 0 : !value) }) }))); } }) })));
|
50
50
|
}
|
51
51
|
export default AutocompleteWithFilter;
|
52
52
|
export * from "./types";
|
@@ -4,7 +4,7 @@ export declare type AutocompleteWithFilterOptionType<T> = T & {
|
|
4
4
|
label: string;
|
5
5
|
};
|
6
6
|
export declare type AutocompleteWithFilterlValueType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteWithFilterOptionType<T> | null : Array<AutocompleteWithFilterOptionType<T>>;
|
7
|
-
export interface AutocompleteWithFilterProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange"> {
|
7
|
+
export interface AutocompleteWithFilterProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange" | "value"> {
|
8
8
|
value: AutocompleteWithFilterlValueType<T, multiple>;
|
9
9
|
options: Array<AutocompleteWithFilterOptionType<T>>;
|
10
10
|
disableCloseOnSelect?: boolean;
|
package/LoadingModal/Modal.js
CHANGED
@@ -24,6 +24,6 @@ function LoadingModal(props) {
|
|
24
24
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Dialog, __assign({ maxWidth: "xs", open: open, sx: { backgroundColor: "#7A7A7A97" }, PaperProps: { sx: { backgroundColor: "#F2F2F2CF" } }, onClose: function (_, reason) {
|
25
25
|
if (reason === "backdropClick")
|
26
26
|
return;
|
27
|
-
}, disableEscapeKeyDown: true }, { children: _jsx(DialogContent, { children: _jsxs(Grid, __assign({ container: true, direction: direction, justifyContent: "space-between", alignItems: "center", "data-testid": "loading-grid" }, { children: [_jsxs(Box, __assign({ position: "relative", display: "inline-flex", sx: { mt: 1.25 } }, { children: [_jsx(CircularProgress, { size: showProgess ? 56 : 40, value: percent, variant: showProgess ? "determinate" : "indeterminate" }), showProgess && percent >= 0 && (_jsx(Box, __assign({ top: 0, left: 0, bottom: 0, right: 0, position: "absolute", display: "flex", alignItems: "center", justifyContent: "center" }, { children: _jsxs(Typography, __assign({ variant: "caption" }, { children: [Math.round(percent), "%"] })) })))] })), _jsx(Typography, __assign({ variant: "subtitle1", component: "span", sx: { mt: 1 } }, { children: text }))] })) }) })) })));
|
27
|
+
}, disableScrollLock: true, disableAutoFocus: true, disableEnforceFocus: true, disableEscapeKeyDown: true }, { children: _jsx(DialogContent, { children: _jsxs(Grid, __assign({ container: true, direction: direction, justifyContent: "space-between", alignItems: "center", "data-testid": "loading-grid" }, { children: [_jsxs(Box, __assign({ position: "relative", display: "inline-flex", sx: { mt: 1.25 } }, { children: [_jsx(CircularProgress, { size: showProgess ? 56 : 40, value: percent, variant: showProgess ? "determinate" : "indeterminate" }), showProgess && percent >= 0 && (_jsx(Box, __assign({ top: 0, left: 0, bottom: 0, right: 0, position: "absolute", display: "flex", alignItems: "center", justifyContent: "center" }, { children: _jsxs(Typography, __assign({ variant: "caption" }, { children: [Math.round(percent), "%"] })) })))] })), _jsx(Typography, __assign({ variant: "subtitle1", component: "span", sx: { mt: 1 } }, { children: text }))] })) }) })) })));
|
28
28
|
}
|
29
29
|
export default LoadingModal;
|