Skip to content

Commit

Permalink
feat(core): add textarea component (#132)
Browse files Browse the repository at this point in the history
Co-authored-by: Maurício Mutte <mauriciomutte.mm@gmail.com>
  • Loading branch information
felipefialho and mauriciomutte authored May 25, 2023
1 parent 52ec472 commit d0124db
Show file tree
Hide file tree
Showing 8 changed files with 1,160 additions and 0 deletions.
120 changes: 120 additions & 0 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,59 @@ export namespace Components {
"readonly"?: boolean;
"value"?: IonTypes.IonSelect['value'];
}
interface AtomTextarea {
"autoGrow": boolean;
"autocomplete"?: 'on' | 'off';
"autofocus": boolean;
"clearOnEdit": boolean;
"color"?: 'primary' | 'secondary' | 'danger';
"cols"?: number;
"counter": boolean;
"counterFormatter"?: (
inputLength: number,
maxLength: number
) => string | undefined;
"debounce": number;
"disabled": boolean;
"enterKeyHint": | 'enter'
| 'done'
| 'go'
| 'next'
| 'previous'
| 'search'
| 'send';
"errorText"?: string;
"fill": 'solid' | 'outline';
"getInputElement": () => Promise<HTMLTextAreaElement>;
"hasError": boolean;
"helperText"?: string;
"icon"?: string;
"inputmode"?: | 'none'
| 'text'
| 'tel'
| 'url'
| 'email'
| 'numeric'
| 'decimal'
| 'search';
"label"?: string;
"labelPlacement"?: 'stacked' | 'floating';
"maxlength"?: number;
"minlength"?: number;
"mode": Mode;
"name"?: string;
"pattern"?: string;
"placeholder"?: string;
"readonly": boolean;
"required": boolean;
"rows": number;
"setFocus": () => Promise<void>;
"setInputEl": (textareaEl: HTMLIonTextareaElement) => Promise<void>;
"shape": 'round' | undefined;
"step"?: string;
"value"?: IonTypes.IonTextarea['value'];
"wrap"?: 'hard' | 'soft' | 'off';
}
}
export interface AtomButtonCustomEvent<T> extends CustomEvent<T> {
detail: T;
Expand All @@ -136,6 +189,10 @@ export interface AtomSelectCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLAtomSelectElement;
}
export interface AtomTextareaCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLAtomTextareaElement;
}
declare global {
interface HTMLAtomButtonElement extends Components.AtomButton, HTMLStencilElement {
}
Expand Down Expand Up @@ -179,6 +236,12 @@ declare global {
prototype: HTMLAtomSelectElement;
new (): HTMLAtomSelectElement;
};
interface HTMLAtomTextareaElement extends Components.AtomTextarea, HTMLStencilElement {
}
var HTMLAtomTextareaElement: {
prototype: HTMLAtomTextareaElement;
new (): HTMLAtomTextareaElement;
};
interface HTMLElementTagNameMap {
"atom-button": HTMLAtomButtonElement;
"atom-col": HTMLAtomColElement;
Expand All @@ -187,6 +250,7 @@ declare global {
"atom-input": HTMLAtomInputElement;
"atom-row": HTMLAtomRowElement;
"atom-select": HTMLAtomSelectElement;
"atom-textarea": HTMLAtomTextareaElement;
}
}
declare namespace LocalJSX {
Expand Down Expand Up @@ -310,6 +374,60 @@ declare namespace LocalJSX {
"readonly"?: boolean;
"value"?: IonTypes.IonSelect['value'];
}
interface AtomTextarea {
"autoGrow"?: boolean;
"autocomplete"?: 'on' | 'off';
"autofocus"?: boolean;
"clearOnEdit"?: boolean;
"color"?: 'primary' | 'secondary' | 'danger';
"cols"?: number;
"counter"?: boolean;
"counterFormatter"?: (
inputLength: number,
maxLength: number
) => string | undefined;
"debounce"?: number;
"disabled"?: boolean;
"enterKeyHint"?: | 'enter'
| 'done'
| 'go'
| 'next'
| 'previous'
| 'search'
| 'send';
"errorText"?: string;
"fill"?: 'solid' | 'outline';
"hasError"?: boolean;
"helperText"?: string;
"icon"?: string;
"inputmode"?: | 'none'
| 'text'
| 'tel'
| 'url'
| 'email'
| 'numeric'
| 'decimal'
| 'search';
"label"?: string;
"labelPlacement"?: 'stacked' | 'floating';
"maxlength"?: number;
"minlength"?: number;
"mode"?: Mode;
"name"?: string;
"onAtomBlur"?: (event: AtomTextareaCustomEvent<void>) => void;
"onAtomChange"?: (event: AtomTextareaCustomEvent<string>) => void;
"onAtomFocus"?: (event: AtomTextareaCustomEvent<void>) => void;
"onAtomInput"?: (event: AtomTextareaCustomEvent<string>) => void;
"pattern"?: string;
"placeholder"?: string;
"readonly"?: boolean;
"required"?: boolean;
"rows"?: number;
"shape"?: 'round' | undefined;
"step"?: string;
"value"?: IonTypes.IonTextarea['value'];
"wrap"?: 'hard' | 'soft' | 'off';
}
interface IntrinsicElements {
"atom-button": AtomButton;
"atom-col": AtomCol;
Expand All @@ -318,6 +436,7 @@ declare namespace LocalJSX {
"atom-input": AtomInput;
"atom-row": AtomRow;
"atom-select": AtomSelect;
"atom-textarea": AtomTextarea;
}
}
export { LocalJSX as JSX };
Expand All @@ -331,6 +450,7 @@ declare module "@stencil/core" {
"atom-input": LocalJSX.AtomInput & JSXBase.HTMLAttributes<HTMLAtomInputElement>;
"atom-row": LocalJSX.AtomRow & JSXBase.HTMLAttributes<HTMLAtomRowElement>;
"atom-select": LocalJSX.AtomSelect & JSXBase.HTMLAttributes<HTMLAtomSelectElement>;
"atom-textarea": LocalJSX.AtomTextarea & JSXBase.HTMLAttributes<HTMLAtomTextareaElement>;
}
}
}
Loading

0 comments on commit d0124db

Please sign in to comment.