@bytebrand/fe-ui-core 4.2.250 → 4.3.0

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 (123) hide show
  1. package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +2 -4
  2. package/common.ts +2 -6
  3. package/package.json +2 -4
  4. package/source/components/AccordionWidget/AccordionWidget.tsx +3 -1
  5. package/source/components/Breadcrumbs/Breadcrumbs.tsx +3 -3
  6. package/source/components/Checkout/CheckoutStepper/CheckoutStepper.styl +190 -2
  7. package/source/components/Checkout/CheckoutStepper/CheckoutStepper.tsx +16 -15
  8. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.styl +2 -2
  9. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.tsx +3 -3
  10. package/source/components/FormattedNumber/FormattedNumber.tsx +3 -2
  11. package/source/components/InfoBlocks/FirstInfoBlock/FirstInfoBlockItem/FirstInfoBlockItem.styl +6 -4
  12. package/source/components/OfferDetailedSection/partials/PanelConfig.tsx +3 -0
  13. package/source/components/OfferPanel/MuiOfferPeriod/{MuiOfferPeriod.theme.tsx → MuiOfferPeriod.theme.js} +13 -8
  14. package/source/components/OfferPanel/MuiOfferPeriod/MuiOfferPeriod.tsx +4 -28
  15. package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +12 -6
  16. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -1
  17. package/source/components/OfferPanel/OfferPanel.tsx +1 -1
  18. package/source/components/OfferPanel/OfferPeriod/OfferPeriod.tsx +4 -0
  19. package/source/components/OfferPanel/RangeGroup/RangeGroup.tsx +4 -6
  20. package/source/components/PriceRatingDetailed/PriceRatingDetailed.tsx +2 -6
  21. package/source/components/SearchFilters/filters/AlternativeID.tsx +53 -42
  22. package/source/components/SearchFilters/filters/DriveType.tsx +1 -1
  23. package/source/components/SearchFilters/filters/EmissionSticker.tsx +1 -1
  24. package/source/components/SearchFilters/filters/FirstRegistration.tsx +1 -0
  25. package/source/components/SearchFilters/filters/InteriorColor.tsx +1 -1
  26. package/source/components/SearchFilters/filters/InteriorMaterial.tsx +1 -2
  27. package/source/components/SearchFilters/filters/Mileage.tsx +1 -1
  28. package/source/components/SearchFilters/filters/Power.tsx +17 -36
  29. package/source/components/SearchFilters/filters/StateOptions.tsx +1 -0
  30. package/source/components/SearchFilters/filters/Transmission.tsx +1 -1
  31. package/source/components/SearchPage/SearchChips/SearchChips.tsx +1 -1
  32. package/source/components/SearchPageMobile/FiltersDetailed/BodyType.tsx +3 -3
  33. package/source/components/SearchPageMobile/FiltersDetailed/Consumption.tsx +2 -2
  34. package/source/components/SearchPageMobile/FiltersDetailed/Doors.tsx +1 -1
  35. package/source/components/SearchPageMobile/FiltersDetailed/MakeModel.tsx +1 -1
  36. package/source/components/SearchWidget/ColorWidget/BodyColorWidget.tsx +3 -3
  37. package/source/components/SearchWidget/EnvironmentWidget/EnvironmentWidget.tsx +3 -3
  38. package/source/components/SearchWidget/HighlightsWidget/HighlightsWidget.tsx +2 -2
  39. package/source/components/SearchWidget/StateWidget/StateWidget.tsx +2 -1
  40. package/source/components/SearchWidgetsMobile/BasicDataWidgetMobile/BasicDataWidgetMobile.tsx +4 -4
  41. package/source/components/SearchWidgetsMobile/EquipmentsWidget/EquipmentsWidget.tsx +16 -16
  42. package/source/components/SearchWidgetsMobile/HighlightsWidgetMobile/HighlightsWidgetMobile.tsx +1 -1
  43. package/source/components/SearchWidgetsMobile/InteriorWidget/InteriorWidget.tsx +1 -1
  44. package/source/components/SearchWidgetsMobile/SafetyWidget/SafetyWidget.tsx +6 -6
  45. package/source/components/Stepper/Stepper.tsx +3 -4
  46. package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.styl +2 -11
  47. package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.tsx +5 -5
  48. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCar.tsx +38 -57
  49. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCard.tsx +2 -2
  50. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx +101 -183
  51. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.tsx +7 -5
  52. package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.tsx +7 -33
  53. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.styl +2 -10
  54. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +14 -54
  55. package/source/components/VehicleDetailedSidebar/partials/Price.styl +1 -5
  56. package/source/components/VehicleDetailedSidebar/partials/Price.tsx +1 -2
  57. package/source/components/VehicleDetailedSidebar/partials/PriceContent.styl +5 -16
  58. package/source/components/VehicleDetailedSidebar/partials/PriceContent.tsx +4 -9
  59. package/source/components/VehicleDetailedSidebar/partials/Properties.tsx +1 -1
  60. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.styl +0 -45
  61. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +42 -121
  62. package/source/components/VehicleDetailedSlider/partials/PriceData.styl +1 -4
  63. package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +1 -8
  64. package/source/components/VehicleDetailedSlider/partials/Stats.tsx +2 -2
  65. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +7 -9
  66. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +1 -35
  67. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +3 -9
  68. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.styl +2 -11
  69. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -2
  70. package/source/components/VehicleSmallCard/VehicleSmallCard.styl +1 -3
  71. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +7 -3
  72. package/source/components/_common/Badge/Badge.styl +0 -3
  73. package/source/components/_common/Badge/Badge.tsx +1 -1
  74. package/source/components/_common/Button/Button.tsx +4 -5
  75. package/source/components/_common/Checkbox/FormCheckbox.tsx +4 -4
  76. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.tsx +1 -1
  77. package/source/components/_common/Chip/Chip.tsx +3 -1
  78. package/source/components/_common/ExpansionPanel/ExpansionPanel.tsx +3 -3
  79. package/source/components/_common/IconSVG/IconSVGConfig.tsx +0 -2
  80. package/source/components/_common/IconSVG/SVG/flags/SK.tsx +1 -0
  81. package/source/components/_common/IconSVG/SVG/slider/360New.tsx +1 -1
  82. package/source/components/_common/MaterialAccordion/MaterialAccordion.tsx +30 -22
  83. package/source/components/_common/MaterialAutocomplete/MaterialAutocomplete.styled.tsx +8 -8
  84. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.styled.tsx +1 -0
  85. package/source/components/_common/MaterialSelect/MaterialSelect.styled.tsx +15 -12
  86. package/source/components/_common/MaterialSelect/MaterialSelect.tsx +3 -3
  87. package/source/components/_common/MaterialSwitch/MaterialSwitch.tsx +1 -3
  88. package/source/components/_common/MaterialTooltip/MaterialTooltip.styled.tsx +1 -1
  89. package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +3 -3
  90. package/source/components/_common/Modal/CookieModal.tsx +3 -1
  91. package/source/components/_common/Modal/Modal.styled.tsx +1 -2
  92. package/source/components/_common/Modal/Modal.tsx +5 -1
  93. package/source/components/_common/Modal/ModalsConfig.tsx +1 -5
  94. package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.styl +7 -23
  95. package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.tsx +36 -84
  96. package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.styl +14 -29
  97. package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.tsx +10 -17
  98. package/source/components/_common/OfferRequestButtonWrapper/OfferRequestButtonWrapper.tsx +4 -12
  99. package/source/components/_common/Range/Range.tsx +14 -27
  100. package/source/components/_common/UserMenu/MaterialMenu.styled.tsx +1 -0
  101. package/source/components/_common/UserMenu/MaterialMenu.tsx +3 -3
  102. package/source/components/_common/UserMenu/MaterialMenuItem.tsx +20 -42
  103. package/source/components/_common/UserMenu/NestedMenu.tsx +1 -1
  104. package/source/components/_common/withStats/withStats.styl +0 -3
  105. package/source/components/_common/withStats/withStats.tsx +16 -19
  106. package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.styl +1 -14
  107. package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.tsx +42 -78
  108. package/source/framework/constants/common.ts +60 -89
  109. package/source/framework/constants/highlights.ts +1 -1
  110. package/source/framework/constants.ts +1 -1
  111. package/source/framework/types/types.ts +4 -9
  112. package/source/framework/utils/CommonUtils.ts +62 -73
  113. package/source/framework/utils/DateUtils.ts +2 -10
  114. package/source/locales/data.ts +2 -2
  115. package/tslint.json +2 -1
  116. package/utils.ts +0 -2
  117. package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +0 -613
  118. package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +0 -335
  119. package/source/components/UserDashboardPage/sections/CheckoutSection/CheckoutSection.styl +0 -38
  120. package/source/components/UserDashboardPage/sections/CheckoutSection/CheckoutSection.tsx +0 -120
  121. package/source/components/UserDashboardPage/sections/FavoriteSection/FavoriteSection.styl +0 -22
  122. package/source/components/UserDashboardPage/sections/FavoriteSection/FavoriteSection.tsx +0 -84
  123. package/source/components/_common/IconSVG/SVG/slider/YoutubeButton.tsx +0 -26
