shelving 1.282.2 → 1.283.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 +10 -0
- 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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shelving",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.283.0",
|
|
4
4
|
"author": "Dave Houlbrooke <dave@shax.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"main": "./index.js",
|
|
10
10
|
"module": "./index.js",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@biomejs/biome": "^2.5.
|
|
12
|
+
"@biomejs/biome": "^2.5.8",
|
|
13
13
|
"@heroicons/react": "^2.2.0",
|
|
14
14
|
"@types/bun": "^1.3.14",
|
|
15
15
|
"@types/react": "^19.2.18",
|
package/ui/README.md
CHANGED
|
@@ -10,7 +10,8 @@ The `ui` module exists so an app never hand-rolls the same form field, card, or
|
|
|
10
10
|
|
|
11
11
|
A few conventions run through every component:
|
|
12
12
|
|
|
13
|
-
- **Styling props are for one-off overrides.** Visual options are props on the component — enumerated props for the scales (`color="red"`, `size="large"`, `space="none"`, `width="narrow"`) and boolean props for on/off variants (`<Button strong>`, `<Title center>`, `<Flex wrap>`). Each maps to a class in a CSS Module. Reach for them when a component needs to look different in *one place* — the way the docs site tints its accents purple — not as the way to dress a whole app. You never pass `style
|
|
13
|
+
- **Styling props are for one-off overrides.** Visual options are props on the component — enumerated props for the scales (`color="red"`, `size="large"`, `space="none"`, `width="narrow"`) and boolean props for on/off variants (`<Button strong>`, `<Title center>`, `<Flex wrap>`). Each maps to a class in a CSS Module. Reach for them when a component needs to look different in *one place* — the way the docs site tints its accents purple — not as the way to dress a whole app. You never pass `style`.
|
|
14
|
+
- **`className` is the escape hatch.** Most components accept an optional `className`, merged *after* the classes the component computes for itself, so an app class reliably wins over the library's `@layer components` rules. It takes any `Classes` value — a string, an array, or a dictionary of `true` flags — and lands on the component's own root element. Use it for a composed one-off treatment that tokens and per-property hooks can't express (an animation, a bespoke gradient); tokens and hooks stay the primary theming surface. Formatting-only components (`<When>`, `<Prose>`, `<Scroll>`), the `*Layout` components, and `<Dialog>` deliberately don't take one — write a new layout, or style the content inside. See `ClassProps`.
|
|
14
15
|
- **Composition.** Higher-level components — a `*Page`, a `*Card` — take their identity from library components like `<Card>`, `<Section>`, `<Button>`, and `<Tag>` rather than shipping their own styling.
|
|
15
16
|
- **Sentence case.** Titles, headings, and button labels capitalise only the first word.
|
|
16
17
|
- **Theme with CSS.** An app-wide custom look is a CSS file, not a wall of props. Write a `theme.css` that overrides the base design-token variables (and, where needed, per-component hooks) at `:root`, and import it after the library styles. The recommended workflow is to spend time tuning those variables to match your design — see [Theming](#theming) below.
|
package/ui/block/Address.d.ts
CHANGED
|
@@ -2,20 +2,20 @@ import type { ReactElement } from "react";
|
|
|
2
2
|
import { type AddressData } from "../../schema/AddressSchema.js";
|
|
3
3
|
import type { Nullish } from "../../util/null.js";
|
|
4
4
|
import { type BlockVariants } from "../style/Block.js";
|
|
5
|
-
import type { ChildProps } from "../util/props.js";
|
|
5
|
+
import type { ChildProps, ClassProps } from "../util/props.js";
|
|
6
6
|
/**
|
|
7
7
|
* Props for `Address` — colour, space, and typography variants plus required children.
|
|
8
8
|
*
|
|
9
9
|
* @see https://shelving.cc/ui/AddressProps
|
|
10
10
|
*/
|
|
11
|
-
export interface AddressProps extends BlockVariants, ChildProps {
|
|
11
|
+
export interface AddressProps extends BlockVariants, ChildProps, ClassProps {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Props for `PhysicalAddress` — an optional name and a nullable `AddressData` object.
|
|
15
15
|
*
|
|
16
16
|
* @see https://shelving.cc/ui/PhysicalAddressProps
|
|
17
17
|
*/
|
|
18
|
-
export interface PhysicalAddressProps {
|
|
18
|
+
export interface PhysicalAddressProps extends ClassProps {
|
|
19
19
|
name?: Nullish<string>;
|
|
20
20
|
address: Nullish<AddressData>;
|
|
21
21
|
}
|
|
@@ -24,7 +24,7 @@ export interface PhysicalAddressProps {
|
|
|
24
24
|
*
|
|
25
25
|
* @see https://shelving.cc/ui/EmailAddressProps
|
|
26
26
|
*/
|
|
27
|
-
export interface EmailAddressProps {
|
|
27
|
+
export interface EmailAddressProps extends ClassProps {
|
|
28
28
|
name?: Nullish<string>;
|
|
29
29
|
email: Nullish<string>;
|
|
30
30
|
}
|
|
@@ -34,7 +34,7 @@ export interface EmailAddressProps {
|
|
|
34
34
|
* @example <Address><Strong>Acme</Strong>{"\n"}1 Example St</Address>
|
|
35
35
|
* @see https://shelving.cc/ui/Address
|
|
36
36
|
*/
|
|
37
|
-
export declare function Address({ children, ...props }: AddressProps): import("react").JSX.Element;
|
|
37
|
+
export declare function Address({ children, className, ...props }: AddressProps): import("react").JSX.Element;
|
|
38
38
|
/**
|
|
39
39
|
* Show an optional `AddressData` object correctly on screen.
|
|
40
40
|
* - Renders an optional `name` in bold, followed by the formatted address; shows "No address" when `address` is empty.
|
|
@@ -43,7 +43,7 @@ export declare function Address({ children, ...props }: AddressProps): import("r
|
|
|
43
43
|
* @example <PhysicalAddress name="Acme" address={addressData} />
|
|
44
44
|
* @see https://shelving.cc/ui/PhysicalAddress
|
|
45
45
|
*/
|
|
46
|
-
export declare function PhysicalAddress({ name, address }: PhysicalAddressProps): ReactElement;
|
|
46
|
+
export declare function PhysicalAddress({ name, address, className }: PhysicalAddressProps): ReactElement;
|
|
47
47
|
/**
|
|
48
48
|
* Show an optional email address string correctly on screen.
|
|
49
49
|
* - Renders an optional `name` in bold, followed by a `mailto:` link; shows "No email" when `email` is empty.
|
|
@@ -52,4 +52,4 @@ export declare function PhysicalAddress({ name, address }: PhysicalAddressProps)
|
|
|
52
52
|
* @example <EmailAddress name="Acme" email="hi@example.com" />
|
|
53
53
|
* @see https://shelving.cc/ui/EmailAddress
|
|
54
54
|
*/
|
|
55
|
-
export declare function EmailAddress({ name, email }: EmailAddressProps): ReactElement;
|
|
55
|
+
export declare function EmailAddress({ name, email, className }: EmailAddressProps): ReactElement;
|
package/ui/block/Address.js
CHANGED
|
@@ -12,9 +12,9 @@ const ADDRESS_CLASS = getModuleClass(ADDRESS_CSS, "address");
|
|
|
12
12
|
* @example <Address><Strong>Acme</Strong>{"\n"}1 Example St</Address>
|
|
13
13
|
* @see https://shelving.cc/ui/Address
|
|
14
14
|
*/
|
|
15
|
-
export function Address({ children, ...props }) {
|
|
15
|
+
export function Address({ children, className, ...props }) {
|
|
16
16
|
return (_jsx("address", { className: getClass(ADDRESS_CLASS, //
|
|
17
|
-
getBlockClass(props)), children: children }));
|
|
17
|
+
getBlockClass(props), className), children: children }));
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Show an optional `AddressData` object correctly on screen.
|
|
@@ -24,8 +24,8 @@ export function Address({ children, ...props }) {
|
|
|
24
24
|
* @example <PhysicalAddress name="Acme" address={addressData} />
|
|
25
25
|
* @see https://shelving.cc/ui/PhysicalAddress
|
|
26
26
|
*/
|
|
27
|
-
export function PhysicalAddress({ name, address }) {
|
|
28
|
-
return (_jsxs(Address, { children: [name && _jsx(Strong, { children: name }), name && "\n", address ? formatAddress(address) : _jsx(Small, { children: "No address" })] }));
|
|
27
|
+
export function PhysicalAddress({ name, address, className }) {
|
|
28
|
+
return (_jsxs(Address, { className: className, children: [name && _jsx(Strong, { children: name }), name && "\n", address ? formatAddress(address) : _jsx(Small, { children: "No address" })] }));
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Show an optional email address string correctly on screen.
|
|
@@ -35,6 +35,6 @@ export function PhysicalAddress({ name, address }) {
|
|
|
35
35
|
* @example <EmailAddress name="Acme" email="hi@example.com" />
|
|
36
36
|
* @see https://shelving.cc/ui/EmailAddress
|
|
37
37
|
*/
|
|
38
|
-
export function EmailAddress({ name, email }) {
|
|
39
|
-
return (_jsxs(Address, { children: [name && _jsx(Strong, { children: name }), name && "\n", email ? _jsx("a", { href: `mailto:${email}`, children: email }) : _jsx(Small, { children: "No email" })] }));
|
|
38
|
+
export function EmailAddress({ name, email, className }) {
|
|
39
|
+
return (_jsxs(Address, { className: className, children: [name && _jsx(Strong, { children: name }), name && "\n", email ? _jsx("a", { href: `mailto:${email}`, children: email }) : _jsx(Small, { children: "No email" })] }));
|
|
40
40
|
}
|
package/ui/block/Address.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { Small } from "../inline/Small.js";
|
|
|
5
5
|
import { Strong } from "../inline/Strong.js";
|
|
6
6
|
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
7
7
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
8
|
-
import type { ChildProps } from "../util/props.js";
|
|
8
|
+
import type { ChildProps, ClassProps } from "../util/props.js";
|
|
9
9
|
import ADDRESS_CSS from "./Address.module.css";
|
|
10
10
|
|
|
11
11
|
const ADDRESS_CLASS = getModuleClass(ADDRESS_CSS, "address");
|
|
@@ -15,14 +15,14 @@ const ADDRESS_CLASS = getModuleClass(ADDRESS_CSS, "address");
|
|
|
15
15
|
*
|
|
16
16
|
* @see https://shelving.cc/ui/AddressProps
|
|
17
17
|
*/
|
|
18
|
-
export interface AddressProps extends BlockVariants, ChildProps {}
|
|
18
|
+
export interface AddressProps extends BlockVariants, ChildProps, ClassProps {}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Props for `PhysicalAddress` — an optional name and a nullable `AddressData` object.
|
|
22
22
|
*
|
|
23
23
|
* @see https://shelving.cc/ui/PhysicalAddressProps
|
|
24
24
|
*/
|
|
25
|
-
export interface PhysicalAddressProps {
|
|
25
|
+
export interface PhysicalAddressProps extends ClassProps {
|
|
26
26
|
name?: Nullish<string>;
|
|
27
27
|
address: Nullish<AddressData>;
|
|
28
28
|
}
|
|
@@ -32,7 +32,7 @@ export interface PhysicalAddressProps {
|
|
|
32
32
|
*
|
|
33
33
|
* @see https://shelving.cc/ui/EmailAddressProps
|
|
34
34
|
*/
|
|
35
|
-
export interface EmailAddressProps {
|
|
35
|
+
export interface EmailAddressProps extends ClassProps {
|
|
36
36
|
name?: Nullish<string>;
|
|
37
37
|
email: Nullish<string>;
|
|
38
38
|
}
|
|
@@ -43,12 +43,13 @@ export interface EmailAddressProps {
|
|
|
43
43
|
* @example <Address><Strong>Acme</Strong>{"\n"}1 Example St</Address>
|
|
44
44
|
* @see https://shelving.cc/ui/Address
|
|
45
45
|
*/
|
|
46
|
-
export function Address({ children, ...props }: AddressProps) {
|
|
46
|
+
export function Address({ children, className, ...props }: AddressProps) {
|
|
47
47
|
return (
|
|
48
48
|
<address
|
|
49
49
|
className={getClass(
|
|
50
50
|
ADDRESS_CLASS, //
|
|
51
51
|
getBlockClass(props),
|
|
52
|
+
className,
|
|
52
53
|
)}
|
|
53
54
|
>
|
|
54
55
|
{children}
|
|
@@ -64,9 +65,9 @@ export function Address({ children, ...props }: AddressProps) {
|
|
|
64
65
|
* @example <PhysicalAddress name="Acme" address={addressData} />
|
|
65
66
|
* @see https://shelving.cc/ui/PhysicalAddress
|
|
66
67
|
*/
|
|
67
|
-
export function PhysicalAddress({ name, address }: PhysicalAddressProps): ReactElement {
|
|
68
|
+
export function PhysicalAddress({ name, address, className }: PhysicalAddressProps): ReactElement {
|
|
68
69
|
return (
|
|
69
|
-
<Address>
|
|
70
|
+
<Address className={className}>
|
|
70
71
|
{name && <Strong>{name}</Strong>}
|
|
71
72
|
{name && "\n"}
|
|
72
73
|
{address ? formatAddress(address) : <Small>No address</Small>}
|
|
@@ -82,9 +83,9 @@ export function PhysicalAddress({ name, address }: PhysicalAddressProps): ReactE
|
|
|
82
83
|
* @example <EmailAddress name="Acme" email="hi@example.com" />
|
|
83
84
|
* @see https://shelving.cc/ui/EmailAddress
|
|
84
85
|
*/
|
|
85
|
-
export function EmailAddress({ name, email }: EmailAddressProps): ReactElement {
|
|
86
|
+
export function EmailAddress({ name, email, className }: EmailAddressProps): ReactElement {
|
|
86
87
|
return (
|
|
87
|
-
<Address>
|
|
88
|
+
<Address className={className}>
|
|
88
89
|
{name && <Strong>{name}</Strong>}
|
|
89
90
|
{name && "\n"}
|
|
90
91
|
{email ? <a href={`mailto:${email}`}>{email}</a> : <Small>No email</Small>}
|
package/ui/block/Block.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
* Semantic element names a block element may render as via its `as` prop.
|
|
6
6
|
*
|
|
@@ -12,7 +12,7 @@ export type BlockElement = "div" | "section" | "header" | "footer" | "article" |
|
|
|
12
12
|
*
|
|
13
13
|
* @see https://shelving.cc/ui/BlockProps
|
|
14
14
|
*/
|
|
15
|
-
export interface BlockProps extends BlockVariants, OptionalChildProps {
|
|
15
|
+
export interface BlockProps extends BlockVariants, OptionalChildProps, ClassProps {
|
|
16
16
|
/**
|
|
17
17
|
* Element this `<Block>` renders as, e.g. "header" to output a "<header>"
|
|
18
18
|
* @default "div"
|
|
@@ -27,4 +27,4 @@ export interface BlockProps extends BlockVariants, OptionalChildProps {
|
|
|
27
27
|
* @example <Block as="aside" width="narrow"><Paragraph>Sidebar</Paragraph></Block>
|
|
28
28
|
* @see https://shelving.cc/ui/Block
|
|
29
29
|
*/
|
|
30
|
-
export declare function Block({ as: Element, children, ...props }: BlockProps): ReactElement;
|
|
30
|
+
export declare function Block({ as: Element, children, className, ...props }: BlockProps): ReactElement;
|
package/ui/block/Block.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getBlockClass } from "../style/Block.js";
|
|
3
|
+
import { getClass } from "../util/css.js";
|
|
3
4
|
/**
|
|
4
5
|
* Plain `<div>` block with block-level spacing.
|
|
5
6
|
* - Pass `as` to render a different semantic element (`section`, `header`, `footer`, `nav`, `aside`, `figure`).
|
|
@@ -8,6 +9,6 @@ import { getBlockClass } from "../style/Block.js";
|
|
|
8
9
|
* @example <Block as="aside" width="narrow"><Paragraph>Sidebar</Paragraph></Block>
|
|
9
10
|
* @see https://shelving.cc/ui/Block
|
|
10
11
|
*/
|
|
11
|
-
export function Block({ as: Element = "div", children, ...props }) {
|
|
12
|
-
return _jsx(Element, { className: getBlockClass(props), children: children });
|
|
12
|
+
export function Block({ as: Element = "div", children, className, ...props }) {
|
|
13
|
+
return _jsx(Element, { className: getClass(getBlockClass(props), className), children: children });
|
|
13
14
|
}
|
package/ui/block/Block.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
3
|
-
import
|
|
3
|
+
import { getClass } from "../util/css.js";
|
|
4
|
+
import type { ClassProps, OptionalChildProps } from "../util/props.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Semantic element names a block element may render as via its `as` prop.
|
|
@@ -14,7 +15,7 @@ export type BlockElement = "div" | "section" | "header" | "footer" | "article" |
|
|
|
14
15
|
*
|
|
15
16
|
* @see https://shelving.cc/ui/BlockProps
|
|
16
17
|
*/
|
|
17
|
-
export interface BlockProps extends BlockVariants, OptionalChildProps {
|
|
18
|
+
export interface BlockProps extends BlockVariants, OptionalChildProps, ClassProps {
|
|
18
19
|
/**
|
|
19
20
|
* Element this `<Block>` renders as, e.g. "header" to output a "<header>"
|
|
20
21
|
* @default "div"
|
|
@@ -30,6 +31,6 @@ export interface BlockProps extends BlockVariants, OptionalChildProps {
|
|
|
30
31
|
* @example <Block as="aside" width="narrow"><Paragraph>Sidebar</Paragraph></Block>
|
|
31
32
|
* @see https://shelving.cc/ui/Block
|
|
32
33
|
*/
|
|
33
|
-
export function Block({ as: Element = "div", children, ...props }: BlockProps): ReactElement {
|
|
34
|
-
return <Element className={getBlockClass(props)}>{children}</Element>;
|
|
34
|
+
export function Block({ as: Element = "div", children, className, ...props }: BlockProps): ReactElement {
|
|
35
|
+
return <Element className={getClass(getBlockClass(props), className)}>{children}</Element>;
|
|
35
36
|
}
|
package/ui/block/Blockquote.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 { OptionalChildProps } from "../util/props.js";
|
|
3
|
+
import type { ClassProps, OptionalChildProps } from "../util/props.js";
|
|
4
4
|
/**
|
|
5
5
|
* Props for `Blockquote` — colour, space, and typography variants plus optional children.
|
|
6
6
|
*
|
|
7
7
|
* @see https://shelving.cc/ui/BlockquoteProps
|
|
8
8
|
*/
|
|
9
|
-
export interface BlockquoteProps extends BlockVariants, OptionalChildProps {
|
|
9
|
+
export interface BlockquoteProps extends BlockVariants, OptionalChildProps, ClassProps {
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Quoted block of text — rendered as `<blockquote>`.
|
|
@@ -15,4 +15,4 @@ export interface BlockquoteProps extends BlockVariants, OptionalChildProps {
|
|
|
15
15
|
* @example <Blockquote>To be or not to be.</Blockquote>
|
|
16
16
|
* @see https://shelving.cc/ui/Blockquote
|
|
17
17
|
*/
|
|
18
|
-
export declare function Blockquote({ children, ...props }: BlockquoteProps): ReactElement;
|
|
18
|
+
export declare function Blockquote({ children, className, ...props }: BlockquoteProps): ReactElement;
|
package/ui/block/Blockquote.js
CHANGED
|
@@ -10,7 +10,7 @@ const BLOCKQUOTE_CLASS = getModuleClass(BLOCKQUOTE_CSS, "blockquote");
|
|
|
10
10
|
* @example <Blockquote>To be or not to be.</Blockquote>
|
|
11
11
|
* @see https://shelving.cc/ui/Blockquote
|
|
12
12
|
*/
|
|
13
|
-
export function Blockquote({ children, ...props }) {
|
|
13
|
+
export function Blockquote({ children, className, ...props }) {
|
|
14
14
|
return (_jsx("blockquote", { className: getClass(BLOCKQUOTE_CLASS, //
|
|
15
|
-
getBlockClass(props)), children: children }));
|
|
15
|
+
getBlockClass(props), className), children: children }));
|
|
16
16
|
}
|
package/ui/block/Blockquote.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 { OptionalChildProps } from "../util/props.js";
|
|
4
|
+
import type { ClassProps, OptionalChildProps } from "../util/props.js";
|
|
5
5
|
import BLOCKQUOTE_CSS from "./Blockquote.module.css";
|
|
6
6
|
|
|
7
7
|
const BLOCKQUOTE_CLASS = getModuleClass(BLOCKQUOTE_CSS, "blockquote");
|
|
@@ -11,7 +11,7 @@ const BLOCKQUOTE_CLASS = getModuleClass(BLOCKQUOTE_CSS, "blockquote");
|
|
|
11
11
|
*
|
|
12
12
|
* @see https://shelving.cc/ui/BlockquoteProps
|
|
13
13
|
*/
|
|
14
|
-
export interface BlockquoteProps extends BlockVariants, OptionalChildProps {}
|
|
14
|
+
export interface BlockquoteProps extends BlockVariants, OptionalChildProps, ClassProps {}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Quoted block of text — rendered as `<blockquote>`.
|
|
@@ -20,12 +20,13 @@ export interface BlockquoteProps extends BlockVariants, OptionalChildProps {}
|
|
|
20
20
|
* @example <Blockquote>To be or not to be.</Blockquote>
|
|
21
21
|
* @see https://shelving.cc/ui/Blockquote
|
|
22
22
|
*/
|
|
23
|
-
export function Blockquote({ children, ...props }: BlockquoteProps): ReactElement {
|
|
23
|
+
export function Blockquote({ children, className, ...props }: BlockquoteProps): ReactElement {
|
|
24
24
|
return (
|
|
25
25
|
<blockquote
|
|
26
26
|
className={getClass(
|
|
27
27
|
BLOCKQUOTE_CLASS, //
|
|
28
28
|
getBlockClass(props),
|
|
29
|
+
className,
|
|
29
30
|
)}
|
|
30
31
|
>
|
|
31
32
|
{children}
|
package/ui/block/Caption.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 { OptionalChildProps } from "../util/index.js";
|
|
3
|
+
import type { ClassProps, OptionalChildProps } from "../util/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Props for `Caption` — colour, space, and typography variants plus optional children.
|
|
6
6
|
*
|
|
7
7
|
* @see https://shelving.cc/ui/CaptionProps
|
|
8
8
|
*/
|
|
9
|
-
export interface CaptionProps extends BlockVariants, OptionalChildProps {
|
|
9
|
+
export interface CaptionProps extends BlockVariants, OptionalChildProps, ClassProps {
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* `<figcaption>` block — caption text for a `<Figure>`.
|
|
@@ -15,4 +15,4 @@ export interface CaptionProps extends BlockVariants, OptionalChildProps {
|
|
|
15
15
|
* @example <Figure><Image src="/cat.jpg" /><Caption>A cat</Caption></Figure>
|
|
16
16
|
* @see https://shelving.cc/ui/Caption
|
|
17
17
|
*/
|
|
18
|
-
export declare function Caption({ children, ...props }: CaptionProps): ReactElement;
|
|
18
|
+
export declare function Caption({ children, className, ...props }: CaptionProps): ReactElement;
|
package/ui/block/Caption.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { getBlockClass } from "../style/Block.js";
|
|
3
3
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
4
4
|
import CAPTION_CSS from "./Caption.module.css";
|
|
5
|
-
const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "
|
|
5
|
+
const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "caption");
|
|
6
6
|
/**
|
|
7
7
|
* `<figcaption>` block — caption text for a `<Figure>`.
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@ const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "divider");
|
|
|
10
10
|
* @example <Figure><Image src="/cat.jpg" /><Caption>A cat</Caption></Figure>
|
|
11
11
|
* @see https://shelving.cc/ui/Caption
|
|
12
12
|
*/
|
|
13
|
-
export function Caption({ children, ...props }) {
|
|
13
|
+
export function Caption({ children, className, ...props }) {
|
|
14
14
|
return (_jsx("figcaption", { className: getClass(CAPTION_CLASS, //
|
|
15
|
-
getBlockClass(props)), children: children }));
|
|
15
|
+
getBlockClass(props), className), children: children }));
|
|
16
16
|
}
|
package/ui/block/Caption.tsx
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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/index.js";
|
|
4
|
+
import type { ClassProps, OptionalChildProps } from "../util/index.js";
|
|
5
5
|
import CAPTION_CSS from "./Caption.module.css";
|
|
6
6
|
|
|
7
|
-
const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "
|
|
7
|
+
const CAPTION_CLASS = getModuleClass(CAPTION_CSS, "caption");
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Props for `Caption` — colour, space, and typography variants plus optional children.
|
|
11
11
|
*
|
|
12
12
|
* @see https://shelving.cc/ui/CaptionProps
|
|
13
13
|
*/
|
|
14
|
-
export interface CaptionProps extends BlockVariants, OptionalChildProps {}
|
|
14
|
+
export interface CaptionProps extends BlockVariants, OptionalChildProps, ClassProps {}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* `<figcaption>` block — caption text for a `<Figure>`.
|
|
@@ -20,12 +20,13 @@ export interface CaptionProps extends BlockVariants, OptionalChildProps {}
|
|
|
20
20
|
* @example <Figure><Image src="/cat.jpg" /><Caption>A cat</Caption></Figure>
|
|
21
21
|
* @see https://shelving.cc/ui/Caption
|
|
22
22
|
*/
|
|
23
|
-
export function Caption({ children, ...props }: CaptionProps): ReactElement {
|
|
23
|
+
export function Caption({ children, className, ...props }: CaptionProps): ReactElement {
|
|
24
24
|
return (
|
|
25
25
|
<figcaption
|
|
26
26
|
className={getClass(
|
|
27
27
|
CAPTION_CLASS, //
|
|
28
28
|
getBlockClass(props),
|
|
29
|
+
className,
|
|
29
30
|
)}
|
|
30
31
|
>
|
|
31
32
|
{children}
|
package/ui/block/Card.d.ts
CHANGED
|
@@ -3,13 +3,14 @@ import { type ClickableProps } from "../button/Clickable.js";
|
|
|
3
3
|
import { type BlockVariants } from "../style/Block.js";
|
|
4
4
|
import { type ShadowVariants } from "../style/Shadow.js";
|
|
5
5
|
import { type StatusVariants } from "../style/Status.js";
|
|
6
|
+
import type { ClassProps } from "../util/props.js";
|
|
6
7
|
import type { BlockElement } from "./Block.js";
|
|
7
8
|
/**
|
|
8
9
|
* Props for `Card` — combines `ClickableProps` (for navigable cards) with colour, status, padding, space, typography, width, and shadow variants.
|
|
9
10
|
*
|
|
10
11
|
* @see https://shelving.cc/ui/CardProps
|
|
11
12
|
*/
|
|
12
|
-
export interface CardProps extends ClickableProps, StatusVariants, BlockVariants, ShadowVariants {
|
|
13
|
+
export interface CardProps extends ClickableProps, StatusVariants, BlockVariants, ShadowVariants, ClassProps {
|
|
13
14
|
/**
|
|
14
15
|
* Element this `<Card>` renders as, e.g. "header" to output a "<header>"
|
|
15
16
|
* @default "article"
|
|
@@ -27,4 +28,4 @@ export interface CardProps extends ClickableProps, StatusVariants, BlockVariants
|
|
|
27
28
|
* @kind component
|
|
28
29
|
* @see https://shelving.cc/ui/Card
|
|
29
30
|
*/
|
|
30
|
-
export declare function Card({ as: Element, children, href, onClick, title, ...props }: CardProps): ReactElement;
|
|
31
|
+
export declare function Card({ as: Element, children, href, onClick, title, className, ...props }: CardProps): ReactElement;
|
package/ui/block/Card.js
CHANGED
|
@@ -16,8 +16,8 @@ import CARD_CSS from "./Card.module.css";
|
|
|
16
16
|
* @kind component
|
|
17
17
|
* @see https://shelving.cc/ui/Card
|
|
18
18
|
*/
|
|
19
|
-
export function Card({ as: Element = "article", children, href, onClick, title = "Open", ...props }) {
|
|
19
|
+
export function Card({ as: Element = "article", children, href, onClick, title = "Open", className, ...props }) {
|
|
20
20
|
const overlay = (href || onClick) && (_jsx(Clickable, { title: title, href: href, onClick: onClick, ...props, className: getModuleClass(CARD_CSS, "overlay") }));
|
|
21
21
|
return (_jsxs(Element, { className: getClass(getModuleClass(CARD_CSS, "card"), //
|
|
22
|
-
getStatusClass(props), getBlockClass(props), getShadowClass(props)), children: [overlay, overlay ? _jsx("div", { children: children }) : children] }));
|
|
22
|
+
getStatusClass(props), getBlockClass(props), getShadowClass(props), className), children: [overlay, overlay ? _jsx("div", { children: children }) : children] }));
|
|
23
23
|
}
|
package/ui/block/Card.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { type BlockVariants, getBlockClass } from "../style/Block.js";
|
|
|
4
4
|
import { getShadowClass, type ShadowVariants } from "../style/Shadow.js";
|
|
5
5
|
import { getStatusClass, type StatusVariants } from "../style/Status.js";
|
|
6
6
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
7
|
+
import type { ClassProps } from "../util/props.js";
|
|
7
8
|
import type { BlockElement } from "./Block.js";
|
|
8
9
|
import CARD_CSS from "./Card.module.css";
|
|
9
10
|
|
|
@@ -12,7 +13,7 @@ import CARD_CSS from "./Card.module.css";
|
|
|
12
13
|
*
|
|
13
14
|
* @see https://shelving.cc/ui/CardProps
|
|
14
15
|
*/
|
|
15
|
-
export interface CardProps extends ClickableProps, StatusVariants, BlockVariants, ShadowVariants {
|
|
16
|
+
export interface CardProps extends ClickableProps, StatusVariants, BlockVariants, ShadowVariants, ClassProps {
|
|
16
17
|
/**
|
|
17
18
|
* Element this `<Card>` renders as, e.g. "header" to output a "<header>"
|
|
18
19
|
* @default "article"
|
|
@@ -31,7 +32,7 @@ export interface CardProps extends ClickableProps, StatusVariants, BlockVariants
|
|
|
31
32
|
* @kind component
|
|
32
33
|
* @see https://shelving.cc/ui/Card
|
|
33
34
|
*/
|
|
34
|
-
export function Card({ as: Element = "article", children, href, onClick, title = "Open", ...props }: CardProps): ReactElement {
|
|
35
|
+
export function Card({ as: Element = "article", children, href, onClick, title = "Open", className, ...props }: CardProps): ReactElement {
|
|
35
36
|
const overlay = (href || onClick) && (
|
|
36
37
|
<Clickable title={title} href={href} onClick={onClick} {...props} className={getModuleClass(CARD_CSS, "overlay")} />
|
|
37
38
|
);
|
|
@@ -42,6 +43,7 @@ export function Card({ as: Element = "article", children, href, onClick, title =
|
|
|
42
43
|
getStatusClass(props),
|
|
43
44
|
getBlockClass(props),
|
|
44
45
|
getShadowClass(props),
|
|
46
|
+
className,
|
|
45
47
|
)}
|
|
46
48
|
>
|
|
47
49
|
{overlay}
|
package/ui/block/Column.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 `<Column>` component.
|
|
8
8
|
*
|
|
9
9
|
* @see https://shelving.cc/ui/ColumnProps
|
|
10
10
|
*/
|
|
11
|
-
export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildProps {
|
|
11
|
+
export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildProps, ClassProps {
|
|
12
12
|
/**
|
|
13
13
|
* Element this `<Column>` renders as, e.g. "header" to output a "<header>"
|
|
14
14
|
* @default "div"
|
|
@@ -22,4 +22,4 @@ export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildP
|
|
|
22
22
|
* @example <Column gap="small">{items}</Column>
|
|
23
23
|
* @see https://shelving.cc/ui/Column
|
|
24
24
|
*/
|
|
25
|
-
export declare function Column({ as: Element, children, column, ...props }: ColumnProps): ReactElement;
|
|
25
|
+
export declare function Column({ as: Element, children, column, className, ...props }: ColumnProps): ReactElement;
|
package/ui/block/Column.js
CHANGED
|
@@ -9,7 +9,7 @@ import { getClass } from "../util/css.js";
|
|
|
9
9
|
* @example <Column gap="small">{items}</Column>
|
|
10
10
|
* @see https://shelving.cc/ui/Column
|
|
11
11
|
*/
|
|
12
|
-
export function Column({ as: Element = "div", children, column = true, ...props }) {
|
|
12
|
+
export function Column({ as: Element = "div", children, column = true, className, ...props }) {
|
|
13
13
|
return (_jsx(Element, { className: getClass(getBlockClass(props), //
|
|
14
|
-
getFlexClass({ column, ...props })), children: children }));
|
|
14
|
+
getFlexClass({ column, ...props }), className), children: children }));
|
|
15
15
|
}
|
package/ui/block/Column.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/ColumnProps
|
|
12
12
|
*/
|
|
13
|
-
export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildProps {
|
|
13
|
+
export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildProps, ClassProps {
|
|
14
14
|
/**
|
|
15
15
|
* Element this `<Column>` renders as, e.g. "header" to output a "<header>"
|
|
16
16
|
* @default "div"
|
|
@@ -25,12 +25,13 @@ export interface ColumnProps extends BlockVariants, FlexVariants, OptionalChildP
|
|
|
25
25
|
* @example <Column gap="small">{items}</Column>
|
|
26
26
|
* @see https://shelving.cc/ui/Column
|
|
27
27
|
*/
|
|
28
|
-
export function Column({ as: Element = "div", children, column = true, ...props }: ColumnProps): ReactElement {
|
|
28
|
+
export function Column({ as: Element = "div", children, column = true, className, ...props }: ColumnProps): ReactElement {
|
|
29
29
|
return (
|
|
30
30
|
<Element
|
|
31
31
|
className={getClass(
|
|
32
32
|
getBlockClass(props), //
|
|
33
33
|
getFlexClass({ column, ...props }),
|
|
34
|
+
className,
|
|
34
35
|
)}
|
|
35
36
|
>
|
|
36
37
|
{children}
|
|
@@ -2,13 +2,13 @@ import type { ReactElement } from "react";
|
|
|
2
2
|
import type { GapVariants } from "../style/Gap.js";
|
|
3
3
|
import type { SpaceVariants } from "../style/Space.js";
|
|
4
4
|
import type { TypographyVariants } from "../style/Typography.js";
|
|
5
|
-
import type { OptionalChildProps } from "../util/props.js";
|
|
5
|
+
import type { ClassProps, OptionalChildProps } from "../util/props.js";
|
|
6
6
|
/**
|
|
7
7
|
* Props for `Definitions` — colour, gap, space, and typography variants plus optional children.
|
|
8
8
|
*
|
|
9
9
|
* @see https://shelving.cc/ui/DefinitionsProps
|
|
10
10
|
*/
|
|
11
|
-
export interface DefinitionsProps extends GapVariants, SpaceVariants, TypographyVariants, OptionalChildProps {
|
|
11
|
+
export interface DefinitionsProps extends GapVariants, SpaceVariants, TypographyVariants, OptionalChildProps, ClassProps {
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Description list — a sequence of term/value pairs rendered as a `<dl>`.
|
|
@@ -19,4 +19,4 @@ export interface DefinitionsProps extends GapVariants, SpaceVariants, Typography
|
|
|
19
19
|
* @example <Definitions><dt>Name</dt><dd>Acme</dd></Definitions>
|
|
20
20
|
* @see https://shelving.cc/ui/Definitions
|
|
21
21
|
*/
|
|
22
|
-
export declare function Definitions({ children, ...props }: DefinitionsProps): ReactElement;
|
|
22
|
+
export declare function Definitions({ children, className, ...props }: DefinitionsProps): ReactElement;
|
package/ui/block/Definitions.js
CHANGED
|
@@ -12,7 +12,7 @@ const DEFINITIONS_CLASS = getModuleClass(DEFINITIONS_CSS, "definitions");
|
|
|
12
12
|
* @example <Definitions><dt>Name</dt><dd>Acme</dd></Definitions>
|
|
13
13
|
* @see https://shelving.cc/ui/Definitions
|
|
14
14
|
*/
|
|
15
|
-
export function Definitions({ children, ...props }) {
|
|
15
|
+
export function Definitions({ children, className, ...props }) {
|
|
16
16
|
return (_jsx("dl", { className: getClass(DEFINITIONS_CLASS, //
|
|
17
|
-
getBlockClass(props)), children: children }));
|
|
17
|
+
getBlockClass(props), className), children: children }));
|
|
18
18
|
}
|
package/ui/block/Definitions.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import type { GapVariants } from "../style/Gap.js";
|
|
|
4
4
|
import type { SpaceVariants } from "../style/Space.js";
|
|
5
5
|
import type { TypographyVariants } from "../style/Typography.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 DEFINITIONS_CSS from "./Definitions.module.css";
|
|
9
9
|
|
|
10
10
|
const DEFINITIONS_CLASS = getModuleClass(DEFINITIONS_CSS, "definitions");
|
|
@@ -14,7 +14,7 @@ const DEFINITIONS_CLASS = getModuleClass(DEFINITIONS_CSS, "definitions");
|
|
|
14
14
|
*
|
|
15
15
|
* @see https://shelving.cc/ui/DefinitionsProps
|
|
16
16
|
*/
|
|
17
|
-
export interface DefinitionsProps extends GapVariants, SpaceVariants, TypographyVariants, OptionalChildProps {}
|
|
17
|
+
export interface DefinitionsProps extends GapVariants, SpaceVariants, TypographyVariants, OptionalChildProps, ClassProps {}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Description list — a sequence of term/value pairs rendered as a `<dl>`.
|
|
@@ -25,12 +25,13 @@ export interface DefinitionsProps extends GapVariants, SpaceVariants, Typography
|
|
|
25
25
|
* @example <Definitions><dt>Name</dt><dd>Acme</dd></Definitions>
|
|
26
26
|
* @see https://shelving.cc/ui/Definitions
|
|
27
27
|
*/
|
|
28
|
-
export function Definitions({ children, ...props }: DefinitionsProps): ReactElement {
|
|
28
|
+
export function Definitions({ children, className, ...props }: DefinitionsProps): ReactElement {
|
|
29
29
|
return (
|
|
30
30
|
<dl
|
|
31
31
|
className={getClass(
|
|
32
32
|
DEFINITIONS_CLASS, //
|
|
33
33
|
getBlockClass(props),
|
|
34
|
+
className,
|
|
34
35
|
)}
|
|
35
36
|
>
|
|
36
37
|
{children}
|
package/ui/block/Details.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { type BlockVariants } from "../style/Block.js";
|
|
3
|
+
import type { ClassProps } from "../util/props.js";
|
|
3
4
|
/** Props for `DetailsItem` — a single collapsible disclosure. */
|
|
4
|
-
export interface DetailsProps extends BlockVariants {
|
|
5
|
+
export interface DetailsProps extends BlockVariants, ClassProps {
|
|
5
6
|
/** Content of the always-visible summary (e.g. a question). */
|
|
6
7
|
title: ReactNode;
|
|
7
8
|
/** Whether the item starts expanded. */
|
|
@@ -18,4 +19,4 @@ export interface DetailsProps extends BlockVariants {
|
|
|
18
19
|
*
|
|
19
20
|
* @kind component
|
|
20
21
|
*/
|
|
21
|
-
export declare function Details({ title, open, name, children, ...props }: DetailsProps): ReactElement;
|
|
22
|
+
export declare function Details({ title, open, name, children, className, ...props }: DetailsProps): ReactElement;
|
package/ui/block/Details.js
CHANGED
|
@@ -12,6 +12,6 @@ const DETAILS_SUMMARY_CLASS = DETAILS_CSS.summary;
|
|
|
12
12
|
*
|
|
13
13
|
* @kind component
|
|
14
14
|
*/
|
|
15
|
-
export function Details({ title, open = false, name, children, ...props }) {
|
|
16
|
-
return (_jsxs("details", { className: getClass(DETAILS_CLASS, getBlockClass(props)), open: open, name: name, children: [_jsxs("summary", { className: DETAILS_SUMMARY_CLASS, children: [_jsx("span", { children: title }), _jsx(ChevronUpIcon, {})] }), children] }));
|
|
15
|
+
export function Details({ title, open = false, name, children, className, ...props }) {
|
|
16
|
+
return (_jsxs("details", { className: getClass(DETAILS_CLASS, getBlockClass(props), className), open: open, name: name, children: [_jsxs("summary", { className: DETAILS_SUMMARY_CLASS, children: [_jsx("span", { children: title }), _jsx(ChevronUpIcon, {})] }), children] }));
|
|
17
17
|
}
|