beta-parity-react
Version:
Beta Parity React Components
145 lines • 4.52 kB
TypeScript
import React from 'react';
import './variables.css';
import './index.css';
import { BaseProps } from '../Base';
import { InputProps } from '../BaseInput';
declare const colorMap: {
readonly neutral: "neutral";
readonly accent: "accent";
};
/**
* Props for the Checkbox component.
*
* Extends properties from the `Input` component.
*/
export interface CheckboxProps extends InputProps {
/**
* The color of the checkbox, can be one of the keys from the colorMap.
*
* "neutral" is default
*
* @default 'neutral'
* @memberof CheckboxProps
*/
color?: keyof typeof colorMap;
/**
* The label for the checkbox.
* Can be a string or a React node.
*
* @memberof CheckboxProps
*/
label?: string | React.ReactNode;
/**
* The sub-label for the checkbox.
* Can be a string or a React node.
*
* @memberof CheckboxProps
*/
sublabel?: string | React.ReactNode;
/**
* Indicates whether the checkbox is in an indeterminate state.
*
* @default false
* @memberof CheckboxProps
*/
indeterminate?: boolean;
/**
* Additional props for the checkbox wrapper.
*
* @memberof CheckboxProps
*/
checkboxWrapperProps?: any;
}
/**
* **Parity Checkbox**.
*
* @see {@link https://beta-parity-react.vercel.app/checkbox Parity Checkbox}
*/
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
export interface CheckboxTreeItem {
value: string;
label: string | React.ReactNode;
sublabel?: string | React.ReactNode;
checked?: boolean;
indeterminate?: boolean;
checkboxProps?: CheckboxProps;
children?: CheckboxTreeItem[];
}
export type DataItems = CheckboxTreeItem[];
/**
* Props for the CheckboxGroup component.
*/
export interface CheckboxGroup extends Pick<CheckboxProps, 'color'>, BaseProps {
/**
* The children nodes of the CheckboxGroup.
*
* @memberof CheckboxGroup
*/
children?: React.ReactNode;
/**
* The tree structure representing the data items for the CheckboxGroup.
*
* @memberof CheckboxGroup
*/
tree?: DataItems;
/**
* The function to handle changes in the CheckboxGroup.
* @param {any} value - The value of the CheckboxGroup.
* @param {DataItems} tree - The tree structure of the CheckboxGroup.
* @param {function} getGroup - The function to get the group value.
* @memberof CheckboxGroup
*/
onChange?: ({ value, tree, getGroup }: {
value: any;
tree: DataItems;
getGroup: (groupValue: string) => any;
}) => void;
/**
* The function to handle the parsed value of the CheckboxGroup.
*
* @param {DataItems} value - The parsed tree structure of the CheckboxGroup.
* @memberof CheckboxGroup
*/
onParse?: (value: DataItems) => void;
/**
* The label for the CheckboxGroup.
*
* When CheckboxGroup have label and value, CheckboxGroup will have a parent node to control CheckboxGroup's children
*
* @memberof CheckboxGroup
*/
label?: string | React.ReactNode;
/**
* The sub-label for the CheckboxGroup.
* Can be a string or a React node.
*
* @memberof CheckboxProps
*/
sublabel?: string | React.ReactNode;
/**
* The value for the CheckboxGroup. This value is ui control - control children state, it not be return
*
* When CheckboxGroup have label and value, CheckboxGroup will have a parent node to control CheckboxGroup's children
*
* @memberof CheckboxGroup
*/
value?: string;
checked?: boolean;
}
/**
* The CheckboxGroup component.
*
* @see {@link https://beta-parity-react.vercel.app/checkbox Parity CheckboxGroup}
*/
export declare const CheckboxGroup: ({ tree, children, onChange, label, sublabel, value, checked, onParse, ...props }: CheckboxGroup) => import("react/jsx-runtime").JSX.Element;
export interface CheckBoxWrapperProps extends BaseProps {
}
export declare const CheckBoxWrapper: React.ForwardRefExoticComponent<CheckBoxWrapperProps & React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>>;
export declare const RecursiveCheckbox: ({ tree, handleChange, indent, color }: {
tree: DataItems;
handleChange: any;
indent?: boolean;
[key: string]: any;
}) => import("react/jsx-runtime").JSX.Element;
export {};
//# sourceMappingURL=index.d.ts.map