Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve multiselect #3100

Merged
merged 2 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/NcMultiselect/NcMultiselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export default {
}
}
</script>

<style>
.wrapper {
display: flex;
gap: 8px;
align-items: start;
}
</style>
```

### Simple example with objects
Expand Down
54 changes: 30 additions & 24 deletions src/components/NcMultiselect/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,6 @@
z-index: 2 !important;
}

// active state, force the input to be shown, we don't want
// the placeholder or the currently selected options
&.multiselect--active {
/* Opened: force display the input */
input.multiselect__input {
opacity: $opacity_full !important;
cursor: text !important;
// remove border radius on bottom opening
border-radius: var(--border-radius) var(--border-radius) 0 0;
display: block !important;
}

/* multiselect__limit hidden if active */
.multiselect__limit {
display: none;
}
}

// Remove radius on top opening
&.multiselect--active.multiselect--above {
input.multiselect__input {
Expand Down Expand Up @@ -65,13 +47,17 @@
display: flex;
flex-wrap: nowrap;
overflow: hidden;
border: 1px solid var(--color-border-dark);
border: 2px solid var(--color-border-dark);
cursor: pointer;
position: relative;
border-radius: 3px;
min-height: 34px;
border-radius: var(--border-radius-large);
min-height: 44px;
height: 100%;

&:focus, &:hover {
border-color: var(--color-primary);
}

/* tag wrapper */
.multiselect__tags-wrap {
align-items: center;
Expand Down Expand Up @@ -141,6 +127,7 @@
// Align content and make the flow smoother
display: flex;
align-items: center;
font-size: var(--default-font-size);

// Anything inside will trigger the select opening
&, * {
Expand All @@ -165,14 +152,33 @@
position: relative !important;
margin: 0;
opacity: 0;
/* let's leave it on top of tags but hide it */
height: 100% !important;
border: none;
/* override hide to force show the placeholder */
/* only when not active */
cursor: pointer;
/* override inline styling of the lib */
padding: 7px 6px !important;
padding: 7px 4px !important;
display: none;
font-size: var(--default-font-size);
}
}

// active state, force the input to be shown, we don't want
// the placeholder or the currently selected options
&.multiselect--active {
/* Opened: force display the input */
input.multiselect__input {
opacity: $opacity_full !important;
cursor: text !important;
// remove border radius on bottom opening
border-radius: var(--border-radius) var(--border-radius) 0 0;
display: block !important;
padding: 12px 15px !important;
height: 40px !important;
}

/* multiselect__limit hidden if active */
.multiselect__limit {
display: none;
}
}
Expand Down