@carbon/ibm-products
Version:
Carbon for IBM Products
105 lines • 3.94 kB
TypeScript
/**
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import PropTypes from 'prop-types';
import { Condition, ConditionGroup, LogicalOperator } from '../ConditionBuilder.types';
/**
* This component build each block of condition consisting of property, operator value and close button.
*/
interface ConditionBlockProps {
condition?: Condition;
onRemove: (e: React.MouseEvent<HTMLButtonElement>) => void;
onChange: (condition: Condition) => void;
onConnectorOperatorChange?: (op: string) => void;
onStatementChange?: (v: string) => void;
addConditionHandler?: (conditionIndex: number) => void;
addConditionSubGroupHandler?: (conditionIndex: number) => void;
hideConditionSubGroupPreviewHandler?: () => void;
showConditionSubGroupPreviewHandler?: () => void;
hideConditionPreviewHandler?: () => void;
showConditionPreviewHandler?: () => void;
conjunction?: LogicalOperator;
isStatement?: boolean;
group: ConditionGroup;
conditionIndex: number;
aria: {
level: number;
posinset: number;
setsize?: number;
};
isLastCondition: (index: number, conditions: (ConditionGroup | Condition)[]) => void;
}
declare const ConditionBlock: {
(props: ConditionBlockProps): React.JSX.Element;
propTypes: {
/**
* callback to add a new condition
*/
addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
/**
* callback to add a new condition subgroup
*/
addConditionSubGroupHandler: PropTypes.Requireable<(...args: any[]) => any>;
/**
* object hold aria attributes
*/
aria: PropTypes.Requireable<object>;
condition: PropTypes.Requireable<object>;
conditionIndex: PropTypes.Requireable<number>;
/**
* string that decides to show the condition connector
*/
conjunction: PropTypes.Requireable<string>;
/**
* object that hold the current group object where is condition is part of
*/
group: PropTypes.Requireable<object>;
/**
* handler for hiding sub group preview
*/
hideConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
/**
* handler for hiding sub group preview
*/
hideConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
isLastCondition: PropTypes.Requireable<(...args: any[]) => any>;
/**
* boolean that decides to show the statement(if/ excl.if)
*/
isStatement: PropTypes.Requireable<boolean>;
/**
* callback to update the current condition of the state tree
*/
onChange: PropTypes.Requireable<(...args: any[]) => any>;
/**
* callback to handle the connector(and/or) change
*/
onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
/**
* callback for Remove a condition
*/
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
/**
* callback to handle the statement(if/ excl.if) change
*/
onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
/**
* handler for showing add condition preview
*/
showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
/**
* handler for showing sub group preview
*/
showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
/**
* object that hold the current condition
*/
state: PropTypes.Requireable<object>;
};
};
export default ConditionBlock;
//# sourceMappingURL=ConditionBlock.d.ts.map