template/src/main/css/snippets/forms.css

107 lines
2.2 KiB
CSS
Raw Normal View History

2024-02-19 11:57:58 +01:00
:root {
/* Colors taken from https://isabelcastillo.com/error-info-messages-css */
--fwd-invalid-color: #d8000c;
--fwd-valid-color: #4f8a10;
--pico-form-element-invalid-border-color: var(--fwd-invalid-color) !important;
--pico-form-element-valid-border-color: var(--fwd-valid-color) !important;
}
/* Status card */
2022-11-20 20:35:50 +01:00
.status-card {
font-weight: bold;
position: relative;
2022-11-20 20:35:50 +01:00
}
.status-card output {
2022-11-20 20:35:50 +01:00
display: block;
2024-02-19 11:57:58 +01:00
margin-right: var(--pico-block-spacing-horizontal);
}
.status-card .close {
position: absolute;
2024-02-19 11:57:58 +01:00
right: var(--pico-block-spacing-horizontal);
top: calc(50% - .5rem);
2022-11-20 20:35:50 +01:00
width: 1rem;
height: 1rem;
2024-02-19 11:57:58 +01:00
background-image: var(--pico-icon-close);
2022-11-20 20:35:50 +01:00
background-position: center;
background-size: auto 1rem;
background-repeat: no-repeat;
opacity: .5;
2024-02-19 11:57:58 +01:00
transition: opacity var(--pico-transition);
2022-11-20 20:35:50 +01:00
}
.status-card .close:is([aria-current], :hover, :active, :focus) {
opacity: 1
}
2024-02-19 11:57:58 +01:00
.status-card.error {
/* Colors taken from https://isabelcastillo.com/error-info-messages-css */
background-color: #ffbaba;
color: var(--fwd-invalid-color);
}
2022-11-20 20:35:50 +01:00
.status-card.info {
/* Colors taken from https://isabelcastillo.com/error-info-messages-css */
background-color: #bde5f8;
color: #00529b;
}
.status-card.success {
2024-02-19 11:57:58 +01:00
/* Colors taken from https://isabelcastillo.com/error-info-messages-css */
background-color: #dff2bf;
color: var(--fwd-valid-color);
2022-11-20 20:35:50 +01:00
}
.status-card.warning {
/* Colors taken from https://isabelcastillo.com/error-info-messages-css */
background-color: #feefb3;
color: #9f6000;
}
/* Input validation */
2022-11-20 20:35:50 +01:00
label.invalid,
2022-11-21 08:25:45 +01:00
*[data-label-for].invalid,
2022-11-20 20:35:50 +01:00
input.invalid,
*[data-hint-for].invalid {
2024-02-19 11:57:58 +01:00
color: var(--fwd-invalid-color) !important;
}
input.invalid {
border-color: var(--fwd-invalid-color) !important;
2022-11-20 20:35:50 +01:00
}
label.valid,
2022-11-21 08:25:45 +01:00
*[data-label-for].valid,
2022-11-20 20:35:50 +01:00
input.valid,
*[data-hint-for].valid {
2024-02-19 11:57:58 +01:00
color: var(--fwd-valid-color) !important;
}
input.valid {
border-color: var(--fwd-valid-color) !important;
2022-11-20 20:35:50 +01:00
}
/* Enable hint-like styling on any element */
.input-hint {
display: block;
2024-02-19 11:57:58 +01:00
margin-top: calc(var(--pico-spacing) * -.75);
}
/* Custom components */
.inline-button {
display: inline-block;
width: unset;
margin: 0;
2022-12-16 22:39:16 +01:00
padding: 0.3em;
}