shelving 1.264.0 → 1.264.2
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 +1 -1
- package/ui/README.md +2 -2
- package/ui/block/Blockquote.module.css +0 -3
- package/ui/block/Card.d.ts +1 -1
- package/ui/block/Card.js +1 -1
- package/ui/block/Card.md +3 -7
- package/ui/block/Card.module.css +0 -3
- package/ui/block/Card.tsx +1 -1
- package/ui/block/Heading.md +0 -1
- package/ui/block/Heading.module.css +0 -3
- package/ui/block/Image.d.ts +3 -3
- package/ui/block/Image.js +4 -4
- package/ui/block/Image.module.css +4 -1
- package/ui/block/Image.tsx +14 -4
- package/ui/block/Label.module.css +0 -3
- package/ui/block/List.md +1 -2
- package/ui/block/List.module.css +0 -3
- package/ui/block/Panel.md +1 -2
- package/ui/block/Panel.module.css +0 -3
- package/ui/block/Paragraph.md +1 -2
- package/ui/block/Paragraph.module.css +0 -3
- package/ui/block/Preformatted.module.css +0 -3
- package/ui/block/Subheading.md +0 -1
- package/ui/block/Subheading.module.css +0 -3
- package/ui/block/Title.md +0 -1
- package/ui/block/Title.module.css +0 -3
- package/ui/block/Video.d.ts +3 -58
- package/ui/block/Video.js +2 -52
- package/ui/block/Video.module.css +1 -51
- package/ui/block/Video.tsx +3 -99
- package/ui/{form → button}/Button.d.ts +6 -2
- package/ui/{form → button}/Button.md +1 -2
- package/ui/{form → button}/Button.module.css +0 -3
- package/ui/{form → button}/Button.tsx +6 -1
- package/ui/button/FullscreenButton.d.ts +31 -0
- package/ui/button/FullscreenButton.js +37 -0
- package/ui/button/FullscreenButton.tsx +58 -0
- package/ui/button/RetryButton.d.ts +29 -0
- package/ui/button/RetryButton.js +27 -0
- package/ui/button/RetryButton.tsx +48 -0
- package/ui/{form → button}/SubmitButton.d.ts +12 -8
- package/ui/{form → button}/SubmitButton.js +4 -4
- package/ui/{form → button}/SubmitButton.tsx +22 -18
- package/ui/button/index.d.ts +5 -0
- package/ui/button/index.js +5 -0
- package/ui/button/index.ts +5 -0
- package/ui/dialog/Dialog.d.ts +1 -1
- package/ui/dialog/Dialog.tsx +1 -1
- package/ui/docs/DocumentationPage.test.tsx +2 -4
- package/ui/docs/DocumentationParams.js +1 -1
- package/ui/docs/DocumentationParams.tsx +1 -1
- package/ui/docs/DocumentationProperties.js +1 -1
- package/ui/docs/DocumentationProperties.tsx +1 -1
- package/ui/docs/DocumentationReferences.js +1 -1
- package/ui/docs/DocumentationReferences.tsx +1 -1
- package/ui/docs/DocumentationReturns.js +1 -1
- package/ui/docs/DocumentationReturns.tsx +1 -1
- package/ui/docs/DocumentationSearchPage.js +2 -2
- package/ui/docs/DocumentationSearchPage.tsx +2 -2
- package/ui/docs/DocumentationThrows.js +1 -1
- package/ui/docs/DocumentationThrows.tsx +1 -1
- package/ui/form/Field.test.tsx +1 -1
- package/ui/form/FormContext.d.ts +1 -1
- package/ui/form/FormContext.js +1 -1
- package/ui/form/FormContext.tsx +1 -1
- package/ui/form/FormFields.d.ts +1 -1
- package/ui/form/FormFields.js +1 -1
- package/ui/form/FormFields.tsx +2 -2
- package/ui/form/FormFooter.js +1 -1
- package/ui/form/FormFooter.tsx +1 -1
- package/ui/form/FormInput.d.ts +1 -1
- package/ui/form/FormInput.js +1 -1
- package/ui/form/FormInput.tsx +2 -2
- package/ui/form/Progress.d.ts +6 -24
- package/ui/form/Progress.js +9 -20
- package/ui/form/Progress.module.css +13 -32
- package/ui/form/Progress.tsx +18 -51
- package/ui/form/index.d.ts +0 -23
- package/ui/form/index.js +0 -23
- package/ui/form/index.ts +0 -23
- package/ui/index.d.ts +2 -0
- package/ui/index.js +2 -0
- package/ui/index.ts +2 -0
- package/ui/inline/Deleted.md +4 -5
- package/ui/inline/Deleted.module.css +1 -3
- package/ui/inline/Inserted.md +4 -5
- package/ui/inline/Inserted.module.css +1 -3
- package/ui/inline/Link.d.ts +1 -1
- package/ui/inline/Link.js +1 -1
- package/ui/inline/Link.md +2 -3
- package/ui/inline/Link.module.css +1 -3
- package/ui/inline/Link.tsx +1 -1
- package/ui/inline/Mark.js +1 -2
- package/ui/inline/Mark.md +5 -5
- package/ui/inline/Mark.module.css +2 -3
- package/ui/inline/Mark.tsx +0 -2
- package/ui/{form → input}/ArrayInput.js +1 -1
- package/ui/{form → input}/ArrayInput.tsx +1 -1
- package/ui/{form → input}/ButtonInput.d.ts +1 -1
- package/ui/{form → input}/ButtonInput.js +1 -1
- package/ui/{form → input}/ButtonInput.tsx +1 -1
- package/ui/{form → input}/ButtonPopover.d.ts +1 -1
- package/ui/{form → input}/ButtonPopover.js +1 -1
- package/ui/{form → input}/ButtonPopover.tsx +1 -1
- package/ui/{form → input}/DictionaryInput.js +1 -1
- package/ui/{form → input}/DictionaryInput.tsx +1 -1
- package/ui/{form → input}/SchemaInput.js +1 -1
- package/ui/{form → input}/SchemaInput.test.tsx +3 -3
- package/ui/{form → input}/SchemaInput.tsx +1 -1
- package/ui/{form → input}/TextInput.d.ts +1 -1
- package/ui/{form → input}/TextInput.js +1 -1
- package/ui/{form → input}/TextInput.tsx +1 -1
- package/ui/input/index.d.ts +20 -0
- package/ui/input/index.js +20 -0
- package/ui/input/index.ts +20 -0
- package/ui/layout/CenteredLayout.d.ts +5 -7
- package/ui/layout/CenteredLayout.js +8 -4
- package/ui/layout/CenteredLayout.md +9 -2
- package/ui/layout/CenteredLayout.module.css +16 -22
- package/ui/layout/CenteredLayout.tsx +18 -12
- package/ui/layout/Layout.d.ts +1 -1
- package/ui/layout/Layout.js +4 -0
- package/ui/layout/Layout.ts +6 -0
- package/ui/layout/SidebarLayout.js +13 -6
- package/ui/layout/SidebarLayout.md +4 -4
- package/ui/layout/SidebarLayout.module.css +6 -9
- package/ui/layout/SidebarLayout.tsx +21 -18
- package/ui/menu/Menu.d.ts +1 -1
- package/ui/menu/Menu.js +1 -1
- package/ui/menu/Menu.tsx +1 -1
- package/ui/misc/Catcher.d.ts +2 -19
- package/ui/misc/Catcher.js +3 -22
- package/ui/misc/Catcher.tsx +4 -40
- package/ui/misc/MetaContext.test.tsx +2 -3
- package/ui/misc/Tag.d.ts +1 -1
- package/ui/misc/Tag.js +1 -1
- package/ui/misc/Tag.md +1 -2
- package/ui/misc/Tag.module.css +0 -3
- package/ui/misc/Tag.tsx +1 -1
- package/ui/notice/Message.module.css +0 -3
- package/ui/notice/Notice.md +1 -2
- package/ui/notice/Notice.module.css +0 -3
- package/ui/router/Router.test.tsx +1 -4
- package/ui/style/TINT_CLASS.md +1 -1
- package/ui/style/Width.d.ts +2 -1
- package/ui/style/Width.module.css +47 -17
- package/ui/style/Width.tsx +22 -1
- package/ui/style/getWidthClass.md +5 -9
- package/ui/table/Table.md +1 -1
- package/ui/tree/TreeButton.d.ts +1 -1
- package/ui/tree/TreeButton.js +1 -1
- package/ui/tree/TreeButton.test.tsx +2 -5
- package/ui/tree/TreeButton.tsx +1 -1
- package/ui/tree/TreeContext.test.tsx +2 -3
- package/ui/tree/TreeMarkup.test.tsx +2 -5
- package/ui/tree/TreeRouter.test.tsx +2 -5
- package/ui/tree/TreeSidebar.js +1 -1
- package/ui/tree/TreeSidebar.tsx +1 -1
- /package/ui/{form → button}/Button.js +0 -0
- /package/ui/{form → button}/Clickable.d.ts +0 -0
- /package/ui/{form → button}/Clickable.js +0 -0
- /package/ui/{form → button}/Clickable.tsx +0 -0
- /package/ui/{form → input}/ArrayInput.d.ts +0 -0
- /package/ui/{form → input}/ArrayRadioInputs.d.ts +0 -0
- /package/ui/{form → input}/ArrayRadioInputs.js +0 -0
- /package/ui/{form → input}/ArrayRadioInputs.tsx +0 -0
- /package/ui/{form → input}/ButtonInputPopover.d.ts +0 -0
- /package/ui/{form → input}/ButtonInputPopover.js +0 -0
- /package/ui/{form → input}/ButtonInputPopover.tsx +0 -0
- /package/ui/{form → input}/CheckboxInput.d.ts +0 -0
- /package/ui/{form → input}/CheckboxInput.js +0 -0
- /package/ui/{form → input}/CheckboxInput.tsx +0 -0
- /package/ui/{form → input}/ChoiceRadioInputs.d.ts +0 -0
- /package/ui/{form → input}/ChoiceRadioInputs.js +0 -0
- /package/ui/{form → input}/ChoiceRadioInputs.tsx +0 -0
- /package/ui/{form → input}/DataInput.d.ts +0 -0
- /package/ui/{form → input}/DataInput.js +0 -0
- /package/ui/{form → input}/DataInput.tsx +0 -0
- /package/ui/{form → input}/DateInput.d.ts +0 -0
- /package/ui/{form → input}/DateInput.js +0 -0
- /package/ui/{form → input}/DateInput.tsx +0 -0
- /package/ui/{form → input}/DictionaryInput.d.ts +0 -0
- /package/ui/{form → input}/FileInput.d.ts +0 -0
- /package/ui/{form → input}/FileInput.js +0 -0
- /package/ui/{form → input}/FileInput.tsx +0 -0
- /package/ui/{form → input}/Input.d.ts +0 -0
- /package/ui/{form → input}/Input.js +0 -0
- /package/ui/{form → input}/Input.module.css +0 -0
- /package/ui/{form → input}/Input.tsx +0 -0
- /package/ui/{form → input}/NumberInput.d.ts +0 -0
- /package/ui/{form → input}/NumberInput.js +0 -0
- /package/ui/{form → input}/NumberInput.tsx +0 -0
- /package/ui/{form → input}/OutputInput.d.ts +0 -0
- /package/ui/{form → input}/OutputInput.js +0 -0
- /package/ui/{form → input}/OutputInput.tsx +0 -0
- /package/ui/{form → input}/Popover.d.ts +0 -0
- /package/ui/{form → input}/Popover.js +0 -0
- /package/ui/{form → input}/Popover.module.css +0 -0
- /package/ui/{form → input}/Popover.tsx +0 -0
- /package/ui/{form → input}/QueryInput.d.ts +0 -0
- /package/ui/{form → input}/QueryInput.js +0 -0
- /package/ui/{form → input}/QueryInput.tsx +0 -0
- /package/ui/{form → input}/RadioInput.d.ts +0 -0
- /package/ui/{form → input}/RadioInput.js +0 -0
- /package/ui/{form → input}/RadioInput.tsx +0 -0
- /package/ui/{form → input}/SchemaInput.d.ts +0 -0
- /package/ui/{form → input}/SchemaInput.md +0 -0
- /package/ui/{form → input}/SelectInput.d.ts +0 -0
- /package/ui/{form → input}/SelectInput.js +0 -0
- /package/ui/{form → input}/SelectInput.tsx +0 -0
|
@@ -21,5 +21,5 @@ export function DocumentationReturns({ returns }) {
|
|
|
21
21
|
const map = useTreeMap();
|
|
22
22
|
if (!returns?.length)
|
|
23
23
|
return null;
|
|
24
|
-
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Return" }), _jsx(Cell, { header: true, width: "
|
|
24
|
+
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Return" }), _jsx(Cell, { header: true, width: "16x", grow: true })] }) }), _jsx("tbody", { children: returns.map(({ type = DEFAULT_TYPE, description }) => (_jsxs("tr", { children: [_jsx("td", { children: _jsx(TreeLink, { name: type, nowrap: true }) }), _jsx("td", { children: _jsx(DocumentationDescription, { description: description || getTreeElement(map, type)?.props.description }) })] }, `${type}-${description}`))) })] }) }) }));
|
|
25
25
|
}
|
|
@@ -7,8 +7,8 @@ import { Panel } from "../block/Panel.js";
|
|
|
7
7
|
import { Row } from "../block/Row.js";
|
|
8
8
|
import { Header, Section } from "../block/Section.js";
|
|
9
9
|
import { Title } from "../block/Title.js";
|
|
10
|
-
import { CheckboxInput } from "../
|
|
11
|
-
import { TextInput } from "../
|
|
10
|
+
import { CheckboxInput } from "../input/CheckboxInput.js";
|
|
11
|
+
import { TextInput } from "../input/TextInput.js";
|
|
12
12
|
import { Page } from "../page/Page.js";
|
|
13
13
|
import { TreeCards } from "../tree/TreeCards.js";
|
|
14
14
|
import { useTreeMap } from "../tree/TreeContext.js";
|
|
@@ -8,8 +8,8 @@ import { Panel } from "../block/Panel.js";
|
|
|
8
8
|
import { Row } from "../block/Row.js";
|
|
9
9
|
import { Header, Section } from "../block/Section.js";
|
|
10
10
|
import { Title } from "../block/Title.js";
|
|
11
|
-
import { CheckboxInput } from "../
|
|
12
|
-
import { TextInput } from "../
|
|
11
|
+
import { CheckboxInput } from "../input/CheckboxInput.js";
|
|
12
|
+
import { TextInput } from "../input/TextInput.js";
|
|
13
13
|
import { Page } from "../page/Page.js";
|
|
14
14
|
import { TreeCards } from "../tree/TreeCards.js";
|
|
15
15
|
import { useTreeMap } from "../tree/TreeContext.js";
|
|
@@ -21,5 +21,5 @@ export function DocumentationThrows({ throws }) {
|
|
|
21
21
|
const map = useTreeMap();
|
|
22
22
|
if (!throws?.length)
|
|
23
23
|
return null;
|
|
24
|
-
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Throws" }), _jsx(Cell, { header: true, width: "
|
|
24
|
+
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Throws" }), _jsx(Cell, { header: true, width: "16x", grow: true })] }) }), _jsx("tbody", { children: throws.map(({ type = DEFAULT_TYPE, description }) => (_jsxs("tr", { children: [_jsx("td", { children: _jsx(TreeLink, { name: type, nowrap: true }) }), _jsx("td", { children: _jsx(DocumentationDescription, { description: description || getTreeElement(map, type)?.props.description }) })] }, `${type}-${description}`))) })] }) }) }));
|
|
25
25
|
}
|
package/ui/form/Field.test.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
|
-
import { Field } from "
|
|
3
|
+
import { Field } from "shelving/ui";
|
|
4
4
|
|
|
5
5
|
describe("Field", () => {
|
|
6
6
|
test("does not render a message container when there is no message", () => {
|
package/ui/form/FormContext.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Schema } from "../../schema/Schema.js";
|
|
2
2
|
import type { Data } from "../../util/data.js";
|
|
3
3
|
import type { AnyCaller } from "../../util/function.js";
|
|
4
|
+
import { type SchemaInputProps } from "../input/SchemaInput.js";
|
|
4
5
|
import type { FormStore } from "./FormStore.js";
|
|
5
|
-
import { type SchemaInputProps } from "./SchemaInput.js";
|
|
6
6
|
/**
|
|
7
7
|
* React context holding the current `FormStore`, provided by the `Form` component.
|
|
8
8
|
*
|
package/ui/form/FormContext.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
import { useStore } from "../../react/useStore.js";
|
|
3
|
+
import { isSchemaRequired } from "../input/SchemaInput.js";
|
|
3
4
|
import { requireContext } from "../util/context.js";
|
|
4
|
-
import { isSchemaRequired } from "./SchemaInput.js";
|
|
5
5
|
/**
|
|
6
6
|
* React context holding the current `FormStore`, provided by the `Form` component.
|
|
7
7
|
*
|
package/ui/form/FormContext.tsx
CHANGED
|
@@ -3,9 +3,9 @@ import { useStore } from "../../react/useStore.js";
|
|
|
3
3
|
import type { Schema } from "../../schema/Schema.js";
|
|
4
4
|
import type { Data } from "../../util/data.js";
|
|
5
5
|
import type { AnyCaller } from "../../util/function.js";
|
|
6
|
+
import { isSchemaRequired, type SchemaInputProps } from "../input/SchemaInput.js";
|
|
6
7
|
import { requireContext } from "../util/context.js";
|
|
7
8
|
import type { FormStore } from "./FormStore.js";
|
|
8
|
-
import { isSchemaRequired, type SchemaInputProps } from "./SchemaInput.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* React context holding the current `FormStore`, provided by the `Form` component.
|
package/ui/form/FormFields.d.ts
CHANGED
package/ui/form/FormFields.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useStore } from "../../react/useStore.js";
|
|
3
|
+
import { SchemaInput } from "../input/SchemaInput.js";
|
|
3
4
|
import { Field } from "./Field.js";
|
|
4
5
|
import { requireForm, useField } from "./FormContext.js";
|
|
5
|
-
import { SchemaInput } from "./SchemaInput.js";
|
|
6
6
|
/**
|
|
7
7
|
* Show a `<Field>` (label, input, and message) for a single named property of the current form.
|
|
8
8
|
*
|
package/ui/form/FormFields.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { useStore } from "../../react/useStore.js";
|
|
3
|
+
import type { InputProps } from "../input/Input.js";
|
|
4
|
+
import { SchemaInput } from "../input/SchemaInput.js";
|
|
3
5
|
import { Field } from "./Field.js";
|
|
4
6
|
import { requireForm, useField } from "./FormContext.js";
|
|
5
|
-
import type { InputProps } from "./Input.js";
|
|
6
|
-
import { SchemaInput } from "./SchemaInput.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Show a `<Field>` (label, input, and message) for a single named property of the current form.
|
package/ui/form/FormFooter.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Row } from "../block/Row.js";
|
|
3
3
|
import { Footer } from "../block/Section.js";
|
|
4
|
+
import { SubmitButton } from "../button/SubmitButton.js";
|
|
4
5
|
import { FormMessage } from "./FormMessage.js";
|
|
5
|
-
import { SubmitButton } from "./SubmitButton.js";
|
|
6
6
|
/**
|
|
7
7
|
* Show a form footer with a submit button and the form's error message.
|
|
8
8
|
* - Renders a row containing a `SubmitButton` (and any extra buttons passed as `children`).
|
package/ui/form/FormFooter.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { Row } from "../block/Row.js";
|
|
3
3
|
import { Footer } from "../block/Section.js";
|
|
4
|
+
import { SubmitButton } from "../button/SubmitButton.js";
|
|
4
5
|
import type { OptionalChildProps } from "../util/props.js";
|
|
5
6
|
import { FormMessage } from "./FormMessage.js";
|
|
6
|
-
import { SubmitButton } from "./SubmitButton.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Props for `FormFooter`, the submit-button-and-message footer for a form.
|
package/ui/form/FormInput.d.ts
CHANGED
package/ui/form/FormInput.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SchemaInput } from "../input/SchemaInput.js";
|
|
2
3
|
import { requireForm, useField } from "./FormContext.js";
|
|
3
|
-
import { SchemaInput } from "./SchemaInput.js";
|
|
4
4
|
/**
|
|
5
5
|
* Show a `SchemaInput` for a single named property of the current form.
|
|
6
6
|
* - Reads the field's value, schema, and message from the form context via `useField()`.
|
package/ui/form/FormInput.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import type { InputProps } from "../input/Input.js";
|
|
3
|
+
import { SchemaInput } from "../input/SchemaInput.js";
|
|
2
4
|
import { requireForm, useField } from "./FormContext.js";
|
|
3
|
-
import type { InputProps } from "./Input.js";
|
|
4
|
-
import { SchemaInput } from "./SchemaInput.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Props for `FormInput`, a bare `SchemaInput` bound to a named form field.
|
package/ui/form/Progress.d.ts
CHANGED
|
@@ -6,37 +6,19 @@ import type { ReactElement } from "react";
|
|
|
6
6
|
*/
|
|
7
7
|
export interface ProgressProps {
|
|
8
8
|
value: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
9
11
|
success?: boolean;
|
|
10
12
|
warning?: boolean;
|
|
11
13
|
danger?: boolean;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
|
-
* Show progress as a single continuous horizontal bar, filled to `value`
|
|
16
|
+
* Show progress as a single continuous horizontal bar, filled to `value` within the `min`–`max` range (matches `getPercent()` and `formatPercent()`).
|
|
17
|
+
* - The fill is allowed to overspill; CSS clamps it to the `0%`–`100%` range via `min-width`/`max-width`.
|
|
15
18
|
*
|
|
16
19
|
* @returns A progress bar element.
|
|
17
20
|
* @kind component
|
|
18
|
-
* @example <Progress value={
|
|
21
|
+
* @example <Progress value={3} max={4} />
|
|
19
22
|
* @see https://shelving.cc/ui/Progress
|
|
20
23
|
*/
|
|
21
|
-
export declare function Progress({ value, success, warning, danger }: ProgressProps): ReactElement | null;
|
|
22
|
-
/**
|
|
23
|
-
* Props for `SegmentedProgress`, a stepped progress bar of discrete segments.
|
|
24
|
-
*
|
|
25
|
-
* @see https://shelving.cc/ui/SegmentedProgressProps
|
|
26
|
-
*/
|
|
27
|
-
export interface SegmentedProgressProps {
|
|
28
|
-
total: number;
|
|
29
|
-
current: number;
|
|
30
|
-
success?: boolean;
|
|
31
|
-
warning?: boolean;
|
|
32
|
-
danger?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Show step progress as a horizontal bar of `total` segments, of which `current + 1` are filled.
|
|
36
|
-
*
|
|
37
|
-
* @returns A segmented progress bar element, or `null` when `total` is not positive.
|
|
38
|
-
* @kind component
|
|
39
|
-
* @example <SegmentedProgress total={4} current={1} />
|
|
40
|
-
* @see https://shelving.cc/ui/SegmentedProgress
|
|
41
|
-
*/
|
|
42
|
-
export declare function SegmentedProgress({ total, current, success, warning, danger }: SegmentedProgressProps): ReactElement | null;
|
|
24
|
+
export declare function Progress({ value, min, max, success, warning, danger }: ProgressProps): ReactElement | null;
|
package/ui/form/Progress.js
CHANGED
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { formatPercent } from "../../util/format.js";
|
|
3
|
+
import { getPercent } from "../../util/number.js";
|
|
2
4
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import styles from "./Progress.module.css";
|
|
4
6
|
/**
|
|
5
|
-
* Show progress as a single continuous horizontal bar, filled to `value`
|
|
7
|
+
* Show progress as a single continuous horizontal bar, filled to `value` within the `min`–`max` range (matches `getPercent()` and `formatPercent()`).
|
|
8
|
+
* - The fill is allowed to overspill; CSS clamps it to the `0%`–`100%` range via `min-width`/`max-width`.
|
|
6
9
|
*
|
|
7
10
|
* @returns A progress bar element.
|
|
8
11
|
* @kind component
|
|
9
|
-
* @example <Progress value={
|
|
12
|
+
* @example <Progress value={3} max={4} />
|
|
10
13
|
* @see https://shelving.cc/ui/Progress
|
|
11
14
|
*/
|
|
12
|
-
export function Progress({ value, success, warning, danger }) {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
return (_jsx("
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Show step progress as a horizontal bar of `total` segments, of which `current + 1` are filled.
|
|
19
|
-
*
|
|
20
|
-
* @returns A segmented progress bar element, or `null` when `total` is not positive.
|
|
21
|
-
* @kind component
|
|
22
|
-
* @example <SegmentedProgress total={4} current={1} />
|
|
23
|
-
* @see https://shelving.cc/ui/SegmentedProgress
|
|
24
|
-
*/
|
|
25
|
-
export function SegmentedProgress({ total, current, success, warning, danger }) {
|
|
26
|
-
if (total <= 0)
|
|
27
|
-
return null;
|
|
28
|
-
const progressStyle = { ["--progress-steps"]: total };
|
|
29
|
-
return (_jsx("div", { className: getClass(getModuleClass(styles, "segmented"), success && getModuleClass(styles, "success"), warning && getModuleClass(styles, "warning"), danger && getModuleClass(styles, "danger")), style: progressStyle, children: Array.from({ length: total }, (_, i) => (_jsx("span", { className: getClass(getModuleClass(styles, "item"), i <= current && getModuleClass(styles, "active")) }, i.toString()))) }));
|
|
15
|
+
export function Progress({ value, min = 0, max = 100, success, warning, danger }) {
|
|
16
|
+
const percent = getPercent(value - min, max - min);
|
|
17
|
+
const fillStyle = { width: `${Number.isFinite(percent) ? percent : 0}%` };
|
|
18
|
+
return (_jsx("figure", { className: getClass(getModuleClass(styles, "track"), success && getModuleClass(styles, "success"), warning && getModuleClass(styles, "warning"), danger && getModuleClass(styles, "danger")), role: "progressbar", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, "aria-valuetext": formatPercent(value - min, max - min), children: _jsx("span", { className: getModuleClass(styles, "fill"), style: fillStyle }) }));
|
|
30
19
|
}
|
|
@@ -7,51 +7,32 @@
|
|
|
7
7
|
/* Continuous progress bar — a single track that fills horizontally. */
|
|
8
8
|
.track {
|
|
9
9
|
position: relative;
|
|
10
|
+
margin: 0;
|
|
10
11
|
inline-size: 100%;
|
|
11
12
|
height: var(--progress-height, 0.375rem);
|
|
12
13
|
border-radius: var(--progress-radius, 999px);
|
|
13
|
-
background: var(--progress-
|
|
14
|
+
background: var(--progress-background, var(--tint-90));
|
|
14
15
|
overflow: hidden;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.fill {
|
|
18
19
|
display: block;
|
|
19
20
|
block-size: 100%;
|
|
20
|
-
inline
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Segmented progress — a grid of N items, of which some are `.active`. */
|
|
28
|
-
.segmented {
|
|
29
|
-
display: grid;
|
|
30
|
-
grid-template-columns: repeat(var(--progress-steps), minmax(0, 1fr));
|
|
31
|
-
gap: var(--progress-gap, 0.375rem);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.item {
|
|
35
|
-
height: var(--progress-height, 0.375rem);
|
|
36
|
-
border-radius: var(--progress-radius, 999px);
|
|
37
|
-
background: var(--progress-color-bg, var(--tint-90));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.active {
|
|
41
|
-
background: var(--progress-color-active, var(--color-blue));
|
|
21
|
+
/* Width is set inline; clamp overspill to the track here. */
|
|
22
|
+
min-width: 0px;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
background: var(--progress-color, var(--color-blue));
|
|
25
|
+
transition: all var(--duration-fast);
|
|
42
26
|
}
|
|
43
27
|
|
|
44
28
|
/* Status variants applied at the container level. */
|
|
45
|
-
.success .fill
|
|
46
|
-
|
|
47
|
-
background: var(--progress-success-color-active, var(--color-green));
|
|
29
|
+
.success .fill {
|
|
30
|
+
background: var(--progress-success, var(--color-green));
|
|
48
31
|
}
|
|
49
|
-
.warning .fill
|
|
50
|
-
|
|
51
|
-
background: var(--progress-warning-color-active, var(--color-orange));
|
|
32
|
+
.warning .fill {
|
|
33
|
+
background: var(--progress-warning, var(--color-orange));
|
|
52
34
|
}
|
|
53
|
-
.danger .fill
|
|
54
|
-
|
|
55
|
-
background: var(--progress-danger-color-active, var(--color-red));
|
|
35
|
+
.danger .fill {
|
|
36
|
+
background: var(--progress-danger, var(--color-red));
|
|
56
37
|
}
|
|
57
38
|
}
|
package/ui/form/Progress.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactElement } from "react";
|
|
2
|
+
import { formatPercent } from "../../util/format.js";
|
|
3
|
+
import { getPercent } from "../../util/number.js";
|
|
2
4
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import styles from "./Progress.module.css";
|
|
4
6
|
|
|
@@ -9,76 +11,41 @@ import styles from "./Progress.module.css";
|
|
|
9
11
|
*/
|
|
10
12
|
export interface ProgressProps {
|
|
11
13
|
value: number;
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
12
16
|
success?: boolean;
|
|
13
17
|
warning?: boolean;
|
|
14
18
|
danger?: boolean;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
|
-
* Show progress as a single continuous horizontal bar, filled to `value`
|
|
22
|
+
* Show progress as a single continuous horizontal bar, filled to `value` within the `min`–`max` range (matches `getPercent()` and `formatPercent()`).
|
|
23
|
+
* - The fill is allowed to overspill; CSS clamps it to the `0%`–`100%` range via `min-width`/`max-width`.
|
|
19
24
|
*
|
|
20
25
|
* @returns A progress bar element.
|
|
21
26
|
* @kind component
|
|
22
|
-
* @example <Progress value={
|
|
27
|
+
* @example <Progress value={3} max={4} />
|
|
23
28
|
* @see https://shelving.cc/ui/Progress
|
|
24
29
|
*/
|
|
25
|
-
export function Progress({ value, success, warning, danger }: ProgressProps): ReactElement | null {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
30
|
+
export function Progress({ value, min = 0, max = 100, success, warning, danger }: ProgressProps): ReactElement | null {
|
|
31
|
+
const percent = getPercent(value - min, max - min);
|
|
32
|
+
const fillStyle = { width: `${Number.isFinite(percent) ? percent : 0}%` } as CSSProperties;
|
|
28
33
|
|
|
29
34
|
return (
|
|
30
|
-
<
|
|
35
|
+
<figure
|
|
31
36
|
className={getClass(
|
|
32
37
|
getModuleClass(styles, "track"),
|
|
33
38
|
success && getModuleClass(styles, "success"),
|
|
34
39
|
warning && getModuleClass(styles, "warning"),
|
|
35
40
|
danger && getModuleClass(styles, "danger"),
|
|
36
41
|
)}
|
|
37
|
-
|
|
42
|
+
role="progressbar"
|
|
43
|
+
aria-valuemin={min}
|
|
44
|
+
aria-valuemax={max}
|
|
45
|
+
aria-valuenow={value}
|
|
46
|
+
aria-valuetext={formatPercent(value - min, max - min)}
|
|
38
47
|
>
|
|
39
|
-
<span className={getModuleClass(styles, "fill")} />
|
|
40
|
-
</
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Props for `SegmentedProgress`, a stepped progress bar of discrete segments.
|
|
46
|
-
*
|
|
47
|
-
* @see https://shelving.cc/ui/SegmentedProgressProps
|
|
48
|
-
*/
|
|
49
|
-
export interface SegmentedProgressProps {
|
|
50
|
-
total: number;
|
|
51
|
-
current: number;
|
|
52
|
-
success?: boolean;
|
|
53
|
-
warning?: boolean;
|
|
54
|
-
danger?: boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Show step progress as a horizontal bar of `total` segments, of which `current + 1` are filled.
|
|
59
|
-
*
|
|
60
|
-
* @returns A segmented progress bar element, or `null` when `total` is not positive.
|
|
61
|
-
* @kind component
|
|
62
|
-
* @example <SegmentedProgress total={4} current={1} />
|
|
63
|
-
* @see https://shelving.cc/ui/SegmentedProgress
|
|
64
|
-
*/
|
|
65
|
-
export function SegmentedProgress({ total, current, success, warning, danger }: SegmentedProgressProps): ReactElement | null {
|
|
66
|
-
if (total <= 0) return null;
|
|
67
|
-
const progressStyle = { ["--progress-steps" as string]: total } as CSSProperties;
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<div
|
|
71
|
-
className={getClass(
|
|
72
|
-
getModuleClass(styles, "segmented"),
|
|
73
|
-
success && getModuleClass(styles, "success"),
|
|
74
|
-
warning && getModuleClass(styles, "warning"),
|
|
75
|
-
danger && getModuleClass(styles, "danger"),
|
|
76
|
-
)}
|
|
77
|
-
style={progressStyle}
|
|
78
|
-
>
|
|
79
|
-
{Array.from({ length: total }, (_, i) => (
|
|
80
|
-
<span key={i.toString()} className={getClass(getModuleClass(styles, "item"), i <= current && getModuleClass(styles, "active"))} />
|
|
81
|
-
))}
|
|
82
|
-
</div>
|
|
48
|
+
<span className={getModuleClass(styles, "fill")} style={fillStyle} />
|
|
49
|
+
</figure>
|
|
83
50
|
);
|
|
84
51
|
}
|
package/ui/form/index.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
export * from "./ArrayInput.js";
|
|
2
|
-
export * from "./ArrayRadioInputs.js";
|
|
3
|
-
export * from "./Button.js";
|
|
4
|
-
export * from "./ButtonInput.js";
|
|
5
|
-
export * from "./ButtonInputPopover.js";
|
|
6
|
-
export * from "./ButtonPopover.js";
|
|
7
|
-
export * from "./CheckboxInput.js";
|
|
8
|
-
export * from "./ChoiceRadioInputs.js";
|
|
9
|
-
export * from "./Clickable.js";
|
|
10
|
-
export * from "./DataInput.js";
|
|
11
|
-
export * from "./DateInput.js";
|
|
12
|
-
export * from "./DictionaryInput.js";
|
|
13
1
|
export * from "./Field.js";
|
|
14
|
-
export * from "./FileInput.js";
|
|
15
2
|
export * from "./Form.js";
|
|
16
3
|
export * from "./FormContext.js";
|
|
17
4
|
export * from "./FormFields.js";
|
|
@@ -21,14 +8,4 @@ export * from "./FormMessage.js";
|
|
|
21
8
|
export * from "./FormNotice.js";
|
|
22
9
|
export * from "./FormNotify.js";
|
|
23
10
|
export * from "./FormStore.js";
|
|
24
|
-
export * from "./Input.js";
|
|
25
|
-
export * from "./NumberInput.js";
|
|
26
|
-
export * from "./OutputInput.js";
|
|
27
|
-
export * from "./Popover.js";
|
|
28
11
|
export * from "./Progress.js";
|
|
29
|
-
export * from "./QueryInput.js";
|
|
30
|
-
export * from "./RadioInput.js";
|
|
31
|
-
export * from "./SchemaInput.js";
|
|
32
|
-
export * from "./SelectInput.js";
|
|
33
|
-
export * from "./SubmitButton.js";
|
|
34
|
-
export * from "./TextInput.js";
|
package/ui/form/index.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
export * from "./ArrayInput.js";
|
|
2
|
-
export * from "./ArrayRadioInputs.js";
|
|
3
|
-
export * from "./Button.js";
|
|
4
|
-
export * from "./ButtonInput.js";
|
|
5
|
-
export * from "./ButtonInputPopover.js";
|
|
6
|
-
export * from "./ButtonPopover.js";
|
|
7
|
-
export * from "./CheckboxInput.js";
|
|
8
|
-
export * from "./ChoiceRadioInputs.js";
|
|
9
|
-
export * from "./Clickable.js";
|
|
10
|
-
export * from "./DataInput.js";
|
|
11
|
-
export * from "./DateInput.js";
|
|
12
|
-
export * from "./DictionaryInput.js";
|
|
13
1
|
export * from "./Field.js";
|
|
14
|
-
export * from "./FileInput.js";
|
|
15
2
|
export * from "./Form.js";
|
|
16
3
|
export * from "./FormContext.js";
|
|
17
4
|
export * from "./FormFields.js";
|
|
@@ -21,14 +8,4 @@ export * from "./FormMessage.js";
|
|
|
21
8
|
export * from "./FormNotice.js";
|
|
22
9
|
export * from "./FormNotify.js";
|
|
23
10
|
export * from "./FormStore.js";
|
|
24
|
-
export * from "./Input.js";
|
|
25
|
-
export * from "./NumberInput.js";
|
|
26
|
-
export * from "./OutputInput.js";
|
|
27
|
-
export * from "./Popover.js";
|
|
28
11
|
export * from "./Progress.js";
|
|
29
|
-
export * from "./QueryInput.js";
|
|
30
|
-
export * from "./RadioInput.js";
|
|
31
|
-
export * from "./SchemaInput.js";
|
|
32
|
-
export * from "./SelectInput.js";
|
|
33
|
-
export * from "./SubmitButton.js";
|
|
34
|
-
export * from "./TextInput.js";
|
package/ui/form/index.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
export * from "./ArrayInput.js";
|
|
2
|
-
export * from "./ArrayRadioInputs.js";
|
|
3
|
-
export * from "./Button.js";
|
|
4
|
-
export * from "./ButtonInput.js";
|
|
5
|
-
export * from "./ButtonInputPopover.js";
|
|
6
|
-
export * from "./ButtonPopover.js";
|
|
7
|
-
export * from "./CheckboxInput.js";
|
|
8
|
-
export * from "./ChoiceRadioInputs.js";
|
|
9
|
-
export * from "./Clickable.js";
|
|
10
|
-
export * from "./DataInput.js";
|
|
11
|
-
export * from "./DateInput.js";
|
|
12
|
-
export * from "./DictionaryInput.js";
|
|
13
1
|
export * from "./Field.js";
|
|
14
|
-
export * from "./FileInput.js";
|
|
15
2
|
export * from "./Form.js";
|
|
16
3
|
export * from "./FormContext.js";
|
|
17
4
|
export * from "./FormFields.js";
|
|
@@ -21,14 +8,4 @@ export * from "./FormMessage.js";
|
|
|
21
8
|
export * from "./FormNotice.js";
|
|
22
9
|
export * from "./FormNotify.js";
|
|
23
10
|
export * from "./FormStore.js";
|
|
24
|
-
export * from "./Input.js";
|
|
25
|
-
export * from "./NumberInput.js";
|
|
26
|
-
export * from "./OutputInput.js";
|
|
27
|
-
export * from "./Popover.js";
|
|
28
11
|
export * from "./Progress.js";
|
|
29
|
-
export * from "./QueryInput.js";
|
|
30
|
-
export * from "./RadioInput.js";
|
|
31
|
-
export * from "./SchemaInput.js";
|
|
32
|
-
export * from "./SelectInput.js";
|
|
33
|
-
export * from "./SubmitButton.js";
|
|
34
|
-
export * from "./TextInput.js";
|
package/ui/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./app/index.js";
|
|
2
2
|
export * from "./block/index.js";
|
|
3
|
+
export * from "./button/index.js";
|
|
3
4
|
export * from "./dialog/index.js";
|
|
4
5
|
export * from "./docs/index.js";
|
|
5
6
|
export * from "./form/index.js";
|
|
6
7
|
export * from "./inline/index.js";
|
|
8
|
+
export * from "./input/index.js";
|
|
7
9
|
export * from "./layout/index.js";
|
|
8
10
|
export * from "./menu/index.js";
|
|
9
11
|
export * from "./misc/index.js";
|
package/ui/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./app/index.js";
|
|
2
2
|
export * from "./block/index.js";
|
|
3
|
+
export * from "./button/index.js";
|
|
3
4
|
export * from "./dialog/index.js";
|
|
4
5
|
export * from "./docs/index.js";
|
|
5
6
|
export * from "./form/index.js";
|
|
6
7
|
export * from "./inline/index.js";
|
|
8
|
+
export * from "./input/index.js";
|
|
7
9
|
export * from "./layout/index.js";
|
|
8
10
|
export * from "./menu/index.js";
|
|
9
11
|
export * from "./misc/index.js";
|
package/ui/index.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./app/index.js";
|
|
2
2
|
export * from "./block/index.js";
|
|
3
|
+
export * from "./button/index.js";
|
|
3
4
|
export * from "./dialog/index.js";
|
|
4
5
|
export * from "./docs/index.js";
|
|
5
6
|
export * from "./form/index.js";
|
|
6
7
|
export * from "./inline/index.js";
|
|
8
|
+
export * from "./input/index.js";
|
|
7
9
|
export * from "./layout/index.js";
|
|
8
10
|
export * from "./menu/index.js";
|
|
9
11
|
export * from "./misc/index.js";
|
package/ui/inline/Deleted.md
CHANGED
|
@@ -5,7 +5,7 @@ Deleted text — renders a `<del>` element to mark content that has been removed
|
|
|
5
5
|
**Things to know:**
|
|
6
6
|
|
|
7
7
|
- Use `Deleted` for content genuinely removed from a document (edits, diffs, retired prices), and `<Inserted>` for content added — they pair up.
|
|
8
|
-
- It
|
|
8
|
+
- It colours itself directly from `--color-red` rather than the tint ladder, so a deletion stays a consistent red even inside a tinted region; change it with `--deleted-color`.
|
|
9
9
|
- Inside `<Prose>` a raw `<del>` picks up the same styling, so Markdown-rendered deletions match component ones.
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -22,13 +22,12 @@ import { Paragraph, Deleted, Inserted } from "shelving/ui";
|
|
|
22
22
|
|
|
23
23
|
## Styling
|
|
24
24
|
|
|
25
|
-
`Deleted`
|
|
25
|
+
`Deleted` colours its text directly from `--color-red` (not the tint ladder), so deletions stay a consistent red regardless of the surrounding tint. Override `--deleted-color` to recolour.
|
|
26
26
|
|
|
27
27
|
| Variable | Styles | Default |
|
|
28
28
|
|---|---|---|
|
|
29
|
-
| `--deleted-
|
|
30
|
-
| `--deleted-color` | Text colour | `var(--tint-50)` |
|
|
29
|
+
| `--deleted-color` | Text colour | `var(--color-red)` |
|
|
31
30
|
| `--deleted-decoration` | Text decoration | `line-through var(--stroke-normal)` |
|
|
32
31
|
| `--deleted-weight` | Font weight | `var(--weight-strong)` |
|
|
33
32
|
|
|
34
|
-
**Global tokens it reads:** `--color-red`, `--stroke-normal`, `--weight-strong
|
|
33
|
+
**Global tokens it reads:** `--color-red`, `--stroke-normal`, and `--weight-strong`.
|
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
@layer components {
|
|
7
7
|
.deleted,
|
|
8
8
|
.prose del {
|
|
9
|
-
--tint-50: var(--deleted-tint, var(--color-red));
|
|
10
|
-
|
|
11
9
|
/* Style */
|
|
12
|
-
color: var(--deleted-color, var(--
|
|
10
|
+
color: var(--deleted-color, var(--color-red));
|
|
13
11
|
text-decoration: var(--deleted-decoration, line-through var(--stroke-normal));
|
|
14
12
|
|
|
15
13
|
/* Text */
|