@flytedan/flytebot-design-system 0.12.10 → 0.12.12
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/index.cjs +244 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -9
- package/dist/index.d.ts +57 -9
- package/dist/index.js +240 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +322 -40
- package/styles/tokens.css +22 -6
package/dist/index.d.cts
CHANGED
|
@@ -1939,18 +1939,18 @@ interface FilePickButtonProps extends Omit<DropzoneProps, "children" | "label" |
|
|
|
1939
1939
|
}
|
|
1940
1940
|
/** A file input behind any trigger. Resets between picks so re-picking the same file fires. */
|
|
1941
1941
|
declare function FilePickButton({ onFiles, onReject, accept, maxFileSize, multiple, disabled, label, icon, className, children, }: FilePickButtonProps): React.JSX.Element;
|
|
1942
|
-
type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<
|
|
1943
|
-
url: string;
|
|
1944
|
-
thumb?: {
|
|
1945
|
-
url: string;
|
|
1946
|
-
};
|
|
1947
|
-
} | void>;
|
|
1942
|
+
type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<Partial<Attachment> | void>;
|
|
1948
1943
|
/**
|
|
1949
1944
|
* Upload orchestration for a staged set of files: progress per file, per-file
|
|
1950
1945
|
* errors, retry, and cancel — the same behaviour an upload field has.
|
|
1951
1946
|
*
|
|
1952
|
-
* `upload(file, onProgress, signal)` must resolve to `
|
|
1953
|
-
*
|
|
1947
|
+
* `upload(file, onProgress, signal)` must resolve to `Partial<Attachment>` (at
|
|
1948
|
+
* least the server-assigned `id`, typically `url` and `thumb` too) or throw.
|
|
1949
|
+
* When the result carries an `id`, it REPLACES the local staged id — the id a
|
|
1950
|
+
* host sends onward (`ChatComposer.onSubmit`) is therefore always the id the
|
|
1951
|
+
* server gave the file, never the client-local placeholder `toAttachment`
|
|
1952
|
+
* minted. Nothing here knows what a chat is; it is the app's upload handler
|
|
1953
|
+
* that does.
|
|
1954
1954
|
*/
|
|
1955
1955
|
declare function useStagedFiles(upload?: FileUploadHandler, opts?: {
|
|
1956
1956
|
onUploaded?: (a: Attachment) => void;
|
|
@@ -3370,6 +3370,54 @@ declare const TranscriptKit: {
|
|
|
3370
3370
|
groupMessages: typeof groupMessages;
|
|
3371
3371
|
};
|
|
3372
3372
|
|
|
3373
|
+
/** Kept modest on purpose: this is a PREVIEW, not a document viewer. A file past this
|
|
3374
|
+
* many characters still opens — it just shows its first slice, same as CodeBlock's own
|
|
3375
|
+
* line fold for a long file. */
|
|
3376
|
+
declare const FILE_VIEWER_TEXT_LIMIT = 500000;
|
|
3377
|
+
/** CSV/TSV render as a real table, which means real DOM rows — bounded for the same
|
|
3378
|
+
* reason a virtualized list is, just simpler: this is a preview, and a spreadsheet with
|
|
3379
|
+
* 50,000 rows is what the "download" action is for. */
|
|
3380
|
+
declare const FILE_VIEWER_CSV_ROW_LIMIT = 500;
|
|
3381
|
+
/**
|
|
3382
|
+
* A minimal, dependency-free delimited-text reader: quoted fields, `""` as an escaped
|
|
3383
|
+
* quote inside one, and either line ending. Not a full RFC 4180 implementation — good
|
|
3384
|
+
* enough for a bounded preview table, which is all this ever renders.
|
|
3385
|
+
*/
|
|
3386
|
+
declare function parseDelimited(text: string, delimiter: string): string[][];
|
|
3387
|
+
interface FileViewerProps {
|
|
3388
|
+
file: Attachment;
|
|
3389
|
+
/**
|
|
3390
|
+
* Mints a short-lived URL for THIS file on demand — called once for the inline
|
|
3391
|
+
* preview and again, separately, for a download. The component never reads
|
|
3392
|
+
* `file.url` itself: production URLs are signed and expire in minutes, so the
|
|
3393
|
+
* only correct URL is one just resolved for the disposition in hand.
|
|
3394
|
+
*/
|
|
3395
|
+
resolveUrl: (disposition: "inline" | "attachment") => Promise<string>;
|
|
3396
|
+
/**
|
|
3397
|
+
* A companion panel — notes, metadata, associations, whatever the host wants
|
|
3398
|
+
* beside the file. Generic on purpose: FileViewer has no idea what a "note" or
|
|
3399
|
+
* a "campaign" is. Beside the preview when there's room, a tab next to Preview
|
|
3400
|
+
* when there isn't. Omit it and there is no side panel and no tab bar at all.
|
|
3401
|
+
*/
|
|
3402
|
+
sidePanel?: React.ReactNode;
|
|
3403
|
+
/** Tab label / region name for `sidePanel`. Default "Details". */
|
|
3404
|
+
sidePanelLabel?: string;
|
|
3405
|
+
onClose?: () => void;
|
|
3406
|
+
/** Extra controls beside the built-in Download action, e.g. a host's "Save to campaign". */
|
|
3407
|
+
actions?: React.ReactNode;
|
|
3408
|
+
className?: string;
|
|
3409
|
+
}
|
|
3410
|
+
/**
|
|
3411
|
+
* A file preview with an optional companion side panel: image, PDF, text/markdown/JSON,
|
|
3412
|
+
* a bounded CSV/TSV table, or an honest "no preview" fallback with the file's own
|
|
3413
|
+
* metadata — plus download, close and a host action slot. Fully responsive: side by side
|
|
3414
|
+
* with `sidePanel` while there's room, a tab next to Preview below a narrow width of its
|
|
3415
|
+
* OWN container (a `@container` query, not the viewport — see the stylesheet), with
|
|
3416
|
+
* exactly one scroll region per pane either way. Renders inside the kit's `Modal` or
|
|
3417
|
+
* `Drawer`, or inline in a page — it has no opinion on how it got on screen.
|
|
3418
|
+
*/
|
|
3419
|
+
declare function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel, onClose, actions, className }: FileViewerProps): React.JSX.Element;
|
|
3420
|
+
|
|
3373
3421
|
interface TableQuery {
|
|
3374
3422
|
/** 1-indexed. */
|
|
3375
3423
|
page: number;
|
|
@@ -3642,4 +3690,4 @@ interface VersionStore<TState, TDiff = unknown> {
|
|
|
3642
3690
|
}
|
|
3643
3691
|
declare function createVersionStore<TState, TDiff = unknown>(initialState: TState, options?: CreateVersionStoreOptions<TState, TDiff>): VersionStore<TState, TDiff>;
|
|
3644
3692
|
|
|
3645
|
-
export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
|
|
3693
|
+
export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
|
package/dist/index.d.ts
CHANGED
|
@@ -1939,18 +1939,18 @@ interface FilePickButtonProps extends Omit<DropzoneProps, "children" | "label" |
|
|
|
1939
1939
|
}
|
|
1940
1940
|
/** A file input behind any trigger. Resets between picks so re-picking the same file fires. */
|
|
1941
1941
|
declare function FilePickButton({ onFiles, onReject, accept, maxFileSize, multiple, disabled, label, icon, className, children, }: FilePickButtonProps): React.JSX.Element;
|
|
1942
|
-
type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<
|
|
1943
|
-
url: string;
|
|
1944
|
-
thumb?: {
|
|
1945
|
-
url: string;
|
|
1946
|
-
};
|
|
1947
|
-
} | void>;
|
|
1942
|
+
type FileUploadHandler = (file: File, onProgress: (pct: number) => void, signal?: AbortSignal) => Promise<Partial<Attachment> | void>;
|
|
1948
1943
|
/**
|
|
1949
1944
|
* Upload orchestration for a staged set of files: progress per file, per-file
|
|
1950
1945
|
* errors, retry, and cancel — the same behaviour an upload field has.
|
|
1951
1946
|
*
|
|
1952
|
-
* `upload(file, onProgress, signal)` must resolve to `
|
|
1953
|
-
*
|
|
1947
|
+
* `upload(file, onProgress, signal)` must resolve to `Partial<Attachment>` (at
|
|
1948
|
+
* least the server-assigned `id`, typically `url` and `thumb` too) or throw.
|
|
1949
|
+
* When the result carries an `id`, it REPLACES the local staged id — the id a
|
|
1950
|
+
* host sends onward (`ChatComposer.onSubmit`) is therefore always the id the
|
|
1951
|
+
* server gave the file, never the client-local placeholder `toAttachment`
|
|
1952
|
+
* minted. Nothing here knows what a chat is; it is the app's upload handler
|
|
1953
|
+
* that does.
|
|
1954
1954
|
*/
|
|
1955
1955
|
declare function useStagedFiles(upload?: FileUploadHandler, opts?: {
|
|
1956
1956
|
onUploaded?: (a: Attachment) => void;
|
|
@@ -3370,6 +3370,54 @@ declare const TranscriptKit: {
|
|
|
3370
3370
|
groupMessages: typeof groupMessages;
|
|
3371
3371
|
};
|
|
3372
3372
|
|
|
3373
|
+
/** Kept modest on purpose: this is a PREVIEW, not a document viewer. A file past this
|
|
3374
|
+
* many characters still opens — it just shows its first slice, same as CodeBlock's own
|
|
3375
|
+
* line fold for a long file. */
|
|
3376
|
+
declare const FILE_VIEWER_TEXT_LIMIT = 500000;
|
|
3377
|
+
/** CSV/TSV render as a real table, which means real DOM rows — bounded for the same
|
|
3378
|
+
* reason a virtualized list is, just simpler: this is a preview, and a spreadsheet with
|
|
3379
|
+
* 50,000 rows is what the "download" action is for. */
|
|
3380
|
+
declare const FILE_VIEWER_CSV_ROW_LIMIT = 500;
|
|
3381
|
+
/**
|
|
3382
|
+
* A minimal, dependency-free delimited-text reader: quoted fields, `""` as an escaped
|
|
3383
|
+
* quote inside one, and either line ending. Not a full RFC 4180 implementation — good
|
|
3384
|
+
* enough for a bounded preview table, which is all this ever renders.
|
|
3385
|
+
*/
|
|
3386
|
+
declare function parseDelimited(text: string, delimiter: string): string[][];
|
|
3387
|
+
interface FileViewerProps {
|
|
3388
|
+
file: Attachment;
|
|
3389
|
+
/**
|
|
3390
|
+
* Mints a short-lived URL for THIS file on demand — called once for the inline
|
|
3391
|
+
* preview and again, separately, for a download. The component never reads
|
|
3392
|
+
* `file.url` itself: production URLs are signed and expire in minutes, so the
|
|
3393
|
+
* only correct URL is one just resolved for the disposition in hand.
|
|
3394
|
+
*/
|
|
3395
|
+
resolveUrl: (disposition: "inline" | "attachment") => Promise<string>;
|
|
3396
|
+
/**
|
|
3397
|
+
* A companion panel — notes, metadata, associations, whatever the host wants
|
|
3398
|
+
* beside the file. Generic on purpose: FileViewer has no idea what a "note" or
|
|
3399
|
+
* a "campaign" is. Beside the preview when there's room, a tab next to Preview
|
|
3400
|
+
* when there isn't. Omit it and there is no side panel and no tab bar at all.
|
|
3401
|
+
*/
|
|
3402
|
+
sidePanel?: React.ReactNode;
|
|
3403
|
+
/** Tab label / region name for `sidePanel`. Default "Details". */
|
|
3404
|
+
sidePanelLabel?: string;
|
|
3405
|
+
onClose?: () => void;
|
|
3406
|
+
/** Extra controls beside the built-in Download action, e.g. a host's "Save to campaign". */
|
|
3407
|
+
actions?: React.ReactNode;
|
|
3408
|
+
className?: string;
|
|
3409
|
+
}
|
|
3410
|
+
/**
|
|
3411
|
+
* A file preview with an optional companion side panel: image, PDF, text/markdown/JSON,
|
|
3412
|
+
* a bounded CSV/TSV table, or an honest "no preview" fallback with the file's own
|
|
3413
|
+
* metadata — plus download, close and a host action slot. Fully responsive: side by side
|
|
3414
|
+
* with `sidePanel` while there's room, a tab next to Preview below a narrow width of its
|
|
3415
|
+
* OWN container (a `@container` query, not the viewport — see the stylesheet), with
|
|
3416
|
+
* exactly one scroll region per pane either way. Renders inside the kit's `Modal` or
|
|
3417
|
+
* `Drawer`, or inline in a page — it has no opinion on how it got on screen.
|
|
3418
|
+
*/
|
|
3419
|
+
declare function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel, onClose, actions, className }: FileViewerProps): React.JSX.Element;
|
|
3420
|
+
|
|
3373
3421
|
interface TableQuery {
|
|
3374
3422
|
/** 1-indexed. */
|
|
3375
3423
|
page: number;
|
|
@@ -3642,4 +3690,4 @@ interface VersionStore<TState, TDiff = unknown> {
|
|
|
3642
3690
|
}
|
|
3643
3691
|
declare function createVersionStore<TState, TDiff = unknown>(initialState: TState, options?: CreateVersionStoreOptions<TState, TDiff>): VersionStore<TState, TDiff>;
|
|
3644
3692
|
|
|
3645
|
-
export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
|
|
3693
|
+
export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, ApiSpecBrowser, type ApiSpecBrowserProps, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DeviceSession, DiffBlock, type DiffBlockProps, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterField, type FilterFieldOption, type FilterFieldSelect, type FilterFieldText, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, Gate, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type JobStatus, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type Flag as SessionFlag, SessionKit, type SessionStats, SidebarNav, type SidebarNavItem, type SidebarNavProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, Textarea, type TextareaProps, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, type UsageLimit, UseFeatureStatus, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, channelWeightOf, computeNeedMore, computeVirtualWindow, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, isImage, isSystemMessage, jobBucket, languageLabel, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, revokeAttachment, toAttachment, tokenize, useChatEngine, useFeatureStatus, usePopoverPosition, useRuntimeMode, useServerTable, useStagedFiles, visibleMessages };
|
package/dist/index.js
CHANGED
|
@@ -2955,13 +2955,15 @@ function EntityRow({
|
|
|
2955
2955
|
onPointerDown,
|
|
2956
2956
|
className: ["fd-erow", tone === "danger" ? "fd-erow-danger" : "", className].filter(Boolean).join(" "),
|
|
2957
2957
|
style: {
|
|
2958
|
-
// display/alignItems/gap moved to the .fd-erow stylesheet rule
|
|
2959
|
-
// follow-
|
|
2960
|
-
// specificity or media/container query, which would have made
|
|
2961
|
-
// for the narrow-container rule below to ever switch this row
|
|
2962
|
-
// to a grid
|
|
2958
|
+
// display/alignItems/gap/padding moved to the .fd-erow stylesheet rule
|
|
2959
|
+
// (MP-114 follow-ups): an inline style always wins over a stylesheet rule
|
|
2960
|
+
// regardless of specificity or media/container query, which would have made
|
|
2961
|
+
// it impossible for the narrow-container rule below to ever switch this row
|
|
2962
|
+
// from a flex row to a grid — and padding specifically is also read back by
|
|
2963
|
+
// .fd-tlist-footer's own indent calc(), as --erow-pad-x, so it has to be a
|
|
2964
|
+
// real, readable stylesheet value rather than a number only this component
|
|
2965
|
+
// ever sees.
|
|
2963
2966
|
height: "100%",
|
|
2964
|
-
padding: "0 12px",
|
|
2965
2967
|
cursor: draggable ? "grab" : void 0,
|
|
2966
2968
|
// Own the gesture on touch too — without this, a touch-drag on a draggable row
|
|
2967
2969
|
// starts the page scrolling instead of (or as well as) the pointer drag.
|
|
@@ -2969,7 +2971,12 @@ function EntityRow({
|
|
|
2969
2971
|
...style
|
|
2970
2972
|
},
|
|
2971
2973
|
children: [
|
|
2972
|
-
draggable ?
|
|
2974
|
+
draggable ? (
|
|
2975
|
+
// font-size moved to the .fd-erow-grip stylesheet rule, same reason as the
|
|
2976
|
+
// row's own padding above: .fd-tlist-footer's indent reads it back as
|
|
2977
|
+
// --erow-grip-size.
|
|
2978
|
+
/* @__PURE__ */ jsx39("i", { className: "ph ph-dots-six-vertical fd-erow-grip", "aria-hidden": "true", style: { flex: "none", color: "var(--text-muted)" } })
|
|
2979
|
+
) : null,
|
|
2973
2980
|
/* @__PURE__ */ jsxs36("span", { className: "fd-erow-body", children: [
|
|
2974
2981
|
/* @__PURE__ */ jsxs36("span", { className: "fd-erow-titleline", children: [
|
|
2975
2982
|
titleIcon ? /* @__PURE__ */ jsx39(Tooltip, { label: titleIcon.tooltip, children: /* @__PURE__ */ jsxs36(
|
|
@@ -4461,7 +4468,7 @@ function useStagedFiles(upload, opts) {
|
|
|
4461
4468
|
patch(att.id, { progress: 0, error: void 0 });
|
|
4462
4469
|
Promise.resolve().then(() => upload(att.file, (p) => patch(att.id, { progress: Math.max(0, Math.min(99, p)) }), ac ? ac.signal : void 0)).then((res) => {
|
|
4463
4470
|
const r = res || {};
|
|
4464
|
-
patch(att.id, {
|
|
4471
|
+
patch(att.id, Object.assign({}, r, { id: r.id || att.id, progress: 100, error: void 0 }));
|
|
4465
4472
|
o.onUploaded && o.onUploaded(att);
|
|
4466
4473
|
}).catch((err) => {
|
|
4467
4474
|
if (ac && ac.signal.aborted) return;
|
|
@@ -9457,7 +9464,9 @@ function ChatComposer({
|
|
|
9457
9464
|
const submit = () => {
|
|
9458
9465
|
if (!canSend) return;
|
|
9459
9466
|
onSubmit(text.trim(), staged.items.map((f) => {
|
|
9460
|
-
const { file
|
|
9467
|
+
const { file, blobUrl, ...rest } = f;
|
|
9468
|
+
void file;
|
|
9469
|
+
void blobUrl;
|
|
9461
9470
|
return rest;
|
|
9462
9471
|
}));
|
|
9463
9472
|
change("");
|
|
@@ -10152,8 +10161,219 @@ function AgentChatPanel({
|
|
|
10152
10161
|
);
|
|
10153
10162
|
}
|
|
10154
10163
|
|
|
10155
|
-
// src/
|
|
10164
|
+
// src/components/files/FileViewer.tsx
|
|
10156
10165
|
import * as React47 from "react";
|
|
10166
|
+
import { jsx as jsx77, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
10167
|
+
function previewKindOf(file) {
|
|
10168
|
+
const mime = (file.mime || "").toLowerCase();
|
|
10169
|
+
const ext = extensionOf(file.name || "");
|
|
10170
|
+
if (isImage(mime, file.name)) return "image";
|
|
10171
|
+
if (mime === "application/pdf" || ext === "pdf") return "pdf";
|
|
10172
|
+
if (mime === "text/markdown" || ext === "md" || ext === "markdown") return "markdown";
|
|
10173
|
+
if (mime === "application/json" || ext === "json") return "json";
|
|
10174
|
+
if (mime === "text/csv" || mime === "text/tab-separated-values" || ext === "csv" || ext === "tsv") return "csv";
|
|
10175
|
+
if (mime.startsWith("text/") || ext === "txt" || ext === "log") return "text";
|
|
10176
|
+
return "none";
|
|
10177
|
+
}
|
|
10178
|
+
var FILE_VIEWER_TEXT_LIMIT = 5e5;
|
|
10179
|
+
var FILE_VIEWER_CSV_ROW_LIMIT = 500;
|
|
10180
|
+
function parseDelimited(text, delimiter) {
|
|
10181
|
+
const rows = [];
|
|
10182
|
+
let row = [];
|
|
10183
|
+
let field = "";
|
|
10184
|
+
let inQuotes = false;
|
|
10185
|
+
for (let i = 0; i < text.length; i++) {
|
|
10186
|
+
const c = text[i];
|
|
10187
|
+
if (inQuotes) {
|
|
10188
|
+
if (c === '"') {
|
|
10189
|
+
if (text[i + 1] === '"') {
|
|
10190
|
+
field += '"';
|
|
10191
|
+
i++;
|
|
10192
|
+
} else inQuotes = false;
|
|
10193
|
+
} else field += c;
|
|
10194
|
+
continue;
|
|
10195
|
+
}
|
|
10196
|
+
if (c === '"') {
|
|
10197
|
+
inQuotes = true;
|
|
10198
|
+
continue;
|
|
10199
|
+
}
|
|
10200
|
+
if (c === delimiter) {
|
|
10201
|
+
row.push(field);
|
|
10202
|
+
field = "";
|
|
10203
|
+
continue;
|
|
10204
|
+
}
|
|
10205
|
+
if (c === "\n") {
|
|
10206
|
+
row.push(field);
|
|
10207
|
+
rows.push(row);
|
|
10208
|
+
row = [];
|
|
10209
|
+
field = "";
|
|
10210
|
+
continue;
|
|
10211
|
+
}
|
|
10212
|
+
if (c === "\r") continue;
|
|
10213
|
+
field += c;
|
|
10214
|
+
}
|
|
10215
|
+
if (field.length || row.length) {
|
|
10216
|
+
row.push(field);
|
|
10217
|
+
rows.push(row);
|
|
10218
|
+
}
|
|
10219
|
+
return rows;
|
|
10220
|
+
}
|
|
10221
|
+
function usePreview(file, kind, resolveUrl) {
|
|
10222
|
+
const [state, setState] = React47.useState({ status: "loading" });
|
|
10223
|
+
const [attempt, setAttempt] = React47.useState(0);
|
|
10224
|
+
const resolveRef = React47.useRef(resolveUrl);
|
|
10225
|
+
React47.useEffect(() => {
|
|
10226
|
+
resolveRef.current = resolveUrl;
|
|
10227
|
+
}, [resolveUrl]);
|
|
10228
|
+
React47.useEffect(() => {
|
|
10229
|
+
if (kind === "none") {
|
|
10230
|
+
setState({ status: "ready" });
|
|
10231
|
+
return;
|
|
10232
|
+
}
|
|
10233
|
+
let dead = false;
|
|
10234
|
+
const ac = typeof AbortController !== "undefined" ? new AbortController() : void 0;
|
|
10235
|
+
setState({ status: "loading" });
|
|
10236
|
+
resolveRef.current("inline").then((url) => {
|
|
10237
|
+
if (dead) return void 0;
|
|
10238
|
+
if (kind === "image" || kind === "pdf") {
|
|
10239
|
+
setState({ status: "ready", url });
|
|
10240
|
+
return void 0;
|
|
10241
|
+
}
|
|
10242
|
+
return fetch(url, ac ? { signal: ac.signal } : void 0).then((res) => {
|
|
10243
|
+
if (!res.ok) throw new Error("The preview didn't load (" + res.status + ").");
|
|
10244
|
+
return res.text();
|
|
10245
|
+
}).then((body) => {
|
|
10246
|
+
if (dead) return;
|
|
10247
|
+
setState({ status: "ready", url, text: body.length > FILE_VIEWER_TEXT_LIMIT ? body.slice(0, FILE_VIEWER_TEXT_LIMIT) : body });
|
|
10248
|
+
});
|
|
10249
|
+
}).catch((err) => {
|
|
10250
|
+
if (dead || ac && ac.signal.aborted) return;
|
|
10251
|
+
setState({ status: "error", error: err && err.message || "The preview didn't load." });
|
|
10252
|
+
});
|
|
10253
|
+
return () => {
|
|
10254
|
+
dead = true;
|
|
10255
|
+
if (ac) ac.abort();
|
|
10256
|
+
};
|
|
10257
|
+
}, [file.id, kind, attempt]);
|
|
10258
|
+
return { ...state, retry: React47.useCallback(() => setAttempt((a) => a + 1), []) };
|
|
10259
|
+
}
|
|
10260
|
+
function PreviewBody({ file, kind, state }) {
|
|
10261
|
+
if (kind === "image") return /* @__PURE__ */ jsx77("img", { className: "fd-fv-image", src: state.url, alt: file.name || "Preview" });
|
|
10262
|
+
if (kind === "pdf") return /* @__PURE__ */ jsx77("iframe", { className: "fd-fv-pdf", src: state.url, title: file.name || "PDF preview" });
|
|
10263
|
+
if (kind === "markdown") return /* @__PURE__ */ jsx77(Markdown, { className: "fd-fv-markdown", source: state.text || "" });
|
|
10264
|
+
if (kind === "json") {
|
|
10265
|
+
let pretty = state.text || "";
|
|
10266
|
+
try {
|
|
10267
|
+
pretty = JSON.stringify(JSON.parse(pretty), null, 2);
|
|
10268
|
+
} catch {
|
|
10269
|
+
}
|
|
10270
|
+
return /* @__PURE__ */ jsx77(CodeBlock, { code: pretty, language: "json" });
|
|
10271
|
+
}
|
|
10272
|
+
if (kind === "csv") {
|
|
10273
|
+
const tsv = extensionOf(file.name || "") === "tsv" || (file.mime || "").toLowerCase().includes("tab-separated");
|
|
10274
|
+
const rows = parseDelimited(state.text || "", tsv ? " " : ",").filter((r) => r.length > 1 || r[0] !== "");
|
|
10275
|
+
const head = rows[0] || [];
|
|
10276
|
+
const dataRows = rows.slice(1);
|
|
10277
|
+
const shown = dataRows.slice(0, FILE_VIEWER_CSV_ROW_LIMIT);
|
|
10278
|
+
return /* @__PURE__ */ jsxs73("div", { className: "fd-fv-csv", children: [
|
|
10279
|
+
/* @__PURE__ */ jsxs73("table", { className: "fd-fv-csv-table", children: [
|
|
10280
|
+
/* @__PURE__ */ jsx77("thead", { children: /* @__PURE__ */ jsx77("tr", { children: head.map((c, i) => /* @__PURE__ */ jsx77("th", { children: c }, i)) }) }),
|
|
10281
|
+
/* @__PURE__ */ jsx77("tbody", { children: shown.map((r, ri) => /* @__PURE__ */ jsx77("tr", { children: head.map((_, ci) => /* @__PURE__ */ jsx77("td", { children: r[ci] ?? "" }, ci)) }, ri)) })
|
|
10282
|
+
] }),
|
|
10283
|
+
dataRows.length > FILE_VIEWER_CSV_ROW_LIMIT ? /* @__PURE__ */ jsxs73("p", { className: "fd-fv-csv-note fd-body-sm fd-muted", children: [
|
|
10284
|
+
"Showing the first ",
|
|
10285
|
+
FILE_VIEWER_CSV_ROW_LIMIT.toLocaleString(),
|
|
10286
|
+
" of ",
|
|
10287
|
+
dataRows.length.toLocaleString(),
|
|
10288
|
+
" rows."
|
|
10289
|
+
] }) : null
|
|
10290
|
+
] });
|
|
10291
|
+
}
|
|
10292
|
+
if (kind === "text") return /* @__PURE__ */ jsx77(CodeBlock, { code: state.text || "", language: extensionOf(file.name || "") || void 0 });
|
|
10293
|
+
return /* @__PURE__ */ jsxs73("div", { className: "fd-fv-fallback", children: [
|
|
10294
|
+
/* @__PURE__ */ jsx77("span", { className: "fd-fv-fallback-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx77("i", { className: "ph ph-" + iconForMime(file.mime, file.name) }) }),
|
|
10295
|
+
/* @__PURE__ */ jsx77("span", { className: "fd-fv-fallback-title", children: "No preview available" }),
|
|
10296
|
+
/* @__PURE__ */ jsxs73("span", { className: "fd-fv-fallback-meta", children: [
|
|
10297
|
+
file.mime || "Unknown type",
|
|
10298
|
+
file.size ? " \xB7 " + formatBytes(file.size) : ""
|
|
10299
|
+
] })
|
|
10300
|
+
] });
|
|
10301
|
+
}
|
|
10302
|
+
function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", onClose, actions, className = "" }) {
|
|
10303
|
+
const kind = React47.useMemo(() => previewKindOf(file), [file]);
|
|
10304
|
+
const preview = usePreview(file, kind, resolveUrl);
|
|
10305
|
+
const [tab, setTab] = React47.useState("preview");
|
|
10306
|
+
const [downloading, setDownloading] = React47.useState(false);
|
|
10307
|
+
const [downloadError, setDownloadError] = React47.useState(null);
|
|
10308
|
+
const hasSide = sidePanel != null;
|
|
10309
|
+
React47.useEffect(() => {
|
|
10310
|
+
setTab("preview");
|
|
10311
|
+
}, [file.id]);
|
|
10312
|
+
const download = () => {
|
|
10313
|
+
setDownloading(true);
|
|
10314
|
+
setDownloadError(null);
|
|
10315
|
+
resolveUrl("attachment").then((url) => {
|
|
10316
|
+
const a = document.createElement("a");
|
|
10317
|
+
a.href = url;
|
|
10318
|
+
a.rel = "noopener";
|
|
10319
|
+
a.download = file.name || "";
|
|
10320
|
+
document.body.appendChild(a);
|
|
10321
|
+
a.click();
|
|
10322
|
+
a.remove();
|
|
10323
|
+
}).catch((err) => setDownloadError(err && err.message || "Download failed.")).finally(() => setDownloading(false));
|
|
10324
|
+
};
|
|
10325
|
+
return /* @__PURE__ */ jsxs73(
|
|
10326
|
+
"section",
|
|
10327
|
+
{
|
|
10328
|
+
className: ["fd-fv", hasSide && tab === "side" ? "is-tab-side" : "is-tab-preview", className].filter(Boolean).join(" "),
|
|
10329
|
+
"aria-label": file.name || "File",
|
|
10330
|
+
children: [
|
|
10331
|
+
/* @__PURE__ */ jsxs73("header", { className: "fd-fv-head", children: [
|
|
10332
|
+
/* @__PURE__ */ jsx77("span", { className: "fd-fv-head-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx77("i", { className: "ph ph-" + iconForMime(file.mime, file.name) }) }),
|
|
10333
|
+
/* @__PURE__ */ jsxs73("span", { className: "fd-fv-head-titles", children: [
|
|
10334
|
+
/* @__PURE__ */ jsx77("span", { className: "fd-fv-head-title", title: file.name, children: file.name }),
|
|
10335
|
+
/* @__PURE__ */ jsxs73("span", { className: "fd-fv-head-meta", children: [
|
|
10336
|
+
file.mime || "Unknown type",
|
|
10337
|
+
file.size ? " \xB7 " + formatBytes(file.size) : ""
|
|
10338
|
+
] })
|
|
10339
|
+
] }),
|
|
10340
|
+
/* @__PURE__ */ jsxs73("span", { className: "fd-fv-head-actions", children: [
|
|
10341
|
+
actions,
|
|
10342
|
+
/* @__PURE__ */ jsx77(Button, { variant: "secondary", size: "sm", icon: "download-simple", loading: downloading, onClick: download, children: "Download" }),
|
|
10343
|
+
onClose ? /* @__PURE__ */ jsx77(IconButton, { icon: "x", label: "Close", onClick: onClose }) : null
|
|
10344
|
+
] })
|
|
10345
|
+
] }),
|
|
10346
|
+
downloadError ? /* @__PURE__ */ jsx77("div", { className: "fd-fv-download-error", role: "alert", children: downloadError }) : null,
|
|
10347
|
+
hasSide ? /* @__PURE__ */ jsx77(
|
|
10348
|
+
Tabs,
|
|
10349
|
+
{
|
|
10350
|
+
className: "fd-fv-tabs",
|
|
10351
|
+
tabs: [{ value: "preview", label: "Preview" }, { value: "side", label: sidePanelLabel }],
|
|
10352
|
+
value: tab,
|
|
10353
|
+
onChange: (v) => setTab(v)
|
|
10354
|
+
}
|
|
10355
|
+
) : null,
|
|
10356
|
+
/* @__PURE__ */ jsxs73("div", { className: "fd-fv-body", children: [
|
|
10357
|
+
/* @__PURE__ */ jsx77("div", { className: "fd-fv-preview", role: "region", "aria-label": "Preview of " + (file.name || "file"), children: /* @__PURE__ */ jsx77(
|
|
10358
|
+
LoadingRegion,
|
|
10359
|
+
{
|
|
10360
|
+
state: preview.status === "loading" ? "loading" : preview.status === "error" ? "error" : "ready",
|
|
10361
|
+
error: preview.error,
|
|
10362
|
+
label: "Loading preview of " + (file.name || "file"),
|
|
10363
|
+
onRetry: preview.status === "error" ? preview.retry : void 0,
|
|
10364
|
+
skeleton: /* @__PURE__ */ jsx77(Skeleton, { shape: "card", h: 220 }),
|
|
10365
|
+
children: /* @__PURE__ */ jsx77(PreviewBody, { file, kind, state: preview })
|
|
10366
|
+
}
|
|
10367
|
+
) }),
|
|
10368
|
+
hasSide ? /* @__PURE__ */ jsx77("div", { className: "fd-fv-side", role: "region", "aria-label": sidePanelLabel, children: sidePanel }) : null
|
|
10369
|
+
] })
|
|
10370
|
+
]
|
|
10371
|
+
}
|
|
10372
|
+
);
|
|
10373
|
+
}
|
|
10374
|
+
|
|
10375
|
+
// src/kits/query.ts
|
|
10376
|
+
import * as React48 from "react";
|
|
10157
10377
|
function eqFilter(get2) {
|
|
10158
10378
|
return (row, value) => Array.isArray(value) ? value.includes(get2(row)) : get2(row) === value;
|
|
10159
10379
|
}
|
|
@@ -10185,22 +10405,22 @@ function compare(a, b, dir) {
|
|
|
10185
10405
|
var API = null;
|
|
10186
10406
|
var PREFS = null;
|
|
10187
10407
|
function useServerTable({ endpoint, params, defaults, deps, prefsKey }) {
|
|
10188
|
-
const [query, setQuery] =
|
|
10408
|
+
const [query, setQuery] = React48.useState(() => {
|
|
10189
10409
|
const store = PREFS || window.PlannerPrefs;
|
|
10190
10410
|
const saved = prefsKey && store ? store.getTable(prefsKey) : {};
|
|
10191
10411
|
return { ...DEFAULTS, ...defaults || {}, ...saved.pageSize ? { pageSize: saved.pageSize } : {}, ...saved.sort ? { sort: saved.sort, dir: saved.dir || "desc" } : {} };
|
|
10192
10412
|
});
|
|
10193
|
-
const savePref =
|
|
10413
|
+
const savePref = React48.useCallback((patch2) => {
|
|
10194
10414
|
const store = PREFS || window.PlannerPrefs;
|
|
10195
10415
|
if (prefsKey && store) store.setTable(prefsKey, patch2);
|
|
10196
10416
|
}, [prefsKey]);
|
|
10197
|
-
const [res, setRes] =
|
|
10198
|
-
const [loading, setLoading] =
|
|
10199
|
-
const seq2 =
|
|
10417
|
+
const [res, setRes] = React48.useState(null);
|
|
10418
|
+
const [loading, setLoading] = React48.useState(true);
|
|
10419
|
+
const seq2 = React48.useRef(0);
|
|
10200
10420
|
const depKey = (deps || []).join("|");
|
|
10201
10421
|
const paramKey = JSON.stringify(params || {});
|
|
10202
10422
|
const queryKey = JSON.stringify(query);
|
|
10203
|
-
|
|
10423
|
+
React48.useEffect(() => {
|
|
10204
10424
|
const id = ++seq2.current;
|
|
10205
10425
|
setLoading(true);
|
|
10206
10426
|
const t = setTimeout(() => {
|
|
@@ -10541,6 +10761,8 @@ export {
|
|
|
10541
10761
|
EmptyState,
|
|
10542
10762
|
EntityRow,
|
|
10543
10763
|
EntityRowMetrics,
|
|
10764
|
+
FILE_VIEWER_CSV_ROW_LIMIT,
|
|
10765
|
+
FILE_VIEWER_TEXT_LIMIT,
|
|
10544
10766
|
FeatureGate,
|
|
10545
10767
|
FileChip,
|
|
10546
10768
|
FileGrid,
|
|
@@ -10548,6 +10770,7 @@ export {
|
|
|
10548
10770
|
FilePickButton,
|
|
10549
10771
|
FileStrip,
|
|
10550
10772
|
FileTile,
|
|
10773
|
+
FileViewer,
|
|
10551
10774
|
FilterBar,
|
|
10552
10775
|
Flag,
|
|
10553
10776
|
FlytedeskBrand,
|
|
@@ -10652,6 +10875,7 @@ export {
|
|
|
10652
10875
|
markdownToText,
|
|
10653
10876
|
meterFormats,
|
|
10654
10877
|
modifierLabel,
|
|
10878
|
+
parseDelimited,
|
|
10655
10879
|
pastedTextName,
|
|
10656
10880
|
pluralizeUnit,
|
|
10657
10881
|
preferenceScore,
|