@bytebrand/fe-ui-core 4.2.97 → 4.2.99

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.
Files changed (59) hide show
  1. package/package.json +1 -1
  2. package/source/components/AccordionWidget/AccordionWidget.tsx +3 -1
  3. package/source/components/OfferDetailedSection/partials/PanelConfig.tsx +2 -0
  4. package/source/components/OfferPanel/MuiOfferPeriod/{MuiOfferPeriod.theme.jsx → MuiOfferPeriod.theme.js} +12 -7
  5. package/source/components/OfferPanel/MuiOfferPeriod/MuiOfferPeriod.tsx +4 -28
  6. package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +10 -6
  7. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -1
  8. package/source/components/OfferPanel/OfferPanel.tsx +1 -1
  9. package/source/components/OfferPanel/OfferPeriod/OfferPeriod.tsx +4 -0
  10. package/source/components/PriceRatingDetailed/PriceRatingDetailed.tsx +2 -2
  11. package/source/components/SearchFilters/filters/DriveType.tsx +1 -1
  12. package/source/components/SearchFilters/filters/EmissionSticker.tsx +1 -1
  13. package/source/components/SearchFilters/filters/FirstRegistration.tsx +1 -0
  14. package/source/components/SearchFilters/filters/Fuel.tsx +1 -1
  15. package/source/components/SearchFilters/filters/InteriorColor.tsx +1 -1
  16. package/source/components/SearchFilters/filters/InteriorMaterial.tsx +1 -2
  17. package/source/components/SearchFilters/filters/Mileage.tsx +1 -1
  18. package/source/components/SearchFilters/filters/Power.tsx +1 -1
  19. package/source/components/SearchFilters/filters/StateOptions.tsx +1 -0
  20. package/source/components/SearchFilters/filters/Transmission.tsx +1 -1
  21. package/source/components/SearchPage/SearchChips/SearchChips.tsx +1 -1
  22. package/source/components/SearchPageMobile/FiltersDetailed/BodyType.tsx +3 -3
  23. package/source/components/SearchPageMobile/FiltersDetailed/Consumption.tsx +2 -2
  24. package/source/components/SearchPageMobile/FiltersDetailed/Doors.tsx +1 -1
  25. package/source/components/SearchPageMobile/FiltersDetailed/MakeModel.tsx +1 -1
  26. package/source/components/SearchWidget/ColorWidget/BodyColorWidget.tsx +3 -3
  27. package/source/components/SearchWidget/EnvironmentWidget/EnvironmentWidget.tsx +3 -3
  28. package/source/components/SearchWidget/HighlightsWidget/HighlightsWidget.tsx +2 -2
  29. package/source/components/SearchWidget/StateWidget/StateWidget.tsx +2 -1
  30. package/source/components/SearchWidgetsMobile/BasicDataWidgetMobile/BasicDataWidgetMobile.tsx +4 -4
  31. package/source/components/SearchWidgetsMobile/EquipmentsWidget/EquipmentsWidget.tsx +16 -16
  32. package/source/components/SearchWidgetsMobile/HighlightsWidgetMobile/HighlightsWidgetMobile.tsx +1 -1
  33. package/source/components/SearchWidgetsMobile/InteriorWidget/InteriorWidget.tsx +1 -1
  34. package/source/components/SearchWidgetsMobile/SafetyWidget/SafetyWidget.tsx +6 -6
  35. package/source/components/Stepper/Stepper.tsx +3 -4
  36. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCar.tsx +1 -1
  37. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.tsx +4 -1
  38. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +18 -18
  39. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.tsx +1 -1
  40. package/source/components/_common/Chip/Chip.tsx +3 -1
  41. package/source/components/_common/ExpansionPanel/ExpansionPanel.tsx +3 -3
  42. package/source/components/_common/IconSVG/SVG/flags/SK.tsx +1 -0
  43. package/source/components/_common/MaterialAccordion/MaterialAccordion.tsx +30 -22
  44. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.styled.tsx +1 -0
  45. package/source/components/_common/MaterialSelect/MaterialSelect.styled.tsx +11 -8
  46. package/source/components/_common/MaterialSelect/MaterialSelect.tsx +3 -3
  47. package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +3 -3
  48. package/source/components/_common/Modal/Modal.tsx +5 -2
  49. package/source/components/_common/Modal/ModalsConfig.tsx +1 -5
  50. package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.tsx +3 -7
  51. package/source/components/_common/Range/Range.tsx +5 -0
  52. package/source/components/_common/UserMenu/MaterialMenu.styled.tsx +1 -0
  53. package/source/components/_common/UserMenu/MaterialMenu.tsx +3 -3
  54. package/source/components/_common/UserMenu/MaterialMenuItem.tsx +6 -9
  55. package/source/components/_common/UserMenu/NestedMenu.tsx +1 -1
  56. package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.tsx +1 -1
  57. package/source/framework/constants/common.ts +1 -9
  58. package/source/framework/types/types.ts +2 -3
  59. package/source/framework/utils/DateUtils.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.2.97",
