shelving 1.282.2 → 1.284.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 +2 -2
- package/ui/README.md +2 -1
- package/ui/block/Address.d.ts +7 -7
- package/ui/block/Address.js +6 -6
- package/ui/block/Address.tsx +10 -9
- package/ui/block/Block.d.ts +3 -3
- package/ui/block/Block.js +3 -2
- package/ui/block/Block.tsx +5 -4
- package/ui/block/Blockquote.d.ts +3 -3
- package/ui/block/Blockquote.js +2 -2
- package/ui/block/Blockquote.tsx +4 -3
- package/ui/block/Caption.d.ts +3 -3
- package/ui/block/Caption.js +3 -3
- package/ui/block/Caption.tsx +5 -4
- package/ui/block/Card.d.ts +3 -2
- package/ui/block/Card.js +2 -2
- package/ui/block/Card.tsx +4 -2
- package/ui/block/Column.d.ts +3 -3
- package/ui/block/Column.js +2 -2
- package/ui/block/Column.tsx +4 -3
- package/ui/block/Definitions.d.ts +3 -3
- package/ui/block/Definitions.js +2 -2
- package/ui/block/Definitions.tsx +4 -3
- package/ui/block/Details.d.ts +3 -2
- package/ui/block/Details.js +2 -2
- package/ui/block/Details.tsx +4 -3
- package/ui/block/Divider.d.ts +3 -2
- package/ui/block/Divider.js +2 -2
- package/ui/block/Divider.tsx +4 -2
- package/ui/block/Heading.d.ts +3 -3
- package/ui/block/Heading.js +2 -2
- package/ui/block/Heading.tsx +4 -3
- package/ui/block/Image.d.ts +3 -2
- package/ui/block/Image.js +2 -2
- package/ui/block/Image.tsx +4 -2
- package/ui/block/Label.d.ts +1 -1
- package/ui/block/Label.js +2 -2
- package/ui/block/Label.tsx +2 -1
- package/ui/block/List.d.ts +3 -2
- package/ui/block/List.js +4 -4
- package/ui/block/List.tsx +6 -4
- package/ui/block/Panel.d.ts +3 -3
- package/ui/block/Panel.js +2 -2
- package/ui/block/Panel.tsx +4 -3
- package/ui/block/Paragraph.d.ts +3 -3
- package/ui/block/Paragraph.js +2 -2
- package/ui/block/Paragraph.tsx +4 -3
- package/ui/block/Preformatted.d.ts +3 -3
- package/ui/block/Preformatted.js +2 -2
- package/ui/block/Preformatted.tsx +4 -3
- package/ui/block/Row.d.ts +3 -3
- package/ui/block/Row.js +2 -2
- package/ui/block/Row.tsx +4 -3
- package/ui/block/Section.js +1 -1
- package/ui/block/Section.tsx +1 -0
- package/ui/block/Subheading.d.ts +1 -1
- package/ui/block/Subheading.js +2 -2
- package/ui/block/Subheading.tsx +2 -1
- package/ui/block/Title.d.ts +1 -1
- package/ui/block/Title.js +2 -2
- package/ui/block/Title.tsx +2 -1
- package/ui/block/Video.d.ts +3 -3
- package/ui/block/Video.js +2 -2
- package/ui/block/Video.tsx +4 -3
- package/ui/button/Button.d.ts +3 -2
- package/ui/button/Button.js +2 -2
- package/ui/button/Button.md +28 -0
- package/ui/button/Button.module.css +23 -5
- package/ui/button/Button.tsx +4 -3
- package/ui/button/Clickable.d.ts +3 -3
- package/ui/button/Clickable.js +6 -4
- package/ui/button/Clickable.tsx +9 -9
- package/ui/button/FullscreenButton.d.ts +3 -5
- package/ui/button/FullscreenButton.tsx +3 -2
- package/ui/button/RetryButton.d.ts +2 -2
- package/ui/button/RetryButton.tsx +2 -2
- package/ui/button/SubmitButton.d.ts +3 -3
- package/ui/button/SubmitButton.js +3 -2
- package/ui/button/SubmitButton.tsx +5 -3
- package/ui/dialog/Dialog.d.ts +6 -4
- package/ui/dialog/Dialog.js +7 -4
- package/ui/dialog/Dialog.tsx +19 -7
- package/ui/dialog/Modal.d.ts +3 -3
- package/ui/dialog/Modal.js +3 -3
- package/ui/dialog/Modal.tsx +5 -5
- package/ui/docs/DocumentationButtons.d.ts +3 -2
- package/ui/docs/DocumentationButtons.js +2 -2
- package/ui/docs/DocumentationButtons.tsx +4 -1
- package/ui/form/Field.d.ts +3 -3
- package/ui/form/Field.js +2 -2
- package/ui/form/Field.tsx +4 -3
- package/ui/form/Form.d.ts +2 -2
- package/ui/form/Form.js +3 -2
- package/ui/form/Form.tsx +5 -3
- package/ui/form/FormFields.d.ts +1 -1
- package/ui/form/FormFields.js +2 -2
- package/ui/form/FormFields.tsx +2 -2
- package/ui/form/FormFooter.d.ts +3 -3
- package/ui/form/FormFooter.js +2 -2
- package/ui/form/FormFooter.tsx +4 -4
- package/ui/form/FormMessage.d.ts +2 -2
- package/ui/form/FormMessage.tsx +2 -3
- package/ui/form/Progress.d.ts +3 -2
- package/ui/form/Progress.js +2 -2
- package/ui/form/Progress.tsx +4 -2
- package/ui/inline/Code.d.ts +3 -3
- package/ui/inline/Code.js +2 -2
- package/ui/inline/Code.tsx +4 -3
- package/ui/inline/Deleted.d.ts +3 -3
- package/ui/inline/Deleted.js +2 -2
- package/ui/inline/Deleted.tsx +4 -3
- package/ui/inline/Emphasis.d.ts +3 -3
- package/ui/inline/Emphasis.js +2 -2
- package/ui/inline/Emphasis.tsx +4 -3
- package/ui/inline/Inserted.d.ts +3 -3
- package/ui/inline/Inserted.js +2 -2
- package/ui/inline/Inserted.tsx +4 -3
- package/ui/inline/Link.d.ts +3 -2
- package/ui/inline/Link.js +2 -2
- package/ui/inline/Link.tsx +4 -2
- package/ui/inline/Mark.d.ts +3 -3
- package/ui/inline/Mark.js +2 -2
- package/ui/inline/Mark.tsx +4 -3
- package/ui/inline/Small.d.ts +3 -3
- package/ui/inline/Small.js +2 -2
- package/ui/inline/Small.tsx +4 -3
- package/ui/inline/Span.d.ts +3 -3
- package/ui/inline/Span.js +3 -2
- package/ui/inline/Span.tsx +5 -4
- package/ui/inline/Strong.d.ts +3 -3
- package/ui/inline/Strong.js +2 -2
- package/ui/inline/Strong.tsx +4 -3
- package/ui/inline/Subscript.d.ts +3 -3
- package/ui/inline/Subscript.js +3 -3
- package/ui/inline/Subscript.tsx +5 -5
- package/ui/inline/Superscript.d.ts +3 -3
- package/ui/inline/Superscript.js +3 -3
- package/ui/inline/Superscript.tsx +5 -5
- package/ui/input/ArrayInput.js +2 -2
- package/ui/input/ArrayInput.tsx +2 -1
- package/ui/input/ArrayRadioInputs.d.ts +1 -1
- package/ui/input/ArrayRadioInputs.js +2 -2
- package/ui/input/ArrayRadioInputs.tsx +2 -1
- package/ui/input/ButtonInput.d.ts +1 -1
- package/ui/input/ButtonInput.js +2 -2
- package/ui/input/ButtonInput.tsx +2 -1
- package/ui/input/CheckboxInput.d.ts +1 -1
- package/ui/input/CheckboxInput.js +2 -2
- package/ui/input/CheckboxInput.tsx +2 -0
- package/ui/input/ChoiceRadioInputs.js +2 -2
- package/ui/input/ChoiceRadioInputs.tsx +2 -1
- package/ui/input/DataInput.js +2 -2
- package/ui/input/DataInput.tsx +2 -1
- package/ui/input/DateInput.d.ts +1 -1
- package/ui/input/DateInput.js +2 -2
- package/ui/input/DateInput.tsx +2 -1
- package/ui/input/DictionaryInput.js +2 -2
- package/ui/input/DictionaryInput.tsx +2 -1
- package/ui/input/FileInput.d.ts +1 -1
- package/ui/input/FileInput.js +3 -2
- package/ui/input/FileInput.tsx +3 -1
- package/ui/input/Input.d.ts +10 -3
- package/ui/input/Input.js +2 -2
- package/ui/input/Input.tsx +11 -4
- package/ui/input/NumberInput.d.ts +1 -1
- package/ui/input/NumberInput.js +2 -2
- package/ui/input/NumberInput.tsx +2 -1
- package/ui/input/OutputInput.d.ts +1 -1
- package/ui/input/OutputInput.js +2 -2
- package/ui/input/OutputInput.tsx +2 -2
- package/ui/input/Popover.d.ts +4 -2
- package/ui/input/Popover.js +4 -3
- package/ui/input/Popover.tsx +6 -3
- package/ui/input/PopoverButton.d.ts +28 -0
- package/ui/input/{ButtonPopover.js → PopoverButton.js} +10 -8
- package/ui/input/PopoverButton.tsx +44 -0
- package/ui/input/PopoverButtonInput.d.ts +27 -0
- package/ui/input/{ButtonInputPopover.js → PopoverButtonInput.js} +10 -8
- package/ui/input/PopoverButtonInput.tsx +44 -0
- package/ui/input/QueryInput.d.ts +1 -1
- package/ui/input/QueryInput.js +2 -2
- package/ui/input/QueryInput.tsx +2 -0
- package/ui/input/RadioInput.d.ts +1 -1
- package/ui/input/RadioInput.js +2 -2
- package/ui/input/RadioInput.tsx +2 -0
- package/ui/input/SchemaInput.d.ts +1 -1
- package/ui/input/SchemaInput.js +2 -2
- package/ui/input/SchemaInput.tsx +2 -2
- package/ui/input/SelectInput.js +2 -2
- package/ui/input/SelectInput.tsx +2 -1
- package/ui/input/TextInput.d.ts +1 -1
- package/ui/input/TextInput.js +3 -3
- package/ui/input/TextInput.tsx +3 -2
- package/ui/input/index.d.ts +2 -2
- package/ui/input/index.js +2 -2
- package/ui/input/index.ts +2 -2
- package/ui/menu/Menu.d.ts +5 -5
- package/ui/menu/Menu.js +4 -4
- package/ui/menu/Menu.tsx +7 -6
- package/ui/misc/Icon.d.ts +2 -1
- package/ui/misc/Icon.js +2 -1
- package/ui/misc/Icon.tsx +3 -1
- package/ui/misc/Loading.d.ts +2 -3
- package/ui/misc/Loading.js +2 -2
- package/ui/misc/Loading.tsx +10 -3
- package/ui/misc/Tag.d.ts +3 -2
- package/ui/misc/Tag.js +2 -2
- package/ui/misc/Tag.tsx +4 -3
- package/ui/notice/Message.d.ts +3 -3
- package/ui/notice/Message.js +2 -2
- package/ui/notice/Message.tsx +4 -3
- package/ui/notice/Notice.d.ts +3 -3
- package/ui/notice/Notice.js +2 -2
- package/ui/notice/Notice.tsx +4 -2
- package/ui/notice/Notices.d.ts +3 -2
- package/ui/notice/Notices.js +2 -2
- package/ui/notice/Notices.tsx +4 -3
- package/ui/table/Cell.d.ts +3 -3
- package/ui/table/Cell.js +2 -2
- package/ui/table/Cell.tsx +4 -3
- package/ui/table/Table.d.ts +3 -3
- package/ui/table/Table.js +2 -2
- package/ui/table/Table.tsx +4 -3
- package/ui/tree/TreeBreadcrumbs.d.ts +3 -2
- package/ui/tree/TreeBreadcrumbs.js +2 -2
- package/ui/tree/TreeBreadcrumbs.tsx +4 -2
- package/ui/tree/TreeButton.d.ts +2 -1
- package/ui/tree/TreeButton.tsx +2 -1
- package/ui/util/ClassProps.md +56 -0
- package/ui/util/css.d.ts +1 -1
- package/ui/util/css.js +2 -2
- package/ui/util/css.test.ts +29 -0
- package/ui/util/css.ts +2 -2
- package/ui/util/props.d.ts +12 -0
- package/ui/util/props.test.tsx +100 -0
- package/ui/util/props.ts +13 -0
- package/ui/input/ButtonInputPopover.d.ts +0 -25
- package/ui/input/ButtonInputPopover.tsx +0 -41
- package/ui/input/ButtonPopover.d.ts +0 -25
- package/ui/input/ButtonPopover.tsx +0 -40
package/ui/misc/Icon.d.ts
CHANGED
|
@@ -4,12 +4,13 @@ import type { SpaceVariants } from "../style/Space.js";
|
|
|
4
4
|
import { type StatusVariants } from "../style/Status.js";
|
|
5
5
|
import type { TintVariant } from "../style/Tint.js";
|
|
6
6
|
import { type SizeVariant } from "../style/Typography.js";
|
|
7
|
+
import type { ClassProps } from "../util/props.js";
|
|
7
8
|
/**
|
|
8
9
|
* Props for `<Icon>` — the `status` to represent and optional icon `size`.
|
|
9
10
|
*
|
|
10
11
|
* @see https://shelving.cc/ui/IconProps
|
|
11
12
|
*/
|
|
12
|
-
export interface IconProps extends ColorVariants, StatusVariants, SpaceVariants {
|
|
13
|
+
export interface IconProps extends ColorVariants, StatusVariants, SpaceVariants, ClassProps {
|
|
13
14
|
/**
|
|
14
15
|
* Set the icon to use. Defaults to appropriate icon for `status`
|
|
15
16
|
*/
|
package/ui/misc/Icon.js
CHANGED
|
@@ -23,5 +23,6 @@ const STATUS_ICONS = {
|
|
|
23
23
|
export function Icon(props) {
|
|
24
24
|
const { status = "info", icon: Element = STATUS_ICONS[status] ?? InformationCircleIcon } = props;
|
|
25
25
|
return (_jsx(Element, { className: getClass(getModuleClass(ICON_CSS, "icon"), //
|
|
26
|
-
getStatusClass(props), getTypographyClass(props)
|
|
26
|
+
getStatusClass(props), getTypographyClass(props), // Used for colour, size, and tint.
|
|
27
|
+
props.className) }));
|
|
27
28
|
}
|
package/ui/misc/Icon.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import { getStatusClass, type Status, type StatusVariants } from "../style/Statu
|
|
|
6
6
|
import type { TintVariant } from "../style/Tint.js";
|
|
7
7
|
import { getTypographyClass, type SizeVariant } from "../style/Typography.js";
|
|
8
8
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
9
|
+
import type { ClassProps } from "../util/props.js";
|
|
9
10
|
import ICON_CSS from "./Icon.module.css";
|
|
10
11
|
import { Loading } from "./Loading.js";
|
|
11
12
|
|
|
@@ -24,7 +25,7 @@ const STATUS_ICONS: {
|
|
|
24
25
|
*
|
|
25
26
|
* @see https://shelving.cc/ui/IconProps
|
|
26
27
|
*/
|
|
27
|
-
export interface IconProps extends ColorVariants, StatusVariants, SpaceVariants {
|
|
28
|
+
export interface IconProps extends ColorVariants, StatusVariants, SpaceVariants, ClassProps {
|
|
28
29
|
/**
|
|
29
30
|
* Set the icon to use. Defaults to appropriate icon for `status`
|
|
30
31
|
*/
|
|
@@ -57,6 +58,7 @@ export function Icon(props: IconProps): ReactElement {
|
|
|
57
58
|
getModuleClass(ICON_CSS, "icon"), //
|
|
58
59
|
getStatusClass(props),
|
|
59
60
|
getTypographyClass(props), // Used for colour, size, and tint.
|
|
61
|
+
props.className,
|
|
60
62
|
)}
|
|
61
63
|
/>
|
|
62
64
|
);
|
package/ui/misc/Loading.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import type { ClassProps } from "../util/props.js";
|
|
2
3
|
/**
|
|
3
4
|
* Animated loading spinner shaped like a Heroicon — a faint track plus a rotating indicator arc.
|
|
4
5
|
*
|
|
@@ -9,9 +10,7 @@ import type { ReactElement } from "react";
|
|
|
9
10
|
* @kind component
|
|
10
11
|
* @see https://shelving.cc/ui/Loading
|
|
11
12
|
*/
|
|
12
|
-
export declare function Loading({ className }:
|
|
13
|
-
className?: string | undefined;
|
|
14
|
-
}): ReactElement;
|
|
13
|
+
export declare function Loading({ className }: ClassProps): ReactElement;
|
|
15
14
|
/**
|
|
16
15
|
* Shared loading spinner element with a stable `key`, ready to drop into `Suspense` fallbacks and lists.
|
|
17
16
|
*
|
package/ui/misc/Loading.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
3
|
import { Icon } from "./Icon.js";
|
|
4
4
|
import LOADING_CSS from "./Loading.module.css";
|
|
5
5
|
const LOADING_TRACK_CLASS = getModuleClass(LOADING_CSS, "track");
|
|
@@ -15,7 +15,7 @@ const LOADING_INDICATOR_CLASS = getModuleClass(LOADING_CSS, "indicator");
|
|
|
15
15
|
* @see https://shelving.cc/ui/Loading
|
|
16
16
|
*/
|
|
17
17
|
export function Loading({ className }) {
|
|
18
|
-
return (_jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", className: className, "data-slot": "icon", children: [_jsx("title", { children: "Loading..." }), _jsx("circle", { className: LOADING_TRACK_CLASS, cx: "12", cy: "12", r: "9", pathLength: "100" }), _jsxs("g", { children: [_jsx("animateTransform", { attributeName: "transform", attributeType: "xml", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.5s", repeatCount: "indefinite" }), _jsx("circle", { className: LOADING_INDICATOR_CLASS, cx: "12", cy: "12", r: "9", pathLength: "100" })] })] }));
|
|
18
|
+
return (_jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", className: getClass(className) || undefined, "data-slot": "icon", children: [_jsx("title", { children: "Loading..." }), _jsx("circle", { className: LOADING_TRACK_CLASS, cx: "12", cy: "12", r: "9", pathLength: "100" }), _jsxs("g", { children: [_jsx("animateTransform", { attributeName: "transform", attributeType: "xml", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.5s", repeatCount: "indefinite" }), _jsx("circle", { className: LOADING_INDICATOR_CLASS, cx: "12", cy: "12", r: "9", pathLength: "100" })] })] }));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Shared loading spinner element with a stable `key`, ready to drop into `Suspense` fallbacks and lists.
|
package/ui/misc/Loading.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
|
+
import type { ClassProps } from "../util/props.js";
|
|
3
4
|
import { Icon } from "./Icon.js";
|
|
4
5
|
import LOADING_CSS from "./Loading.module.css";
|
|
5
6
|
|
|
@@ -16,9 +17,15 @@ const LOADING_INDICATOR_CLASS = getModuleClass(LOADING_CSS, "indicator");
|
|
|
16
17
|
* @kind component
|
|
17
18
|
* @see https://shelving.cc/ui/Loading
|
|
18
19
|
*/
|
|
19
|
-
export function Loading({ className }:
|
|
20
|
+
export function Loading({ className }: ClassProps): ReactElement {
|
|
20
21
|
return (
|
|
21
|
-
<svg
|
|
22
|
+
<svg
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
viewBox="0 0 24 24"
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
className={getClass(className) || undefined}
|
|
27
|
+
data-slot="icon"
|
|
28
|
+
>
|
|
22
29
|
<title>Loading...</title>
|
|
23
30
|
<circle className={LOADING_TRACK_CLASS} cx="12" cy="12" r="9" pathLength="100" />
|
|
24
31
|
<g>
|
package/ui/misc/Tag.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ReactElement } from "react";
|
|
|
2
2
|
import { type ClickableProps } from "../button/Clickable.js";
|
|
3
3
|
import { type StatusVariants } from "../style/Status.js";
|
|
4
4
|
import { type TypographyVariants } from "../style/Typography.js";
|
|
5
|
+
import type { ClassProps } from "../util/props.js";
|
|
5
6
|
/**
|
|
6
7
|
* Styling variants accepted by `<Tag>` — status, colour, and typography options.
|
|
7
8
|
*
|
|
@@ -23,7 +24,7 @@ export declare function getTagClass(variants: TagVariants): string;
|
|
|
23
24
|
*
|
|
24
25
|
* @see https://shelving.cc/ui/TagProps
|
|
25
26
|
*/
|
|
26
|
-
export interface TagProps extends TagVariants, ClickableProps {
|
|
27
|
+
export interface TagProps extends TagVariants, ClickableProps, ClassProps {
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
30
|
* Small inline label used to annotate other content.
|
|
@@ -33,4 +34,4 @@ export interface TagProps extends TagVariants, ClickableProps {
|
|
|
33
34
|
* @kind component
|
|
34
35
|
* @see https://shelving.cc/ui/Tag
|
|
35
36
|
*/
|
|
36
|
-
export declare function Tag(props: TagProps): ReactElement;
|
|
37
|
+
export declare function Tag({ className, ...props }: TagProps): ReactElement;
|
package/ui/misc/Tag.js
CHANGED
|
@@ -25,6 +25,6 @@ export function getTagClass(variants) {
|
|
|
25
25
|
* @kind component
|
|
26
26
|
* @see https://shelving.cc/ui/Tag
|
|
27
27
|
*/
|
|
28
|
-
export function Tag(props) {
|
|
29
|
-
return _jsx(Clickable, { ...props, className: getTagClass(props) });
|
|
28
|
+
export function Tag({ className, ...props }) {
|
|
29
|
+
return _jsx(Clickable, { ...props, className: getClass(getTagClass(props), className) });
|
|
30
30
|
}
|
package/ui/misc/Tag.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Clickable, type ClickableProps } from "../button/Clickable.js";
|
|
|
3
3
|
import { getStatusClass, type StatusVariants } from "../style/Status.js";
|
|
4
4
|
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
5
5
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
6
|
+
import type { ClassProps } from "../util/props.js";
|
|
6
7
|
import TAG_CSS from "./Tag.module.css";
|
|
7
8
|
|
|
8
9
|
const TAG_CLASS = getModuleClass(TAG_CSS, "tag");
|
|
@@ -35,7 +36,7 @@ export function getTagClass(variants: TagVariants) {
|
|
|
35
36
|
*
|
|
36
37
|
* @see https://shelving.cc/ui/TagProps
|
|
37
38
|
*/
|
|
38
|
-
export interface TagProps extends TagVariants, ClickableProps {}
|
|
39
|
+
export interface TagProps extends TagVariants, ClickableProps, ClassProps {}
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* Small inline label used to annotate other content.
|
|
@@ -45,6 +46,6 @@ export interface TagProps extends TagVariants, ClickableProps {}
|
|
|
45
46
|
* @kind component
|
|
46
47
|
* @see https://shelving.cc/ui/Tag
|
|
47
48
|
*/
|
|
48
|
-
export function Tag(props: TagProps): ReactElement {
|
|
49
|
-
return <Clickable {...props} className={getTagClass(props)} />;
|
|
49
|
+
export function Tag({ className, ...props }: TagProps): ReactElement {
|
|
50
|
+
return <Clickable {...props} className={getClass(getTagClass(props), className)} />;
|
|
50
51
|
}
|
package/ui/notice/Message.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type BlockVariants } from "../style/Block.js";
|
|
2
2
|
import { type StatusVariants } from "../style/Status.js";
|
|
3
|
-
import type { ChildProps } from "../util/index.js";
|
|
3
|
+
import type { ChildProps, ClassProps } from "../util/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Props for `<Message>` — paragraph props plus colour and status styling variants.
|
|
6
6
|
*
|
|
7
7
|
* @see https://shelving.cc/ui/MessageProps
|
|
8
8
|
*/
|
|
9
|
-
export interface MessageProps extends BlockVariants, StatusVariants, ChildProps {
|
|
9
|
+
export interface MessageProps extends BlockVariants, StatusVariants, ChildProps, ClassProps {
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Status-coloured paragraph used for inline feedback messages.
|
|
@@ -16,4 +16,4 @@ export interface MessageProps extends BlockVariants, StatusVariants, ChildProps
|
|
|
16
16
|
* @example <Message status="error">Something went wrong</Message>
|
|
17
17
|
* @see https://shelving.cc/ui/Message
|
|
18
18
|
*/
|
|
19
|
-
export declare function Message({ children, ...props }: MessageProps): import("react").JSX.Element;
|
|
19
|
+
export declare function Message({ children, className, ...props }: MessageProps): import("react").JSX.Element;
|
package/ui/notice/Message.js
CHANGED
|
@@ -12,8 +12,8 @@ const MESSAGE_CLASS = getModuleClass(MESSAGE_CSS, "message");
|
|
|
12
12
|
* @example <Message status="error">Something went wrong</Message>
|
|
13
13
|
* @see https://shelving.cc/ui/Message
|
|
14
14
|
*/
|
|
15
|
-
export function Message({ children, ...props }) {
|
|
15
|
+
export function Message({ children, className, ...props }) {
|
|
16
16
|
const { status } = props;
|
|
17
17
|
return (_jsx("p", { role: status === "error" || status === "danger" ? "alert" : "status", className: getClass(MESSAGE_CLASS, //
|
|
18
|
-
getBlockClass(props), getStatusClass(props)), children: children }));
|
|
18
|
+
getBlockClass(props), getStatusClass(props), className), children: children }));
|
|
19
19
|
}
|
package/ui/notice/Message.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
2
2
|
import { getStatusClass, type StatusVariants } from "../style/Status.js";
|
|
3
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
4
|
-
import type { ChildProps } from "../util/index.js";
|
|
4
|
+
import type { ChildProps, ClassProps } from "../util/index.js";
|
|
5
5
|
import MESSAGE_CSS from "./Message.module.css";
|
|
6
6
|
|
|
7
7
|
const MESSAGE_CLASS = getModuleClass(MESSAGE_CSS, "message");
|
|
@@ -11,7 +11,7 @@ const MESSAGE_CLASS = getModuleClass(MESSAGE_CSS, "message");
|
|
|
11
11
|
*
|
|
12
12
|
* @see https://shelving.cc/ui/MessageProps
|
|
13
13
|
*/
|
|
14
|
-
export interface MessageProps extends BlockVariants, StatusVariants, ChildProps {}
|
|
14
|
+
export interface MessageProps extends BlockVariants, StatusVariants, ChildProps, ClassProps {}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Status-coloured paragraph used for inline feedback messages.
|
|
@@ -21,7 +21,7 @@ export interface MessageProps extends BlockVariants, StatusVariants, ChildProps
|
|
|
21
21
|
* @example <Message status="error">Something went wrong</Message>
|
|
22
22
|
* @see https://shelving.cc/ui/Message
|
|
23
23
|
*/
|
|
24
|
-
export function Message({ children, ...props }: MessageProps) {
|
|
24
|
+
export function Message({ children, className, ...props }: MessageProps) {
|
|
25
25
|
const { status } = props;
|
|
26
26
|
return (
|
|
27
27
|
<p
|
|
@@ -30,6 +30,7 @@ export function Message({ children, ...props }: MessageProps) {
|
|
|
30
30
|
MESSAGE_CLASS, //
|
|
31
31
|
getBlockClass(props),
|
|
32
32
|
getStatusClass(props),
|
|
33
|
+
className,
|
|
33
34
|
)}
|
|
34
35
|
>
|
|
35
36
|
{children}
|
package/ui/notice/Notice.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { ReactElement } from "react";
|
|
|
2
2
|
import { type BlockVariants } from "../style/Block.js";
|
|
3
3
|
import { type FlexVariants } from "../style/Flex.js";
|
|
4
4
|
import { type StatusVariants } from "../style/Status.js";
|
|
5
|
-
import type { OptionalChildProps } from "../util/props.js";
|
|
5
|
+
import type { ClassProps, OptionalChildProps } from "../util/props.js";
|
|
6
6
|
/**
|
|
7
7
|
* Props for `<Notice>` — flex/colour/status styling variants, optional `children`, and an optional `icon`.
|
|
8
8
|
*
|
|
9
9
|
* @see https://shelving.cc/ui/NoticeProps
|
|
10
10
|
*/
|
|
11
|
-
export interface NoticeProps extends BlockVariants, FlexVariants, StatusVariants, OptionalChildProps {
|
|
11
|
+
export interface NoticeProps extends BlockVariants, FlexVariants, StatusVariants, OptionalChildProps, ClassProps {
|
|
12
12
|
/** Icon for the notice (or `null` or `false` to hide the icon, defaults to `<StatusIcon>`). */
|
|
13
13
|
icon?: ReactElement | false | undefined;
|
|
14
14
|
}
|
|
@@ -22,7 +22,7 @@ export interface NoticeProps extends BlockVariants, FlexVariants, StatusVariants
|
|
|
22
22
|
* @see https://shelving.cc/ui/Notice
|
|
23
23
|
*/
|
|
24
24
|
export declare function Notice({ children, //
|
|
25
|
-
icon, ...props }: NoticeProps): import("react").JSX.Element;
|
|
25
|
+
icon, className, ...props }: NoticeProps): import("react").JSX.Element;
|
|
26
26
|
/**
|
|
27
27
|
* Shared loading `<Notice>` element showing the loading spinner.
|
|
28
28
|
*
|
package/ui/notice/Notice.js
CHANGED
|
@@ -16,10 +16,10 @@ const NOTICE_CLASS = getModuleClass(NOTICE_CSS, "notice");
|
|
|
16
16
|
* @see https://shelving.cc/ui/Notice
|
|
17
17
|
*/
|
|
18
18
|
export function Notice({ children, //
|
|
19
|
-
icon, ...props }) {
|
|
19
|
+
icon, className, ...props }) {
|
|
20
20
|
const { status } = props;
|
|
21
21
|
return (_jsxs("aside", { role: status === "danger" || status === "error" ? "alert" : "status", className: getClass(NOTICE_CLASS, //
|
|
22
|
-
getBlockClass(props), getFlexClass(props), getStatusClass(props)), children: [icon !== undefined ? icon : status && _jsx(Icon, { status: status }), children] }));
|
|
22
|
+
getBlockClass(props), getFlexClass(props), getStatusClass(props), className), children: [icon !== undefined ? icon : status && _jsx(Icon, { status: status }), children] }));
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Shared loading `<Notice>` element showing the loading spinner.
|
package/ui/notice/Notice.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
|
4
4
|
import { type FlexVariants, getFlexClass } from "../style/Flex.js";
|
|
5
5
|
import { getStatusClass, type StatusVariants } from "../style/Status.js";
|
|
6
6
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
7
|
-
import type { OptionalChildProps } from "../util/props.js";
|
|
7
|
+
import type { ClassProps, OptionalChildProps } from "../util/props.js";
|
|
8
8
|
import NOTICE_CSS from "./Notice.module.css";
|
|
9
9
|
|
|
10
10
|
const NOTICE_CLASS = getModuleClass(NOTICE_CSS, "notice");
|
|
@@ -14,7 +14,7 @@ const NOTICE_CLASS = getModuleClass(NOTICE_CSS, "notice");
|
|
|
14
14
|
*
|
|
15
15
|
* @see https://shelving.cc/ui/NoticeProps
|
|
16
16
|
*/
|
|
17
|
-
export interface NoticeProps extends BlockVariants, FlexVariants, StatusVariants, OptionalChildProps {
|
|
17
|
+
export interface NoticeProps extends BlockVariants, FlexVariants, StatusVariants, OptionalChildProps, ClassProps {
|
|
18
18
|
/** Icon for the notice (or `null` or `false` to hide the icon, defaults to `<StatusIcon>`). */
|
|
19
19
|
icon?: ReactElement | false | undefined;
|
|
20
20
|
}
|
|
@@ -31,6 +31,7 @@ export interface NoticeProps extends BlockVariants, FlexVariants, StatusVariants
|
|
|
31
31
|
export function Notice({
|
|
32
32
|
children, //
|
|
33
33
|
icon,
|
|
34
|
+
className,
|
|
34
35
|
...props
|
|
35
36
|
}: NoticeProps) {
|
|
36
37
|
const { status } = props;
|
|
@@ -42,6 +43,7 @@ export function Notice({
|
|
|
42
43
|
getBlockClass(props),
|
|
43
44
|
getFlexClass(props),
|
|
44
45
|
getStatusClass(props),
|
|
46
|
+
className,
|
|
45
47
|
)}
|
|
46
48
|
>
|
|
47
49
|
{icon !== undefined ? icon : status && <Icon status={status} />}
|
package/ui/notice/Notices.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
2
|
import { type FlexVariants } from "../style/Flex.js";
|
|
3
|
+
import type { ClassProps } from "../util/props.js";
|
|
3
4
|
/**
|
|
4
5
|
* Props for `<Notices>` — flex styling variants for the notices container.
|
|
5
6
|
*
|
|
6
7
|
* @see https://shelving.cc/ui/NoticesProps
|
|
7
8
|
*/
|
|
8
|
-
export interface NoticesProps extends FlexVariants {
|
|
9
|
+
export interface NoticesProps extends FlexVariants, ClassProps {
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Render the global list of notices and subscribe to incoming `"notice"` events.
|
|
@@ -15,4 +16,4 @@ export interface NoticesProps extends FlexVariants {
|
|
|
15
16
|
* @kind component
|
|
16
17
|
* @see https://shelving.cc/ui/Notices
|
|
17
18
|
*/
|
|
18
|
-
export declare function Notices(props: NoticesProps): ReactElement;
|
|
19
|
+
export declare function Notices({ className, ...props }: NoticesProps): ReactElement;
|
package/ui/notice/Notices.js
CHANGED
|
@@ -16,11 +16,11 @@ const NOTICES_CLASS = getModuleClass(NOTICES_CSS, "notices");
|
|
|
16
16
|
* @kind component
|
|
17
17
|
* @see https://shelving.cc/ui/Notices
|
|
18
18
|
*/
|
|
19
|
-
export function Notices(props) {
|
|
19
|
+
export function Notices({ className, ...props }) {
|
|
20
20
|
const notices = useStore(NOTICES).value;
|
|
21
21
|
useEffect(() => {
|
|
22
22
|
// Subscribe to global notices.
|
|
23
23
|
return subscribeNotices((message, status) => NOTICES.show(message, status));
|
|
24
24
|
});
|
|
25
|
-
return (_jsx("aside", { className: getClass(NOTICES_CLASS, getFlexClass(props)), children: notices.map(({ key, value }) => (_jsx(Notice, { ...value }, key))) }));
|
|
25
|
+
return (_jsx("aside", { className: getClass(NOTICES_CLASS, getFlexClass(props), className), children: notices.map(({ key, value }) => (_jsx(Notice, { ...value }, key))) }));
|
|
26
26
|
}
|
package/ui/notice/Notices.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { useStore } from "../../react/useStore.js";
|
|
|
3
3
|
import { type FlexVariants, getFlexClass } from "../style/Flex.js";
|
|
4
4
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
5
5
|
import { subscribeNotices } from "../util/notice.js";
|
|
6
|
+
import type { ClassProps } from "../util/props.js";
|
|
6
7
|
import { Notice } from "./Notice.js";
|
|
7
8
|
import NOTICES_CSS from "./Notices.module.css";
|
|
8
9
|
import { NOTICES } from "./NoticesStore.js";
|
|
@@ -14,7 +15,7 @@ const NOTICES_CLASS = getModuleClass(NOTICES_CSS, "notices");
|
|
|
14
15
|
*
|
|
15
16
|
* @see https://shelving.cc/ui/NoticesProps
|
|
16
17
|
*/
|
|
17
|
-
export interface NoticesProps extends FlexVariants {}
|
|
18
|
+
export interface NoticesProps extends FlexVariants, ClassProps {}
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Render the global list of notices and subscribe to incoming `"notice"` events.
|
|
@@ -24,14 +25,14 @@ export interface NoticesProps extends FlexVariants {}
|
|
|
24
25
|
* @kind component
|
|
25
26
|
* @see https://shelving.cc/ui/Notices
|
|
26
27
|
*/
|
|
27
|
-
export function Notices(props: NoticesProps): ReactElement {
|
|
28
|
+
export function Notices({ className, ...props }: NoticesProps): ReactElement {
|
|
28
29
|
const notices = useStore(NOTICES).value;
|
|
29
30
|
useEffect(() => {
|
|
30
31
|
// Subscribe to global notices.
|
|
31
32
|
return subscribeNotices((message, status) => NOTICES.show(message, status));
|
|
32
33
|
});
|
|
33
34
|
return (
|
|
34
|
-
<aside className={getClass(NOTICES_CLASS, getFlexClass(props))}>
|
|
35
|
+
<aside className={getClass(NOTICES_CLASS, getFlexClass(props), className)}>
|
|
35
36
|
{notices.map(({ key, value }) => (
|
|
36
37
|
<Notice key={key} {...value} />
|
|
37
38
|
))}
|
package/ui/table/Cell.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { type TypographyVariants } from "../style/Typography.js";
|
|
3
3
|
import { type WidthVariants } from "../style/Width.js";
|
|
4
|
-
import type { OptionalChildProps } from "../util/index.js";
|
|
4
|
+
import type { ClassProps, OptionalChildProps } from "../util/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Props for `Cell` — width and typography variants plus `children`.
|
|
7
7
|
*
|
|
8
8
|
* @see https://shelving.cc/ui/CellProps
|
|
9
9
|
*/
|
|
10
|
-
export interface CellProps extends WidthVariants, TypographyVariants, OptionalChildProps {
|
|
10
|
+
export interface CellProps extends WidthVariants, TypographyVariants, OptionalChildProps, ClassProps {
|
|
11
11
|
header?: boolean | undefined;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -19,4 +19,4 @@ export interface CellProps extends WidthVariants, TypographyVariants, OptionalCh
|
|
|
19
19
|
* @kind component
|
|
20
20
|
* @see https://shelving.cc/ui/Cell
|
|
21
21
|
*/
|
|
22
|
-
export declare function Cell({ header, children, ...props }: CellProps): ReactElement;
|
|
22
|
+
export declare function Cell({ header, children, className, ...props }: CellProps): ReactElement;
|
package/ui/table/Cell.js
CHANGED
|
@@ -11,8 +11,8 @@ import { getClass } from "../util/css.js";
|
|
|
11
11
|
* @kind component
|
|
12
12
|
* @see https://shelving.cc/ui/Cell
|
|
13
13
|
*/
|
|
14
|
-
export function Cell({ header = false, children, ...props }) {
|
|
14
|
+
export function Cell({ header = false, children, className, ...props }) {
|
|
15
15
|
const Component = header ? "th" : "td";
|
|
16
16
|
return (_jsx(Component, { className: getClass(getWidthClass(props), //
|
|
17
|
-
getTypographyClass(props)), children: children }));
|
|
17
|
+
getTypographyClass(props), className), children: children }));
|
|
18
18
|
}
|
package/ui/table/Cell.tsx
CHANGED
|
@@ -2,14 +2,14 @@ import type { ReactElement } from "react";
|
|
|
2
2
|
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
3
3
|
import { getWidthClass, type WidthVariants } from "../style/Width.js";
|
|
4
4
|
import { getClass } from "../util/css.js";
|
|
5
|
-
import type { OptionalChildProps } from "../util/index.js";
|
|
5
|
+
import type { ClassProps, OptionalChildProps } from "../util/index.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Props for `Cell` — width and typography variants plus `children`.
|
|
9
9
|
*
|
|
10
10
|
* @see https://shelving.cc/ui/CellProps
|
|
11
11
|
*/
|
|
12
|
-
export interface CellProps extends WidthVariants, TypographyVariants, OptionalChildProps {
|
|
12
|
+
export interface CellProps extends WidthVariants, TypographyVariants, OptionalChildProps, ClassProps {
|
|
13
13
|
header?: boolean | undefined;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -22,13 +22,14 @@ export interface CellProps extends WidthVariants, TypographyVariants, OptionalCh
|
|
|
22
22
|
* @kind component
|
|
23
23
|
* @see https://shelving.cc/ui/Cell
|
|
24
24
|
*/
|
|
25
|
-
export function Cell({ header = false, children, ...props }: CellProps): ReactElement {
|
|
25
|
+
export function Cell({ header = false, children, className, ...props }: CellProps): ReactElement {
|
|
26
26
|
const Component = header ? "th" : "td";
|
|
27
27
|
return (
|
|
28
28
|
<Component
|
|
29
29
|
className={getClass(
|
|
30
30
|
getWidthClass(props), //
|
|
31
31
|
getTypographyClass(props),
|
|
32
|
+
className,
|
|
32
33
|
)}
|
|
33
34
|
>
|
|
34
35
|
{children}
|
package/ui/table/Table.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { type BlockVariants } from "../style/Block.js";
|
|
3
|
-
import type { ChildProps } from "../util/props.js";
|
|
3
|
+
import type { ChildProps, ClassProps } from "../util/props.js";
|
|
4
4
|
/**
|
|
5
5
|
* Props for `Table` — colour, space, typography, and width variants plus `children`.
|
|
6
6
|
*
|
|
7
7
|
* @see https://shelving.cc/ui/TableProps
|
|
8
8
|
*/
|
|
9
|
-
export interface TableProps extends BlockVariants, ChildProps {
|
|
9
|
+
export interface TableProps extends BlockVariants, ChildProps, ClassProps {
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Table block — rendered as `<table>`.
|
|
@@ -16,4 +16,4 @@ export interface TableProps extends BlockVariants, ChildProps {
|
|
|
16
16
|
* @kind component
|
|
17
17
|
* @see https://shelving.cc/ui/Table
|
|
18
18
|
*/
|
|
19
|
-
export declare function Table({ children, ...props }: TableProps): ReactElement;
|
|
19
|
+
export declare function Table({ children, className, ...props }: TableProps): ReactElement;
|
package/ui/table/Table.js
CHANGED
|
@@ -11,7 +11,7 @@ const TABLE_CLASS = getModuleClass(TABLE_CSS, "table");
|
|
|
11
11
|
* @kind component
|
|
12
12
|
* @see https://shelving.cc/ui/Table
|
|
13
13
|
*/
|
|
14
|
-
export function Table({ children, ...props }) {
|
|
14
|
+
export function Table({ children, className, ...props }) {
|
|
15
15
|
return (_jsx("table", { className: getClass(TABLE_CLASS, //
|
|
16
|
-
getBlockClass(props)), children: children }));
|
|
16
|
+
getBlockClass(props), className), children: children }));
|
|
17
17
|
}
|
package/ui/table/Table.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
3
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
4
|
-
import type { ChildProps } from "../util/props.js";
|
|
4
|
+
import type { ChildProps, ClassProps } from "../util/props.js";
|
|
5
5
|
import TABLE_CSS from "./Table.module.css";
|
|
6
6
|
|
|
7
7
|
const TABLE_CLASS = getModuleClass(TABLE_CSS, "table");
|
|
@@ -11,7 +11,7 @@ const TABLE_CLASS = getModuleClass(TABLE_CSS, "table");
|
|
|
11
11
|
*
|
|
12
12
|
* @see https://shelving.cc/ui/TableProps
|
|
13
13
|
*/
|
|
14
|
-
export interface TableProps extends BlockVariants, ChildProps {}
|
|
14
|
+
export interface TableProps extends BlockVariants, ChildProps, ClassProps {}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Table block — rendered as `<table>`.
|
|
@@ -21,12 +21,13 @@ export interface TableProps extends BlockVariants, ChildProps {}
|
|
|
21
21
|
* @kind component
|
|
22
22
|
* @see https://shelving.cc/ui/Table
|
|
23
23
|
*/
|
|
24
|
-
export function Table({ children, ...props }: TableProps): ReactElement {
|
|
24
|
+
export function Table({ children, className, ...props }: TableProps): ReactElement {
|
|
25
25
|
return (
|
|
26
26
|
<table
|
|
27
27
|
className={getClass(
|
|
28
28
|
TABLE_CLASS, //
|
|
29
29
|
getBlockClass(props),
|
|
30
|
+
className,
|
|
30
31
|
)}
|
|
31
32
|
>
|
|
32
33
|
{children}
|
|
@@ -2,12 +2,13 @@ import { type ReactElement } from "react";
|
|
|
2
2
|
import { type FlexVariants } from "../style/Flex.js";
|
|
3
3
|
import type { SpaceVariants } from "../style/Space.js";
|
|
4
4
|
import type { TypographyVariants } from "../style/Typography.js";
|
|
5
|
+
import type { ClassProps } from "../util/props.js";
|
|
5
6
|
/**
|
|
6
7
|
* Props for the `TreeBreadcrumbs` component — typography, space, and flex variant props.
|
|
7
8
|
*
|
|
8
9
|
* @see https://shelving.cc/ui/TreeBreadcrumbsProps
|
|
9
10
|
*/
|
|
10
|
-
export interface TreeBreadcrumbsProps extends TypographyVariants, SpaceVariants, FlexVariants {
|
|
11
|
+
export interface TreeBreadcrumbsProps extends TypographyVariants, SpaceVariants, FlexVariants, ClassProps {
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Breadcrumb trail of links to a tree page's ancestors, separated by `›` arrow icons.
|
|
@@ -22,4 +23,4 @@ export interface TreeBreadcrumbsProps extends TypographyVariants, SpaceVariants,
|
|
|
22
23
|
* @example <TreeBreadcrumbs />
|
|
23
24
|
* @see https://shelving.cc/ui/TreeBreadcrumbs
|
|
24
25
|
*/
|
|
25
|
-
export declare function TreeBreadcrumbs({ tint, left, wrap, ...props }: TreeBreadcrumbsProps): ReactElement | null;
|
|
26
|
+
export declare function TreeBreadcrumbs({ tint, left, wrap, className, ...props }: TreeBreadcrumbsProps): ReactElement | null;
|
|
@@ -21,12 +21,12 @@ import { useTreeMap } from "./TreeContext.js";
|
|
|
21
21
|
* @example <TreeBreadcrumbs />
|
|
22
22
|
* @see https://shelving.cc/ui/TreeBreadcrumbs
|
|
23
23
|
*/
|
|
24
|
-
export function TreeBreadcrumbs({ tint = "70", left = true, wrap = true, ...props }) {
|
|
24
|
+
export function TreeBreadcrumbs({ tint = "70", left = true, wrap = true, className, ...props }) {
|
|
25
25
|
const map = useTreeMap();
|
|
26
26
|
const segments = splitPath(requireMetaURL().path).slice(0, -1); // Don't include the element itself.
|
|
27
27
|
// Cumulative ancestor paths (`/util`, `/util/string`, …); skip prefixes with no element (e.g. the partial `/util` half of a `"util/string"` module name).
|
|
28
28
|
const ancestors = segments.map((_, i) => joinPath("/", segments.slice(0, i + 1))).filter(path => map.has(path));
|
|
29
29
|
const variants = { tint, left, wrap, ...props };
|
|
30
30
|
return (_jsxs("nav", { "aria-label": "Breadcrumb", className: getClass(getBlockClass(variants), //
|
|
31
|
-
getFlexClass(variants)), children: [_jsx(TreeButton, { small: true, plain: true, name: "/" }), _jsx(ChevronRightIcon, {}), ancestors.map(path => (_jsxs(Fragment, { children: [_jsx(TreeButton, { small: true, plain: true, name: path }), _jsx(ChevronRightIcon, {})] }, path)))] }));
|
|
31
|
+
getFlexClass(variants), className), children: [_jsx(TreeButton, { small: true, plain: true, name: "/" }), _jsx(ChevronRightIcon, {}), ancestors.map(path => (_jsxs(Fragment, { children: [_jsx(TreeButton, { small: true, plain: true, name: path }), _jsx(ChevronRightIcon, {})] }, path)))] }));
|
|
32
32
|
}
|
|
@@ -7,6 +7,7 @@ import { type FlexVariants, getFlexClass } from "../style/Flex.js";
|
|
|
7
7
|
import type { SpaceVariants } from "../style/Space.js";
|
|
8
8
|
import type { TypographyVariants } from "../style/Typography.js";
|
|
9
9
|
import { getClass } from "../util/css.js";
|
|
10
|
+
import type { ClassProps } from "../util/props.js";
|
|
10
11
|
import { TreeButton } from "./TreeButton.js";
|
|
11
12
|
import { useTreeMap } from "./TreeContext.js";
|
|
12
13
|
|
|
@@ -15,7 +16,7 @@ import { useTreeMap } from "./TreeContext.js";
|
|
|
15
16
|
*
|
|
16
17
|
* @see https://shelving.cc/ui/TreeBreadcrumbsProps
|
|
17
18
|
*/
|
|
18
|
-
export interface TreeBreadcrumbsProps extends TypographyVariants, SpaceVariants, FlexVariants {}
|
|
19
|
+
export interface TreeBreadcrumbsProps extends TypographyVariants, SpaceVariants, FlexVariants, ClassProps {}
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Breadcrumb trail of links to a tree page's ancestors, separated by `›` arrow icons.
|
|
@@ -30,7 +31,7 @@ export interface TreeBreadcrumbsProps extends TypographyVariants, SpaceVariants,
|
|
|
30
31
|
* @example <TreeBreadcrumbs />
|
|
31
32
|
* @see https://shelving.cc/ui/TreeBreadcrumbs
|
|
32
33
|
*/
|
|
33
|
-
export function TreeBreadcrumbs({ tint = "70", left = true, wrap = true, ...props }: TreeBreadcrumbsProps): ReactElement | null {
|
|
34
|
+
export function TreeBreadcrumbs({ tint = "70", left = true, wrap = true, className, ...props }: TreeBreadcrumbsProps): ReactElement | null {
|
|
34
35
|
const map = useTreeMap();
|
|
35
36
|
const segments = splitPath(requireMetaURL().path).slice(0, -1); // Don't include the element itself.
|
|
36
37
|
// Cumulative ancestor paths (`/util`, `/util/string`, …); skip prefixes with no element (e.g. the partial `/util` half of a `"util/string"` module name).
|
|
@@ -42,6 +43,7 @@ export function TreeBreadcrumbs({ tint = "70", left = true, wrap = true, ...prop
|
|
|
42
43
|
className={getClass(
|
|
43
44
|
getBlockClass(variants), //
|
|
44
45
|
getFlexClass(variants),
|
|
46
|
+
className,
|
|
45
47
|
)}
|
|
46
48
|
>
|
|
47
49
|
<TreeButton small plain name="/" />
|
package/ui/tree/TreeButton.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { type ButtonVariants } from "../button/Button.js";
|
|
3
|
+
import type { ClassProps } from "../util/props.js";
|
|
3
4
|
/**
|
|
4
5
|
* Props for the `TreeButton` component — the element reference plus button variants.
|
|
5
6
|
*
|
|
6
7
|
* @see https://shelving.cc/ui/TreeButtonProps
|
|
7
8
|
*/
|
|
8
|
-
export interface TreeButtonProps extends ButtonVariants {
|
|
9
|
+
export interface TreeButtonProps extends ButtonVariants, ClassProps {
|
|
9
10
|
/** Reference to an element in the tree — a flat key (`"Store"`, `"Store.get"`) or a canonical path (`"/schema/BooleanSchema"`). */
|
|
10
11
|
readonly name: string;
|
|
11
12
|
/** Visible label — defaults to the resolved element's `title`, falling back to `name`. */
|
package/ui/tree/TreeButton.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { Button, type ButtonVariants } from "../button/Button.js";
|
|
3
|
+
import type { ClassProps } from "../util/props.js";
|
|
3
4
|
import { getTreeElement, useTreeMap } from "./TreeContext.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -7,7 +8,7 @@ import { getTreeElement, useTreeMap } from "./TreeContext.js";
|
|
|
7
8
|
*
|
|
8
9
|
* @see https://shelving.cc/ui/TreeButtonProps
|
|
9
10
|
*/
|
|
10
|
-
export interface TreeButtonProps extends ButtonVariants {
|
|
11
|
+
export interface TreeButtonProps extends ButtonVariants, ClassProps {
|
|
11
12
|
/** Reference to an element in the tree — a flat key (`"Store"`, `"Store.get"`) or a canonical path (`"/schema/BooleanSchema"`). */
|
|
12
13
|
readonly name: string;
|
|
13
14
|
/** Visible label — defaults to the resolved element's `title`, falling back to `name`. */
|