@@ -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',
@@ -9,18 +9,16 @@ export interface IRangeGroup {
9
9
  onChange: (event: Event, value: number | number[]) => void;
10
10
  className?: string;
11
11
  isAlternative?: boolean;
12
- maxFinancingFirstInstallment?: number;
13
12
  }
14
13
 
15
- const RangeGroup: FC<IRangeGroup> = ({ sliders, onChange, isAlternative, maxFinancingFirstInstallment }) => <>
16
- {sliders.length && sliders.map(({ name, min, max, step, caption, value, unitName, withRangeLimit }) => {
14
+ const RangeGroup: FC<IRangeGroup> = ({ sliders, onChange, isAlternative }) => <>
15
+ {sliders.length && sliders.map(({ name, min, max, step, caption, value, unitName }) => {
17
16
  const rangeProps = {
18
17
  min, max, step, value,
19
- isAlternative, withRangeLimit,
18
+ isAlternative,
20
19
  units: value ? ` ${unitName}` : '',
21
20
  onAfterChange: () => {},
22
- onChange: (_: Event, value: number | number[]) => onChange(name, value),
23
- maxFinancingFirstInstallment
21
+ onChange: (_: Event, value: number | number[]) => onChange(name, value)
24
22
  };
25
23
  return (
26
24
  <Fragment key={name}>
@@ -157,12 +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: <>
162
- {getFormattedPrice((marginToLeft ? price - MARGIN_OFFSET : min) as number)}
163
- <br />
164
- {t(`${i18nPrefix}priceTo`)} {getFormattedPrice((marginToRight ? price + MARGIN_OFFSET : max) as number)} €
165
- </>
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)} €</>
166
162
  };
167
163
 
168
164
  return (
@@ -1,4 +1,4 @@
1
- import React, { useState, KeyboardEvent } from 'react';
1
+ import * as React from 'react';
2
2
  import TextField from '../../_common/TextField/TextField';
3
3
  import Button from '../../_common/Button/Button';
4
4
  import classNames from 'classnames';
@@ -11,58 +11,69 @@ interface IAlternativeIDProps {
11
11
  error: boolean;
12
12
  successTransition: boolean;
13
13
  autoDeId?: string;
14
- onChange: (value: string) => void;
14
+ onChange: (value: any) => void;
15
15
  onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
16
16
  }
17
17
 
18
- const AlternativeID: React.FC<IAlternativeIDProps> = ({
19
- t,
20
- name,
21
- successTransition,
22
- autoDeId,
23
- onChange,
24
- error = false
25
- }) => {
26
- const [value, setValue] = useState<string>(autoDeId || '');
18
+ interface IAlternativeIDState {
19
+ value: string;
20
+ }
27
21
 
28
- const onFilterChange = (value: string) => {
29
- setValue(value);
22
+ class AlternativeID extends React.Component<IAlternativeIDProps, IAlternativeIDState> {
23
+ static defaultProps = {
24
+ error: false
30
25
  };
31
26
 
32
- const handleSearchClick = () => {
33
- onChange(value);
27
+ state = {
28
+ value: ''
34
29
  };
35
30
 
36
- const onKeyAlternativeRedirect = (event: React.KeyboardEvent<HTMLInputElement>) => {
31
+ componentDidMount() { this.setState({ value: this.props.autoDeId }); }
32
+
33
+ onFilterChange = (value: string) => {
34
+ this.setState({ value });
35
+ };
36
+
37
+ handleSearchClick = () => {
38
+ const { value } = this.state;
39
+
40
+ this.props.onChange(value);
41
+ }
42
+
43
+ onKeyAlternativeRedirect = (event: React.KeyboardEvent<HTMLInputElement>) => {
44
+ const { value } = this.state;
37
45
  if (event.key === 'Enter') {
38
- onChange(value);
46
+ this.props.onChange(value);
39
47
  }
40
- };
48
+ }
41
49
 
42
- const inputProps = {
43
- name,
44
- placeholder: 'z.B: FCEE67',
45
- value,
46
- onChange: onFilterChange,
47
- onKeyPress: (event: KeyboardEvent<HTMLInputElement>) => onKeyAlternativeRedirect(event)
48
- };
50
+ render(): JSX.Element {
51
+ const { t, name, error, successTransition } = this.props;
52
+ const inputProps = {
53
+ name,
54
+ placeholder: 'z.B: FCEE67',
55
+ value: this.state.value,
56
+ onChange: this.onFilterChange,
57
+ onKeyPress: (event: React.KeyboardEvent<HTMLInputElement>) => this.onKeyAlternativeRedirect(event)
58
+ };
49
59
 
50
- const buttonProps = {
51
- onClick: handleSearchClick,
52
- className: classNames(
53
- styles.button,
54
- { [styles.buttonWithError]: error },
55
- { [styles.buttonIsFetching]: successTransition }
56
- )
57
- };
60
+ const buttonProps = {
61
+ onClick: this.handleSearchClick,
62
+ className: classNames(
63
+ styles.button,
64
+ { [styles.buttonWithError]: error },
65
+ { [styles.buttonIsFetching]: successTransition }
66
+ )
67
+ };
58
68
 
59
- return (
60
- <div>
61
- <TextField {...inputProps} />
62
- {error && <span className={styles.errorText}>{t('filters.alternativeErrorText')}</span>}
63
- <Button {...buttonProps}>{t('filters.alternativeBtn')}</Button>
64
- </div>
65
- );
66
- };
69
+ return (
70
+ <div>
71
+ <TextField {...inputProps} />
72
+ {error && <span className={styles.errorText}>{t('filters.alternativeErrorText')}</span>}
73
+ <Button {...buttonProps}>{t('filters.alternativeBtn')}</Button>
74
+ </div>
75
+ );
76
+ }
77
+ }
67
78
 
68
- export default AlternativeID;
79
+ export default AlternativeID;
@@ -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';
@@ -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';
@@ -2,10 +2,10 @@ import React, { memo } from 'react';
2
2
  import Slider from '../../_common/Slider/Slider';
3
3
  import MaterialAutocomplete from '../../_common/MaterialAutocomplete/MaterialAutocomplete';
4
4
  import styles from './commonFilters.styl';
5
- import { isEqual, isNil } from 'lodash';
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 {
@@ -17,18 +17,12 @@ interface IPowerProps {
17
17
  onChangeControls?: (name: string, value: any) => void;
18
18
  t?: any;
19
19
  }
20
- interface ITypeState {
21
- type: string;
22
- }
23
20
 
24
- class Power extends React.Component<IPowerProps, ITypeState> {
21
+ class Power extends React.Component<IPowerProps, {}> {
25
22
  constructor(props: IPowerProps) {
26
23
  super(props);
27
24
 
28
25
  this.name = 'POWER';
29
- this.state = {
30
- type: props.controls.type
31
- };
32
26
  }
33
27
 
34
28
  private readonly name: string;
@@ -36,13 +30,10 @@ class Power extends React.Component<IPowerProps, ITypeState> {
36
30
 
37
31
  onDropDownChange = (name: string, value: any) => {
38
32
  const { controls, onChange, onChangeControls } = this.props;
39
- const { type } = this.state;
40
- const { from, to }: any = { ...controls, [name]: value };
33
+ const { from, to, type }: any = { ...controls, [name]: value };
41
34
  const controlsObj = { from, to, type };
42
35
  this.tempValues = { from, to };
43
- if ((controlsObj.from === '' && controlsObj.to === '') || (!controlsObj.to && !controlsObj.from)) {
44
- controlsObj.type = null;
45
- }
36
+
46
37
  onChangeControls(this.name, controlsObj);
47
38
  onChange(this.name, controlsObj);
48
39
  };
@@ -50,16 +41,9 @@ class Power extends React.Component<IPowerProps, ITypeState> {
50
41
  onTypeChange = (_event: React.SyntheticEvent, value: any) => {
51
42
  const { controls, onChange, onChangeControls } = this.props;
52
43
  const values = this.tempValues ? this.tempValues : controls;
53
- // this.type=value;
54
- this.setState(() => ({
55
- type: value
56
- }));
57
- if (!isNil(values.from) && !isNil(values.to)) {
58
- if (values.from !== '' || values.to !== '') {
59
- onChangeControls(this.name, { ...values, type: value });
60
- onChange(this.name, { ...values, type: value });
61
- }
62
- }
44
+
45
+ onChangeControls(this.name, { ...values, type: value });
46
+ onChange(this.name, { ...values, type: value });
63
47
  };
64
48
 
65
49
  getOptions = (options: any) => options.map((option: string) => ({
@@ -78,9 +62,7 @@ class Power extends React.Component<IPowerProps, ITypeState> {
78
62
  };
79
63
 
80
64
  renderSlider = () => {
81
- const { type } = this.state;
82
-
83
- const { values, options, onChange, onChangeControls } = this.props;
65
+ const { values, options, onChange, onChangeControls, controls: { type } } = this.props;
84
66
  const sliderProps = {
85
67
  options,
86
68
  name: this.name,
@@ -88,6 +70,7 @@ class Power extends React.Component<IPowerProps, ITypeState> {
88
70
  values: this.transformValues(values),
89
71
  onChange: (value: any, name: string) => {
90
72
  this.tempValues = value;
73
+
91
74
  onChange(name, { ...value, type });
92
75
  onChangeControls(this.name, { ...value, type });
93
76
  // onChangeControls(this.name, { ...RANGE_FILTERS_DEFAULT_CONTROLS, type });
@@ -98,8 +81,8 @@ class Power extends React.Component<IPowerProps, ITypeState> {
98
81
  };
99
82
 
100
83
  renderRadioGroup = () => {
101
- const { typeOptions } = this.props;
102
- const { type } = this.state;
84
+ const { typeOptions, controls } = this.props;
85
+ const { type } = controls;
103
86
  const radioGroupProps = {
104
87
  value: type,
105
88
  name: 'POWER_TYPE',
@@ -123,16 +106,15 @@ class Power extends React.Component<IPowerProps, ITypeState> {
123
106
 
124
107
  render(): JSX.Element {
125
108
  const { t, controls } = this.props;
126
- const { type } = this.state;
127
- const { from = 0, to = 0 } = controls;
109
+ const { from = 0, to = 0, type } = controls;
128
110
  const commonProps = {
129
111
  size: 'custom'
130
112
  };
131
113
 
132
114
  const fromProps = {
133
115
  ...commonProps,
134
- value: (from !== 0 ? `${from}` :0) || null,
135
- label: this.getLabel('filters.from', type),
116
+ value: from || null,
117
+ label: this.getLabel('filters.from', controls.type),
136
118
  type: 'number',
137
119
  onChange: (value: any) => this.onDropDownChange('from', value),
138
120
  items: this.getOptions(sliceLessThan(POWER_FIX, to))
@@ -140,9 +122,9 @@ class Power extends React.Component<IPowerProps, ITypeState> {
140
122
 
141
123
  const toProps = {
142
124
  ...commonProps,
143
- value: (to !== 0 ? `${to}` :0) || null,
125
+ value: to || null,
144
126
  type: 'number',
145
- label: this.getLabel('filters.to', type),
127
+ label: this.getLabel('filters.to', controls.type),
146
128
  onChange: (value: any) => this.onDropDownChange('to', value),
147
129
  items: this.getOptions(sliceMoreThan(POWER_FIX, from))
148
130
  };
@@ -168,7 +150,6 @@ class Power extends React.Component<IPowerProps, ITypeState> {
168
150
  export default memo(Power, (prevProps: any, nextProps: any) => {
169
151
  return prevProps.controls.from === nextProps.controls.from &&
170
152
  prevProps.controls.to === nextProps.controls.to &&
171
- prevProps.t === nextProps.t &&
172
153
  prevProps.controls.type === nextProps.controls.type &&
173
154
  prevProps.values.from === nextProps.values.from &&
174
155
  prevProps.values.to === nextProps.values.to &&
@@ -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;