@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
package/dist/Form.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
import { CheckboxField, DateField, NumberField, SelectField, TextAreaField, TextField, } from "./Fields.js";
|
|
5
|
+
import { Notice } from "./Notice.js";
|
|
6
|
+
/** A string this long or longer is asked for in a box of several lines. */
|
|
7
|
+
const LONG_TEXT = 200;
|
|
8
|
+
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
9
|
+
function labelOf(name, property) {
|
|
10
|
+
if (property.title)
|
|
11
|
+
return property.title;
|
|
12
|
+
const words = name.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
13
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
14
|
+
}
|
|
15
|
+
/** An instant as the text a date-and-time control holds: local time, to the minute. */
|
|
16
|
+
function toLocalText(instant) {
|
|
17
|
+
const at = new Date(instant);
|
|
18
|
+
if (Number.isNaN(at.getTime()))
|
|
19
|
+
return "";
|
|
20
|
+
const two = (part) => String(part).padStart(2, "0");
|
|
21
|
+
return `${at.getFullYear()}-${two(at.getMonth() + 1)}-${two(at.getDate())}T${two(at.getHours())}:${two(at.getMinutes())}`;
|
|
22
|
+
}
|
|
23
|
+
/** What each field starts with: the given value, else the schema's default, else nothing. */
|
|
24
|
+
function startDraft(schema, value) {
|
|
25
|
+
const draft = {};
|
|
26
|
+
for (const [name, property] of Object.entries(schema.properties)) {
|
|
27
|
+
const given = value?.[name] ?? property.default;
|
|
28
|
+
if (property.type === "boolean")
|
|
29
|
+
draft[name] = given === true;
|
|
30
|
+
else if (property.enum)
|
|
31
|
+
draft[name] = given === undefined ? "" : String(given);
|
|
32
|
+
else if (property.type === "string") {
|
|
33
|
+
const text = typeof given === "string" ? given : "";
|
|
34
|
+
draft[name] = property.format === "date-time" ? toLocalText(text) : text;
|
|
35
|
+
}
|
|
36
|
+
else
|
|
37
|
+
draft[name] = typeof given === "number" ? given : undefined;
|
|
38
|
+
}
|
|
39
|
+
return draft;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Checks what was typed against the schema and turns it into values of the
|
|
43
|
+
* schema's types. An optional field left empty is left out of the values.
|
|
44
|
+
* Returns a message for each field that does not pass.
|
|
45
|
+
*/
|
|
46
|
+
export function checkForm(schema, draft) {
|
|
47
|
+
const values = {};
|
|
48
|
+
const errors = {};
|
|
49
|
+
const required = new Set(schema.required ?? []);
|
|
50
|
+
for (const [name, property] of Object.entries(schema.properties)) {
|
|
51
|
+
const held = draft[name];
|
|
52
|
+
if (property.type === "boolean") {
|
|
53
|
+
values[name] = held === true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (held === undefined || held === "") {
|
|
57
|
+
if (required.has(name))
|
|
58
|
+
errors[name] = "This is required.";
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (property.enum) {
|
|
62
|
+
const chosen = property.enum.find((option) => String(option) === String(held));
|
|
63
|
+
if (chosen === undefined)
|
|
64
|
+
errors[name] = "Choose one of the options.";
|
|
65
|
+
else
|
|
66
|
+
values[name] = chosen;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (property.type === "string") {
|
|
70
|
+
const text = String(held);
|
|
71
|
+
if (property.minLength !== undefined && text.length < property.minLength) {
|
|
72
|
+
errors[name] = `Use at least ${property.minLength} characters.`;
|
|
73
|
+
}
|
|
74
|
+
else if (property.maxLength !== undefined && text.length > property.maxLength) {
|
|
75
|
+
errors[name] = `Use at most ${property.maxLength} characters.`;
|
|
76
|
+
}
|
|
77
|
+
else if (property.format === "email" && !EMAIL.test(text)) {
|
|
78
|
+
errors[name] = "Enter an email address.";
|
|
79
|
+
}
|
|
80
|
+
else if (property.format === "date-time") {
|
|
81
|
+
const at = new Date(text);
|
|
82
|
+
if (Number.isNaN(at.getTime()))
|
|
83
|
+
errors[name] = "Enter a date and time.";
|
|
84
|
+
else
|
|
85
|
+
values[name] = at.toISOString();
|
|
86
|
+
}
|
|
87
|
+
else
|
|
88
|
+
values[name] = text;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const number = Number(held);
|
|
92
|
+
if (Number.isNaN(number))
|
|
93
|
+
errors[name] = "Enter a number.";
|
|
94
|
+
else if (property.type === "integer" && !Number.isInteger(number)) {
|
|
95
|
+
errors[name] = "Enter a whole number.";
|
|
96
|
+
}
|
|
97
|
+
else if (property.minimum !== undefined && number < property.minimum) {
|
|
98
|
+
errors[name] = `Enter ${property.minimum} or more.`;
|
|
99
|
+
}
|
|
100
|
+
else if (property.maximum !== undefined && number > property.maximum) {
|
|
101
|
+
errors[name] = `Enter ${property.maximum} or less.`;
|
|
102
|
+
}
|
|
103
|
+
else
|
|
104
|
+
values[name] = number;
|
|
105
|
+
}
|
|
106
|
+
return { values, errors };
|
|
107
|
+
}
|
|
108
|
+
/** A form drawn from a JSON Schema. It checks what was typed before it submits. */
|
|
109
|
+
export function Form({ schema, value, onSubmit, submitLabel, errors, disabled }) {
|
|
110
|
+
const [draft, setDraft] = useState(() => startDraft(schema, value));
|
|
111
|
+
const [found, setFound] = useState({});
|
|
112
|
+
const [failure, setFailure] = useState();
|
|
113
|
+
const [busy, setBusy] = useState(false);
|
|
114
|
+
const form = useRef(null);
|
|
115
|
+
const required = new Set(schema.required ?? []);
|
|
116
|
+
const off = disabled === true || busy;
|
|
117
|
+
const set = (name, next) => {
|
|
118
|
+
setDraft((before) => ({ ...before, [name]: next }));
|
|
119
|
+
setFound(({ [name]: _cleared, ...rest }) => rest);
|
|
120
|
+
};
|
|
121
|
+
const submit = async (event) => {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
if (off)
|
|
124
|
+
return;
|
|
125
|
+
const checked = checkForm(schema, draft);
|
|
126
|
+
setFound(checked.errors);
|
|
127
|
+
const first = Object.keys(checked.errors)[0];
|
|
128
|
+
if (first !== undefined) {
|
|
129
|
+
const control = form.current?.elements.namedItem(first);
|
|
130
|
+
if (control instanceof HTMLElement)
|
|
131
|
+
control.focus();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
setBusy(true);
|
|
135
|
+
setFailure(undefined);
|
|
136
|
+
try {
|
|
137
|
+
await onSubmit(checked.values);
|
|
138
|
+
}
|
|
139
|
+
catch (caught) {
|
|
140
|
+
setFailure(caught instanceof Error ? caught.message : String(caught));
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
setBusy(false);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return (_jsxs("form", { ref: form, noValidate: true, onSubmit: submit, className: "flex max-w-xl flex-col gap-4", children: [schema.title ? _jsx("h2", { className: "m-0 text-title font-semibold", children: schema.title }) : null, schema.description ? _jsx("p", { className: "m-0 text-ink-muted", children: schema.description }) : null, failure ? _jsx(Notice, { tone: "danger", children: failure }) : null, Object.entries(schema.properties).map(([name, property]) => {
|
|
147
|
+
const common = {
|
|
148
|
+
name,
|
|
149
|
+
label: labelOf(name, property),
|
|
150
|
+
...(property.description ? { hint: property.description } : {}),
|
|
151
|
+
error: found[name] ?? errors?.[name],
|
|
152
|
+
required: required.has(name),
|
|
153
|
+
disabled: off,
|
|
154
|
+
};
|
|
155
|
+
const held = draft[name];
|
|
156
|
+
if (property.type === "boolean") {
|
|
157
|
+
return (_jsx(CheckboxField, { ...common, required: false, checked: held === true, onChange: (next) => set(name, next) }, name));
|
|
158
|
+
}
|
|
159
|
+
if (property.enum) {
|
|
160
|
+
const options = property.enum.map((option) => ({
|
|
161
|
+
value: String(option),
|
|
162
|
+
label: String(option),
|
|
163
|
+
}));
|
|
164
|
+
// A choice that may be left open, or has not been made yet, starts on an empty option.
|
|
165
|
+
if (!common.required || held === "")
|
|
166
|
+
options.unshift({ value: "", label: "" });
|
|
167
|
+
return (_jsx(SelectField, { ...common, value: String(held ?? ""), options: options, onChange: (next) => set(name, next) }, name));
|
|
168
|
+
}
|
|
169
|
+
if (property.type === "number" || property.type === "integer") {
|
|
170
|
+
return (_jsx(NumberField, { ...common, value: typeof held === "number" ? held : undefined, ...(property.minimum !== undefined ? { min: property.minimum } : {}), ...(property.maximum !== undefined ? { max: property.maximum } : {}), ...(property.type === "integer" ? { step: 1 } : {}), onChange: (next) => set(name, next) }, name));
|
|
171
|
+
}
|
|
172
|
+
const text = String(held ?? "");
|
|
173
|
+
if (property.format === "date" || property.format === "date-time") {
|
|
174
|
+
return (_jsx(DateField, { ...common, value: text, withTime: property.format === "date-time", onChange: (next) => set(name, next) }, name));
|
|
175
|
+
}
|
|
176
|
+
const limits = {
|
|
177
|
+
...(property.minLength !== undefined ? { minLength: property.minLength } : {}),
|
|
178
|
+
...(property.maxLength !== undefined ? { maxLength: property.maxLength } : {}),
|
|
179
|
+
};
|
|
180
|
+
if (property.maxLength !== undefined && property.maxLength >= LONG_TEXT) {
|
|
181
|
+
return (_jsx(TextAreaField, { ...common, ...limits, value: text, onChange: (next) => set(name, next) }, name));
|
|
182
|
+
}
|
|
183
|
+
return (_jsx(TextField, { ...common, ...limits, type: property.format === "email"
|
|
184
|
+
? "email"
|
|
185
|
+
: property.format === "password"
|
|
186
|
+
? "password"
|
|
187
|
+
: "text", value: text, onChange: (next) => set(name, next) }, name));
|
|
188
|
+
}), _jsx("div", { children: _jsx(Button, { type: "submit", variant: "primary", disabled: off, children: submitLabel }) })] }));
|
|
189
|
+
}
|
package/dist/Grid.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { KeyboardEvent, ReactNode } from "react";
|
|
2
|
+
export interface GridColumn {
|
|
3
|
+
name: string;
|
|
4
|
+
/** What the heading says. The name, when left out. */
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
/** What the column holds, behind a small ⓘ beside its heading. */
|
|
7
|
+
description?: string | undefined;
|
|
8
|
+
/** What the column holds: text, integer, number, boolean, timestamp, date, json and so on. */
|
|
9
|
+
type: string;
|
|
10
|
+
/** Lets a cell be changed in place. */
|
|
11
|
+
editable?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The grid asks `editor` for the control that changes this column's cell, in place of a box
|
|
14
|
+
* to type the raw value in. A cell the screen draws itself (a chip, a name) can then be changed too.
|
|
15
|
+
*/
|
|
16
|
+
control?: boolean;
|
|
17
|
+
/** A yes/no cell can go back to having no value: it goes empty, yes, no, empty. */
|
|
18
|
+
clearable?: boolean;
|
|
19
|
+
sortable?: boolean;
|
|
20
|
+
filterable?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface GridSort {
|
|
23
|
+
column: string;
|
|
24
|
+
descending: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface GridProps<Row extends Record<string, unknown>> {
|
|
27
|
+
/** Names the grid for screen readers: "Rows of orders". */
|
|
28
|
+
label: string;
|
|
29
|
+
columns: GridColumn[];
|
|
30
|
+
rows: Row[];
|
|
31
|
+
rowKey: (row: Row) => string;
|
|
32
|
+
/** What the rows are sorted by: one column, or several, the first most important. */
|
|
33
|
+
sort?: GridSort | GridSort[] | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Called with the column whose header was pressed, and whether Shift was held: a press with
|
|
36
|
+
* Shift adds the column to the sort, or turns it the other way, and one without starts again.
|
|
37
|
+
*/
|
|
38
|
+
onSort?: (column: string, additive: boolean) => void;
|
|
39
|
+
/** What is typed in the filter row, by column. */
|
|
40
|
+
filters?: Record<string, string>;
|
|
41
|
+
onFilter?: (column: string, text: string) => void;
|
|
42
|
+
/** What cannot be read in a filter box, by column. The box is marked, and the screen says what. */
|
|
43
|
+
filterErrors?: Record<string, string>;
|
|
44
|
+
/** Saves one changed cell. A rejection's message is shown in the cell. */
|
|
45
|
+
onEdit?: (row: Row, column: string, value: unknown) => Promise<unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* The control that changes a cell of a column with `control`: a choice, a date, a row of
|
|
48
|
+
* another table. `save` stores the value and closes it, `cancel` closes it with nothing changed.
|
|
49
|
+
* Return undefined for the grid's own box.
|
|
50
|
+
*/
|
|
51
|
+
editor?: (edit: {
|
|
52
|
+
row: Row;
|
|
53
|
+
column: GridColumn;
|
|
54
|
+
value: unknown;
|
|
55
|
+
save: (next: unknown) => Promise<void>;
|
|
56
|
+
cancel: () => void;
|
|
57
|
+
}) => ReactNode | undefined;
|
|
58
|
+
/** Replaces how a cell is shown. Return undefined to keep the grid's own rendering. */
|
|
59
|
+
cell?: (row: Row, column: GridColumn) => ReactNode | undefined;
|
|
60
|
+
rowActions?: (row: Row) => ReactNode;
|
|
61
|
+
/** The key of the row that is chosen. */
|
|
62
|
+
selectedKey?: string | undefined;
|
|
63
|
+
/** Lets one row be chosen, and is called with it. Each row gets a button to choose it by. */
|
|
64
|
+
onSelect?: ((row: Row) => void) | undefined;
|
|
65
|
+
/** Shown in place of the rows when there are none. */
|
|
66
|
+
empty: ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* `grid` follows the WAI-ARIA grid pattern: the grid is one tab stop, arrow
|
|
69
|
+
* keys move between cells, Enter or F2 edits a cell and Escape puts it back,
|
|
70
|
+
* the header stays in view and the first column stays put. Left out, each
|
|
71
|
+
* value to change is a button of its own, as tenant apps have it.
|
|
72
|
+
*/
|
|
73
|
+
navigation?: "grid";
|
|
74
|
+
/**
|
|
75
|
+
* With `navigation="grid"`: whether the first column stays in view when the
|
|
76
|
+
* grid is scrolled sideways. It does unless this says otherwise.
|
|
77
|
+
*/
|
|
78
|
+
lockFirst?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The grid is the one scroller of a screen that fills the window: it takes the height
|
|
81
|
+
* left, in a parent that is a column with `min-h-0`, and scrolls inside it, with its header
|
|
82
|
+
* row and filters pinned. Without it, it is as tall as its rows, to 70% of the window.
|
|
83
|
+
*/
|
|
84
|
+
fill?: boolean;
|
|
85
|
+
/** Row height, with `navigation="grid"`: compact rows are 28 px. */
|
|
86
|
+
density?: "compact" | "standard";
|
|
87
|
+
/** Rows chosen with checkboxes, with `navigation="grid"`, for something done to all of them. */
|
|
88
|
+
checked?: Set<string>;
|
|
89
|
+
onCheck?: (next: Set<string>) => void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Whether a key typed into a field of the grid stays there. The grid's own keys do;
|
|
93
|
+
* the page's, F1 for help and ⌘K for the palette, go on to the shortcuts above.
|
|
94
|
+
*/
|
|
95
|
+
export declare function keepsKey(event: Pick<KeyboardEvent, "key" | "metaKey" | "ctrlKey">): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* A stored moment as the reader's own clock shows it, `2026-06-01 09:00` (with seconds when it
|
|
98
|
+
* has some). The same text is shown in a cell being edited and in the row's inspector, and
|
|
99
|
+
* read back by `instantFromText`: a time is shown, typed and filtered in one zone (D21).
|
|
100
|
+
*/
|
|
101
|
+
export declare function localWall(instant: string, separator?: string): string;
|
|
102
|
+
/** What hovering a time says: the moment in UTC, so a time is never only the reader's guess. */
|
|
103
|
+
export declare const utcOf: (instant: string) => string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Text typed for a moment, as the instant it means: with a zone (`2026-06-01T09:00:00Z`,
|
|
106
|
+
* `+02:00`) as written, and without one in the reader's own zone. A moment that does not exist
|
|
107
|
+
* (31 February, 25:00) is refused, not moved to another.
|
|
108
|
+
*/
|
|
109
|
+
export declare function instantFromText(text: string): string;
|
|
110
|
+
/** A stored value as text a person can read and edit. */
|
|
111
|
+
export declare function showValue(type: string, value: unknown): string;
|
|
112
|
+
/**
|
|
113
|
+
* Turns typed text into a value of the column's type. Empty text means no value.
|
|
114
|
+
* Throws with a message for text that cannot be that type.
|
|
115
|
+
*/
|
|
116
|
+
export declare function parseValue(type: string, text: string): unknown;
|
|
117
|
+
/** Rows and columns of data, with sorting, a filter under each heading and editing in place. */
|
|
118
|
+
export declare function Grid<Row extends Record<string, unknown>>(props: GridProps<Row>): import("react").JSX.Element;
|