@bytebrand/fe-ui-core 4.1.217 → 4.1.219

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.217",
3
+ "version": "4.1.219",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -3,7 +3,6 @@ import { storiesOf } from '@storybook/react';
3
3
  import { action } from '@storybook/addon-actions';
4
4
 
5
5
  import Switcher from './Switcher';
6
- import RadioGroup from '../../_common/Radio/RadioGroup';
7
6
 
8
7
  import styles from './Switcher.story.styl';
9
8
  export class SwitcherGroup extends React.Component {
@@ -17,28 +16,19 @@ export class SwitcherGroup extends React.Component {
17
16
  this.setState(() => ({ value }));
18
17
  };
19
18
 
20
- renderCheckout = (index) => {
21
- const financing = ['1 Jahr', '2 Jahre'];
22
-
23
- return (
24
- <div className={styles.equipment}>
25
- <div className={styles.column}>
26
- <span className={styles.titleCheckout}>
27
- {financing[index]}
28
- </span>
29
- </div>
30
- </div>
31
- );
32
- };
19
+ onChange = (e, value, name) => {
20
+ this.setState({ value: value });
21
+ }
33
22
 
34
23
  render() {
24
+ const warrantyPeriodOptions = ['1 Jahr', '2 Jahre'];
35
25
  return (
36
- <>
37
- <RadioGroup name='months' containerClassName={styles.containerClassName} childClassName={styles.verticalChild} value={this.state.value} onChange={this.onChange}>
38
- <Switcher label={this.renderCheckout(0)} value={0} borderLeftRadius={true}/>
39
- <Switcher label={this.renderCheckout(1)} value={1} borderRightRadius={true}/>
40
- </RadioGroup>
41
- </>
26
+ <Switcher
27
+ options={warrantyPeriodOptions}
28
+ value={this.state.value}
29
+ onChange={this.onChange}
30
+ name={'warrantyPeriod'}
31
+ />
42
32
  );
43
33
  }
44
34
  }
