pico/scss/forms/_input-date.scss

60 lines
1.6 KiB
SCSS
Raw Normal View History

2022-10-23 10:47:50 +07:00
@use "sass:map";
2022-10-22 13:11:51 +07:00
@use "../settings" as *;
2022-10-23 10:47:50 +07:00
@if map.get($modules, "forms/input-date") {
/**
* Input type datetime
*/
2022-10-22 11:44:10 +07:00
2022-10-23 10:47:50 +07:00
// :not() are needed to add Specificity and avoid !important on padding
input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]) {
&:is([type="date"], [type="datetime-local"], [type="month"], [type="time"], [type="week"]) {
#{$✨}icon-position: 0.75rem;
#{$✨}icon-width: 1rem;
padding-right: calc(var(#{$}icon-width) + var(#{$}icon-position));
background-image: var(#{$}icon-date);
background-position: center right var(#{$}icon-position);
background-size: var(#{$}icon-width) auto;
background-repeat: no-repeat;
}
2022-10-22 11:44:10 +07:00
2022-10-23 10:47:50 +07:00
// Time
&[type="time"] {
background-image: var(#{$}icon-time);
}
2022-10-22 11:44:10 +07:00
}
2022-10-23 10:47:50 +07:00
// Calendar picker
[type="date"],
[type="datetime-local"],
[type="month"],
[type="time"],
[type="week"] {
&::-webkit-calendar-picker-indicator {
width: var(#{$}icon-width);
margin-right: calc(var(#{$}icon-width) * -1);
margin-left: var(#{$}icon-position);
opacity: 0;
}
2022-10-22 11:44:10 +07:00
}
// Calendar icons are hidden in Firefox
@if $enable-important {
@-moz-document url-prefix() {
[type="date"],
[type="datetime-local"],
[type="month"],
[type="time"],
[type="week"] {
padding-right: var(#{$}form-element-spacing-horizontal) !important;
background-image: none !important;
}
}
}
2022-10-23 10:47:50 +07:00
[dir="rtl"]
:is([type="date"], [type="datetime-local"], [type="month"], [type="time"], [type="week"]) {
text-align: right;
}
2022-10-22 11:44:10 +07:00
}