3
+ "version": "4.2.99",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -15,6 +15,7 @@ import {
15
15
 
16
16
  import ExpansionPanel from '../_common/ExpansionPanel/ExpansionPanel';
17
17
  import Accordion from '../_common/AccordionWrapper/AccordionWrapper';
18
+ // import AccordionItem from '../_common/AccordionWrapper/AccordionItem/AccordionItem';
18
19
  import VehicleProperty from '../VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty';
19
20
  import IconSVG from '../_common/IconSVG/IconSVG';
20
21
  import { getActualHighlights } from '../../framework/constants/highlights';
@@ -34,7 +35,7 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
34
35
  }
35
36
 
36
37
  handleChange =
37
- (panel: string) => (_: React.SyntheticEvent, isExpanded: boolean) => {
38
+ (panel: string) => (event: React.SyntheticEvent, isExpanded: boolean) => {
38
39
  this.setState({ expanded: isExpanded ? panel : false });
39
40
  };
40
41
 
@@ -209,6 +210,7 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
209
210
  onChange={this.handleChange}
210
211
  expanded={this.state.expanded}
211
212
  defaultExpanded={section.expanded}
213
+ // titleClassName={styles.titleClassName}
212
214
  >
213
215
  {section.component}
214
216
  </ExpansionPanel>
@@ -23,6 +23,8 @@ const PanelConfig: React.FunctionComponent<IPanelConfigProps> = ({
23
23
  OfferBlockComponent,
24
24
  offerBlockProps,
25
25
  postfix,
26
+ isOpenDetails,
27
+ onToggleDetailsClick,
26
28
  isAlternative
27
29
  }) => {
28
30
  const requestOfferProps = {
@@ -3,9 +3,11 @@ import { createTheme } from '@mui/material/styles';
3
3
  export const theme = createTheme({
4
4
  components: {
5
5
  MuiToggleButton: {
6
- styleOverrides: {
7
- root: ({ ownerState: { variant } }) => ({
8
- ...(variant === 'sidebar' && {
6
+ variants: [
7
+ {
8
+ props: { variant: 'sidebar' },
9
+ style: {
10
+ width: 40,
9
11
  height: 41,
10
12
  color: '#333',
11
13
  width: '100%',
@@ -16,10 +18,13 @@ export const theme = createTheme({
16
18
  '&.Mui-selected:hover': {
17
19
  backgroundColor: '#005ccb',
18
20
  color: '#fff'
19
- }
20
- })
21
- })
22
- }
21
+ },
22
+ // '&:hover': {
23
+ // backgroundColor: 'transparent'
24
+ // }
25
+ }
26
+ }
27
+ ]
23
28
  }
24
29
  }
25
30
  });
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
2
2
  import _get from 'lodash/get';
3
3
  import styles from '../OfferPanel.styl';
4
4
  import { modalsTranslate } from '../../../locales/data';
5
- import ToggleButton, { ToggleButtonProps } from '@mui/material/ToggleButton';
5
+ import ToggleButton from '@mui/material/ToggleButton';
6
6
  import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
7
7
  import { ThemeProvider } from '@mui/material/styles';
8
8
  import { theme } from './MuiOfferPeriod.theme';
@@ -14,24 +14,6 @@ export interface IOfferPeriod {
14
14
  onChange: (key: string, value: number) => void;
15
15
  }
16
16
 
17
- type ToggleButtonVariant =
18
- | 'text'
19
- | 'outlined'
20
- | 'contained'
21
- | 'sidebar';
22
-
23
- interface CustomToggleButtonProps extends Omit<ToggleButtonProps, 'variant'> {
24
- variant: ToggleButtonVariant;
25
- }
26
-
27
- const MyCustomToggleButton: FC<CustomToggleButtonProps> = (props) => {
28
- return (
29
- <ToggleButton {...props}>
30
- {props.children}
31
- </ToggleButton>
32
- );
33
- };
34
-
35
17
  const OfferPeriod: FC<IOfferPeriod> = ({ paybackPeriod, periods, t, onChange }) => {
36
18
 
37
19
  return (
@@ -45,19 +27,13 @@ const OfferPeriod: FC<IOfferPeriod> = ({ paybackPeriod, periods, t, onChange })
45
27
  color='primary'
46
28
  value={paybackPeriod}
47
29
  exclusive
48
- onChange={(event) => {
49
- onChange('paybackPeriod', +(event.target as HTMLInputElement).value);
30
+ onChange={(e) => {
31
+ onChange('paybackPeriod', +e.target.value);
50
32
  }}
51
33
  >
52
34
  {periods.map((period) => {
53
35
  return (
54
- <MyCustomToggleButton
55
- variant={'sidebar'}
56
- key={period}
57
- value={period}
58
- >
59
- {period}
60
- </MyCustomToggleButton>
36
+ <ToggleButton variant='sidebar' key={period} value={period}>{period}</ToggleButton>
61
37
  );
62
38
  })}
63
39
  </ToggleButtonGroup>
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import styles from './OfferCheckboxGroup.styl';
3
3
  import classnames from 'classnames';
4
4
  // import FormattedNumber from '../../FormattedNumber/FormattedNumber';
@@ -22,13 +22,11 @@ export interface ICheckboxProps {
22
22
  containerClassName?: string;
23
23
  checkboxClassName?: string;
24
24
  labelClassName?: string;
25
- labelPlacement?: "end" | "start" | "top" | "bottom";
26
25
  tooltipDescription?: string;
27
26
  checkboxPriceValue: any;
28
27
  tooltipPosX?: string;
29
28
  error?: boolean;
30
- description?: string;
31
- label?: JSX.Element | string | null;
29
+ label?: JSX.Element | string | null | ReactNode;
32
30
  }
33
31
 
34
32
  class CheckboxContainer extends React.Component<ICheckboxProps, {}> {
@@ -89,8 +87,8 @@ class CheckboxContainer extends React.Component<ICheckboxProps, {}> {
89
87
 
90
88
  render() {
91
89
  const {
92
- containerClassName, labelClassName, reversed,
93
- checked, disabled, error, label, tooltipDescription, labelPlacement,
90
+ containerClassName, checkboxClassName, labelClassName, reversed,
91
+ checked, disabled, value, error, label, tooltipDescription, checkboxPriceValue, tooltipPosX, labelPlacement,
94
92
  description
95
93
  } = this.props;
96
94
 
@@ -107,6 +105,12 @@ class CheckboxContainer extends React.Component<ICheckboxProps, {}> {
107
105
  labelClassName
108
106
  );
109
107
 
108
+ const checkboxClasses = classnames(
109
+ styles.checkbox,
110
+ checkboxClassName,
111
+ { [styles.withLabel]: !!label }
112
+ );
113
+
110
114
  const wrapInputClasses = classnames(
111
115
  styles.wrapInput,
112
116
  { [styles.reversed]: reversed }
@@ -11,7 +11,7 @@ interface IOfferPeriod {
11
11
  transferInstallments?: any;
12
12
  }
13
13
 
14
- const OfferCheckboxGroup: FC<IOfferPeriod> = ({ additionalService, transferInstallments, isAboAccordionExpanded0 = true, priceTabIndex }) => {
14
+ const OfferCheckboxGroup: FC<IOfferPeriod> = ({ additionalService, transferInstallments, isAboAccordionExpanded0 = true, priceTabIndex, labelClassname }) => {
15
15
  const offerGroupClass = classNames(styles.checkboxWrapped, { [styles.checkBoxGroup]: priceTabIndex !== THREE });
16
16
  return (
17
17
  <div className={offerGroupClass}>
@@ -11,7 +11,7 @@ import CheckboxMaterial from '../_common/CheckboxMaterial/CheckboxMaterial';
11
11
  interface IFinalAdvice {
12
12
  checked: boolean;
13
13
  label: string;
14
- onChange?: (event?: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string, value?: any) => void;
14
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any) => void;
15
15
  reversed?: boolean;
16
16
  value: string;
17
17
  }
@@ -1,5 +1,6 @@
1
1
  import React, { FC, ChangeEvent } from 'react';
2
2
  import _get from 'lodash/get';
3
+ import classNames from 'classnames';
3
4
  import styles from './OfferPeriod.styl';
4
5
  import { modalsTranslate } from '../../../locales/data';
5
6
  import CheckboxMaterial from '../../_common/CheckboxMaterial/CheckboxMaterial';
@@ -21,6 +22,9 @@ const OfferPeriod: FC<IOfferPeriod> = ({ paybackPeriod, periods, t, onChange })
21
22
  <div className={styles.periods}>
22
23
  {periods.map((period: number) => {
23
24
  const isChecked = paybackPeriod === period;
25
+ const labelClassName = classNames(
26
+ { [styles.checked]: isChecked }
27
+ );
24
28
  const inputProps = {
25
29
  type: 'period',
26
30
  name: 'duration',
@@ -157,8 +157,8 @@ class PriceRatingDetailed extends React.Component<IPriceRatingDetailedProps, IPr
157
157
  const MIN_PRICE = 500;
158
158
  const MARGIN_OFFSET = price >= MIN_PRICE ? MIN_PRICE : (price / 2);
159
159
  const strings = {
160
- general: `${getFormattedPrice((marginToLeft ? price - MARGIN_OFFSET : min) as number)} – ${getFormattedPrice((marginToRight ? price + MARGIN_OFFSET : max) as number)}\u00A0€`,
161
- compact: <>{getFormattedPrice((marginToLeft ? price - MARGIN_OFFSET : min) as number)}<br />{t(`${i18nPrefix}priceTo`)} {getFormattedPrice((marginToRight ? price + MARGIN_OFFSET : max) as number)} €</>
160
+ general: `${getFormattedPrice(marginToLeft ? price - MARGIN_OFFSET : min)} – ${getFormattedPrice(marginToRight ? price + MARGIN_OFFSET : max)}\u00A0€`,
161
+ compact: <>{getFormattedPrice(marginToLeft ? price - MARGIN_OFFSET : min)}<br />{t(`${i18nPrefix}priceTo`)} {getFormattedPrice(marginToRight ? price + MARGIN_OFFSET : max)} €</>
162
162
  };
163
163
 
164
164
  return (
@@ -14,7 +14,7 @@ export interface IDriveTypeProps {
14
14
  }
15
15
 
16
16
  class DriveType extends React.Component<IDriveTypeProps, {}> {
17
- onDriveTypeChange = (event?: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string, value?: any): void => {
17
+ onDriveTypeChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any): void => {
18
18
  const { values } = this.props;
19
19
  event.stopPropagation();
20
20
  event.nativeEvent.stopImmediatePropagation();
@@ -11,7 +11,7 @@ export interface IEmissionStickerProps {
11
11
  }
12
12
 
13
13
  class EmissionSticker extends React.Component<IEmissionStickerProps, {}> {
14
- onFilterChange = (_event?: React.ChangeEvent<HTMLInputElement>, value?: any) => {
14
+ onFilterChange = (_event: any, value: string[]) => {
15
15
  this.props.onChange('OWNERS_OPTIONS', value);
16
16
  };
17
17
 
@@ -1,6 +1,7 @@
1
1
  import React, { memo } from 'react';
2
2
  import Slider from '../../_common/Slider/Slider';
3
3
  import _get from 'lodash/get';
4
+ import { RANGE_FILTERS_DEFAULT_CONTROLS } from '../../../framework/constants/Search';
4
5
  import { sliceLessThan, sliceMoreThan } from '../../../framework/utils/CommonUtils';
5
6
  import { getSearchYears } from '../../../framework/utils/DateUtils';
6
7
  import MaterialAutocomplete from '../../_common/MaterialAutocomplete/MaterialAutocomplete';
@@ -10,7 +10,7 @@ interface IFuelProps {
10
10
  values: any[];
11
11
  aggregation?: any;
12
12
  t?: any;
13
- isNotDetailed:boolean;
13
+ isNotDetailed?: boolean;
14
14
  onChange: (fieldName: string, fieldValue: string[]) => void;
15
15
  }
16
16
 
@@ -16,7 +16,7 @@ export interface IInteriorColorProps {
16
16
  }
17
17
 
18
18
  const InteriorColor = ({ onChange, values, options, aggregation, t, className }: IInteriorColorProps) => {
19
- const onColorChange = (event?: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string, value?: any): void => {
19
+ const onColorChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any): void => {
20
20
  event.stopPropagation();
21
21
  event.nativeEvent.stopImmediatePropagation();
22
22
  let _value = value;
@@ -11,13 +11,12 @@ interface IInteriorMaterialProps {
11
11
  values: any[];
12
12
  aggregation?: any;
13
13
  t: (key: string) => string;
14
- isHorizontal?: boolean;
15
14
 
16
15
  onChange?: (event: any, value: string[]) => void;
17
16
  }
18
17
 
19
18
  const InteriorMaterial = ({ options, values, aggregation, t, onChange }: IInteriorMaterialProps) => {
20
- const onTypeChange = (event?: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string, value?: any): void => {
19
+ const onTypeChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any): void => {
21
20
  event.stopPropagation();
22
21
  event.nativeEvent.stopImmediatePropagation();
23
22
  let _value = value;
@@ -2,7 +2,7 @@ import React, { memo } from 'react';
2
2
  import _get from 'lodash/get';
3
3
  import { isEqual } from 'lodash';
4
4
  import Slider from '../../_common/Slider/Slider';
5
- import { MILLAGE_FIX } from '../../../framework/constants/Search';
5
+ import { MILLAGE_FIX, RANGE_FILTERS_DEFAULT_CONTROLS } from '../../../framework/constants/Search';
6
6
  import { sliceLessThan, sliceMoreThan, numberWithDot } from '../../../framework/utils/CommonUtils';
7
7
  import styles from './commonFilters.styl';
8
8
  import MaterialAutocomplete from '../../_common/MaterialAutocomplete/MaterialAutocomplete';
@@ -5,7 +5,7 @@ import styles from './commonFilters.styl';
5
5
  import { isEqual } from 'lodash';
6
6
  import { RadioGroup } from '@mui/material';
7
7
  import CheckboxMaterial from '../../_common/CheckboxMaterial/CheckboxMaterial';
8
- import { POWER_FIX } from '../../../framework/constants/Search';
8
+ import { POWER_FIX, RANGE_FILTERS_DEFAULT_CONTROLS } from '../../../framework/constants/Search';
9
9
  import { sliceLessThan, sliceMoreThan } from '../../../framework/utils/CommonUtils';
10
10
 
11
11
  interface IPowerProps {
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
+ import Checkbox from '../../_common/Checkbox/Checkbox';
3
4
  import styles from './StateOptions.styl';
4
5
  import FilterLabel from '../../_common/FilterLabel/FilterLabel';
5
6
  import CheckboxMaterial from '../../_common/CheckboxMaterial/CheckboxMaterial';
@@ -14,7 +14,7 @@ export interface ITransmissionProps {
14
14
  }
15
15
 
16
16
  class Transmission extends React.Component<ITransmissionProps, {}> {
17
- onTransmissionChange = (event?: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string, value?: any): void => {
17
+ onTransmissionChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any): void => {
18
18
  const { values } = this.props;
19
19
  event.stopPropagation();
20
20
  event.nativeEvent.stopImmediatePropagation();
@@ -5,7 +5,7 @@ import ChipFilter from '../ChipFilter/ChipFilter';
5
5
  import { SearchPage as SearchPageTranslate } from '../../../locales/data';
6
6
  import Chip from '@mui/material/Chip';
7
7
 
8
- import { getChipFilterValue } from '../../../framework/utils/CommonUtils';
8
+ import { getChipFilterValue, getFormattedPrice } from '../../../framework/utils/CommonUtils';
9
9
 
10
10
  export interface ISearchChipsProps {
11
11
  chips: any[];
@@ -21,9 +21,9 @@ class BodyType extends React.Component<IBodyTypeBlock> {
21
21
  || !_isEqual(aggregation, nextProps.aggregation)
22
22
  || t !== nextProps.t;
23
23
  }
24
- onBodyTypeCheckboxChange = (option: any) => (_event?: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string) => this.onFilterChange(checked, option);
24
+ onBodyTypeCheckboxChange = (option: any) => (_: React.ChangeEvent<HTMLInputElement>, checked: boolean) => this.onFilterChange(checked, option);
25
25
 
26
- onFilterChange = (_: boolean | string, fieldName: string): void => {
26
+ onFilterChange = (_: boolean, fieldName: string): void => {
27
27
  const { BODY_TYPE, onChange } = this.props;
28
28
  const bodyTypeField = 'BODY_TYPE';
29
29
  const values = [...BODY_TYPE.values];
@@ -37,7 +37,7 @@ class BodyType extends React.Component<IBodyTypeBlock> {
37
37
  onChange(bodyTypeField, values);
38
38
  };
39
39
 
40
- renderLabel = (option: string, isChecked: boolean): JSX.Element => {
40
+ renderLabel = (option: string, isChecked: boolean): React.ReactNode => {
41
41
  const { t, aggregation } = this.props;
42
42
  // const agg = aggregation && aggregation[option] || 0;
43
43
  const agg = aggregation && aggregation[option] ? aggregation[option] : 0;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { memo } from 'react';
2
2
  import _get from 'lodash/get';
3
3
 
4
4
  import styles from './Consumption.styl';
@@ -8,7 +8,7 @@ import { CONSUMPTION_FIX } from '../../../framework/constants/Search';
8
8
  export interface IConsumptionProps {
9
9
  values: any;
10
10
  options: any;
11
- controls?: any;
11
+ controls: any;
12
12
  shortTitle?: boolean;
13
13
  onChange: (fieldName: string, fieldValue: any) => void;
14
14
  t?: (phrase: string) => string;
@@ -25,7 +25,7 @@ class Doors extends React.Component<IDoorsProps, IDoorsState> {
25
25
  };
26
26
  }
27
27
 
28
- onFilterChange = (_:React.ChangeEvent<HTMLInputElement> | boolean, _checked?: string | boolean, fieldName?: any): void => {
28
+ onFilterChange = (_: boolean, checked?: boolean, fieldName?: string): void => {
29
29
  const { fieldValues } = this.props;
30
30
  let newValue: string[] = [...fieldValues];
31
31
 
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { memo } from 'react';
2
2
  import _get from 'lodash/get';
3
3
  import styles from './MakeModel.styl';
4
4
  import MaterialSelect from '../../_common/MaterialSelect/MaterialSelect';
@@ -39,7 +39,7 @@ const BodyColorWidget = ({
39
39
 
40
40
  }: IBodyColorWidgetProps) => {
41
41
 
42
- const onColorChange = (event?: React.ChangeEvent<HTMLInputElement>, checked?: string | boolean, value?: any): void => {
42
+ const onColorChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any): void => {
43
43
  event.stopPropagation();
44
44
  event.nativeEvent.stopImmediatePropagation();
45
45
  let _value = value;
@@ -55,7 +55,7 @@ const BodyColorWidget = ({
55
55
  onFilterChange('BODY_COLOR', _value);
56
56
  };
57
57
 
58
- const onCheckboxClick = (_event?: React.ChangeEvent<HTMLInputElement>, value?: string | boolean): void => {
58
+ const onCheckboxClick = (_: React.ChangeEvent<HTMLInputElement>, value: boolean): void => {
59
59
  onFilterChange('METALLIC', value ? 'exterior_metallic' : '');
60
60
  };
61
61
 
@@ -72,7 +72,7 @@ const BodyColorWidget = ({
72
72
  content: option,
73
73
  value: option,
74
74
  className: styles.color,
75
- labelPlacement: 'bottom' as 'bottom',
75
+ labelPlacement: 'bottom',
76
76
  checked: isChecked,
77
77
  label: <FilterLabel text={t(`cbd:${option}`)} agg={agg} isVertical={true}/>,
78
78
  onChange: onColorChange
@@ -50,7 +50,7 @@ const EnvironmentWidget: React.FC<IEnvironmentWidgetProps> = ({
50
50
  const getConsumption = _get(CONSUMPTION, 'values.to');
51
51
  const getEmissionClass = _get(EMISSION_CLASS, 'values');
52
52
 
53
- const onEmissionStickersChange = (event?: React.ChangeEvent<HTMLInputElement>, _checked?: string | boolean, value?: any) => {
53
+ const onEmissionStickersChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any) => {
54
54
  event.stopPropagation();
55
55
  event.nativeEvent.stopImmediatePropagation();
56
56
  const { values } = EMISSION_STICKER;
@@ -63,7 +63,7 @@ const EnvironmentWidget: React.FC<IEnvironmentWidgetProps> = ({
63
63
  onFilterChange(EMISSION_STICKER_KEY, value);
64
64
  };
65
65
 
66
- const onCheckboxClick = (_: React.ChangeEvent<HTMLElement>, value?: boolean | string): void => {
66
+ const onCheckboxClick = (_: React.ChangeEvent<HTMLElement>, value: boolean): void => {
67
67
  onFilterChange(PARTICULATE_FILTER_KEY, value ? 'engineData_particulateFilterDiesel' : '');
68
68
  };
69
69
 
@@ -132,7 +132,7 @@ const EnvironmentWidget: React.FC<IEnvironmentWidgetProps> = ({
132
132
  <MaterialAutocomplete
133
133
  size='custom'
134
134
  value={getConsumption ? getValue(getConsumption) : null}
135
- onChange={(value: string) => onFilterChange(CONSUMPTION_KEY, { from: void 0, to: value } as any)}
135
+ onChange={(value: string) => onFilterChange(CONSUMPTION_KEY, { from: void 0, to: value })}
136
136
  label={t('filters.consumption')}
137
137
  unit='l/100 km'
138
138
  items={getOptions(CONSUMPTION_FIX)}
@@ -29,7 +29,7 @@ export interface IHighlightsWidgetProps {
29
29
 
30
30
  class HighlightsWidget extends React.Component<IHighlightsWidgetProps, {}> {
31
31
 
32
- onFilterChange = (event: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string, value?: any) => {
32
+ onFilterChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any) => {
33
33
  event.stopPropagation();
34
34
  event.nativeEvent.stopImmediatePropagation();
35
35
 
@@ -75,7 +75,7 @@ class HighlightsWidget extends React.Component<IHighlightsWidgetProps, {}> {
75
75
  };
76
76
 
77
77
  render(): JSX.Element {
78
- const { t, Link } = this.props;
78
+ const { t, HIGHLIGHTS, Link } = this.props;
79
79
 
80
80
  return (
81
81
  <div className={styles.highlights}>
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import Owners from '../../SearchFilters/filters/Owners';
3
3
  import MaterialSelect from '../../_common/MaterialSelect/MaterialSelect';
4
+ import StateOptions from '../../SearchFilters/filters/StateOptions';
4
5
  import StateOptionsNew from '../../SearchFilters/filters/StateOptionsNew';
5
6
  import { VEHICLE_CONDITION_KEY, STATE_OPTIONS_KEY } from '../../../framework/constants/Search';
6
7
  import FilterLabel from '../../_common/FilterLabel/FilterLabel';
@@ -47,7 +48,7 @@ const StateWidget = (props: IStateWidgetProps) => {
47
48
  labelContainerClassName: styles.labelWrapper
48
49
  };
49
50
 
50
- const getCheckboxClickHandler = (name: string) => (_: React.ChangeEvent<HTMLInputElement>, value?: boolean | string): void => {
51
+ const getCheckboxClickHandler = (name: string) => (_: React.ChangeEvent<HTMLInputElement>, value: boolean): void => {
51
52
  const { VEHICLE_CONDITION: { values, options } } = props;
52
53
  const currentValues: any = {};
53
54
  options.forEach((key: string) => { currentValues[key] = values.includes(key); });
@@ -12,7 +12,7 @@ import Mileage from '../../SearchPageMobile/FiltersDetailed/Mileage';
12
12
  import Consumption from '../../SearchPageMobile/FiltersDetailed/Consumption';
13
13
  import FirstRegistration from '../../SearchPageMobile/FiltersDetailed/FirstRegistration';
14
14
  import MakeModel, { IMakeModelProps } from '../../SearchPageMobile/FiltersDetailed/MakeModel';
15
- import { IMakeModelExcludeProps } from '../../SearchPageMobile/FiltersDetailed/MakeModelExclude';
15
+ import MakeModelExclude, { IMakeModelExcludeProps } from '../../SearchPageMobile/FiltersDetailed/MakeModelExclude';
16
16
  import { COST_TYPE_DEFAULT, COST_TYPE_OPTIONS, RANGE_FILTERS, RANGE_FILTERS_DEFAULT_CONTROLS } from '../../../framework/constants/Search';
17
17
  import { OBJECT_FILTERS, RATE_DEFAULT_CONTROLS } from '../../../framework/constants/SearchWidget';
18
18
 
@@ -32,7 +32,7 @@ class BasicDataWidgetMobile extends React.Component<IMakeModelProps & IMakeModel
32
32
  };
33
33
 
34
34
  shouldComponentUpdate(nextProps: any, nextState: any) {
35
- const { MMS_GROUPS, BODY_TYPE, FIRST_REGISTRATION, MILEAGE, POWER, RATE, PRICE, CONSUMPTION, SEATS, DOORS, FUEL, t } = this.props;
35
+ const { MMS_GROUPS, BODY_TYPE, FIRST_REGISTRATION, MILEAGE, POWER, RATE, PRICE, CONSUMPTION, SEATS, DOORS, FUEL, t, isNotDetailed } = this.props;
36
36
 
37
37
  const dataBlocks = {
38
38
  MMS_GROUPS, BODY_TYPE, FIRST_REGISTRATION, MILEAGE, POWER, RATE, PRICE, CONSUMPTION, SEATS, DOORS, FUEL
@@ -66,8 +66,8 @@ class BasicDataWidgetMobile extends React.Component<IMakeModelProps & IMakeModel
66
66
  render(): React.ReactNode {
67
67
  const {
68
68
  MMS_GROUPS, BODY_TYPE, FIRST_REGISTRATION, MILEAGE, POWER, RATE, PRICE, CONSUMPTION, SEATS, DOORS, FUEL,
69
- onFilterChange, onChangeFilterControls, onRemoveMmsGroup, onDropDownFocus,
70
- t, showModal, hideModal, onAddMmsGroupClick, isNotDetailed
69
+ onFilterChange, onChangeFilterControls, onAddMmsGroup, onRemoveMmsGroup, onDropDownFocus,
70
+ MM_GROUPS_EXCLUDE, onAddMmExcludeGroup, onRemoveMmExcludeGroup, t, showModal, hideModal, onAddMmsGroupClick, isNotDetailed
71
71
  } = this.props;
72
72
  const commonProps = { t, onChange: onFilterChange };
73
73
 
@@ -39,7 +39,7 @@ const EquipmentsWidget = (props: IEquipmentsWidget) => {
39
39
  CLIMATISATION, HEATER, MULTIMEDIA, SEATS_OPTIONS, WHEEL, LIGHTS, DOORS_OPTIONS, WINDOW_OPTIONS,
40
40
  MIRRORS_OPTIONS, LANDING_GEAR, EXTRAS_OPTIONS, DRIVER_SEATS, CO_DRIVER_SEATS, BACK_SEATS, HIGHLIGHTS,
41
41
  onFilterChange,
42
- // onDropDownFocus,
42
+ onDropDownFocus,
43
43
  onCategoryFocus,
44
44
  t } = props;
45
45
  const onCheckboxClick = (fieldName: string, categoryName: string, values: string[]): void => {
@@ -116,11 +116,11 @@ const EquipmentsWidget = (props: IEquipmentsWidget) => {
116
116
  return onFilterChange(categoryName, values);
117
117
  };
118
118
 
119
- // const onDropdownFocus = (fieldName: string) => {
120
- // if (onDropDownFocus) {
121
- // onDropDownFocus(fieldName);
122
- // }
123
- // };
119
+ const onDropdownFocus = (fieldName: string) => {
120
+ if (onDropDownFocus) {
121
+ onDropDownFocus(fieldName);
122
+ }
123
+ };
124
124
 
125
125
  const getOptions = (options: any, categoryName?: string) => {
126
126
  const { [categoryName]: { aggregation } } = props;
@@ -134,16 +134,16 @@ const EquipmentsWidget = (props: IEquipmentsWidget) => {
134
134
  });
135
135
  };
136
136
 
137
- // const isDropDown = (name: string) => {
138
- // switch (name) {
139
- // case 'DRIVER_SEATS':
140
- // case 'CO_DRIVER_SEATS':
141
- // case 'BACK_SEATS':
142
- // return true;
143
- // default:
144
- // return false;
145
- // }
146
- // };
137
+ const isDropDown = (name: string) => {
138
+ switch (name) {
139
+ case 'DRIVER_SEATS':
140
+ case 'CO_DRIVER_SEATS':
141
+ case 'BACK_SEATS':
142
+ return true;
143
+ default:
144
+ return false;
145
+ }
146
+ };
147
147
 
148
148
  const renderDropDown = (index: number, categoryName?: string, data?: any, isMobile?: boolean): React.ReactNode => {
149
149
  const { options, values } = data;
@@ -36,7 +36,7 @@ const HighlightsWidgetMobile = ({ onFilterChange, HIGHLIGHTS, t }: IHighlightsWi
36
36
  onFilterChange(HIGHLIGHTS_KEY, value);
37
37
  };
38
38
 
39
- const onHighlightsChange = (event: React.ChangeEvent<HTMLInputElement>, checked?: boolean | string, value?: any): void => {
39
+ const onHighlightsChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any): void => {
40
40
  const { values } = HIGHLIGHTS;
41
41
  event.stopPropagation();
42
42
  event.nativeEvent.stopImmediatePropagation();
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { memo } from 'react';
2
2
  import InteriorColor from '../../SearchFilters/filters/InteriorColor';
3
3
  import InteriorMaterial from '../../SearchFilters/filters/InteriorMaterial';
4
4
 
@@ -22,7 +22,7 @@ export interface ISafetyWidget {
22
22
  const AIRBAG_KEY = 'AIRBAG';
23
23
 
24
24
  const SafetyWidget = (props: ISafetyWidget) => {
25
- const { ASSISTANTS, AIRBAG, PARKING_ASSISTANTS, THEFT_PROTECTION, HIGHLIGHTS, onFilterChange, t } = props;
25
+ const { ASSISTANTS, AIRBAG, PARKING_ASSISTANTS, THEFT_PROTECTION, HIGHLIGHTS, onFilterChange, onDropDownFocus, t } = props;
26
26
  const onCheckboxClick = (fieldName: string, categoryName: string, values: string[]) => {
27
27
  const index = values.indexOf(fieldName);
28
28
 
@@ -40,11 +40,11 @@ const SafetyWidget = (props: ISafetyWidget) => {
40
40
  return onFilterChange(AIRBAG_KEY, values);
41
41
  };
42
42
 
43
- // const onDropdownFocus = () => {
44
- // if (onDropDownFocus) {
45
- // onDropDownFocus(AIRBAG_KEY);
46
- // }
47
- // };
43
+ const onDropdownFocus = () => {
44
+ if (onDropDownFocus) {
45
+ onDropDownFocus(AIRBAG_KEY);
46
+ }
47
+ };
48
48
 
49
49
  const getOptions = (_: string, options: any) => {
50
50
  const { aggregation } = AIRBAG;