documentation/extensions/odoo_theme/static/style.scss
Elisabeth Dickinson 64787fce6e [IMP][CSS]Change order of imported scss files
The aim of this cleanup is to use as many bootstrap classes, functions
and utilities as possible to reduce the amount of extra code.
Instead of redefining variables, BS variables are overridden in the
bootstrap_overridden file.

In order to be able to reuse these overridden variables within our own
custom variable file — and after consultation with SRI — it was
determined that the variables.scss file should come after the bootstrap
files in the order of importation, unlike the order of odoo website's
scss files.

Changes to variables in bootstrap_overridden have been made to adapt to
the new structure.
2023-01-03 08:48:41 +01:00

1144 lines
31 KiB
SCSS

@import "scss/bootstrap_scss/_functions.scss";
@import "scss/_sphinx_basic";
@import "scss/bootstrap_overridden";
@import "scss/bootstrap_scss/bootstrap";
@import "scss/_variables";
@import "scss/_mixins";
@import "scss/_typography";
@import "scss/_iconfont";
div[aria-label="related navigation"] {
display: none;
}
body {
position: relative;
a {
@include media-breakpoint-down(lg) {
overflow-wrap: anywhere;
}
&:not(:hover), &.o_logo {
text-decoration: none !important;
}
&:hover {
text-underline-position: from-font;
}
&.external {
&:not(.image-reference):after {
content: '#{$i-external-link}';
margin: 0 $o-icon-margin;
font-family: icomoon, sans-serif !important;
@include font-size($font-size-base/1.3);
}
}
}
// This fixes the scroll position on all elements, including refs
:target {
&:before {
@include o-scroll-padding()
}
}
abbr {
text-underline-offset: 2px;
&[title="Pull Request"] {
@include o-easter-egg();
}
}
}
.hidden {
display: none !important;
opacity: 0 !important;
visibility: hidden !important;
}
span.viewcode-link {
float: none;
margin-left: .3rem;
}
//------------------------------------------------------------------------------
// Header with logo, searchbar and switchers
//------------------------------------------------------------------------------
header {
position: fixed;
width: 100%;
top: 0;
left: 0;
right: 0;
z-index: 10;
.o_main_header {
height: $o-header-mobile-height;
padding: 0 $o-padding-s;
background-color: $o-header-bg;
@include media-breakpoint-up(lg) {
height: $o-header-height;
padding: 0 $o-padding-m;
}
@include media-breakpoint-up(xl) {
padding: 0 $o-padding-l 0 $o-padding-m;
}
.o_logo_wrapper {
margin-right: $o-margin-s;
@include media-breakpoint-up(xl) {
width: calc(#{$o-side-nav-width} - #{$o-padding-m});
}
@include media-breakpoint-up(lg) {
margin-right: $o-margin-l;
}
> .o_logo {
img {
vertical-align: baseline;
margin-bottom: -2px;
}
span {
color: $o-violet;
@include font-size($font-size-base);
@include o-easter-egg($img:'img/ducky.svg');
}
}
}
.o_logo img {
@include media-breakpoint-up(lg) {
height: 30px
}
}
> div:not(.o_logo_wrapper) {
@include media-breakpoint-up(lg) {
width: calc(100% - (#{$o-side-nav-width}));
}
}
.o_search_wrapper {
position: relative;
@include media-breakpoint-up(lg) {
margin-right: $o-padding-m;
}
.o_search {
position: relative;
width: 100%;
.btn {
@include o-position-absolute($top: 50%, $right: .5rem);
@include o-transform (translateY(-50%)) ;
padding: 0 $o-padding-xs;
font-size: 1.2rem;
color: $o-gray;
}
.form-control {
@include media-breakpoint-down(lg) {
padding: 0.275rem 0.5rem;
font-size: $font-size-sm;
}
}
}
.highlight-link {
margin-bottom: 0;
@include font-size(0);
a {
text-decoration: none;
color: $o-gray;
&:before {
@include o-position-absolute($top: 50%, $right: 3rem);
@include o-transform (translateY(-50%)) ;
content: $i-close;
@include o-inline-icon(auto, middle, 1.2rem);
}
}
}
}
}
.o_subheader {
height: $o-subheader-height;
padding-right: $o-padding-s;
background: $o-gray-bg;
@include media-breakpoint-up(lg) {
padding: 0 $o-padding-m;
}
@include media-breakpoint-up(xl) {
padding: 0 $o-padding-l 0 0;
}
.o_side_nav_toggler_wrapper {
height: 100%;
button {
&:focus, &:focus-visible{
box-shadow: none;
outline:none;
}
&[aria-expanded="true"]{
background-color: rgba(0,0,0, .2);
}
}
}
}
}
//------------------------------------------------------------------------------
// Left side nav toctree
//------------------------------------------------------------------------------
.o_side_nav {
.o_mobile-overlay {
@include o-position-absolute($top: 0, $bottom: 0, $left: 0, $right:0);
z-index: -100;
opacity: 0;
transition: opacity .2s linear;
background-color: rgba(0,0,0,.3);
}
.o_side_nav-inner {
position: fixed;
left: -100%;
z-index: 10;
width: 90%;
height: calc(100% - #{$o-headers-mobile-height});
overflow-y: auto;
padding-left: $o-padding-s;
background-color: lighten($o-violet, 70%) ;
color: $o-violet;
font-weight: $o-fw-regular;
@include o-transition(all, .3s);
@include font-size($font-size-sm);
@include media-breakpoint-up(lg) {
width: $o-side-nav-width;
height: calc(100vh - #{$o-headers-height});
left: 0;
padding-top: $o-padding-m;
padding-left: $o-padding-m;
}
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-track {
background: $white;
}
&::-webkit-scrollbar-thumb {
background-color: $o-violet;
border-radius: 0;
}
}
&.show {
.o_mobile-overlay {
opacity: 1;
z-index: 1;
}
.o_side_nav-inner {
left: 0;
}
}
.toctree-l1 {
padding-bottom: $o-padding-xs;
> .o_toc_entry_wrapper a {
color: $o-violet;
font-weight: 600;
}
}
.o_main_toc {
> ul {
li {
&.o_active_toc_entry {
&:not(.toctree-l1) > .o_toc_entry_wrapper i[class^="i-"]:not(.collapsed), > a , > .o_toc_entry_wrapper a, > .o_toc_entry_wrapper i {
color: $o-violet;
}
}
a {
&.current {
color: $o-violet;
}
}
}
}
}
ul {
.o_deepest_active_toc_entry {
background-color: $o-toc-bg;
border-left: 3px solid $o-toc-border;
margin-left: -3px;
}
> .toctree-l1 {
&[class*="o_menu_"] > .o_toc_entry_wrapper > i:before {
content: $i-doc-apps;
@include o-inline-icon(0 5px 0 0);
color: $o-violet;
}
&.o_menu_applications > .o_toc_entry_wrapper > i:before{
content:'#{$i-doc-apps}';
}
&.o_menu_administration > .o_toc_entry_wrapper > i:before{
content:'#{$i-doc-admin}';
}
&.o_menu_developer > .o_toc_entry_wrapper > i:before{
content:'#{$i-doc-dev}';
}
&.o_menu_services > .o_toc_entry_wrapper > i:before{
content:'#{$i-doc-services}';
}
&.o_menu_contributing > .o_toc_entry_wrapper > i:before{
content:'#{$i-doc-contribute}';
}
}
}
}
.o_main_toc, .o_page_toc_nav {
ul { // all uls in toc
list-style: none;
padding-left: $o-padding-s;
li {
> a.reference {
padding-left: .875rem;
}
a {
display: inline-block;
padding: .4rem 0;
color: $o-gray-color;
font-weight: $o-fw-regular;
}
&:not(.toctree-l1) {
.o_toc_entry_wrapper {
&:not(.o_page_toc_title) {
display: flex;
align-items: baseline;
}
> i[class^="i-"] {
display: inline-block;
margin-right: .125rem;
@include o-transition(rotate, .3s);
font-size: .75rem;
&[aria-expanded="true"] {
@include o-transform(rotate(90deg));
}
}
}
}
&.o_active_toc_entry {
&:not(.toctree-l1) > .o_toc_entry_wrapper {
i[class^="i-"]:not(.collapsed) {
@include o-transform(rotate(90deg));
}
}
> a , > .o_toc_entry_wrapper a, > .o_toc_entry_wrapper i {
font-weight: $o-fw-bold;
}
}
}
}
> ul { //is first ul in toc
padding-left: 0;
}
}
//------------------------------------------------------------------------------
// On this page local toctree
//------------------------------------------------------------------------------
aside.o_page_toc {
color: $body-color;
@include font-size($font-size-sm);
&:not(.o_in_nav_toc) {
display: none;
@include media-breakpoint-up(xl) {
display: block;
grid-area: toc;
top: $o-headers-height;
padding: $o-padding-m $o-padding-s $o-padding-m 0;
overflow-y: auto;
}
position: -webkit-sticky;
position: sticky;
height: 100%;
max-height: calc(100vh - #{$o-headers-height});
}
&.o_in_nav_toc {
display: block;
@include media-breakpoint-up(xl) {
display: none;
}
}
h5 {
text-transform: uppercase;
font-weight: $o-fw-bold;
color: $o-gray-color;
padding-left: $o-padding-xs;
margin-bottom: $o-padding-xs;
}
a {
font-weight: $o-fw-regular;
color: $o-gray-color
}
.o_page_toc_title {
display:none;
+ ul {
padding-left: 0;
}
}
}
//------------------------------------------------------------------------------
// Main page content
//------------------------------------------------------------------------------
#wrap {
display: grid;
grid-template-areas: "main";
grid-template-columns: minmax(0,100%);
margin-top: $o-headers-mobile-height;
@include media-breakpoint-up(lg) {
grid-template-areas: "sidebar main toc";
grid-template-columns: minmax(0,$o-side-nav-width) minmax(0,auto) minmax(0,$o-on-page-width);
margin-top: $o-headers-height;
}
// Literals Styles (ex: https://www.odoo.com/documentation/master/developer/reference/backend/orm.html#fields)
.o_code, .sig [class^="sig-"] {
@include o-code;
}
.o_code {
padding: 0 .3rem;
&.file {
font-family: $font-family-base;
font-weight: $o-fw-medium;
font-style: italic;
padding-right: .4rem;
color: $blue-700;
background-color: $blue-100;
}
}
.sig {
.sig-prename {
padding-left: .3rem;
&+ .sig-name {
padding-right: .3rem;
}
}
em.property + .sig-name {
padding-left: .3rem;
}
.sig-paren:last-of-type {
padding-right: .3rem;
}
}
dl.py, dl.js, dl.o-definition-list {
> dd {
border-left: 3px solid $o-literals-border;
margin-top: -0.075rem;
padding-left: $o-padding-s;
padding-top: $o-padding-xs;
}
&.class em.property {
font-size: $font-size-sm;
&:first-child {
border-bottom: 3px solid $o-literals-border;
}
&:not(:first-child) {
@include o_code;
padding: 0 .3rem;
}
}
}
dl.field-list {
@include font-size($font-size-sm);
padding: .5rem;
border: 1px solid $o-gray-border;
@include media-breakpoint-down(lg) {
display: block;
}
> dt {
padding-left: 0;
}
ul {
list-style: none;
padding-left: 0;
li:not(:last-child) {
padding-bottom: $o-padding-xs;
}
}
}
iframe {
max-width: 100%;
}
main {
position: relative;
grid-area: main;
padding-bottom: $o-padding-l;
@include media-breakpoint-up(lg) {
padding: $o-padding-m $o-padding-l;
margin: 0;
grid-column-end: toc;
}
@include media-breakpoint-up(xl) {
grid-column-end: main;
}
&.o_index, &.o_fullwidth_page, &.o_has_code_column {
grid-column-end: toc;
}
// Homepage
&.o_index {
.o_content_fw_banner {
margin: 0 -0.75rem $o-margin-m;
padding: $o-padding-m $o-padding-s;
align-items: center;
@include o-gradient();
@include media-breakpoint-up(lg) {
margin: -#{$o-margin-m} -#{$o-margin-l} $o-margin-m;
padding: $o-padding-m $o-padding-m;
}
@include media-breakpoint-up(xl) {
margin: -#{$o-margin-m} -#{$o-margin-l} $o-margin-l;
padding: $o-padding-l $o-padding-l;
}
}
.row:first-of-type h2.border-top {
@include media-breakpoint-up(lg) {
border-top: 0 solid transparent !important;
}
}
h5 {
font-size: 12px;
}
ul {
> li {
position: relative;
padding-bottom: $o-padding-xs;
display: flex;
align-items: center;
&:before {
content: $i-article;
@include o-inline-icon(0 $o-icon-margin 0 0);
color: $o-gray-light;
}
}
}
.o_changelog {
.row:last-of-type > .border-bottom {
border: none !important;
}
}
}
// First level legal page and pages with toctrees (i.e.: User Docs, Install & Maintain, Developer, Contributing)
&.o_fullwidth_page {
div.toctree-wrapper > ul {
display: flex;
flex-wrap: wrap;
> li {
@include media-breakpoint-down(lg) {
width: 100%;
}
@include media-breakpoint-up(lg) {
width: 33%;
&:not(:nth-of-type(3n)){
padding-right: $o-padding-m;
}
}
}
}
}
// pages with column for code on the right
&.o_has_code_column {
article.doc-body {
@include media-breakpoint-up(xl) {
.o_git_link {
right: calc(#{$o-codecol-width} + #{$o-padding-l});
}
section {
> * {
width: $o-halfpage-width;
float: left;
clear: left;
}
> h1 {
max-width: calc(#{$o-halfpage-width} - 120px);
}
> h1, > h2, > h3, > h4, > h5, > h6 {
float: none;
clear: none;
}
.doc-aside {
width: $o-codecol-width;
float: none;
clear: none;
margin-left: 57%;
padding: $o-padding-s;
blockquote {
font-weight: $o-fw-semibold;
font-style: italic;
}
pre {
font-size: 12px;
}
}
}
}
}
+ aside.o_page_toc{
display: none;
}
}
&.o_hide_toc {
.toctree-wrapper {
display: none;
}
}
.toctree-wrapper {
> ul, .toctree-l1 > ul {
padding-left: 0;
list-style: none;
}
.toctree-l1 > a {
display: block;
@include font-size($h2-font-size);
margin-top: $o-padding-m;
padding-bottom: $o-padding-xs;
border-bottom: 1px solid $o-gray-border;
margin-bottom: $o-margin-s;
font-size: 1.2rem;
font-weight: 600;
}
.toctree-l1 {
margin-bottom: 2rem;
}
.toctree-l2 > a[href="#"] {
margin-top: 0.7rem;
display: inline-block;
}
a[href="#"] {
pointer-events: none;
cursor: default;
color: $o-gray-color;
font-weight: $o-fw-semibold;
}
}
article.doc-body {
padding-top: $o-padding-s;
position: relative;
.o_git_link {
@include font-size($font-size-sm);
@include o-position-absolute($top: 0px, $right: $o-margin-s);
@include media-breakpoint-up(lg) {
@include o-position-absolute($top: 10px, $right: $o-margin-s);
}
i {
margin-right: .2rem;
}
}
// Search items highlighted
span.highlighted {
background-color: lighten($warning, 15%);
}
section {
margin-bottom: $o-margin-m;
> h1 {
color: $o-violet;
font-weight: $o-fw-bold;
margin-bottom: $o-margin-s;
@include media-breakpoint-up(lg) {
max-width: calc(100% - 120px);
}
}
> h2 {
font-family: $o-font-family-serif;
color: $o-gray-color;
margin-bottom: $o-margin-s;
padding-bottom: .3rem;
border-bottom: 1px solid $o-gray-border;
}
> h3 {
font-weight: $o-fw-bold;
}
> h4, > h5, > h6 {
font-weight: $o-fw-semibold;
}
img {
margin-bottom: $o-margin-s;
}
img:not(.o-no-modal) {
cursor: pointer;
}
iframe {
margin-bottom: $o-margin-s;
}
p > img {
border: none;
padding: 0;
margin-bottom: 0;
}
.figure {
.caption, .caption-text {
font-weight: $o-fw-semibold;
color: $o-gray;
}
.caption, .caption-text, .legend, .legend p {
font-style: italic;
margin: 0 auto;
}
@include media-breakpoint-up(md) {
&:not([class^="col"]) .legend {
max-width: 60%;
}
}
}
a.headerlink {
text-decoration: none;
font-size: 0;
line-height: 0;
visibility: hidden !important;
&:before {
content: "\a0";
}
&:after {
content: '#{$i-link}';
font-family: icomoon, sans-serif !important;
@include font-size($font-size-base);
margin: 0 0 0 .3rem;
visibility: hidden;
color: $o-gray-light;
opacity: 0;
@include o-transition(all, .1s)
}
}
*:hover > a.headerlink:after {
// This makes permalinks only visible on hover.
visibility: visible;
opacity: 1;
}
table.table {
@include media-breakpoint-down(lg){
display: block;
overflow-x: auto;
code {
overflow-wrap: break-word;
}
}
}
}
}
div[class^="highlight"] {
// This styles the consoles like read-the-doc's consoles
overflow-x: auto;
border: 1px solid $o-gray-border;
margin: 1px 0 24px 0;
div[class^="highlight"] {
padding: 0;
border: none;
margin: 0;
}
pre {
white-space: pre;
margin: 0;
padding: 1rem;
display: block;
overflow: auto;
}
}
.guilabel, .menuselection {
font-weight: $o-fw-semibold;
}
.dfn{
@include font-size($font-size-sm);
line-height: 1;
color: $blue-600;
font-weight: $o-fw-semibold;
&:before {
content:'?';
display: inline-block;
width: 15px;
height: 15px;
border: 2px solid $blue-600;
border-radius: 20px;
text-align: center;
color: $blue-600;
font-size: 12px;
font-weight: $o-fw-extrabold;
font-style: normal;
margin: 0 .1rem;
}
}
.container .container:not([class^="col"]) {
padding: 0;
margin: 0;
}
ul, ol {
text-align: left;
}
ol {
ol {
list-style: lower-alpha;
> li:before {
content: none;
}
}
}
//------------------------------------------------------------------------------
// Alerts
//------------------------------------------------------------------------------
.alert {
border-width: 0 0 0 $alert-border-width;
@include font-size($font-size-sm);
code, div[class^="highlight"] {
background-color: $white !important;
border: 1px solid var(--o-alert-code-border-color,#{$o-gray-border}) ;
color: inherit;
}
> p , > ul {
margin-bottom: .5rem;
}
> *:last-child {
margin-bottom: 0;
}
> h3, > .alert-title {
line-height: 1em;
margin: 0 0 10px 0;
@include font-size($font-size-base);
font-weight: $o-fw-bold;
&:before {
content: var(--o-alert-icon, #{$o-alert-default-icon});
@include o-inline-icon(0 $o-icon-margin 0 0, baseline, $font-size-base, inherit);
@include media-breakpoint-down(md) {
display:none;
}
}
}
// Custom Admonitions
&[class^="admonition"] {
--o-alert-icon: '#{$i-info}';
--o-alert-code-border-color: tint-color($info, 30%);
$background: shift-color($info, $alert-bg-scale);
$border: shift-color($info, $alert-border-scale);
$color: shift-color($info, $alert-color-scale);
@if (contrast-ratio($background, $color) < $min-contrast-ratio) {
$color: mix($info, color-contrast($background), abs($alert-color-scale));
}
@include alert-variant($background, $border, $color);
}
// Note
&.alert-primary {
--o-alert-code-border-color: #{tint-color($primary, 50%)};
--o-alert-icon: '#{$i-note}';
}
// See Also
&.alert-secondary {
--o-alert-icon: '#{$i-article}';
--o-alert-code-border-color: #{tint-color($secondary, 30%)};
a {
color: $secondary;
}
}
// Tip
&.alert-tip {
--o-alert-icon: '#{$i-lightbulb}';
--o-alert-code-border-color: #{$o-gray-border};
$background: $o-gray-bg;
$border: shift-color($primary, $alert-border-scale);
$color: shift-color($primary, $alert-color-scale);
@if (contrast-ratio($background, $color) < $min-contrast-ratio) {
$color: mix($primary, color-contrast($background), abs($alert-color-scale));
}
@include alert-variant($background, $border, $color);
}
// Example
&.alert-success {
--o-alert-icon: '#{$i-knowledge}';
--o-alert-code-border-color: #{tint-color($success, 50%)};
}
// Warning & Important
&.alert-warning {
--o-alert-icon: '#{$i-warning}';
--o-alert-code-border-color: #{tint-color($warning, 50%)};
}
// Danger
&.alert-danger {
--o-alert-icon: '#{$i-danger}';
--o-alert-code-border-color: #{tint-color($danger, 50%)};
}
// Exercises
&.alert-dark {
--o-alert-icon: '#{$i-exercise}';
--o-alert-code-border-color: #{tint-color($dark, 50%)};
}
}
}
}
//------------------------------------------------------------------------------
// Spoilers
//------------------------------------------------------------------------------
.o_spoiler {
border-color: tint-color($dark, 30%);
background-color: $o-accordion-bg;
.accordion-button {
&::after {
margin: 0 $o-icon-margin 0 0;
}
&.collapsed::after {
transform: rotate(-90deg);
}
}
.accordion-body {
#wrap & { // FIXME: Temporary workaround to take priority over pre-existing rules.
> *:first-child {
margin-top: $o-margin-s;
}
code, div[class^="highlight"] {
border-color: tint-color($dark, 50%);
&:first-child:last-child {
margin-bottom: 0;
}
}
}
}
}
//------------------------------------------------------------------------------
// Content Tabs
//------------------------------------------------------------------------------
.sphinx-tabs {
padding: 0;
margin-bottom: $o-margin-s;
div[role="tablist"] {
border-color: $o-gray-border;
display: inline-flex;
overflow-x: auto;
overflow-y: clip;
width: 100%;
}
*:focus-visible {
outline: none;
}
button {
display: inline;
&:focus {
outline: none;
}
}
.sphinx-tabs-tab {
background: $o-gray-bg;
color: $o-gray-color;
border: 0;
border-top: solid 1px $o-gray-border;
padding: $o-padding-xs $o-padding-s;
&:hover {
&:not([aria-selected="true"]) {
cursor: pointer;
background: tint-color($o-violet, 80%);
color: $o-violet;
transition: color .15s, background .15s;
border-radius: 0;
}
}
&:first-of-type {
border-left: solid 1px $o-gray-border;
}
&:last-of-type {
border-right: solid 1px $o-gray-border;
}
&:focus {
z-index: unset;
}
&[aria-selected="true"] {
@include o-content-tab-selected();
margin-top: 0;
margin-bottom: -1px;
&:hover {
cursor: unset;
}
&:first-of-type {
@include o-content-tab-selected();
}
}
}
.sphinx-tabs-panel {
background: $white;
color: $o-gray-color;
border: 1px solid $o-gray-border;
padding: $o-padding-s;
&:focus {
outline: none;
}
> div[class^="highlight-"]{
border: 0 !important;
}
> *:last-child {
margin-bottom: 0 !important;
}
}
}
//------------------------------------------------------------------------------
// Footer
//------------------------------------------------------------------------------
footer {
.o_get_help {
padding-top: $o-padding-l;
padding-bottom: $o-padding-l;
background: $o-gray-bg;
@include media-breakpoint-up(lg) {
padding-left: calc(#{$o-side-nav-width} + #{$o-padding-l})
}
h4 {
color: $secondary;
font-weight: $o-fw-bold;
margin-bottom: $o-margin-s;
}
}
}