@box/threaded-annotations 4.8.6 → 4.8.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{THREADED_ANNOTATIONS_PORTAL}from"../esm/lib/v2/constants.js";import{MessageEditor}from"../esm/lib/components/v2/message-editor/message-editor.js";import{ThreadViewState,ThreadedAnnotationsProvider,useThreadedAnnotationsContext}from"../esm/lib/v2/threaded-annotations-context.js";import{t as MessagesView}from"./messages-view.js";import{buildMentionContent}from"../esm/lib/v2/utils/build-mention-content.js";import clsx from"clsx";import{useCallback,useEffect,useMemo,useRef}from"react";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/threaded-annotations2.css';var threaded_annotations_module_default={threadedAnnotations:`
|
|
1
|
+
import{THREADED_ANNOTATIONS_PORTAL}from"../esm/lib/v2/constants.js";import{MessageEditor}from"../esm/lib/components/v2/message-editor/message-editor.js";import{ThreadViewState,ThreadedAnnotationsProvider,useThreadedAnnotationsContext}from"../esm/lib/v2/threaded-annotations-context.js";import{t as MessagesView}from"./messages-view.js";import{buildMentionContent}from"../esm/lib/v2/utils/build-mention-content.js";import clsx from"clsx";import{useCallback,useEffect,useMemo,useRef}from"react";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/threaded-annotations2.css';var threaded_annotations_module_default={threadedAnnotations:`_threadedAnnotations_x0zhn_1`,expandable:`_expandable_x0zhn_13`,annotations:`_annotations_x0zhn_21`,highlighted:`_highlighted_x0zhn_21`},ThreadedAnnotationsContent=({messages:messageList,isResolved=!1,resolvedBy,resolvedAt,maxCharacterCount,onDelete,onThreadDelete,onAvatarClick,onCopyLink,onEdit,onEditError,onResolve,onUnresolve,onPost,onPostError,isRichTextEnabled=!1,onFormatToggle,userSelectorProps,onEditorOpenChange,annotationTarget,onAnnotationBadgeClick,originalContentDeleted,isHighlighted=!1,autoFocusReplyEditor=!0})=>{let{viewState,dispatch,editingMessageId,replyMention,isReplyDisabled,isAnnotations}=useThreadedAnnotationsContext(),containerRef=useRef(null),isExpanded=viewState!==ThreadViewState.Collapsed,hasHiddenReplies=messageList.length>2,isExpandable=viewState===ThreadViewState.Collapsed&&(hasHiddenReplies||!isReplyDisabled&&!isResolved);useEffect(()=>{editingMessageId&&!messageList.some(message=>message.id===editingMessageId)&&dispatch({type:`CLEAR_EDIT`})},[editingMessageId,messageList,dispatch]),useEffect(()=>{onEditorOpenChange?.(isExpanded)},[isExpanded,onEditorOpenChange]),useEffect(()=>{if(!isExpanded)return;let portalSelector=`[${Object.keys(THREADED_ANNOTATIONS_PORTAL)[0]}]`,handleClickOutside=e=>{let target=e.target;containerRef.current?.contains(target)||document.querySelector(portalSelector)?.contains(target)||dispatch({type:`COLLAPSE`})};return document.addEventListener(`mousedown`,handleClickOutside),()=>document.removeEventListener(`mousedown`,handleClickOutside)},[isExpanded,dispatch]);let hasNoMessages=messageList.length===0,handleClearMention=useCallback(()=>dispatch({type:`CLEAR_MENTION`}),[dispatch]),initialReplyContent=useMemo(()=>replyMention?buildMentionContent(replyMention):null,[replyMention]),handleClick=useCallback(e=>{if(!isExpandable)return;let target=e.target;!e.currentTarget.contains(target)||target.closest(`[data-no-expand]`)||dispatch({type:`EXPAND`})},[isExpandable,dispatch]);return isAnnotations&&hasNoMessages?jsx(MessageEditor,{isFirstAnnotation:!0,isRichTextEnabled,maxCharacterCount,onFormatToggle,onPost,onPostError,onPostSuccess:handleClearMention,userSelectorProps}):jsxs(`div`,{ref:containerRef,className:clsx(threaded_annotations_module_default.threadedAnnotations,isExpandable&&threaded_annotations_module_default.expandable,isAnnotations&&threaded_annotations_module_default.annotations,isHighlighted&&threaded_annotations_module_default.highlighted),"data-thread-expandable":isExpandable?!0:void 0,"data-thread-highlighted":isHighlighted?!0:void 0,onClick:isExpandable?handleClick:void 0,children:[jsx(MessagesView,{messages:messageList,isResolved,resolvedBy,resolvedAt,maxCharacterCount,onDelete,onThreadDelete,onAvatarClick,onCopyLink,onEdit,onEditError,onResolve,onUnresolve,isRichTextEnabled,onFormatToggle,userSelectorProps,annotationTarget,onAnnotationBadgeClick,originalContentDeleted}),viewState===ThreadViewState.Composing&&jsx(MessageEditor,{autoFocus:autoFocusReplyEditor,initialContent:initialReplyContent,isRichTextEnabled,maxCharacterCount,onFormatToggle,onPost,onPostError,onPostSuccess:handleClearMention,isReply:!0,userSelectorProps})]})},ThreadedAnnotations=props=>jsx(ThreadedAnnotationsProvider,{defaultExpanded:props.defaultExpanded||props.messages.length===0,isReplyDisabled:props.isReplyDisabled||props.isResolved,isEditDisabled:props.isEditDisabled||props.isResolved,isAnnotations:props.isAnnotations,collapsed:props.collapsed,children:jsx(ThreadedAnnotationsContent,{...props})});export{ThreadedAnnotations as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._threadedAnnotations_x0zhn_1{padding:var(--space-3) var(--space-4) var(--space-4) var(--space-3);background-color:var(--surface-surface);border-width:var(--border-1);border-style:solid;border-color:var(--bp-gray-10);border-radius:var(--radius-6);flex-direction:column;gap:1.125rem;transition:background-color 1s ease-out,border-color 1s ease-out;display:flex}._threadedAnnotations_x0zhn_1._expandable_x0zhn_13{cursor:pointer}._threadedAnnotations_x0zhn_1._expandable_x0zhn_13 [data-message-body],._threadedAnnotations_x0zhn_1._expandable_x0zhn_13 [data-message-author]{cursor:pointer;-webkit-user-select:none;user-select:none}._threadedAnnotations_x0zhn_1._expandable_x0zhn_13:not(._annotations_x0zhn_21,._highlighted_x0zhn_21):hover{background-color:var(--surface-surface-hover);--avatar-border-color:var(--surface-surface-hover);--fade-bg:var(--surface-surface-hover)}._threadedAnnotations_x0zhn_1._highlighted_x0zhn_21{background-color:var(--surface-item-surface-selected);border-color:var(--border-item-border-selected);--avatar-border-color:var(--surface-item-surface-selected);--fade-bg:var(--surface-item-surface-selected)}
|
|
@@ -60,7 +60,10 @@ interface ThreadedAnnotationsBaseProps {
|
|
|
60
60
|
* and `collapsed` always wins. Threads with no messages always mount expanded.
|
|
61
61
|
*/
|
|
62
62
|
defaultExpanded?: boolean;
|
|
63
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* When true, applies a visual highlight (border + background tint) to the thread card.
|
|
65
|
+
* Clearing the prop fades the treatment out over 1s — the caller owns hold timing. Not a focus state.
|
|
66
|
+
*/
|
|
64
67
|
isHighlighted?: boolean;
|
|
65
68
|
/**
|
|
66
69
|
* When false, the reply composer does not autofocus or scroll itself into view when the thread
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/threaded-annotations",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.8",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/dom": "^1.6.0",
|
|
@@ -21,23 +21,23 @@
|
|
|
21
21
|
"uuid": "^9.0.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@box/blueprint-web": "^16.20.
|
|
25
|
-
"@box/blueprint-web-assets": "^5.7.
|
|
26
|
-
"@box/collaboration-popover": "^2.2.
|
|
27
|
-
"@box/readable-time": "^2.2.
|
|
28
|
-
"@box/user-selector": "^3.0.
|
|
24
|
+
"@box/blueprint-web": "^16.20.7",
|
|
25
|
+
"@box/blueprint-web-assets": "^5.7.14",
|
|
26
|
+
"@box/collaboration-popover": "^2.2.23",
|
|
27
|
+
"@box/readable-time": "^2.2.23",
|
|
28
|
+
"@box/user-selector": "^3.0.1",
|
|
29
29
|
"clsx": "^1.2.1",
|
|
30
30
|
"react": "^18.0.0",
|
|
31
31
|
"react-dom": "^18.0.0",
|
|
32
32
|
"react-intl": "^6.4.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@box/blueprint-web": "^16.20.
|
|
36
|
-
"@box/blueprint-web-assets": "^5.7.
|
|
35
|
+
"@box/blueprint-web": "^16.20.7",
|
|
36
|
+
"@box/blueprint-web-assets": "^5.7.14",
|
|
37
37
|
"@box/eslint-plugin-blueprint": "2.2.8",
|
|
38
|
-
"@box/readable-time": "^2.2.
|
|
39
|
-
"@box/storybook-utils": "^1.2.
|
|
40
|
-
"@box/user-selector": "^3.0.
|
|
38
|
+
"@box/readable-time": "^2.2.23",
|
|
39
|
+
"@box/storybook-utils": "^1.2.23",
|
|
40
|
+
"@box/user-selector": "^3.0.1",
|
|
41
41
|
"react": "^18.0.0",
|
|
42
42
|
"react-dom": "^18.0.0"
|
|
43
43
|
},
|