/** * Types for FileItem. * * @module @mks2508/mks-ui/react/ui/FileItem */ import type { VariantProps } from 'class-variance-authority'; import type { SlotOverrides } from '../../../core/types'; import type { FileIconResolver } from '../FileIcon/FileIcon.types'; import type { FileItemSlot, fileItemVariants } from './FileItem.styles'; /** What kind of filesystem entry this row represents. */ export type FileItemKind = 'file' | 'dir'; /** * Git change status for a file, rendered as a small dot in the `gitStatus` * slot when set. Colours resolve to theme design tokens (see * {@link FileItemGitStatusClasses}) so the dot reads correctly under any * theme without hardcoded hex. * * | Status | Token | Meaning | * |--------|-------|---------| * | `modified` | `bg-primary` | Tracked file with unstaged or staged modifications | * | `added` | `bg-accent-foreground` | New file staged | * | `deleted` | `bg-destructive` | Tracked file removed from the working tree | * | `untracked` | `bg-ring` | New file not yet tracked by git | * | `renamed` | `bg-secondary-foreground` | File renamed/moved (porcelain `R`) | */ export type FileItemChangeStatus = 'modified' | 'added' | 'deleted' | 'untracked' | 'renamed'; /** * Visual density of the row. * * Maps 1:1 to the `density` CVA variant in `fileItemVariants`. */ export type FileItemDensity = NonNullable['density']>; /** * Props for FileItem. * * @see {@link FileItemSlot} for available slot names */ export interface IFileItemProps extends Omit, 'density'> { /** Full path relative to some root (e.g. `"src/components/Button/index.tsx"`). */ path: string; /** Whether this is a file or a directory. */ kind: FileItemKind; /** Last-modified timestamp; when present renders a "Xh ago"-style chip. */ modifiedAt?: Date; /** Mark this row with a boost glyph (e.g. ⭐ recents/pinned). */ isBoosted?: boolean; /** * Git change status — when set to a non-null value, renders a small * coloured dot in the `gitStatus` slot before the path. Accepts `null` * explicitly so consumers that receive optional data from a backend * (e.g. `?withGitStatus=true`) can pass through cleanly. */ changeStatus?: FileItemChangeStatus | null; /** Whether this row is currently selected (for highlighting). */ selected?: boolean; /** Click / activate handler. */ onSelect?: () => void; /** Row density. Default `"compact"` (28px, matches MC). */ density?: FileItemDensity; /** * Icon base path passed to FileIcon. Default `"/file-icons/"`. */ iconBasePath?: string; /** Custom file-icon resolver. */ iconResolve?: FileIconResolver; /** Optional CSS class merged onto the root. */ className?: string; /** Native tab index. Default 0 so rows are keyboard-reachable. */ tabIndex?: number; /** * Override default Tailwind classes for specific visual regions. * * @example * ```tsx * * ``` */ slots?: SlotOverrides; } //# sourceMappingURL=FileItem.types.d.ts.map