60e2149072
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date) - Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class - Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting - Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states - Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions - Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares) - Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline - Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements - Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations - Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary - Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds All tests follow AAA pattern and use data-testid selectors matching Angular version. Total: 245 tests across 10 feature suites.
224 lines
6.2 KiB
TypeScript
224 lines
6.2 KiB
TypeScript
/**
|
|
*
|
|
* ToggleButton is used to select a boolean value using a button.
|
|
*
|
|
* [Live Demo](https://www.primereact.org/togglebutton/)
|
|
*
|
|
* @module togglebutton
|
|
*
|
|
*/
|
|
import * as React from 'react';
|
|
import { CheckboxPassThroughType } from '../checkbox/checkbox';
|
|
import { ComponentHooks } from '../componentbase/componentbase';
|
|
import { PassThroughOptions } from '../passthrough';
|
|
import { TooltipPassThroughOptions } from '../tooltip/tooltip';
|
|
import { TooltipOptions } from '../tooltip/tooltipoptions';
|
|
import { IconType, PassThroughType } from '../utils';
|
|
|
|
export declare type ToggleButtonPassThroughType<T> = PassThroughType<T, ToggleButtonPassThroughMethodOptions>;
|
|
|
|
/**
|
|
* Custom passthrough(pt) option method.
|
|
*/
|
|
export interface ToggleButtonPassThroughMethodOptions {
|
|
props: ToggleButtonProps;
|
|
}
|
|
|
|
/**
|
|
* Custom passthrough(pt) options.
|
|
* @see {@link ToggleButtonProps.pt}
|
|
*/
|
|
export interface ToggleButtonPassThroughOptions {
|
|
/**
|
|
* Uses to pass attributes to the root's DOM element.
|
|
*/
|
|
root?: ToggleButtonPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
|
|
/**
|
|
* Uses to pass attributes to the icon's DOM element.
|
|
*/
|
|
icon?: ToggleButtonPassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement>>;
|
|
/**
|
|
* Uses to pass attributes to the label's DOM element.
|
|
*/
|
|
label?: ToggleButtonPassThroughType<React.HTMLAttributes<HTMLSpanElement>>;
|
|
/**
|
|
* Uses to pass attributes tooltip's DOM element.
|
|
* @type {TooltipPassThroughOptions}
|
|
*/
|
|
tooltip?: TooltipPassThroughOptions;
|
|
/**
|
|
* Used to manage all lifecycle hooks
|
|
* @see {@link ComponentHooks}
|
|
*/
|
|
hooks?: ComponentHooks;
|
|
/**
|
|
* Uses to pass attributes to the input's DOM element.
|
|
*/
|
|
input?: ToggleButtonPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
|
|
/**
|
|
* Used to pass attributes to the box's DOM element.
|
|
*/
|
|
box?: CheckboxPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
|
|
}
|
|
/**
|
|
* Custom toggle button change target options
|
|
*/
|
|
interface ToggleButtonChangeTargetOptions {
|
|
/**
|
|
* The name of the element.
|
|
*/
|
|
name: string;
|
|
/**
|
|
* Unique identifier of the element.
|
|
*/
|
|
id: string;
|
|
/**
|
|
* Collapsed state as a boolean.
|
|
*/
|
|
value: boolean;
|
|
}
|
|
|
|
/**
|
|
* Custom change event.
|
|
* @see {@link ToggleButtonProps.onChange}
|
|
* @event
|
|
*/
|
|
interface ToggleButtonChangeEvent {
|
|
/**
|
|
* Browser event
|
|
*/
|
|
originalEvent: React.SyntheticEvent;
|
|
/**
|
|
* Value as the checked state.
|
|
*/
|
|
value: boolean;
|
|
/**
|
|
* Stops the event from propagating.
|
|
*/
|
|
stopPropagation(): void;
|
|
/**
|
|
* Prevents the default action of the event.
|
|
*/
|
|
preventDefault(): void;
|
|
/**
|
|
* Target element.
|
|
*/
|
|
target: ToggleButtonChangeTargetOptions;
|
|
}
|
|
|
|
/**
|
|
* Defines valid properties in ToggleButton component. In addition to these, all properties of HTMLDivElement can be used in this component.
|
|
* @group Properties
|
|
*/
|
|
export interface ToggleButtonProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange' | 'ref' | 'pt'> {
|
|
/**
|
|
* Specifies the on/off state of the button.
|
|
* @defaultValue false
|
|
*/
|
|
checked?: boolean | undefined;
|
|
/**
|
|
* Used to get the child elements of the component.
|
|
* @readonly
|
|
*/
|
|
children?: React.ReactNode | undefined;
|
|
/**
|
|
* Position of the icon, valid values are "left" and "right".
|
|
* @defaultValue left
|
|
*/
|
|
iconPos?: 'left' | 'right' | undefined;
|
|
/**
|
|
* When present, it specifies that the component should have invalid state style.
|
|
* @defaultValue false
|
|
*/
|
|
invalid?: boolean | undefined;
|
|
/**
|
|
* When present, it specifies that the element should be disabled.
|
|
* @defaultValue false
|
|
*/
|
|
disabled?: boolean | undefined;
|
|
/**
|
|
* When present, it specifies that an input field is read-only.
|
|
* @default false
|
|
*/
|
|
readonly?: boolean | undefined;
|
|
/**
|
|
* Icon for the off state.
|
|
*/
|
|
offIcon?: IconType<ToggleButtonProps> | undefined;
|
|
/**
|
|
* Label for the off state.
|
|
* @defaultValue no
|
|
*/
|
|
offLabel?: string | undefined;
|
|
/**
|
|
* Icon for the on state.
|
|
*/
|
|
onIcon?: IconType<ToggleButtonProps> | undefined;
|
|
/**
|
|
* Label for the on state.
|
|
* @defaultValue yes
|
|
*/
|
|
onLabel?: string | undefined;
|
|
/**
|
|
* Content of the tooltip.
|
|
*/
|
|
tooltip?: string | undefined;
|
|
/**
|
|
* Configuration of the tooltip, refer to the tooltip documentation for more information.
|
|
*/
|
|
tooltipOptions?: TooltipOptions | undefined;
|
|
/**
|
|
* Callback to invoke when autocomplete loses focus.
|
|
* @param {React.FocusEvent<HTMLElement>} event - Browser event.
|
|
*/
|
|
onBlur?(event: React.FocusEvent<HTMLElement>): void;
|
|
/**
|
|
* Callback to invoke on value change.
|
|
* @param {ToggleButtonChangeEvent} event - Browser event.
|
|
*/
|
|
onChange?(event: ToggleButtonChangeEvent): void;
|
|
/**
|
|
* Callback to invoke when autocomplete gets focus.
|
|
* @param {React.FocusEvent<HTMLElement>} event - Browser event.
|
|
*/
|
|
onFocus?(event: React.FocusEvent<HTMLElement>): void;
|
|
/**
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
* @type {ToggleButtonPassThroughOptions}
|
|
*/
|
|
pt?: ToggleButtonPassThroughOptions;
|
|
/**
|
|
* Used to configure passthrough(pt) options of the component.
|
|
* @type {PassThroughOptions}
|
|
*/
|
|
ptOptions?: PassThroughOptions;
|
|
/**
|
|
* When enabled, it removes component related styles in the core.
|
|
* @defaultValue false
|
|
*/
|
|
unstyled?: boolean;
|
|
}
|
|
|
|
/**
|
|
* **PrimeReact - ToggleButton**
|
|
*
|
|
* _ToggleButton is used to select a boolean value using a button._
|
|
*
|
|
* [Live Demo](https://www.primereact.org/togglebutton/)
|
|
* --- ---
|
|
* 
|
|
*
|
|
* @group Component
|
|
*/
|
|
export declare class ToggleButton extends React.Component<ToggleButtonProps, any> {
|
|
/**
|
|
* Used to focus the component.
|
|
*/
|
|
public focus(): void;
|
|
/**
|
|
* Used to get container element.
|
|
* @return {HTMLDivElement | null} Container element
|
|
*/
|
|
public getElement(): HTMLDivElement | null;
|
|
}
|