2021-07-07 11:12:38 +00:00
|
|
|
//
|
|
|
|
// Base styles
|
|
|
|
//
|
|
|
|
|
2022-11-04 15:49:41 +00:00
|
|
|
.accordion {
|
|
|
|
// scss-docs-start accordion-css-vars
|
|
|
|
--#{$prefix}accordion-color: #{$accordion-color};
|
|
|
|
--#{$prefix}accordion-bg: #{$accordion-bg};
|
|
|
|
--#{$prefix}accordion-transition: #{$accordion-transition};
|
|
|
|
--#{$prefix}accordion-border-color: #{$accordion-border-color};
|
|
|
|
--#{$prefix}accordion-border-width: #{$accordion-border-width};
|
|
|
|
--#{$prefix}accordion-border-radius: #{$accordion-border-radius};
|
|
|
|
--#{$prefix}accordion-inner-border-radius: #{$accordion-inner-border-radius};
|
|
|
|
--#{$prefix}accordion-btn-padding-x: #{$accordion-button-padding-x};
|
|
|
|
--#{$prefix}accordion-btn-padding-y: #{$accordion-button-padding-y};
|
|
|
|
--#{$prefix}accordion-btn-color: #{$accordion-button-color};
|
|
|
|
--#{$prefix}accordion-btn-bg: #{$accordion-button-bg};
|
|
|
|
--#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon)};
|
|
|
|
--#{$prefix}accordion-btn-icon-width: #{$accordion-icon-width};
|
|
|
|
--#{$prefix}accordion-btn-icon-transform: #{$accordion-icon-transform};
|
|
|
|
--#{$prefix}accordion-btn-icon-transition: #{$accordion-icon-transition};
|
|
|
|
--#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon)};
|
|
|
|
--#{$prefix}accordion-btn-focus-border-color: #{$accordion-button-focus-border-color};
|
|
|
|
--#{$prefix}accordion-btn-focus-box-shadow: #{$accordion-button-focus-box-shadow};
|
|
|
|
--#{$prefix}accordion-body-padding-x: #{$accordion-body-padding-x};
|
|
|
|
--#{$prefix}accordion-body-padding-y: #{$accordion-body-padding-y};
|
|
|
|
--#{$prefix}accordion-active-color: #{$accordion-button-active-color};
|
|
|
|
--#{$prefix}accordion-active-bg: #{$accordion-button-active-bg};
|
|
|
|
// scss-docs-end accordion-css-vars
|
|
|
|
}
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
.accordion-button {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
width: 100%;
|
2022-11-04 15:49:41 +00:00
|
|
|
padding: var(--#{$prefix}accordion-btn-padding-y) var(--#{$prefix}accordion-btn-padding-x);
|
2021-07-07 11:12:38 +00:00
|
|
|
@include font-size($font-size-base);
|
2022-11-04 15:49:41 +00:00
|
|
|
color: var(--#{$prefix}accordion-btn-color);
|
2021-07-07 11:12:38 +00:00
|
|
|
text-align: left; // Reset button style
|
2022-11-04 15:49:41 +00:00
|
|
|
background-color: var(--#{$prefix}accordion-btn-bg);
|
2021-07-07 11:12:38 +00:00
|
|
|
border: 0;
|
|
|
|
@include border-radius(0);
|
|
|
|
overflow-anchor: none;
|
2022-11-04 15:49:41 +00:00
|
|
|
@include transition(var(--#{$prefix}accordion-transition));
|
2021-07-07 11:12:38 +00:00
|
|
|
|
|
|
|
&:not(.collapsed) {
|
2022-11-04 15:49:41 +00:00
|
|
|
color: var(--#{$prefix}accordion-active-color);
|
|
|
|
background-color: var(--#{$prefix}accordion-active-bg);
|
|
|
|
box-shadow: inset 0 calc(-1 * var(--#{$prefix}accordion-border-width)) 0 var(--#{$prefix}accordion-border-color); // stylelint-disable-line function-disallowed-list
|
2021-07-07 11:12:38 +00:00
|
|
|
|
|
|
|
&::after {
|
2022-11-04 15:49:41 +00:00
|
|
|
background-image: var(--#{$prefix}accordion-btn-active-icon);
|
|
|
|
transform: var(--#{$prefix}accordion-btn-icon-transform);
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Accordion icon
|
|
|
|
&::after {
|
|
|
|
flex-shrink: 0;
|
2022-11-04 15:49:41 +00:00
|
|
|
width: var(--#{$prefix}accordion-btn-icon-width);
|
|
|
|
height: var(--#{$prefix}accordion-btn-icon-width);
|
2021-07-07 11:12:38 +00:00
|
|
|
margin-left: auto;
|
|
|
|
content: "";
|
2022-11-04 15:49:41 +00:00
|
|
|
background-image: var(--#{$prefix}accordion-btn-icon);
|
2021-07-07 11:12:38 +00:00
|
|
|
background-repeat: no-repeat;
|
2022-11-04 15:49:41 +00:00
|
|
|
background-size: var(--#{$prefix}accordion-btn-icon-width);
|
|
|
|
@include transition(var(--#{$prefix}accordion-btn-icon-transition));
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
z-index: 3;
|
2022-11-04 15:49:41 +00:00
|
|
|
border-color: var(--#{$prefix}accordion-btn-focus-border-color);
|
2021-07-07 11:12:38 +00:00
|
|
|
outline: 0;
|
2022-11-04 15:49:41 +00:00
|
|
|
box-shadow: var(--#{$prefix}accordion-btn-focus-box-shadow);
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-header {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-item {
|
2022-11-04 15:49:41 +00:00
|
|
|
color: var(--#{$prefix}accordion-color);
|
|
|
|
background-color: var(--#{$prefix}accordion-bg);
|
|
|
|
border: var(--#{$prefix}accordion-border-width) solid var(--#{$prefix}accordion-border-color);
|
2021-07-07 11:12:38 +00:00
|
|
|
|
|
|
|
&:first-of-type {
|
2022-11-04 15:49:41 +00:00
|
|
|
@include border-top-radius(var(--#{$prefix}accordion-border-radius));
|
2021-07-07 11:12:38 +00:00
|
|
|
|
|
|
|
.accordion-button {
|
2022-11-04 15:49:41 +00:00
|
|
|
@include border-top-radius(var(--#{$prefix}accordion-inner-border-radius));
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(:first-of-type) {
|
|
|
|
border-top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only set a border-radius on the last item if the accordion is collapsed
|
|
|
|
&:last-of-type {
|
2022-11-04 15:49:41 +00:00
|
|
|
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
2021-07-07 11:12:38 +00:00
|
|
|
|
|
|
|
.accordion-button {
|
|
|
|
&.collapsed {
|
2022-11-04 15:49:41 +00:00
|
|
|
@include border-bottom-radius(var(--#{$prefix}accordion-inner-border-radius));
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-collapse {
|
2022-11-04 15:49:41 +00:00
|
|
|
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-body {
|
2022-11-04 15:49:41 +00:00
|
|
|
padding: var(--#{$prefix}accordion-body-padding-y) var(--#{$prefix}accordion-body-padding-x);
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Flush accordion items
|
|
|
|
//
|
|
|
|
// Remove borders and border-radius to keep accordion items edge-to-edge.
|
|
|
|
|
|
|
|
.accordion-flush {
|
|
|
|
.accordion-collapse {
|
|
|
|
border-width: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-item {
|
|
|
|
border-right: 0;
|
|
|
|
border-left: 0;
|
|
|
|
@include border-radius(0);
|
|
|
|
|
|
|
|
&:first-child { border-top: 0; }
|
|
|
|
&:last-child { border-bottom: 0; }
|
|
|
|
|
|
|
|
.accordion-button {
|
2022-11-04 15:49:41 +00:00
|
|
|
&,
|
|
|
|
&.collapsed {
|
|
|
|
@include border-radius(0);
|
|
|
|
}
|
2021-07-07 11:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|