-
Notifications
You must be signed in to change notification settings - Fork 41
Feature/svelte portal 301 #302
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ dist | |
|
||
# test coverage reports | ||
coverage | ||
text-results/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -423,6 +423,11 @@ Full list of props/bindable variables for this component. The `Option` type you | |
|
||
If `maxSelect={1}`, `value` will be the single item in `selected` (or `null` if `selected` is empty). If `maxSelect != 1`, `maxSelect` and `selected` are equal. Warning: Setting `value` does not rendered state on initial mount, meaning `bind:value` will update local variable `value` whenever internal component state changes but passing a `value` when component first mounts won't be reflected in UI. This is because the source of truth for rendering is `bind:selected`. `selected` is reactive to `value` internally but only on reassignment from initial value. Suggestions for better solutions than [#249](https://github.com/janosh/svelte-multiselect/issues/249) welcome! | ||
|
||
1. ```ts | ||
fixed: boolean | null = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the purpose of allowing also, can we find a more descriptive name than |
||
``` | ||
if fixed is set, will cause the dropdown to be rendered with popper.js fixed strategy, enabling the dropdown to expand outside it's parent. This is good for modals / scrollable containers. | ||
|
||
## 🎰   Slots | ||
|
||
`MultiSelect.svelte` accepts the following named slots: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<script lang="ts"> | ||
import hljs from 'highlight.js/lib/common' | ||
import 'highlight.js/styles/vs2015.css' | ||
import store_src from '$site/stores.ts?raw' | ||
</script> | ||
|
||
|
||
# Fixed Position | ||
Often times you want the dropdown to escape a modal or a parent that forces the dropdown to scroll inside of it. | ||
|
||
svelte-popper.js is used to position the dropdown. By default it is in absolute mode, but by specifying the fixed prop it sets popper.js to fixed mode, enabling the dropdown to expand outside of it's parent. | ||
|
||
Below is an example where fixed position is useful, a div that has a fixed height and scroll. | ||
|
||
```css | ||
<style> | ||
#wrapper { | ||
height: 200px; | ||
overflow: auto; | ||
background-color: #00023A; | ||
} | ||
</style> | ||
``` | ||
|
||
|
||
|
||
|
||
## Without fixed | ||
|
||
<br /> | ||
|
||
```svelte example stackblitz id="without-fixed" | ||
<script> | ||
import MultiSelect from 'svelte-multiselect' | ||
import { languages } from '$site/options' | ||
import { language_store } from '$site/stores' | ||
</script> | ||
|
||
<div id="wrapper"> | ||
<MultiSelect | ||
options={languages} | ||
bind:selected={$language_store} | ||
> | ||
</MultiSelect> | ||
</div> | ||
|
||
<style> | ||
#wrapper { | ||
height: 200px; | ||
overflow: auto; | ||
background-color: #00023A; | ||
} | ||
</style> | ||
``` | ||
|
||
## With fixed | ||
|
||
the fixed prop enables the dropdown to be positioned fixed, and | ||
|
||
<br /> | ||
|
||
```svelte example stackblitz id="with-fixed" | ||
<script> | ||
import MultiSelect from 'svelte-multiselect' | ||
import { languages } from '$site/options' | ||
import { language_store } from '$site/stores' | ||
</script> | ||
|
||
<div id="wrapper"> | ||
<MultiSelect | ||
options={languages} | ||
bind:selected={$language_store} | ||
fixed | ||
> | ||
</MultiSelect> | ||
</div> | ||
|
||
<style> | ||
#wrapper { | ||
height: 200px; | ||
overflow: auto; | ||
background-color: #00023A; | ||
} | ||
</style> | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/bryanmylee/svelte-popperjs looks to be unmaintained (last commit 2 years ago) and i think i read that the next major Svelte release is expected to break backward compatibility with Svelte 4. so adding this dependency could become an anchor to Svelte 5 in the future. let's try to minimize the number of new packages added for this feature