shelving 1.260.3 → 1.261.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 +1 -1
- package/ui/form/CheckboxInput.js +0 -1
- package/ui/form/CheckboxInput.tsx +0 -1
- package/ui/form/RadioInput.js +0 -1
- package/ui/form/RadioInput.tsx +0 -1
- package/ui/inline/Code.md +4 -2
- package/ui/inline/Code.module.css +2 -2
- package/ui/inline/Deleted.d.ts +5 -3
- package/ui/inline/Deleted.js +7 -4
- package/ui/inline/Deleted.md +34 -0
- package/ui/inline/Deleted.module.css +5 -3
- package/ui/inline/Deleted.tsx +18 -6
- package/ui/inline/Emphasis.d.ts +3 -2
- package/ui/inline/Emphasis.js +5 -3
- package/ui/inline/Emphasis.md +29 -0
- package/ui/inline/Emphasis.module.css +1 -1
- package/ui/inline/Emphasis.tsx +14 -4
- package/ui/inline/Inserted.d.ts +5 -3
- package/ui/inline/Inserted.js +6 -3
- package/ui/inline/Inserted.md +34 -0
- package/ui/inline/Inserted.module.css +5 -3
- package/ui/inline/Inserted.tsx +17 -5
- package/ui/inline/Link.d.ts +4 -2
- package/ui/inline/Link.js +5 -2
- package/ui/inline/Link.md +4 -2
- package/ui/inline/Link.module.css +3 -1
- package/ui/inline/Link.tsx +15 -4
- package/ui/inline/Mark.d.ts +3 -2
- package/ui/inline/Mark.js +6 -3
- package/ui/inline/Mark.md +6 -5
- package/ui/inline/Mark.module.css +12 -4
- package/ui/inline/Mark.tsx +16 -4
- package/ui/inline/Small.d.ts +3 -2
- package/ui/inline/Small.js +5 -3
- package/ui/inline/Small.md +30 -0
- package/ui/inline/Small.module.css +2 -1
- package/ui/inline/Small.tsx +14 -4
- package/ui/inline/Strong.d.ts +3 -2
- package/ui/inline/Strong.js +5 -3
- package/ui/inline/Strong.md +5 -1
- package/ui/inline/Strong.module.css +1 -1
- package/ui/inline/Strong.tsx +14 -4
package/package.json
CHANGED
package/ui/form/CheckboxInput.js
CHANGED
|
@@ -4,7 +4,6 @@ import { getClass, getModuleClass } from "../util/css.js";
|
|
|
4
4
|
import { getInputClass } from "./Input.js";
|
|
5
5
|
import INPUT_CSS from "./Input.module.css";
|
|
6
6
|
const INPUT_LABEL_CLASS = getModuleClass(INPUT_CSS, "label");
|
|
7
|
-
const INPUT_PLACEHOLDER_CLASS = getModuleClass(INPUT_CSS, "placeholder");
|
|
8
7
|
/**
|
|
9
8
|
* Checkbox input bound to a `boolean` value, rendered as a labelled `<input type="checkbox">`.
|
|
10
9
|
* - The label content comes from `children`, falling back to `placeholder`/`title`.
|
|
@@ -6,7 +6,6 @@ import { getInputClass, type InputVariants, type ValueInputProps } from "./Input
|
|
|
6
6
|
import INPUT_CSS from "./Input.module.css";
|
|
7
7
|
|
|
8
8
|
const INPUT_LABEL_CLASS = getModuleClass(INPUT_CSS, "label");
|
|
9
|
-
const INPUT_PLACEHOLDER_CLASS = getModuleClass(INPUT_CSS, "placeholder");
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Props for `CheckboxInput`, a boolean-valued checkbox input.
|
package/ui/form/RadioInput.js
CHANGED
|
@@ -4,7 +4,6 @@ import { getClass, getModuleClass } from "../util/css.js";
|
|
|
4
4
|
import { getInputClass } from "./Input.js";
|
|
5
5
|
import INPUT_CSS from "./Input.module.css";
|
|
6
6
|
const INPUT_LABEL_CLASS = getModuleClass(INPUT_CSS, "label");
|
|
7
|
-
const INPUT_PLACEHOLDER_CLASS = getModuleClass(INPUT_CSS, "placeholder");
|
|
8
7
|
/**
|
|
9
8
|
* Single `<input type="radio">` wrapped in a `<label>` styled as an `<Input>`.
|
|
10
9
|
* - Calls `onValue(true)` when selected; label content comes from `children`, falling back to `placeholder`/`title`.
|
package/ui/form/RadioInput.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import { getInputClass, type InputVariants, type ValueInputProps } from "./Input
|
|
|
6
6
|
import INPUT_CSS from "./Input.module.css";
|
|
7
7
|
|
|
8
8
|
const INPUT_LABEL_CLASS = getModuleClass(INPUT_CSS, "label");
|
|
9
|
-
const INPUT_PLACEHOLDER_CLASS = getModuleClass(INPUT_CSS, "placeholder");
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Props for `RadioInput`, a single labelled radio button styled as an input.
|
package/ui/inline/Code.md
CHANGED
|
@@ -13,7 +13,7 @@ An inline code span — renders a `<code>` element with monospace type and a sub
|
|
|
13
13
|
|
|
14
14
|
- Pick the sibling whose semantics match — they all look the same but mean different things to assistive tech and search.
|
|
15
15
|
- Pass `plain` to drop the default background and inline padding (useful when the code already sits inside a tinted container).
|
|
16
|
-
- Painted from the [tint ladder](/ui/TINT_CLASS): the background
|
|
16
|
+
- Painted from the [tint ladder](/ui/TINT_CLASS): the background defaults to `--tint-90` and the text to `--tint-00`, so it re-tints with its surrounding scope (override per-instance with `--code-background` / `--code-color`).
|
|
17
17
|
- Inside `<Prose>` raw `<code>` / `<kbd>` / `<samp>` / `<var>` pick up the same styling, and code inside a `<pre>` drops the inline box automatically.
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
@@ -37,7 +37,7 @@ import { Code } from "shelving/ui";
|
|
|
37
37
|
|
|
38
38
|
## Styling
|
|
39
39
|
|
|
40
|
-
`Code` paints from the [tint ladder](/ui/TINT_CLASS)
|
|
40
|
+
`Code` paints from the [tint ladder](/ui/TINT_CLASS): the box `background` / `color` default to ladder steps so they re-tint with the surrounding scope, and every property has a per-instance override hook.
|
|
41
41
|
|
|
42
42
|
| Variable | Styles | Default |
|
|
43
43
|
|---|---|---|
|
|
@@ -47,5 +47,7 @@ import { Code } from "shelving/ui";
|
|
|
47
47
|
| `--code-leading` | Line height | `var(--leading)` |
|
|
48
48
|
| `--code-padding` | Inline padding (non-`plain`) | `var(--space-xxsmall)` |
|
|
49
49
|
| `--code-radius` | Corner radius (non-`plain`) | `var(--radius-xxsmall)` |
|
|
50
|
+
| `--code-background` | Background fill (non-`plain`) | `var(--tint-90)` |
|
|
51
|
+
| `--code-color` | Text colour (non-`plain`) | `var(--tint-00)` |
|
|
50
52
|
|
|
51
53
|
**Global tokens it reads:** `--font-code`, `--weight-code`, `--size-smaller`, `--leading`, `--space-xxsmall`, `--radius-xxsmall`, and the tint-ladder steps `--tint-00` / `--tint-90` for the box fill and text.
|
package/ui/inline/Deleted.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { type ColorVariants } from "../style/Color.js";
|
|
3
|
+
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
3
5
|
/**
|
|
4
|
-
* Props for `Deleted` — optional `children`.
|
|
6
|
+
* Props for `Deleted` — colour and typography variants, plus optional `children`.
|
|
5
7
|
*
|
|
6
8
|
* @see https://shelving.cc/ui/DeletedProps
|
|
7
9
|
*/
|
|
8
|
-
export interface DeletedProps extends OptionalChildProps {
|
|
10
|
+
export interface DeletedProps extends OptionalChildProps, ColorVariants, TypographyVariants {
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Deleted text — renders a `<del>` element to mark content removed from a document.
|
|
@@ -14,4 +16,4 @@ export interface DeletedProps extends OptionalChildProps {
|
|
|
14
16
|
* @example <Deleted>old price</Deleted>
|
|
15
17
|
* @see https://shelving.cc/ui/Deleted
|
|
16
18
|
*/
|
|
17
|
-
export declare function Deleted({ children }: DeletedProps): ReactElement;
|
|
19
|
+
export declare function Deleted({ children, ...props }: DeletedProps): ReactElement;
|
package/ui/inline/Deleted.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getColorClass } from "../style/Color.js";
|
|
3
|
+
import { getTypographyClass } from "../style/Typography.js";
|
|
4
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import DELETED_CSS from "./Deleted.module.css";
|
|
4
|
-
const DELETED_CLASS = getModuleClass(DELETED_CSS, "
|
|
6
|
+
const DELETED_CLASS = getModuleClass(DELETED_CSS, "deleted");
|
|
5
7
|
/**
|
|
6
8
|
* Deleted text — renders a `<del>` element to mark content removed from a document.
|
|
7
9
|
*
|
|
@@ -9,6 +11,7 @@ const DELETED_CLASS = getModuleClass(DELETED_CSS, "definitions");
|
|
|
9
11
|
* @example <Deleted>old price</Deleted>
|
|
10
12
|
* @see https://shelving.cc/ui/Deleted
|
|
11
13
|
*/
|
|
12
|
-
export function Deleted({ children }) {
|
|
13
|
-
return _jsx("del", { className: DELETED_CLASS,
|
|
14
|
+
export function Deleted({ children, ...props }) {
|
|
15
|
+
return (_jsx("del", { className: getClass(DELETED_CLASS, //
|
|
16
|
+
getColorClass(props), getTypographyClass(props)), children: children }));
|
|
14
17
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Deleted
|
|
2
|
+
|
|
3
|
+
Deleted text — renders a `<del>` element to mark content that has been removed from a document, shown struck through in red by default. Prefer it over a raw `<del>` inside React components so the semantics and class names stay consistent.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Use `Deleted` for content genuinely removed from a document (edits, diffs, retired prices), and `<Inserted>` for content added — they pair up.
|
|
8
|
+
- It drives its colour through the [tint ladder](/ui/TINT_CLASS), so the `color` variant (`color="purple"`, `color="orange"`, …) recolours the strike-through. The base tint defaults to `--color-red`.
|
|
9
|
+
- Inside `<Prose>` a raw `<del>` picks up the same styling, so Markdown-rendered deletions match component ones.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Marking a removed value
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Paragraph, Deleted, Inserted } from "shelving/ui";
|
|
17
|
+
|
|
18
|
+
<Paragraph>
|
|
19
|
+
Was <Deleted>$50</Deleted> <Inserted>$35</Inserted>.
|
|
20
|
+
</Paragraph>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Styling
|
|
24
|
+
|
|
25
|
+
`Deleted` paints from the [tint ladder](/ui/TINT_CLASS): the `50` tint sets the text colour, defaulting to `--color-red`. Override `--deleted-tint` to recolour from the base, or set each property directly.
|
|
26
|
+
|
|
27
|
+
| Variable | Styles | Default |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `--deleted-tint` | Base tint (`--tint-50`) the colour derives from | `var(--color-red)` |
|
|
30
|
+
| `--deleted-color` | Text colour | `var(--tint-50)` |
|
|
31
|
+
| `--deleted-decoration` | Text decoration | `line-through var(--stroke-normal)` |
|
|
32
|
+
| `--deleted-weight` | Font weight | `var(--weight-strong)` |
|
|
33
|
+
|
|
34
|
+
**Global tokens it reads:** `--color-red`, `--stroke-normal`, `--weight-strong`, and the tint-ladder step `--tint-50`.
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
@layer components {
|
|
7
7
|
.deleted,
|
|
8
8
|
.prose del {
|
|
9
|
+
--tint-50: var(--deleted-tint, var(--color-red));
|
|
10
|
+
|
|
9
11
|
/* Style */
|
|
10
|
-
color: var(--color-
|
|
11
|
-
text-decoration: line-through var(--stroke-normal);
|
|
12
|
+
color: var(--deleted-color, var(--tint-50));
|
|
13
|
+
text-decoration: var(--deleted-decoration, line-through var(--stroke-normal));
|
|
12
14
|
|
|
13
15
|
/* Text */
|
|
14
|
-
font-weight: var(--weight-strong);
|
|
16
|
+
font-weight: var(--deleted-weight, var(--weight-strong));
|
|
15
17
|
}
|
|
16
18
|
}
|
package/ui/inline/Deleted.tsx
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { type ColorVariants, getColorClass } from "../style/Color.js";
|
|
3
|
+
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
4
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import type { OptionalChildProps } from "../util/props.js";
|
|
4
6
|
import DELETED_CSS from "./Deleted.module.css";
|
|
5
7
|
|
|
6
|
-
const DELETED_CLASS = getModuleClass(DELETED_CSS, "
|
|
8
|
+
const DELETED_CLASS = getModuleClass(DELETED_CSS, "deleted");
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* Props for `Deleted` — optional `children`.
|
|
11
|
+
* Props for `Deleted` — colour and typography variants, plus optional `children`.
|
|
10
12
|
*
|
|
11
13
|
* @see https://shelving.cc/ui/DeletedProps
|
|
12
14
|
*/
|
|
13
|
-
export interface DeletedProps extends OptionalChildProps {}
|
|
15
|
+
export interface DeletedProps extends OptionalChildProps, ColorVariants, TypographyVariants {}
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Deleted text — renders a `<del>` element to mark content removed from a document.
|
|
@@ -19,6 +21,16 @@ export interface DeletedProps extends OptionalChildProps {}
|
|
|
19
21
|
* @example <Deleted>old price</Deleted>
|
|
20
22
|
* @see https://shelving.cc/ui/Deleted
|
|
21
23
|
*/
|
|
22
|
-
export function Deleted({ children }: DeletedProps): ReactElement {
|
|
23
|
-
return
|
|
24
|
+
export function Deleted({ children, ...props }: DeletedProps): ReactElement {
|
|
25
|
+
return (
|
|
26
|
+
<del
|
|
27
|
+
className={getClass(
|
|
28
|
+
DELETED_CLASS, //
|
|
29
|
+
getColorClass(props),
|
|
30
|
+
getTypographyClass(props),
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</del>
|
|
35
|
+
);
|
|
24
36
|
}
|
package/ui/inline/Emphasis.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
3
|
import type { OptionalChildProps } from "../util/props.js";
|
|
3
4
|
/**
|
|
4
5
|
* Props for `Emphasis` — optional `children`.
|
|
5
6
|
*
|
|
6
7
|
* @see https://shelving.cc/ui/EmphasisProps
|
|
7
8
|
*/
|
|
8
|
-
export interface EmphasisProps extends OptionalChildProps {
|
|
9
|
+
export interface EmphasisProps extends OptionalChildProps, TypographyVariants {
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Emphasised text — renders an `<em>` element for stress emphasis (typically italic).
|
|
@@ -14,4 +15,4 @@ export interface EmphasisProps extends OptionalChildProps {
|
|
|
14
15
|
* @example <Emphasis>really</Emphasis>
|
|
15
16
|
* @see https://shelving.cc/ui/Emphasis
|
|
16
17
|
*/
|
|
17
|
-
export declare function Emphasis({ children }: EmphasisProps): ReactElement;
|
|
18
|
+
export declare function Emphasis({ children, ...props }: EmphasisProps): ReactElement;
|
package/ui/inline/Emphasis.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getTypographyClass } from "../style/Typography.js";
|
|
3
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
4
|
import EMPHASIS_CSS from "./Emphasis.module.css";
|
|
4
5
|
const EMPHASIS_CLASS = getModuleClass(EMPHASIS_CSS, "emphasis");
|
|
5
6
|
/**
|
|
@@ -9,6 +10,7 @@ const EMPHASIS_CLASS = getModuleClass(EMPHASIS_CSS, "emphasis");
|
|
|
9
10
|
* @example <Emphasis>really</Emphasis>
|
|
10
11
|
* @see https://shelving.cc/ui/Emphasis
|
|
11
12
|
*/
|
|
12
|
-
export function Emphasis({ children }) {
|
|
13
|
-
return _jsx("em", { className: EMPHASIS_CLASS,
|
|
13
|
+
export function Emphasis({ children, ...props }) {
|
|
14
|
+
return (_jsx("em", { className: getClass(EMPHASIS_CLASS, //
|
|
15
|
+
getTypographyClass(props)), children: children }));
|
|
14
16
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Emphasis
|
|
2
|
+
|
|
3
|
+
Emphasised text — renders an `<em>` element for stress emphasis, the kind that changes the meaning of a sentence (typically shown italic). Prefer it over a raw `<em>` or `<i>` inside React components so the semantics and class names stay consistent.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Use `Emphasis` for stress emphasis (italic), `<Strong>` for importance (bold), and `<Mark>` for relevance highlighting — they are not interchangeable.
|
|
8
|
+
- It only sets the font style; it inherits colour, weight, and size from the surrounding text.
|
|
9
|
+
- Inside `<Prose>` raw `<em>` / `<i>` pick up the same styling, so Markdown-rendered emphasis matches component ones.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Stress emphasis in body copy
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Paragraph, Emphasis } from "shelving/ui";
|
|
17
|
+
|
|
18
|
+
<Paragraph>
|
|
19
|
+
You were meant to turn <Emphasis>left</Emphasis>.
|
|
20
|
+
</Paragraph>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Styling
|
|
24
|
+
|
|
25
|
+
`Emphasis` only sets its font style and inherits everything else from its surroundings.
|
|
26
|
+
|
|
27
|
+
| Variable | Styles | Default |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `--emphasis-style` | Font style | `italic` |
|
package/ui/inline/Emphasis.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
3
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
4
5
|
import EMPHASIS_CSS from "./Emphasis.module.css";
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ const EMPHASIS_CLASS = getModuleClass(EMPHASIS_CSS, "emphasis");
|
|
|
10
11
|
*
|
|
11
12
|
* @see https://shelving.cc/ui/EmphasisProps
|
|
12
13
|
*/
|
|
13
|
-
export interface EmphasisProps extends OptionalChildProps {}
|
|
14
|
+
export interface EmphasisProps extends OptionalChildProps, TypographyVariants {}
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Emphasised text — renders an `<em>` element for stress emphasis (typically italic).
|
|
@@ -19,6 +20,15 @@ export interface EmphasisProps extends OptionalChildProps {}
|
|
|
19
20
|
* @example <Emphasis>really</Emphasis>
|
|
20
21
|
* @see https://shelving.cc/ui/Emphasis
|
|
21
22
|
*/
|
|
22
|
-
export function Emphasis({ children }: EmphasisProps): ReactElement {
|
|
23
|
-
return
|
|
23
|
+
export function Emphasis({ children, ...props }: EmphasisProps): ReactElement {
|
|
24
|
+
return (
|
|
25
|
+
<em
|
|
26
|
+
className={getClass(
|
|
27
|
+
EMPHASIS_CLASS, //
|
|
28
|
+
getTypographyClass(props),
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</em>
|
|
33
|
+
);
|
|
24
34
|
}
|
package/ui/inline/Inserted.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { type ColorVariants } from "../style/Color.js";
|
|
3
|
+
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
3
5
|
/**
|
|
4
|
-
* Props for `Inserted` — optional `children`.
|
|
6
|
+
* Props for `Inserted` — colour and typography variants, plus optional `children`.
|
|
5
7
|
*
|
|
6
8
|
* @see https://shelving.cc/ui/InsertedProps
|
|
7
9
|
*/
|
|
8
|
-
export interface InsertedProps extends OptionalChildProps {
|
|
10
|
+
export interface InsertedProps extends OptionalChildProps, ColorVariants, TypographyVariants {
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Inserted text — renders an `<ins>` element to mark content added to a document.
|
|
@@ -14,4 +16,4 @@ export interface InsertedProps extends OptionalChildProps {
|
|
|
14
16
|
* @example <Inserted>new price</Inserted>
|
|
15
17
|
* @see https://shelving.cc/ui/Inserted
|
|
16
18
|
*/
|
|
17
|
-
export declare function Inserted({ children }: InsertedProps): ReactElement;
|
|
19
|
+
export declare function Inserted({ children, ...props }: InsertedProps): ReactElement;
|
package/ui/inline/Inserted.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getColorClass } from "../style/Color.js";
|
|
3
|
+
import { getTypographyClass } from "../style/Typography.js";
|
|
4
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import INSERTED_CSS from "./Inserted.module.css";
|
|
4
6
|
const INSERTED_CLASS = getModuleClass(INSERTED_CSS, "inserted");
|
|
5
7
|
/**
|
|
@@ -9,6 +11,7 @@ const INSERTED_CLASS = getModuleClass(INSERTED_CSS, "inserted");
|
|
|
9
11
|
* @example <Inserted>new price</Inserted>
|
|
10
12
|
* @see https://shelving.cc/ui/Inserted
|
|
11
13
|
*/
|
|
12
|
-
export function Inserted({ children }) {
|
|
13
|
-
return _jsx("ins", { className: INSERTED_CLASS,
|
|
14
|
+
export function Inserted({ children, ...props }) {
|
|
15
|
+
return (_jsx("ins", { className: getClass(INSERTED_CLASS, //
|
|
16
|
+
getColorClass(props), getTypographyClass(props)), children: children }));
|
|
14
17
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Inserted
|
|
2
|
+
|
|
3
|
+
Inserted text — renders an `<ins>` element to mark content that has been added to a document, shown underlined in green by default. Prefer it over a raw `<ins>` inside React components so the semantics and class names stay consistent.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Use `Inserted` for content genuinely added to a document (edits, diffs, new prices), and `<Deleted>` for content removed — they pair up.
|
|
8
|
+
- It drives its colour through the [tint ladder](/ui/TINT_CLASS), so the `color` variant (`color="purple"`, `color="blue"`, …) recolours the underline. The base tint defaults to `--color-green`.
|
|
9
|
+
- Inside `<Prose>` a raw `<ins>` picks up the same styling, so Markdown-rendered insertions match component ones.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Marking an added value
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Paragraph, Deleted, Inserted } from "shelving/ui";
|
|
17
|
+
|
|
18
|
+
<Paragraph>
|
|
19
|
+
Was <Deleted>$50</Deleted> <Inserted>$35</Inserted>.
|
|
20
|
+
</Paragraph>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Styling
|
|
24
|
+
|
|
25
|
+
`Inserted` paints from the [tint ladder](/ui/TINT_CLASS): the `50` tint sets the text colour, defaulting to `--color-green`. Override `--inserted-tint` to recolour from the base, or set each property directly.
|
|
26
|
+
|
|
27
|
+
| Variable | Styles | Default |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `--inserted-tint` | Base tint (`--tint-50`) the colour derives from | `var(--color-green)` |
|
|
30
|
+
| `--inserted-color` | Text colour | `var(--tint-50)` |
|
|
31
|
+
| `--inserted-decoration` | Text decoration | `underline var(--stroke-normal)` |
|
|
32
|
+
| `--inserted-weight` | Font weight | `var(--weight-strong)` |
|
|
33
|
+
|
|
34
|
+
**Global tokens it reads:** `--color-green`, `--stroke-normal`, `--weight-strong`, and the tint-ladder step `--tint-50`.
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
@layer components {
|
|
7
7
|
.inserted,
|
|
8
8
|
.prose ins {
|
|
9
|
+
--tint-50: var(--inserted-tint, var(--color-green));
|
|
10
|
+
|
|
9
11
|
/* Style */
|
|
10
|
-
color: var(--color-
|
|
11
|
-
text-decoration: underline var(--stroke-normal);
|
|
12
|
+
color: var(--inserted-color, var(--tint-50));
|
|
13
|
+
text-decoration: var(--inserted-decoration, underline var(--stroke-normal));
|
|
12
14
|
|
|
13
15
|
/* Text */
|
|
14
|
-
font-weight: var(--weight-strong);
|
|
16
|
+
font-weight: var(--inserted-weight, var(--weight-strong));
|
|
15
17
|
}
|
|
16
18
|
}
|
package/ui/inline/Inserted.tsx
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { type ColorVariants, getColorClass } from "../style/Color.js";
|
|
3
|
+
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
4
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import type { OptionalChildProps } from "../util/props.js";
|
|
4
6
|
import INSERTED_CSS from "./Inserted.module.css";
|
|
5
7
|
|
|
6
8
|
const INSERTED_CLASS = getModuleClass(INSERTED_CSS, "inserted");
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* Props for `Inserted` — optional `children`.
|
|
11
|
+
* Props for `Inserted` — colour and typography variants, plus optional `children`.
|
|
10
12
|
*
|
|
11
13
|
* @see https://shelving.cc/ui/InsertedProps
|
|
12
14
|
*/
|
|
13
|
-
export interface InsertedProps extends OptionalChildProps {}
|
|
15
|
+
export interface InsertedProps extends OptionalChildProps, ColorVariants, TypographyVariants {}
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Inserted text — renders an `<ins>` element to mark content added to a document.
|
|
@@ -19,6 +21,16 @@ export interface InsertedProps extends OptionalChildProps {}
|
|
|
19
21
|
* @example <Inserted>new price</Inserted>
|
|
20
22
|
* @see https://shelving.cc/ui/Inserted
|
|
21
23
|
*/
|
|
22
|
-
export function Inserted({ children }: InsertedProps): ReactElement {
|
|
23
|
-
return
|
|
24
|
+
export function Inserted({ children, ...props }: InsertedProps): ReactElement {
|
|
25
|
+
return (
|
|
26
|
+
<ins
|
|
27
|
+
className={getClass(
|
|
28
|
+
INSERTED_CLASS, //
|
|
29
|
+
getColorClass(props),
|
|
30
|
+
getTypographyClass(props),
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</ins>
|
|
35
|
+
);
|
|
24
36
|
}
|
package/ui/inline/Link.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { type ClickableProps } from "../form/Clickable.js";
|
|
3
|
+
import { type ColorVariants } from "../style/Color.js";
|
|
4
|
+
import { type TypographyVariants } from "../style/Typography.js";
|
|
3
5
|
/**
|
|
4
|
-
* Props for `Link` —
|
|
6
|
+
* Props for `Link` — `ClickableProps` (`href` for navigation or `onClick` for actions) plus colour and typography variants.
|
|
5
7
|
*
|
|
6
8
|
* @see https://shelving.cc/ui/LinkProps
|
|
7
9
|
*/
|
|
8
|
-
export interface LinkProps extends ClickableProps {
|
|
10
|
+
export interface LinkProps extends ClickableProps, ColorVariants, TypographyVariants {
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Inline link — delegates to `<Clickable>`, rendering an `<a>` (when `href` is set) or `<button>` (when `onClick` is set).
|
package/ui/inline/Link.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Clickable } from "../form/Clickable.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getColorClass } from "../style/Color.js";
|
|
4
|
+
import { getTypographyClass } from "../style/Typography.js";
|
|
5
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
4
6
|
import LINK_CSS from "./Link.module.css";
|
|
5
7
|
const LINK_CLASS = getModuleClass(LINK_CSS, "link");
|
|
6
8
|
/**
|
|
@@ -10,5 +12,6 @@ const LINK_CLASS = getModuleClass(LINK_CSS, "link");
|
|
|
10
12
|
* @see https://shelving.cc/ui/Link
|
|
11
13
|
*/
|
|
12
14
|
export function Link(props) {
|
|
13
|
-
return _jsx(Clickable, { ...props, className: LINK_CLASS
|
|
15
|
+
return (_jsx(Clickable, { ...props, className: getClass(LINK_CLASS, //
|
|
16
|
+
getColorClass(props), getTypographyClass(props)) }));
|
|
14
17
|
}
|
package/ui/inline/Link.md
CHANGED
|
@@ -31,10 +31,12 @@ import { Link } from "shelving/ui";
|
|
|
31
31
|
|
|
32
32
|
## Styling
|
|
33
33
|
|
|
34
|
-
`Link`
|
|
34
|
+
`Link` drives its colour through the tint ladder, so the `color` variant (`color="purple"`, `color="red"`, …) recolours the link. By default the `50` tint resolves to the global `--color-link` token.
|
|
35
35
|
|
|
36
36
|
| Variable | Styles | Default |
|
|
37
37
|
|---|---|---|
|
|
38
|
-
| `--link-
|
|
38
|
+
| `--link-tint` | Base tint (`--tint-50`) the link colour derives from | `var(--color-link)` |
|
|
39
|
+
| `--link-color` | Text colour | `var(--tint-50)` |
|
|
40
|
+
| `--link-weight` | Font weight | `var(--weight-strong)` |
|
|
39
41
|
|
|
40
42
|
**Global tokens it reads:** `--color-link`, `--weight-strong`, and `--stroke-normal` (the underline thickness).
|
package/ui/inline/Link.tsx
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { Clickable, type ClickableProps } from "../form/Clickable.js";
|
|
3
|
-
import {
|
|
3
|
+
import { type ColorVariants, getColorClass } from "../style/Color.js";
|
|
4
|
+
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
5
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
4
6
|
import LINK_CSS from "./Link.module.css";
|
|
5
7
|
|
|
6
8
|
const LINK_CLASS = getModuleClass(LINK_CSS, "link");
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* Props for `Link` —
|
|
11
|
+
* Props for `Link` — `ClickableProps` (`href` for navigation or `onClick` for actions) plus colour and typography variants.
|
|
10
12
|
*
|
|
11
13
|
* @see https://shelving.cc/ui/LinkProps
|
|
12
14
|
*/
|
|
13
|
-
export interface LinkProps extends ClickableProps {}
|
|
15
|
+
export interface LinkProps extends ClickableProps, ColorVariants, TypographyVariants {}
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Inline link — delegates to `<Clickable>`, rendering an `<a>` (when `href` is set) or `<button>` (when `onClick` is set).
|
|
@@ -19,5 +21,14 @@ export interface LinkProps extends ClickableProps {}
|
|
|
19
21
|
* @see https://shelving.cc/ui/Link
|
|
20
22
|
*/
|
|
21
23
|
export function Link(props: LinkProps): ReactElement {
|
|
22
|
-
return
|
|
24
|
+
return (
|
|
25
|
+
<Clickable
|
|
26
|
+
{...props}
|
|
27
|
+
className={getClass(
|
|
28
|
+
LINK_CLASS, //
|
|
29
|
+
getColorClass(props),
|
|
30
|
+
getTypographyClass(props),
|
|
31
|
+
)}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
23
34
|
}
|
package/ui/inline/Mark.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
3
|
import type { OptionalChildProps } from "../util/props.js";
|
|
3
4
|
/**
|
|
4
5
|
* Props for `Mark` — optional `children`.
|
|
5
6
|
*
|
|
6
7
|
* @see https://shelving.cc/ui/MarkProps
|
|
7
8
|
*/
|
|
8
|
-
export interface MarkProps extends OptionalChildProps {
|
|
9
|
+
export interface MarkProps extends OptionalChildProps, TypographyVariants {
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Highlighted text — renders a `<mark>` element to call attention to a run of text.
|
|
@@ -13,4 +14,4 @@ export interface MarkProps extends OptionalChildProps {
|
|
|
13
14
|
* @kind component
|
|
14
15
|
* @see https://shelving.cc/ui/Mark
|
|
15
16
|
*/
|
|
16
|
-
export declare function Mark({ children }: MarkProps): ReactElement;
|
|
17
|
+
export declare function Mark({ children, ...props }: MarkProps): ReactElement;
|
package/ui/inline/Mark.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { TINT_CLASS } from "../style/Tint.js";
|
|
3
|
+
import { getTypographyClass } from "../style/Typography.js";
|
|
4
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import MARK_CSS from "./Mark.module.css";
|
|
4
6
|
const MARK_CLASS = getModuleClass(MARK_CSS, "mark");
|
|
5
7
|
/**
|
|
@@ -8,6 +10,7 @@ const MARK_CLASS = getModuleClass(MARK_CSS, "mark");
|
|
|
8
10
|
* @kind component
|
|
9
11
|
* @see https://shelving.cc/ui/Mark
|
|
10
12
|
*/
|
|
11
|
-
export function Mark({ children }) {
|
|
12
|
-
return _jsx("mark", { className: MARK_CLASS,
|
|
13
|
+
export function Mark({ children, ...props }) {
|
|
14
|
+
return (_jsx("mark", { className: getClass(MARK_CLASS, //
|
|
15
|
+
TINT_CLASS, getTypographyClass(props)), children: children }));
|
|
13
16
|
}
|
package/ui/inline/Mark.md
CHANGED
|
@@ -20,14 +20,15 @@ import { Mark } from "shelving/ui";
|
|
|
20
20
|
|
|
21
21
|
## Styling
|
|
22
22
|
|
|
23
|
-
`Mark`
|
|
23
|
+
`Mark` paints from the [tint ladder](/ui/TINT_CLASS): the `50` tint sets the background and the `00` tint the text. By default the base tint resolves to `--color-yellow`; override `--mark-tint` to recolour the whole pill, or `--mark-background` / `--mark-color` to set the two faces independently.
|
|
24
24
|
|
|
25
25
|
| Variable | Styles | Default |
|
|
26
26
|
|---|---|---|
|
|
27
|
-
| `--mark-
|
|
28
|
-
| `--mark-
|
|
29
|
-
| `--mark-
|
|
27
|
+
| `--mark-tint` | Base tint (`--tint-50`) the pill derives from | `var(--color-yellow)` |
|
|
28
|
+
| `--mark-background` | Background fill | `var(--tint-50)` |
|
|
29
|
+
| `--mark-color` | Text colour | `var(--tint-00)` |
|
|
30
|
+
| `--mark-padding` | Inline padding | `var(--space-xxsmall)` |
|
|
30
31
|
| `--mark-radius` | Corner radius | `var(--radius-xxsmall)` |
|
|
31
32
|
| `--mark-weight` | Font weight | `var(--weight-strong)` |
|
|
32
33
|
|
|
33
|
-
**Global tokens it reads:** `--
|
|
34
|
+
**Global tokens it reads:** `--color-yellow`, `--space-xxsmall`, `--radius-xxsmall`, `--weight-strong`, and the tint-ladder steps `--tint-50` / `--tint-00`.
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
@import "../style/layers.css";
|
|
2
2
|
@import "../style/Radius.module.css";
|
|
3
3
|
@import "../style/Typography.module.css";
|
|
4
|
+
@import "../style/Tint.module.css";
|
|
4
5
|
|
|
5
6
|
@layer components {
|
|
6
7
|
.mark,
|
|
7
8
|
.prose mark {
|
|
9
|
+
--tint-50: var(--mark-tint, var(--color-yellow));
|
|
10
|
+
|
|
11
|
+
/* Box */
|
|
8
12
|
display: inline-block;
|
|
9
|
-
|
|
10
|
-
padding-inline: var(--mark-padding, 0.375em);
|
|
13
|
+
padding-inline: var(--mark-padding, var(--space-xxsmall));
|
|
11
14
|
border-radius: var(--mark-radius, var(--radius-xxsmall));
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
vertical-align: text-bottom;
|
|
16
|
+
|
|
17
|
+
/* Style */
|
|
18
|
+
background-color: var(--mark-background, var(--tint-50));
|
|
19
|
+
color: var(--mark-color, var(--tint-00));
|
|
20
|
+
|
|
21
|
+
/* Text */
|
|
14
22
|
font-weight: var(--mark-weight, var(--weight-strong));
|
|
15
23
|
}
|
|
16
24
|
}
|
package/ui/inline/Mark.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { TINT_CLASS } from "../style/Tint.js";
|
|
3
|
+
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
4
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
5
|
import type { OptionalChildProps } from "../util/props.js";
|
|
4
6
|
import MARK_CSS from "./Mark.module.css";
|
|
5
7
|
|
|
@@ -10,7 +12,7 @@ const MARK_CLASS = getModuleClass(MARK_CSS, "mark");
|
|
|
10
12
|
*
|
|
11
13
|
* @see https://shelving.cc/ui/MarkProps
|
|
12
14
|
*/
|
|
13
|
-
export interface MarkProps extends OptionalChildProps {}
|
|
15
|
+
export interface MarkProps extends OptionalChildProps, TypographyVariants {}
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Highlighted text — renders a `<mark>` element to call attention to a run of text.
|
|
@@ -18,6 +20,16 @@ export interface MarkProps extends OptionalChildProps {}
|
|
|
18
20
|
* @kind component
|
|
19
21
|
* @see https://shelving.cc/ui/Mark
|
|
20
22
|
*/
|
|
21
|
-
export function Mark({ children }: MarkProps): ReactElement {
|
|
22
|
-
return
|
|
23
|
+
export function Mark({ children, ...props }: MarkProps): ReactElement {
|
|
24
|
+
return (
|
|
25
|
+
<mark
|
|
26
|
+
className={getClass(
|
|
27
|
+
MARK_CLASS, //
|
|
28
|
+
TINT_CLASS,
|
|
29
|
+
getTypographyClass(props),
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</mark>
|
|
34
|
+
);
|
|
23
35
|
}
|
package/ui/inline/Small.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
3
|
import type { OptionalChildProps } from "../util/props.js";
|
|
3
4
|
/**
|
|
4
5
|
* Props for `Small` — optional `children`.
|
|
5
6
|
*
|
|
6
7
|
* @see https://shelving.cc/ui/SmallProps
|
|
7
8
|
*/
|
|
8
|
-
export interface SmallProps extends OptionalChildProps {
|
|
9
|
+
export interface SmallProps extends OptionalChildProps, TypographyVariants {
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Small print — renders a `<small>` element for side comments and fine print.
|
|
@@ -14,4 +15,4 @@ export interface SmallProps extends OptionalChildProps {
|
|
|
14
15
|
* @example <Small>Terms apply.</Small>
|
|
15
16
|
* @see https://shelving.cc/ui/Small
|
|
16
17
|
*/
|
|
17
|
-
export declare function Small({ children }: SmallProps): ReactElement;
|
|
18
|
+
export declare function Small({ children, ...props }: SmallProps): ReactElement;
|
package/ui/inline/Small.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getTypographyClass } from "../style/Typography.js";
|
|
3
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
4
|
import SMALL_CSS from "./Small.module.css";
|
|
4
5
|
const SMALL_CLASS = getModuleClass(SMALL_CSS, "small");
|
|
5
6
|
/**
|
|
@@ -9,6 +10,7 @@ const SMALL_CLASS = getModuleClass(SMALL_CSS, "small");
|
|
|
9
10
|
* @example <Small>Terms apply.</Small>
|
|
10
11
|
* @see https://shelving.cc/ui/Small
|
|
11
12
|
*/
|
|
12
|
-
export function Small({ children }) {
|
|
13
|
-
return _jsx("small", { className: SMALL_CLASS,
|
|
13
|
+
export function Small({ children, ...props }) {
|
|
14
|
+
return (_jsx("small", { className: getClass(SMALL_CLASS, //
|
|
15
|
+
getTypographyClass(props)), children: children }));
|
|
14
16
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Small
|
|
2
|
+
|
|
3
|
+
Small print — renders a `<small>` element for side comments and fine print such as disclaimers, attributions, and legal notes. Prefer it over a raw `<small>` inside React components so the semantics and class names stay consistent.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- It signals fine print semantically; it keeps the surrounding font size and weight, only muting the colour to a lighter tint step (`--tint-70`). Reach for the `size` typography variant if you also want smaller text.
|
|
8
|
+
- Inside `<Prose>` a raw `<small>` picks up the same styling, so Markdown-rendered fine print matches component ones.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
### Fine print after a statement
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { Paragraph, Small } from "shelving/ui";
|
|
16
|
+
|
|
17
|
+
<Paragraph>
|
|
18
|
+
Upgrade any time. <Small>Terms apply.</Small>
|
|
19
|
+
</Paragraph>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Styling
|
|
23
|
+
|
|
24
|
+
`Small` mutes its text colour to a lighter tint step and inherits size and weight from its surroundings.
|
|
25
|
+
|
|
26
|
+
| Variable | Styles | Default |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `--small-color` | Text colour | `var(--tint-70)` |
|
|
29
|
+
|
|
30
|
+
**Global tokens it reads:** the tint-ladder step `--tint-70`.
|
package/ui/inline/Small.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
3
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
4
5
|
import SMALL_CSS from "./Small.module.css";
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ const SMALL_CLASS = getModuleClass(SMALL_CSS, "small");
|
|
|
10
11
|
*
|
|
11
12
|
* @see https://shelving.cc/ui/SmallProps
|
|
12
13
|
*/
|
|
13
|
-
export interface SmallProps extends OptionalChildProps {}
|
|
14
|
+
export interface SmallProps extends OptionalChildProps, TypographyVariants {}
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Small print — renders a `<small>` element for side comments and fine print.
|
|
@@ -19,6 +20,15 @@ export interface SmallProps extends OptionalChildProps {}
|
|
|
19
20
|
* @example <Small>Terms apply.</Small>
|
|
20
21
|
* @see https://shelving.cc/ui/Small
|
|
21
22
|
*/
|
|
22
|
-
export function Small({ children }: SmallProps): ReactElement {
|
|
23
|
-
return
|
|
23
|
+
export function Small({ children, ...props }: SmallProps): ReactElement {
|
|
24
|
+
return (
|
|
25
|
+
<small
|
|
26
|
+
className={getClass(
|
|
27
|
+
SMALL_CLASS, //
|
|
28
|
+
getTypographyClass(props),
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</small>
|
|
33
|
+
);
|
|
24
34
|
}
|
package/ui/inline/Strong.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { type TypographyVariants } from "../style/Typography.js";
|
|
2
3
|
import type { OptionalChildProps } from "../util/props.js";
|
|
3
4
|
/**
|
|
4
5
|
* Props for `Strong` — optional `children`.
|
|
5
6
|
*
|
|
6
7
|
* @see https://shelving.cc/ui/StrongProps
|
|
7
8
|
*/
|
|
8
|
-
export interface StrongProps extends OptionalChildProps {
|
|
9
|
+
export interface StrongProps extends OptionalChildProps, TypographyVariants {
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Strong importance — renders a `<strong>` element for text of strong importance (typically bold).
|
|
@@ -13,4 +14,4 @@ export interface StrongProps extends OptionalChildProps {
|
|
|
13
14
|
* @kind component
|
|
14
15
|
* @see https://shelving.cc/ui/Strong
|
|
15
16
|
*/
|
|
16
|
-
export declare function Strong({ children }: StrongProps): ReactElement;
|
|
17
|
+
export declare function Strong({ children, ...props }: StrongProps): ReactElement;
|
package/ui/inline/Strong.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getTypographyClass } from "../style/Typography.js";
|
|
3
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
4
|
import STRONG_CSS from "./Strong.module.css";
|
|
4
5
|
const STRONG_CLASS = getModuleClass(STRONG_CSS, "strong");
|
|
5
6
|
/**
|
|
@@ -8,6 +9,7 @@ const STRONG_CLASS = getModuleClass(STRONG_CSS, "strong");
|
|
|
8
9
|
* @kind component
|
|
9
10
|
* @see https://shelving.cc/ui/Strong
|
|
10
11
|
*/
|
|
11
|
-
export function Strong({ children }) {
|
|
12
|
-
return _jsx("strong", { className: STRONG_CLASS,
|
|
12
|
+
export function Strong({ children, ...props }) {
|
|
13
|
+
return (_jsx("strong", { className: getClass(STRONG_CLASS, //
|
|
14
|
+
getTypographyClass(props)), children: children }));
|
|
13
15
|
}
|
package/ui/inline/Strong.md
CHANGED
|
@@ -22,6 +22,10 @@ import { Paragraph, Strong } from "shelving/ui";
|
|
|
22
22
|
|
|
23
23
|
## Styling
|
|
24
24
|
|
|
25
|
-
`Strong`
|
|
25
|
+
`Strong` only sets its font weight and inherits colour and size from its surroundings.
|
|
26
|
+
|
|
27
|
+
| Variable | Styles | Default |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `--strong-weight` | Font weight | `var(--weight-strong)` |
|
|
26
30
|
|
|
27
31
|
**Global tokens it reads:** `--weight-strong`.
|
package/ui/inline/Strong.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
3
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
3
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
4
5
|
import STRONG_CSS from "./Strong.module.css";
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ const STRONG_CLASS = getModuleClass(STRONG_CSS, "strong");
|
|
|
10
11
|
*
|
|
11
12
|
* @see https://shelving.cc/ui/StrongProps
|
|
12
13
|
*/
|
|
13
|
-
export interface StrongProps extends OptionalChildProps {}
|
|
14
|
+
export interface StrongProps extends OptionalChildProps, TypographyVariants {}
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Strong importance — renders a `<strong>` element for text of strong importance (typically bold).
|
|
@@ -18,6 +19,15 @@ export interface StrongProps extends OptionalChildProps {}
|
|
|
18
19
|
* @kind component
|
|
19
20
|
* @see https://shelving.cc/ui/Strong
|
|
20
21
|
*/
|
|
21
|
-
export function Strong({ children }: StrongProps): ReactElement {
|
|
22
|
-
return
|
|
22
|
+
export function Strong({ children, ...props }: StrongProps): ReactElement {
|
|
23
|
+
return (
|
|
24
|
+
<strong
|
|
25
|
+
className={getClass(
|
|
26
|
+
STRONG_CLASS, //
|
|
27
|
+
getTypographyClass(props),
|
|
28
|
+
)}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</strong>
|
|
32
|
+
);
|
|
23
33
|
}
|