/** * Copyright 2022, SumUp Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type FieldsetHTMLAttributes, type InputHTMLAttributes, type Ref } from 'react'; import { type CheckboxProps } from '../Checkbox/Checkbox.js'; type Option = Omit & { value: string | number; }; export interface CheckboxGroupProps extends Omit, 'onChange' | 'defaultValue'> { /** * A name for the CheckboxGroup. This name is shared among the individual Checkboxes. */ name: string; /** * A collection of available options. Each option must have at least a label and a value * for the respective Checkbox. * Pass the optional `required` prop to indicate a Checkbox is required. */ options: Option[]; /** * The values of the Checkboxes that are checked by default (uncontrolled). */ defaultValue?: Option['value'][]; /** * The values of the Checkboxes that are checked by default (controlled). */ value?: Option['value'][]; /** * A callback that is called when any of the inputs change their values. * Passed on to the Checkboxes. */ onChange?: CheckboxProps['onChange']; /** * A description of the selector group. */ label: string; /** * Label to indicate that the input is optional. Only displayed when the * `required` prop is falsy. */ optionalLabel?: string; /** * The ref to the HTML DOM element. */ ref?: Ref; /** * An information, warning or error message, displayed below the Checkboxes. */ validationHint?: string; /** * Triggers error message below the Checkboxes. */ invalid?: boolean; /** * Triggers warning message below the Checkboxes. */ hasWarning?: boolean; /** * Triggers valid message below the Checkboxes. */ showValid?: boolean; /** * Makes the input group required. */ required?: InputHTMLAttributes['required']; /** * Visually hide the label. This should only be used in rare cases and only * if the purpose of the field can be inferred from other context. */ hideLabel?: boolean; } /** * A group of Checkboxes. */ export declare const CheckboxGroup: import("react").ForwardRefExoticComponent & import("react").RefAttributes>; export {};