shelving 1.256.1 → 1.257.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/package.json +1 -1
- package/ui/block/Address.d.ts +2 -4
- package/ui/block/Address.js +2 -4
- package/ui/block/Address.module.css +0 -14
- package/ui/block/Address.tsx +3 -7
- package/ui/block/Block.d.ts +2 -18
- package/ui/block/Block.js +1 -23
- package/ui/block/Block.tsx +2 -40
- package/ui/block/Blockquote.d.ts +2 -4
- package/ui/block/Blockquote.js +2 -4
- package/ui/block/Blockquote.module.css +0 -14
- package/ui/block/Blockquote.tsx +3 -7
- package/ui/block/Caption.d.ts +2 -4
- package/ui/block/Caption.js +2 -4
- package/ui/block/Caption.module.css +0 -13
- package/ui/block/Caption.tsx +3 -7
- package/ui/block/Card.d.ts +2 -6
- package/ui/block/Card.js +3 -6
- package/ui/block/Card.tsx +4 -19
- package/ui/block/Column.d.ts +27 -0
- package/ui/block/Column.js +17 -0
- package/ui/block/Column.tsx +41 -0
- package/ui/block/Definitions.d.ts +4 -4
- package/ui/block/Definitions.js +2 -5
- package/ui/block/Definitions.module.css +0 -9
- package/ui/block/Definitions.tsx +6 -8
- package/ui/block/Divider.d.ts +2 -3
- package/ui/block/Divider.js +2 -3
- package/ui/block/Divider.module.css +1 -17
- package/ui/block/Divider.tsx +3 -5
- package/ui/block/Heading.d.ts +2 -4
- package/ui/block/Heading.js +2 -4
- package/ui/block/Heading.module.css +1 -15
- package/ui/block/Heading.tsx +3 -7
- package/ui/block/Image.js +2 -2
- package/ui/block/Image.module.css +0 -14
- package/ui/block/Image.tsx +2 -2
- package/ui/block/Label.d.ts +3 -3
- package/ui/block/Label.js +2 -4
- package/ui/block/Label.module.css +1 -14
- package/ui/block/Label.tsx +5 -9
- package/ui/block/List.d.ts +2 -4
- package/ui/block/List.js +3 -4
- package/ui/block/List.module.css +1 -2
- package/ui/block/List.tsx +4 -8
- package/ui/block/Panel.d.ts +2 -4
- package/ui/block/Panel.js +2 -4
- package/ui/block/Panel.module.css +1 -10
- package/ui/block/Panel.tsx +3 -7
- package/ui/block/Paragraph.d.ts +2 -15
- package/ui/block/Paragraph.js +3 -18
- package/ui/block/Paragraph.module.css +2 -19
- package/ui/block/Paragraph.tsx +12 -24
- package/ui/block/Preformatted.d.ts +3 -6
- package/ui/block/Preformatted.js +2 -6
- package/ui/block/Preformatted.tsx +4 -17
- package/ui/block/Prose.js +3 -1
- package/ui/block/Prose.tsx +4 -0
- package/ui/block/Row.d.ts +26 -0
- package/ui/block/Row.js +17 -0
- package/ui/block/Row.tsx +41 -0
- package/ui/block/Section.d.ts +2 -18
- package/ui/block/Section.js +8 -22
- package/ui/block/Section.module.css +1 -14
- package/ui/block/Section.tsx +10 -28
- package/ui/block/Subheading.js +2 -4
- package/ui/block/Subheading.module.css +1 -15
- package/ui/block/Subheading.tsx +2 -6
- package/ui/block/Title.js +2 -4
- package/ui/block/Title.module.css +1 -15
- package/ui/block/Title.tsx +2 -6
- package/ui/block/Video.d.ts +3 -3
- package/ui/block/Video.js +7 -8
- package/ui/block/Video.module.css +1 -10
- package/ui/block/Video.tsx +9 -9
- package/ui/block/index.d.ts +2 -0
- package/ui/block/index.js +2 -0
- package/ui/block/index.ts +2 -0
- package/ui/docs/DocumentationButtons.d.ts +10 -4
- package/ui/docs/DocumentationButtons.js +5 -4
- package/ui/docs/DocumentationButtons.tsx +20 -11
- package/ui/docs/DocumentationCard.js +1 -1
- package/ui/docs/DocumentationCard.tsx +1 -1
- package/ui/docs/DocumentationPage.js +1 -1
- package/ui/docs/DocumentationPage.tsx +1 -1
- package/ui/docs/DocumentationSearchPage.js +1 -1
- package/ui/docs/DocumentationSearchPage.tsx +1 -1
- package/ui/form/ArrayInput.js +3 -2
- package/ui/form/ArrayInput.tsx +4 -3
- package/ui/form/ArrayRadioInputs.js +2 -2
- package/ui/form/ArrayRadioInputs.tsx +3 -4
- package/ui/form/ChoiceRadioInputs.js +1 -1
- package/ui/form/ChoiceRadioInputs.tsx +1 -1
- package/ui/form/DataInput.js +1 -1
- package/ui/form/DataInput.tsx +1 -1
- package/ui/form/DictionaryInput.js +1 -1
- package/ui/form/DictionaryInput.tsx +1 -1
- package/ui/form/Field.d.ts +4 -5
- package/ui/form/Field.js +8 -3
- package/ui/form/Field.module.css +6 -29
- package/ui/form/Field.tsx +17 -9
- package/ui/form/Form.d.ts +2 -2
- package/ui/form/Form.js +2 -6
- package/ui/form/Form.tsx +4 -9
- package/ui/form/FormFooter.js +1 -1
- package/ui/form/FormFooter.tsx +1 -1
- package/ui/form/FormMessage.d.ts +2 -2
- package/ui/form/FormMessage.tsx +3 -2
- package/ui/menu/Menu.d.ts +3 -2
- package/ui/menu/Menu.js +4 -2
- package/ui/menu/Menu.tsx +13 -3
- package/ui/misc/Catcher.js +1 -1
- package/ui/misc/Catcher.tsx +1 -1
- package/ui/notice/Message.d.ts +3 -3
- package/ui/notice/Message.js +3 -3
- package/ui/notice/Message.module.css +4 -0
- package/ui/notice/Message.tsx +5 -5
- package/ui/notice/Notice.d.ts +2 -2
- package/ui/notice/Notice.js +4 -2
- package/ui/notice/Notice.module.css +1 -23
- package/ui/notice/Notice.tsx +10 -4
- package/ui/style/Block.d.ts +24 -0
- package/ui/style/Block.js +23 -0
- package/ui/style/Block.module.css +78 -0
- package/ui/style/Block.tsx +39 -0
- package/ui/style/Flex.d.ts +0 -38
- package/ui/style/Flex.js +0 -27
- package/ui/style/Flex.tsx +0 -44
- package/ui/style/index.d.ts +1 -0
- package/ui/style/index.js +1 -0
- package/ui/style/{index.tsx → index.ts} +1 -0
- package/ui/table/Table.d.ts +3 -5
- package/ui/table/Table.js +2 -5
- package/ui/table/Table.module.css +0 -15
- package/ui/table/Table.tsx +4 -9
- package/ui/tree/TreeBreadcrumbs.d.ts +1 -1
- package/ui/tree/TreeBreadcrumbs.js +5 -4
- package/ui/tree/TreeBreadcrumbs.tsx +5 -4
- package/util/ansi.d.ts +1 -1
- package/ui/block/Block.module.css +0 -27
- package/ui/block/Prose.module.css +0 -22
- package/ui/form/Form.module.css +0 -35
package/package.json
CHANGED
package/ui/block/Address.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { type AddressData } from "../../schema/AddressSchema.js";
|
|
3
3
|
import type { Nullish } from "../../util/null.js";
|
|
4
|
-
import { type
|
|
5
|
-
import { type SpaceVariants } from "../style/Space.js";
|
|
6
|
-
import { type TypographyVariants } from "../style/Typography.js";
|
|
4
|
+
import { type BlockVariants } from "../style/Block.js";
|
|
7
5
|
import type { ChildProps } from "../util/props.js";
|
|
8
6
|
/**
|
|
9
7
|
* Props for `Address` — colour, space, and typography variants plus required children.
|
|
10
8
|
*
|
|
11
9
|
* @see https://shelving.cc/ui/AddressProps
|
|
12
10
|
*/
|
|
13
|
-
export interface AddressProps extends
|
|
11
|
+
export interface AddressProps extends BlockVariants, ChildProps {
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
14
|
* Props for `PhysicalAddress` — an optional name and a nullable `AddressData` object.
|
package/ui/block/Address.js
CHANGED
|
@@ -2,9 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { formatAddress } from "../../schema/AddressSchema.js";
|
|
3
3
|
import { Small } from "../inline/Small.js";
|
|
4
4
|
import { Strong } from "../inline/Strong.js";
|
|
5
|
-
import {
|
|
6
|
-
import { getSpaceClass } from "../style/Space.js";
|
|
7
|
-
import { getTypographyClass } from "../style/Typography.js";
|
|
5
|
+
import { getBlockClass } from "../style/Block.js";
|
|
8
6
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
9
7
|
import ADDRESS_CSS from "./Address.module.css";
|
|
10
8
|
const ADDRESS_CLASS = getModuleClass(ADDRESS_CSS, "address");
|
|
@@ -16,7 +14,7 @@ const ADDRESS_CLASS = getModuleClass(ADDRESS_CSS, "address");
|
|
|
16
14
|
*/
|
|
17
15
|
export function Address({ children, ...props }) {
|
|
18
16
|
return (_jsx("address", { className: getClass(ADDRESS_CLASS, //
|
|
19
|
-
|
|
17
|
+
getBlockClass(props)), children: children }));
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
20
|
* Show an optional `AddressData` object correctly on screen.
|
|
@@ -7,23 +7,9 @@
|
|
|
7
7
|
.address,
|
|
8
8
|
.prose address {
|
|
9
9
|
/* Box */
|
|
10
|
-
display: block;
|
|
11
|
-
margin-inline: 0;
|
|
12
10
|
margin-block: var(--address-space, var(--space-paragraph));
|
|
13
11
|
|
|
14
12
|
/* Text */
|
|
15
13
|
white-space: preserve wrap;
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
@layer overrides {
|
|
20
|
-
.address,
|
|
21
|
-
.prose address {
|
|
22
|
-
&:first-child {
|
|
23
|
-
margin-block-start: 0;
|
|
24
|
-
}
|
|
25
|
-
&:last-child {
|
|
26
|
-
margin-block-end: 0;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
package/ui/block/Address.tsx
CHANGED
|
@@ -3,9 +3,7 @@ import { type AddressData, formatAddress } from "../../schema/AddressSchema.js";
|
|
|
3
3
|
import type { Nullish } from "../../util/null.js";
|
|
4
4
|
import { Small } from "../inline/Small.js";
|
|
5
5
|
import { Strong } from "../inline/Strong.js";
|
|
6
|
-
import { type
|
|
7
|
-
import { getSpaceClass, type SpaceVariants } from "../style/Space.js";
|
|
8
|
-
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
6
|
+
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
9
7
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
10
8
|
import type { ChildProps } from "../util/props.js";
|
|
11
9
|
import ADDRESS_CSS from "./Address.module.css";
|
|
@@ -17,7 +15,7 @@ const ADDRESS_CLASS = getModuleClass(ADDRESS_CSS, "address");
|
|
|
17
15
|
*
|
|
18
16
|
* @see https://shelving.cc/ui/AddressProps
|
|
19
17
|
*/
|
|
20
|
-
export interface AddressProps extends
|
|
18
|
+
export interface AddressProps extends BlockVariants, ChildProps {}
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
* Props for `PhysicalAddress` — an optional name and a nullable `AddressData` object.
|
|
@@ -50,9 +48,7 @@ export function Address({ children, ...props }: AddressProps) {
|
|
|
50
48
|
<address
|
|
51
49
|
className={getClass(
|
|
52
50
|
ADDRESS_CLASS, //
|
|
53
|
-
|
|
54
|
-
getSpaceClass(props),
|
|
55
|
-
getTypographyClass(props),
|
|
51
|
+
getBlockClass(props),
|
|
56
52
|
)}
|
|
57
53
|
>
|
|
58
54
|
{children}
|
package/ui/block/Block.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { type IndentVariants } from "../style/Indent.js";
|
|
4
|
-
import { type PaddingVariants } from "../style/Padding.js";
|
|
5
|
-
import { type SpaceVariants } from "../style/Space.js";
|
|
6
|
-
import { type TypographyVariants } from "../style/Typography.js";
|
|
7
|
-
import { type WidthVariants } from "../style/Width.js";
|
|
2
|
+
import { type BlockVariants } from "../style/Block.js";
|
|
8
3
|
import type { OptionalChildProps } from "../util/props.js";
|
|
9
4
|
/**
|
|
10
5
|
* Semantic element names a block element may render as via its `as` prop.
|
|
@@ -17,24 +12,13 @@ export type BlockElement = "div" | "section" | "header" | "footer" | "article" |
|
|
|
17
12
|
*
|
|
18
13
|
* @see https://shelving.cc/ui/BlockProps
|
|
19
14
|
*/
|
|
20
|
-
export interface BlockProps extends
|
|
15
|
+
export interface BlockProps extends BlockVariants, OptionalChildProps {
|
|
21
16
|
/**
|
|
22
17
|
* Element this `<Block>` renders as, e.g. "header" to output a "<header>"
|
|
23
18
|
* @default "div"
|
|
24
19
|
*/
|
|
25
20
|
as?: BlockElement | undefined;
|
|
26
21
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Get the combined `className` string for a block from its styling variants.
|
|
29
|
-
*
|
|
30
|
-
* Composes the base block class and tint ladder with the colour, space, typography, and width variant helpers, so anything that wants block-level styling can apply it.
|
|
31
|
-
*
|
|
32
|
-
* @param variants Colour, space, typography, and width variants.
|
|
33
|
-
* @returns A space-separated `className` string combining the block class and resolved variant classes.
|
|
34
|
-
* @example getBlockClass({ space: "large" }) // "block tint …"
|
|
35
|
-
* @see https://shelving.cc/ui/getBlockClass
|
|
36
|
-
*/
|
|
37
|
-
export declare function getBlockClass(variants: BlockProps): string;
|
|
38
22
|
/**
|
|
39
23
|
* Plain `<div>` block with block-level spacing.
|
|
40
24
|
* - Pass `as` to render a different semantic element (`section`, `header`, `footer`, `nav`, `aside`, `figure`).
|
package/ui/block/Block.js
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { getIndentClass } from "../style/Indent.js";
|
|
4
|
-
import { getPaddingClass } from "../style/Padding.js";
|
|
5
|
-
import { getSpaceClass } from "../style/Space.js";
|
|
6
|
-
import { getTypographyClass } from "../style/Typography.js";
|
|
7
|
-
import { getWidthClass } from "../style/Width.js";
|
|
8
|
-
import { getClass, getModuleClass } from "../util/css.js";
|
|
9
|
-
import BLOCK_CSS from "./Block.module.css";
|
|
10
|
-
const BLOCK_CLASS = getModuleClass(BLOCK_CSS, "block");
|
|
11
|
-
/**
|
|
12
|
-
* Get the combined `className` string for a block from its styling variants.
|
|
13
|
-
*
|
|
14
|
-
* Composes the base block class and tint ladder with the colour, space, typography, and width variant helpers, so anything that wants block-level styling can apply it.
|
|
15
|
-
*
|
|
16
|
-
* @param variants Colour, space, typography, and width variants.
|
|
17
|
-
* @returns A space-separated `className` string combining the block class and resolved variant classes.
|
|
18
|
-
* @example getBlockClass({ space: "large" }) // "block tint …"
|
|
19
|
-
* @see https://shelving.cc/ui/getBlockClass
|
|
20
|
-
*/
|
|
21
|
-
export function getBlockClass(variants) {
|
|
22
|
-
return getClass(BLOCK_CLASS, //
|
|
23
|
-
getColorClass(variants), getIndentClass(variants), getPaddingClass(variants), getSpaceClass(variants), getTypographyClass(variants), getWidthClass(variants));
|
|
24
|
-
}
|
|
2
|
+
import { getBlockClass } from "../style/Block.js";
|
|
25
3
|
/**
|
|
26
4
|
* Plain `<div>` block with block-level spacing.
|
|
27
5
|
* - Pass `as` to render a different semantic element (`section`, `header`, `footer`, `nav`, `aside`, `figure`).
|
package/ui/block/Block.tsx
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { getIndentClass, type IndentVariants } from "../style/Indent.js";
|
|
4
|
-
import { getPaddingClass, type PaddingVariants } from "../style/Padding.js";
|
|
5
|
-
import { getSpaceClass, type SpaceVariants } from "../style/Space.js";
|
|
6
|
-
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
7
|
-
import { getWidthClass, type WidthVariants } from "../style/Width.js";
|
|
8
|
-
import { getClass, getModuleClass } from "../util/css.js";
|
|
2
|
+
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
9
3
|
import type { OptionalChildProps } from "../util/props.js";
|
|
10
|
-
import BLOCK_CSS from "./Block.module.css";
|
|
11
|
-
|
|
12
|
-
const BLOCK_CLASS = getModuleClass(BLOCK_CSS, "block");
|
|
13
4
|
|
|
14
5
|
/**
|
|
15
6
|
* Semantic element names a block element may render as via its `as` prop.
|
|
@@ -23,14 +14,7 @@ export type BlockElement = "div" | "section" | "header" | "footer" | "article" |
|
|
|
23
14
|
*
|
|
24
15
|
* @see https://shelving.cc/ui/BlockProps
|
|
25
16
|
*/
|
|
26
|
-
export interface BlockProps
|
|
27
|
-
extends ColorVariants,
|
|
28
|
-
PaddingVariants,
|
|
29
|
-
IndentVariants,
|
|
30
|
-
SpaceVariants,
|
|
31
|
-
TypographyVariants,
|
|
32
|
-
WidthVariants,
|
|
33
|
-
OptionalChildProps {
|
|
17
|
+
export interface BlockProps extends BlockVariants, OptionalChildProps {
|
|
34
18
|
/**
|
|
35
19
|
* Element this `<Block>` renders as, e.g. "header" to output a "<header>"
|
|
36
20
|
* @default "div"
|
|
@@ -38,28 +22,6 @@ export interface BlockProps
|
|
|
38
22
|
as?: BlockElement | undefined;
|
|
39
23
|
}
|
|
40
24
|
|
|
41
|
-
/**
|
|
42
|
-
* Get the combined `className` string for a block from its styling variants.
|
|
43
|
-
*
|
|
44
|
-
* Composes the base block class and tint ladder with the colour, space, typography, and width variant helpers, so anything that wants block-level styling can apply it.
|
|
45
|
-
*
|
|
46
|
-
* @param variants Colour, space, typography, and width variants.
|
|
47
|
-
* @returns A space-separated `className` string combining the block class and resolved variant classes.
|
|
48
|
-
* @example getBlockClass({ space: "large" }) // "block tint …"
|
|
49
|
-
* @see https://shelving.cc/ui/getBlockClass
|
|
50
|
-
*/
|
|
51
|
-
export function getBlockClass(variants: BlockProps): string {
|
|
52
|
-
return getClass(
|
|
53
|
-
BLOCK_CLASS, //
|
|
54
|
-
getColorClass(variants),
|
|
55
|
-
getIndentClass(variants),
|
|
56
|
-
getPaddingClass(variants),
|
|
57
|
-
getSpaceClass(variants),
|
|
58
|
-
getTypographyClass(variants),
|
|
59
|
-
getWidthClass(variants),
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
25
|
/**
|
|
64
26
|
* Plain `<div>` block with block-level spacing.
|
|
65
27
|
* - Pass `as` to render a different semantic element (`section`, `header`, `footer`, `nav`, `aside`, `figure`).
|
package/ui/block/Blockquote.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { type SpaceVariants } from "../style/Space.js";
|
|
4
|
-
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
|
+
import { type BlockVariants } from "../style/Block.js";
|
|
5
3
|
import type { OptionalChildProps } from "../util/props.js";
|
|
6
4
|
/**
|
|
7
5
|
* Props for `Blockquote` — colour, space, and typography variants plus optional children.
|
|
8
6
|
*
|
|
9
7
|
* @see https://shelving.cc/ui/BlockquoteProps
|
|
10
8
|
*/
|
|
11
|
-
export interface BlockquoteProps extends
|
|
9
|
+
export interface BlockquoteProps extends BlockVariants, OptionalChildProps {
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* Quoted block of text — rendered as `<blockquote>`.
|
package/ui/block/Blockquote.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { getSpaceClass } from "../style/Space.js";
|
|
4
|
-
import { getTypographyClass } from "../style/Typography.js";
|
|
2
|
+
import { getBlockClass } from "../style/Block.js";
|
|
5
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
6
4
|
import BLOCKQUOTE_CSS from "./Blockquote.module.css";
|
|
7
5
|
const BLOCKQUOTE_CLASS = getModuleClass(BLOCKQUOTE_CSS, "blockquote");
|
|
@@ -14,5 +12,5 @@ const BLOCKQUOTE_CLASS = getModuleClass(BLOCKQUOTE_CSS, "blockquote");
|
|
|
14
12
|
*/
|
|
15
13
|
export function Blockquote({ children, ...props }) {
|
|
16
14
|
return (_jsx("blockquote", { className: getClass(BLOCKQUOTE_CLASS, //
|
|
17
|
-
|
|
15
|
+
getBlockClass(props)), children: children }));
|
|
18
16
|
}
|
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
--tint-50: var(--blockquote-tint, inherit);
|
|
12
12
|
|
|
13
13
|
/* Box */
|
|
14
|
-
display: block;
|
|
15
|
-
margin-inline: 0;
|
|
16
14
|
margin-block: var(--blockquote-space, var(--space-paragraph));
|
|
17
15
|
border-inline-start: var(--blockquote-border, var(--blockquote-stroke, var(--stroke-normal)) solid var(--tint-80));
|
|
18
16
|
padding-block: var(--blockquote-padding, var(--space-small));
|
|
@@ -27,15 +25,3 @@
|
|
|
27
25
|
text-align: var(--blockquote-align, left);
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
@layer overrides {
|
|
32
|
-
.blockquote,
|
|
33
|
-
.prose blockquote {
|
|
34
|
-
&:first-child {
|
|
35
|
-
margin-block-start: 0;
|
|
36
|
-
}
|
|
37
|
-
&:last-child {
|
|
38
|
-
margin-block-end: 0;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
package/ui/block/Blockquote.tsx
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { getSpaceClass, type SpaceVariants } from "../style/Space.js";
|
|
4
|
-
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
2
|
+
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
5
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
6
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
7
5
|
import BLOCKQUOTE_CSS from "./Blockquote.module.css";
|
|
@@ -13,7 +11,7 @@ const BLOCKQUOTE_CLASS = getModuleClass(BLOCKQUOTE_CSS, "blockquote");
|
|
|
13
11
|
*
|
|
14
12
|
* @see https://shelving.cc/ui/BlockquoteProps
|
|
15
13
|
*/
|
|
16
|
-
export interface BlockquoteProps extends
|
|
14
|
+
export interface BlockquoteProps extends BlockVariants, OptionalChildProps {}
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* Quoted block of text — rendered as `<blockquote>`.
|
|
@@ -27,9 +25,7 @@ export function Blockquote({ children, ...props }: BlockquoteProps): ReactElemen
|
|
|
27
25
|
<blockquote
|
|
28
26
|
className={getClass(
|
|
29
27
|
BLOCKQUOTE_CLASS, //
|
|
30
|
-
|
|
31
|
-
getSpaceClass(props),
|
|
32
|
-
getTypographyClass(props),
|
|
28
|
+
getBlockClass(props),
|
|
33
29
|
)}
|
|
34
30
|
>
|
|
35
31
|
{children}
|
package/ui/block/Caption.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { type SpaceVariants } from "../style/Space.js";
|
|
4
|
-
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
|
+
import { type BlockVariants } from "../style/Block.js";
|
|
5
3
|
import type { OptionalChildProps } from "../util/index.js";
|
|
6
4
|
/**
|
|
7
5
|
* Props for `Caption` — colour, space, and typography variants plus optional children.
|
|
8
6
|
*
|
|
9
7
|
* @see https://shelving.cc/ui/CaptionProps
|
|
10
8
|
*/
|
|
11
|
-
export interface CaptionProps extends
|
|
9
|
+
export interface CaptionProps extends BlockVariants, OptionalChildProps {
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* `<figcaption>` block — caption text for a `<Figure>`.
|
package/ui/block/Caption.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { getSpaceClass } from "../style/Space.js";
|
|
4
|
-
import { getTypographyClass } from "../style/Typography.js";
|
|
2
|
+
import { getBlockClass } from "../style/Block.js";
|
|
5
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
6
4
|
import CAPTION_CSS from "./Caption.module.css";
|
|
7
5
|
const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "divider");
|
|
@@ -14,5 +12,5 @@ const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "divider");
|
|
|
14
12
|
*/
|
|
15
13
|
export function Caption({ children, ...props }) {
|
|
16
14
|
return (_jsx("figcaption", { className: getClass(CAPTION_CLASS, //
|
|
17
|
-
|
|
15
|
+
getBlockClass(props)), children: children }));
|
|
18
16
|
}
|
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
.caption,
|
|
8
8
|
.prose figcaption {
|
|
9
9
|
/* Box */
|
|
10
|
-
display: block;
|
|
11
|
-
padding: 0;
|
|
12
|
-
margin-inline: 0;
|
|
13
10
|
margin-block: var(--caption-gap, var(--space-xxsmall));
|
|
14
11
|
|
|
15
12
|
/* Text */
|
|
@@ -21,16 +18,6 @@
|
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
@layer overrides {
|
|
24
|
-
.caption,
|
|
25
|
-
.prose figcaption {
|
|
26
|
-
&:first-child {
|
|
27
|
-
margin-block-start: 0;
|
|
28
|
-
}
|
|
29
|
-
&:last-child {
|
|
30
|
-
margin-block-end: 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
21
|
/* Captions have tighter margins than most block elements so zero the abutting margin of any neighbouring sibling — otherwise margin collapse would let the bigger neighbour margin win. */
|
|
35
22
|
.prose figcaption + * {
|
|
36
23
|
margin-block-start: 0;
|
package/ui/block/Caption.tsx
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { getSpaceClass, type SpaceVariants } from "../style/Space.js";
|
|
4
|
-
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
2
|
+
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
5
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
6
4
|
import type { OptionalChildProps } from "../util/index.js";
|
|
7
5
|
import CAPTION_CSS from "./Caption.module.css";
|
|
@@ -13,7 +11,7 @@ const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "divider");
|
|
|
13
11
|
*
|
|
14
12
|
* @see https://shelving.cc/ui/CaptionProps
|
|
15
13
|
*/
|
|
16
|
-
export interface CaptionProps extends
|
|
14
|
+
export interface CaptionProps extends BlockVariants, OptionalChildProps {}
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* `<figcaption>` block — caption text for a `<Figure>`.
|
|
@@ -27,9 +25,7 @@ export function Caption({ children, ...props }: CaptionProps): ReactElement {
|
|
|
27
25
|
<figcaption
|
|
28
26
|
className={getClass(
|
|
29
27
|
CAPTION_CLASS, //
|
|
30
|
-
|
|
31
|
-
getSpaceClass(props),
|
|
32
|
-
getTypographyClass(props),
|
|
28
|
+
getBlockClass(props),
|
|
33
29
|
)}
|
|
34
30
|
>
|
|
35
31
|
{children}
|
package/ui/block/Card.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { type ClickableProps } from "../form/Clickable.js";
|
|
3
|
-
import { type
|
|
4
|
-
import { type PaddingVariants } from "../style/Padding.js";
|
|
5
|
-
import { type SpaceVariants } from "../style/Space.js";
|
|
3
|
+
import { type BlockVariants } from "../style/Block.js";
|
|
6
4
|
import { type StatusVariants } from "../style/Status.js";
|
|
7
|
-
import { type TypographyVariants } from "../style/Typography.js";
|
|
8
|
-
import { type WidthVariants } from "../style/Width.js";
|
|
9
5
|
import type { BlockElement } from "./Block.js";
|
|
10
6
|
/**
|
|
11
7
|
* Props for `Card` — combines `ClickableProps` (for navigable cards) with colour, status, padding, space, typography, and width variants.
|
|
12
8
|
*
|
|
13
9
|
* @see https://shelving.cc/ui/CardProps
|
|
14
10
|
*/
|
|
15
|
-
export interface CardProps extends ClickableProps,
|
|
11
|
+
export interface CardProps extends ClickableProps, StatusVariants, BlockVariants {
|
|
16
12
|
/**
|
|
17
13
|
* Element this `<Card>` renders as, e.g. "header" to output a "<header>"
|
|
18
14
|
* @default "article"
|
package/ui/block/Card.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Clickable } from "../form/Clickable.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getPaddingClass } from "../style/Padding.js";
|
|
5
|
-
import { getSpaceClass } from "../style/Space.js";
|
|
3
|
+
import { getBlockClass } from "../style/Block.js";
|
|
6
4
|
import { getStatusClass } from "../style/Status.js";
|
|
7
|
-
import { getTypographyClass } from "../style/Typography.js";
|
|
8
|
-
import { getWidthClass } from "../style/Width.js";
|
|
9
5
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
10
6
|
import CARD_CSS from "./Card.module.css";
|
|
11
7
|
/**
|
|
@@ -23,5 +19,6 @@ import CARD_CSS from "./Card.module.css";
|
|
|
23
19
|
*/
|
|
24
20
|
export function Card({ as: Element = "article", children, href, onClick, title = "Open", ...props }) {
|
|
25
21
|
const overlay = (href || onClick) && (_jsx(Clickable, { title: title, href: href, onClick: onClick, ...props, className: getModuleClass(CARD_CSS, "overlay") }));
|
|
26
|
-
return (_jsxs(Element, { className: getClass(getModuleClass(CARD_CSS, "card"),
|
|
22
|
+
return (_jsxs(Element, { className: getClass(getModuleClass(CARD_CSS, "card"), //
|
|
23
|
+
getStatusClass(props), getBlockClass(props)), children: [overlay, overlay ? _jsx("div", { children: children }) : children] }));
|
|
27
24
|
}
|
package/ui/block/Card.tsx
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { Clickable, type ClickableProps } from "../form/Clickable.js";
|
|
3
|
-
import { type
|
|
4
|
-
import { getPaddingClass, type PaddingVariants } from "../style/Padding.js";
|
|
5
|
-
import { getSpaceClass, type SpaceVariants } from "../style/Space.js";
|
|
3
|
+
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
6
4
|
import { getStatusClass, type StatusVariants } from "../style/Status.js";
|
|
7
|
-
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
8
|
-
import { getWidthClass, type WidthVariants } from "../style/Width.js";
|
|
9
5
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
10
6
|
import type { BlockElement } from "./Block.js";
|
|
11
7
|
import CARD_CSS from "./Card.module.css";
|
|
@@ -15,14 +11,7 @@ import CARD_CSS from "./Card.module.css";
|
|
|
15
11
|
*
|
|
16
12
|
* @see https://shelving.cc/ui/CardProps
|
|
17
13
|
*/
|
|
18
|
-
export interface CardProps
|
|
19
|
-
extends ClickableProps,
|
|
20
|
-
ColorVariants,
|
|
21
|
-
StatusVariants,
|
|
22
|
-
PaddingVariants,
|
|
23
|
-
SpaceVariants,
|
|
24
|
-
TypographyVariants,
|
|
25
|
-
WidthVariants {
|
|
14
|
+
export interface CardProps extends ClickableProps, StatusVariants, BlockVariants {
|
|
26
15
|
/**
|
|
27
16
|
* Element this `<Card>` renders as, e.g. "header" to output a "<header>"
|
|
28
17
|
* @default "article"
|
|
@@ -50,13 +39,9 @@ export function Card({ as: Element = "article", children, href, onClick, title =
|
|
|
50
39
|
return (
|
|
51
40
|
<Element
|
|
52
41
|
className={getClass(
|
|
53
|
-
getModuleClass(CARD_CSS, "card"),
|
|
42
|
+
getModuleClass(CARD_CSS, "card"), //
|
|
54
43
|
getStatusClass(props),
|
|
55
|
-
|
|
56
|
-
getPaddingClass(props),
|
|
57
|
-
getSpaceClass(props),
|
|
58
|
-
getTypographyClass(props),
|
|
59
|
-
getWidthClass(props),
|
|
44
|
+
getBlockClass(props),
|
|
60
45
|
)}
|
|
61
46
|
>
|
|
62
47
|
{overlay}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import { type BlockVariants } from "../style/Block.js";
|
|
3
|
+
import { type FlexVariants } from "../style/Flex.js";
|
|
4
|
+
import type { OptionalChildProps } from "../util/index.js";
|
|
5
|
+
import type { BlockElement } from "./Block.js";
|
|
6
|
+
/**
|
|
7
|
+
* Props for the `<Column>` component.
|
|
8
|
+
*
|
|
9
|
+
* @see https://shelving.cc/ui/ColumnProps
|
|
10
|
+
*/
|
|
11
|
+
export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildProps {
|
|
12
|
+
/**
|
|
13
|
+
* Element this `<Column>` renders as, e.g. "header" to output a "<header>"
|
|
14
|
+
* @default "div"
|
|
15
|
+
*/
|
|
16
|
+
as?: BlockElement | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Flex container that stacks its children as a column by default.
|
|
20
|
+
*
|
|
21
|
+
* @param variants
|
|
22
|
+
* @returns A `<div>` element with the computed block/flex class.
|
|
23
|
+
* @kind component
|
|
24
|
+
* @example <Column gap="small">{items}</Column>
|
|
25
|
+
* @see https://shelving.cc/ui/Column
|
|
26
|
+
*/
|
|
27
|
+
export declare function Column({ as: Element, children, column, ...props }: ColumnProps): ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getBlockClass } from "../style/Block.js";
|
|
3
|
+
import { getFlexClass } from "../style/Flex.js";
|
|
4
|
+
import { getClass } from "../util/css.js";
|
|
5
|
+
/**
|
|
6
|
+
* Flex container that stacks its children as a column by default.
|
|
7
|
+
*
|
|
8
|
+
* @param variants
|
|
9
|
+
* @returns A `<div>` element with the computed block/flex class.
|
|
10
|
+
* @kind component
|
|
11
|
+
* @example <Column gap="small">{items}</Column>
|
|
12
|
+
* @see https://shelving.cc/ui/Column
|
|
13
|
+
*/
|
|
14
|
+
export function Column({ as: Element = "div", children, column = true, ...props }) {
|
|
15
|
+
return (_jsx(Element, { className: getClass(getBlockClass(props), //
|
|
16
|
+
getFlexClass({ column, ...props })), children: children }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
3
|
+
import { type FlexVariants, getFlexClass } from "../style/Flex.js";
|
|
4
|
+
import { getClass } from "../util/css.js";
|
|
5
|
+
import type { OptionalChildProps } from "../util/index.js";
|
|
6
|
+
import type { BlockElement } from "./Block.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Props for the `<Column>` component.
|
|
10
|
+
*
|
|
11
|
+
* @see https://shelving.cc/ui/ColumnProps
|
|
12
|
+
*/
|
|
13
|
+
export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildProps {
|
|
14
|
+
/**
|
|
15
|
+
* Element this `<Column>` renders as, e.g. "header" to output a "<header>"
|
|
16
|
+
* @default "div"
|
|
17
|
+
*/
|
|
18
|
+
as?: BlockElement | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Flex container that stacks its children as a column by default.
|
|
23
|
+
*
|
|
24
|
+
* @param variants
|
|
25
|
+
* @returns A `<div>` element with the computed block/flex class.
|
|
26
|
+
* @kind component
|
|
27
|
+
* @example <Column gap="small">{items}</Column>
|
|
28
|
+
* @see https://shelving.cc/ui/Column
|
|
29
|
+
*/
|
|
30
|
+
export function Column({ as: Element = "div", children, column = true, ...props }: ColumnProps): ReactElement {
|
|
31
|
+
return (
|
|
32
|
+
<Element
|
|
33
|
+
className={getClass(
|
|
34
|
+
getBlockClass(props), //
|
|
35
|
+
getFlexClass({ column, ...props }),
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</Element>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import type { ColorVariants } from "../style/Color.js";
|
|
3
|
+
import type { GapVariants } from "../style/Gap.js";
|
|
4
|
+
import type { SpaceVariants } from "../style/Space.js";
|
|
5
|
+
import type { TypographyVariants } from "../style/Typography.js";
|
|
6
6
|
import type { OptionalChildProps } from "../util/props.js";
|
|
7
7
|
/**
|
|
8
8
|
* Props for `Definitions` — colour, gap, space, and typography variants plus optional children.
|
package/ui/block/Definitions.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { getGapClass } from "../style/Gap.js";
|
|
4
|
-
import { getSpaceClass } from "../style/Space.js";
|
|
5
|
-
import { getTypographyClass } from "../style/Typography.js";
|
|
2
|
+
import { getBlockClass } from "../style/Block.js";
|
|
6
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
7
4
|
import DEFINITIONS_CSS from "./Definitions.module.css";
|
|
8
5
|
const DEFINITIONS_CLASS = getModuleClass(DEFINITIONS_CSS, "definitions");
|
|
@@ -17,5 +14,5 @@ const DEFINITIONS_CLASS = getModuleClass(DEFINITIONS_CSS, "definitions");
|
|
|
17
14
|
*/
|
|
18
15
|
export function Definitions({ children, ...props }) {
|
|
19
16
|
return (_jsx("dl", { className: getClass(DEFINITIONS_CLASS, //
|
|
20
|
-
|
|
17
|
+
getBlockClass(props)), children: children }));
|
|
21
18
|
}
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
.definitions,
|
|
9
9
|
.prose dl {
|
|
10
10
|
/* Box */
|
|
11
|
-
display: block;
|
|
12
|
-
margin-inline: 0;
|
|
13
11
|
margin-block: var(--definitions-space, var(--space-paragraph));
|
|
14
12
|
|
|
15
13
|
/* Text */
|
|
@@ -43,13 +41,6 @@
|
|
|
43
41
|
@layer overrides {
|
|
44
42
|
.definitions,
|
|
45
43
|
.prose dl {
|
|
46
|
-
&:first-child {
|
|
47
|
-
margin-block-start: 0;
|
|
48
|
-
}
|
|
49
|
-
&:last-child {
|
|
50
|
-
margin-block-end: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
44
|
dt:first-child {
|
|
54
45
|
margin-block-start: 0;
|
|
55
46
|
}
|