@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS
113 lines (108 loc) • 4.51 kB
TypeScript
import * as react from 'react';
import { HTMLAttributes, ReactNode } from 'react';
import { TimeOutput } from 'react-timekeeper';
import { a as DialogProps } from '../../../Dialog.types-D8CR0sn7.js';
import { P as PopoverProps, C as CombinedRefs$1 } from '../../../Popover.types-BYrGCnLC.js';
import { Themes } from '../../constants.js';
import '@radix-ui/react-dialog';
import '../../../Button.types-Dt-FZKMg.js';
import '../../types.js';
import '@snowball-tech/design-tokens/dist/web/typescript/constants';
import '../../../Paper.types-NMDyV2Rb.js';
import '../../../Typography.constants-DvMtFxBN.js';
import '@radix-ui/react-popover';
declare enum PickerVariants {
SideBySide = "side-by-side",
Tabs = "tabs"
}
declare const DEFAULT_PICKER_VARIANT = PickerVariants.Tabs;
declare enum TimeVariants {
Clock = "clock"
}
declare const DEFAULT_TIME_VARIANT = TimeVariants.Clock;
declare enum Orientations {
Horizontal = "horizontal",
Responsive = "responsive",
Vertical = "vertical"
}
declare const DEFAULT_ORIENTATION = Orientations.Responsive;
declare const DEFAULT_DESKTOP_ORIENTATION = Orientations.Horizontal;
declare const DEFAULT_MOBILE_ORIENTATION = Orientations.Vertical;
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?: ReactNode;
disabled?: boolean;
error?: Error | ReactNode;
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?: ReactNode;
labelElement?: keyof HTMLElementTagNameMap;
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?: ReactNode;
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;
}
declare const DateTimePicker: react.ForwardRefExoticComponent<DateTimePickerProps & react.RefAttributes<CombinedRefs>>;
export { DEFAULT_DESKTOP_ORIENTATION as DEFAULT_DATETIME_DESKTOP_ORIENTATION, DEFAULT_MOBILE_ORIENTATION as DEFAULT_DATETIME_MOBILE_ORIENTATION, DEFAULT_ORIENTATION as DEFAULT_DATETIME_ORIENTATION, DEFAULT_PICKER_VARIANT as DEFAULT_DATETIME_PICKER_VARIANT, DEFAULT_TIME_VARIANT as DEFAULT_DATETIME_TIME_VARIANT, Orientations as DateTimeOrientations, DateTimePicker, type DateTimePickerProps, type CombinedRefs as DateTimePickerRefs, PickerVariants as DateTimePickerVariants, TimeVariants as DateTimeTimeVariants };