@brainfish-ai/components 0.28.1 → 0.28.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainfish-ai/components",
3
- "version": "0.28.1",
3
+ "version": "0.28.3",
4
4
  "description": "Brainfish Components",
5
5
  "license": "MIT",
6
6
  "main": "./dist/esm/index.js",
@@ -65,7 +65,7 @@
65
65
  "**/*.css"
66
66
  ],
67
67
  "engines": {
68
- "node": "22.x"
68
+ "node": "22.x || 24.x"
69
69
  },
70
70
  "scripts": {
71
71
  "start": "NODE_ENV=development BABEL_ENV=development yarn storybook",
@@ -1 +0,0 @@
1
- {"version":3,"file":"sidebar.DsEgGwJU.js","sources":["../../../src/layouts/sidebar/context.tsx","../../../src/layouts/sidebar/app-nav/app-nav.tsx","../../../src/layouts/sidebar/article-nav/article-search.tsx","../../../src/layouts/sidebar/article-nav/article-item.tsx","../../../src/layouts/sidebar/article-nav/tree-sync.ts","../../../src/layouts/sidebar/article-nav/article-tree.tsx","../../../src/layouts/sidebar/article-nav/expansion.ts","../../../src/layouts/sidebar/article-nav/article-nav.tsx","../../../src/layouts/sidebar/section-nav/section-nav.tsx","../../../src/layouts/sidebar/sidebar.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { ArticleNavItem, ItemLinkComponent } from './types';\n\nexport interface SidebarContextProps {\n collapsed: boolean;\n ItemLinkComponent: ItemLinkComponent;\n activeArticleId?: string;\n onSelectArticle?: (id: string) => void;\n onExpandArticle?: (id: string) => void;\n onSearchArticles?: (value: string) => void;\n onAddArticle?: (parentId: string | null) => Promise<ArticleNavItem>;\n onMoreActions?: (articleId: string) => void;\n canMoveArticle?: (move: { id: string; parentId: string | null; index: number }) => boolean;\n onMoveArticle?: (moved: { id: string; parentId: string | null; index: number }) => void | Promise<void>;\n}\n\nexport interface SidebarContextValue extends SidebarContextProps {\n handleSearchArticles: (value: string) => void;\n isSearching: boolean;\n searchValue: string;\n setSearchValue: React.Dispatch<React.SetStateAction<string>>;\n /** Set when user selects from search results; tree uses this until activeArticleId catches up */\n lastSelectedArticleId: string | null;\n setLastSelectedArticleId: React.Dispatch<React.SetStateAction<string | null>>;\n}\n\nconst SidebarContext = React.createContext<SidebarContextValue | null>(null);\n\nexport function SidebarProvider({\n collapsed,\n ItemLinkComponent,\n activeArticleId,\n onSelectArticle,\n onExpandArticle,\n onSearchArticles,\n onAddArticle,\n onMoreActions,\n canMoveArticle,\n onMoveArticle,\n children,\n}: React.PropsWithChildren<SidebarContextProps>) {\n const [isSearching, setIsSearching] = React.useState<boolean>(false);\n const [searchValue, setSearchValue] = React.useState<string>('');\n const [lastSelectedArticleId, setLastSelectedArticleId] = React.useState<string | null>(null);\n\n const handleSearchArticles = React.useCallback(\n (value: string) => {\n const trimmedValue = value.trim();\n setIsSearching(trimmedValue !== '');\n onSearchArticles?.(value);\n },\n [onSearchArticles],\n );\n\n const contextValue = React.useMemo<SidebarContextValue>(\n () => ({\n collapsed,\n ItemLinkComponent,\n activeArticleId,\n onSearchArticles,\n onSelectArticle,\n onExpandArticle,\n onAddArticle,\n onMoreActions,\n canMoveArticle,\n onMoveArticle,\n isSearching,\n searchValue,\n setSearchValue,\n lastSelectedArticleId,\n setLastSelectedArticleId,\n handleSearchArticles,\n }),\n [\n isSearching,\n searchValue,\n lastSelectedArticleId,\n collapsed,\n ItemLinkComponent,\n activeArticleId,\n onSelectArticle,\n onExpandArticle,\n onSearchArticles,\n onAddArticle,\n onMoreActions,\n canMoveArticle,\n onMoveArticle,\n handleSearchArticles,\n ],\n );\n\n return <SidebarContext.Provider value={contextValue}>{children}</SidebarContext.Provider>;\n}\n\nexport function useSidebar() {\n const sidebarContext = React.useContext(SidebarContext);\n\n if (!sidebarContext) throw new Error('useSidebar must be used within SidebarProvider');\n\n return sidebarContext;\n}\n","import * as React from 'react';\nimport { ArrowBendUpLeft } from '@phosphor-icons/react';\n\nimport type { SidebarNavItem } from '../types';\nimport { useSidebar } from '../context';\n\nimport { Button } from '@/components/ui/button';\nimport { ScrollArea } from '@/components/ui/scroll-area';\nimport { cn } from '@/lib/utils';\n\nexport interface AppNavProps {\n className?: string;\n items?: SidebarNavItem[];\n activeId?: string;\n showBack?: boolean;\n onBack?: () => void;\n}\n\nexport function AppNav({ className, items, activeId, showBack, onBack }: AppNavProps) {\n const { collapsed, ItemLinkComponent } = useSidebar();\n\n const hasBack = !!showBack && !!onBack;\n\n return (\n <nav className={cn('flex flex-col gap-2', className)} aria-label=\"App navigation\">\n {hasBack && (\n <Button\n variant=\"link\"\n className={cn('py-2 text-base text-default w-full mx-4', collapsed ? 'justify-center' : 'justify-start')}\n size=\"icon\"\n onClick={onBack}\n >\n <ArrowBendUpLeft aria-hidden=\"true\" />\n <span className={cn(collapsed && 'sr-only')}>back to Brainfish</span>\n </Button>\n )}\n <ScrollArea className=\"min-h-0 max-h-[calc(100dvh-var(--header-nav-height)-5rem)]\">\n <div className=\"flex flex-col gap-2 mx-4\">\n {items?.map((item) => (\n <ItemLinkComponent\n key={item.id}\n className={cn(\n 'flex p-2 rounded-lg gap-1 text-base text-default items-center hover:text-primary-foreground focus:text-primary-foreground',\n item.id === activeId\n ? 'bg-primary text-primary-foreground font-bold'\n : 'hover:bg-lime-100 focus:bg-lime-100',\n )}\n href={item.href}\n data-sidebar-item-id={item.id}\n data-sidebar-item-type=\"app\"\n data-sidebar-app-nav-item-selected={item.id === activeId}\n >\n {item.Icon ? <item.Icon weight={item.id === activeId ? 'fill' : 'regular'} size={16} /> : null}\n <span className={cn('transition-opacity duration-200', collapsed && 'opacity-0 sr-only')}>\n {item.label}\n </span>\n </ItemLinkComponent>\n ))}\n </div>\n </ScrollArea>\n </nav>\n );\n}\n","import * as React from 'react';\nimport { MagnifyingGlass, X } from '@phosphor-icons/react';\nimport { useToggle } from 'usehooks-ts';\n\nimport { useSidebar } from '../context';\n\nimport { Input } from '@/components/ui/input';\n\nexport function ArticleSearch() {\n const { handleSearchArticles, searchValue, setSearchValue } = useSidebar();\n const [searchInteracted, , setSearchInteracted] = useToggle(false);\n const searchInputRef = React.useRef<HTMLInputElement>(null);\n\n React.useEffect(() => {\n if (searchInteracted) handleSearchArticles?.(searchValue);\n }, [searchValue, handleSearchArticles, searchInteracted]);\n\n return (\n <div className=\"mb-2\">\n <Input\n ref={searchInputRef}\n className=\"h-auto text-subtlest border-border-subtle\"\n startIcon={MagnifyingGlass}\n endIcon={searchValue ? X : undefined}\n onEndIconClick={() => {\n setSearchValue('');\n handleSearchArticles?.('');\n }}\n value={searchValue}\n onChange={(e) => {\n const value = e.target.value;\n if (!searchInteracted) {\n setSearchInteracted(true);\n }\n setSearchValue(value);\n if (value.trim() === '') {\n handleSearchArticles('');\n setSearchInteracted(false);\n }\n }}\n placeholder=\"Find an article\"\n aria-label=\"Find an article\"\n type=\"search\"\n />\n </div>\n );\n}\n","import * as React from 'react';\nimport { Folder, FolderDashed, FolderOpen, File, FileDashed, DotsThree, Lightning, Plus } from '@phosphor-icons/react';\nimport { Key, TreeItemContentRenderProps, TreeStateContext, Button as AriaButton } from 'react-aria-components';\n\nimport { ArticleNavItem, ItemLinkComponent } from '../types';\nimport { useSidebar } from '../context';\n\nimport { cn } from '@/lib/utils';\nimport { Button } from '@/components/ui/button';\nimport { ButtonGroup } from '@/components/ui/button-group';\nimport { Spinner } from '@/components/ui/spinner';\n\ntype ArticleItemTreeNode = {\n key: Key;\n value: ArticleNavItem;\n children: ArticleItemTreeNode[] | null;\n};\n\nfunction FolderSlotButton({ children }: { children: React.ReactNode }) {\n return (\n <AriaButton slot=\"chevron\" className=\"relative z-30 flex p-0\">\n <span className=\"relative inline-flex size-3 items-center justify-center\">{children}</span>\n </AriaButton>\n );\n}\n\nexport interface ArticleItemProps extends TreeItemContentRenderProps {\n ItemLinkComponent: ItemLinkComponent;\n item: ArticleItemTreeNode;\n onAddArticle?: (parentId: string) => void;\n isAddingArticle?: boolean;\n isLoadingChildren?: boolean;\n onMoreActions?: (articleId: string) => void;\n}\n\nexport function ArticleItem({\n item,\n hasChildItems,\n isSelected,\n isExpanded,\n ItemLinkComponent,\n onAddArticle,\n isAddingArticle,\n isLoadingChildren,\n onMoreActions,\n level,\n}: ArticleItemProps) {\n const { isSearching } = useSidebar();\n const treeState = React.useContext(TreeStateContext);\n const shouldPreventNavigation = Boolean(isSelected);\n\n const handleAddClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n onAddArticle?.(item.value.id);\n };\n\n const handleMoreClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n onMoreActions?.(item.value.id);\n };\n\n const handleItemClick = (e: React.MouseEvent) => {\n if (shouldPreventNavigation) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n if (hasChildItems && treeState) {\n treeState.toggleKey(item.key);\n }\n };\n\n const showActions = !!((onAddArticle && !isAddingArticle) || onMoreActions);\n\n const isDraft = item.value.status === 'draft';\n\n let statusLabel: string;\n switch (item.value.status) {\n case 'draft':\n statusLabel = '(draft)';\n break;\n case 'unpublished':\n statusLabel = '(unpublished changes)';\n break;\n default:\n statusLabel = '';\n }\n\n const folderIcon = (\n <FolderSlotButton>\n <Folder\n aria-hidden=\"true\"\n weight=\"fill\"\n className={cn(\n 'absolute size-3 transition-opacity duration-200 ease-out',\n isExpanded ? 'opacity-0' : 'opacity-100',\n )}\n />\n <FolderOpen\n aria-hidden=\"true\"\n weight=\"fill\"\n className={cn(\n 'absolute size-3 transition-opacity duration-200 ease-out',\n isExpanded ? 'opacity-100' : 'opacity-0',\n )}\n />\n </FolderSlotButton>\n );\n\n const folderWithChangesIcon = (\n <FolderSlotButton>\n <FolderDashed\n aria-hidden=\"true\"\n weight=\"fill\"\n className={cn(\n 'absolute size-3 transition-opacity duration-200 ease-out',\n isExpanded ? 'opacity-0' : 'opacity-100',\n )}\n />\n <FolderOpen\n aria-hidden=\"true\"\n weight=\"fill\"\n className={cn(\n 'absolute size-3 transition-opacity duration-200 ease-out',\n isExpanded ? 'opacity-100' : 'opacity-0',\n )}\n />\n </FolderSlotButton>\n );\n\n const discoveryIconContent = (\n <>\n <span className=\"sr-only\">Knowledge Discovery</span>\n <Lightning aria-hidden=\"true\" weight=\"fill\" className=\"size-3 shrink-0 text-blue-600\" />\n </>\n );\n\n const discoveryIcon = hasChildItems ? (\n <FolderSlotButton>\n <span className=\"text-blue-600\">{discoveryIconContent}</span>\n </FolderSlotButton>\n ) : (\n <span className=\"flex size-3 shrink-0 items-center justify-center text-blue-600\">{discoveryIconContent}</span>\n );\n\n const fileIcon = (\n <span className=\"flex size-3 shrink-0 items-center justify-center\">\n <File aria-hidden=\"true\" className=\"size-3\" />\n </span>\n );\n\n const fileWithChangesIcon = (\n <span className=\"flex size-3 shrink-0 items-center justify-center\">\n <span className=\"sr-only\">Unpublished Changes</span>\n <FileDashed aria-hidden=\"true\" className=\"size-3\" />\n </span>\n );\n\n const loadingFolderIcon = (\n <span\n className=\"flex size-3 shrink-0 items-center justify-center\"\n role=\"status\"\n aria-label={`Loading nested articles for ${item.value.label}`}\n >\n <Spinner aria-hidden=\"true\" className=\"size-3 text-current\" />\n <span className=\"sr-only\">Loading nested articles for {item.value.label}</span>\n </span>\n );\n\n const renderStatusIcon = (status: ArticleNavItem['status'], hasChildItems: boolean) => {\n if (status === 'discovery') {\n return discoveryIcon;\n }\n\n const hasChanges = status === 'unpublished' || status === 'draft';\n\n if (hasChildItems) {\n return hasChanges ? folderWithChangesIcon : folderIcon;\n } else {\n return hasChanges ? fileWithChangesIcon : fileIcon;\n }\n };\n\n return (\n <div\n style={{ ['--line-offset' as string]: '0.875rem' }}\n aria-busy={isLoadingChildren || undefined}\n className={cn(\n 'group relative flex items-center gap-1 rounded-md py-1 pl-1 ml-[calc((var(--tree-item-level)-1)*var(--line-offset))] pr-4 h-9',\n isDraft && 'text-subtlest italic',\n isSelected\n ? 'bg-lime-100 text-primary-foreground font-bold after:absolute after:-right-0.5 after:top-1/2 after:h-1/2 after:w-1 after:-translate-y-1/2 after:bg-lime-400'\n : 'hover:bg-dark-200 hover:text-accent-foreground',\n )}\n >\n {Array.from({ length: level - 1 }, (_, i) => (\n <span\n key={`${item.value.label}-${i + 1}`}\n style={{ ['--item-line-level' as string]: i + 1 }}\n // Don't mess with the calc: forumula for multiple lines.\n className=\"absolute w-[1px] bg-dark-400 -top-2 h-9 left-[calc(-4px-var(--line-offset)*(var(--item-line-level)-1))]\"\n aria-hidden={true}\n />\n ))}\n\n <AriaButton slot=\"drag\" className=\"sr-only\">\n Drag {item.value.label}\n </AriaButton>\n\n {isSearching ? null : isLoadingChildren ? loadingFolderIcon : renderStatusIcon(item.value.status, hasChildItems)}\n\n <ItemLinkComponent\n href={item.value.href}\n title={`${item.value.label} ${statusLabel}`}\n data-sidebar-item-id={item.value.id}\n data-sidebar-item-type=\"article\"\n className={cn(\n 'min-w-0 text-inherit text-sm truncate flex-1 after:absolute after:inset-0 after:z-10 pr-1',\n isSelected && 'text-primary-foreground',\n )}\n onClick={handleItemClick}\n >\n {item.value.label}\n </ItemLinkComponent>\n\n {showActions && (\n <ButtonGroup\n orientation=\"horizontal\"\n className={cn(\n 'absolute h-4 my-auto right-0.5 top-0 bottom-0 z-20 hidden items-center rounded-xl',\n 'group-hover:flex group-focus-within:flex',\n isSelected ? 'bg-lime-100 text-primary-foreground' : 'bg-dark-200',\n )}\n >\n {onMoreActions && (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={`More actions for ${item.value.label}`}\n className=\"size-4 [&_svg]:size-3.5\"\n onClick={handleMoreClick}\n >\n <DotsThree aria-hidden=\"true\" weight=\"bold\" />\n </Button>\n )}\n\n {onAddArticle && !isAddingArticle && (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={`Add article to ${item.value.label}`}\n className=\"size-4 [&_svg]:size-3.5\"\n onClick={handleAddClick}\n >\n <Plus aria-hidden=\"true\" />\n </Button>\n )}\n </ButtonGroup>\n )}\n </div>\n );\n}\n","import type { ArticleNavItem } from '../types';\n\ntype TreeEntry = {\n item: ArticleNavItem;\n parentId: string | null;\n index: number;\n depth: number;\n};\n\nexport type TreeSyncOperation =\n | { type: 'remove'; id: string }\n | { type: 'insert'; parentId: string | null; index: number; item: ArticleNavItem }\n | { type: 'move'; id: string; parentId: string | null; index: number }\n | { type: 'update'; id: string; item: ArticleNavItem };\n\nfunction flattenArticles(items: ArticleNavItem[], parentId: string | null = null, depth = 0, result: TreeEntry[] = []): TreeEntry[] {\n items.forEach((item, index) => {\n result.push({ item, parentId, index, depth });\n if (item.items?.length) {\n flattenArticles(item.items, item.id, depth + 1, result);\n }\n });\n\n return result;\n}\n\nfunction haveSameValue(a: ArticleNavItem, b: ArticleNavItem) {\n return (\n a.label === b.label &&\n a.href === b.href &&\n a.status === b.status &&\n a.hasChildren === b.hasChildren &&\n a.isLoadingChildren === b.isLoadingChildren\n );\n}\n\nexport function buildArticleTreeSyncOperations(currentArticles: ArticleNavItem[], nextArticles: ArticleNavItem[]): TreeSyncOperation[] {\n const currentEntries = flattenArticles(currentArticles);\n const nextEntries = flattenArticles(nextArticles);\n\n const currentMap = new Map(currentEntries.map((entry) => [entry.item.id, entry]));\n const nextMap = new Map(nextEntries.map((entry) => [entry.item.id, entry]));\n const operations: TreeSyncOperation[] = [];\n\n currentEntries\n .filter((entry) => !nextMap.has(entry.item.id))\n .sort((a, b) => b.depth - a.depth)\n .forEach((entry) => {\n operations.push({ type: 'remove', id: entry.item.id });\n });\n\n nextEntries.forEach((entry) => {\n const currentEntry = currentMap.get(entry.item.id);\n\n if (!currentEntry) {\n operations.push({\n type: 'insert',\n parentId: entry.parentId,\n index: entry.index,\n item: entry.item,\n });\n\n return;\n }\n\n if (currentEntry.parentId !== entry.parentId || currentEntry.index !== entry.index) {\n operations.push({\n type: 'move',\n id: entry.item.id,\n parentId: entry.parentId,\n index: entry.index,\n });\n }\n\n if (!haveSameValue(currentEntry.item, entry.item)) {\n operations.push({\n type: 'update',\n id: entry.item.id,\n item: entry.item,\n });\n }\n });\n\n return operations;\n}\n","import * as React from 'react';\nimport {\n useDragAndDrop,\n useTreeData,\n Tree,\n TreeItem,\n TreeItemContent,\n Collection,\n DropIndicator,\n type Key,\n} from 'react-aria-components';\n\nimport { ArticleNavItem } from '../types';\nimport { ArticleItem } from './article-item';\nimport { useSidebar } from '../context';\nimport { getNewlyExpandedKeys } from './expansion';\nimport { buildArticleTreeSyncOperations } from './tree-sync';\n\nlet placeholderCounter = 0;\n\ninterface ArticleTreeProps {\n articles: ArticleNavItem[];\n isSearching?: boolean;\n renderEmptyState?: () => React.ReactNode;\n}\n\nexport function getParentKeys(items: ArticleNavItem[], targetId: string, parents: string[] = []): string[] | null {\n for (const item of items) {\n if (item.id === targetId) {\n return parents;\n }\n if (item.items && item.items.length > 0) {\n const result = getParentKeys(item.items, targetId, [...parents, item.id]);\n if (result) return result;\n }\n }\n\n return null;\n}\n\ntype ArticleTreeNode = {\n value: ArticleNavItem;\n children: ArticleTreeNode[] | null;\n};\n\nfunction treeNodesToArticleNavItems(items: ArticleTreeNode[]): ArticleNavItem[] {\n return items.map((item) => ({\n ...item.value,\n items: item.children?.length ? treeNodesToArticleNavItems(item.children) : item.value.items,\n }));\n}\n\nexport function ArticleTree({ articles, isSearching, renderEmptyState }: ArticleTreeProps) {\n const {\n ItemLinkComponent,\n activeArticleId,\n lastSelectedArticleId,\n setLastSelectedArticleId,\n onSelectArticle,\n onExpandArticle,\n handleSearchArticles,\n setSearchValue,\n canMoveArticle,\n onMoveArticle,\n onAddArticle,\n onMoreActions,\n } = useSidebar();\n\n const effectiveActiveId = activeArticleId ?? lastSelectedArticleId ?? undefined;\n\n const articlesTree = useTreeData({\n initialItems: articles,\n getKey: (articleItem) => articleItem.id,\n getChildren: (articleItem) => articleItem.items ?? [],\n });\n\n const prevArticlesRef = React.useRef(articles);\n React.useEffect(() => {\n if (prevArticlesRef.current === articles) return;\n\n prevArticlesRef.current = articles;\n\n const currentArticles = treeNodesToArticleNavItems(articlesTree.items);\n const operations = buildArticleTreeSyncOperations(currentArticles, articles);\n\n if (operations.length === 0) return;\n\n operations.forEach((operation) => {\n switch (operation.type) {\n case 'remove':\n articlesTree.remove(operation.id);\n break;\n case 'insert':\n articlesTree.insert(operation.parentId, operation.index, operation.item);\n break;\n case 'move':\n articlesTree.move(operation.id, operation.parentId, operation.index);\n break;\n case 'update':\n articlesTree.update(operation.id, operation.item);\n break;\n }\n });\n }, [articles, articlesTree]);\n\n const { dragAndDropHooks } = useDragAndDrop({\n getItems: (_keys, items: typeof articlesTree.items) =>\n items.map((item) => ({\n 'text/plain': item.value.label,\n })),\n onMove: (e) => {\n if (isSearching) return;\n const movedArticleId = Array.from(e.keys)[0];\n if (!movedArticleId) return;\n\n const targetItem = articlesTree.getItem(e.target.key);\n if (!targetItem) return;\n\n let movedToParentId: string | null;\n let movedToIndex: number;\n\n if (e.target.dropPosition === 'on') {\n movedToParentId = e.target.key.toString();\n movedToIndex = targetItem.children?.length ?? 0;\n } else {\n movedToParentId = targetItem.parentKey?.toString() ?? null;\n const siblings = movedToParentId ? (articlesTree.getItem(movedToParentId)?.children ?? []) : articlesTree.items;\n const targetIndex = siblings.findIndex((i) => i.key === e.target.key);\n movedToIndex = e.target.dropPosition === 'before' ? targetIndex : targetIndex + 1;\n }\n\n const moveDetails = {\n id: movedArticleId.toString(),\n parentId: movedToParentId,\n index: movedToIndex,\n };\n\n if (canMoveArticle && !canMoveArticle(moveDetails)) {\n return;\n }\n\n const movedItem = articlesTree.getItem(movedArticleId);\n const originalParentId = movedItem?.parentKey?.toString() ?? null;\n const originalSiblings = originalParentId\n ? (articlesTree.getItem(originalParentId)?.children ?? [])\n : articlesTree.items;\n const originalIndex = originalSiblings.findIndex((i) => i.key === movedArticleId);\n\n if (e.target.dropPosition === 'on') {\n articlesTree.move(movedArticleId, movedToParentId, movedToIndex);\n } else if (e.target.dropPosition === 'before') {\n articlesTree.moveBefore(e.target.key, e.keys);\n } else {\n articlesTree.moveAfter(e.target.key, e.keys);\n }\n\n const result = onMoveArticle?.(moveDetails);\n\n if (result && typeof result.then === 'function') {\n result.catch(() => {\n articlesTree.move(movedArticleId, originalParentId, originalIndex);\n });\n }\n },\n renderDropIndicator: (target) => (\n <DropIndicator\n target={target}\n className=\"outline outline-1 outline-lime-200 ml-[calc(var(--tree-item-level)*0.5rem)]\"\n />\n ),\n });\n\n // Selection when there's no active article from URL/context; used so the tree can show a selection before navigation.\n const [localSelectedKeys, setLocalSelectedKeys] = React.useState<Set<Key>>(new Set());\n const selectedKeys = React.useMemo(\n () => (effectiveActiveId != null ? new Set<Key>([effectiveActiveId]) : localSelectedKeys),\n [effectiveActiveId, localSelectedKeys],\n );\n\n const pathToActive = React.useMemo(() => {\n if (!effectiveActiveId || isSearching || !articles.length) return [];\n const path = getParentKeys(articles, effectiveActiveId);\n\n return path ?? [];\n }, [articles, effectiveActiveId, isSearching]);\n\n const [expandedKeysState, setExpandedKeysState] = React.useState<Set<Key>>(new Set());\n const expandedKeys = React.useMemo(\n () => new Set<Key>([...pathToActive, ...expandedKeysState]),\n [pathToActive, expandedKeysState],\n );\n\n React.useEffect(() => {\n if (!activeArticleId) return;\n setLastSelectedArticleId(null);\n }, [activeArticleId, lastSelectedArticleId, setLastSelectedArticleId]);\n\n const pendingAddIdsRef = React.useRef<Set<string>>(new Set());\n const [pendingAddIds, setPendingAddIds] = React.useState<Set<string>>(new Set());\n\n const handleAddArticle = React.useCallback(\n (parentId: string) => {\n if (isSearching || !onAddArticle || pendingAddIdsRef.current.has(parentId)) return;\n\n pendingAddIdsRef.current.add(parentId);\n setPendingAddIds(new Set(pendingAddIdsRef.current));\n\n const tempId = `__placeholder_${++placeholderCounter}`;\n const placeholder: ArticleNavItem = { id: tempId, label: 'Untitled', href: '', status: 'draft' };\n\n articlesTree.append(parentId, placeholder);\n setExpandedKeysState((prev) => new Set([...prev, parentId]));\n\n onAddArticle(parentId).then(\n (created) => {\n articlesTree.remove(tempId);\n articlesTree.append(parentId, created);\n // Highlight the newly created article in the tree.\n setLocalSelectedKeys(new Set([created.id]));\n onSelectArticle?.(created.id);\n pendingAddIdsRef.current.delete(parentId);\n setPendingAddIds(new Set(pendingAddIdsRef.current));\n },\n () => {\n articlesTree.remove(tempId);\n pendingAddIdsRef.current.delete(parentId);\n setPendingAddIds(new Set(pendingAddIdsRef.current));\n },\n );\n },\n [isSearching, onAddArticle, articlesTree, onSelectArticle],\n );\n\n const navigateToArticleId = React.useCallback(\n (articleId: string) => {\n onSelectArticle?.(articleId);\n // No URL/store id: keep highlight in sync for Storybook and other uncontrolled hosts.\n if (activeArticleId == null) {\n setLocalSelectedKeys(new Set<Key>([articleId]));\n }\n if (isSearching) {\n setLastSelectedArticleId(articleId);\n setSearchValue('');\n handleSearchArticles?.('');\n }\n },\n [activeArticleId, handleSearchArticles, isSearching, onSelectArticle, setLastSelectedArticleId, setSearchValue],\n );\n\n return (\n <Tree\n aria-label={isSearching ? 'Search results' : 'Articles tree'}\n items={articlesTree.items}\n renderEmptyState={renderEmptyState}\n dragAndDropHooks={isSearching ? undefined : dragAndDropHooks}\n className=\"flex flex-col\"\n // toggle → selectOnFocus off in React Aria, so ArrowUp/Down only move focus; Space updates selection → onSelectionChange.\n selectionBehavior=\"toggle\"\n selectionMode=\"single\"\n expandedKeys={expandedKeys}\n onExpandedChange={(nextExpandedKeys) => {\n const newlyExpandedKeys = getNewlyExpandedKeys(expandedKeys, nextExpandedKeys);\n\n newlyExpandedKeys.forEach((key) => {\n onExpandArticle?.(key);\n });\n\n setExpandedKeysState(nextExpandedKeys);\n }}\n selectedKeys={selectedKeys}\n disallowEmptySelection\n onSelectionChange={(selection) => {\n if (selection !== 'all') {\n // Keep local selection in sync when we're not driven by URL/active article.\n if (effectiveActiveId == null) setLocalSelectedKeys(selection);\n const selected = Array.from(selection)?.[0];\n\n if (selected) {\n navigateToArticleId(selected.toString());\n }\n }\n }}\n >\n {function renderItem(item) {\n return (\n <TreeItem\n className=\"list-none\"\n textValue={item.value.label}\n id={item.value.id}\n hasChildItems={item.value.hasChildren}\n >\n <TreeItemContent>\n {(props) => (\n <ArticleItem\n ItemLinkComponent={ItemLinkComponent}\n item={item}\n onAddArticle={!isSearching && onAddArticle ? handleAddArticle : undefined}\n isAddingArticle={!isSearching && pendingAddIds.has(item.value.id)}\n isLoadingChildren={!isSearching && item.value.isLoadingChildren}\n onMoreActions={onMoreActions ? (articleId) => onMoreActions(articleId) : undefined}\n {...props}\n />\n )}\n </TreeItemContent>\n\n {!isSearching && item.children && <Collection items={item.children}>{renderItem}</Collection>}\n </TreeItem>\n );\n }}\n </Tree>\n );\n}\n","import type { Key } from 'react-aria-components';\n\nexport function getNewlyExpandedKeys(previous: Iterable<Key>, next: Iterable<Key>): string[] {\n const previousKeys = new Set(Array.from(previous, (key) => key.toString()));\n\n return Array.from(next, (key) => key.toString()).filter((key) => !previousKeys.has(key));\n}\n","import * as React from 'react';\nimport { Article } from '@phosphor-icons/react';\nimport { useDebounceValue } from 'usehooks-ts';\n\nimport { useSidebar } from '../context';\nimport { ArticleNavItem } from '../types';\nimport { ArticleSearch } from './article-search';\nimport { ArticleTree } from './article-tree';\n\nimport { Spinner } from '@/components/ui/spinner';\nimport { cn } from '@/lib/utils';\nimport { Button } from '@/components/ui/button';\nimport { useSubstringFilter } from '@/lib/hooks';\n\n/** Debounce applied to the article tree filter + remount key while searching (avoids work every keystroke). */\nconst ARTICLE_TREE_SEARCH_DEBOUNCE_MS = 400;\n/** Stable ref for useDebounceValue options — inline objects reset debounce each render (usehooks-ts #703). */\nconst ARTICLE_TREE_SEARCH_DEBOUNCE_OPTIONS = { leading: true, trailing: true } as const;\n\nexport interface ArticleNavProps {\n className?: string;\n isLoadingArticles?: boolean;\n articles?: ArticleNavItem[];\n}\n\nexport function ArticleNav({ articles, className, isLoadingArticles }: ArticleNavProps) {\n const { isSearching, searchValue, onAddArticle } = useSidebar();\n const { contains } = useSubstringFilter();\n const trimmedQuery = searchValue.trim();\n const [debouncedTreeQuery] = useDebounceValue(\n isSearching ? trimmedQuery : '',\n isSearching ? ARTICLE_TREE_SEARCH_DEBOUNCE_MS : 0,\n isSearching ? ARTICLE_TREE_SEARCH_DEBOUNCE_OPTIONS : undefined,\n );\n\n const shouldShowLoadingState = !isSearching && (isLoadingArticles ?? articles === undefined);\n const renderLoadingEmptyState = React.useCallback(\n () => (\n <div\n className=\"flex min-h-20 items-center justify-center text-muted-foreground\"\n role=\"status\"\n aria-live=\"polite\"\n aria-label=\"Loading articles list\"\n >\n <Spinner className=\"size-5\" aria-hidden=\"true\" />\n <span className=\"sr-only\">Loading articles list</span>\n </div>\n ),\n [],\n );\n\n const noArticles = !shouldShowLoadingState && !isSearching && (!articles || articles.length === 0);\n\n const filteredArticles = React.useMemo(() => {\n if (isSearching) {\n // `includes('')` is true for every string; avoid showing the full tree with an empty query.\n if (trimmedQuery === '' || debouncedTreeQuery === '') {\n return [];\n }\n const result: ArticleNavItem[] = [];\n const query = debouncedTreeQuery;\n\n const traverse = (nodes: ArticleNavItem[]) => {\n for (const item of nodes) {\n if (contains(item.label, query)) {\n // Strip children so each hit is one row; otherwise the tree would render nested\n // items AND the same nodes again as separate roots (duplicates).\n result.push({ ...item, hasChildren: false, items: [] });\n }\n if (item.items?.length) {\n traverse(item.items);\n }\n }\n };\n\n traverse(articles ?? []);\n\n return result;\n }\n if (articles && articles.length > 0) {\n return articles;\n }\n\n return [];\n }, [articles, isSearching, trimmedQuery, debouncedTreeQuery, contains]);\n\n return (\n <div className={cn('flex flex-col gap-0.5 px-4', className)}>\n {noArticles && (\n <Button variant=\"ghost\" className=\"text-subtlest\" onClick={() => onAddArticle?.(null).catch(() => {})}>\n <Article aria-hidden=\"true\" />\n Create first article or folder\n </Button>\n )}\n\n {shouldShowLoadingState ? (\n <ArticleTree articles={[]} renderEmptyState={renderLoadingEmptyState} />\n ) : (\n <>\n <ArticleSearch />\n <nav aria-label=\"Articles navigation\">\n <ArticleTree\n key={isSearching ? (trimmedQuery === '' ? 'search:empty' : `search:${debouncedTreeQuery}`) : 'browse'}\n articles={filteredArticles ?? []}\n />\n </nav>\n </>\n )}\n </div>\n );\n}\n","import * as React from 'react';\n\nimport { SidebarNavItem } from '../types';\nimport { useSidebar } from '../context';\n\nimport { cn } from '@/lib/utils';\n\nexport interface SectionNavProps {\n className?: string;\n items: SidebarNavItem[];\n activeId?: string;\n}\n\nexport function SectionNav({ className, items, activeId }: SectionNavProps) {\n const { ItemLinkComponent } = useSidebar();\n\n return (\n <nav className={cn('flex flex-col', className)} aria-label=\"App section navigation\">\n {items.map((item) => (\n <ItemLinkComponent\n key={item.id}\n href={item.href}\n data-sidebar-item-id={item.id}\n data-sidebar-item-type=\"section\"\n data-sidebar-section-nav-item-selected={item.id === activeId}\n className={cn(\n 'flex p-2 mx-4 text-base text-default relative rounded-lg',\n 'after:transition-opacity after:absolute after:top-0 after:bottom-0 after:-right-4 after:w-2 after:bg-primary after:rounded-l-md after:opacity-0',\n 'hover:bg-lime-100 focus:bg-lime-100 hover:text-primary-foreground focus:text-primary-foreground',\n item.id === activeId && 'font-bold after:opacity-100',\n )}\n >\n {item.label}\n </ItemLinkComponent>\n ))}\n </nav>\n );\n}\n","import * as React from 'react';\n\nimport { SidebarNavItem, ArticleNavItem } from './types';\nimport { SidebarContextProps, SidebarProvider } from './context';\nimport { AppNav } from './app-nav';\nimport { ArticleNav } from './article-nav';\nimport { SectionNav } from './section-nav';\n\nimport { ScrollArea } from '@/components/ui/scroll-area';\nimport { cn } from '@/lib/utils';\n\nexport interface SidebarProps extends React.ComponentPropsWithoutRef<'aside'>, SidebarContextProps {\n showAppBack?: boolean;\n onAppBack?: () => void;\n appNavItems?: SidebarNavItem[];\n appNavActiveId?: string;\n showArticles?: boolean;\n isLoadingArticles?: boolean;\n articles?: ArticleNavItem[];\n sectionNavItems?: SidebarNavItem[];\n sectionNavActiveId?: string;\n}\n\nexport const Sidebar = React.forwardRef<HTMLElement, SidebarProps>(function Sidebar(\n {\n className,\n ItemLinkComponent,\n collapsed,\n showAppBack,\n onAppBack,\n appNavItems,\n appNavActiveId,\n isLoadingArticles,\n sectionNavItems,\n sectionNavActiveId,\n activeArticleId,\n showArticles,\n articles,\n onSelectArticle,\n onExpandArticle,\n onSearchArticles,\n onAddArticle,\n onMoreActions,\n canMoveArticle,\n onMoveArticle,\n ...props\n },\n ref,\n) {\n // indicates if the scroll area is at the bottom\n const [atScrollBottom, setAtScrollBottom] = React.useState(false);\n\n // detect if the scroll area is at the bottom\n const handleScroll = (event: React.UIEvent<HTMLDivElement>) => {\n const { scrollHeight, scrollTop, clientHeight } = event.currentTarget;\n setAtScrollBottom(scrollTop + clientHeight >= scrollHeight);\n };\n\n return (\n <SidebarProvider\n collapsed={!!collapsed}\n ItemLinkComponent={ItemLinkComponent}\n activeArticleId={activeArticleId}\n onSelectArticle={onSelectArticle}\n onExpandArticle={onExpandArticle}\n onSearchArticles={onSearchArticles}\n onAddArticle={onAddArticle}\n onMoreActions={onMoreActions}\n canMoveArticle={canMoveArticle}\n onMoveArticle={onMoveArticle}\n >\n <aside\n ref={ref}\n {...props}\n className={cn(\n 'py-4 transition-width duration-200 ease-in-out flex flex-col h-dvh',\n collapsed ? 'w-[64px]' : 'w-[260px]',\n className,\n )}\n aria-label=\"Application navigation\"\n >\n <AppNav\n className={cn(\n 'flex-shrink-0',\n appNavItems && appNavItems.length > 0 && 'pb-4',\n !collapsed && 'border-b border-border-subtle',\n )}\n showBack={showAppBack}\n items={appNavItems}\n activeId={appNavActiveId}\n onBack={onAppBack}\n />\n\n {!collapsed && (\n <>\n {showArticles && (\n <ScrollArea onScroll={handleScroll}>\n <ArticleNav\n className=\"py-4 max-w-[var(--left-nav-width,inherit)]\"\n articles={articles}\n isLoadingArticles={isLoadingArticles}\n />\n </ScrollArea>\n )}\n {sectionNavItems && sectionNavItems.length > 0 && (\n <SectionNav\n className={cn('pt-4 flex-shrink-0', !collapsed && !atScrollBottom && 'border-t border-subtle')}\n items={sectionNavItems}\n activeId={sectionNavActiveId}\n />\n )}\n </>\n )}\n </aside>\n </SidebarProvider>\n );\n});\n"],"names":["SidebarContext","React","createContext","SidebarProvider","collapsed","ItemLinkComponent","activeArticleId","onSelectArticle","onExpandArticle","onSearchArticles","onAddArticle","onMoreActions","canMoveArticle","onMoveArticle","children","isSearching","setIsSearching","useState","searchValue","setSearchValue","lastSelectedArticleId","setLastSelectedArticleId","handleSearchArticles","useCallback","value","trimmedValue","trim","contextValue","useMemo","Provider","useSidebar","sidebarContext","useContext","Error","AppNav","className","items","activeId","showBack","onBack","hasBack","createElement","cn","Button","variant","size","onClick","ArrowBendUpLeft","ScrollArea","map","item","key","id","href","Icon","weight","label","ArticleSearch","searchInteracted","setSearchInteracted","useToggle","searchInputRef","useRef","useEffect","Input","ref","startIcon","MagnifyingGlass","endIcon","X","onEndIconClick","onChange","e","target","placeholder","type","FolderSlotButton","AriaButton","slot","ArticleItem","hasChildItems","isSelected","isExpanded","isAddingArticle","isLoadingChildren","level","treeState","TreeStateContext","shouldPreventNavigation","Boolean","showActions","isDraft","status","statusLabel","folderIcon","Folder","FolderOpen","folderWithChangesIcon","FolderDashed","discoveryIconContent","Fragment","Lightning","discoveryIcon","fileIcon","File","fileWithChangesIcon","FileDashed","loadingFolderIcon","role","Spinner","style","Array","from","length","_","i","hasChanges","renderStatusIcon","title","preventDefault","stopPropagation","toggleKey","ButtonGroup","orientation","DotsThree","Plus","flattenArticles","parentId","depth","result","forEach","index","push","placeholderCounter","getParentKeys","targetId","parents","treeNodesToArticleNavItems","ArticleTree","articles","renderEmptyState","effectiveActiveId","articlesTree","useTreeData","initialItems","getKey","articleItem","getChildren","prevArticlesRef","current","operations","currentArticles","nextArticles","currentEntries","nextEntries","currentMap","Map","entry","nextMap","filter","has","sort","a","b","currentEntry","get","hasChildren","buildArticleTreeSyncOperations","operation","remove","insert","move","update","dragAndDropHooks","useDragAndDrop","getItems","_keys","onMove","movedArticleId","keys","targetItem","getItem","movedToParentId","movedToIndex","dropPosition","toString","parentKey","targetIndex","findIndex","moveDetails","movedItem","originalParentId","originalIndex","moveBefore","moveAfter","then","catch","renderDropIndicator","DropIndicator","localSelectedKeys","setLocalSelectedKeys","Set","selectedKeys","pathToActive","expandedKeysState","setExpandedKeysState","expandedKeys","pendingAddIdsRef","pendingAddIds","setPendingAddIds","handleAddArticle","add","tempId","append","prev","created","delete","navigateToArticleId","articleId","Tree","selectionBehavior","selectionMode","onExpandedChange","nextExpandedKeys","previous","next","previousKeys","getNewlyExpandedKeys","disallowEmptySelection","onSelectionChange","selection","selected","renderItem","TreeItem","textValue","TreeItemContent","props","Collection","ARTICLE_TREE_SEARCH_DEBOUNCE_OPTIONS","leading","trailing","ArticleNav","isLoadingArticles","contains","useSubstringFilter","trimmedQuery","debouncedTreeQuery","useDebounceValue","shouldShowLoadingState","renderLoadingEmptyState","noArticles","filteredArticles","query","traverse","nodes","Article","SectionNav","Sidebar","forwardRef","showAppBack","onAppBack","appNavItems","appNavActiveId","sectionNavItems","sectionNavActiveId","showArticles","atScrollBottom","setAtScrollBottom","onScroll","event","scrollHeight","scrollTop","clientHeight","currentTarget"],"mappings":"8zBA2BA,MAAMA,EAAiBC,EAAMC,cAA0C,MAEhE,SAASC,GAAgBC,UAC9BA,EACAC,kBAAAA,EAAAA,gBACAC,EAAAC,gBACAA,EAAAC,gBACAA,EAAAC,iBACAA,EAAAC,aACAA,EAAAC,cACAA,EAAAC,eACAA,EAAAC,cACAA,EAAAC,SACAA,IAEA,MAAOC,EAAaC,GAAkBf,EAAMgB,UAAkB,IACvDC,EAAaC,GAAkBlB,EAAMgB,SAAiB,KACtDG,EAAuBC,GAA4BpB,EAAMgB,SAAwB,MAElFK,EAAuBrB,EAAMsB,YAChCC,IACC,MAAMC,EAAeD,EAAME,OAC3BV,EAAgC,KAAjBS,GACfhB,IAAmBe,IAErB,CAACf,IAGGkB,EAAe1B,EAAM2B,QACzB,KAAA,CACExB,YACAC,kBAAAA,EACAC,kBACAG,mBACAF,kBACAC,kBACAE,eACAC,gBACAC,iBACAC,gBACAE,cACAG,cACAC,iBACAC,wBACA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ACAC,kBACAC,mBACAC,eACAC,gBACAC,iBACAC;eAEAZ,EAAAwC,cAAC,QAAA,CACCwB,SACI2K,EACJzM,UAAWO,EACT,qEACAtC,EAAY,WAAa,YACzB+B,GAEF,aAAW;eAEXlC,EAAAwC,cAACP,EAAA,CACCC,UAAWO,EACT,gBACA2N,GAAeA,EAAYpJ,OAAS,GAAK,QACxC7G,GAAa,iCAEhBkC,SAAU6N,EACV/N,MAAOiO,EACPhO,SAAUiO,EACV/N,OAAQ6N,KAGRhQ,kBACAH,EAAAwC,cAAAxC,EAAAmG,SAAA,KACGqK,kBACCxQ,EAAAwC,cAACO,EAAA,CAAW4N,SA3CFC,IACpB,MAAMC,aAAEA,EAAAC,UAAcA,EAAAC,aAAWA,GAAiBH,EAAMI,cACxDN,EAAkBI,EAAYC,GAAgBF,oBA0ClC7Q,EAAAwC,cAACwM,EAAA,CACC9M,UAAU,6CACVwG,WACAuG,uBAILqB,GAAmBA,EAAgBtJ,OAAS,kBAC3ChH,EAAAwC,cAACuN,EAAA,CACC7N,UAAWO,EAAG,sBAAuBtC,IAAcsQ,GAAkB,0BACrEtO,MAAOmO,EACPlO,SAAUmO,MAQ1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"suggestion-card.bmZvXXVu.js","sources":["../../../src/scenes/knowledge-review/review-list/edit-count.tsx","../../../src/scenes/knowledge-review/review-list/review-list-item.tsx","../../../src/scenes/knowledge-review/context.tsx","../../../src/scenes/knowledge-review/review-list/review-list.tsx","../../../src/scenes/knowledge-review/suggestion-card/suggestion-card.tsx"],"sourcesContent":["import React from 'react';\nimport { Circle } from '@phosphor-icons/react';\n\nexport function EditCount({ count }: { count: number }) {\n return (\n <span className=\"inline-flex items-center gap-0.5\">\n <Circle size={8} weight=\"fill\" aria-hidden=\"true\" className=\"text-blue\" />\n <span className=\"text-xs leading-4 text-subtle\">\n {count} {count === 1 ? 'edit' : 'edits'}\n </span>\n </span>\n );\n}\n","import * as React from 'react';\n\nimport { EditCount } from './edit-count';\n\nimport { cn } from '@/lib/utils';\nimport { formatDistance } from '@/lib/formatDate';\nimport { StatusBadge } from '@/components/convos/status-badge';\n\nexport interface ReviewListItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique identifier for the knowledge article */\n id: string;\n /** Primary text displayed in the first row */\n title: string;\n /** Content rendered in the top-right corner (e.g. relative timestamp) */\n timestamp: Date;\n /** Icon rendered at the start of the second row */\n icon?: React.ReactNode;\n /** Text or content next to the icon in the second row */\n description?: string | null;\n /** Whether this item is new */\n isNew?: boolean;\n /** Whether this item has been accepted (e.g. accepted as draft) */\n isAccepted?: boolean;\n /** Number of edits for this item */\n editCount?: number;\n /** Whether this item is currently selected */\n isSelected?: boolean;\n}\n\nexport const ReviewListItem = React.forwardRef<HTMLButtonElement, ReviewListItemProps>(function ReviewListItem(\n { title, timestamp, icon, description, isNew, isAccepted, editCount, isSelected = false, className, ...props },\n ref,\n) {\n let status: React.ReactNode | undefined;\n if (isAccepted) {\n status = <StatusBadge variant=\"accepted\">Accepted</StatusBadge>;\n } else if (editCount) {\n status = <EditCount count={editCount} />;\n }\n\n return (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n aria-pressed={isSelected}\n className={cn(\n 'relative flex w-full flex-col gap-1 bg-surface rounded p-4 cursor-pointer transition-colors text-left border border-transparent',\n isSelected\n ? [\n 'shadow-[0px_1px_3px_0px_rgba(95,95,95,0.26)]',\n 'after:content-[\"\"] after:block after:absolute after:right-[-2px] after:top-1/2 after:-translate-y-1/2 after:w-1 after:h-14 after:rounded-sm after:bg-primary',\n ]\n : 'hover:bg-dark-100 hover:border-dark-300',\n className,\n )}\n >\n {/* Row 1: Title + Timestamp */}\n <span className=\"flex items-center justify-between w-full gap-2\">\n <span className={cn('text-sm text-default truncate min-w-0 flex-1', isSelected ? 'font-bold' : 'font-normal')}>\n {title}\n </span>\n {timestamp && <span className=\"text-xs leading-4 text-subtlest shrink-0\">{formatDistance(timestamp)}</span>}\n </span>\n\n {/* Row 2: Icon + Description + Status */}\n {(icon || description || status) && (\n <span className=\"flex items-center gap-1 leading-4\">\n {/* isNew */}\n {isNew && (\n <StatusBadge variant=\"success\" surface=\"transparent\">\n New\n </StatusBadge>\n )}\n {/* icon */}\n {icon && <span className=\"shrink-0 flex items-center\">{icon}</span>}\n {/* description */}\n {description && <span className=\"text-xs text-subtle truncate\">{description}</span>}\n {/* not new but with status */}\n {!isNew && status && <span className=\"shrink-0 ml-1 flex items-center\">{status}</span>}\n </span>\n )}\n </button>\n );\n});\n","import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';\n\nimport type { ReviewListItemProps } from './review-list/review-list-item';\n\nexport type LoadedDiffDoc = {\n isNew: boolean;\n diffTitle: string;\n diffContent: React.ReactNode;\n};\n\ntype ReviewsSelectionValue = {\n selectedItem: ReviewListItemProps | null;\n setSelectedItem: (item: ReviewListItemProps | null) => void;\n loadedDiffDoc: LoadedDiffDoc | null;\n setLoadedDiffDoc: (doc: LoadedDiffDoc | null) => void;\n loadingDiff: boolean;\n setLoadingDiff: (loading: boolean) => void;\n onApproveAllSuggestions: () => void;\n onRejectAllSuggestions: () => void;\n onAcceptAndPublish?: () => void;\n onOpenArticleLink?: () => void;\n onSourceLinkClick?: () => void;\n breadcrumb?: string;\n suggestionReasonBody?: string;\n};\n\nconst ReviewsContext = createContext<ReviewsSelectionValue | null>(null);\n\nexport type ReviewsProviderProps = {\n children: React.ReactNode;\n /** Optional initial selection (e.g. from server or mock data) */\n defaultSelectedItem?: ReviewListItemProps | null;\n onApproveAllSuggestions: () => void;\n onRejectAllSuggestions: () => void;\n onAcceptAndPublish?: () => void;\n onOpenArticleLink?: () => void;\n onSourceLinkClick?: () => void;\n breadcrumb?: string;\n suggestionReasonBody?: string;\n};\n\nexport function ReviewsSelectionProvider({\n children,\n defaultSelectedItem = null,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onAcceptAndPublish,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n suggestionReasonBody,\n}: ReviewsProviderProps) {\n const [userSelectedItem, setUserSelectedItem] = useState<ReviewListItemProps | null>(null);\n const selectedItem = userSelectedItem ?? defaultSelectedItem;\n\n const [loadedDiffDoc, setLoadedDiffDoc] = useState<LoadedDiffDoc | null>(null);\n\n const [loadingDiff, setLoadingDiff] = useState(false);\n\n const handleSelect = useCallback((item: ReviewListItemProps | null) => setUserSelectedItem(item), []);\n const value = useMemo<ReviewsSelectionValue>(\n () => ({\n selectedItem,\n setSelectedItem: handleSelect,\n loadedDiffDoc,\n setLoadedDiffDoc,\n loadingDiff,\n setLoadingDiff,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onAcceptAndPublish,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n suggestionReasonBody,\n }),\n [\n selectedItem,\n handleSelect,\n loadedDiffDoc,\n loadingDiff,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onAcceptAndPublish,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n suggestionReasonBody,\n ],\n );\n\n return <ReviewsContext.Provider value={value}>{children}</ReviewsContext.Provider>;\n}\n\nexport function useReviewsSelection(): ReviewsSelectionValue {\n const ctx = useContext(ReviewsContext);\n if (!ctx) {\n throw new Error('useReviewsSelection must be used within ReviewsSelectionProvider');\n }\n\n return ctx;\n}\n","import React, { forwardRef } from 'react';\n\nimport { ReviewListItem, ReviewListItemProps } from './review-list-item';\nimport { useReviewsSelection } from '../context';\n\nimport { cn } from '@/lib/utils';\n\ninterface ReviewListProps {\n items: ReviewListItemProps[];\n className?: string;\n}\n\nexport const ReviewList = forwardRef<HTMLUListElement, ReviewListProps>(({ items, className, ...props }, ref) => {\n const { selectedItem, setSelectedItem } = useReviewsSelection();\n\n return (\n <ul\n ref={ref}\n className={cn(\n 'min-w-0 w-full overflow-hidden bg-muted border border-dark-300 rounded-lg p-2 space-y-2 list-none m-0',\n className,\n )}\n {...props}\n >\n {items.map((item) => (\n <li key={item.id}>\n <ReviewListItem {...item} isSelected={selectedItem?.id === item.id} onClick={() => setSelectedItem(item)} />\n </li>\n ))}\n </ul>\n );\n});\nReviewList.displayName = 'ReviewList';\n","import * as React from 'react';\nimport { CaretDown, CaretUp, CheckCircle, XCircle } from '@phosphor-icons/react';\n\nimport { Button } from '@/components/ui/button';\nimport { brandShadowEffect } from '@/lib/styles';\nimport { cn } from '@/lib/utils';\n\nexport interface SuggestionCardSource {\n /** Eyebrow label, e.g. \"1 day ago from\" — rendered uppercase by the card. */\n label: string;\n /** Display name of the source, e.g. \"team-meetingFEB.mp4\". */\n name: string;\n /**\n * Optional icon next to the source name. Pass a `@phosphor-icons/react` icon.\n */\n icon?: React.ReactNode;\n}\n\n/**\n * Pagination state for the side paginator column. When omitted, the paginator\n * column (and its divider) is not rendered at all.\n */\nexport interface SuggestionCardPagination {\n /** 1-based index of this suggestion within the set. */\n currentIndex: number;\n /** Total number of suggestions in the set. */\n totalCount: number;\n /** Fires when the user navigates to the previous suggestion. Omit to hide the button. */\n onPrevious?: () => void;\n /** Fires when the user navigates to the next suggestion. Omit to hide the button. */\n onNext?: () => void;\n}\n\n/**\n * Visual diff shown between the source row and the reason. Renders as a\n * single bordered row with the old text struck-through in destructive color\n * and the new text in link color.\n *\n * - For replace ops, set both `oldText` and `newText`.\n * - For delete ops, set only `oldText`.\n * - For insert ops, set only `newText`.\n *\n * When both fields are empty/undefined the diff row is not rendered.\n */\nexport interface SuggestionCardDiff {\n /** Original text being removed. Strikethrough + destructive. */\n oldText?: string;\n /** Proposed replacement / insertion. Link color. */\n newText?: string;\n}\n\nexport interface SuggestionCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n /**\n * Source metadata shown at the top of the card. Omit to skip the source\n * row entirely — useful when the host doesn't have source info to surface.\n */\n source?: SuggestionCardSource;\n /**\n * Old vs. new text for the suggestion. Renders the bordered diff row\n * between the source and the reason. Omit to skip the diff row entirely.\n */\n diff?: SuggestionCardDiff;\n /**\n * Host-provided explanation for why this suggestion was raised. Renders\n * as the body paragraph below the diff. Omit to skip the reason line.\n */\n reason?: string;\n\n /**\n * Fires when the user accepts this suggestion. When omitted, the accept\n * button is rendered disabled (so the affordance is visible but inert).\n */\n onAccept?: () => void;\n /**\n * Fires when the user rejects this suggestion. When omitted, the reject\n * button is rendered disabled.\n */\n onReject?: () => void;\n /** Disable the accept button while an accept is in-flight. */\n acceptDisabled?: boolean;\n /** Disable the reject button while a reject is in-flight. */\n rejectDisabled?: boolean;\n\n /**\n * Paginator state. When omitted, the whole paginator column (and its\n * dividing border) is not rendered.\n */\n pagination?: SuggestionCardPagination;\n readOnly?: boolean;\n}\n\n/**\n * Floating card that displays a single review suggestion with its source,\n * accept/reject actions, and an optional paginator for navigating within-article\n * suggestions. Purely presentational — the host wires callbacks to the\n * reviewSuggestions plugin / API layer.\n */\nexport const SuggestionCard = React.forwardRef<HTMLDivElement, SuggestionCardProps>(function SuggestionCard(\n {\n source,\n diff,\n reason,\n onAccept,\n onReject,\n acceptDisabled,\n rejectDisabled,\n pagination,\n className,\n readOnly,\n ...props\n },\n ref,\n) {\n const acceptIsDisabled = acceptDisabled || !onAccept;\n const rejectIsDisabled = rejectDisabled || !onReject;\n const hasDiff = Boolean(diff && diff.oldText && diff.newText);\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label=\"Review suggestion\"\n className={cn(\n 'flex w-full items-stretch gap-4 rounded-lg bg-surface p-4 border shadow-md dark:shadow-brand-dark',\n className,\n )}\n {...props}\n >\n <div className=\"flex min-w-0 flex-1 flex-col gap-4\">\n {source && (\n <div className=\"flex flex-col gap-1\">\n <span className=\"text-xs font-bold uppercase leading-4 text-default\">{source.label}</span>\n <div className=\"flex items-center gap-0.5 [&_svg]:size-4 [&_svg]:shrink-0\">\n <span className=\"flex items-center text-subtle\" aria-hidden=\"true\">\n {source.icon}\n </span>\n <span className=\"truncate text-sm leading-4 text-subtle\">{source.name}</span>\n </div>\n </div>\n )}\n\n <div className=\"flex w-full flex-col gap-4\">\n <span className=\"text-xs font-bold uppercase leading-4 text-default\">Reason</span>\n {reason && <span className=\"text-sm leading-4 text-default\">{reason}</span>}\n\n {hasDiff && <SuggestionCardDiffRow oldText={diff?.oldText} newText={diff?.newText} />}\n\n {!readOnly && (\n <div className=\"flex items-center gap-2\">\n {!acceptIsDisabled && (\n <Button\n type=\"button\"\n variant=\"default\"\n elevation=\"shadow\"\n size=\"icon\"\n onClick={onAccept}\n aria-label=\"Accept suggestion\"\n className={cn('rounded-md border-border bg-green-400 text-default', brandShadowEffect)}\n >\n <CheckCircle weight=\"regular\" aria-hidden=\"true\" />\n </Button>\n )}\n {!rejectIsDisabled && (\n <Button\n type=\"button\"\n variant=\"destructive\"\n elevation=\"shadow\"\n size=\"icon\"\n onClick={onReject}\n aria-label=\"Reject suggestion\"\n className={cn('rounded-md border-border bg-red-400 text-default', brandShadowEffect)}\n >\n <XCircle weight=\"regular\" aria-hidden=\"true\" />\n </Button>\n )}\n </div>\n )}\n </div>\n </div>\n\n {pagination && pagination.totalCount > 1 && <SuggestionCardPaginator {...pagination} />}\n </div>\n );\n});\n\n/**\n * Bordered old/new diff row. Old text is rendered first with strikethrough\n * in destructive color, new text follows in link color. Either side can be\n * omitted (delete-only or insert-only).\n */\nfunction SuggestionCardDiffRow({ oldText, newText }: SuggestionCardDiff) {\n return (\n <div className=\"flex flex-col items-baseline gap-2 border-t border-dark-300 py-4 text-sm leading-4\">\n {oldText && (\n <div className=\"text-destructive\">\n <span className=\"font-bold\">Replace: </span>\n <span className=\"line-through\">{oldText}</span>\n </div>\n )}\n {newText && (\n <div className=\"text-blue-600\">\n <span className=\"font-bold\">With: </span>\n {newText}\n </div>\n )}\n </div>\n );\n}\n\nfunction SuggestionCardPaginator({ currentIndex, totalCount, onPrevious, onNext }: SuggestionCardPagination) {\n const hasPrevious = currentIndex > 1 && !!onPrevious;\n const hasNext = currentIndex < totalCount && !!onNext;\n\n return (\n <div className=\"flex w-10 shrink-0 flex-col items-center justify-center self-stretch py-2 pl-3\">\n <div className=\"flex flex-col items-center gap-0.5\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={onPrevious}\n disabled={!hasPrevious}\n aria-label=\"Previous suggestion\"\n className=\"text-subtlest disabled:invisible\"\n >\n <CaretUp aria-hidden=\"true\" className=\"size-3.5\" />\n </Button>\n <span className=\"text-xs leading-4 text-subtlest tabular-nums\" aria-hidden=\"true\">\n {currentIndex}/{totalCount}\n </span>\n <span className=\"sr-only\" aria-live=\"polite\">\n Suggestion {currentIndex} of {totalCount}\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={onNext}\n disabled={!hasNext}\n aria-label=\"Next suggestion\"\n className=\"text-subtlest disabled:invisible\"\n >\n <CaretDown aria-hidden=\"true\" className=\"size-3.5\" />\n </Button>\n </div>\n </div>\n );\n}\n"],"names":["EditCount","count","React","createElement","className","Circle","size","weight","ReviewListItem","forwardRef","title","timestamp","icon","description","isNew","isAccepted","editCount","isSelected","props","ref","status","StatusBadge","variant","type","cn","formatDistance","surface","ReviewsContext","createContext","ReviewsSelectionProvider","children","defaultSelectedItem","onApproveAllSuggestions","onRejectAllSuggestions","onAcceptAndPublish","onOpenArticleLink","onSourceLinkClick","breadcrumb","suggestionReasonBody","userSelectedItem","setUserSelectedItem","useState","selectedItem","loadedDiffDoc","setLoadedDiffDoc","loadingDiff","setLoadingDiff","handleSelect","useCallback","item","value","useMemo","setSelectedItem","Provider","useReviewsSelection","ctx","useContext","Error","ReviewList","items","map","key","id","onClick","displayName","SuggestionCard","source","diff","reason","onAccept","onReject","acceptDisabled","rejectDisabled","pagination","readOnly","acceptIsDisabled","rejectIsDisabled","hasDiff","Boolean","oldText","newText","role","label","name","SuggestionCardDiffRow","Button","elevation","brandShadowEffect","CheckCircle","XCircle","totalCount","SuggestionCardPaginator","currentIndex","onPrevious","onNext","hasPrevious","hasNext","disabled","CaretUp","CaretDown"],"mappings":"0aAGO,SAASA,GAAUC,MAAEA;AAC1B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