mirror of https://github.com/Budibase/budibase.git
committed by
GitHub
20 changed files with 191 additions and 14 deletions
@ -0,0 +1,44 @@ |
|||||
|
<script> |
||||
|
import { onMount } from "svelte" |
||||
|
import { fade } from "svelte/transition" |
||||
|
import { MDCDialog } from "@material/dialog" |
||||
|
import ClassBuilder from "../ClassBuilder.js" |
||||
|
|
||||
|
let dialog |
||||
|
let dialogSurface |
||||
|
let instance |
||||
|
|
||||
|
export let _bb |
||||
|
// TODO: may not be the best way to instantiate the dialog. Check how this will work Budibase side |
||||
|
export let open = true |
||||
|
|
||||
|
onMount(() => { |
||||
|
instance = new MDCDialog(dialog) |
||||
|
return () => { |
||||
|
instance && instance.destroy() |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
$: dialogSurface && _bb.attachChildren(dialogSurface) |
||||
|
|
||||
|
$: { |
||||
|
if (open) { |
||||
|
instance && instance.open() |
||||
|
} else { |
||||
|
instance && instance.close() |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<div bind:this={dialog} class="mdc-dialog"> |
||||
|
<div class="mdc-dialog__container"> |
||||
|
<div |
||||
|
bind:this={dialogSurface} |
||||
|
class="mdc-dialog__surface" |
||||
|
role="alertdialog" |
||||
|
aria-modal="true" |
||||
|
aria-labelledby="my-dialog-title" |
||||
|
aria-describedby="my-dialog-content" /> |
||||
|
</div> |
||||
|
<div class="mdc-dialog__scrim" on:click={() => (open = false)} /> |
||||
|
</div> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<script> |
||||
|
import { onMount } from "svelte" |
||||
|
export let _bb |
||||
|
let dialogActions |
||||
|
|
||||
|
onMount(() => { |
||||
|
_bb.setContext("BBMD:button:context", "mdc-dialog__button") |
||||
|
}) |
||||
|
|
||||
|
$: dialogActions && _bb.attachChildren(dialogActions) |
||||
|
</script> |
||||
|
|
||||
|
<footer bind:this={dialogActions} class="mdc-dialog__actions" /> |
||||
@ -0,0 +1,11 @@ |
|||||
|
<script> |
||||
|
let dialogContent |
||||
|
export let _bb |
||||
|
|
||||
|
$: dialogContent && _bb.attachChildren(dialogContent) |
||||
|
</script> |
||||
|
|
||||
|
<div |
||||
|
class="mdc-dialog__content" |
||||
|
bind:this={dialogContent} |
||||
|
id="my-dialog-content" /> |
||||
@ -0,0 +1,5 @@ |
|||||
|
<script> |
||||
|
export let title = "" |
||||
|
</script> |
||||
|
|
||||
|
<h2 class="mdc-dialog__title" id="my-dialog-title">{title}</h2> |
||||
@ -0,0 +1 @@ |
|||||
|
@import "@material/dialog/mdc-dialog.scss" |
||||
@ -0,0 +1,5 @@ |
|||||
|
import "./_style.scss" |
||||
|
export { default as Dialog } from "./Dialog.svelte" |
||||
|
export { default as DialogActions } from "./DialogActions.svelte" |
||||
|
export { default as DialogContent } from "./DialogContent.svelte" |
||||
|
export { default as DialogHeader } from "./DialogHeader.svelte" |
||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 0 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<span class="mdc-typography--body1">{text}</span> |
<span |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--body1"> |
||||
|
{text} |
||||
|
</span> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 0 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<span class="mdc-typography--caption">{text}</span> |
<span |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--caption"> |
||||
|
{text} |
||||
|
</span> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 5 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<h1 class="mdc-typography--headline1">{text}</h1> |
<h1 |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--headline1"> |
||||
|
{text} |
||||
|
</h1> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 5 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<h2 class="mdc-typography--headline2">{text}</h2> |
<h2 |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--headline2"> |
||||
|
{text} |
||||
|
</h2> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 5 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<h3 class="mdc-typography--headline3">{text}</h3> |
<h3 |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--headline3"> |
||||
|
{text} |
||||
|
</h3> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 5 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<h4 class="mdc-typography--headline4">{text}</h4> |
<h4 |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--headline4"> |
||||
|
{text} |
||||
|
</h4> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 5 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<h5 class="mdc-typography--headline5">{text}</h5> |
<h5 |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--headline5"> |
||||
|
{text} |
||||
|
</h5> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 0 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<span class="mdc-typography--overline">{text}</span> |
<span |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--overline"> |
||||
|
{text} |
||||
|
</span> |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
<script> |
<script> |
||||
export let text = "" |
export let text = "" |
||||
|
export let verticalMargin = 0 |
||||
|
export let horizontalMargin = 0 |
||||
</script> |
</script> |
||||
|
|
||||
<span class="mdc-typography--subtitle1">{text}</span> |
<span |
||||
|
style={`margin: ${verticalMargin}px ${horizontalMargin}px`} |
||||
|
class="mdc-typography--subtitle1"> |
||||
|
{text} |
||||
|
</span> |
||||
|
|||||
Loading…
Reference in new issue