-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #722 from MisRob/teleport
Let's teleport + make 'sidebar' icon flip in RTL languages
- Loading branch information
Showing
13 changed files
with
194 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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,29 @@ | ||
<template> | ||
|
||
<DocsPageTemplate apiDocs> | ||
<DocsPageSection title="Overview" anchor="#overview"> | ||
<p>Use <code>KOverlay</code> to move an element from its original place in the DOM to the overlay container element <code>#k-overlay</code> that is inserted to an application's document body automatically <DocsInternalLink href="/installation#install-plugin" text="during the KDS installation process" />. This is often useful for modals, tooltips, dropdowns, or other elements that should appear on top of other content.</p> | ||
</DocsPageSection> | ||
|
||
<DocsPageSection title="Usage" anchor="#usage"> | ||
<p>First, check whether you need <code>KOverlay</code>. Some KDS components already utilize it internally and you only need to instruct them to activate it, typically via the <code>appendToOverlay</code> prop.</p> | ||
|
||
<p>If you need to use <code>KOverlay</code>, simply wrap an element or a component in it:</p> | ||
|
||
<DocsShowCode language="html"> | ||
<KOverlay> | ||
<YourComponent /> | ||
</KOverlay> | ||
</DocsShowCode> | ||
</DocsPageSection> | ||
|
||
<DocsPageSection title="Related" anchor="#related"> | ||
<ul> | ||
<li> | ||
<DocsInternalLink href="/installation#install-plugin" text="KDS installation step" /> that attaches the overlay container element <code>#k-overlay</code> to an application's document body | ||
</li> | ||
</ul> | ||
</DocsPageSection> | ||
</DocsPageTemplate> | ||
|
||
</template> |
This file contains 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 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 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 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 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,36 @@ | ||
<template> | ||
|
||
<Teleport :to="overlayElSelector"> | ||
<!-- @slot Content to be moved to the overlay container element `#k-overlay` --> | ||
<slot></slot> | ||
</Teleport> | ||
|
||
</template> | ||
|
||
|
||
<script> | ||
import Teleport from 'vue2-teleport'; | ||
import _useOverlay from '../composables/_useOverlay'; | ||
/** | ||
* Moves an element from its original place in the DOM | ||
* to the overlay container element #k-overlay that is inserted | ||
* to an application's document body automatically during | ||
* the KDS installation process (see KThemePlugin.js). | ||
* This is often useful for modals, tooltips, dropdowns, or other | ||
* elements that should appear on top of other content. | ||
*/ | ||
export default { | ||
name: 'KOverlay', | ||
components: { | ||
Teleport, | ||
}, | ||
setup() { | ||
const { overlayElSelector } = _useOverlay(); | ||
return { overlayElSelector }; | ||
}, | ||
}; | ||
</script> | ||
|
This file contains 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 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 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 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,10 @@ | ||
describe('_useOverlay', () => { | ||
// this is taken care of by KThemePlugin.js that is already registered | ||
// in the global jest setup | ||
it(`document body contains the overlay container element #k-overlay upon the KDS plugin initialization`, () => { | ||
expect(` | ||
<div id="k-overlay"> | ||
</div> | ||
`).toBeInDom(); | ||
}); | ||
}); |
Oops, something went wrong.