diff --git a/src/kit/index.ts b/src/kit/index.ts index 1eb1493..907c67f 100644 --- a/src/kit/index.ts +++ b/src/kit/index.ts @@ -14,9 +14,11 @@ export * from "./page-tabs" export * from "./pagination" export * from "./patient-avatar" export * from "./patient-panel" +export * from "./patient-picker" export * from "./person-chip" export * from "./save-bar" export * from "./search-input" export * from "./stat-tile" export * from "./status-badge" +export * from "./stepper" export * from "./time-range-input" diff --git a/src/kit/patient-picker.tsx b/src/kit/patient-picker.tsx new file mode 100644 index 0000000..fdb4fb8 --- /dev/null +++ b/src/kit/patient-picker.tsx @@ -0,0 +1,124 @@ +import * as React from "react" +import { ChevronsUpDownIcon, UserSearchIcon, XIcon } from "lucide-react" + +import { cn } from "@/lib/utils" +import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command" +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover" +import { GenderMark, PatientAvatar, type AvatarPerson } from "./patient-avatar" + +export interface PickerPatient extends AvatarPerson { + readonly id: number + readonly middleName?: string + readonly birthDate: string + readonly phone?: string + readonly cardNumber?: string +} + +/** Выбор пациента из картотеки: поиск по ФИО, телефону, номеру карты. */ +export function PatientPicker({ + patients, + value, + onChange, + placeholder = "Найдите пациента", + invalid, + className, +}: { + patients: readonly PickerPatient[] + value: number | null + onChange: (id: number | null) => void + placeholder?: string + invalid?: boolean + className?: string +}) { + const [open, setOpen] = React.useState(false) + const selected = patients.find((p) => p.id === value) + const name = (p: PickerPatient) => `${p.lastName} ${p.firstName} ${p.middleName ?? ""}`.trim() + + return ( + + + + + + + + + Пациент не найден + + {patients.map((p) => ( + { + onChange(p.id) + setOpen(false) + }} + className="gap-3" + > + +
+
{name(p)}
+
+ {p.birthDate} + {p.cardNumber && <> · карта {p.cardNumber}} +
+
+
+ ))} +
+
+
+
+
+ ) +} diff --git a/src/kit/stepper.tsx b/src/kit/stepper.tsx new file mode 100644 index 0000000..60f8689 --- /dev/null +++ b/src/kit/stepper.tsx @@ -0,0 +1,58 @@ +import { CheckIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +export interface StepItem { + readonly label: string + /** Подпись под шагом: выбранный слот, пациент… */ + readonly hint?: string +} + +/** Шаги мастера: пройденные — с галочкой и кликабельны, будущие — недоступны. */ +export function Stepper({ + steps, + current, + onStepClick, + className, +}: { + steps: readonly StepItem[] + current: number + onStepClick?: (index: number) => void + className?: string +}) { + return ( +
    + {steps.map((step, i) => { + const done = i < current + const active = i === current + const clickable = Boolean(onStepClick) && done + return ( +
  1. + {i > 0 && } + +
  2. + ) + })} +
+ ) +} diff --git a/src/ui/sheet.tsx b/src/ui/sheet.tsx new file mode 100644 index 0000000..ada93ce --- /dev/null +++ b/src/ui/sheet.tsx @@ -0,0 +1,141 @@ + +import * as React from "react" +import { cn } from "@/lib/utils" +import { XIcon } from "lucide-react" +import { Dialog as SheetPrimitive } from "radix-ui" + +function Sheet({ ...props }: React.ComponentProps) { + return +} + +function SheetTrigger({ + ...props +}: React.ComponentProps) { + return +} + +function SheetClose({ + ...props +}: React.ComponentProps) { + return +} + +function SheetPortal({ + ...props +}: React.ComponentProps) { + return +} + +function SheetOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function SheetContent({ + className, + children, + side = "right", + showCloseButton = true, + ...props +}: React.ComponentProps & { + side?: "top" | "right" | "bottom" | "left" + showCloseButton?: boolean +}) { + return ( + + + + {children} + {showCloseButton && ( + + + Close + + )} + + + ) +} + +function SheetHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function SheetFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function SheetTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function SheetDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { + Sheet, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +}