|
1 | 1 | @use 'sass:map'; |
| 2 | +@use 'sass:string'; |
2 | 3 | @use '../../base' as *; |
3 | 4 | @use 'igniteui-theming/sass/animations/easings' as *; |
4 | 5 |
|
|
11 | 12 | // The --variant CSS produced by css-vars is needed also |
12 | 13 | // when dynamically switching between the input `type` attribute. |
13 | 14 | $variant: map.get($theme, '_meta', 'theme'); |
| 15 | + $mode: map.get($theme, '_meta', 'variant'); |
14 | 16 | $transition-timing: .25s $out-cubic; |
15 | 17 | $material-theme: $variant == 'material'; |
16 | 18 | $indigo-theme: $variant == 'indigo'; |
|
112 | 114 |
|
113 | 115 | @if $variant == 'material' { |
114 | 116 | %form-group-display--border { |
115 | | - &:has(input:-webkit-autofill, input:autofill) { |
| 117 | + &:has( |
| 118 | + input:-webkit-autofill, |
| 119 | + input:autofill, |
| 120 | + input[type='date'], |
| 121 | + input[type='time'], |
| 122 | + input[type='datetime-local'], |
| 123 | + input[type='month'], |
| 124 | + input[type='week'] |
| 125 | + ) { |
116 | 126 | %igx-input-group__notch--border { |
117 | 127 | border-block-start-color: transparent; |
118 | 128 | } |
|
137 | 147 |
|
138 | 148 | %form-group-display { |
139 | 149 | @include sizable(); |
| 150 | + |
140 | 151 | --component-size: var(--ig-size, #{var-get($theme, 'default-size')}); |
141 | 152 | --input-size: var(--component-size); |
142 | 153 | --input-icon: #{sizable(rem(14px), rem(16px), rem(16px))}; |
143 | 154 |
|
144 | 155 | position: relative; |
145 | 156 | display: block; |
| 157 | + color-scheme: string.unquote($mode); |
146 | 158 | color: var-get($theme, 'idle-text-color'); |
147 | 159 |
|
148 | 160 | igx-prefix, |
|
193 | 205 |
|
194 | 206 | input[type='number'] { |
195 | 207 | -moz-appearance: textfield; |
| 208 | + appearance: textfield; |
196 | 209 | } |
197 | 210 |
|
198 | 211 | // Don't show the number spinner |
|
218 | 231 |
|
219 | 232 | @if $variant == 'material' { |
220 | 233 | &:not(%form-group-display--border) { |
221 | | - &:has(input:-webkit-autofill, input:autofill) { |
| 234 | + &:has( |
| 235 | + input:-webkit-autofill, |
| 236 | + input:autofill, |
| 237 | + input[type='date'], |
| 238 | + input[type='time'], |
| 239 | + input[type='datetime-local'], |
| 240 | + input[type='month'], |
| 241 | + input[type='week'] |
| 242 | + ) { |
222 | 243 | %form-group-label { |
223 | 244 | --floating-label-position: -73%; |
224 | 245 |
|
|
230 | 251 | } |
231 | 252 |
|
232 | 253 | &:not(%form-group-display--focused, %form-group-display--filled) { |
233 | | - &:has(input:not(:placeholder-shown, [type='file'])) { |
| 254 | + &:has(input:not( |
| 255 | + :placeholder-shown, |
| 256 | + [type='file'], |
| 257 | + [type='date'], |
| 258 | + [type='time'], |
| 259 | + [type='datetime-local'], |
| 260 | + [type='month'], |
| 261 | + [type='week'] |
| 262 | + )) { |
234 | 263 | %form-group-label { |
235 | 264 | @include type-style('subtitle-1'); |
236 | 265 | transform: translateY(0); |
237 | 266 | } |
238 | 267 | } |
| 268 | + |
| 269 | + &:has( |
| 270 | + input[type='date'], |
| 271 | + input[type='time'], |
| 272 | + input[type='datetime-local'], |
| 273 | + input[type='month'], |
| 274 | + input[type='week'] |
| 275 | + ) { |
| 276 | + %form-group-label { |
| 277 | + @include type-style('caption'); |
| 278 | + } |
| 279 | + |
| 280 | + %igx-input-group__notch { |
| 281 | + border-block-start-color: transparent !important; |
| 282 | + } |
| 283 | + } |
239 | 284 | } |
240 | 285 | } |
241 | 286 | } |
|
272 | 317 | color: var-get($theme, 'input-suffix-color--filled'); |
273 | 318 | background: var-get($theme, 'input-suffix-background--filled'); |
274 | 319 | } |
| 320 | + |
| 321 | + &:not(%form-group-display--readonly, %form-group-display--disabled) { |
| 322 | + &:hover { |
| 323 | + %form-group-input { |
| 324 | + color: var-get($theme, 'filled-text-hover-color'); |
| 325 | + } |
| 326 | + } |
| 327 | + |
| 328 | + &%form-group-display--focused { |
| 329 | + %form-group-input { |
| 330 | + color: var-get($theme, 'focused-text-color'); |
| 331 | + } |
| 332 | + } |
| 333 | + } |
275 | 334 | } |
276 | 335 |
|
277 | 336 | %form-group-display--focused { |
278 | 337 | color: var-get($theme, 'input-prefix-color--focused'); |
279 | 338 |
|
| 339 | + &:not(%form-group-display--filled) { |
| 340 | + %form-group-input { |
| 341 | + color: var-get($theme, 'idle-text-color'); |
| 342 | + } |
| 343 | + } |
| 344 | + |
280 | 345 | igx-prefix, |
281 | 346 | [igxPrefix] { |
282 | 347 | color: var-get($theme, 'input-prefix-color--focused'); |
|
364 | 429 | &:hover { |
365 | 430 | %form-group-input--hover { |
366 | 431 | cursor: default; |
367 | | - color: var-get($theme, 'filled-text-color'); |
368 | 432 |
|
369 | | - &:not(:focus-within) { |
370 | | - &::placeholder { |
371 | | - color: var-get($theme, 'placeholder-color'); |
372 | | - } |
| 433 | + &:not(:focus-within)::placeholder { |
| 434 | + color: var-get($theme, 'placeholder-color'); |
373 | 435 | } |
374 | 436 | } |
375 | 437 | } |
|
389 | 451 | [igxSuffix] { |
390 | 452 | @extend %form-group-suffix--disabled; |
391 | 453 | } |
| 454 | + |
| 455 | + input::-webkit-datetime-edit { |
| 456 | + color: var-get($theme, 'disabled-text-color'); |
| 457 | + } |
392 | 458 | } |
393 | 459 |
|
394 | 460 | %form-group-box-wrapper { |
|
1334 | 1400 |
|
1335 | 1401 | %form-group-input { |
1336 | 1402 | position: relative; |
1337 | | - display: block; |
1338 | 1403 | border: none; |
1339 | 1404 | padding-block-start: $input-top-padding; |
1340 | 1405 | padding-block-end: $input-bottom-padding; |
|
1343 | 1408 | width: 100%; |
1344 | 1409 | min-width: 0; |
1345 | 1410 | background: transparent; |
1346 | | - color: var-get($theme, 'filled-text-color'); |
| 1411 | + color: inherit; |
1347 | 1412 | outline-style: none; |
1348 | 1413 | box-shadow: none; |
1349 | 1414 | overflow: hidden; |
1350 | 1415 | text-overflow: ellipsis; |
1351 | | - |
1352 | | - &:not(%form-group-textarea, [type='date']) { |
| 1416 | + appearance: none; |
| 1417 | + |
| 1418 | + &:not( |
| 1419 | + %form-group-textarea, |
| 1420 | + [type='date'], |
| 1421 | + [type='time'], |
| 1422 | + [type='datetime-local'], |
| 1423 | + [type='month'], |
| 1424 | + [type='week'] |
| 1425 | + ) { |
1353 | 1426 | line-height: 0 !important; /* Reset typography */ |
1354 | 1427 | } |
1355 | 1428 |
|
|
1363 | 1436 | line-height: normal; /* Fix placeholder position in Safari */ |
1364 | 1437 | } |
1365 | 1438 |
|
| 1439 | + &::-webkit-datetime-edit-fields-wrapper { |
| 1440 | + width: 100%; |
| 1441 | + padding: 0; |
| 1442 | + } |
| 1443 | + |
| 1444 | + &::-webkit-datetime-edit { |
| 1445 | + color: inherit; |
| 1446 | + line-height: normal; |
| 1447 | + } |
| 1448 | + |
1366 | 1449 | @if $variant == 'indigo' { |
1367 | 1450 | height: calc(var-get($theme, 'size') - 1px); |
1368 | 1451 |
|
|
1427 | 1510 | } |
1428 | 1511 |
|
1429 | 1512 | %form-group-input--hover { |
1430 | | - color: var-get($theme, 'filled-text-hover-color'); |
1431 | | - |
1432 | 1513 | &::placeholder { |
1433 | 1514 | color: var-get($theme, 'hover-placeholder-color'); |
1434 | 1515 | } |
1435 | 1516 | } |
1436 | 1517 |
|
1437 | 1518 | %form-group-input--focus { |
1438 | | - color: var-get($theme, 'focused-text-color'); |
1439 | | - |
1440 | 1519 | &::placeholder { |
1441 | 1520 | color: var-get($theme, 'hover-placeholder-color'); |
1442 | 1521 | } |
|
2299 | 2378 |
|
2300 | 2379 | // The :not selector is needed otherwise bootstrap will override the %autofill-background-fix |
2301 | 2380 | %form-group-display--bootstrap { |
2302 | | - :not(:has(input:-webkit-autofill, input:autofill)) { |
| 2381 | + :not(:has( |
| 2382 | + input:-webkit-autofill, |
| 2383 | + input:autofill, |
| 2384 | + input[type='date'], |
| 2385 | + input[type='time'], |
| 2386 | + input[type='datetime-local'], |
| 2387 | + input[type='month'], |
| 2388 | + input[type='week']) |
| 2389 | + ) { |
2303 | 2390 | %bootstrap-input { |
2304 | 2391 | transition: box-shadow .15s ease-out, border .15s ease-out; |
2305 | 2392 | } |
|
0 commit comments