"use client" import * as React from "react" import { Button } from "../ui/button" import { Tip } from "../ui/tip" import { DragHandleGripIcon } from "../ui/drag-handle-grip" import { type SortRule } from "../../lib/table-properties-types" import { PROPERTIES_SHEET_TOOLTIP_Z, PROPERTIES_SHEET_TOOLTIP_Z_INDEX } from "./sheet-portal-z" import { PropertiesCardIconAction } from "./properties-card-icon-action" /** Sort rule card inside the Sort drawer panel */ export type DrawerSortCardProps = { rule: SortRule /** * Resolved column label for the sort rule's `fieldKey`. Required — every * consumer derives labels from its column defs (the drawer passes * `resolveColumnLabel(rule.fieldKey)`), so the card never falls back to a * product-specific column list. */ fieldLabel: string isPrimary: boolean onRemove: () => void onToggleDir: () => void } export function DrawerSortCard(props: DrawerSortCardProps) { const { rule, fieldLabel, isPrimary, onRemove, onToggleDir } = props const label = fieldLabel || rule.fieldKey if (!label) return null const directionLabel = rule.direction === "asc" ? "Ascending" : "Descending" return (
{label}