Use slots to render lightning bolt icons in the correct position regardless of labels

This commit is contained in:
Andrew Kingston 2025-03-26 09:48:44 +00:00
parent 99abeb4104
commit dfdb23f2a7
No known key found for this signature in database
5 changed files with 30 additions and 17 deletions

View File

@ -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>

View File

@ -114,6 +114,7 @@
inputmode={getInputMode(type)}
autocomplete={autocompleteValue}
/>
<slot />
</div>
<style>

View File

@ -41,5 +41,7 @@
on:blur
on:focus
on:keyup
/>
>
<slot />
</TextField>
</Field>

View File

@ -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>

View File

@ -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}