@softure-ai/theme-notion 0.34.0 → 0.36.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 +24 -0
- package/README.md +51 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/messages/en.d.ts +3 -0
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/messages/en.js +1 -0
- package/dist/messages/en.js.map +1 -1
- package/dist/messages/index.d.ts +3 -0
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/notion/List.d.ts +13 -2
- package/dist/notion/List.d.ts.map +1 -1
- package/dist/notion/List.js +10 -3
- package/dist/notion/List.js.map +1 -1
- package/dist/notion/ResultBadge.d.ts +8 -3
- package/dist/notion/ResultBadge.d.ts.map +1 -1
- package/dist/notion/ResultBadge.js +2 -2
- package/dist/notion/ResultBadge.js.map +1 -1
- package/dist/notion/RowActionsMenu.d.ts +59 -0
- package/dist/notion/RowActionsMenu.d.ts.map +1 -0
- package/dist/notion/RowActionsMenu.js +84 -0
- package/dist/notion/RowActionsMenu.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +7 -0
- package/src/messages/en.ts +1 -0
- package/src/notion/List.tsx +29 -4
- package/src/notion/ResultBadge.tsx +9 -3
- package/src/notion/RowActionsMenu.tsx +243 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ 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.36.0
|
|
8
|
+
|
|
9
|
+
- `RowActionsMenu` (#1492): a destructive `onSelect` may return a promise (a server action); with `confirm` the
|
|
10
|
+
dialog stays open while it is pending, both buttons disabled and the confirm button showing `confirm.pendingLabel`
|
|
11
|
+
("Deleting…"), closes when it resolves and stays open when it rejects. `RowMenuAction.opensDialog` leaves focus to
|
|
12
|
+
the app's own dialog when the menu closes, and `triggerRef` reaches the menu button so that dialog can return focus
|
|
13
|
+
to it. Below `md` every item is the 44 px touch target; `id` on an action renders as `data-row-action` for browser
|
|
14
|
+
tests.
|
|
15
|
+
- `ResultBadge` (#1493): every other `span` prop (`data-*`, `id`, ARIA) reaches the badge, so an app marks a badge
|
|
16
|
+
with what it shows (`data-read-status="ok"`) without wrapping it. The theme's `data-slot`, `data-tone`,
|
|
17
|
+
`data-color` and `data-spinning` stay the theme's.
|
|
18
|
+
|
|
19
|
+
## 0.35.0
|
|
20
|
+
|
|
21
|
+
- `RowActionsMenu` (#1486): a row's overflow menu. An icon-only "More actions" button (`label` for the app's words)
|
|
22
|
+
opens a `DropdownMenu` of `actions`; `destructiveAction` is last, after a separator, in the danger tone, and with
|
|
23
|
+
`confirm` opens an `AlertDialog` first and runs only on the destructive confirm, focus returning to the button.
|
|
24
|
+
- `ListEntry` (#1486): a `menu` slot at the end of the actions line; the inline control and the menu button stay on
|
|
25
|
+
one line, each at least 44 px on a phone. The docs state the rules: at most one control inline, the rest in the
|
|
26
|
+
menu (a row with a single action keeps it inline); each fact once (a switch is its own state, a `ResultBadge` its own
|
|
27
|
+
icon). The phone's 44 px rule no longer stretches a switch's track into a blob: a `Switch size="touch"` keeps its
|
|
28
|
+
square beside the menu.
|
|
29
|
+
- Migration: an app that built its own row overflow menu replaces it with `menu={<RowActionsMenu … />}`.
|
|
30
|
+
|
|
7
31
|
## 0.34.0
|
|
8
32
|
|
|
9
33
|
- `ListEntry` (#1481): a list row with an identity and a right column. `title` and `details` (the lines under it) on
|
package/README.md
CHANGED
|
@@ -158,6 +158,7 @@ stages with a state, below), `Timeline` (dated entries on a vertical rail, below
|
|
|
158
158
|
`SortableList`, `SortableItem`, `SortableHandle` and `SortableActivator` (rows reordered by dragging, below),
|
|
159
159
|
`List`, `ListItem` and `ListRow` (a list of rows, compact or roomy by the page's density, below),
|
|
160
160
|
`ListEntry` (a list row with an identity and a right column, its state over its controls, below),
|
|
161
|
+
`RowActionsMenu` (a row's other actions behind a "More actions" button, the destructive one last and confirmed, below),
|
|
161
162
|
`ListGroup` and `ListGroupHeading` (a run of rows under a heading that sticks at the top of its scroll, below),
|
|
162
163
|
`MiniProgress` (a compact bar with its figure inside, for a table cell or a tile, below),
|
|
163
164
|
`UpdatePrompt` (the offer to reload into a new build, for an installed app, below),
|
|
@@ -554,17 +555,66 @@ follows the list's density.
|
|
|
554
555
|
</List>
|
|
555
556
|
```
|
|
556
557
|
|
|
558
|
+
**Row controls and row state.** A row shows at most one control inline in `actions`: a switch, or the row's one
|
|
559
|
+
primary action. Every other action goes into `menu`, a `RowActionsMenu` on the same line: an icon-only "More actions"
|
|
560
|
+
button (its name from `label`, English by default) that opens a menu of `actions`, with `destructiveAction` last,
|
|
561
|
+
after a separator, in the danger tone. Give the destructive action a `confirm` (`title`, `description`,
|
|
562
|
+
`confirmLabel`, `cancelLabel`) and it opens an alert dialog first, running only on the destructive confirm; focus goes
|
|
563
|
+
back to the menu button. A destructive `onSelect` that returns a promise (a server action) keeps the dialog open with
|
|
564
|
+
both buttons disabled and `confirm.pendingLabel` ("Deleting…") on the confirm button until it settles: it closes on
|
|
565
|
+
success and stays open on failure, where the app shows its own error. An action that opens the app's own dialog sets
|
|
566
|
+
`opensDialog`, so the menu leaves focus to that dialog; pass `triggerRef` and return focus to the menu button from the
|
|
567
|
+
dialog's `onCloseAutoFocus`. Below `md` every item is the 44 px touch target; an action's `id` renders as
|
|
568
|
+
`data-row-action` for browser tests. The menu opens with Enter, Space or ArrowDown, and the arrow keys move between items. A row
|
|
569
|
+
with a single action keeps it inline and has no menu. The inline control and the menu button never wrap apart, and on
|
|
570
|
+
a phone each is at least the touch target (44 px): pass the switch `size="touch"` (with `className="md:m-0 md:h-4
|
|
571
|
+
md:w-[26px]"` for the plain switch on a desktop), since the row never stretches a switch's track. Each fact is said once: a switch is its own on/off state, so no
|
|
572
|
+
badge or label repeats it; a `ResultBadge` carries its own icon, so no separate state icon stands next to it.
|
|
573
|
+
|
|
574
|
+
```tsx
|
|
575
|
+
<ListEntry
|
|
576
|
+
title={hook.name}
|
|
577
|
+
details={<span>{hook.url}</span>}
|
|
578
|
+
status={<ResultBadge tone={TONE_BY_RESULT[hook.lastResult]}>{hook.lastResultLabel}</ResultBadge>}
|
|
579
|
+
actions={<Switch size="touch" className="md:m-0 md:h-4 md:w-[26px]" checked={hook.isOn} onCheckedChange={toggle} aria-label={t.hooks.enabled} />}
|
|
580
|
+
menu={
|
|
581
|
+
<RowActionsMenu
|
|
582
|
+
label={t.rows.more}
|
|
583
|
+
actions={[
|
|
584
|
+
{ label: t.hooks.test, onSelect: test },
|
|
585
|
+
{ id: "replace-token", label: t.hooks.replaceToken, onSelect: openReplaceDialog, opensDialog: true },
|
|
586
|
+
]}
|
|
587
|
+
triggerRef={menuButton}
|
|
588
|
+
destructiveAction={{
|
|
589
|
+
id: "delete",
|
|
590
|
+
label: t.hooks.delete,
|
|
591
|
+
onSelect: () => deleteHook(hook.id),
|
|
592
|
+
confirm: {
|
|
593
|
+
title: t.hooks.deleteTitle,
|
|
594
|
+
confirmLabel: t.hooks.delete,
|
|
595
|
+
pendingLabel: t.hooks.deleting,
|
|
596
|
+
cancelLabel: t.common.cancel,
|
|
597
|
+
},
|
|
598
|
+
}}
|
|
599
|
+
/>
|
|
600
|
+
}
|
|
601
|
+
/>
|
|
602
|
+
```
|
|
603
|
+
|
|
557
604
|
**`ResultBadge`: a result in its tone.** A result (passed, failed, skipped, running) as a filled tag in its tone's
|
|
558
605
|
colour (`TONE_COLORS`: `success` green, `warning` orange, `danger` red, `muted` gray, `default` the default tag), with
|
|
559
606
|
the tone's icon (`RESULT_BADGE_ICONS`: `CircleCheck`, `TriangleAlert`, `CircleX`, `CircleMinus`, `Circle`; pass
|
|
560
607
|
`icon` for another) and always a word. The app keeps its own table of which result takes which tone; the theme owns
|
|
561
608
|
the colours, so "failed" is red in every list. `isSpinning` marks a run still in progress: the icon (a
|
|
562
609
|
`LoaderCircle` unless `icon` is given) spins with `motion-safe:animate-spin`, still for a reader who asked for reduced
|
|
563
|
-
motion. `Status` is the ghost counterpart, for a state written in text colour.
|
|
610
|
+
motion. `Status` is the ghost counterpart, for a state written in text colour. Every other `span` prop (`data-*`,
|
|
611
|
+
`id`, ARIA) reaches the badge, so an app marks it with what it shows and its tests read that; the theme's own
|
|
612
|
+
`data-slot`, `data-tone`, `data-color` and `data-spinning` always win.
|
|
564
613
|
|
|
565
614
|
```tsx
|
|
566
615
|
<ResultBadge tone="danger">Failed</ResultBadge>
|
|
567
616
|
<ResultBadge tone="muted" isSpinning>Running</ResultBadge>
|
|
617
|
+
<ResultBadge tone="success" data-read-status="ok">Read</ResultBadge>
|
|
568
618
|
```
|
|
569
619
|
|
|
570
620
|
**`ListGroup`, `ListGroupHeading`: a sticky group heading.** A heading over a run of rows (a country's days, a month's
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export { StatCards, StatPills, StatsFold, type StatCard, type StatCardAside, typ
|
|
|
70
70
|
export { FileInput, type FileInputMessages, type FileInputMessagesOverride, type FileInputProps } from "./notion/FileInput.js";
|
|
71
71
|
export { FormGrid, type FormGridColumns, type FormGridProps } from "./notion/FormGrid.js";
|
|
72
72
|
export { RESULT_BADGE_ICONS, ResultBadge, type ResultBadgeProps } from "./notion/ResultBadge.js";
|
|
73
|
+
export { RowActionsMenu, type RowActionsMenuProps, type RowMenuAction, type RowMenuConfirmation, type RowMenuDestructiveAction, } from "./notion/RowActionsMenu.js";
|
|
73
74
|
export { Status, type StatusProps } from "./notion/Status.js";
|
|
74
75
|
export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps } from "./notion/Steps.js";
|
|
75
76
|
export { TabBar, type TabBarItem, type TabBarProps } from "./notion/TabBar.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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C;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ export { StatCards, StatPills, StatsFold, } from "./notion/Stats.js";
|
|
|
72
72
|
export { FileInput } from "./notion/FileInput.js";
|
|
73
73
|
export { FormGrid } from "./notion/FormGrid.js";
|
|
74
74
|
export { RESULT_BADGE_ICONS, ResultBadge } from "./notion/ResultBadge.js";
|
|
75
|
+
export { RowActionsMenu, } from "./notion/RowActionsMenu.js";
|
|
75
76
|
export { Status } from "./notion/Status.js";
|
|
76
77
|
export { Steps } from "./notion/Steps.js";
|
|
77
78
|
export { TabBar } from "./notion/TabBar.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,oGAAoG;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAuB,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,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AE,SAAS;iBAAE,IAAI,EAAE,OAAO;iBAAE,MAAM,EAAE,QAAQ;;aAC1E,OAAO;iBAAI,KAAK,EAAE,iBAAiB;iBAAE,WAAW,EAAE,gCAAgC;;CAC1E,CAAC"}
|
package/dist/messages/en.js
CHANGED
|
@@ -12,6 +12,7 @@ export const en = {
|
|
|
12
12
|
},
|
|
13
13
|
breadcrumb: { label: "breadcrumb", more: "More" },
|
|
14
14
|
copy: { copy: "Copy", copied: "Copied" },
|
|
15
|
+
rowActions: { more: "More actions" },
|
|
15
16
|
dialog: { close: "Close" },
|
|
16
17
|
fileInput: { choose: "Choose a file", chooseMany: "Choose files", none: "No file chosen", count: "{count} files" },
|
|
17
18
|
filterChip: { add: "Add filter" },
|
package/dist/messages/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,UAAU,EAAE;QACV,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kCAAkC;KAChD;IACD,UAAU,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE;IACjD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE;IACxC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;IAC1B,SAAS,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE;IAClH,UAAU,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE;IACjC,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;IACzB,SAAS,EAAE,EAAE,KAAK,EAAE,OA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SAAS,EAAE,eAAe;QAC1B,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,iBAAiB;QAC1B,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,cAAc;QACrB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,kBAAkB;QAC5B,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;KACjB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,eAAe;QAC1B,YAAY,EAAE,QAAQ;QACtB,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,sBAAsB;QAC/B,MAAM,EAAE,gCAAgC;QACxC,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,mBAAmB;QAC5B,IAAI,EAAE,MAAM;KACb;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;IAC5E,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,gCAAgC,EAAE;CAC5E,CAAC"}
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG,OAAO,EAAE,CAAC"}
|
package/dist/notion/List.d.ts
CHANGED
|
@@ -63,10 +63,16 @@ export type ListEntryProps = Omit<ComponentProps<"div">, "title" | "children"> &
|
|
|
63
63
|
readonly status?: ReactNode;
|
|
64
64
|
/**
|
|
65
65
|
* The row's controls, under the status. They stay their own targets above the row's link, and are at least the
|
|
66
|
-
* touch target (44 px) on a phone
|
|
66
|
+
* touch target (44 px) on a phone; a switch keeps its track and takes its 44 px square from `size="touch"` (with
|
|
67
|
+
* `className="md:m-0 md:h-4 md:w-[26px]"` for the plain switch on a desktop). A control marked `data-row-wide` (an inline form that needs room) makes the right
|
|
67
68
|
* column take the full row width under the identity, its lines starting on the left.
|
|
68
69
|
*/
|
|
69
70
|
readonly actions?: ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* The row's other actions behind a "More actions" button (a `RowActionsMenu`), at the end of the actions line: it
|
|
73
|
+
* stays on one line with the inline control and is at least the touch target (44 px) on a phone.
|
|
74
|
+
*/
|
|
75
|
+
readonly menu?: ReactNode;
|
|
70
76
|
/** The row opens this address: the title's link is stretched over the whole row, with an arrow at its right. */
|
|
71
77
|
readonly href?: string;
|
|
72
78
|
/** The element for the link (a router's link component); a plain `a` by default. */
|
|
@@ -77,8 +83,13 @@ export type ListEntryProps = Omit<ComponentProps<"div">, "title" | "children"> &
|
|
|
77
83
|
* top of the right column and its controls under it. With `href` the title is a link stretched over the whole row, so
|
|
78
84
|
* the row is one box lit on hover, and an arrow sits beside the column (never on a line of its own); the column stays
|
|
79
85
|
* above the link. On a phone (below `md`) the column wraps under the identity, right-aligned. Place it in a `ListItem`.
|
|
86
|
+
*
|
|
87
|
+
* Row controls: at most one control inline in `actions` (a switch, or the row's one primary action); every other
|
|
88
|
+
* action goes into `menu`, the destructive one last. A row with a single action keeps it inline and has no menu.
|
|
89
|
+
* Row state: each fact once. A switch is its own on/off state (no badge or label repeating it); a `ResultBadge`
|
|
90
|
+
* carries its own icon, so no separate state icon stands next to it.
|
|
80
91
|
*/
|
|
81
|
-
export declare function ListEntry({ title, details, status, actions, href, linkComponent: Link, className, ...props }: ListEntryProps): import("react").JSX.Element;
|
|
92
|
+
export declare function ListEntry({ title, details, status, actions, menu, href, linkComponent: Link, className, ...props }: ListEntryProps): import("react").JSX.Element;
|
|
82
93
|
export type ListGroupProps = ComponentProps<"div"> & {
|
|
83
94
|
/** Renders the child element (a `section`, an app's own `li`) with the group's classes. */
|
|
84
95
|
readonly asChild?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/notion/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY;aACvB,IAAI,EAAE,oEAAoE;aAC1E,UAAU,EAAE,wEAAwE;aACpF,IAAI,EAAE,oBAAoB;aAC1B,GAAG,EAAE,uPAAuP;aAC5P,KAAK,EAAE,4CAA4C;aACnD,YAAY,EACV,kIAAkI;aACpI,kBAAkB,EAChB,qIAAqI;CAC/H,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5C,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG;IAC1D,kDAAkD;IAClD,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,oFAAoF;IACpF,QAAQ,CAAC,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AAC,GAAG;IACnD,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,OAAe,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,+BAGjF;AAED,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC1D,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAC/B,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,4GAA4G;AAC5G,wBAAgB,gBAAgB,CAAC,EAAE,OAAgB,EAAE,OAAe,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,+BAUjH"}
|
package/dist/notion/List.js
CHANGED
|
@@ -50,14 +50,21 @@ function isDrawn(node) {
|
|
|
50
50
|
* top of the right column and its controls under it. With `href` the title is a link stretched over the whole row, so
|
|
51
51
|
* the row is one box lit on hover, and an arrow sits beside the column (never on a line of its own); the column stays
|
|
52
52
|
* above the link. On a phone (below `md`) the column wraps under the identity, right-aligned. Place it in a `ListItem`.
|
|
53
|
+
*
|
|
54
|
+
* Row controls: at most one control inline in `actions` (a switch, or the row's one primary action); every other
|
|
55
|
+
* action goes into `menu`, the destructive one last. A row with a single action keeps it inline and has no menu.
|
|
56
|
+
* Row state: each fact once. A switch is its own on/off state (no badge or label repeating it); a `ResultBadge`
|
|
57
|
+
* carries its own icon, so no separate state icon stands next to it.
|
|
53
58
|
*/
|
|
54
|
-
export function ListEntry({ title, details, status, actions, href, linkComponent: Link = "a", className, ...props }) {
|
|
59
|
+
export function ListEntry({ title, details, status, actions, menu, href, linkComponent: Link = "a", className, ...props }) {
|
|
55
60
|
const hasStatus = isDrawn(status);
|
|
56
61
|
const hasActions = isDrawn(actions);
|
|
57
|
-
const
|
|
62
|
+
const hasMenu = isDrawn(menu);
|
|
63
|
+
const hasControls = hasActions || hasMenu;
|
|
64
|
+
const hasColumn = hasStatus || hasControls;
|
|
58
65
|
const hasLink = href !== undefined;
|
|
59
66
|
const titleClasses = "min-w-0 text-ui-medium text-foreground";
|
|
60
|
-
return (_jsxs("div", { "data-slot": "list-entry", className: cn("relative flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-2 py-(--list-row-y) text-ui transition-colors duration-100 hover:bg-accent", "has-[[data-slot=list-entry-title]:focus-visible]:ring-2 has-[[data-slot=list-entry-title]:focus-visible]:ring-ring", className), ...props, children: [_jsxs("div", { "data-slot": "list-entry-identity", className: "flex min-w-0 flex-1 basis-48 flex-col gap-0.5 max-md:basis-full", children: [hasLink ? (_jsx(Link, { "data-slot": "list-entry-title", href: href, className: cn(titleClasses, "outline-none after:absolute after:inset-0 after:rounded-md after:content-['']"), children: title })) : (_jsx("span", { "data-slot": "list-entry-title", className: titleClasses, children: title })), isDrawn(details) ? (_jsx("div", { "data-slot": "list-entry-details", className: "flex min-w-0 flex-col text-ui text-muted-foreground", children: details })) : null] }), hasColumn || hasLink ? (_jsxs("div", { "data-slot": "list-entry-side", className: "group/list-entry-side pointer-events-none relative z-10 ml-auto flex max-w-full min-w-0 flex-nowrap items-center gap-2 has-[[data-row-wide]]:ml-0 has-[[data-row-wide]]:basis-full", children: [hasColumn ? (_jsxs("div", { "data-slot": "list-entry-column", className: "flex min-w-0 flex-col items-end gap-1 has-[[data-row-wide]]:flex-1 has-[[data-row-wide]]:items-stretch", children: [hasStatus ? (_jsx("div", { "data-slot": "list-entry-status", className: "pointer-events-auto flex min-w-0 flex-wrap items-center justify-end gap-1 group-has-[[data-row-wide]]/list-entry-side:justify-start", children: status })) : null,
|
|
67
|
+
return (_jsxs("div", { "data-slot": "list-entry", className: cn("relative flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-2 py-(--list-row-y) text-ui transition-colors duration-100 hover:bg-accent", "has-[[data-slot=list-entry-title]:focus-visible]:ring-2 has-[[data-slot=list-entry-title]:focus-visible]:ring-ring", className), ...props, children: [_jsxs("div", { "data-slot": "list-entry-identity", className: "flex min-w-0 flex-1 basis-48 flex-col gap-0.5 max-md:basis-full", children: [hasLink ? (_jsx(Link, { "data-slot": "list-entry-title", href: href, className: cn(titleClasses, "outline-none after:absolute after:inset-0 after:rounded-md after:content-['']"), children: title })) : (_jsx("span", { "data-slot": "list-entry-title", className: titleClasses, children: title })), isDrawn(details) ? (_jsx("div", { "data-slot": "list-entry-details", className: "flex min-w-0 flex-col text-ui text-muted-foreground", children: details })) : null] }), hasColumn || hasLink ? (_jsxs("div", { "data-slot": "list-entry-side", className: "group/list-entry-side pointer-events-none relative z-10 ml-auto flex max-w-full min-w-0 flex-nowrap items-center gap-2 has-[[data-row-wide]]:ml-0 has-[[data-row-wide]]:basis-full", children: [hasColumn ? (_jsxs("div", { "data-slot": "list-entry-column", className: "flex min-w-0 flex-col items-end gap-1 has-[[data-row-wide]]:flex-1 has-[[data-row-wide]]:items-stretch", children: [hasStatus ? (_jsx("div", { "data-slot": "list-entry-status", className: "pointer-events-auto flex min-w-0 flex-wrap items-center justify-end gap-1 group-has-[[data-row-wide]]/list-entry-side:justify-start", children: status })) : null, hasControls ? (_jsxs("div", { "data-slot": "list-entry-actions", className: cn("pointer-events-auto flex min-w-0 items-center justify-end gap-1 has-[[data-row-wide]]:flex-col has-[[data-row-wide]]:items-stretch has-[[data-row-wide]]:justify-start max-md:*:not-data-[slot=switch]:min-h-touch-target max-md:*:not-data-[slot=switch]:min-w-touch-target max-md:*:data-[slot=switch]:mx-0", hasMenu ? "flex-nowrap" : "flex-wrap"), children: [actions, hasMenu ? (_jsx("div", { "data-slot": "list-entry-menu", className: "flex shrink-0 items-center justify-center max-md:*:min-h-touch-target max-md:*:min-w-touch-target", children: menu })) : null] })) : null] })) : null, hasLink ? (_jsx("span", { "data-slot": "list-entry-arrow", "aria-hidden": "true", className: "flex shrink-0 text-muted-foreground", children: _jsx(ChevronRight, { strokeWidth: ICON_STROKE_WIDTH, className: "size-4" }) })) : null] })) : null] }));
|
|
61
68
|
}
|
|
62
69
|
/**
|
|
63
70
|
* A run of rows under a `ListGroupHeading` (a country's days, a month's entries), placed straight in the scroll
|
package/dist/notion/List.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/notion/List.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,oEAAoE;IAC1E,UAAU,EAAE,wEAAwE;IACpF,IAAI,EAAE,oBAAoB;IAC1B,GAAG,EAAE,uPAAuP;IAC5P,KAAK,EAAE,4CAA4C;IACnD,YAAY,EACV,kIAAkI;IACpI,kBAAkB,EAChB,qIAAqI;CAC/H,CAAC;AAaX;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAa;IACpG,OAAO,CACL,KAAC,OAAO,iBACI,MAAM,kBACF,OAAO,kBACP,OAAO,EACrB,SAAS,EAAE,EAAE,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,KACxF,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAOD,+EAA+E;AAC/E,MAAM,UAAU,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS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,CAAC,KAAK,CAAC;IACzC,OAAO,CACL,KAAC,IAAI,iBACO,oBAAoB,kBAChB,OAAO,EACrB,SAAS,EAAE,EAAE,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,KACxG,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type LucideIcon } from "lucide-react";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
3
3
|
import { type Tone } from "./tones.js";
|
|
4
4
|
/** The icon a result badge draws for each tone when the app passes none. */
|
|
5
5
|
export declare const RESULT_BADGE_ICONS: Readonly<Record<Tone, LucideIcon>>;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The badge's remaining `span` props (`data-*`, `id`, ARIA, handlers) reach the element, so an app can mark a badge with
|
|
8
|
+
* what it shows (`data-read-status="ok"`). The theme's own `data-slot`, `data-tone`, `data-color` and `data-spinning`
|
|
9
|
+
* always win, and the look (`variant`, `color`) is the theme's.
|
|
10
|
+
*/
|
|
11
|
+
export interface ResultBadgeProps extends Omit<ComponentProps<"span">, "color" | "children" | "title" | "className"> {
|
|
7
12
|
/** What the result means; the theme owns its colour (`TONE_COLORS`), so one result reads alike in every list. */
|
|
8
13
|
readonly tone: Tone;
|
|
9
14
|
/** The app's own icon in place of the tone's default (a spinning run defaults to a loader). */
|
|
@@ -16,5 +21,5 @@ export interface ResultBadgeProps {
|
|
|
16
21
|
readonly title?: string;
|
|
17
22
|
readonly className?: string;
|
|
18
23
|
}
|
|
19
|
-
export declare function ResultBadge({ tone, icon, isSpinning, children, title, className }: ResultBadgeProps): import("react").JSX.Element;
|
|
24
|
+
export declare function ResultBadge({ tone, icon, isSpinning, children, title, className, ...attributes }: ResultBadgeProps): import("react").JSX.Element;
|
|
20
25
|
//# sourceMappingURL=ResultBadge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultBadge.d.ts","sourceRoot":"","sources":["../../src/notion/ResultBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0E,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ResultBadge.d.ts","sourceRoot":"","sources":["../../src/notion/ResultBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0E,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvD,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpD,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAMjE,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,CAAC;IAClH,iHAAiH;IACjH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,kGAAkG;IAClG,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AASD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,EAAE,gBAAgB,+BAoB1H"}
|
|
@@ -18,8 +18,8 @@ function getPlainText(children) {
|
|
|
18
18
|
}
|
|
19
19
|
// A result (passed, failed, skipped, running): a filled tag in its tone's colour, with an icon and a word. The filled
|
|
20
20
|
// counterpart of `Status`, for a list whose rows each end in a result.
|
|
21
|
-
export function ResultBadge({ tone, icon, isSpinning = false, children, title, className }) {
|
|
21
|
+
export function ResultBadge({ tone, icon, isSpinning = false, children, title, className, ...attributes }) {
|
|
22
22
|
const Icon = icon ?? (isSpinning ? LoaderCircle : RESULT_BADGE_ICONS[tone]);
|
|
23
|
-
return (_jsxs(Badge, { variant: "tag", color: TONE_COLORS[tone] ?? "default", "data-slot": "result-badge", "data-tone": tone, "data-color": TONE_COLORS[tone] ?? "default", "data-spinning": isSpinning || undefined, title: title ?? getPlainText(children), className: cn("gap-1 [&>svg]:size-3.5 [&>svg]:shrink-0", className), children: [_jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: isSpinning ? "motion-safe:animate-spin" : undefined }), _jsx("span", { "data-slot": "result-badge-label", className: "min-w-0 truncate", children: children })] }));
|
|
23
|
+
return (_jsxs(Badge, { ...attributes, variant: "tag", color: TONE_COLORS[tone] ?? "default", "data-slot": "result-badge", "data-tone": tone, "data-color": TONE_COLORS[tone] ?? "default", "data-spinning": isSpinning || undefined, title: title ?? getPlainText(children), className: cn("gap-1 [&>svg]:size-3.5 [&>svg]:shrink-0", className), children: [_jsx(Icon, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH, className: isSpinning ? "motion-safe:animate-spin" : undefined }), _jsx("span", { "data-slot": "result-badge-label", className: "min-w-0 truncate", children: children })] }));
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=ResultBadge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultBadge.js","sourceRoot":"","sources":["../../src/notion/ResultBadge.tsx"],"names":[],"mappings":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CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrG,CAAC;AAED,sHAAsH;AACtH,uEAAuE;AACvE,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,GAAG,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,UAAU,EAAoB;IACzH,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5E,OAAO,CACL,MAAC,KAAK,OACA,UAAU,EACd,OAAO,EAAC,KAAK,EACb,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,SAAS,eAC3B,cAAc,eACb,IAAI,gBACH,WAAW,CAAC,IAAI,CAAC,IAAI,SAAS,mBAC3B,UAAU,IAAI,SAAS,EACtC,KAAK,EAAE,KAAK,IAAI,YAAY,CAAC,QAAQ,CAAC,EACtC,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,aAEnE,KAAC,IAAI,mBAAa,MAAM,EAAC,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,SAAS,GAAI,EAC3H,4BAAgB,oBAAoB,EAAC,SAAS,EAAC,kBAAkB,YAC9D,QAAQ,GACJ,IACD,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
/** One secondary action of a row: its words, an optional icon, and what it does. */
|
|
3
|
+
export interface RowMenuAction {
|
|
4
|
+
/** A stable hook for browser tests, rendered as `data-row-action` on the item. */
|
|
5
|
+
readonly id?: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
/** A line icon before the words (the theme's stroke and size apply). */
|
|
8
|
+
readonly icon?: ReactNode;
|
|
9
|
+
readonly onSelect: () => void;
|
|
10
|
+
readonly isDisabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The action opens the app's own dialog: the menu leaves focus to that dialog when it closes instead of taking it
|
|
13
|
+
* back to its button. Return focus to the button from the dialog's `onCloseAutoFocus` through `triggerRef`.
|
|
14
|
+
*/
|
|
15
|
+
readonly opensDialog?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** The confirmation a destructive action asks for: the app's own copy. */
|
|
18
|
+
export interface RowMenuConfirmation {
|
|
19
|
+
readonly title: ReactNode;
|
|
20
|
+
readonly description?: ReactNode;
|
|
21
|
+
/** The words of the destructive confirm button. */
|
|
22
|
+
readonly confirmLabel: string;
|
|
23
|
+
/** The words of the confirm button while an async action runs ("Deleting…"); `confirmLabel` when not given. */
|
|
24
|
+
readonly pendingLabel?: string;
|
|
25
|
+
/** The words of the button that keeps things as they are. */
|
|
26
|
+
readonly cancelLabel: string;
|
|
27
|
+
}
|
|
28
|
+
/** The destructive action of a row (delete, revoke): last in the menu, in the danger tone. */
|
|
29
|
+
export interface RowMenuDestructiveAction extends Omit<RowMenuAction, "onSelect"> {
|
|
30
|
+
/**
|
|
31
|
+
* What the action does. With `confirm` it may return a promise (a server action): the dialog then stays open with
|
|
32
|
+
* both buttons disabled and `pendingLabel` on the confirm button until it settles, closes when it resolves and stays
|
|
33
|
+
* open when it rejects. The app reports the error itself; the menu only keeps the dialog open.
|
|
34
|
+
*/
|
|
35
|
+
readonly onSelect: () => void | Promise<unknown>;
|
|
36
|
+
/** Ask first: the action runs only after the alert dialog's confirm button. Without it the action runs at once. */
|
|
37
|
+
readonly confirm?: RowMenuConfirmation;
|
|
38
|
+
}
|
|
39
|
+
export interface RowActionsMenuProps {
|
|
40
|
+
/** The secondary actions, in the order they are listed. */
|
|
41
|
+
readonly actions?: readonly RowMenuAction[];
|
|
42
|
+
/** The destructive action, always last, after a separator. */
|
|
43
|
+
readonly destructiveAction?: RowMenuDestructiveAction;
|
|
44
|
+
/** The button's accessible name; the English default is "More actions". */
|
|
45
|
+
readonly label?: string;
|
|
46
|
+
/** The menu's edge against the button; `end` (the row's right edge) by default. */
|
|
47
|
+
readonly align?: "start" | "center" | "end";
|
|
48
|
+
/** Reaches the menu button, so an app's dialog opened from the menu can return focus to it. */
|
|
49
|
+
readonly triggerRef?: Ref<HTMLButtonElement>;
|
|
50
|
+
readonly className?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A row's overflow menu: an icon-only "More actions" button that opens a menu of the row's secondary actions, the
|
|
54
|
+
* destructive one last, after a separator and in the danger tone, optionally confirmed in an alert dialog. Opens with
|
|
55
|
+
* Enter, Space or ArrowDown; the arrow keys move between items. Place it in `ListEntry`'s `menu` slot, next to the
|
|
56
|
+
* row's one inline control.
|
|
57
|
+
*/
|
|
58
|
+
export declare function RowActionsMenu({ actions, destructiveAction, label, align, triggerRef, className, }: RowActionsMenuProps): import("react").JSX.Element;
|
|
59
|
+
//# sourceMappingURL=RowActionsMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowActionsMenu.d.ts","sourceRoot":"","sources":["../../src/notion/RowActionsMenu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkD,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAyBjG,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,0EAA0E;AAC1E,MAAM,WAAW,mB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ragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Ellipsis } from "lucide-react";
|
|
4
|
+
import { useCallback, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import { en as messages } from "../messages/en.js";
|
|
7
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../ui/alert-dialog.js";
|
|
8
|
+
import { Button } from "../ui/button.js";
|
|
9
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "../ui/dropdown-menu.js";
|
|
10
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
11
|
+
// Below `md` every item is the touch target, as the row's own controls are; a desktop keeps the compact items.
|
|
12
|
+
const ITEM_TOUCH_CLASS = "max-md:min-h-touch-target";
|
|
13
|
+
function assignRef(ref, value) {
|
|
14
|
+
if (typeof ref === "function")
|
|
15
|
+
ref(value);
|
|
16
|
+
else if (ref !== null && ref !== undefined)
|
|
17
|
+
ref.current = value;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A row's overflow menu: an icon-only "More actions" button that opens a menu of the row's secondary actions, the
|
|
21
|
+
* destructive one last, after a separator and in the danger tone, optionally confirmed in an alert dialog. Opens with
|
|
22
|
+
* Enter, Space or ArrowDown; the arrow keys move between items. Place it in `ListEntry`'s `menu` slot, next to the
|
|
23
|
+
* row's one inline control.
|
|
24
|
+
*/
|
|
25
|
+
export function RowActionsMenu({ actions = [], destructiveAction, label = messages.rowActions.more, align = "end", triggerRef, className, }) {
|
|
26
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
27
|
+
const [isPending, setIsPending] = useState(false);
|
|
28
|
+
const trigger = useRef(null);
|
|
29
|
+
const isLeavingFocus = useRef(false);
|
|
30
|
+
const confirmation = destructiveAction?.confirm;
|
|
31
|
+
const setTrigger = useCallback((node) => {
|
|
32
|
+
trigger.current = node;
|
|
33
|
+
assignRef(triggerRef, node);
|
|
34
|
+
}, [triggerRef]);
|
|
35
|
+
const selectAction = (action) => {
|
|
36
|
+
isLeavingFocus.current = action.opensDialog === true;
|
|
37
|
+
action.onSelect();
|
|
38
|
+
};
|
|
39
|
+
const selectDestructive = () => {
|
|
40
|
+
if (destructiveAction === undefined)
|
|
41
|
+
return;
|
|
42
|
+
isLeavingFocus.current = false;
|
|
43
|
+
if (confirmation === undefined) {
|
|
44
|
+
// The menu is already closed, so a returned promise is the app's to handle.
|
|
45
|
+
void destructiveAction.onSelect();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setIsConfirming(true);
|
|
49
|
+
};
|
|
50
|
+
const confirmDestructive = (event) => {
|
|
51
|
+
if (destructiveAction === undefined)
|
|
52
|
+
return;
|
|
53
|
+
const result = destructiveAction.onSelect();
|
|
54
|
+
if (!(result instanceof Promise))
|
|
55
|
+
return;
|
|
56
|
+
// Keep the dialog open until the action settles.
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
setIsPending(true);
|
|
59
|
+
result.then(() => {
|
|
60
|
+
setIsPending(false);
|
|
61
|
+
setIsConfirming(false);
|
|
62
|
+
}, () => {
|
|
63
|
+
// The app reports its own error; the dialog stays open so the reader can retry or cancel.
|
|
64
|
+
setIsPending(false);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const changeConfirming = (isOpen) => {
|
|
68
|
+
if (isPending)
|
|
69
|
+
return;
|
|
70
|
+
setIsConfirming(isOpen);
|
|
71
|
+
};
|
|
72
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { ref: setTrigger, "data-slot": "row-actions-menu-trigger", type: "button", variant: "ghost", size: "icon", "aria-label": label, className: cn("text-muted-foreground", className), children: _jsx(Ellipsis, { strokeWidth: ICON_STROKE_WIDTH, "aria-hidden": "true" }) }) }), _jsxs(DropdownMenuContent, { align: align, onCloseAutoFocus: (event) => {
|
|
73
|
+
// An item that opened the app's dialog leaves focus to that dialog.
|
|
74
|
+
if (!isLeavingFocus.current)
|
|
75
|
+
return;
|
|
76
|
+
isLeavingFocus.current = false;
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
}, children: [actions.map((action) => (_jsxs(DropdownMenuItem, { "data-row-action": action.id, className: ITEM_TOUCH_CLASS, disabled: action.isDisabled, onSelect: () => selectAction(action), children: [action.icon, action.label] }, action.label))), destructiveAction !== undefined && actions.length > 0 ? _jsx(DropdownMenuSeparator, {}) : null, destructiveAction !== undefined ? (_jsxs(DropdownMenuItem, { variant: "destructive", "data-row-action": destructiveAction.id, className: ITEM_TOUCH_CLASS, disabled: destructiveAction.isDisabled, onSelect: selectDestructive, children: [destructiveAction.icon, destructiveAction.label] })) : null] })] }), confirmation !== undefined && destructiveAction !== undefined ? (_jsx(AlertDialog, { open: isConfirming, onOpenChange: changeConfirming, children: _jsxs(AlertDialogContent, { size: "sm", onCloseAutoFocus: (event) => {
|
|
79
|
+
// The menu item that opened the dialog is gone: focus goes back to the menu button.
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
trigger.current?.focus();
|
|
82
|
+
}, children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: confirmation.title }), confirmation.description !== undefined ? (_jsx(AlertDialogDescription, { children: confirmation.description })) : null] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: isPending, children: confirmation.cancelLabel }), _jsx(AlertDialogAction, { variant: "destructive", disabled: isPending, "aria-busy": isPending || undefined, onClick: confirmDestructive, children: isPending ? (confirmation.pendingLabel ?? confirmation.confirmLabel) : confirmation.confirmLabel })] })] }) })) : null] }));
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=RowActionsMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowActionsMenu.js","sourceRoot":"","sources":["../../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SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,GAC/E,IACF,IACD,GACT,CACf,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,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.36.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/index.ts
CHANGED
|
@@ -125,6 +125,13 @@ export {
|
|
|
125
125
|
export { FileInput, type FileInputMessages, type FileInputMessagesOverride, type FileInputProps } from "./notion/FileInput.js";
|
|
126
126
|
export { FormGrid, type FormGridColumns, type FormGridProps } from "./notion/FormGrid.js";
|
|
127
127
|
export { RESULT_BADGE_ICONS, ResultBadge, type ResultBadgeProps } from "./notion/ResultBadge.js";
|
|
128
|
+
export {
|
|
129
|
+
RowActionsMenu,
|
|
130
|
+
type RowActionsMenuProps,
|
|
131
|
+
type RowMenuAction,
|
|
132
|
+
type RowMenuConfirmation,
|
|
133
|
+
type RowMenuDestructiveAction,
|
|
134
|
+
} from "./notion/RowActionsMenu.js";
|
|
128
135
|
export { Status, type StatusProps } from "./notion/Status.js";
|
|
129
136
|
export { Steps, type StepItem, type StepState, type StepsLayout, type StepsProps } from "./notion/Steps.js";
|
|
130
137
|
export { TabBar, type TabBarItem, type TabBarProps } from "./notion/TabBar.js";
|
package/src/messages/en.ts
CHANGED
|
@@ -12,6 +12,7 @@ export const en = {
|
|
|
12
12
|
},
|
|
13
13
|
breadcrumb: { label: "breadcrumb", more: "More" },
|
|
14
14
|
copy: { copy: "Copy", copied: "Copied" },
|
|
15
|
+
rowActions: { more: "More actions" },
|
|
15
16
|
dialog: { close: "Close" },
|
|
16
17
|
fileInput: { choose: "Choose a file", chooseMany: "Choose files", none: "No file chosen", count: "{count} files" },
|
|
17
18
|
filterChip: { add: "Add filter" },
|
package/src/notion/List.tsx
CHANGED
|
@@ -93,10 +93,16 @@ export type ListEntryProps = Omit<ComponentProps<"div">, "title" | "children"> &
|
|
|
93
93
|
readonly status?: ReactNode;
|
|
94
94
|
/**
|
|
95
95
|
* The row's controls, under the status. They stay their own targets above the row's link, and are at least the
|
|
96
|
-
* touch target (44 px) on a phone
|
|
96
|
+
* touch target (44 px) on a phone; a switch keeps its track and takes its 44 px square from `size="touch"` (with
|
|
97
|
+
* `className="md:m-0 md:h-4 md:w-[26px]"` for the plain switch on a desktop). A control marked `data-row-wide` (an inline form that needs room) makes the right
|
|
97
98
|
* column take the full row width under the identity, its lines starting on the left.
|
|
98
99
|
*/
|
|
99
100
|
readonly actions?: ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* The row's other actions behind a "More actions" button (a `RowActionsMenu`), at the end of the actions line: it
|
|
103
|
+
* stays on one line with the inline control and is at least the touch target (44 px) on a phone.
|
|
104
|
+
*/
|
|
105
|
+
readonly menu?: ReactNode;
|
|
100
106
|
/** The row opens this address: the title's link is stretched over the whole row, with an arrow at its right. */
|
|
101
107
|
readonly href?: string;
|
|
102
108
|
/** The element for the link (a router's link component); a plain `a` by default. */
|
|
@@ -112,12 +118,18 @@ function isDrawn(node: ReactNode): boolean {
|
|
|
112
118
|
* top of the right column and its controls under it. With `href` the title is a link stretched over the whole row, so
|
|
113
119
|
* the row is one box lit on hover, and an arrow sits beside the column (never on a line of its own); the column stays
|
|
114
120
|
* above the link. On a phone (below `md`) the column wraps under the identity, right-aligned. Place it in a `ListItem`.
|
|
121
|
+
*
|
|
122
|
+
* Row controls: at most one control inline in `actions` (a switch, or the row's one primary action); every other
|
|
123
|
+
* action goes into `menu`, the destructive one last. A row with a single action keeps it inline and has no menu.
|
|
124
|
+
* Row state: each fact once. A switch is its own on/off state (no badge or label repeating it); a `ResultBadge`
|
|
125
|
+
* carries its own icon, so no separate state icon stands next to it.
|
|
115
126
|
*/
|
|
116
127
|
export function ListEntry({
|
|
117
128
|
title,
|
|
118
129
|
details,
|
|
119
130
|
status,
|
|
120
131
|
actions,
|
|
132
|
+
menu,
|
|
121
133
|
href,
|
|
122
134
|
linkComponent: Link = "a",
|
|
123
135
|
className,
|
|
@@ -125,7 +137,9 @@ export function ListEntry({
|
|
|
125
137
|
}: ListEntryProps) {
|
|
126
138
|
const hasStatus = isDrawn(status);
|
|
127
139
|
const hasActions = isDrawn(actions);
|
|
128
|
-
const
|
|
140
|
+
const hasMenu = isDrawn(menu);
|
|
141
|
+
const hasControls = hasActions || hasMenu;
|
|
142
|
+
const hasColumn = hasStatus || hasControls;
|
|
129
143
|
const hasLink = href !== undefined;
|
|
130
144
|
const titleClasses = "min-w-0 text-ui-medium text-foreground";
|
|
131
145
|
return (
|
|
@@ -176,12 +190,23 @@ export function ListEntry({
|
|
|
176
190
|
{status}
|
|
177
191
|
</div>
|
|
178
192
|
) : null}
|
|
179
|
-
{
|
|
193
|
+
{hasControls ? (
|
|
180
194
|
<div
|
|
181
195
|
data-slot="list-entry-actions"
|
|
182
|
-
className=
|
|
196
|
+
className={cn(
|
|
197
|
+
"pointer-events-auto flex min-w-0 items-center justify-end gap-1 has-[[data-row-wide]]:flex-col has-[[data-row-wide]]:items-stretch has-[[data-row-wide]]:justify-start max-md:*:not-data-[slot=switch]:min-h-touch-target max-md:*:not-data-[slot=switch]:min-w-touch-target max-md:*:data-[slot=switch]:mx-0",
|
|
198
|
+
hasMenu ? "flex-nowrap" : "flex-wrap",
|
|
199
|
+
)}
|
|
183
200
|
>
|
|
184
201
|
{actions}
|
|
202
|
+
{hasMenu ? (
|
|
203
|
+
<div
|
|
204
|
+
data-slot="list-entry-menu"
|
|
205
|
+
className="flex shrink-0 items-center justify-center max-md:*:min-h-touch-target max-md:*:min-w-touch-target"
|
|
206
|
+
>
|
|
207
|
+
{menu}
|
|
208
|
+
</div>
|
|
209
|
+
) : null}
|
|
185
210
|
</div>
|
|
186
211
|
) : null}
|
|
187
212
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Circle, CircleCheck, CircleMinus, CircleX, LoaderCircle, TriangleAlert, type LucideIcon } from "lucide-react";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { Badge } from "../ui/badge.js";
|
|
@@ -16,7 +16,12 @@ export const RESULT_BADGE_ICONS: Readonly<Record<Tone, LucideIcon>> = {
|
|
|
16
16
|
muted: CircleMinus,
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* The badge's remaining `span` props (`data-*`, `id`, ARIA, handlers) reach the element, so an app can mark a badge with
|
|
21
|
+
* what it shows (`data-read-status="ok"`). The theme's own `data-slot`, `data-tone`, `data-color` and `data-spinning`
|
|
22
|
+
* always win, and the look (`variant`, `color`) is the theme's.
|
|
23
|
+
*/
|
|
24
|
+
export interface ResultBadgeProps extends Omit<ComponentProps<"span">, "color" | "children" | "title" | "className"> {
|
|
20
25
|
/** What the result means; the theme owns its colour (`TONE_COLORS`), so one result reads alike in every list. */
|
|
21
26
|
readonly tone: Tone;
|
|
22
27
|
/** The app's own icon in place of the tone's default (a spinning run defaults to a loader). */
|
|
@@ -37,10 +42,11 @@ function getPlainText(children: ReactNode): string | undefined {
|
|
|
37
42
|
|
|
38
43
|
// A result (passed, failed, skipped, running): a filled tag in its tone's colour, with an icon and a word. The filled
|
|
39
44
|
// counterpart of `Status`, for a list whose rows each end in a result.
|
|
40
|
-
export function ResultBadge({ tone, icon, isSpinning = false, children, title, className }: ResultBadgeProps) {
|
|
45
|
+
export function ResultBadge({ tone, icon, isSpinning = false, children, title, className, ...attributes }: ResultBadgeProps) {
|
|
41
46
|
const Icon = icon ?? (isSpinning ? LoaderCircle : RESULT_BADGE_ICONS[tone]);
|
|
42
47
|
return (
|
|
43
48
|
<Badge
|
|
49
|
+
{...attributes}
|
|
44
50
|
variant="tag"
|
|
45
51
|
color={TONE_COLORS[tone] ?? "default"}
|
|
46
52
|
data-slot="result-badge"
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Ellipsis } from "lucide-react";
|
|
4
|
+
import { useCallback, useRef, useState, type MouseEvent, type ReactNode, type Ref } from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { en as messages } from "../messages/en.js";
|
|
8
|
+
import {
|
|
9
|
+
AlertDialog,
|
|
10
|
+
AlertDialogAction,
|
|
11
|
+
AlertDialogCancel,
|
|
12
|
+
AlertDialogContent,
|
|
13
|
+
AlertDialogDescription,
|
|
14
|
+
AlertDialogFooter,
|
|
15
|
+
AlertDialogHeader,
|
|
16
|
+
AlertDialogTitle,
|
|
17
|
+
} from "../ui/alert-dialog.js";
|
|
18
|
+
import { Button } from "../ui/button.js";
|
|
19
|
+
import {
|
|
20
|
+
DropdownMenu,
|
|
21
|
+
DropdownMenuContent,
|
|
22
|
+
DropdownMenuItem,
|
|
23
|
+
DropdownMenuSeparator,
|
|
24
|
+
DropdownMenuTrigger,
|
|
25
|
+
} from "../ui/dropdown-menu.js";
|
|
26
|
+
|
|
27
|
+
import { ICON_STROKE_WIDTH } from "./icon-stroke.js";
|
|
28
|
+
|
|
29
|
+
/** One secondary action of a row: its words, an optional icon, and what it does. */
|
|
30
|
+
export interface RowMenuAction {
|
|
31
|
+
/** A stable hook for browser tests, rendered as `data-row-action` on the item. */
|
|
32
|
+
readonly id?: string;
|
|
33
|
+
readonly label: string;
|
|
34
|
+
/** A line icon before the words (the theme's stroke and size apply). */
|
|
35
|
+
readonly icon?: ReactNode;
|
|
36
|
+
readonly onSelect: () => void;
|
|
37
|
+
readonly isDisabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The action opens the app's own dialog: the menu leaves focus to that dialog when it closes instead of taking it
|
|
40
|
+
* back to its button. Return focus to the button from the dialog's `onCloseAutoFocus` through `triggerRef`.
|
|
41
|
+
*/
|
|
42
|
+
readonly opensDialog?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The confirmation a destructive action asks for: the app's own copy. */
|
|
46
|
+
export interface RowMenuConfirmation {
|
|
47
|
+
readonly title: ReactNode;
|
|
48
|
+
readonly description?: ReactNode;
|
|
49
|
+
/** The words of the destructive confirm button. */
|
|
50
|
+
readonly confirmLabel: string;
|
|
51
|
+
/** The words of the confirm button while an async action runs ("Deleting…"); `confirmLabel` when not given. */
|
|
52
|
+
readonly pendingLabel?: string;
|
|
53
|
+
/** The words of the button that keeps things as they are. */
|
|
54
|
+
readonly cancelLabel: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The destructive action of a row (delete, revoke): last in the menu, in the danger tone. */
|
|
58
|
+
export interface RowMenuDestructiveAction extends Omit<RowMenuAction, "onSelect"> {
|
|
59
|
+
/**
|
|
60
|
+
* What the action does. With `confirm` it may return a promise (a server action): the dialog then stays open with
|
|
61
|
+
* both buttons disabled and `pendingLabel` on the confirm button until it settles, closes when it resolves and stays
|
|
62
|
+
* open when it rejects. The app reports the error itself; the menu only keeps the dialog open.
|
|
63
|
+
*/
|
|
64
|
+
readonly onSelect: () => void | Promise<unknown>;
|
|
65
|
+
/** Ask first: the action runs only after the alert dialog's confirm button. Without it the action runs at once. */
|
|
66
|
+
readonly confirm?: RowMenuConfirmation;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface RowActionsMenuProps {
|
|
70
|
+
/** The secondary actions, in the order they are listed. */
|
|
71
|
+
readonly actions?: readonly RowMenuAction[];
|
|
72
|
+
/** The destructive action, always last, after a separator. */
|
|
73
|
+
readonly destructiveAction?: RowMenuDestructiveAction;
|
|
74
|
+
/** The button's accessible name; the English default is "More actions". */
|
|
75
|
+
readonly label?: string;
|
|
76
|
+
/** The menu's edge against the button; `end` (the row's right edge) by default. */
|
|
77
|
+
readonly align?: "start" | "center" | "end";
|
|
78
|
+
/** Reaches the menu button, so an app's dialog opened from the menu can return focus to it. */
|
|
79
|
+
readonly triggerRef?: Ref<HTMLButtonElement>;
|
|
80
|
+
readonly className?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Below `md` every item is the touch target, as the row's own controls are; a desktop keeps the compact items.
|
|
84
|
+
const ITEM_TOUCH_CLASS = "max-md:min-h-touch-target";
|
|
85
|
+
|
|
86
|
+
function assignRef<T>(ref: Ref<T> | undefined, value: T | null): void {
|
|
87
|
+
if (typeof ref === "function") ref(value);
|
|
88
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A row's overflow menu: an icon-only "More actions" button that opens a menu of the row's secondary actions, the
|
|
93
|
+
* destructive one last, after a separator and in the danger tone, optionally confirmed in an alert dialog. Opens with
|
|
94
|
+
* Enter, Space or ArrowDown; the arrow keys move between items. Place it in `ListEntry`'s `menu` slot, next to the
|
|
95
|
+
* row's one inline control.
|
|
96
|
+
*/
|
|
97
|
+
export function RowActionsMenu({
|
|
98
|
+
actions = [],
|
|
99
|
+
destructiveAction,
|
|
100
|
+
label = messages.rowActions.more,
|
|
101
|
+
align = "end",
|
|
102
|
+
triggerRef,
|
|
103
|
+
className,
|
|
104
|
+
}: RowActionsMenuProps) {
|
|
105
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
106
|
+
const [isPending, setIsPending] = useState(false);
|
|
107
|
+
const trigger = useRef<HTMLButtonElement | null>(null);
|
|
108
|
+
const isLeavingFocus = useRef(false);
|
|
109
|
+
const confirmation = destructiveAction?.confirm;
|
|
110
|
+
|
|
111
|
+
const setTrigger = useCallback(
|
|
112
|
+
(node: HTMLButtonElement | null) => {
|
|
113
|
+
trigger.current = node;
|
|
114
|
+
assignRef(triggerRef, node);
|
|
115
|
+
},
|
|
116
|
+
[triggerRef],
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const selectAction = (action: RowMenuAction) => {
|
|
120
|
+
isLeavingFocus.current = action.opensDialog === true;
|
|
121
|
+
action.onSelect();
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const selectDestructive = () => {
|
|
125
|
+
if (destructiveAction === undefined) return;
|
|
126
|
+
isLeavingFocus.current = false;
|
|
127
|
+
if (confirmation === undefined) {
|
|
128
|
+
// The menu is already closed, so a returned promise is the app's to handle.
|
|
129
|
+
void destructiveAction.onSelect();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
setIsConfirming(true);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const confirmDestructive = (event: MouseEvent<HTMLButtonElement>) => {
|
|
136
|
+
if (destructiveAction === undefined) return;
|
|
137
|
+
const result = destructiveAction.onSelect();
|
|
138
|
+
if (!(result instanceof Promise)) return;
|
|
139
|
+
// Keep the dialog open until the action settles.
|
|
140
|
+
event.preventDefault();
|
|
141
|
+
setIsPending(true);
|
|
142
|
+
result.then(
|
|
143
|
+
() => {
|
|
144
|
+
setIsPending(false);
|
|
145
|
+
setIsConfirming(false);
|
|
146
|
+
},
|
|
147
|
+
() => {
|
|
148
|
+
// The app reports its own error; the dialog stays open so the reader can retry or cancel.
|
|
149
|
+
setIsPending(false);
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const changeConfirming = (isOpen: boolean) => {
|
|
155
|
+
if (isPending) return;
|
|
156
|
+
setIsConfirming(isOpen);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<>
|
|
161
|
+
<DropdownMenu>
|
|
162
|
+
<DropdownMenuTrigger asChild>
|
|
163
|
+
<Button
|
|
164
|
+
ref={setTrigger}
|
|
165
|
+
data-slot="row-actions-menu-trigger"
|
|
166
|
+
type="button"
|
|
167
|
+
variant="ghost"
|
|
168
|
+
size="icon"
|
|
169
|
+
aria-label={label}
|
|
170
|
+
className={cn("text-muted-foreground", className)}
|
|
171
|
+
>
|
|
172
|
+
<Ellipsis strokeWidth={ICON_STROKE_WIDTH} aria-hidden="true" />
|
|
173
|
+
</Button>
|
|
174
|
+
</DropdownMenuTrigger>
|
|
175
|
+
<DropdownMenuContent
|
|
176
|
+
align={align}
|
|
177
|
+
onCloseAutoFocus={(event) => {
|
|
178
|
+
// An item that opened the app's dialog leaves focus to that dialog.
|
|
179
|
+
if (!isLeavingFocus.current) return;
|
|
180
|
+
isLeavingFocus.current = false;
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
{actions.map((action) => (
|
|
185
|
+
<DropdownMenuItem
|
|
186
|
+
key={action.label}
|
|
187
|
+
data-row-action={action.id}
|
|
188
|
+
className={ITEM_TOUCH_CLASS}
|
|
189
|
+
disabled={action.isDisabled}
|
|
190
|
+
onSelect={() => selectAction(action)}
|
|
191
|
+
>
|
|
192
|
+
{action.icon}
|
|
193
|
+
{action.label}
|
|
194
|
+
</DropdownMenuItem>
|
|
195
|
+
))}
|
|
196
|
+
{destructiveAction !== undefined && actions.length > 0 ? <DropdownMenuSeparator /> : null}
|
|
197
|
+
{destructiveAction !== undefined ? (
|
|
198
|
+
<DropdownMenuItem
|
|
199
|
+
variant="destructive"
|
|
200
|
+
data-row-action={destructiveAction.id}
|
|
201
|
+
className={ITEM_TOUCH_CLASS}
|
|
202
|
+
disabled={destructiveAction.isDisabled}
|
|
203
|
+
onSelect={selectDestructive}
|
|
204
|
+
>
|
|
205
|
+
{destructiveAction.icon}
|
|
206
|
+
{destructiveAction.label}
|
|
207
|
+
</DropdownMenuItem>
|
|
208
|
+
) : null}
|
|
209
|
+
</DropdownMenuContent>
|
|
210
|
+
</DropdownMenu>
|
|
211
|
+
{confirmation !== undefined && destructiveAction !== undefined ? (
|
|
212
|
+
<AlertDialog open={isConfirming} onOpenChange={changeConfirming}>
|
|
213
|
+
<AlertDialogContent
|
|
214
|
+
size="sm"
|
|
215
|
+
onCloseAutoFocus={(event) => {
|
|
216
|
+
// The menu item that opened the dialog is gone: focus goes back to the menu button.
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
trigger.current?.focus();
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
<AlertDialogHeader>
|
|
222
|
+
<AlertDialogTitle>{confirmation.title}</AlertDialogTitle>
|
|
223
|
+
{confirmation.description !== undefined ? (
|
|
224
|
+
<AlertDialogDescription>{confirmation.description}</AlertDialogDescription>
|
|
225
|
+
) : null}
|
|
226
|
+
</AlertDialogHeader>
|
|
227
|
+
<AlertDialogFooter>
|
|
228
|
+
<AlertDialogCancel disabled={isPending}>{confirmation.cancelLabel}</AlertDialogCancel>
|
|
229
|
+
<AlertDialogAction
|
|
230
|
+
variant="destructive"
|
|
231
|
+
disabled={isPending}
|
|
232
|
+
aria-busy={isPending || undefined}
|
|
233
|
+
onClick={confirmDestructive}
|
|
234
|
+
>
|
|
235
|
+
{isPending ? (confirmation.pendingLabel ?? confirmation.confirmLabel) : confirmation.confirmLabel}
|
|
236
|
+
</AlertDialogAction>
|
|
237
|
+
</AlertDialogFooter>
|
|
238
|
+
</AlertDialogContent>
|
|
239
|
+
</AlertDialog>
|
|
240
|
+
) : null}
|
|
241
|
+
</>
|
|
242
|
+
);
|
|
243
|
+
}
|