demarches-normaliennes/app/assets/stylesheets/forms.scss

634 lines
12 KiB
SCSS
Raw Normal View History

2017-07-20 10:25:32 +02:00
@import "constants";
2017-06-14 17:39:46 +02:00
@import "colors";
@import "placeholders";
2017-06-14 17:39:46 +02:00
.form {
input.unstyled {
padding: 0 !important;
background: none !important;
border: none !important;
width: auto !important;
&:focus {
box-shadow: none !important;
background-color: $white !important;
}
}
.placeholder {
color: $dark-grey;
font-style: italic;
}
.fr-input-group {
margin-bottom: 1rem;
}
.section-2 {
margin-top: 1.5rem;
padding-top: 1rem;
border-top: 2px solid var(--border-default-grey);
}
.section-2,
.section-3 {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
.section-4,
.section-5,
.section-6 {
margin-top: 1.5rem;
margin-bottom: 1rem;
}
legend {
width: 100%;
}
hr {
width: 100%;
height: 0;
margin-top: $default-padding;
margin-bottom: $default-fields-spacer;
border: none;
2020-02-10 14:46:45 +01:00
border-bottom: 2px solid $border-grey;
}
@mixin notice-text-style {
font-size: 16px;
2020-06-11 14:33:15 +02:00
color: $dark-grey;
}
.mandatory {
fill: currentColor;
}
label:not(.fr-label),
legend.form-label {
font-size: 18px;
2017-08-02 15:29:12 +02:00
margin-bottom: $default-padding;
display: block;
2018-02-21 18:32:07 +01:00
font-weight: bold;
2017-08-02 15:29:12 +02:00
&.required {
&::after {
color: $dark-red;
content: " *";
}
}
}
.form-label {
font-weight: bold;
font-size: 18px;
margin-bottom: $default-padding;
}
.notice {
@include notice-text-style;
margin-top: - $default-spacer;
margin-bottom: $default-padding;
p {
margin-bottom: $default-spacer;
}
input[type='date'] {
display: inline-block;
}
}
2017-12-14 16:21:14 +01:00
.editable-champ {
2018-04-09 18:27:15 +02:00
position: relative;
.updated-at {
@include notice-text-style;
float: right;
margin-left: $default-spacer;
visibility: hidden;
}
&:hover .updated-at,
.updated-at.highlighted {
visibility: visible;
2017-08-02 15:29:12 +02:00
}
2018-04-03 17:53:14 +02:00
// Move checkbox to the top-left side of the label
2023-05-16 09:02:38 +02:00
&.editable-champ-checkbox {
label.admin-default-zone {
font-weight: bold;
}
}
&.editable-champ-checkbox {
label {
padding-left: 28px;
font-weight: normal;
}
input[type=checkbox] {
position: absolute;
top: 3px;
left: 0px;
}
2020-02-10 15:59:36 +01:00
// When an (eventual) notice is displayed after the input, give it some bottom margin.
2020-02-10 15:59:36 +01:00
.notice {
margin-bottom: $default-fields-spacer;
}
}
2017-06-14 17:39:46 +02:00
}
.radios {
display: flex;
// Horizontal layout (default)
flex-direction: row;
align-items: flex-start;
2021-01-04 17:14:28 +01:00
flex-wrap: wrap;
label {
margin-right: $default-padding;
}
// Vertical layout
&.vertical {
flex-direction: column;
align-items: stretch;
label {
margin-right: 0;
}
}
label {
padding: $default-padding $default-padding $default-padding $default-spacer;
border: 1px solid $border-grey;
border-radius: 4px;
font-weight: normal;
background: $white;
user-select: none;
&:last-of-type {
margin-bottom: 0;
}
&:hover {
background: $light-grey;
cursor: pointer;
}
&:active {
border-color: darken($border-grey, 10);
}
&:first-child {
margin-left: 0;
}
&.blank-radio {
color: $dark-grey;
font-style: italic;
}
input[type=radio] {
margin-bottom: 0;
}
.notice {
margin: 4px 0 0 27px;
}
}
}
.drop_down_other { // scss-lint:disable SelectorFormat
label {
font-weight: normal;
}
}
2023-05-05 09:13:05 +02:00
.fr-label {
// la description d'un champ peut contenir du markup (markdown->html),
// on herite donc la fontsize/mrgin/padding du fr-hint-text
.fr-hint-text > * {
2023-05-05 09:13:05 +02:00
font-size: inherit;
margin: inherit;
padding: inherit;
}
}
input[type=password],
select {
2017-06-14 17:39:46 +02:00
display: block;
margin-bottom: 0;
2018-07-23 14:52:14 +02:00
&.small-margin {
margin-bottom: $default-spacer;
2018-07-23 14:52:14 +02:00
}
&.no-margin {
margin-bottom: 0;
}
2023-01-05 15:51:24 +01:00
+ .spinner:not(.right):not(.left) {
position: relative;
top: -($default-fields-spacer / 2);
}
2018-07-23 14:52:14 +02:00
}
2019-01-30 16:14:15 +01:00
2018-11-14 16:26:00 +01:00
input[type=checkbox] {
&.small-margin {
margin-bottom: $default-spacer;
2018-11-14 16:26:00 +01:00
}
}
2018-07-23 14:52:14 +02:00
input[type=text]:not([data-address='true']),
select {
2023-01-26 10:39:13 +01:00
border-radius: 4px;
border: solid 1px $border-grey;
padding: $default-padding;
2017-06-20 10:03:49 +02:00
&.small {
padding: $default-spacer;
}
2017-06-20 10:03:49 +02:00
&:disabled {
background-color: $border-grey;
}
2022-06-27 15:58:37 +02:00
&:focus,
&:focus-visible {
outline: 0;
2021-09-20 15:04:24 +02:00
border: 1px solid $blue-france-500;
box-shadow: 0px 0px 2px 1px $blue-france-500;
}
// Hide the browser default invalidity indicator until the field is touched
2023-01-24 16:31:46 +01:00
&:invalid:not(:focus):not(.fr-input) {
box-shadow: none;
}
&.touched:invalid {
border: 1px solid $dark-red;
box-shadow: 0px 0px 2px 1px $dark-red;
}
2017-06-14 17:39:46 +02:00
}
2017-07-24 09:46:13 +02:00
div.field_with_errors > input { // scss-lint:disable SelectorFormat
border: 1px solid $dark-red;
}
input[type=text],
input[type=email],
input[type=password],
input[type=date],
input[type=number],
input[type=datetime-local],
2023-05-05 09:13:05 +02:00
textarea,
input[type=tel], {
@media (max-width: $two-columns-breakpoint) {
width: 100%;
}
// don't set 100% width when width-* classes or size attribute are applied
@media (min-width: $two-columns-breakpoint) {
&:not([class^='width-']):not([size]) {
width: 100%;
}
}
}
@media (min-width: $two-columns-breakpoint) {
input[type=email],
input[type=password],
input[type=number],
input[type=tel] {
max-width: 500px;
}
}
input[type=date] {
max-width: 180px;
}
// override default site width/max-width for editable-champ form (Usager form)
.editable-champ {
input {
max-width: none;
@media (min-width: $two-columns-breakpoint) {
&:not([size]) {
&[type='date'],
&[type='tel'],
&[type='number'],
&[type='datetime-local'] {
width: 33.33%;
}
&[type='email'] {
width: 66.67%;
}
}
}
}
}
input[type=checkbox],
input[type=radio] {
@extend %outline;
// Firefox tends to display some controls smaller than other browsers.
// Ensure a consistency of size between browsers.
width: 16px;
height: 16px;
margin-left: 5px;
margin-right: 4px;
margin-bottom: 0;
}
2020-10-07 17:41:20 +02:00
[data-reach-combobox-input] {
min-height: 62px;
border-radius: 4px;
border: solid 1px $border-grey;
padding: $default-padding;
2020-10-07 17:41:20 +02:00
&:not([class^='width-']) {
width: 100%;
min-width: 50%;
max-width: 100%;
}
&:focus {
border-color: $blue-france-500;
}
2020-10-07 17:41:20 +02:00
}
[data-reach-combobox-token-list] {
padding: $default-spacer;
display: flex;
flex-wrap: wrap;
align-items: center;
list-style: none;
}
[data-reach-combobox-token] button {
border: solid 1px $border-grey;
color: $black;
border-radius: 4px;
padding: $default-spacer;
margin-right: $default-spacer;
cursor: pointer;
display: flex;
align-items: center;
}
[data-reach-combobox-token] button:focus {
background-color: $black;
color: $white;
}
2018-10-17 12:07:12 +02:00
.editable-champ {
&:not(.editable-champ-carte) .algolia-autocomplete {
margin-bottom: 2 * $default-padding;
}
.geo-areas {
margin-bottom: 2 * $default-padding;
}
2019-01-30 16:14:15 +01:00
&.editable-champ-repetition {
.row {
border-radius: 4px;
border: 1px solid $border-grey;
padding: $default-padding;
margin-bottom: 2 * $default-padding;
}
}
2017-07-26 12:09:21 +02:00
}
.editable-champ-titre_identite { // scss-lint:disable SelectorFormat
margin-bottom: 2 * $default-padding;
}
2021-11-24 17:30:35 +01:00
.cnaf-inputs,
.dgfip-inputs,
2021-12-15 15:25:02 +01:00
.pole-emploi-inputs,
.mesri-inputs {
label {
font-weight: 400;
2021-09-21 14:49:54 +02:00
}
}
input.aa-input,
input.aa-hint {
2017-07-26 12:09:21 +02:00
border-radius: 4px;
border: solid 1px $border-grey;
padding: $default-padding;
}
input.aa-hint {
2020-06-11 14:33:15 +02:00
color: $dark-grey;
2017-07-26 12:09:21 +02:00
}
.header-subsection {
font-size: 22px;
2021-09-20 15:04:24 +02:00
color: $blue-france-500;
margin-bottom: $default-padding;
}
.explication-libelle {
font-weight: bold;
font-size: 20px;
margin-bottom: $default-padding;
}
.explication {
2020-02-10 15:59:36 +01:00
margin-bottom: $default-fields-spacer;
padding: $default-spacer;
background-color: $light-grey;
2018-07-09 18:16:59 +02:00
p:not(:last-child) {
margin-bottom: $default-padding;
}
}
.send-wrapper {
display: flex;
width: 100%;
margin-top: $default-padding;
margin-bottom: 2 * $default-padding;
.button {
margin-top: $default-padding;
margin-bottom: 0;
}
// Wide layout: align buttons on a single row
@media (min-width: 550px) {
flex-direction: row;
.button:not(:first-of-type) {
margin-left: $default-spacer;
}
// If there are more than one button, align the "Send" button to the right
.button:not(:first-of-type).send {
margin-left: auto;
}
}
// Narrow layout: stack buttons vertically
@media (max-width: 550px) {
flex-direction: column-reverse;
align-items: center;
.button {
width: 100%;
max-width: 350px;
line-height: 30px;
margin-left: none;
margin-right: none;
}
}
2017-07-24 09:46:13 +02:00
}
.justify-content--space-between {
justify-content: space-between;
}
.send-notice {
@include notice-text-style;
margin-bottom: $default-padding;
}
.send-wrapper + .send-notice {
margin-top: - $default-padding;
}
.inline-champ {
margin-left: $default-spacer;
margin-right: $default-spacer;
width: 100%;
&:first-child {
margin-left: 0;
}
&:last-child {
margin-right: 0;
}
}
fieldset ~ .spinner {
position: relative;
top: -($default-fields-spacer / 2);
}
}
[data-react-component-value^="ComboMultiple"] {
margin-bottom: $default-fields-spacer;
[data-reach-combobox-input] {
flex-grow: 1;
background-image: image-url("icons/chevron-down");
background-size: 14px;
background-repeat: no-repeat;
background-position: right 10px center;
border-radius: 4px;
border: solid 1px $border-grey;
padding: $default-padding;
margin: $default-spacer;
margin-top: 0;
2023-03-22 10:07:51 +01:00
width: 100%;
}
ul {
list-style: none;
li {
margin-right: $default-spacer;
display: inline-block;
}
}
}
[data-reach-combobox-token-label] {
border: 1px solid #CCCCCC;
border-radius: 4px;
display: flex;
flex-wrap: wrap;
}
2020-10-07 17:41:20 +02:00
[data-reach-combobox-option] {
font-size: 16px;
list-style-type: none;
2020-10-07 17:41:20 +02:00
}
[data-reach-combobox-option][aria-selected="true"] {
background: $light-blue !important;
color: $white;
}
[data-reach-combobox-separator] {
font-size: 16px;
color: $dark-grey;
background: $light-grey;
padding: $default-spacer;
}
[data-reach-combobox-no-results] {
font-size: 16px;
color: $dark-grey;
background: $light-grey;
padding: $default-spacer;
}
[data-reach-combobox-token] button {
cursor: pointer;
background-color: transparent;
background-image: none;
border: none;
line-height: 1;
padding: 0;
margin-right: 4px;
display: flex;
align-items: center !important;
}
[data-reach-combobox-input] button:focus {
outline-color: $light-blue;
}
[data-reach-combobox-popover] {
z-index: 20;
}
.fconnect-form {
input[type='password'] {
margin-bottom: 16px;
}
}
input::placeholder,
textarea::placeholder {
opacity: 0.6; // normalize opacity across browsers
color: $dark-grey;
}
.sticky-action-footer {
border-top: 2px solid $blue-france-500;
position: sticky;
// scss-lint:disable VendorPrefix
position: -webkit-sticky; // This is needed on Safari (tested on 12.1)
// scss-lint:enable VendorPrefix
bottom: 0;
padding: $default-padding 0;
background-color: $white;
z-index: 2;
}