@tldraw/commenting 5.3.0-internal.41291fb579ed → 5.3.0-internal.5f14a24c179e
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/commenting.css +3 -5
- package/dist-cjs/canvas/comments-filter-menu.js +21 -13
- package/dist-cjs/canvas/comments-filter-menu.js.map +2 -2
- package/dist-cjs/canvas/comments-overflow-menu.js +10 -2
- package/dist-cjs/canvas/comments-overflow-menu.js.map +2 -2
- package/dist-cjs/canvas/comments-overlay.js +9 -30
- package/dist-cjs/canvas/comments-overlay.js.map +2 -2
- package/dist-cjs/canvas/comments-visibility-toggle.js +4 -3
- package/dist-cjs/canvas/comments-visibility-toggle.js.map +2 -2
- package/dist-cjs/index.js +1 -1
- package/dist-esm/canvas/comments-filter-menu.mjs +21 -13
- package/dist-esm/canvas/comments-filter-menu.mjs.map +2 -2
- package/dist-esm/canvas/comments-overflow-menu.mjs +10 -2
- package/dist-esm/canvas/comments-overflow-menu.mjs.map +2 -2
- package/dist-esm/canvas/comments-overlay.mjs +9 -30
- package/dist-esm/canvas/comments-overlay.mjs.map +2 -2
- package/dist-esm/canvas/comments-visibility-toggle.mjs +4 -3
- package/dist-esm/canvas/comments-visibility-toggle.mjs.map +2 -2
- package/dist-esm/index.mjs +1 -1
- package/package.json +3 -3
- package/src/canvas/comments-filter-menu.tsx +18 -14
- package/src/canvas/comments-overflow-menu.tsx +7 -3
- package/src/canvas/comments-overlay.tsx +12 -41
- package/src/canvas/comments-visibility-toggle.tsx +5 -4
- package/src/ui/comments.css +3 -5
- package/dist-cjs/ui/tooltip-button.js +0 -32
- package/dist-cjs/ui/tooltip-button.js.map +0 -7
- package/dist-esm/ui/tooltip-button.mjs +0 -12
- package/dist-esm/ui/tooltip-button.mjs.map +0 -7
- package/src/ui/tooltip-button.tsx +0 -20
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
useTranslation,
|
|
10
10
|
useValue,
|
|
11
11
|
} from 'tldraw'
|
|
12
|
-
import { TooltipButton } from '../ui/tooltip-button'
|
|
13
12
|
import { SidebarFilters } from './sidebar-filters'
|
|
14
13
|
import { sidebarFilters } from './state'
|
|
15
14
|
|
|
@@ -37,9 +36,14 @@ export function CommentsFilterMenu({
|
|
|
37
36
|
return (
|
|
38
37
|
<TldrawUiDropdownMenuRoot id="comments-filter">
|
|
39
38
|
<TldrawUiDropdownMenuTrigger>
|
|
40
|
-
<
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
className="tlui-cmt-header-btn"
|
|
42
|
+
title={msg('comments.filter')}
|
|
43
|
+
aria-label={msg('comments.filter')}
|
|
44
|
+
>
|
|
41
45
|
<FilterIcon />
|
|
42
|
-
</
|
|
46
|
+
</button>
|
|
43
47
|
</TldrawUiDropdownMenuTrigger>
|
|
44
48
|
<TldrawUiDropdownMenuContent
|
|
45
49
|
className="tlui-cmt-menu"
|
|
@@ -50,16 +54,16 @@ export function CommentsFilterMenu({
|
|
|
50
54
|
<TldrawUiMenuContextProvider type="menu" sourceId="menu">
|
|
51
55
|
<TldrawUiMenuGroup id="comments-filter">
|
|
52
56
|
<TldrawUiMenuCheckboxItem
|
|
53
|
-
id="show-
|
|
54
|
-
label="comments.show-
|
|
55
|
-
checked={
|
|
56
|
-
onSelect={() => toggle('
|
|
57
|
+
id="show-resolved"
|
|
58
|
+
label="comments.show-resolved"
|
|
59
|
+
checked={filters.showResolved}
|
|
60
|
+
onSelect={() => toggle('showResolved')}
|
|
57
61
|
/>
|
|
58
62
|
{canFilterByAuthor && (
|
|
59
63
|
<TldrawUiMenuCheckboxItem
|
|
60
|
-
id="
|
|
61
|
-
label="comments.
|
|
62
|
-
checked={
|
|
64
|
+
id="only-mine"
|
|
65
|
+
label="comments.only-mine"
|
|
66
|
+
checked={filters.onlyMine}
|
|
63
67
|
onSelect={() => toggle('onlyMine')}
|
|
64
68
|
/>
|
|
65
69
|
)}
|
|
@@ -72,10 +76,10 @@ export function CommentsFilterMenu({
|
|
|
72
76
|
/>
|
|
73
77
|
)}
|
|
74
78
|
<TldrawUiMenuCheckboxItem
|
|
75
|
-
id="
|
|
76
|
-
label="comments.
|
|
77
|
-
checked={filters.
|
|
78
|
-
onSelect={() => toggle('
|
|
79
|
+
id="only-current-page"
|
|
80
|
+
label="comments.only-current-page"
|
|
81
|
+
checked={filters.onlyCurrentPage}
|
|
82
|
+
onSelect={() => toggle('onlyCurrentPage')}
|
|
79
83
|
/>
|
|
80
84
|
</TldrawUiMenuGroup>
|
|
81
85
|
</TldrawUiMenuContextProvider>
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
useTranslation,
|
|
10
10
|
useValue,
|
|
11
11
|
} from 'tldraw'
|
|
12
|
-
import { TooltipButton } from '../ui/tooltip-button'
|
|
13
12
|
import { commentsHidden, toggleCommentsHidden } from './state'
|
|
14
13
|
|
|
15
14
|
// A keyboard-shortcut glyph, not translatable copy — kept out of JSX as a constant.
|
|
@@ -26,9 +25,14 @@ export function CommentsOverflowMenu() {
|
|
|
26
25
|
return (
|
|
27
26
|
<TldrawUiDropdownMenuRoot id="comments-overflow">
|
|
28
27
|
<TldrawUiDropdownMenuTrigger>
|
|
29
|
-
<
|
|
28
|
+
<button
|
|
29
|
+
type="button"
|
|
30
|
+
className="tlui-cmt-header-btn"
|
|
31
|
+
title={msg('comments.more-options')}
|
|
32
|
+
aria-label={msg('comments.more-options')}
|
|
33
|
+
>
|
|
30
34
|
<TldrawUiIcon icon="dots-vertical" label={msg('comments.more-options')} small />
|
|
31
|
-
</
|
|
35
|
+
</button>
|
|
32
36
|
</TldrawUiDropdownMenuTrigger>
|
|
33
37
|
<TldrawUiDropdownMenuContent
|
|
34
38
|
className="tlui-cmt-menu"
|
|
@@ -47,7 +47,6 @@ import { CommentThread } from '../ui/comment-thread'
|
|
|
47
47
|
import { CountBadge } from '../ui/count-badge'
|
|
48
48
|
import { MentionMember } from '../ui/mention-list'
|
|
49
49
|
import { isMentionPickerOpen } from '../ui/mention-suggestion'
|
|
50
|
-
import { TooltipButton } from '../ui/tooltip-button'
|
|
51
50
|
import { collectClusterLeaves } from './cluster-input'
|
|
52
51
|
import { CommentBody } from './comment-body'
|
|
53
52
|
import {
|
|
@@ -1162,15 +1161,6 @@ const ThreadPin = memo(function ThreadPin({
|
|
|
1162
1161
|
// see the note on the layer.
|
|
1163
1162
|
usePassThroughWheelEvents(markerRef)
|
|
1164
1163
|
|
|
1165
|
-
// The drop-target hint is editor-global state with no automatic reset. If the pin unmounts
|
|
1166
|
-
// mid-drag (e.g. Shift+C hides comments), no pointer event will ever reach the drag handlers —
|
|
1167
|
-
// clear the hint here or it stays on the shape indefinitely.
|
|
1168
|
-
useEffect(() => {
|
|
1169
|
-
return () => {
|
|
1170
|
-
if (dragRef.current) editor.setHintingShapes([])
|
|
1171
|
-
}
|
|
1172
|
-
}, [editor])
|
|
1173
|
-
|
|
1174
1164
|
// Clicking outside the open popover (and off its own pin) closes the thread — mirrors the
|
|
1175
1165
|
// pending composer's dismiss. Capture phase + a class check rather than stopPropagation, since the
|
|
1176
1166
|
// popover portals elsewhere in the DOM. The pin marker is excluded so its own click-to-toggle
|
|
@@ -1324,12 +1314,13 @@ const ThreadPin = memo(function ThreadPin({
|
|
|
1324
1314
|
comment.authorId === currentUserId ? (
|
|
1325
1315
|
<TldrawUiDropdownMenuRoot id={`comment-actions-${comment.id}`}>
|
|
1326
1316
|
<TldrawUiDropdownMenuTrigger>
|
|
1327
|
-
<
|
|
1328
|
-
|
|
1317
|
+
<button
|
|
1318
|
+
type="button"
|
|
1329
1319
|
className="tlui-cmt-thread__action"
|
|
1320
|
+
title={msg('comments.more-options')}
|
|
1330
1321
|
>
|
|
1331
1322
|
<TldrawUiIcon icon="dots-vertical" label={msg('comments.more-options')} small />
|
|
1332
|
-
</
|
|
1323
|
+
</button>
|
|
1333
1324
|
</TldrawUiDropdownMenuTrigger>
|
|
1334
1325
|
<TldrawUiDropdownMenuContent
|
|
1335
1326
|
className="tlui-cmt-menu"
|
|
@@ -1368,9 +1359,9 @@ const ThreadPin = memo(function ThreadPin({
|
|
|
1368
1359
|
const headerActions = (
|
|
1369
1360
|
<>
|
|
1370
1361
|
{currentUserId && (
|
|
1371
|
-
<
|
|
1372
|
-
tooltip={msg(thread.resolved ? 'comments.reopen' : 'comments.resolve')}
|
|
1362
|
+
<button
|
|
1373
1363
|
className="tlui-cmt-thread__action"
|
|
1364
|
+
title={msg(thread.resolved ? 'comments.reopen' : 'comments.resolve')}
|
|
1374
1365
|
onClick={toggleResolve}
|
|
1375
1366
|
>
|
|
1376
1367
|
<TldrawUiIcon
|
|
@@ -1378,17 +1369,18 @@ const ThreadPin = memo(function ThreadPin({
|
|
|
1378
1369
|
label={msg(thread.resolved ? 'comments.reopen' : 'comments.resolve')}
|
|
1379
1370
|
small
|
|
1380
1371
|
/>
|
|
1381
|
-
</
|
|
1372
|
+
</button>
|
|
1382
1373
|
)}
|
|
1383
1374
|
{currentUserId && (
|
|
1384
1375
|
<TldrawUiDropdownMenuRoot id={`comment-thread-actions-${thread.id}`}>
|
|
1385
1376
|
<TldrawUiDropdownMenuTrigger>
|
|
1386
|
-
<
|
|
1387
|
-
|
|
1377
|
+
<button
|
|
1378
|
+
type="button"
|
|
1388
1379
|
className="tlui-cmt-thread__action"
|
|
1380
|
+
title={msg('comments.more-options')}
|
|
1389
1381
|
>
|
|
1390
1382
|
<TldrawUiIcon icon="dots-vertical" label={msg('comments.more-options')} small />
|
|
1391
|
-
</
|
|
1383
|
+
</button>
|
|
1392
1384
|
</TldrawUiDropdownMenuTrigger>
|
|
1393
1385
|
<TldrawUiDropdownMenuContent
|
|
1394
1386
|
className="tlui-cmt-menu"
|
|
@@ -1465,26 +1457,7 @@ const ThreadPin = memo(function ThreadPin({
|
|
|
1465
1457
|
if (!drag.moved && Math.hypot(e.clientX - drag.startX, e.clientY - drag.startY) < 4) return
|
|
1466
1458
|
drag.moved = true
|
|
1467
1459
|
const cursorPage = editor.screenToPage({ x: e.clientX, y: e.clientY })
|
|
1468
|
-
|
|
1469
|
-
setDragPagePoint(pagePoint)
|
|
1470
|
-
// Hint the shape the pin would re-anchor to on drop — the same hit-test endDrag resolves
|
|
1471
|
-
// with. Regions translate rather than re-anchor, so they never hint.
|
|
1472
|
-
if (!isRegion) {
|
|
1473
|
-
const hit = editor.getShapeAtPoint(pagePoint, { hitInside: true })
|
|
1474
|
-
editor.setHintingShapes(hit ? [hit.id] : [])
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
// A cancelled pointer (touch gesture takeover, browser interruption) aborts the drag outright:
|
|
1478
|
-
// no re-anchor commit, no click-toggle — the pin snaps back and the hint clears.
|
|
1479
|
-
const cancelDrag = (e: ReactPointerEvent<HTMLDivElement>) => {
|
|
1480
|
-
const drag = dragRef.current
|
|
1481
|
-
dragRef.current = null
|
|
1482
|
-
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
|
1483
|
-
e.currentTarget.releasePointerCapture(e.pointerId)
|
|
1484
|
-
}
|
|
1485
|
-
if (!drag) return
|
|
1486
|
-
setDragPagePoint(null)
|
|
1487
|
-
editor.setHintingShapes([])
|
|
1460
|
+
setDragPagePoint({ x: cursorPage.x + drag.offsetX, y: cursorPage.y + drag.offsetY })
|
|
1488
1461
|
}
|
|
1489
1462
|
const endDrag = (e: ReactPointerEvent<HTMLDivElement>) => {
|
|
1490
1463
|
const drag = dragRef.current
|
|
@@ -1493,7 +1466,6 @@ const ThreadPin = memo(function ThreadPin({
|
|
|
1493
1466
|
e.currentTarget.releasePointerCapture(e.pointerId)
|
|
1494
1467
|
}
|
|
1495
1468
|
if (!drag) return
|
|
1496
|
-
editor.setHintingShapes([])
|
|
1497
1469
|
if (!drag.moved) {
|
|
1498
1470
|
openThreadId.set(editor, openThreadId.get(editor) === thread.id ? null : thread.id)
|
|
1499
1471
|
return
|
|
@@ -1587,7 +1559,6 @@ const ThreadPin = memo(function ThreadPin({
|
|
|
1587
1559
|
onPointerDown={startDrag}
|
|
1588
1560
|
onPointerMove={onDrag}
|
|
1589
1561
|
onPointerUp={endDrag}
|
|
1590
|
-
onPointerCancel={cancelDrag}
|
|
1591
1562
|
onPointerEnter={() => setPinHovered(true)}
|
|
1592
1563
|
onPointerLeave={() => setPinHovered(false)}
|
|
1593
1564
|
>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEditor, useTranslation, useValue } from 'tldraw'
|
|
2
|
-
import { TooltipButton } from '../ui/tooltip-button'
|
|
3
2
|
import { commentsHidden, toggleCommentsHidden } from './state'
|
|
4
3
|
|
|
5
4
|
/** The sidebar header's show/hide toggle for comment pins — an eye that closes while comments
|
|
@@ -12,14 +11,16 @@ export function CommentsVisibilityToggle() {
|
|
|
12
11
|
const label = hidden ? msg('comments.show') : msg('comments.hide')
|
|
13
12
|
|
|
14
13
|
return (
|
|
15
|
-
<
|
|
16
|
-
|
|
14
|
+
<button
|
|
15
|
+
type="button"
|
|
17
16
|
className="tlui-cmt-header-btn"
|
|
17
|
+
title={label}
|
|
18
|
+
aria-label={label}
|
|
18
19
|
aria-pressed={hidden}
|
|
19
20
|
onClick={() => toggleCommentsHidden(editor)}
|
|
20
21
|
>
|
|
21
22
|
{hidden ? <EyeClosedIcon /> : <EyeOpenIcon />}
|
|
22
|
-
</
|
|
23
|
+
</button>
|
|
23
24
|
)
|
|
24
25
|
}
|
|
25
26
|
|
package/src/ui/comments.css
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
.tlui-cmt-head {
|
|
34
34
|
display: flex;
|
|
35
|
-
align-items:
|
|
35
|
+
align-items: baseline;
|
|
36
36
|
gap: 6px;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.tlui-cmt-time {
|
|
46
|
-
font-size:
|
|
46
|
+
font-size: 11px;
|
|
47
47
|
color: var(--tl-color-text-3);
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -566,9 +566,7 @@
|
|
|
566
566
|
margin-top: 2px;
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
|
|
570
|
-
padding: 4px 0 0;
|
|
571
|
-
}
|
|
569
|
+
/* The reply composer carries no avatar at all — the field spans the thread's full width. */
|
|
572
570
|
.tlui-cmt-thread .tlui-cmt-composer .tlui-cmt-avatar {
|
|
573
571
|
display: none;
|
|
574
572
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var tooltip_button_exports = {};
|
|
20
|
-
__export(tooltip_button_exports, {
|
|
21
|
-
TooltipButton: () => TooltipButton
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(tooltip_button_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
var import_tldraw = require("tldraw");
|
|
27
|
-
const TooltipButton = (0, import_react.forwardRef)(
|
|
28
|
-
function TooltipButton2({ tooltip, children, ...props }, ref) {
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tldraw.TldrawUiTooltip, { content: tooltip, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { ref, type: "button", "aria-label": tooltip, ...props, children }) });
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
//# sourceMappingURL=tooltip-button.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ui/tooltip-button.tsx"],
|
|
4
|
-
"sourcesContent": ["import { type ButtonHTMLAttributes, forwardRef } from 'react'\nimport { TldrawUiTooltip } from 'tldraw'\n\ninterface TooltipButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n\ttooltip: string\n}\n\n/** An icon button labelled by a styled tooltip. Forwards ref and props to the underlying button\n * so `asChild` triggers (dropdown, tooltip) both compose onto the real element. */\nexport const TooltipButton = forwardRef<HTMLButtonElement, TooltipButtonProps>(\n\tfunction TooltipButton({ tooltip, children, ...props }, ref) {\n\t\treturn (\n\t\t\t<TldrawUiTooltip content={tooltip}>\n\t\t\t\t<button ref={ref} type=\"button\" aria-label={tooltip} {...props}>\n\t\t\t\t\t{children}\n\t\t\t\t</button>\n\t\t\t</TldrawUiTooltip>\n\t\t)\n\t}\n)\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaI;AAbJ,mBAAsD;AACtD,oBAAgC;AAQzB,MAAM,oBAAgB;AAAA,EAC5B,SAASA,eAAc,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,KAAK;AAC5D,WACC,4CAAC,iCAAgB,SAAS,SACzB,sDAAC,YAAO,KAAU,MAAK,UAAS,cAAY,SAAU,GAAG,OACvD,UACF,GACD;AAAA,EAEF;AACD;",
|
|
6
|
-
"names": ["TooltipButton"]
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { TldrawUiTooltip } from "tldraw";
|
|
4
|
-
const TooltipButton = forwardRef(
|
|
5
|
-
function TooltipButton2({ tooltip, children, ...props }, ref) {
|
|
6
|
-
return /* @__PURE__ */ jsx(TldrawUiTooltip, { content: tooltip, children: /* @__PURE__ */ jsx("button", { ref, type: "button", "aria-label": tooltip, ...props, children }) });
|
|
7
|
-
}
|
|
8
|
-
);
|
|
9
|
-
export {
|
|
10
|
-
TooltipButton
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=tooltip-button.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ui/tooltip-button.tsx"],
|
|
4
|
-
"sourcesContent": ["import { type ButtonHTMLAttributes, forwardRef } from 'react'\nimport { TldrawUiTooltip } from 'tldraw'\n\ninterface TooltipButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n\ttooltip: string\n}\n\n/** An icon button labelled by a styled tooltip. Forwards ref and props to the underlying button\n * so `asChild` triggers (dropdown, tooltip) both compose onto the real element. */\nexport const TooltipButton = forwardRef<HTMLButtonElement, TooltipButtonProps>(\n\tfunction TooltipButton({ tooltip, children, ...props }, ref) {\n\t\treturn (\n\t\t\t<TldrawUiTooltip content={tooltip}>\n\t\t\t\t<button ref={ref} type=\"button\" aria-label={tooltip} {...props}>\n\t\t\t\t\t{children}\n\t\t\t\t</button>\n\t\t\t</TldrawUiTooltip>\n\t\t)\n\t}\n)\n"],
|
|
5
|
-
"mappings": "AAaI;AAbJ,SAAoC,kBAAkB;AACtD,SAAS,uBAAuB;AAQzB,MAAM,gBAAgB;AAAA,EAC5B,SAASA,eAAc,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,KAAK;AAC5D,WACC,oBAAC,mBAAgB,SAAS,SACzB,8BAAC,YAAO,KAAU,MAAK,UAAS,cAAY,SAAU,GAAG,OACvD,UACF,GACD;AAAA,EAEF;AACD;",
|
|
6
|
-
"names": ["TooltipButton"]
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, forwardRef } from 'react'
|
|
2
|
-
import { TldrawUiTooltip } from 'tldraw'
|
|
3
|
-
|
|
4
|
-
interface TooltipButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
-
tooltip: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** An icon button labelled by a styled tooltip. Forwards ref and props to the underlying button
|
|
9
|
-
* so `asChild` triggers (dropdown, tooltip) both compose onto the real element. */
|
|
10
|
-
export const TooltipButton = forwardRef<HTMLButtonElement, TooltipButtonProps>(
|
|
11
|
-
function TooltipButton({ tooltip, children, ...props }, ref) {
|
|
12
|
-
return (
|
|
13
|
-
<TldrawUiTooltip content={tooltip}>
|
|
14
|
-
<button ref={ref} type="button" aria-label={tooltip} {...props}>
|
|
15
|
-
{children}
|
|
16
|
-
</button>
|
|
17
|
-
</TldrawUiTooltip>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
)
|