@tldraw/mentions 5.7.0-next.d597a258777e → 5.7.0-next.e175bb4a0646
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/dist-cjs/index.d.ts +1 -1
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/mention-list.js +4 -3
- package/dist-cjs/mention-list.js.map +2 -2
- package/dist-esm/index.d.mts +1 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/mention-list.mjs +4 -3
- package/dist-esm/mention-list.mjs.map +2 -2
- package/mentions.css +29 -36
- package/package.json +3 -3
- package/src/mention-list.tsx +6 -9
package/dist-cjs/index.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ export declare interface MentionListProps {
|
|
|
104
104
|
* picker-only display fields. @public */
|
|
105
105
|
export declare interface MentionMember extends CommentAuthor {
|
|
106
106
|
id: string;
|
|
107
|
-
/**
|
|
107
|
+
/** Muted text after the name, e.g. an email or handle. */
|
|
108
108
|
secondary?: string;
|
|
109
109
|
/** Marks the current user; shown as a "(You)" suffix after the name. */
|
|
110
110
|
you?: boolean;
|
package/dist-cjs/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var import_mention_extension = require("./mention-extension");
|
|
|
35
35
|
var import_mention_suggestion = require("./mention-suggestion");
|
|
36
36
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
37
37
|
"@tldraw/mentions",
|
|
38
|
-
"5.7.0-next.
|
|
38
|
+
"5.7.0-next.e175bb4a0646",
|
|
39
39
|
"cjs"
|
|
40
40
|
);
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
package/dist-cjs/mention-list.js
CHANGED
|
@@ -45,9 +45,9 @@ function DefaultMemberRow({ member }) {
|
|
|
45
45
|
const MentionList = (0, import_react.forwardRef)(function MentionList2({ members, activeIndex = 0, onSelect, emptyLabel, renderMember }, ref) {
|
|
46
46
|
const msg = (0, import_tldraw.useTranslation)();
|
|
47
47
|
if (members.length === 0) {
|
|
48
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: "tlui-cmt-mention-list tlui-cmt-mention-list--empty", children: emptyLabel ?? msg(messages.commentsMentionNoMatches) });
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: "tlui-menu tlui-cmt-mention-list tlui-cmt-mention-list--empty", children: emptyLabel ?? msg(messages.commentsMentionNoMatches) });
|
|
49
49
|
}
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: "tlui-cmt-mention-list", role: "listbox", children: members.map((member, i) => {
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: "tlui-menu tlui-cmt-mention-list", role: "listbox", children: members.map((member, i) => {
|
|
51
51
|
const active = i === activeIndex;
|
|
52
52
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
53
|
"button",
|
|
@@ -55,7 +55,8 @@ const MentionList = (0, import_react.forwardRef)(function MentionList2({ members
|
|
|
55
55
|
type: "button",
|
|
56
56
|
role: "option",
|
|
57
57
|
"aria-selected": active,
|
|
58
|
-
|
|
58
|
+
"data-highlighted": active || void 0,
|
|
59
|
+
className: "tlui-button tlui-button__menu tlui-cmt-mention-list__item",
|
|
59
60
|
onMouseDown: (e) => e.preventDefault(),
|
|
60
61
|
onClick: () => onSelect?.(member),
|
|
61
62
|
children: renderMember ? renderMember(member) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultMemberRow, { member })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/mention-list.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ReactNode, forwardRef } from 'react'\nimport { defineMessages, useTranslation } from 'tldraw'\nimport { Avatar } from './avatar'\nimport { CommentAuthor } from './comment-author'\n\nconst messages = defineMessages({\n\tcommentsMentionNoMatches: { id: 'comments.mention-no-matches', defaultMessage: 'No matches' },\n\tcommentsMentionYou: { id: 'comments.mention-you', defaultMessage: 'You' },\n})\n\n/** A person the composer's \\@-mention picker can offer: a {@link CommentAuthor} plus its id and\n * picker-only display fields. @public */\nexport interface MentionMember extends CommentAuthor {\n\tid: string\n\t/**
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCE;AAxCF,mBAAsC;AACtC,oBAA+C;AAC/C,oBAAuB;AAGvB,MAAM,eAAW,8BAAe;AAAA,EAC/B,0BAA0B,EAAE,IAAI,+BAA+B,gBAAgB,aAAa;AAAA,EAC5F,oBAAoB,EAAE,IAAI,wBAAwB,gBAAgB,MAAM;AACzE,CAAC;AA6BD,SAAS,iBAAiB,EAAE,OAAO,GAA8B;AAChE,QAAM,UAAM,8BAAe;AAC3B,SACC,4EACC;AAAA,gDAAC,wBAAO,QAAQ,QAAQ;AAAA,IACxB,6CAAC,UAAK,WAAU,+BACf;AAAA,mDAAC,UAAK,WAAU,+BACd;AAAA,eAAO;AAAA,QACP,OAAO,OACP,4CAAC,UAAK,WAAU,8BAA8B,cAAI,IAAI,SAAS,kBAAkB,CAAC,KAAI;AAAA,SAExF;AAAA,MACC,OAAO,aACP,4CAAC,UAAK,WAAU,oCAAoC,iBAAO,WAAU;AAAA,OAEvE;AAAA,KACD;AAEF;AAQO,MAAM,kBAAc,yBAA6C,SAASA,aAChF,EAAE,SAAS,cAAc,GAAG,UAAU,YAAY,aAAa,GAC/D,KACC;AACD,QAAM,UAAM,8BAAe;AAC3B,MAAI,QAAQ,WAAW,GAAG;AACzB,WACC,4CAAC,SAAI,KAAU,WAAU,
|
|
4
|
+
"sourcesContent": ["import { ReactNode, forwardRef } from 'react'\nimport { defineMessages, useTranslation } from 'tldraw'\nimport { Avatar } from './avatar'\nimport { CommentAuthor } from './comment-author'\n\nconst messages = defineMessages({\n\tcommentsMentionNoMatches: { id: 'comments.mention-no-matches', defaultMessage: 'No matches' },\n\tcommentsMentionYou: { id: 'comments.mention-you', defaultMessage: 'You' },\n})\n\n/** A person the composer's \\@-mention picker can offer: a {@link CommentAuthor} plus its id and\n * picker-only display fields. @public */\nexport interface MentionMember extends CommentAuthor {\n\tid: string\n\t/** Muted text after the name, e.g. an email or handle. */\n\tsecondary?: string\n\t/** Marks the current user; shown as a \"(You)\" suffix after the name. */\n\tyou?: boolean\n\t/** Hosts may carry extra fields; a custom `renderMember` can read them. */\n\t[key: string]: unknown\n}\n\n/** @public */\nexport interface MentionListProps {\n\t/** Members to choose from \u2014 already resolved for the current query by the host. */\n\tmembers: MentionMember[]\n\t/** Index of the highlighted row, driven by the composer's keyboard navigation. */\n\tactiveIndex?: number\n\t/** Called when a member is chosen (click, or Enter on the active row). */\n\tonSelect?(member: MentionMember): void\n\t/** Shown when no member matches the query. Defaults to a translated \"No matches\". */\n\temptyLabel?: string\n\t/** Override a row's content (inside the selectable button). Defaults to avatar + name (+ secondary). */\n\trenderMember?(member: MentionMember): ReactNode\n}\n\n/** The default row content: avatar, name (with a \"(You)\" marker), and optional secondary text. */\nfunction DefaultMemberRow({ member }: { member: MentionMember }) {\n\tconst msg = useTranslation()\n\treturn (\n\t\t<>\n\t\t\t<Avatar author={member} />\n\t\t\t<span className=\"tlui-cmt-mention-list__text\">\n\t\t\t\t<span className=\"tlui-cmt-mention-list__name\">\n\t\t\t\t\t{member.name}\n\t\t\t\t\t{member.you && (\n\t\t\t\t\t\t<span className=\"tlui-cmt-mention-list__you\">{`(${msg(messages.commentsMentionYou)})`}</span>\n\t\t\t\t\t)}\n\t\t\t\t</span>\n\t\t\t\t{member.secondary && (\n\t\t\t\t\t<span className=\"tlui-cmt-mention-list__secondary\">{member.secondary}</span>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</>\n\t)\n}\n\n/**\n * The \\@-mention member picker: a popover list of people to mention, shown as the user types after\n * `@`. Presentational \u2014 the composer's suggestion plugin owns resolution, keyboard navigation, and\n * placement, and drives this with the host-resolved `members` and the highlighted `activeIndex`.\n * @public @react\n */\nexport const MentionList = forwardRef<HTMLDivElement, MentionListProps>(function MentionList(\n\t{ members, activeIndex = 0, onSelect, emptyLabel, renderMember },\n\tref\n) {\n\tconst msg = useTranslation()\n\tif (members.length === 0) {\n\t\treturn (\n\t\t\t<div ref={ref} className=\"tlui-menu tlui-cmt-mention-list tlui-cmt-mention-list--empty\">\n\t\t\t\t{emptyLabel ?? msg(messages.commentsMentionNoMatches)}\n\t\t\t</div>\n\t\t)\n\t}\n\treturn (\n\t\t<div ref={ref} className=\"tlui-menu tlui-cmt-mention-list\" role=\"listbox\">\n\t\t\t{members.map((member, i) => {\n\t\t\t\tconst active = i === activeIndex\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\tkey={member.id}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected={active}\n\t\t\t\t\t\tdata-highlighted={active || undefined}\n\t\t\t\t\t\tclassName=\"tlui-button tlui-button__menu tlui-cmt-mention-list__item\"\n\t\t\t\t\t\t// Keep the composer focused on a row press: it's portaled outside the editor, so a\n\t\t\t\t\t\t// bare mousedown would blur the composer \u2014 which now dismisses the picker \u2014 before\n\t\t\t\t\t\t// the click could select. Selection runs on click; focus stays put.\n\t\t\t\t\t\tonMouseDown={(e) => e.preventDefault()}\n\t\t\t\t\t\tonClick={() => onSelect?.(member)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderMember ? renderMember(member) : <DefaultMemberRow member={member} />}\n\t\t\t\t\t</button>\n\t\t\t\t)\n\t\t\t})}\n\t\t</div>\n\t)\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCE;AAxCF,mBAAsC;AACtC,oBAA+C;AAC/C,oBAAuB;AAGvB,MAAM,eAAW,8BAAe;AAAA,EAC/B,0BAA0B,EAAE,IAAI,+BAA+B,gBAAgB,aAAa;AAAA,EAC5F,oBAAoB,EAAE,IAAI,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|
104
104
|
* picker-only display fields. @public */
|
|
105
105
|
export declare interface MentionMember extends CommentAuthor {
|
|
106
106
|
id: string;
|
|
107
|
-
/**
|
|
107
|
+
/** Muted text after the name, e.g. an email or handle. */
|
|
108
108
|
secondary?: string;
|
|
109
109
|
/** Marks the current user; shown as a "(You)" suffix after the name. */
|
|
110
110
|
you?: boolean;
|
package/dist-esm/index.mjs
CHANGED
|
@@ -22,9 +22,9 @@ function DefaultMemberRow({ member }) {
|
|
|
22
22
|
const MentionList = forwardRef(function MentionList2({ members, activeIndex = 0, onSelect, emptyLabel, renderMember }, ref) {
|
|
23
23
|
const msg = useTranslation();
|
|
24
24
|
if (members.length === 0) {
|
|
25
|
-
return /* @__PURE__ */ jsx("div", { ref, className: "tlui-cmt-mention-list tlui-cmt-mention-list--empty", children: emptyLabel ?? msg(messages.commentsMentionNoMatches) });
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { ref, className: "tlui-menu tlui-cmt-mention-list tlui-cmt-mention-list--empty", children: emptyLabel ?? msg(messages.commentsMentionNoMatches) });
|
|
26
26
|
}
|
|
27
|
-
return /* @__PURE__ */ jsx("div", { ref, className: "tlui-cmt-mention-list", role: "listbox", children: members.map((member, i) => {
|
|
27
|
+
return /* @__PURE__ */ jsx("div", { ref, className: "tlui-menu tlui-cmt-mention-list", role: "listbox", children: members.map((member, i) => {
|
|
28
28
|
const active = i === activeIndex;
|
|
29
29
|
return /* @__PURE__ */ jsx(
|
|
30
30
|
"button",
|
|
@@ -32,7 +32,8 @@ const MentionList = forwardRef(function MentionList2({ members, activeIndex = 0,
|
|
|
32
32
|
type: "button",
|
|
33
33
|
role: "option",
|
|
34
34
|
"aria-selected": active,
|
|
35
|
-
|
|
35
|
+
"data-highlighted": active || void 0,
|
|
36
|
+
className: "tlui-button tlui-button__menu tlui-cmt-mention-list__item",
|
|
36
37
|
onMouseDown: (e) => e.preventDefault(),
|
|
37
38
|
onClick: () => onSelect?.(member),
|
|
38
39
|
children: renderMember ? renderMember(member) : /* @__PURE__ */ jsx(DefaultMemberRow, { member })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/mention-list.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ReactNode, forwardRef } from 'react'\nimport { defineMessages, useTranslation } from 'tldraw'\nimport { Avatar } from './avatar'\nimport { CommentAuthor } from './comment-author'\n\nconst messages = defineMessages({\n\tcommentsMentionNoMatches: { id: 'comments.mention-no-matches', defaultMessage: 'No matches' },\n\tcommentsMentionYou: { id: 'comments.mention-you', defaultMessage: 'You' },\n})\n\n/** A person the composer's \\@-mention picker can offer: a {@link CommentAuthor} plus its id and\n * picker-only display fields. @public */\nexport interface MentionMember extends CommentAuthor {\n\tid: string\n\t/**
|
|
5
|
-
"mappings": "AAwCE,mBACC,KAEC,YAHF;AAxCF,SAAoB,kBAAkB;AACtC,SAAS,gBAAgB,sBAAsB;AAC/C,SAAS,cAAc;AAGvB,MAAM,WAAW,eAAe;AAAA,EAC/B,0BAA0B,EAAE,IAAI,+BAA+B,gBAAgB,aAAa;AAAA,EAC5F,oBAAoB,EAAE,IAAI,wBAAwB,gBAAgB,MAAM;AACzE,CAAC;AA6BD,SAAS,iBAAiB,EAAE,OAAO,GAA8B;AAChE,QAAM,MAAM,eAAe;AAC3B,SACC,iCACC;AAAA,wBAAC,UAAO,QAAQ,QAAQ;AAAA,IACxB,qBAAC,UAAK,WAAU,+BACf;AAAA,2BAAC,UAAK,WAAU,+BACd;AAAA,eAAO;AAAA,QACP,OAAO,OACP,oBAAC,UAAK,WAAU,8BAA8B,cAAI,IAAI,SAAS,kBAAkB,CAAC,KAAI;AAAA,SAExF;AAAA,MACC,OAAO,aACP,oBAAC,UAAK,WAAU,oCAAoC,iBAAO,WAAU;AAAA,OAEvE;AAAA,KACD;AAEF;AAQO,MAAM,cAAc,WAA6C,SAASA,aAChF,EAAE,SAAS,cAAc,GAAG,UAAU,YAAY,aAAa,GAC/D,KACC;AACD,QAAM,MAAM,eAAe;AAC3B,MAAI,QAAQ,WAAW,GAAG;AACzB,WACC,oBAAC,SAAI,KAAU,WAAU,
|
|
4
|
+
"sourcesContent": ["import { ReactNode, forwardRef } from 'react'\nimport { defineMessages, useTranslation } from 'tldraw'\nimport { Avatar } from './avatar'\nimport { CommentAuthor } from './comment-author'\n\nconst messages = defineMessages({\n\tcommentsMentionNoMatches: { id: 'comments.mention-no-matches', defaultMessage: 'No matches' },\n\tcommentsMentionYou: { id: 'comments.mention-you', defaultMessage: 'You' },\n})\n\n/** A person the composer's \\@-mention picker can offer: a {@link CommentAuthor} plus its id and\n * picker-only display fields. @public */\nexport interface MentionMember extends CommentAuthor {\n\tid: string\n\t/** Muted text after the name, e.g. an email or handle. */\n\tsecondary?: string\n\t/** Marks the current user; shown as a \"(You)\" suffix after the name. */\n\tyou?: boolean\n\t/** Hosts may carry extra fields; a custom `renderMember` can read them. */\n\t[key: string]: unknown\n}\n\n/** @public */\nexport interface MentionListProps {\n\t/** Members to choose from \u2014 already resolved for the current query by the host. */\n\tmembers: MentionMember[]\n\t/** Index of the highlighted row, driven by the composer's keyboard navigation. */\n\tactiveIndex?: number\n\t/** Called when a member is chosen (click, or Enter on the active row). */\n\tonSelect?(member: MentionMember): void\n\t/** Shown when no member matches the query. Defaults to a translated \"No matches\". */\n\temptyLabel?: string\n\t/** Override a row's content (inside the selectable button). Defaults to avatar + name (+ secondary). */\n\trenderMember?(member: MentionMember): ReactNode\n}\n\n/** The default row content: avatar, name (with a \"(You)\" marker), and optional secondary text. */\nfunction DefaultMemberRow({ member }: { member: MentionMember }) {\n\tconst msg = useTranslation()\n\treturn (\n\t\t<>\n\t\t\t<Avatar author={member} />\n\t\t\t<span className=\"tlui-cmt-mention-list__text\">\n\t\t\t\t<span className=\"tlui-cmt-mention-list__name\">\n\t\t\t\t\t{member.name}\n\t\t\t\t\t{member.you && (\n\t\t\t\t\t\t<span className=\"tlui-cmt-mention-list__you\">{`(${msg(messages.commentsMentionYou)})`}</span>\n\t\t\t\t\t)}\n\t\t\t\t</span>\n\t\t\t\t{member.secondary && (\n\t\t\t\t\t<span className=\"tlui-cmt-mention-list__secondary\">{member.secondary}</span>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t</>\n\t)\n}\n\n/**\n * The \\@-mention member picker: a popover list of people to mention, shown as the user types after\n * `@`. Presentational \u2014 the composer's suggestion plugin owns resolution, keyboard navigation, and\n * placement, and drives this with the host-resolved `members` and the highlighted `activeIndex`.\n * @public @react\n */\nexport const MentionList = forwardRef<HTMLDivElement, MentionListProps>(function MentionList(\n\t{ members, activeIndex = 0, onSelect, emptyLabel, renderMember },\n\tref\n) {\n\tconst msg = useTranslation()\n\tif (members.length === 0) {\n\t\treturn (\n\t\t\t<div ref={ref} className=\"tlui-menu tlui-cmt-mention-list tlui-cmt-mention-list--empty\">\n\t\t\t\t{emptyLabel ?? msg(messages.commentsMentionNoMatches)}\n\t\t\t</div>\n\t\t)\n\t}\n\treturn (\n\t\t<div ref={ref} className=\"tlui-menu tlui-cmt-mention-list\" role=\"listbox\">\n\t\t\t{members.map((member, i) => {\n\t\t\t\tconst active = i === activeIndex\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\tkey={member.id}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected={active}\n\t\t\t\t\t\tdata-highlighted={active || undefined}\n\t\t\t\t\t\tclassName=\"tlui-button tlui-button__menu tlui-cmt-mention-list__item\"\n\t\t\t\t\t\t// Keep the composer focused on a row press: it's portaled outside the editor, so a\n\t\t\t\t\t\t// bare mousedown would blur the composer \u2014 which now dismisses the picker \u2014 before\n\t\t\t\t\t\t// the click could select. Selection runs on click; focus stays put.\n\t\t\t\t\t\tonMouseDown={(e) => e.preventDefault()}\n\t\t\t\t\t\tonClick={() => onSelect?.(member)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderMember ? renderMember(member) : <DefaultMemberR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AC,MAAM,EAAE,eAAe;AAAA,QACrC,SAAS,MAAM,WAAW,MAAM;AAAA,QAE/B,yBAAe,aAAa,MAAM,IAAI,oBAAC,oBAAiB,QAAgB;AAAA;AAAA,MAZpE,OAAO;AAAA,IAab;AAAA,EAEF,CAAC,GACF;AAEF,CAAC;",
|
|
6
6
|
"names": ["MentionList"]
|
|
7
7
|
}
|
package/mentions.css
CHANGED
|
@@ -28,56 +28,48 @@
|
|
|
28
28
|
border-radius: 4px;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/* mention picker
|
|
32
|
-
.tlui-
|
|
31
|
+
/* mention picker — row size, highlight, panel and shadow come from .tlui-menu and
|
|
32
|
+
.tlui-button__menu; these rules only lay out the row's contents. */
|
|
33
|
+
.tlui-menu.tlui-cmt-mention-list {
|
|
33
34
|
display: flex;
|
|
34
35
|
flex-direction: column;
|
|
35
|
-
gap: 4px;
|
|
36
|
-
padding: 4px;
|
|
37
36
|
width: 100%;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
color: var(--tl-color-text-1
|
|
42
|
-
background: var(--tl-color-panel, #fff);
|
|
43
|
-
border-radius: 10px;
|
|
44
|
-
/* shadow-3 (like the context menu) already carries a 1px inset edge — a separate `border`
|
|
45
|
-
on top of it double-outlines the popup. */
|
|
46
|
-
box-shadow: var(--tl-shadow-3, 0 2px 12px rgba(0, 0, 0, 0.14));
|
|
37
|
+
/* Fits MAX_SUGGESTIONS (8) menu rows: .tlui-menu hides its scrollbar and the active row
|
|
38
|
+
isn't scrolled into view, so a cut-off last row would be unreachable. */
|
|
39
|
+
max-height: 296px;
|
|
40
|
+
color: var(--tl-color-text-1);
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
.tlui-cmt-mention-list__item {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
border-radius: 6px;
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
text-align: left;
|
|
59
|
-
color: var(--tl-color-text-1);
|
|
60
|
-
font: inherit;
|
|
43
|
+
.tlui-cmt-mention-list .tlui-cmt-mention-list__item {
|
|
44
|
+
/* min-height rather than the menu row's fixed 40px, so a taller renderMember row can grow. */
|
|
45
|
+
height: auto;
|
|
46
|
+
min-height: 40px;
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
justify-content: flex-start;
|
|
49
|
+
text-align: start;
|
|
61
50
|
}
|
|
62
51
|
|
|
63
|
-
.tlui-cmt-mention-list__item
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
.tlui-cmt-mention-list__item .tlui-cmt-avatar {
|
|
53
|
+
width: 20px;
|
|
54
|
+
height: 20px;
|
|
55
|
+
font-size: 10px;
|
|
66
56
|
}
|
|
67
57
|
|
|
58
|
+
/* Name and secondary share one line so a row never outgrows the menu-row height. */
|
|
68
59
|
.tlui-cmt-mention-list__text {
|
|
69
60
|
display: flex;
|
|
70
|
-
|
|
61
|
+
align-items: baseline;
|
|
62
|
+
gap: 6px;
|
|
71
63
|
min-width: 0;
|
|
72
|
-
line-height: 1.3;
|
|
73
64
|
}
|
|
74
65
|
|
|
75
66
|
.tlui-cmt-mention-list__name {
|
|
76
67
|
font-size: 12px;
|
|
77
|
-
font-weight: 500;
|
|
78
68
|
white-space: nowrap;
|
|
79
69
|
overflow: hidden;
|
|
80
70
|
text-overflow: ellipsis;
|
|
71
|
+
flex-shrink: 0;
|
|
72
|
+
max-width: 100%;
|
|
81
73
|
}
|
|
82
74
|
|
|
83
75
|
.tlui-cmt-mention-list__you {
|
|
@@ -94,12 +86,13 @@
|
|
|
94
86
|
text-overflow: ellipsis;
|
|
95
87
|
}
|
|
96
88
|
|
|
97
|
-
.tlui-cmt-mention-list--empty {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
.tlui-menu.tlui-cmt-mention-list--empty {
|
|
90
|
+
flex-direction: row;
|
|
91
|
+
align-items: center;
|
|
92
|
+
height: 40px;
|
|
93
|
+
padding: 0 12px;
|
|
101
94
|
color: var(--tl-color-text-3);
|
|
102
|
-
font-size:
|
|
95
|
+
font-size: 12px;
|
|
103
96
|
}
|
|
104
97
|
|
|
105
98
|
/* the @-picker popup — anchored under the editor field, positioned by the suggestion plugin */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tldraw/mentions",
|
|
3
3
|
"description": "tldraw @-mention picker and TipTap node, shared by commenting and shape rich text.",
|
|
4
|
-
"version": "5.7.0-next.
|
|
4
|
+
"version": "5.7.0-next.e175bb4a0646",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"@tiptap/pm": "^3.12.1",
|
|
52
52
|
"@tiptap/react": "^3.12.1",
|
|
53
53
|
"@tiptap/suggestion": "3.13.0",
|
|
54
|
-
"@tldraw/utils": "5.7.0-next.
|
|
55
|
-
"tldraw": "5.7.0-next.
|
|
54
|
+
"@tldraw/utils": "5.7.0-next.e175bb4a0646",
|
|
55
|
+
"tldraw": "5.7.0-next.e175bb4a0646"
|
|
56
56
|
},
|
|
57
57
|
"module": "dist-esm/index.mjs",
|
|
58
58
|
"source": "src/index.ts",
|
package/src/mention-list.tsx
CHANGED
|
@@ -12,7 +12,7 @@ const messages = defineMessages({
|
|
|
12
12
|
* picker-only display fields. @public */
|
|
13
13
|
export interface MentionMember extends CommentAuthor {
|
|
14
14
|
id: string
|
|
15
|
-
/**
|
|
15
|
+
/** Muted text after the name, e.g. an email or handle. */
|
|
16
16
|
secondary?: string
|
|
17
17
|
/** Marks the current user; shown as a "(You)" suffix after the name. */
|
|
18
18
|
you?: boolean
|
|
@@ -34,7 +34,7 @@ export interface MentionListProps {
|
|
|
34
34
|
renderMember?(member: MentionMember): ReactNode
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/** The default row content: avatar, name (with a "(You)" marker), and
|
|
37
|
+
/** The default row content: avatar, name (with a "(You)" marker), and optional secondary text. */
|
|
38
38
|
function DefaultMemberRow({ member }: { member: MentionMember }) {
|
|
39
39
|
const msg = useTranslation()
|
|
40
40
|
return (
|
|
@@ -68,13 +68,13 @@ export const MentionList = forwardRef<HTMLDivElement, MentionListProps>(function
|
|
|
68
68
|
const msg = useTranslation()
|
|
69
69
|
if (members.length === 0) {
|
|
70
70
|
return (
|
|
71
|
-
<div ref={ref} className="tlui-cmt-mention-list tlui-cmt-mention-list--empty">
|
|
71
|
+
<div ref={ref} className="tlui-menu tlui-cmt-mention-list tlui-cmt-mention-list--empty">
|
|
72
72
|
{emptyLabel ?? msg(messages.commentsMentionNoMatches)}
|
|
73
73
|
</div>
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
return (
|
|
77
|
-
<div ref={ref} className="tlui-cmt-mention-list" role="listbox">
|
|
77
|
+
<div ref={ref} className="tlui-menu tlui-cmt-mention-list" role="listbox">
|
|
78
78
|
{members.map((member, i) => {
|
|
79
79
|
const active = i === activeIndex
|
|
80
80
|
return (
|
|
@@ -83,11 +83,8 @@ export const MentionList = forwardRef<HTMLDivElement, MentionListProps>(function
|
|
|
83
83
|
type="button"
|
|
84
84
|
role="option"
|
|
85
85
|
aria-selected={active}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
? 'tlui-cmt-mention-list__item tlui-cmt-mention-list__item--active'
|
|
89
|
-
: 'tlui-cmt-mention-list__item'
|
|
90
|
-
}
|
|
86
|
+
data-highlighted={active || undefined}
|
|
87
|
+
className="tlui-button tlui-button__menu tlui-cmt-mention-list__item"
|
|
91
88
|
// Keep the composer focused on a row press: it's portaled outside the editor, so a
|
|
92
89
|
// bare mousedown would blur the composer — which now dismisses the picker — before
|
|
93
90
|
// the click could select. Selection runs on click; focus stays put.
|