@photon-ai/pho-ui 2.17.0 → 3.0.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/chunks/{basic-page-CogcwGx3.js → basic-page-CYDwfVjO.js} +2 -2
- package/dist/chunks/{basic-page-CogcwGx3.js.map → basic-page-CYDwfVjO.js.map} +1 -1
- package/dist/chunks/calendar-4OFiCLAv.js +292 -0
- package/dist/chunks/calendar-4OFiCLAv.js.map +1 -0
- package/dist/chunks/date-picker-Bwa6J4ik.js +381 -0
- package/dist/chunks/date-picker-Bwa6J4ik.js.map +1 -0
- package/dist/chunks/{error-D0yoFxCv.js → error-BAQgnde7.js} +2 -2
- package/dist/chunks/{error-D0yoFxCv.js.map → error-BAQgnde7.js.map} +1 -1
- package/dist/chunks/{filter-bar-BsvdXwzc.js → filter-bar-D9lBBr4z.js} +2 -2
- package/dist/chunks/{filter-bar-BsvdXwzc.js.map → filter-bar-D9lBBr4z.js.map} +1 -1
- package/dist/components/calendar.js +5 -0
- package/dist/components/date-picker.js +6 -0
- package/dist/components/error.js +1 -1
- package/dist/components/filter-bar.js +1 -1
- package/dist/index.js +114 -116
- package/dist/primitives.js +1 -1
- package/dist/sections/basic-page.js +1 -1
- package/dist/src/components/calendar/calendar.d.ts +36 -0
- package/dist/src/components/calendar/index.d.ts +2 -0
- package/dist/src/components/date-picker/date-picker.d.ts +97 -0
- package/dist/src/components/date-picker/index.d.ts +2 -0
- package/dist/src/index.d.ts +2 -1
- package/package.json +10 -5
- package/dist/chunks/date-range-picker-DwFDUNRL.js +0 -88
- package/dist/chunks/date-range-picker-DwFDUNRL.js.map +0 -1
- package/dist/components/date-range-picker.js +0 -10
- package/dist/src/components/date-range-picker/date-range-picker.d.ts +0 -31
- package/dist/src/components/date-range-picker/index.d.ts +0 -1
package/dist/primitives.js
CHANGED
|
@@ -40,11 +40,11 @@ import "./primitives/toggle.js";
|
|
|
40
40
|
import "./primitives/toggle-group.js";
|
|
41
41
|
import "./primitives/toolbar.js";
|
|
42
42
|
import "./primitives/tooltip.js";
|
|
43
|
+
export * from "@base-ui/react/popover";
|
|
43
44
|
export * from "@base-ui/react/field";
|
|
44
45
|
export * from "@base-ui/react/separator";
|
|
45
46
|
export * from "@base-ui/react/dialog";
|
|
46
47
|
export * from "@base-ui/react/scroll-area";
|
|
47
|
-
export * from "@base-ui/react/popover";
|
|
48
48
|
export * from "@base-ui/react/collapsible";
|
|
49
49
|
export * from "@base-ui/react/avatar";
|
|
50
50
|
export * from "@base-ui/react/form";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as s } from "../chunks/data-table-DcwCgXJU.js";
|
|
3
|
-
import { a as E, c as a, d as C, f as S, i as I, l as e, m as o, n as B, o as P, p as N, r, s as t, t as D, u as R } from "../chunks/basic-page-
|
|
3
|
+
import { a as E, c as a, d as C, f as S, i as I, l as e, m as o, n as B, o as P, p as N, r, s as t, t as D, u as R } from "../chunks/basic-page-CYDwfVjO.js";
|
|
4
4
|
export {
|
|
5
5
|
D as AUTO_SAVE_DELAY_MS,
|
|
6
6
|
B as BASIC_PAGE_CALLOUT,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DayPickerProps } from 'react-day-picker';
|
|
2
|
+
export type CalendarProps = DayPickerProps & {
|
|
3
|
+
/**
|
|
4
|
+
* The word on the button back to today, used as its label and its tooltip.
|
|
5
|
+
* @default "Today"
|
|
6
|
+
*/
|
|
7
|
+
todayLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Calendar built on React DayPicker — a month of days to read or to choose
|
|
11
|
+
* from. Pass `mode` to make it selectable (`single`, `multiple`, `range`);
|
|
12
|
+
* without one it is a static month. Every DayPicker prop passes through, so
|
|
13
|
+
* `numberOfMonths`, `disabled`, `startMonth` / `endMonth`, `captionLayout`,
|
|
14
|
+
* and the locale props all work as documented upstream.
|
|
15
|
+
*
|
|
16
|
+
* Pho supplies the whole class map, so the library's stylesheet is neither
|
|
17
|
+
* imported nor needed. `classNames` and `components` merge over Pho's,
|
|
18
|
+
* element by element.
|
|
19
|
+
*
|
|
20
|
+
* The caption is clickable: month and year each open a jump list, so a date
|
|
21
|
+
* two years out is two taps rather than twenty-four. Pass
|
|
22
|
+
* `captionLayout="label"` for a caption that only reads, and `startMonth` /
|
|
23
|
+
* `endMonth` to say how far the year list should reach. Between the month
|
|
24
|
+
* arrows sits a way back to today's month.
|
|
25
|
+
*
|
|
26
|
+
* Selection follows DayPicker's own contract: hand it `onSelect` and the
|
|
27
|
+
* calendar is controlled, so `selected` has to come with it. Leave both off
|
|
28
|
+
* and it keeps the selection itself.
|
|
29
|
+
*
|
|
30
|
+
* For a calendar behind a field — a trigger that shows the chosen date and
|
|
31
|
+
* opens this in a popover — use `DatePicker`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function Calendar({ className, classNames, components, showOutsideDays, captionLayout, startMonth, endMonth, todayLabel, ...props }: CalendarProps): import("react").JSX.Element;
|
|
34
|
+
export declare namespace Calendar {
|
|
35
|
+
var displayName: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DateRange, PropsBase } from 'react-day-picker';
|
|
3
|
+
import { InputSize } from '../input';
|
|
4
|
+
/** The trigger wears Input's sizes so the two line up in one form. */
|
|
5
|
+
export type DatePickerSize = InputSize;
|
|
6
|
+
/**
|
|
7
|
+
* How fine the time is asked for, and read back. Omit it for a date alone.
|
|
8
|
+
* The value is always a `Date`; the granularity says which of its parts the
|
|
9
|
+
* viewer sets, and everything below is zeroed.
|
|
10
|
+
*/
|
|
11
|
+
export type DatePickerTime = "hour" | "minute" | "second";
|
|
12
|
+
/**
|
|
13
|
+
* The shape to type, in this locale's own order — `mm/dd/yyyy`,
|
|
14
|
+
* `yyyy-mm-dd`, `dd.mm.yyyy`. Lowercase, the way a browser's own date field
|
|
15
|
+
* writes it, so the two paths read alike.
|
|
16
|
+
*/
|
|
17
|
+
export declare function dateFieldMask(locales?: Intl.LocalesArgument, time?: DatePickerTime): string;
|
|
18
|
+
/**
|
|
19
|
+
* The figures in the field — `09/12/2026`, or `09/10/2026 – 09/13/2026` for a
|
|
20
|
+
* span, in the viewer's locale. An empty or half-finished range prints just
|
|
21
|
+
* the day that is settled; nothing selected prints nothing. Pass `time` to
|
|
22
|
+
* print the clock too, at the precision that was asked for.
|
|
23
|
+
*
|
|
24
|
+
* Figures rather than words (`Sep 12, 2026`) because the field is typed into:
|
|
25
|
+
* a month's name is the one part of a date nobody wants to spell.
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatDateLabel(value: Date | DateRange | undefined, locales?: Intl.LocalesArgument, time?: DatePickerTime): string;
|
|
28
|
+
interface DatePickerBaseProps {
|
|
29
|
+
/** Field label (associated for accessibility). */
|
|
30
|
+
label?: ReactNode;
|
|
31
|
+
/** Helper text below the field; rendered in the error color when `invalid`. */
|
|
32
|
+
hint?: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* What the field shows until something is chosen.
|
|
35
|
+
* @default the shape to type, in this locale's order (`mm/dd/yyyy`)
|
|
36
|
+
*/
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
/** Render the invalid state (error ring + error-colored hint). */
|
|
39
|
+
invalid?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/** Marks the label with the required asterisk. */
|
|
42
|
+
required?: boolean;
|
|
43
|
+
/** Size variant. @default "md" */
|
|
44
|
+
size?: DatePickerSize;
|
|
45
|
+
/**
|
|
46
|
+
* Ask for a time as well as a day, this fine. `hour` sets the hour and
|
|
47
|
+
* zeroes the rest, `minute` the hour and minute, `second` all three. Omit
|
|
48
|
+
* it and the value is midnight on the chosen day.
|
|
49
|
+
*/
|
|
50
|
+
time?: DatePickerTime;
|
|
51
|
+
/** Locale for the trigger's words. Defaults to the viewer's. */
|
|
52
|
+
locales?: Intl.LocalesArgument;
|
|
53
|
+
/**
|
|
54
|
+
* Everything else React DayPicker takes — `disabled` days, `startMonth` /
|
|
55
|
+
* `endMonth`, `numberOfMonths`, `weekStartsOn`, `captionLayout`.
|
|
56
|
+
*/
|
|
57
|
+
calendarProps?: PropsBase;
|
|
58
|
+
/** Id for the trigger, if the page needs its own. */
|
|
59
|
+
id?: string;
|
|
60
|
+
/** Class applied to the trigger. */
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface DatePickerSingleProps extends DatePickerBaseProps {
|
|
64
|
+
/** @default "single" */
|
|
65
|
+
mode?: "single";
|
|
66
|
+
value?: Date;
|
|
67
|
+
defaultValue?: Date;
|
|
68
|
+
onValueChange?: (value: Date | undefined) => void;
|
|
69
|
+
}
|
|
70
|
+
export interface DatePickerRangeProps extends DatePickerBaseProps {
|
|
71
|
+
mode: "range";
|
|
72
|
+
value?: DateRange;
|
|
73
|
+
defaultValue?: DateRange;
|
|
74
|
+
onValueChange?: (value: DateRange | undefined) => void;
|
|
75
|
+
}
|
|
76
|
+
export type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
|
|
77
|
+
/**
|
|
78
|
+
* Date Picker — a field that shows the chosen date and opens a `Calendar` to
|
|
79
|
+
* change it. `mode="range"` picks a span instead of a day; the popover stays
|
|
80
|
+
* open until both ends are down.
|
|
81
|
+
*
|
|
82
|
+
* The value is a `Date` (or a `{ from, to }` range), never a string: pass
|
|
83
|
+
* `value` to control it, `defaultValue` to let it keep its own. Clearing is
|
|
84
|
+
* built in — clicking the chosen day again unsets it.
|
|
85
|
+
*
|
|
86
|
+
* `time` asks for the clock as well, to the hour, the minute, or the second.
|
|
87
|
+
*
|
|
88
|
+
* On a touch device the field hands off to the system picker — the OS wheel or
|
|
89
|
+
* dialog, which people already know — as long as the rules the page set are
|
|
90
|
+
* ones it can enforce. A weekday rule or a predicate keeps the calendar, which
|
|
91
|
+
* can; so does `mode="range"`, which no system picker offers.
|
|
92
|
+
*/
|
|
93
|
+
export declare function DatePicker(props: DatePickerProps): import("react").JSX.Element;
|
|
94
|
+
export declare namespace DatePicker {
|
|
95
|
+
var displayName: string;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
export * from './utils';
|
|
9
9
|
export * from './motion';
|
|
10
10
|
export * from './components/button';
|
|
11
|
-
export * from './components/
|
|
11
|
+
export * from './components/calendar';
|
|
12
|
+
export { DatePicker, formatDateLabel, type DatePickerProps, type DatePickerSingleProps, type DatePickerRangeProps, type DatePickerSize, } from './components/date-picker';
|
|
12
13
|
export * from './components/input';
|
|
13
14
|
export * from './components/input-group';
|
|
14
15
|
export * from './components/card';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@photon-ai/pho-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Pho Design System — Photon's React component library, built on Base UI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -37,10 +37,6 @@
|
|
|
37
37
|
"types": "./dist/src/components/data-table/index.d.ts",
|
|
38
38
|
"import": "./dist/components/data-table.js"
|
|
39
39
|
},
|
|
40
|
-
"./components/date-range-picker": {
|
|
41
|
-
"types": "./dist/src/components/date-range-picker/index.d.ts",
|
|
42
|
-
"import": "./dist/components/date-range-picker.js"
|
|
43
|
-
},
|
|
44
40
|
"./components/input": {
|
|
45
41
|
"types": "./dist/src/components/input/index.d.ts",
|
|
46
42
|
"import": "./dist/components/input.js"
|
|
@@ -451,6 +447,14 @@
|
|
|
451
447
|
"./components/trace": {
|
|
452
448
|
"types": "./dist/src/components/trace/index.d.ts",
|
|
453
449
|
"import": "./dist/components/trace.js"
|
|
450
|
+
},
|
|
451
|
+
"./components/calendar": {
|
|
452
|
+
"types": "./dist/src/components/calendar/index.d.ts",
|
|
453
|
+
"import": "./dist/components/calendar.js"
|
|
454
|
+
},
|
|
455
|
+
"./components/date-picker": {
|
|
456
|
+
"types": "./dist/src/components/date-picker/index.d.ts",
|
|
457
|
+
"import": "./dist/components/date-picker.js"
|
|
454
458
|
}
|
|
455
459
|
},
|
|
456
460
|
"peerDependencies": {
|
|
@@ -494,6 +498,7 @@
|
|
|
494
498
|
"d3-time": "3.1.0",
|
|
495
499
|
"libphonenumber-js": "^1.13.11",
|
|
496
500
|
"motion": "^13.1.0",
|
|
501
|
+
"react-day-picker": "^10.0.1",
|
|
497
502
|
"tailwind-merge": "^3.6.0"
|
|
498
503
|
},
|
|
499
504
|
"scripts": {
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { t as N } from "./cn-ChIgwEl3.js";
|
|
3
|
-
import { a as C } from "./button-CdqS_t5a.js";
|
|
4
|
-
import { t as h } from "./input-DjvZoF8v.js";
|
|
5
|
-
import { useState as g } from "react";
|
|
6
|
-
import { jsx as u, jsxs as E } from "react/jsx-runtime";
|
|
7
|
-
var T = 6048e5, m = (e) => String(e).padStart(2, "0");
|
|
8
|
-
function s(e) {
|
|
9
|
-
return `${e.getFullYear()}-${m(e.getMonth() + 1)}-${m(e.getDate())}T${m(e.getHours())}:${m(e.getMinutes())}`;
|
|
10
|
-
}
|
|
11
|
-
function y(e) {
|
|
12
|
-
if (e.trim() === "") return null;
|
|
13
|
-
const t = new Date(e);
|
|
14
|
-
return Number.isNaN(t.getTime()) ? null : t;
|
|
15
|
-
}
|
|
16
|
-
function L(e, t, a) {
|
|
17
|
-
const n = new Intl.DateTimeFormat(a, {
|
|
18
|
-
month: "short",
|
|
19
|
-
day: "numeric"
|
|
20
|
-
});
|
|
21
|
-
return `${n.format(e)} – ${n.format(t)}`;
|
|
22
|
-
}
|
|
23
|
-
function R(e, t, a = T) {
|
|
24
|
-
if (e == null || t == null) return "Choose a start and an end.";
|
|
25
|
-
if (e.getTime() >= t.getTime()) return "Start must be before end.";
|
|
26
|
-
if (t.getTime() - e.getTime() > a) {
|
|
27
|
-
const n = a / 864e5;
|
|
28
|
-
return `Range can't be longer than ${Number.isInteger(n) && n > 0 ? n === 1 ? "1 day" : `${n} days` : "the configured maximum"}.`;
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
function V({ start: e, end: t, onApply: a, maxSpanMs: n = T, className: v, ...D }) {
|
|
33
|
-
const c = e?.getTime() ?? "", f = t?.getTime() ?? "", [S, x] = g(`${c}:${f}`), [d, p] = g(() => e ? s(e) : ""), [$, b] = g(() => t ? s(t) : "");
|
|
34
|
-
S !== `${c}:${f}` && (x(`${c}:${f}`), p(e ? s(e) : ""), b(t ? s(t) : ""));
|
|
35
|
-
const l = y(d), r = y($), o = R(l, r, n);
|
|
36
|
-
return /* @__PURE__ */ E("form", {
|
|
37
|
-
"aria-label": "Custom date range",
|
|
38
|
-
className: N("flex min-w-64 flex-col gap-3", v),
|
|
39
|
-
onSubmit: (i) => {
|
|
40
|
-
i.preventDefault(), !(o != null || l == null || r == null) && a?.({
|
|
41
|
-
start: l,
|
|
42
|
-
end: r
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
...D,
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ u(h, {
|
|
48
|
-
type: "datetime-local",
|
|
49
|
-
label: "Start",
|
|
50
|
-
size: "md",
|
|
51
|
-
value: d,
|
|
52
|
-
onChange: (i) => p(i.target.value),
|
|
53
|
-
invalid: o != null && l != null && r != null,
|
|
54
|
-
autoComplete: "off"
|
|
55
|
-
}),
|
|
56
|
-
/* @__PURE__ */ u(h, {
|
|
57
|
-
type: "datetime-local",
|
|
58
|
-
label: "End",
|
|
59
|
-
size: "md",
|
|
60
|
-
value: $,
|
|
61
|
-
onChange: (i) => b(i.target.value),
|
|
62
|
-
invalid: o != null && l != null && r != null,
|
|
63
|
-
hint: o ?? void 0,
|
|
64
|
-
autoComplete: "off"
|
|
65
|
-
}),
|
|
66
|
-
/* @__PURE__ */ u("div", {
|
|
67
|
-
className: "flex justify-end",
|
|
68
|
-
children: /* @__PURE__ */ u(C, {
|
|
69
|
-
type: "submit",
|
|
70
|
-
size: "sm",
|
|
71
|
-
disabled: o != null,
|
|
72
|
-
children: "Apply"
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
]
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
V.displayName = "DateRangePicker";
|
|
79
|
-
export {
|
|
80
|
-
y as a,
|
|
81
|
-
L as i,
|
|
82
|
-
T as n,
|
|
83
|
-
s as o,
|
|
84
|
-
R as r,
|
|
85
|
-
V as t
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
//# sourceMappingURL=date-range-picker-DwFDUNRL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-range-picker-DwFDUNRL.js","names":[],"sources":["../../src/components/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import { useState, type ComponentProps } from \"react\";\nimport { Button } from \"../button\";\nimport { Input } from \"../input\";\nimport { cn } from \"../../utils/cn\";\n\n/** Longest window the activity APIs serve — the 7-day preset. */\nexport const MAX_DATE_RANGE_MS = 7 * 24 * 60 * 60 * 1000;\n\nconst pad = (value: number) => String(value).padStart(2, \"0\");\n\n/** `YYYY-MM-DDTHH:mm` in the viewer's local zone, for `datetime-local`. */\nexport function toDateTimeLocalValue(date: Date): string {\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;\n}\n\n/** The local instant a `datetime-local` value names, or `null` if empty. */\nexport function fromDateTimeLocalValue(value: string): Date | null {\n if (value.trim() === \"\") return null;\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\n/**\n * The trigger words for an applied custom range — `Sep 1 – Sep 8`.\n * Short month and day, spaced en dash, no times.\n */\nexport function formatDateRangeLabel(\n start: Date,\n end: Date,\n locales?: Intl.LocalesArgument,\n): string {\n const format = new Intl.DateTimeFormat(locales, {\n month: \"short\",\n day: \"numeric\",\n });\n return `${format.format(start)} – ${format.format(end)}`;\n}\n\nexport function dateRangeError(\n start: Date | null,\n end: Date | null,\n maxSpanMs = MAX_DATE_RANGE_MS,\n): string | null {\n if (start == null || end == null) return \"Choose a start and an end.\";\n if (start.getTime() >= end.getTime()) return \"Start must be before end.\";\n if (end.getTime() - start.getTime() > maxSpanMs) {\n const days = maxSpanMs / (24 * 60 * 60 * 1000);\n const limit =\n Number.isInteger(days) && days > 0\n ? days === 1\n ? \"1 day\"\n : `${days} days`\n : \"the configured maximum\";\n return `Range can't be longer than ${limit}.`;\n }\n return null;\n}\n\nexport interface DateRangePickerProps extends Omit<\n ComponentProps<\"form\">,\n \"onSubmit\" | \"children\"\n> {\n start?: Date;\n end?: Date;\n onApply?: (range: { start: Date; end: Date }) => void;\n maxSpanMs?: number;\n}\n\n/**\n * Two native `datetime-local` fields and Apply — the custom range\n * panel a time Select opens. No third-party calendar. The page owns\n * the popover around it.\n */\nexport function DateRangePicker({\n start,\n end,\n onApply,\n maxSpanMs = MAX_DATE_RANGE_MS,\n className,\n ...props\n}: DateRangePickerProps) {\n const startKey = start?.getTime() ?? \"\";\n const endKey = end?.getTime() ?? \"\";\n const [seen, setSeen] = useState(`${startKey}:${endKey}`);\n const [startValue, setStartValue] = useState(() =>\n start ? toDateTimeLocalValue(start) : \"\",\n );\n const [endValue, setEndValue] = useState(() =>\n end ? toDateTimeLocalValue(end) : \"\",\n );\n if (seen !== `${startKey}:${endKey}`) {\n setSeen(`${startKey}:${endKey}`);\n setStartValue(start ? toDateTimeLocalValue(start) : \"\");\n setEndValue(end ? toDateTimeLocalValue(end) : \"\");\n }\n\n const nextStart = fromDateTimeLocalValue(startValue);\n const nextEnd = fromDateTimeLocalValue(endValue);\n const error = dateRangeError(nextStart, nextEnd, maxSpanMs);\n\n return (\n <form\n aria-label=\"Custom date range\"\n className={cn(\"flex min-w-64 flex-col gap-3\", className)}\n onSubmit={(event) => {\n event.preventDefault();\n if (error != null || nextStart == null || nextEnd == null) return;\n onApply?.({ start: nextStart, end: nextEnd });\n }}\n {...props}\n >\n <Input\n type=\"datetime-local\"\n label=\"Start\"\n size=\"md\"\n value={startValue}\n onChange={(event) => setStartValue(event.target.value)}\n invalid={error != null && nextStart != null && nextEnd != null}\n autoComplete=\"off\"\n />\n <Input\n type=\"datetime-local\"\n label=\"End\"\n size=\"md\"\n value={endValue}\n onChange={(event) => setEndValue(event.target.value)}\n invalid={error != null && nextStart != null && nextEnd != null}\n hint={error ?? undefined}\n autoComplete=\"off\"\n />\n <div className=\"flex justify-end\">\n <Button type=\"submit\" size=\"sm\" disabled={error != null}>\n Apply\n </Button>\n </div>\n </form>\n );\n}\n\nDateRangePicker.displayName = \"DateRangePicker\";\n"],"mappings":"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"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { a as e, i as t, n as o, o as r, r as s, t as i } from "../chunks/date-range-picker-DwFDUNRL.js";
|
|
3
|
-
export {
|
|
4
|
-
i as DateRangePicker,
|
|
5
|
-
o as MAX_DATE_RANGE_MS,
|
|
6
|
-
s as dateRangeError,
|
|
7
|
-
t as formatDateRangeLabel,
|
|
8
|
-
e as fromDateTimeLocalValue,
|
|
9
|
-
r as toDateTimeLocalValue
|
|
10
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
|
-
/** Longest window the activity APIs serve — the 7-day preset. */
|
|
3
|
-
export declare const MAX_DATE_RANGE_MS: number;
|
|
4
|
-
/** `YYYY-MM-DDTHH:mm` in the viewer's local zone, for `datetime-local`. */
|
|
5
|
-
export declare function toDateTimeLocalValue(date: Date): string;
|
|
6
|
-
/** The local instant a `datetime-local` value names, or `null` if empty. */
|
|
7
|
-
export declare function fromDateTimeLocalValue(value: string): Date | null;
|
|
8
|
-
/**
|
|
9
|
-
* The trigger words for an applied custom range — `Sep 1 – Sep 8`.
|
|
10
|
-
* Short month and day, spaced en dash, no times.
|
|
11
|
-
*/
|
|
12
|
-
export declare function formatDateRangeLabel(start: Date, end: Date, locales?: Intl.LocalesArgument): string;
|
|
13
|
-
export declare function dateRangeError(start: Date | null, end: Date | null, maxSpanMs?: number): string | null;
|
|
14
|
-
export interface DateRangePickerProps extends Omit<ComponentProps<"form">, "onSubmit" | "children"> {
|
|
15
|
-
start?: Date;
|
|
16
|
-
end?: Date;
|
|
17
|
-
onApply?: (range: {
|
|
18
|
-
start: Date;
|
|
19
|
-
end: Date;
|
|
20
|
-
}) => void;
|
|
21
|
-
maxSpanMs?: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Two native `datetime-local` fields and Apply — the custom range
|
|
25
|
-
* panel a time Select opens. No third-party calendar. The page owns
|
|
26
|
-
* the popover around it.
|
|
27
|
-
*/
|
|
28
|
-
export declare function DateRangePicker({ start, end, onApply, maxSpanMs, className, ...props }: DateRangePickerProps): import("react").JSX.Element;
|
|
29
|
-
export declare namespace DateRangePicker {
|
|
30
|
-
var displayName: string;
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DateRangePicker, MAX_DATE_RANGE_MS, dateRangeError, formatDateRangeLabel, fromDateTimeLocalValue, toDateTimeLocalValue, type DateRangePickerProps, } from './date-range-picker';
|