@bytebrand/fe-ui-core 4.1.218 → 4.1.220
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 +1 -1
- package/source/components/Checkout/Switcher/Switcher.story.js +10 -20
- package/source/components/Checkout/Switcher/Switcher.styled.tsx +53 -0
- package/source/components/Checkout/Switcher/Switcher.tsx +25 -81
- package/source/components/_common/MaterialTooltip/MaterialTooltip.styled.tsx +1 -1
- package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +1 -1
- package/source/components/Checkout/Switcher/Switcher.styl +0 -93
package/package.json
CHANGED
|
@@ -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
|
-
|
|
21
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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,47 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
-
|
|
11
|
+
options: any[];
|
|
10
12
|
|
|
11
|
-
onChange?: (
|
|
12
|
-
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
13
|
-
onFocus?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
13
|
+
onChange?: (e: React.SyntheticEvent, value: number, key: string) => 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
|
-
|
|
36
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
onChange(event, checked, value);
|
|
26
|
+
const onChangeSwitch = (event: React.SyntheticEvent) => {
|
|
27
|
+
onChange(event, +event.target.value, name);
|
|
63
28
|
};
|
|
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
29
|
|
|
80
30
|
return (
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
onChange={onChangeRadio}
|
|
96
|
-
ref={setInputRef}
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
</label>
|
|
100
|
-
</div>
|
|
31
|
+
<ThemeProvider theme={theme}>
|
|
32
|
+
<ToggleButtonGroup
|
|
33
|
+
color='primary'
|
|
34
|
+
value={value}
|
|
35
|
+
exclusive
|
|
36
|
+
onChange={onChangeSwitch}
|
|
37
|
+
>
|
|
38
|
+
{options && options.map((option, index) => {
|
|
39
|
+
return (
|
|
40
|
+
<ToggleButton key={option} value={index + 1}>{option}</ToggleButton>
|
|
41
|
+
);
|
|
42
|
+
})}
|
|
43
|
+
</ToggleButtonGroup>
|
|
44
|
+
</ThemeProvider>
|
|
101
45
|
);
|
|
102
46
|
};
|
|
103
47
|
|
|
@@ -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)(
|
|
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={
|
|
47
|
+
<IconButton onTouchEnd={e => onHandleClick(e)}>
|
|
48
48
|
<IconSvgWrapper name={'infoIcon'} customDimensions disabled={disabled} />
|
|
49
49
|
</IconButton>
|
|
50
50
|
</LightTooltip>
|
|
@@ -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
|
-
|