@bytebrand/fe-ui-core 4.2.155 → 4.2.157

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.2.155",
3
+ "version": "4.2.157",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React, { useState, KeyboardEvent } 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,69 +11,58 @@ interface IAlternativeIDProps {
11
11
  error: boolean;
12
12
  successTransition: boolean;
13
13
  autoDeId?: string;
14
- onChange: (value: any) => void;
14
+ onChange: (value: string) => void;
15
15
  onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
16
16
  }
17
17
 
18
- interface IAlternativeIDState {
19
- value: string;
20
- }
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 || '');
21
27
 
22
- class AlternativeID extends React.Component<IAlternativeIDProps, IAlternativeIDState> {
23
- static defaultProps = {
24
- error: false
28
+ const onFilterChange = (value: string) => {
29
+ setValue(value);
25
30
  };
26
31
 
27
- state = {
28
- value: ''
32
+ const handleSearchClick = () => {
33
+ onChange(value);
29
34
  };
30
35
 
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;
36
+ const onKeyAlternativeRedirect = (event: React.KeyboardEvent<HTMLInputElement>) => {
45
37
  if (event.key === 'Enter') {
46
- this.props.onChange(value);
38
+ onChange(value);
47
39
  }
48
- }
40
+ };
49
41
 
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
- };
42
+ const inputProps = {
43
+ name,
44
+ placeholder: 'z.B: FCEE67',
45
+ value,
46
+ onChange: onFilterChange,
47
+ onKeyPress: (event: KeyboardEvent<HTMLInputElement>) => onKeyAlternativeRedirect(event)
48
+ };
59
49
 
60
- const buttonProps = {
61
- onClick: this.handleSearchClick,
62
- className: classNames(
63
- styles.button,
64
- { [styles.buttonWithError]: error },
65
- { [styles.buttonIsFetching]: successTransition }
66
- )
67
- };
50
+ const buttonProps = {
51
+ onClick: handleSearchClick,
52
+ className: classNames(
53
+ styles.button,
54
+ { [styles.buttonWithError]: error },
55
+ { [styles.buttonIsFetching]: successTransition }
56
+ )
57
+ };
68
58
 
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
- }
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
+ };
78
67
 
79
- export default AlternativeID;
68
+ export default AlternativeID;
@@ -167,7 +167,7 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
167
167
  { [styles.vehicleWrapRecently]: vehicleComponentName === 'recently' },
168
168
  { [styles.topVehicle]: isTop },
169
169
  { [styles.disableBorder]: minimizeData },
170
- { [styles.isFirstReferenceCar]: isReferenceSearch && index === 0 && currentPage === 1 },
170
+ { [styles.isFirstReferenceCar]: isReferenceSearch && index === 0 },
171
171
  className
172
172
  );
173
173
 
@@ -69,7 +69,7 @@ const Range: React.FC<IRangeProps> = ({
69
69
  <ThemeProvider theme={Theme}>
70
70
  <Slider
71
71
  min={min}
72
- max={max}
72
+ max={withRangeLimit ? maxFinancingFirstInstallment : max}
73
73
  step={step}
74
74
  disableSwap={isMobileOnly ? true : false}
75
75
  valueLabelDisplay='auto'