@arbidocs/blocks 0.5.170 → 0.5.172
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/{ConnectedCallDock-2LQZTKQD.cjs → ConnectedCallDock-AQRVWENO.cjs} +4 -4
- package/dist/{ConnectedCallDock-2LQZTKQD.cjs.map → ConnectedCallDock-AQRVWENO.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-YZWAB7E5.cjs → ConnectedCallRoom-7M4YQ4KA.cjs} +4 -4
- package/dist/{ConnectedCallRoom-YZWAB7E5.cjs.map → ConnectedCallRoom-7M4YQ4KA.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-CTJLD6RF.cjs → ConnectedProductionSetDialog-SHDI7KP6.cjs} +5 -5
- package/dist/{ConnectedProductionSetDialog-CTJLD6RF.cjs.map → ConnectedProductionSetDialog-SHDI7KP6.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-HQFZEDSO.cjs → FilesViewerDialog-KD22ACKY.cjs} +9 -9
- package/dist/{FilesViewerDialog-HQFZEDSO.cjs.map → FilesViewerDialog-KD22ACKY.cjs.map} +1 -1
- package/dist/auth/index.cjs +12 -12
- package/dist/calls/connected/ConnectedConversationCallActions.js +6 -0
- package/dist/calls/connected/ConnectedConversationCallActions.js.map +2 -2
- package/dist/calls/connected/OwnedAgentCallButton.d.ts +4 -0
- package/dist/calls/connected/OwnedAgentCallButton.js +13 -0
- package/dist/calls/connected/OwnedAgentCallButton.js.map +7 -0
- package/dist/calls/index.cjs +22 -22
- package/dist/chat/index.cjs +5 -5
- package/dist/{chunk-3UCRJRNI.cjs → chunk-5OD6DRG7.cjs} +5 -5
- package/dist/{chunk-3UCRJRNI.cjs.map → chunk-5OD6DRG7.cjs.map} +1 -1
- package/dist/{chunk-WWCSRBNZ.cjs → chunk-A7MGQMOV.cjs} +13 -13
- package/dist/{chunk-WWCSRBNZ.cjs.map → chunk-A7MGQMOV.cjs.map} +1 -1
- package/dist/{chunk-O2NHBB3D.cjs → chunk-E23H6FJR.cjs} +4 -4
- package/dist/{chunk-O2NHBB3D.cjs.map → chunk-E23H6FJR.cjs.map} +1 -1
- package/dist/{chunk-2O772C6Y.cjs → chunk-ICZLFE26.cjs} +2 -2
- package/dist/{chunk-2O772C6Y.cjs.map → chunk-ICZLFE26.cjs.map} +1 -1
- package/dist/{chunk-WV3RNWAG.cjs → chunk-KQJUY2OE.cjs} +6 -3
- package/dist/chunk-KQJUY2OE.cjs.map +1 -0
- package/dist/{chunk-Q25CZLK6.cjs → chunk-N33U2SB5.cjs} +28 -4
- package/dist/chunk-N33U2SB5.cjs.map +1 -0
- package/dist/{chunk-IRUQZI6P.cjs → chunk-PIKTGP55.cjs} +3 -2
- package/dist/chunk-PIKTGP55.cjs.map +1 -0
- package/dist/{chunk-7QSZSGUQ.cjs → chunk-QSY2VW7V.cjs} +6 -6
- package/dist/{chunk-7QSZSGUQ.cjs.map → chunk-QSY2VW7V.cjs.map} +1 -1
- package/dist/{chunk-I6SINJQ2.cjs → chunk-RJMKTK4P.cjs} +13 -2
- package/dist/chunk-RJMKTK4P.cjs.map +1 -0
- package/dist/{chunk-6OVP3BUA.cjs → chunk-TV2HTJD6.cjs} +4 -4
- package/dist/{chunk-6OVP3BUA.cjs.map → chunk-TV2HTJD6.cjs.map} +1 -1
- package/dist/{chunk-LYYJDQW6.cjs → chunk-UTYEXDJK.cjs} +28 -28
- package/dist/{chunk-LYYJDQW6.cjs.map → chunk-UTYEXDJK.cjs.map} +1 -1
- package/dist/{chunk-QNNNANQS.cjs → chunk-YOTUWXOV.cjs} +11 -11
- package/dist/{chunk-QNNNANQS.cjs.map → chunk-YOTUWXOV.cjs.map} +1 -1
- package/dist/connect/index.cjs +192 -191
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +7 -7
- package/dist/connection/ConnectedAgentChatPanel.js +2 -0
- package/dist/connection/ConnectedAgentChatPanel.js.map +2 -2
- package/dist/connection/messenger/DmAgentProgress.js +1 -1
- package/dist/connection/messenger/DmAgentProgress.js.map +2 -2
- package/dist/databases/DatabaseTable.js +26 -2
- package/dist/databases/DatabaseTable.js.map +2 -2
- package/dist/databases/index.cjs +52 -52
- package/dist/embed/index.cjs +11 -11
- package/dist/index.cjs +94 -94
- package/dist/lib/entity-id.d.ts +1 -1
- package/dist/lib/entity-id.js +1 -0
- package/dist/lib/entity-id.js.map +2 -2
- package/dist/pages/index.cjs +3 -3
- package/dist/shell/index.cjs +21 -21
- package/dist/shell/use-sidebar-controller.js +4 -1
- package/dist/shell/use-sidebar-controller.js.map +2 -2
- package/dist/styles.css +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/src/blocks.css +2 -0
- package/dist/chunk-I6SINJQ2.cjs.map +0 -1
- package/dist/chunk-IRUQZI6P.cjs.map +0 -1
- package/dist/chunk-Q25CZLK6.cjs.map +0 -1
- package/dist/chunk-WV3RNWAG.cjs.map +0 -1
|
@@ -94,6 +94,9 @@ function useSidebarSettle(expanded, settleMs = 300) {
|
|
|
94
94
|
return { labelsExpanded, tipsVisible };
|
|
95
95
|
}
|
|
96
96
|
var isMenuOpen = () => typeof document !== "undefined" && document.querySelector('[role="menu"][data-state="open"]') !== null;
|
|
97
|
+
var isOverlayOpen = () => typeof document !== "undefined" && document.querySelector(
|
|
98
|
+
'[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"], [role="menu"][data-state="open"]'
|
|
99
|
+
) !== null;
|
|
97
100
|
function useSidebarController(options = {}) {
|
|
98
101
|
const [storedPinned, setPinned] = chunkAHDJXIUB_cjs.useControllableState(
|
|
99
102
|
options.isPinned,
|
|
@@ -139,7 +142,7 @@ function useSidebarController(options = {}) {
|
|
|
139
142
|
const onPointerLeave = (event) => {
|
|
140
143
|
if (event.pointerType !== "mouse" && options.hoverExpansion !== "all") return;
|
|
141
144
|
isPointerOver.current = false;
|
|
142
|
-
if (!isSmallScreen) setHovering(false);
|
|
145
|
+
if (!isSmallScreen && !isOverlayOpen()) setHovering(false);
|
|
143
146
|
};
|
|
144
147
|
return {
|
|
145
148
|
layout,
|
|
@@ -902,5 +905,5 @@ exports.resolveSidebarLayout = resolveSidebarLayout;
|
|
|
902
905
|
exports.useCloseOnEscape = useCloseOnEscape;
|
|
903
906
|
exports.useSidebarController = useSidebarController;
|
|
904
907
|
exports.useSidebarSettle = useSidebarSettle;
|
|
905
|
-
//# sourceMappingURL=chunk-
|
|
906
|
-
//# sourceMappingURL=chunk-
|
|
908
|
+
//# sourceMappingURL=chunk-KQJUY2OE.cjs.map
|
|
909
|
+
//# sourceMappingURL=chunk-KQJUY2OE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shell/ShellSidebar.tsx","../src/lib/use-close-on-escape.ts","../src/lib/sidebar-mode.ts","../src/shell/use-sidebar-controller.ts","../src/shell/SidebarRowAction.tsx","../src/shell/AskField.tsx","../src/shell/ActionCluster.tsx","../src/shell/StatusRow.tsx","../src/shell/OfflinePill.tsx","../src/shell/RemoteControlPill.tsx","../src/shell/TipCard.tsx","../src/shell/DockZone.tsx"],"names":["jsxs","Sidebar","jsx","useRef","useEffect","useState","useControllableState","useIsPhone","useIsNarrow","useIsTouchScreen","useCallback","useContext","SidebarRowHoverContext","cn","BlocksTooltipProvider","Tooltip","TooltipTrigger","TooltipContent","testIdOr","Sparkles","Button","Search","ArrowUp","X","useId","STATUS_ROW_TONES","STATUS_ROW_BASE_CLASS","WifiOff","TriangleAlert","RefreshCw","MousePointerClick","Lightbulb","Pencil","ChevronLeft","ChevronRight","containerWidth"],"mappings":";;;;;;;;;;;;;AAyCO,SAAS,YAAA,CAAa;AAAA,EAC3B,UAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,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,EAAmB;AAAA,QACnC,SAAA,EAAWW,KAAAA;AAAA,UACT,sCAAA;AAAA,UACA,gBAAA,IAAoB,CAAC,UAAA,IAAc;AAAA;AACrC;AAAA,KACF;AAAA,IAEC,UAAA,IAAc,YAAA,KAAiB,IAAA,oBAC9BX,cAAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,mEAAA;AAAA,QACV,KAAA,EAAO,EAAE,IAAA,EAAM,YAAA;AAAa;AAAA,KAC9B;AAAA,IAED,UAAA,oBAAcA,cAAAA,CAAC,KAAA,EAAA,EAAI,WAAU,yCAAA,EAA0C;AAAA,GAAA,EAC1E,CAAA;AAEJ","file":"chunk-KQJUY2OE.cjs","sourcesContent":["import type { ReactNode } from 'react'\nimport { Sidebar, type SidebarRootProps } from './Sidebar'\nimport type { SidebarController } from './use-sidebar-controller'\nimport type { NavItem, NavSection } from './types'\n\nexport interface ShellSidebarProps extends Pick<\n SidebarRootProps,\n 'className' | 'aria-label' | 'labels' | 'backdropTestId'\n> {\n /** From `useSidebarController`: layout, hover/pin/drawer behaviour. */\n controller: SidebarController\n /** Brand mark of the phone drawer's header (logo + close). Omit for no drawer header. */\n drawerLogo?: ReactNode\n /** `data-testid` of the drawer's close button. */\n drawerCloseTestId?: string\n /** Top block (workspace switcher, ask field, pin toggle). Read `controller.expanded` for the rail. */\n header?: ReactNode\n /** Rows as data. */\n items?: NavItem[]\n /** Labelled groups of rows as data, after `items`. */\n sections?: NavSection[]\n navClassName?: string\n /**\n * Width-bound cards at the top of the footer (smart tips, notices): shown only once the panel\n * has settled open, and gone the instant it starts to close.\n */\n tips?: ReactNode\n /** The rest of the footer (status rows, account rows). */\n footer?: ReactNode\n /** Root `data-testid` (default `sidebar`). */\n 'data-testid'?: string\n}\n\n/**\n * The whole sidebar from a controller and data: `Sidebar.Root` in the resolved mode, the phone\n * drawer header, the header slot, the nav rows/groups and the footer. Renders nothing while the\n * layout is hidden (a phone with the drawer closed), so no clipped rows carry duplicate test ids.\n *\n * const sidebar = useSidebarController({ isPinned, onPinnedChange: setPinned })\n * <ShellSidebar controller={sidebar} header={…} items={nav} footer={…} />\n */\nexport function ShellSidebar({\n controller,\n drawerLogo,\n drawerCloseTestId,\n header,\n items,\n sections,\n navClassName,\n tips,\n footer,\n ...rootProps\n}: ShellSidebarProps) {\n if (controller.layout.hidden) return null\n return (\n <Sidebar.Root {...controller.rootProps} {...rootProps}>\n {controller.isDrawer && drawerLogo && (\n <Sidebar.DrawerHeader\n logo={drawerLogo}\n onClose={controller.closeDrawer}\n data-testid={drawerCloseTestId}\n />\n )}\n {header && <Sidebar.Header>{header}</Sidebar.Header>}\n <Sidebar.Nav items={items} sections={sections} className={navClassName} />\n {(tips || footer) && (\n <Sidebar.Footer>\n {controller.tipsVisible && tips}\n {footer}\n </Sidebar.Footer>\n )}\n </Sidebar.Root>\n )\n}\n","import { useEffect, useRef } from 'react'\n\n/**\n * While `isActive`, Escape calls `onClose`. For surfaces that float over the page without being a\n * modal (no backdrop, no focus trap), so nothing else closes them from the keyboard. An Escape a\n * dialog already handled (`defaultPrevented`) is left alone so one press closes one layer.\n */\nexport function useCloseOnEscape(isActive: boolean, onClose: () => void): void {\n const onCloseRef = useRef(onClose)\n useEffect(() => {\n onCloseRef.current = onClose\n })\n\n useEffect(() => {\n if (!isActive) return\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && !e.defaultPrevented) onCloseRef.current()\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [isActive])\n}\n","import { useEffect, useRef, useState } from 'react'\n\n/**\n * Headless sidebar behaviour (no DOM, no store): how the sidebar lays out for a given set of\n * inputs, and the settle timing that keeps labels/tips from squeezing during the width transition.\n *\n * - `drawer` small-screen off-canvas panel (opened by the app bar's menu button)\n * - `collapsed` hidden (width 0): a phone with the drawer closed, or `isCollapsed`\n * - `pinned` full width, inline, pushes the content\n * - `rail` icon strip that floats open to full width while hovered\n */\nexport type SidebarMode = 'drawer' | 'collapsed' | 'pinned' | 'rail'\n\nexport interface SidebarModeInput {\n isSmallScreen: boolean\n /** The phone drawer was requested open. */\n isDrawerRequested: boolean\n isCollapsed: boolean\n isPinned: boolean\n isHovering: boolean\n /**\n * Tablet-width viewport (above the phone drawer breakpoint but too narrow to give the content a\n * usable column next to a 255px panel): pinning is ignored and the sidebar stays an icon rail.\n */\n isNarrow?: boolean\n}\n\nexport interface SidebarLayout {\n mode: SidebarMode\n /** Labels should be shown (the panel is, or is becoming, full width). */\n expanded: boolean\n /** Phones: nothing is rendered until the drawer opens. */\n hidden: boolean\n /** Hover state that actually applies (never on touch-sized screens). */\n hovering: boolean\n}\n\nexport function resolveSidebarLayout(input: SidebarModeInput): SidebarLayout {\n const { isSmallScreen, isDrawerRequested, isCollapsed, isPinned, isHovering } = input\n const canPin = isPinned && !isSmallScreen && !input.isNarrow\n const drawerOpen = isSmallScreen && isDrawerRequested\n // Small screens are drawer-only: when it is closed the panel is fully off-canvas\n // regardless of pinning (pinning is a desktop concept), and hover never expands.\n const effectiveCollapsed = isCollapsed || (isSmallScreen && !drawerOpen)\n const hovering = isHovering && !isSmallScreen\n\n let mode: SidebarMode\n if (drawerOpen) mode = 'drawer'\n else if (effectiveCollapsed) mode = 'collapsed'\n else if (canPin) mode = 'pinned'\n else mode = 'rail'\n\n // `hovering`, not `isHovering`: a stale hover flag must not report a hidden phone sidebar as expanded.\n const expanded = drawerOpen || (!effectiveCollapsed && (canPin || hovering))\n\n return { mode, expanded, hidden: isSmallScreen && !drawerOpen, hovering }\n}\n\n/**\n * Settle timing around the width transition (default 300ms):\n * - `labelsExpanded` switches on immediately but off only after the transition, so labels do not\n * snap to icon-only while the panel is still wide;\n * - `tipsVisible` is the opposite: width-bound content (a tip card) appears only once the panel\n * has fully opened and disappears the instant collapse starts.\n */\nexport function useSidebarSettle(expanded: boolean, settleMs = 300) {\n const [labelsExpanded, setLabelsExpanded] = useState(expanded)\n const [tipsVisible, setTipsVisible] = useState(expanded)\n const labelsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const tipsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useEffect(() => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n if (expanded) setLabelsExpanded(true)\n else labelsTimer.current = setTimeout(() => setLabelsExpanded(false), settleMs)\n return () => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n }\n }, [expanded, settleMs])\n\n useEffect(() => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n if (expanded) tipsTimer.current = setTimeout(() => setTipsVisible(true), settleMs)\n else setTipsVisible(false)\n return () => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n }\n }, [expanded, settleMs])\n\n return { labelsExpanded, tipsVisible }\n}\n","import { useCallback, useEffect, useRef, type PointerEvent } from 'react'\nimport { useControllableState } from '../lib/useControllableState'\nimport { useCloseOnEscape } from '../lib/use-close-on-escape'\nimport { useIsNarrow, useIsPhone, useIsTouchScreen } from '../lib/use-media-query'\nimport { resolveSidebarLayout, useSidebarSettle, type SidebarLayout } from '../lib/sidebar-mode'\nimport type { SidebarRootProps } from './Sidebar'\n\nexport interface UseSidebarControllerOptions {\n /** Pinned open (desktop). Controlled when set; otherwise kept here, seeded by `defaultPinned`. */\n isPinned?: boolean\n /** Default `true`. */\n defaultPinned?: boolean\n onPinnedChange?: (isPinned: boolean) => void\n /** The rail is floated open (hover, or its toggle at a narrow width). Controlled when set. */\n isHovering?: boolean\n onHoveringChange?: (isHovering: boolean) => void\n /** The phone drawer is open. Controlled when set (the app bar's menu button opens it). */\n isDrawerOpen?: boolean\n onDrawerOpenChange?: (isDrawerOpen: boolean) => void\n /**\n * Keep the sidebar a rail even when pinned, on top of the tablet width (for example while a\n * docked panel squeezes the content). The stored pin is left untouched.\n */\n forceRail?: boolean\n /**\n * Which rails expand on pointer enter. The default ignores narrow and emulated touch hover;\n * `all` retains hover expansion for a host whose narrow rail has no separate expand button.\n */\n hoverExpansion?: 'desktop-pointer' | 'all'\n}\n\n/** The `Sidebar.Root` props the controller resolves. */\nexport type SidebarControllerRootProps = Pick<\n SidebarRootProps,\n | 'mode'\n | 'expanded'\n | 'isHovering'\n | 'onBackdropClick'\n | 'hasRailBackdrop'\n | 'onPointerEnter'\n | 'onPointerLeave'\n>\n\nexport interface SidebarController {\n layout: SidebarLayout\n /** Labels shown (settled: they stay on until the closing transition ends). */\n expanded: boolean\n /** Width-bound content (tips, notices) may show: on once fully open, off as closing starts. */\n tipsVisible: boolean\n /** The phone drawer is showing. */\n isDrawer: boolean\n isSmallScreen: boolean\n /** Tablet width (or `forceRail`): pinning is ignored and the sidebar stays a rail. */\n isNarrow: boolean\n /** The pin as it applies (always off while narrow). */\n isPinned: boolean\n /** Spread onto `Sidebar.Root` (or pass the controller to `ShellSidebar`). */\n rootProps: SidebarControllerRootProps\n openDrawer: () => void\n closeDrawer: () => void\n /** The pin toggle: pins/unpins, or floats the rail open/closed while narrow. */\n togglePin: () => void\n /** Open from the rail (its ask button): pins, or floats the rail open while narrow. */\n expand: () => void\n /** After a nav row is chosen: closes the drawer, and a floated rail the pointer has left. */\n afterNavigate: () => void\n}\n\n// A menu opened from the rail (the account menu) is positioned against the sidebar's current\n// layout. Hovering that menu from the content would expand the rail, re-anchor the menu under\n// the pointer and move the item being clicked, so hover does not expand the rail while one is open.\nconst isMenuOpen = () =>\n typeof document !== 'undefined' &&\n document.querySelector('[role=\"menu\"][data-state=\"open\"]') !== null\n\n// A dialog or menu opened from the floated rail (a skill's launcher from its ask field) sits outside\n// it: moving the pointer there must not fold the rail, which would unmount what opened it.\nconst isOverlayOpen = () =>\n typeof document !== 'undefined' &&\n document.querySelector(\n '[role=\"dialog\"][data-state=\"open\"], [role=\"alertdialog\"][data-state=\"open\"], [role=\"menu\"][data-state=\"open\"]'\n ) !== null\n\n/**\n * Sidebar behaviour as one hook, shared by every shell: resolves the layout (drawer / pinned /\n * rail) for the viewport, settles labels and tips around the width transition, and owns the hover,\n * pin and drawer rules:\n * - touch: the rail opens only through its toggle, never by the pointer enter of a tap;\n * - narrow: a pointer drifting over the rail does not float the labels over the content;\n * - Escape closes a floated rail; the drawer closes itself when the viewport grows past a phone;\n * - choosing a row closes the drawer, and a floated rail unless the pointer is still over it.\n *\n * State is controlled per field (`isPinned`, `isHovering`, `isDrawerOpen`) so an app can keep it\n * in its own store, or uncontrolled for a shell that does not care.\n */\nexport function useSidebarController(options: UseSidebarControllerOptions = {}): SidebarController {\n const [storedPinned, setPinned] = useControllableState(\n options.isPinned,\n options.defaultPinned ?? true,\n options.onPinnedChange\n )\n const [isHovering, setHovering] = useControllableState(\n options.isHovering,\n false,\n options.onHoveringChange\n )\n const [isDrawerOpen, setDrawerOpen] = useControllableState(\n options.isDrawerOpen,\n false,\n options.onDrawerOpenChange\n )\n\n const isSmallScreen = useIsPhone()\n const isNarrow = useIsNarrow() || !!options.forceRail\n const isTouch = useIsTouchScreen()\n\n const layout = resolveSidebarLayout({\n isSmallScreen,\n isDrawerRequested: isDrawerOpen,\n isCollapsed: false,\n isPinned: storedPinned,\n isHovering,\n isNarrow,\n })\n const isDrawer = layout.mode === 'drawer'\n const { labelsExpanded, tipsVisible } = useSidebarSettle(layout.expanded)\n\n // Whether the pointer is physically over the sidebar (decides if navigating closes the rail).\n const isPointerOver = useRef(false)\n\n const closeDrawer = useCallback(() => setDrawerOpen(false), [setDrawerOpen])\n const openDrawer = useCallback(() => setDrawerOpen(true), [setDrawerOpen])\n\n // The floated rail has no modal behaviour (the drawer gets Escape from `Sidebar.Root`).\n useCloseOnEscape(layout.mode === 'rail' && layout.hovering, () => setHovering(false))\n\n // A drawer left open when the viewport grows past a phone (rotate/resize) would be a stuck overlay.\n useEffect(() => {\n if (isDrawerOpen && !isSmallScreen) setDrawerOpen(false)\n }, [isDrawerOpen, isSmallScreen, setDrawerOpen])\n\n const onPointerEnter = (event: PointerEvent<HTMLElement>) => {\n // Primary-input media queries can report touch even while a mouse is in use.\n if (event.pointerType !== 'mouse' && options.hoverExpansion !== 'all') return\n isPointerOver.current = true\n if (\n !isSmallScreen &&\n (!isNarrow || options.hoverExpansion === 'all') &&\n (!isMenuOpen() || options.hoverExpansion === 'all')\n )\n setHovering(true)\n }\n const onPointerLeave = (event: PointerEvent<HTMLElement>) => {\n if (event.pointerType !== 'mouse' && options.hoverExpansion !== 'all') return\n isPointerOver.current = false\n if (!isSmallScreen && !isOverlayOpen()) setHovering(false)\n }\n\n return {\n layout,\n expanded: labelsExpanded,\n tipsVisible,\n isDrawer,\n isSmallScreen,\n isNarrow,\n isPinned: storedPinned && !isNarrow,\n rootProps: {\n mode: layout.mode,\n expanded: labelsExpanded,\n isHovering: layout.hovering,\n onBackdropClick: isDrawer ? closeDrawer : () => setHovering(false),\n hasRailBackdrop: isTouch,\n onPointerEnter,\n onPointerLeave,\n },\n openDrawer,\n closeDrawer,\n togglePin: () => (isNarrow ? setHovering(!isHovering) : setPinned(!storedPinned)),\n expand: () => (isNarrow ? setHovering(true) : setPinned(true)),\n afterNavigate: () => {\n if (!isPointerOver.current && !storedPinned) setHovering(false)\n if (isDrawer) closeDrawer()\n },\n }\n}\n","import { useContext, type ReactNode } from 'react'\nimport { cn, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { BlocksTooltipProvider } from '../provider/TooltipScope'\nimport { SidebarRowHoverContext } from './Sidebar'\n\nexport type SidebarRowActionPulse = 'active' | 'success' | 'error'\n\nexport interface SidebarRowActionProps {\n /** The row this control sits on is selected: the glyph takes the selection ink. */\n active?: boolean\n onClick?: () => void\n /** Tooltip text and accessible label. */\n label: string\n /**\n * Demand attention while the row is idle: `active` pulses primary (work in progress),\n * `success` pulses green (just finished), `error` is a steady red alert. A selected row wins.\n */\n pulse?: SidebarRowActionPulse | null\n 'data-testid'?: string\n children: ReactNode\n}\n\nconst PULSE_STYLES: Record<SidebarRowActionPulse, string> = {\n active: 'animate-pulse-attention text-primary',\n success: 'animate-pulse-attention text-green-text',\n // Steady (not animated) so a failure stays put and reads as a standing alert.\n error: 'text-red-text opacity-100',\n}\n\n/**\n * The secondary control at the right edge of a sidebar row: a small muted glyph. Always visible\n * (touch has no hover); hovering or focusing the row only brightens it a tone, through\n * SidebarRowHoverContext. Stops propagation so it never triggers the row's own click.\n */\nexport function SidebarRowAction({\n active = false,\n onClick,\n label,\n pulse = null,\n 'data-testid': testId,\n children,\n}: SidebarRowActionProps) {\n const rowHovered = useContext(SidebarRowHoverContext)\n\n const tone = active\n ? 'text-accent-foreground hover:bg-background/60'\n : pulse\n ? `${PULSE_STYLES[pulse]} hover:bg-muted`\n : cn(\n 'text-muted-foreground hover:bg-muted hover:text-foreground',\n rowHovered ? 'opacity-100' : 'opacity-70'\n )\n\n return (\n <BlocksTooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild onFocusCapture={(e) => e.stopPropagation()}>\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onClick?.()\n }}\n aria-label={label}\n data-slot=\"sidebar-row-action\"\n data-testid={testId}\n className={cn('rounded-md p-1 transition-colors pointer-coarse:p-2.5', tone)}\n >\n {children}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\">{label}</TooltipContent>\n </Tooltip>\n </BlocksTooltipProvider>\n )\n}\n","import type { InputHTMLAttributes, KeyboardEvent, ReactNode, Ref } from 'react'\nimport { ArrowUp, Search, Sparkles, X } from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Fixed strings of the ask field, its trigger and the expanded row. */\nexport interface AskFieldLabels {\n /** Input placeholder (the `placeholder` prop wins). */\n placeholder: string\n /** The input's accessible name. */\n inputLabel: string\n search: string\n askAi: string\n /** The icon-only trigger. */\n askOrSearch: string\n closeSearch: string\n}\n\nexport const DEFAULT_ASK_FIELD_LABELS: AskFieldLabels = {\n placeholder: 'Ask or search…',\n inputLabel: 'Ask AI or search your documents',\n search: 'Search',\n askAi: 'Ask AI',\n askOrSearch: 'Ask AI or search',\n closeSearch: 'Close search',\n}\n\nexport interface AskFieldProps {\n value: string\n onValueChange: (value: string) => void\n /** Enter / the arrow button: ask AI. */\n onAsk: (text: string) => void\n /** The magnifier button: semantic search. */\n onSearch: (text: string) => void\n /** Intercept keys first (e.g. a slash menu); call `preventDefault` to stop the default Enter-asks. */\n onInputKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void\n /** Rendered just under the field at its width (a slash/autocomplete menu). */\n menu?: ReactNode\n inputRef?: Ref<HTMLInputElement>\n /** Extra attributes for the input, e.g. the combobox props of `useListKeyNav` for a slash menu. */\n inputProps?: InputHTMLAttributes<HTMLInputElement>\n placeholder?: string\n labels?: Partial<AskFieldLabels>\n autoFocus?: boolean\n className?: string\n /** Root id (default `workspace-ask-bar`); the input/search/submit ids are `<root>-input|search|submit`. */\n 'data-testid'?: string\n}\n\n/**\n * The compact one-line ask/search field: sparkle, input, then two icon doors (Search, Ask AI).\n * Text and the menu are controlled by the host, so the same field serves the sidebar, the phone\n * app bar and any custom shell.\n */\nexport function AskField({\n value,\n onValueChange,\n onAsk,\n onSearch,\n onInputKeyDown,\n menu,\n inputRef,\n inputProps,\n placeholder,\n labels,\n autoFocus = false,\n className,\n 'data-testid': testIdProp,\n}: AskFieldProps) {\n const testId = testIdOr(testIdProp, { testId: 'workspace-ask-bar' })\n const l = { ...DEFAULT_ASK_FIELD_LABELS, ...labels }\n const isEmpty = !value.trim()\n const submit = (handler: (text: string) => void) => {\n const text = value.trim()\n if (text) handler(text)\n }\n\n return (\n <div className={cn('relative', className)} data-slot=\"ask-field\" data-testid={testId}>\n {menu && <div className=\"absolute inset-x-0 top-9 z-30\">{menu}</div>}\n <div\n role=\"search\"\n className=\"flex h-9 items-center gap-0.5 rounded-md border border-border bg-background pl-2.5 pr-0.5 transition-colors focus-within:border-primary focus-within:ring-3 focus-within:ring-primary pointer-coarse:h-11\"\n >\n <Sparkles aria-hidden=\"true\" className=\"size-4 shrink-0 text-ai-ink\" />\n <input\n {...inputProps}\n ref={inputRef}\n type=\"text\"\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n onKeyDown={(e) => {\n onInputKeyDown?.(e)\n // Enter asks (not mid-IME-composition). A plain div, not a <form>.\n if (e.defaultPrevented) return\n if (e.key === 'Enter' && !e.nativeEvent.isComposing) {\n e.preventDefault()\n submit(onAsk)\n }\n }}\n placeholder={placeholder ?? l.placeholder}\n aria-label={l.inputLabel}\n autoFocus={autoFocus}\n className=\"ml-1.5 h-8 min-w-0 flex-1 bg-transparent pointer-coarse:h-11 text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n data-testid={`${testId}-input`}\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n disabled={isEmpty}\n onClick={() => submit(onSearch)}\n title={l.search}\n aria-label={l.search}\n className=\"size-7 shrink-0 text-muted-foreground hover:text-foreground pointer-coarse:size-10\"\n data-testid={`${testId}-search`}\n >\n <Search className=\"size-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n disabled={isEmpty}\n onClick={() => submit(onAsk)}\n title={l.askAi}\n aria-label={l.askAi}\n className=\"!inline-flex size-7 shrink-0 text-ai-ink hover:bg-ai-soft hover:text-ai-ink pointer-coarse:size-10\"\n data-testid={`${testId}-submit`}\n >\n <ArrowUp className=\"size-4\" />\n </Button>\n </div>\n </div>\n )\n}\n\nexport interface AskTriggerProps {\n /** Opens the ask field (or the palette): one action that asks AI and searches. */\n onClick: () => void\n /** `rail`: the icon-only sidebar's bordered tile; `appbar`: the phone app bar's bare icon. */\n variant?: 'rail' | 'appbar'\n labels?: Partial<Pick<AskFieldLabels, 'askOrSearch'>>\n 'data-testid'?: string\n}\n\n/** The icon that stands in for the field where there is no room for it. */\nexport function AskTrigger({\n onClick,\n variant = 'rail',\n labels,\n 'data-testid': testId,\n}: AskTriggerProps) {\n const text = labels?.askOrSearch ?? DEFAULT_ASK_FIELD_LABELS.askOrSearch\n return (\n <button\n type=\"button\"\n onClick={onClick}\n title={text}\n aria-label={text}\n data-slot=\"ask-trigger\"\n data-testid={testId}\n className={cn(\n 'flex items-center justify-center rounded-md text-ai-ink transition-colors hover:bg-ai-soft',\n variant === 'rail'\n ? 'h-9 w-12 border border-border bg-background pointer-coarse:h-11'\n : 'size-11'\n )}\n >\n <Sparkles className={variant === 'rail' ? 'size-4' : 'size-5'} />\n </button>\n )\n}\n\nexport interface AskRowProps {\n /** The field (an AskField). */\n children: ReactNode\n onClose: () => void\n labels?: Partial<Pick<AskFieldLabels, 'closeSearch'>>\n /** Row id (default `workspace-ask-bar-expanded`). */\n 'data-testid'?: string\n /** Collapse button id (default `workspace-ask-bar-collapse`). */\n collapseTestId?: string\n}\n\n/** The phone's expanded ask row: takes over the app bar so there is room to type; Escape closes. */\nexport function AskRow({\n children,\n onClose,\n labels,\n 'data-testid': testId,\n collapseTestId,\n}: AskRowProps) {\n return (\n <div\n className=\"flex h-14 flex-shrink-0 items-center gap-1 bg-background px-3 pt-safe\"\n data-slot=\"ask-row\"\n data-testid={testIdOr(testId, { testId: 'workspace-ask-bar-expanded' })}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && !e.defaultPrevented) onClose()\n }}\n >\n <div className=\"min-w-0 flex-1\">{children}</div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={labels?.closeSearch ?? DEFAULT_ASK_FIELD_LABELS.closeSearch}\n data-testid={testIdOr(collapseTestId, { testId: 'workspace-ask-bar-collapse' })}\n className=\"flex size-11 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n >\n <X className=\"size-5\" />\n </button>\n </div>\n )\n}\n","import { useId, type MouseEvent, type ReactNode } from 'react'\nimport type { ShellActionLayout } from './types'\n\nexport interface ActionClusterProps {\n /**\n * `bar`: one row for a page header or phone app bar (status, bell, contacts, account).\n * `sidebar`: the bottom of the expanded sidebar: the bell and contacts rows stacked above the\n * account row.\n * `rail`: the same stack on the icon-only rail (same order, icon-only rows).\n * `drawer`: the phone drawer's rows (bell and contacts only; the app bar carries the account).\n */\n layout?: ShellActionLayout\n /** Status pill (remote control); `bar` only. Other layouts show status in their own rows. */\n status?: ReactNode\n /** Report a problem (bug icon), first in the cluster. */\n report?: ReactNode\n /** Notification bell (the kit's NotificationBell, or a `Sidebar.BadgeRow`). */\n mail?: ReactNode\n /** Calendar entry (a `Sidebar.BadgeRow`), right after mail. */\n calendar?: ReactNode\n /** Databases entry (a `Sidebar.BadgeRow`), right after calendar. */\n databases?: ReactNode\n bell?: ReactNode\n /** Contacts / messages entry with its own badge (a `Sidebar.BadgeRow`). */\n contacts?: ReactNode\n /** Account menu (the kit's UserMenu). */\n account?: ReactNode\n /**\n * Names the cluster: the group's accessible name in every layout, and a visible heading above\n * the rows in the `drawer` layout (where phones otherwise get unlabelled rows).\n */\n label?: string\n 'data-testid'?: string\n}\n\n/**\n * The account area: notifications, contacts and the account menu, in one of four placements. In\n * the sidebar and on the rail the two badge rows are stacked above the account row in the same\n * order, so nothing moves when the rail expands; the account menu holds everything else (help,\n * settings, tips, processing).\n */\nexport function ActionCluster({\n layout = 'bar',\n status,\n report,\n mail,\n calendar,\n databases,\n bell,\n contacts,\n account,\n label,\n 'data-testid': testId = 'sidebar-actions',\n}: ActionClusterProps) {\n const labelId = useId()\n // Dashboard's content area resets focus on click, and Radix PORTALS bubble through the React\n // tree: stop clicks here or a dropdown item (e.g. \"View all\") would un-focus the panel it opened.\n const stop = (e: MouseEvent) => e.stopPropagation()\n\n if (layout === 'sidebar' || layout === 'rail' || layout === 'drawer') {\n const rail = layout === 'rail'\n return (\n <div\n className={rail ? 'flex flex-col items-center gap-0.5' : 'flex flex-col gap-0.5'}\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-labelledby={label && layout === 'drawer' ? labelId : undefined}\n aria-label={label && layout !== 'drawer' ? label : undefined}\n data-slot=\"action-cluster\"\n data-layout={layout}\n data-testid={testId}\n >\n {label && layout === 'drawer' && (\n <p\n id={labelId}\n className=\"px-3 pb-1 pt-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground\"\n data-slot=\"action-cluster-label\"\n >\n {label}\n </p>\n )}\n {bell}\n {mail}\n {calendar}\n {databases}\n {contacts}\n {report}\n {account && layout !== 'drawer' && (\n <div className={rail ? 'mt-1' : 'mt-1 min-w-0'}>{account}</div>\n )}\n </div>\n )\n }\n\n return (\n <div\n className=\"flex items-center gap-1\"\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-label={label}\n data-slot=\"action-cluster\"\n >\n {status}\n {report}\n {mail}\n {calendar}\n {databases}\n {bell}\n {contacts}\n {account}\n </div>\n )\n}\n","import { X } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { STATUS_ROW_BASE_CLASS, STATUS_ROW_TONES } from './status-row-styles'\n\nexport type StatusRowTone = 'progress' | 'success' | 'error'\n\nexport interface StatusRowProps {\n tone: StatusRowTone\n /** e.g. \"Processing 3 files…\". Always the accessible name; hidden visually when `compact`. */\n label: string\n /** Opens the thing the status is about (the processing panel). */\n onClick: () => void\n /** Icon-only (the collapsed rail). */\n compact?: boolean\n 'data-testid'?: string\n}\n\n/**\n * A live status line for the sidebar footer: a spinner and a short sentence that opens the\n * thing it reports on. The host renders it ONLY while the state is relevant (work running,\n * something failed), so a quiet app shows nothing. Announced politely to screen readers.\n */\nexport function StatusRow({\n tone,\n label,\n onClick,\n compact = false,\n 'data-testid': testId,\n}: StatusRowProps) {\n const { className, Icon, spin } = STATUS_ROW_TONES[tone]\n return (\n <div role=\"status\" data-slot=\"status-row\" className={cn(compact && 'flex justify-center')}>\n <button\n type=\"button\"\n onClick={onClick}\n aria-label={label}\n title={label}\n data-testid={testId}\n data-tone={tone}\n className={cn(\n STATUS_ROW_BASE_CLASS,\n compact ? 'size-9 justify-center pointer-coarse:size-11' : 'w-full px-2.5 py-1.5',\n className\n )}\n >\n <Icon\n className={cn('size-4 shrink-0', spin && 'animate-spin motion-reduce:animate-none')}\n />\n {!compact && <span className=\"min-w-0 flex-1 truncate text-left\">{label}</span>}\n </button>\n </div>\n )\n}\n\n/** Short live state at a navigation row's right edge, replacing inventory counts. */\nexport function StatusBadge({\n tone,\n label,\n onClick,\n onDismiss,\n 'data-testid': testId,\n}: {\n tone: StatusRowTone\n label: string\n onClick?: () => void\n onDismiss?: () => void\n 'data-testid'?: string\n}) {\n const className = cn(\n 'rounded-md px-1.5 py-0.5 text-xs font-medium whitespace-nowrap',\n STATUS_ROW_TONES[tone].className\n )\n return (\n <span\n role=\"status\"\n className={cn(\n 'ml-auto inline-flex items-center rounded-md',\n STATUS_ROW_TONES[tone].className\n )}\n data-testid={testId}\n data-tone={tone}\n >\n {onClick ? (\n <button\n type=\"button\"\n title={label}\n className={className}\n onClick={(event) => {\n event.stopPropagation()\n onClick()\n }}\n onKeyDown={(event) => event.stopPropagation()}\n >\n {label}\n </button>\n ) : (\n <span className={className}>{label}</span>\n )}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label={`Dismiss ${label}`}\n title=\"Dismiss\"\n className=\"mr-1 rounded-sm p-0.5 opacity-60 hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={(event) => {\n event.stopPropagation()\n onDismiss()\n }}\n onKeyDown={(event) => event.stopPropagation()}\n >\n <X className=\"size-3\" />\n </button>\n )}\n </span>\n )\n}\n","import { RefreshCw, TriangleAlert, WifiOff } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\nimport { SidebarRowHoverContext } from './Sidebar'\nimport { SidebarRowAction } from './SidebarRowAction'\n\nexport type OfflinePillTone = 'offline' | 'failed' | 'syncing'\n\n/** Fixed strings of the offline pill. */\nexport interface OfflinePillLabels {\n reconnect: string\n}\n\nexport const DEFAULT_OFFLINE_PILL_LABELS: OfflinePillLabels = {\n reconnect: 'Reconnect',\n}\n\nexport interface OfflinePillProps {\n tone: OfflinePillTone\n /** e.g. \"Offline · 3 pending\", \"2 failed to sync\", \"Syncing 4…\". */\n label: string\n /** Icon-only (the collapsed rail / app bar). */\n compact?: boolean\n /** Opens the pending-changes list. */\n onOpen: () => void\n /** Offered beside the pill (only when not compact); pass it only while it can do something. */\n onReconnect?: () => void\n labels?: Partial<OfflinePillLabels>\n /** Pill button id (default `offline-sync-status`). */\n 'data-testid'?: string\n /** Reconnect button id (default `offline-reconnect-button`). */\n reconnectTestId?: string\n}\n\nconst TONES: Record<OfflinePillTone, { className: string; Icon: typeof WifiOff }> = {\n offline: { className: 'bg-yellow-bg text-yellow-text', Icon: WifiOff },\n failed: { className: 'bg-red-bg text-red-text', Icon: TriangleAlert },\n syncing: { className: 'bg-blue-bg text-blue-text', Icon: RefreshCw },\n}\n\n/**\n * Connection + sync indicator: a status pill that opens the pending-changes list, plus an\n * optional Reconnect button beside it. The app renders it only when there is something to say\n * (offline, or changes waiting/failing), so online-and-synced stays clean.\n */\nexport function OfflinePill({\n tone,\n label,\n compact = false,\n onOpen,\n onReconnect,\n labels,\n 'data-testid': testId,\n reconnectTestId,\n}: OfflinePillProps) {\n const { className, Icon } = TONES[tone]\n return (\n <div\n className={cn('flex items-center gap-1', compact && 'justify-center')}\n data-slot=\"offline-pill\"\n >\n <button\n type=\"button\"\n data-testid={testIdOr(testId, { testId: 'offline-sync-status' })}\n aria-label={label}\n title={label}\n onClick={onOpen}\n className={cn(\n 'flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors hover:brightness-95 pointer-coarse:min-h-11',\n compact && 'flex-none justify-center',\n className\n )}\n >\n <Icon className={cn('size-4 shrink-0', tone === 'syncing' && 'animate-spin')} />\n {!compact && <span className=\"truncate\">{label}</span>}\n </button>\n {!compact && onReconnect && (\n // Forced visible (context true): there is no row to hover.\n <SidebarRowHoverContext.Provider value={true}>\n <SidebarRowAction\n label={labels?.reconnect ?? DEFAULT_OFFLINE_PILL_LABELS.reconnect}\n onClick={onReconnect}\n data-testid={testIdOr(reconnectTestId, { testId: 'offline-reconnect-button' })}\n >\n <RefreshCw className=\"size-5\" />\n </SidebarRowAction>\n </SidebarRowHoverContext.Provider>\n )}\n </div>\n )\n}\n","import { MousePointerClick, X } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Fixed strings of the remote-control pill. */\nexport interface RemoteControlPillLabels {\n /** The disable button (the `disableLabel` prop wins). */\n turnOffRemoteControl: string\n}\n\nexport const DEFAULT_REMOTE_CONTROL_PILL_LABELS: RemoteControlPillLabels = {\n turnOffRemoteControl: 'Turn off remote control',\n}\n\nexport interface RemoteControlPillProps {\n /** A run is actively driving the screen (tinted + pulsing). */\n isActive: boolean\n label: string\n onDisable: () => void\n disableLabel?: string\n showDisableLabel?: boolean\n labels?: Partial<RemoteControlPillLabels>\n /** Root id (default `remote-control-indicator`). */\n 'data-testid'?: string\n /** Disable button id (default `remote-control-indicator-disable`). */\n disableTestId?: string\n}\n\n/**\n * Persistent, unobtrusive status pill shown while remote control is on or a run is executing,\n * with a one-click disable. The app decides when to mount it.\n */\nexport function RemoteControlPill({\n isActive,\n label,\n onDisable,\n disableLabel: disableLabelProp,\n showDisableLabel = false,\n labels,\n 'data-testid': testId,\n disableTestId,\n}: RemoteControlPillProps) {\n const disableLabel =\n disableLabelProp ??\n labels?.turnOffRemoteControl ??\n DEFAULT_REMOTE_CONTROL_PILL_LABELS.turnOffRemoteControl\n return (\n <div\n data-slot=\"remote-control-pill\"\n // Remote control's own control: a remote run never acts inside it.\n data-remote-control-surface=\"\"\n data-testid={testIdOr(testId, { testId: 'remote-control-indicator' })}\n className={cn(\n 'flex min-w-0 max-w-full items-center gap-1.5 rounded-full py-1 pl-2.5 pr-1 text-xs font-medium',\n isActive ? 'bg-accent text-accent-foreground' : 'bg-muted text-muted-foreground'\n )}\n >\n <MousePointerClick className={cn('size-3.5 shrink-0', isActive && 'animate-pulse')} />\n <span className=\"min-w-0 max-w-[16rem] truncate\">{label}</span>\n <button\n type=\"button\"\n onClick={onDisable}\n title={disableLabel}\n aria-label={disableLabel}\n data-testid={testIdOr(disableTestId, { testId: 'remote-control-indicator-disable' })}\n className={cn(\n 'flex shrink-0 items-center justify-center rounded-full transition-colors hover:bg-foreground/10 hover:text-foreground',\n showDisableLabel ? 'gap-1 px-2 py-1' : 'size-5 pointer-coarse:size-8'\n )}\n >\n {showDisableLabel && <span>{disableLabel}</span>}\n <X className=\"size-3.5\" />\n </button>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { ChevronLeft, ChevronRight, Lightbulb, Pencil, X } from 'lucide-react'\nimport { Button, cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Fixed strings of the tip card. */\nexport interface TipCardLabels {\n /** Default CTA text (the `ctaLabel` prop wins). */\n showMe: string\n previousTip: string\n nextTip: string\n editTip: string\n /** The card's heading and accessible name. */\n tip: string\n /** The dismiss button: it turns tips off (they come back from the account menu). */\n hideTips: string\n /** \"1 of 3\". */\n position: (index: number, count: number) => string\n}\n\nexport const DEFAULT_TIP_CARD_LABELS: TipCardLabels = {\n showMe: 'Show me',\n previousTip: 'Previous tip',\n nextTip: 'Next tip',\n editTip: 'Edit tip',\n tip: 'Tip',\n hideTips: 'Hide tips',\n position: (index, count) => `${index} of ${count}`,\n}\n\nexport interface TipCardProps {\n /** The tip text: one sentence. */\n message: ReactNode\n /** Which tip is showing (0-based) out of `count`; the pager appears when `count` > 1. */\n index?: number\n count?: number\n onPrev?: () => void\n onNext?: () => void\n /** The single primary action; omit when the tip has none. */\n ctaLabel?: string\n onCta?: () => void\n /** Turns tips off. The card is dismissible so it never becomes permanent furniture. */\n onDismiss?: () => void\n /** Dev-only edit affordance: the host passes it only in development builds. */\n onEdit?: () => void\n /** Hover pauses the host's tip rotation (desktop enhancement). */\n onHoverChange?: (hovered: boolean) => void\n labels?: Partial<TipCardLabels>\n className?: string\n /** Card id (default `tip-row`). */\n testId?: string\n /** Control ids; defaults are the current ids. */\n testIds?: Partial<Record<'prev' | 'next' | 'cta' | 'edit' | 'dismiss', string>>\n}\n\nconst ICON_BUTTON =\n 'flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:size-11'\n\n/**\n * The Smart Tips card: a compact muted tile. Header (bulb, \"Tip\", dismiss), one sentence, then\n * ONE primary action with a quiet \"n of m\" pager. It is shown only while tips are on and a tip\n * applies; the host owns which tip is current, rotation and the on/off preference.\n */\nexport function TipCard({\n message,\n index = 0,\n count = 1,\n onPrev,\n onNext,\n ctaLabel,\n onCta,\n onDismiss,\n onEdit,\n onHoverChange,\n labels,\n className,\n testId,\n testIds,\n}: TipCardProps) {\n const l = { ...DEFAULT_TIP_CARD_LABELS, ...labels }\n const hasMany = count > 1\n\n return (\n <section\n data-slot=\"tip-card\"\n aria-label={l.tip}\n className={cn('min-w-0 rounded-lg bg-muted p-3 text-sm', className)}\n onMouseEnter={() => onHoverChange?.(true)}\n onMouseLeave={() => onHoverChange?.(false)}\n data-testid={testIdOr(testId, { testId: 'tip-row' })}\n >\n <div className=\"-my-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground\">\n <Lightbulb className=\"size-4 shrink-0 text-primary\" aria-hidden />\n <span>{l.tip}</span>\n <span className=\"-mr-1.5 ml-auto flex items-center\">\n {onEdit && (\n <button\n type=\"button\"\n onClick={onEdit}\n aria-label={l.editTip}\n title={l.editTip}\n className={cn(ICON_BUTTON, 'text-red-text hover:bg-red-bg hover:text-red-text')}\n data-testid={testIdOr(testIds?.edit, { testId: 'tip-edit' })}\n >\n <Pencil className=\"size-3.5\" />\n </button>\n )}\n {onDismiss && (\n <button\n type=\"button\"\n onClick={onDismiss}\n aria-label={l.hideTips}\n title={l.hideTips}\n className={ICON_BUTTON}\n data-testid={testIdOr(testIds?.dismiss, { testId: 'tip-dismiss' })}\n >\n <X className=\"size-4\" />\n </button>\n )}\n </span>\n </div>\n <p className=\"mt-2 text-foreground\">{message}</p>\n {(onCta || hasMany) && (\n <div className=\"mt-3 flex items-center justify-between gap-2\">\n {onCta ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={onCta}\n className=\"font-medium text-primary\"\n data-testid={testIdOr(testIds?.cta, { testId: 'page-header-info-cta' })}\n >\n {ctaLabel ?? l.showMe}\n </Button>\n ) : (\n <span />\n )}\n {hasMany && (\n <span className=\"-mr-1.5 flex items-center text-xs text-muted-foreground\">\n <button\n type=\"button\"\n onClick={onPrev}\n aria-label={l.previousTip}\n title={l.previousTip}\n className={ICON_BUTTON}\n data-testid={testIdOr(testIds?.prev, { testId: 'tip-prev' })}\n >\n <ChevronLeft className=\"size-4\" />\n </button>\n <span className=\"min-w-10 text-center tabular-nums\" aria-live=\"polite\">\n {l.position(index + 1, count)}\n </span>\n <button\n type=\"button\"\n onClick={onNext}\n aria-label={l.nextTip}\n title={l.nextTip}\n className={ICON_BUTTON}\n data-testid={testIdOr(testIds?.next, { testId: 'tip-next' })}\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </span>\n )}\n </div>\n )}\n </section>\n )\n}\n","/**\n * DockZone Component\n *\n * Layout wrapper that provides a resizable right-hand panel area (#dock-zone)\n * where panels in 'docked' mode render via PanelPortal.\n *\n * Uses MutationObserver on the #dock-zone element to detect when content is\n * portaled in/out, so the split layout appears only when a panel is actually\n * mounted — not just when the store says a panel prefers 'docked' mode.\n *\n * The dock zone reads its initial width from the child's data-dock-width\n * attribute (pixels). If absent, defaults to 50% of the container.\n *\n * Below MOBILE_BREAKPOINT_PX, MIN_MAIN_PX + MIN_DOCK_PX (500px combined)\n * can't both fit — the clamp math still ran unconditionally and squeezed the\n * dock pane down to whatever sliver was left (as little as ~90px on a 390px\n * phone), rendering both panes as unusable slivers instead of showing either\n * one properly. Below that width this becomes a single full-width view that\n * swaps between main and docked content instead of splitting — same\n * principle as the Document Viewer's own view-swap (Edit ⇄ Track Changes).\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { cn } from '@arbidocs/react/ui'\n\nconst MIN_DOCK_PX = 200\nconst MIN_MAIN_PX = 300\n// Standard right-panel width — matches the overlay sheet (sm:w-[34rem]) so a\n// panel is the same size whether it's pinned or floating. Pinned stays\n// draggable from here; floating is fixed.\nconst DEFAULT_DOCK_PX = 544\nconst MOBILE_BREAKPOINT_PX = 640\n\ninterface DockZoneProps {\n children: React.ReactNode\n 'data-testid'?: string\n}\n\nexport function DockZone({ children, ...props }: DockZoneProps) {\n const [hasDockedContent, setHasDockedContent] = useState(false)\n const [dockWidth, setDockWidth] = useState<number | null>(null)\n const [isResizing, setIsResizing] = useState(false)\n const [dragPosition, setDragPosition] = useState<number | null>(null)\n const [containerWidth, setContainerWidth] = useState(0)\n const containerRef = useRef<HTMLDivElement>(null)\n const dockZoneRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const el = containerRef.current\n if (!el) return\n const observer = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width\n if (width !== undefined) setContainerWidth(width)\n })\n observer.observe(el)\n return () => observer.disconnect()\n }, [])\n\n const isMobile = containerWidth > 0 && containerWidth < MOBILE_BREAKPOINT_PX\n\n // Observe dock-zone children to know when content is actually portaled in\n // Also read initial width from the child's data-dock-width attribute\n useEffect(() => {\n const el = dockZoneRef.current\n if (!el) return\n\n const update = () => {\n const hasChildren = el.children.length > 0\n setHasDockedContent(hasChildren)\n if (hasChildren) {\n const requestedWidth = el.firstElementChild?.getAttribute('data-dock-width')\n if (requestedWidth) {\n setDockWidth(parseInt(requestedWidth, 10))\n }\n }\n }\n\n const observer = new MutationObserver(update)\n update()\n observer.observe(el, { childList: true })\n return () => observer.disconnect()\n }, [])\n\n const handleMouseDown = useCallback(() => {\n setIsResizing(true)\n setDragPosition(null)\n }, [])\n\n const handleMouseMove = useCallback(\n (e: MouseEvent) => {\n if (!isResizing || !containerRef.current) return\n const rect = containerRef.current.getBoundingClientRect()\n const x = e.clientX - rect.left\n // Clamp so neither pane gets too small\n const clamped = Math.min(Math.max(x, MIN_MAIN_PX), rect.width - MIN_DOCK_PX)\n setDragPosition(clamped)\n },\n [isResizing]\n )\n\n const handleMouseUp = useCallback(() => {\n if (dragPosition !== null && containerRef.current) {\n const containerWidth = containerRef.current.getBoundingClientRect().width\n setDockWidth(containerWidth - dragPosition)\n }\n setIsResizing(false)\n setDragPosition(null)\n }, [dragPosition])\n\n useEffect(() => {\n if (!isResizing) return\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n return () => {\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing, handleMouseMove, handleMouseUp])\n\n // Below the mobile breakpoint there's no room to split at all — MIN_MAIN_PX\n // + MIN_DOCK_PX alone is 500px, wider than most phones. Show whichever\n // side is active at full width instead of squeezing both into slivers.\n const effectiveDockWidth =\n hasDockedContent && containerWidth > 0\n ? isMobile\n ? containerWidth\n : Math.min(\n Math.max(dockWidth ?? DEFAULT_DOCK_PX, MIN_DOCK_PX),\n containerWidth - MIN_MAIN_PX\n )\n : 0\n const mainHidden = isMobile && hasDockedContent\n\n return (\n <div ref={containerRef} className=\"h-full relative flex\" data-testid={props['data-testid']}>\n <div\n style={{\n width: mainHidden ? 0 : `calc(100% - ${effectiveDockWidth}px)`,\n // Reserve gutter space so the vertical scrollbar doesn't appear and\n // disappear as streaming content crosses the viewport boundary —\n // that toggle reflows the layout and reads as a screen-wide flicker.\n scrollbarGutter: 'stable',\n }}\n className={cn(\n // The CSS container for the page's @-variants (PageContainer must not be one; see there).\n '@container h-full overflow-auto',\n hasDockedContent && !isMobile && 'border-r',\n mainHidden && 'overflow-hidden',\n // Animate opening only. On close the portaled content has already\n // unmounted, so animating leaves an empty strip shrinking while the\n // page behind reflows — reads as flicker over heavy content like the\n // documents grid. Snap closed instead. Resizing is also instant so\n // the divider doesn't lag the cursor.\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n aria-hidden={mainHidden}\n inert={mainHidden}\n data-scroll-container\n >\n {children}\n </div>\n\n {/* Wide grab zone with a visible grip, so the divider is findable and forgiving to hit */}\n {hasDockedContent && !isMobile && (\n <div\n className=\"group flex w-2 flex-shrink-0 cursor-col-resize items-center justify-center\"\n onMouseDown={handleMouseDown}\n data-testid=\"dock-resize-handle\"\n >\n <div className=\"h-12 w-1 rounded-full bg-muted-foreground/40 transition-colors group-hover:bg-primary\" />\n </div>\n )}\n\n <div\n ref={dockZoneRef}\n id=\"dock-zone\"\n style={{ width: effectiveDockWidth }}\n className={cn(\n 'h-full overflow-hidden flex-shrink-0',\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n />\n\n {isResizing && dragPosition !== null && (\n <div\n className=\"absolute top-0 bottom-0 w-0.5 bg-primary z-50 pointer-events-none\"\n style={{ left: dragPosition }}\n />\n )}\n {isResizing && <div className=\"absolute inset-0 z-40 cursor-col-resize\" />}\n </div>\n )\n}\n"]}
|
|
@@ -821,17 +821,41 @@ function DatabaseTable({
|
|
|
821
821
|
() => hasOpenRow ? (row) => latest.current.onOpenRow?.(row) : void 0,
|
|
822
822
|
[hasOpenRow]
|
|
823
823
|
);
|
|
824
|
+
const latestSources = react.useRef(sources);
|
|
825
|
+
latestSources.current = sources;
|
|
826
|
+
const hasSources = !!sources;
|
|
827
|
+
const hasSearchRows = !!sources?.searchRows;
|
|
828
|
+
const hasOpenDocument = !!sources?.onOpenDocument;
|
|
829
|
+
const contentKey = JSON.stringify([columns, sources?.members, sources?.documents]);
|
|
824
830
|
const columnDefs = react.useMemo(
|
|
825
831
|
() => createDatabaseColumns(columns, {
|
|
826
832
|
readOnly,
|
|
827
833
|
onEditColumn: editColumn,
|
|
828
834
|
onAddColumn: addColumn,
|
|
829
835
|
onOpenRow: openRow,
|
|
830
|
-
sources
|
|
836
|
+
sources: sources && {
|
|
837
|
+
members: sources.members,
|
|
838
|
+
documents: sources.documents,
|
|
839
|
+
searchRows: hasSearchRows ? (databaseId, q) => latestSources.current.searchRows(databaseId, q) : void 0,
|
|
840
|
+
onOpenDocument: hasOpenDocument ? (documentId) => latestSources.current?.onOpenDocument?.(documentId) : void 0
|
|
841
|
+
},
|
|
831
842
|
locale,
|
|
832
843
|
labels: columnLabels
|
|
833
844
|
}),
|
|
834
|
-
|
|
845
|
+
// `columns` and `sources` are read through `contentKey` (and the latest callbacks).
|
|
846
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
847
|
+
[
|
|
848
|
+
contentKey,
|
|
849
|
+
hasSources,
|
|
850
|
+
hasSearchRows,
|
|
851
|
+
hasOpenDocument,
|
|
852
|
+
readOnly,
|
|
853
|
+
editColumn,
|
|
854
|
+
addColumn,
|
|
855
|
+
openRow,
|
|
856
|
+
locale,
|
|
857
|
+
columnLabels
|
|
858
|
+
]
|
|
835
859
|
);
|
|
836
860
|
const noColumns = columns.length === 0;
|
|
837
861
|
const emptyState = {
|
|
@@ -954,5 +978,5 @@ exports.rowTitle = rowTitle;
|
|
|
954
978
|
exports.sameCellValue = sameCellValue;
|
|
955
979
|
exports.titleOf = titleOf;
|
|
956
980
|
exports.toApiValue = toApiValue;
|
|
957
|
-
//# sourceMappingURL=chunk-
|
|
958
|
-
//# sourceMappingURL=chunk-
|
|
981
|
+
//# sourceMappingURL=chunk-N33U2SB5.cjs.map
|
|
982
|
+
//# sourceMappingURL=chunk-N33U2SB5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/databases/column-types.ts","../src/databases/linkCells.tsx","../src/databases/PickCellEditor.tsx","../src/databases/SelectChip.tsx","../src/databases/SelectCellEditor.tsx","../src/databases/databaseColumns.tsx","../src/databases/DatabaseTable.tsx"],"names":["jsxs","jsx","FileText","ArrowUpRight","Fragment","cn","useState","useEffect","useMemo","useRef","X","Search","Loader2","Check","Type","Hash","CalendarDays","CheckSquare","ChevronDown","UserRound","Sigma","Lock","MoreHorizontal","Plus","Maximize2","Table2","Button","testIdOr","GridView"],"mappings":";;;;;;;;;;AA0BO,IAAM,qBAAA,GAA8C;AAAA,EACzD,MAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF;AAGO,IAAM,qBAAA,uBAA6D,GAAA,CAAwB;AAAA,EAChG,QAAA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,iBAAA,uBAAyD,GAAA,CAAwB;AAAA,EAC5F,UAAA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,mBAAmB,CAAC,MAAA,KAC/B,qBAAA,CAAsB,GAAA,CAAI,OAAO,IAAI;AAIhC,IAAM,sBAA0C,CAAC,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,OAAO,KAAK;AAuFpF,IAAM,mCAAA,GAAgE;AAAA,EAC3E,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,IAAA,EAAM,MAAA;AAAA,EACN,QAAA,EAAU,UAAA;AAAA,EACV,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,QAAA;AAAA,EACR,QAAA,EAAU,WAAA;AAAA,EACV,QAAA,EAAU,UAAA;AAAA,EACV,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV;AAMA,IAAM,YAAA,GAAe;AAAA,EACnB,2BAAA;AAAA,EACA,6BAAA;AAAA,EACA,+BAAA;AAAA,EACA,+BAAA;AAAA,EACA,yBAAA;AAAA,EACA;AACF,CAAA;AAEO,SAAS,WAAW,MAAA,EAAwB;AACjD,EAAA,IAAI,IAAA,GAAO,CAAA;AACX,EAAA,KAAA,MAAW,EAAA,IAAM,MAAA,CAAO,WAAA,EAAY,EAAG,IAAA,GAAQ,OAAO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GAAS,CAAA,oBACzC3B,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,kCAAA,EACb,QAAA,kBAAAD,eAAAA;AAAA,UAAC0B,SAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAQ,OAAA;AAAA,YACR,IAAA,EAAK,IAAA;AAAA,YACL,OAAA,EAAS,QAAA;AAAA,YACT,aAAA,EAAY,kBAAA;AAAA,YACZ,SAAA,EAAU,+BAAA;AAAA,YAEV,QAAA,EAAA;AAAA,8BAAAzB,cAAAA,CAACsB,gBAAAA,EAAA,EAAK,SAAA,EAAU,QAAA,EAAS,CAAA;AAAA,cACxB,CAAA,CAAE;AAAA;AAAA;AAAA,SACL,EACF;AAAA;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-N33U2SB5.cjs","sourcesContent":["/**\n * Databases: the shapes the blocks read, and the per-type rules for showing and editing a cell.\n *\n * A database is a user-defined table (a client database, billing records). Its columns are typed:\n * `text`, `number`, `date`, `checkbox` and `select` hold a value; `person` holds a workspace member's\n * id (`usr-…`); `document` and `relation` hold lists of ids (documents of the workspace, rows of the\n * target database); `lookup` (the values of a column of the related rows) and `rollup` (a number\n * measured over them) are computed by the server and never written. The server checks and\n * normalises every cell (dates arrive as ISO `YYYY-MM-DD` or a full timestamp, numbers as numbers, a\n * select as one of its options) and names every id a row refers to in the row's `titles`, so the\n * blocks only format for display and turn an editor's value into what the API takes.\n */\n\nexport type DatabaseColumnType =\n | 'text'\n | 'number'\n | 'date'\n | 'checkbox'\n | 'select'\n | 'person'\n | 'document'\n | 'relation'\n | 'lookup'\n | 'rollup'\n\n/** Every type, in the order a type picker lists them. */\nexport const DATABASE_COLUMN_TYPES: DatabaseColumnType[] = [\n 'text',\n 'number',\n 'date',\n 'checkbox',\n 'select',\n 'person',\n 'document',\n 'relation',\n 'lookup',\n 'rollup',\n]\n\n/** Types whose cells the server computes from a relation: shown, never edited. */\nexport const COMPUTED_COLUMN_TYPES: ReadonlySet<DatabaseColumnType> = new Set<DatabaseColumnType>([\n 'lookup',\n 'rollup',\n])\n\n/** Types whose cells are lists of ids (written as a list that replaces the cell's links). */\nexport const LINK_COLUMN_TYPES: ReadonlySet<DatabaseColumnType> = new Set<DatabaseColumnType>([\n 'document',\n 'relation',\n])\n\nexport const isComputedColumn = (column: Pick<DatabaseColumnView, 'type'>): boolean =>\n COMPUTED_COLUMN_TYPES.has(column.type)\n\nexport type DatabaseRollupOp = 'count' | 'sum' | 'avg' | 'min' | 'max'\n\nexport const DATABASE_ROLLUP_OPS: DatabaseRollupOp[] = ['count', 'sum', 'avg', 'min', 'max']\n\n/**\n * A relation column's target. A `two_way` column has a paired column on the target database\n * (`pair_column_id`) showing the same links from the other side; `reverse` marks the paired side.\n */\nexport interface DatabaseRelationView {\n database_id: string\n two_way?: boolean\n pair_column_id?: string | null\n reverse?: boolean\n}\n\n/** A lookup: `column` of the target database, read through this database's `relation` column. */\nexport interface DatabaseLookupView {\n relation: string\n column: string\n}\n\n/** A rollup: `op` over the rows linked through `relation` (`column`: a number column, not for count). */\nexport interface DatabaseRollupView {\n relation: string\n column?: string | null\n op?: DatabaseRollupOp\n}\n\n/** A column as the blocks read it (the API's `DatabaseColumn`). */\nexport interface DatabaseColumnView {\n id: string\n name: string\n type: DatabaseColumnType\n options?: string[] | null\n relation?: DatabaseRelationView | null\n lookup?: DatabaseLookupView | null\n rollup?: DatabaseRollupView | null\n /** Who may write it beyond the row's editors (`owners`, or `listed`: the people a person column of another\n * database lists — an approval's decision). */\n edit_by?: DatabaseEditRuleView | null\n /** Set by the host: the viewer may not write this column (its `edit_by` rule leaves them out). */\n locked?: boolean\n}\n\n/** A column's edit rule: the workspace's owners and the database's creator, or the people listed in\n * `column_id` of the database `database_id`. */\nexport interface DatabaseEditRuleView {\n kind: 'owners' | 'listed'\n database_id?: string | null\n column_id?: string | null\n}\n\n/**\n * A row as the blocks read it: cell values keyed by column id; an empty cell is absent. `titles`\n * names every person, document and related row the cells refer to (id → display name).\n */\nexport interface DatabaseRowView {\n id: string\n values: Record<string, unknown>\n titles?: Record<string, string>\n /** False: a draft only its creator sees, until submitted (shared). */\n shared?: boolean\n}\n\n/** A database as a list shows it (the API's `DatabaseRead`). */\nexport interface DatabaseSummaryView {\n id: string\n name: string\n description?: string | null\n columns: DatabaseColumnView[]\n row_count: number\n /** False for a database of another (public) workspace: read here, edited in its own workspace. */\n editable: boolean\n updated_at?: string | null\n}\n\nexport interface DatabaseColumnTypeLabels {\n text: string\n number: string\n date: string\n checkbox: string\n select: string\n person: string\n document: string\n relation: string\n lookup: string\n rollup: string\n}\n\nexport const DEFAULT_DATABASE_COLUMN_TYPE_LABELS: DatabaseColumnTypeLabels = {\n text: 'Text',\n number: 'Number',\n date: 'Date',\n checkbox: 'Checkbox',\n select: 'Select',\n person: 'Person',\n document: 'Documents',\n relation: 'Relation',\n lookup: 'Lookup',\n rollup: 'Rollup',\n}\n\n/**\n * Chip colours for select options: a stable colour per option text, so a value keeps its colour.\n * Theme tone pairs (tokens.css), so light and dark follow the host.\n */\nconst OPTION_TONES = [\n 'bg-blue-bg text-blue-text',\n 'bg-green-bg text-green-text',\n 'bg-yellow-bg text-yellow-text',\n 'bg-purple-bg text-purple-text',\n 'bg-red-bg text-red-text',\n 'bg-gray-bg text-gray-text',\n]\n\nexport function optionTone(option: string): string {\n let hash = 0\n for (const ch of option.toLowerCase()) hash = (hash * 31 + ch.charCodeAt(0)) >>> 0\n return OPTION_TONES[hash % OPTION_TONES.length]\n}\n\nconst isEmpty = (value: unknown): boolean =>\n value === null ||\n value === undefined ||\n (typeof value === 'string' && value.trim() === '') ||\n (Array.isArray(value) && value.length === 0)\n\n/** A cell as a list: a list cell as is, a single value as a list of one, an empty cell as none. */\nexport function cellList(value: unknown): unknown[] {\n if (isEmpty(value)) return []\n return Array.isArray(value) ? value.filter((v) => !isEmpty(v)) : [value]\n}\n\n/** The ids a person, document or relation cell holds. */\nexport function cellIds(value: unknown): string[] {\n return cellList(value).filter((v): v is string => typeof v === 'string')\n}\n\n/** An id's display name from the row's titles (the id itself when the server could not name it). */\nexport function titleOf(id: string, titles?: Record<string, string>): string {\n return titles?.[id] ?? id\n}\n\n/** Two cell values, as the API stores them, are the same (lists compare item by item). */\nexport function sameCellValue(a: unknown, b: unknown): boolean {\n if (Array.isArray(a) || Array.isArray(b)) {\n const la = cellList(a)\n const lb = cellList(b)\n return la.length === lb.length && la.every((v, i) => v === lb[i])\n }\n return (a ?? null) === (b ?? null)\n}\n\n/**\n * A stored date for display. A bare `YYYY-MM-DD` is a calendar day: it is shown from its own\n * components, never through a time zone (which would move it a day for viewers west of UTC).\n */\nexport function formatDateValue(value: string, locale?: string): string {\n const day = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value)\n if (day) {\n const [, y, m, d] = day\n return new Date(Date.UTC(+y, +m - 1, +d)).toLocaleDateString(locale, { timeZone: 'UTC' })\n }\n const at = new Date(value)\n return Number.isNaN(at.getTime()) ? value : at.toLocaleString(locale)\n}\n\nexport function formatNumberValue(value: number, locale?: string): string {\n return value.toLocaleString(locale, { maximumFractionDigits: 6 })\n}\n\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?(Z|[+-]\\d{2}:?\\d{2})?)?$/\n\n/**\n * One value of a lookup cell, whose type is the looked-up column's: an id reads as its title, a\n * number and an ISO date as their own column would show them.\n */\nexport function formatLookupValue(\n value: unknown,\n titles?: Record<string, string>,\n locale?: string\n): string {\n if (isEmpty(value)) return ''\n if (typeof value === 'number') return formatNumberValue(value, locale)\n if (typeof value === 'boolean') return value ? 'Yes' : 'No'\n if (typeof value === 'string') {\n if (titles?.[value] !== undefined) return titles[value]\n if (ISO_DATE.test(value)) return formatDateValue(value, locale)\n }\n return String(value)\n}\n\nconst NAMED_TYPES: ReadonlySet<DatabaseColumnType> = new Set<DatabaseColumnType>([\n 'person',\n 'document',\n 'relation',\n])\n\n/**\n * A cell as text: what a cell shows, what search and copy see. Checkboxes read as Yes/No; people,\n * documents and related rows by their titles (the row's `titles`), lists joined with commas.\n */\nexport function formatCell(\n value: unknown,\n type: DatabaseColumnType,\n locale?: string,\n titles?: Record<string, string>\n): string {\n if (isEmpty(value)) return ''\n if ((type === 'number' || type === 'rollup') && typeof value === 'number')\n return formatNumberValue(value, locale)\n if (type === 'date' && typeof value === 'string') return formatDateValue(value, locale)\n if (type === 'checkbox') return value ? 'Yes' : 'No'\n if (NAMED_TYPES.has(type))\n return cellIds(value)\n .map((id) => titleOf(id, titles))\n .join(', ')\n if (type === 'lookup')\n return cellList(value)\n .map((v) => formatLookupValue(v, titles, locale))\n .join(', ')\n return String(value)\n}\n\n/**\n * An editor's value as the API takes it. Empty becomes `null` (which empties the cell); everything\n * else goes as typed and the server checks it, so a bad value comes back as a 422 naming the column.\n * A document or relation cell goes as its list of ids (which replaces the cell's links).\n */\nexport function toApiValue(value: unknown, type: DatabaseColumnType): unknown {\n if (isEmpty(value)) return null\n if (LINK_COLUMN_TYPES.has(type)) return cellIds(value)\n if (type === 'checkbox') return Boolean(value)\n if (type === 'date' && value instanceof Date) {\n const pad = (n: number) => String(n).padStart(2, '0')\n return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`\n }\n if (type === 'number' && typeof value === 'string') {\n const n = Number(value.replace(/,/g, ''))\n return Number.isFinite(n) ? n : value\n }\n return value\n}\n\n/**\n * Sort comparator for a column's stored values: empty cells last, then by type. People, documents,\n * related rows and lookups sort by what they show, so pass each row's titles.\n */\nexport function compareCells(\n a: unknown,\n b: unknown,\n type: DatabaseColumnType,\n titlesA?: Record<string, string>,\n titlesB?: Record<string, string>\n): number {\n const ea = isEmpty(a)\n const eb = isEmpty(b)\n if (ea || eb) return ea === eb ? 0 : ea ? 1 : -1\n if (type === 'number' || type === 'checkbox' || type === 'rollup') return Number(a) - Number(b)\n const shown = NAMED_TYPES.has(type) || type === 'lookup'\n const ta = shown ? formatCell(a, type, undefined, titlesA) : String(a)\n const tb = shown ? formatCell(b, type, undefined, titlesB) : String(b)\n return ta.localeCompare(tb, undefined, { sensitivity: 'base', numeric: true })\n}\n\n/**\n * A row's title: its first column as text (what a relation picker and a row's detail call it), or\n * `''` when that cell is empty.\n */\nexport function rowTitle(\n row: Pick<DatabaseRowView, 'values' | 'titles'>,\n columns: DatabaseColumnView[],\n locale?: string\n): string {\n const first = columns[0]\n return first ? formatCell(row.values[first.id], first.type, locale, row.titles) : ''\n}\n","/**\n * Cells that refer to other things: a person (a workspace member), documents of the workspace, rows\n * of a related database, and the computed lookup and rollup cells read through a relation.\n *\n * The row's `titles` names every id its cells hold, so a cell shows names without another call. A\n * document chip opens the document (the host's `onOpenDocument`).\n */\nimport type { MouseEvent, ReactNode } from 'react'\nimport { ArrowUpRight, FileText } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { cellIds, cellList, formatLookupValue, titleOf } from './column-types'\n\n/** Something a person, document or relation cell can hold, as a picker lists it. */\nexport interface DatabasePickOption {\n id: string\n label: string\n /** A second, quieter line (an email, a file's folder). */\n description?: string\n}\n\n/**\n * Where the pickers of person, document and relation cells get their choices, and what a document\n * chip does. The host owns the data; without a source the cell still shows, but does not edit.\n */\nexport interface DatabaseCellSources {\n /** The workspace's members (person cells). */\n members?: DatabasePickOption[]\n /** The workspace's documents (document cells). */\n documents?: DatabasePickOption[]\n /** Rows of `databaseId` matching `q` (relation cells; an empty `q` lists the first rows). */\n searchRows?: (databaseId: string, q: string) => Promise<DatabasePickOption[]>\n /** Open a document (a click on a document chip). */\n onOpenDocument?: (documentId: string) => void\n}\n\nconst CHIP =\n 'inline-flex h-[22px] min-w-0 max-w-[14rem] shrink-0 items-center gap-1 rounded-md border border-border bg-muted/50 px-1.5 text-xs text-foreground'\n\nfunction initials(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean)\n const letters = parts.length > 1 ? parts[0][0] + parts[parts.length - 1][0] : name.slice(0, 2)\n return letters.toUpperCase()\n}\n\n/** A member's avatar initials and name. */\nexport function PersonChip({ name }: { name: string }) {\n return (\n <span className=\"inline-flex min-w-0 items-center gap-1.5 text-sm\">\n <span\n aria-hidden\n className=\"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-medium text-muted-foreground\"\n >\n {initials(name)}\n </span>\n <span className=\"truncate\">{name}</span>\n </span>\n )\n}\n\n/** A document or related row as a chip; a document chip opens the document when clicked. */\nexport function LinkChip({\n label,\n kind,\n onOpen,\n testId,\n}: {\n label: string\n kind: 'document' | 'relation'\n onOpen?: () => void\n testId?: string\n}) {\n const Icon = kind === 'document' ? FileText : ArrowUpRight\n const body = (\n <>\n <Icon className=\"size-3 shrink-0 text-muted-foreground\" aria-hidden />\n <span className=\"truncate\">{label}</span>\n </>\n )\n if (!onOpen) {\n return (\n <span className={CHIP} title={label} data-testid={testId}>\n {body}\n </span>\n )\n }\n // The grid edits on double-click: a click on the chip opens the document and nothing else.\n const stop = (e: MouseEvent) => e.stopPropagation()\n return (\n <button\n type=\"button\"\n title={label}\n data-testid={testId}\n onClick={(e) => {\n e.stopPropagation()\n onOpen()\n }}\n onDoubleClick={stop}\n onMouseDown={stop}\n className={cn(CHIP, 'hover:bg-muted hover:underline')}\n >\n {body}\n </button>\n )\n}\n\n/** Chips on one line (a grid cell), or wrapping onto more (`wrap`: a row's detail). */\nfunction ChipRow({ children, wrap }: { children: ReactNode; wrap?: boolean }) {\n return (\n <span\n className={cn(\n 'flex min-w-0 items-center gap-1',\n wrap ? 'flex-wrap py-0.5' : 'h-full overflow-hidden'\n )}\n >\n {children}\n </span>\n )\n}\n\nexport function PersonCell({ value, titles }: { value: unknown; titles?: Record<string, string> }) {\n const [id] = cellIds(value)\n return id ? <PersonChip name={titleOf(id, titles)} /> : null\n}\n\nexport function LinkChipsCell({\n value,\n titles,\n kind,\n onOpenDocument,\n wrap,\n}: {\n value: unknown\n titles?: Record<string, string>\n kind: 'document' | 'relation'\n onOpenDocument?: (id: string) => void\n wrap?: boolean\n}) {\n const ids = cellIds(value)\n if (ids.length === 0) return null\n return (\n <ChipRow wrap={wrap}>\n {ids.map((id) => (\n <LinkChip\n key={id}\n label={titleOf(id, titles)}\n kind={kind}\n testId={`database-chip-${id}`}\n onOpen={kind === 'document' && onOpenDocument ? () => onOpenDocument(id) : undefined}\n />\n ))}\n </ChipRow>\n )\n}\n\n/** A lookup's values: related rows and documents as chips, anything else as quiet tags. */\nexport function LookupCell({\n value,\n titles,\n locale,\n wrap,\n}: {\n value: unknown\n titles?: Record<string, string>\n locale?: string\n wrap?: boolean\n}) {\n const values = cellList(value)\n if (values.length === 0) return null\n return (\n <ChipRow wrap={wrap}>\n {values.map((v, i) => {\n const text = formatLookupValue(v, titles, locale)\n const key = `${i}-${text}`\n if (typeof v === 'string' && /^doc-/.test(v))\n return <LinkChip key={key} label={text} kind=\"document\" />\n if (typeof v === 'string' && /^dbr-/.test(v))\n return <LinkChip key={key} label={text} kind=\"relation\" />\n return (\n <span\n key={key}\n title={text}\n className=\"inline-flex h-[22px] min-w-0 max-w-[14rem] shrink-0 items-center truncate rounded-md bg-muted/60 px-1.5 text-xs text-foreground\"\n >\n {text}\n </span>\n )\n })}\n </ChipRow>\n )\n}\n","/**\n * PickCellEditor: the editor of person, document and relation cells. Opening the cell shows a search\n * box over the choices (workspace members, workspace documents, rows of the related database), the\n * way Notion and Airtable do.\n *\n * Single (person): one click, or the arrow keys and Enter, picks a value and closes. Multiple\n * (documents, related rows): a click toggles a choice and the picker stays open; the chosen ones\n * sit on top, removable, and Backspace in an empty search removes the last. Clicking away or \"Done\"\n * keeps the change; Escape keeps the old value. Used as an AG Grid popup editor (`cellEditorPopup`)\n * and in a row's detail panel (`DatabaseRowDetail`).\n *\n * Choices come from a fixed list (`options`, filtered here) or a server search (`search`, debounced).\n */\nimport { useEffect, useMemo, useRef, useState, type KeyboardEvent } from 'react'\nimport type { CustomCellEditorProps } from 'ag-grid-react'\nimport { Check, Loader2, Search, X } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { cellIds, type DatabaseRowView } from './column-types'\nimport { LinkChip, PersonChip, type DatabasePickOption } from './linkCells'\n\n/** The most choices a picker lists at once (refine the search for more). */\nconst MAX_SHOWN = 50\nconst SEARCH_DEBOUNCE_MS = 200\n\nexport interface PickCellEditorLabels {\n searchPlaceholder: string\n noMatches: string\n searching: string\n clear: string\n done: string\n remove: (label: string) => string\n}\n\nexport const DEFAULT_PICK_CELL_EDITOR_LABELS: PickCellEditorLabels = {\n searchPlaceholder: 'Search…',\n noMatches: 'No matches',\n searching: 'Searching…',\n clear: 'Clear',\n done: 'Done',\n remove: (label) => `Remove ${label}`,\n}\n\nexport interface PickCellEditorParams {\n kind: 'person' | 'document' | 'relation'\n /** A fixed list of choices, filtered as the user types. */\n options?: DatabasePickOption[]\n /** Choices from the server for a search (instead of `options`). */\n search?: (q: string) => Promise<DatabasePickOption[]>\n labels?: Partial<PickCellEditorLabels>\n}\n\nfunction useChoices(\n query: string,\n options: DatabasePickOption[] | undefined,\n search: ((q: string) => Promise<DatabasePickOption[]>) | undefined\n): { choices: DatabasePickOption[]; loading: boolean } {\n const [found, setFound] = useState<DatabasePickOption[]>([])\n const [loading, setLoading] = useState(Boolean(search))\n useEffect(() => {\n if (!search) return\n let live = true\n setLoading(true)\n const t = setTimeout(\n () => {\n search(query.trim())\n .then((rows) => live && setFound(rows))\n .catch(() => live && setFound([]))\n .finally(() => live && setLoading(false))\n },\n query ? SEARCH_DEBOUNCE_MS : 0\n )\n return () => {\n live = false\n clearTimeout(t)\n }\n }, [query, search])\n\n const filtered = useMemo(() => {\n if (search) return found.slice(0, MAX_SHOWN)\n const q = query.trim().toLowerCase()\n const all = options ?? []\n const hits = q\n ? all.filter(\n (o) =>\n o.label.toLowerCase().includes(q) || (o.description ?? '').toLowerCase().includes(q)\n )\n : all\n return hits.slice(0, MAX_SHOWN)\n }, [found, options, query, search])\n\n return { choices: filtered, loading: Boolean(search) && loading }\n}\n\n/**\n * What the editor reads of AG Grid's editor props: the value, a setter, a close and the row (whose\n * `titles` name the chosen ids). A host outside the grid (a row's detail panel) passes just these.\n */\nexport type PickCellEditorProps = Pick<\n CustomCellEditorProps<DatabaseRowView>,\n 'value' | 'onValueChange' | 'stopEditing'\n> & { data?: DatabaseRowView } & PickCellEditorParams\n\nexport function PickCellEditor(props: PickCellEditorProps) {\n const { value, onValueChange, stopEditing, data, kind, options, search } = props\n const l = { ...DEFAULT_PICK_CELL_EDITOR_LABELS, ...props.labels }\n const multiple = kind !== 'person'\n const [chosen, setChosen] = useState<string[]>(() => cellIds(value))\n const [query, setQuery] = useState('')\n const [active, setActive] = useState(0)\n const input = useRef<HTMLInputElement>(null)\n const { choices, loading } = useChoices(query, options, search)\n\n // Names for the chosen ids: the row's titles, then whatever the pickers have shown.\n const names = useRef<Record<string, string>>({ ...(data?.titles ?? {}) })\n for (const o of options ?? []) names.current[o.id] ??= o.label\n for (const o of choices) names.current[o.id] = o.label\n const nameOf = (id: string) => names.current[id] ?? id\n\n useEffect(() => input.current?.focus(), [])\n useEffect(() => setActive(0), [query])\n\n const commit = (ids: string[]) => {\n setChosen(ids)\n // The cell shows the new chips by name before the server answers with the row's titles.\n if (data) {\n const titles = { ...(data.titles ?? {}) }\n for (const id of ids) titles[id] ??= nameOf(id)\n data.titles = titles\n }\n onValueChange(multiple ? ids : (ids[0] ?? null))\n }\n\n const close = () => setTimeout(() => stopEditing(), 0)\n\n const toggle = (id: string) => {\n if (!multiple) {\n commit([id])\n close()\n return\n }\n commit(chosen.includes(id) ? chosen.filter((x) => x !== id) : [...chosen, id])\n }\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault()\n e.stopPropagation()\n if (choices.length === 0) return\n const step = e.key === 'ArrowDown' ? 1 : -1\n setActive((i) => (i + step + choices.length) % choices.length)\n } else if (e.key === 'Enter') {\n e.preventDefault()\n e.stopPropagation()\n const pick = choices[active]\n if (pick) toggle(pick.id)\n else if (multiple) close()\n } else if (e.key === 'Backspace' && multiple && !query && chosen.length > 0) {\n commit(chosen.slice(0, -1))\n } else if (\n e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'Home' ||\n e.key === 'End'\n ) {\n // Move the caret in the search box, not the grid's focused cell.\n e.stopPropagation()\n }\n }\n\n return (\n <div\n data-testid=\"database-pick-editor\"\n className=\"flex w-72 flex-col rounded-md border border-border bg-popover shadow-md\"\n >\n {multiple && chosen.length > 0 && (\n <div className=\"flex flex-wrap gap-1 border-b border-border p-1.5\">\n {chosen.map((id) => (\n <span key={id} className=\"inline-flex min-w-0 items-center\">\n <LinkChip label={nameOf(id)} kind={kind === 'document' ? 'document' : 'relation'} />\n <button\n type=\"button\"\n aria-label={l.remove(nameOf(id))}\n onClick={() => commit(chosen.filter((x) => x !== id))}\n data-testid={`database-pick-remove-${id}`}\n className=\"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground\"\n >\n <X className=\"size-3\" />\n </button>\n </span>\n ))}\n </div>\n )}\n <div className=\"flex items-center gap-1.5 border-b border-border px-2\">\n <Search className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n <input\n ref={input}\n value={query}\n placeholder={l.searchPlaceholder}\n onChange={(e) => setQuery(e.target.value)}\n onKeyDown={onKeyDown}\n data-testid=\"database-pick-search\"\n className=\"h-8 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground\"\n />\n {loading && <Loader2 className=\"size-3.5 animate-spin text-muted-foreground\" />}\n </div>\n <div role=\"listbox\" aria-multiselectable={multiple} className=\"max-h-64 overflow-y-auto p-1\">\n {choices.map((o, i) => {\n const isChosen = chosen.includes(o.id)\n return (\n <button\n key={o.id}\n type=\"button\"\n role=\"option\"\n aria-selected={isChosen}\n onMouseEnter={() => setActive(i)}\n onClick={() => toggle(o.id)}\n data-testid={`database-pick-option-${o.id}`}\n className={cn(\n 'flex w-full items-center gap-2 rounded px-2 py-1 text-left text-sm',\n i === active && 'bg-muted'\n )}\n >\n <span className=\"flex min-w-0 flex-1 flex-col\">\n {kind === 'person' ? (\n <PersonChip name={o.label} />\n ) : (\n <span className=\"truncate\">{o.label}</span>\n )}\n {o.description && (\n <span className=\"truncate text-xs text-muted-foreground\">{o.description}</span>\n )}\n </span>\n {isChosen && <Check className=\"size-3.5 shrink-0\" />}\n </button>\n )\n })}\n {choices.length === 0 && (\n <p className=\"px-2 py-1.5 text-sm text-muted-foreground\">\n {loading ? l.searching : l.noMatches}\n </p>\n )}\n </div>\n {(multiple || chosen.length > 0) && (\n <div className=\"flex justify-end border-t border-border p-1\">\n {!multiple ? (\n <button\n type=\"button\"\n onClick={() => {\n commit([])\n close()\n }}\n data-testid=\"database-pick-clear\"\n className=\"rounded px-2 py-1 text-sm text-muted-foreground hover:bg-muted\"\n >\n {l.clear}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={close}\n data-testid=\"database-pick-done\"\n className=\"rounded px-2 py-1 text-sm font-medium hover:bg-muted\"\n >\n {l.done}\n </button>\n )}\n </div>\n )}\n </div>\n )\n}\n","import { cn } from '@arbidocs/react/ui'\nimport { optionTone } from './column-types'\n\n/** A select option as a coloured chip (the same colour wherever the option appears). */\nexport function SelectChip({ value }: { value: string }) {\n return (\n <span\n className={cn(\n 'inline-flex max-w-full items-center truncate rounded-md px-2 py-0.5 text-xs font-medium',\n optionTone(value)\n )}\n >\n {value}\n </span>\n )\n}\n","/**\n * SelectCellEditor: the editor of a select column. Opening the cell shows its options straight away,\n * as the chips the cell displays (plus \"Clear\"), the way Notion and Airtable do: one click, or the\n * arrow keys and Enter, picks a value and closes; Escape or clicking away keeps the old one.\n * Used as an AG Grid popup editor (`cellEditorPopup`) and in a row's detail panel (`DatabaseRowDetail`).\n */\nimport { useEffect, useRef, useState, type KeyboardEvent } from 'react'\nimport type { CustomCellEditorProps } from 'ag-grid-react'\nimport { Check } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { SelectChip } from './SelectChip'\n\nexport interface SelectCellEditorParams {\n options: string[]\n clearLabel?: string\n}\n\n/**\n * What the editor reads of AG Grid's editor props: the value, a setter and a close. A host outside\n * the grid (a row's detail panel) passes just these.\n */\nexport type SelectCellEditorProps = Pick<\n CustomCellEditorProps,\n 'value' | 'onValueChange' | 'stopEditing'\n> &\n SelectCellEditorParams\n\nexport function SelectCellEditor(props: SelectCellEditorProps) {\n const { value, onValueChange, stopEditing, options, clearLabel = 'Clear' } = props\n const items: Array<string | null> = [...options, null]\n const [active, setActive] = useState(() => Math.max(0, options.indexOf(String(value ?? ''))))\n const list = useRef<HTMLDivElement>(null)\n\n useEffect(() => list.current?.focus(), [])\n\n const pick = (option: string | null) => {\n onValueChange(option)\n // Let the grid take the new value before the editor closes.\n setTimeout(() => stopEditing(), 0)\n }\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault()\n e.stopPropagation()\n const step = e.key === 'ArrowDown' ? 1 : -1\n setActive((i) => (i + step + items.length) % items.length)\n } else if (e.key === 'Enter') {\n e.preventDefault()\n e.stopPropagation()\n pick(items[active])\n }\n }\n\n return (\n <div\n ref={list}\n role=\"listbox\"\n tabIndex={-1}\n onKeyDown={onKeyDown}\n data-testid=\"database-select-editor\"\n className=\"flex min-w-44 flex-col gap-0.5 rounded-md border border-border bg-popover p-1 shadow-md outline-none\"\n >\n {items.map((option, i) => (\n <button\n key={option ?? '__clear'}\n type=\"button\"\n role=\"option\"\n aria-selected={option === value}\n onMouseEnter={() => setActive(i)}\n onClick={() => pick(option)}\n data-testid={\n option === null ? 'database-select-clear' : `database-select-option-${option}`\n }\n className={cn(\n 'flex items-center gap-2 rounded px-2 py-1 text-left text-sm',\n i === active && 'bg-muted'\n )}\n >\n {option === null ? (\n <span className=\"text-muted-foreground\">{clearLabel}</span>\n ) : (\n <SelectChip value={option} />\n )}\n {option !== null && option === value && <Check className=\"ml-auto size-3.5\" />}\n </button>\n ))}\n </div>\n )\n}\n","/**\n * Column definitions for a database grid, built from the database's own (user-defined) columns.\n *\n * Each column edits in place with the editor for its type (AG Grid's for text, number, date and\n * checkbox; a chip list for select; a searchable picker for a person, documents and related rows); a\n * checkbox toggles with one click, a select shows its value as a coloured chip, documents and\n * related rows as chips named from the row's `titles`. Lookup and rollup columns are computed by the\n * server: read-only, their header marked with a quiet \"computed\" sign. The header carries the type's\n * icon and a button that opens the column's settings, and a trailing narrow column holds the \"add a\n * column\" button: a Notion/Airtable-style table.\n *\n * Every column's `colId` is the database column id (`col-…`), so AG Grid's saved column state\n * (order, width) survives renames.\n */\nimport type { ReactNode } from 'react'\nimport type {\n ColDef,\n ICellRendererParams,\n ValueFormatterParams,\n ValueGetterParams,\n ValueSetterParams,\n} from 'ag-grid-community'\nimport {\n ArrowUpRight,\n CalendarDays,\n CheckSquare,\n ChevronDown,\n FileText,\n Hash,\n Lock,\n Maximize2,\n MoreHorizontal,\n Plus,\n Search,\n Sigma,\n Type,\n UserRound,\n} from 'lucide-react'\nimport {\n compareCells,\n formatCell,\n isComputedColumn,\n sameCellValue,\n toApiValue,\n type DatabaseColumnType,\n type DatabaseColumnView,\n type DatabaseRowView,\n} from './column-types'\nimport { SelectChip } from './SelectChip'\nimport { SelectCellEditor } from './SelectCellEditor'\nimport { PickCellEditor, type PickCellEditorParams } from './PickCellEditor'\nimport { LinkChipsCell, LookupCell, PersonCell, type DatabaseCellSources } from './linkCells'\n\nexport { SelectChip }\n\nexport interface DatabaseColumnLabels {\n addColumn: string\n columnSettings: (name: string) => string\n computed: string\n openRow: string\n}\n\nexport const DEFAULT_DATABASE_COLUMN_LABELS: DatabaseColumnLabels = {\n addColumn: 'Add a column',\n columnSettings: (name) => `${name} column settings`,\n computed: 'Computed from a relation (read-only)',\n openRow: 'Open row',\n}\n\n/** colId of the trailing \"add a column\" column (never a database column id). */\nexport const ADD_COLUMN_COL_ID = '__add_column'\n\n/** colId of the leading \"open the row\" column (never a database column id). */\nexport const OPEN_ROW_COL_ID = '__open_row'\n\nexport const COLUMN_TYPE_ICONS: Record<DatabaseColumnType, typeof Type> = {\n text: Type,\n number: Hash,\n date: CalendarDays,\n checkbox: CheckSquare,\n select: ChevronDown,\n person: UserRound,\n document: FileText,\n relation: ArrowUpRight,\n lookup: Search,\n rollup: Sigma,\n}\n\nexport interface DatabaseColumnOptions {\n /** No editing, no column settings, no add-column button (a database of another workspace). */\n readOnly?: boolean\n /** Open a column's settings (rename, options, delete). */\n onEditColumn?: (column: DatabaseColumnView) => void\n /** Add a column (the trailing \"+\" header). */\n onAddColumn?: () => void\n /** Open a row in full (a leading column of \"open\" buttons). */\n onOpenRow?: (row: DatabaseRowView) => void\n /** Choices for person, document and relation cells, and what a document chip opens. */\n sources?: DatabaseCellSources\n /** Locale for numbers and dates. */\n locale?: string\n labels?: Partial<DatabaseColumnLabels>\n}\n\nconst WIDTHS: Record<DatabaseColumnType, number> = {\n text: 220,\n number: 130,\n date: 140,\n checkbox: 110,\n select: 160,\n person: 180,\n document: 240,\n relation: 240,\n lookup: 200,\n rollup: 130,\n}\n\n/*\n * The headers are module-level components with their values as params (AG Grid passes them as\n * props), so a host re-render that rebuilds the columns re-renders a header in place instead of\n * remounting it: keyboard focus on its settings button survives (#2240's class of bug). The names\n * avoid the header params' own (`column` is AG Grid's column there).\n */\ninterface HeaderLabelParams {\n dbColumn: DatabaseColumnView\n onEdit?: () => void\n settingsLabel: string\n computedLabel: string\n}\n\nfunction HeaderLabel({\n dbColumn: column,\n onEdit,\n settingsLabel: label,\n computedLabel,\n}: HeaderLabelParams) {\n const Icon = COLUMN_TYPE_ICONS[column.type]\n return (\n <span className=\"group/dbh flex min-w-0 items-center gap-1.5\">\n <Icon className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n <span className=\"truncate text-[12.5px] font-medium\">{column.name}</span>\n {isComputedColumn(column) && (\n <span title={computedLabel} data-testid={`database-column-computed-${column.id}`}>\n <Lock className=\"size-3 shrink-0 text-muted-foreground/70\" aria-label={computedLabel} />\n </span>\n )}\n {onEdit && (\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n data-testid={`database-column-settings-${column.id}`}\n // The header sorts on click: keep the settings button's click to itself.\n onClick={(e) => {\n e.stopPropagation()\n onEdit()\n }}\n onMouseDown={(e) => e.stopPropagation()}\n className=\"ml-auto rounded p-0.5 text-muted-foreground opacity-0 hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover/dbh:opacity-100\"\n >\n <MoreHorizontal className=\"size-3.5\" />\n </button>\n )}\n </span>\n )\n}\n\ninterface AddColumnHeaderParams {\n addLabel: string\n onAddColumn: () => void\n}\n\n/** The \"add a column\" column's header: its button. */\nfunction AddColumnHeader({ addLabel, onAddColumn }: AddColumnHeaderParams) {\n return (\n <button\n type=\"button\"\n aria-label={addLabel}\n title={addLabel}\n data-testid=\"database-add-column\"\n onClick={onAddColumn}\n className=\"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground\"\n >\n <Plus className=\"size-4\" />\n </button>\n )\n}\n\n/** Wide enough for the type's values and for the header (icon, name, settings button). */\nexport function columnWidth(column: DatabaseColumnView): number {\n // A computed column's header also carries its read-only sign.\n const header = Math.round(column.name.length * 8) + 76 + (isComputedColumn(column) ? 16 : 0)\n return Math.min(320, Math.max(WIDTHS[column.type], header))\n}\n\n/** Whether a cell of this column can be edited here (given the sources the host supplied). */\nexport function canEditColumn(column: DatabaseColumnView, sources?: DatabaseCellSources): boolean {\n if (isComputedColumn(column) || column.locked) return false\n if (column.type === 'person') return Boolean(sources?.members)\n if (column.type === 'document') return Boolean(sources?.documents)\n if (column.type === 'relation') return Boolean(sources?.searchRows && column.relation)\n return true\n}\n\nfunction editorFor(\n column: DatabaseColumnView,\n sources?: DatabaseCellSources\n): Pick<ColDef, 'cellEditor' | 'cellEditorParams' | 'cellEditorPopup'> {\n const pick = (params: PickCellEditorParams) => ({\n cellEditor: PickCellEditor,\n cellEditorPopup: true,\n cellEditorParams: params,\n })\n switch (column.type) {\n case 'number':\n return { cellEditor: 'agNumberCellEditor', cellEditorParams: { showStepperButtons: false } }\n case 'date':\n return { cellEditor: 'agDateStringCellEditor' }\n case 'checkbox':\n return { cellEditor: 'agCheckboxCellEditor' }\n case 'select':\n // Options show as chips the moment the cell opens (AG Grid's own select needs a second click).\n return {\n cellEditor: SelectCellEditor,\n cellEditorPopup: true,\n cellEditorParams: { options: column.options ?? [] },\n }\n case 'person':\n return pick({ kind: 'person', options: sources?.members ?? [] })\n case 'document':\n return pick({ kind: 'document', options: sources?.documents ?? [] })\n case 'relation': {\n const target = column.relation?.database_id\n const searchRows = sources?.searchRows\n return pick({\n kind: 'relation',\n search: target && searchRows ? (q: string) => searchRows(target, q) : undefined,\n })\n }\n case 'lookup':\n case 'rollup':\n return {}\n default:\n return { cellEditor: 'agTextCellEditor' }\n }\n}\n\nfunction rendererFor(\n column: DatabaseColumnView,\n locale?: string,\n sources?: DatabaseCellSources\n): Partial<ColDef<DatabaseRowView>> {\n switch (column.type) {\n case 'checkbox':\n return {\n cellRenderer: 'agCheckboxCellRenderer',\n cellClass: 'flex items-center justify-center',\n }\n case 'select':\n return {\n cellRenderer: (p: ICellRendererParams<DatabaseRowView>): ReactNode =>\n typeof p.value === 'string' && p.value ? <SelectChip value={p.value} /> : null,\n }\n case 'number':\n return {\n cellClass: 'cell-numeric',\n valueFormatter: (p: ValueFormatterParams<DatabaseRowView>) =>\n formatCell(p.value, 'number', locale),\n }\n case 'rollup':\n return {\n cellClass: 'cell-numeric text-muted-foreground',\n valueFormatter: (p: ValueFormatterParams<DatabaseRowView>) =>\n formatCell(p.value, 'rollup', locale),\n }\n case 'date':\n return {\n valueFormatter: (p: ValueFormatterParams<DatabaseRowView>) =>\n formatCell(p.value, 'date', locale),\n }\n case 'person':\n return {\n cellRenderer: (p: ICellRendererParams<DatabaseRowView>): ReactNode => (\n <PersonCell value={p.value} titles={p.data?.titles} />\n ),\n }\n case 'document':\n case 'relation':\n return {\n cellRenderer: (p: ICellRendererParams<DatabaseRowView>): ReactNode => (\n <LinkChipsCell\n value={p.value}\n titles={p.data?.titles}\n kind={column.type === 'document' ? 'document' : 'relation'}\n onOpenDocument={sources?.onOpenDocument}\n />\n ),\n }\n case 'lookup':\n return {\n cellRenderer: (p: ICellRendererParams<DatabaseRowView>): ReactNode => (\n <LookupCell value={p.value} titles={p.data?.titles} locale={locale} />\n ),\n }\n default:\n return {}\n }\n}\n\n/** One grid column per database column, then the \"add a column\" column (unless read-only). */\nexport function createDatabaseColumns(\n columns: DatabaseColumnView[],\n options: DatabaseColumnOptions = {}\n): ColDef<DatabaseRowView>[] {\n const { readOnly, onEditColumn, onAddColumn, onOpenRow, locale, sources } = options\n const l = { ...DEFAULT_DATABASE_COLUMN_LABELS, ...options.labels }\n const openRow: ColDef<DatabaseRowView>[] =\n onOpenRow && columns.length > 0\n ? [\n {\n colId: OPEN_ROW_COL_ID,\n headerName: '',\n width: 40,\n minWidth: 40,\n maxWidth: 40,\n resizable: false,\n sortable: false,\n editable: false,\n suppressMovable: true,\n // Pinned: the button stays in view however far the table scrolls.\n pinned: 'left',\n lockPinned: true,\n lockPosition: 'left',\n cellClass: 'flex items-center justify-center !px-0',\n valueGetter: () => null,\n cellRenderer: (p: ICellRendererParams<DatabaseRowView>): ReactNode =>\n p.data ? (\n <button\n type=\"button\"\n aria-label={l.openRow}\n title={l.openRow}\n data-testid={`database-open-row-${p.data.id}`}\n onClick={(e) => {\n e.stopPropagation()\n if (p.data) onOpenRow(p.data)\n }}\n onDoubleClick={(e) => e.stopPropagation()}\n className=\"flex size-6 items-center justify-center rounded text-muted-foreground/70 hover:bg-muted hover:text-foreground\"\n >\n <Maximize2 className=\"size-3.5\" />\n </button>\n ) : null,\n },\n ]\n : []\n const defs: ColDef<DatabaseRowView>[] = columns.map((column) => ({\n colId: column.id,\n headerName: column.name,\n width: columnWidth(column),\n minWidth: 90,\n resizable: true,\n sortable: true,\n editable: !readOnly && canEditColumn(column, sources),\n // The grid's own type inference must not second-guess the database's column type.\n cellDataType: false,\n headerComponentParams: {\n innerHeaderComponent: HeaderLabel,\n innerHeaderComponentParams: {\n dbColumn: column,\n settingsLabel: l.columnSettings(column.name),\n computedLabel: l.computed,\n onEdit: !readOnly && onEditColumn ? () => onEditColumn(column) : undefined,\n } satisfies HeaderLabelParams,\n },\n // An empty checkbox reads as unticked (not indeterminate).\n valueGetter: (p: ValueGetterParams<DatabaseRowView>) =>\n column.type === 'checkbox'\n ? p.data?.values[column.id] === true\n : (p.data?.values[column.id] ?? null),\n // Edits land in the row's values as the API would store them; the host saves them in\n // onCellValueChanged and puts the server's normalised row back.\n valueSetter: (p: ValueSetterParams<DatabaseRowView>) => {\n if (!p.data) return false\n const next = toApiValue(p.newValue, column.type)\n if (sameCellValue(next, p.oldValue)) return false\n p.data.values = { ...p.data.values, [column.id]: next }\n return true\n },\n comparator: (a: unknown, b: unknown, nodeA, nodeB) =>\n compareCells(a, b, column.type, nodeA?.data?.titles, nodeB?.data?.titles),\n getQuickFilterText: (p) => formatCell(p.value, column.type, locale, p.data?.titles),\n ...editorFor(column, sources),\n ...rendererFor(column, locale, sources),\n }))\n defs.unshift(...openRow)\n if (!readOnly && onAddColumn) {\n defs.push({\n colId: ADD_COLUMN_COL_ID,\n width: 52,\n minWidth: 52,\n maxWidth: 52,\n resizable: false,\n sortable: false,\n editable: false,\n suppressMovable: true,\n // Pinned: on a wide table the add button stays in view instead of scrolling off the right.\n pinned: 'right',\n lockPinned: true,\n headerComponent: AddColumnHeader,\n headerComponentParams: { addLabel: l.addColumn, onAddColumn } satisfies AddColumnHeaderParams,\n valueGetter: () => null,\n })\n }\n return defs\n}\n","/**\n * DatabaseTable: a database's rows in an editable grid, Notion/Airtable style. Cells edit in place\n * (double-click or Enter; a checkbox toggles with one click), the header of each column opens its\n * settings, the trailing \"+\" header adds a column and the footer adds a row. Ticked rows are\n * reported for a bulk delete. Pure: the host owns the data and saves each edit.\n */\nimport { useEffect, useMemo, useRef } from 'react'\nimport type { CellValueChangedEvent, GridApi } from 'ag-grid-community'\nimport { Plus, Table2 } from 'lucide-react'\nimport { Button } from '@arbidocs/react/ui'\nimport { GridView, type GridViewProps } from '../files/GridView'\nimport { testIdOr } from '../chat/test-id'\nimport {\n DEFAULT_DATABASE_COLUMN_LABELS,\n createDatabaseColumns,\n type DatabaseColumnLabels,\n} from './databaseColumns'\nimport type { DatabaseColumnView, DatabaseRowView } from './column-types'\nimport type { DatabaseCellSources } from './linkCells'\n\nconst escapeHtml = (text: string): string =>\n text.replace(/[&<>\"']/g, (ch) => `&#${ch.charCodeAt(0)};`)\n\nexport interface DatabaseTableLabels {\n newRow: string\n emptyTitle: string\n emptyMessage: string\n noColumnsTitle: string\n noColumnsMessage: string\n noMatches: string\n}\n\nexport const DEFAULT_DATABASE_TABLE_LABELS: DatabaseTableLabels = {\n newRow: 'New row',\n emptyTitle: 'No rows yet',\n emptyMessage: 'Add a row, or import a spreadsheet.',\n noColumnsTitle: 'No columns yet',\n noColumnsMessage: 'Add a column to start.',\n noMatches: 'No rows match your search or filters.',\n}\n\nexport interface DatabaseTableProps {\n columns: DatabaseColumnView[]\n rows: DatabaseRowView[]\n /** An edited cell: the value is already in the API's form (`null` empties the cell). */\n onCellChange?: (row: DatabaseRowView, columnId: string, value: unknown) => void\n onAddRow?: () => void\n onAddColumn?: () => void\n onEditColumn?: (column: DatabaseColumnView) => void\n /** Open a row in full (its detail): a leading column of \"open\" buttons. */\n onOpenRow?: (row: DatabaseRowView) => void\n /**\n * Choices for person, document and relation cells (workspace members, documents, a search of\n * the related database's rows) and what a document chip opens. Keep it stable (memoise it): the\n * columns are rebuilt when it changes.\n */\n sources?: DatabaseCellSources\n /** Ticked rows (for a bulk delete). With it, rows show a checkbox. */\n onSelectionChange?: (rows: DatabaseRowView[]) => void\n selected?: DatabaseRowView[]\n /** Read-only: a database of another (public) workspace. */\n readOnly?: boolean\n /** Rows are filtered by a search: an empty result says so instead of \"no rows yet\". */\n isFiltered?: boolean\n isLoading?: boolean\n locale?: string\n /** Saved column state key (AG Grid persists by it): one per database. */\n gridId?: string\n height?: GridViewProps<DatabaseRowView>['height']\n labels?: Partial<DatabaseTableLabels>\n columnLabels?: Partial<DatabaseColumnLabels>\n gridProps?: Partial<Omit<GridViewProps<DatabaseRowView>, 'items' | 'columnDefs' | 'getItemId'>>\n testId?: string\n}\n\nexport function DatabaseTable({\n columns,\n rows,\n onCellChange,\n onAddRow,\n onAddColumn,\n onEditColumn,\n onOpenRow,\n sources,\n onSelectionChange,\n selected,\n readOnly = false,\n isFiltered = false,\n isLoading,\n locale,\n gridId,\n height = '100%',\n labels,\n columnLabels,\n gridProps,\n testId,\n}: DatabaseTableProps) {\n const l = { ...DEFAULT_DATABASE_TABLE_LABELS, ...labels }\n // A host often hands new callbacks on each render (ConnectedDatabasesPage does). The columns take\n // stable ones that call the latest, so they are rebuilt only when what they show changes: a\n // rebuild makes AG Grid recreate each header's label, and keyboard focus on a header button\n // would fall to the page on every host render.\n const latest = useRef({ onEditColumn, onAddColumn, onOpenRow })\n latest.current = { onEditColumn, onAddColumn, onOpenRow }\n const hasEditColumn = !!onEditColumn\n const hasAddColumn = !!onAddColumn\n const hasOpenRow = !!onOpenRow\n const editColumn = useMemo(\n () =>\n hasEditColumn\n ? (column: DatabaseColumnView) => latest.current.onEditColumn?.(column)\n : undefined,\n [hasEditColumn]\n )\n const addColumn = useMemo(\n () => (hasAddColumn ? () => latest.current.onAddColumn?.() : undefined),\n [hasAddColumn]\n )\n const openRow = useMemo(\n () => (hasOpenRow ? (row: DatabaseRowView) => latest.current.onOpenRow?.(row) : undefined),\n [hasOpenRow]\n )\n // A refetch hands equal columns and sources as new objects. Rebuilding the column definitions\n // for them makes AG Grid recreate its columns, which ends an edit in progress (an open picker\n // closes under the click), so they are rebuilt only when their content changes.\n const latestSources = useRef(sources)\n latestSources.current = sources\n const hasSources = !!sources\n const hasSearchRows = !!sources?.searchRows\n const hasOpenDocument = !!sources?.onOpenDocument\n const contentKey = JSON.stringify([columns, sources?.members, sources?.documents])\n const columnDefs = useMemo(\n () =>\n createDatabaseColumns(columns, {\n readOnly,\n onEditColumn: editColumn,\n onAddColumn: addColumn,\n onOpenRow: openRow,\n sources: sources && {\n members: sources.members,\n documents: sources.documents,\n searchRows: hasSearchRows\n ? (databaseId, q) => latestSources.current!.searchRows!(databaseId, q)\n : undefined,\n onOpenDocument: hasOpenDocument\n ? (documentId) => latestSources.current?.onOpenDocument?.(documentId)\n : undefined,\n },\n locale,\n labels: columnLabels,\n }),\n // `columns` and `sources` are read through `contentKey` (and the latest callbacks).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n contentKey,\n hasSources,\n hasSearchRows,\n hasOpenDocument,\n readOnly,\n editColumn,\n addColumn,\n openRow,\n locale,\n columnLabels,\n ]\n )\n\n // No columns: a full empty state (there is no header to add one from). Columns but no rows: the\n // grid stays, header and all, with a no-rows overlay, so columns can still be added and resized.\n const noColumns = columns.length === 0\n const emptyState = {\n icon: <Table2 className=\"size-8 text-muted-foreground\" />,\n title: l.noColumnsTitle,\n message: readOnly ? undefined : l.noColumnsMessage,\n action:\n !readOnly && onAddColumn ? (\n <Button onClick={onAddColumn} data-testid=\"database-empty-add-column\" className=\"gap-1.5\">\n <Plus className=\"size-4\" />\n {columnLabels?.addColumn ?? DEFAULT_DATABASE_COLUMN_LABELS.addColumn}\n </Button>\n ) : undefined,\n }\n const noRowsText = isFiltered\n ? l.noMatches\n : readOnly\n ? l.emptyTitle\n : `${l.emptyTitle}. ${l.emptyMessage}`\n\n // A column just added lands at the right edge, often past the viewport: bring it into view.\n const api = useRef<GridApi<DatabaseRowView> | null>(null)\n const knownColumns = useRef<Set<string> | null>(null)\n useEffect(() => {\n const ids = new Set(columns.map((c) => c.id))\n const added = knownColumns.current\n ? columns.filter((c) => !knownColumns.current!.has(c.id))\n : []\n knownColumns.current = ids\n const last = added[added.length - 1]\n if (last && api.current) {\n const grid = api.current\n // After the grid has applied the new column definitions.\n setTimeout(() => grid.ensureColumnVisible(last.id, 'end'), 0)\n }\n }, [columns])\n\n const handleCellValueChanged = (event: CellValueChangedEvent<DatabaseRowView>) => {\n const columnId = event.column.getColId()\n if (!event.data || !onCellChange) return\n onCellChange(event.data, columnId, event.data.values[columnId] ?? null)\n }\n\n return (\n <div\n className=\"flex h-full min-h-0 flex-col\"\n data-testid={testIdOr(testId, { testId: 'database-table' })}\n >\n <div className=\"min-h-0 flex-1\">\n <GridView<DatabaseRowView>\n testId=\"database-grid\"\n items={rows}\n columnDefs={columnDefs}\n getItemId={(row) => row.id}\n getRowTestId={(row) => `database-row-${row.id}`}\n getCellTestId={(colId, row) => `database-cell-${row.id}-${colId}`}\n isLoading={isLoading}\n emptyState={emptyState}\n showEmpty={noColumns}\n gridId={gridId}\n height={height}\n rowHeight={38}\n selection={\n onSelectionChange\n ? { mode: 'multiple', selected: selected ?? [], onSelectionChange, controlled: true }\n : undefined\n }\n onCellValueChanged={handleCellValueChanged}\n {...gridProps}\n onGridReady={(params) => {\n api.current = params.api\n gridProps?.onGridReady?.(params)\n }}\n gridOptions={{\n overlayNoRowsTemplate: `<span class=\"text-sm text-muted-foreground\">${escapeHtml(noRowsText)}</span>`,\n singleClickEdit: false,\n stopEditingWhenCellsLoseFocus: true,\n enterNavigatesVerticallyAfterEdit: true,\n undoRedoCellEditing: false,\n ...gridProps?.gridOptions,\n }}\n />\n </div>\n {!readOnly && onAddRow && columns.length > 0 && (\n <div className=\"border-t border-border px-2 py-1\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={onAddRow}\n data-testid=\"database-add-row\"\n className=\"gap-1.5 text-muted-foreground\"\n >\n <Plus className=\"size-4\" />\n {l.newRow}\n </Button>\n </div>\n )}\n </div>\n )\n}\n"]}
|
|
@@ -7,11 +7,12 @@ var ENTITY_ID = new RegExp(`^${ENTITY_ID_SOURCE}$`);
|
|
|
7
7
|
function entityIdFromPath(pathname) {
|
|
8
8
|
const parts = pathname.split("/").filter(Boolean);
|
|
9
9
|
if (parts.length === 2 && parts[0].startsWith("wrk-") && ENTITY_ID.test(parts[0])) parts.shift();
|
|
10
|
+
if (parts.length === 2 && parts[1].startsWith(`${parts[0]}-`)) parts.shift();
|
|
10
11
|
return parts.length === 1 && ENTITY_ID.test(parts[0]) ? parts[0] : void 0;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
exports.ENTITY_ID = ENTITY_ID;
|
|
14
15
|
exports.ENTITY_ID_SOURCE = ENTITY_ID_SOURCE;
|
|
15
16
|
exports.entityIdFromPath = entityIdFromPath;
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-PIKTGP55.cjs.map
|
|
18
|
+
//# sourceMappingURL=chunk-PIKTGP55.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/entity-id.ts"],"names":[],"mappings":";;;AACO,IAAM,gBAAA,GACX;AACK,IAAM,SAAA,GAAY,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,gBAAgB,CAAA,CAAA,CAAG;AAGpD,SAAS,iBAAiB,QAAA,EAAsC;AACrE,EAAA,MAAM,QAAQ,QAAA,CAAS,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AAChD,EAAA,IAAI,MAAM,MAAA,KAAW,CAAA,IAAK,KAAA,CAAM,CAAC,EAAE,UAAA,CAAW,MAAM,CAAA,IAAK,SAAA,CAAU,KAAK,KAAA,CAAM,CAAC,CAAC,CAAA,QAAS,KAAA,EAAM;AAC/F,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,CAAA,IAAK,KAAA,CAAM,CAAC,CAAA,CAAE,UAAA,CAAW,CAAA,EAAG,KAAA,CAAM,CAAC,CAAC,CAAA,CAAA,CAAG,CAAA,QAAS,KAAA,EAAM;AAC3E,EAAA,OAAO,KAAA,CAAM,MAAA,KAAW,CAAA,IAAK,SAAA,CAAU,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,KAAA,CAAM,CAAC,CAAA,GAAI,MAAA;AACrE","file":"chunk-PIKTGP55.cjs","sourcesContent":["/** Exact external ids only: partial ids in streaming text must never cause lookups. */\nexport const ENTITY_ID_SOURCE =\n '(?:doc|eml|evt|call|con|wrk|prj|wfl|pag|dbs|viw|fct|tag|usr|agt|cht|cal)-[a-zA-Z0-9]{8}'\nexport const ENTITY_ID = new RegExp(`^${ENTITY_ID_SOURCE}$`)\n\n/** A direct resource reference, optionally qualified by a complete workspace id or its own type. */\nexport function entityIdFromPath(pathname: string): string | undefined {\n const parts = pathname.split('/').filter(Boolean)\n if (parts.length === 2 && parts[0].startsWith('wrk-') && ENTITY_ID.test(parts[0])) parts.shift()\n if (parts.length === 2 && parts[1].startsWith(`${parts[0]}-`)) parts.shift()\n return parts.length === 1 && ENTITY_ID.test(parts[0]) ? parts[0] : undefined\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkKKYNTWDU_cjs = require('./chunk-KKYNTWDU.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk5OD6DRG7_cjs = require('./chunk-5OD6DRG7.cjs');
|
|
6
6
|
var chunkPLIF5CUV_cjs = require('./chunk-PLIF5CUV.cjs');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var ui = require('@arbidocs/react/ui');
|
|
@@ -122,20 +122,20 @@ function resolveAuthReturn() {
|
|
|
122
122
|
}
|
|
123
123
|
if (url.origin !== window.location.origin) return null;
|
|
124
124
|
const { pathname, search, hash } = url;
|
|
125
|
-
const route =
|
|
125
|
+
const route = chunk5OD6DRG7_cjs.parseHref(`${pathname}${search}${hash}`);
|
|
126
126
|
switch (route?.kind) {
|
|
127
127
|
case "review-access":
|
|
128
128
|
return { type: "review_access", notificationId: route.notificationId };
|
|
129
129
|
case "notification":
|
|
130
130
|
return { type: "notification", notificationId: route.notificationId };
|
|
131
131
|
}
|
|
132
|
-
if (
|
|
132
|
+
if (chunk5OD6DRG7_cjs.isDeepLinkPath(pathname)) return { type: "path", path: `${pathname}${search}${hash}` };
|
|
133
133
|
switch (route?.kind) {
|
|
134
134
|
case "workspace":
|
|
135
135
|
case "conversation":
|
|
136
136
|
case "document":
|
|
137
137
|
case "action":
|
|
138
|
-
return { type: "path", path:
|
|
138
|
+
return { type: "path", path: chunk5OD6DRG7_cjs.hrefFor(route) };
|
|
139
139
|
// A secure-mail claim's key never rides in the saved address; a call keeps its invite and key.
|
|
140
140
|
case "secure-mail":
|
|
141
141
|
return { type: "path", path: pathname };
|
|
@@ -171,5 +171,5 @@ exports.preserveAuthReturnUrl = preserveAuthReturnUrl;
|
|
|
171
171
|
exports.resolveAuthReturn = resolveAuthReturn;
|
|
172
172
|
exports.signInRedirect = signInRedirect;
|
|
173
173
|
exports.takeAuthReturnUrl = takeAuthReturnUrl;
|
|
174
|
-
//# sourceMappingURL=chunk-
|
|
175
|
-
//# sourceMappingURL=chunk-
|
|
174
|
+
//# sourceMappingURL=chunk-QSY2VW7V.cjs.map
|
|
175
|
+
//# sourceMappingURL=chunk-QSY2VW7V.cjs.map
|