@dartech/arsenal-ui 1.4.65 → 1.4.67

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/index.js CHANGED
@@ -821,9 +821,10 @@ const ControlAutocomplete = _a => {
821
821
  textFieldProps = {},
822
822
  disableCloseOnSelect,
823
823
  useStringValue,
824
- requiredErrorText = ''
824
+ requiredErrorText = '',
825
+ startAdornment
825
826
  } = _a,
826
- autocompleteProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options", "multiple", "textFieldProps", "disableCloseOnSelect", "useStringValue", "requiredErrorText"]);
827
+ autocompleteProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options", "multiple", "textFieldProps", "disableCloseOnSelect", "useStringValue", "requiredErrorText", "startAdornment"]);
827
828
  const _b = useController({
828
829
  name,
829
830
  control,
@@ -902,7 +903,13 @@ const ControlAutocomplete = _a => {
902
903
  FormHelperTextProps: {
903
904
  variant: 'standard'
904
905
  }
905
- }, textFieldProps));
906
+ }, startAdornment ? {
907
+ InputProps: Object.assign(Object.assign({}, params.InputProps), {
908
+ startAdornment: jsxs(Fragment, {
909
+ children: [startAdornment, params.InputProps.startAdornment]
910
+ })
911
+ })
912
+ } : {}, textFieldProps));
906
913
  }
907
914
  }, autocompleteProps));
908
915
  };
@@ -933,9 +940,10 @@ function ControlQueryAutocomplete(_a) {
933
940
  queryFunction,
934
941
  validate,
935
942
  itemQueryFunction,
936
- requiredErrorText = ''
943
+ requiredErrorText = '',
944
+ startAdornment
937
945
  } = _a,
938
- autocompleteProps = __rest(_a, ["name", "label", "control", "required", "searchBy", "labelKey", "multiple", "mongoQueryJson", "disabled", "valueKey", "sortBy", "hideErrorMessage", "disableCloseOnSelect", "textFieldProps", "onChange", "queryFunction", "validate", "itemQueryFunction", "requiredErrorText"]);
946
+ autocompleteProps = __rest(_a, ["name", "label", "control", "required", "searchBy", "labelKey", "multiple", "mongoQueryJson", "disabled", "valueKey", "sortBy", "hideErrorMessage", "disableCloseOnSelect", "textFieldProps", "onChange", "queryFunction", "validate", "itemQueryFunction", "requiredErrorText", "startAdornment"]);
939
947
  const _b = useController({
940
948
  control,
941
949
  name,
@@ -1089,8 +1097,9 @@ function ControlQueryAutocomplete(_a) {
1089
1097
  })]
1090
1098
  }) : label,
1091
1099
  InputLabelProps: {
1092
- shrink: true
1100
+ shrink: !!(autocompleteProps === null || autocompleteProps === void 0 ? void 0 : autocompleteProps.placeholder)
1093
1101
  },
1102
+ placeholder: autocompleteProps === null || autocompleteProps === void 0 ? void 0 : autocompleteProps.placeholder,
1094
1103
  sx: {
1095
1104
  '.MuiInputLabel-root span': {
1096
1105
  color: '#D6331F'
@@ -1103,14 +1112,18 @@ function ControlQueryAutocomplete(_a) {
1103
1112
  FormHelperTextProps: {
1104
1113
  variant: 'standard'
1105
1114
  },
1106
- InputProps: Object.assign(Object.assign({}, params.InputProps), {
1115
+ InputProps: Object.assign(Object.assign(Object.assign({}, params.InputProps), {
1107
1116
  endAdornment: jsxs(React.Fragment, {
1108
1117
  children: [isFetching ? jsx(CircularProgress, {
1109
1118
  color: "inherit",
1110
1119
  size: 20
1111
1120
  }) : null, params.InputProps.endAdornment]
1112
1121
  })
1113
- })
1122
+ }), startAdornment ? {
1123
+ startAdornment: jsxs(Fragment, {
1124
+ children: [startAdornment, params.InputProps.startAdornment]
1125
+ })
1126
+ } : {})
1114
1127
  }, textFieldProps))
1115
1128
  }, autocompleteProps));
1116
1129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.4.65",
3
+ "version": "1.4.67",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -1,5 +1,6 @@
1
1
  import { AutocompleteProps } from '@mui/material/Autocomplete';
2
2
  import { TextFieldProps } from '@mui/material/TextField';
3
+ import { InputProps } from '@mui/material/Input';
3
4
  import { Control } from 'react-hook-form';
4
5
  import { ReactNode } from 'react';
5
6
  import { ValidateFunc } from '../../../interfaces';
@@ -62,6 +63,7 @@ export type ControlAutocompleteProps = Omit<AutocompleteProps<unknown, boolean,
62
63
  textFieldProps?: TextFieldProps;
63
64
  useStringValue?: boolean;
64
65
  requiredErrorText?: string;
66
+ startAdornment?: InputProps['startAdornment'];
65
67
  };
66
- export declare const ControlAutocomplete: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, multiple, textFieldProps, disableCloseOnSelect, useStringValue, requiredErrorText, ...autocompleteProps }: ControlAutocompleteProps) => JSX.Element;
68
+ export declare const ControlAutocomplete: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, multiple, textFieldProps, disableCloseOnSelect, useStringValue, requiredErrorText, startAdornment, ...autocompleteProps }: ControlAutocompleteProps) => JSX.Element;
67
69
  export default ControlAutocomplete;
@@ -16,5 +16,5 @@ type ControlQueryAutocompleteProps<T> = Omit<ControlAutocompleteProps, 'options'
16
16
  requiredErrorText?: string;
17
17
  renderInput?: AutocompleteProps<unknown, boolean, boolean, boolean, React.ElementType<any>>['renderInput'];
18
18
  };
19
- export declare function ControlQueryAutocomplete<T>({ name, label, control, required, searchBy, labelKey, multiple, mongoQueryJson, disabled, valueKey, sortBy, hideErrorMessage, disableCloseOnSelect, textFieldProps, onChange, queryFunction, validate, itemQueryFunction, requiredErrorText, ...autocompleteProps }: ControlQueryAutocompleteProps<T>): JSX.Element;
19
+ export declare function ControlQueryAutocomplete<T>({ name, label, control, required, searchBy, labelKey, multiple, mongoQueryJson, disabled, valueKey, sortBy, hideErrorMessage, disableCloseOnSelect, textFieldProps, onChange, queryFunction, validate, itemQueryFunction, requiredErrorText, startAdornment, ...autocompleteProps }: ControlQueryAutocompleteProps<T>): JSX.Element;
20
20
  export default ControlQueryAutocomplete;