@bytebrand/fe-ui-core 4.1.152 → 4.1.153

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.1.152",
3
+ "version": "4.1.153",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -115,7 +115,7 @@ export const Theme = createTheme({
115
115
  MuiInputLabel: {
116
116
  styleOverrides: {
117
117
  root: ({ ownerState }) => ({
118
- maxWidth: 'calc(100% - 30px)',
118
+ maxWidth: 'calc(100% - 28px)',
119
119
  ...(ownerState.size === 'custom' && { // tslint:disable-line
120
120
  marginTop: isMobileOnly ? '0px' :'-4px',
121
121
  ['&.MuiInputLabel-shrink, &.Mui-focused']: {
@@ -1,5 +1,5 @@
1
1
  import React, { memo } from 'react';
2
- import { TextField, Checkbox } from '@mui/material';
2
+ import { TextField, Checkbox, Box, Divider } from '@mui/material';
3
3
  import { ThemeProvider } from '@mui/material/styles';
4
4
  import _isEmpty from 'lodash/isEmpty';
5
5
  import _indexOf from 'lodash/indexOf';
@@ -10,6 +10,7 @@ import _get from 'lodash/get';
10
10
  import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
11
11
  import { Theme, ArrowSelect, CheckboxLabel } from './MaterialAutocomplete.styled';
12
12
  import isEqual from 'lodash/isEqual';
13
+ import IconSVG from '../IconSVG/IconSVG';
13
14
 
14
15
  export interface IItems {
15
16
  value: string | number;
@@ -50,6 +51,8 @@ export interface IMaterialAutocompleteProps {
50
51
  disableIcon?: boolean;
51
52
  name?: string;
52
53
  placeholder?: string;
54
+ readOnly?:boolean,
55
+ listWithImage?:boolean
53
56
  }
54
57
 
55
58
  const ITEM_HEIGHT = 36;
@@ -76,7 +79,10 @@ const MaterialAutocomplete: React.FC<IMaterialAutocompleteProps> = ({
76
79
  items,
77
80
  disableIcon,
78
81
  name,
79
- placeholder
82
+ placeholder,
83
+ readOnly,
84
+ listWithImage
85
+
80
86
  }: IMaterialAutocompleteProps) => {
81
87
  const filter = createFilterOptions<IFilmOptionType>();
82
88
 
@@ -96,6 +102,8 @@ const MaterialAutocomplete: React.FC<IMaterialAutocompleteProps> = ({
96
102
  value={value}
97
103
  name={name}
98
104
  error={error}
105
+ readOnly={readOnly}
106
+ listwithimage={listWithImage}
99
107
  onChange={(e, newValue, reason: string, details?: { option: any }) => {
100
108
  if (typeof newValue === 'string') {
101
109
  onChange(newValue);
@@ -160,6 +168,22 @@ const MaterialAutocomplete: React.FC<IMaterialAutocompleteProps> = ({
160
168
  </li>
161
169
  );
162
170
  }
171
+ if (listWithImage){
172
+ return(
173
+ <><Box component='li'
174
+ sx={{ '& > svg': { mr: 2, flexShrink: 0 } }}
175
+ {...props}
176
+ key={_uniqueId(option.label)}>
177
+ <IconSVG
178
+ customDimensions
179
+ width='26px'
180
+ height='16px'
181
+ name={option.icon} />
182
+ {option.value}
183
+ </Box>
184
+ {option.isDivider ? <Divider /> : null}</>
185
+ );
186
+ }
163
187
  const isSeries = (option.isDisabled && option.label !== 'No options') || option.isSeries;
164
188
  const label = isSeries ? option.label.toUpperCase() : option.label;
165
189
  return (
@@ -189,6 +213,7 @@ const MaterialAutocomplete: React.FC<IMaterialAutocompleteProps> = ({
189
213
  label={label}
190
214
  name={name}
191
215
  placeholder={placeholder}
216
+ InputProps={{ ...params.InputProps, readOnly }}
192
217
  />
193
218
  )}
194
219
  >