refac
This commit is contained in:
@@ -4,18 +4,18 @@
|
||||
export let value = '';
|
||||
export let placeholder = '';
|
||||
export let rows = 1;
|
||||
export let minSize = null;
|
||||
export let maxSize = null;
|
||||
export let minSize: number | null = null;
|
||||
export let maxSize: number | null = null;
|
||||
export let required = false;
|
||||
export let readonly = false;
|
||||
export let className =
|
||||
'w-full rounded-lg px-3.5 py-2 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden h-full';
|
||||
export let ariaLabel = null;
|
||||
export let ariaLabel: string | null = null;
|
||||
|
||||
export let onInput = () => {};
|
||||
export let onBlur = () => {};
|
||||
export let onInput: (event: Event) => void = () => {};
|
||||
export let onBlur: (event: FocusEvent) => void = () => {};
|
||||
|
||||
let textareaElement;
|
||||
let textareaElement: HTMLTextAreaElement | null = null;
|
||||
|
||||
// Adjust height on mount and after setting the element.
|
||||
onMount(async () => {
|
||||
@@ -38,7 +38,7 @@
|
||||
// Find all ancestors that currently have an active scroll offset.
|
||||
// This is extremely fast because reading `scrollTop` on a clean layout doesn't trigger reflow,
|
||||
// and it makes the fix 100% robust without relying on hardcoded CSS classes.
|
||||
let activeScrollParents = [];
|
||||
const activeScrollParents: { el: HTMLElement; top: number }[] = [];
|
||||
let p = textareaElement.parentNode;
|
||||
while (p && p !== document.body) {
|
||||
if (p instanceof HTMLElement && p.scrollTop > 0) {
|
||||
@@ -91,4 +91,4 @@
|
||||
resize();
|
||||
}}
|
||||
on:blur={onBlur}
|
||||
/>
|
||||
></textarea>
|
||||
|
||||
Reference in New Issue
Block a user