shelving 1.262.1 → 1.263.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.262.1",
3
+ "version": "1.263.0",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
package/ui/form/Button.md CHANGED
@@ -60,6 +60,8 @@ import { getButtonClass } from "shelving/ui";
60
60
  | `--button-radius` | Corner radius | `var(--radius-xsmall)` (8px) |
61
61
  | `--button-padding` | Inner padding | `var(--space-small)` (12px) |
62
62
  | `--button-small-padding` | Inner padding when `small` | `var(--space-xxsmall)` (4px) |
63
+ | `--button-gap` | Gap between icon and label | `var(--space-small)` (12px) |
64
+ | `--button-small-gap` | Gap between icon and label when `small` | `var(--space-xxsmall)` (4px) |
63
65
  | `--button-space` | Outer block margin | `var(--space-small)` (12px) |
64
66
  | `--button-font` | Font family | `var(--font-body)` |
65
67
  | `--button-weight` | Font weight | `var(--weight-strong)` (700) |
@@ -28,6 +28,7 @@
28
28
  /* Content */
29
29
  overflow: hidden;
30
30
  word-break: normal;
31
+ gap: var(--button-gap, var(--space-small));
31
32
  justify-content: center;
32
33
  align-items: center;
33
34
 
@@ -61,6 +62,7 @@
61
62
 
62
63
  /* Variants */
63
64
  &.small {
65
+ gap: var(--button-small-gap, var(--space-xxsmall));
64
66
  padding-block: var(--button-small-padding, var(--space-xxsmall));
65
67
  padding-inline: var(--button-small-padding, var(--space-xxsmall));
66
68
  }
@@ -73,9 +73,7 @@ export declare function ErrorNotice({ reason }: ErrorProps): ReactElement;
73
73
  */
74
74
  export declare function PageCatcher({ children }: ChildProps): ReactElement;
75
75
  /**
76
- * Render a caught error as a full-page `<Page>` with an error `<Card>` and retry button.
77
- *
78
- * - Uses `getMessage()` to extract a human-readable message, falling back to `"Unknown error"`.
76
+ * Render a caught error as a full-page `<Page>` with a centered `<ErrorNotice>`.
79
77
  *
80
78
  * @kind component
81
79
  * @see https://shelving.cc/ui/ErrorPage
@@ -2,15 +2,11 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { ArrowPathIcon } from "@heroicons/react/24/solid";
3
3
  import { Component, createContext, use } from "react";
4
4
  import { getMessage } from "../../util/error.js";
5
- import { Card } from "../block/Card.js";
6
5
  import { Paragraph } from "../block/Paragraph.js";
7
- import { Row } from "../block/Row.js";
8
- import { Subheading } from "../block/Subheading.js";
9
6
  import { Button } from "../form/Button.js";
10
7
  import { CenteredLayout } from "../layout/CenteredLayout.js";
11
8
  import { Notice } from "../notice/Notice.js";
12
9
  import { Page } from "../page/Page.js";
13
- import { Icon } from "./Icon.js";
14
10
  const RetryContext = createContext(undefined);
15
11
  RetryContext.displayName = "RetryContext";
16
12
  const RETRY_CHILDREN = (_jsxs(_Fragment, { children: [_jsx(ArrowPathIcon, {}), "Retry"] }));
@@ -82,14 +78,11 @@ export function PageCatcher({ children }) {
82
78
  return _jsx(Catcher, { as: ErrorPage, children: children });
83
79
  }
84
80
  /**
85
- * Render a caught error as a full-page `<Page>` with an error `<Card>` and retry button.
86
- *
87
- * - Uses `getMessage()` to extract a human-readable message, falling back to `"Unknown error"`.
81
+ * Render a caught error as a full-page `<Page>` with a centered `<ErrorNotice>`.
88
82
  *
89
83
  * @kind component
90
84
  * @see https://shelving.cc/ui/ErrorPage
91
85
  */
92
86
  export function ErrorPage({ reason }) {
93
- const message = getMessage(reason) ?? "Unknown error";
94
- return (_jsx(Page, { title: "Error", children: _jsx(CenteredLayout, { children: _jsxs(Card, { status: "error", children: [_jsx(Subheading, { children: _jsxs(Row, { left: true, children: [_jsx(Icon, { status: "error" }), " ", message] }) }), _jsx(RetryButton, {})] }) }) }));
87
+ return (_jsx(Page, { title: "Error", children: _jsx(CenteredLayout, { children: _jsx(ErrorNotice, { reason: reason }) }) }));
95
88
  }
@@ -2,16 +2,12 @@ import { ArrowPathIcon } from "@heroicons/react/24/solid";
2
2
  import { Component, createContext, type ReactElement, type ReactNode, use } from "react";
3
3
  import { getMessage } from "../../util/error.js";
4
4
  import type { Callback } from "../../util/function.js";
5
- import { Card } from "../block/Card.js";
6
5
  import { Paragraph } from "../block/Paragraph.js";
7
- import { Row } from "../block/Row.js";
8
- import { Subheading } from "../block/Subheading.js";
9
6
  import { Button, type ButtonVariants } from "../form/Button.js";
10
7
  import { CenteredLayout } from "../layout/CenteredLayout.js";
11
8
  import { Notice } from "../notice/Notice.js";
12
9
  import { Page } from "../page/Page.js";
13
10
  import type { ChildProps, OptionalChildProps } from "../util/props.js";
14
- import { Icon } from "./Icon.js";
15
11
 
16
12
  const RetryContext = createContext<Callback | undefined>(undefined);
17
13
  RetryContext.displayName = "RetryContext";
@@ -137,26 +133,16 @@ export function PageCatcher({ children }: ChildProps): ReactElement {
137
133
  }
138
134
 
139
135
  /**
140
- * Render a caught error as a full-page `<Page>` with an error `<Card>` and retry button.
141
- *
142
- * - Uses `getMessage()` to extract a human-readable message, falling back to `"Unknown error"`.
136
+ * Render a caught error as a full-page `<Page>` with a centered `<ErrorNotice>`.
143
137
  *
144
138
  * @kind component
145
139
  * @see https://shelving.cc/ui/ErrorPage
146
140
  */
147
141
  export function ErrorPage({ reason }: ErrorProps): ReactElement {
148
- const message = getMessage(reason) ?? "Unknown error";
149
142
  return (
150
143
  <Page title="Error">
151
144
  <CenteredLayout>
152
- <Card status="error">
153
- <Subheading>
154
- <Row left>
155
- <Icon status="error" /> {message}
156
- </Row>
157
- </Subheading>
158
- <RetryButton />
159
- </Card>
145
+ <ErrorNotice reason={reason} />
160
146
  </CenteredLayout>
161
147
  </Page>
162
148
  );