Files
iTop/css/backoffice/components/_field.scss
2021-09-07 10:59:14 +02:00

220 lines
6.5 KiB
SCSS

/*!
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/* SCSS variables */
$ibo-field--sibling-spacing: 16px !default;
$ibo-field--value--color: $ibo-color-grey-700 !default;
$ibo-field--label--description--content: "?" !default;
$ibo-field--label--description--padding-left: 4px !default;
$ibo-field--label--description--color: $ibo-color-grey-600 !default;
$ibo-field--background-color--is-fullscreen: $ibo-color-white-100 !default;
$ibo-field--label--width--is-fullscreen: 100% !default;
$ibo-field--label--padding-x--is-fullscreen: 8px !default;
$ibo-field--label--padding-y--is-fullscreen: 4px !default;
$ibo-field--label--background-color--is-fullscreen: $ibo-color-grey-100 !default;
$ibo-field--label--border-bottom--is-fullscreen: 1px solid $ibo-color-grey-400 !default;
$ibo-field--fullscreen-toggler--size: 20px !default;
$ibo-field--fullscreen-toggler--border-radius: $ibo-border-radius-500 !default;
$ibo-field--fullscreen-toggler--background-color--on-hover: $ibo-color-white-200 !default;
$ibo-field--value--padding-x--is-fullscreen: $ibo-field--label--padding-x--is-fullscreen !default;
$ibo-field--value--padding-top--is-fullscreen: $ibo-field--label--padding-y--is-fullscreen + 32px !default;
$ibo-field--value--padding-bottom--is-fullscreen: $ibo-field--label--padding-y--is-fullscreen !default;
$ibo-field--value-decoration--spacing-x: 0.5rem !default;
/* SCSS rules */
.ibo-field {
@extend %ibo-font-size-150;
/* Avoid value to overflow from its container with very long strings (typically URLs) */
/* Note: Some types of attribute must be excluding as it can alter their rendering */
&:not([data-attribute-type="AttributeBlob"]):not([data-attribute-type="AttributeFile"]):not([data-attribute-type="AttributeImage"]):not([data-attribute-type="AttributeCustomFields"]):not(.ibo-input-file-select--container) {
/* We need the rule to apply for the class and all its descendants, hence the "&, & *" */
.ibo-field--value {
&, & * {
word-break: break-word;
white-space: inherit; /* Here we don't put break-spaces as it would put ".ibo-field-small .ibo-field-value" on a new line due to the spaces/indentation of the HTML templates. For now we rather have this rule than diminish the templates readability/maintenability */
}
}
&.ibo-field-large {
.ibo-field--value {
&, & * {
white-space: break-spaces; /* For large fields we don't have the issue stated above */
}
}
}
}
& ~ .ibo-field {
margin-top: $ibo-field--sibling-spacing;
}
}
/* Large field = Label on top, value below */
.ibo-field-large {
display: block;
.ibo-field--label {
position: relative; /* Necessary for fullscreen toggler */
display: flex;
align-items: center;
max-width: initial;
width: 100%;
}
/* For custom fields (eg. request templates) only */
.ibo-field-small .ibo-field--label {
display: table-cell;
vertical-align: top;
padding-right: 10px;
min-width: 100px;
max-width: 145px;
width: 30%;
}
/* Fullscreen mode */
&.ibo-is-fullscreen {
background-color: $ibo-field--background-color--is-fullscreen;
.ibo-field--label {
position: fixed;
width: $ibo-field--label--width--is-fullscreen;
min-width: initial;
max-width: initial;
padding: $ibo-field--label--padding-y--is-fullscreen $ibo-field--label--padding-x--is-fullscreen;
background-color: $ibo-field--label--background-color--is-fullscreen;
border-bottom: $ibo-field--label--border-bottom--is-fullscreen;
}
.ibo-field--value {
padding: $ibo-field--value--padding-top--is-fullscreen $ibo-field--value--padding-x--is-fullscreen $ibo-field--value--padding-bottom--is-fullscreen $ibo-field--value--padding-x--is-fullscreen;
}
}
}
/* Small field = Label on the left, value on the right */
.ibo-field-small {
display: table;
width: 100%;
.ibo-field--label {
display: table-cell;
vertical-align: top;
padding-right: 10px;
}
}
.ibo-field--fullscreen-toggler {
width: $ibo-field--fullscreen-toggler--size;
height: $ibo-field--fullscreen-toggler--size;
border-radius: $ibo-field--fullscreen-toggler--border-radius;
cursor: pointer;
@extend %ibo-hyperlink-inherited-colors;
@extend %ibo-fully-centered-content;
@extend %ibo-font-size-50;
&:hover {
background-color: $ibo-field--fullscreen-toggler--background-color--on-hover;
}
}
.ibo-field--label {
min-width: 100px;
max-width: 145px;
width: 30%;
@extend %ibo-font-weight-600;
> .ibo-has-description {
&::after {
content: $ibo-field--label--description--content;
padding-left: $ibo-field--label--description--padding-left;
vertical-align: top;
cursor: pointer;
color: $ibo-field--label--description--color;
@extend %ibo-font-ral-bol-50;
}
}
}
.ibo-field--label-small .ibo-field--label{
width: 145px;
}
.ibo-field--value {
display: table;
width: 100%;
color: $ibo-field--value--color;
/* Hack to force a table to fit its container without overflow (see N°2127) */
/* Note that along with with, we now display a "expand" icon on large fields so we can have a better view of its content */
.HTML {
table {
table-layout: fixed;
width: 100%;
}
}
}
.ibo-field--comments {
display: table-cell;
vertical-align: top;
padding-right: 10px;
> input[type="checkbox"] {
margin-left: 5px;
float: right;
}
> .multi_values, > .mono_value {
float: right;
}
}
/********************************************************/
/* Shameful zone, CSS classes not following conventions */
/* To be reworked */
/********************************************************/
.mailto, .tel {
white-space: nowrap;
.text_decoration {
margin-right: $ibo-field--value-decoration--spacing-x;
font-size: 0.9em; /* Mind the "em" instead of "rem" as we want the decoration to be size relatively to the text itself, not the page */
}
}
.object-ref-icon, .object-ref-icon-disabled {
&.text_decoration {
margin-right: $ibo-field--value-decoration--spacing-x;
@extend %ibo-font-size-100;
}
}
.multi_values, .mono_value {
display: inline-block;
padding: 1px 3px;
margin-left: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
color: #fff;
font-weight: bold;
}
.mono_value {
background-color: #3c3;
}
.multi_values {
background-color: #c33;
}
.form_field ~ .form_field {
margin-top: $ibo-field--sibling-spacing;
}