@softure-ai/theme-notion 0.31.0 → 0.32.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/CHANGELOG.md +18 -0
- package/README.md +12 -9
- package/dist/notion/FoldRow.d.ts +7 -4
- package/dist/notion/FoldRow.d.ts.map +1 -1
- package/dist/notion/FoldRow.js +21 -13
- package/dist/notion/FoldRow.js.map +1 -1
- package/package.json +1 -1
- package/src/notion/FoldRow.tsx +79 -28
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
|
|
|
4
4
|
production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
|
|
5
5
|
"Definition of done").
|
|
6
6
|
|
|
7
|
+
## 0.32.0
|
|
8
|
+
|
|
9
|
+
- `FoldRow` (#1463): the bar and its opened content share one 8 px horizontal inset. The summary is padded `px-2`
|
|
10
|
+
(was `px-1`), the opened content `px-2 py-3` (was `p-3`), so the chevron and the details table start at the same x;
|
|
11
|
+
the actions keep the same inset on the bar's right (`pr-2`, was `pr-1`). `isInset` content starts under the title
|
|
12
|
+
at the new inset (`py-2 pr-2 pl-8`, was `py-2 pr-1 pl-6`).
|
|
13
|
+
- Migration: an app that aligned the row itself
|
|
14
|
+
(`[&_[data-slot=fold-row-summary]]:px-2 [&_[data-slot=fold-row-content]]:px-2` on the row) drops the override.
|
|
15
|
+
- `FoldRow` (#1471): the right column of a row with `actions` spans the summary's full height and lights with it as one
|
|
16
|
+
box, open or hovered, however many lines the summary wraps to (it used to stop under the control). A new `status`
|
|
17
|
+
prop draws a status above the actions in that column (`data-slot="fold-row-status"`; a status alone draws the
|
|
18
|
+
column too); the actions sit in `data-slot="fold-row-action-list"`. Below `md` the column falls under the summary
|
|
19
|
+
and each action is at least 44 px. With a column, the row is a grid and the opened content is the details' sibling
|
|
20
|
+
under the whole bar (shown while the row is open), so find-in-page no longer opens a closed row with actions.
|
|
21
|
+
- Migration: an app that wrapped `FoldRow` to put a status above its action and light both as one box passes
|
|
22
|
+
`status` and `actions` instead and drops the wrapper. Selectors that looked for `fold-row-content` inside the
|
|
23
|
+
`<details>` of a row with actions look in `fold-row-with-actions` instead.
|
|
24
|
+
|
|
7
25
|
## 0.31.0
|
|
8
26
|
|
|
9
27
|
- `PageLayout`: a screen inside the app shell, its `PageHeader` (the `header` prop takes the same props) and then its
|
package/README.md
CHANGED
|
@@ -213,16 +213,19 @@ is `min-w-0`, so a wide table scrolls inside its card instead of widening the pa
|
|
|
213
213
|
```
|
|
214
214
|
|
|
215
215
|
**`FoldRow`.** An item as one list row in a native `<details>`: a chevron, the title, short facts and badges on the
|
|
216
|
-
right; opened, it shows a `DetailTable` and its `children`. The opened content
|
|
217
|
-
(`
|
|
218
|
-
|
|
216
|
+
right; opened, it shows a `DetailTable` and its `children`. The bar and the opened content share one 8 px
|
|
217
|
+
horizontal inset (`px-2`; the content is padded 12 px top and bottom, `py-3`), so the table starts under the chevron;
|
|
218
|
+
`isInset` indents it under the title instead (32 px on the left) and sets `data-inset` on the content, like
|
|
219
|
+
`StatsFold`. A row with a summary of its own (icons, a status) passes `summary`,
|
|
219
220
|
drawn after the chevron in place of `title`, `facts` and `badges`; `details` and `detailsLabel` are optional together,
|
|
220
221
|
so the content can be several tables or a list. `size="touch"` makes the summary at least the `touch-target` height
|
|
221
|
-
(44 px) instead of the row height, for a phone list. `actions` puts controls
|
|
222
|
-
a menu), beside the `<details>` rather than inside its `<summary>`, so clicking one never folds the row;
|
|
223
|
-
|
|
224
|
-
the summary
|
|
225
|
-
|
|
222
|
+
(44 px) instead of the row height, for a phone list. `actions` puts controls in a right column of the row's bar (a
|
|
223
|
+
delete button, a menu), beside the `<details>` rather than inside its `<summary>`, so clicking one never folds the row;
|
|
224
|
+
`status` puts the item's status above them in the same column. The column spans the summary's full height however
|
|
225
|
+
many lines it wraps to, and the summary and the column light as one box when the row is open or hovered. Below `md`
|
|
226
|
+
the column falls under the summary and each action is at least 44 px. With a column the row is a grid
|
|
227
|
+
(`data-slot="fold-row-with-actions"`, which carries the bottom border) and the opened content sits under the whole bar
|
|
228
|
+
as the details' sibling, shown while it is open. `isOpenInitially` renders the row open (`<details open>`), for the row the
|
|
226
229
|
address points at; only the first render reads it, and the reader can still fold the row.
|
|
227
230
|
|
|
228
231
|
```tsx
|
|
@@ -230,7 +233,7 @@ address points at; only the first render reads it, and the reader can still fold
|
|
|
230
233
|
<FoldRow summary={<><Receipt aria-hidden="true" className="size-4" /> Invoice 12/2026 <Badge>Paid</Badge></>}>
|
|
231
234
|
<InvoiceLines />
|
|
232
235
|
</FoldRow>
|
|
233
|
-
<FoldRow title="clip.mp4" badges={[]} actions={<DeleteButton />} />
|
|
236
|
+
<FoldRow title="clip.mp4" badges={[]} status={<Status color="green">Paid</Status>} actions={<DeleteButton />} />
|
|
234
237
|
```
|
|
235
238
|
|
|
236
239
|
**`FilterChip`.** The filters above a list or a table, drawn the way a Notion database view draws them: a 24 px pill
|
package/dist/notion/FoldRow.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type FoldRowDetailsProps = {
|
|
|
32
32
|
readonly details?: never;
|
|
33
33
|
};
|
|
34
34
|
export type FoldRowProps = FoldRowSummaryProps & FoldRowDetailsProps & {
|
|
35
|
-
/** Indents the opened content to line up with the title after the chevron; by default it
|
|
35
|
+
/** Indents the opened content to line up with the title after the chevron; by default it starts under the chevron. */
|
|
36
36
|
readonly isInset?: boolean;
|
|
37
37
|
/** `touch` makes the summary at least the touch target high (44 px) instead of the row height. */
|
|
38
38
|
readonly size?: "default" | "touch";
|
|
@@ -44,11 +44,14 @@ export type FoldRowProps = FoldRowSummaryProps & FoldRowDetailsProps & {
|
|
|
44
44
|
*/
|
|
45
45
|
readonly isOpenInitially?: boolean;
|
|
46
46
|
/**
|
|
47
|
-
* Controls
|
|
48
|
-
* it, so clicking
|
|
49
|
-
* is open or hovered
|
|
47
|
+
* Controls in the right column of the row's bar (a delete button, a menu). The column sits beside the `<summary>`,
|
|
48
|
+
* not in it, so clicking a control never folds the row; it spans the summary's full height and lights with it when
|
|
49
|
+
* the row is open or hovered, so the bar reads as one box. On a phone (below `md`) the column falls under the
|
|
50
|
+
* summary and each control is at least the touch target (44 px).
|
|
50
51
|
*/
|
|
51
52
|
readonly actions?: ReactNode;
|
|
53
|
+
/** The item's status, drawn in the same column above the actions (with no actions, the column holds only it). */
|
|
54
|
+
readonly status?: ReactNode;
|
|
52
55
|
};
|
|
53
56
|
export declare function FoldRow(props: FoldRowProps): import("react").JSX.Element;
|
|
54
57
|
//# sourceMappingURL=FoldRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FoldRow.d.ts","sourceRoot":"","sources":["../../src/notion/FoldRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;CACtB;AAED,wFAAwF;AACxF,MAAM,MAAM,mBAAmB,GAC3B;IACE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;CAC1B,GACD;IACE,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC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,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;CACzB,CAAC;AAEN,mEAAmE;AACnE,MAAM,MAAM,mBAAmB,GAC3B;IACE,2CAA2C;IAC3C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;CACxC,GACD;IACE,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC;AAEN,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAC5C,mBAAmB,GAAG;IACpB,sHAAsH;IACtH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IACpC,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,iHAAiH;IACjH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;CAC7B,CAAC;AAkEJ,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAiD1C"}
|
package/dist/notion/FoldRow.js
CHANGED
|
@@ -5,8 +5,10 @@ import { Badge } from "../ui/badge.js";
|
|
|
5
5
|
import { DetailTable } from "./DetailTable.js";
|
|
6
6
|
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
7
7
|
import { TONE_COLORS } from "./tones.js";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
// The bar and its opened content share one 8 px horizontal inset, so the details start under the chevron; the inset
|
|
9
|
+
// variant starts under the title instead (8 px inset, 16 px chevron, 8 px gap).
|
|
10
|
+
const CONTENT_LAYOUT = "flex-col gap-2 px-2 py-3";
|
|
11
|
+
const INSET_CONTENT_LAYOUT = "flex-col gap-2 py-2 pr-2 pl-8";
|
|
10
12
|
function FoldRowFixedSummary({ title, facts = [], badges, }) {
|
|
11
13
|
return (_jsxs(_Fragment, { children: [_jsxs("span", { "data-slot": "fold-row-heading", className: "flex min-w-0 items-center gap-2", children: [_jsx(FoldRowChevron, {}), _jsx("span", { className: "min-w-0 text-ui-medium", children: title })] }), facts.map((fact, index) => (_jsx("span", { "data-slot": "fold-row-fact", className: "text-ui text-muted-foreground", children: fact }, index))), badges.length === 0 ? null : (_jsx("span", { "data-slot": "fold-row-badges", className: "ml-auto inline-flex flex-wrap gap-1", children: badges.map((badge) => {
|
|
12
14
|
const tone = badge.tone ?? "default";
|
|
@@ -16,21 +18,27 @@ function FoldRowFixedSummary({ title, facts = [], badges, }) {
|
|
|
16
18
|
function FoldRowChevron() {
|
|
17
19
|
return (_jsx(ChevronRight, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: "size-4 shrink-0 text-muted-foreground transition-transform duration-150 group-open/fold-row:rotate-90" }));
|
|
18
20
|
}
|
|
21
|
+
function isDrawn(node) {
|
|
22
|
+
return node !== undefined && node !== null;
|
|
23
|
+
}
|
|
19
24
|
// An item as one folding list row: a native `<details>` that opens in place to its details, with no client state.
|
|
20
25
|
export function FoldRow(props) {
|
|
21
|
-
const { actions,
|
|
22
|
-
if (actions
|
|
23
|
-
return _jsx(FoldRowDetails, { ...props, className: "border-b border-border" });
|
|
26
|
+
const { actions, status, isInset = false } = props;
|
|
27
|
+
if (!isDrawn(actions) && !isDrawn(status)) {
|
|
28
|
+
return (_jsx(FoldRowDetails, { ...props, className: "border-b border-border", content: _jsx(FoldRowContent, { ...props, className: cn("flex", isInset ? INSET_CONTENT_LAYOUT : CONTENT_LAYOUT, "empty:hidden") }) }));
|
|
24
29
|
}
|
|
25
|
-
// The
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
30
|
+
// The right column sits beside the `<details>`, not in its `<summary>`: a control inside the summary would fold the
|
|
31
|
+
// row. To make the column exactly as high as the summary, the `<details>` holds only its summary and shares a grid
|
|
32
|
+
// row with the column (grid items stretch to their row); the opened content is the next row, shown while the
|
|
33
|
+
// details is open (`peer-open`). The details and the column carry the bar's light together, so they read as one box.
|
|
34
|
+
return (_jsxs("div", { "data-slot": "fold-row-with-actions", className: "group/fold-row-with-actions grid grid-cols-1 border-b border-border md:grid-cols-[minmax(0,1fr)_auto]", children: [_jsx(FoldRowDetails, { ...props, className: "peer/fold-row min-w-0 rounded-md transition-colors duration-120 group-hover/fold-row-with-actions:bg-accent open:bg-accent max-md:rounded-b-none md:rounded-r-none", isLitByRow: true }), _jsxs("div", { "data-slot": "fold-row-actions", className: "flex flex-wrap items-center gap-2 rounded-b-md pr-2 pb-1 pl-8 transition-colors duration-120 group-hover/fold-row-with-actions:bg-accent peer-open/fold-row:bg-accent md:flex-col md:flex-nowrap md:items-end md:justify-center md:gap-1 md:rounded-b-none md:rounded-r-md md:py-1 md:pl-0", children: [isDrawn(status) ? (_jsx("div", { "data-slot": "fold-row-status", className: "flex items-center", children: status })) : null, isDrawn(actions) ? (_jsx("div", { "data-slot": "fold-row-action-list", className: "flex items-center gap-1 max-md:*:min-h-touch-target max-md:*:min-w-touch-target", children: actions })) : null] }), _jsx(FoldRowContent, { ...props, className: cn("col-span-full hidden", isInset ? INSET_CONTENT_LAYOUT : CONTENT_LAYOUT, "peer-open/fold-row:not-empty:flex") })] }));
|
|
35
|
+
}
|
|
36
|
+
function FoldRowContent(props) {
|
|
37
|
+
const { isInset = false, children, className } = props;
|
|
38
|
+
return (_jsxs("div", { "data-slot": "fold-row-content", "data-inset": isInset, className: className, children: [props.details === undefined ? null : _jsx(DetailTable, { label: props.detailsLabel, rows: props.details }), children] }));
|
|
29
39
|
}
|
|
30
40
|
function FoldRowDetails(props) {
|
|
31
|
-
const {
|
|
32
|
-
return (_jsxs("details", { "data-slot": "fold-row", open: isOpenInitially || undefined, className: cn("group/fold-row", className), children: [_jsx("summary", { "data-slot": "fold-row-summary", className: cn("flex cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-
|
|
33
|
-
// With actions the bar continues under them: no rounding on the right, and hovering them lights it too.
|
|
34
|
-
hasActions && "rounded-r-none group-hover/fold-row-with-actions:bg-accent"), children: props.summary === undefined ? (_jsx(FoldRowFixedSummary, { title: props.title, facts: props.facts, badges: props.badges ?? [] })) : (_jsxs(_Fragment, { children: [_jsx(FoldRowChevron, {}), _jsx("span", { "data-slot": "fold-row-summary-slot", className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1", children: props.summary })] })) }), _jsxs("div", { "data-slot": "fold-row-content", "data-inset": isInset, className: isInset ? INSET_CONTENT_CLASS : CONTENT_CLASS, children: [props.details === undefined ? null : _jsx(DetailTable, { label: props.detailsLabel, rows: props.details }), children] })] }));
|
|
41
|
+
const { isOpenInitially = false, size = "default", className, isLitByRow = false, content } = props;
|
|
42
|
+
return (_jsxs("details", { "data-slot": "fold-row", open: isOpenInitially || undefined, className: cn("group/fold-row", className), children: [_jsx("summary", { "data-slot": "fold-row-summary", className: cn("flex cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-2 py-1", !isLitByRow && "transition-colors duration-120 group-open/fold-row:bg-accent hover:bg-accent", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none [&::-webkit-details-marker]:hidden", size === "touch" ? "min-h-touch-target" : "min-h-row-height"), children: props.summary === undefined ? (_jsx(FoldRowFixedSummary, { title: props.title, facts: props.facts, badges: props.badges ?? [] })) : (_jsxs(_Fragment, { children: [_jsx(FoldRowChevron, {}), _jsx("span", { "data-slot": "fold-row-summary-slot", className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1", children: props.summary })] })) }), content] }));
|
|
35
43
|
}
|
|
36
44
|
//# sourceMappingURL=FoldRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FoldRow.js","sourceRoot":"","sources":["../../src/notion/FoldRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"FoldRow.js","sourceRoot":"","sources":["../../src/notion/FoldRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AA+DpD,oHAAoH;AACpH,gFAAgF;AAChF,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAClD,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAE7D,SAAS,mBAAmB,CAAC,EAC3B,KAAK,EACL,KAAK,GAAG,EAAE,EACV,MAAM,GAKP;IACC,OAAO,CACL,8BAEE,6BAAgB,kBAAkB,EAAC,SAAS,EAAC,iCAAiC,aAC5E,KAAC,cAAc,KAAG,EAClB,eAAM,SAAS,EA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IAAI,EAAE,KAAK,CAAC,OAAO,GAAI,EACpG,QAAQ,IACL,CACP,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,KAMC;IAED,MAAM,EAAE,eAAe,GAAG,KAAK,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACpG,OAAO,CACL,gCAAmB,UAAU,EAAC,IAAI,EAAE,eAAe,IAAI,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,aAC1G,+BACY,kBAAkB,EAC5B,SAAS,EAAE,EAAE,CACX,2FAA2F,EAC3F,CAAC,UAAU,IAAI,8EAA8E,EAC7F,4GAA4G,EAC5G,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,kBAAkB,CAC7D,YAEA,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAC7B,KAAC,mBAAmB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,GAAI,CAC5F,CAAC,CAAC,CAAC,CACF,8BACE,KAAC,cAAc,KAAG,EAClB,4BACY,uBAAuB,EACjC,SAAS,EAAC,4DAA4D,YAErE,KAAK,CAAC,OAAO,GACT,IACN,CACJ,GACO,EACT,OAAO,IACA,CACX,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softure-ai/theme-notion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/notion/FoldRow.tsx
CHANGED
|
@@ -47,7 +47,7 @@ export type FoldRowDetailsProps =
|
|
|
47
47
|
|
|
48
48
|
export type FoldRowProps = FoldRowSummaryProps &
|
|
49
49
|
FoldRowDetailsProps & {
|
|
50
|
-
/** Indents the opened content to line up with the title after the chevron; by default it
|
|
50
|
+
/** Indents the opened content to line up with the title after the chevron; by default it starts under the chevron. */
|
|
51
51
|
readonly isInset?: boolean;
|
|
52
52
|
/** `touch` makes the summary at least the touch target high (44 px) instead of the row height. */
|
|
53
53
|
readonly size?: "default" | "touch";
|
|
@@ -59,15 +59,20 @@ export type FoldRowProps = FoldRowSummaryProps &
|
|
|
59
59
|
*/
|
|
60
60
|
readonly isOpenInitially?: boolean;
|
|
61
61
|
/**
|
|
62
|
-
* Controls
|
|
63
|
-
* it, so clicking
|
|
64
|
-
* is open or hovered
|
|
62
|
+
* Controls in the right column of the row's bar (a delete button, a menu). The column sits beside the `<summary>`,
|
|
63
|
+
* not in it, so clicking a control never folds the row; it spans the summary's full height and lights with it when
|
|
64
|
+
* the row is open or hovered, so the bar reads as one box. On a phone (below `md`) the column falls under the
|
|
65
|
+
* summary and each control is at least the touch target (44 px).
|
|
65
66
|
*/
|
|
66
67
|
readonly actions?: ReactNode;
|
|
68
|
+
/** The item's status, drawn in the same column above the actions (with no actions, the column holds only it). */
|
|
69
|
+
readonly status?: ReactNode;
|
|
67
70
|
};
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
// The bar and its opened content share one 8 px horizontal inset, so the details start under the chevron; the inset
|
|
73
|
+
// variant starts under the title instead (8 px inset, 16 px chevron, 8 px gap).
|
|
74
|
+
const CONTENT_LAYOUT = "flex-col gap-2 px-2 py-3";
|
|
75
|
+
const INSET_CONTENT_LAYOUT = "flex-col gap-2 py-2 pr-2 pl-8";
|
|
71
76
|
|
|
72
77
|
function FoldRowFixedSummary({
|
|
73
78
|
title,
|
|
@@ -123,42 +128,91 @@ function FoldRowChevron() {
|
|
|
123
128
|
);
|
|
124
129
|
}
|
|
125
130
|
|
|
131
|
+
function isDrawn(node: ReactNode): boolean {
|
|
132
|
+
return node !== undefined && node !== null;
|
|
133
|
+
}
|
|
134
|
+
|
|
126
135
|
// An item as one folding list row: a native `<details>` that opens in place to its details, with no client state.
|
|
127
136
|
export function FoldRow(props: FoldRowProps) {
|
|
128
|
-
const { actions,
|
|
129
|
-
if (actions
|
|
130
|
-
return
|
|
137
|
+
const { actions, status, isInset = false } = props;
|
|
138
|
+
if (!isDrawn(actions) && !isDrawn(status)) {
|
|
139
|
+
return (
|
|
140
|
+
<FoldRowDetails
|
|
141
|
+
{...props}
|
|
142
|
+
className="border-b border-border"
|
|
143
|
+
content={<FoldRowContent {...props} className={cn("flex", isInset ? INSET_CONTENT_LAYOUT : CONTENT_LAYOUT, "empty:hidden")} />}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
131
146
|
}
|
|
132
|
-
// The
|
|
133
|
-
//
|
|
134
|
-
//
|
|
147
|
+
// The right column sits beside the `<details>`, not in its `<summary>`: a control inside the summary would fold the
|
|
148
|
+
// row. To make the column exactly as high as the summary, the `<details>` holds only its summary and shares a grid
|
|
149
|
+
// row with the column (grid items stretch to their row); the opened content is the next row, shown while the
|
|
150
|
+
// details is open (`peer-open`). The details and the column carry the bar's light together, so they read as one box.
|
|
135
151
|
return (
|
|
136
|
-
<div
|
|
137
|
-
|
|
152
|
+
<div
|
|
153
|
+
data-slot="fold-row-with-actions"
|
|
154
|
+
className="group/fold-row-with-actions grid grid-cols-1 border-b border-border md:grid-cols-[minmax(0,1fr)_auto]"
|
|
155
|
+
>
|
|
156
|
+
<FoldRowDetails
|
|
157
|
+
{...props}
|
|
158
|
+
className="peer/fold-row min-w-0 rounded-md transition-colors duration-120 group-hover/fold-row-with-actions:bg-accent open:bg-accent max-md:rounded-b-none md:rounded-r-none"
|
|
159
|
+
isLitByRow
|
|
160
|
+
/>
|
|
138
161
|
<div
|
|
139
162
|
data-slot="fold-row-actions"
|
|
140
|
-
className=
|
|
141
|
-
"flex shrink-0 items-center gap-1 rounded-r-md pr-1 transition-colors duration-120 group-hover/fold-row-with-actions:bg-accent peer-open/fold-row:bg-accent",
|
|
142
|
-
size === "touch" ? "min-h-touch-target" : "min-h-row-height",
|
|
143
|
-
)}
|
|
163
|
+
className="flex flex-wrap items-center gap-2 rounded-b-md pr-2 pb-1 pl-8 transition-colors duration-120 group-hover/fold-row-with-actions:bg-accent peer-open/fold-row:bg-accent md:flex-col md:flex-nowrap md:items-end md:justify-center md:gap-1 md:rounded-b-none md:rounded-r-md md:py-1 md:pl-0"
|
|
144
164
|
>
|
|
145
|
-
{
|
|
165
|
+
{isDrawn(status) ? (
|
|
166
|
+
<div data-slot="fold-row-status" className="flex items-center">
|
|
167
|
+
{status}
|
|
168
|
+
</div>
|
|
169
|
+
) : null}
|
|
170
|
+
{isDrawn(actions) ? (
|
|
171
|
+
<div
|
|
172
|
+
data-slot="fold-row-action-list"
|
|
173
|
+
className="flex items-center gap-1 max-md:*:min-h-touch-target max-md:*:min-w-touch-target"
|
|
174
|
+
>
|
|
175
|
+
{actions}
|
|
176
|
+
</div>
|
|
177
|
+
) : null}
|
|
146
178
|
</div>
|
|
179
|
+
<FoldRowContent
|
|
180
|
+
{...props}
|
|
181
|
+
className={cn("col-span-full hidden", isInset ? INSET_CONTENT_LAYOUT : CONTENT_LAYOUT, "peer-open/fold-row:not-empty:flex")}
|
|
182
|
+
/>
|
|
147
183
|
</div>
|
|
148
184
|
);
|
|
149
185
|
}
|
|
150
186
|
|
|
151
|
-
function
|
|
152
|
-
const { isInset = false,
|
|
187
|
+
function FoldRowContent(props: FoldRowProps & { readonly className: string }) {
|
|
188
|
+
const { isInset = false, children, className } = props;
|
|
189
|
+
return (
|
|
190
|
+
<div data-slot="fold-row-content" data-inset={isInset} className={className}>
|
|
191
|
+
{props.details === undefined ? null : <DetailTable label={props.detailsLabel} rows={props.details} />}
|
|
192
|
+
{children}
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function FoldRowDetails(
|
|
198
|
+
props: FoldRowProps & {
|
|
199
|
+
readonly className: string;
|
|
200
|
+
/** The summary lights on its own, or the wrapper lights the whole details (with the right column). */
|
|
201
|
+
readonly isLitByRow?: boolean;
|
|
202
|
+
/** The opened content, when it lives inside the details. */
|
|
203
|
+
readonly content?: ReactNode;
|
|
204
|
+
},
|
|
205
|
+
) {
|
|
206
|
+
const { isOpenInitially = false, size = "default", className, isLitByRow = false, content } = props;
|
|
153
207
|
return (
|
|
154
208
|
<details data-slot="fold-row" open={isOpenInitially || undefined} className={cn("group/fold-row", className)}>
|
|
155
209
|
<summary
|
|
156
210
|
data-slot="fold-row-summary"
|
|
157
211
|
className={cn(
|
|
158
|
-
"flex cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-
|
|
212
|
+
"flex cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-2 py-1",
|
|
213
|
+
!isLitByRow && "transition-colors duration-120 group-open/fold-row:bg-accent hover:bg-accent",
|
|
214
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none [&::-webkit-details-marker]:hidden",
|
|
159
215
|
size === "touch" ? "min-h-touch-target" : "min-h-row-height",
|
|
160
|
-
// With actions the bar continues under them: no rounding on the right, and hovering them lights it too.
|
|
161
|
-
hasActions && "rounded-r-none group-hover/fold-row-with-actions:bg-accent",
|
|
162
216
|
)}
|
|
163
217
|
>
|
|
164
218
|
{props.summary === undefined ? (
|
|
@@ -175,10 +229,7 @@ function FoldRowDetails(props: FoldRowProps & { readonly className: string; read
|
|
|
175
229
|
</>
|
|
176
230
|
)}
|
|
177
231
|
</summary>
|
|
178
|
-
|
|
179
|
-
{props.details === undefined ? null : <DetailTable label={props.detailsLabel} rows={props.details} />}
|
|
180
|
-
{children}
|
|
181
|
-
</div>
|
|
232
|
+
{content}
|
|
182
233
|
</details>
|
|
183
234
|
);
|
|
184
235
|
}
|