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.
Files changed (240) hide show
  1. package/package.json +2 -2
  2. package/ui/README.md +2 -1
  3. package/ui/block/Address.d.ts +7 -7
  4. package/ui/block/Address.js +6 -6
  5. package/ui/block/Address.tsx +10 -9
  6. package/ui/block/Block.d.ts +3 -3
  7. package/ui/block/Block.js +3 -2
  8. package/ui/block/Block.tsx +5 -4
  9. package/ui/block/Blockquote.d.ts +3 -3
  10. package/ui/block/Blockquote.js +2 -2
  11. package/ui/block/Blockquote.tsx +4 -3
  12. package/ui/block/Caption.d.ts +3 -3
  13. package/ui/block/Caption.js +3 -3
  14. package/ui/block/Caption.tsx +5 -4
  15. package/ui/block/Card.d.ts +3 -2
  16. package/ui/block/Card.js +2 -2
  17. package/ui/block/Card.tsx +4 -2
  18. package/ui/block/Column.d.ts +3 -3
  19. package/ui/block/Column.js +2 -2
  20. package/ui/block/Column.tsx +4 -3
  21. package/ui/block/Definitions.d.ts +3 -3
  22. package/ui/block/Definitions.js +2 -2
  23. package/ui/block/Definitions.tsx +4 -3
  24. package/ui/block/Details.d.ts +3 -2
  25. package/ui/block/Details.js +2 -2
  26. package/ui/block/Details.tsx +4 -3
  27. package/ui/block/Divider.d.ts +3 -2
  28. package/ui/block/Divider.js +2 -2
  29. package/ui/block/Divider.tsx +4 -2
  30. package/ui/block/Heading.d.ts +3 -3
  31. package/ui/block/Heading.js +2 -2
  32. package/ui/block/Heading.tsx +4 -3
  33. package/ui/block/Image.d.ts +3 -2
  34. package/ui/block/Image.js +2 -2
  35. package/ui/block/Image.tsx +4 -2
  36. package/ui/block/Label.d.ts +1 -1
  37. package/ui/block/Label.js +2 -2
  38. package/ui/block/Label.tsx +2 -1
  39. package/ui/block/List.d.ts +3 -2
  40. package/ui/block/List.js +4 -4
  41. package/ui/block/List.tsx +6 -4
  42. package/ui/block/Panel.d.ts +3 -3
  43. package/ui/block/Panel.js +2 -2
  44. package/ui/block/Panel.tsx +4 -3
  45. package/ui/block/Paragraph.d.ts +3 -3
  46. package/ui/block/Paragraph.js +2 -2
  47. package/ui/block/Paragraph.tsx +4 -3
  48. package/ui/block/Preformatted.d.ts +3 -3
  49. package/ui/block/Preformatted.js +2 -2
  50. package/ui/block/Preformatted.tsx +4 -3
  51. package/ui/block/Row.d.ts +3 -3
  52. package/ui/block/Row.js +2 -2
  53. package/ui/block/Row.tsx +4 -3
  54. package/ui/block/Section.js +1 -1
  55. package/ui/block/Section.tsx +1 -0
  56. package/ui/block/Subheading.d.ts +1 -1
  57. package/ui/block/Subheading.js +2 -2
  58. package/ui/block/Subheading.tsx +2 -1
  59. package/ui/block/Title.d.ts +1 -1
  60. package/ui/block/Title.js +2 -2
  61. package/ui/block/Title.tsx +2 -1
  62. package/ui/block/Video.d.ts +3 -3
  63. package/ui/block/Video.js +2 -2
  64. package/ui/block/Video.tsx +4 -3
  65. package/ui/button/Button.d.ts +3 -2
  66. package/ui/button/Button.js +2 -2
  67. package/ui/button/Button.md +28 -0
  68. package/ui/button/Button.module.css +23 -5
  69. package/ui/button/Button.tsx +4 -3
  70. package/ui/button/Clickable.d.ts +3 -3
  71. package/ui/button/Clickable.js +6 -4
  72. package/ui/button/Clickable.tsx +9 -9
  73. package/ui/button/FullscreenButton.d.ts +3 -5
  74. package/ui/button/FullscreenButton.tsx +3 -2
  75. package/ui/button/RetryButton.d.ts +2 -2
  76. package/ui/button/RetryButton.tsx +2 -2
  77. package/ui/button/SubmitButton.d.ts +3 -3
  78. package/ui/button/SubmitButton.js +3 -2
  79. package/ui/button/SubmitButton.tsx +5 -3
  80. package/ui/dialog/Dialog.d.ts +6 -4
  81. package/ui/dialog/Dialog.js +7 -4
  82. package/ui/dialog/Dialog.tsx +19 -7
  83. package/ui/dialog/Modal.d.ts +3 -3
  84. package/ui/dialog/Modal.js +3 -3
  85. package/ui/dialog/Modal.tsx +5 -5
  86. package/ui/docs/DocumentationButtons.d.ts +3 -2
  87. package/ui/docs/DocumentationButtons.js +2 -2
  88. package/ui/docs/DocumentationButtons.tsx +4 -1
  89. package/ui/form/Field.d.ts +3 -3
  90. package/ui/form/Field.js +2 -2
  91. package/ui/form/Field.tsx +4 -3
  92. package/ui/form/Form.d.ts +2 -2
  93. package/ui/form/Form.js +3 -2
  94. package/ui/form/Form.tsx +5 -3
  95. package/ui/form/FormFields.d.ts +1 -1
  96. package/ui/form/FormFields.js +2 -2
  97. package/ui/form/FormFields.tsx +2 -2
  98. package/ui/form/FormFooter.d.ts +3 -3
  99. package/ui/form/FormFooter.js +2 -2
  100. package/ui/form/FormFooter.tsx +4 -4
  101. package/ui/form/FormMessage.d.ts +2 -2
  102. package/ui/form/FormMessage.tsx +2 -3
  103. package/ui/form/Progress.d.ts +3 -2
  104. package/ui/form/Progress.js +2 -2
  105. package/ui/form/Progress.tsx +4 -2
  106. package/ui/inline/Code.d.ts +3 -3
  107. package/ui/inline/Code.js +2 -2
  108. package/ui/inline/Code.tsx +4 -3
  109. package/ui/inline/Deleted.d.ts +3 -3
  110. package/ui/inline/Deleted.js +2 -2
  111. package/ui/inline/Deleted.tsx +4 -3
  112. package/ui/inline/Emphasis.d.ts +3 -3
  113. package/ui/inline/Emphasis.js +2 -2
  114. package/ui/inline/Emphasis.tsx +4 -3
  115. package/ui/inline/Inserted.d.ts +3 -3
  116. package/ui/inline/Inserted.js +2 -2
  117. package/ui/inline/Inserted.tsx +4 -3
  118. package/ui/inline/Link.d.ts +3 -2
  119. package/ui/inline/Link.js +2 -2
  120. package/ui/inline/Link.tsx +4 -2
  121. package/ui/inline/Mark.d.ts +3 -3
  122. package/ui/inline/Mark.js +2 -2
  123. package/ui/inline/Mark.tsx +4 -3
  124. package/ui/inline/Small.d.ts +3 -3
  125. package/ui/inline/Small.js +2 -2
  126. package/ui/inline/Small.tsx +4 -3
  127. package/ui/inline/Span.d.ts +3 -3
  128. package/ui/inline/Span.js +3 -2
  129. package/ui/inline/Span.tsx +5 -4
  130. package/ui/inline/Strong.d.ts +3 -3
  131. package/ui/inline/Strong.js +2 -2
  132. package/ui/inline/Strong.tsx +4 -3
  133. package/ui/inline/Subscript.d.ts +3 -3
  134. package/ui/inline/Subscript.js +3 -3
  135. package/ui/inline/Subscript.tsx +5 -5
  136. package/ui/inline/Superscript.d.ts +3 -3
  137. package/ui/inline/Superscript.js +3 -3
  138. package/ui/inline/Superscript.tsx +5 -5
  139. package/ui/input/ArrayInput.js +2 -2
  140. package/ui/input/ArrayInput.tsx +2 -1
  141. package/ui/input/ArrayRadioInputs.d.ts +1 -1
  142. package/ui/input/ArrayRadioInputs.js +2 -2
  143. package/ui/input/ArrayRadioInputs.tsx +2 -1
  144. package/ui/input/ButtonInput.d.ts +1 -1
  145. package/ui/input/ButtonInput.js +2 -2
  146. package/ui/input/ButtonInput.tsx +2 -1
  147. package/ui/input/CheckboxInput.d.ts +1 -1
  148. package/ui/input/CheckboxInput.js +2 -2
  149. package/ui/input/CheckboxInput.tsx +2 -0
  150. package/ui/input/ChoiceRadioInputs.js +2 -2
  151. package/ui/input/ChoiceRadioInputs.tsx +2 -1
  152. package/ui/input/DataInput.js +2 -2
  153. package/ui/input/DataInput.tsx +2 -1
  154. package/ui/input/DateInput.d.ts +1 -1
  155. package/ui/input/DateInput.js +2 -2
  156. package/ui/input/DateInput.tsx +2 -1
  157. package/ui/input/DictionaryInput.js +2 -2
  158. package/ui/input/DictionaryInput.tsx +2 -1
  159. package/ui/input/FileInput.d.ts +1 -1
  160. package/ui/input/FileInput.js +3 -2
  161. package/ui/input/FileInput.tsx +3 -1
  162. package/ui/input/Input.d.ts +10 -3
  163. package/ui/input/Input.js +2 -2
  164. package/ui/input/Input.tsx +11 -4
  165. package/ui/input/NumberInput.d.ts +1 -1
  166. package/ui/input/NumberInput.js +2 -2
  167. package/ui/input/NumberInput.tsx +2 -1
  168. package/ui/input/OutputInput.d.ts +1 -1
  169. package/ui/input/OutputInput.js +2 -2
  170. package/ui/input/OutputInput.tsx +2 -2
  171. package/ui/input/Popover.d.ts +4 -2
  172. package/ui/input/Popover.js +4 -3
  173. package/ui/input/Popover.tsx +6 -3
  174. package/ui/input/PopoverButton.d.ts +28 -0
  175. package/ui/input/{ButtonPopover.js → PopoverButton.js} +10 -8
  176. package/ui/input/PopoverButton.tsx +44 -0
  177. package/ui/input/PopoverButtonInput.d.ts +27 -0
  178. package/ui/input/{ButtonInputPopover.js → PopoverButtonInput.js} +10 -8
  179. package/ui/input/PopoverButtonInput.tsx +44 -0
  180. package/ui/input/QueryInput.d.ts +1 -1
  181. package/ui/input/QueryInput.js +2 -2
  182. package/ui/input/QueryInput.tsx +2 -0
  183. package/ui/input/RadioInput.d.ts +1 -1
  184. package/ui/input/RadioInput.js +2 -2
  185. package/ui/input/RadioInput.tsx +2 -0
  186. package/ui/input/SchemaInput.d.ts +1 -1
  187. package/ui/input/SchemaInput.js +2 -2
  188. package/ui/input/SchemaInput.tsx +2 -2
  189. package/ui/input/SelectInput.js +2 -2
  190. package/ui/input/SelectInput.tsx +2 -1
  191. package/ui/input/TextInput.d.ts +1 -1
  192. package/ui/input/TextInput.js +3 -3
  193. package/ui/input/TextInput.tsx +3 -2
  194. package/ui/input/index.d.ts +2 -2
  195. package/ui/input/index.js +2 -2
  196. package/ui/input/index.ts +2 -2
  197. package/ui/menu/Menu.d.ts +5 -5
  198. package/ui/menu/Menu.js +4 -4
  199. package/ui/menu/Menu.tsx +7 -6
  200. package/ui/misc/Icon.d.ts +2 -1
  201. package/ui/misc/Icon.js +2 -1
  202. package/ui/misc/Icon.tsx +3 -1
  203. package/ui/misc/Loading.d.ts +2 -3
  204. package/ui/misc/Loading.js +2 -2
  205. package/ui/misc/Loading.tsx +10 -3
  206. package/ui/misc/Tag.d.ts +3 -2
  207. package/ui/misc/Tag.js +2 -2
  208. package/ui/misc/Tag.tsx +4 -3
  209. package/ui/notice/Message.d.ts +3 -3
  210. package/ui/notice/Message.js +2 -2
  211. package/ui/notice/Message.tsx +4 -3
  212. package/ui/notice/Notice.d.ts +3 -3
  213. package/ui/notice/Notice.js +2 -2
  214. package/ui/notice/Notice.tsx +4 -2
  215. package/ui/notice/Notices.d.ts +3 -2
  216. package/ui/notice/Notices.js +2 -2
  217. package/ui/notice/Notices.tsx +4 -3
  218. package/ui/table/Cell.d.ts +3 -3
  219. package/ui/table/Cell.js +2 -2
  220. package/ui/table/Cell.tsx +4 -3
  221. package/ui/table/Table.d.ts +3 -3
  222. package/ui/table/Table.js +2 -2
  223. package/ui/table/Table.tsx +4 -3
  224. package/ui/tree/TreeBreadcrumbs.d.ts +3 -2
  225. package/ui/tree/TreeBreadcrumbs.js +2 -2
  226. package/ui/tree/TreeBreadcrumbs.tsx +4 -2
  227. package/ui/tree/TreeButton.d.ts +2 -1
  228. package/ui/tree/TreeButton.tsx +2 -1
  229. package/ui/util/ClassProps.md +56 -0
  230. package/ui/util/css.d.ts +1 -1
  231. package/ui/util/css.js +2 -2
  232. package/ui/util/css.test.ts +29 -0
  233. package/ui/util/css.ts +2 -2
  234. package/ui/util/props.d.ts +12 -0
  235. package/ui/util/props.test.tsx +100 -0
  236. package/ui/util/props.ts +13 -0
  237. package/ui/input/ButtonInputPopover.d.ts +0 -25
  238. package/ui/input/ButtonInputPopover.tsx +0 -41
  239. package/ui/input/ButtonPopover.d.ts +0 -25
  240. package/ui/input/ButtonPopover.tsx +0 -40
