pico/scss/forms/_input-date.scss

61 lines
2.0 KiB
SCSS
Raw Permalink 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
2024-01-25 01:42:54 +07:00
#{$parent-selector} input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]) {
2022-10-23 10:47:50 +07:00
&:is([type="date"], [type="datetime-local"], [type="month"], [type="time"], [type="week"]) {
2023-12-28 13:21:52 +07:00
#{$css-var-prefix}icon-position: 0.75rem;
#{$css-var-prefix}icon-width: 1rem;
padding-right: calc(var(#{$css-var-prefix}icon-width) + var(#{$css-var-prefix}icon-position));
background-image: var(#{$css-var-prefix}icon-date);
background-position: center right var(#{$css-var-prefix}icon-position);
background-size: var(#{$css-var-prefix}icon-width) auto;
2022-10-23 10:47:50 +07:00
background-repeat: no-repeat;
}
2022-10-22 11:44:10 +07:00
2022-10-23 10:47:50 +07:00
// Time
&[type="time"] {
2023-12-28 13:21:52 +07:00
background-image: var(#{$css-var-prefix}icon-time);
2022-10-23 10:47:50 +07:00
}
2022-10-22 11:44:10 +07:00
}
2022-10-23 10:47:50 +07:00
// Calendar picker
2024-01-25 01:42:54 +07:00
#{$parent-selector} [type="date"],
#{$parent-selector} [type="datetime-local"],
#{$parent-selector} [type="month"],
#{$parent-selector} [type="time"],
#{$parent-selector} [type="week"] {
2022-10-23 10:47:50 +07:00
&::-webkit-calendar-picker-indicator {
2023-12-28 13:21:52 +07:00
width: var(#{$css-var-prefix}icon-width);
margin-right: calc(var(#{$css-var-prefix}icon-width) * -1);
margin-left: var(#{$css-var-prefix}icon-position);
2022-10-23 10:47:50 +07:00
opacity: 0;
}
2022-10-22 11:44:10 +07:00
}
// Calendar icons are hidden in Firefox
@if $enable-important {
@-moz-document url-prefix() {
2024-01-25 01:42:54 +07:00
#{$parent-selector} [type="date"],
#{$parent-selector} [type="datetime-local"],
#{$parent-selector} [type="month"],
#{$parent-selector} [type="time"],
#{$parent-selector} [type="week"] {
2023-12-28 13:21:52 +07:00
padding-right: var(#{$css-var-prefix}form-element-spacing-horizontal) !important;
background-image: none !important;
}
}
}
2022-10-23 10:47:50 +07:00
[dir="rtl"]
2024-01-25 01:42:54 +07:00
#{$parent-selector}
2022-10-23 10:47:50 +07:00
:is([type="date"], [type="datetime-local"], [type="month"], [type="time"], [type="week"]) {
text-align: right;
}
2022-10-22 11:44:10 +07:00
}