1
1
import { css } from '@emotion/core' ;
2
2
import vars from '../../../../materials/custom-properties' ;
3
+ import designTokens from '../../../../materials/design-tokens' ;
3
4
import { getInputStyles } from '../styles' ;
4
5
5
6
// NOTE: order is important here
6
7
// * a disabled-field currently does not display warning/error-states so it takes precedence
7
8
// * a readonly-field cannot be changed, but it might be relevant for validation, so error and warning are checked first
8
9
// how you can interact with the field is controlled separately by the props, this only influences visuals
9
- const getLocalizedInputStyles = props => [
10
- getInputStyles ( props ) ,
10
+ const getLocalizedInputStyles = ( props , theme ) => [
11
+ getInputStyles ( props , theme ) ,
11
12
css `
12
13
border-top-left-radius : 0 ;
13
14
border-bottom-left-radius : 0 ;
@@ -16,22 +17,36 @@ const getLocalizedInputStyles = props => [
16
17
` ,
17
18
] ;
18
19
19
- const getLanguageLabelStyles = ( ) => css `
20
- /* avoid wrapping label onto new lines */
21
- flex : 1 0 auto;
22
- box-sizing : border-box;
23
- color : ${ vars . fontColorDisabled } ;
24
- height : ${ vars . sizeHeightInput } ;
25
- line-height : ${ vars . sizeHeightInput } ;
26
- background-color : ${ vars . backgroundColorInputDisabled } ;
27
- border-top-left-radius : ${ vars . borderRadiusInput } ;
28
- border-bottom-left-radius : ${ vars . borderRadiusInput } ;
29
- border : 1px ${ vars . borderColorInputDisabled } solid;
30
- padding : 0 ${ vars . spacing8 } ;
31
- transition : ${ vars . transitionStandard } ;
32
- border-right : 0 ;
33
- box-shadow : none;
34
- appearance : none;
35
- ` ;
20
+ const getLanguageLabelStyles = ( props , theme ) => {
21
+ const overwrittenVars = {
22
+ ...vars ,
23
+ ...theme ,
24
+ } ;
25
+
26
+ return css `
27
+ /* avoid wrapping label onto new lines */
28
+ flex : 1 0 auto;
29
+ box-sizing : border-box;
30
+ color : ${ overwrittenVars [ designTokens . fontColorForInputWhenDisabled ] } ;
31
+ height : ${ vars . sizeHeightInput } ;
32
+ line-height : ${ vars . sizeHeightInput } ;
33
+ background-color : ${ overwrittenVars [
34
+ designTokens . backgroundColorForInputWhenDisabled
35
+ ] } ;
36
+ border-top-left-radius : ${ overwrittenVars [
37
+ designTokens . borderRadiusForInput
38
+ ] } ;
39
+ border-bottom-left-radius : ${ overwrittenVars [
40
+ designTokens . borderRadiusForInput
41
+ ] } ;
42
+ border : 1px ${ overwrittenVars [ designTokens . borderColorForInputWhenDisabled ] }
43
+ solid;
44
+ padding : 0 ${ vars . spacing8 } ;
45
+ transition : ${ vars . transitionStandard } ;
46
+ border-right : 0 ;
47
+ box-shadow : none;
48
+ appearance : none;
49
+ ` ;
50
+ } ;
36
51
37
52
export { getLocalizedInputStyles , getLanguageLabelStyles } ;
0 commit comments