@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS
94 lines (91 loc) • 3.45 kB
TypeScript
import { HTMLAttributes } from 'react';
import { TimeOutput } from 'react-timekeeper';
import { DialogProps } from '../Dialog/Dialog.types.js';
import { PopoverProps, CombinedRefs as CombinedRefs$1 } from '../Popover/Popover.types.js';
import { T as Themes } from '../constants-QFINMz1u.js';
import { Orientations, PickerVariants, TimeVariants } from './DateTimePicker.constants.js';
import '@radix-ui/react-dialog';
import '../Button/Button.types.js';
import '@snowball-tech/design-tokens/dist/web/typescript/constants';
import '../Button/Button.constants.js';
import '../Paper/Paper.types.js';
import '../Paper/Paper.constants.js';
import '../Typography/Typography.constants.js';
import '../Dialog/Dialog.constants.js';
import '@radix-ui/react-popover';
type CombinedRefs = {
calendar: HTMLDivElement | null;
input: HTMLInputElement | null;
picker: CombinedRefs$1 | null;
};
type DialogPropsOverride = Partial<Omit<DialogProps, 'children' | 'defaultOpen' | 'disabled' | 'onDismiss' | 'onToggle' | 'open' | 'popover' | 'trigger'>>;
type PopoverPropsOverride = Partial<Omit<PopoverProps, 'children' | 'disabled' | 'onOpenChange' | 'open' | 'popover' | 'toggleOnTriggerClick' | 'trigger' | 'triggerAsButton' | 'withArrow'>>;
interface DateTimePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'placeholder' | 'popover'> {
amPm?: boolean;
clearable?: boolean;
defaultOpen?: boolean;
defaultValue?: Date | null;
description?: string;
disabled?: boolean;
error?: string;
fullWidth?: boolean;
i18n?: {
buttons?: {
clear?: string;
close?: string;
now?: string;
today?: string;
};
calendar?: {
fastNext?: string;
fastPrevious?: string;
next?: string;
previous?: string;
};
tabs?: {
bar?: string;
date?: string;
time?: string;
};
};
id?: string;
label?: string;
maxDate?: 'today' | Date;
maxDateTime?: 'now' | Date;
maxTime?: 'now' | Date;
minDate?: 'today' | Date;
minDateTime?: 'now' | Date;
minTime?: 'now' | Date;
modal?: boolean;
name?: string;
open?: boolean;
orientation?: `${Orientations}`;
pickerVariant?: `${PickerVariants}`;
placeholder?: string;
popover?: DialogPropsOverride | PopoverPropsOverride;
readOnly?: boolean;
required?: boolean;
staticPicker?: boolean;
success?: string;
theme?: Themes;
timeVariant?: `${TimeVariants}`;
value?: Date | null;
withClose?: boolean;
withDatePicker?: boolean;
withNow?: boolean;
withPicker?: boolean;
withTimePicker?: boolean;
withToday?: boolean;
onChange?: (newDate: Date | null) => void;
onClear?: () => void;
onClose?: () => void;
onDateChange?: (newDate: Date | null, newDateTime: Date | null) => void;
onDismiss?: () => void;
onFieldChange?: (type: 'ampm' | 'day' | 'hour' | 'minute' | 'month' | 'second' | 'year', newValue: Date | null) => void;
onNow?: () => void;
onOpen?: () => void;
onOpenChange?: (open: boolean) => void;
onTimeChange?: (newTime: TimeOutput | null, newDateTime: Date | null) => void;
onToday?: () => void;
}
export type { CombinedRefs, DateTimePickerProps, DialogPropsOverride, PopoverPropsOverride };