-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor(web-twig, demo): Move Tooltip demo scripts to the demo app
- Loading branch information
Showing
4 changed files
with
43 additions
and
40 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
apps/web-twig-demo/assets/scripts/tooltip-advanced-usage.ts
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,40 @@ | ||
import { Tooltip } from '@lmc-eu/spirit-web/src/js/index.esm'; | ||
|
||
const checkboxFlip = document.getElementById('my-advanced-flip') as HTMLInputElement; | ||
const checkboxFlipCrossAxis = document.getElementById('my-advanced-flip-cross-axis') as HTMLInputElement; | ||
const checkboxShift = document.getElementById('my-advanced-shift') as HTMLInputElement; | ||
const checkboxSize = document.getElementById('my-advanced-size') as HTMLInputElement; | ||
const select = document.getElementById('my-advanced-select') as HTMLSelectElement; | ||
const selectFallback = document.getElementById('my-advanced-select-fallback') as HTMLSelectElement; | ||
|
||
const tooltip = Tooltip.getOrCreateInstance(document.getElementById('my-advanced-tooltip')); | ||
|
||
tooltip.show(); | ||
|
||
checkboxFlip.addEventListener('change', () => tooltip.updateConfig({ enableFlipping: checkboxFlip.checked })); | ||
|
||
checkboxFlipCrossAxis.addEventListener('change', () => { | ||
tooltip.updateConfig({ enableFlippingCrossAxis: checkboxFlipCrossAxis.checked }); | ||
}); | ||
|
||
checkboxShift.addEventListener('change', () => { | ||
tooltip.updateConfig({ enableShifting: checkboxShift.checked }); | ||
}); | ||
|
||
checkboxSize.addEventListener('change', () => { | ||
tooltip.updateConfig({ enableSizing: checkboxSize.checked }); | ||
}); | ||
|
||
select.addEventListener('change', () => { | ||
tooltip.updateConfig({ placement: select.value }); | ||
}); | ||
|
||
selectFallback.addEventListener('change', () => { | ||
tooltip.updateConfig({ flipFallbackPlacements: selectFallback.value }); | ||
}); | ||
|
||
const viewport = document.getElementById('my-advanced-viewport'); | ||
const content = document.getElementById('my-advanced-content'); | ||
|
||
viewport.scrollLeft = (content.offsetWidth - viewport.offsetWidth) / 2; | ||
viewport.scrollTop = (content.offsetHeight - viewport.offsetHeight) / 2; |
2 changes: 1 addition & 1 deletion
2
apps/web-twig-demo/assets/scripts/tooltip-dismissible-via-js.ts
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