UNPKG

@enact/sandstone

Version:

Large-screen/TV support library for Enact, containing a variety of UI components.

93 lines (84 loc) 2.67 kB
// Type definitions for sandstone/DayPicker import { GroupProps as ui_Group_GroupProps } from "@enact/ui/Group"; import * as React from "react"; import { ChangeableProps as ui_Changeable_ChangeableProps } from "@enact/ui/Changeable"; type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N; export interface DayPickerBaseProps extends Omit<ui_Group_GroupProps, "children"> {} /** * A day of the week selection component. * * This component is most often not used directly but may be composed within another component as it is within . */ export class DayPickerBase extends React.Component< Merge<React.HTMLProps<HTMLElement>, DayPickerBaseProps> > {} export interface DayPickerProps extends Omit< Merge<DayPickerBaseProps, ui_Changeable_ChangeableProps>, "onChange" | "value" | "defaultValue" > { /** * Disables all days in this picker. */ disabled?: boolean; /** * Disables DayPicker and the control becomes non-interactive. */ disabled?: boolean; /** * Called when an day is selected or unselected. * * The event payload will be an object with the following members: * * `selected` - An array of numbers representing the selected days, 0 indexed where Sunday is represented by 0 */ onSelect?: Function; /** * An array of numbers (0 indexed where Sunday is 0) representing the selected days of the week. */ selected?: number | number[]; /** * The initial value used when `selected` is not set. */ selected?: number | number[]; /** * The "aria-label" for the component. * * By default, "aria-label" is set to the full names of the selected days or the custom text when the weekend, week days, or all days is selected. */ "aria-label"?: string; } /** * A day of the week selection component, ready to use in Sandstone applications. * * By default, `DayPicker` maintains the state of its `selected` property. Supply the `selected` property to control its initial value. If you wish to directly control updates to the component, supply a value to `selected` at creation time and update it in response to `onChange` events. * * Usage: * ``` <DayPicker selected={[2, 3]} onSelect={handleSelect} /> ``` */ export class DayPicker extends React.Component< Merge<React.HTMLProps<HTMLElement>, DayPickerProps> > {} /** * Determines whether it should return "Every Day", "Every Weekend", "Every Weekday" or list of days for a given selected day type. */ export function getSelectedDayString( selected: any, noneText?: string, dayNameLength?: string, ): string; export default DayPicker;