@danxbot/ui 7.2.0 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const startOfDay: (d: Date) => Date;
|
|
2
|
+
export type DateRange = {
|
|
3
|
+
from: Date | null;
|
|
4
|
+
to: Date | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The popover a calendar opens in — ONE size for every control that opens one (`DatePicker`,
|
|
8
|
+
* `DateField`), so they cannot drift apart.
|
|
9
|
+
*
|
|
10
|
+
* A touch day is floored to 44px (`dx-tap`), so seven of them need 308px, and a popover is capped
|
|
11
|
+
* at 90vw. With the old fixed 20.5rem frame plus 12px padding a 375px phone clipped the Sunday
|
|
12
|
+
* column, the next-month arrow and Clear (SG-906, measured). So on a coarse pointer the padding
|
|
13
|
+
* drops to 8px and the calendar fills the popover instead of fixing its own width: 308px of days +
|
|
14
|
+
* 16px of padding = 324px, which is 90vw of a 360px phone. On a mouse nothing changes size.
|
|
15
|
+
*/
|
|
16
|
+
export declare const CALENDAR_POPOVER_CLASS = "w-[19rem] p-3 pointer-coarse:w-[22rem] pointer-coarse:p-2";
|
|
17
|
+
export interface DateCalendarProps {
|
|
18
|
+
/** A single date, or a range when `range` is set. */
|
|
19
|
+
value?: Date | DateRange | null;
|
|
20
|
+
onValueChange?: (value: Date | DateRange | null) => void;
|
|
21
|
+
range?: boolean;
|
|
22
|
+
min?: Date;
|
|
23
|
+
max?: Date;
|
|
24
|
+
/** Disable specific days — weekends, holidays, taken slots. */
|
|
25
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function DateCalendar({ value, onValueChange, range, min, max, isDateDisabled, className, }: DateCalendarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface DateFieldProps {
|
|
2
|
+
/** The stored ISO calendar date (`YYYY-MM-DD`), or null for none. */
|
|
3
|
+
value: string | null;
|
|
4
|
+
/** Reports the new ISO date, or null when the person cleared it. Only on commit. */
|
|
5
|
+
onValueChange: (value: string | null) => void;
|
|
6
|
+
/** Told when the box gains and loses focus — i.e. while the person's own text is on screen. */
|
|
7
|
+
onEditingChange?: (editing: boolean) => void;
|
|
8
|
+
/** The accessible name. Required: a date box with no name is a box nobody can find. */
|
|
9
|
+
"aria-label": string;
|
|
10
|
+
/** @default "MM/DD/YYYY" */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** The sentence shown for typed text that is not a date. */
|
|
14
|
+
invalidMessage?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function DateField({ value, onValueChange, onEditingChange, "aria-label": ariaLabel, placeholder, disabled, invalidMessage, className, }: DateFieldProps): import("react").JSX.Element;
|
|
18
|
+
export interface DateTimeFieldProps {
|
|
19
|
+
/** The stored ISO instant, or null for none. */
|
|
20
|
+
value: string | null;
|
|
21
|
+
/** Reports the new ISO instant, or null when the date was cleared. Only on commit. */
|
|
22
|
+
onValueChange: (value: string | null) => void;
|
|
23
|
+
/** Told while either half has focus. */
|
|
24
|
+
onEditingChange?: (editing: boolean) => void;
|
|
25
|
+
"aria-label": string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function DateTimeField({ value, onValueChange, onEditingChange, "aria-label": ariaLabel, disabled, className, }: DateTimeFieldProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
to: Date | null;
|
|
4
|
-
};
|
|
1
|
+
import { type DateRange } from "./DateCalendar";
|
|
2
|
+
export type { DateRange };
|
|
5
3
|
export interface DatePickerProps {
|
|
6
4
|
/** A single date, or a range when `range` is set. */
|
|
7
5
|
value?: Date | DateRange | null;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export { ThemeMenu, type ThemeMenuProps } from "./components/ThemeMenu";
|
|
|
35
35
|
export { AppShell, type AppShellProps, type NavItem, type NavSection, } from "./components/AppShell";
|
|
36
36
|
export { FileUpload, type FileUploadProps, type UploadFile } from "./components/FileUpload";
|
|
37
37
|
export { DatePicker, type DatePickerProps, type DateRange } from "./components/DatePicker";
|
|
38
|
+
export { DateCalendar, type DateCalendarProps } from "./components/DateCalendar";
|
|
39
|
+
export { DateField, DateTimeField, type DateFieldProps, type DateTimeFieldProps, } from "./components/DateField";
|
|
38
40
|
export { Tree, type TreeProps, type TreeNode } from "./components/Tree";
|
|
39
41
|
export { CommandPalette, useCommandPalette, type CommandPaletteProps, type CommandItem, } from "./components/CommandPalette";
|
|
40
42
|
export { Slider, type SliderProps, type SliderMark } from "./components/Slider";
|