feat(text-area)!: integrate TextArea with v11 (#1967)

This commit is contained in:
Eric Liu 2024-04-29 21:50:33 -07:00 committed by GitHub
commit d7f0ed1947
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 181 additions and 80 deletions

View file

@ -34,6 +34,12 @@ export interface TextAreaProps extends RestProps {
*/
maxCount?: number;
/**
* Specify the counter mode
* @default "character"
*/
counterMode?: "character" | "word";
/**
* Set to `true` to enable the light variant
* @default false
@ -82,6 +88,18 @@ export interface TextAreaProps extends RestProps {
*/
invalidText?: string;
/**
* Set to `true` to indicate an warning state
* @default false
*/
warn?: boolean;
/**
* Specify the warning state text
* @default ""
*/
warnText?: string;
/**
* Set an id for the textarea element
* @default "ccs-" + Math.random().toString(36)
@ -106,10 +124,6 @@ export interface TextAreaProps extends RestProps {
export default class TextArea extends SvelteComponentTyped<
TextAreaProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
change: WindowEventMap["change"];
input: WindowEventMap["input"];
keydown: WindowEventMap["keydown"];
@ -118,5 +132,5 @@ export default class TextArea extends SvelteComponentTyped<
blur: WindowEventMap["blur"];
paste: DocumentAndElementEventHandlersEventMap["paste"];
},
{ labelText: {} }
{ invalidText: {}; labelText: {}; warnText: {} }
> {}

View file

@ -1,25 +1,15 @@
import type { SvelteComponentTyped } from "svelte";
import type { SvelteHTMLElements } from "svelte/elements";
type RestProps = SvelteHTMLElements["div"];
export interface TextAreaSkeletonProps extends RestProps {
export interface TextAreaSkeletonProps {
/**
* Set to `true` to visually hide the label text
* @default false
*/
hideLabel?: boolean;
[key: `data-${string}`]: any;
}
export default class TextAreaSkeleton extends SvelteComponentTyped<
TextAreaSkeletonProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
Record<string, any>,
{}
> {}