@symply.io/basic-components 1.0.0-beta.11 → 1.0.0-beta.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/Autocomplete/index.d.ts +1 -1
- package/Autocomplete/index.js +4 -3
- package/Autocomplete/types.d.ts +5 -4
- package/AutocompleteWithFilter/index.d.ts +1 -1
- package/AutocompleteWithFilter/index.js +3 -3
- package/AutocompleteWithFilter/types.d.ts +5 -4
- package/FormRadioGroup/index.js +1 -1
- package/package.json +1 -1
package/Autocomplete/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import { AutocompleteProps } from "./types";
|
2
|
-
declare function CustomAutocomplete<T, multiple extends boolean | undefined>(props: AutocompleteProps<T, multiple>): JSX.Element;
|
2
|
+
declare function CustomAutocomplete<T, multiple extends boolean | undefined = false>(props: AutocompleteProps<T, multiple>): JSX.Element;
|
3
3
|
export default CustomAutocomplete;
|
4
4
|
export * from "./types";
|
package/Autocomplete/index.js
CHANGED
@@ -30,9 +30,10 @@ function CustomAutocomplete(props) {
|
|
30
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"]);
|
31
31
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
32
32
|
var _a = useInteractions(), inputValue = _a.inputValue, onInputChange = _a.onInputChange;
|
33
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, options: options, multiple: multiple, onChange: function (_,
|
34
|
-
|
35
|
-
|
33
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, options: options, multiple: multiple, onChange: function (_, val) {
|
34
|
+
console.log({ val: val });
|
35
|
+
onChange(val);
|
36
|
+
}, 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 })); } }) })));
|
36
37
|
}
|
37
38
|
export default CustomAutocomplete;
|
38
39
|
export * from "./types";
|
package/Autocomplete/types.d.ts
CHANGED
@@ -3,12 +3,13 @@ import { TextFieldProps } from "@mui/material/TextField";
|
|
3
3
|
export declare type AutocompleteOptionType<T> = T & {
|
4
4
|
label: string;
|
5
5
|
};
|
6
|
-
export declare type
|
7
|
-
export
|
6
|
+
export declare type AutocompleteValueNonNullableType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteOptionType<T> : Array<AutocompleteOptionType<T>>;
|
7
|
+
export declare type AutocompleteValueNullableType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteOptionType<T> | null : Array<AutocompleteOptionType<T>> | null;
|
8
|
+
export interface AutocompleteProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange"> {
|
8
9
|
multiple?: multiple;
|
9
10
|
options: Array<AutocompleteOptionType<T>>;
|
10
|
-
value
|
11
|
+
value?: AutocompleteValueNonNullableType<T, multiple>;
|
11
12
|
primaryColor?: CSSProperties["color"];
|
12
13
|
secondaryColor?: CSSProperties["color"];
|
13
|
-
onChange: (value:
|
14
|
+
onChange: (value: AutocompleteValueNullableType<T, multiple>) => void;
|
14
15
|
}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { AutocompleteWithFilterProps } from "./types";
|
2
|
-
declare function AutocompleteWithFilter<T, multiple extends boolean | undefined>(props: AutocompleteWithFilterProps<T, multiple>): JSX.Element;
|
2
|
+
declare function AutocompleteWithFilter<T, multiple extends boolean | undefined = false>(props: AutocompleteWithFilterProps<T, multiple>): JSX.Element;
|
3
3
|
export default AutocompleteWithFilter;
|
4
4
|
export * from "./types";
|
@@ -39,9 +39,9 @@ function AutocompleteWithFilter(props) {
|
|
39
39
|
stringify: function (option) { return option.label; }
|
40
40
|
});
|
41
41
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
42
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, limitTags: 1, options: options, multiple: multiple, filterOptions: filter, onChange: function (_,
|
43
|
-
onChange(
|
44
|
-
}, disableCloseOnSelect: disableCloseOnSelect || multiple, getOptionLabel: function (option) {
|
42
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, limitTags: 1, options: options, multiple: multiple, filterOptions: filter, onChange: function (_, val) {
|
43
|
+
onChange(val);
|
44
|
+
}, value: value, disableCloseOnSelect: disableCloseOnSelect || multiple, getOptionLabel: function (option) {
|
45
45
|
return option.label || "";
|
46
46
|
}, renderOption: function (props, option, _a) {
|
47
47
|
var selected = _a.selected;
|
@@ -3,13 +3,14 @@ import { TextFieldProps } from "@mui/material/TextField";
|
|
3
3
|
export declare type AutocompleteWithFilterOptionType<T> = T & {
|
4
4
|
label: string;
|
5
5
|
};
|
6
|
-
export declare type
|
7
|
-
export
|
8
|
-
|
6
|
+
export declare type AutocompleteWithFilterlNonNullableValueType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteWithFilterOptionType<T> : Array<AutocompleteWithFilterOptionType<T>>;
|
7
|
+
export declare type AutocompleteWithFilterlNullableValueType<T, multiple extends boolean | undefined> = multiple extends false | undefined ? AutocompleteWithFilterOptionType<T> | null : Array<AutocompleteWithFilterOptionType<T>> | null;
|
8
|
+
export interface AutocompleteWithFilterProps<T, multiple extends boolean | undefined> extends Omit<TextFieldProps, "onChange"> {
|
9
|
+
value: AutocompleteWithFilterlNonNullableValueType<T, multiple>;
|
9
10
|
options: Array<AutocompleteWithFilterOptionType<T>>;
|
10
11
|
disableCloseOnSelect?: boolean;
|
11
12
|
multiple?: multiple;
|
12
13
|
primaryColor?: CSSProperties["color"];
|
13
14
|
secondaryColor?: CSSProperties["color"];
|
14
|
-
onChange: (value:
|
15
|
+
onChange: (value: AutocompleteWithFilterlNullableValueType<T, multiple>) => void;
|
15
16
|
}
|
package/FormRadioGroup/index.js
CHANGED
@@ -26,7 +26,7 @@ function FormRadioGroup(props) {
|
|
26
26
|
onChange(event.target.value);
|
27
27
|
}, sx: {
|
28
28
|
my: 1,
|
29
|
-
"& label span:first-
|
29
|
+
"& label span:first-of-type span:first-of-type": {
|
30
30
|
margin: "-5px 0 -5px 0"
|
31
31
|
}
|
32
32
|
} }, { children: options.map(function (opt) {
|