import * as react_jsx_runtime from 'react/jsx-runtime'; import * as React from 'react'; import { DataListViewType } from './lib/data-list-view.js'; import { OpenTablePropertiesHandle } from './lib/list-page-table-properties.js'; import { RowHeight } from './lib/row-height.js'; type TabPatch = Partial; type OnEditView = (tab: ViewTab, helpers: { updateTab: (patch: TabPatch) => void; }) => void; /** Same labels/icons as Properties drawer `SelectionTileGrid` — single source in `DATA_LIST_VIEW_TILES`. */ declare const VIEW_TYPES: { type: ViewType; label: string; icon: string; }[]; /** Count pill on the views toolbar — color by lifecycle/status filter (WCAG: dark text on light inactive; light text on solid active). */ declare function viewToolbarCountBadgeClass(filterId: string, isActive: boolean): string; declare function resolveSupportedViews(supportedViewTypes: readonly DataListViewType[] | undefined, fallback: readonly DataListViewType[]): readonly DataListViewType[]; declare function computeShownViews(tabs: ViewTab[], activeTabId: string, showViewsToolbar: boolean, visibleViewCount: number): { shownViews: ViewTab[]; hiddenViews: ViewTab[]; canShedViews: boolean; }; declare function resolveExportTotal(exportTotalRows: number | undefined, getTabCount: ((filterId: string) => number) | undefined, activeTab: ViewTab): number; /** True once `on` has been true — set during render, like the original inline latch. */ declare function useLatch(on: boolean): boolean; type StateInput = { defaultTabs: ViewTab[]; tabsProp?: ViewTab[]; onTabsChange?: (tabs: ViewTab[]) => void; activeTabIdProp?: string; onActiveTabChange?: (id: string) => void; persistKey?: string; showViewCountsProp?: boolean; onShowViewCountsChange?: (show: boolean) => void; showMetricsProp?: boolean; onShowMetricsChange?: (show: boolean) => void; defaultShowMetrics: boolean; }; /** * Internal tabs/active-tab state, optionally backed by `localStorage` when * `persistKey` is set AND the consumer is NOT in controlled mode. * `usePersistedState` accepts an empty key as "disabled, behave like useState", * so it is always called once (rules of hooks) and storage is toggled by the * key string. Hubs that move forward between versions of `defaultTabs` should * bump `persistKey`. */ declare function useListPageState(input: StateInput): { tabs: ViewTab[]; setTabsState: (action: React.SetStateAction) => void; activeTabId: string; setActiveTabId: (id: string) => void; showViewCounts: boolean; showMetrics: boolean; }; /** * Prices rung 1 for the views row, the same way `Tabs` does for a tablist. * Without this the row only knows how to trade *every* inactive label for its * icon at once, so a row a few pixels short read as a row of glyphs — and, * because the all-or-nothing rung records the width it failed at, it stayed * that way even after the row had room again. */ declare function useViewsRowFit(tabCount: number, enabled: boolean): { viewsViewportRef: React.RefObject; openViewLabels: number; visibleViewCount: number; }; declare function useTabActions(tabs: ViewTab[], activeTabId: string, setTabsState: (action: React.SetStateAction) => void, setActiveTabId: (id: string) => void): { addView: (type: ViewType) => void; removeTab: (id: string, e: React.MouseEvent | React.KeyboardEvent) => void; updateTab: (id: string, patch: TabPatch) => void; duplicateTab: (tab: ViewTab) => void; }; declare function useRenameAndReview(updateTab: (id: string, patch: TabPatch) => void): { renameOpen: boolean; setRenameOpen: React.Dispatch>; renameValue: string; setRenameValue: React.Dispatch>; openRename: (tab: ViewTab) => void; commitRename: () => void; reviewOpen: boolean; setReviewOpen: React.Dispatch>; reviewTab: ViewTab | null; openReview: (tab: ViewTab) => void; onReviewOpenChange: (open: boolean) => void; }; type TabActions = { addView: (type: ViewType) => void; removeTab: (id: string, e: React.MouseEvent | React.KeyboardEvent) => void; updateTab: (id: string, patch: TabPatch) => void; duplicateTab: (tab: ViewTab) => void; openRename: (tab: ViewTab) => void; openReview: (tab: ViewTab) => void; }; declare function ListPageShortcuts({ show, addableViewTypes, activeTab, tabCount, onEditView, actions, }: { show: boolean; addableViewTypes: { type: ViewType; }[]; activeTab: ViewTab | undefined; tabCount: number; onEditView: OnEditView | undefined; actions: TabActions; }): react_jsx_runtime.JSX.Element | null; declare function ViewsToolbar({ viewsViewportRef, canShedViews, visibleViewCount, openViewLabels, shownViews, hiddenViews, tabCount, activeTabId, setActiveTabId, getTabCount, showViewCounts, onEditView, actions, addableViewTypes, onRequestCreateView, }: { viewsViewportRef: React.RefObject; canShedViews: boolean; visibleViewCount: number; openViewLabels: number; shownViews: ViewTab[]; hiddenViews: ViewTab[]; tabCount: number; activeTabId: string; setActiveTabId: (id: string) => void; getTabCount: ((filterId: string) => number) | undefined; showViewCounts: boolean; onEditView: OnEditView | undefined; actions: TabActions; addableViewTypes: { type: ViewType; label: string; icon: string; }[]; onRequestCreateView: ((type: ViewType) => void) | undefined; }): react_jsx_runtime.JSX.Element; declare function RenameViewDialog({ open, onOpenChange, value, onValueChange, onCommit, }: { open: boolean; onOpenChange: (open: boolean) => void; value: string; onValueChange: (value: string) => void; onCommit: () => void; }): react_jsx_runtime.JSX.Element; declare function ReviewViewDialog({ open, reviewTab, onOpenChange, onClose, getTabCount, }: { open: boolean; reviewTab: ViewTab | null; onOpenChange: (open: boolean) => void; onClose: () => void; getTabCount: ((filterId: string) => number) | undefined; }): react_jsx_runtime.JSX.Element; type ViewType = DataListViewType; interface FilterOption { id: string; label: string; } interface ViewTab { id: string; label: string; viewType: ViewType; icon: string; /** Optional filter key for lifecycle or category-based filtering */ filterId: string; /** * Per-view row density preference captured at creation time (or later via * Properties). Consumers that render tables/boards can read this to set the * initial `rowHeight` for that specific view tab. */ rowHeight?: RowHeight; } interface ListPageTemplateProps { /** Page header — rendered above metrics */ header: React.ReactNode; /** Optional metrics strip — rendered below header */ metrics?: React.ReactNode; /** * Default visibility for the metrics strip when not controlled. * Persisted under `:listpage:show-metrics:v1` when `persistKey` is set. * @default true */ defaultShowMetrics?: boolean; /** Whether to show metrics (controlled externally) */ showMetrics?: boolean; /** Called when metrics visibility changes (controlled mode) */ onShowMetricsChange?: (show: boolean) => void; /** Initial tabs (uncontrolled mode) */ defaultTabs: ViewTab[]; /** * Controlled tabs — when all four are provided, tab state is owned by the parent * (e.g. for localStorage). Otherwise `defaultTabs` + internal state are used. */ tabs?: ViewTab[]; onTabsChange?: (tabs: ViewTab[]) => void; activeTabId?: string; onActiveTabChange?: (id: string) => void; /** Filter options per tab (e.g. All, Upcoming, Ongoing, Completed) */ filterOptions?: FilterOption[]; /** Label for the filter sub-menu (default: "Filter") */ filterLabel?: string; /** Get count for a tab's filter (for badge) */ getTabCount?: (filterId: string) => number; /** Render the content for the active tab */ renderContent: (tab: ViewTab, updateTab: (patch: Partial) => void) => React.ReactNode; /** Export drawer props */ exportOpen?: boolean; onExportOpenChange?: (open: boolean) => void; /** Row count for export; if omitted, uses `getTabCount(activeTab.filterId)` when provided */ exportTotalRows?: number; /** * Tab menu — “Edit” (e.g. open table properties). Parent can switch to table view first, then call ref. * Overrides `tablePropertiesRef` when both are set. */ onEditView?: (tab: ViewTab, helpers: { updateTab: (patch: Partial) => void; }) => void; /** * Ref to the active tab’s table surface (`openPropertiesDrawer`). Wires “View → Edit” to * `TablePropertiesDrawer` when `onEditView` is omitted. */ tablePropertiesRef?: React.RefObject; /** When true, hide the views tab strip (tabs + add view) — e.g. search landing with a single table surface. */ hideViewsToolbar?: boolean; /** * Subset of view types the hub actually implements (e.g. List hub omits Dashboard/Folder). * When set, the Add view menu and ⌘1–9 shortcuts are filtered so users cannot add a view the * hub cannot render. When omitted, defaults to {@link TABLE_ONLY_HUB_SUPPORTED_VIEWS} * (table only). Pass {@link FULL_HUB_SUPPORTED_VIEWS} when the product asks for Add view parity. * (table, list, board, dashboard). Pass an explicit allowlist for specialized hubs * (e.g. tokens table-only, library with folder/calendar). * * Pair with `TablePropertiesDrawerButton.supportedViewTypes` to keep Properties consistent. */ supportedViewTypes?: readonly DataListViewType[]; /** * **Opt-in localStorage persistence** for the page-level state: the * user's view tabs (their labels, view types, icons, filterIds) and the * currently active tab. When set, returning to the hub restores the * tab arrangement. * * Storage keys: `exxat-ds::listpage:tabs:v1` and * `exxat-ds::listpage:active-tab:v1`. **Use the same key * across renders** of the same hub or persistence will reset. * * When `tabs` / `activeTabId` are also passed in controlled mode, the * controlled props win — `persistKey` is ignored. Most hubs SHOULD pick * one or the other. * * @see `apps/web/docs/persisted-state-pattern.md` * @see `.cursor/rules/exxat-persisted-state.mdc` */ persistKey?: string; /** * Whether count badges should be shown in the view tab bar. * This is a **hub-level** preference (affects all tabs). * When `persistKey` is provided and the prop is not controlled, the value * is persisted under `:listpage:show-view-counts:v1`. */ showViewCounts?: boolean; onShowViewCountsChange?: (show: boolean) => void; /** * Called when the user selects a view type from the "Add view" picker. * The parent (HubTable / LibraryTable) is expected to open * `TablePropertiesDrawer` in creation mode (`isCreatingNewView`) for that type, * allowing the user to set name + relevant initial view settings before the * tab is actually created. */ onRequestCreateView?: (type: ViewType) => void; } declare function ListPageTemplate({ header, metrics, defaultShowMetrics, showMetrics: showMetricsProp, onShowMetricsChange, defaultTabs, tabs: tabsProp, onTabsChange, activeTabId: activeTabIdProp, onActiveTabChange, getTabCount, renderContent, exportOpen, onExportOpenChange, exportTotalRows, onEditView, tablePropertiesRef, hideViewsToolbar, supportedViewTypes, persistKey, showViewCounts: showViewCountsProp, onShowViewCountsChange, onRequestCreateView, }: ListPageTemplateProps): react_jsx_runtime.JSX.Element; export { type FilterOption as F, ListPageTemplate as L, RenameViewDialog as R, type TabActions as T, VIEW_TYPES as V, type ListPageTemplateProps as a, type ViewTab as b, type ViewType as c, ListPageShortcuts as d, ReviewViewDialog as e, ViewsToolbar as f, computeShownViews as g, resolveSupportedViews as h, useListPageState as i, useRenameAndReview as j, useTabActions as k, useViewsRowFit as l, resolveExportTotal as r, useLatch as u, viewToolbarCountBadgeClass as v };