2020-03-03 16:23:03 +01:00
|
|
|
<script>
|
2020-03-04 17:48:51 +01:00
|
|
|
import "@material/select/helper-text/mdc-select-helper-text.scss"
|
2020-03-03 16:23:03 +01:00
|
|
|
import { onMount } from "svelte"
|
|
|
|
import { MDCSelectHelperText } from "@material/select/helper-text"
|
|
|
|
import ClassBuilder from "../ClassBuilder.js"
|
|
|
|
|
|
|
|
const cb = new ClassBuilder("select-helper-text")
|
|
|
|
|
|
|
|
let helperText
|
|
|
|
let instance
|
|
|
|
|
|
|
|
export let id = ""
|
|
|
|
export let text = ""
|
|
|
|
export let persistent = false
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
if (!!helperText) {
|
|
|
|
instance = new MDCSelectHelperText(helperText)
|
|
|
|
return () => {
|
|
|
|
instance && instance.destroy()
|
|
|
|
instance = null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
$: modifiers = { persistent }
|
|
|
|
$: props = { modifiers }
|
|
|
|
$: helperClass = cb.build({ props })
|
|
|
|
</script>
|
|
|
|
|
2020-03-04 12:02:17 +01:00
|
|
|
<p bind:this={helperText} {id} class={helperClass} aria-hidden="true">{text}</p>
|