@@ -2,13 +2,14 @@ import { ChevronUpIcon } from "@heroicons/react/24/outline";
2
2
  import type { ReactElement, ReactNode } from "react";
3
3
  import { type BlockVariants, getBlockClass } from "../style/Block.js";
4
4
  import { getClass } from "../util/css.js";
5
+ import type { ClassProps } from "../util/props.js";
5
6
  import DETAILS_CSS from "./Details.module.css";
6
7
 
7
8
  const DETAILS_CLASS = DETAILS_CSS.details;
8
9
  const DETAILS_SUMMARY_CLASS = DETAILS_CSS.summary;
9
10
 
10
11
  /** Props for `DetailsItem` — a single collapsible disclosure. */
11
- export interface DetailsProps extends BlockVariants {
12
+ export interface DetailsProps extends BlockVariants, ClassProps {
12
13
  /** Content of the always-visible summary (e.g. a question). */
13
14
  title: ReactNode;
14
15
  /** Whether the item starts expanded. */
@@ -26,9 +27,9 @@ export interface DetailsProps extends BlockVariants {
26
27
  *
27
28
  * @kind component
28
29
  */
29
- export function Details({ title, open = false, name, children, ...props }: DetailsProps): ReactElement {
30
+ export function Details({ title, open = false, name, children, className, ...props }: DetailsProps): ReactElement {
30
31
  return (
31
- <details className={getClass(DETAILS_CLASS, getBlockClass(props))} open={open} name={name}>
32
+ <details className={getClass(DETAILS_CLASS, getBlockClass(props), className)} open={open} name={name}>
32
33
  <summary className={DETAILS_SUMMARY_CLASS}>
33
34
  <span>{title}</span>
34
35
  <ChevronUpIcon />
@@ -1,10 +1,11 @@
1
1
  import { type BlockVariants } from "../style/Block.js";
2
+ import type { ClassProps } from "../util/props.js";
2
3
  /**
3
4
  * Props for `Divider` — space and colour variants.
4
5
  *
5
6
  * @see https://shelving.cc/ui/DividerProps
6
7
  */
7
- export interface DividerProps extends BlockVariants {
8
+ export interface DividerProps extends BlockVariants, ClassProps {
8
9
  }
9
10
  /**
10
11
  * Horizontal rule separating blocks of content — rendered as `<hr>`.
@@ -12,4 +13,4 @@ export interface DividerProps extends BlockVariants {
12
13
  * @example <Divider />
13
14
  * @see https://shelving.cc/ui/Divider
14
15
  */
15
- export declare function Divider(props: DividerProps): import("react").JSX.Element;
16
+ export declare function Divider({ className, ...props }: DividerProps): import("react").JSX.Element;
@@ -9,7 +9,7 @@ const DIVIDER_CLASS = getModuleClass(DIVIDER_CSS, "divider");
9
9
  * @example <Divider />
10
10
  * @see https://shelving.cc/ui/Divider
11
11
  */
12
- export function Divider(props) {
12
+ export function Divider({ className, ...props }) {
13
13
  return (_jsx("hr", { className: getClass(DIVIDER_CLASS, //
14
- getBlockClass(props)) }));
14
+ getBlockClass(props), className) }));
15
15
  }
@@ -1,5 +1,6 @@
1
1
  import { type BlockVariants, getBlockClass } from "../style/Block.js";
2
2
  import { getClass, getModuleClass } from "../util/css.js";
3
+ import type { ClassProps } from "../util/props.js";
3
4
  import DIVIDER_CSS from "./Divider.module.css";
4
5
 
5
6
  const DIVIDER_CLASS = getModuleClass(DIVIDER_CSS, "divider");
@@ -9,7 +10,7 @@ const DIVIDER_CLASS = getModuleClass(DIVIDER_CSS, "divider");
9
10
  *
10
11
  * @see https://shelving.cc/ui/DividerProps
11
12
  */
12
- export interface DividerProps extends BlockVariants {}
13
+ export interface DividerProps extends BlockVariants, ClassProps {}
13
14
 
14
15
  /**
15
16
  * Horizontal rule separating blocks of content — rendered as `<hr>`.
@@ -17,12 +18,13 @@ export interface DividerProps extends BlockVariants {}
17
18
  * @example <Divider />
18
19
  * @see https://shelving.cc/ui/Divider
19
20
  */
20
- export function Divider(props: DividerProps) {
21
+ export function Divider({ className, ...props }: DividerProps) {
21
22
  return (
22
23
  <hr
23
24
  className={getClass(
24
25
  DIVIDER_CLASS, //
25
26
  getBlockClass(props),
27
+ className,
26
28
  )}
27
29
  />
28
30
  );
@@ -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 shared by `<Title>`, `Heading`, and `<Subheading>` — colour, space, and typography variants plus a heading-level override.
6
6
  *
7
7
  * @see https://shelving.cc/ui/HeadingProps
8
8
  */
9
- export interface HeadingProps extends BlockVariants, ChildProps {
9
+ export interface HeadingProps extends BlockVariants, ChildProps, ClassProps {
10
10
  /**
11
11
  * Heading level (`1`–`6`) — sets the rendered `<h1>`–`<h6>` tag.
12
12
  * Avoid overriding this in practice: pick the component that matches the level — `<Title>` (`<h1>`), `Heading` (`<h2>`), or `<Subheading>` (`<h3>`) — so the visual size and the document outline stay in step.
@@ -20,4 +20,4 @@ export interface HeadingProps extends BlockVariants, ChildProps {
20
20
  * @kind component
21
21
  * @see https://shelving.cc/ui/Heading
22
22
  */
23
- export declare function Heading({ level, children, ...props }: HeadingProps): ReactElement;
23
+ export declare function Heading({ level, children, className, ...props }: HeadingProps): ReactElement;
@@ -10,8 +10,8 @@ const HEADING_CLASS = getModuleClass(HEADING_CSS, "heading");
10
10
  * @kind component
11
11
  * @see https://shelving.cc/ui/Heading
12
12
  */
13
- export function Heading({ level = "2", children, ...props }) {
13
+ export function Heading({ level = "2", children, className, ...props }) {
14
14
  const Element = `h${level}`;
15
15
  return (_jsx(Element, { className: getClass(HEADING_CLASS, //
16
- getBlockClass(props)), children: children }));
16
+ getBlockClass(props), className), children: children }));
17
17
  }
@@ -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 HEADING_CSS from "./Heading.module.css";
6
6
 
7
7
  const HEADING_CLASS = getModuleClass(HEADING_CSS, "heading");
@@ -11,7 +11,7 @@ const HEADING_CLASS = getModuleClass(HEADING_CSS, "heading");
11
11
  *
12
12
  * @see https://shelving.cc/ui/HeadingProps
13
13
  */
14
- export interface HeadingProps extends BlockVariants, ChildProps {
14
+ export interface HeadingProps extends BlockVariants, ChildProps, ClassProps {
15
15
  /**
16
16
  * Heading level (`1`–`6`) — sets the rendered `<h1>`–`<h6>` tag.
17
17
  * Avoid overriding this in practice: pick the component that matches the level — `<Title>` (`<h1>`), `Heading` (`<h2>`), or `<Subheading>` (`<h3>`) — so the visual size and the document outline stay in step.
@@ -26,13 +26,14 @@ export interface HeadingProps extends BlockVariants, ChildProps {
26
26
  * @kind component
27
27
  * @see https://shelving.cc/ui/Heading
28
28
  */
29
- export function Heading({ level = "2", children, ...props }: HeadingProps): ReactElement {
29
+ export function Heading({ level = "2", children, className, ...props }: HeadingProps): ReactElement {
30
30
  const Element: `h${typeof level}` = `h${level}`;
31
31
  return (
32
32
  <Element
33
33
  className={getClass(
34
34
  HEADING_CLASS, //
35
35
  getBlockClass(props),
36
+ className,
36
37
  )}
37
38
  >
38
39
  {children}
@@ -1,12 +1,13 @@
1
1
  import type { ReactElement } from "react";
2
2
  import type { SpaceVariants } from "../style/Space.js";
3
3
  import type { WidthVariants } from "../style/Width.js";
4
+ import type { ClassProps } from "../util/props.js";
4
5
  /**
5
6
  * Props for `Image` — an `src`, optional `alt` text, plus space and width variants.
6
7
  *
7
8
  * @see https://shelving.cc/ui/ImageProps
8
9
  */
9
- export interface ImageProps extends SpaceVariants, WidthVariants {
10
+ export interface ImageProps extends SpaceVariants, WidthVariants, ClassProps {
10
11
  src: string;
11
12
  alt?: string;
12
13
  }
@@ -17,4 +18,4 @@ export interface ImageProps extends SpaceVariants, WidthVariants {
17
18
  * @example <Image src="/logo.png" alt="Logo" width="narrow" />
18
19
  * @see https://shelving.cc/ui/Image
19
20
  */
20
- export declare function Image({ src, alt, ...props }: ImageProps): ReactElement;
21
+ export declare function Image({ src, alt, className, ...props }: ImageProps): ReactElement;
package/ui/block/Image.js CHANGED
@@ -10,7 +10,7 @@ const IMAGE_CLASS = getModuleClass(IMAGE_CSS, "image");
10
10
  * @example <Image src="/logo.png" alt="Logo" width="narrow" />
11
11
  * @see https://shelving.cc/ui/Image
12
12
  */
13
- export function Image({ src, alt, ...props }) {
13
+ export function Image({ src, alt, className, ...props }) {
14
14
  return (_jsx("img", { src: src, alt: alt, className: getClass(IMAGE_CLASS, //
15
- getBlockClass(props)) }));
15
+ getBlockClass(props), className) }));
16
16
  }
@@ -3,6 +3,7 @@ import { getBlockClass } from "../style/Block.js";
3
3
  import type { SpaceVariants } from "../style/Space.js";
4
4
  import type { WidthVariants } from "../style/Width.js";
5
5
  import { getClass, getModuleClass } from "../util/css.js";
6
+ import type { ClassProps } from "../util/props.js";
6
7
  import IMAGE_CSS from "./Image.module.css";
7
8
 
8
9
  const IMAGE_CLASS = getModuleClass(IMAGE_CSS, "image");
@@ -12,7 +13,7 @@ const IMAGE_CLASS = getModuleClass(IMAGE_CSS, "image");
12
13
  *
13
14
  * @see https://shelving.cc/ui/ImageProps
14
15
  */
15
- export interface ImageProps extends SpaceVariants, WidthVariants {
16
+ export interface ImageProps extends SpaceVariants, WidthVariants, ClassProps {
16
17
  src: string;
17
18
  alt?: string;
18
19
  }
@@ -24,7 +25,7 @@ export interface ImageProps extends SpaceVariants, WidthVariants {
24
25
  * @example <Image src="/logo.png" alt="Logo" width="narrow" />
25
26
  * @see https://shelving.cc/ui/Image
26
27
  */
27
- export function Image({ src, alt, ...props }: ImageProps): ReactElement {
28
+ export function Image({ src, alt, className, ...props }: ImageProps): ReactElement {
28
29
  return (
29
30
  <img
30
31
  src={src}
@@ -32,6 +33,7 @@ export function Image({ src, alt, ...props }: ImageProps): ReactElement {
32
33
  className={getClass(
33
34
  IMAGE_CLASS, //
34
35
  getBlockClass(props),
36
+ className,
35
37
  )}
36
38
  />
37
39
  );
@@ -16,4 +16,4 @@ export interface LabelProps extends HeadingProps {
16
16
  * @example <Label>Email address</Label>
17
17
  * @see https://shelving.cc/ui/Label
18
18
  */
19
- export declare function Label({ level, children, ...props }: LabelProps): ReactElement;
19
+ export declare function Label({ level, children, className, ...props }: LabelProps): ReactElement;
package/ui/block/Label.js CHANGED
@@ -12,8 +12,8 @@ const LABEL_CLASS = getModuleClass(LABEL_CSS, "label");
12
12
  * @example <Label>Email address</Label>
13
13
  * @see https://shelving.cc/ui/Label
14
14
  */
15
- export function Label({ level = "3", children, ...props }) {
15
+ export function Label({ level = "3", children, className, ...props }) {
16
16
  const Element = `h${level}`;
17
17
  return (_jsx(Element, { className: getClass(LABEL_CLASS, //
18
- getBlockClass(props)), children: children }));
18
+ getBlockClass(props), className), children: children }));
19
19
  }
@@ -22,13 +22,14 @@ export interface LabelProps extends HeadingProps {}
22
22
  * @example <Label>Email address</Label>
23
23
  * @see https://shelving.cc/ui/Label
24
24
  */
25
- export function Label({ level = "3", children, ...props }: LabelProps): ReactElement {
25
+ export function Label({ level = "3", children, className, ...props }: LabelProps): ReactElement {
26
26
  const Element: `h${typeof level}` = `h${level}`;
27
27
  return (
28
28
  <Element
29
29
  className={getClass(
30
30
  LABEL_CLASS, //
31
31
  getBlockClass(props),
32
+ className,
32
33
  )}
33
34
  >
34
35
  {children}
@@ -2,12 +2,13 @@ import type { ReactElement, ReactNode } from "react";
2
2
  import type { ImmutableArray } from "../../util/array.js";
3
3
  import { type BlockVariants } from "../style/Block.js";
4
4
  import { type GapVariants } from "../style/Gap.js";
5
+ import type { ClassProps } from "../util/props.js";
5
6
  /**
6
7
  * Props for `List` — colour, gap, space, and typography variants plus its list items and an `ordered` toggle.
7
8
  *
8
9
  * @see https://shelving.cc/ui/ListProps
9
10
  */
10
- export interface ListProps extends GapVariants, BlockVariants {
11
+ export interface ListProps extends GapVariants, BlockVariants, ClassProps {
11
12
  readonly children: ImmutableArray<ReactNode>;
12
13
  readonly ordered?: boolean | undefined;
13
14
  }
@@ -18,4 +19,4 @@ export interface ListProps extends GapVariants, BlockVariants {
18
19
  * @kind component
19
20
  * @see https://shelving.cc/ui/List
20
21
  */
21
- export declare function List({ children, ordered, ...props }: ListProps): ReactElement;
22
+ export declare function List({ children, ordered, className, ...props }: ListProps): ReactElement;
package/ui/block/List.js CHANGED
@@ -12,9 +12,9 @@ const LIST_UNORDERED_CLASS = getModuleClass(LIST_CSS, "unordered");
12
12
  * @kind component
13
13
  * @see https://shelving.cc/ui/List
14
14
  */
15
- export function List({ children, ordered = false, ...props }) {
15
+ export function List({ children, ordered = false, className, ...props }) {
16
16
  const items = children.map((v, i) => _jsx("li", { children: v }, i.toString()));
17
- const className = getClass(ordered ? LIST_ORDERED_CLASS : LIST_UNORDERED_CLASS, //
18
- getBlockClass(props), getGapClass(props));
19
- return ordered ? _jsx("ol", { className: className, children: items }) : _jsx("ul", { className: className, children: items });
17
+ const classes = getClass(ordered ? LIST_ORDERED_CLASS : LIST_UNORDERED_CLASS, //
18
+ getBlockClass(props), getGapClass(props), className);
19
+ return ordered ? _jsx("ol", { className: classes, children: items }) : _jsx("ul", { className: classes, children: items });
20
20
  }
package/ui/block/List.tsx CHANGED
@@ -3,6 +3,7 @@ import type { ImmutableArray } from "../../util/array.js";
3
3
  import { type BlockVariants, getBlockClass } from "../style/Block.js";
4
4
  import { type GapVariants, getGapClass } from "../style/Gap.js";
5
5
  import { getClass, getModuleClass } from "../util/css.js";
6
+ import type { ClassProps } from "../util/props.js";
6
7
  import LIST_CSS from "./List.module.css";
7
8
 
8
9
  const LIST_ORDERED_CLASS = getModuleClass(LIST_CSS, "ordered");
@@ -13,7 +14,7 @@ const LIST_UNORDERED_CLASS = getModuleClass(LIST_CSS, "unordered");
13
14
  *
14
15
  * @see https://shelving.cc/ui/ListProps
15
16
  */
16
- export interface ListProps extends GapVariants, BlockVariants {
17
+ export interface ListProps extends GapVariants, BlockVariants, ClassProps {
17
18
  readonly children: ImmutableArray<ReactNode>;
18
19
  readonly ordered?: boolean | undefined;
19
20
  }
@@ -25,12 +26,13 @@ export interface ListProps extends GapVariants, BlockVariants {
25
26
  * @kind component
26
27
  * @see https://shelving.cc/ui/List
27
28
  */
28
- export function List({ children, ordered = false, ...props }: ListProps): ReactElement {
29
+ export function List({ children, ordered = false, className, ...props }: ListProps): ReactElement {
29
30
  const items = children.map((v, i) => <li key={i.toString()}>{v}</li>);
30
- const className = getClass(
31
+ const classes = getClass(
31
32
  ordered ? LIST_ORDERED_CLASS : LIST_UNORDERED_CLASS, //
32
33
  getBlockClass(props),
33
34
  getGapClass(props),
35
+ className,
34
36
  );
35
- return ordered ? <ol className={className}>{items}</ol> : <ul className={className}>{items}</ul>;
37
+ return ordered ? <ol className={classes}>{items}</ol> : <ul className={classes}>{items}</ul>;
36
38
  }
@@ -2,14 +2,14 @@ import type { ReactElement } from "react";
2
2
  import { type BlockVariants } from "../style/Block.js";
3
3
  import { type PaddingVariants } from "../style/Padding.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
  import type { BlockElement } from "./Block.js";
7
7
  /**
8
8
  * Props for `Panel` — colour, status, and typography variants plus optional `children`.
9
9
  *
10
10
  * @see https://shelving.cc/ui/PanelProps
11
11
  */
12
- export interface PanelProps extends BlockVariants, PaddingVariants, StatusVariants, OptionalChildProps {
12
+ export interface PanelProps extends BlockVariants, PaddingVariants, StatusVariants, OptionalChildProps, ClassProps {
13
13
  /**
14
14
  * Element this `<Panel>` renders as, e.g. "header" to output a "<header>"
15
15
  * @default "section"
@@ -26,4 +26,4 @@ export interface PanelProps extends BlockVariants, PaddingVariants, StatusVarian
26
26
  * @kind component
27
27
  * @see https://shelving.cc/ui/Panel
28
28
  */
29
- export declare function Panel({ as: Element, children, ...props }: PanelProps): ReactElement;
29
+ export declare function Panel({ as: Element, children, className, ...props }: PanelProps): ReactElement;
package/ui/block/Panel.js CHANGED
@@ -15,7 +15,7 @@ const PANEL_CLASS = getModuleClass(PANEL_CSS, "panel");
15
15
  * @kind component
16
16
  * @see https://shelving.cc/ui/Panel
17
17
  */
18
- export function Panel({ as: Element = "section", children, ...props }) {
18
+ export function Panel({ as: Element = "section", children, className, ...props }) {
19
19
  return (_jsx(Element, { className: getClass(PANEL_CLASS, //
20
- getStatusClass(props), getPaddingClass(props), getBlockClass(props)), children: children }));
20
+ getStatusClass(props), getPaddingClass(props), getBlockClass(props), className), children: children }));
21
21
  }
@@ -3,7 +3,7 @@ import { type BlockVariants, getBlockClass } from "../style/Block.js";
3
3
  import { getPaddingClass, type PaddingVariants } from "../style/Padding.js";
4
4
  import { getStatusClass, type StatusVariants } from "../style/Status.js";
5
5
  import { getClass, getModuleClass } from "../util/css.js";
6
- import type { OptionalChildProps } from "../util/props.js";
6
+ import type { ClassProps, OptionalChildProps } from "../util/props.js";
7
7
  import type { BlockElement } from "./Block.js";
8
8
  import PANEL_CSS from "./Panel.module.css";
9
9
 
@@ -14,7 +14,7 @@ const PANEL_CLASS = getModuleClass(PANEL_CSS, "panel");
14
14
  *
15
15
  * @see https://shelving.cc/ui/PanelProps
16
16
  */
17
- export interface PanelProps extends BlockVariants, PaddingVariants, StatusVariants, OptionalChildProps {
17
+ export interface PanelProps extends BlockVariants, PaddingVariants, StatusVariants, OptionalChildProps, ClassProps {
18
18
  /**
19
19
  * Element this `<Panel>` renders as, e.g. "header" to output a "<header>"
20
20
  * @default "section"
@@ -32,7 +32,7 @@ export interface PanelProps extends BlockVariants, PaddingVariants, StatusVarian
32
32
  * @kind component
33
33
  * @see https://shelving.cc/ui/Panel
34
34
  */
35
- export function Panel({ as: Element = "section", children, ...props }: PanelProps): ReactElement {
35
+ export function Panel({ as: Element = "section", children, className, ...props }: PanelProps): ReactElement {
36
36
  return (
37
37
  <Element
38
38
  className={getClass(
@@ -40,6 +40,7 @@ export function Panel({ as: Element = "section", children, ...props }: PanelProp
40
40
  getStatusClass(props),
41
41
  getPaddingClass(props),
42
42
  getBlockClass(props),
43
+ className,
43
44
  )}
44
45
  >
45
46
  {children}
@@ -1,12 +1,12 @@
1
1
  import type { ReactElement } from "react";
2
2
  import { type BlockVariants } from "../style/Block.js";
3
- import type { OptionalChildProps } from "../util/props.js";
3
+ import type { ClassProps, OptionalChildProps } from "../util/props.js";
4
4
  /**
5
5
  * Props for `Paragraph` — colour, space, and typography variants.
6
6
  *
7
7
  * @see https://shelving.cc/ui/ParagraphProps
8
8
  */
9
- export interface ParagraphProps extends BlockVariants, OptionalChildProps {
9
+ export interface ParagraphProps extends BlockVariants, OptionalChildProps, ClassProps {
10
10
  }
11
11
  /**
12
12
  * Paragraph block of body text — rendered as `<p>`.
@@ -14,4 +14,4 @@ export interface ParagraphProps extends BlockVariants, OptionalChildProps {
14
14
  * @kind component
15
15
  * @see https://shelving.cc/ui/Paragraph
16
16
  */
17
- export declare function Paragraph({ children, ...props }: ParagraphProps): ReactElement;
17
+ export declare function Paragraph({ children, className, ...props }: ParagraphProps): ReactElement;
@@ -9,7 +9,7 @@ const PARAGRAPH_CLASS = getModuleClass(PARAGRAPH_CSS, "paragraph");
9
9
  * @kind component
10
10
  * @see https://shelving.cc/ui/Paragraph
11
11
  */
12
- export function Paragraph({ children, ...props }) {
12
+ export function Paragraph({ children, className, ...props }) {
13
13
  return (_jsx("p", { className: getClass(PARAGRAPH_CLASS, //
14
- getBlockClass(props)), children: children }));
14
+ getBlockClass(props), className), children: children }));
15
15
  }
@@ -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 { OptionalChildProps } from "../util/props.js";
4
+ import type { ClassProps, OptionalChildProps } from "../util/props.js";
5
5
  import PARAGRAPH_CSS from "./Paragraph.module.css";
6
6
 
7
7
  const PARAGRAPH_CLASS = getModuleClass(PARAGRAPH_CSS, "paragraph");
@@ -11,7 +11,7 @@ const PARAGRAPH_CLASS = getModuleClass(PARAGRAPH_CSS, "paragraph");
11
11
  *
12
12
  * @see https://shelving.cc/ui/ParagraphProps
13
13
  */
14
- export interface ParagraphProps extends BlockVariants, OptionalChildProps {}
14
+ export interface ParagraphProps extends BlockVariants, OptionalChildProps, ClassProps {}
15
15
 
16
16
  /**
17
17
  * Paragraph block of body text — rendered as `<p>`.
@@ -19,12 +19,13 @@ export interface ParagraphProps extends BlockVariants, OptionalChildProps {}
19
19
  * @kind component
20
20
  * @see https://shelving.cc/ui/Paragraph
21
21
  */
22
- export function Paragraph({ children, ...props }: ParagraphProps): ReactElement {
22
+ export function Paragraph({ children, className, ...props }: ParagraphProps): ReactElement {
23
23
  return (
24
24
  <p
25
25
  className={getClass(
26
26
  PARAGRAPH_CLASS, //
27
27
  getBlockClass(props),
28
+ className,
28
29
  )}
29
30
  >
30
31
  {children}
@@ -1,13 +1,13 @@
1
1
  import type { ReactElement } from "react";
2
2
  import { type BlockVariants } from "../style/Block.js";
3
3
  import type { SpaceVariants } from "../style/Space.js";
4
- import type { OptionalChildProps } from "../util/props.js";
4
+ import type { ClassProps, OptionalChildProps } from "../util/props.js";
5
5
  /**
6
6
  * Props for `Preformatted` — space, colour, typography, width, and padding variants plus a `wrap` toggle.
7
7
  *
8
8
  * @see https://shelving.cc/ui/PreformattedProps
9
9
  */
10
- export interface PreformattedProps extends SpaceVariants, BlockVariants, OptionalChildProps {
10
+ export interface PreformattedProps extends SpaceVariants, BlockVariants, OptionalChildProps, ClassProps {
11
11
  /** Enable line wrapping (default is nowrap). */
12
12
  wrap?: boolean | undefined;
13
13
  }
@@ -20,4 +20,4 @@ export interface PreformattedProps extends SpaceVariants, BlockVariants, Optiona
20
20
  * @example <Preformatted>{"line one\nline two"}</Preformatted>
21
21
  * @see https://shelving.cc/ui/Preformatted
22
22
  */
23
- export declare function Preformatted({ children, ...variants }: PreformattedProps): ReactElement;
23
+ export declare function Preformatted({ children, className, ...variants }: PreformattedProps): ReactElement;
@@ -11,7 +11,7 @@ import PREFORMATTED_CSS from "./Preformatted.module.css";
11
11
  * @example <Preformatted>{"line one\nline two"}</Preformatted>
12
12
  * @see https://shelving.cc/ui/Preformatted
13
13
  */
14
- export function Preformatted({ children, ...variants }) {
14
+ export function Preformatted({ children, className, ...variants }) {
15
15
  return (_jsx("pre", { className: getClass(getModuleClass(PREFORMATTED_CSS, "preformatted", variants), //
16
- getBlockClass(variants)), children: children }));
16
+ getBlockClass(variants), className), children: children }));
17
17
  }
@@ -2,7 +2,7 @@ import type { ReactElement } from "react";
2
2
  import { type BlockVariants, getBlockClass } from "../style/Block.js";
3
3
  import type { SpaceVariants } from "../style/Space.js";
4
4
  import { getClass, getModuleClass } from "../util/css.js";
5
- import type { OptionalChildProps } from "../util/props.js";
5
+ import type { ClassProps, OptionalChildProps } from "../util/props.js";
6
6
  import PREFORMATTED_CSS from "./Preformatted.module.css";
7
7
 
8
8
  /**
@@ -10,7 +10,7 @@ import PREFORMATTED_CSS from "./Preformatted.module.css";
10
10
  *
11
11
  * @see https://shelving.cc/ui/PreformattedProps
12
12
  */
13
- export interface PreformattedProps extends SpaceVariants, BlockVariants, OptionalChildProps {
13
+ export interface PreformattedProps extends SpaceVariants, BlockVariants, OptionalChildProps, ClassProps {
14
14
  /** Enable line wrapping (default is nowrap). */
15
15
  wrap?: boolean | undefined;
16
16
  }
@@ -24,12 +24,13 @@ export interface PreformattedProps extends SpaceVariants, BlockVariants, Optiona
24
24
  * @example <Preformatted>{"line one\nline two"}</Preformatted>
25
25
  * @see https://shelving.cc/ui/Preformatted
26
26
  */
27
- export function Preformatted({ children, ...variants }: PreformattedProps): ReactElement {
27
+ export function Preformatted({ children, className, ...variants }: PreformattedProps): ReactElement {
28
28
  return (
29
29
  <pre
30
30
  className={getClass(
31
31
  getModuleClass(PREFORMATTED_CSS, "preformatted", variants), //
32
32
  getBlockClass(variants),
33
+ className,
33
34
  )}
34
35
  >
35
36
  {children}
package/ui/block/Row.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import type { ReactElement } from "react";
2
2
  import { type BlockVariants } from "../style/Block.js";
3
3
  import { type FlexVariants } from "../style/Flex.js";
4
- import type { OptionalChildProps } from "../util/index.js";
4
+ import type { ClassProps, OptionalChildProps } from "../util/index.js";
5
5
  import type { BlockElement } from "./Block.js";
6
6
  /**
7
7
  * Props for the `<Row>` component.
8
8
  *
9
9
  * @see https://shelving.cc/ui/RowProps
10
10
  */
11
- export interface RowProps extends BlockVariants, FlexVariants, OptionalChildProps {
11
+ export interface RowProps extends BlockVariants, FlexVariants, OptionalChildProps, ClassProps {
12
12
  /**
13
13
  * Element this `<Row>` renders as, e.g. "header" to output a "<header>"
14
14
  * @default "div"
@@ -22,4 +22,4 @@ export interface RowProps extends BlockVariants, FlexVariants, OptionalChildProp
22
22
  * @example <Row gap="small" center>{items}</Row>
23
23
  * @see https://shelving.cc/ui/Row
24
24
  */
25
- export declare function Row({ as: Element, children, ...props }: RowProps): ReactElement;
25
+ export declare function Row({ as: Element, children, className, ...props }: RowProps): ReactElement;
package/ui/block/Row.js CHANGED
@@ -9,7 +9,7 @@ import { getClass } from "../util/css.js";
9
9
  * @example <Row gap="small" center>{items}</Row>
10
10
  * @see https://shelving.cc/ui/Row
11
11
  */
12
- export function Row({ as: Element = "div", children, ...props }) {
12
+ export function Row({ as: Element = "div", children, className, ...props }) {
13
13
  return (_jsx(Element, { className: getClass(getBlockClass(props), //
14
- getFlexClass(props)), children: children }));
14
+ getFlexClass(props), className), children: children }));
15
15
  }
package/ui/block/Row.tsx CHANGED
@@ -2,7 +2,7 @@ import type { ReactElement } from "react";
2
2
  import { type BlockVariants, getBlockClass } from "../style/Block.js";
3
3
  import { type FlexVariants, getFlexClass } from "../style/Flex.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
  import type { BlockElement } from "./Block.js";
7
7
 
8
8
  /**
@@ -10,7 +10,7 @@ import type { BlockElement } from "./Block.js";
10
10
  *
11
11
  * @see https://shelving.cc/ui/RowProps
12
12
  */
13
- export interface RowProps extends BlockVariants, FlexVariants, OptionalChildProps {
13
+ export interface RowProps extends BlockVariants, FlexVariants, OptionalChildProps, ClassProps {
14
14
  /**
15
15
  * Element this `<Row>` renders as, e.g. "header" to output a "<header>"
16
16
  * @default "div"
@@ -25,12 +25,13 @@ export interface RowProps extends BlockVariants, FlexVariants, OptionalChildProp
25
25
  * @example <Row gap="small" center>{items}</Row>
26
26
  * @see https://shelving.cc/ui/Row
27
27
  */
28
- export function Row({ as: Element = "div", children, ...props }: RowProps): ReactElement {
28
+ export function Row({ as: Element = "div", children, className, ...props }: RowProps): ReactElement {
29
29
  return (
30
30
  <Element
31
31
  className={getClass(
32
32
  getBlockClass(props), //
33
33
  getFlexClass(props),
34
+ className,
34
35
  )}
35
36
  >
36
37
  {children}
@@ -5,7 +5,7 @@ import SECTION_CSS from "./Section.module.css";
5
5
  const SECTION_CLASS = getModuleClass(SECTION_CSS, "section");
6
6
  function _getSectionClass(props) {
7
7
  return getClass(SECTION_CLASS, //
8
- getBlockClass(props));
8
+ getBlockClass(props), props.className);
9
9
  }
10
10
  /**
11
11
  * `<section>` block with section-level spacing.
@@ -24,6 +24,7 @@ function _getSectionClass(props: SectionProps): string {
24
24
  return getClass(
25
25
  SECTION_CLASS, //
26
26
  getBlockClass(props),
27
+ props.className,
27
28
  );
28
29
  }
29
30
 
@@ -13,4 +13,4 @@ export type SubheadingProps = HeadingProps;
13
13
  * @kind component
14
14
  * @see https://shelving.cc/ui/Subheading
15
15
  */
16
- export declare function Subheading({ level, children, ...props }: SubheadingProps): ReactElement;
16
+ export declare function Subheading({ level, children, className, ...props }: SubheadingProps): ReactElement;