pico/scss/forms/_input-file.scss

42 lines
1.4 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-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.
2024-01-25 01:42:54 +07:00
#{$parent-selector} [type="file"] {
2023-12-28 13:21:52 +07:00
#{$css-var-prefix}color: var(#{$css-var-prefix}muted-color);
margin-left: calc(var(#{$css-var-prefix}outline-width) * -1); // 1
padding: calc(var(#{$css-var-prefix}form-element-spacing-vertical) * 0.5) 0;
padding-left: var(#{$css-var-prefix}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-12-28 13:21:52 +07:00
margin-right: calc(var(#{$css-var-prefix}spacing) / 2);
padding: calc(var(#{$css-var-prefix}form-element-spacing-vertical) * 0.5)
var(#{$css-var-prefix}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-12-28 13:21:52 +07:00
#{$css-var-prefix}background-color: var(#{$css-var-prefix}secondary-hover-background);
#{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-hover-border);
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 {
2023-12-28 13:21:52 +07:00
#{$css-var-prefix}box-shadow:
var(#{$css-var-prefix}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
0 0 0 var(#{$css-var-prefix}outline-width) var(#{$css-var-prefix}secondary-focus);
2022-12-26 11:35:56 +07:00
}
}
2022-10-22 11:44:10 +07:00
}
}