@@ -0,0 +1,53 @@
1
+ import { createTheme } from '@mui/material/styles';
2
+
3
+ export const theme = createTheme({
4
+ components: {
5
+ MuiToggleButtonGroup: {
6
+ styleOverrides: {
7
+ root: {
8
+ display: 'grid',
9
+ gridTemplateColumns: '1fr 1fr'
10
+ }
11
+ }
12
+ },
13
+ MuiToggleButton: {
14
+ styleOverrides: {
15
+ root: {
16
+ fontSize: 12,
17
+ padding: 0,
18
+ color: 'rgba(0,0,0,0.6)',
19
+ background: '#fff',
20
+ minHeight: 40,
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ justifyContent: 'center',
24
+ boxSizing: 'border-box',
25
+ minWidth: 50,
26
+ border: '2px solid rgba(0,0,0,0.3)',
27
+ textTransform: 'none',
28
+ '&:hover': {
29
+ color: '#333333',
30
+ background: '#fff'
31
+ },
32
+ '&.Mui-selected': {
33
+ backgroundColor: '#005ccb',
34
+ color: '#fff',
35
+ border: 'none'
36
+ },
37
+ '&.Mui-selected:hover': {
38
+ backgroundColor: '#005ccb',
39
+ color: '#fff'
40
+ },
41
+ '&.MuiToggleButtonGroup-grouped:first-of-type': {
42
+ borderTopLeftRadius: '6px',
43
+ borderBottomLeftRadius: '6px'
44
+ },
45
+ '&.MuiToggleButtonGroup-grouped:last-of-type': {
46
+ borderTopRightRadius: '6px',
47
+ borderBottomRightRadius: '6px'
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ });
@@ -1,103 +1,48 @@
1
1
  import * as React from 'react';
2
- import styles from './Switcher.styl';
3
- import classnames from 'classnames';
2
+ import _get from 'lodash/get';
3
+ import ToggleButton from '@mui/material/ToggleButton';
4
+ import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
5
+ import { ThemeProvider } from '@mui/material/styles';
6
+ import { theme } from './Switcher.styled';
4
7
 
5
8
  type SwitcherProps = {
6
- // Native radio button props
7
9
  name?: string;
8
10
  value: any;
9
- checked?: boolean;
11
+ options: any[];
10
12
 
11
- onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean, value: any) => void;
12
- onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
13
- onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void;
13
+ onChange?: (event: React.SyntheticEvent, value: number, name: any) => void;
14
14
 
15
- // Custom radio button props
16
- labelClassName?: string;
17
- error?: boolean;
18
- label?: JSX.Element | string | null;
19
- disabled?: boolean;
20
15
  borderLeftRadius?: boolean;
21
16
  borderRightRadius?: boolean;
22
17
  };
23
18
 
24
19
  const Switcher = ({
25
20
  name,
26
- value,
27
- checked,
28
- labelClassName,
29
- error,
30
- label,
31
- disabled,
32
- borderLeftRadius,
33
- borderRightRadius,
34
21
  onChange,
35
- onBlur,
36
- onFocus
22
+ options,
23
+ value
37
24
  }: SwitcherProps) => {
38
- let input: HTMLInputElement = null;
39
- const setInputRef = (ref: HTMLInputElement) => {
40
- input = ref;
41
- };
42
- const onChangeRadio = (event: React.ChangeEvent<HTMLInputElement>) => {
43
- const { checked } = event.target;
44
-
45
- if (disabled) {
46
- return false;
47
- }
48
-
49
- event.stopPropagation();
50
- event.nativeEvent.stopImmediatePropagation();
51
-
52
- onChange(event, checked, value);
53
- };
54
- const onKeyPress = (event: any) => {
55
- const checked = input.checked;
56
- const value = input.value;
57
25
 
58
- if (disabled) {
59
- return false;
60
- }
61
-
62
- onChange(event, checked, value);
26
+ const onChangeSwitch = (event: React.SyntheticEvent, value: number) => {
27
+ onChange(event, +event.target.value, name);
28
+ console.log('qqqq value ====', +event.target.value);
63
29
  };
64
- const containerClasses = classnames(
65
- styles.container,
66
- { [styles.disabled]: disabled },
67
- { [styles.checked]: checked },
68
- { [styles.error]: error },
69
- { [styles.borderLeft]: borderLeftRadius },
70
- { [styles.borderRight]: borderRightRadius }
71
-
72
- );
73
-
74
- const labelClasses = classnames(
75
- styles.label,
76
- labelClassName,
77
- { [styles.checkedCheckout]: checked }
78
- );
79
30
 
80
31
  return (
81
- <div className={containerClasses} tabIndex={1} onFocus={onFocus} onBlur={onBlur} onKeyPress={onKeyPress}>
82
- <label className={labelClasses}>
83
- {/* Visual representation of the radio button */}
84
- <div className={styles.radioLabelWrapper}>
85
- <span className={styles.labelContent}>{label}</span>
86
- {/* Hidden radio input for SEO and HTML semantics */}
87
- <input
88
- className={styles.input}
89
- type='radio'
90
- name={name}
91
- checked={checked}
92
- value={value}
93
- disabled={disabled}
94
- tabIndex={-1}
95
- onChange={onChangeRadio}
96
- ref={setInputRef}
97
- />
98
- </div>
99
- </label>
100
- </div>
32
+ <ThemeProvider theme={theme}>
33
+ <ToggleButtonGroup
34
+ color='primary'
35
+ value={value}
36
+ exclusive
37
+ onChange={onChangeSwitch}
38
+ >
39
+ {options.map((option, index) => {
40
+ return (
41
+ <ToggleButton key={option} value={index}>{option}</ToggleButton>
42
+ );
43
+ })}
44
+ </ToggleButtonGroup>
45
+ </ThemeProvider>
101
46
  );
102
47
  };
103
48
 
@@ -53,10 +53,6 @@
53
53
  .priceItemBuy
54
54
  border-top: 1px solid rgba(76, 78, 100, 0.12);
55
55
 
56
- .priceItemPrice
57
- +media-tablet-landscape-up()
58
- transform: translateX(-6px);
59
-
60
56
  .priceItemCategory
61
57
  font-size: 12px
62
58
  color: rgba(76, 78, 100, 0.87);
@@ -100,6 +96,7 @@
100
96
  justify-content: center;
101
97
  align-items: flex-end;
102
98
  color: inherit;
99
+ padding-right: 5px;
103
100
 
104
101
  .oldPriceWrap
105
102
  display: flex;
@@ -1,7 +1,7 @@
1
1
  import { styled } from '@mui/system';
2
2
  import IconSVG from '../IconSVG/IconSVG';
3
3
 
4
- export const IconSvgWrapper = styled(IconSVG)((props) => ({
4
+ export const IconSvgWrapper = styled(IconSVG)(props => ({
5
5
  fill: props.disabled ? '#4C4E6442' : '#4C4E648A',
6
6
  width: '12px',
7
7
  height: '12px'
@@ -44,7 +44,7 @@ const MaterialTooltip = ({ text, placement, className, disabled }: IMaterialTool
44
44
  title={text}
45
45
  className={className}
46
46
  >
47
- <IconButton onTouchEnd={(e) => onHandleClick(e)}>
47
+ <IconButton onTouchEnd={e => onHandleClick(e)}>
48
48
  <IconSvgWrapper name={'infoIcon'} customDimensions disabled={disabled} />
49
49
  </IconButton>
50
50
  </LightTooltip>
@@ -119,6 +119,13 @@ const BreadcrumbsFactory: IBreadcrumbsFactoryConfig = {
119
119
  withBackBtn: true
120
120
  }),
121
121
 
122
+ VEHICLE_NOT_DETAILS: () => ({
123
+ list: [],
124
+ classBreadcrumbsAny: 'VEHICLE_DETAILS',
125
+ className: 'breadcrumbsCDP',
126
+ withBackBtn: true
127
+ }),
128
+
122
129
  ALTERNATIVE_VEHICLE_DETAILS: (props: any) => ({
123
130
  list: [
124
131
  {
@@ -1,93 +0,0 @@
1
- @import '../../../theme/theme.styl'
2
-
3
- .container
4
- border: 2px solid rgba(0, 0, 0, 0.3)
5
- padding: 2px
6
- color: $grey-3
7
- background: $white
8
- max-height: 40px
9
- display: flex
10
- align-items: center
11
- justify-content: center
12
- box-sizing: border-box
13
- min-width: 50px
14
-
15
- .container.checked
16
- border: 2px solid $skyBlue
17
- box-sizing: border-box
18
- outline: none
19
- background: $skyBlue
20
- .labelContent
21
- color: $white
22
-
23
- .borderLeft
24
- border-top-left-radius: 6px
25
- border-bottom-left-radius: 6px
26
-
27
- .borderRight
28
- border-top-right-radius: 6px
29
- border-bottom-right-radius: 6px
30
-
31
-
32
-
33
- .labelContent
34
- color: $black60
35
- font-size: $font-size-default
36
- line-height: 28px
37
- flex: 1
38
-
39
- .container.disabled
40
- border: 2px solid rgba(0, 0, 0, 0.06)
41
- color: $secondary15
42
-
43
- .labelContent
44
- color: $secondary15
45
-
46
- .infoContent
47
- color: $secondary15
48
-
49
- .radio, .label
50
- cursor: not-allowed
51
-
52
- .payTypeIcon
53
- color: $secondary15
54
-
55
- circle
56
- stroke: $secondary15
57
- path
58
- fill: $secondary15
59
- .radio
60
- border-color: $primary40
61
- .label
62
- color: $secondary15
63
-
64
- .label
65
- position: relative
66
- font-family: $font-style-arial
67
- font-weight: $font-weight-medium
68
- font-style: normal
69
- font-size: $font-size-h6
70
- cursor: pointer
71
- padding: 0 !important
72
-
73
-
74
- /* styles for the hidden input */
75
- .input
76
- position: absolute
77
- left: 0
78
- right: 0
79
- display: inline-block
80
- width: 0
81
- height: 0
82
- visibility: hidden
83
- opacity: 0
84
- margin: 0
85
- padding: 0
86
-
87
-
88
- .radioLabelWrapper
89
- display: flex
90
- justify-content: space-between
91
- align-items: center
92
-
93
-