y-taro-ui
Version:
基于taro的表单解决方案 & 基础组件
53 lines (52 loc) • 1.82 kB
TypeScript
import React from 'react';
import './index.less';
export declare type CheckboxValueType = string | number;
export interface CheckboxOptionType {
label?: React.ReactNode;
value: CheckboxValueType;
style?: React.CSSProperties;
disabled?: boolean;
onChange?: (e: any) => void;
}
export interface CheckboxGroupContextValue {
name?: string;
onToggle?: (option: CheckboxOptionType) => void;
value?: CheckboxValueType[];
disabled?: boolean;
max?: number;
}
export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue | null>;
export interface CheckboxProps {
value?: CheckboxValueType;
label?: React.ReactNode;
disabled?: boolean;
checked?: boolean;
onChange?: (value: boolean) => void;
className?: string;
style?: React.CSSProperties;
icon?: 'check-circle-filled' | 'check-circle-outlined';
}
export declare const Checkbox: React.FC<CheckboxProps>;
export interface CheckboxGroupProps {
icon?: 'check-circle-filled' | 'check-circle-outlined';
max?: number;
disabled?: boolean;
direction?: 'column' | 'row';
justify?: 'flex-start' | 'flex-end' | 'space-between';
options: {
id: CheckboxValueType;
name: string | number;
className?: string;
style?: React.CSSProperties;
onChange?: () => void;
children?: React.ReactNode;
disabled?: boolean;
}[];
value?: CheckboxValueType[];
onChange?: (value: CheckboxValueType[], fieldId?: string) => void;
vlidate?: (value: CheckboxValueType[]) => boolean;
fieldId?: string;
children?: React.ReactNode;
}
export declare const CheckboxGroup: React.MemoExoticComponent<(props: CheckboxGroupProps) => JSX.Element>;
export default CheckboxGroup;