No notes defined.
<div class="sds-monthsPicker sds-stackMd">
<div>
<button type="button" class="sds-actionMenu__yearSelect h5 dropdown-item" data-toggle="collapse" data-target="#monthsPickerYears" aria-expanded="false" aria-controls="monthsPickerYears">
2022
<span class="sds-icon sds-icon-chevrondown"></span>
</button>
</div>
<div class="sds-staticStackMd position-relative" data-js-monthsPicker>
<div class="sds-monthsPicker__inner is-invalid">
<div class="row row-xs no-bottom-gutter">
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Jan
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Fév
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Mar
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Avr
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Mai
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Juin
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Juil
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Aout
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Sep
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Oct
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="">
Nov
</button>
</div>
<div class="sds-monthsPicker__item col-auto d-flex justify-content-center">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-js-monthsPicker-item="" disabled>
Déc
</button>
</div>
</div>
</div>
<button type="button" class="sds-btn -btnPrimary -block" disabled>
<span class="sds-btn__text">Apply</span>
</button>
<div class="sds-monthsPicker__yearSelect collapse" id="monthsPickerYears">
<div class="sds-monthsPicker__inner">
<div class="row row-xs">
<div class="col-auto">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-toggle="collapse" data-target="#actionMenuYears">
2018
</button>
</div>
<div class="col-auto">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-toggle="collapse" data-target="#actionMenuYears">
2019
</button>
</div>
<div class="col-auto">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-toggle="collapse" data-target="#actionMenuYears">
2020
</button>
</div>
<div class="col-auto">
<button type="button" class="sds-btn -iconBtn -btnSecondary -btnHasLabel" data-toggle="collapse" data-target="#actionMenuYears">
2021
</button>
</div>
</div>
</div>
</div>
<div class="invalid-feedback">
Please select a second month
</div>
</div>
</div>
<div class="{{ namespace }}monthsPicker {{ namespace }}stackMd{% for mod in modifiers %} {{ mod }}{% endfor %}{% for mod in classes %} {{ mod }}{% endfor %}">
<div>
<button type="button"
class="{{ namespace }}actionMenu__yearSelect h5 dropdown-item"
data-toggle="collapse"
data-target="#monthsPickerYears"
aria-expanded="false"
aria-controls="monthsPickerYears"
>
2022
<span class="{{ namespace }}icon {{ namespace }}icon-chevrondown"></span>
</button>
</div>
<div class="{{ namespace }}staticStackMd position-relative"{% if range %} data-js-monthsPicker{% endif %}>
<div class="{{ namespace }}monthsPicker__inner{% if error %} is-invalid{% endif %}">
<div class="row row-xs no-bottom-gutter">
{% for key, item in months %}
{% if item %}
<div class="{{ namespace }}monthsPicker__item col-auto d-flex justify-content-center{% if item.active %} -isActive{% endif %}">
{% render "@icon-btn-secondary--has-label",{
text: item.text,
disabled: item.disabled,
classes: item.classes,
attrs: {
"data-js-monthsPicker-item": ""
}
},true %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% render "@btn-primary--full-width",{
text: "Apply",
disabled: error
},true %}
<div class="{{ namespace }}monthsPicker__yearSelect collapse" id="monthsPickerYears">
<div class="{{ namespace }}monthsPicker__inner">
<div class="row row-xs">
{% for key, item in years %}
{% if item %}
<div class="col-auto">
{% render "@icon-btn-secondary--has-label",{
text: item.text,
attrs: {
"data-toggle": "collapse",
"data-target": "#actionMenuYears"
}
},true %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
<div class="invalid-feedback">
Please select a second month
</div>
</div>
</div>
export default class monthsPicker {
constructor() {
this.handleMonthSelection();
}
// JavaScript
handleMonthSelection () {
const monthsPicker = document.querySelector('[data-js-monthsPicker]');
const buttons = monthsPicker.querySelectorAll('[data-js-monthsPicker-item]');
buttons.forEach(button => {
button.addEventListener('click', () => {
const isActive = button.parentNode.classList.contains('-isActive');
const hasNoRange = button.parentNode.classList.contains('-noRange');
const activeButtons = document.querySelectorAll('.-isActive');
// Toggle 'active' class on the clicked button
button.parentNode.classList.toggle('-isActive');
// If two buttons have 'active' class, remove all 'active' classes
if (activeButtons.length === 2) {
activeButtons.forEach(btn => {
btn.classList.remove('-isActive');
monthsPicker.classList.remove("-rangeLocked");
});
}
if (activeButtons.length === 1 && !isActive) {
monthsPicker.classList.add("-rangeLocked")
}
// Toggle 'noRange' class if the button was already active
if (isActive) {
button.parentNode.classList.toggle('-noRange');
monthsPicker.classList.toggle("-noRangeLocked");
} else {
// Remove 'noRange' class from all buttons
buttons.forEach(btn => {
btn.parentNode.classList.remove('-noRange');
monthsPicker.classList.remove("-noRangeLocked");
});
}
});
button.parentNode.addEventListener('mouseenter', () => {
button.parentNode.classList.add('-isHovered');
});
button.parentNode.addEventListener('mouseleave', () => {
button.parentNode.classList.remove('-isHovered');
});
});
}
}
/* variables specific to current element */
$element-specific-variables: "";
.#{$namespace}monthsPicker {
/* Save root element context for easy access if nesting is needed */
$self: &;
/* properties of current element + media queries */
/* Pseudo Elements */
&::before {
}
&::after {
}
/*
Include elements that are linked to the current element but have to reside at the root level of the stylesheet
(e.g: keyframes)
*/
@at-root {
}
/* children - write selector in full in comments in order to facilitate search */
&__body {
}
&__inner {
max-width: 208px;
display: flex;
justify-content: center;
margin: auto;
position: relative;
z-index: z("zero");
}
// monthsPicker__item
&__item {
// follows same logic as parent
$item: &;
$item-offset: map-deep-get($token-spacer-grid-map, "xs");
position: relative;
padding-bottom: $item-offset;
&::before {
content: "";
opacity: 0;
position: absolute;
z-index: z("negative");
top: 0;
bottom: $item-offset;
left: (-(map-deep-get($token-spacer-inset-map, "sm")));
right:(-(map-deep-get($token-spacer-inset-map, "sm")));
margin: auto;
@include custom-prop-fallback("background-color", "comp-button-secondary-background-color");
border-radius: inherit;
}
&:nth-of-type(4n + 1) {
&::before {
left: map-deep-get($token-spacer-inline-map, "sm") !important;
}
}
&:nth-of-type(4n + 4) {
&::before {
right: map-deep-get($token-spacer-inline-map, "sm") !important;
}
}
&.-isActive,
&.-noRange {
border-radius: 50%;
> * {
border-color: inherit;
border-radius: inherit;
@include btn-interaction-base-outline();
@include btn-interaction-active-outline();
}
}
&.-isHovered ~ #{$self}__item {
&::before {
opacity: 0;
}
}
&.-isHovered:not(.-isActive) {
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
border-top-left-radius: 50% !important;
border-bottom-left-radius: 50% !important;
> * {
border-color: inherit;
border-radius: inherit;
@include btn-interaction-base-outline();
@include btn-interaction-active-outline();
}
}
&.-isHovered ~ &.-isActive:not(.-noRange) {
border-top-right-radius: 50% !important;
border-bottom-right-radius: 50% !important;
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
> * {
border-radius: inherit;
}
}
&.-isActive:not(.-noRange) {
// follows same logic as base element
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
> * {
border-radius: inherit;
}
& ~ .-isActive {
border-top-right-radius: 50% !important;
border-bottom-right-radius: 50% !important;
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
> * {
border-radius: inherit;
}
}
& ~ .-isHovered {
> * {
border-top-right-radius: 50% !important;
border-bottom-right-radius: 50% !important;
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
}
}
&.-noRange {
&.-isHovered {
border-radius: 50% !important;
> * {
border-radius: inherit;
}
}
~ .-isHovered {
border-top-right-radius: 50% !important;
border-bottom-right-radius: 50% !important;
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
> * {
border-radius: inherit;
}
}
}
#{$self}:has(&.-isActive) {
#{$self}__item.-isHovered:not(.-noRange) ~ #{$self}__item {
&::before {
opacity: 1;
}
}
}
&.-isHovered:not(.-noRange) + &.-isActive,
&.-isHovered:not(.-noRange) ~ #{$self}__item ~ &.-isActive {
&::before {
right: map-deep-get($token-spacer-inline-map, "sm");
}
}
&.-isHovered:not(.-noRange) + &.-isActive ~ #{$self}__item,
&.-isHovered:not(.-noRange) ~ #{$self}__item ~ &.-isActive ~ #{$self}__item {
&::before {
opacity: 0 !important;
}
}
&.-isActive:not(.-noRange) ~ #{$self}__item {
&::before {
opacity: 1;
}
}
&.-isActive + &.-isHovered,
&.-isActive ~ #{$self}__item ~ &.-isHovered {
&::before {
right: map-deep-get($token-spacer-inline-map, "sm");
border-top-right-radius: 50%;
border-bottom-right-radius: 50%;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
&.-isActive + &.-isHovered ~ #{$self}__item,
&.-isActive ~ #{$self}__item ~ &.-isHovered ~ #{$self}__item {
&::before {
opacity: 0 !important;
}
}
}
/* modifiers */
// timeFrame -rangeLocked
.-rangeLocked {
// follows same logic as base element
#{$self}__item.-isHovered {
border-top-right-radius: 50% !important;
border-top-left-radius: 50% !important;
border-bottom-left-radius: 50% !important;
border-bottom-right-radius: 50% !important;
> * {
border-radius: inherit;
}
& ~ #{$self}__item::before {
opacity: 0 !important;
}
}
#{$self}__item#{$self}__item.-isActive {
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
border-top-left-radius: 50% !important;
border-bottom-left-radius: 50% !important;
> * {
border-radius: inherit;
@include btn-interaction-base-outline();
@include btn-interaction-active-outline();
}
& ~ .-isActive {
border-top-right-radius: 50% !important;
border-bottom-right-radius: 50% !important;
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
> * {
border-radius: inherit;
}
}
}
#{$self}__item.-isActive + #{$self}__item.-isHovered:not(.-isActive),
#{$self}__item.-isActive ~ #{$self}__item ~ #{$self}__item.-isHovered:not(.-isActive) {
&::before {
right: (-(map-deep-get($token-spacer-inline-map, "sm")));
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
#{$self}__item.-isActive:not(.-noRange),
#{$self}__item.-isActive:not(.-noRange) ~ #{$self}__item:not(.-isActive) {
&::before {
opacity: 1 !important;
}
}
#{$self}__item.-isActive:not(.-noRange) ~ #{$self}__item:not(.-isActive) {
border-radius: 0 !important;
> * {
border-radius: 50% !important;
}
}
#{$self}__item.-isActive:not(.-noRange) {
&::before {
left: map-deep-get($token-spacer-inline-map, "sm");
right: (-(map-deep-get($token-spacer-inline-map, "sm")));
}
}
#{$self}__item.-isActive:not(.-noRange) + #{$self}__item.-isActive:not(.-noRange),
#{$self}__item.-isActive:not(.-noRange) ~ #{$self}__item ~ #{$self}__item.-isActive:not(.-noRange) {
&::before {
left: (-(map-deep-get($token-spacer-inline-map, "sm")));
right: map-deep-get($token-spacer-inline-map, "sm");
}
}
#{$self}__item.-isActive:not(.-noRange) + #{$self}__item.-isActive:not(.-noRange) {
&::before {
left: (-(map-deep-get($token-spacer-inline-map, "sm"))) !important;
opacity: 1;
}
}
#{$self}__item.-isActive:not(.-noRange) + #{$self}__item.-isActive:not(.-noRange) ~ #{$self}__item,
#{$self}__item.-isActive:not(.-noRange) ~ #{$self}__item ~ #{$self}__item.-isActive:not(.-noRange) ~ #{$self}__item {
&::before {
opacity: 0 !important;
}
}
}
.-noRangeLocked {
#{$self}__item {
&::before {
opacity: 0 !important;
}
}
}
&.-noRange {
#{$self}__item#{$self}__item {
&.-isActive,
&.-isActive + *,
&.-isActive ~ * {
&::before {
content: none !important;
}
}
&.-isActive {
> * {
border-radius: 50%;
}
}
}
}
&__yearSelect {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100% !important;
@include custom-prop-fallback("background-color", "comp-dropdown-background-color");
opacity: 0;
transition: opacity 0.1s linear !important;
margin: 0;
&.show {
opacity: 1;
}
}
/* random parent element */
/*
*
* Syntax : .randomParentElt & {}
*
*/
/* Pseudo Classes */
&:hover {
@media (hover: hover) {
}
}
&:focus {
}
&:active {
}
&:focus,
&:active {
}
}