@vaam-apps/ui 0.1.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/CHANGELOG.md +104 -0
- package/LICENSE +21 -0
- package/README.md +286 -0
- package/dist/components/data/code.d.ts +37 -0
- package/dist/components/data/code.d.ts.map +1 -0
- package/dist/components/data/code.js +37 -0
- package/dist/components/data/code.js.map +1 -0
- package/dist/components/data/copy-button.d.ts +39 -0
- package/dist/components/data/copy-button.d.ts.map +1 -0
- package/dist/components/data/copy-button.js +50 -0
- package/dist/components/data/copy-button.js.map +1 -0
- package/dist/components/data/detail-row.d.ts +69 -0
- package/dist/components/data/detail-row.d.ts.map +1 -0
- package/dist/components/data/detail-row.js +27 -0
- package/dist/components/data/detail-row.js.map +1 -0
- package/dist/components/data/id-display.d.ts +33 -0
- package/dist/components/data/id-display.d.ts.map +1 -0
- package/dist/components/data/id-display.js +25 -0
- package/dist/components/data/id-display.js.map +1 -0
- package/dist/components/data/masked-value.d.ts +47 -0
- package/dist/components/data/masked-value.d.ts.map +1 -0
- package/dist/components/data/masked-value.js +46 -0
- package/dist/components/data/masked-value.js.map +1 -0
- package/dist/components/data/money.d.ts +28 -0
- package/dist/components/data/money.d.ts.map +1 -0
- package/dist/components/data/money.js +22 -0
- package/dist/components/data/money.js.map +1 -0
- package/dist/components/data/phone-display.d.ts +45 -0
- package/dist/components/data/phone-display.d.ts.map +1 -0
- package/dist/components/data/phone-display.js +23 -0
- package/dist/components/data/phone-display.js.map +1 -0
- package/dist/components/data/stat-tile.d.ts +33 -0
- package/dist/components/data/stat-tile.d.ts.map +1 -0
- package/dist/components/data/stat-tile.js +18 -0
- package/dist/components/data/stat-tile.js.map +1 -0
- package/dist/components/data/timestamp-display.d.ts +14 -0
- package/dist/components/data/timestamp-display.d.ts.map +1 -0
- package/dist/components/data/timestamp-display.js +77 -0
- package/dist/components/data/timestamp-display.js.map +1 -0
- package/dist/components/patterns/inline-banner.d.ts +22 -0
- package/dist/components/patterns/inline-banner.d.ts.map +1 -0
- package/dist/components/patterns/inline-banner.js +11 -0
- package/dist/components/patterns/inline-banner.js.map +1 -0
- package/dist/components/patterns/inline-empty-state.d.ts +20 -0
- package/dist/components/patterns/inline-empty-state.d.ts.map +1 -0
- package/dist/components/patterns/inline-empty-state.js +11 -0
- package/dist/components/patterns/inline-empty-state.js.map +1 -0
- package/dist/components/patterns/live-row.d.ts +23 -0
- package/dist/components/patterns/live-row.d.ts.map +1 -0
- package/dist/components/patterns/live-row.js +48 -0
- package/dist/components/patterns/live-row.js.map +1 -0
- package/dist/components/patterns/payload-inspector.d.ts +25 -0
- package/dist/components/patterns/payload-inspector.d.ts.map +1 -0
- package/dist/components/patterns/payload-inspector.js +33 -0
- package/dist/components/patterns/payload-inspector.js.map +1 -0
- package/dist/components/patterns/route-skeleton.d.ts +15 -0
- package/dist/components/patterns/route-skeleton.d.ts.map +1 -0
- package/dist/components/patterns/route-skeleton.js +7 -0
- package/dist/components/patterns/route-skeleton.js.map +1 -0
- package/dist/components/patterns/screen-layout.d.ts +14 -0
- package/dist/components/patterns/screen-layout.d.ts.map +1 -0
- package/dist/components/patterns/screen-layout.js +11 -0
- package/dist/components/patterns/screen-layout.js.map +1 -0
- package/dist/components/patterns/stale-write-banner.d.ts +26 -0
- package/dist/components/patterns/stale-write-banner.d.ts.map +1 -0
- package/dist/components/patterns/stale-write-banner.js +28 -0
- package/dist/components/patterns/stale-write-banner.js.map +1 -0
- package/dist/components/patterns/state-timeline.d.ts +58 -0
- package/dist/components/patterns/state-timeline.d.ts.map +1 -0
- package/dist/components/patterns/state-timeline.js +103 -0
- package/dist/components/patterns/state-timeline.js.map +1 -0
- package/dist/components/primitives/badge.d.ts +27 -0
- package/dist/components/primitives/badge.d.ts.map +1 -0
- package/dist/components/primitives/badge.js +33 -0
- package/dist/components/primitives/badge.js.map +1 -0
- package/dist/components/primitives/button.d.ts +12 -0
- package/dist/components/primitives/button.d.ts.map +1 -0
- package/dist/components/primitives/button.js +42 -0
- package/dist/components/primitives/button.js.map +1 -0
- package/dist/components/primitives/calendar.d.ts +39 -0
- package/dist/components/primitives/calendar.d.ts.map +1 -0
- package/dist/components/primitives/calendar.js +102 -0
- package/dist/components/primitives/calendar.js.map +1 -0
- package/dist/components/primitives/card.d.ts +24 -0
- package/dist/components/primitives/card.d.ts.map +1 -0
- package/dist/components/primitives/card.js +28 -0
- package/dist/components/primitives/card.js.map +1 -0
- package/dist/components/primitives/checkbox.d.ts +42 -0
- package/dist/components/primitives/checkbox.d.ts.map +1 -0
- package/dist/components/primitives/checkbox.js +31 -0
- package/dist/components/primitives/checkbox.js.map +1 -0
- package/dist/components/primitives/chip-select.d.ts +38 -0
- package/dist/components/primitives/chip-select.d.ts.map +1 -0
- package/dist/components/primitives/chip-select.js +25 -0
- package/dist/components/primitives/chip-select.js.map +1 -0
- package/dist/components/primitives/command-menu.d.ts +54 -0
- package/dist/components/primitives/command-menu.d.ts.map +1 -0
- package/dist/components/primitives/command-menu.js +24 -0
- package/dist/components/primitives/command-menu.js.map +1 -0
- package/dist/components/primitives/confirm-dialog.d.ts +52 -0
- package/dist/components/primitives/confirm-dialog.d.ts.map +1 -0
- package/dist/components/primitives/confirm-dialog.js +30 -0
- package/dist/components/primitives/confirm-dialog.js.map +1 -0
- package/dist/components/primitives/date-picker.d.ts +68 -0
- package/dist/components/primitives/date-picker.d.ts.map +1 -0
- package/dist/components/primitives/date-picker.js +107 -0
- package/dist/components/primitives/date-picker.js.map +1 -0
- package/dist/components/primitives/dialog.d.ts +50 -0
- package/dist/components/primitives/dialog.d.ts.map +1 -0
- package/dist/components/primitives/dialog.js +90 -0
- package/dist/components/primitives/dialog.js.map +1 -0
- package/dist/components/primitives/drawer.d.ts +71 -0
- package/dist/components/primitives/drawer.d.ts.map +1 -0
- package/dist/components/primitives/drawer.js +93 -0
- package/dist/components/primitives/drawer.js.map +1 -0
- package/dist/components/primitives/dropdown-menu.d.ts +40 -0
- package/dist/components/primitives/dropdown-menu.d.ts.map +1 -0
- package/dist/components/primitives/dropdown-menu.js +53 -0
- package/dist/components/primitives/dropdown-menu.js.map +1 -0
- package/dist/components/primitives/form-field.d.ts +94 -0
- package/dist/components/primitives/form-field.d.ts.map +1 -0
- package/dist/components/primitives/form-field.js +27 -0
- package/dist/components/primitives/form-field.js.map +1 -0
- package/dist/components/primitives/inline-confirm.d.ts +62 -0
- package/dist/components/primitives/inline-confirm.d.ts.map +1 -0
- package/dist/components/primitives/inline-confirm.js +11 -0
- package/dist/components/primitives/inline-confirm.js.map +1 -0
- package/dist/components/primitives/input.d.ts +4 -0
- package/dist/components/primitives/input.d.ts.map +1 -0
- package/dist/components/primitives/input.js +13 -0
- package/dist/components/primitives/input.js.map +1 -0
- package/dist/components/primitives/label.d.ts +26 -0
- package/dist/components/primitives/label.d.ts.map +1 -0
- package/dist/components/primitives/label.js +33 -0
- package/dist/components/primitives/label.js.map +1 -0
- package/dist/components/primitives/pagination.d.ts +54 -0
- package/dist/components/primitives/pagination.d.ts.map +1 -0
- package/dist/components/primitives/pagination.js +31 -0
- package/dist/components/primitives/pagination.js.map +1 -0
- package/dist/components/primitives/popover.d.ts +12 -0
- package/dist/components/primitives/popover.d.ts.map +1 -0
- package/dist/components/primitives/popover.js +22 -0
- package/dist/components/primitives/popover.js.map +1 -0
- package/dist/components/primitives/progress.d.ts +25 -0
- package/dist/components/primitives/progress.d.ts.map +1 -0
- package/dist/components/primitives/progress.js +25 -0
- package/dist/components/primitives/progress.js.map +1 -0
- package/dist/components/primitives/radio-group.d.ts +47 -0
- package/dist/components/primitives/radio-group.d.ts.map +1 -0
- package/dist/components/primitives/radio-group.js +11 -0
- package/dist/components/primitives/radio-group.js.map +1 -0
- package/dist/components/primitives/select.d.ts +39 -0
- package/dist/components/primitives/select.d.ts.map +1 -0
- package/dist/components/primitives/select.js +142 -0
- package/dist/components/primitives/select.js.map +1 -0
- package/dist/components/primitives/separator.d.ts +9 -0
- package/dist/components/primitives/separator.d.ts.map +1 -0
- package/dist/components/primitives/separator.js +16 -0
- package/dist/components/primitives/separator.js.map +1 -0
- package/dist/components/primitives/side-nav.d.ts +65 -0
- package/dist/components/primitives/side-nav.d.ts.map +1 -0
- package/dist/components/primitives/side-nav.js +100 -0
- package/dist/components/primitives/side-nav.js.map +1 -0
- package/dist/components/primitives/skeleton.d.ts +22 -0
- package/dist/components/primitives/skeleton.d.ts.map +1 -0
- package/dist/components/primitives/skeleton.js +25 -0
- package/dist/components/primitives/skeleton.js.map +1 -0
- package/dist/components/primitives/spinner.d.ts +20 -0
- package/dist/components/primitives/spinner.d.ts.map +1 -0
- package/dist/components/primitives/spinner.js +21 -0
- package/dist/components/primitives/spinner.js.map +1 -0
- package/dist/components/primitives/switch.d.ts +29 -0
- package/dist/components/primitives/switch.d.ts.map +1 -0
- package/dist/components/primitives/switch.js +24 -0
- package/dist/components/primitives/switch.js.map +1 -0
- package/dist/components/primitives/table.d.ts +23 -0
- package/dist/components/primitives/table.d.ts.map +1 -0
- package/dist/components/primitives/table.js +81 -0
- package/dist/components/primitives/table.js.map +1 -0
- package/dist/components/primitives/tabs.d.ts +38 -0
- package/dist/components/primitives/tabs.d.ts.map +1 -0
- package/dist/components/primitives/tabs.js +84 -0
- package/dist/components/primitives/tabs.js.map +1 -0
- package/dist/components/primitives/textarea.d.ts +4 -0
- package/dist/components/primitives/textarea.d.ts.map +1 -0
- package/dist/components/primitives/textarea.js +11 -0
- package/dist/components/primitives/textarea.js.map +1 -0
- package/dist/components/primitives/toast.d.ts +24 -0
- package/dist/components/primitives/toast.d.ts.map +1 -0
- package/dist/components/primitives/toast.js +58 -0
- package/dist/components/primitives/toast.js.map +1 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.d.ts.map +1 -0
- package/dist/components/primitives/tooltip.js +6 -0
- package/dist/components/primitives/tooltip.js.map +1 -0
- package/dist/components/status/state-chip.d.ts +53 -0
- package/dist/components/status/state-chip.d.ts.map +1 -0
- package/dist/components/status/state-chip.js +8 -0
- package/dist/components/status/state-chip.js.map +1 -0
- package/dist/components/status/state-mark.d.ts +21 -0
- package/dist/components/status/state-mark.d.ts.map +1 -0
- package/dist/components/status/state-mark.js +90 -0
- package/dist/components/status/state-mark.js.map +1 -0
- package/dist/components/status/status-pill.d.ts +62 -0
- package/dist/components/status/status-pill.d.ts.map +1 -0
- package/dist/components/status/status-pill.js +65 -0
- package/dist/components/status/status-pill.js.map +1 -0
- package/dist/components/status/status-tokens.d.ts +110 -0
- package/dist/components/status/status-tokens.d.ts.map +1 -0
- package/dist/components/status/status-tokens.js +102 -0
- package/dist/components/status/status-tokens.js.map +1 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +11 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +78 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/money.d.ts +73 -0
- package/dist/lib/money.d.ts.map +1 -0
- package/dist/lib/money.js +123 -0
- package/dist/lib/money.js.map +1 -0
- package/dist/lib/omit-undefined.d.ts +17 -0
- package/dist/lib/omit-undefined.d.ts.map +1 -0
- package/dist/lib/omit-undefined.js +24 -0
- package/dist/lib/omit-undefined.js.map +1 -0
- package/package.json +100 -0
- package/src/components/data/code.tsx +43 -0
- package/src/components/data/copy-button.tsx +97 -0
- package/src/components/data/detail-row.tsx +113 -0
- package/src/components/data/id-display.tsx +49 -0
- package/src/components/data/masked-value.tsx +96 -0
- package/src/components/data/money.tsx +46 -0
- package/src/components/data/phone-display.tsx +60 -0
- package/src/components/data/stat-tile.tsx +68 -0
- package/src/components/data/timestamp-display.tsx +106 -0
- package/src/components/patterns/inline-banner.tsx +60 -0
- package/src/components/patterns/inline-empty-state.tsx +45 -0
- package/src/components/patterns/live-row.tsx +75 -0
- package/src/components/patterns/payload-inspector.tsx +157 -0
- package/src/components/patterns/route-skeleton.tsx +77 -0
- package/src/components/patterns/screen-layout.tsx +44 -0
- package/src/components/patterns/stale-write-banner.tsx +44 -0
- package/src/components/patterns/state-timeline.tsx +229 -0
- package/src/components/primitives/badge.tsx +40 -0
- package/src/components/primitives/button.tsx +54 -0
- package/src/components/primitives/calendar.tsx +136 -0
- package/src/components/primitives/card.tsx +70 -0
- package/src/components/primitives/checkbox.tsx +101 -0
- package/src/components/primitives/chip-select.tsx +105 -0
- package/src/components/primitives/command-menu.tsx +92 -0
- package/src/components/primitives/confirm-dialog.tsx +109 -0
- package/src/components/primitives/date-picker.tsx +271 -0
- package/src/components/primitives/dialog.tsx +195 -0
- package/src/components/primitives/drawer.tsx +326 -0
- package/src/components/primitives/dropdown-menu.tsx +128 -0
- package/src/components/primitives/form-field.tsx +136 -0
- package/src/components/primitives/inline-confirm.tsx +118 -0
- package/src/components/primitives/input.tsx +21 -0
- package/src/components/primitives/label.tsx +43 -0
- package/src/components/primitives/pagination.tsx +110 -0
- package/src/components/primitives/popover.tsx +41 -0
- package/src/components/primitives/progress.tsx +66 -0
- package/src/components/primitives/radio-group.tsx +90 -0
- package/src/components/primitives/select.tsx +254 -0
- package/src/components/primitives/separator.tsx +49 -0
- package/src/components/primitives/side-nav.tsx +253 -0
- package/src/components/primitives/skeleton.tsx +25 -0
- package/src/components/primitives/spinner.tsx +39 -0
- package/src/components/primitives/switch.tsx +74 -0
- package/src/components/primitives/table.tsx +157 -0
- package/src/components/primitives/tabs.tsx +163 -0
- package/src/components/primitives/textarea.tsx +21 -0
- package/src/components/primitives/toast.tsx +117 -0
- package/src/components/primitives/tooltip.tsx +38 -0
- package/src/components/status/state-chip.tsx +70 -0
- package/src/components/status/state-mark.tsx +154 -0
- package/src/components/status/status-pill.tsx +153 -0
- package/src/components/status/status-tokens.ts +173 -0
- package/src/index.ts +96 -0
- package/src/lib/cn.ts +168 -0
- package/src/lib/money.ts +164 -0
- package/src/lib/omit-undefined.ts +25 -0
- package/src/styles/theme.css +381 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { DateRange } from "react-day-picker";
|
|
2
|
+
export type { DateRange };
|
|
3
|
+
/**
|
|
4
|
+
* `2026-09-11` — ISO 8601 calendar date, no time, no zone.
|
|
5
|
+
*
|
|
6
|
+
* Every date this module exchanges with a caller is one of these, not a
|
|
7
|
+
* `Date`. A `Date` is an instant, and an instant rendered in a different
|
|
8
|
+
* zone is a different calendar day — which is how a filter for "today"
|
|
9
|
+
* silently returns yesterday's rows for anyone west of the server. The
|
|
10
|
+
* `Date` objects `react-day-picker` works in are confined to this file.
|
|
11
|
+
*/
|
|
12
|
+
export type IsoDate = string;
|
|
13
|
+
/** `Date` (local midnight) → `YYYY-MM-DD`, without going through UTC. */
|
|
14
|
+
export declare function toIsoDate(date: Date): IsoDate;
|
|
15
|
+
/**
|
|
16
|
+
* `YYYY-MM-DD` → `Date` at *local* midnight.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately not `new Date("2026-09-11")`, which the spec parses as
|
|
19
|
+
* UTC midnight — in any negative-offset zone that is the previous day,
|
|
20
|
+
* so a calendar built on it highlights the wrong cell.
|
|
21
|
+
*/
|
|
22
|
+
export declare function fromIsoDate(iso: IsoDate): Date | undefined;
|
|
23
|
+
export interface DatePickerProps {
|
|
24
|
+
value: IsoDate | undefined;
|
|
25
|
+
onValueChange: (value: IsoDate | undefined) => void;
|
|
26
|
+
/** Shown when empty, and used as the control's accessible name. */
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** Earliest selectable date, inclusive. */
|
|
29
|
+
min?: IsoDate | undefined;
|
|
30
|
+
/** Latest selectable date, inclusive. */
|
|
31
|
+
max?: IsoDate | undefined;
|
|
32
|
+
disabled?: boolean | undefined;
|
|
33
|
+
/** Show an inline clear affordance once a date is picked. */
|
|
34
|
+
clearable?: boolean;
|
|
35
|
+
className?: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** A single calendar date, chosen from a popover calendar. */
|
|
38
|
+
export declare function DatePicker({ value, onValueChange, placeholder, min, max, disabled, clearable, className, }: DatePickerProps): import("react").JSX.Element;
|
|
39
|
+
/** Two ISO dates, inclusive at both ends. `undefined` at either end means open. */
|
|
40
|
+
export interface IsoDateRange {
|
|
41
|
+
from?: IsoDate | undefined;
|
|
42
|
+
to?: IsoDate | undefined;
|
|
43
|
+
}
|
|
44
|
+
export interface DateRangePickerProps {
|
|
45
|
+
value: IsoDateRange | undefined;
|
|
46
|
+
onValueChange: (value: IsoDateRange | undefined) => void;
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
min?: IsoDate | undefined;
|
|
49
|
+
max?: IsoDate | undefined;
|
|
50
|
+
disabled?: boolean | undefined;
|
|
51
|
+
clearable?: boolean;
|
|
52
|
+
/** Months shown side by side. Two makes a cross-month range selectable
|
|
53
|
+
* without navigating, which is the common case for "last 30 days". */
|
|
54
|
+
numberOfMonths?: number;
|
|
55
|
+
className?: string | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A start and end date as one control.
|
|
59
|
+
*
|
|
60
|
+
* Exists because the alternative — two `<input type="date">` side by side
|
|
61
|
+
* — is what applications actually ship, and it cannot express the one
|
|
62
|
+
* thing a range needs: that the two ends constrain each other. Here the
|
|
63
|
+
* second click is always after the first, the fill between them is
|
|
64
|
+
* visible, and a half-finished range is representable (`from` set, `to`
|
|
65
|
+
* open) rather than being a validation error.
|
|
66
|
+
*/
|
|
67
|
+
export declare function DateRangePicker({ value, onValueChange, placeholder, min, max, disabled, clearable, numberOfMonths, className, }: DateRangePickerProps): import("react").JSX.Element;
|
|
68
|
+
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/date-picker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,MA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AO,GAAG,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;0EACsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAWD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,aAAa,EACb,WAAiC,EACjC,GAAG,EACH,GAAG,EACH,QAAQ,EACR,SAAgB,EAChB,cAAkB,EAClB,SAAS,GACV,EAAE,oBAAoB,+BA6CtB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Popover as HeadlessPopover, PopoverButton, PopoverPanel } from "@headlessui/react";
|
|
4
|
+
import { CalendarDays, X } from "lucide-react";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
import { omitUndefined } from "../../lib/omit-undefined.js";
|
|
7
|
+
import { Calendar } from "./calendar.js";
|
|
8
|
+
/** `Date` (local midnight) → `YYYY-MM-DD`, without going through UTC. */
|
|
9
|
+
export function toIsoDate(date) {
|
|
10
|
+
const year = date.getFullYear();
|
|
11
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
12
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
13
|
+
return `${year}-${month}-${day}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `YYYY-MM-DD` → `Date` at *local* midnight.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately not `new Date("2026-09-11")`, which the spec parses as
|
|
19
|
+
* UTC midnight — in any negative-offset zone that is the previous day,
|
|
20
|
+
* so a calendar built on it highlights the wrong cell.
|
|
21
|
+
*/
|
|
22
|
+
export function fromIsoDate(iso) {
|
|
23
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
|
|
24
|
+
if (match === null)
|
|
25
|
+
return undefined;
|
|
26
|
+
const [, year, month, day] = match;
|
|
27
|
+
return new Date(Number(year), Number(month) - 1, Number(day));
|
|
28
|
+
}
|
|
29
|
+
function displayLabel(iso, placeholder) {
|
|
30
|
+
return iso === undefined || iso === "" ? placeholder : iso;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The field-looking button that opens the calendar.
|
|
34
|
+
*
|
|
35
|
+
* A `<button>`, not an `<input>`: the value is chosen from the calendar,
|
|
36
|
+
* and a text input that looks editable but is not is worse than a button
|
|
37
|
+
* that looks like a field. Callers who want typed entry should use a
|
|
38
|
+
* plain `<Input type="date">` — the browser's own picker is better than
|
|
39
|
+
* anything worth reimplementing here.
|
|
40
|
+
*/
|
|
41
|
+
function PickerTrigger({ placeholder, label, hasValue, disabled, onClear, className, }) {
|
|
42
|
+
return (_jsxs("div", { className: cn("relative inline-flex w-full items-center", className), children: [_jsxs(PopoverButton, { ...omitUndefined({ disabled }), className: cn("input input-bordered flex w-full items-center gap-2 text-left font-sans text-prose", !hasValue && "text-subtle-foreground", "disabled:cursor-not-allowed disabled:opacity-50", hasValue && onClear !== undefined && "pr-9"), children: [_jsx(CalendarDays, { size: 14, strokeWidth: 1.5, className: "shrink-0 text-subtle-foreground" }), _jsx("span", { className: "truncate font-mono tabular-nums", children: label }), _jsx("span", { className: "sr-only", children: placeholder })] }), hasValue && onClear !== undefined && (_jsx("button", { type: "button", onClick: onClear, "aria-label": `Clear ${placeholder}`, className: "-translate-y-1/2 absolute top-1/2 right-2 text-subtle-foreground hover:text-foreground", children: _jsx(X, { size: 14, strokeWidth: 1.5 }) }))] }));
|
|
43
|
+
}
|
|
44
|
+
const PANEL_CLASS = cn("z-50 rounded-md border border-edge bg-surface-2 shadow-[var(--shadow-popover)]", "[--anchor-gap:6px] focus:outline-none", "origin-top transition duration-100 ease-out data-closed:scale-95 data-closed:opacity-0");
|
|
45
|
+
/** A single calendar date, chosen from a popover calendar. */
|
|
46
|
+
export function DatePicker({ value, onValueChange, placeholder = "Pick a date", min, max, disabled, clearable = true, className, }) {
|
|
47
|
+
const selected = value === undefined ? undefined : fromIsoDate(value);
|
|
48
|
+
return (_jsx(HeadlessPopover, { className: cn("relative", className), children: ({ close }) => (_jsxs(_Fragment, { children: [_jsx(PickerTrigger, { placeholder: placeholder, label: displayLabel(value, placeholder), hasValue: value !== undefined && value !== "", disabled: disabled, onClear: clearable ? () => onValueChange(undefined) : undefined, className: undefined }), _jsx(PopoverPanel, { anchor: "bottom start", transition: true, className: PANEL_CLASS, children: _jsx(Calendar, { mode: "single", ...omitUndefined({
|
|
49
|
+
selected,
|
|
50
|
+
defaultMonth: selected,
|
|
51
|
+
startMonth: min === undefined ? undefined : fromIsoDate(min),
|
|
52
|
+
endMonth: max === undefined ? undefined : fromIsoDate(max),
|
|
53
|
+
}), onSelect: (next) => {
|
|
54
|
+
onValueChange(next === undefined ? undefined : toIsoDate(next));
|
|
55
|
+
// Closing on pick is right for a single date and wrong for
|
|
56
|
+
// a range, where the first click is only half the answer.
|
|
57
|
+
if (next !== undefined)
|
|
58
|
+
close();
|
|
59
|
+
} }) })] })) }));
|
|
60
|
+
}
|
|
61
|
+
function rangeLabel(value, placeholder) {
|
|
62
|
+
if (value === undefined)
|
|
63
|
+
return placeholder;
|
|
64
|
+
const { from, to } = value;
|
|
65
|
+
if (from === undefined && to === undefined)
|
|
66
|
+
return placeholder;
|
|
67
|
+
if (from !== undefined && to === undefined)
|
|
68
|
+
return `${from} → …`;
|
|
69
|
+
if (from === undefined && to !== undefined)
|
|
70
|
+
return `… → ${to}`;
|
|
71
|
+
return `${from} → ${to}`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A start and end date as one control.
|
|
75
|
+
*
|
|
76
|
+
* Exists because the alternative — two `<input type="date">` side by side
|
|
77
|
+
* — is what applications actually ship, and it cannot express the one
|
|
78
|
+
* thing a range needs: that the two ends constrain each other. Here the
|
|
79
|
+
* second click is always after the first, the fill between them is
|
|
80
|
+
* visible, and a half-finished range is representable (`from` set, `to`
|
|
81
|
+
* open) rather than being a validation error.
|
|
82
|
+
*/
|
|
83
|
+
export function DateRangePicker({ value, onValueChange, placeholder = "Pick a date range", min, max, disabled, clearable = true, numberOfMonths = 2, className, }) {
|
|
84
|
+
const selected = value === undefined
|
|
85
|
+
? undefined
|
|
86
|
+
: {
|
|
87
|
+
from: value.from === undefined ? undefined : fromIsoDate(value.from),
|
|
88
|
+
to: value.to === undefined ? undefined : fromIsoDate(value.to),
|
|
89
|
+
};
|
|
90
|
+
const hasValue = value !== undefined && (value.from !== undefined || value.to !== undefined);
|
|
91
|
+
return (_jsxs(HeadlessPopover, { className: cn("relative", className), children: [_jsx(PickerTrigger, { placeholder: placeholder, label: rangeLabel(value, placeholder), hasValue: hasValue, disabled: disabled, onClear: clearable ? () => onValueChange(undefined) : undefined, className: undefined }), _jsx(PopoverPanel, { anchor: "bottom start", transition: true, className: PANEL_CLASS, children: _jsx(Calendar, { mode: "range", numberOfMonths: numberOfMonths, ...omitUndefined({
|
|
92
|
+
selected,
|
|
93
|
+
defaultMonth: selected?.from,
|
|
94
|
+
startMonth: min === undefined ? undefined : fromIsoDate(min),
|
|
95
|
+
endMonth: max === undefined ? undefined : fromIsoDate(max),
|
|
96
|
+
}), onSelect: (next) => {
|
|
97
|
+
if (next === undefined) {
|
|
98
|
+
onValueChange(undefined);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
onValueChange({
|
|
102
|
+
from: next.from === undefined ? undefined : toIsoDate(next.from),
|
|
103
|
+
to: next.to === undefined ? undefined : toIsoDate(next.to),
|
|
104
|
+
});
|
|
105
|
+
} }) })] }));
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=date-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../src/components/primitives/date-picker.tsx"],"names":[],"mappings":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C;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DialogDescription as HeadlessDialogDescription, DialogTitle as HeadlessDialogTitle } from "@headlessui/react";
|
|
2
|
+
import { type ComponentPropsWithoutRef, type ElementType, type ReactNode } from "react";
|
|
3
|
+
export interface DialogProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* D3: Radix `Dialog` → Headless UI `Dialog`/`DialogPanel`/`DialogTitle`/`DialogBackdrop`.
|
|
11
|
+
*
|
|
12
|
+
* `Dialog` itself is **not** a Headless UI component — it's a plain context
|
|
13
|
+
* provider. Headless UI's own `Dialog` only wraps the modal
|
|
14
|
+
* backdrop/panel (`DialogContent` below) and is controlled-only
|
|
15
|
+
* (`open`/`onClose`); it has no equivalent to Radix's `Dialog.Trigger`,
|
|
16
|
+
* which rendered in place (outside any portal) and could itself drive an
|
|
17
|
+
* *uncontrolled* open state. Two real consumers need both shapes:
|
|
18
|
+
* `providers-screen.tsx`'s edit dialog is fully controlled
|
|
19
|
+
* (`open={selectedId !== null}`, no `DialogTrigger` at all), while the
|
|
20
|
+
* gallery's demo dialog is uncontrolled, opened by its own in-place
|
|
21
|
+
* `DialogTrigger`. This root supplies the open/close plumbing for both,
|
|
22
|
+
* the same controlled/uncontrolled duality `Select` (D17) uses.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Dialog({ open, defaultOpen, onOpenChange, children }: DialogProps): import("react").JSX.Element;
|
|
25
|
+
type TriggerProps<T extends ElementType> = {
|
|
26
|
+
as?: T;
|
|
27
|
+
} & Omit<ComponentPropsWithoutRef<T>, "as">;
|
|
28
|
+
/**
|
|
29
|
+
* Renders in place, not portaled — `as` selects the rendered element/component,
|
|
30
|
+
* matching Headless UI's own polymorphism convention rather than Radix's
|
|
31
|
+
* `asChild` (D4 already retired that pattern for `Button`; this is the
|
|
32
|
+
* identical call applied to a trigger). Replaces
|
|
33
|
+
* `<DialogTrigger asChild><Button variant="secondary">…</Button></DialogTrigger>`
|
|
34
|
+
* with `<DialogTrigger as={Button} variant="secondary">…</DialogTrigger>`
|
|
35
|
+
* (the gallery's own only consumer, updated in this same change).
|
|
36
|
+
*/
|
|
37
|
+
export declare function DialogTrigger<T extends ElementType = "button">({ as, onClick, ...props }: TriggerProps<T>): import("react").JSX.Element;
|
|
38
|
+
/** Unconsumed today (grepped across `admin/`) — kept for API parity. Same
|
|
39
|
+
* `as`-polymorphic shape as `DialogTrigger`. */
|
|
40
|
+
export declare function DialogClose<T extends ElementType = "button">({ as, onClick, ...props }: TriggerProps<T>): import("react").JSX.Element;
|
|
41
|
+
export declare function DialogContent({ className, children, ...props }: ComponentPropsWithoutRef<"div">): import("react").JSX.Element;
|
|
42
|
+
export declare function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
43
|
+
/** #56: the confirm/requeue dialog's own action row. Mirrors `DialogHeader`'s
|
|
44
|
+
* shape (a thin, class-composing div, not a Headless-UI-wrapped primitive —
|
|
45
|
+
* a footer has no accessibility semantics either library needs to own). */
|
|
46
|
+
export declare function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
47
|
+
export declare function DialogTitle({ className, ...props }: ComponentPropsWithoutRef<typeof HeadlessDialogTitle>): import("react").JSX.Element;
|
|
48
|
+
export declare function DialogDescription({ className, ...props }: ComponentPropsWithoutRef<typeof HeadlessDialogDescription>): import("react").JSX.Element;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,iBAAiB,IAAI,yBAAyB,EAC9C,WAAW,IAA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E,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,+BAEzF;AAED,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,+BAOtD;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,yBAAyB,CAAC,+BAO5D"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { DialogBackdrop, DialogPanel, Dialog as HeadlessDialog, DialogDescription as HeadlessDialogDescription, DialogTitle as HeadlessDialogTitle, } from "@headlessui/react";
|
|
4
|
+
import { X } from "lucide-react";
|
|
5
|
+
import { createContext, useContext, useState, } from "react";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
const DialogContext = createContext(null);
|
|
8
|
+
function useDialogContext(component) {
|
|
9
|
+
const ctx = useContext(DialogContext);
|
|
10
|
+
if (ctx === null) {
|
|
11
|
+
throw new Error(`<${component} /> must be rendered inside <Dialog>.`);
|
|
12
|
+
}
|
|
13
|
+
return ctx;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* D3: Radix `Dialog` → Headless UI `Dialog`/`DialogPanel`/`DialogTitle`/`DialogBackdrop`.
|
|
17
|
+
*
|
|
18
|
+
* `Dialog` itself is **not** a Headless UI component — it's a plain context
|
|
19
|
+
* provider. Headless UI's own `Dialog` only wraps the modal
|
|
20
|
+
* backdrop/panel (`DialogContent` below) and is controlled-only
|
|
21
|
+
* (`open`/`onClose`); it has no equivalent to Radix's `Dialog.Trigger`,
|
|
22
|
+
* which rendered in place (outside any portal) and could itself drive an
|
|
23
|
+
* *uncontrolled* open state. Two real consumers need both shapes:
|
|
24
|
+
* `providers-screen.tsx`'s edit dialog is fully controlled
|
|
25
|
+
* (`open={selectedId !== null}`, no `DialogTrigger` at all), while the
|
|
26
|
+
* gallery's demo dialog is uncontrolled, opened by its own in-place
|
|
27
|
+
* `DialogTrigger`. This root supplies the open/close plumbing for both,
|
|
28
|
+
* the same controlled/uncontrolled duality `Select` (D17) uses.
|
|
29
|
+
*/
|
|
30
|
+
export function Dialog({ open, defaultOpen = false, onOpenChange, children }) {
|
|
31
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
32
|
+
const isControlled = open !== undefined;
|
|
33
|
+
const currentOpen = isControlled ? open : internalOpen;
|
|
34
|
+
function setOpen(next) {
|
|
35
|
+
if (!isControlled)
|
|
36
|
+
setInternalOpen(next);
|
|
37
|
+
onOpenChange?.(next);
|
|
38
|
+
}
|
|
39
|
+
return (_jsx(DialogContext.Provider, { value: { open: currentOpen, setOpen }, children: children }));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Renders in place, not portaled — `as` selects the rendered element/component,
|
|
43
|
+
* matching Headless UI's own polymorphism convention rather than Radix's
|
|
44
|
+
* `asChild` (D4 already retired that pattern for `Button`; this is the
|
|
45
|
+
* identical call applied to a trigger). Replaces
|
|
46
|
+
* `<DialogTrigger asChild><Button variant="secondary">…</Button></DialogTrigger>`
|
|
47
|
+
* with `<DialogTrigger as={Button} variant="secondary">…</DialogTrigger>`
|
|
48
|
+
* (the gallery's own only consumer, updated in this same change).
|
|
49
|
+
*/
|
|
50
|
+
export function DialogTrigger({ as, onClick, ...props }) {
|
|
51
|
+
const { setOpen } = useDialogContext("DialogTrigger");
|
|
52
|
+
const Component = (as ?? "button");
|
|
53
|
+
return (_jsx(Component, { type: as === undefined ? "button" : undefined, onClick: (event) => {
|
|
54
|
+
onClick?.(event);
|
|
55
|
+
setOpen(true);
|
|
56
|
+
}, ...props }));
|
|
57
|
+
}
|
|
58
|
+
/** Unconsumed today (grepped across `admin/`) — kept for API parity. Same
|
|
59
|
+
* `as`-polymorphic shape as `DialogTrigger`. */
|
|
60
|
+
export function DialogClose({ as, onClick, ...props }) {
|
|
61
|
+
const { setOpen } = useDialogContext("DialogClose");
|
|
62
|
+
const Component = (as ?? "button");
|
|
63
|
+
return (_jsx(Component, { type: as === undefined ? "button" : undefined, onClick: (event) => {
|
|
64
|
+
onClick?.(event);
|
|
65
|
+
setOpen(false);
|
|
66
|
+
}, ...props }));
|
|
67
|
+
}
|
|
68
|
+
// Radius bumps to --radius-md here on purpose (design doc §3.5, unchanged by
|
|
69
|
+
// D8's radius-scale rewrite — see theme.css): a floating layer reads as
|
|
70
|
+
// detached from the grid beneath it.
|
|
71
|
+
export function DialogContent({ className, children, ...props }) {
|
|
72
|
+
const { open, setOpen } = useDialogContext("DialogContent");
|
|
73
|
+
return (_jsxs(HeadlessDialog, { open: open, onClose: setOpen, className: "relative z-50", children: [_jsx(DialogBackdrop, { transition: true, className: "fixed inset-0 bg-black/50 duration-150 ease-out data-closed:opacity-0" }), _jsx("div", { className: "fixed inset-0 flex w-screen items-center justify-center p-4", children: _jsxs(DialogPanel, { transition: true, className: cn("relative w-full max-w-[480px] rounded-md border border-edge bg-surface-2 p-6 shadow-[var(--shadow-dialog)]", "duration-150 ease-out data-closed:scale-95 data-closed:opacity-0", className), ...props, children: [children, _jsx("button", { type: "button", "aria-label": "Close", onClick: () => setOpen(false), className: "absolute top-4 right-4 text-subtle-foreground hover:text-foreground", children: _jsx(X, { size: 16, strokeWidth: 1.5 }) })] }) })] }));
|
|
74
|
+
}
|
|
75
|
+
export function DialogHeader({ className, ...props }) {
|
|
76
|
+
return _jsx("div", { className: cn("mb-4 flex flex-col gap-1", className), ...props });
|
|
77
|
+
}
|
|
78
|
+
/** #56: the confirm/requeue dialog's own action row. Mirrors `DialogHeader`'s
|
|
79
|
+
* shape (a thin, class-composing div, not a Headless-UI-wrapped primitive —
|
|
80
|
+
* a footer has no accessibility semantics either library needs to own). */
|
|
81
|
+
export function DialogFooter({ className, ...props }) {
|
|
82
|
+
return _jsx("div", { className: cn("mt-6 flex items-center justify-end gap-2", className), ...props });
|
|
83
|
+
}
|
|
84
|
+
export function DialogTitle({ className, ...props }) {
|
|
85
|
+
return (_jsx(HeadlessDialogTitle, { className: cn("font-medium text-foreground text-title-sm", className), ...props }));
|
|
86
|
+
}
|
|
87
|
+
export function DialogDescription({ className, ...props }) {
|
|
88
|
+
return (_jsx(HeadlessDialogDescription, { className: cn("text-muted-foreground text-prose", className), ...props }));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/components/primitives/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,cAAc,EACd,WAAW,EACX,MAAM,IAAI,cAAc,EACxB,iBAAiB,IAAI,yBAAyB,EAC9C,WAAW,IAAI,mBAAmB,GACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACjC,OAAO,EAEL,aAAa,EAIb,UAAU,EACV,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAMlC,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAErE,SAAS,gBAAgB,CAAC,SAAiB;IACzC,MAAM,GAAG,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACtC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,IAAI,SAAS,uCAAuC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AASD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAe;IACvF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,WAAW,CA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AAE,GAAG,KAAK,EAAwC;IACxF,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,0CAA0C,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EAC6C;IACrD,OAAO,CACL,KAAC,mBAAmB,IAClB,SAAS,EAAE,EAAE,CAAC,2CAA2C,EAAE,SAAS,CAAC,KACjE,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,GAAG,KAAK,EACmD;IAC3D,OAAO,CACL,KAAC,yBAAyB,IACxB,SAAS,EAAE,EAAE,CAAC,kCAAkC,EAAE,SAAS,CAAC,KACxD,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare const Drawer: typeof import("vaul").Root;
|
|
3
|
+
export declare const DrawerTrigger: import("react").ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export declare const DrawerClose: import("react").ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare const DrawerPortal: typeof import("vaul").Portal;
|
|
6
|
+
export declare const DrawerOverlay: import("react").ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-dialog").DialogOverlayProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const DrawerContent: import("react").ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-dialog").DialogContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
/** Not previously exported — `vaul`'s `Content` renders Radix Dialog's
|
|
9
|
+
* `Content` underneath (`vaul/dist/index.js` imports `@radix-ui/react-
|
|
10
|
+
* dialog` directly and forwards its `Content`/`Title`/`Description`), so
|
|
11
|
+
* Radix's own "DialogContent requires a DialogTitle" dev warning applies
|
|
12
|
+
* here exactly as it does to `primitives/dialog.tsx`. `QuickDetailDrawer`/
|
|
13
|
+
* `MoreDetailDrawer` below always render one; exported separately too for
|
|
14
|
+
* any future one-off use of the generic `DrawerContent` above. */
|
|
15
|
+
export declare const DrawerTitle: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
16
|
+
/** See `DrawerTitle` — same "not previously exported, Radix warns without
|
|
17
|
+
* one" reasoning, for `aria-describedby` instead of the accessible name. */
|
|
18
|
+
export declare const DrawerDescription: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
19
|
+
interface DetailDrawerProps {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onOpenChange: (open: boolean) => void;
|
|
22
|
+
/** Rendered as the drawer's accessible name (`Drawer.Title`) — required,
|
|
23
|
+
* not optional, because both variants always render one and Radix warns
|
|
24
|
+
* loudly in dev without it. */
|
|
25
|
+
title: ReactNode;
|
|
26
|
+
/** Rendered as the drawer's accessible description (`Drawer.Description`).
|
|
27
|
+
* Optional for the *caller* — when omitted, a screen-reader-only
|
|
28
|
+
* fallback is still rendered so `aria-describedby` is always wired,
|
|
29
|
+
* matching `primitives/dialog.tsx`'s own precedent of never shipping a
|
|
30
|
+
* `Content` with no description at all. */
|
|
31
|
+
description?: ReactNode;
|
|
32
|
+
/** The scrollable body — a summary of fields, an edit form, whatever the
|
|
33
|
+
* calling screen owns. This file has no opinion on it. */
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
/** Optional sticky action row (§1.5's Polar reference: "a fixed bottom
|
|
36
|
+
* action row... stays visible without the form needing to scroll"). */
|
|
37
|
+
footer?: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* **Quick details** (§3, D14) — a peek at one row's state without leaving
|
|
42
|
+
* the list. Narrow (`420–480px` at `md`+), undimmed (background stays
|
|
43
|
+
* legible and, per `vaul`'s own `modal={false}` behaviour verified above,
|
|
44
|
+
* scrollable/clickable — matching the Mercury reference, §1.4), no route
|
|
45
|
+
* ownership: the caller owns `open`/`onOpenChange` from local state (e.g.
|
|
46
|
+
* "which row id is selected"), and losing it on refresh is expected and
|
|
47
|
+
* fine (reopening is one click on the same row).
|
|
48
|
+
*
|
|
49
|
+
* Not a `Dialog`, and not for anything destructive — §1.7/§3 reserve that
|
|
50
|
+
* for the centered `Dialog` primitive. This is a read-mostly summary with
|
|
51
|
+
* 1–2 actions, e.g. a "View full details" link that upgrades to
|
|
52
|
+
* `MoreDetailDrawer`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function QuickDetailDrawer(props: DetailDrawerProps): import("react").JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* **More details** (§3, D14) — the full record: every field, an edit
|
|
57
|
+
* form, destructive actions, short nested history. Wide (`640–720px` at
|
|
58
|
+
* `md`+), dimmed (modal-weight, matching the Polar reference, §1.5). The
|
|
59
|
+
* *caller* is expected to own a shallow `?panel=<recordId>` route so this
|
|
60
|
+
* survives refresh and is linkable (D14) — this component only owns the
|
|
61
|
+
* visual/behavioural weight, never routing; pass `open` derived from that
|
|
62
|
+
* query param and `onOpenChange` wired to update it.
|
|
63
|
+
*
|
|
64
|
+
* A destructive-confirmation step opened *from inside* this drawer (e.g.
|
|
65
|
+
* webhook-secret rotation) stays a nested `Dialog` (§3's own footnote) —
|
|
66
|
+
* that dialog needs a z-index at or above this drawer's `z-50`; setting
|
|
67
|
+
* that is `primitives/dialog.tsx`'s job (§8 risk list), not this file's.
|
|
68
|
+
*/
|
|
69
|
+
export declare function MoreDetailDrawer(props: DetailDrawerProps): import("react").JSX.Element;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/drawer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAenD,eAAO,MAAM,MAAM,4BAAuB,CAAC;AAC3C,eAAO,MAAM,aAAa,mJAA0B,CAAC;AACrD,eAAO,MAAM,WAAW,iJAAwB,CAAC;AACjD,eAAO,MAAM,YAAY,8BAAyB,CAAC;AAEnD,eAAO,MAAM,aAAa,0QASxB,CAAC;AAGH,eAAO,MAAM,aAAa,0QAkBxB,CAAC;AAGH;;;;;;kEAMkE;AAClE,eAAO,MAAM,WAAW,mNAStB,CAAC;AAGH;4EAC4E;AAC5E,eAAO,MAAM,iBAAiB,6NAS5B,CAAC;AAoFH,UAAU,iBAAiB;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;mCAE+B;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB;;;;+CAI2C;IAC3C,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;8DAC0D;IAC1D,QAAQ,EAAE,SAAS,CAAC;IACpB;2EACuE;IACvE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA+FD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,+BAQzD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,+BAExD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { Drawer as DrawerPrimitive } from "vaul";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
// vaul is standalone. Direction defaults to "right" — a side drawer reads
|
|
8
|
+
// as the console's Sheet-equivalent (design doc T15: "extend, don't fork");
|
|
9
|
+
// pass `direction="bottom"` for the mobile/narrow-viewport case.
|
|
10
|
+
//
|
|
11
|
+
// This generic composition (`Drawer`/`DrawerTrigger`/`DrawerClose`/
|
|
12
|
+
// `DrawerContent`) is unchanged by console-redesign.md §6.4/D14 — it is
|
|
13
|
+
// still the right tool for a one-off drawer with no quick-vs-more
|
|
14
|
+
// distinction to encode (see the gallery's own "Open drawer" example).
|
|
15
|
+
// `QuickDetailDrawer`/`MoreDetailDrawer` below are a *second*, self-
|
|
16
|
+
// contained API for the specific §3 distinction; they do not replace this
|
|
17
|
+
// one.
|
|
18
|
+
export const Drawer = DrawerPrimitive.Root;
|
|
19
|
+
export const DrawerTrigger = DrawerPrimitive.Trigger;
|
|
20
|
+
export const DrawerClose = DrawerPrimitive.Close;
|
|
21
|
+
export const DrawerPortal = DrawerPrimitive.Portal;
|
|
22
|
+
export const DrawerOverlay = forwardRef(({ className, ...props }, ref) => (_jsx(DrawerPrimitive.Overlay, { ref: ref, className: cn("fixed inset-0 z-50 bg-black/50", className), ...props })));
|
|
23
|
+
DrawerOverlay.displayName = "DrawerOverlay";
|
|
24
|
+
export const DrawerContent = forwardRef(({ className, children, ...props }, ref) => (_jsxs(DrawerPortal, { children: [_jsx(DrawerOverlay, {}), _jsx(DrawerPrimitive.Content, { ref: ref, className: cn("fixed inset-y-0 right-0 z-50 flex h-full w-full max-w-[560px] flex-col", "border-edge border-l bg-surface-2 shadow-[var(--shadow-dialog)]", className), ...props, children: children })] })));
|
|
25
|
+
DrawerContent.displayName = "DrawerContent";
|
|
26
|
+
/** Not previously exported — `vaul`'s `Content` renders Radix Dialog's
|
|
27
|
+
* `Content` underneath (`vaul/dist/index.js` imports `@radix-ui/react-
|
|
28
|
+
* dialog` directly and forwards its `Content`/`Title`/`Description`), so
|
|
29
|
+
* Radix's own "DialogContent requires a DialogTitle" dev warning applies
|
|
30
|
+
* here exactly as it does to `primitives/dialog.tsx`. `QuickDetailDrawer`/
|
|
31
|
+
* `MoreDetailDrawer` below always render one; exported separately too for
|
|
32
|
+
* any future one-off use of the generic `DrawerContent` above. */
|
|
33
|
+
export const DrawerTitle = forwardRef(({ className, ...props }, ref) => (_jsx(DrawerPrimitive.Title, { ref: ref, className: cn("font-medium text-foreground text-title-sm", className), ...props })));
|
|
34
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
35
|
+
/** See `DrawerTitle` — same "not previously exported, Radix warns without
|
|
36
|
+
* one" reasoning, for `aria-describedby` instead of the accessible name. */
|
|
37
|
+
export const DrawerDescription = forwardRef(({ className, ...props }, ref) => (_jsx(DrawerPrimitive.Description, { ref: ref, className: cn("text-muted-foreground text-prose", className), ...props })));
|
|
38
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
39
|
+
function DetailDrawerContent({ open, onOpenChange, title, description, children, footer, className, dimmed, contentClassName, }) {
|
|
40
|
+
return (_jsx(DrawerPrimitive.Root, { open: open, onOpenChange: onOpenChange, direction: "bottom", modal: dimmed, dismissible: true, handleOnly: true,
|
|
41
|
+
// vaul defaults this to `false` (`onOpenAutoFocus` is pre-vented
|
|
42
|
+
// unless the caller opts in) — verified in `dist/index.js`'s `Root`
|
|
43
|
+
// default parameters. Without it, opening either drawer would leave
|
|
44
|
+
// keyboard focus sitting on whatever triggered it instead of moving
|
|
45
|
+
// into the panel, which is a real, checkable regression from plain
|
|
46
|
+
// Radix `Dialog` behaviour (its own default *does* auto-focus
|
|
47
|
+
// `Content`) — set explicitly so focus genuinely lands inside the
|
|
48
|
+
// drawer the moment it opens, not just gets trapped there once the
|
|
49
|
+
// user starts tabbing.
|
|
50
|
+
autoFocus: true, children: _jsxs(DrawerPrimitive.Portal, { children: [dimmed && _jsx(DrawerPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/50" }), _jsxs(DrawerPrimitive.Content, { className: cn("fixed z-50 flex flex-col bg-surface-2 shadow-[var(--shadow-dialog)] outline-none",
|
|
51
|
+
// Phone: bottom sheet.
|
|
52
|
+
"inset-x-0 bottom-0 rounded-t-box border-edge border-t",
|
|
53
|
+
// `md`+: right-hand panel — every sheet-only property above is
|
|
54
|
+
// reset explicitly (inset, rounding, border side, max-height),
|
|
55
|
+
// not just overridden by a wider max-width, per this file's
|
|
56
|
+
// own D12-correction note above.
|
|
57
|
+
"md:inset-x-auto md:inset-y-0 md:right-0 md:h-full md:max-h-none", "md:w-full md:rounded-t-none md:rounded-l-box md:border-t-0 md:border-l", contentClassName, className), children: [_jsx(DrawerPrimitive.Handle, { className: "mt-2 shrink-0 bg-edge-strong md:hidden!" }), _jsxs("div", { className: "flex items-start justify-between gap-3 border-edge border-b px-5 py-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsx(DrawerTitle, { className: "truncate", children: title }), _jsx(DrawerDescription, { className: description == null ? "sr-only" : "mt-1", children: description ?? "Details panel." })] }), _jsx(DrawerPrimitive.Close, { "aria-label": "Close", className: "shrink-0 text-subtle-foreground hover:text-foreground", children: _jsx(X, { size: 16, strokeWidth: 1.5 }) })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-5 py-4", children: children }), footer != null && (_jsx("div", { className: "flex shrink-0 items-center justify-end gap-2 border-edge border-t px-5 py-4", children: footer }))] })] }) }));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* **Quick details** (§3, D14) — a peek at one row's state without leaving
|
|
61
|
+
* the list. Narrow (`420–480px` at `md`+), undimmed (background stays
|
|
62
|
+
* legible and, per `vaul`'s own `modal={false}` behaviour verified above,
|
|
63
|
+
* scrollable/clickable — matching the Mercury reference, §1.4), no route
|
|
64
|
+
* ownership: the caller owns `open`/`onOpenChange` from local state (e.g.
|
|
65
|
+
* "which row id is selected"), and losing it on refresh is expected and
|
|
66
|
+
* fine (reopening is one click on the same row).
|
|
67
|
+
*
|
|
68
|
+
* Not a `Dialog`, and not for anything destructive — §1.7/§3 reserve that
|
|
69
|
+
* for the centered `Dialog` primitive. This is a read-mostly summary with
|
|
70
|
+
* 1–2 actions, e.g. a "View full details" link that upgrades to
|
|
71
|
+
* `MoreDetailDrawer`.
|
|
72
|
+
*/
|
|
73
|
+
export function QuickDetailDrawer(props) {
|
|
74
|
+
return (_jsx(DetailDrawerContent, { ...props, dimmed: false, contentClassName: "max-h-[70vh] md:max-w-[440px]" }));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* **More details** (§3, D14) — the full record: every field, an edit
|
|
78
|
+
* form, destructive actions, short nested history. Wide (`640–720px` at
|
|
79
|
+
* `md`+), dimmed (modal-weight, matching the Polar reference, §1.5). The
|
|
80
|
+
* *caller* is expected to own a shallow `?panel=<recordId>` route so this
|
|
81
|
+
* survives refresh and is linkable (D14) — this component only owns the
|
|
82
|
+
* visual/behavioural weight, never routing; pass `open` derived from that
|
|
83
|
+
* query param and `onOpenChange` wired to update it.
|
|
84
|
+
*
|
|
85
|
+
* A destructive-confirmation step opened *from inside* this drawer (e.g.
|
|
86
|
+
* webhook-secret rotation) stays a nested `Dialog` (§3's own footnote) —
|
|
87
|
+
* that dialog needs a z-index at or above this drawer's `z-50`; setting
|
|
88
|
+
* that is `primitives/dialog.tsx`'s job (§8 risk list), not this file's.
|
|
89
|
+
*/
|
|
90
|
+
export function MoreDetailDrawer(props) {
|
|
91
|
+
return _jsx(DetailDrawerContent, { ...props, dimmed: true, contentClassName: "max-h-[92vh] md:max-w-[680px]" });
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceR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AC,KAAwB;IACvD,OAAO,KAAC,mBAAmB,OAAK,KAAK,EAAE,MAAM,QAAC,gBAAgB,EAAC,+BAA+B,GAAG,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MenuItems, MenuSeparator } from "@headlessui/react";
|
|
2
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
3
|
+
export declare const DropdownMenu: import("@headlessui/react")._internal_ComponentMenu & {
|
|
4
|
+
Button: import("@headlessui/react")._internal_ComponentMenuButton;
|
|
5
|
+
Items: import("@headlessui/react")._internal_ComponentMenuItems;
|
|
6
|
+
Item: import("@headlessui/react")._internal_ComponentMenuItem;
|
|
7
|
+
Section: import("@headlessui/react")._internal_ComponentMenuSection;
|
|
8
|
+
Heading: import("@headlessui/react")._internal_ComponentMenuHeading;
|
|
9
|
+
Separator: import("@headlessui/react")._internal_ComponentMenuSeparator;
|
|
10
|
+
};
|
|
11
|
+
export declare const DropdownMenuTrigger: import("@headlessui/react")._internal_ComponentMenuButton;
|
|
12
|
+
export declare const DropdownMenuGroup: import("@headlessui/react")._internal_ComponentMenuSection;
|
|
13
|
+
export declare function DropdownMenuSeparator({ className, ...props }: ComponentPropsWithoutRef<typeof MenuSeparator>): import("react").JSX.Element;
|
|
14
|
+
export declare function DropdownMenuContent({ className, ...props }: ComponentPropsWithoutRef<typeof MenuItems>): import("react").JSX.Element;
|
|
15
|
+
export declare function DropdownMenuItem({ className, ...props }: Omit<ComponentPropsWithoutRef<"button">, "type">): import("react").JSX.Element;
|
|
16
|
+
/** Unconsumed today (see module doc above) — caller controls `checked`
|
|
17
|
+
* itself, since Headless UI's `Menu` has no built-in checkbox-item state
|
|
18
|
+
* the way Radix's `DropdownMenuCheckboxItem` did. */
|
|
19
|
+
export declare function DropdownMenuCheckboxItem({ className, checked, children, ...props }: Omit<ComponentPropsWithoutRef<"button">, "type"> & {
|
|
20
|
+
checked?: boolean;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* **Found live, not assumed**: Headless UI's own `MenuHeading` throws the
|
|
24
|
+
* identical "not inside a relevant parent" error `label.tsx`'s own module
|
|
25
|
+
* doc already found for the standalone `Label` — `MenuHeading` needs a
|
|
26
|
+
* `MenuSection` ancestor to supply that context (`MenuSection`'s own
|
|
27
|
+
* implementation calls `useLabels()` to *create* the provider; `MenuHeading`
|
|
28
|
+
* calls `useLabelContext()` to *consume* it), and every call site here
|
|
29
|
+
* (matching the original Radix `DropdownMenuLabel`'s own shape) renders a
|
|
30
|
+
* standalone label with no surrounding group. Radix's own `Label` was a
|
|
31
|
+
* plain, non-interactive `<div>` with no roving-focus/ARIA-grouping
|
|
32
|
+
* behaviour beyond being read as ordinary text inside the menu's
|
|
33
|
+
* accessible tree — so a plain `<div>` here loses nothing real and avoids
|
|
34
|
+
* a dependency this element doesn't actually need. Reproduced live: a real
|
|
35
|
+
* "Uncaught Error: You used a <Label /> component, but it is not inside a
|
|
36
|
+
* relevant parent" client-side exception, thrown the instant the gallery's
|
|
37
|
+
* demo menu opened, before this fix.
|
|
38
|
+
*/
|
|
39
|
+
export declare function DropdownMenuLabel({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,SAAS,EAET,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAKtD,eAAO,MAAM,YAAY;;;;;;;CAAO,CAAC;AAKjC,eAAO,MAAM,mBAAmB,2DAAa,CAAC;AAM9C,eAAO,MAAM,iBAAiB,4DAAc,CAAC;AAE7C,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,aAAa,CAAC,+BAEhD;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,SAAS,CAAC,+BAa5C;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,+BAclD;AAED;;qDAEqD;AACrD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,+BAoB1E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,+BAO9F"}
|