2022-10-23 10:47:50 +07:00
|
|
|
@use "sass:map";
|
2022-10-22 13:11:51 +07:00
|
|
|
@use "../settings" as *;
|
2022-10-22 11:44:10 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
@if map.get($modules, "components/accordion") {
|
|
|
|
/**
|
|
|
|
* Accordion (<details>)
|
|
|
|
*/
|
2019-11-27 15:31:49 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
details {
|
|
|
|
display: block;
|
|
|
|
margin-bottom: var(#{$✨}spacing);
|
2022-12-29 17:11:17 +07:00
|
|
|
|
|
|
|
&:not([role="list"], :has(summary[role="button"])) {
|
|
|
|
padding-bottom: var(#{$✨}spacing);
|
|
|
|
border-bottom: var(#{$✨}border-width) solid var(#{$✨}accordion-border-color);
|
|
|
|
}
|
2021-07-02 17:44:25 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
summary {
|
|
|
|
line-height: 1rem;
|
2019-11-27 15:31:49 +07:00
|
|
|
list-style-type: none;
|
2022-10-23 10:47:50 +07:00
|
|
|
cursor: pointer;
|
2019-11-27 15:31:49 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
&:not([role]) {
|
|
|
|
color: var(#{$✨}accordion-close-summary-color);
|
|
|
|
}
|
2020-09-29 08:38:35 +07:00
|
|
|
|
2022-10-22 13:11:51 +07:00
|
|
|
@if $enable-transitions {
|
2022-10-23 10:47:50 +07:00
|
|
|
transition: color var(#{$✨}transition);
|
2020-09-29 08:38:35 +07:00
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
// Reset marker
|
|
|
|
&::-webkit-details-marker {
|
|
|
|
display: none;
|
|
|
|
}
|
2022-01-23 12:45:00 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
&::marker {
|
|
|
|
display: none;
|
2022-01-23 12:45:00 +07:00
|
|
|
}
|
2019-11-27 18:35:03 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
&::-moz-list-bullet {
|
|
|
|
list-style-type: none;
|
|
|
|
}
|
2022-03-06 09:37:03 +07:00
|
|
|
|
2022-01-23 12:45:00 +07:00
|
|
|
// Marker
|
|
|
|
&::after {
|
2022-10-23 10:47:50 +07:00
|
|
|
display: block;
|
|
|
|
width: 1rem;
|
|
|
|
height: 1rem;
|
|
|
|
margin-inline-start: calc(var(#{$✨}spacing, 1rem) * 0.5);
|
|
|
|
float: right;
|
|
|
|
transform: rotate(-90deg);
|
|
|
|
background-image: var(#{$✨}icon-chevron);
|
|
|
|
background-position: right center;
|
|
|
|
background-size: 1rem auto;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
content: "";
|
|
|
|
|
|
|
|
@if $enable-transitions {
|
|
|
|
transition: transform var(#{$✨}transition);
|
|
|
|
}
|
2022-01-23 12:45:00 +07:00
|
|
|
}
|
2019-11-27 18:35:03 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
&:focus {
|
|
|
|
outline: none;
|
|
|
|
|
|
|
|
&:not([role="button"]) {
|
|
|
|
color: var(#{$✨}accordion-active-summary-color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Type button
|
|
|
|
&[role="button"] {
|
|
|
|
width: 100%;
|
|
|
|
text-align: left;
|
|
|
|
|
|
|
|
// Marker
|
|
|
|
&::after {
|
|
|
|
height: calc(1rem * var(#{$✨}line-height, 1.5));
|
|
|
|
background-image: var(#{$✨}icon-chevron-button);
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $enable-classes {
|
|
|
|
// .contrast
|
|
|
|
&:not(.outline).contrast {
|
|
|
|
// Marker
|
|
|
|
&::after {
|
|
|
|
background-image: var(#{$✨}icon-chevron-button-inverse);
|
|
|
|
}
|
2022-01-23 12:45:00 +07:00
|
|
|
}
|
|
|
|
}
|
2019-11-27 18:35:03 +07:00
|
|
|
}
|
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
// Open
|
|
|
|
&[open] {
|
|
|
|
> summary {
|
|
|
|
margin-bottom: calc(var(#{$✨}spacing));
|
2021-07-02 16:54:41 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
&:not([role]) {
|
|
|
|
&:not(:focus) {
|
|
|
|
color: var(#{$✨}accordion-open-summary-color);
|
|
|
|
}
|
2022-01-23 12:45:00 +07:00
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
&::after {
|
|
|
|
transform: rotate(0);
|
|
|
|
}
|
2022-03-06 09:37:03 +07:00
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
}
|
|
|
|
}
|
2021-10-24 02:06:00 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
[dir="rtl"] {
|
|
|
|
details {
|
|
|
|
summary {
|
|
|
|
text-align: right;
|
2022-01-23 12:45:00 +07:00
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
&::after {
|
|
|
|
float: left;
|
|
|
|
background-position: left center;
|
|
|
|
}
|
2021-10-24 02:06:00 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-15 23:22:12 +07:00
|
|
|
}
|