@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.
@@ -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";
@@ -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 (_, value) {
34
- onChange(value);
35
- }, inputValue: inputValue, onInputChange: onInputChange, renderInput: function (params) { return _jsx(TextField, __assign({}, params, rest, { size: size })); } }) })));
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";
@@ -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 AutocompleteValueType<T, multiple> = multiple extends false | undefined ? AutocompleteOptionType<T> | null : Array<AutocompleteOptionType<T>> | null;
7
- export interface AutocompleteProps<T, multiple> extends Omit<TextFieldProps, "onChange"> {
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: AutocompleteValueType<T, multiple>;
11
+ value?: AutocompleteValueNonNullableType<T, multiple>;
11
12
  primaryColor?: CSSProperties["color"];
12
13
  secondaryColor?: CSSProperties["color"];
13
- onChange: (value: AutocompleteValueType<T, multiple>) => void;
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 (_, value) {
43
- onChange(value);
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 AutocompleteWithFilterValueType<T, multiple> = multiple extends false | undefined ? AutocompleteWithFilterOptionType<T> | null : Array<AutocompleteWithFilterOptionType<T>> | null;
7
- export interface AutocompleteWithFilterProps<T, multiple> extends Omit<TextFieldProps, "onChange"> {
8
- value: AutocompleteWithFilterValueType<T, multiple>;
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: AutocompleteWithFilterValueType<T, multiple>) => void;
15
+ onChange: (value: AutocompleteWithFilterlNullableValueType<T, multiple>) => void;
15
16
  }
@@ -26,7 +26,7 @@ function FormRadioGroup(props) {
26
26
  onChange(event.target.value);
27
27
  }, sx: {
28
28
  my: 1,
29
- "& label span:first-child span:first-child": {
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.0.0-beta.11",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",