UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

65 lines (64 loc) 2.95 kB
/** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react'; import { type PolymorphicCommonProps, type TooltipObjectProps } from '../_common/types'; type SegmentedControlID = string | number; type SegmentedControlProps<T extends SegmentedControlID> = { /** Additional class name */ className?: string; /** Size of the segmented control */ size?: 'small' | 'medium' | 'large'; /** If segmented control items will include only icons (makes controls rectangular) */ hasOnlyIcons?: boolean; /** The callback function triggered when the segmented control value changes */ onChange: (e: T) => void | ((e: React.SetStateAction<T>) => void); /** The currently selected option */ selected: T; /** The children component of the segmented control */ children: React.ReactNode; /** Whether the segmented control has a box shadow applied */ isFloating?: boolean; }; type SegmentedControlItemProps = { /** Additional class name */ className?: string; /** The children component of the segmented control item */ children?: React.ReactNode; /** The value of the segmented control item */ value: string; /** The description of the segmented control item, will be displayed in the tooltip */ description?: string; /** The tooltip props that will be applied if tooltip is set */ tooltipProps?: TooltipObjectProps; /** Whether the segmented control item is disabled */ isDisabled?: boolean; }; declare const SegmentedControl: { <T extends SegmentedControlID, U extends React.ElementType = "div">({ size, hasOnlyIcons, children, selected, onChange, as, className, style, isFloating, htmlAttributes, ref, ...restProps }: PolymorphicCommonProps<U, SegmentedControlProps<T>>): import("react/jsx-runtime").JSX.Element; displayName: string; } & { Item: { <T extends React.ElementType = "button">({ as, children, className, style, value, htmlAttributes, description, tooltipProps, isDisabled, ref, ...restProps }: PolymorphicCommonProps<T, SegmentedControlItemProps>): import("react/jsx-runtime").JSX.Element; displayName: string; }; }; export { SegmentedControl }; //# sourceMappingURL=SegmentedControl.d.ts.map