@volvel/ui 0.0.0-stage → 0.7.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/LICENSE +202 -0
- package/THIRD_PARTY_NOTICES.md +23036 -0
- package/dist/Badge.d.ts +20 -0
- package/dist/Badge.js +35 -0
- package/dist/Button.d.ts +56 -0
- package/dist/Button.js +52 -0
- package/dist/Chart.d.ts +23 -0
- package/dist/Chart.js +98 -0
- package/dist/Combobox.d.ts +45 -0
- package/dist/Combobox.js +42 -0
- package/dist/ContextMenu.d.ts +16 -0
- package/dist/ContextMenu.js +38 -0
- package/dist/DateInput.d.ts +31 -0
- package/dist/DateInput.js +329 -0
- package/dist/Details.d.ts +12 -0
- package/dist/Details.js +9 -0
- package/dist/Dialog.d.ts +44 -0
- package/dist/Dialog.js +95 -0
- package/dist/Dialogs.d.ts +56 -0
- package/dist/Dialogs.js +95 -0
- package/dist/Doc.d.ts +25 -0
- package/dist/Doc.js +118 -0
- package/dist/DocServed.d.ts +6 -0
- package/dist/DocServed.js +154 -0
- package/dist/DocZoom.d.ts +11 -0
- package/dist/DocZoom.js +133 -0
- package/dist/Facts.d.ts +12 -0
- package/dist/Facts.js +10 -0
- package/dist/Fields.d.ts +184 -0
- package/dist/Fields.js +249 -0
- package/dist/Form.d.ts +47 -0
- package/dist/Form.js +189 -0
- package/dist/Grid.d.ts +118 -0
- package/dist/Grid.js +475 -0
- package/dist/HeadingSlot.d.ts +13 -0
- package/dist/HeadingSlot.js +19 -0
- package/dist/JsonView.d.ts +11 -0
- package/dist/JsonView.js +68 -0
- package/dist/LogViewer.d.ts +45 -0
- package/dist/LogViewer.js +299 -0
- package/dist/Markdown.d.ts +21 -0
- package/dist/Markdown.js +27 -0
- package/dist/MarkdownBody.d.ts +6 -0
- package/dist/MarkdownBody.js +14 -0
- package/dist/Menu.d.ts +29 -0
- package/dist/Menu.js +8 -0
- package/dist/MoveButtons.d.ts +19 -0
- package/dist/MoveButtons.js +22 -0
- package/dist/Notice.d.ts +47 -0
- package/dist/Notice.js +50 -0
- package/dist/PageShell.d.ts +42 -0
- package/dist/PageShell.js +14 -0
- package/dist/Pagination.d.ts +13 -0
- package/dist/Pagination.js +9 -0
- package/dist/Panel.d.ts +31 -0
- package/dist/Panel.js +33 -0
- package/dist/Pickers.d.ts +37 -0
- package/dist/Pickers.js +44 -0
- package/dist/Popover.d.ts +24 -0
- package/dist/Popover.js +12 -0
- package/dist/ResultView.d.ts +28 -0
- package/dist/ResultView.js +140 -0
- package/dist/SchemaForm.d.ts +45 -0
- package/dist/SchemaForm.js +626 -0
- package/dist/SideSheet.d.ts +31 -0
- package/dist/SideSheet.js +136 -0
- package/dist/Sparkline.d.ts +14 -0
- package/dist/Sparkline.js +23 -0
- package/dist/Surfaces.d.ts +30 -0
- package/dist/Surfaces.js +34 -0
- package/dist/Switch.d.ts +18 -0
- package/dist/Switch.js +11 -0
- package/dist/Table.d.ts +15 -0
- package/dist/Table.js +6 -0
- package/dist/Tabs.d.ts +32 -0
- package/dist/Tabs.js +11 -0
- package/dist/Term.d.ts +82 -0
- package/dist/Term.js +153 -0
- package/dist/Timeline.d.ts +29 -0
- package/dist/Timeline.js +39 -0
- package/dist/Toast.d.ts +43 -0
- package/dist/Toast.js +140 -0
- package/dist/Tooltip.d.ts +34 -0
- package/dist/Tooltip.js +70 -0
- package/dist/Tree.d.ts +51 -0
- package/dist/Tree.js +233 -0
- package/dist/chartEngine.d.ts +32 -0
- package/dist/chartEngine.js +72 -0
- package/dist/chartTheme.d.ts +41 -0
- package/dist/chartTheme.js +131 -0
- package/dist/contrast.d.ts +27 -0
- package/dist/contrast.js +110 -0
- package/dist/dates.d.ts +61 -0
- package/dist/dates.js +294 -0
- package/dist/drawer/Chips.d.ts +37 -0
- package/dist/drawer/Chips.js +32 -0
- package/dist/drawer/Choices.d.ts +47 -0
- package/dist/drawer/Choices.js +81 -0
- package/dist/drawer/Drawer.d.ts +125 -0
- package/dist/drawer/Drawer.js +150 -0
- package/dist/drawer/EditorBodies.d.ts +95 -0
- package/dist/drawer/EditorBodies.js +169 -0
- package/dist/drawer/NumberFormat.d.ts +36 -0
- package/dist/drawer/NumberFormat.js +98 -0
- package/dist/drawer/SortableRows.d.ts +35 -0
- package/dist/drawer/SortableRows.js +23 -0
- package/dist/drawer/edgeShadows.d.ts +7 -0
- package/dist/drawer/edgeShadows.js +17 -0
- package/dist/drawer/index.d.ts +8 -0
- package/dist/drawer/index.js +8 -0
- package/dist/drawer/useSortable.d.ts +53 -0
- package/dist/drawer/useSortable.js +323 -0
- package/dist/format.d.ts +6 -0
- package/dist/format.js +17 -0
- package/dist/icons.d.ts +20 -0
- package/dist/icons.js +16 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +48 -0
- package/dist/markdownKnowledge.d.ts +45 -0
- package/dist/markdownKnowledge.js +37 -0
- package/dist/overlay.d.ts +7 -0
- package/dist/overlay.js +10 -0
- package/dist/pageIcons.d.ts +12 -0
- package/dist/pageIcons.js +32 -0
- package/dist/presence.d.ts +41 -0
- package/dist/presence.js +108 -0
- package/dist/returnFocus.d.ts +9 -0
- package/dist/returnFocus.js +44 -0
- package/dist/tokens.css +437 -0
- package/dist/type-scale.css +34 -0
- package/dist/useFlip.d.ts +32 -0
- package/dist/useFlip.js +118 -0
- package/fonts/OFL.txt +193 -0
- package/fonts/geist-latin.woff2 +0 -0
- package/fonts/geist-mono-latin.woff2 +0 -0
- package/package.json +52 -3
- package/README.md +0 -3
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as Base } from "@base-ui/react/popover";
|
|
3
|
+
import { Calendar, ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { addDays, addMonths, compareYmd, datePattern, daysInMonth, firstDayOf, formatDay, formatTime, formatWall, hmText, localeOf, monthNames, parseEntry, parseTime, readWall, sameDay, todayYmd, weekdayNames, weekdayOf, ymdText, } from "./dates.js";
|
|
6
|
+
const box = "h-control w-full rounded-control border border-line-control bg-field ps-3 pe-11 text-ink placeholder:text-ink-muted/70 disabled:opacity-60 aria-[invalid=true]:border-danger";
|
|
7
|
+
/** For a drawer's editors, whose boxes are a little lower. */
|
|
8
|
+
const compactBox = "h-9 w-full rounded-control border border-line-control bg-surface ps-2 pe-9 text-body-sm text-ink placeholder:text-ink-muted/70 focus-visible:outline-2 focus-visible:outline-focus disabled:opacity-60 aria-[invalid=true]:border-danger";
|
|
9
|
+
/** A filter bar's box: as high as its selects, the label inside. */
|
|
10
|
+
const inlineBox = "h-[34px] w-full rounded-control border border-line-control bg-sunken pe-9 text-body-sm text-ink placeholder:text-ink-muted/70 focus-visible:outline-2 focus-visible:outline-action disabled:opacity-60 aria-[invalid=true]:border-danger";
|
|
11
|
+
/** The part of a wall string a field compares on: the day, or the day and the minute. */
|
|
12
|
+
const trimWall = (text, withTime) => text ? text.slice(0, withTime ? 16 : 10) : "";
|
|
13
|
+
const WHOLE_ISO = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?Z?)?$/i;
|
|
14
|
+
function useCoarse() {
|
|
15
|
+
const [coarse, setCoarse] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (typeof window.matchMedia !== "function")
|
|
18
|
+
return;
|
|
19
|
+
const query = window.matchMedia("(pointer: coarse)");
|
|
20
|
+
const read = () => setCoarse(query.matches);
|
|
21
|
+
read();
|
|
22
|
+
query.addEventListener?.("change", read);
|
|
23
|
+
return () => query.removeEventListener?.("change", read);
|
|
24
|
+
}, []);
|
|
25
|
+
return coarse;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A date, or a date and a time, in a box the person types in: "Nov 21, 2026" in their locale, with
|
|
29
|
+
* a calendar behind the button at its end. What is typed is read by the locale's order, ISO, month
|
|
30
|
+
* names, "today", "tomorrow", "yesterday"; what can't be read is said and left as it was typed.
|
|
31
|
+
* The value in and out is a wall string. On a touch screen the button opens the phone's own picker.
|
|
32
|
+
*/
|
|
33
|
+
export function DateInput({ value, onChange, withTime = false, min, max, required, disabled, name, formValue, onProblem, boxProps, id, compact = false, inlineLabel, ...rest }) {
|
|
34
|
+
const locale = useMemo(localeOf, []);
|
|
35
|
+
const wall = trimWall(value, withTime);
|
|
36
|
+
const [text, setText] = useState(() => formatWall(wall, locale, withTime));
|
|
37
|
+
const [own, setProblem] = useState();
|
|
38
|
+
const lastSent = useRef(wall);
|
|
39
|
+
const input = useRef(null);
|
|
40
|
+
const wrapper = useRef(null);
|
|
41
|
+
const native = useRef(null);
|
|
42
|
+
const popup = useRef(null);
|
|
43
|
+
const [open, setOpen] = useState(false);
|
|
44
|
+
const coarse = useCoarse();
|
|
45
|
+
const problemId = useId();
|
|
46
|
+
const say = useCallback((next) => {
|
|
47
|
+
setProblem(next);
|
|
48
|
+
onProblem?.(next);
|
|
49
|
+
}, [onProblem]);
|
|
50
|
+
// A value that comes from outside, such as a Clear button, replaces what was typed. The value
|
|
51
|
+
// this box itself sent does not: the box already shows what it means.
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (wall === lastSent.current)
|
|
54
|
+
return;
|
|
55
|
+
lastSent.current = wall;
|
|
56
|
+
setText(formatWall(wall, locale, withTime));
|
|
57
|
+
say(undefined);
|
|
58
|
+
}, [wall, locale, withTime, say]);
|
|
59
|
+
const minWall = trimWall(min, withTime);
|
|
60
|
+
const maxWall = trimWall(max, withTime);
|
|
61
|
+
const range = (candidate) => {
|
|
62
|
+
const shown = (edge) => formatWall(edge, locale, withTime);
|
|
63
|
+
if (minWall && candidate < minWall)
|
|
64
|
+
return `Pick a date on or after ${shown(minWall)}.`;
|
|
65
|
+
if (maxWall && candidate > maxWall)
|
|
66
|
+
return `Pick a date on or before ${shown(maxWall)}.`;
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
69
|
+
const send = (next) => {
|
|
70
|
+
lastSent.current = next;
|
|
71
|
+
onChange(next);
|
|
72
|
+
};
|
|
73
|
+
const wallOf = (day, time) => withTime
|
|
74
|
+
? `${ymdText(day)}T${hmText(time ?? readWall(wall)?.time ?? { h: 0, mi: 0 })}`
|
|
75
|
+
: ymdText(day);
|
|
76
|
+
/** Reads the box. `settle` says it is final: the person left it or pressed Enter. */
|
|
77
|
+
const read = (typed, settle) => {
|
|
78
|
+
if (typed.trim() === "") {
|
|
79
|
+
say(undefined);
|
|
80
|
+
if (wall !== "")
|
|
81
|
+
send("");
|
|
82
|
+
if (settle)
|
|
83
|
+
setText("");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const entry = parseEntry(typed, withTime, locale);
|
|
87
|
+
if (!entry) {
|
|
88
|
+
if (!settle)
|
|
89
|
+
return;
|
|
90
|
+
const sample = formatDay(todayYmd(), locale);
|
|
91
|
+
say(`Couldn't read "${typed.trim()}" as a date. Try ${sample} or ${ymdText(todayYmd())}.`);
|
|
92
|
+
if (wall !== "")
|
|
93
|
+
send("");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const next = wallOf(entry.day, entry.time);
|
|
97
|
+
const outside = range(next);
|
|
98
|
+
if (outside) {
|
|
99
|
+
if (!settle)
|
|
100
|
+
return;
|
|
101
|
+
say(outside);
|
|
102
|
+
if (wall !== "")
|
|
103
|
+
send("");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
say(undefined);
|
|
107
|
+
if (next !== wall)
|
|
108
|
+
send(next);
|
|
109
|
+
if (settle)
|
|
110
|
+
setText(formatWall(next, locale, withTime));
|
|
111
|
+
};
|
|
112
|
+
const problem = own;
|
|
113
|
+
const hint = datePattern(locale, withTime);
|
|
114
|
+
const { onBlur, onFocus, ...forwarded } = (boxProps ?? {});
|
|
115
|
+
const { ref: boxRef, ...aria } = forwarded;
|
|
116
|
+
const describedBy = [aria["aria-describedby"], onProblem === undefined && problem ? problemId : undefined]
|
|
117
|
+
.filter(Boolean)
|
|
118
|
+
.join(" ") || undefined;
|
|
119
|
+
const toggle = (next) => {
|
|
120
|
+
if (next && coarse && native.current) {
|
|
121
|
+
try {
|
|
122
|
+
native.current.showPicker();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// No native picker here: the calendar is the fallback.
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
setOpen(next);
|
|
130
|
+
};
|
|
131
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { ref: wrapper, className: "relative", children: [inlineLabel ? (_jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-y-0 start-2.5 flex items-center text-body-sm text-ink-muted", children: inlineLabel })) : null, _jsx("input", { ...aria, style: inlineLabel
|
|
132
|
+
? { paddingInlineStart: `calc(${inlineLabel.length}ch + 1.25rem)` }
|
|
133
|
+
: undefined, ref: (node) => {
|
|
134
|
+
input.current = node;
|
|
135
|
+
if (typeof boxRef === "function")
|
|
136
|
+
boxRef(node);
|
|
137
|
+
else if (boxRef && typeof boxRef === "object")
|
|
138
|
+
boxRef.current = node;
|
|
139
|
+
}, id: aria.id ?? id, type: "text", "data-date-input": "", inputMode: "text", autoComplete: "off", autoCorrect: "off", spellCheck: false, dir: "auto", placeholder: hint, required: required, disabled: disabled, "aria-label": rest["aria-label"], "aria-invalid": problem ? true : aria["aria-invalid"], "aria-describedby": describedBy, value: text, className: inlineLabel ? inlineBox : compact ? compactBox : box, onFocus: (event) => {
|
|
140
|
+
onFocus?.(event);
|
|
141
|
+
}, onChange: (event) => {
|
|
142
|
+
const typed = event.currentTarget.value;
|
|
143
|
+
setText(typed);
|
|
144
|
+
if (problem)
|
|
145
|
+
say(undefined);
|
|
146
|
+
// A whole ISO date goes at once: it is what a test or a paste gives.
|
|
147
|
+
if (typed.trim() === "" || WHOLE_ISO.test(typed.trim()))
|
|
148
|
+
read(typed, false);
|
|
149
|
+
}, onBlur: (event) => {
|
|
150
|
+
read(event.currentTarget.value, true);
|
|
151
|
+
onBlur?.(event);
|
|
152
|
+
}, onKeyDown: (event) => {
|
|
153
|
+
if (event.key === "Enter") {
|
|
154
|
+
read(event.currentTarget.value, true);
|
|
155
|
+
}
|
|
156
|
+
else if (event.key === "ArrowDown" && event.altKey) {
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
toggle(true);
|
|
159
|
+
}
|
|
160
|
+
} }), _jsxs(Base.Root, { open: open, onOpenChange: (next) => toggle(next), children: [_jsx(Base.Trigger, { type: "button", disabled: disabled, "aria-label": "Open calendar", className: `absolute inset-y-0 end-0 flex ${compact ? "w-9" : "w-10"} items-center justify-center rounded-e-control text-ink-muted hover:text-ink disabled:opacity-60`, children: _jsx(Calendar, { "aria-hidden": "true", size: 16 }) }), _jsx(Base.Portal, { children: _jsx(Base.Positioner, { anchor: wrapper, side: "bottom", align: "start", sideOffset: 6, collisionPadding: 16, className: "layer-popover", children: _jsxs(Base.Popup, { ref: popup, "data-date-picker": "", initialFocus: () => popup.current?.querySelector("[data-day][tabindex='0']") ?? true, finalFocus: input, className: "w-[min(21.5rem,calc(100vw-2rem))] rounded-panel border border-line-strong bg-raised p-3 text-ink shadow-overlay transition-[opacity,translate] motion-base data-[ending-style]:opacity-0 data-[starting-style]:-translate-y-1 data-[starting-style]:opacity-0", children: [_jsx(Base.Title, { className: "sr-only", children: "Choose date" }), _jsx(Calendar_, { locale: locale, withTime: withTime, value: readWall(wall), min: readWall(minWall)?.day, max: readWall(maxWall)?.day, required: required === true, onPick: (day) => {
|
|
161
|
+
const next = wallOf(day, undefined);
|
|
162
|
+
const outside = range(next);
|
|
163
|
+
if (outside) {
|
|
164
|
+
say(outside);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
say(undefined);
|
|
168
|
+
send(next);
|
|
169
|
+
setText(formatWall(next, locale, withTime));
|
|
170
|
+
if (!withTime)
|
|
171
|
+
setOpen(false);
|
|
172
|
+
}, onTime: (time) => {
|
|
173
|
+
const day = readWall(wall)?.day ?? todayYmd();
|
|
174
|
+
const next = wallOf(day, time);
|
|
175
|
+
const outside = range(next);
|
|
176
|
+
if (outside) {
|
|
177
|
+
say(outside);
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
say(undefined);
|
|
181
|
+
send(next);
|
|
182
|
+
setText(formatWall(next, locale, withTime));
|
|
183
|
+
return true;
|
|
184
|
+
}, onClear: () => {
|
|
185
|
+
say(undefined);
|
|
186
|
+
send("");
|
|
187
|
+
setText("");
|
|
188
|
+
setOpen(false);
|
|
189
|
+
}, onClose: () => setOpen(false) })] }) }) })] }), coarse ? (_jsx("input", { ref: native, type: withTime ? "datetime-local" : "date", tabIndex: -1, "aria-hidden": "true", value: wall, min: minWall || undefined, max: maxWall || undefined, onChange: (event) => {
|
|
190
|
+
const picked = trimWall(event.currentTarget.value, withTime);
|
|
191
|
+
setText(formatWall(picked, locale, withTime));
|
|
192
|
+
say(undefined);
|
|
193
|
+
send(picked);
|
|
194
|
+
}, className: "pointer-events-none absolute start-0 bottom-0 size-px opacity-0" })) : null, name ? _jsx("input", { type: "hidden", name: name, value: formValue ?? wall }) : null] }), onProblem === undefined && problem ? (_jsx("p", { id: problemId, role: "alert", className: "m-0 text-body-sm text-danger", children: problem })) : null] }));
|
|
195
|
+
}
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
// The calendar
|
|
198
|
+
function Calendar_({ locale, withTime, value, min, max, required, onPick, onTime, onClear, onClose, }) {
|
|
199
|
+
const today = todayYmd();
|
|
200
|
+
const clamp = (day) => min && compareYmd(day, min) < 0 ? min : max && compareYmd(day, max) > 0 ? max : day;
|
|
201
|
+
const [focus, setFocus] = useState(() => clamp(value?.day ?? today));
|
|
202
|
+
const moved = useRef(false);
|
|
203
|
+
const grid = useRef(null);
|
|
204
|
+
const headingId = useId();
|
|
205
|
+
const first = useMemo(() => firstDayOf(locale), [locale]);
|
|
206
|
+
const months = useMemo(() => monthNames(locale, "long"), [locale]);
|
|
207
|
+
const longDays = useMemo(() => weekdayNames(locale, "long"), [locale]);
|
|
208
|
+
const shortDays = useMemo(() => weekdayNames(locale, "short"), [locale]);
|
|
209
|
+
const [timeText, setTimeText] = useState(() => value?.time ? formatTime(value.time, locale) : "");
|
|
210
|
+
const [timeProblem, setTimeProblem] = useState();
|
|
211
|
+
useLayoutEffect(() => {
|
|
212
|
+
if (!moved.current)
|
|
213
|
+
return;
|
|
214
|
+
moved.current = false;
|
|
215
|
+
grid.current?.querySelector(`[data-date="${ymdText(focus)}"]`)?.focus();
|
|
216
|
+
}, [focus]);
|
|
217
|
+
const go = (day) => {
|
|
218
|
+
moved.current = true;
|
|
219
|
+
setFocus(day);
|
|
220
|
+
};
|
|
221
|
+
const outOf = (day) => min && compareYmd(day, min) < 0
|
|
222
|
+
? `before ${formatDay(min, locale)}`
|
|
223
|
+
: max && compareYmd(day, max) > 0
|
|
224
|
+
? `after ${formatDay(max, locale)}`
|
|
225
|
+
: undefined;
|
|
226
|
+
const rows = useMemo(() => {
|
|
227
|
+
const start = addDays({ y: focus.y, m: focus.m, d: 1 }, -((weekdayOf({ y: focus.y, m: focus.m, d: 1 }) - first + 7) % 7));
|
|
228
|
+
return Array.from({ length: 6 }, (_, row) => Array.from({ length: 7 }, (_, column) => addDays(start, row * 7 + column)));
|
|
229
|
+
}, [focus.y, focus.m, first]);
|
|
230
|
+
const onKey = (event) => {
|
|
231
|
+
const rtl = grid.current ? getComputedStyle(grid.current).direction === "rtl" : false;
|
|
232
|
+
const weekday = (weekdayOf(focus) - first + 7) % 7;
|
|
233
|
+
let next;
|
|
234
|
+
switch (event.key) {
|
|
235
|
+
case "ArrowLeft":
|
|
236
|
+
next = addDays(focus, rtl ? 1 : -1);
|
|
237
|
+
break;
|
|
238
|
+
case "ArrowRight":
|
|
239
|
+
next = addDays(focus, rtl ? -1 : 1);
|
|
240
|
+
break;
|
|
241
|
+
case "ArrowUp":
|
|
242
|
+
next = addDays(focus, -7);
|
|
243
|
+
break;
|
|
244
|
+
case "ArrowDown":
|
|
245
|
+
next = addDays(focus, 7);
|
|
246
|
+
break;
|
|
247
|
+
case "Home":
|
|
248
|
+
next = addDays(focus, -weekday);
|
|
249
|
+
break;
|
|
250
|
+
case "End":
|
|
251
|
+
next = addDays(focus, 6 - weekday);
|
|
252
|
+
break;
|
|
253
|
+
case "PageUp":
|
|
254
|
+
next = event.shiftKey ? addMonths(focus, -12) : addMonths(focus, -1);
|
|
255
|
+
break;
|
|
256
|
+
case "PageDown":
|
|
257
|
+
next = event.shiftKey ? addMonths(focus, 12) : addMonths(focus, 1);
|
|
258
|
+
break;
|
|
259
|
+
default:
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
event.preventDefault();
|
|
263
|
+
event.stopPropagation();
|
|
264
|
+
go(next);
|
|
265
|
+
};
|
|
266
|
+
const years = useMemo(() => {
|
|
267
|
+
const from = Math.min(min?.y ?? focus.y - 100, focus.y);
|
|
268
|
+
const to = Math.max(max?.y ?? focus.y + 20, focus.y);
|
|
269
|
+
return Array.from({ length: to - from + 1 }, (_, index) => from + index);
|
|
270
|
+
}, [min, max, focus.y]);
|
|
271
|
+
const keepIn = (y, m) => clamp({ y, m, d: Math.min(focus.d, daysInMonth(y, m)) });
|
|
272
|
+
const step = (n) => setFocus(clamp(addMonths(focus, n)));
|
|
273
|
+
const commitTime = () => {
|
|
274
|
+
if (timeText.trim() === "") {
|
|
275
|
+
setTimeProblem(undefined);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const time = parseTime(timeText);
|
|
279
|
+
if (!time) {
|
|
280
|
+
setTimeProblem(`Couldn't read "${timeText.trim()}" as a time. Try 2:30 PM or 14:30.`);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
setTimeProblem(undefined);
|
|
284
|
+
if (onTime(time))
|
|
285
|
+
setTimeText(formatTime(time, locale));
|
|
286
|
+
};
|
|
287
|
+
const selectClass = "h-9 min-w-0 rounded-control border border-line-control bg-field px-2 text-body-sm text-ink";
|
|
288
|
+
const stepClass = "flex size-9 shrink-0 items-center justify-center rounded-control text-ink-muted hover:bg-hover hover:text-ink";
|
|
289
|
+
return (_jsxs("div", { onKeyDown: onKey, className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("button", { type: "button", "aria-label": "Previous month", className: stepClass, onClick: () => step(-1), children: _jsx(ChevronLeft, { "aria-hidden": "true", size: 16, className: "rtl:rotate-180" }) }), _jsx("select", { "aria-label": "Month", value: focus.m, className: `${selectClass} flex-1`, onChange: (event) => setFocus(keepIn(focus.y, Number(event.currentTarget.value))), children: months.map((month, index) => (_jsx("option", { value: index + 1, children: month }, month))) }), _jsx("select", { "aria-label": "Year", value: focus.y, className: `${selectClass} w-20`, onChange: (event) => setFocus(keepIn(Number(event.currentTarget.value), focus.m)), children: years.map((year) => (_jsx("option", { value: year, children: year }, year))) }), _jsx("button", { type: "button", "aria-label": "Next month", className: stepClass, onClick: () => step(1), children: _jsx(ChevronRight, { "aria-hidden": "true", size: 16, className: "rtl:rotate-180" }) })] }), _jsxs("div", { id: headingId, "aria-live": "polite", className: "sr-only", children: [months[focus.m - 1], " ", focus.y] }), _jsxs("table", { ref: grid, role: "grid", "aria-labelledby": headingId, className: "w-full border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: Array.from({ length: 7 }, (_, column) => {
|
|
290
|
+
const day = (first + column) % 7;
|
|
291
|
+
return (_jsx("th", { scope: "col", abbr: longDays[day] ?? "", className: "h-8 text-center text-meta font-medium text-ink-muted", children: shortDays[day] }, day));
|
|
292
|
+
}) }) }), _jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: row.map((day) => {
|
|
293
|
+
const selected = sameDay(day, value?.day);
|
|
294
|
+
const away = outOf(day);
|
|
295
|
+
const inMonth = day.m === focus.m;
|
|
296
|
+
const label = [
|
|
297
|
+
formatDay(day, locale, "full"),
|
|
298
|
+
selected ? "selected" : undefined,
|
|
299
|
+
away ? `not available, ${away}` : undefined,
|
|
300
|
+
]
|
|
301
|
+
.filter(Boolean)
|
|
302
|
+
.join(", ");
|
|
303
|
+
return (_jsx("td", {
|
|
304
|
+
// biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: a cell of the date picker grid
|
|
305
|
+
role: "gridcell", "aria-selected": selected, className: "p-0 text-center", children: _jsx("button", { type: "button", "data-day": "", "data-date": ymdText(day), tabIndex: sameDay(day, focus) ? 0 : -1, "aria-label": label, "aria-current": sameDay(day, today) ? "date" : undefined, "aria-disabled": away ? true : undefined, onClick: () => {
|
|
306
|
+
setFocus(day);
|
|
307
|
+
if (!away)
|
|
308
|
+
onPick(day);
|
|
309
|
+
}, className: `size-10 rounded-control text-body-sm tabular-nums ${selected
|
|
310
|
+
? "bg-action font-semibold text-action-ink"
|
|
311
|
+
: `hover:bg-hover ${inMonth ? "text-ink" : "text-ink-subtle"}`} aria-[current=date]:border aria-[current=date]:border-line-strong aria-[current=date]:font-semibold aria-disabled:cursor-not-allowed aria-disabled:text-ink-subtle aria-disabled:line-through aria-disabled:hover:bg-transparent`, children: day.d }) }, ymdText(day)));
|
|
312
|
+
}) }, ymdText(row[0])))) })] }), withTime ? (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("label", { htmlFor: `${headingId}-time`, className: "text-body-sm font-medium", children: "Time" }), _jsx("input", { id: `${headingId}-time`, type: "text", autoComplete: "off", dir: "auto", value: timeText, placeholder: formatTime({ h: 14, mi: 30 }, locale), "aria-invalid": timeProblem ? true : undefined, "aria-describedby": timeProblem ? `${headingId}-time-note` : undefined, onChange: (event) => setTimeText(event.currentTarget.value), onBlur: commitTime, onKeyDown: (event) => {
|
|
313
|
+
if (event.key === "Enter") {
|
|
314
|
+
event.preventDefault();
|
|
315
|
+
commitTime();
|
|
316
|
+
}
|
|
317
|
+
}, className: `${selectClass} w-28` })] }), timeProblem ? (_jsx("p", { id: `${headingId}-time-note`, role: "alert", className: "m-0 text-body-sm text-danger", children: timeProblem })) : null] })) : null, _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("button", { type: "button", className: "rounded-control px-2 py-1 text-body-sm font-medium text-ink-muted hover:bg-hover hover:text-ink", onClick: () => {
|
|
318
|
+
const day = clamp(today);
|
|
319
|
+
if (outOf(today)) {
|
|
320
|
+
go(day);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
onPick(today);
|
|
324
|
+
go(today);
|
|
325
|
+
}, children: "Today" }), required ? null : (_jsx("button", { type: "button", className: "rounded-control px-2 py-1 text-body-sm font-medium text-ink-muted hover:bg-hover hover:text-ink", onClick: onClear, children: "Clear" })), withTime ? (_jsx("button", { type: "button", className: "rounded-control bg-action px-3 py-1 text-body-sm font-semibold text-action-ink", onClick: () => {
|
|
326
|
+
commitTime();
|
|
327
|
+
onClose();
|
|
328
|
+
}, children: "Done" })) : null] })] }));
|
|
329
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A section that stays folded until it is opened. It is the browser's own
|
|
4
|
+
* `details`, so it opens from the keyboard and is found by a search of the
|
|
5
|
+
* page with no code of ours.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Details({ summary, children, defaultOpen, }: {
|
|
8
|
+
/** What is shown while it is folded. */
|
|
9
|
+
summary: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
}): import("react").JSX.Element;
|
package/dist/Details.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A section that stays folded until it is opened. It is the browser's own
|
|
4
|
+
* `details`, so it opens from the keyboard and is found by a search of the
|
|
5
|
+
* page with no code of ours.
|
|
6
|
+
*/
|
|
7
|
+
export function Details({ summary, children, defaultOpen = false, }) {
|
|
8
|
+
return (_jsxs("details", { open: defaultOpen, className: "group rounded-control border border-line", children: [_jsx("summary", { className: "cursor-pointer px-3 py-2 font-medium marker:text-ink-muted", children: summary }), _jsx("div", { className: "px-3 pb-3", children: children })] }));
|
|
9
|
+
}
|
package/dist/Dialog.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface DialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
/** Drawn in a tile before the title: what the dialog is about, as the boards head theirs. */
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/** Kept in view along the foot, set off by a hairline: the buttons that finish it. */
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* `wide` is for a form with a table or an editor in it. `palette` fills a
|
|
13
|
+
* phone's screen, and is a panel near the top on anything wider. `table` is
|
|
14
|
+
* for a dialog that is a table to read: most of the window, with the table
|
|
15
|
+
* filling it, and the whole screen on a phone. A table in a `regular` dialog
|
|
16
|
+
* is always scrolled.
|
|
17
|
+
*/
|
|
18
|
+
size?: "regular" | "wide" | "palette" | "table";
|
|
19
|
+
/** Its width in pixels, or `"full"` for the window less a margin, as its maker chose. It scrolls inside, at the height the window allows. */
|
|
20
|
+
width?: number | "full";
|
|
21
|
+
/**
|
|
22
|
+
* Called once it has left, after its motion. What closing it leads to, such as
|
|
23
|
+
* opening another screen, waits for this, so the dialog is seen to go.
|
|
24
|
+
*/
|
|
25
|
+
onClosed?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* The dialog draws its own head and padding (the widget selector's search row): the title
|
|
28
|
+
* stays for a screen reader, with no bar and no close button, and the children fill the panel.
|
|
29
|
+
*/
|
|
30
|
+
bare?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* `false` for a dialog that cannot be set aside, such as the one that asks for a new sign-in:
|
|
33
|
+
* it draws no close button, and Esc and a press on the backdrop leave it open.
|
|
34
|
+
*/
|
|
35
|
+
dismissible?: boolean;
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The first field to type in or choose from, in the order it is read. An optional date is not
|
|
40
|
+
* the one to start on: that would open its calendar (or a phone's picker) before anything was
|
|
41
|
+
* asked, so it is passed over.
|
|
42
|
+
*/
|
|
43
|
+
export declare function firstField(root: HTMLElement | null): HTMLElement | undefined;
|
|
44
|
+
export declare function Dialog({ open, onClose, title, description, icon, footer, size, width, onClosed, bare, dismissible, children, }: DialogProps): import("react").JSX.Element;
|
package/dist/Dialog.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as Base } from "@base-ui/react/dialog";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { InOverlay } from "./overlay.js";
|
|
6
|
+
import { useOpening } from "./presence.js";
|
|
7
|
+
import { useReturnFocus } from "./returnFocus.js";
|
|
8
|
+
import { CodeText } from "./Term.js";
|
|
9
|
+
/** A field a person types into: not a switch, a choice, a file or a hidden one. */
|
|
10
|
+
const TEXT_FIELD = 'textarea:not([disabled]), select:not([disabled]), input:not([disabled]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"])';
|
|
11
|
+
/**
|
|
12
|
+
* The first field to type in or choose from, in the order it is read. An optional date is not
|
|
13
|
+
* the one to start on: that would open its calendar (or a phone's picker) before anything was
|
|
14
|
+
* asked, so it is passed over.
|
|
15
|
+
*/
|
|
16
|
+
export function firstField(root) {
|
|
17
|
+
return Array.from(root?.querySelectorAll(TEXT_FIELD) ?? []).find((field) => !(field.hasAttribute("data-date-input") && !field.hasAttribute("required")));
|
|
18
|
+
}
|
|
19
|
+
export function Dialog({ open, onClose, title, description, icon, footer, size = "regular", width, onClosed, bare = false, dismissible = true, children, }) {
|
|
20
|
+
const shown = useOpening(open);
|
|
21
|
+
const popup = useRef(null);
|
|
22
|
+
const returnFocus = useReturnFocus(open);
|
|
23
|
+
// A form that is read after the dialog opened (a page's modal) has no field yet when the focus
|
|
24
|
+
// is placed, and the focus waits on Close. When its first field arrives, and the person has not
|
|
25
|
+
// moved the focus themselves, the field takes it.
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!shown)
|
|
28
|
+
return;
|
|
29
|
+
let cleanup;
|
|
30
|
+
let frame = 0;
|
|
31
|
+
const start = () => {
|
|
32
|
+
const root = popup.current;
|
|
33
|
+
if (!root) {
|
|
34
|
+
frame = requestAnimationFrame(start);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let moved = false;
|
|
38
|
+
const mine = () => {
|
|
39
|
+
moved = true;
|
|
40
|
+
};
|
|
41
|
+
root.addEventListener("keydown", mine, true);
|
|
42
|
+
root.addEventListener("pointerdown", mine, true);
|
|
43
|
+
const settle = () => {
|
|
44
|
+
if (moved)
|
|
45
|
+
return watch.disconnect();
|
|
46
|
+
const on = document.activeElement;
|
|
47
|
+
const waiting = !on || on === document.body || on === root || on.getAttribute("aria-label") === "Close";
|
|
48
|
+
if (!waiting)
|
|
49
|
+
return watch.disconnect();
|
|
50
|
+
const field = firstField(root);
|
|
51
|
+
if (field) {
|
|
52
|
+
field.focus();
|
|
53
|
+
watch.disconnect();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const watch = new MutationObserver(settle);
|
|
57
|
+
watch.observe(root, { childList: true, subtree: true });
|
|
58
|
+
const stop = setTimeout(() => watch.disconnect(), 4000);
|
|
59
|
+
cleanup = () => {
|
|
60
|
+
clearTimeout(stop);
|
|
61
|
+
watch.disconnect();
|
|
62
|
+
root.removeEventListener("keydown", mine, true);
|
|
63
|
+
root.removeEventListener("pointerdown", mine, true);
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
start();
|
|
67
|
+
return () => {
|
|
68
|
+
cancelAnimationFrame(frame);
|
|
69
|
+
cleanup?.();
|
|
70
|
+
};
|
|
71
|
+
}, [shown]);
|
|
72
|
+
return (_jsx(InOverlay.Provider, { value: true, children: _jsx(Base.Root, { open: shown, onOpenChange: (next) => !next && dismissible && onClose(), onOpenChangeComplete: (now) => {
|
|
73
|
+
if (!now)
|
|
74
|
+
onClosed?.();
|
|
75
|
+
}, children: _jsxs(Base.Portal, { children: [_jsx(Base.Backdrop, { className: "fixed inset-0 layer-dialog bg-scrim transition-opacity motion-slow data-[ending-style]:opacity-0 data-[starting-style]:opacity-0" }), _jsxs(Base.Popup, { ref: popup,
|
|
76
|
+
// What marks itself `data-autofocus` (a search field) gets the focus; else the first
|
|
77
|
+
// field to type in, so a dialog that asks for a name takes the name as it opens; else
|
|
78
|
+
// the first control does.
|
|
79
|
+
initialFocus: () => popup.current?.querySelector("[data-autofocus]") ??
|
|
80
|
+
firstField(popup.current) ??
|
|
81
|
+
true, finalFocus: returnFocus, className: `fixed layer-dialog flex flex-col overflow-hidden border-line bg-surface shadow-modal transition-[opacity,scale] motion-slow data-[ending-style]:opacity-0 data-[starting-style]:scale-98 data-[starting-style]:opacity-0 ${size === "table"
|
|
82
|
+
? "inset-0 flex flex-col md:inset-auto md:top-[8vh] md:left-1/2 md:h-[84vh] md:w-[min(76rem,calc(100vw-3rem))] md:-translate-x-1/2 md:rounded-overlay md:border"
|
|
83
|
+
: size === "palette"
|
|
84
|
+
? "inset-0 md:inset-auto md:top-[10vh] md:left-1/2 md:max-h-[80vh] md:w-[min(40rem,calc(100vw-2rem))] md:-translate-x-1/2 md:rounded-overlay md:border"
|
|
85
|
+
: `left-1/2 max-h-[88vh] -translate-x-1/2 rounded-overlay border ${size === "wide"
|
|
86
|
+
? "top-[6vh] w-[min(46rem,calc(100vw-2rem))]"
|
|
87
|
+
: "top-[12vh] w-[min(30rem,calc(100vw-2rem))]"}`}`, ...(width !== undefined
|
|
88
|
+
? {
|
|
89
|
+
style: {
|
|
90
|
+
width: width === "full" ? "calc(100vw - 2rem)" : `${width}px`,
|
|
91
|
+
maxWidth: "calc(100vw - 2rem)",
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
: {}), children: [bare ? (_jsx(Base.Title, { className: "sr-only", children: title })) : (_jsxs("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "flex size-8 shrink-0 items-center justify-center rounded-control border border-action/30 bg-action-soft text-action", children: icon })) : null, _jsx(Base.Title, { className: "m-0 line-clamp-3 min-w-0 text-title font-semibold [overflow-wrap:anywhere]", children: title })] }), dismissible ? (_jsx(Base.Close, { "aria-label": "Close", className: "-mr-1 flex size-8 shrink-0 items-center justify-center rounded-control text-ink-muted hover:bg-hover hover:text-ink", children: _jsx(X, { "aria-hidden": "true", size: 16 }) })) : null] })), _jsxs("div", { className: `min-h-0 flex-1 ${bare ? "" : "px-5 py-4"} ${size === "table" ? "flex flex-col overflow-hidden" : "overflow-y-auto"}`, children: [description ? (_jsx(Base.Description, { className: "mt-0 mb-4 text-ink-muted", children: _jsx(CodeText, { children: description }) })) : null, size === "table" ? (_jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: children })) : (children)] }), footer ? (_jsx("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-line px-5 py-3", children: footer })) : null] })] }) }) }));
|
|
95
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface ConfirmOptions {
|
|
3
|
+
title: string;
|
|
4
|
+
/** What will happen, in a sentence or two. */
|
|
5
|
+
text?: ReactNode;
|
|
6
|
+
/** The button that goes ahead. Name the action: "Delete", not "OK". */
|
|
7
|
+
action?: string;
|
|
8
|
+
cancel?: string;
|
|
9
|
+
/** Marks an action that cannot be undone. */
|
|
10
|
+
danger?: boolean;
|
|
11
|
+
/** Things the question is about, each with a way to go and see it. Going closes the question as "no". */
|
|
12
|
+
links?: {
|
|
13
|
+
label: string;
|
|
14
|
+
onSelect: () => void;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
export interface PromptOptions extends ConfirmOptions {
|
|
18
|
+
label: string;
|
|
19
|
+
hint?: string;
|
|
20
|
+
initial?: string;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** Refuses an empty answer. On by default. */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
multiline?: boolean;
|
|
25
|
+
/** The most characters the field takes. */
|
|
26
|
+
maxLength?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Does what the answer is for, before the dialog closes. It resolves to a sentence to show
|
|
29
|
+
* on the field, which keeps what was typed, or to nothing when it went through.
|
|
30
|
+
*/
|
|
31
|
+
submit?: (value: string) => Promise<string | undefined>;
|
|
32
|
+
}
|
|
33
|
+
export interface TypeToConfirmOptions extends ConfirmOptions {
|
|
34
|
+
/** What has to be typed, exactly, before the action is offered. */
|
|
35
|
+
expected: string;
|
|
36
|
+
}
|
|
37
|
+
export interface Dialogs {
|
|
38
|
+
/** Asks a yes or no question. Resolves to whether the person went ahead. */
|
|
39
|
+
confirm: (options: ConfirmOptions) => Promise<boolean>;
|
|
40
|
+
/** Asks for one line or one block of text. Resolves to it, or to `null` when canceled. */
|
|
41
|
+
prompt: (options: PromptOptions) => Promise<string | null>;
|
|
42
|
+
/** Asks the person to type a name before something is destroyed. */
|
|
43
|
+
typeToConfirm: (options: TypeToConfirmOptions) => Promise<boolean>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Holds the questions an app asks before it acts: a confirmation, a short
|
|
47
|
+
* answer, a name typed out before something is destroyed. Put one around the
|
|
48
|
+
* app and ask through `useDialogs`. They take the place of the browser's own
|
|
49
|
+
* `confirm`, `prompt` and `alert`, which cannot be styled, block the page,
|
|
50
|
+
* and are switched off in some embedded browsers.
|
|
51
|
+
*/
|
|
52
|
+
export declare function DialogsProvider({ children }: {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
}): import("react").JSX.Element;
|
|
55
|
+
/** The way to ask a question from anywhere under a `DialogsProvider`. */
|
|
56
|
+
export declare function useDialogs(): Dialogs;
|