@synergycodes/axiom
Version:
A React library for creating node-based UIs and diagram-driven applications. Perfect for React Flow users, providing ready-to-use node templates and components that work seamlessly with React Flow's ecosystem.
36 lines (35 loc) • 1.52 kB
TypeScript
import { ReactElement, ForwardRefExoticComponent, MouseEventHandler } from 'react';
import { Size } from '../../shared/types/size';
import { Shape } from '../button/types';
import { SegmentPickerItemProps, Item } from './item/segment-picker-item';
type SegmentPickerPropsBase = {
children: ReactElement<SegmentPickerItemProps, typeof Item>[];
size?: Size;
/**
* Controls the shape of the SegmentPicker and its items.
* (default) - Items stretch to fill the container equally.
* 'circle' - Items fit tightly around their content to maintain a circular shape.
* Only supported when items contain icons only.
*/
shape?: Shape;
className?: string;
onChange?: (event: MouseEventHandler<HTMLButtonElement>, value: string) => void;
};
type ControlledSegmentPickerProps = {
/** The currently selected value (controlled mode). */
value: string;
/** Must not be used in controlled mode. */
defaultValue?: never;
} & SegmentPickerPropsBase;
type UncontrolledSegmentPickerProps = {
/** The initial selected value (uncontrolled mode). */
defaultValue: string;
/** Must not be used in uncontrolled mode. */
value?: never;
} & SegmentPickerPropsBase;
type SegmentPickerProps = ControlledSegmentPickerProps | UncontrolledSegmentPickerProps;
type SegmentPickerComponent = ForwardRefExoticComponent<SegmentPickerProps & React.RefAttributes<HTMLDivElement>> & {
Item: typeof Item;
};
export declare const SegmentPicker: SegmentPickerComponent;
export {};