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/dropdown") {
|
|
|
|
|
/**
|
|
|
|
|
* Dropdown ([role="list"])
|
|
|
|
|
*/
|
2022-02-28 01:57:59 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Container
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
// 1. Container type accordion
|
2022-10-23 10:47:50 +07:00
|
|
|
|
details[role="list"],
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// 2. Container type nested list
|
|
|
|
|
nav li:has(button, a):has(li) {
|
2022-10-23 10:47:50 +07:00
|
|
|
|
position: relative;
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// margin-bottom: var(#{$✨}spacing);
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
|
|
|
|
|
// Marker
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
summary,
|
|
|
|
|
> button,
|
|
|
|
|
> a {
|
|
|
|
|
&::after {
|
|
|
|
|
display: block;
|
|
|
|
|
width: 1rem;
|
|
|
|
|
height: calc(1rem * var(#{$✨}line-height, 1.5));
|
|
|
|
|
margin-inline-start: 0.25rem;
|
|
|
|
|
float: right;
|
|
|
|
|
// TODO: find out why we need this magic number (0.2 rem)
|
2023-03-15 22:16:28 +07:00
|
|
|
|
// for the marker to be aligned with the regular select
|
2023-01-01 14:00:33 +07:00
|
|
|
|
transform: rotate(0deg) translateX(0.2rem);
|
|
|
|
|
background-image: var(#{$✨}icon-chevron);
|
|
|
|
|
background-position: right center;
|
|
|
|
|
background-size: 1rem auto;
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
content: "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Marker as button
|
|
|
|
|
summary[role="button"],
|
|
|
|
|
> button {
|
|
|
|
|
&::after {
|
|
|
|
|
background-image: var(#{$✨}icon-chevron-button);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if $enable-classes {
|
|
|
|
|
&.outline {
|
|
|
|
|
&::after {
|
|
|
|
|
background-image: var(#{$✨}icon-chevron);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-15 00:14:05 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
&.contrast:not(.outline) {
|
|
|
|
|
&::after {
|
|
|
|
|
background-image: var(#{$✨}icon-chevron-button-contrast);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Container type accordion
|
|
|
|
|
// inside a nav
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
nav details[role="list"] {
|
|
|
|
|
// Override height
|
|
|
|
|
margin-bottom: 0;
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2022-02-28 01:57:59 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Bouton as a select
|
|
|
|
|
// inside container type accordion
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
details[role="list"] summary:not([role]) {
|
|
|
|
|
height: calc(
|
|
|
|
|
1rem *
|
|
|
|
|
var(#{$✨}line-height) +
|
|
|
|
|
var(#{$✨}form-element-spacing-vertical) *
|
|
|
|
|
2 +
|
|
|
|
|
var(#{$✨}border-width) *
|
|
|
|
|
2
|
|
|
|
|
);
|
|
|
|
|
padding: var(#{$✨}form-element-spacing-vertical) var(#{$✨}form-element-spacing-horizontal);
|
|
|
|
|
border: var(#{$✨}border-width) solid var(#{$✨}form-element-border-color);
|
|
|
|
|
border-radius: var(#{$✨}border-radius);
|
|
|
|
|
background-color: var(#{$✨}form-element-background-color);
|
|
|
|
|
color: var(#{$✨}form-element-placeholder-color);
|
|
|
|
|
line-height: inherit;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
user-select: none;
|
|
|
|
|
|
|
|
|
|
@if $enable-transitions {
|
|
|
|
|
transition: background-color var(#{$✨}transition), border-color var(#{$✨}transition),
|
|
|
|
|
color var(#{$✨}transition), box-shadow var(#{$✨}transition);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
|
|
|
|
border-color: var(#{$✨}form-element-active-border-color);
|
|
|
|
|
background-color: var(#{$✨}form-element-active-background-color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
|
box-shadow: 0 0 0 var(#{$✨}outline-width) var(#{$✨}form-element-focus-color);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-28 12:22:55 +07:00
|
|
|
|
// Reset focus visible from accordion component
|
|
|
|
|
&:focus-visible {
|
|
|
|
|
outline: none;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Aria-invalid
|
|
|
|
|
&[aria-invalid="false"] {
|
|
|
|
|
#{$✨}form-element-border-color: var(#{$✨}form-element-valid-border-color);
|
|
|
|
|
#{$✨}form-element-active-border-color: var(#{$✨}form-element-valid-focus-color);
|
|
|
|
|
#{$✨}form-element-focus-color: var(#{$✨}form-element-valid-focus-color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&[aria-invalid="true"] {
|
|
|
|
|
#{$✨}form-element-border-color: var(#{$✨}form-element-invalid-border-color);
|
|
|
|
|
#{$✨}form-element-active-border-color: var(#{$✨}form-element-invalid-focus-color);
|
|
|
|
|
#{$✨}form-element-focus-color: var(#{$✨}form-element-invalid-focus-color);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Bouton as a select
|
|
|
|
|
// inside container type accordion
|
|
|
|
|
// AND inside a nav
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
nav details[role="list"] summary:not([role]) {
|
|
|
|
|
// Override height
|
|
|
|
|
height: auto;
|
|
|
|
|
padding: calc(var(#{$✨}nav-link-spacing-vertical) - (var(#{$✨}border-width) * 2))
|
|
|
|
|
var(#{$✨}nav-link-spacing-horizontal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Submenu
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
// 1. Inside container type accordion
|
2022-10-23 10:47:50 +07:00
|
|
|
|
details[role="list"] summary + ul,
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// 2. Inside container type nested list
|
|
|
|
|
nav li button + ul,
|
|
|
|
|
nav li a + ul {
|
2022-10-23 10:47:50 +07:00
|
|
|
|
display: flex;
|
|
|
|
|
z-index: 99;
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
flex-direction: column;
|
2023-01-01 14:00:33 +07:00
|
|
|
|
width: 100%;
|
|
|
|
|
min-width: fit-content;
|
2022-10-23 10:47:50 +07:00
|
|
|
|
margin: 0;
|
2023-01-01 14:00:33 +07:00
|
|
|
|
margin-top: var(#{$✨}outline-width);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
padding: 0;
|
|
|
|
|
border: var(#{$✨}border-width) solid var(#{$✨}dropdown-border-color);
|
|
|
|
|
border-radius: var(#{$✨}border-radius);
|
|
|
|
|
background-color: var(#{$✨}dropdown-background-color);
|
|
|
|
|
box-shadow: var(#{$✨}dropdown-box-shadow);
|
|
|
|
|
color: var(#{$✨}dropdown-color);
|
|
|
|
|
white-space: nowrap;
|
2023-01-01 14:00:33 +07:00
|
|
|
|
opacity: 0;
|
|
|
|
|
|
|
|
|
|
@if $enable-transitions {
|
|
|
|
|
transition: opacity var(--pico-transition), transform 0s ease-in-out 1s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&[dir="rtl"] {
|
|
|
|
|
right: 0;
|
|
|
|
|
left: auto;
|
|
|
|
|
}
|
2022-10-23 10:47:50 +07:00
|
|
|
|
|
|
|
|
|
li {
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-bottom: 0;
|
2022-10-22 13:11:51 +07:00
|
|
|
|
padding: calc(var(#{$✨}form-element-spacing-vertical) * 0.5)
|
|
|
|
|
var(#{$✨}form-element-spacing-horizontal);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
list-style: none;
|
2022-02-28 01:57:59 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:first-of-type {
|
|
|
|
|
margin-top: calc(var(#{$✨}form-element-spacing-vertical) * 0.5);
|
2022-02-28 01:57:59 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:last-of-type {
|
|
|
|
|
margin-bottom: calc(var(#{$✨}form-element-spacing-vertical) * 0.5);
|
2022-02-28 01:57:59 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
a {
|
|
|
|
|
display: block;
|
|
|
|
|
margin: calc(var(#{$✨}form-element-spacing-vertical) * -0.5)
|
|
|
|
|
calc(var(#{$✨}form-element-spacing-horizontal) * -1);
|
|
|
|
|
padding: calc(var(#{$✨}form-element-spacing-vertical) * 0.5)
|
|
|
|
|
var(#{$✨}form-element-spacing-horizontal);
|
|
|
|
|
overflow: hidden;
|
2023-01-01 14:00:33 +07:00
|
|
|
|
border-radius: 0;
|
2022-10-23 10:47:50 +07:00
|
|
|
|
color: var(#{$✨}dropdown-color);
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
&:hover,
|
|
|
|
|
&:focus,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus-visible {
|
2022-10-23 10:47:50 +07:00
|
|
|
|
background-color: var(#{$✨}dropdown-hover-background-color);
|
|
|
|
|
}
|
2022-02-28 01:57:59 +07:00
|
|
|
|
}
|
2022-12-29 18:00:21 +07:00
|
|
|
|
|
2023-03-19 01:51:49 +07:00
|
|
|
|
label {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
&:has(label):hover {
|
|
|
|
|
background-color: var(#{$✨}dropdown-hover-background-color);
|
2022-12-29 18:00:21 +07:00
|
|
|
|
}
|
2022-02-28 01:57:59 +07:00
|
|
|
|
}
|
2021-12-27 13:55:58 +05:30
|
|
|
|
}
|
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Submenu inside container
|
|
|
|
|
// type nested list
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
nav li button + ul,
|
|
|
|
|
nav li a + ul {
|
|
|
|
|
transform: scaleY(0%);
|
|
|
|
|
transform-origin: top;
|
|
|
|
|
|
|
|
|
|
&:first-of-type,
|
|
|
|
|
&:last-of-type {
|
|
|
|
|
margin-right: var(#{$✨}nav-link-spacing-horizontal);
|
|
|
|
|
margin-left: var(#{$✨}nav-link-spacing-horizontal);
|
2021-12-27 13:55:58 +05:30
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-27 22:43:15 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Button opened
|
|
|
|
|
// inside container type accordion
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
details[role="list"][open] summary {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
}
|
2022-10-23 10:47:50 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Menu opened
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
// 1. Inside container type accordion
|
|
|
|
|
details[role="list"][open] summary,
|
|
|
|
|
// 2. Inside container type nested list
|
|
|
|
|
nav li:has(:focus, :focus-within) button,
|
|
|
|
|
nav li:has(:focus, :focus-within) a {
|
|
|
|
|
+ ul {
|
|
|
|
|
transform: scaleY(1);
|
|
|
|
|
opacity: 1;
|
2023-02-15 00:14:05 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
@if $enable-transitions {
|
|
|
|
|
transition: opacity var(--pico-transition), transform 0s ease-in-out 0s;
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-01 14:00:33 +07:00
|
|
|
|
}
|
2023-03-05 09:20:24 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Menu opened inside container
|
|
|
|
|
// type nested list on a touch device
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
@media (any-hover: none) {
|
|
|
|
|
nav li button,
|
|
|
|
|
nav li a {
|
|
|
|
|
&:hover {
|
|
|
|
|
+ ul {
|
|
|
|
|
transform: scaleY(1);
|
|
|
|
|
opacity: 1;
|
2023-02-15 00:14:05 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
@if $enable-transitions {
|
|
|
|
|
transition: opacity var(--pico-transition), transform 0s ease-in-out 0s;
|
2022-12-29 17:59:44 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-28 01:57:59 +07:00
|
|
|
|
}
|
2022-02-27 22:43:15 +07:00
|
|
|
|
|
2023-01-01 14:00:33 +07:00
|
|
|
|
// Close for dropdown
|
|
|
|
|
// inside container type accordion
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
details[role="list"][open] summary {
|
|
|
|
|
&::before {
|
|
|
|
|
display: block;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
position: fixed;
|
|
|
|
|
width: 100vw;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
inset: 0;
|
|
|
|
|
background: none;
|
|
|
|
|
content: "";
|
|
|
|
|
cursor: default;
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2022-02-27 22:43:15 +07:00
|
|
|
|
}
|
2022-10-15 23:22:12 +07:00
|
|
|
|
}
|