2020-11-02 14:36:51 -05:00
|
|
|
//
|
|
|
|
// Base styles
|
|
|
|
//
|
|
|
|
|
2022-03-28 18:05:37 -04:00
|
|
|
.accordion {
|
|
|
|
// scss-docs-start accordion-css-vars
|
|
|
|
--#{$prefix}accordion-color: #{$accordion-color};
|
|
|
|
--#{$prefix}accordion-bg: #{$accordion-bg};
|
|
|
|
--#{$prefix}accordion-border-color: #{$accordion-border-color};
|
|
|
|
--#{$prefix}accordion-border-width: #{$accordion-border-width};
|
|
|
|
--#{$prefix}accordion-border-radius: #{$accordion-border-radius};
|
|
|
|
--#{$prefix}accordion-btn-padding-x: #{$accordion-button-padding-x};
|
|
|
|
--#{$prefix}accordion-btn-padding-y: #{$accordion-button-padding-y};
|
|
|
|
--#{$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
|
|
|
|
}
|
|
|
|
|
2020-11-02 14:36:51 -05:00
|
|
|
.accordion-button {
|
2020-11-03 15:56:24 -05:00
|
|
|
position: relative;
|
2020-11-02 14:36:51 -05:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
width: 100%;
|
2022-03-28 18:05:37 -04:00
|
|
|
padding: var(--#{$prefix}accordion-btn-padding-y) var(--#{$prefix}accordion-btn-padding-x);
|
2020-11-02 14:36:51 -05:00
|
|
|
@include font-size($font-size-base);
|
2022-03-28 18:05:37 -04:00
|
|
|
color: var(--#{$prefix}accordion-color);
|
2021-02-03 14:44:48 -05:00
|
|
|
text-align: left; // Reset button style
|
2020-11-02 14:36:51 -05:00
|
|
|
background-color: $accordion-button-bg;
|
2021-03-17 01:16:03 -04:00
|
|
|
border: 0;
|
2020-11-02 14:36:51 -05:00
|
|
|
@include border-radius(0);
|
|
|
|
overflow-anchor: none;
|
2020-11-05 15:18:38 -05:00
|
|
|
@include transition($accordion-transition);
|
|
|
|
|
2020-11-02 14:36:51 -05:00
|
|
|
&:not(.collapsed) {
|
2022-03-28 18:05:37 -04:00
|
|
|
color: var(--#{$prefix}accordion-active-color);
|
|
|
|
background-color: var(--#{$prefix}accordion-active-bg);
|
|
|
|
box-shadow: inset 0 calc(var(--#{$prefix}accordion-border-width) * -1) 0 var(--#{$prefix}accordion-border-color); // stylelint-disable-line function-disallowed-list
|
2020-11-02 14:36:51 -05:00
|
|
|
|
|
|
|
&::after {
|
|
|
|
background-image: escape-svg($accordion-button-active-icon);
|
|
|
|
transform: $accordion-icon-transform;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Accordion icon
|
|
|
|
&::after {
|
|
|
|
flex-shrink: 0;
|
|
|
|
width: $accordion-icon-width;
|
|
|
|
height: $accordion-icon-width;
|
|
|
|
margin-left: auto;
|
|
|
|
content: "";
|
|
|
|
background-image: escape-svg($accordion-button-icon);
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-size: $accordion-icon-width;
|
|
|
|
@include transition($accordion-icon-transition);
|
|
|
|
}
|
|
|
|
|
2020-11-03 15:56:24 -05:00
|
|
|
&:hover {
|
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
|
2020-11-02 14:36:51 -05:00
|
|
|
&:focus {
|
2020-11-03 15:56:24 -05:00
|
|
|
z-index: 3;
|
2020-11-05 15:18:38 -05:00
|
|
|
border-color: $accordion-button-focus-border-color;
|
2020-11-02 14:36:51 -05:00
|
|
|
outline: 0;
|
2020-11-05 15:18:38 -05:00
|
|
|
box-shadow: $accordion-button-focus-box-shadow;
|
2020-11-02 14:36:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-header {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-item {
|
2021-10-29 01:53:42 -04:00
|
|
|
color: color-contrast($accordion-bg);
|
2022-03-28 18:05:37 -04:00
|
|
|
background-color: var(--#{$prefix}accordion-bg);
|
|
|
|
border: var(--#{$prefix}accordion-border-width) solid var(--#{$prefix}accordion-border-color);
|
2021-03-17 01:16:03 -04:00
|
|
|
|
2020-11-05 15:18:38 -05:00
|
|
|
&:first-of-type {
|
2022-03-28 18:05:37 -04:00
|
|
|
@include border-top-radius(var(--#{$prefix}accordion-border-radius));
|
2021-03-17 01:16:03 -04:00
|
|
|
|
2020-11-05 15:18:38 -05:00
|
|
|
.accordion-button {
|
2022-03-28 18:05:37 -04:00
|
|
|
@include border-top-radius($accordion-inner-border-radius); // todo
|
2020-11-05 15:18:38 -05:00
|
|
|
}
|
|
|
|
}
|
2020-11-02 14:36:51 -05:00
|
|
|
|
2021-04-30 03:59:54 -04:00
|
|
|
&:not(:first-of-type) {
|
|
|
|
border-top: 0;
|
|
|
|
}
|
|
|
|
|
2021-03-17 01:16:03 -04:00
|
|
|
// Only set a border-radius on the last item if the accordion is collapsed
|
2020-11-02 14:36:51 -05:00
|
|
|
&:last-of-type {
|
2022-03-28 18:05:37 -04:00
|
|
|
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
2021-03-17 01:16:03 -04:00
|
|
|
|
2020-11-02 14:36:51 -05:00
|
|
|
.accordion-button {
|
|
|
|
&.collapsed {
|
2022-03-28 18:05:37 -04:00
|
|
|
@include border-bottom-radius($accordion-inner-border-radius); // todo
|
2020-11-02 14:36:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-05 15:18:38 -05:00
|
|
|
.accordion-collapse {
|
2022-03-28 18:05:37 -04:00
|
|
|
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
|
2020-11-02 14:36:51 -05:00
|
|
|
}
|
|
|
|
}
|
2020-11-05 15:18:38 -05:00
|
|
|
}
|
2020-11-02 14:36:51 -05:00
|
|
|
|
|
|
|
.accordion-body {
|
2022-03-28 18:05:37 -04:00
|
|
|
padding: var(--#{$prefix}accordion-body-padding-y) var(--#{$prefix}accordion-body-padding-x);
|
2020-11-02 14:36:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Flush accordion items
|
|
|
|
//
|
|
|
|
// Remove borders and border-radius to keep accordion items edge-to-edge.
|
|
|
|
|
|
|
|
.accordion-flush {
|
2020-11-05 15:18:38 -05:00
|
|
|
.accordion-collapse {
|
2020-11-02 14:36:51 -05:00
|
|
|
border-width: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.accordion-item {
|
2021-03-22 16:01:08 -04:00
|
|
|
border-right: 0;
|
|
|
|
border-left: 0;
|
2021-03-17 01:16:03 -04:00
|
|
|
@include border-radius(0);
|
2020-11-02 14:36:51 -05:00
|
|
|
|
2021-03-22 16:01:08 -04:00
|
|
|
&:first-child { border-top: 0; }
|
|
|
|
&:last-child { border-bottom: 0; }
|
|
|
|
|
2021-03-17 01:16:03 -04:00
|
|
|
.accordion-button {
|
|
|
|
@include border-radius(0);
|
2020-11-02 14:36:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|