@isoftdata/svelte-textarea
Advanced tools
+15
-1
@@ -5,2 +5,4 @@ <script lang="ts"> | ||
| import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements' | ||
| import lazyAction from '@isoftdata/svelte-action-form-lazy' | ||
| import { getEventValue } from '@isoftdata/browser-event' | ||
@@ -24,2 +26,4 @@ const uid = $props.id() | ||
| title?: string | undefined | ||
| /** When using binding, `true` means the value will update `onchange`, `false` means `oninput`. A millisecond number value indicates the delay from the last UI interaction(debouncing) */ | ||
| lazy?: boolean | number | ||
| value: string | null | ||
@@ -47,2 +51,3 @@ textarea?: HTMLTextAreaElement | undefined | ||
| title = undefined, | ||
| lazy = false, | ||
| value = $bindable(), | ||
@@ -88,3 +93,12 @@ textarea = $bindable(undefined), | ||
| {...rest} | ||
| bind:value | ||
| {value} | ||
| use:lazyAction={{ | ||
| lazy, | ||
| oninput: (e: Event) => { | ||
| value = getEventValue(e) | ||
| }, | ||
| onchange: (e: Event) => { | ||
| value = getEventValue(e) | ||
| }, | ||
| }} | ||
| onfocus={event => { | ||
@@ -91,0 +105,0 @@ doSelectOnFocus(event) |
@@ -19,2 +19,4 @@ import Label from '@isoftdata/svelte-label'; | ||
| title?: string | undefined; | ||
| /** When using binding, `true` means the value will update `onchange`, `false` means `oninput`. A millisecond number value indicates the delay from the last UI interaction(debouncing) */ | ||
| lazy?: boolean | number; | ||
| value: string | null; | ||
@@ -21,0 +23,0 @@ textarea?: HTMLTextAreaElement | undefined; |
+17
-13
| { | ||
| "name": "@isoftdata/svelte-textarea", | ||
| "version": "2.0.0", | ||
| "scripts": { | ||
| "dev": "vite dev", | ||
| "build": "vite build && npm run package", | ||
| "preview": "vite preview", | ||
| "package": "svelte-kit sync && svelte-package && publint", | ||
| "prepublishOnly": "npm run package", | ||
| "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
| "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
| "lint": "prettier --plugin-search-dir . --check . && eslint .", | ||
| "format": "prettier --plugin-search-dir . --write ." | ||
| }, | ||
| "version": "2.1.0", | ||
| "exports": { | ||
@@ -55,6 +44,21 @@ ".": { | ||
| "dependencies": { | ||
| "@isoftdata/browser-event": "^2.3.2", | ||
| "@isoftdata/svelte-action-form-lazy": "^1.0.0", | ||
| "@isoftdata/svelte-label": "^2.0.0", | ||
| "@isoftdata/utility-bootstrap": "^2.2.0", | ||
| "svelte": "^5.23.2" | ||
| }, | ||
| "engines": { | ||
| "pnpm": "10.x" | ||
| }, | ||
| "scripts": { | ||
| "dev": "vite dev", | ||
| "build": "vite build && npm run package", | ||
| "preview": "vite preview", | ||
| "package": "svelte-kit sync && svelte-package && publint", | ||
| "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
| "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
| "lint": "prettier --plugin-search-dir . --check . && eslint .", | ||
| "format": "prettier --plugin-search-dir . --write ." | ||
| } | ||
| } | ||
| } |
+3
-2
@@ -5,4 +5,4 @@ # Svelte Textarea | ||
| ```bash | ||
| npm i @isoftdata/svelte-textarea | ||
| ```sh | ||
| pnpm i @isoftdata/svelte-textarea | ||
| ``` | ||
@@ -30,2 +30,3 @@ | ||
| | labelParentClass | `ClassValue` | The class name(s) to add to the label's parent. | `undefined` | | ||
| | lazy | `boolean \| number` | When using binding, `true` means the value will update `onchange`, `false` means `oninput`. A millisecond number value indicates the delay from the last UI interaction(debouncing) | `false` | | ||
| | required | `boolean` | Whether the field is required or not. | `false` | | ||
@@ -32,0 +33,0 @@ | selectOnFocus | `boolean` | Whether to select the text on focus or not. | `false` | |
8040
13.78%31
6.9%68
1.49%6
50%