Extract UI kit into Medkit workspace package (@medkit/ui)

Move shadcn primitives, kit components, charts, theme provider, shared
hooks and utils (cn, format, masks, clipboard) into packages/medkit,
consumed as source via npm workspaces. The app now imports everything
from "@medkit/ui".

- Package-internal imports are relative; no @/ alias inside the kit
- Theme tokens, fonts and base styles move to @medkit/ui/styles.css,
  which registers its own @source so classes are found from node_modules
- NotifyToaster takes a navigate prop instead of depending on
  react-router; the app mounts it in App with useNavigate()
- Kit-only dependencies move to the package; react, react-dom and
  tailwindcss are peers
- Drop components.json (shadcn CLI unused, aliases no longer valid)
- Update UI docs and add a package README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ilya Mukhortov 2026-10-25 10:48:51 +10:00
parent ab08dea5d6
commit 0f02a3c252
72 changed files with 481 additions and 131 deletions

52
README.md Normal file
View File

@ -0,0 +1,52 @@
# Medkit — `@medkit/ui`
UI kit МИС «Медицина»: React 19 + Tailwind 4 + Radix (shadcn/ui). Живая витрина — `/ui` и `/ui-form` в medicine-ui.
```
src/ui/ базовые примитивы shadcn/ui
src/kit/ составные компоненты: формы, таблицы, пациенты, услуги, уведомления
src/charts/ SVG-графики без библиотек
src/hooks/ use-media-query, use-caret
src/lib/ cn, format, masks, clipboard
src/styles.css тема (токены, шрифты, тёмный режим)
```
Пакет поставляется исходниками (без сборки): TS/TSX компилирует бандлер приложения.
## Подключение
```tsx
import { Button, DataTable, DateInput, cn } from "@medkit/ui"
```
CSS приложения:
```css
@import "tailwindcss";
@import "@medkit/ui/styles.css";
```
`styles.css` сам добавляет исходники кита в `@source`, так что классы находятся и из `node_modules`. Палитру можно переопределить своими `:root` / `.dark` после импорта.
Корень приложения:
```tsx
<ThemeProvider>
<TooltipProvider>
<App /> {/* внутри — <NotifyToaster navigate={useNavigate()} /> для notify() */}
<Toaster />
</TooltipProvider>
</ThemeProvider>
```
`NotifyToaster` без `navigate` переходит по `href` через `window.location.assign`.
Peer-зависимости: `react`, `react-dom` 19, `tailwindcss` 4. В Vite-проекте ничего настраивать не нужно.
## Правила для кода пакета
- Импорты внутри пакета — только относительные (`../lib/utils`), без `@/`: алиас принадлежит приложению.
- Никаких данных и роутера приложения — только пропсы.
- Новый компонент: файл в `src/kit/`, экспорт в `src/kit/index.ts`, пример на `/ui`. Новый shadcn-примитив — файл в `src/ui/` и строка в `src/index.ts`.
- Компоненты shadcn берутся исходниками с GitHub (`apps/v4/registry/new-york-v4/ui/*.tsx`), импорт `cn` заменяется на `../lib/utils`.
- Проверка типов: `npm run typecheck -w @medkit/ui`.

35
package.json Normal file
View File

