@glimstone/react 0.0.0-stage → 4.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/README.md +118 -2
- package/dist/AboutCard.d.ts +152 -0
- package/dist/AboutCard.js +82 -0
- package/dist/Badge.d.ts +47 -0
- package/dist/Badge.js +35 -0
- package/dist/Button.d.ts +54 -0
- package/dist/Button.js +52 -0
- package/dist/Card.d.ts +29 -0
- package/dist/Card.js +20 -0
- package/dist/CoffeeDialog.d.ts +17 -0
- package/dist/CoffeeDialog.js +9 -0
- package/dist/Combobox.d.ts +16 -0
- package/dist/Combobox.js +32 -0
- package/dist/ConfirmDialog.d.ts +29 -0
- package/dist/ConfirmDialog.js +15 -0
- package/dist/CryptoDonateDialog.d.ts +61 -0
- package/dist/CryptoDonateDialog.js +23 -0
- package/dist/DropdownListbox.d.ts +22 -0
- package/dist/DropdownListbox.js +182 -0
- package/dist/EmptyState.d.ts +19 -0
- package/dist/EmptyState.js +10 -0
- package/dist/IconTipButton.d.ts +18 -0
- package/dist/IconTipButton.js +13 -0
- package/dist/InfoBubble.d.ts +4 -0
- package/dist/InfoBubble.js +19 -0
- package/dist/NumberField.d.ts +16 -0
- package/dist/NumberField.js +18 -0
- package/dist/PaypalDialog.d.ts +51 -0
- package/dist/PaypalDialog.js +20 -0
- package/dist/ReadmeButton.d.ts +29 -0
- package/dist/ReadmeButton.js +27 -0
- package/dist/Select.d.ts +41 -0
- package/dist/Select.js +192 -0
- package/dist/Selector.d.ts +67 -0
- package/dist/Selector.js +128 -0
- package/dist/SidebarRow.d.ts +22 -0
- package/dist/SidebarRow.js +10 -0
- package/dist/Slider.d.ts +12 -0
- package/dist/Slider.js +18 -0
- package/dist/SubCard.d.ts +15 -0
- package/dist/SubCard.js +14 -0
- package/dist/Toast.d.ts +29 -0
- package/dist/Toast.js +24 -0
- package/dist/Toggle.d.ts +16 -0
- package/dist/Toggle.js +4 -0
- package/dist/UnavailableNotice.d.ts +15 -0
- package/dist/UnavailableNotice.js +12 -0
- package/dist/WindowBar.d.ts +24 -0
- package/dist/WindowBar.js +31 -0
- package/dist/glyphs.d.ts +22 -0
- package/dist/glyphs.js +30 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +28 -0
- package/dist/portalHue.d.ts +10 -0
- package/dist/portalHue.js +15 -0
- package/dist/useConfirm.d.ts +26 -0
- package/dist/useConfirm.js +39 -0
- package/dist/useLabelMode.d.ts +6 -0
- package/dist/useLabelMode.js +11 -0
- package/dist/usePaypalButtons.d.ts +15 -0
- package/dist/usePaypalButtons.js +42 -0
- package/dist/useTipBubble.d.ts +34 -0
- package/dist/useTipBubble.js +63 -0
- package/package.json +28 -4
package/dist/Combobox.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useState } from "react";
|
|
3
|
+
import * as combobox from "@zag-js/combobox";
|
|
4
|
+
import { normalizeProps, Portal, useMachine } from "@zag-js/react";
|
|
5
|
+
import { IconCheck, IconExpand } from "./glyphs.js";
|
|
6
|
+
export function Combobox({ label, hideLabel, options, value, onChange, placeholder, empty, toggleLabel, disabled }) {
|
|
7
|
+
const [shown, setShown] = useState(options);
|
|
8
|
+
const collection = combobox.collection({
|
|
9
|
+
items: shown,
|
|
10
|
+
itemToValue: (o) => o.value,
|
|
11
|
+
itemToString: (o) => o.label,
|
|
12
|
+
isItemDisabled: (o) => !!o.disabled,
|
|
13
|
+
});
|
|
14
|
+
const service = useMachine(combobox.machine, {
|
|
15
|
+
id: useId(),
|
|
16
|
+
collection,
|
|
17
|
+
value: value ? [value] : [],
|
|
18
|
+
placeholder,
|
|
19
|
+
disabled,
|
|
20
|
+
positioning: { sameWidth: true, gutter: 6 },
|
|
21
|
+
// Typing opens the list after the filter has run, so only a close may put
|
|
22
|
+
// the full list back.
|
|
23
|
+
onOpenChange: ({ open }) => !open && setShown(options),
|
|
24
|
+
onInputValueChange: ({ inputValue }) => {
|
|
25
|
+
const q = inputValue.toLocaleLowerCase();
|
|
26
|
+
setShown(options.filter((o) => o.label.toLocaleLowerCase().includes(q)));
|
|
27
|
+
},
|
|
28
|
+
onValueChange: (d) => onChange(d.value[0] ?? ""),
|
|
29
|
+
});
|
|
30
|
+
const api = combobox.connect(service, normalizeProps);
|
|
31
|
+
return (_jsxs("div", { ...api.getRootProps(), className: "glim-combobox", children: [_jsx("label", { ...api.getLabelProps(), className: hideLabel ? "glim-sr-only" : "glim-field-label", children: label }), _jsxs("div", { ...api.getControlProps(), className: "glim-combobox-control", children: [_jsx("input", { ...api.getInputProps(), className: "glim-combobox-input" }), _jsx("button", { ...api.getTriggerProps(), "aria-label": toggleLabel, className: "glim-combobox-toggle", children: _jsx("span", { className: "glim-select-indicator", "data-state": api.open ? "open" : "closed", children: _jsx(IconExpand, {}) }) })] }), _jsx(Portal, { children: _jsx("div", { ...api.getPositionerProps(), className: "glim-select-positioner", children: _jsxs("ul", { ...api.getContentProps(), className: "glim-select-content", children: [shown.length === 0 && _jsx("li", { className: "glim-select-empty", children: empty }), shown.map((item) => (_jsxs("li", { ...api.getItemProps({ item }), className: "glim-select-item", children: [_jsx("span", { ...api.getItemTextProps({ item }), children: item.label }), _jsx("span", { ...api.getItemIndicatorProps({ item }), className: "glim-select-check", children: _jsx(IconCheck, {}) })] }, item.value)))] }) }) })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
export interface ConfirmDialogProps {
|
|
3
|
+
/** A generic title such as "Confirm"; the call site's own text is `message`. */
|
|
4
|
+
title: string;
|
|
5
|
+
/** The question or explanation, also the dialog's accessible description. */
|
|
6
|
+
message: string;
|
|
7
|
+
confirmLabel: string;
|
|
8
|
+
/** Translation key behind `confirmLabel`, so the confirm button can pick
|
|
9
|
+
* a glyph. Optional: a caller passing a composed or data label has none. */
|
|
10
|
+
confirmLabelKey?: string;
|
|
11
|
+
cancelLabel: string;
|
|
12
|
+
/** A control the confirming action needs an answer to, such as "also remove
|
|
13
|
+
* X?", shown under the message so the question is asked in one window.
|
|
14
|
+
* Keep it to a switch or two. */
|
|
15
|
+
extra?: ReactNode;
|
|
16
|
+
/** Glyph for the confirm button. The action changes per call site, so no
|
|
17
|
+
* fixed key can name it; without one the button beside a glyphed Cancel
|
|
18
|
+
* looks unfinished. */
|
|
19
|
+
confirmGlyph?: ReactNode;
|
|
20
|
+
/** Accessible name for the header close button, separate from cancelLabel so
|
|
21
|
+
* the two controls are not announced alike. Leave it out and the button is
|
|
22
|
+
* not drawn, since a corner close beside Cancel reads as a second choice. */
|
|
23
|
+
closeLabel?: string;
|
|
24
|
+
onConfirm: () => void;
|
|
25
|
+
onCancel: () => void;
|
|
26
|
+
/** The dialog card's root DOM node, for useConfirm.tsx's focus trap. */
|
|
27
|
+
ref?: Ref<HTMLDivElement>;
|
|
28
|
+
}
|
|
29
|
+
export declare function ConfirmDialog({ title, message, confirmLabel, confirmLabelKey, confirmGlyph, extra, cancelLabel, closeLabel, onConfirm, onCancel, ref, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from "./Badge.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
import { IconCancel, IconClose } from "./glyphs.js";
|
|
5
|
+
export function ConfirmDialog({ title, message, confirmLabel, confirmLabelKey, confirmGlyph, extra, cancelLabel, closeLabel, onConfirm, onCancel, ref, }) {
|
|
6
|
+
return (_jsx("div", { className: "glim-modal-backdrop", onClick: (e) => {
|
|
7
|
+
if (e.target === e.currentTarget)
|
|
8
|
+
onCancel();
|
|
9
|
+
}, children: _jsxs("div", { ref: ref, role: "dialog", "aria-modal": "true", "aria-labelledby": "confirmdialog-title", "aria-describedby": "confirmdialog-message", className: "glim-modal-card", children: [_jsxs("div", { className: "glim-modal-head", children: [_jsx("h2", { id: "confirmdialog-title", className: "glim-modal-title", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: title }) }), closeLabel !== undefined && (_jsx(Button, { label: closeLabel, labelKey: "common.close", glyph: _jsx(IconClose, {}), tone: "neutral", onClick: onCancel, className: "glim-modal-close" }))] }), _jsxs("div", { className: "glim-modal-body", children: [_jsx("p", { id: "confirmdialog-message", className: "glim-modal-text", children: message }), extra !== undefined && _jsx("div", { className: "glim-modal-extra", children: extra })] }), _jsxs("div", { className: "glim-modal-foot", children: [_jsx(Button, { label: cancelLabel, labelKey: "common.cancel", glyph: _jsx(IconCancel, {}), tone: "neutral", autoFocus: true, onClick: onCancel }), _jsx(Button, { label: confirmLabel,
|
|
10
|
+
// `null` means no key: the action being confirmed has no fixed one.
|
|
11
|
+
labelKey: confirmLabelKey ?? null, glyph: confirmGlyph,
|
|
12
|
+
// Not red ("Destructive and confirmable actions"): the dialog's
|
|
13
|
+
// sentence is the warning, and neither button is recommended.
|
|
14
|
+
tone: "neutral", onClick: onConfirm })] })] }) }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
/** One address, and the chain it lives on. */
|
|
3
|
+
export interface CryptoNetwork {
|
|
4
|
+
/** Stable id, for the copy toast and for the app's own tests. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** The chain as a donor's wallet names it. */
|
|
7
|
+
name: string;
|
|
8
|
+
address: string;
|
|
9
|
+
/** One short line shown with the address, for what a donor has to know
|
|
10
|
+
* before sending. Already translated. */
|
|
11
|
+
note?: string;
|
|
12
|
+
}
|
|
13
|
+
/** One coin, and every chain it can be sent on. */
|
|
14
|
+
export interface CryptoCoin {
|
|
15
|
+
/** Stable id, and the key `renderMark` draws by. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** The ticker, on the tile under the mark. */
|
|
18
|
+
symbol: string;
|
|
19
|
+
/** The full name, for the accessible label. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Never empty, and every entry carries an address. */
|
|
22
|
+
networks: CryptoNetwork[];
|
|
23
|
+
/** The coin's own colour and the ink that holds on it, which its tile lights
|
|
24
|
+
* up in under the pointer ("Brand tiles"). The picked coin keeps the accent. */
|
|
25
|
+
tile?: {
|
|
26
|
+
color: string;
|
|
27
|
+
ink: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface CryptoDonateDialogProps {
|
|
31
|
+
/** The coins on offer. See the rule at the top of this file. */
|
|
32
|
+
coins: CryptoCoin[];
|
|
33
|
+
/** What is shown right now. The app owns this, so it can remember it. */
|
|
34
|
+
coin: CryptoCoin;
|
|
35
|
+
network: CryptoNetwork;
|
|
36
|
+
/** Picking a coin lands on that coin's first network rather than keeping the
|
|
37
|
+
* previous chain, which the donor never checked against the new coin. */
|
|
38
|
+
onPick: (coin: CryptoCoin, network: CryptoNetwork) => void;
|
|
39
|
+
text: {
|
|
40
|
+
title: string;
|
|
41
|
+
/** The app's appeal, the same in every giving window. */
|
|
42
|
+
appeal: string;
|
|
43
|
+
/** One sentence saying what to do: pick a currency and a network, then scan
|
|
44
|
+
* or copy. */
|
|
45
|
+
intro: string;
|
|
46
|
+
/** The label over the chain row ("Networks"). */
|
|
47
|
+
networks: string;
|
|
48
|
+
copyLabel: string;
|
|
49
|
+
closeLabel: string;
|
|
50
|
+
};
|
|
51
|
+
/** The address as a scannable square. */
|
|
52
|
+
renderQr?: (value: string) => ReactNode;
|
|
53
|
+
/** A coin's own mark. */
|
|
54
|
+
renderMark?: (coin: CryptoCoin) => ReactNode;
|
|
55
|
+
/** Copy the address and say so in a toast, in the app's own words. */
|
|
56
|
+
onCopy: (coin: CryptoCoin, network: CryptoNetwork) => void;
|
|
57
|
+
onClose: () => void;
|
|
58
|
+
/** The window's own card, for the app's Escape handling and focus trap. */
|
|
59
|
+
ref?: Ref<HTMLDivElement>;
|
|
60
|
+
}
|
|
61
|
+
export declare function CryptoDonateDialog({ coins, coin, network, onPick, text, renderQr, renderMark, onCopy, onClose, ref, }: CryptoDonateDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { hueVars } from "@glimstone/core";
|
|
3
|
+
import { Badge } from "./Badge.js";
|
|
4
|
+
import { Button } from "./Button.js";
|
|
5
|
+
import { useLabelMode } from "./useLabelMode.js";
|
|
6
|
+
export function CryptoDonateDialog({ coins, coin, network, onPick, text, renderQr, renderMark, onCopy, onClose, ref, }) {
|
|
7
|
+
// `reactive` shows both mark and ticker here: somebody searching a grid of
|
|
8
|
+
// coins should not have to hover every tile to find USDT.
|
|
9
|
+
const mode = useLabelMode("buttons");
|
|
10
|
+
const showMark = mode !== "text";
|
|
11
|
+
const showTicker = mode !== "glyph";
|
|
12
|
+
return (_jsx("div", { className: "glim-modal-backdrop", onClick: (e) => {
|
|
13
|
+
if (e.target === e.currentTarget)
|
|
14
|
+
onClose();
|
|
15
|
+
}, children: _jsxs("div", { ref: ref, tabIndex: -1, role: "dialog", "aria-modal": "true", "aria-labelledby": "cryptodonate-title", className: "glim-modal-card glim-modal-card--wide", children: [_jsx("div", { className: "glim-modal-head", children: _jsx("h2", { id: "cryptodonate-title", className: "glim-modal-title", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: text.title }) }) }), _jsxs("div", { className: "glim-give-body glim-give-body--scroll", children: [_jsx("p", { className: "glim-give-appeal", children: text.appeal }), _jsx("p", { className: "glim-give-intro", children: text.intro }), _jsxs("div", { className: "glim-give-well", children: [renderQr?.(network.address), _jsx("p", { dir: "ltr", className: "glim-give-address", children: network.address }), _jsx("div", { className: "glim-give-networks", role: "listbox", "aria-label": text.networks, children: coin.networks.map((n, i) => (_jsx("button", { type: "button", role: "option", "aria-selected": n.id === network.id, onClick: () => onPick(coin, n), style: hueVars(i), className: `glim-give-network glim-hue${n.id === network.id ? " glim-active" : ""}`, children: n.name }, n.id))) }), network.note && _jsx("p", { className: "glim-give-note", children: network.note }), _jsx(Button, { label: text.copyLabel, labelKey: "common.copy", tone: "accent", hueIndex: coins.findIndex((c) => c.id === coin.id), onClick: () => onCopy(coin, network) })] }), _jsx("div", { className: "glim-give-coins", role: "listbox", "aria-label": text.title, children: coins.map((c, i) => {
|
|
16
|
+
const picked = c.id === coin.id;
|
|
17
|
+
const lit = !picked && c.tile;
|
|
18
|
+
return (_jsxs("button", { type: "button", role: "option", "aria-selected": picked, "aria-label": `${c.name} (${c.symbol})`, title: c.name, onClick: () => onPick(c, c.networks[0]), style: {
|
|
19
|
+
...hueVars(i),
|
|
20
|
+
...(lit && { "--tile": c.tile.color, "--tile-ink": c.tile.ink }),
|
|
21
|
+
}, className: `glim-give-coin ${showTicker ? "glim-hue glim-hue-icon" : "glim-hue"} ${picked ? "glim-active" : lit ? "glim-brand-tile" : "glim-give-coin--plain"}`, children: [showMark && renderMark?.(c), showTicker && _jsx("span", { className: "glim-give-ticker", children: c.symbol })] }, c.id));
|
|
22
|
+
}) })] }), _jsx("div", { className: "glim-give-foot", children: _jsx(Button, { label: text.closeLabel, labelKey: "common.close", tone: "neutral", onClick: onClose }) })] }) }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from "react";
|
|
2
|
+
export interface DropdownListboxProps {
|
|
3
|
+
/** Whether the panel is mounted. The caller owns the trigger; only the
|
|
4
|
+
* panel is shared. */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Called when the panel dismisses itself (outside click, Escape, scroll,
|
|
7
|
+
* resize). Picking an option does not call it: a single-select list closes
|
|
8
|
+
* itself at the call site, a multi-select one stays open. */
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
/** The trigger, which anchors the panel and is exempt from the outside-click
|
|
11
|
+
* dismissal so clicking it does not close and reopen the list. */
|
|
12
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
13
|
+
/** Accessible name for the listbox, normally the same label the trigger
|
|
14
|
+
* carries. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** `aria-multiselectable`, for a checkbox multi-select list. */
|
|
17
|
+
multiselectable?: boolean;
|
|
18
|
+
/** The `role="option"` buttons. */
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** @deprecated Use Select, which keeps focus on its trigger and adds typeahead. */
|
|
22
|
+
export declare function DropdownListbox({ open, onClose, triggerRef, label, multiselectable, children, }: DropdownListboxProps): import("react").ReactPortal | null;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { computeBubblePosition } from "@glimstone/core";
|
|
5
|
+
import { usePortalHue } from "./portalHue.js";
|
|
6
|
+
// The `role="listbox"` panel a button-opens-a-list picker drops open. It is
|
|
7
|
+
// portalled to document.body, because a card with `overflow: hidden` clips an
|
|
8
|
+
// absolutely positioned panel whatever its z-index, and placed with
|
|
9
|
+
// computeBubblePosition, which clamps it into the viewport and flips it above
|
|
10
|
+
// the trigger when needed.
|
|
11
|
+
//
|
|
12
|
+
// The panel takes the trigger's width and is centred on it with
|
|
13
|
+
// `translateX(-50%)`, since computeBubblePosition returns the centre. Equal
|
|
14
|
+
// widths look start-aligned and need no RTL branch.
|
|
15
|
+
/** The gap to the trigger and the minimum distance from the viewport edge,
|
|
16
|
+
* 4px to match `mt-1`. */
|
|
17
|
+
const DROPDOWN_GAP = 4;
|
|
18
|
+
/** @deprecated Use Select, which keeps focus on its trigger and adds typeahead. */
|
|
19
|
+
export function DropdownListbox({ open, onClose, triggerRef, label, multiselectable, children, }) {
|
|
20
|
+
const panelRef = useRef(null);
|
|
21
|
+
const [pos, setPos] = useState(null);
|
|
22
|
+
// One focus move per opening, once the panel sits at its real coordinates.
|
|
23
|
+
const focusedOnOpen = useRef(false);
|
|
24
|
+
// Whether focus is inside the panel, tracked as it moves because it cannot be
|
|
25
|
+
// read at teardown.
|
|
26
|
+
const focusInsideRef = useRef(false);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!open)
|
|
29
|
+
focusedOnOpen.current = false;
|
|
30
|
+
}, [open]);
|
|
31
|
+
// Read through a ref so an inline onClose does not re-attach every listener
|
|
32
|
+
// on each render, which happens on every toggle in a multi-select list.
|
|
33
|
+
const onCloseRef = useRef(onClose);
|
|
34
|
+
onCloseRef.current = onClose;
|
|
35
|
+
// The next open re-measures instead of flashing at the old coordinates.
|
|
36
|
+
useLayoutEffect(() => {
|
|
37
|
+
if (!open)
|
|
38
|
+
setPos(null);
|
|
39
|
+
}, [open]);
|
|
40
|
+
// The portal leaves the trigger's rainbow subtree, so the panel copies the
|
|
41
|
+
// trigger's hue.
|
|
42
|
+
const hue = usePortalHue(open, triggerRef);
|
|
43
|
+
// Measured and placed before paint, so the panel never jumps from its
|
|
44
|
+
// off-screen parking spot.
|
|
45
|
+
useLayoutEffect(() => {
|
|
46
|
+
if (!open)
|
|
47
|
+
return;
|
|
48
|
+
const trigger = triggerRef.current;
|
|
49
|
+
const panel = panelRef.current;
|
|
50
|
+
if (!trigger || !panel)
|
|
51
|
+
return;
|
|
52
|
+
const rect = trigger.getBoundingClientRect();
|
|
53
|
+
// The width is written to the node before the height is read, because
|
|
54
|
+
// option labels wrap against it. `pos` receives the same value below.
|
|
55
|
+
panel.style.width = `${rect.width}px`;
|
|
56
|
+
const viewport = {
|
|
57
|
+
width: document.documentElement.clientWidth || window.innerWidth,
|
|
58
|
+
height: document.documentElement.clientHeight || window.innerHeight,
|
|
59
|
+
};
|
|
60
|
+
const { left, top } = computeBubblePosition(rect, { width: rect.width, height: panel.offsetHeight }, viewport, DROPDOWN_GAP);
|
|
61
|
+
// `children` is a dependency so a list that changes length while open is
|
|
62
|
+
// re-measured. Its identity changes on every render, so returning the
|
|
63
|
+
// previous object when nothing moved is what stops an endless loop.
|
|
64
|
+
setPos((prev) => prev && prev.left === left && prev.top === top && prev.width === rect.width
|
|
65
|
+
? prev
|
|
66
|
+
: { left, top, width: rect.width });
|
|
67
|
+
}, [open, triggerRef, children]);
|
|
68
|
+
// A fixed panel that has lost its trigger reads as broken, so an outside
|
|
69
|
+
// press, Escape, scroll or resize closes it. The panel itself is exempt from
|
|
70
|
+
// the outside press, or pressing an option would unmount the list before its
|
|
71
|
+
// click landed. The scroll listener captures on `window` to see nested
|
|
72
|
+
// scroll containers, and ignores scrolls inside the panel, which scrolls a
|
|
73
|
+
// long list itself.
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!open)
|
|
76
|
+
return;
|
|
77
|
+
function onPointerDown(e) {
|
|
78
|
+
const target = e.target;
|
|
79
|
+
if (panelRef.current?.contains(target))
|
|
80
|
+
return;
|
|
81
|
+
if (triggerRef.current?.contains(target))
|
|
82
|
+
return;
|
|
83
|
+
onCloseRef.current();
|
|
84
|
+
}
|
|
85
|
+
function onKeyDown(e) {
|
|
86
|
+
if (e.key === "Escape")
|
|
87
|
+
onCloseRef.current();
|
|
88
|
+
}
|
|
89
|
+
function onScroll(e) {
|
|
90
|
+
const target = e.target;
|
|
91
|
+
if (target instanceof Node && panelRef.current?.contains(target))
|
|
92
|
+
return;
|
|
93
|
+
onCloseRef.current();
|
|
94
|
+
}
|
|
95
|
+
function onResize() {
|
|
96
|
+
onCloseRef.current();
|
|
97
|
+
}
|
|
98
|
+
document.addEventListener("mousedown", onPointerDown);
|
|
99
|
+
document.addEventListener("keydown", onKeyDown);
|
|
100
|
+
window.addEventListener("scroll", onScroll, true);
|
|
101
|
+
window.addEventListener("resize", onResize);
|
|
102
|
+
return () => {
|
|
103
|
+
document.removeEventListener("mousedown", onPointerDown);
|
|
104
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
105
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
106
|
+
window.removeEventListener("resize", onResize);
|
|
107
|
+
};
|
|
108
|
+
}, [open, triggerRef]);
|
|
109
|
+
// The options are the caller's children, so they are found in the DOM by
|
|
110
|
+
// their role.
|
|
111
|
+
function options() {
|
|
112
|
+
const panel = panelRef.current;
|
|
113
|
+
if (!panel)
|
|
114
|
+
return [];
|
|
115
|
+
return Array.from(panel.querySelectorAll('[role="option"]'));
|
|
116
|
+
}
|
|
117
|
+
// Focus moves to the selected option on open, so a keyboard user reaches the
|
|
118
|
+
// list. It waits for `pos`: focusing an option parked at -9999px makes the
|
|
119
|
+
// browser scroll to it, and that scroll closes the panel.
|
|
120
|
+
useLayoutEffect(() => {
|
|
121
|
+
if (!open || !pos || focusedOnOpen.current)
|
|
122
|
+
return;
|
|
123
|
+
const opts = options();
|
|
124
|
+
if (opts.length === 0)
|
|
125
|
+
return;
|
|
126
|
+
const active = opts.find((o) => o.getAttribute("aria-selected") === "true") ?? opts[0];
|
|
127
|
+
focusedOnOpen.current = true;
|
|
128
|
+
active.scrollIntoView?.({ block: "nearest" });
|
|
129
|
+
active.focus();
|
|
130
|
+
}, [open, pos]);
|
|
131
|
+
// Focus returns to the trigger on close only if it was inside the panel; a
|
|
132
|
+
// click elsewhere has already put it where the user wants. By cleanup time
|
|
133
|
+
// the portal is gone and focus sits on <body>, hence the tracked flag. The
|
|
134
|
+
// panel's onBlur clears it only when focus leaves the panel, so arrowing
|
|
135
|
+
// between options keeps it.
|
|
136
|
+
useLayoutEffect(() => {
|
|
137
|
+
const trigger = triggerRef.current;
|
|
138
|
+
return () => {
|
|
139
|
+
if (focusInsideRef.current)
|
|
140
|
+
trigger?.focus();
|
|
141
|
+
focusInsideRef.current = false;
|
|
142
|
+
};
|
|
143
|
+
}, [open, triggerRef]);
|
|
144
|
+
// Arrows, Home and End move between options here so every listbox behaves
|
|
145
|
+
// alike. Enter and Space need nothing: the options are real buttons.
|
|
146
|
+
function onPanelKeyDown(e) {
|
|
147
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp" && e.key !== "Home" && e.key !== "End")
|
|
148
|
+
return;
|
|
149
|
+
const opts = options();
|
|
150
|
+
if (opts.length === 0)
|
|
151
|
+
return;
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
const at = opts.indexOf(document.activeElement);
|
|
154
|
+
let next;
|
|
155
|
+
if (e.key === "Home")
|
|
156
|
+
next = 0;
|
|
157
|
+
else if (e.key === "End")
|
|
158
|
+
next = opts.length - 1;
|
|
159
|
+
else {
|
|
160
|
+
const dir = e.key === "ArrowDown" ? 1 : -1;
|
|
161
|
+
next = at < 0 ? (dir === 1 ? 0 : opts.length - 1) : (at + dir + opts.length) % opts.length;
|
|
162
|
+
}
|
|
163
|
+
opts[next].scrollIntoView?.({ block: "nearest" });
|
|
164
|
+
opts[next].focus();
|
|
165
|
+
}
|
|
166
|
+
if (!open)
|
|
167
|
+
return null;
|
|
168
|
+
return createPortal(_jsx("div", { ref: panelRef, role: "listbox", onKeyDown: onPanelKeyDown, onFocus: () => {
|
|
169
|
+
focusInsideRef.current = true;
|
|
170
|
+
}, onBlur: (e) => {
|
|
171
|
+
if (!e.currentTarget.contains(e.relatedTarget))
|
|
172
|
+
focusInsideRef.current = false;
|
|
173
|
+
}, "aria-multiselectable": multiselectable ? "true" : undefined, "aria-label": label, className: `glim-listbox glim-fade${hue.className ? ` ${hue.className}` : ""}`, style: {
|
|
174
|
+
// Parked off-screen until measured, since the panel needs to be in the
|
|
175
|
+
// DOM at its real width to have a height.
|
|
176
|
+
left: pos?.left ?? -9999,
|
|
177
|
+
top: pos?.top ?? -9999,
|
|
178
|
+
width: pos?.width,
|
|
179
|
+
transform: "translateX(-50%)",
|
|
180
|
+
...(hue.style ?? {}),
|
|
181
|
+
}, children: children }), document.body);
|
|
182
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* What a list, table or panel shows when it holds nothing: a muted, oversized
|
|
4
|
+
* glyph, a title, an optional hint and an optional action. "Nothing here yet"
|
|
5
|
+
* and "nothing matches the filter" take the same shape with different words,
|
|
6
|
+
* so somebody is not sent looking for a filter that was never set.
|
|
7
|
+
*/
|
|
8
|
+
export declare function EmptyState({ glyph, title, hint, action, nested, }: {
|
|
9
|
+
/** The page's own glyph, so the empty state echoes the place it is on. */
|
|
10
|
+
glyph?: ReactNode;
|
|
11
|
+
/** What is missing, such as "No backups yet" or "No backups match the filter". */
|
|
12
|
+
title: string;
|
|
13
|
+
/** One line on how to get there; anything longer goes into a bubble or a window. */
|
|
14
|
+
hint?: string;
|
|
15
|
+
/** A Button that gets out of the empty state, such as "Add a backup" or "Clear the filter". */
|
|
16
|
+
action?: ReactNode;
|
|
17
|
+
/** It stands inside a card, which already provides the surface. */
|
|
18
|
+
nested?: boolean;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* What a list, table or panel shows when it holds nothing: a muted, oversized
|
|
4
|
+
* glyph, a title, an optional hint and an optional action. "Nothing here yet"
|
|
5
|
+
* and "nothing matches the filter" take the same shape with different words,
|
|
6
|
+
* so somebody is not sent looking for a filter that was never set.
|
|
7
|
+
*/
|
|
8
|
+
export function EmptyState({ glyph, title, hint, action, nested = false, }) {
|
|
9
|
+
return (_jsxs("div", { className: nested ? "glim-empty" : "glim-card glim-empty", children: [glyph && (_jsx("span", { className: "glim-empty-glyph", "aria-hidden": "true", children: glyph })), _jsx("p", { className: "glim-empty-title", children: title }), hint && _jsx("p", { className: "glim-empty-hint", children: hint }), action] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
export declare function IconTipButton({ tip, onClick, disabled, className, style, children, type, ariaPressed, ariaExpanded, }: {
|
|
3
|
+
/** The hover and focus explanation, and the button's `aria-label`. */
|
|
4
|
+
tip: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
/** `aria-pressed` for a trigger that toggles rather than acts once. Omitted,
|
|
9
|
+
* no attribute is rendered. */
|
|
10
|
+
ariaPressed?: boolean;
|
|
11
|
+
/** `aria-expanded` for a trigger that opens a disclosure panel. Omitted, no
|
|
12
|
+
* attribute is rendered. */
|
|
13
|
+
ariaExpanded?: boolean;
|
|
14
|
+
/** Inline style, so a hued Badge can set its `--item-hue*` properties. */
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
type?: "button" | "submit";
|
|
18
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTipBubble } from "./useTipBubble.js";
|
|
3
|
+
// An icon-only <button> whose accessible name and hover or focus explanation is
|
|
4
|
+
// a `.glim-bubble` tooltip rather than the native `title=` balloon. `tip` is
|
|
5
|
+
// required because an icon-only button has no other way to say what it does.
|
|
6
|
+
//
|
|
7
|
+
// Unlike Button, this control has no label to hide: a bare glyph in a box the
|
|
8
|
+
// caller sizes, with no width stage, no tone fill and no place in the label
|
|
9
|
+
// mode engine.
|
|
10
|
+
export function IconTipButton({ tip, onClick, disabled, className, style, children, type = "button", ariaPressed, ariaExpanded, }) {
|
|
11
|
+
const tooltip = useTipBubble(tip, disabled);
|
|
12
|
+
return (_jsxs(_Fragment, { children: [tooltip.wrap(_jsx("button", { ref: tooltip.ref, type: type, onClick: onClick, disabled: disabled, "aria-label": tip, "aria-pressed": ariaPressed, "aria-expanded": ariaExpanded, "aria-describedby": tooltip.describedBy, ...tooltip.handlers, className: className, style: style, children: children })), tooltip.bubble] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTipBubble } from "./useTipBubble.js";
|
|
3
|
+
// A neutral (i) icon beside a label that reveals a short help text on hover and
|
|
4
|
+
// keyboard focus. Explanations live here rather than as a permanent grey
|
|
5
|
+
// paragraph under the control. The icon never takes the accent colour, which
|
|
6
|
+
// means "active"; the bubble itself comes from useTipBubble.
|
|
7
|
+
//
|
|
8
|
+
// `onAccent` is for an icon inside a filled accent badge such as a card heading:
|
|
9
|
+
// it inherits the badge's --accent-contrast ink and drops the idle opacity, which
|
|
10
|
+
// has less margin on a busy fill.
|
|
11
|
+
export function InfoBubble({ tip, onAccent = false }) {
|
|
12
|
+
const tooltip = useTipBubble(tip);
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: tooltip.ref, "aria-label": tip, "aria-describedby": tooltip.describedBy, tabIndex: 0, ...tooltip.handlers,
|
|
14
|
+
// Inside a <label>, a click on a span is forwarded to the label's field,
|
|
15
|
+
// which takes focus and closes the bubble at once. stopPropagation does
|
|
16
|
+
// not stop the native forwarding; preventDefault does, and the span
|
|
17
|
+
// keeps the focus it took on mousedown.
|
|
18
|
+
onClick: (e) => e.preventDefault(), className: onAccent ? "glim-info-icon glim-info-icon--on-accent" : "glim-info-icon", children: _jsxs("svg", { viewBox: "0 0 16 16", width: "15", height: "15", fill: "none", "aria-hidden": "true", children: [_jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.3" }), _jsx("circle", { cx: "8", cy: "4.6", r: "0.9", fill: "currentColor" }), _jsx("path", { d: "M8 7v4.4", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })] }) }), tooltip.bubble] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ChangeEventHandler, type InputHTMLAttributes, type Ref } from "react";
|
|
2
|
+
export interface NumberFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
3
|
+
/** The bounds and the step. The steppers, the arrow keys and the wheel all
|
|
4
|
+
* go through the input's own stepUp(), so the range lives here alone. */
|
|
5
|
+
min?: number | string;
|
|
6
|
+
max?: number | string;
|
|
7
|
+
step?: number | string;
|
|
8
|
+
/** Called alike for typing, the arrow keys, the steppers and the wheel,
|
|
9
|
+
* which steps the value only while the field has focus. */
|
|
10
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
11
|
+
/** Classes for the input. A width set here has to be definite, since the
|
|
12
|
+
* arrows sit against the input's end. */
|
|
13
|
+
className?: string;
|
|
14
|
+
ref?: Ref<HTMLInputElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare function NumberField({ className, ref, ...rest }: NumberFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { attachNumberSteppers, syncNumberSteppers } from "@glimstone/core";
|
|
4
|
+
export function NumberField({ className = "", ref, ...rest }) {
|
|
5
|
+
const own = useRef(null);
|
|
6
|
+
useEffect(() => attachNumberSteppers(own.current), []);
|
|
7
|
+
// A value the app sets fires no input event, so the arrows look again.
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
syncNumberSteppers(own.current);
|
|
10
|
+
}, [rest.value, rest.min, rest.max, rest.step, rest.disabled, rest.readOnly]);
|
|
11
|
+
return (_jsx("span", { className: "glim-num-wrap", children: _jsx("input", { ...rest, ref: (el) => {
|
|
12
|
+
own.current = el;
|
|
13
|
+
if (typeof ref === "function")
|
|
14
|
+
ref(el);
|
|
15
|
+
else if (ref)
|
|
16
|
+
ref.current = el;
|
|
17
|
+
}, type: "number", className: `glim-num-input glim-num-field glim-num ${className}`.trim() }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReactNode, Ref, RefObject } from "react";
|
|
2
|
+
import type { GiveFrequency } from "@glimstone/core";
|
|
3
|
+
export interface PaypalSelectorProps {
|
|
4
|
+
labelledBy: string;
|
|
5
|
+
options: {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
/** Null when no segment is picked, as while a typed amount applies. */
|
|
10
|
+
value: string | null;
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface PaypalDialogProps {
|
|
14
|
+
text: {
|
|
15
|
+
title: string;
|
|
16
|
+
/** The app's appeal, the same in every giving window. */
|
|
17
|
+
appeal: string;
|
|
18
|
+
/** One sentence: the payment happens at PayPal, by account or by card. */
|
|
19
|
+
intro: string;
|
|
20
|
+
frequencyLabel: string;
|
|
21
|
+
frequencies: Record<GiveFrequency, string>;
|
|
22
|
+
amountLabel: string;
|
|
23
|
+
/** Placeholder and accessible name of the free amount. */
|
|
24
|
+
otherAmount: string;
|
|
25
|
+
loading: string;
|
|
26
|
+
thanks: string;
|
|
27
|
+
failed: string;
|
|
28
|
+
closeLabel: string;
|
|
29
|
+
};
|
|
30
|
+
frequency: GiveFrequency;
|
|
31
|
+
onFrequency: (frequency: GiveFrequency) => void;
|
|
32
|
+
/** The preset amounts, as whole numbers in the currency. */
|
|
33
|
+
amounts: string[];
|
|
34
|
+
currencySymbol: string;
|
|
35
|
+
/** The picked preset, or null while the free amount is in use. */
|
|
36
|
+
preset: string | null;
|
|
37
|
+
onPreset: (amount: string) => void;
|
|
38
|
+
typed: string;
|
|
39
|
+
/** Whether `typed` parses as an amount PayPal accepts. */
|
|
40
|
+
typedValid: boolean;
|
|
41
|
+
onTyped: (text: string) => void;
|
|
42
|
+
/** The app's own horizontal selector. */
|
|
43
|
+
renderSelector: (props: PaypalSelectorProps) => ReactNode;
|
|
44
|
+
/** From usePaypalButtons. */
|
|
45
|
+
buttonsRef: RefObject<HTMLDivElement | null>;
|
|
46
|
+
status: "idle" | "done" | "failed";
|
|
47
|
+
onClose: () => void;
|
|
48
|
+
/** The window's own card, for the app's Escape handling and focus trap. */
|
|
49
|
+
ref?: Ref<HTMLDivElement>;
|
|
50
|
+
}
|
|
51
|
+
export declare function PaypalDialog({ text, frequency, onFrequency, amounts, currencySymbol, preset, onPreset, typed, typedValid, onTyped, renderSelector, buttonsRef, status, onClose, ref, }: PaypalDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from "./Badge.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
export function PaypalDialog({ text, frequency, onFrequency, amounts, currencySymbol, preset, onPreset, typed, typedValid, onTyped, renderSelector, buttonsRef, status, onClose, ref, }) {
|
|
5
|
+
const frequencies = ["once", "month", "year"];
|
|
6
|
+
return (_jsx("div", { className: "glim-modal-backdrop", onClick: (e) => {
|
|
7
|
+
if (e.target === e.currentTarget)
|
|
8
|
+
onClose();
|
|
9
|
+
}, children: _jsxs("div", { ref: ref, tabIndex: -1, role: "dialog", "aria-modal": "true", "aria-labelledby": "paypal-window-title", className: "glim-modal-card glim-modal-card--wide", children: [_jsx("div", { className: "glim-modal-head", children: _jsx("h2", { id: "paypal-window-title", className: "glim-modal-title", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: text.title }) }) }), _jsxs("div", { className: "glim-give-body glim-give-body--scroll", children: [_jsx("p", { className: "glim-give-appeal", children: text.appeal }), _jsx("p", { className: "glim-give-intro", children: text.intro }), _jsxs("div", { className: "glim-give-group", children: [_jsx("span", { id: "paypal-frequency", className: "glim-eyebrow", children: text.frequencyLabel }), renderSelector({
|
|
10
|
+
labelledBy: "paypal-frequency",
|
|
11
|
+
options: frequencies.map((f) => ({ value: f, label: text.frequencies[f] })),
|
|
12
|
+
value: frequency,
|
|
13
|
+
onChange: (v) => onFrequency(v),
|
|
14
|
+
})] }), _jsxs("div", { className: "glim-give-group", children: [_jsx("span", { id: "paypal-amount", className: "glim-eyebrow", children: text.amountLabel }), _jsxs("div", { className: "glim-give-amounts", children: [_jsx("div", { children: renderSelector({
|
|
15
|
+
labelledBy: "paypal-amount",
|
|
16
|
+
options: amounts.map((a) => ({ value: a, label: `${a} ${currencySymbol}` })),
|
|
17
|
+
value: preset,
|
|
18
|
+
onChange: onPreset,
|
|
19
|
+
}) }), _jsx("input", { type: "text", inputMode: "decimal", value: typed, placeholder: text.otherAmount, "aria-label": text.otherAmount, "aria-invalid": typed !== "" && !typedValid, onChange: (e) => onTyped(e.target.value), className: `glim-give-amount${typedValid ? " glim-give-amount--valid" : ""}` })] })] }), _jsx("div", { ref: buttonsRef, className: "glim-give-wallet", children: _jsx("p", { className: "glim-give-loading", children: text.loading }) }), status === "done" && _jsx("p", { className: "glim-give-status glim-give-status--ok", children: text.thanks }), status === "failed" && _jsx("p", { className: "glim-give-status glim-give-status--fail", children: text.failed })] }), _jsx("div", { className: "glim-give-foot", children: _jsx(Button, { label: text.closeLabel, labelKey: "common.close", tone: "neutral", onClick: onClose }) })] }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type MouseEvent, type ReactNode } from "react";
|
|
2
|
+
import { type ReadmeBrand, type ReadmePart } from "@glimstone/core";
|
|
3
|
+
export type { ReadmeBrand, ReadmePart } from "@glimstone/core";
|
|
4
|
+
export interface ReadmeButtonProps {
|
|
5
|
+
/** The brand whose colour the unit lights up in. */
|
|
6
|
+
brand: ReadmeBrand;
|
|
7
|
+
/** The button, then its segments. */
|
|
8
|
+
parts: [ReadmePart, ...ReadmePart[]];
|
|
9
|
+
mark?: ReactNode;
|
|
10
|
+
/** The class that paints the mark at rest, such as `glim-windows-mark`. It
|
|
11
|
+
* sits on the mark's box, where the lit unit's ink can override it. */
|
|
12
|
+
markClass?: string;
|
|
13
|
+
/** A vendor's own button artwork, which replaces the first part's mark and words. */
|
|
14
|
+
art?: ReactNode;
|
|
15
|
+
/** The "(i)" at the end of the unit, for what the name cannot say. */
|
|
16
|
+
hint?: string;
|
|
17
|
+
/** Holds the second lines in view while one reports what it did, such as "Copied". */
|
|
18
|
+
note?: boolean;
|
|
19
|
+
/** The second line of a unit whose first part has neither `href` nor `onClick`. */
|
|
20
|
+
soonLabel?: string;
|
|
21
|
+
/** Runs on a click on a part's link, for an app whose webview has no browser
|
|
22
|
+
* behind it to open the address in. */
|
|
23
|
+
onLinkClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function ReadmeButton({ brand, parts, mark, markClass, art, hint, note, soonLabel, onLinkClick }: ReadmeButtonProps): import("react").JSX.Element;
|
|
26
|
+
/** A vendor mark kept as its own markup, from appMarks.ts. */
|
|
27
|
+
export declare function BrandMark({ svg }: {
|
|
28
|
+
svg: string;
|
|
29
|
+
}): import("react").JSX.Element;
|