@xeonr/platform-ui 1.3.0 → 1.4.0
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.
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/kit/Anchored.d.ts +13 -2
- package/dist/kit/Anchored.d.ts.map +1 -1
- package/dist/kit/Anchored.js +47 -18
- package/dist/kit/Anchored.js.map +1 -1
- package/dist/kit/Badge.d.ts +1 -0
- package/dist/kit/Badge.d.ts.map +1 -1
- package/dist/kit/Badge.js +14 -0
- package/dist/kit/Badge.js.map +1 -1
- package/dist/kit/Blocks.d.ts.map +1 -1
- package/dist/kit/Blocks.js +4 -2
- package/dist/kit/Blocks.js.map +1 -1
- package/dist/kit/Button.d.ts +8 -2
- package/dist/kit/Button.d.ts.map +1 -1
- package/dist/kit/Button.js +17 -3
- package/dist/kit/Button.js.map +1 -1
- package/dist/kit/Chip.d.ts +6 -0
- package/dist/kit/Chip.d.ts.map +1 -1
- package/dist/kit/Chip.js +2 -1
- package/dist/kit/Chip.js.map +1 -1
- package/dist/kit/Color.d.ts +69 -0
- package/dist/kit/Color.d.ts.map +1 -0
- package/dist/kit/Color.js +150 -0
- package/dist/kit/Color.js.map +1 -0
- package/dist/kit/Combobox.d.ts +5 -1
- package/dist/kit/Combobox.d.ts.map +1 -1
- package/dist/kit/Combobox.js +39 -28
- package/dist/kit/Combobox.js.map +1 -1
- package/dist/kit/Controls.d.ts +184 -0
- package/dist/kit/Controls.d.ts.map +1 -0
- package/dist/kit/Controls.js +344 -0
- package/dist/kit/Controls.js.map +1 -0
- package/dist/kit/DatePicker.d.ts +125 -0
- package/dist/kit/DatePicker.d.ts.map +1 -0
- package/dist/kit/DatePicker.js +438 -0
- package/dist/kit/DatePicker.js.map +1 -0
- package/dist/kit/Dropzone.d.ts +41 -0
- package/dist/kit/Dropzone.d.ts.map +1 -0
- package/dist/kit/Dropzone.js +118 -0
- package/dist/kit/Dropzone.js.map +1 -0
- package/dist/kit/Form.d.ts +86 -13
- package/dist/kit/Form.d.ts.map +1 -1
- package/dist/kit/Form.js +124 -13
- package/dist/kit/Form.js.map +1 -1
- package/dist/kit/Icon.d.ts +4 -0
- package/dist/kit/Icon.d.ts.map +1 -1
- package/dist/kit/Icon.js +5 -1
- package/dist/kit/Icon.js.map +1 -1
- package/dist/kit/List.d.ts +55 -8
- package/dist/kit/List.d.ts.map +1 -1
- package/dist/kit/List.js +43 -6
- package/dist/kit/List.js.map +1 -1
- package/dist/kit/Menu.d.ts +71 -9
- package/dist/kit/Menu.d.ts.map +1 -1
- package/dist/kit/Menu.js +119 -21
- package/dist/kit/Menu.js.map +1 -1
- package/dist/kit/Modal.d.ts +37 -4
- package/dist/kit/Modal.d.ts.map +1 -1
- package/dist/kit/Modal.js +42 -14
- package/dist/kit/Modal.js.map +1 -1
- package/dist/kit/MultiCombobox.d.ts +48 -1
- package/dist/kit/MultiCombobox.d.ts.map +1 -1
- package/dist/kit/MultiCombobox.js +100 -27
- package/dist/kit/MultiCombobox.js.map +1 -1
- package/dist/kit/Picker.d.ts +6 -1
- package/dist/kit/Picker.d.ts.map +1 -1
- package/dist/kit/Picker.js +10 -5
- package/dist/kit/Picker.js.map +1 -1
- package/dist/kit/Popover.d.ts +13 -1
- package/dist/kit/Popover.d.ts.map +1 -1
- package/dist/kit/Popover.js +31 -9
- package/dist/kit/Popover.js.map +1 -1
- package/dist/kit/Skeleton.d.ts +44 -3
- package/dist/kit/Skeleton.d.ts.map +1 -1
- package/dist/kit/Skeleton.js +39 -1
- package/dist/kit/Skeleton.js.map +1 -1
- package/dist/kit/Stepper.d.ts +33 -0
- package/dist/kit/Stepper.d.ts.map +1 -0
- package/dist/kit/Stepper.js +97 -0
- package/dist/kit/Stepper.js.map +1 -0
- package/dist/kit/TabStrip.d.ts.map +1 -1
- package/dist/kit/TabStrip.js +7 -2
- package/dist/kit/TabStrip.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type IconName } from "./Icon.tsx";
|
|
3
|
+
import { type AnchoredAlign, type AnchoredSide } from "./Anchored.tsx";
|
|
4
|
+
/** A local calendar day, `YYYY-MM-DD`. */
|
|
5
|
+
export type DayKey = string;
|
|
6
|
+
/** A range of days; either end is null while the range is half-picked or open-ended. */
|
|
7
|
+
export type DateRangeValue = [DayKey | null, DayKey | null];
|
|
8
|
+
/** The local calendar day a Date falls on, as `YYYY-MM-DD`. */
|
|
9
|
+
export declare function toDayKey(d: Date): DayKey;
|
|
10
|
+
/** `YYYY-MM-DD` as local midnight, or null if it is not one. Any other Date-parsable string is read and truncated to its local day. */
|
|
11
|
+
export declare function fromDayKey(s: string | null | undefined): Date | null;
|
|
12
|
+
interface CalendarCommon {
|
|
13
|
+
/** the earliest day that can be picked (`YYYY-MM-DD` or a Date) */
|
|
14
|
+
min?: DayKey | Date | undefined;
|
|
15
|
+
/** the latest day that can be picked */
|
|
16
|
+
max?: DayKey | Date | undefined;
|
|
17
|
+
/** further days that cannot be picked — weekends, a blackout */
|
|
18
|
+
isDisabled?: ((day: DayKey) => boolean) | undefined;
|
|
19
|
+
/** 1 (default) starts weeks on Monday, 0 on Sunday */
|
|
20
|
+
weekStartsOn?: 0 | 1 | undefined;
|
|
21
|
+
/** BCP 47 locale for the month and weekday names (default: the browser's) */
|
|
22
|
+
locale?: string | undefined;
|
|
23
|
+
/** focus the selected day (or today) on mount, for a calendar opened from a trigger */
|
|
24
|
+
autoFocus?: boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
export type CalendarProps = CalendarCommon & ({
|
|
27
|
+
mode?: "single" | undefined;
|
|
28
|
+
value: DayKey | null;
|
|
29
|
+
onChange: (day: DayKey) => void;
|
|
30
|
+
} | {
|
|
31
|
+
mode: "range";
|
|
32
|
+
value: DateRangeValue;
|
|
33
|
+
/** every click: `[day, null]` after the first, the ordered pair after the second */
|
|
34
|
+
onChange: (range: DateRangeValue) => void;
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Calendar: one month of days to pick from — one day, or a range. A range
|
|
38
|
+
* takes two clicks in either order (the second may be the same day, for a
|
|
39
|
+
* one-day range) and previews itself under the pointer in between. Keyboard
|
|
40
|
+
* as a date grid: arrows move a day or a week, Page Up/Down a month (with
|
|
41
|
+
* Shift, a year), Home/End the week's ends, Enter or Space picks.
|
|
42
|
+
*/
|
|
43
|
+
export declare function Calendar(props: CalendarProps): import("react").JSX.Element;
|
|
44
|
+
/** A named shortcut — "Last 7 days", "Tomorrow". Computed when the picker opens, so "today" is today. */
|
|
45
|
+
export interface DatePreset<V> {
|
|
46
|
+
label: string;
|
|
47
|
+
value: V | (() => V);
|
|
48
|
+
}
|
|
49
|
+
interface DatePickerCommon extends Omit<CalendarCommon, "autoFocus"> {
|
|
50
|
+
/** shown while nothing is picked (default "Pick a date" / "Any time") */
|
|
51
|
+
placeholder?: ReactNode | undefined;
|
|
52
|
+
/** an × that empties it (default true) */
|
|
53
|
+
clearable?: boolean | undefined;
|
|
54
|
+
disabled?: boolean | undefined;
|
|
55
|
+
/** accessible name, when no Field label names it */
|
|
56
|
+
label?: string | undefined;
|
|
57
|
+
id?: string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* `field` (default) is a form control the width of its container. `chip`
|
|
60
|
+
* is a filter-bar chip — lit while a value is set, with its own clear ×.
|
|
61
|
+
*/
|
|
62
|
+
variant?: "field" | "chip" | undefined;
|
|
63
|
+
/** the trigger's glyph (default calendar) */
|
|
64
|
+
icon?: IconName | (string & {}) | undefined;
|
|
65
|
+
/** which side of the trigger the calendar opens on (default bottom) */
|
|
66
|
+
side?: AnchoredSide | undefined;
|
|
67
|
+
align?: AnchoredAlign | undefined;
|
|
68
|
+
/** a column beside the calendar — a list of months with counts, say; `close` dismisses the picker */
|
|
69
|
+
aside?: ((close: () => void) => ReactNode) | undefined;
|
|
70
|
+
/** submits the value with a plain <form> under this name (a range as `from/to`) */
|
|
71
|
+
name?: string | undefined;
|
|
72
|
+
}
|
|
73
|
+
export type DatePickerProps = DatePickerCommon & ({
|
|
74
|
+
mode?: "single" | undefined;
|
|
75
|
+
value: DayKey | null;
|
|
76
|
+
onChange: (day: DayKey | null) => void;
|
|
77
|
+
presets?: DatePreset<DayKey>[] | undefined;
|
|
78
|
+
/** how the trigger shows the value (default "3 Mar 2026") */
|
|
79
|
+
format?: ((day: DayKey) => ReactNode) | undefined;
|
|
80
|
+
} | {
|
|
81
|
+
mode: "range";
|
|
82
|
+
value: DateRangeValue;
|
|
83
|
+
/** once a range is complete (both ends), or a preset or clear is chosen */
|
|
84
|
+
onChange: (range: DateRangeValue) => void;
|
|
85
|
+
presets?: DatePreset<DateRangeValue>[] | undefined;
|
|
86
|
+
/** how the trigger shows the value (default "3 Mar 2026 – 9 Mar 2026"; see `months`) */
|
|
87
|
+
format?: ((range: DateRangeValue) => ReactNode) | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The default caption names whole calendar months: a range that is all of
|
|
90
|
+
* March reads "March 2026" — a month picked from an `aside` list of months
|
|
91
|
+
* (1.4; default false). Ignored when `format` is given.
|
|
92
|
+
*/
|
|
93
|
+
months?: boolean | undefined;
|
|
94
|
+
});
|
|
95
|
+
export interface DescribeDateRangeOptions {
|
|
96
|
+
/** BCP 47 locale (default: the browser's) */
|
|
97
|
+
locale?: string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* A range that is exactly whole calendar months reads as the months:
|
|
100
|
+
* 1–31 Mar 2026 is "March 2026", 1 Mar–31 May 2026 "March – May 2026"
|
|
101
|
+
* (1.4; default false, so existing captions do not change).
|
|
102
|
+
*/
|
|
103
|
+
months?: boolean | undefined;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The default caption for a range: "3 Mar 2026 – 9 Mar 2026", "From 3 Mar 2026",
|
|
107
|
+
* "Until 9 Mar 2026". The second argument is a locale or options; with
|
|
108
|
+
* `{ months: true }` a whole calendar month reads "March 2026".
|
|
109
|
+
*/
|
|
110
|
+
export declare function describeDateRange([a, b]: DateRangeValue, opts?: string | DescribeDateRangeOptions): string | null;
|
|
111
|
+
/**
|
|
112
|
+
* DatePicker: a day, or a range of days, picked from a Calendar that opens
|
|
113
|
+
* from a trigger. The `field` variant is a form control (it goes red inside a
|
|
114
|
+
* Field with an `error`); the `chip` variant sits in a filter bar and lights
|
|
115
|
+
* while a value is set. `presets` are the shortcuts a range picker wants
|
|
116
|
+
* ("Last 7 days"). The calendar portals to document.body, flips near a viewport
|
|
117
|
+
* edge, and Escape closes it before any modal it sits in.
|
|
118
|
+
*
|
|
119
|
+
* A range is held inside the picker while it is half-picked and handed up
|
|
120
|
+
* only once both ends are chosen, so a list filtered on it does not refetch
|
|
121
|
+
* for a range that is still being drawn.
|
|
122
|
+
*/
|
|
123
|
+
export declare function DatePicker(props: DatePickerProps): import("react").JSX.Element;
|
|
124
|
+
export {};
|
|
125
|
+
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/kit/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAcjF,0CAA0C;AAC1C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAI5D,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAExC;AAED,uIAAuI;AACvI,wBAAgB,UAAU,CAAC,CAAC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AE,cAAc,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,EAAE,GAAG,SAAS,CAAC;IACnD,wFAAwF;IACxF,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,SAAS,CAAC,GAAG,SAAS,CAAC;IAC5D;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B,CACF,CAAC;AAKF,MAAM,WAAW,wBAAwB;IACvC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAiBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,wBAAwB,GAAG,MAAM,GAAG,IAAI,CAUjH;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAuJhD"}
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { v } from "../theme/tokens.js";
|
|
5
|
+
import { Icon } from "./Icon.js";
|
|
6
|
+
import { IconButton } from "./Button.js";
|
|
7
|
+
import { Anchored } from "./Anchored.js";
|
|
8
|
+
import { useEscapeLayer } from "./layers.js";
|
|
9
|
+
import { useField } from "./Form.js";
|
|
10
|
+
import { chipCss } from "./Chip.js";
|
|
11
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
12
|
+
/** The local calendar day a Date falls on, as `YYYY-MM-DD`. */
|
|
13
|
+
export function toDayKey(d) {
|
|
14
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
15
|
+
}
|
|
16
|
+
/** `YYYY-MM-DD` as local midnight, or null if it is not one. Any other Date-parsable string is read and truncated to its local day. */
|
|
17
|
+
export function fromDayKey(s) {
|
|
18
|
+
if (!s)
|
|
19
|
+
return null;
|
|
20
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
21
|
+
if (m)
|
|
22
|
+
return new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
|
|
23
|
+
const d = new Date(s);
|
|
24
|
+
return Number.isNaN(+d) ? null : new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
25
|
+
}
|
|
26
|
+
const asKey = (d) => d === undefined ? null : typeof d === "string" ? (fromDayKey(d) ? toDayKey(fromDayKey(d)) : null) : toDayKey(d);
|
|
27
|
+
const addDays = (k, n) => {
|
|
28
|
+
const d = fromDayKey(k);
|
|
29
|
+
return toDayKey(new Date(d.getFullYear(), d.getMonth(), d.getDate() + n));
|
|
30
|
+
};
|
|
31
|
+
const addMonths = (k, n) => {
|
|
32
|
+
const d = fromDayKey(k);
|
|
33
|
+
const target = new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
34
|
+
const last = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();
|
|
35
|
+
return toDayKey(new Date(target.getFullYear(), target.getMonth(), Math.min(d.getDate(), last)));
|
|
36
|
+
};
|
|
37
|
+
const monthOf = (k) => k.slice(0, 7);
|
|
38
|
+
/* ------------------------------------------------------------------ Calendar */
|
|
39
|
+
const CalWrap = styled.div `
|
|
40
|
+
width: 252px;
|
|
41
|
+
user-select: none;
|
|
42
|
+
`;
|
|
43
|
+
const CalHead = styled.div `
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
margin-bottom: 6px;
|
|
48
|
+
font-size: 12.5px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
color: ${v.text};
|
|
51
|
+
button:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; }
|
|
52
|
+
`;
|
|
53
|
+
const Week = styled.div `
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: repeat(7, 36px);
|
|
56
|
+
`;
|
|
57
|
+
const Weekday = styled.span `
|
|
58
|
+
height: 26px;
|
|
59
|
+
display: grid;
|
|
60
|
+
place-items: center;
|
|
61
|
+
font-size: 10.5px;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
color: ${v.faint};
|
|
64
|
+
`;
|
|
65
|
+
const Cell = styled.div `
|
|
66
|
+
padding: 1px 0;
|
|
67
|
+
${(p) => p.$band === "mid" && css `background: ${v.brand12};`}
|
|
68
|
+
${(p) => p.$band === "start" && css `background: linear-gradient(to right, transparent 50%, ${v.brand12} 50%);`}
|
|
69
|
+
${(p) => p.$band === "end" && css `background: linear-gradient(to left, transparent 50%, ${v.brand12} 50%);`}
|
|
70
|
+
`;
|
|
71
|
+
const Day = styled.button `
|
|
72
|
+
width: 36px;
|
|
73
|
+
height: 32px;
|
|
74
|
+
display: grid;
|
|
75
|
+
place-items: center;
|
|
76
|
+
border-radius: ${v.rCtl};
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
font-variant-numeric: tabular-nums;
|
|
79
|
+
color: ${(p) => (p.$outside ? v.faint : v.text)};
|
|
80
|
+
border: 1px solid ${(p) => (p.$today ? v.line2 : "transparent")};
|
|
81
|
+
transition: background 0.12s ease;
|
|
82
|
+
&:hover:not(:disabled) { background: ${v.hover}; }
|
|
83
|
+
&:disabled { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
|
|
84
|
+
&:focus-visible { box-shadow: ${v.ring}; border-radius: ${v.rCtl}; }
|
|
85
|
+
${(p) => p.$edge &&
|
|
86
|
+
css `
|
|
87
|
+
background: ${v.grad};
|
|
88
|
+
color: ${v.onBrand};
|
|
89
|
+
border-color: transparent;
|
|
90
|
+
&:hover:not(:disabled) { background: ${v.grad}; filter: brightness(1.08); }
|
|
91
|
+
`}
|
|
92
|
+
`;
|
|
93
|
+
/**
|
|
94
|
+
* Calendar: one month of days to pick from — one day, or a range. A range
|
|
95
|
+
* takes two clicks in either order (the second may be the same day, for a
|
|
96
|
+
* one-day range) and previews itself under the pointer in between. Keyboard
|
|
97
|
+
* as a date grid: arrows move a day or a week, Page Up/Down a month (with
|
|
98
|
+
* Shift, a year), Home/End the week's ends, Enter or Space picks.
|
|
99
|
+
*/
|
|
100
|
+
export function Calendar(props) {
|
|
101
|
+
const { min, max, isDisabled, weekStartsOn = 1, locale, autoFocus } = props;
|
|
102
|
+
const range = props.mode === "range";
|
|
103
|
+
const from = range ? props.value[0] : props.value;
|
|
104
|
+
const to = range ? props.value[1] : props.value;
|
|
105
|
+
const lo = asKey(min);
|
|
106
|
+
const hi = asKey(max);
|
|
107
|
+
const today = toDayKey(new Date());
|
|
108
|
+
const off = (k) => (!!lo && k < lo) || (!!hi && k > hi) || !!isDisabled?.(k);
|
|
109
|
+
const initial = to ?? from ?? (hi && today > hi ? hi : lo && today < lo ? lo : today);
|
|
110
|
+
const [focus, setFocus] = useState(initial);
|
|
111
|
+
const [hover, setHover] = useState(null);
|
|
112
|
+
const month = monthOf(focus);
|
|
113
|
+
const grid = useRef(null);
|
|
114
|
+
const keyed = useRef(!!autoFocus);
|
|
115
|
+
// the focused day follows the keyboard; the DOM focus follows it once the keyboard has been used
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!keyed.current)
|
|
118
|
+
return;
|
|
119
|
+
grid.current?.querySelector(`[data-day="${focus}"]`)?.focus();
|
|
120
|
+
}, [focus]);
|
|
121
|
+
const first = fromDayKey(`${month}-01`);
|
|
122
|
+
const lead = (first.getDay() - weekStartsOn + 7) % 7;
|
|
123
|
+
const start = toDayKey(new Date(first.getFullYear(), first.getMonth(), 1 - lead));
|
|
124
|
+
const weeks = Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, d) => addDays(start, w * 7 + d)));
|
|
125
|
+
const weekdays = weeks[0].map((k) => fromDayKey(k).toLocaleDateString(locale, { weekday: "short" }).slice(0, 2));
|
|
126
|
+
const title = first.toLocaleDateString(locale, { month: "long", year: "numeric" });
|
|
127
|
+
const prevMonthLast = toDayKey(new Date(first.getFullYear(), first.getMonth(), 0));
|
|
128
|
+
const nextMonthFirst = toDayKey(new Date(first.getFullYear(), first.getMonth() + 1, 1));
|
|
129
|
+
const canPrev = !lo || prevMonthLast >= lo;
|
|
130
|
+
const canNext = !hi || nextMonthFirst <= hi;
|
|
131
|
+
const pick = (k) => {
|
|
132
|
+
if (off(k))
|
|
133
|
+
return;
|
|
134
|
+
setFocus(k);
|
|
135
|
+
if (props.mode !== "range") {
|
|
136
|
+
props.onChange(k);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const [a, b] = props.value;
|
|
140
|
+
if (!a || b)
|
|
141
|
+
props.onChange([k, null]);
|
|
142
|
+
else
|
|
143
|
+
props.onChange(k < a ? [k, a] : [a, k]);
|
|
144
|
+
};
|
|
145
|
+
// the band a range draws, previewed under the pointer while half-picked
|
|
146
|
+
const bandTo = range && from && !to && hover ? hover : to;
|
|
147
|
+
const [bLo, bHi] = from && bandTo ? (bandTo < from ? [bandTo, from] : [from, bandTo]) : [null, null];
|
|
148
|
+
const onKey = (e) => {
|
|
149
|
+
const step = {
|
|
150
|
+
ArrowLeft: () => addDays(focus, -1),
|
|
151
|
+
ArrowRight: () => addDays(focus, 1),
|
|
152
|
+
ArrowUp: () => addDays(focus, -7),
|
|
153
|
+
ArrowDown: () => addDays(focus, 7),
|
|
154
|
+
PageUp: () => addMonths(focus, e.shiftKey ? -12 : -1),
|
|
155
|
+
PageDown: () => addMonths(focus, e.shiftKey ? 12 : 1),
|
|
156
|
+
Home: () => addDays(focus, -((fromDayKey(focus).getDay() - weekStartsOn + 7) % 7)),
|
|
157
|
+
End: () => addDays(focus, 6 - ((fromDayKey(focus).getDay() - weekStartsOn + 7) % 7)),
|
|
158
|
+
};
|
|
159
|
+
const go = step[e.key];
|
|
160
|
+
if (go) {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
keyed.current = true;
|
|
163
|
+
let next = go();
|
|
164
|
+
if (lo && next < lo)
|
|
165
|
+
next = lo;
|
|
166
|
+
if (hi && next > hi)
|
|
167
|
+
next = hi;
|
|
168
|
+
setFocus(next);
|
|
169
|
+
if (range && from && !to)
|
|
170
|
+
setHover(next);
|
|
171
|
+
}
|
|
172
|
+
else if (e.key === "Enter" || e.key === " ") {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
pick(focus);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
return (_jsxs(CalWrap, { children: [_jsxs(CalHead, { children: [_jsx(IconButton, { "$size": 26, "aria-label": "Previous month", disabled: !canPrev, onClick: () => setFocus(addMonths(focus, -1) < (lo ?? "") ? lo : addMonths(focus, -1)), children: _jsx(Icon, { name: "chevron-left" }) }), _jsx("span", { "aria-live": "polite", children: title }), _jsx(IconButton, { "$size": 26, "aria-label": "Next month", disabled: !canNext, onClick: () => setFocus(hi && addMonths(focus, 1) > hi ? hi : addMonths(focus, 1)), children: _jsx(Icon, { name: "chevron-right" }) })] }), _jsxs("div", { ref: grid, role: "grid", "aria-label": title, "aria-multiselectable": range || undefined, onKeyDown: onKey, onMouseLeave: () => setHover(null), children: [_jsx(Week, { role: "row", children: weekdays.map((w, i) => _jsx(Weekday, { role: "columnheader", children: w }, i)) }), weeks.map((week) => (_jsx(Week, { role: "row", children: week.map((k) => {
|
|
178
|
+
const edge = k === from || k === to;
|
|
179
|
+
const inBand = !!bLo && !!bHi && k >= bLo && k <= bHi && bLo !== bHi;
|
|
180
|
+
const band = !inBand ? "none" : k === bLo ? "start" : k === bHi ? "end" : "mid";
|
|
181
|
+
const selected = edge || (!!from && !!to && k > from && k < to);
|
|
182
|
+
const date = fromDayKey(k);
|
|
183
|
+
return (_jsx(Cell, { role: "gridcell", "aria-selected": selected, "$band": band, children: _jsx(Day, { type: "button", "data-day": k, tabIndex: k === focus ? 0 : -1, disabled: off(k), "aria-label": date.toLocaleDateString(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }), "aria-current": k === today ? "date" : undefined, "$edge": edge, "$outside": monthOf(k) !== month, "$today": k === today, onMouseEnter: () => setHover(k), onFocus: () => setFocus(k), onClick: () => pick(k), children: date.getDate() }) }, k));
|
|
184
|
+
}) }, week[0])))] })] }));
|
|
185
|
+
}
|
|
186
|
+
/* ------------------------------------------------------------------ DatePicker */
|
|
187
|
+
const FieldBox = styled.div `
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
width: 100%;
|
|
191
|
+
min-width: 0;
|
|
192
|
+
height: 32px;
|
|
193
|
+
border-radius: ${v.rCtl};
|
|
194
|
+
background: ${v.field};
|
|
195
|
+
border: 1px solid ${(p) => (p.$invalid ? v.danger : p.$open ? v.brand55 : v.fieldLine)};
|
|
196
|
+
${(p) => p.$open && css `box-shadow: 0 0 0 3px ${p.$invalid ? v.dangerBg : v.brand08};`}
|
|
197
|
+
${(p) => p.$disabled && css `opacity: 0.55;`}
|
|
198
|
+
&:focus-within { border-color: ${(p) => (p.$invalid ? v.danger : v.brand55)}; }
|
|
199
|
+
`;
|
|
200
|
+
const FieldBtn = styled.button `
|
|
201
|
+
flex: 1 1 auto;
|
|
202
|
+
min-width: 0;
|
|
203
|
+
height: 100%;
|
|
204
|
+
display: flex;
|
|
205
|
+
align-items: center;
|
|
206
|
+
gap: 8px;
|
|
207
|
+
padding: 0 10px;
|
|
208
|
+
text-align: left;
|
|
209
|
+
font-size: 12.5px;
|
|
210
|
+
color: ${(p) => (p.$placeholder ? v.faint : v.text)};
|
|
211
|
+
&:focus-visible { box-shadow: none; }
|
|
212
|
+
&:disabled { cursor: not-allowed; }
|
|
213
|
+
> .val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
214
|
+
> svg { flex: none; color: ${v.faint}; font-size: 12px; }
|
|
215
|
+
`;
|
|
216
|
+
const ChipBox = styled.span `
|
|
217
|
+
${chipCss}
|
|
218
|
+
padding: 0;
|
|
219
|
+
gap: 0;
|
|
220
|
+
cursor: default;
|
|
221
|
+
&:has(button:focus-visible) { box-shadow: ${v.ring}; }
|
|
222
|
+
`;
|
|
223
|
+
const ChipBtn = styled.button `
|
|
224
|
+
display: inline-flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
gap: 6px;
|
|
227
|
+
height: 100%;
|
|
228
|
+
padding: 0 10px;
|
|
229
|
+
border-radius: 999px;
|
|
230
|
+
font: inherit;
|
|
231
|
+
color: inherit;
|
|
232
|
+
&:focus-visible { box-shadow: none; }
|
|
233
|
+
&:disabled { cursor: not-allowed; }
|
|
234
|
+
svg { font-size: 11px; }
|
|
235
|
+
`;
|
|
236
|
+
const ClearBtn = styled.button `
|
|
237
|
+
flex: none;
|
|
238
|
+
display: inline-grid;
|
|
239
|
+
place-items: center;
|
|
240
|
+
width: 22px;
|
|
241
|
+
height: 22px;
|
|
242
|
+
margin: ${(p) => (p.$chip ? "0 3px 0 -6px" : "0 5px 0 0")};
|
|
243
|
+
border-radius: ${(p) => (p.$chip ? "50%" : "6px")};
|
|
244
|
+
color: ${v.faint};
|
|
245
|
+
font-size: 10px;
|
|
246
|
+
&:hover { color: ${v.text}; background: ${v.hover}; }
|
|
247
|
+
`;
|
|
248
|
+
const Panel = styled.div `
|
|
249
|
+
display: flex;
|
|
250
|
+
align-items: flex-start;
|
|
251
|
+
gap: 12px;
|
|
252
|
+
padding: 10px 12px 12px;
|
|
253
|
+
background: ${v.surface};
|
|
254
|
+
border: 1px solid ${v.line2};
|
|
255
|
+
border-radius: ${v.rCard};
|
|
256
|
+
box-shadow: ${v.elev};
|
|
257
|
+
max-width: calc(100vw - 16px);
|
|
258
|
+
overflow-x: auto;
|
|
259
|
+
> .side {
|
|
260
|
+
align-self: stretch;
|
|
261
|
+
border-left: 1px solid ${v.line};
|
|
262
|
+
padding-left: 12px;
|
|
263
|
+
min-width: 160px;
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
const Presets = styled.div `
|
|
267
|
+
display: flex;
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
gap: 2px;
|
|
270
|
+
min-width: 112px;
|
|
271
|
+
padding-right: 10px;
|
|
272
|
+
border-right: 1px solid ${v.line};
|
|
273
|
+
align-self: stretch;
|
|
274
|
+
> button {
|
|
275
|
+
height: 26px;
|
|
276
|
+
padding: 0 8px;
|
|
277
|
+
border-radius: ${v.rCtl};
|
|
278
|
+
font-size: 11.5px;
|
|
279
|
+
font-weight: 600;
|
|
280
|
+
text-align: left;
|
|
281
|
+
color: ${v.muted};
|
|
282
|
+
white-space: nowrap;
|
|
283
|
+
&:hover { background: ${v.hover}; color: ${v.text}; }
|
|
284
|
+
&[aria-pressed="true"] { background: ${v.brand12}; color: ${v.brand}; }
|
|
285
|
+
}
|
|
286
|
+
`;
|
|
287
|
+
const Foot = styled.div `
|
|
288
|
+
display: flex;
|
|
289
|
+
justify-content: space-between;
|
|
290
|
+
align-items: center;
|
|
291
|
+
margin-top: 8px;
|
|
292
|
+
font-size: 11px;
|
|
293
|
+
color: ${v.faint};
|
|
294
|
+
> button { font-size: 11.5px; font-weight: 600; color: ${v.muted}; padding: 3px 6px; border-radius: 6px; }
|
|
295
|
+
> button:hover { color: ${v.text}; background: ${v.hover}; }
|
|
296
|
+
`;
|
|
297
|
+
const dayLabel = (k, locale) => fromDayKey(k).toLocaleDateString(locale, { day: "numeric", month: "short", year: "numeric" });
|
|
298
|
+
const monthLabel = (d, locale, year = true) => d.toLocaleDateString(locale, year ? { month: "long", year: "numeric" } : { month: "long" });
|
|
299
|
+
/** "March 2026" / "March – May 2026" for a range of whole calendar months, else null. */
|
|
300
|
+
function describeMonths(a, b, locale) {
|
|
301
|
+
const from = fromDayKey(a);
|
|
302
|
+
const to = fromDayKey(b);
|
|
303
|
+
if (!from || !to || from > to || from.getDate() !== 1)
|
|
304
|
+
return null;
|
|
305
|
+
// the day after `to` is the 1st: `to` is the last day of its month
|
|
306
|
+
if (new Date(to.getFullYear(), to.getMonth(), to.getDate() + 1).getDate() !== 1)
|
|
307
|
+
return null;
|
|
308
|
+
const sameYear = from.getFullYear() === to.getFullYear();
|
|
309
|
+
if (sameYear && from.getMonth() === to.getMonth())
|
|
310
|
+
return monthLabel(from, locale);
|
|
311
|
+
return `${monthLabel(from, locale, !sameYear)} – ${monthLabel(to, locale)}`;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* The default caption for a range: "3 Mar 2026 – 9 Mar 2026", "From 3 Mar 2026",
|
|
315
|
+
* "Until 9 Mar 2026". The second argument is a locale or options; with
|
|
316
|
+
* `{ months: true }` a whole calendar month reads "March 2026".
|
|
317
|
+
*/
|
|
318
|
+
export function describeDateRange([a, b], opts) {
|
|
319
|
+
const { locale, months } = typeof opts === "string" ? { locale: opts, months: false } : (opts ?? {});
|
|
320
|
+
if (a && b && months) {
|
|
321
|
+
const m = describeMonths(a, b, locale);
|
|
322
|
+
if (m)
|
|
323
|
+
return m;
|
|
324
|
+
}
|
|
325
|
+
if (a && b)
|
|
326
|
+
return a === b ? dayLabel(a, locale) : `${dayLabel(a, locale)} – ${dayLabel(b, locale)}`;
|
|
327
|
+
if (a)
|
|
328
|
+
return `From ${dayLabel(a, locale)}`;
|
|
329
|
+
if (b)
|
|
330
|
+
return `Until ${dayLabel(b, locale)}`;
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
const presetValue = (p) => (typeof p.value === "function" ? p.value() : p.value);
|
|
334
|
+
/**
|
|
335
|
+
* DatePicker: a day, or a range of days, picked from a Calendar that opens
|
|
336
|
+
* from a trigger. The `field` variant is a form control (it goes red inside a
|
|
337
|
+
* Field with an `error`); the `chip` variant sits in a filter bar and lights
|
|
338
|
+
* while a value is set. `presets` are the shortcuts a range picker wants
|
|
339
|
+
* ("Last 7 days"). The calendar portals to document.body, flips near a viewport
|
|
340
|
+
* edge, and Escape closes it before any modal it sits in.
|
|
341
|
+
*
|
|
342
|
+
* A range is held inside the picker while it is half-picked and handed up
|
|
343
|
+
* only once both ends are chosen, so a list filtered on it does not refetch
|
|
344
|
+
* for a range that is still being drawn.
|
|
345
|
+
*/
|
|
346
|
+
export function DatePicker(props) {
|
|
347
|
+
const { clearable = true, disabled, label, id, variant = "field", icon = "calendar", side, align, aside, name, locale } = props;
|
|
348
|
+
const range = props.mode === "range";
|
|
349
|
+
const field = useField();
|
|
350
|
+
const [open, setOpen] = useState(false);
|
|
351
|
+
const [draft, setDraft] = useState([null, null]);
|
|
352
|
+
const wrap = useRef(null);
|
|
353
|
+
const layer = useRef(null);
|
|
354
|
+
const trigger = useRef(null);
|
|
355
|
+
const panelId = useId();
|
|
356
|
+
const empty = range ? !props.value[0] && !props.value[1] : !props.value;
|
|
357
|
+
const caption = empty
|
|
358
|
+
? (props.placeholder ?? (range ? "Any time" : "Pick a date"))
|
|
359
|
+
: props.mode === "range"
|
|
360
|
+
? (props.format ? props.format(props.value) : describeDateRange(props.value, { locale, months: props.months }))
|
|
361
|
+
: (props.format ? props.format(props.value) : dayLabel(props.value, locale));
|
|
362
|
+
// focus goes back to the trigger after the panel has gone (asked for here, done in an effect)
|
|
363
|
+
const [refocus, setRefocus] = useState(0);
|
|
364
|
+
useEffect(() => { if (refocus)
|
|
365
|
+
trigger.current?.focus(); }, [refocus]);
|
|
366
|
+
const close = (back) => {
|
|
367
|
+
setOpen(false);
|
|
368
|
+
if (back)
|
|
369
|
+
setRefocus((n) => n + 1);
|
|
370
|
+
};
|
|
371
|
+
const show = () => {
|
|
372
|
+
if (disabled)
|
|
373
|
+
return;
|
|
374
|
+
if (props.mode === "range")
|
|
375
|
+
setDraft(props.value);
|
|
376
|
+
setOpen(true);
|
|
377
|
+
};
|
|
378
|
+
useEscapeLayer(open, () => close(true));
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
if (!open)
|
|
381
|
+
return;
|
|
382
|
+
const onDown = (e) => {
|
|
383
|
+
const t = e.target;
|
|
384
|
+
if (!wrap.current?.contains(t) && !layer.current?.contains(t))
|
|
385
|
+
setOpen(false);
|
|
386
|
+
};
|
|
387
|
+
document.addEventListener("mousedown", onDown, true);
|
|
388
|
+
return () => document.removeEventListener("mousedown", onDown, true);
|
|
389
|
+
}, [open]);
|
|
390
|
+
const clear = () => {
|
|
391
|
+
if (props.mode === "range")
|
|
392
|
+
props.onChange([null, null]);
|
|
393
|
+
else
|
|
394
|
+
props.onChange(null);
|
|
395
|
+
setDraft([null, null]);
|
|
396
|
+
};
|
|
397
|
+
const common = { min: props.min, max: props.max, isDisabled: props.isDisabled, weekStartsOn: props.weekStartsOn, locale };
|
|
398
|
+
const calendar = props.mode === "range" ? (_jsx(Calendar, { ...common, mode: "range", autoFocus: true, value: draft, onChange: (r) => {
|
|
399
|
+
setDraft(r);
|
|
400
|
+
if (r[0] && r[1]) {
|
|
401
|
+
props.onChange(r);
|
|
402
|
+
close(true);
|
|
403
|
+
}
|
|
404
|
+
} })) : (_jsx(Calendar, { ...common, autoFocus: true, value: props.value, onChange: (d) => { props.onChange(d); close(true); } }));
|
|
405
|
+
const presets = props.presets?.length ? (_jsx(Presets, { role: "group", "aria-label": "Shortcuts", children: props.mode === "range"
|
|
406
|
+
? props.presets.map((p) => {
|
|
407
|
+
const val = presetValue(p);
|
|
408
|
+
return (_jsx("button", { type: "button", "aria-pressed": val[0] === props.value[0] && val[1] === props.value[1], onClick: () => { props.onChange(val); close(true); }, children: p.label }, p.label));
|
|
409
|
+
})
|
|
410
|
+
: props.presets.map((p) => {
|
|
411
|
+
const val = presetValue(p);
|
|
412
|
+
return (_jsx("button", { type: "button", "aria-pressed": val === props.value, onClick: () => { props.onChange(val); close(true); }, children: p.label }, p.label));
|
|
413
|
+
}) })) : null;
|
|
414
|
+
const half = range && open && draft[0] && !draft[1];
|
|
415
|
+
const triggerProps = {
|
|
416
|
+
ref: trigger,
|
|
417
|
+
type: "button",
|
|
418
|
+
id: id,
|
|
419
|
+
disabled,
|
|
420
|
+
"aria-label": label,
|
|
421
|
+
"aria-haspopup": "dialog",
|
|
422
|
+
"aria-expanded": open,
|
|
423
|
+
"aria-controls": open ? panelId : undefined,
|
|
424
|
+
"aria-invalid": field?.invalid || undefined,
|
|
425
|
+
"aria-describedby": field?.describedBy,
|
|
426
|
+
onClick: () => (open ? close(false) : show()),
|
|
427
|
+
onKeyDown: (e) => { if (e.key === "ArrowDown" && !open) {
|
|
428
|
+
e.preventDefault();
|
|
429
|
+
show();
|
|
430
|
+
} },
|
|
431
|
+
};
|
|
432
|
+
const clearBtn = clearable && !empty && !disabled ? (_jsx(ClearBtn, { type: "button", "$chip": variant === "chip", "aria-label": range ? "Clear dates" : "Clear date", onClick: (e) => { e.stopPropagation(); clear(); }, children: _jsx(Icon, { name: "close" }) })) : null;
|
|
433
|
+
const hidden = name !== undefined
|
|
434
|
+
? _jsx("input", { type: "hidden", name: name, value: range ? `${props.value[0] ?? ""}/${props.value[1] ?? ""}` : (props.value ?? "") })
|
|
435
|
+
: null;
|
|
436
|
+
return (_jsxs("div", { ref: wrap, style: { display: variant === "chip" ? "inline-flex" : "block", minWidth: 0 }, children: [variant === "chip" ? (_jsxs(ChipBox, { "$on": !empty || open, children: [_jsxs(ChipBtn, { ...triggerProps, children: [_jsx(Icon, { name: icon }), _jsx("span", { children: caption })] }), clearBtn] })) : (_jsxs(FieldBox, { "$open": open, "$invalid": !!field?.invalid, "$disabled": !!disabled, children: [_jsxs(FieldBtn, { ...triggerProps, "$placeholder": empty, children: [_jsx(Icon, { name: icon }), _jsx("span", { className: "val", children: caption })] }), clearBtn] })), hidden, open ? (_jsx(Anchored, { anchor: wrap, align: align ?? "left", side: side, gap: 5, layerRef: layer, children: _jsxs(Panel, { id: panelId, role: "dialog", "aria-label": label ?? (range ? "Choose dates" : "Choose a date"), children: [presets, _jsxs("div", { children: [calendar, range ? (_jsxs(Foot, { children: [_jsx("span", { "aria-live": "polite", children: half ? "Pick the last day" : draft[0] ? "" : "Pick the first day" }), !empty || draft[0] ? _jsx("button", { type: "button", onClick: () => { clear(); }, children: "Clear" }) : null] })) : null] }), aside ? _jsx("div", { className: "side", children: aside(() => close(true)) }) : null] }) })) : null] }));
|
|
437
|
+
}
|
|
438
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../src/kit/DatePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AAC/F,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAiB,MAAM,WAAY,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAyC,MAAM,eAAgB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAY,CAAC;AAgBrC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAEtD,+DAA+D;AAC/D,MAAM,UAAU,QAAQ,CAAC,CAAO;IAC9B,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,uIAAuI;AACvI,MAAM,UAAU,UAAU,CAAC,CAA4B;IACrD,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,MAAM,CAAC,GAAG,2BA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AK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,sBAAgB,CAAC,CAAC,CAAC,IAAI,IACzF,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,KAAK,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,MAAM,YAAE,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAO,CAAC,CAAC,CAAC,IAAI,IAChE,GACC,CACZ,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type IconName } from "./Icon.tsx";
|
|
3
|
+
/** Whether a file matches an `accept` list of extensions (`.png`) and MIME types (`image/*`, `application/pdf`). */
|
|
4
|
+
export declare function fileAccepted(file: File, accept: string[] | undefined): boolean;
|
|
5
|
+
export interface DropzoneProps {
|
|
6
|
+
/** the accepted files, from a drop or the file dialog */
|
|
7
|
+
onFiles: (files: File[]) => void;
|
|
8
|
+
/** files that `accept` or `multiple` turned away, so the caller can say why */
|
|
9
|
+
onReject?: ((files: File[]) => void) | undefined;
|
|
10
|
+
/** extensions (`.png`) and MIME types (`image/*`) it takes; anything, by default */
|
|
11
|
+
accept?: string[] | undefined;
|
|
12
|
+
/** take several at once (default true) */
|
|
13
|
+
multiple?: boolean | undefined;
|
|
14
|
+
disabled?: boolean | undefined;
|
|
15
|
+
/** files are being taken in: a spinner, and no drops until it is done */
|
|
16
|
+
busy?: boolean | undefined;
|
|
17
|
+
/** the caption while `busy` (default "Uploading…") */
|
|
18
|
+
busyLabel?: ReactNode | undefined;
|
|
19
|
+
/** the caption (default "**Drop files here** or click to browse") */
|
|
20
|
+
children?: ReactNode | undefined;
|
|
21
|
+
/** a second line — the limits ("Up to 5 GB each") */
|
|
22
|
+
hint?: ReactNode | undefined;
|
|
23
|
+
/** the caption while files are over it (default "Drop to add") */
|
|
24
|
+
overLabel?: ReactNode | undefined;
|
|
25
|
+
icon?: IconName | (string & {}) | undefined;
|
|
26
|
+
/** one row rather than a block — under a list that already has files */
|
|
27
|
+
compact?: boolean | undefined;
|
|
28
|
+
/** accessible name (default "Choose files") */
|
|
29
|
+
label?: string | undefined;
|
|
30
|
+
/** take a whole folder from the file dialog (Chromium, Safari and Firefox all honour `webkitdirectory`) */
|
|
31
|
+
directory?: boolean | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Dropzone: drag files onto it, or click it (or Enter/Space) to browse.
|
|
35
|
+
* Three states — idle, files over it, busy — and it says which. Filters on
|
|
36
|
+
* `accept` itself, because a drop ignores the file dialog's filter; what it
|
|
37
|
+
* turns away goes to `onReject`. Generic: no upload, no queue, no progress —
|
|
38
|
+
* pair it with `TransferList` for that.
|
|
39
|
+
*/
|
|
40
|
+
export declare function Dropzone({ onFiles, onReject, accept, multiple, disabled, busy, busyLabel, children, hint, overLabel, icon, compact, label, directory, }: DropzoneProps): import("react").JSX.Element;
|
|
41
|
+
//# sourceMappingURL=Dropzone.d.ts.map
|