@ -0,0 +1,35 @@
{
"name": "@medkit/ui",
"version": "0.1.0",
"private": true,
"description": "Medkit — UI kit МИС «Медицина»: React 19 + Tailwind 4 + Radix (shadcn/ui)",
"type": "module",
"sideEffects": [
"*.css"
],
"exports": {
".": "./src/index.ts",
"./styles.css": "./src/styles.css"
},
"scripts": {
"typecheck": "tsc --noEmit -p ."
},
"peerDependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwindcss": "^4.0.0"
},
"dependencies": {
"@fontsource-variable/jetbrains-mono": "^5.3.0",
"@fontsource-variable/onest": "^5.3.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"lucide-react": "^1.61.0",
"radix-ui": "^1.8.1",
"react-day-picker": "^9.14.0",
"sonner": "^2.0.8",
"tailwind-merge": "^3.7.0",
"tw-animate-css": "^1.4.0"
}
}

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
/** Ширина контейнера — чтобы SVG рисовался в реальных пикселях и текст не масштабировался. */
export function useElementWidth<T extends HTMLElement>() {

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { ChartTooltip, TooltipRow, useChartHover, useElementWidth } from "./chart-hover"
export interface ChartSeries {

44
src/index.ts Normal file
View File

@ -0,0 +1,44 @@
// Medkit — UI kit МИС «Медицина». Витрина — /ui в medicine-ui.
export * from "./kit"
export * from "./ui/alert-dialog"
export * from "./ui/avatar"
export * from "./ui/badge"
export * from "./ui/button"
export * from "./ui/calendar"
export * from "./ui/card"
export * from "./ui/checkbox"
export * from "./ui/command"
export * from "./ui/context-menu"
export * from "./ui/dialog"
export * from "./ui/dropdown-menu"
export * from "./ui/empty"
export * from "./ui/hover-card"
export * from "./ui/input"
export * from "./ui/input-group"
export * from "./ui/kbd"
export * from "./ui/label"
export * from "./ui/popover"
export * from "./ui/progress"
export * from "./ui/scroll-area"
export * from "./ui/select"
export * from "./ui/separator"
export * from "./ui/sheet"
export * from "./ui/skeleton"
export * from "./ui/sonner"
export * from "./ui/switch"
export * from "./ui/table"
export * from "./ui/tabs"
export * from "./ui/textarea"
export * from "./ui/toggle"
export * from "./ui/toggle-group"
export * from "./ui/tooltip"
export * from "./charts/chart-hover"
export * from "./charts/column-chart"
export * from "./charts/sparkline"
export * from "./hooks/use-caret"
export * from "./hooks/use-media-query"
export * from "./lib/clipboard"
export * from "./lib/format"
export * from "./lib/masks"
export * from "./lib/utils"
export * from "./theme-provider"

View File

@ -1,7 +1,7 @@
import { CopyIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { copyToClipboard } from "@/lib/clipboard"
import { cn } from "../lib/utils"
import { copyToClipboard } from "../lib/clipboard"
/** Фрагмент кода с кнопкой копирования. */
export function CodeBlock({ code, className }: { code: string; className?: string }) {

View File

@ -1,9 +1,9 @@
import * as React from "react"
import { CheckIcon, ChevronDownIcon, PlusIcon, 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 { cn } from "../lib/utils"
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../ui/command"
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"
/**
* Одиночный выбор из справочника с поиском и очисткой (как tui-combo-box).

View File

@ -10,8 +10,8 @@ import {
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
import { buttonVariants } from "@/components/ui/button"
} from "../ui/alert-dialog"
import { buttonVariants } from "../ui/button"
/** Подтверждение необратимого действия: «Удалить профиль?» → Удалить / Отмена. */
export function ConfirmDialog({

View File

@ -1,6 +1,6 @@
import { type LucideIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
export interface ContentTabItem<T extends string = string> {
readonly id: T

View File

@ -1,7 +1,7 @@
import * as React from "react"
import { ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
export type SortDirection = "asc" | "desc"

View File

@ -1,13 +1,13 @@
import * as React from "react"
import { CalendarIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group"
import { Popover, PopoverAnchor, PopoverContent } from "@/components/ui/popover"
import { formatRuDate, isDatePrefixValid, isSameDay, maskDate, maskWithCaret, parseRuDate } from "@/lib/masks"
import { useCaret } from "@/hooks/use-caret"
import { cn } from "@/lib/utils"
import { Button } from "../ui/button"
import { Calendar } from "../ui/calendar"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../ui/input-group"
import { Popover, PopoverAnchor, PopoverContent } from "../ui/popover"
import { formatRuDate, isDatePrefixValid, isSameDay, maskDate, maskWithCaret, parseRuDate } from "../lib/masks"
import { useCaret } from "../hooks/use-caret"
import { cn } from "../lib/utils"
export interface DateLimits {
min?: Date

View File

@ -1,4 +1,4 @@
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
const WEEKDAYS = ["вс", "пн", "вт", "ср", "чт", "пт", "сб"]
const MONTHS = ["янв", "фев", "мар", "апр", "мая", "июн", "июл", "авг", "сен", "окт", "ноя", "дек"]

View File

@ -1,13 +1,13 @@
import * as React from "react"
import { CalendarRangeIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "@/components/ui/input-group"
import { Popover, PopoverAnchor, PopoverContent } from "@/components/ui/popover"
import { useMediaQuery } from "@/hooks/use-media-query"
import { isSameDay } from "@/lib/masks"
import { cn } from "@/lib/utils"
import { Button } from "../ui/button"
import { Calendar } from "../ui/calendar"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "../ui/input-group"
import { Popover, PopoverAnchor, PopoverContent } from "../ui/popover"
import { useMediaQuery } from "../hooks/use-media-query"
import { isSameDay } from "../lib/masks"
import { cn } from "../lib/utils"
import { calendarBounds, startOfDay, useCalendarPopover, useDateText, type DateLimits } from "./date-input"

View File

@ -1,9 +1,9 @@
import * as React from "react"
import type { LucideIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { cn } from "@/lib/utils"
import { Button } from "../ui/button"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../ui/dialog"
import { cn } from "../lib/utils"
/**
* Модальное редактирование одного смыслового блока (InfoSection): форма, «Отмена» / «Сохранить».

View File

@ -1,7 +1,7 @@
import * as React from "react"
import { UploadCloudIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
/** Зона загрузки: перетащить файлы или выбрать в диалоге. */
export function FileDrop({

View File

@ -10,9 +10,9 @@ import {
XIcon,
} from "lucide-react"
import { cn } from "@/lib/utils"
import { formatBytes } from "@/lib/format"
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog"
import { cn } from "../lib/utils"
import { formatBytes } from "../lib/format"
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog"
export interface FileItem {
readonly name: string

View File

@ -1,7 +1,7 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { Label } from "@/components/ui/label"
import { cn } from "../lib/utils"
import { Label } from "../ui/label"
/** Подзаголовок группы полей формы. */
export function FormSection({ title, children }: { title: string; children: React.ReactNode }) {

View File

@ -1,4 +1,4 @@
// Переиспользуемые компоненты МИС «Медицина». Витрина — /ui (src/pages/ui/ui-page.tsx).
// Составные компоненты Medkit. Витрина — /ui в medicine-ui (src/pages/ui/ui-page.tsx).
export * from "./code-block"
export * from "./combobox"
export * from "./confirm-dialog"

View File

@ -1,8 +1,8 @@
import * as React from "react"
import { CopyIcon, PencilIcon, type LucideIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { copyToClipboard } from "@/lib/clipboard"
import { cn } from "../lib/utils"
import { copyToClipboard } from "../lib/clipboard"
/** Смысловой блок на мягкой подложке: иконка + заголовок, справа — действие; с `onEdit` — карандаш при наведении. */
export function InfoSection({

View File

@ -1,9 +1,9 @@
import * as React from "react"
import { CheckIcon, ChevronDownIcon, 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 { cn } from "../lib/utils"
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../ui/command"
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"
export interface MultiSelectOption<T extends string = string> {
readonly value: T

View File

@ -7,15 +7,18 @@ import {
XIcon,
type LucideIcon,
} from "lucide-react"
import { useNavigate } from "react-router-dom"
import * as React from "react"
import { toast, Toaster } from "sonner"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
export type NotifyType = "success" | "info" | "warning" | "error"
const TOASTER_ID = "notify"
/** Переход по href из карточки; без роутера — обычная навигация браузера. */
const NavigateContext = React.createContext<(href: string) => void>((href) => window.location.assign(href))
const typeMeta: Record<NotifyType, { icon: LucideIcon; tile: string; bar: string; duration: number }> = {
success: { icon: CircleCheckIcon, tile: "bg-success-soft text-success", bar: "bg-success", duration: 5000 },
info: { icon: InfoIcon, tile: "bg-info-soft text-info", bar: "bg-info", duration: 6000 },
@ -49,9 +52,12 @@ notify.warning = (o: Omit<NotifyOptions, "type">) => notify({ ...o, type: "warni
notify.error = (o: Omit<NotifyOptions, "type">) => notify({ ...o, type: "error" })
notify.dismiss = (id?: string | number) => toast.dismiss(id)
/** Контейнер уведомлений. Монтируется один раз внутри BrowserRouter — карточке нужен роутер для «Перейти». */
export function NotifyToaster() {
return (
/**
* Контейнер уведомлений, монтируется один раз. `navigate` — переход для кнопки «Перейти»
* (с react-router: `useNavigate()`), по умолчанию `window.location.assign`.
*/
export function NotifyToaster({ navigate }: { navigate?: (href: string) => void }) {
const toaster = (
<Toaster
id={TOASTER_ID}
position="top-right"
@ -61,6 +67,7 @@ export function NotifyToaster() {
toastOptions={{ unstyled: true, className: "w-full" }}
/>
)
return navigate ? <NavigateContext.Provider value={navigate}>{toaster}</NavigateContext.Provider> : toaster
}
function NotifyCard({
@ -71,7 +78,7 @@ function NotifyCard({
href,
actionLabel = "Перейти",
}: Omit<NotifyOptions, "duration"> & { id: string | number; type: NotifyType }) {
const navigate = useNavigate()
const navigate = React.useContext(NavigateContext)
const { icon: Icon, tile, bar } = typeMeta[type]
return (

View File

@ -1,8 +1,8 @@
import * as React from "react"
import { type LucideIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { ScrollArea } from "@/components/ui/scroll-area"
import { cn } from "../lib/utils"
import { ScrollArea } from "../ui/scroll-area"
/**
* Рамка раздела без вкладок: карточка с шапкой (иконка, заголовок, действия)

View File

@ -1,17 +1,17 @@
import * as React from "react"
import { ChevronDownIcon, XIcon, type LucideIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "@/components/ui/context-menu"
import { cn } from "../lib/utils"
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../ui/context-menu"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Kbd } from "@/components/ui/kbd"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
} from "../ui/dropdown-menu"
import { Kbd } from "../ui/kbd"
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip"
export type PageTabTone = "male" | "female" | "neutral"

View File

@ -1,6 +1,6 @@
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
const DEFAULT_SIZES = [15, 30, 50] as const

View File

@ -1,5 +1,5 @@
import { cn } from "@/lib/utils"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { cn } from "../lib/utils"
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar"
export type Gender = "male" | "female"

View File

@ -1,9 +1,9 @@
import * as React from "react"
import { CopyIcon, IdCardIcon, PhoneIcon, StethoscopeIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { copyToClipboard } from "@/lib/clipboard"
import { pluralYears } from "@/lib/format"
import { cn } from "../lib/utils"
import { copyToClipboard } from "../lib/clipboard"
import { pluralYears } from "../lib/format"
import { ContentTabs, type ContentTabItem } from "./content-tabs"
import { GenderMark, PatientAvatar, type AvatarPerson } from "./patient-avatar"

View File

@ -1,9 +1,9 @@
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 { cn } from "../lib/utils"
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../ui/command"
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"
import { GenderMark, PatientAvatar, type AvatarPerson } from "./patient-avatar"
export interface PickerPatient extends AvatarPerson {

View File

@ -1,6 +1,6 @@
import { XIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
export function initialsOf(name: string) {
const parts = name.replace(/\./g, " ").trim().split(/\s+/)

View File

@ -1,8 +1,8 @@
import * as React from "react"
import { CircleAlertIcon, CircleCheckIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { cn } from "../lib/utils"
import { Button } from "../ui/button"
/**
* Липкая панель внизу формы: показывает, есть ли несохранённые изменения,

View File

@ -1,7 +1,7 @@
import * as React from "react"
import { SearchIcon, XIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
/** Поле поиска на мягкой подложке: иконка, крестик очистки. */
export const SearchInput = React.forwardRef<

View File

@ -1,8 +1,8 @@
import { MinusIcon, PlusIcon, Trash2Icon } from "lucide-react"
import { cn } from "@/lib/utils"
import { formatMoney } from "@/lib/format"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { cn } from "../lib/utils"
import { formatMoney } from "../lib/format"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select"
import { StatusBadge, type StatusTone } from "./status-badge"
export type ServiceLineStatus = "unpaid" | "paid" | "refunded" | "declined"

View File

@ -1,13 +1,13 @@
import * as React from "react"
import { CheckIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { formatMoney } from "@/lib/format"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { ScrollArea } from "@/components/ui/scroll-area"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { cn } from "../lib/utils"
import { formatMoney } from "../lib/format"
import { Button } from "../ui/button"
import { Checkbox } from "../ui/checkbox"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../ui/dialog"
import { ScrollArea } from "../ui/scroll-area"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select"
import { ContentTabs } from "./content-tabs"
import { SearchInput } from "./search-input"

View File

@ -1,10 +1,10 @@
import * as React from "react"
import { CircleCheckIcon } from "lucide-react"
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group"
import { isSnilsValid, maskSnils, maskWithCaret, onlyDigits } from "@/lib/masks"
import { useCaret } from "@/hooks/use-caret"
import { cn } from "@/lib/utils"
import { InputGroup, InputGroupAddon, InputGroupInput } from "../ui/input-group"
import { isSnilsValid, maskSnils, maskWithCaret, onlyDigits } from "../lib/masks"
import { useCaret } from "../hooks/use-caret"
import { cn } from "../lib/utils"
/** Текст ошибки для СНИЛС; пустое значение ошибкой не считается. */
export function snilsError(value: string) {

View File

@ -1,6 +1,6 @@
import { type LucideIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import type { StatusTone } from "./status-badge"
const toneClass: Record<StatusTone, string> = {

View File

@ -1,4 +1,4 @@
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
export type StatusTone = "positive" | "info" | "warning" | "negative" | "neutral"

View File

@ -1,6 +1,6 @@
import { CheckIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
export interface StepItem {
readonly label: string

View File

@ -1,12 +1,12 @@
import * as React from "react"
import { ClockIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group"
import { Popover, PopoverAnchor, PopoverContent } from "@/components/ui/popover"
import { isTimePrefixValid, maskTime, maskWithCaret } from "@/lib/masks"
import { useCaret } from "@/hooks/use-caret"
import { cn } from "@/lib/utils"
import { Button } from "../ui/button"
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../ui/input-group"
import { Popover, PopoverAnchor, PopoverContent } from "../ui/popover"
import { isTimePrefixValid, maskTime, maskWithCaret } from "../lib/masks"
import { useCaret } from "../hooks/use-caret"
import { cn } from "../lib/utils"
import { useCalendarPopover } from "./date-input"

View File

@ -1,6 +1,6 @@
import { XIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
export interface TimeRangeValue {
from: string

187
src/styles.css Normal file
View File

@ -0,0 +1,187 @@
/*
* Medkit — тема и базовые стили. Подключение в приложении (после tailwindcss):
* @import "tailwindcss";
* @import "@medkit/ui/styles.css";
* Переопределить палитру можно своими :root / .dark после импорта.
*/
@import "tw-animate-css";
@import "@fontsource-variable/onest";
@import "@fontsource-variable/jetbrains-mono";
/* Классы компонентов kit — чтобы Tailwind видел их и из node_modules */
@source ".";
@custom-variant dark (&:is(.dark *));
/*
* Палитра «клинический бирюзовый».
* Основной цвет — глубокий бирюзовый (доверие, медицина), акцент — коралл
* для тревожных отметок (аллергии, неявки). Сайдбар тёмный, чтобы рабочая
* область читалась как «лист» поверх приборной панели.
*/
:root {
--radius: 0.75rem;
--background: oklch(0.972 0.006 210);
--foreground: oklch(0.22 0.025 240);
--card: oklch(1 0 0);
--card-foreground: oklch(0.22 0.025 240);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.22 0.025 240);
--primary: oklch(0.52 0.105 195);
--primary-foreground: oklch(0.99 0.005 195);
--secondary: oklch(0.955 0.012 200);
--secondary-foreground: oklch(0.3 0.04 220);
--muted: oklch(0.962 0.006 220);
--muted-foreground: oklch(0.52 0.02 240);
--accent: oklch(0.95 0.025 190);
--accent-foreground: oklch(0.33 0.07 200);
--destructive: oklch(0.6 0.2 25);
--border: oklch(0.915 0.01 220);
--input: oklch(0.9 0.012 220);
--ring: oklch(0.62 0.1 195);
/* Семантика клиники */
--coral: oklch(0.66 0.17 30);
--coral-soft: oklch(0.96 0.03 30);
--success: oklch(0.6 0.13 160);
--success-soft: oklch(0.955 0.04 160);
--warning: oklch(0.72 0.14 75);
--warning-soft: oklch(0.965 0.045 85);
--info: oklch(0.58 0.13 245);
--info-soft: oklch(0.955 0.025 245);
--male: oklch(0.6 0.12 240);
--female: oklch(0.63 0.16 350);
/* Тёмная «приборная» боковая панель */
--sidebar: oklch(0.235 0.035 228);
--sidebar-foreground: oklch(0.84 0.02 220);
--sidebar-muted: oklch(0.6 0.03 225);
--sidebar-accent: oklch(0.3 0.045 220);
--sidebar-primary: oklch(0.8 0.12 185);
--sidebar-border: oklch(0.3 0.035 228);
/* Графики: категориальные слоты проверены на различимость при дальтонизме */
--chart-1: #2a78d6;
--chart-2: #eb6834;
--chart-3: #1baf7a;
--chart-bad: #e34948;
--chart-muted: #c3c8d0;
--chart-grid: oklch(0.93 0.008 220);
}
.dark {
--background: oklch(0.17 0.02 235);
--foreground: oklch(0.94 0.01 220);
--card: oklch(0.215 0.024 235);
--card-foreground: oklch(0.94 0.01 220);
--popover: oklch(0.23 0.025 235);
--popover-foreground: oklch(0.94 0.01 220);
--primary: oklch(0.74 0.12 190);
--primary-foreground: oklch(0.2 0.04 220);
--secondary: oklch(0.27 0.025 230);
--secondary-foreground: oklch(0.9 0.01 220);
--muted: oklch(0.255 0.02 235);
--muted-foreground: oklch(0.68 0.02 230);
--accent: oklch(0.3 0.04 205);
--accent-foreground: oklch(0.9 0.05 190);
--destructive: oklch(0.66 0.19 25);
--border: oklch(0.3 0.022 235);
--input: oklch(0.33 0.025 235);
--ring: oklch(0.65 0.11 190);
--coral: oklch(0.72 0.15 30);
--coral-soft: oklch(0.3 0.06 30);
--success: oklch(0.72 0.13 160);
--success-soft: oklch(0.28 0.05 160);
--warning: oklch(0.8 0.13 80);
--warning-soft: oklch(0.3 0.05 80);
--info: oklch(0.7 0.12 245);
--info-soft: oklch(0.28 0.05 245);
--male: oklch(0.7 0.11 240);
--female: oklch(0.72 0.14 350);
--sidebar: oklch(0.14 0.02 235);
--sidebar-foreground: oklch(0.82 0.015 220);
--sidebar-muted: oklch(0.55 0.02 225);
--sidebar-accent: oklch(0.22 0.03 225);
--sidebar-primary: oklch(0.8 0.12 185);
--sidebar-border: oklch(0.22 0.02 235);
--chart-1: #3987e5;
--chart-2: #d95926;
--chart-3: #199e70;
--chart-bad: #e66767;
--chart-muted: #4a5561;
--chart-grid: oklch(0.28 0.02 235);
}
@theme inline {
--font-sans: "Onest Variable", ui-sans-serif, system-ui, sans-serif;
--font-mono: "JetBrains Mono Variable", ui-monospace, monospace;
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-coral: var(--coral);
--color-coral-soft: var(--coral-soft);
--color-success: var(--success);
--color-success-soft: var(--success-soft);
--color-warning: var(--warning);
--color-warning-soft: var(--warning-soft);
--color-info: var(--info);
--color-info-soft: var(--info-soft);
--color-male: var(--male);
--color-female: var(--female);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-muted: var(--sidebar-muted);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-border: var(--sidebar-border);
}
@layer base {
* {
@apply border-border outline-ring/50;
}
html {
font-feature-settings: "tnum" 0;
}
body {
@apply bg-background text-foreground antialiased;
}
.tabular {
font-variant-numeric: tabular-nums;
}
}
/* Тонкий скроллбар для полосы вкладок */
.scrollbar-none {
scrollbar-width: none;
}
.scrollbar-none::-webkit-scrollbar {
display: none;
}

View File

@ -1,9 +1,9 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { AlertDialog as AlertDialogPrimitive } from "radix-ui"
import { Button } from "@/components/ui/button"
import { Button } from "./button"
function AlertDialog({
...props

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Avatar as AvatarPrimitive } from "radix-ui"
function Avatar({

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Slot } from "radix-ui"
const badgeVariants = cva(

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Slot } from "radix-ui"
const buttonVariants = cva(

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import {
ChevronDownIcon,
ChevronLeftIcon,
@ -13,7 +13,7 @@ import {
} from "react-day-picker"
import { ru } from "react-day-picker/locale"
import { Button, buttonVariants } from "@/components/ui/button"
import { Button, buttonVariants } from "./button"
function Calendar({
className,

View File

@ -1,5 +1,5 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
function Card({ className, ...props }: React.ComponentProps<"div">) {
return (

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { CheckIcon } from "lucide-react"
import { Checkbox as CheckboxPrimitive } from "radix-ui"

View File

@ -1,7 +1,7 @@
import * as React from "react"
import { Command as CommandPrimitive } from "cmdk"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { SearchIcon } from "lucide-react"
import {
@ -10,7 +10,7 @@ import {
DialogDescription,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog"
} from "./dialog"
function Command({
className,

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
import { ContextMenu as ContextMenuPrimitive } from "radix-ui"

View File

@ -1,10 +1,10 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { XIcon } from "lucide-react"
import { Dialog as DialogPrimitive } from "radix-ui"
import { Button } from "@/components/ui/button"
import { Button } from "./button"
function Dialog({
...props

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"

View File

@ -1,5 +1,5 @@
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
function Empty({ className, ...props }: React.ComponentProps<"div">) {
return (

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { HoverCard as HoverCardPrimitive } from "radix-ui"
function HoverCard({

View File

@ -1,11 +1,11 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Textarea } from "@/components/ui/textarea"
import { Button } from "./button"
import { Input } from "./input"
import { Textarea } from "./textarea"
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
return (

View File

@ -1,5 +1,5 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (

View File

@ -1,4 +1,4 @@
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
return (

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Label as LabelPrimitive } from "radix-ui"
function Label({

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Popover as PopoverPrimitive } from "radix-ui"
function Popover({

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Progress as ProgressPrimitive } from "radix-ui"
function Progress({

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
// Как tui-scrollbar в старом UI: нативный скролл скрыт, поверх контента —

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
import { Select as SelectPrimitive } from "radix-ui"

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Separator as SeparatorPrimitive } from "radix-ui"
function Separator({

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { XIcon } from "lucide-react"
import { Dialog as SheetPrimitive } from "radix-ui"

View File

@ -1,4 +1,4 @@
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return (

View File

@ -6,7 +6,7 @@ import {
OctagonXIcon,
TriangleAlertIcon,
} from "lucide-react"
import { useTheme } from "@/components/theme-provider"
import { useTheme } from "../theme-provider"
import { Toaster as Sonner, type ToasterProps } from "sonner"
const Toaster = ({ ...props }: ToasterProps) => {

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Switch as SwitchPrimitive } from "radix-ui"
function Switch({

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
function Table({ className, ...props }: React.ComponentProps<"table">) {
return (

View File

@ -1,7 +1,7 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Tabs as TabsPrimitive } from "radix-ui"
function Tabs({

View File

@ -1,5 +1,5 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
return (

View File

@ -1,10 +1,10 @@
import * as React from "react"
import { type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui"
import { toggleVariants } from "@/components/ui/toggle"
import { toggleVariants } from "./toggle"
const ToggleGroupContext = React.createContext<
VariantProps<typeof toggleVariants> & {

View File

@ -1,7 +1,7 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Toggle as TogglePrimitive } from "radix-ui"
const toggleVariants = cva(

View File

@ -1,6 +1,6 @@
import * as React from "react"
import { cn } from "@/lib/utils"
import { cn } from "../lib/utils"
import { Tooltip as TooltipPrimitive } from "radix-ui"
function TooltipProvider({

25
tsconfig.json Normal file
View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.medkit.tsbuildinfo",
"target": "es2023",
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "esnext",
"types": [],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}