Use slots to render lightning bolt icons in the correct position regardless of labels
This commit is contained in:
parent
99abeb4104
commit
dfdb23f2a7
|
@ -75,6 +75,7 @@
|
|||
class:is-disabled={disabled}
|
||||
class:is-focused={isFocused}
|
||||
>
|
||||
<!-- We need to ignore prettier here as we want no whitespace -->
|
||||
<!-- prettier-ignore -->
|
||||
<textarea
|
||||
bind:this={textarea}
|
||||
|
@ -90,6 +91,7 @@
|
|||
on:blur
|
||||
on:keypress
|
||||
>{value || ""}</textarea>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
inputmode={getInputMode(type)}
|
||||
autocomplete={autocompleteValue}
|
||||
/>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -41,5 +41,7 @@
|
|||
on:blur
|
||||
on:focus
|
||||
on:keyup
|
||||
/>
|
||||
>
|
||||
<slot />
|
||||
</TextField>
|
||||
</Field>
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
export let label: string | undefined = undefined
|
||||
export let labelPosition = "above"
|
||||
export let placeholder: string | undefined = undefined
|
||||
export let disabled = false
|
||||
export let readonly: boolean = false
|
||||
export let disabled: boolean = false
|
||||
export let error: string | undefined = undefined
|
||||
export let height: number | undefined = undefined
|
||||
export let minHeight: number | undefined = undefined
|
||||
export let helpText: string | undefined = undefined
|
||||
export let updateOnChange: boolean = false
|
||||
|
||||
let textarea: TextArea
|
||||
export function focus() {
|
||||
|
@ -33,11 +35,16 @@
|
|||
<TextArea
|
||||
bind:this={textarea}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{value}
|
||||
{placeholder}
|
||||
{height}
|
||||
{minHeight}
|
||||
{updateOnChange}
|
||||
on:change={onChange}
|
||||
on:keypress
|
||||
/>
|
||||
on:scrollable
|
||||
>
|
||||
<slot />
|
||||
</TextArea>
|
||||
</Field>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { Icon, Input, Drawer, Button, CoreTextArea } from "@budibase/bbui"
|
||||
import { Icon, Input, Drawer, Button, TextArea } from "@budibase/bbui"
|
||||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
|
@ -67,7 +67,7 @@
|
|||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div class="control" class:multiline class:disabled class:scrollable>
|
||||
<svelte:component
|
||||
this={multiline ? CoreTextArea : Input}
|
||||
this={multiline ? TextArea : Input}
|
||||
{label}
|
||||
{disabled}
|
||||
readonly={isJS}
|
||||
|
@ -78,7 +78,7 @@
|
|||
{placeholder}
|
||||
{updateOnChange}
|
||||
{autocomplete}
|
||||
/>
|
||||
>
|
||||
{#if !disabled && !disableBindings}
|
||||
<div
|
||||
class="icon"
|
||||
|
@ -90,6 +90,7 @@
|
|||
<Icon size="S" name="FlashOn" />
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:component>
|
||||
</div>
|
||||
<Drawer
|
||||
on:drawerHide={onDrawerHide}
|
||||
|
|
Loading…
Reference in New Issue