@dashforge/tw 0.9.1-beta → 0.10.0-beta
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/CHANGELOG.md +31 -0
- package/dist/index.esm.js +1152 -336
- package/dist/src/components/DateRangePicker/DateRangePicker.d.ts +13 -0
- package/dist/src/components/DateRangePicker/DateRangePicker.d.ts.map +1 -0
- package/dist/src/components/DateRangePicker/dateRangePicker.types.d.ts +85 -0
- package/dist/src/components/DateRangePicker/dateRangePicker.types.d.ts.map +1 -0
- package/dist/src/components/DateRangePicker/dateRangePicker.variants.d.ts +183 -0
- package/dist/src/components/DateRangePicker/dateRangePicker.variants.d.ts.map +1 -0
- package/dist/src/components/DateTimePicker/DateTimePicker.d.ts +7 -43
- package/dist/src/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/src/components/DateTimePicker/dateTimePicker.types.d.ts +50 -55
- package/dist/src/components/DateTimePicker/dateTimePicker.types.d.ts.map +1 -1
- package/dist/src/components/DateTimePicker/dateTimePicker.variants.d.ts +36 -94
- package/dist/src/components/DateTimePicker/dateTimePicker.variants.d.ts.map +1 -1
- package/dist/src/components/TimePicker/TimePicker.d.ts +12 -0
- package/dist/src/components/TimePicker/TimePicker.d.ts.map +1 -0
- package/dist/src/components/TimePicker/timePicker.types.d.ts +80 -0
- package/dist/src/components/TimePicker/timePicker.types.d.ts.map +1 -0
- package/dist/src/components/TimePicker/timePicker.variants.d.ts +103 -0
- package/dist/src/components/TimePicker/timePicker.variants.d.ts.map +1 -0
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/DateRangePicker/DateRangePicker.test.tsx +92 -0
- package/src/components/DateRangePicker/DateRangePicker.tsx +510 -0
- package/src/components/DateRangePicker/dateRangePicker.types.ts +74 -0
- package/src/components/DateRangePicker/dateRangePicker.variants.ts +101 -0
- package/src/components/DateTimePicker/DateTimePicker.test.tsx +60 -186
- package/src/components/DateTimePicker/DateTimePicker.tsx +209 -181
- package/src/components/DateTimePicker/dateTimePicker.types.ts +50 -54
- package/src/components/DateTimePicker/dateTimePicker.variants.ts +22 -51
- package/src/components/TimePicker/TimePicker.test.tsx +65 -0
- package/src/components/TimePicker/TimePicker.tsx +274 -0
- package/src/components/TimePicker/timePicker.types.ts +69 -0
- package/src/components/TimePicker/timePicker.variants.ts +53 -0
- package/src/index.ts +28 -16
- package/src/components/DateTimePicker/DateTimePicker.perf.test.tsx +0 -153
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DateRangePickerProps } from './dateRangePicker.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Dashforge TW `<DateRangePicker>` — a form-bound start/end date field.
|
|
4
|
+
*
|
|
5
|
+
* A read-only trigger button paired with a dual-month range calendar popover
|
|
6
|
+
* (Radix Popover), built on the headless `useDateRange` engine. Integrates
|
|
7
|
+
* with the Dashforge form bridge + RBAC.
|
|
8
|
+
*
|
|
9
|
+
* Storage contract: a `{ start, end }` pair of ISO `YYYY-MM-DD` dates —
|
|
10
|
+
* shared with the MUI `@dashforge/ui` `DateRangePicker`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function DateRangePicker(props: DateRangePickerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
//# sourceMappingURL=DateRangePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAoQvE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,kDAoN1D"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Engine } from '@dashforge/ui-core';
|
|
3
|
+
import type { AccessRequirement } from '@dashforge/rbac';
|
|
4
|
+
import type { DateRange, ISODate, WeekDay } from '@dashforge/calendar-core';
|
|
5
|
+
/** Per-slot `className` overrides for `<DateRangePicker>`. */
|
|
6
|
+
export interface DateRangePickerSlotProps {
|
|
7
|
+
root?: {
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
label?: {
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
requiredMark?: {
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
trigger?: {
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
helperText?: {
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
errorText?: {
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for the `<DateRangePicker>` form field (Tailwind skin).
|
|
28
|
+
*
|
|
29
|
+
* A read-only trigger paired with a dual-month range calendar popover. The
|
|
30
|
+
* stored value is a `{ start, end }` pair of plain ISO calendar dates
|
|
31
|
+
* (`YYYY-MM-DD`); either side may be `null`. No time, no timezone.
|
|
32
|
+
*
|
|
33
|
+
* The prop surface mirrors the MUI `@dashforge/ui` `DateRangePicker`.
|
|
34
|
+
*/
|
|
35
|
+
export interface DateRangePickerProps {
|
|
36
|
+
/** Field name — the bridge registration key. Required. */
|
|
37
|
+
name: string;
|
|
38
|
+
/** Validation rules forwarded to the form bridge. */
|
|
39
|
+
rules?: unknown;
|
|
40
|
+
/** Field label. */
|
|
41
|
+
label?: ReactNode;
|
|
42
|
+
/** Helper text below the control (overrides a bridge error message). */
|
|
43
|
+
helperText?: ReactNode;
|
|
44
|
+
/** Explicit error state (overrides the bridge's auto error). */
|
|
45
|
+
error?: boolean;
|
|
46
|
+
/** Marks the field required (adds the label asterisk). */
|
|
47
|
+
required?: boolean;
|
|
48
|
+
/** Disables the field. */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/** Placeholder shown when no range is selected. */
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
/** Label/control layout. */
|
|
53
|
+
layout?: 'stacked' | 'inline';
|
|
54
|
+
/** Reactive visibility predicate evaluated against the form engine. */
|
|
55
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
56
|
+
/** RBAC access requirement. */
|
|
57
|
+
access?: AccessRequirement;
|
|
58
|
+
/** Controlled value — a `{ start, end }` pair. */
|
|
59
|
+
value?: DateRange;
|
|
60
|
+
/** Uncontrolled initial value. */
|
|
61
|
+
defaultValue?: DateRange;
|
|
62
|
+
/** Fired with the new range (partial on the first click, complete on the second). */
|
|
63
|
+
onChange?: (value: DateRange) => void;
|
|
64
|
+
/** Earliest selectable date (inclusive). */
|
|
65
|
+
minDate?: ISODate;
|
|
66
|
+
/** Latest selectable date (inclusive). */
|
|
67
|
+
maxDate?: ISODate;
|
|
68
|
+
/** Explicit list of disabled dates. */
|
|
69
|
+
disabledDates?: readonly ISODate[];
|
|
70
|
+
/** Predicate marking arbitrary dates disabled. */
|
|
71
|
+
isDateDisabled?: (date: ISODate) => boolean;
|
|
72
|
+
/** Weekday of the calendar's first column (`0` = Sunday). */
|
|
73
|
+
weekStartDay?: WeekDay;
|
|
74
|
+
/** BCP-47 locale for the calendar and the display format. */
|
|
75
|
+
locale?: string;
|
|
76
|
+
/** Stretches the field to its container width. */
|
|
77
|
+
fullWidth?: boolean;
|
|
78
|
+
/** Root-level Tailwind class override. */
|
|
79
|
+
sx?: string;
|
|
80
|
+
/** Per-slot `className` overrides. */
|
|
81
|
+
slotProps?: DateRangePickerSlotProps;
|
|
82
|
+
/** Test id applied to the field root. */
|
|
83
|
+
testId?: string;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=dateRangePicker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateRangePicker.types.d.ts","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/dateRangePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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,uEAAuE;IACvE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C,+BAA+B;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,kDAAkD;IAClD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,kCAAkC;IAClC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,aAAa,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,kDAAkD;IAClD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;IAC5C,6DAA6D;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slots for `<DateRangePicker>` — a bridge-integrated start/end date field
|
|
3
|
+
* whose trigger is a `<button>` styled as an input, opening a dual-month
|
|
4
|
+
* range calendar popover.
|
|
5
|
+
*
|
|
6
|
+
* Theme identity: bare neutral / brand token-backed classes only — no
|
|
7
|
+
* `dark:` variants on the neutral palette (the preset CSS-var swap
|
|
8
|
+
* auto-inverts). See `_shared/themeIdentity.test.ts`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const dateRangePickerVariants: import("tailwind-variants").TVReturnType<{
|
|
11
|
+
layout: {
|
|
12
|
+
stacked: {};
|
|
13
|
+
inline: {
|
|
14
|
+
root: string;
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
error: {
|
|
19
|
+
true: {
|
|
20
|
+
trigger: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
fullWidth: {
|
|
24
|
+
true: {
|
|
25
|
+
root: string;
|
|
26
|
+
trigger: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
root: string;
|
|
31
|
+
label: string;
|
|
32
|
+
requiredMark: string;
|
|
33
|
+
trigger: string;
|
|
34
|
+
value: string;
|
|
35
|
+
placeholder: string;
|
|
36
|
+
icon: string;
|
|
37
|
+
panel: string;
|
|
38
|
+
month: string;
|
|
39
|
+
header: string;
|
|
40
|
+
navButton: string;
|
|
41
|
+
navSpacer: string;
|
|
42
|
+
monthLabel: string;
|
|
43
|
+
grid: string;
|
|
44
|
+
weekdayRow: string;
|
|
45
|
+
weekday: string;
|
|
46
|
+
weekRow: string;
|
|
47
|
+
helperText: string;
|
|
48
|
+
errorText: string;
|
|
49
|
+
}, undefined, {
|
|
50
|
+
layout: {
|
|
51
|
+
stacked: {};
|
|
52
|
+
inline: {
|
|
53
|
+
root: string;
|
|
54
|
+
label: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
error: {
|
|
58
|
+
true: {
|
|
59
|
+
trigger: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
fullWidth: {
|
|
63
|
+
true: {
|
|
64
|
+
root: string;
|
|
65
|
+
trigger: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
69
|
+
root: string;
|
|
70
|
+
label: string;
|
|
71
|
+
requiredMark: string;
|
|
72
|
+
trigger: string;
|
|
73
|
+
value: string;
|
|
74
|
+
placeholder: string;
|
|
75
|
+
icon: string;
|
|
76
|
+
panel: string;
|
|
77
|
+
month: string;
|
|
78
|
+
header: string;
|
|
79
|
+
navButton: string;
|
|
80
|
+
navSpacer: string;
|
|
81
|
+
monthLabel: string;
|
|
82
|
+
grid: string;
|
|
83
|
+
weekdayRow: string;
|
|
84
|
+
weekday: string;
|
|
85
|
+
weekRow: string;
|
|
86
|
+
helperText: string;
|
|
87
|
+
errorText: string;
|
|
88
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
89
|
+
layout: {
|
|
90
|
+
stacked: {};
|
|
91
|
+
inline: {
|
|
92
|
+
root: string;
|
|
93
|
+
label: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
error: {
|
|
97
|
+
true: {
|
|
98
|
+
trigger: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
fullWidth: {
|
|
102
|
+
true: {
|
|
103
|
+
root: string;
|
|
104
|
+
trigger: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
root: string;
|
|
109
|
+
label: string;
|
|
110
|
+
requiredMark: string;
|
|
111
|
+
trigger: string;
|
|
112
|
+
value: string;
|
|
113
|
+
placeholder: string;
|
|
114
|
+
icon: string;
|
|
115
|
+
panel: string;
|
|
116
|
+
month: string;
|
|
117
|
+
header: string;
|
|
118
|
+
navButton: string;
|
|
119
|
+
navSpacer: string;
|
|
120
|
+
monthLabel: string;
|
|
121
|
+
grid: string;
|
|
122
|
+
weekdayRow: string;
|
|
123
|
+
weekday: string;
|
|
124
|
+
weekRow: string;
|
|
125
|
+
helperText: string;
|
|
126
|
+
errorText: string;
|
|
127
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
128
|
+
/**
|
|
129
|
+
* Per-day-cell recipe for the range grid. `endpoint` (a committed start/end)
|
|
130
|
+
* is the solid fill; `inBand` (inside the committed or previewed range) is
|
|
131
|
+
* the light tint. Declared `inBand` before `endpoint` so an endpoint cell —
|
|
132
|
+
* which is also in-band — resolves to the solid fill.
|
|
133
|
+
*/
|
|
134
|
+
export declare const dateRangeDayVariants: import("tailwind-variants").TVReturnType<{
|
|
135
|
+
inBand: {
|
|
136
|
+
true: string;
|
|
137
|
+
};
|
|
138
|
+
endpoint: {
|
|
139
|
+
true: string;
|
|
140
|
+
};
|
|
141
|
+
siblingMonth: {
|
|
142
|
+
true: string;
|
|
143
|
+
};
|
|
144
|
+
today: {
|
|
145
|
+
true: string;
|
|
146
|
+
};
|
|
147
|
+
disabled: {
|
|
148
|
+
true: string;
|
|
149
|
+
};
|
|
150
|
+
}, undefined, "flex h-9 w-9 items-center justify-center rounded-md text-sm text-neutral-900 transition-colors hover:bg-neutral-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary-500", {
|
|
151
|
+
inBand: {
|
|
152
|
+
true: string;
|
|
153
|
+
};
|
|
154
|
+
endpoint: {
|
|
155
|
+
true: string;
|
|
156
|
+
};
|
|
157
|
+
siblingMonth: {
|
|
158
|
+
true: string;
|
|
159
|
+
};
|
|
160
|
+
today: {
|
|
161
|
+
true: string;
|
|
162
|
+
};
|
|
163
|
+
disabled: {
|
|
164
|
+
true: string;
|
|
165
|
+
};
|
|
166
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
167
|
+
inBand: {
|
|
168
|
+
true: string;
|
|
169
|
+
};
|
|
170
|
+
endpoint: {
|
|
171
|
+
true: string;
|
|
172
|
+
};
|
|
173
|
+
siblingMonth: {
|
|
174
|
+
true: string;
|
|
175
|
+
};
|
|
176
|
+
today: {
|
|
177
|
+
true: string;
|
|
178
|
+
};
|
|
179
|
+
disabled: {
|
|
180
|
+
true: string;
|
|
181
|
+
};
|
|
182
|
+
}, undefined, "flex h-9 w-9 items-center justify-center rounded-md text-sm text-neutral-900 transition-colors hover:bg-neutral-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary-500", unknown, unknown, undefined>>;
|
|
183
|
+
//# sourceMappingURL=dateRangePicker.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateRangePicker.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/dateRangePicker.variants.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAmDlC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0QA8B/B,CAAC"}
|
|
@@ -1,49 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DateTimePickerProps } from './dateTimePicker.types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* into the format the native input expects.
|
|
3
|
+
* Dashforge TW `<DateTimePicker>` — a form-bound date + time field.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - `datetime` → `YYYY-MM-DDTHH:mm` (no timezone, datetime-local
|
|
10
|
-
* rejects `Z` / offset suffixes)
|
|
5
|
+
* A read-only trigger button paired with a popover combining a `<Calendar>`
|
|
6
|
+
* and a time list (Radix Popover). Integrates with the Dashforge form
|
|
7
|
+
* bridge + RBAC.
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - Truncates a richer ISO string (e.g. `2026-05-16T10:23:45.000Z`)
|
|
15
|
-
* down to the mode-appropriate prefix.
|
|
16
|
-
* - Returns `''` for null / undefined / unparseable inputs (native
|
|
17
|
-
* inputs use `''` to represent "no value").
|
|
18
|
-
*/
|
|
19
|
-
export declare function isoToInputValue(mode: DateTimePickerMode, raw: string | null | undefined): string;
|
|
20
|
-
/**
|
|
21
|
-
* Dashforge TW DateTimePicker — bridge-integrated native date/time input.
|
|
22
|
-
*
|
|
23
|
-
* Three modes (`mode` prop):
|
|
24
|
-
* - `date` — `<input type="date">` → `YYYY-MM-DD`
|
|
25
|
-
* - `time` — `<input type="time">` → `HH:mm` (`HH:mm:ss` with `step={1}`)
|
|
26
|
-
* - `datetime` — `<input type="datetime-local">` → `YYYY-MM-DDTHH:mm`
|
|
27
|
-
*
|
|
28
|
-
* **Why native inputs instead of React Aria `<DatePicker>`?**
|
|
29
|
-
*
|
|
30
|
-
* 1. Zero new deps (`@internationalized/date` would add ~30 KB).
|
|
31
|
-
* 2. Mirrors `@dashforge/ui/DateTimePicker` (MUI side) for API parity.
|
|
32
|
-
* 3. Native inputs are AAA-grade a11y out of the box — screen readers,
|
|
33
|
-
* keyboard nav, OS-provided calendar/clock UI.
|
|
34
|
-
* 4. Predictable state (no internal Aria state machine that fights
|
|
35
|
-
* controlled props — the F5-A lesson learned in `<Autocomplete>`).
|
|
36
|
-
*
|
|
37
|
-
* A richer custom-calendar version (range mode, locale awareness,
|
|
38
|
-
* custom popover styling) can land as F5-B-bis built on Aria
|
|
39
|
-
* `<DatePicker>` / `<Calendar>`.
|
|
40
|
-
*
|
|
41
|
-
* **A11y**:
|
|
42
|
-
* - `aria-invalid` driven by the resolved validation state.
|
|
43
|
-
* - `aria-describedby` links input ↔ helper/error.
|
|
44
|
-
* - Required fields get the native `required` attribute + a visual `*`.
|
|
45
|
-
* - `color-scheme: light dark` keeps the OS calendar icon readable
|
|
46
|
-
* in both color schemes.
|
|
9
|
+
* Storage contract: a naive ISO datetime `"YYYY-MM-DDTHH:mm"` — no seconds,
|
|
10
|
+
* no timezone. Shared with the MUI `@dashforge/ui` `DateTimePicker`.
|
|
47
11
|
*/
|
|
48
12
|
export declare function DateTimePicker(props: DateTimePickerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
49
13
|
//# sourceMappingURL=DateTimePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTimePicker/DateTimePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateTimePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTimePicker/DateTimePicker.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AA8ErE;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,kDAiPxD"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { Engine } from '@dashforge/ui-core';
|
|
3
3
|
import type { AccessRequirement } from '@dashforge/rbac';
|
|
4
|
-
import type {
|
|
5
|
-
/**
|
|
6
|
-
* Operating mode of the picker.
|
|
7
|
-
*
|
|
8
|
-
* - `'date'` — `YYYY-MM-DD` (native `<input type="date">`)
|
|
9
|
-
* - `'time'` — `HH:mm` or `HH:mm:ss` (native `<input type="time">`)
|
|
10
|
-
* - `'datetime'` — `YYYY-MM-DDTHH:mm` (native `<input type="datetime-local">`)
|
|
11
|
-
*
|
|
12
|
-
* Note: `datetime-local` does NOT include timezone info. Values are
|
|
13
|
-
* naive local-time strings. If you need TZ-aware persistence, convert
|
|
14
|
-
* upstream (e.g., interpret as UTC, or attach the user's TZ from a
|
|
15
|
-
* separate field).
|
|
16
|
-
*/
|
|
17
|
-
export type DateTimePickerMode = 'date' | 'time' | 'datetime';
|
|
4
|
+
import type { ISODate, WeekDay } from '@dashforge/calendar-core';
|
|
5
|
+
/** Per-slot `className` overrides for `<DateTimePicker>`. */
|
|
18
6
|
export interface DateTimePickerSlotProps {
|
|
19
7
|
root?: {
|
|
20
8
|
className?: string;
|
|
@@ -25,10 +13,7 @@ export interface DateTimePickerSlotProps {
|
|
|
25
13
|
requiredMark?: {
|
|
26
14
|
className?: string;
|
|
27
15
|
};
|
|
28
|
-
|
|
29
|
-
className?: string;
|
|
30
|
-
};
|
|
31
|
-
input?: {
|
|
16
|
+
trigger?: {
|
|
32
17
|
className?: string;
|
|
33
18
|
};
|
|
34
19
|
helperText?: {
|
|
@@ -39,57 +24,67 @@ export interface DateTimePickerSlotProps {
|
|
|
39
24
|
};
|
|
40
25
|
}
|
|
41
26
|
/**
|
|
42
|
-
* Props for `<DateTimePicker
|
|
43
|
-
*
|
|
44
|
-
* Bridge-integrated date / time / datetime input built on the native
|
|
45
|
-
* HTML5 input types (`type="date|time|datetime-local"`). Chosen over a
|
|
46
|
-
* custom React Aria `<DatePicker>` for F5-B because:
|
|
27
|
+
* Props for the `<DateTimePicker>` form field (Tailwind skin).
|
|
47
28
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* 3. **Bundle size** — saves ~30KB minified over the Aria stack.
|
|
52
|
-
* 4. **API parity** with the MUI side (`@dashforge/ui/DateTimePicker`).
|
|
53
|
-
* 5. **Predictability** — no internal state machine to fight (see the
|
|
54
|
-
* ComboBox lesson learned in `<Autocomplete>` F5-A).
|
|
29
|
+
* A read-only trigger paired with a popover combining a `<Calendar>` and a
|
|
30
|
+
* time list. The stored value is a naive ISO datetime — `"YYYY-MM-DDTHH:mm"`
|
|
31
|
+
* — or `null`. No seconds, no timezone.
|
|
55
32
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* Value contract: ISO 8601-ish naive strings, always.
|
|
33
|
+
* For a date-only field use `<DatePicker>`; for time-only use `<TimePicker>`.
|
|
34
|
+
* The prop surface mirrors the MUI `@dashforge/ui` `DateTimePicker`.
|
|
59
35
|
*/
|
|
60
|
-
export interface DateTimePickerProps
|
|
36
|
+
export interface DateTimePickerProps {
|
|
37
|
+
/** Field name — the bridge registration key. Required. */
|
|
61
38
|
name: string;
|
|
39
|
+
/** Validation rules forwarded to the form bridge. */
|
|
62
40
|
rules?: unknown;
|
|
63
|
-
/**
|
|
64
|
-
mode?: DateTimePickerMode;
|
|
41
|
+
/** Field label. */
|
|
65
42
|
label?: ReactNode;
|
|
43
|
+
/** Helper text below the control (overrides a bridge error message). */
|
|
66
44
|
helperText?: ReactNode;
|
|
67
|
-
|
|
45
|
+
/** Explicit error state (overrides the bridge's auto error). */
|
|
68
46
|
error?: boolean;
|
|
47
|
+
/** Marks the field required (adds the label asterisk). */
|
|
48
|
+
required?: boolean;
|
|
49
|
+
/** Disables the field. */
|
|
69
50
|
disabled?: boolean;
|
|
51
|
+
/** Placeholder shown when no value is selected. */
|
|
70
52
|
placeholder?: string;
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
max?: string;
|
|
75
|
-
/**
|
|
76
|
-
* Step in seconds (time / datetime). Default 60 ⇒ minute precision.
|
|
77
|
-
* Set to 1 to allow seconds.
|
|
78
|
-
*/
|
|
79
|
-
step?: number;
|
|
80
|
-
/** Engine predicate — field not rendered when it returns `false`. */
|
|
53
|
+
/** Label/control layout. */
|
|
54
|
+
layout?: 'stacked' | 'inline';
|
|
55
|
+
/** Reactive visibility predicate evaluated against the form engine. */
|
|
81
56
|
visibleWhen?: (engine: Engine) => boolean;
|
|
82
57
|
/** RBAC access requirement. */
|
|
83
58
|
access?: AccessRequirement;
|
|
84
|
-
/**
|
|
85
|
-
sx?: string;
|
|
86
|
-
/** Per-slot className overrides. */
|
|
87
|
-
slotProps?: DateTimePickerSlotProps;
|
|
88
|
-
/** Controlled value (form mode reads from the bridge if omitted). */
|
|
59
|
+
/** Controlled value — `"YYYY-MM-DDTHH:mm"` or `null`. */
|
|
89
60
|
value?: string | null;
|
|
90
|
-
/**
|
|
61
|
+
/** Uncontrolled initial value. */
|
|
91
62
|
defaultValue?: string | null;
|
|
92
|
-
/**
|
|
93
|
-
|
|
63
|
+
/** Fired with the new datetime (or `null` when cleared). */
|
|
64
|
+
onChange?: (value: string | null) => void;
|
|
65
|
+
/** Earliest selectable date (inclusive). */
|
|
66
|
+
minDate?: ISODate;
|
|
67
|
+
/** Latest selectable date (inclusive). */
|
|
68
|
+
maxDate?: ISODate;
|
|
69
|
+
/** Explicit list of disabled dates. */
|
|
70
|
+
disabledDates?: readonly ISODate[];
|
|
71
|
+
/** Predicate marking arbitrary dates disabled. */
|
|
72
|
+
isDateDisabled?: (date: ISODate) => boolean;
|
|
73
|
+
/** Weekday of the calendar's first column (`0` = Sunday). */
|
|
74
|
+
weekStartDay?: WeekDay;
|
|
75
|
+
/** BCP-47 locale for the calendar and the display format. */
|
|
76
|
+
locale?: string;
|
|
77
|
+
/** Step between time-list options, in minutes. Default `30`. */
|
|
78
|
+
stepMinutes?: number;
|
|
79
|
+
/** Render the time list in 12-hour notation. Default `false`. */
|
|
80
|
+
hour12?: boolean;
|
|
81
|
+
/** Stretches the field to its container width. */
|
|
82
|
+
fullWidth?: boolean;
|
|
83
|
+
/** Root-level Tailwind class override. */
|
|
84
|
+
sx?: string;
|
|
85
|
+
/** Per-slot `className` overrides. */
|
|
86
|
+
slotProps?: DateTimePickerSlotProps;
|
|
87
|
+
/** Test id applied to the field root. */
|
|
88
|
+
testId?: string;
|
|
94
89
|
}
|
|
95
90
|
//# sourceMappingURL=dateTimePicker.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePicker.types.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTimePicker/dateTimePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dateTimePicker.types.d.ts","sourceRoot":"","sources":["../../../../src/components/DateTimePicker/dateTimePicker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EA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