shelving 1.304.0 → 1.305.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 +4 -4
- package/ui/dialog/Dialog.md +1 -1
- package/ui/dialog/Dialog.module.css +8 -3
- package/ui/dialog/Modal.md +1 -1
- package/ui/dialog/Modal.module.css +13 -7
- package/ui/table/Cell.d.ts +5 -2
- package/ui/table/Cell.js +5 -2
- package/ui/table/Cell.tsx +8 -3
- package/ui/table/Table.d.ts +3 -1
- package/ui/table/Table.js +3 -2
- package/ui/table/Table.md +19 -2
- package/ui/table/Table.module.css +156 -0
- package/ui/table/Table.tsx +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shelving",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.305.0",
|
|
4
4
|
"author": "Dave Houlbrooke <dave@shax.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@biomejs/biome": "^2.5.15",
|
|
13
13
|
"@heroicons/react": "^2.2.0",
|
|
14
|
-
"@types/bun": "^1.4.
|
|
14
|
+
"@types/bun": "^1.4.3",
|
|
15
15
|
"@types/react": "^19.3.0",
|
|
16
16
|
"@types/react-dom": "^19.3.0",
|
|
17
17
|
"stylelint": "^17.16.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"type": "module",
|
|
83
83
|
"types": "./index.d.ts",
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"react": "^19.3.
|
|
86
|
-
"react-dom": "^19.3.
|
|
85
|
+
"react": "^19.3.1",
|
|
86
|
+
"react-dom": "^19.3.1"
|
|
87
87
|
}
|
|
88
88
|
}
|
package/ui/dialog/Dialog.md
CHANGED
|
@@ -64,7 +64,7 @@ function DeleteButton({ onConfirm }: { onConfirm: () => void }) {
|
|
|
64
64
|
|
|
65
65
|
## Styling
|
|
66
66
|
|
|
67
|
-
`Dialog` paints the full-screen overlay and resets the browser's default `<dialog>` border, size limits, and `::backdrop`. The inner panel comes from its children, usually `<Modal>`. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
67
|
+
`Dialog` paints the full-screen overlay and resets the browser's default `<dialog>` border, size limits, and `::backdrop`. Transparent borders as wide as the screen's safe areas keep the content and the close button clear of the notch, rounded corners and home bar. The inner panel comes from its children, usually `<Modal>`. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
68
68
|
|
|
69
69
|
| Variable | Styles | Default |
|
|
70
70
|
|---|---|---|
|
|
@@ -22,7 +22,12 @@
|
|
|
22
22
|
overscroll-behavior: contain;
|
|
23
23
|
padding-block: var(--dialog-padding, var(--space-normal));
|
|
24
24
|
padding-inline: var(--dialog-indent, var(--space-normal));
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
/* Transparent borders keep the content out of the screen's safe areas (notch, rounded corners, home bar). The overlay paints under them, so the padding stays even. */
|
|
27
|
+
border-top: env(safe-area-inset-top, 0) solid transparent;
|
|
28
|
+
border-right: env(safe-area-inset-right, 0) solid transparent;
|
|
29
|
+
border-bottom: env(safe-area-inset-bottom, 0) solid transparent;
|
|
30
|
+
border-left: env(safe-area-inset-left, 0) solid transparent;
|
|
26
31
|
|
|
27
32
|
/* Style */
|
|
28
33
|
color: var(--dialog-color, var(--tint-100));
|
|
@@ -61,7 +66,7 @@
|
|
|
61
66
|
|
|
62
67
|
.close {
|
|
63
68
|
position: fixed;
|
|
64
|
-
top: var(--dialog-close-offset, var(--space-small));
|
|
65
|
-
right: var(--dialog-close-offset, var(--space-small));
|
|
69
|
+
top: calc(var(--dialog-close-offset, var(--space-small)) + env(safe-area-inset-top, 0px));
|
|
70
|
+
right: calc(var(--dialog-close-offset, var(--space-small)) + env(safe-area-inset-right, 0px));
|
|
66
71
|
}
|
|
67
72
|
}
|
package/ui/dialog/Modal.md
CHANGED
|
@@ -96,7 +96,7 @@ A link click inside a `<Dialog>` closes it, so the menu slides out as the page c
|
|
|
96
96
|
|
|
97
97
|
## Styling
|
|
98
98
|
|
|
99
|
-
`Modal` paints a shadowed surface with no border. Set `--modal-stroke` (for example `var(--stroke-normal)`) to show the themed border, or `--modal-border` to replace it. A pinned panel then has no border on the side that touches the screen edge. On a pinned panel, only the corners that do not touch a screen edge are round. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
99
|
+
`Modal` paints a shadowed surface with no border. Set `--modal-stroke` (for example `var(--stroke-normal)`) to show the themed border, or `--modal-border` to replace it. A pinned panel then has no visible border on the side that touches the screen edge. That side has a transparent border as wide as the screen's safe area (notch, rounded corners, home bar), so the content stays clear of it and the background fills it. On a pinned panel, only the corners that do not touch a screen edge are round. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
100
100
|
|
|
101
101
|
| Variable | Styles | Default |
|
|
102
102
|
|---|---|---|
|
|
@@ -54,30 +54,36 @@
|
|
|
54
54
|
width: var(--modal-width, var(--width-narrow));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/*
|
|
57
|
+
/*
|
|
58
|
+
* On each side that touches the edge of the screen, a transparent border replaces any `--modal-stroke` or `--modal-border`.
|
|
59
|
+
* - The border is as wide as the screen's safe area on that side (notch, rounded corners, home bar), so the content stays clear of it.
|
|
60
|
+
* - The panel's background paints under the border, so it fills the safe area, and the padding stays even.
|
|
61
|
+
*/
|
|
58
62
|
&.top {
|
|
59
63
|
top: 0;
|
|
60
|
-
border-top:
|
|
64
|
+
border-top: env(safe-area-inset-top, 0) solid transparent;
|
|
61
65
|
view-transition-class: modal-top;
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
&.bottom {
|
|
65
69
|
bottom: 0;
|
|
66
|
-
border-bottom:
|
|
70
|
+
border-bottom: env(safe-area-inset-bottom, 0) solid transparent;
|
|
67
71
|
view-transition-class: modal-bottom;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
&.left {
|
|
71
75
|
left: 0;
|
|
72
|
-
border-
|
|
73
|
-
border-
|
|
76
|
+
border-top: env(safe-area-inset-top, 0) solid transparent;
|
|
77
|
+
border-bottom: env(safe-area-inset-bottom, 0) solid transparent;
|
|
78
|
+
border-left: env(safe-area-inset-left, 0) solid transparent;
|
|
74
79
|
view-transition-class: modal-left;
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
&.right {
|
|
78
83
|
right: 0;
|
|
79
|
-
border-
|
|
80
|
-
border-
|
|
84
|
+
border-top: env(safe-area-inset-top, 0) solid transparent;
|
|
85
|
+
border-right: env(safe-area-inset-right, 0) solid transparent;
|
|
86
|
+
border-bottom: env(safe-area-inset-bottom, 0) solid transparent;
|
|
81
87
|
view-transition-class: modal-right;
|
|
82
88
|
}
|
|
83
89
|
}
|
package/ui/table/Cell.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { type IndentVariants } from "../style/Indent.js";
|
|
3
|
+
import { type PaddingVariants } from "../style/Padding.js";
|
|
2
4
|
import { type TypographyVariants } from "../style/Typography.js";
|
|
3
5
|
import { type WidthVariants } from "../style/Width.js";
|
|
4
6
|
import type { ClassProps, OptionalChildProps } from "../util/index.js";
|
|
5
7
|
/**
|
|
6
|
-
* Props for `Cell` — width and typography variants plus `children`.
|
|
8
|
+
* Props for `Cell` — padding, indent, width, and typography variants plus `children`.
|
|
7
9
|
*
|
|
8
10
|
* @see https://shelving.cc/ui/CellProps
|
|
9
11
|
*/
|
|
10
|
-
export interface CellProps extends WidthVariants, TypographyVariants, OptionalChildProps, ClassProps {
|
|
12
|
+
export interface CellProps extends PaddingVariants, IndentVariants, WidthVariants, TypographyVariants, OptionalChildProps, ClassProps {
|
|
11
13
|
header?: boolean | undefined;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
@@ -15,6 +17,7 @@ export interface CellProps extends WidthVariants, TypographyVariants, OptionalCh
|
|
|
15
17
|
* - Rendered as `<td>` (or a `<th>` using `<Cell header>`).
|
|
16
18
|
* - Sets its column's width via the `width` variant. Unlike a `<col>`, a cell honours `min-width`, so `width="12x" grow` gives the column a hard minimum that fills the remaining space and keeps the table from collapsing the column on a narrow viewport.
|
|
17
19
|
* - A column's width is the widest of its cells, so use this to size a column that has no header to set the width on.
|
|
20
|
+
* - `padding` sets the cell's top and bottom padding, and `indent` its left and right. Both override the table's `padding` / `indent`, and `indent` also overrides the zero outer padding of the first and last cells.
|
|
18
21
|
*
|
|
19
22
|
* @kind component
|
|
20
23
|
* @see https://shelving.cc/ui/Cell
|
package/ui/table/Cell.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getIndentClass } from "../style/Indent.js";
|
|
3
|
+
import { getPaddingClass } from "../style/Padding.js";
|
|
2
4
|
import { getTypographyClass } from "../style/Typography.js";
|
|
3
5
|
import { getWidthClass } from "../style/Width.js";
|
|
4
6
|
import { getClass } from "../util/css.js";
|
|
@@ -7,12 +9,13 @@ import { getClass } from "../util/css.js";
|
|
|
7
9
|
* - Rendered as `<td>` (or a `<th>` using `<Cell header>`).
|
|
8
10
|
* - Sets its column's width via the `width` variant. Unlike a `<col>`, a cell honours `min-width`, so `width="12x" grow` gives the column a hard minimum that fills the remaining space and keeps the table from collapsing the column on a narrow viewport.
|
|
9
11
|
* - A column's width is the widest of its cells, so use this to size a column that has no header to set the width on.
|
|
12
|
+
* - `padding` sets the cell's top and bottom padding, and `indent` its left and right. Both override the table's `padding` / `indent`, and `indent` also overrides the zero outer padding of the first and last cells.
|
|
10
13
|
*
|
|
11
14
|
* @kind component
|
|
12
15
|
* @see https://shelving.cc/ui/Cell
|
|
13
16
|
*/
|
|
14
17
|
export function Cell({ header = false, children, className, ...props }) {
|
|
15
18
|
const Component = header ? "th" : "td";
|
|
16
|
-
return (_jsx(Component, { className: getClass(
|
|
17
|
-
getTypographyClass(props), className), children: children }));
|
|
19
|
+
return (_jsx(Component, { className: getClass(getPaddingClass(props), //
|
|
20
|
+
getIndentClass(props), getWidthClass(props), getTypographyClass(props), className), children: children }));
|
|
18
21
|
}
|
package/ui/table/Cell.tsx
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
+
import { getIndentClass, type IndentVariants } from "../style/Indent.js";
|
|
3
|
+
import { getPaddingClass, type PaddingVariants } from "../style/Padding.js";
|
|
2
4
|
import { getTypographyClass, type TypographyVariants } from "../style/Typography.js";
|
|
3
5
|
import { getWidthClass, type WidthVariants } from "../style/Width.js";
|
|
4
6
|
import { getClass } from "../util/css.js";
|
|
5
7
|
import type { ClassProps, OptionalChildProps } from "../util/index.js";
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
|
-
* Props for `Cell` — width and typography variants plus `children`.
|
|
10
|
+
* Props for `Cell` — padding, indent, width, and typography variants plus `children`.
|
|
9
11
|
*
|
|
10
12
|
* @see https://shelving.cc/ui/CellProps
|
|
11
13
|
*/
|
|
12
|
-
export interface CellProps extends WidthVariants, TypographyVariants, OptionalChildProps, ClassProps {
|
|
14
|
+
export interface CellProps extends PaddingVariants, IndentVariants, WidthVariants, TypographyVariants, OptionalChildProps, ClassProps {
|
|
13
15
|
header?: boolean | undefined;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -18,6 +20,7 @@ export interface CellProps extends WidthVariants, TypographyVariants, OptionalCh
|
|
|
18
20
|
* - Rendered as `<td>` (or a `<th>` using `<Cell header>`).
|
|
19
21
|
* - Sets its column's width via the `width` variant. Unlike a `<col>`, a cell honours `min-width`, so `width="12x" grow` gives the column a hard minimum that fills the remaining space and keeps the table from collapsing the column on a narrow viewport.
|
|
20
22
|
* - A column's width is the widest of its cells, so use this to size a column that has no header to set the width on.
|
|
23
|
+
* - `padding` sets the cell's top and bottom padding, and `indent` its left and right. Both override the table's `padding` / `indent`, and `indent` also overrides the zero outer padding of the first and last cells.
|
|
21
24
|
*
|
|
22
25
|
* @kind component
|
|
23
26
|
* @see https://shelving.cc/ui/Cell
|
|
@@ -27,7 +30,9 @@ export function Cell({ header = false, children, className, ...props }: CellProp
|
|
|
27
30
|
return (
|
|
28
31
|
<Component
|
|
29
32
|
className={getClass(
|
|
30
|
-
|
|
33
|
+
getPaddingClass(props), //
|
|
34
|
+
getIndentClass(props),
|
|
35
|
+
getWidthClass(props),
|
|
31
36
|
getTypographyClass(props),
|
|
32
37
|
className,
|
|
33
38
|
)}
|
package/ui/table/Table.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type BlockVariants } from "../style/Block.js";
|
|
|
3
3
|
import type { ChildProps, ClassProps } from "../util/props.js";
|
|
4
4
|
/**
|
|
5
5
|
* Props for `Table` — colour, space, typography, and width variants plus `children`.
|
|
6
|
+
* - `padding` and `indent` set the padding of every cell, not of the `<table>` itself.
|
|
6
7
|
*
|
|
7
8
|
* @see https://shelving.cc/ui/TableProps
|
|
8
9
|
*/
|
|
@@ -12,8 +13,9 @@ export interface TableProps extends BlockVariants, ChildProps, ClassProps {
|
|
|
12
13
|
* Table block — rendered as `<table>`.
|
|
13
14
|
* - Wrap in a `<Scroll horizontal>` if the table may exceed the container width on small screens.
|
|
14
15
|
* - `<th>` / `<td>` cells draw the borders (the `<table>` element itself has none); override their weight via the `--table-border` / `--table-stroke` hooks.
|
|
16
|
+
* - `padding` sets the top and bottom padding of every cell, and `indent` the left and right. A `<Cell>` with its own `padding` or `indent` overrides them.
|
|
15
17
|
*
|
|
16
18
|
* @kind component
|
|
17
19
|
* @see https://shelving.cc/ui/Table
|
|
18
20
|
*/
|
|
19
|
-
export declare function Table({ children, className, ...props }: TableProps): ReactElement;
|
|
21
|
+
export declare function Table({ padding, indent, children, className, ...props }: TableProps): ReactElement;
|
package/ui/table/Table.js
CHANGED
|
@@ -7,11 +7,12 @@ const TABLE_CLASS = getModuleClass(TABLE_CSS, "table");
|
|
|
7
7
|
* Table block — rendered as `<table>`.
|
|
8
8
|
* - Wrap in a `<Scroll horizontal>` if the table may exceed the container width on small screens.
|
|
9
9
|
* - `<th>` / `<td>` cells draw the borders (the `<table>` element itself has none); override their weight via the `--table-border` / `--table-stroke` hooks.
|
|
10
|
+
* - `padding` sets the top and bottom padding of every cell, and `indent` the left and right. A `<Cell>` with its own `padding` or `indent` overrides them.
|
|
10
11
|
*
|
|
11
12
|
* @kind component
|
|
12
13
|
* @see https://shelving.cc/ui/Table
|
|
13
14
|
*/
|
|
14
|
-
export function Table({ children, className, ...props }) {
|
|
15
|
+
export function Table({ padding, indent, children, className, ...props }) {
|
|
15
16
|
return (_jsx("table", { className: getClass(TABLE_CLASS, //
|
|
16
|
-
getBlockClass(props), className), children: children }));
|
|
17
|
+
padding && getModuleClass(TABLE_CSS, `padding-${padding}`), indent && getModuleClass(TABLE_CSS, `indent-${indent}`), getBlockClass(props), className), children: children }));
|
|
17
18
|
}
|
package/ui/table/Table.md
CHANGED
|
@@ -10,6 +10,8 @@ A data table — renders a `<table>`. Compose the usual `<thead>` / `<tbody>` /
|
|
|
10
10
|
- Like the other block components it collapses its outer block margin when it is the first or last child.
|
|
11
11
|
- Spans the full width of its container by default; set the `width` variant (`narrow` / `normal` / `wide` / `full` / `fit`) to constrain it.
|
|
12
12
|
- Size columns with `<Cell>` and the `width` variant — `width="fit"` hugs the content, and `width="12x" grow` gives a column a hard minimum it can grow past (cells honour `min-width`, so the table scrolls rather than collapsing the column on a narrow screen). A column's width is the widest of its cells.
|
|
13
|
+
- Set cell padding for the whole table with the `padding` (top and bottom) and `indent` (left and right) variants — `<Table padding="small" indent="normal">`. These pad every cell, not the `<table>` itself.
|
|
14
|
+
- A `<Cell>` takes the same `padding` and `indent` variants, which override the table's values for that cell — for example `<Cell width="fit" padding="none">` around a button that already has its own padding.
|
|
13
15
|
- Inside `<Prose>` a raw `<table>` picks up the same styling, so Markdown-rendered tables match component ones.
|
|
14
16
|
|
|
15
17
|
## Usage
|
|
@@ -30,11 +32,26 @@ import { Table } from "shelving/ui";
|
|
|
30
32
|
</Table>
|
|
31
33
|
```
|
|
32
34
|
|
|
35
|
+
### Cell padding
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Button, Cell, Table } from "shelving/ui";
|
|
39
|
+
|
|
40
|
+
<Table padding="small">
|
|
41
|
+
<tbody>
|
|
42
|
+
<tr>
|
|
43
|
+
<Cell width="full">Alice</Cell>
|
|
44
|
+
<Cell width="fit" padding="none"><Button small>Remove</Button></Cell>
|
|
45
|
+
</tr>
|
|
46
|
+
</tbody>
|
|
47
|
+
</Table>
|
|
48
|
+
```
|
|
49
|
+
|
|
33
50
|
## Styling
|
|
34
51
|
|
|
35
52
|
`Table` exposes hooks for its rhythm, cell padding, and border; it paints no surface of its own, so it inherits the surrounding tint.
|
|
36
53
|
|
|
37
|
-
`--table-padding` sets the top and bottom padding of each cell, and `--table-indent` the left and right. Each takes one length. The outermost columns still drop their outer inline padding, and `<thead>` / `<tfoot>` their outer block padding, so the table stays flush with its container.
|
|
54
|
+
`--table-padding` sets the top and bottom padding of each cell, and `--table-indent` the left and right. Each takes one length. The table's `padding` and `indent` variants set these hooks. The outermost columns still drop their outer inline padding, and `<thead>` / `<tfoot>` their outer block padding, so the table stays flush with its container.
|
|
38
55
|
|
|
39
56
|
| Variable | Styles | Default |
|
|
40
57
|
|---|---|---|
|
|
@@ -56,7 +73,7 @@ import { Table } from "shelving/ui";
|
|
|
56
73
|
|
|
57
74
|
Defining contents for the `<Table>` is done with standard `<tr>`, `<th>`, `<td>`, `<thead>`, `<tbody>`, `<tfoot>` elements.
|
|
58
75
|
|
|
59
|
-
The `<Cell>` element can be used to define a `<td>` or `<th>`, and supports `WidthVariants` and `TypographyVariants` for styling.
|
|
76
|
+
The `<Cell>` element can be used to define a `<td>` or `<th>`, and supports `PaddingVariants`, `IndentVariants`, `WidthVariants` and `TypographyVariants` for styling.
|
|
60
77
|
|
|
61
78
|
## Column widths
|
|
62
79
|
|
|
@@ -63,3 +63,159 @@
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
@layer variants {
|
|
68
|
+
/* Cell padding (top and bottom) for every cell in the table, from the `padding` variant. */
|
|
69
|
+
.padding-none {
|
|
70
|
+
--table-padding: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.padding-paragraph {
|
|
74
|
+
--table-padding: var(--space-paragraph);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.padding-section {
|
|
78
|
+
--table-padding: var(--space-section);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.padding-xxsmall {
|
|
82
|
+
--table-padding: var(--space-xxsmall);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.padding-xsmall {
|
|
86
|
+
--table-padding: var(--space-xsmall);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.padding-small {
|
|
90
|
+
--table-padding: var(--space-small);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.padding-normal {
|
|
94
|
+
--table-padding: var(--space-normal);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.padding-large {
|
|
98
|
+
--table-padding: var(--space-large);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.padding-xlarge {
|
|
102
|
+
--table-padding: var(--space-xlarge);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.padding-xxlarge {
|
|
106
|
+
--table-padding: var(--space-xxlarge);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.padding-1x {
|
|
110
|
+
--table-padding: calc(var(--space-normal) * 1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.padding-2x {
|
|
114
|
+
--table-padding: calc(var(--space-normal) * 2);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.padding-3x {
|
|
118
|
+
--table-padding: calc(var(--space-normal) * 3);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.padding-4x {
|
|
122
|
+
--table-padding: calc(var(--space-normal) * 4);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.padding-5x {
|
|
126
|
+
--table-padding: calc(var(--space-normal) * 5);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.padding-6x {
|
|
130
|
+
--table-padding: calc(var(--space-normal) * 6);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.padding-7x {
|
|
134
|
+
--table-padding: calc(var(--space-normal) * 7);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.padding-8x {
|
|
138
|
+
--table-padding: calc(var(--space-normal) * 8);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.padding-9x {
|
|
142
|
+
--table-padding: calc(var(--space-normal) * 9);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.padding-10x {
|
|
146
|
+
--table-padding: calc(var(--space-normal) * 10);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Cell indent (left and right) for every cell in the table, from the `indent` variant. */
|
|
150
|
+
.indent-none {
|
|
151
|
+
--table-indent: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.indent-xxsmall {
|
|
155
|
+
--table-indent: var(--space-xxsmall);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.indent-xsmall {
|
|
159
|
+
--table-indent: var(--space-xsmall);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.indent-small {
|
|
163
|
+
--table-indent: var(--space-small);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.indent-normal {
|
|
167
|
+
--table-indent: var(--space-normal);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.indent-large {
|
|
171
|
+
--table-indent: var(--space-large);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.indent-xlarge {
|
|
175
|
+
--table-indent: var(--space-xlarge);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.indent-xxlarge {
|
|
179
|
+
--table-indent: var(--space-xxlarge);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.indent-1x {
|
|
183
|
+
--table-indent: calc(var(--space-normal) * 1);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.indent-2x {
|
|
187
|
+
--table-indent: calc(var(--space-normal) * 2);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.indent-3x {
|
|
191
|
+
--table-indent: calc(var(--space-normal) * 3);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.indent-4x {
|
|
195
|
+
--table-indent: calc(var(--space-normal) * 4);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.indent-5x {
|
|
199
|
+
--table-indent: calc(var(--space-normal) * 5);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.indent-6x {
|
|
203
|
+
--table-indent: calc(var(--space-normal) * 6);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.indent-7x {
|
|
207
|
+
--table-indent: calc(var(--space-normal) * 7);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.indent-8x {
|
|
211
|
+
--table-indent: calc(var(--space-normal) * 8);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.indent-9x {
|
|
215
|
+
--table-indent: calc(var(--space-normal) * 9);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.indent-10x {
|
|
219
|
+
--table-indent: calc(var(--space-normal) * 10);
|
|
220
|
+
}
|
|
221
|
+
}
|
package/ui/table/Table.tsx
CHANGED
|
@@ -8,6 +8,7 @@ const TABLE_CLASS = getModuleClass(TABLE_CSS, "table");
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Props for `Table` — colour, space, typography, and width variants plus `children`.
|
|
11
|
+
* - `padding` and `indent` set the padding of every cell, not of the `<table>` itself.
|
|
11
12
|
*
|
|
12
13
|
* @see https://shelving.cc/ui/TableProps
|
|
13
14
|
*/
|
|
@@ -17,15 +18,18 @@ export interface TableProps extends BlockVariants, ChildProps, ClassProps {}
|
|
|
17
18
|
* Table block — rendered as `<table>`.
|
|
18
19
|
* - Wrap in a `<Scroll horizontal>` if the table may exceed the container width on small screens.
|
|
19
20
|
* - `<th>` / `<td>` cells draw the borders (the `<table>` element itself has none); override their weight via the `--table-border` / `--table-stroke` hooks.
|
|
21
|
+
* - `padding` sets the top and bottom padding of every cell, and `indent` the left and right. A `<Cell>` with its own `padding` or `indent` overrides them.
|
|
20
22
|
*
|
|
21
23
|
* @kind component
|
|
22
24
|
* @see https://shelving.cc/ui/Table
|
|
23
25
|
*/
|
|
24
|
-
export function Table({ children, className, ...props }: TableProps): ReactElement {
|
|
26
|
+
export function Table({ padding, indent, children, className, ...props }: TableProps): ReactElement {
|
|
25
27
|
return (
|
|
26
28
|
<table
|
|
27
29
|
className={getClass(
|
|
28
30
|
TABLE_CLASS, //
|
|
31
|
+
padding && getModuleClass(TABLE_CSS, `padding-${padding}`),
|
|
32
|
+
indent && getModuleClass(TABLE_CSS, `indent-${indent}`),
|
|
29
33
|
getBlockClass(props),
|
|
30
34
|
className,
|
|
31
35
|
)}
|