Skip to content

Commit

Permalink
feat: multiselect migration (#654)
Browse files Browse the repository at this point in the history
* feat(multiselect): migrate component
All instances of vue-multiselect have been replaced by @vueform/multiselect
Logic and styles have been ported.
Accessibility and looks have been enhanced.

* feat(multiselect): remove dep
* feat(multiselect): global debounce wait time util
  • Loading branch information
narduin authored Feb 4, 2025
1 parent 5c62253 commit 2c77392
Show file tree
Hide file tree
Showing 22 changed files with 257 additions and 271 deletions.
2 changes: 2 additions & 0 deletions configs/defis/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ website:
display: false
content: Notice avec un [lien beta](/beta) et du _style_
closeable: false
# debounce high enough for accessibility (screen readers will announce results)
default_debounce_wait: 600
# display settings
pagination_sizes:
organizations_list: 9
Expand Down
2 changes: 2 additions & 0 deletions configs/ecospheres/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ website:
list_search_topics:
url_search_topics:
oauth_option: true
# debounce high enough for accessibility (screen readers will announce results)
default_debounce_wait: 600
pagination_sizes:
organizations_list: 9
topics_list: 100
Expand Down
2 changes: 2 additions & 0 deletions configs/hackathon/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ website:
display: false
content: Notice avec un [lien beta](/beta) et du _style_
closeable: false
# debounce high enough for accessibility (screen readers will announce results)
default_debounce_wait: 600
# display settings
pagination_sizes:
organizations_list: 9
Expand Down
2 changes: 2 additions & 0 deletions configs/logistique/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ website:
display: false
content: Notice avec un [lien beta](/beta) et du _style_
closeable: false
# debounce high enough for accessibility (screen readers will announce results)
default_debounce_wait: 600
# display settings
pagination_sizes:
organizations_list: 9
Expand Down
2 changes: 2 additions & 0 deletions configs/meteo-france/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ website:
display: false
content: Notice avec un [lien beta](/beta) et du _style_
closeable: false
# debounce high enough for accessibility (screen readers will announce results)
default_debounce_wait: 600
# display settings
pagination_sizes:
organizations_list: 9
Expand Down
2 changes: 2 additions & 0 deletions configs/simplification/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ website:
display: false
content: Notice avec un [lien beta](/beta) et du _style_
closeable: false
# debounce high enough for accessibility (screen readers will announce results)
default_debounce_wait: 600
# display settings
pagination_sizes:
organizations_list: 9
Expand Down
19 changes: 4 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@json2csv/plainjs": "^7.0.6",
"@unhead/vue": "^1.11.18",
"@vee-validate/rules": "^4.15.0",
"@vueform/multiselect": "^2.6.10",
"@vueform/multiselect": "^2.6.11",
"@vueuse/core": "^12.4.0",
"@vueuse/integrations": "^12.4.0",
"axios": "^1.7.9",
Expand All @@ -39,7 +39,6 @@
"vue": "^3.5.13",
"vue-loading-overlay": "^6.0.6",
"vue-matomo": "^4.2.0",
"vue-multiselect": "^3.1.0",
"vue-router": "^4.5.0",
"vue3-text-clamp": "^0.1.2",
"vue3-toastify": "^0.2.8"
Expand Down
1 change: 1 addition & 0 deletions src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--blue-france-950-100: var(--blue-cumulus-950-100);
--blue-france-950-100-hover: var(--blue-cumulus-950-100-hover);
--blue-france-950-100-active: var(--blue-cumulus-950-100-active);
--blue-france-sun-113: #000091;
--blue-france-sun-113-625: var(--blue-cumulus-sun-368-moon-732);
--blue-france-sun-113-625-hover: var(--blue-cumulus-sun-368-moon-732-hover);
--blue-france-sun-113-625-active: var(--blue-cumulus-sun-368-moon-732-active);
Expand Down
139 changes: 49 additions & 90 deletions src/assets/multiselect.css
Original file line number Diff line number Diff line change
@@ -1,108 +1,67 @@
.multiselect__option,
.multiselect__single {
white-space: normal;
h4 {
font-size: 1.2rem;
.multiselect {
--ms-max-height: 20rem;
--ms-bg: var(--background-contrast-grey);
--ms-spinner-color: var(--blue-cumulus-sun-368-moon-732);
--ms-option-bg-selected: var(--blue-cumulus-sun-368-moon-732);
--ms-option-bg-pointed: var(--blue-cumulus-sun-368-moon-732);
--ms-option-color-pointed: var(--background-contrast-grey);
--ms-option-bg-selected-pointed: var(--blue-cumulus-sun-368-moon-732-hover);
&&,
&&.is-active {
border: none;
box-shadow: none;
}
}
.multiselect__option--highlight {
background-color: var(--background-alt-grey-active);
color: var(--text-default-grey);
}
.multiselect__option--highlight::after {
background-color: var(--background-alt-grey-active);
color: var(--text-default-grey);
}
.multiselect__spinner::before,
.multiselect__spinner::after {
border-color: var(--background-alt-grey-active) transparent transparent;
top: 60%;
}
.multiselect__select {
--data-uri-svg: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23161616' d='m12 13.1 5-4.9 1.4 1.4-6.4 6.3-6.4-6.4L7 8.1l5 5z'/%3E%3C/svg%3E");
background-image: var(--data-uri-svg);
background-position: calc(100% - 1rem) 50%;
background-repeat: no-repeat;
background-size: 1rem 1rem;
.multiselect--active & {
.multiselect-caret {
--ms-px: 1rem;
--data-uri-svg: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23161616' d='m12 13.1 5-4.9 1.4 1.4-6.4 6.3-6.4-6.4L7 8.1l5 5z'/%3E%3C/svg%3E");
-webkit-mask-image: var(--data-uri-svg);
mask-image: var(--data-uri-svg);
width: 1.1rem;
transition: none;
}
.multiselect-caret.is-open {
transform: none;
transition: none;
}
}
.multiselect__select::before {
content: unset;
}
.multiselect__clear {
position: absolute;
right: 15px;
height: 40px;
width: 40px;
display: block;
cursor: pointer;
z-index: 3;
.multiselect-option {
position: relative;

&:before,
&:after {
content: '';
display: block;
position: absolute;
width: 3px;
height: 16px;
background-color: var(--border-plain-grey);
top: 30%;
right: 4px;
}
&:has(button) {
padding: 0;
}

&:before {
transform: rotate(45deg);
}
button {
--hover-tint: inherit;
--active-tint: var(--background-action-high-blue-france-active);
padding: 0.75rem;
block-size: 100%;
inline-size: 100%;
text-align: left;

&:after {
transform: rotate(-45deg);
&:focus {
outline-offset: -4px;
}
}

&.is-pointed {
button:focus {
outline-color: var(--background-default-grey);
}
}
}
.multiselect-dropdown {
overflow-y: auto;
}
}
.multiselect {
--ms-bg: var(--background-contrast-grey);
}
.multiselect:has(.multiselect-single-label .card) {
--ms-bg: var(--background-default-grey);
border: 1px solid var(--background-contrast-grey);
}
.multiselect-wrapper {
--ms-radius: 0.25rem 0.25rem 0 0;
--ms-caret-color: var(--border-plain-grey);
}
/* dsfr-input style */
.multiselect-search {
box-shadow: inset 0 -2px 0 0 var(--border-plain-grey);
}
.multiselect__tags {
--idle: transparent;
--hover: var(--background-contrast-grey-hover);
--active: var(--background-contrast-grey-active);
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
background-color: var(--background-contrast-grey);
border: 0;
box-shadow: inset 0 -2px 0 0 var(--border-plain-grey);
color: var(--text-title-grey);
display: block;
font-size: 1rem;
line-height: 1.5rem;
padding: 0.5rem 2.5rem 0.5rem 1rem;
width: 100%;
border-radius: 0.25rem 0.25rem 0 0;
& > .multiselect__single {
padding: 0;
background-color: var(--background-contrast-grey);
}
}
.multiselect__tags:focus-within {
outline: 2px solid #0a76f6;
outline-offset: -2px;
}
.multiselect__input {
padding: 0;
background-color: transparent;
}
.multiselect__placeholder {
color: var(--text-default-grey);
}
Loading

0 comments on commit 2c77392

Please sign in to comment.