@glimstone/react 4.3.7 → 4.4.1
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 +6 -1
- package/dist/AboutCard.d.ts +3 -1
- package/dist/AboutCard.js +6 -6
- package/dist/Badge.d.ts +8 -3
- package/dist/Badge.js +6 -6
- package/dist/BusyRing.d.ts +13 -0
- package/dist/BusyRing.js +6 -0
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +2 -1
- package/dist/Card.d.ts +3 -1
- package/dist/Card.js +2 -2
- package/dist/Checkbox.js +1 -1
- package/dist/CoffeeDialog.js +1 -1
- package/dist/ColorPicker.js +3 -3
- package/dist/Combobox.js +2 -1
- package/dist/ConfirmDialog.js +1 -1
- package/dist/ContextMenu.js +3 -3
- package/dist/CopyField.js +1 -1
- package/dist/CryptoDonateDialog.js +1 -1
- package/dist/DropdownListbox.js +4 -4
- package/dist/EmptyState.js +1 -1
- package/dist/FieldError.d.ts +8 -0
- package/dist/FieldError.js +9 -0
- package/dist/FieldRow.js +1 -1
- package/dist/FieldRowGroup.js +1 -1
- package/dist/Fortress.d.ts +112 -0
- package/dist/Fortress.js +164 -0
- package/dist/FortressAppCard.d.ts +39 -0
- package/dist/FortressAppCard.js +40 -0
- package/dist/FortressPermissions.d.ts +23 -0
- package/dist/FortressPermissions.js +34 -0
- package/dist/FortressStatusWindow.d.ts +24 -0
- package/dist/FortressStatusWindow.js +18 -0
- package/dist/GlyphField.js +1 -1
- package/dist/GlyphTile.js +1 -1
- package/dist/IconButton.js +2 -2
- package/dist/IconTipButton.js +1 -1
- package/dist/InfoBubble.js +1 -1
- package/dist/InstanceCard.d.ts +25 -0
- package/dist/InstanceCard.js +7 -0
- package/dist/Kbd.js +1 -1
- package/dist/ListRow.js +1 -1
- package/dist/ListTable.d.ts +21 -0
- package/dist/ListTable.js +74 -0
- package/dist/MenuBar.js +1 -1
- package/dist/Meter.js +1 -1
- package/dist/NumberField.d.ts +3 -1
- package/dist/NumberField.js +14 -11
- package/dist/PasswordField.d.ts +3 -1
- package/dist/PasswordField.js +8 -5
- package/dist/PathField.js +1 -1
- package/dist/PaypalDialog.js +1 -1
- package/dist/Pill.js +1 -1
- package/dist/Popover.d.ts +14 -0
- package/dist/Popover.js +19 -0
- package/dist/ProgressBar.js +1 -1
- package/dist/ReadmeButton.js +2 -2
- package/dist/RowMark.js +1 -1
- package/dist/Select.js +4 -4
- package/dist/Selector.js +1 -1
- package/dist/Sheet.d.ts +21 -0
- package/dist/Sheet.js +21 -0
- package/dist/SidebarRow.js +2 -2
- package/dist/SignInCard.js +2 -2
- package/dist/SkeletonRow.d.ts +10 -0
- package/dist/SkeletonRow.js +6 -0
- package/dist/Slider.js +1 -1
- package/dist/SubCard.d.ts +10 -8
- package/dist/SubCard.js +7 -7
- package/dist/Table.js +1 -1
- package/dist/TextField.d.ts +7 -3
- package/dist/TextField.js +12 -6
- package/dist/Toast.js +18 -11
- package/dist/Toggle.js +1 -1
- package/dist/Tree.js +1 -1
- package/dist/UnavailableNotice.js +1 -1
- package/dist/Window.d.ts +2 -15
- package/dist/Window.js +13 -15
- package/dist/WindowBar.js +1 -1
- package/dist/WindowFootRow.d.ts +25 -0
- package/dist/WindowFootRow.js +17 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/useConfirm.js +2 -2
- package/dist/useTipBubble.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -71,16 +71,21 @@ needs none of them.
|
|
|
71
71
|
| `ContextMenu`, `MenuBar` | A menu at a point and the row of menus in a head bar, with submenus, rows that tick a box, choices, key caps and counts. Opened with the pointer, the first row shows its ring only once a key is pressed |
|
|
72
72
|
| `Checkbox` | The drawn box for "Don't show again" and for choices applied together, `slim` for the box alone in a dense row. Every setting is a `Toggle` |
|
|
73
73
|
| `Kbd`, `Pill` | A key cap, and the quiet data pill of a list row |
|
|
74
|
-
| `TextField`, `TextArea` | A line of text and a few lines of text, borderless and filled, in the widths a row needs |
|
|
74
|
+
| `TextField`, `TextArea` | A line of text and a few lines of text, borderless and filled, in the widths a row needs, with `error` for a value they cannot take |
|
|
75
|
+
| `FieldError` | The line under a field whose value it cannot take, for an app's own field |
|
|
75
76
|
| `FieldRow`, `FieldRowGroup` | One labelled row: the name at its start with an "(i)", the control at its end, named by the row, or a lone value as a pill, and rows that share one column for their names. `useFieldName` gives an app's own control the same name |
|
|
76
77
|
| `GlyphField` | A field with a glyph inside it, such as a filter, and controls after it in the box |
|
|
77
78
|
| `Table` | A short list of facts in columns |
|
|
78
79
|
| `PasswordField`, `CopyField` | A secret with the reveal eye inside the field, and a value in monospace with a button that copies it |
|
|
80
|
+
| `Fortress`, `FortressPairing`, `InstanceCard`, `FortressAppCard`, `FortressPermissions` | The fortress in an app's Instances tab: the app's own cards as children, the switch for the other apps, a card per app with a row per instance, the permissions with a switch each, and the windows to join with the phrase, remove an instance and show the phrase beside its QR code. `FortressPairing` is the card in the pairing settings that changes the phrase and leaves |
|
|
79
81
|
| `SignInCard`, `SignInField` | The sign-in page: the app's logo and name, the password, a code when the app asks for one, a passkey and the reset form in the same card. The app's own fields, buttons and steps go into `fields`, `actions` and `step`, and `SignInField` gives a field of the app's own the label above it |
|
|
80
82
|
| `PathField`, `Tree` | A path with a button that asks the app for one, and a hierarchy loaded as it opens, for the picker behind that button |
|
|
81
83
|
| `ListRow`, `RowMark`, `GlyphTile` | One row of a list with a tile, badges and buttons that come in on hover, the round mark on a row picked for an action on many, and a small holder for a glyph |
|
|
84
|
+
| `ListTable` | The list of a list page: sorting by a click on a heading, a filter per column, a search that floats inside it, and rows picked as in a file manager |
|
|
82
85
|
| `IconButton` | A glyph in a square in every label mode, for a row that keeps its text, as a link with `href`, on or off with `pressed`, and `absent` to hold a missing button's place |
|
|
83
86
|
| `Meter`, `ProgressBar` | A level such as a disk's, red from a threshold and `quiet` for a footer line, and work toward its end with a sheen while it runs. Only the bar moves |
|
|
87
|
+
| `BusyRing`, `SkeletonRow` | The ring that turns while the app works on something, and a row that holds a list row's place while the list loads. Both show only after 400 ms |
|
|
88
|
+
| `Popover`, `Sheet` | A small panel beside its trigger in the top layer, and a panel at the end edge for a row's details, a `<dialog>` shown modal with a window's foot |
|
|
84
89
|
| `ColorPicker` | The square, the hue bar, a preview with the name the colour proposes, the hex field and Apply, in the page or floating beside its swatch |
|
|
85
90
|
| `useLabelMode`, `useTipBubble`, `usePortalHue` | The small hooks the components need |
|
|
86
91
|
| `glyphs` | The marks the components draw themselves, and `setGlyphResolver`, the seam an app registers its own icon set through |
|
package/dist/AboutCard.d.ts
CHANGED
|
@@ -106,9 +106,11 @@ export interface InfoTileProps {
|
|
|
106
106
|
about: Omit<InfoAboutCardProps, "hueIndex">;
|
|
107
107
|
/** The Version card's rainbow position; the cards after it take the next ones. */
|
|
108
108
|
hueIndex?: number;
|
|
109
|
+
/** Data attributes for the tile, so a component built on it can name itself. */
|
|
110
|
+
[data: `data-${string}`]: string | undefined;
|
|
109
111
|
}
|
|
110
112
|
/** The Info tile's cards in their fixed order, for the page that stacks them. */
|
|
111
|
-
export declare function InfoTile({ version, help, about, hueIndex }: InfoTileProps): import("react").JSX.Element;
|
|
113
|
+
export declare function InfoTile({ version, help, about, hueIndex, ...data }: InfoTileProps): import("react").JSX.Element;
|
|
112
114
|
/**
|
|
113
115
|
* The 3.2.0 props of the single About card, laid out as the Info tile: the
|
|
114
116
|
* About card under `text.title`, the Version card under `text.version` with the
|
package/dist/AboutCard.js
CHANGED
|
@@ -6,12 +6,12 @@ import { Card } from "./Card.js";
|
|
|
6
6
|
import { ReadmeButton } from "./ReadmeButton.js";
|
|
7
7
|
/** The last card of the Info tile: who made the app, then the give row. */
|
|
8
8
|
export function InfoAboutCard({ text, onCoffee, coffeeArt, onPaypal, paypalGlyph, onCrypto, cryptoGlyph, hueIndex, }) {
|
|
9
|
-
return (_jsxs(Card, { title: text.title, hueIndex: hueIndex, children: [_jsx("p", { className: "glim-info-text", children: text.body }), _jsx("p", { className: "glim-info-text", children: text.coffee }), _jsxs("div", { className: "glim-readme-btn-rows glim-about-give", children: [_jsx(ReadmeButton, { brand: "coffee", parts: [{ name: text.coffeeButton, onClick: onCoffee }], art: coffeeArt }), onPaypal && text.paypalButton && (_jsx(ReadmeButton, { brand: "paypal", parts: [{ name: text.paypalButton, onClick: onPaypal }], mark: paypalGlyph, markClass: "glim-paypal-mark" })), onCrypto && text.cryptoButton && (_jsx(ReadmeButton, { brand: "bitcoin", parts: [{ name: text.cryptoButton, onClick: onCrypto }], mark: cryptoGlyph, markClass: "glim-bitcoin-mark" }))] })] }));
|
|
9
|
+
return (_jsxs(Card, { "data-glim": "InfoAboutCard", title: text.title, hueIndex: hueIndex, children: [_jsx("p", { className: "glim-info-text", children: text.body }), _jsx("p", { className: "glim-info-text", children: text.coffee }), _jsxs("div", { className: "glim-readme-btn-rows glim-about-give", children: [_jsx(ReadmeButton, { brand: "coffee", parts: [{ name: text.coffeeButton, onClick: onCoffee }], art: coffeeArt }), onPaypal && text.paypalButton && (_jsx(ReadmeButton, { brand: "paypal", parts: [{ name: text.paypalButton, onClick: onPaypal }], mark: paypalGlyph, markClass: "glim-paypal-mark" })), onCrypto && text.cryptoButton && (_jsx(ReadmeButton, { brand: "bitcoin", parts: [{ name: text.cryptoButton, onClick: onCrypto }], mark: cryptoGlyph, markClass: "glim-bitcoin-mark" }))] })] }));
|
|
10
10
|
}
|
|
11
11
|
/** The first card: every version as a row, and the New or Release notes button and the update check under them. */
|
|
12
12
|
export function InfoVersionCard({ text, rows, updateCheck, onReleaseNotes, whatsNew, openUrl = openInBrowser, hueIndex, }) {
|
|
13
13
|
const notes = !whatsNew && onReleaseNotes && text.releaseNotes;
|
|
14
|
-
return (_jsxs(Card, { title: text.title, hint: text.hint, hueIndex: hueIndex, children: [_jsx("ul", { className: "glim-version-rows", children: rows.map((row) => (_jsxs("li", { className: "glim-version-row", children: [_jsxs("span", { className: "glim-version-name", children: [_jsx("span", { className: "glim-version-part", children: row.name }), row.sub && _jsx("span", { className: "glim-version-sub", children: row.sub })] }), _jsx(VersionNumber, { row: row, unreleased: text.unreleased, openUrl: openUrl })] }, row.name))) }), (notes || whatsNew || updateCheck) && (_jsxs("div", { className: "glim-version-actions", children: [notes && _jsx(Button, { label: notes, labelKey: "about.releaseNotes", onClick: onReleaseNotes }), whatsNew, updateCheck && _jsx(UpdateCheckButton, { ...updateCheck })] }))] }));
|
|
14
|
+
return (_jsxs(Card, { "data-glim": "InfoVersionCard", title: text.title, hint: text.hint, hueIndex: hueIndex, children: [_jsx("ul", { className: "glim-version-rows", children: rows.map((row) => (_jsxs("li", { className: "glim-version-row", children: [_jsxs("span", { className: "glim-version-name", children: [_jsx("span", { className: "glim-version-part", children: row.name }), row.sub && _jsx("span", { className: "glim-version-sub", children: row.sub })] }), _jsx(VersionNumber, { row: row, unreleased: text.unreleased, openUrl: openUrl })] }, row.name))) }), (notes || whatsNew || updateCheck) && (_jsxs("div", { className: "glim-version-actions", children: [notes && _jsx(Button, { label: notes, labelKey: "about.releaseNotes", onClick: onReleaseNotes }), whatsNew, updateCheck && _jsx(UpdateCheckButton, { ...updateCheck })] }))] }));
|
|
15
15
|
}
|
|
16
16
|
/** The update check shows its verdict on itself, like a test button. */
|
|
17
17
|
function UpdateCheckButton(check) {
|
|
@@ -40,7 +40,7 @@ function VersionNumber({ row, unreleased, openUrl }) {
|
|
|
40
40
|
/** The second card: a sentence inviting a report, then GitHub, Email, the manual and the bug report. */
|
|
41
41
|
export function InfoHelpCard({ text, repoUrl, repoGlyph, mailAddress, mailGlyph, manualUrl, manualGlyph, onBugReport, bugGlyph, openUrl = openInBrowser, hueIndex, }) {
|
|
42
42
|
const wantsMail = offersMail(text.report, mailAddress);
|
|
43
|
-
return (_jsxs(Card, { title: text.title, hint: text.hint, hueIndex: hueIndex, children: [_jsx("p", { className: "glim-info-text", children: text.report }), _jsxs("div", { className: "glim-readme-btn-rows", children: [_jsx(ReadmeButton, { brand: "github", parts: [{ name: text.repoButton, onClick: () => openUrl(repoUrl) }], mark: repoGlyph, markClass: "glim-github-mark" }), wantsMail && (_jsx(ReadmeButton, { brand: "house", parts: [
|
|
43
|
+
return (_jsxs(Card, { "data-glim": "InfoHelpCard", title: text.title, hint: text.hint, hueIndex: hueIndex, children: [_jsx("p", { className: "glim-info-text", children: text.report }), _jsxs("div", { className: "glim-readme-btn-rows", children: [_jsx(ReadmeButton, { brand: "github", parts: [{ name: text.repoButton, onClick: () => openUrl(repoUrl) }], mark: repoGlyph, markClass: "glim-github-mark" }), wantsMail && (_jsx(ReadmeButton, { brand: "house", parts: [
|
|
44
44
|
{
|
|
45
45
|
name: text.mailButton,
|
|
46
46
|
onClick: () => openUrl(mailHref(mailAddress, text.mailSubject)),
|
|
@@ -48,9 +48,9 @@ export function InfoHelpCard({ text, repoUrl, repoGlyph, mailAddress, mailGlyph,
|
|
|
48
48
|
], mark: mailGlyph, markClass: "glim-house-mark" })), manualUrl && text.manual && (_jsx(ReadmeButton, { brand: "docs", parts: [{ name: text.manual, sub: text.manualSub, onClick: () => openUrl(manualUrl) }], mark: manualGlyph, markClass: "glim-docs-mark" })), onBugReport && text.bugReport && (_jsx(ReadmeButton, { brand: "github", parts: [{ name: text.bugReport, sub: text.bugReportSub, onClick: onBugReport }], mark: bugGlyph }))] })] }));
|
|
49
49
|
}
|
|
50
50
|
/** The Info tile's cards in their fixed order, for the page that stacks them. */
|
|
51
|
-
export function InfoTile({ version, help, about, hueIndex }) {
|
|
51
|
+
export function InfoTile({ version, help, about, hueIndex, ...data }) {
|
|
52
52
|
const at = (offset) => (hueIndex === undefined ? undefined : hueIndex + offset);
|
|
53
|
-
return (_jsxs(
|
|
53
|
+
return (_jsxs("div", { "data-glim": "InfoTile", ...data, style: { display: "contents" }, children: [_jsx(InfoVersionCard, { ...version, hueIndex: at(0) }), _jsx(InfoHelpCard, { ...help, hueIndex: at(1) }), _jsx(InfoAboutCard, { ...about, hueIndex: at(2) })] }));
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* The 3.2.0 props of the single About card, laid out as the Info tile: the
|
|
@@ -65,7 +65,7 @@ export function AboutCard({ text, version, glimstoneVersion, repoUrl, repoGlyph,
|
|
|
65
65
|
...(version ? [{ name: text.version, version, repoUrl }] : []),
|
|
66
66
|
{ name: "GlimStone", version: glimstoneVersion, repoUrl: glimstoneRepoUrl },
|
|
67
67
|
];
|
|
68
|
-
return (_jsx(InfoTile, { hueIndex: hueIndex, about: { text, onCoffee, coffeeArt, onPaypal, paypalGlyph, onCrypto, cryptoGlyph }, version: { text: { title: text.version, unreleased: text.unreleased }, rows, openUrl }, help: {
|
|
68
|
+
return (_jsx(InfoTile, { "data-glim": "AboutCard", hueIndex: hueIndex, about: { text, onCoffee, coffeeArt, onPaypal, paypalGlyph, onCrypto, cryptoGlyph }, version: { text: { title: text.version, unreleased: text.unreleased }, rows, openUrl }, help: {
|
|
69
69
|
text: {
|
|
70
70
|
title: text.helpTitle,
|
|
71
71
|
report: text.report,
|
package/dist/Badge.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { type BadgeShape, type BadgeSize, type BadgeTone, type NotchInset } from "@glimstone/core";
|
|
3
|
-
export type { BadgeShape, BadgeSize, BadgeTone, NotchInset } from "@glimstone/core";
|
|
2
|
+
import { type BadgeForm, type BadgeShape, type BadgeSize, type BadgeTone, type NotchInset } from "@glimstone/core";
|
|
3
|
+
export type { BadgeForm, BadgeShape, BadgeSize, BadgeTone, NotchInset } from "@glimstone/core";
|
|
4
4
|
export interface BadgeProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
/** Status colour. Defaults to the neutral chip. */
|
|
@@ -8,6 +8,11 @@ export interface BadgeProps {
|
|
|
8
8
|
/** Size stage; see badgeClassName in the core. A square icon-only badge is always
|
|
9
9
|
* `"icon"`. */
|
|
10
10
|
size?: BadgeSize;
|
|
11
|
+
/** The corners: rounded, square, pill or circle. Without it they follow the
|
|
12
|
+
* shape setting. */
|
|
13
|
+
form?: BadgeForm;
|
|
14
|
+
/** @deprecated Use `form`. Only "circle" has an effect: it makes the badge
|
|
15
|
+
* icon-only. */
|
|
11
16
|
shape?: BadgeShape;
|
|
12
17
|
/** Render as a <button> or a real <a href>, with the same box as a span. */
|
|
13
18
|
as?: "span" | "button" | "a";
|
|
@@ -44,4 +49,4 @@ export interface BadgeProps {
|
|
|
44
49
|
* badge in normal flow is a `tone="heading"` badge at another size. */
|
|
45
50
|
inFlow?: boolean;
|
|
46
51
|
}
|
|
47
|
-
export declare function Badge({ children, tone, size, shape, as, onClick, disabled, title, ariaLabel, href, target, rel, wrap, className, hueIndex, tip, insetStart, inFlow, }: BadgeProps): import("react").JSX.Element;
|
|
52
|
+
export declare function Badge({ children, tone, size, form, shape, as, onClick, disabled, title, ariaLabel, href, target, rel, wrap, className, hueIndex, tip, insetStart, inFlow, }: BadgeProps): import("react").JSX.Element;
|
package/dist/Badge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { badgeClassName, hueVars } from "@glimstone/core";
|
|
3
3
|
import { IconTipButton } from "./IconTipButton.js";
|
|
4
|
-
export function Badge({ children, tone = "neutral", size = "medium", shape
|
|
4
|
+
export function Badge({ children, tone = "neutral", size = "medium", form, shape, as = "span", onClick, disabled, title, ariaLabel, href, target, rel, wrap, className, hueIndex, tip, insetStart, inFlow, }) {
|
|
5
5
|
// No rainbow subscription: Badge holds no hooks so a test can call it as a
|
|
6
6
|
// plain function, and hueVars points at the root's colours, so a palette
|
|
7
7
|
// change reaches the badge without a render.
|
|
@@ -16,7 +16,7 @@ export function Badge({ children, tone = "neutral", size = "medium", shape = "ro
|
|
|
16
16
|
const classes = [
|
|
17
17
|
hueOn && "glim-hue",
|
|
18
18
|
isNotchHue && "glim-notch-hue",
|
|
19
|
-
badgeClassName({ tone, size, shape, wrap, iconOnly: tip !== undefined, inFlow, insetStart, action: as !== "span" }),
|
|
19
|
+
badgeClassName({ tone, size, form, shape, wrap, iconOnly: tip !== undefined, inFlow, insetStart, action: as !== "span" }),
|
|
20
20
|
className,
|
|
21
21
|
]
|
|
22
22
|
.filter(Boolean)
|
|
@@ -24,12 +24,12 @@ export function Badge({ children, tone = "neutral", size = "medium", shape = "ro
|
|
|
24
24
|
const hueStyle = hueOn ? hueVars(hueIndex) : undefined;
|
|
25
25
|
if (as === "button") {
|
|
26
26
|
if (tip !== undefined) {
|
|
27
|
-
return (_jsx(IconTipButton, { tip: tip, onClick: onClick, disabled: disabled, style: hueStyle, className: classes, children: children }));
|
|
27
|
+
return (_jsx(IconTipButton, { "data-glim": "Badge", tip: tip, onClick: onClick, disabled: disabled, style: hueStyle, className: classes, children: children }));
|
|
28
28
|
}
|
|
29
|
-
return (_jsx("button", { type: "button", onClick: onClick, disabled: disabled, title: title, "aria-label": ariaLabel, style: hueStyle, className: classes, children: children }));
|
|
29
|
+
return (_jsx("button", { "data-glim": "Badge", type: "button", onClick: onClick, disabled: disabled, title: title, "aria-label": ariaLabel, style: hueStyle, className: classes, children: children }));
|
|
30
30
|
}
|
|
31
31
|
if (as === "a") {
|
|
32
|
-
return (_jsx("a", { href: href, target: target, rel: rel, title: title, "aria-label": ariaLabel, style: hueStyle, className: classes, children: children }));
|
|
32
|
+
return (_jsx("a", { "data-glim": "Badge", href: href, target: target, rel: rel, title: title, "aria-label": ariaLabel, style: hueStyle, className: classes, children: children }));
|
|
33
33
|
}
|
|
34
|
-
return (_jsx("span", { title: title, "aria-label": ariaLabel, style: hueStyle, className: classes, children: children }));
|
|
34
|
+
return (_jsx("span", { "data-glim": "Badge", title: title, "aria-label": ariaLabel, style: hueStyle, className: classes, children: children }));
|
|
35
35
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type BusyRingSize } from "@glimstone/core";
|
|
2
|
+
export type { BusyRingSize } from "@glimstone/core";
|
|
3
|
+
export interface BusyRingProps {
|
|
4
|
+
/** `small` fits a button's glyph slot, `large` a card that waits. */
|
|
5
|
+
size?: BusyRingSize;
|
|
6
|
+
/** What is being waited for. With it the ring is a status that says so, without
|
|
7
|
+
* it the ring is hidden from assistive technology and its surroundings speak. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Milliseconds before it shows; 0 shows it at once. */
|
|
10
|
+
delay?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function BusyRing({ size, label, delay, className }: BusyRingProps): import("react").JSX.Element;
|
package/dist/BusyRing.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { busyRingView } from "@glimstone/core";
|
|
3
|
+
export function BusyRing({ size, label, delay, className }) {
|
|
4
|
+
const view = busyRingView({ size, delay });
|
|
5
|
+
return (_jsxs("span", { "data-glim": "BusyRing", role: label ? "status" : undefined, "aria-hidden": label ? undefined : true, className: className ? `${view.className} ${className}` : view.className, style: view.style, children: [_jsx("span", { className: "glim-busy-ring-arc", children: _jsx("span", { className: "glim-busy-ring-tail" }) }), _jsx("span", { className: "glim-busy-ring-arc glim-busy-ring-arc--inner", children: _jsx("span", { className: "glim-busy-ring-tail" }) }), label && _jsx("span", { className: "glim-sr-only", children: label })] }));
|
|
6
|
+
}
|
package/dist/Button.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
|
|
|
42
42
|
hueIndex?: number;
|
|
43
43
|
/** Forwarded to the underlying <button>, so a dialog can move focus to it. */
|
|
44
44
|
ref?: Ref<HTMLButtonElement>;
|
|
45
|
-
/** Shows
|
|
45
|
+
/** Shows the busy ring in place of the glyph, at once. Separate from `disabled`, since a
|
|
46
46
|
* caller may want one without the other. */
|
|
47
47
|
busy?: boolean;
|
|
48
48
|
/** For a dialog that opens with focus on one of its buttons. */
|
package/dist/Button.js
CHANGED
|
@@ -3,6 +3,7 @@ import { useSyncExternalStore } from "react";
|
|
|
3
3
|
import { buttonView, mediaMatches, narrowerThan, subscribeMedia, takePageHue } from "@glimstone/core";
|
|
4
4
|
import { useLabelMode } from "./useLabelMode.js";
|
|
5
5
|
import { useTipBubble } from "./useTipBubble.js";
|
|
6
|
+
import { BusyRing } from "./BusyRing.js";
|
|
6
7
|
import { glyphFor, IconClose } from "./glyphs.js";
|
|
7
8
|
export function Button({ label, labelKey, glyph, onClick, tone = "neutral", variant = "default", disabled = false, type = "button", className = "", title, hueIndex, busy = false, autoFocus = false, stage: stageOverride, keepLabel = false, compact = false, compactBelow, size, href, before, after, ref, ...rest }) {
|
|
8
9
|
const mode = useLabelMode("buttons");
|
|
@@ -40,7 +41,7 @@ export function Button({ label, labelKey, glyph, onClick, tone = "neutral", vari
|
|
|
40
41
|
},
|
|
41
42
|
}
|
|
42
43
|
: tooltip.handlers;
|
|
43
|
-
return (_jsxs(_Fragment, { children: [tooltip.wrap(_jsxs(Element, { ...rest, ...own, ref: mergeRefs(ref, tooltip.ref), onClick: onClick, "aria-busy": busy || undefined, "aria-describedby": tooltip.describedBy, ...handlers, style: view.style, className: `${view.className} ${className}`.trim(), children: [before, view.showGlyph && (_jsx("span", { className: "glim-btn-glyph", children: busy ? _jsx(
|
|
44
|
+
return (_jsxs(_Fragment, { children: [tooltip.wrap(_jsxs(Element, { "data-glim": "Button", ...rest, ...own, ref: mergeRefs(ref, tooltip.ref), onClick: onClick, "aria-busy": busy || undefined, "aria-describedby": tooltip.describedBy, ...handlers, style: view.style, className: `${view.className} ${className}`.trim(), children: [before, view.showGlyph && (_jsx("span", { className: "glim-btn-glyph", children: busy ? _jsx(BusyRing, { size: "small", delay: 0 }) : resolved })), _jsx("span", { className: view.labelClass, children: label }), after] })), tooltip.bubble] }));
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
46
47
|
* Feeds one element to both the caller's `ref`, a callback or an object, and
|
package/dist/Card.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { ReactNode } from "react";
|
|
|
12
12
|
*
|
|
13
13
|
* A card with neither `title` nor `hint` draws no heading.
|
|
14
14
|
*/
|
|
15
|
-
export declare function Card({ title, drawn, hint, children, hueIndex, nested, }: {
|
|
15
|
+
export declare function Card({ title, drawn, hint, children, hueIndex, nested, ...data }: {
|
|
16
16
|
/** The section name. Omit it where a control inside already carries the same
|
|
17
17
|
* name; the badge still renders to keep the card's hue notch. */
|
|
18
18
|
title?: string;
|
|
@@ -28,4 +28,6 @@ export declare function Card({ title, drawn, hint, children, hueIndex, nested, }
|
|
|
28
28
|
/** This card sits inside another card that already provides the surface and
|
|
29
29
|
* the padding. */
|
|
30
30
|
nested?: boolean;
|
|
31
|
+
/** Data attributes for the box, so a component built on the card can name itself. */
|
|
32
|
+
[data: `data-${string}`]: string | undefined;
|
|
31
33
|
}): import("react").JSX.Element;
|
package/dist/Card.js
CHANGED
|
@@ -15,6 +15,6 @@ import { InfoBubble } from "./InfoBubble.js";
|
|
|
15
15
|
*
|
|
16
16
|
* A card with neither `title` nor `hint` draws no heading.
|
|
17
17
|
*/
|
|
18
|
-
export function Card({ title, drawn, hint, children, hueIndex, nested, }) {
|
|
19
|
-
return (_jsxs("div", { className: `glim-panel glim-notch-card${nested ? " glim-panel--nested" : ""}${hueIndex !== undefined ? " glim-hue" : ""}`, style: hueIndex !== undefined ? hueVars(hueIndex) : undefined, children: [(title || drawn || hint) && (_jsx("h2", { className: "glim-panel-heading", children: _jsxs(Badge, { tone: "heading", size: "heading", wrap: true, hueIndex: hueIndex, children: [drawn ?? title, hint && _jsx(InfoBubble, { tip: hint, onAccent: true })] }) })), children] }));
|
|
18
|
+
export function Card({ title, drawn, hint, children, hueIndex, nested, ...data }) {
|
|
19
|
+
return (_jsxs("div", { "data-glim": "Card", "data-glim-title": title, ...data, className: `glim-panel glim-notch-card${nested ? " glim-panel--nested" : ""}${hueIndex !== undefined ? " glim-hue" : ""}`, style: hueIndex !== undefined ? hueVars(hueIndex) : undefined, children: [(title || drawn || hint) && (_jsx("h2", { className: "glim-panel-heading", children: _jsxs(Badge, { tone: "heading", size: "heading", wrap: true, hueIndex: hueIndex, children: [drawn ?? title, hint && _jsx(InfoBubble, { tip: hint, onAccent: true })] }) })), children] }));
|
|
20
20
|
}
|
package/dist/Checkbox.js
CHANGED
|
@@ -3,5 +3,5 @@ import { IconCheck } from "./glyphs.js";
|
|
|
3
3
|
export function Checkbox({ checked, onChange, label, hideLabel = false, slim = false, disabled, className }) {
|
|
4
4
|
const bare = hideLabel || slim;
|
|
5
5
|
const classes = ["glim-checkbox", slim && "glim-checkbox--slim", className].filter(Boolean).join(" ");
|
|
6
|
-
return (_jsxs("button", { type: "button", role: "checkbox", "aria-checked": checked, "aria-label": bare ? label : undefined, disabled: disabled, onClick: () => onChange(!checked), className: classes, children: [_jsx("span", { className: "glim-checkbox-box", "aria-hidden": "true", children: _jsx(IconCheck, {}) }), !bare && _jsx("span", { children: label })] }));
|
|
6
|
+
return (_jsxs("button", { "data-glim": "Checkbox", type: "button", role: "checkbox", "aria-checked": checked, "aria-label": bare ? label : undefined, disabled: disabled, onClick: () => onChange(!checked), className: classes, children: [_jsx("span", { className: "glim-checkbox-box", "aria-hidden": "true", children: _jsx(IconCheck, {}) }), !bare && _jsx("span", { children: label })] }));
|
|
7
7
|
}
|
package/dist/CoffeeDialog.js
CHANGED
|
@@ -5,5 +5,5 @@ export function CoffeeDialog({ widgetUrl, text, onClose, ref }) {
|
|
|
5
5
|
return (_jsx("div", { className: "glim-modal-backdrop", onClick: (e) => {
|
|
6
6
|
if (e.target === e.currentTarget)
|
|
7
7
|
onClose();
|
|
8
|
-
}, children: _jsxs("div", { ref: ref, tabIndex: -1, role: "dialog", "aria-modal": "true", "aria-labelledby": "coffee-title", className: "glim-modal-card glim-modal-card--wide glim-modal-card--tall", children: [_jsx("div", { className: "glim-modal-head", children: _jsx("h2", { id: "coffee-title", className: "glim-modal-title", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: text.title }) }) }), _jsxs("div", { className: "glim-give-body", children: [_jsx("p", { className: "glim-give-appeal", children: text.appeal }), _jsx("p", { className: "glim-give-intro", children: text.intro }), _jsx("div", { className: "glim-give-frame", children: _jsx("iframe", { src: widgetUrl, title: text.title, allow: "payment", className: "glim-give-iframe" }) })] }), _jsx("div", { className: "glim-give-foot", children: _jsx(Button, { label: text.closeLabel, labelKey: "common.close", tone: "neutral", onClick: onClose }) })] }) }));
|
|
8
|
+
}, children: _jsxs("div", { "data-glim": "CoffeeDialog", "data-glim-title": text.title, ref: ref, tabIndex: -1, role: "dialog", "aria-modal": "true", "aria-labelledby": "coffee-title", className: "glim-modal-card glim-modal-card--wide glim-modal-card--tall", children: [_jsx("div", { className: "glim-modal-head", children: _jsx("h2", { id: "coffee-title", className: "glim-modal-title", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: text.title }) }) }), _jsxs("div", { className: "glim-give-body", children: [_jsx("p", { className: "glim-give-appeal", children: text.appeal }), _jsx("p", { className: "glim-give-intro", children: text.intro }), _jsx("div", { className: "glim-give-frame", children: _jsx("iframe", { src: widgetUrl, title: text.title, allow: "payment", className: "glim-give-iframe" }) })] }), _jsx("div", { className: "glim-give-foot", children: _jsx(Button, { label: text.closeLabel, labelKey: "common.close", tone: "neutral", onClick: onClose }) })] }) }));
|
|
9
9
|
}
|
package/dist/ColorPicker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
import { COLOR_NAMES_DE, COLOR_PICKER_TEXT, colorPicker, floatColorPicker, nearestColorName, normalizeHex, } from "@glimstone/core";
|
|
4
|
+
import { COLOR_NAMES_DE, COLOR_PICKER_TEXT, colorPicker, floatColorPicker, nearestColorName, normalizeHex, portalTarget, } from "@glimstone/core";
|
|
5
5
|
import { Button } from "./Button.js";
|
|
6
6
|
import { IconCheck } from "./glyphs.js";
|
|
7
7
|
export function ColorPicker({ value, onApply, onInput, anchor, onClose, names = COLOR_NAMES_DE, text, className }) {
|
|
@@ -55,7 +55,7 @@ export function ColorPicker({ value, onApply, onInput, anchor, onClose, names =
|
|
|
55
55
|
apply();
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const body = (_jsxs("div", { ref: panel, className: ["glim-picker-panel", anchor && "glim-picker-panel--float", className].filter(Boolean).join(" "), style: { "--glim-picker-colour": draft }, onKeyDown: onKeyDown, children: [_jsx("div", { ref: host, style: { display: "contents" } }), _jsxs("div", { className: "glim-picker-foot", children: [_jsx("span", { className: "glim-picker-swatch", "aria-hidden": "true" }), name !== null && _jsx("span", { className: "glim-picker-name", children: name }), _jsx("input", { className: "glim-picker-hex", value: typed, maxLength: 7, spellCheck: false, "aria-label": words.hex, onChange: (e) => {
|
|
58
|
+
const body = (_jsxs("div", { "data-glim": "ColorPicker", ref: panel, className: ["glim-picker-panel", anchor && "glim-picker-panel--float", className].filter(Boolean).join(" "), style: { "--glim-picker-colour": draft }, onKeyDown: onKeyDown, children: [_jsx("div", { ref: host, style: { display: "contents" } }), _jsxs("div", { className: "glim-picker-foot", children: [_jsx("span", { className: "glim-picker-swatch", "aria-hidden": "true" }), name !== null && _jsx("span", { className: "glim-picker-name", children: name }), _jsx("input", { className: "glim-picker-hex", value: typed, maxLength: 7, spellCheck: false, "aria-label": words.hex, onChange: (e) => {
|
|
59
59
|
setTyped(e.target.value);
|
|
60
60
|
const hex = normalizeHex(e.target.value);
|
|
61
61
|
if (!hex)
|
|
@@ -64,5 +64,5 @@ export function ColorPicker({ value, onApply, onInput, anchor, onClose, names =
|
|
|
64
64
|
widget.current?.setValue(hex);
|
|
65
65
|
onInput?.(hex);
|
|
66
66
|
} })] }), _jsx("div", { className: "glim-picker-actions", children: _jsx(Button, { label: words.apply, labelKey: "apply", glyph: _jsx(IconCheck, {}), tone: "accent", onClick: apply }) })] }));
|
|
67
|
-
return anchor ? createPortal(body,
|
|
67
|
+
return anchor ? createPortal(body, portalTarget()) : body;
|
|
68
68
|
}
|
package/dist/Combobox.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { portalTarget } from "@glimstone/core";
|
|
2
3
|
import { useId, useState } from "react";
|
|
3
4
|
import * as combobox from "@zag-js/combobox";
|
|
4
5
|
import { useFieldName } from "./fieldName.js";
|
|
@@ -30,5 +31,5 @@ export function Combobox({ label, hideLabel, options, value, onChange, placehold
|
|
|
30
31
|
onValueChange: (d) => onChange(d.value[0] ?? ""),
|
|
31
32
|
});
|
|
32
33
|
const api = combobox.connect(service, normalizeProps);
|
|
33
|
-
return (_jsxs("div", { ...api.getRootProps(), className: "glim-combobox", children: [_jsx("label", { ...api.getLabelProps(), className: hideLabel || label === undefined ? "glim-sr-only" : "glim-field-label", children: name }), _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)))] }) }) })] }));
|
|
34
|
+
return (_jsxs("div", { "data-glim": "Combobox", ...api.getRootProps(), className: "glim-combobox", children: [_jsx("label", { ...api.getLabelProps(), className: hideLabel || label === undefined ? "glim-sr-only" : "glim-field-label", children: name }), _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, { container: { current: portalTarget() }, 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)))] }) }) })] }));
|
|
34
35
|
}
|
package/dist/ConfirmDialog.js
CHANGED
|
@@ -6,7 +6,7 @@ export function ConfirmDialog({ title, message, confirmLabel, confirmLabelKey, c
|
|
|
6
6
|
return (_jsx("div", { className: "glim-modal-backdrop", onClick: (e) => {
|
|
7
7
|
if (e.target === e.currentTarget)
|
|
8
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,
|
|
9
|
+
}, children: _jsxs("div", { "data-glim": "ConfirmDialog", "data-glim-title": title, 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
10
|
// `null` means no key: the action being confirmed has no fixed one.
|
|
11
11
|
labelKey: confirmLabelKey ?? null, glyph: confirmGlyph,
|
|
12
12
|
// Not red ("Destructive and confirmable actions"): the dialog's
|
package/dist/ContextMenu.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
8
8
|
// caller flips `checked` and the row follows.
|
|
9
9
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
10
10
|
import { createPortal } from "react-dom";
|
|
11
|
-
import { claimMenu, closeMenuOutside, focusedAsker, focusFirstMenuRow, focusMenuRow, isMenuHead, menuMove, menuRowView, placeMenu, placeSubmenu, returnFocus, tidyMenu, } from "@glimstone/core";
|
|
11
|
+
import { claimMenu, closeMenuOutside, focusedAsker, focusFirstMenuRow, focusMenuRow, isMenuHead, menuMove, menuRowView, placeMenu, placeSubmenu, returnFocus, tidyMenu, portalTarget, } from "@glimstone/core";
|
|
12
12
|
import { IconCheck, IconExpand, IconPencil } from "./glyphs.js";
|
|
13
13
|
import { Kbd } from "./Kbd.js";
|
|
14
14
|
import { useTipBubble } from "./useTipBubble.js";
|
|
@@ -132,6 +132,6 @@ export function ContextMenu({ x, y, items, above = false, label, id, opener, onC
|
|
|
132
132
|
else if (!opens && sub)
|
|
133
133
|
setSub(null);
|
|
134
134
|
}
|
|
135
|
-
return (_jsxs(_Fragment, { children: [createPortal(_jsx("div", { ref: menu, role: "menu", id: id, "aria-label": label, className: "glim-menu", style: pos, onKeyDown: (e) => keys(e, false), onMouseOver: hover, onContextMenu: (e) => e.preventDefault(), children: _jsx(Rows, { entries: rows, openAt: sub?.at, onPick: (i) => pick(rows, i) }) }),
|
|
136
|
-
createPortal(_jsx("div", { ref: subMenu, id: host.subId, role: "menu", "aria-label": host.label, className: "glim-menu", style: subPos ?? { left: 0, top: 0 }, onKeyDown: (e) => keys(e, true), onContextMenu: (e) => e.preventDefault(), children: _jsx(Rows, { entries: subRows, onPick: (i) => pick(subRows, i) }) }),
|
|
135
|
+
return (_jsxs(_Fragment, { children: [createPortal(_jsx("div", { "data-glim": "ContextMenu", ref: menu, role: "menu", id: id, "aria-label": label, className: "glim-menu", style: pos, onKeyDown: (e) => keys(e, false), onMouseOver: hover, onContextMenu: (e) => e.preventDefault(), children: _jsx(Rows, { entries: rows, openAt: sub?.at, onPick: (i) => pick(rows, i) }) }), portalTarget()), subRows &&
|
|
136
|
+
createPortal(_jsx("div", { ref: subMenu, id: host.subId, role: "menu", "aria-label": host.label, className: "glim-menu", style: subPos ?? { left: 0, top: 0 }, onKeyDown: (e) => keys(e, true), onContextMenu: (e) => e.preventDefault(), children: _jsx(Rows, { entries: subRows, onPick: (i) => pick(subRows, i) }) }), portalTarget())] }));
|
|
137
137
|
}
|
package/dist/CopyField.js
CHANGED
|
@@ -22,5 +22,5 @@ export function CopyField({ value, label, width, text = { copy: "Copy", copied:
|
|
|
22
22
|
clearTimeout(timer.current);
|
|
23
23
|
timer.current = window.setTimeout(() => setCopied(false), COPIED_MS);
|
|
24
24
|
}
|
|
25
|
-
return (_jsxs("span", { className: ["glim-copy", fieldWidthClass(width), className].filter(Boolean).join(" "), children: [_jsx("input", { ref: field, readOnly: true, value: value, "aria-label": name, spellCheck: false, className: "glim-input glim-input--mono" }), _jsx(Button, { label: copied ? text.copied : text.copy, labelKey: copied ? "copied" : "copy", glyph: copied ? _jsx(IconCheck, {}) : _jsx(IconCopy, {}), variant: "icon", onClick: copy }), _jsx("span", { role: "status", className: "glim-sr-only", children: copied ? text.copied : "" })] }));
|
|
25
|
+
return (_jsxs("span", { "data-glim": "CopyField", className: ["glim-copy", fieldWidthClass(width), className].filter(Boolean).join(" "), children: [_jsx("input", { ref: field, readOnly: true, value: value, "aria-label": name, spellCheck: false, className: "glim-input glim-input--mono" }), _jsx(Button, { label: copied ? text.copied : text.copy, labelKey: copied ? "copied" : "copy", glyph: copied ? _jsx(IconCheck, {}) : _jsx(IconCopy, {}), variant: "icon", onClick: copy }), _jsx("span", { role: "status", className: "glim-sr-only", children: copied ? text.copied : "" })] }));
|
|
26
26
|
}
|
|
@@ -12,7 +12,7 @@ export function CryptoDonateDialog({ coins, coin, network, onPick, text, renderQ
|
|
|
12
12
|
return (_jsx("div", { className: "glim-modal-backdrop", onClick: (e) => {
|
|
13
13
|
if (e.target === e.currentTarget)
|
|
14
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) => {
|
|
15
|
+
}, children: _jsxs("div", { "data-glim": "CryptoDonateDialog", "data-glim-title": text.title, 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
16
|
const picked = c.id === coin.id;
|
|
17
17
|
const lit = !picked && c.tile;
|
|
18
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: {
|
package/dist/DropdownListbox.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
import { computeBubblePosition } from "@glimstone/core";
|
|
4
|
+
import { computeBubblePosition, portalTarget } from "@glimstone/core";
|
|
5
5
|
import { usePortalHue } from "./portalHue.js";
|
|
6
6
|
// The `role="listbox"` panel a button-opens-a-list picker drops open. It is
|
|
7
|
-
// portalled to
|
|
7
|
+
// portalled to <body> (portalTarget), because a card with `overflow: hidden` clips an
|
|
8
8
|
// absolutely positioned panel whatever its z-index, and placed with
|
|
9
9
|
// computeBubblePosition, which clamps it into the viewport and flips it above
|
|
10
10
|
// the trigger when needed.
|
|
@@ -166,7 +166,7 @@ export function DropdownListbox({ open, onClose, triggerRef, label, multiselecta
|
|
|
166
166
|
}
|
|
167
167
|
if (!open)
|
|
168
168
|
return null;
|
|
169
|
-
return createPortal(_jsx("div", { ref: panelRef, role: "listbox", onKeyDown: onPanelKeyDown, onFocus: () => {
|
|
169
|
+
return createPortal(_jsx("div", { "data-glim": "DropdownListbox", ref: panelRef, role: "listbox", onKeyDown: onPanelKeyDown, onFocus: () => {
|
|
170
170
|
focusInsideRef.current = true;
|
|
171
171
|
}, onBlur: (e) => {
|
|
172
172
|
if (!e.currentTarget.contains(e.relatedTarget))
|
|
@@ -179,5 +179,5 @@ export function DropdownListbox({ open, onClose, triggerRef, label, multiselecta
|
|
|
179
179
|
width: pos?.width,
|
|
180
180
|
transform: "translateX(-50%)",
|
|
181
181
|
...(hue.style ?? {}),
|
|
182
|
-
}, children: children }),
|
|
182
|
+
}, children: children }), portalTarget());
|
|
183
183
|
}
|
package/dist/EmptyState.js
CHANGED
|
@@ -6,5 +6,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
* so somebody is not sent looking for a filter that was never set.
|
|
7
7
|
*/
|
|
8
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] }));
|
|
9
|
+
return (_jsxs("div", { "data-glim": "EmptyState", "data-glim-title": title, 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
10
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** The line under a field whose value it cannot take, with the fault mark.
|
|
3
|
+
* The fields draw it from their `error`; an app's own field draws it with
|
|
4
|
+
* the id its aria-describedby names. */
|
|
5
|
+
export declare function FieldError({ id, children }: {
|
|
6
|
+
id: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TOAST_MARKS } from "@glimstone/core";
|
|
3
|
+
import { MarkSvg } from "./glyphs.js";
|
|
4
|
+
/** The line under a field whose value it cannot take, with the fault mark.
|
|
5
|
+
* The fields draw it from their `error`; an app's own field draws it with
|
|
6
|
+
* the id its aria-describedby names. */
|
|
7
|
+
export function FieldError({ id, children }) {
|
|
8
|
+
return (_jsxs("span", { "data-glim": "FieldError", id: id, className: "glim-field-error", children: [_jsx(MarkSvg, { mark: TOAST_MARKS.fail }), children] }));
|
|
9
|
+
}
|
package/dist/FieldRow.js
CHANGED
|
@@ -9,5 +9,5 @@ export function FieldRow({ label, drawn, hint, value, tone, wide, children, clas
|
|
|
9
9
|
const inGroup = useContext(FieldRowGroupContext);
|
|
10
10
|
const control = children ??
|
|
11
11
|
(value !== undefined && (_jsx(Pill, { className: "glim-num", tone: tone, children: value })));
|
|
12
|
-
return (_jsx(FieldRowContext.Provider, { value: label, children: _jsxs("div", { ...rest, ref: row, className: ["glim-field-row", wide && "glim-field-row--wide", className].filter(Boolean).join(" "), children: [_jsxs("span", { className: "glim-field-row-name", children: [_jsx("span", { className: "glim-field-row-label", onClick: () => pressRowControl(row.current), children: drawn ?? label }), hint && _jsx(InfoBubble, { tip: hint })] }), inGroup ? _jsx("span", { className: "glim-field-row-controls", children: control }) : control] }) }));
|
|
12
|
+
return (_jsx(FieldRowContext.Provider, { value: label, children: _jsxs("div", { "data-glim": "FieldRow", ...rest, ref: row, className: ["glim-field-row", wide && "glim-field-row--wide", className].filter(Boolean).join(" "), children: [_jsxs("span", { className: "glim-field-row-name", children: [_jsx("span", { className: "glim-field-row-label", onClick: () => pressRowControl(row.current), children: drawn ?? label }), hint && _jsx(InfoBubble, { tip: hint })] }), inGroup ? _jsx("span", { className: "glim-field-row-controls", children: control }) : control] }) }));
|
|
13
13
|
}
|
package/dist/FieldRowGroup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FieldRowGroupContext } from "./fieldName.js";
|
|
3
3
|
export function FieldRowGroup({ children, columns, className, style, ...rest }) {
|
|
4
|
-
return (_jsx(FieldRowGroupContext.Provider, { value: true, children: _jsx("div", { ...rest, style: columns ? { ...style, "--field-columns": columns } : style, className: className ? `glim-field-row-group ${className}` : "glim-field-row-group", children: children }) }));
|
|
4
|
+
return (_jsx(FieldRowGroupContext.Provider, { value: true, children: _jsx("div", { "data-glim": "FieldRowGroup", ...rest, style: columns ? { ...style, "--field-columns": columns } : style, className: className ? `glim-field-row-group ${className}` : "glim-field-row-group", children: children }) }));
|
|
5
5
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ChangeAnswer, type FortressAnswer, type FortressApp, type FortressInstance, type FortressPermission, type FortressText, type PhraseAnswer, type ToastSeverity } from "@glimstone/core";
|
|
3
|
+
export type { ChangeAnswer, FortressAnswer, FortressText, PhraseAnswer } from "@glimstone/core";
|
|
4
|
+
/** The label keys behind the fortress's buttons, which pick their glyphs (see Button). */
|
|
5
|
+
export interface FortressLabelKeys {
|
|
6
|
+
join: string;
|
|
7
|
+
leave: string;
|
|
8
|
+
showPhrase: string;
|
|
9
|
+
changePhrase: string;
|
|
10
|
+
remove: string;
|
|
11
|
+
later: string;
|
|
12
|
+
unlock: string;
|
|
13
|
+
copy: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FortressProps {
|
|
16
|
+
text: FortressText;
|
|
17
|
+
/** The interface language, for counts and lists. */
|
|
18
|
+
lang: string;
|
|
19
|
+
/** The app showing the page. */
|
|
20
|
+
app: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
logo?: string;
|
|
24
|
+
};
|
|
25
|
+
joined: boolean;
|
|
26
|
+
/** The other apps of the fortress, each with its instances. */
|
|
27
|
+
apps: FortressApp[];
|
|
28
|
+
permissions: FortressPermission[];
|
|
29
|
+
onPermission: (id: string, on: boolean) => Promise<FortressAnswer>;
|
|
30
|
+
/** Puts the small confirmation of a saved permission, or the reason it failed, into the app's toasts. */
|
|
31
|
+
notify?: (message: string, severity: ToastSeverity) => void;
|
|
32
|
+
onJoin: (words: string[]) => Promise<FortressAnswer>;
|
|
33
|
+
/** Removes an instance, of this app or another. Without it no other app offers Remove. */
|
|
34
|
+
onRemove?: (id: string) => Promise<FortressAnswer>;
|
|
35
|
+
/** `password` is set where `phrasePassword` asks for it first. Without it there is no Show phrase. */
|
|
36
|
+
onShowPhrase?: (password?: string) => Promise<PhraseAnswer>;
|
|
37
|
+
/** Offered right after a removal and beside `removed`, since until the phrase changes the fortress takes no new app. */
|
|
38
|
+
onChangePhrase?: () => Promise<ChangeAnswer>;
|
|
39
|
+
/** The instances removed since the phrase last changed, by name ("Bravo on Atlas"). While there are any, a line says that no new app can join. */
|
|
40
|
+
removed?: string[];
|
|
41
|
+
/** Another member removed this app, so the empty place says so until it joins again. */
|
|
42
|
+
removedHere?: boolean;
|
|
43
|
+
/** Whether the other apps show. Without it the switch keeps its state on this device. */
|
|
44
|
+
showOthers?: boolean;
|
|
45
|
+
onShowOthers?: (on: boolean) => void;
|
|
46
|
+
/** The app draws the switch for the other apps itself, such as at the top of its pairing card, with `showOthers` and `othersLine`. */
|
|
47
|
+
hideSwitch?: boolean;
|
|
48
|
+
/** The devices this app is paired with today, whose pairing moves into the fortress on joining. */
|
|
49
|
+
pairedWith?: string[];
|
|
50
|
+
/** A member of a fortress this app saw on the network while it is in none. */
|
|
51
|
+
found?: {
|
|
52
|
+
app: string;
|
|
53
|
+
device: string;
|
|
54
|
+
logo?: string;
|
|
55
|
+
};
|
|
56
|
+
/** Asks for the app's password before the phrase shows. */
|
|
57
|
+
phrasePassword?: boolean;
|
|
58
|
+
onOpen?: (app: FortressApp, instance: FortressInstance) => void;
|
|
59
|
+
/** The app's own card for another app, such as the one its Instances tab draws, in place of FortressAppCard. With `onRemove` it gets `remove`, which asks before an instance goes, as the app's own cards do. */
|
|
60
|
+
renderApp?: (app: FortressApp, hueIndex: number, remove?: (id: string, name: string) => void) => ReactNode;
|
|
61
|
+
/** What the QR code beside the words carries, the words alone without it. */
|
|
62
|
+
phraseQr?: (words: string[]) => string;
|
|
63
|
+
/** Something of the app's own under a permission's words. */
|
|
64
|
+
permissionExtra?: (permission: FortressPermission) => ReactNode;
|
|
65
|
+
labelKeys?: Partial<FortressLabelKeys>;
|
|
66
|
+
/** The rainbow position the fortress's first card takes, after the app's own cards. */
|
|
67
|
+
hueStart?: number;
|
|
68
|
+
/** This app's own instance cards. As a function it gets `remove`, which asks before an instance goes. */
|
|
69
|
+
children?: ReactNode | ((remove: (id: string, device: string) => void) => ReactNode);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The fortress in the Instances tab ("The fortress" in the design language):
|
|
73
|
+
* the app's own instances first, the switch for the other apps and, once it is
|
|
74
|
+
* on, their cards and the permissions, with Show phrase or Enter phrase in the
|
|
75
|
+
* corner. Changing the phrase and leaving live in the pairing settings
|
|
76
|
+
* (FortressPairing).
|
|
77
|
+
*/
|
|
78
|
+
export declare function Fortress(props: FortressProps): import("react").JSX.Element;
|
|
79
|
+
export interface FortressPairingProps {
|
|
80
|
+
text: FortressText;
|
|
81
|
+
lang: string;
|
|
82
|
+
app: {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
};
|
|
86
|
+
onLeave: () => Promise<FortressAnswer>;
|
|
87
|
+
/** `password` is set where `phrasePassword` asks for it first. Without it there is no Show phrase here. */
|
|
88
|
+
onShowPhrase?: (password?: string) => Promise<PhraseAnswer>;
|
|
89
|
+
/** Asks for the app's password before the phrase shows. */
|
|
90
|
+
phrasePassword?: boolean;
|
|
91
|
+
/** What the QR code beside the words carries, the words alone without it. */
|
|
92
|
+
phraseQr?: (words: string[]) => string;
|
|
93
|
+
/** Without it there is no way to change the phrase here, for an app that cannot keep a new one. */
|
|
94
|
+
onChangePhrase?: () => Promise<ChangeAnswer>;
|
|
95
|
+
/** The devices whose pairing ends with leaving. */
|
|
96
|
+
pairedWith?: string[];
|
|
97
|
+
/** A sentence of the app's own for the leave window, such as what stays as it is. */
|
|
98
|
+
leaveNote?: string;
|
|
99
|
+
labelKeys?: Partial<FortressLabelKeys>;
|
|
100
|
+
hueIndex?: number;
|
|
101
|
+
/** Rows of the app's own above the phrase, such as the name the instance goes by. */
|
|
102
|
+
children?: ReactNode;
|
|
103
|
+
/** Rows of the app's own below leaving, such as the switch for the other apps. */
|
|
104
|
+
after?: ReactNode;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The fortress in the app's pairing settings: the one place where the phrase
|
|
108
|
+
* shows and changes and the app leaves, each behind a window that says what
|
|
109
|
+
* it does. An app that shows the phrase here leaves Show phrase out of its
|
|
110
|
+
* Fortress.
|
|
111
|
+
*/
|
|
112
|
+
export declare function FortressPairing(props: FortressPairingProps): import("react").JSX.Element;
|