@vokality/design-system 1.3.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/README.md +51 -5
- package/dist/browser.d.ts +13 -0
- package/dist/browser.js +7 -0
- package/dist/charts/chart.d.ts +6 -5
- package/dist/charts/chart.js +44 -25
- package/dist/chat.d.ts +54 -0
- package/dist/chat.js +1 -0
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Alert/Alert.js +5 -2
- package/dist/components/AppShell/AppShell.js +10 -14
- package/dist/components/Avatar/Avatar.js +2 -2
- package/dist/components/AvatarGroup/AvatarGroup.js +2 -2
- package/dist/components/BarChart/BarChart.js +17 -15
- package/dist/components/Breadcrumbs/Breadcrumbs.js +6 -3
- package/dist/components/Calendar/Calendar.js +6 -5
- package/dist/components/Card/Card.js +2 -3
- package/dist/components/ChatInbox/ChatInbox.d.ts +11 -0
- package/dist/components/ChatInbox/ChatInbox.js +49 -0
- package/dist/components/ChatPanel/ChatPanel.d.ts +3 -0
- package/dist/components/ChatPanel/ChatPanel.js +13 -0
- package/dist/components/ChatPanel/composer.d.ts +5 -0
- package/dist/components/ChatPanel/composer.js +32 -0
- package/dist/components/ChatPanel/transcript.d.ts +13 -0
- package/dist/components/ChatPanel/transcript.js +39 -0
- package/dist/components/ChatWidget/ChatWidget.d.ts +12 -0
- package/dist/components/ChatWidget/ChatWidget.js +42 -0
- package/dist/components/Checkbox/Checkbox.d.ts +5 -10
- package/dist/components/Checkbox/Checkbox.js +5 -19
- package/dist/components/CodeBlock/CodeBlock.js +19 -5
- package/dist/components/Combobox/Combobox.js +22 -15
- package/dist/components/Combobox/ListPanel.js +20 -9
- package/dist/components/CommandPalette/CommandPalette.js +33 -14
- package/dist/components/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist/components/ContextMenu/ContextMenu.js +5 -50
- package/dist/components/DatePicker/DatePicker.js +35 -29
- package/dist/components/DescriptionList/DescriptionList.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +24 -7
- package/dist/components/Dialog/Dialog.js +30 -41
- package/dist/components/Drawer/Drawer.d.ts +4 -2
- package/dist/components/EmptyState/EmptyState.js +2 -2
- package/dist/components/ErrorSummary/ErrorSummary.js +5 -3
- package/dist/components/FaqList/FaqList.js +1 -1
- package/dist/components/Field/Field.js +4 -4
- package/dist/components/Fieldset/Fieldset.js +3 -3
- package/dist/components/FileUpload/FileUpload.js +17 -9
- package/dist/components/Grid/Grid.d.ts +867 -5
- package/dist/components/Grid/Grid.js +3 -4
- package/dist/components/Heading/Heading.js +2 -1
- package/dist/components/Icon/Icon.js +4 -2
- package/dist/components/Inline/Inline.d.ts +867 -5
- package/dist/components/Inline/Inline.js +2 -3
- package/dist/components/LineChart/LineChart.js +17 -15
- package/dist/components/LinkProvider/LinkProvider.d.ts +1 -1
- package/dist/components/LinkProvider/LinkProvider.js +6 -2
- package/dist/components/List/List.js +1 -1
- package/dist/components/MediaCard/MediaCard.js +2 -2
- package/dist/components/Menu/Menu.js +6 -43
- package/dist/components/Menu/entries.d.ts +1 -30
- package/dist/components/Menu/entries.js +16 -100
- package/dist/components/MultiSelect/MultiSelect.js +43 -34
- package/dist/components/NumberInput/NumberInput.js +17 -18
- package/dist/components/OtpInput/OtpInput.d.ts +1 -1
- package/dist/components/OtpInput/OtpInput.js +10 -67
- package/dist/components/PageHeader/PageHeader.js +2 -2
- package/dist/components/Pagination/Pagination.js +3 -1
- package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +9 -4
- package/dist/components/Popover/Popover.d.ts +6 -7
- package/dist/components/Popover/Popover.js +2 -19
- package/dist/components/Progress/Progress.d.ts +1 -1
- package/dist/components/Progress/Progress.js +7 -11
- package/dist/components/Radio/Radio.d.ts +4 -2
- package/dist/components/RadioGroup/RadioGroup.d.ts +5 -12
- package/dist/components/RadioGroup/RadioGroup.js +6 -33
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +63 -0
- package/dist/components/RichTextEditor/RichTextEditor.js +175 -0
- package/dist/components/RichTextEditor/toolbar.d.ts +15 -0
- package/dist/components/RichTextEditor/toolbar.js +142 -0
- package/dist/components/RichTextEditor/uploads.d.ts +41 -0
- package/dist/components/RichTextEditor/uploads.js +124 -0
- package/dist/components/SearchInput/SearchInput.js +4 -2
- package/dist/components/SectionHeader/SectionHeader.js +1 -3
- package/dist/components/SegmentedControl/SegmentedControl.js +2 -12
- package/dist/components/Select/Select.d.ts +15 -16
- package/dist/components/Select/Select.js +11 -252
- package/dist/components/Slider/Slider.js +11 -21
- package/dist/components/Sparkline/Sparkline.js +8 -3
- package/dist/components/Spinner/Spinner.js +5 -2
- package/dist/components/Stack/Stack.d.ts +867 -5
- package/dist/components/Stack/Stack.js +2 -3
- package/dist/components/Stat/Stat.js +6 -3
- package/dist/components/Steps/Steps.js +6 -3
- package/dist/components/Switch/Switch.d.ts +7 -7
- package/dist/components/Switch/Switch.js +4 -10
- package/dist/components/Table/Table.js +38 -19
- package/dist/components/Tabs/Tabs.js +2 -22
- package/dist/components/Tag/Tag.js +3 -1
- package/dist/components/Text/Text.d.ts +9 -5
- package/dist/components/Text/Text.js +3 -4
- package/dist/components/TileGrid/TileGrid.js +1 -1
- package/dist/components/TimePicker/TimePicker.js +35 -33
- package/dist/components/Timeline/Timeline.js +5 -4
- package/dist/components/Toaster/Toaster.js +21 -17
- package/dist/components/Tooltip/Tooltip.d.ts +6 -6
- package/dist/components/Tooltip/Tooltip.js +3 -17
- package/dist/components/TreeView/TreeView.js +15 -12
- package/dist/components.css +281 -60
- package/dist/hooks/useTheme.js +6 -6
- package/dist/icons/message-circle.svg +1 -0
- package/dist/internal/CharCount.js +3 -1
- package/dist/internal/choice.d.ts +10 -48
- package/dist/internal/choice.js +8 -96
- package/dist/internal/describedBy.d.ts +3 -0
- package/dist/internal/describedBy.js +4 -0
- package/dist/internal/options.d.ts +10 -5
- package/dist/internal/options.js +25 -11
- package/dist/internal/status.d.ts +3 -2
- package/dist/internal/status.js +10 -2
- package/dist/internal/useScrollActive.js +2 -2
- package/dist/internal/useToday.d.ts +3 -0
- package/dist/internal/useToday.js +42 -0
- package/dist/lib/dates.js +25 -15
- package/dist/lib/format.js +11 -8
- package/dist/lib/icons.d.ts +5 -0
- package/dist/lib/icons.js +2 -0
- package/dist/lib/math.js +17 -5
- package/dist/lib/rich-text.d.ts +13 -0
- package/dist/lib/rich-text.js +62 -0
- package/dist/lib/space.d.ts +1 -2
- package/dist/lib/space.js +4 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/theme.js +1 -1
- package/dist/localization.d.ts +166 -0
- package/dist/localization.js +142 -0
- package/dist/tokens.css +2 -0
- package/dist/tokens.dtcg.json +10 -0
- package/dist/tokens.json +10 -0
- package/dist/types.d.ts +6 -1
- package/dist/vokality.css +283 -60
- package/dist/vokality.iife.js +35981 -9698
- package/docs/brand.md +8 -5
- package/docs/components/AppShell/README.md +1 -1
- package/docs/components/Badge/README.md +1 -1
- package/docs/components/BarChart/README.md +1 -0
- package/docs/components/Button/README.md +4 -2
- package/docs/components/ChatInbox/README.md +41 -0
- package/docs/components/ChatWidget/README.md +47 -0
- package/docs/components/Checkbox/README.md +7 -3
- package/docs/components/ContextMenu/README.md +7 -3
- package/docs/components/Dialog/README.md +9 -4
- package/docs/components/Drawer/README.md +1 -1
- package/docs/components/Field/README.md +1 -1
- package/docs/components/Fieldset/README.md +2 -2
- package/docs/components/Inline/README.md +1 -1
- package/docs/components/LineChart/README.md +1 -0
- package/docs/components/LocaleProvider/README.md +48 -0
- package/docs/components/Menu/README.md +13 -8
- package/docs/components/OtpInput/README.md +9 -5
- package/docs/components/PasswordInput/README.md +11 -2
- package/docs/components/Popover/README.md +6 -3
- package/docs/components/Progress/README.md +3 -1
- package/docs/components/RadioGroup/README.md +5 -2
- package/docs/components/RichTextEditor/README.md +84 -0
- package/docs/components/SegmentedControl/README.md +2 -0
- package/docs/components/Select/README.md +13 -17
- package/docs/components/Skeleton/README.md +1 -1
- package/docs/components/Slider/README.md +4 -2
- package/docs/components/Steps/README.md +1 -1
- package/docs/components/Switch/README.md +5 -2
- package/docs/components/Tabs/README.md +4 -2
- package/docs/components/Text/README.md +1 -1
- package/docs/components/Toaster/README.md +3 -1
- package/docs/components/Tooltip/README.md +5 -3
- package/package.json +49 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useLocale } from "../../localization.js";
|
|
4
|
+
import { forwardRef, useState } from "react";
|
|
4
5
|
import { Icon } from "../Icon/Icon.js";
|
|
5
6
|
import { Input } from "../Input/Input.js";
|
|
6
7
|
import { cx } from "../../lib/cx.js";
|
|
@@ -12,13 +13,9 @@ export const NumberInput = forwardRef(function NumberInput(props, ref) {
|
|
|
12
13
|
const controlled = props.value !== undefined;
|
|
13
14
|
const [internal, setInternal] = useState(props.defaultValue != null ? props.defaultValue : null);
|
|
14
15
|
const value = props.value !== undefined ? props.value : internal;
|
|
15
|
-
//
|
|
16
|
-
const [
|
|
17
|
-
const
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (!editing.current)
|
|
20
|
-
setText(value == null ? "" : String(value));
|
|
21
|
-
}, [value]);
|
|
16
|
+
// Preserve partial input only while it still describes the current value.
|
|
17
|
+
const [draft, setDraft] = useState(null);
|
|
18
|
+
const text = draft && draft.value === value ? draft.text : value == null ? "" : String(value);
|
|
22
19
|
const decimals = (String(step).split(".")[1] || "").length;
|
|
23
20
|
const clamp = (n) => {
|
|
24
21
|
if (min != null && n < min)
|
|
@@ -31,26 +28,27 @@ export const NumberInput = forwardRef(function NumberInput(props, ref) {
|
|
|
31
28
|
const next = n == null || isNaN(n) ? null : clamp(n);
|
|
32
29
|
if (!controlled)
|
|
33
30
|
setInternal(next);
|
|
34
|
-
|
|
31
|
+
setDraft(null);
|
|
35
32
|
props.onChange?.(next);
|
|
36
33
|
};
|
|
37
34
|
// From empty, a step counts from min (or 0).
|
|
38
|
-
const bump = (d) => set((value ?? min ?? 0) + d);
|
|
35
|
+
const bump = (d) => { set((value ?? min ?? 0) + d); };
|
|
39
36
|
const rest = omit(props, ["value", "defaultValue", "onChange", "min", "max", "step", "decrementLabel", "incrementLabel", "suffix", "prefix", "className"]);
|
|
40
37
|
return (_jsx(Input, { ...rest, ref: ref, className: cx("vk-number", props.className), inputMode: decimals ? "decimal" : "numeric", role: "spinbutton", "aria-valuenow": value ?? undefined, "aria-valuemin": min, "aria-valuemax": max, autoComplete: "off", value: text, prefix: props.prefix, onChange: (e) => {
|
|
41
|
-
|
|
42
|
-
const raw =
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const nextText = e.target.value;
|
|
39
|
+
const raw = nextText.replace(",", ".");
|
|
40
|
+
if (raw === "" || raw === "-") {
|
|
41
|
+
setDraft({ text: nextText, value });
|
|
45
42
|
return;
|
|
43
|
+
}
|
|
46
44
|
const n = Number(raw);
|
|
47
|
-
|
|
45
|
+
setDraft({ text: nextText, value: Number.isNaN(n) ? value : n });
|
|
46
|
+
if (!Number.isNaN(n)) {
|
|
48
47
|
if (!controlled)
|
|
49
48
|
setInternal(n);
|
|
50
49
|
props.onChange?.(n);
|
|
51
50
|
}
|
|
52
51
|
}, onBlur: (e) => {
|
|
53
|
-
editing.current = false;
|
|
54
52
|
const raw = text.replace(",", ".");
|
|
55
53
|
set(raw === "" ? null : Number(raw));
|
|
56
54
|
props.onBlur?.(e);
|
|
@@ -80,11 +78,12 @@ export const NumberInput = forwardRef(function NumberInput(props, ref) {
|
|
|
80
78
|
e.preventDefault();
|
|
81
79
|
set(max);
|
|
82
80
|
}
|
|
83
|
-
}, suffix: _jsx(Stepper, { unit: props.suffix, value: value, min: min, max: max, disabled: props.disabled, decrementLabel: props.decrementLabel, incrementLabel: props.incrementLabel, onStep: (dir) => bump(dir * step) }) }));
|
|
81
|
+
}, suffix: _jsx(Stepper, { unit: props.suffix, value: value, min: min, max: max, disabled: props.disabled, decrementLabel: props.decrementLabel, incrementLabel: props.incrementLabel, onStep: (dir) => { bump(dir * step); } }) }));
|
|
84
82
|
});
|
|
85
83
|
// The unit and the − and + buttons; each button is disabled at its end of the range.
|
|
86
84
|
function Stepper({ unit, value, min, max, disabled, decrementLabel, incrementLabel, onStep }) {
|
|
85
|
+
const { messages } = useLocale();
|
|
87
86
|
const atMin = min != null && value != null && value <= min;
|
|
88
87
|
const atMax = max != null && value != null && value >= max;
|
|
89
|
-
return (_jsxs("span", { className: "vk-stepper", children: [unit ? _jsx("span", { className: "vk-stepper-unit", "aria-hidden": "true", children: unit }) : null, _jsx("button", { type: "button", tabIndex: -1, className: "vk-stepper-btn", "aria-label": decrementLabel ||
|
|
88
|
+
return (_jsxs("span", { className: "vk-stepper", children: [unit ? _jsx("span", { className: "vk-stepper-unit", "aria-hidden": "true", children: unit }) : null, _jsx("button", { type: "button", tabIndex: -1, className: "vk-stepper-btn", "aria-label": decrementLabel || messages.decrease, disabled: disabled || atMin, onClick: () => { onStep(-1); }, children: _jsx(Icon, { name: "minus", size: 14 }) }), _jsx("button", { type: "button", tabIndex: -1, className: "vk-stepper-btn", "aria-label": incrementLabel || messages.increase, disabled: disabled || atMax, onClick: () => { onStep(1); }, children: _jsx(Icon, { name: "plus", size: 14 }) })] }));
|
|
90
89
|
}
|
|
@@ -15,5 +15,5 @@ export interface OtpInputProps {
|
|
|
15
15
|
'aria-describedby'?: string;
|
|
16
16
|
'aria-invalid'?: boolean;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
18
|
+
/** Styled Radix OTP fields; the primitive owns validation, paste, navigation, focus and form data. */
|
|
19
19
|
export declare function OtpInput(props: OtpInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,75 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { unstable_OneTimePasswordField as Primitive } from "radix-ui";
|
|
4
|
+
import { useLocale } from "../../localization.js";
|
|
4
5
|
import { useUid } from "../../internal/useUid.js";
|
|
5
6
|
import { cx } from "../../lib/cx.js";
|
|
6
|
-
/**
|
|
7
|
-
function OtpBox({ index: i, length, value, pattern, firstId, props, boxRef, set, focus }) {
|
|
8
|
-
const first = i === 0;
|
|
9
|
-
return (_jsx("input", { ref: boxRef, id: first ? firstId : undefined, className: "vk-input vk-otp-box", inputMode: props.numeric === false ? "text" : "numeric", autoComplete: first ? "one-time-code" : "off", maxLength: 1, value: value[i] || "", disabled: props.disabled, "aria-label": (props.label || "Digit") + " " + (i + 1) + " of " + length, "aria-invalid": props["aria-invalid"], "aria-describedby": first ? props["aria-describedby"] : undefined, onFocus: (e) => e.target.select(), onChange: (e) => {
|
|
10
|
-
const ch = e.target.value.slice(-1);
|
|
11
|
-
if (ch && !pattern.test(ch))
|
|
12
|
-
return;
|
|
13
|
-
const arr = value.split("");
|
|
14
|
-
while (arr.length < i)
|
|
15
|
-
arr.push("");
|
|
16
|
-
arr[i] = ch;
|
|
17
|
-
set(arr.join("").replace(/\s+$/, ""));
|
|
18
|
-
if (ch)
|
|
19
|
-
focus(i + 1);
|
|
20
|
-
}, onKeyDown: (e) => {
|
|
21
|
-
if (e.key === "Backspace" && !value[i]) {
|
|
22
|
-
e.preventDefault();
|
|
23
|
-
const arr = value.split("");
|
|
24
|
-
arr[i - 1] = "";
|
|
25
|
-
set(arr.join(""));
|
|
26
|
-
focus(i - 1);
|
|
27
|
-
}
|
|
28
|
-
else if (e.key === "ArrowLeft") {
|
|
29
|
-
e.preventDefault();
|
|
30
|
-
focus(i - 1);
|
|
31
|
-
}
|
|
32
|
-
else if (e.key === "ArrowRight") {
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
focus(i + 1);
|
|
35
|
-
}
|
|
36
|
-
}, onPaste: (e) => {
|
|
37
|
-
const text = (e.clipboardData.getData("text") || "").split("").filter((c) => pattern.test(c)).join("");
|
|
38
|
-
if (!text)
|
|
39
|
-
return;
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
set(text);
|
|
42
|
-
focus(Math.min(text.length, length - 1));
|
|
43
|
-
} }));
|
|
44
|
-
}
|
|
45
|
-
/** One box per character of a one-time code; typing advances, Backspace goes back, a paste fills them all. */
|
|
7
|
+
/** Styled Radix OTP fields; the primitive owns validation, paste, navigation, focus and form data. */
|
|
46
8
|
export function OtpInput(props) {
|
|
9
|
+
const { messages } = useLocale();
|
|
47
10
|
const length = props.length || 6;
|
|
48
|
-
const [uncontrolled, setUncontrolled] = useState(() => (props.defaultValue || "").slice(0, length));
|
|
49
|
-
const value = props.value !== undefined ? props.value : uncontrolled;
|
|
50
|
-
const refs = useRef([]);
|
|
51
11
|
const uid = useUid("vk-otp");
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
props.
|
|
58
|
-
if (v.length === length)
|
|
59
|
-
props.onComplete?.(v);
|
|
60
|
-
};
|
|
61
|
-
const focus = (i) => {
|
|
62
|
-
const el = refs.current[Math.max(0, Math.min(length - 1, i))];
|
|
63
|
-
if (el) {
|
|
64
|
-
el.focus();
|
|
65
|
-
el.select();
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const boxes = [];
|
|
69
|
-
for (let i = 0; i < length; i++) {
|
|
70
|
-
boxes.push(_jsx(OtpBox, { index: i, length: length, value: value, pattern: pattern, firstId: props.id || uid, props: props, boxRef: (el) => {
|
|
71
|
-
refs.current[i] = el;
|
|
72
|
-
}, set: set, focus: focus }, i));
|
|
73
|
-
}
|
|
74
|
-
return (_jsxs("div", { role: "group", className: cx("vk-otp", props.className), "aria-labelledby": props["aria-labelledby"], "aria-label": props["aria-labelledby"] ? undefined : props["aria-label"] || "One-time code", children: [boxes, props.name ? _jsx("input", { type: "hidden", name: props.name, value: value }) : null] }));
|
|
12
|
+
const style = { "--vk-otp-length": length };
|
|
13
|
+
return (_jsxs(Primitive.Root, { className: cx("vk-otp", props.className), style: style, value: props.value, defaultValue: props.defaultValue, onValueChange: (code) => {
|
|
14
|
+
props.onChange?.(code);
|
|
15
|
+
if (code.length === length)
|
|
16
|
+
props.onComplete?.(code);
|
|
17
|
+
}, validationType: props.numeric === false ? "none" : "numeric", name: props.disabled ? undefined : props.name, disabled: props.disabled, "aria-labelledby": props["aria-labelledby"], "aria-label": props["aria-labelledby"] ? undefined : props["aria-label"] || messages.oneTimeCode, children: [Array.from({ length }, (_, index) => (_jsx(Primitive.Input, { index: index, id: index === 0 ? props.id || uid : undefined, className: "vk-input vk-otp-box", "aria-label": messages.digitPosition(props.label || messages.digit, index + 1, length), "aria-invalid": props["aria-invalid"], "aria-describedby": index === 0 ? props["aria-describedby"] : undefined }, index))), _jsx(Primitive.HiddenInput, {})] }));
|
|
75
18
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
2
3
|
import { Badge } from "../Badge/Badge.js";
|
|
3
4
|
import { Breadcrumbs } from "../Breadcrumbs/Breadcrumbs.js";
|
|
4
5
|
import { cx } from "../../lib/cx.js";
|
|
@@ -6,6 +7,5 @@ import { para } from "../../lib/text.js";
|
|
|
6
7
|
/** The top of a page inside an app: breadcrumbs, the page title, a description and the page's main actions. */
|
|
7
8
|
export function PageHeader({ title, description, eyebrow, breadcrumbs, actions, badge, badgeTone, divider, headingAs, children, className }) {
|
|
8
9
|
const Heading = headingAs || "h1";
|
|
9
|
-
|
|
10
|
-
return (_jsxs("header", { className: cx("vk-page-header", divider ? "vk-page-header-divider" : null, className), children: [breadcrumbs ? _jsx(Breadcrumbs, { items: breadcrumbs }) : null, _jsxs("div", { className: "vk-page-header-row", children: [_jsxs("div", { className: "vk-page-header-text", children: [eyebrow ? _jsx("p", { className: "vk-page-header-eyebrow", children: eyebrow }) : null, _jsxs(Heading, { className: "vk-page-header-title", children: [title, badge ? _jsx(Badge, { tone: badgeTone, children: badge }) : null] }), description ? _jsx(Description, { className: "vk-page-header-description", children: description }) : null] }), actions ? _jsx("div", { className: "vk-page-header-actions", children: actions }) : null] }), children] }));
|
|
10
|
+
return (_jsxs("header", { className: cx("vk-page-header", divider ? "vk-page-header-divider" : null, className), children: [breadcrumbs ? _jsx(Breadcrumbs, { items: breadcrumbs }) : null, _jsxs("div", { className: "vk-page-header-row", children: [_jsxs("div", { className: "vk-page-header-text", children: [eyebrow ? _jsx("p", { className: "vk-page-header-eyebrow", children: eyebrow }) : null, _jsxs(Heading, { className: "vk-page-header-title", children: [title, badge ? _jsx(Badge, { tone: badgeTone, children: badge }) : null] }), description ? createElement(para(description), { className: "vk-page-header-description" }, description) : null] }), actions ? _jsx("div", { className: "vk-page-header-actions", children: actions }) : null] }), children] }));
|
|
11
11
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useLocale } from "../../localization.js";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { Icon } from "../Icon/Icon.js";
|
|
5
6
|
import { cx } from "../../lib/cx.js";
|
|
6
7
|
import { pageList } from "../../lib/math.js";
|
|
7
8
|
/** Moves through a long list one page at a time, with an optional summary of what's shown. */
|
|
8
9
|
export function Pagination({ pageCount, page: pageProp, defaultPage, onChange, siblings, summary, previousLabel, nextLabel, label, className }) {
|
|
10
|
+
const { messages } = useLocale();
|
|
9
11
|
const count = Math.max(1, pageCount || 1);
|
|
10
12
|
const controlled = pageProp !== undefined;
|
|
11
13
|
const [internal, setInternal] = useState(defaultPage || 1);
|
|
@@ -18,5 +20,5 @@ export function Pagination({ pageCount, page: pageProp, defaultPage, onChange, s
|
|
|
18
20
|
onChange?.(p);
|
|
19
21
|
};
|
|
20
22
|
const pages = pageList(page, count, siblings ?? 1);
|
|
21
|
-
return (_jsxs("nav", { "aria-label": label ||
|
|
23
|
+
return (_jsxs("nav", { "aria-label": label || messages.pagination, className: cx("vk-pagination", className), children: [summary ? _jsx("p", { className: "vk-pagination-summary", children: summary }) : null, _jsxs("ul", { className: "vk-pagination-list", children: [_jsx("li", { children: _jsxs("button", { type: "button", className: "vk-page vk-page-step", disabled: page === 1, onClick: () => { go(page - 1); }, children: [_jsx(Icon, { name: "chevron-left" }), _jsx("span", { children: previousLabel || messages.previous })] }) }), pages.map((p) => typeof p === "string" ? (_jsx("li", { className: "vk-page-gap", "aria-hidden": "true", children: "…" }, p)) : (_jsx("li", { children: _jsx("button", { type: "button", className: "vk-page", "aria-current": p === page ? "page" : undefined, "aria-label": messages.page(p), onClick: () => { go(p); }, children: p }) }, p))), _jsx("li", { children: _jsxs("button", { type: "button", className: "vk-page vk-page-step", disabled: page === count, onClick: () => { go(page + 1); }, children: [_jsx("span", { children: nextLabel || messages.next }), _jsx(Icon, { name: "chevron-right" })] }) })] })] }));
|
|
22
24
|
}
|
|
@@ -3,5 +3,5 @@ export interface PasswordInputProps extends Omit<InputProps, 'type' | 'suffix'>
|
|
|
3
3
|
showLabel?: string;
|
|
4
4
|
hideLabel?: string;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
6
|
+
/** Styled Radix password toggle; the primitive owns visibility, selection and focus. The ref is the input. */
|
|
7
7
|
export declare const PasswordInput: import("react").ForwardRefExoticComponent<PasswordInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { unstable_PasswordToggleField as Primitive } from "radix-ui";
|
|
5
|
+
import { useLocale } from "../../localization.js";
|
|
6
|
+
import { useUid } from "../../internal/useUid.js";
|
|
4
7
|
import { Input } from "../Input/Input.js";
|
|
5
8
|
import { omit } from "../../lib/omit.js";
|
|
6
|
-
/**
|
|
9
|
+
/** Styled Radix password toggle; the primitive owns visibility, selection and focus. The ref is the input. */
|
|
7
10
|
export const PasswordInput = forwardRef(function PasswordInput(props, ref) {
|
|
8
|
-
const
|
|
11
|
+
const { messages } = useLocale();
|
|
12
|
+
const uid = useUid("vk-password");
|
|
13
|
+
const id = props.id || uid;
|
|
9
14
|
const rest = omit(props, ["showLabel", "hideLabel"]);
|
|
10
|
-
return (_jsx(Input, {
|
|
15
|
+
return (_jsx(Primitive.Root, { children: _jsx(Primitive.Input, { asChild: true, id: id, children: _jsx(Input, { ...rest, ref: ref, suffix: _jsx(Primitive.Slot, { render: ({ visible }) => (_jsx(Primitive.Toggle, { id: id + "-toggle", "aria-controls": id, className: "vk-affix-button", "aria-pressed": visible, "aria-label": visible ? props.hideLabel || messages.hidePassword : props.showLabel || messages.showPassword, disabled: props.disabled, children: visible ? props.hideLabel || messages.hidePassword : props.showLabel || messages.showPassword })) }) }) }) }));
|
|
11
16
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { Popover as Primitive } from "radix-ui";
|
|
2
3
|
import type { IconName } from "../../types.js";
|
|
3
|
-
export interface PopoverProps {
|
|
4
|
+
export interface PopoverProps extends Pick<Primitive.PopoverProps, 'open' | 'defaultOpen' | 'onOpenChange' | 'modal'> {
|
|
4
5
|
label: string;
|
|
5
6
|
title?: string;
|
|
6
7
|
icon?: IconName;
|
|
@@ -8,11 +9,9 @@ export interface PopoverProps {
|
|
|
8
9
|
size?: 'sm';
|
|
9
10
|
align?: 'start' | 'end';
|
|
10
11
|
width?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
close: () => void;
|
|
14
|
-
}) => ReactNode);
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
close?: ReactElement;
|
|
15
14
|
className?: string;
|
|
16
15
|
}
|
|
17
16
|
/** Non-modal panel attached to a button (Radix Popover). */
|
|
18
|
-
export declare function Popover({ label, title, icon, variant, size, align, width, defaultOpen, children, className }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function Popover({ label, title, icon, variant, size, align, width, open, defaultOpen, onOpenChange, modal, children, close, className }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useState } from "react";
|
|
4
3
|
import { Popover as Primitive } from "radix-ui";
|
|
5
4
|
import { Icon } from "../Icon/Icon.js";
|
|
6
|
-
import { focusables } from "../../internal/focusables.js";
|
|
7
5
|
import { cx } from "../../lib/cx.js";
|
|
8
6
|
/** Non-modal panel attached to a button (Radix Popover). */
|
|
9
|
-
export function Popover({ label, title, icon, variant, size, align, width, defaultOpen, children, className }) {
|
|
10
|
-
|
|
11
|
-
const popRef = useRef(null);
|
|
12
|
-
// Focus moves into the panel when it opens, not when it mounts already open.
|
|
13
|
-
const opened = useRef(false);
|
|
14
|
-
const onOpenChange = (next) => {
|
|
15
|
-
if (next)
|
|
16
|
-
opened.current = true;
|
|
17
|
-
setOpen(next);
|
|
18
|
-
};
|
|
19
|
-
return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { open: open, onOpenChange: onOpenChange, children: [_jsxs(Primitive.Trigger, { className: cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" ? "vk-btn-sm" : null), children: [_jsxs("span", { className: "vk-btn-label", children: [icon ? _jsx(Icon, { name: icon, size: 16, className: "vk-menu-trigger-icon" }) : null, label] }), _jsx("span", { className: "vk-btn-glyph", "aria-hidden": "true", children: _jsx(Icon, { name: "chevron-down", size: 14 }) })] }), _jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { ref: popRef, "aria-label": title || label, className: "vk-popover vk-popover-panel", side: "bottom", align: align === "end" ? "end" : "start", sideOffset: 4, collisionPadding: 8, style: width ? { width } : undefined, onOpenAutoFocus: (e) => {
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
if (!opened.current || !popRef.current)
|
|
22
|
-
return;
|
|
23
|
-
const f = focusables(popRef.current);
|
|
24
|
-
(f[0] || popRef.current).focus();
|
|
25
|
-
}, children: [title ? _jsx("p", { className: "vk-popover-title", children: title }) : null, typeof children === "function" ? children({ close: () => setOpen(false) }) : children] }) })] }) }));
|
|
7
|
+
export function Popover({ label, title, icon, variant, size, align, width, open, defaultOpen, onOpenChange, modal, children, close, className }) {
|
|
8
|
+
return (_jsx("div", { className: cx("vk-menu-root", className), children: _jsxs(Primitive.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, modal: modal, children: [_jsxs(Primitive.Trigger, { className: cx("vk-btn", "vk-btn-" + (variant || "outline"), size === "sm" ? "vk-btn-sm" : null), children: [_jsxs("span", { className: "vk-btn-label", children: [icon ? _jsx(Icon, { name: icon, size: 16, className: "vk-menu-trigger-icon" }) : null, label] }), _jsx("span", { className: "vk-btn-glyph", "aria-hidden": "true", children: _jsx(Icon, { name: "chevron-down", size: 14 }) })] }), _jsx(Primitive.Portal, { children: _jsxs(Primitive.Content, { "aria-label": title || label, className: "vk-popover vk-popover-panel", side: "bottom", align: align === "end" ? "end" : "start", sideOffset: 4, collisionPadding: 8, style: width ? { width } : undefined, children: [title ? _jsx("p", { className: "vk-popover-title", children: title }) : null, children, close ? _jsx("div", { className: "vk-popover-footer", children: _jsx(Primitive.Close, { asChild: true, children: close }) }) : null] }) })] }) }));
|
|
26
9
|
}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useLocale } from "../../localization.js";
|
|
3
4
|
import { Progress as Primitive } from "radix-ui";
|
|
4
5
|
import { useUid } from "../../internal/useUid.js";
|
|
5
6
|
import { cx } from "../../lib/cx.js";
|
|
6
|
-
function measure(value, maxProp) {
|
|
7
|
-
const max = maxProp && maxProp > 0 ? maxProp : 100;
|
|
8
|
-
// Radix treats a value outside 0..max as indeterminate, so clamp it.
|
|
9
|
-
const now = value == null ? null : Math.max(0, Math.min(max, value));
|
|
10
|
-
const pct = now == null ? 0 : (now / max) * 100;
|
|
11
|
-
return { max, now, pct };
|
|
12
|
-
}
|
|
13
7
|
// The label and the value above the bar; the value is left out while indeterminate.
|
|
14
8
|
function ProgressRow({ label, labelId, value }) {
|
|
15
9
|
return (_jsxs("div", { className: "vk-progress-row", children: [label ? _jsx("span", { id: labelId, className: "vk-progress-label", children: label }) : _jsx("span", {}), value != null ? _jsx("span", { className: "vk-progress-value", children: value }) : null] }));
|
|
16
10
|
}
|
|
17
11
|
/** A bar showing how far a task has got, or that it is still running (Radix Progress). */
|
|
18
12
|
export function Progress({ value, max: maxProp, label, showValue, valueText, tone, "aria-label": ariaLabel, className }) {
|
|
19
|
-
const {
|
|
20
|
-
const
|
|
13
|
+
const { messages } = useLocale();
|
|
14
|
+
const max = maxProp ?? 100;
|
|
15
|
+
const indeterminate = value == null;
|
|
16
|
+
const pct = value == null ? 0 : (value / max) * 100;
|
|
21
17
|
const labelId = useUid("vk-progress");
|
|
22
|
-
const shownValue = showValue && !indeterminate ? valueText || Math.round(pct) + "%" : null;
|
|
23
|
-
return (_jsxs("div", { className: cx("vk-progress", "vk-progress-" + (tone || "primary"), className), children: [label || showValue ? _jsx(ProgressRow, { label: label, labelId: labelId, value: shownValue }) : null, _jsx(Primitive.Root, { value:
|
|
18
|
+
const shownValue = showValue && !indeterminate ? valueText || String(Math.round(pct)) + "%" : null;
|
|
19
|
+
return (_jsxs("div", { className: cx("vk-progress", "vk-progress-" + (tone || "primary"), className), children: [label || showValue ? _jsx(ProgressRow, { label: label, labelId: labelId, value: shownValue }) : null, _jsx(Primitive.Root, { value: value, max: max, "aria-labelledby": label ? labelId : undefined, "aria-label": label ? undefined : ariaLabel || messages.progress, getValueLabel: valueText === undefined ? undefined : () => valueText, className: "vk-progress-track", children: indeterminate ? null : _jsx(Primitive.Indicator, { className: "vk-progress-fill", style: { width: String(pct) + "%" } }) })] }));
|
|
24
20
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { InputHTMLAttributes } from "react";
|
|
2
|
+
import type { ChoiceTextProps } from "../../internal/choice.js";
|
|
3
|
+
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type">, ChoiceTextProps {
|
|
4
|
+
}
|
|
3
5
|
/**
|
|
4
6
|
* Square radio (inner square dot) with label and optional description. A native radio, since Radix radios only
|
|
5
7
|
* work inside a group; `RadioGroup` draws the same box with Radix RadioGroup.
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { RadioGroup as Primitive } from "radix-ui";
|
|
3
|
+
export interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<typeof Primitive.Root>, "asChild" | "children" | "onChange"> {
|
|
3
4
|
label: ReactNode;
|
|
4
|
-
name: string;
|
|
5
5
|
options: (string | {
|
|
6
6
|
value: string;
|
|
7
7
|
label: ReactNode;
|
|
8
8
|
description?: ReactNode;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
})[];
|
|
11
|
-
value?: string;
|
|
12
|
-
defaultValue?: string;
|
|
13
|
-
/** Receives a change event whose target reads `value`, `name` and `checked` like a native radio. */
|
|
14
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
15
11
|
inline?: boolean;
|
|
16
12
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
* Inside a form each option submits through a hidden radio named `name`.
|
|
20
|
-
*/
|
|
21
|
-
export declare function RadioGroup(props: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/** Styled Radix RadioGroup with a fieldset legend and direct onValueChange(value) callbacks. */
|
|
14
|
+
export declare function RadioGroup({ label, options, inline, className, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,41 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useState } from "react";
|
|
4
3
|
import { RadioGroup as Primitive } from "radix-ui";
|
|
5
|
-
import { ChoiceLabel
|
|
4
|
+
import { ChoiceLabel } from "../../internal/choice.js";
|
|
6
5
|
import { useUid } from "../../internal/useUid.js";
|
|
7
6
|
import { cx } from "../../lib/cx.js";
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
* Inside a form each option submits through a hidden radio named `name`.
|
|
11
|
-
*/
|
|
12
|
-
export function RadioGroup(props) {
|
|
13
|
-
const controlled = props.value !== undefined;
|
|
14
|
-
const [own, setOwn] = useState(props.defaultValue ?? null);
|
|
15
|
-
const value = controlled ? props.value : own;
|
|
16
|
-
const click = useRef(null);
|
|
7
|
+
/** Styled Radix RadioGroup with a fieldset legend and direct onValueChange(value) callbacks. */
|
|
8
|
+
export function RadioGroup({ label, options, inline, className, ...props }) {
|
|
17
9
|
const legendId = useUid("vk-radio-group");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const c = click.current;
|
|
22
|
-
click.current = null;
|
|
23
|
-
if (!c) {
|
|
24
|
-
// The form was reset; as natively, no change event.
|
|
25
|
-
if (!controlled)
|
|
26
|
-
setOwn(props.defaultValue ?? null);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (!controlled)
|
|
30
|
-
setOwn(v);
|
|
31
|
-
props.onChange?.(choiceChangeEvent(c.event, c.control, { type: "radio", checked: true, value: v, name: props.name }));
|
|
32
|
-
};
|
|
33
|
-
return (_jsx(Primitive.Root, { asChild: true, name: props.name, value: value, onValueChange: onValueChange, ...arrows.group, children: _jsxs("fieldset", { className: cx("vk-choice-group", props.inline && "vk-choice-group-inline"), "aria-labelledby": legendId, children: [_jsx("legend", { id: legendId, className: "vk-field-label", children: props.label }), _jsx("div", { className: "vk-choice-list", children: (props.options || []).map((o) => {
|
|
34
|
-
const opt = typeof o === "string" ? { value: o, label: o } : o;
|
|
35
|
-
return (_jsx(ChoiceLabel, { label: opt.label, description: opt.description, disabled: opt.disabled, children: _jsx(Primitive.Item, { className: "vk-choice-box vk-choice-box-radio", value: opt.value, disabled: opt.disabled, ...arrows.item, onClick: (e) => {
|
|
36
|
-
// Radix checks an option on its click (also the one it sends when an arrow key moves focus).
|
|
37
|
-
if (opt.value !== value)
|
|
38
|
-
click.current = { event: e, control: e.currentTarget };
|
|
39
|
-
}, children: _jsx(Primitive.Indicator, { forceMount: true, className: "vk-choice-dot" }) }) }, opt.value));
|
|
10
|
+
return (_jsx(Primitive.Root, { ...props, asChild: true, children: _jsxs("fieldset", { className: cx("vk-choice-group", inline && "vk-choice-group-inline", className), "aria-labelledby": legendId, children: [_jsx("legend", { id: legendId, className: "vk-field-label", children: label }), _jsx("div", { className: "vk-choice-list", children: options.map((option) => {
|
|
11
|
+
const item = typeof option === "string" ? { value: option, label: option } : option;
|
|
12
|
+
return (_jsx(ChoiceLabel, { label: item.label, description: item.description, disabled: props.disabled || item.disabled, children: _jsx(Primitive.Item, { className: "vk-choice-box vk-choice-box-radio", value: item.value, disabled: item.disabled, children: _jsx(Primitive.Indicator, { forceMount: true, className: "vk-choice-dot" }) }) }, item.value));
|
|
40
13
|
}) })] }) }));
|
|
41
14
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type FocusEventHandler } from "react";
|
|
2
|
+
/** A durable, app-managed attachment; its link is persisted in the Markdown document. */
|
|
3
|
+
export interface RichTextAttachment {
|
|
4
|
+
name: string;
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
/** The application owns authentication and storage. Abort on signal when an attempt is canceled. */
|
|
8
|
+
export type RichTextUpload = (file: File, options: {
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
}) => Promise<RichTextAttachment>;
|
|
11
|
+
/** Unicode emoji and its localized accessible/search label. */
|
|
12
|
+
export interface RichTextEmoji {
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RichTextEditorProps {
|
|
17
|
+
/** Controlled CommonMark document. */
|
|
18
|
+
value?: string;
|
|
19
|
+
/** Initial CommonMark document for an uncontrolled editor. */
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
/** Emits canonical CommonMark after document changes; selection changes do not emit. */
|
|
22
|
+
onChange?: (markdown: string) => void;
|
|
23
|
+
/** Native form field name; submissions contain the Markdown string. */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** ID of the editable textbox, including when wired by Field. */
|
|
26
|
+
id?: string;
|
|
27
|
+
/** Prevent all changes, uploads and form submission of this field. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Keep the document readable/selectable, without editing or a toolbar. */
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
/** Full controls above the field, or a small action row with expandable formatting below. */
|
|
32
|
+
toolbar?: "full" | "minimal";
|
|
33
|
+
/** Native form validation focuses the editor when the Markdown field is empty. */
|
|
34
|
+
required?: boolean;
|
|
35
|
+
/** Hint shown inside an empty editor; supply a visible Field label too. */
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
/** Outer wrapper class. */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** Called when focus leaves the editable textbox. */
|
|
40
|
+
onBlur?: FocusEventHandler<HTMLDivElement>;
|
|
41
|
+
/** Enable attachments with an app-provided upload callback. */
|
|
42
|
+
onUploadAttachment?: RichTextUpload;
|
|
43
|
+
/** File chooser accept filter, for example "image/*,.pdf". Enforce server-side too. */
|
|
44
|
+
accept?: string;
|
|
45
|
+
/** Reject files larger than this byte count before calling the upload callback. */
|
|
46
|
+
maxFileSize?: number;
|
|
47
|
+
/** Override the built-in labeled Unicode emoji choices. */
|
|
48
|
+
emojiOptions?: readonly RichTextEmoji[];
|
|
49
|
+
/** Observe upload and callback-contract errors; the UI shows localized retry feedback. */
|
|
50
|
+
onUploadError?: (error: Error, file: File) => void;
|
|
51
|
+
/** Observe the existing upload state, for example to disable a surrounding Send action. */
|
|
52
|
+
onUploadPendingChange?: (pending: boolean) => void;
|
|
53
|
+
/** Accessible name when a visible Field does not provide one. */
|
|
54
|
+
"aria-label"?: string;
|
|
55
|
+
/** Visible label ID, set by Field. */
|
|
56
|
+
"aria-labelledby"?: string;
|
|
57
|
+
/** Hint/error IDs, set by Field. */
|
|
58
|
+
"aria-describedby"?: string;
|
|
59
|
+
/** Invalid state, set by Field. */
|
|
60
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling";
|
|
61
|
+
}
|
|
62
|
+
/** A ProseMirror editor with CommonMark persistence, formatting, Unicode emoji and attachment uploads. */
|
|
63
|
+
export declare const RichTextEditor: import("react").ForwardRefExoticComponent<RichTextEditorProps & import("react").RefAttributes<HTMLDivElement>>;
|