@cn-ui/core
Version:
The @cn-ui/core is a collection of UI components and utilities for building modern web applications with SolidJS.
58 lines (57 loc) • 1.87 kB
TypeScript
import { type Atom } from "@cn-ui/reactive";
import { type Accessor } from "solid-js";
import type { JSXElement } from "solid-js";
import { type BaseFormItemType } from "../form/BaseFormItemType";
import "./index.css";
import { type FocusOptions } from "./triggerFocus";
import { type CountProps } from "./useTextCount";
export interface CountConfig {
max?: number;
strategy?: (value: string) => number;
show?: boolean | ((args: {
value: string;
count: number;
maxLength?: number;
}) => JSXElement);
exceedFormatter?: (value: string, config: CountConfig) => string;
}
export interface InputExpose {
inputType: Atom<string>;
isHovering: Accessor<boolean>;
model: Atom<string>;
focus: (opts: FocusOptions) => void;
disabled: Accessor<boolean>;
}
export interface BaseInputProps extends Omit<CountProps, "model">, BaseFormItemType {
/**
* input 的 id,而不是外层的
* @tested
*/
id?: string;
/**
* 前置图标
* @tested
*/
prefixIcon?: JSXElement | ((expose: InputExpose) => JSXElement);
/**
* 后置图标
* @tested
*/
suffixIcon?: JSXElement | ((expose: InputExpose) => JSXElement);
rounded?: boolean;
/**
* input type 属性
* @tested
*/
type?: "text" | "textarea" | "password" | string;
expose?: (expose: InputExpose) => void;
/**
* textarea 自动高度
* @tested
*/
autoSize?: boolean;
resize?: boolean;
wrapperRef?: (el: HTMLSpanElement) => void;
}
export declare const BaseInput: import("solid-js").Component<import("@cn-ui/reactive").OriginComponentOutputType<BaseInputProps, HTMLInputElement, string>>;
export declare const Input: import("solid-js").Component<import("@cn-ui/reactive").OriginComponentOutputType<BaseInputProps, HTMLInputElement, string>>;