pico/scss/forms/_input-file.scss

41 lines
1.2 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-22 11:44:10 +07:00
2022-10-23 10:47:50 +07:00
@if map.get($modules, "forms/input-file") {
/**
* Input type file
*/
2023-02-19 10:17:14 +07:00
// 1. Hack to display the outline on the focused file selector button
// with the forced overflow hidden on the input[type="file"] element.
input[type="file"] {
2022-10-23 10:47:50 +07:00
#{$✨}color: var(#{$}muted-color);
2023-02-19 10:17:14 +07:00
margin-left: calc(var(#{$}outline-width) * -1); // 1
2022-10-23 10:47:50 +07:00
padding: calc(var(#{$}form-element-spacing-vertical) * 0.5) 0;
2023-02-19 10:17:14 +07:00
padding-left: var(#{$}outline-width); // 1
2022-10-23 10:47:50 +07:00
border: 0;
border-radius: 0;
background: none;
2022-10-22 11:44:10 +07:00
2022-10-23 10:47:50 +07:00
&::file-selector-button {
2023-02-19 10:17:14 +07:00
margin-right: calc(var(#{$}spacing) / 2);
padding: calc(var(#{$}form-element-spacing-vertical) * 0.5)
var(#{$}form-element-spacing-horizontal);
2022-10-23 10:47:50 +07:00
}
2022-12-26 11:35:56 +07:00
&:is(:hover, :active, :focus) {
&::file-selector-button {
2023-02-19 10:17:14 +07:00
#{$✨}background-color: var(#{$}secondary-background-hover);
#{$✨}border-color: var(#{$}secondary-border-hover);
2022-12-26 11:35:56 +07:00
}
2023-02-19 10:17:14 +07:00
}
2022-12-26 11:35:56 +07:00
2023-02-19 10:17:14 +07:00
&:focus {
&::file-selector-button {
#{$✨}box-shadow: var(#{$}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
0 0 0 var(#{$}outline-width) var(#{$}secondary-focus);
2022-12-26 11:35:56 +07:00
}
}
2022-10-22 11:44:10 +07:00
}
}