-
Notifications
You must be signed in to change notification settings - Fork 842
/
Copy path_combo_box.scss
160 lines (132 loc) Β· 4.64 KB
/
_combo_box.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// TODO: Address nesting during Emotion conversion, if possible
// stylelint-disable max-nesting-depth
.euiComboBox {
@include euiFormControlSize(auto, $includeAlternates: true);
position: relative;
/**
* 1. Allow pills to truncate their text with an ellipsis.
* 2. Don't allow pills/placeholder to overlap with the caret, loading icon or clear button.
* 3. The height on combo can be larger than normal text inputs.
*/
&--compressed,
.euiFormControlLayout {
height: auto;
}
.euiComboBox__inputWrap {
@include euiFormControlStyle($includeStates: false, $includeSizes: true);
@include euiFormControlWithIcon($isIconOptional: true);
@include euiFormControlSize(auto, $includeAlternates: true);
padding: $euiSizeXS $euiSizeS;
display: flex; /* 1 */
outline: none; // Fixes an intermittent focus ring in Firefox
// to override the padding added above
@include euiFormControlLayoutPadding(1); /* 2 */
.euiComboBoxPill {
$inputMinWidth: $euiSize;
// Ensure the input doesn't drop to the next line when the EuiBadge has a very long text
// Overrides the default EuiBadge max-width that is 100%
max-width: calc(100% - #{$euiSizeXS * .5} - #{$inputMinWidth});
}
&:not(.euiComboBox__inputWrap--noWrap) {
padding-top: $euiSizeXS;
padding-bottom: $euiSizeXS;
padding-left: $euiSizeXS;
height: auto; /* 3 */
flex-wrap: wrap; /* 1 */
align-content: flex-start;
&:hover {
cursor: text;
}
}
&.euiComboBox__inputWrap-isClearable {
@include euiFormControlLayoutPadding(2); /* 2 */
}
&.euiComboBox__inputWrap-isLoading {
@include euiFormControlLayoutPadding(2); /* 2 */
.euiComboBoxPlaceholder {
@include euiFormControlLayoutPadding(2); /* 2 */
}
}
&.euiComboBox__inputWrap-isLoading.euiComboBox__inputWrap-isClearable {
@include euiFormControlLayoutPadding(3); /* 2 */
}
}
/**
* 1. Force field height to match other field heights.
* 2. Force input height to expand to fill this element.
* 3. Reset appearance on Safari.
* 4. Fix react-input-autosize appearance.
* 5. Prevent a lot of input from causing the react-input-autosize to overflow the container.
*/
.euiComboBox__input {
// stylelint-disable-next-line declaration-no-important
display: inline-flex !important; /* 1 */
height: $euiSizeXL; /* 2 */
overflow: hidden; /* 5 */
> input {
@include euiFont;
appearance: none; /* 3 */
padding: 0;
border: none;
background: transparent;
font-size: $euiFontSizeS;
color: $euiTextColor;
margin: $euiSizeXS;
line-height: $euiLineHeight; /* 4 */
}
}
&.euiComboBox-isOpen {
.euiComboBox__inputWrap {
@include euiFormControlFocusStyle;
&--compressed {
@include euiFormControlFocusStyle($borderOnly: true);
}
}
}
&.euiComboBox-isInvalid {
.euiComboBox__inputWrap {
@include euiFormControlInvalidStyle;
}
}
&.euiComboBox-isDisabled {
.euiComboBox__inputWrap {
// stylelint-disable property-no-vendor-prefix
@include euiFormControlDisabledStyle;
-webkit-text-fill-color: unset; // overrides $euiFormControlDisabledColor because the color doesn't work with multiple background colors
}
.euiComboBoxPlaceholder,
.euiComboBoxPill--plainText {
@include euiFormControlDisabledTextStyle;
}
// overrides the `cursor: text;` that displays on hover for combo boxes that allow multiple pills
.euiComboBox__inputWrap:not(.euiComboBox__inputWrap--noWrap):hover {
cursor: not-allowed;
}
}
&.euiComboBox--compressed {
.euiComboBox__inputWrap {
line-height: $euiFormControlCompressedHeight; /* 2 */
padding-top: 0;
padding-bottom: 0;
@include euiFormControlLayoutPadding(1, $compressed: true); /* 2 */
&.euiComboBox__inputWrap-isClearable {
@include euiFormControlLayoutPadding(2, $compressed: true); /* 2 */
}
&.euiComboBox__inputWrap-isLoading {
@include euiFormControlLayoutPadding(2, $compressed: true); /* 2 */
.euiComboBoxPlaceholder {
@include euiFormControlLayoutPadding(2, $compressed: true); /* 2 */
}
}
&.euiComboBox__inputWrap-isLoading.euiComboBox__inputWrap-isClearable {
@include euiFormControlLayoutPadding(3, $compressed: true); /* 2 */
}
}
}
// Overrides the euiFormControlLayout prepend and append height that is 100%
.euiFormControlLayout__prepend,
.euiFormControlLayout__append {
// stylelint-disable-next-line declaration-no-important
height: auto !important;
}
}