UNPKG

4.66 kBSCSSView Raw
1@use './variables.scss' as *;
2@use './mixins.scss';
3/* for debugging */
4// *:focus {
5// outline: 1px red solid !important;
6// }
7
8@keyframes react-widgets-autofill-start {
9 from {
10 /**/
11 }
12 to {
13 /**/
14 }
15}
16
17@keyframes react-widgets-autofill-cancel {
18 from {
19 /**/
20 }
21 to {
22 /**/
23 }
24}
25
26.rw-btn {
27 @include mixins.btn-input-reset;
28
29 display: inline-flex;
30 align-items: center;
31 justify-content: center;
32 background-clip: $widget-background-clip;
33 cursor: pointer;
34
35 &:focus {
36 outline: none;
37 }
38
39 &:disabled,
40 fieldset[disabled] &,
41 // for picker-caret
42 .rw-state-disabled &,
43 .rw-state-readonly & {
44 cursor: inherit;
45 }
46 // easier to disable this way then check in each event handler
47 fieldset[disabled] & {
48 pointer-events: none;
49 }
50}
51
52// The Psuedo button on DropdownList and Multiselect
53// also composes rw-btn
54.rw-picker-caret,
55.rw-picker-btn {
56 color: $picker-btn-color;
57 align-items: $picker-btn-align-items;
58 justify-content: $picker-btn-justify-content;
59 padding-left: $picker-btn-padding-left;
60 padding-right: $picker-btn-padding-right;
61}
62
63.rw-picker-btn {
64 background-color: $picker-btn-bg;
65 // border color doesn't make sense here
66 // since it's surrounded by the input border
67
68 &:hover {
69 color: $picker-btn-hover-color;
70 background-color: $picker-btn-hover-bg;
71 }
72 &:active {
73 color: $picker-btn-active-color;
74 background-color: $picker-btn-active-bg;
75 }
76
77 &:disabled,
78 fieldset[disabled] & {
79 background-color: $picker-btn-disabled-bg;
80 }
81}
82
83.rw-input-addon {
84 // The input border should be more important here
85 &,
86 &.rw-picker-btn {
87 border-left: $input-addon-border-color 1px solid;
88
89 [dir='rtl'] & {
90 border-right: $input-addon-border-color 1px solid;
91 border-left: none;
92 }
93 }
94}
95
96.rw-sr {
97 position: absolute;
98 width: 1px;
99 height: 1px;
100 margin: -1px;
101 padding: 0;
102 overflow: hidden;
103 clip: rect(0, 0, 0, 0);
104 border: 0;
105}
106
107.rw-widget {
108 border: none;
109 color: $widget-color;
110 font-weight: $widget-font-weight;
111 font-size: $widget-font-size;
112 font-family: $widget-font-family;
113 outline: none;
114 position: relative;
115
116 &,
117 & *,
118 &:after,
119 &:before,
120 & *:after,
121 & *:before {
122 box-sizing: border-box;
123 }
124}
125
126.rw-state-readonly,
127.rw-state-disabled,
128fieldset[disabled] .rw-widget {
129 cursor: not-allowed;
130}
131
132.rw-widget-picker {
133 display: grid;
134 overflow: hidden;
135 min-height: $input-height;
136 background-color: $input-bg;
137 border: $input-border-color $input-border-width solid;
138 border-radius: $input-border-radius;
139 outline: none;
140 grid-template: 1fr / 1fr $input-addon-width;
141 // ensure that the "chrome" is the same width as the actual container
142 width: 100%;
143
144 &.rw-hide-caret {
145 grid-template-columns: 1fr;
146 }
147
148 .rw-state-focus & {
149 color: $input-focus-color;
150 background-color: $input-focus-bg;
151 border-color: $input-focus-border-color;
152 box-shadow: $widget-focus-box-shadow;
153 transition: if($widget-focus-box-shadow, $widget-focus-transition, null);
154
155 &.rw-widget-input {
156 @if ($input-box-shadow) {
157 box-shadow: #{$widget-focus-box-shadow}, #{$input-box-shadow};
158 }
159 }
160 }
161}
162
163.rw-input {
164 @include mixins.btn-input-reset;
165 @include mixins.input-base;
166
167 padding: 0 $input-padding-x;
168
169 &[type='text']::-ms-clear {
170 display: none;
171 }
172
173 &:disabled,
174 &:read-only {
175 // use parent style
176 cursor: inherit;
177 }
178}
179
180// This class represents the abstract container that is the "input" of any
181// given widget
182.rw-widget-input {
183 color: $input-color;
184 background-color: $input-bg;
185 box-shadow: $input-box-shadow;
186 background-clip: $widget-background-clip;
187
188 // Listbox is also the rw-widget
189 &.rw-state-disabled,
190 .rw-state-disabled &,
191 fieldset[disabled] & {
192 color: $input-disabled-color;
193 background-color: $input-disabled-bg;
194 border-color: $input-disabled-border-color;
195 }
196}
197
198.rw-placeholder,
199.rw-input::placeholder {
200 color: $input-placeholder-color;
201
202 .rw-state-disabled & {
203 color: $input-disabled-placeholder-color;
204 }
205}
206
207// https://github.com/klarna/ui/blob/master/Field/styles.scss
208.rw-detect-autofill {
209 @include mixins.btn-input-reset;
210 @include mixins.input-base;
211}
212
213.rw-detect-autofill:-webkit-autofill {
214 animation-name: react-widgets-autofill-start;
215 animation-duration: 0.01ms;
216}
217
218.rw-detect-autofill:not(:-webkit-autofill) {
219 animation-name: react-widgets-autofill-cancel;
220 animation-duration: 0.01ms;
221}
222
223.rw-webkit-autofill .rw-widget-container,
224.rw-input:-webkit-autofill {
225 background-color: $input-autofill-bg !important;
226 background-image: none !important;
227 color: $input-autofill-color !important;
228}