Release 0.13.1: polish app sidebar

This commit is contained in:
Ilya Mukhortov 2026-10-30 17:11:30 +10:00
parent a1ca908d3a
commit 0630146ec7
4 changed files with 39 additions and 26 deletions

View File

@ -2,6 +2,11 @@
Установка версии: `npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^X.Y.Z"`. На 0.x `^0.7.0` не подхватывает 0.8.0 — минорную версию поднимаем в зависимости явно. Установка версии: `npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^X.Y.Z"`. На 0.x `^0.7.0` не подхватывает 0.8.0 — минорную версию поднимаем в зависимости явно.
## [0.13.1] — 2026-10-30
### Изменено
- `AppSidebar`: меню стало плотнее по высоте, улучшены поиск, активные и фокусные состояния, счётчики и нижняя панель пользователя. Заголовки групп читаются лучше, а вложенные открытые карточки занимают меньше места.
## [0.13.0] — 2026-10-30 ## [0.13.0] — 2026-10-30
### Новое ### Новое

View File

@ -18,7 +18,7 @@ src/styles.css тема (токены, шрифты, тёмный режим)
Пакет ставится прямо из git, версии — теги `vX.Y.Z`: Пакет ставится прямо из git, версии — теги `vX.Y.Z`:
```bash ```bash
npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^0.13.0" npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^0.13.1"
``` ```
`package-lock.json` фиксирует коммит; обновиться до свежего тега — `npm update @medkit/ui`. В medicine-ui kit подключён git-submodule в `packages/medkit` (npm workspace) — правки видны сразу. `package-lock.json` фиксирует коммит; обновиться до свежего тега — `npm update @medkit/ui`. В medicine-ui kit подключён git-submodule в `packages/medkit` (npm workspace) — правки видны сразу.

View File

@ -1,6 +1,6 @@
{ {
"name": "@medkit/ui", "name": "@medkit/ui",
"version": "0.13.0", "version": "0.13.1",
"private": true, "private": true,
"description": "Medkit — UI kit МИС «Медицина»: React 19 + Tailwind 4 + Radix (shadcn/ui)", "description": "Medkit — UI kit МИС «Медицина»: React 19 + Tailwind 4 + Radix (shadcn/ui)",
"repository": { "repository": {

View File

@ -92,25 +92,25 @@ export function AppSidebar({
return ( return (
<aside <aside
className={cn( className={cn(
"flex h-svh shrink-0 flex-col overflow-clip bg-sidebar text-sidebar-foreground transition-[width] duration-200 print:hidden", "flex h-svh shrink-0 flex-col overflow-clip border-r border-sidebar-border/80 bg-sidebar text-sidebar-foreground transition-[width] duration-200 print:hidden",
collapsed ? "w-[60px]" : "w-56", collapsed ? "w-[60px]" : "w-56",
className, className,
)} )}
> >
<div className={cn("flex h-14 shrink-0 items-center", collapsed ? "justify-center" : "gap-2.5 px-5")}> <div className={cn("flex h-16 shrink-0 items-center", collapsed ? "justify-center" : "gap-2.5 px-5")}>
{logo(collapsed)} {logo(collapsed)}
{!collapsed && headerExtra} {!collapsed && headerExtra}
</div> </div>
{search && ( {search && (
<div className="shrink-0 px-3 pb-1"> <div className="shrink-0 px-3 pb-2">
<SidebarTooltip label={search.tooltip} enabled={collapsed}> <SidebarTooltip label={search.tooltip} enabled={collapsed}>
<button <button
type="button" type="button"
onClick={search.onClick} onClick={search.onClick}
aria-label={collapsed ? search.tooltip : undefined} aria-label={collapsed ? search.tooltip : undefined}
className={cn( className={cn(
"flex h-9 w-full items-center gap-2 rounded-lg border border-sidebar-border bg-white/[0.03] text-sm text-sidebar-muted transition hover:bg-white/[0.06] hover:text-sidebar-foreground", "flex h-9 w-full items-center gap-2 rounded-lg border border-white/[0.08] bg-white/[0.04] text-sm text-sidebar-muted shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] transition-colors hover:border-white/[0.12] hover:bg-white/[0.07] hover:text-sidebar-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-primary/60",
collapsed ? "justify-center" : "px-3", collapsed ? "justify-center" : "px-3",
)} )}
> >
@ -119,7 +119,9 @@ export function AppSidebar({
<> <>
<span className="truncate">{search.label}</span> <span className="truncate">{search.label}</span>
{search.shortcut && ( {search.shortcut && (
<Kbd className="ml-auto border-0 bg-white/10 text-sidebar-foreground">{search.shortcut}</Kbd> <Kbd className="ml-auto border border-white/[0.06] bg-white/[0.08] text-[10px] text-sidebar-foreground shadow-none">
{search.shortcut}
</Kbd>
)} )}
</> </>
)} )}
@ -129,14 +131,16 @@ export function AppSidebar({
)} )}
<ScrollArea className="min-h-0 flex-1 [&_[data-slot=scroll-area-thumb]]:bg-white/15 [&_[data-slot=scroll-area-thumb]]:group-hover/bar:bg-white/30"> <ScrollArea className="min-h-0 flex-1 [&_[data-slot=scroll-area-thumb]]:bg-white/15 [&_[data-slot=scroll-area-thumb]]:group-hover/bar:bg-white/30">
<nav className={cn("px-3 py-2", collapsed ? "space-y-1.5" : "space-y-4")}> <nav className={cn("px-3 py-3", collapsed ? "space-y-2" : "space-y-3.5")}>
{groups.map((group) => ( {groups.map((group) => (
<div key={group.label} className="group/nav"> <div key={group.label} className="group/nav">
{collapsed ? ( {collapsed ? (
<div className="mx-auto mb-1.5 h-px w-6 bg-sidebar-border group-first/nav:hidden" /> <div className="mx-auto mb-2 h-px w-7 bg-sidebar-border/90 group-first/nav:hidden" />
) : ( ) : (
<div className="mb-1 px-3 text-3xs font-semibold tracking-[0.14em] text-sidebar-muted uppercase"> <div className="mb-1.5 flex items-center gap-2 px-3">
<span className="text-[10px] leading-4 font-semibold tracking-[0.11em] text-sidebar-muted uppercase">
{group.label} {group.label}
</span>
</div> </div>
)} )}
<ul className="space-y-0.5"> <ul className="space-y-0.5">
@ -151,7 +155,7 @@ export function AppSidebar({
</nav> </nav>
</ScrollArea> </ScrollArea>
<div className="shrink-0 border-t border-sidebar-border p-3"> <div className="shrink-0 border-t border-sidebar-border bg-black/[0.04] px-3 py-2.5 shadow-[0_-8px_20px_rgba(0,0,0,0.06)]">
<div className={cn("flex items-center gap-1", collapsed && "flex-col")}> <div className={cn("flex items-center gap-1", collapsed && "flex-col")}>
{user ? <UserMenu user={user} collapsed={collapsed} menu={userMenu} /> : <div className="flex-1" />} {user ? <UserMenu user={user} collapsed={collapsed} menu={userMenu} /> : <div className="flex-1" />}
<SidebarIconButton label={collapsed ? "Развернуть меню" : "Свернуть меню"} onClick={onToggle}> <SidebarIconButton label={collapsed ? "Развернуть меню" : "Свернуть меню"} onClick={onToggle}>
@ -191,7 +195,7 @@ function SidebarLink({ item, collapsed }: { item: SidebarNavItem; collapsed: boo
const label = count > 0 ? `${item.label}: ${count}` : item.label const label = count > 0 ? `${item.label}: ${count}` : item.label
const base = cn( const base = cn(
"relative flex h-9 items-center rounded-lg text-sm font-medium transition-colors", "relative flex h-8.5 items-center rounded-lg text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-primary/60",
collapsed ? "justify-center" : "gap-3 px-3", collapsed ? "justify-center" : "gap-3 px-3",
) )
@ -216,10 +220,12 @@ function SidebarLink({ item, collapsed }: { item: SidebarNavItem; collapsed: boo
className={cn( className={cn(
base, base,
"group/link", "group/link",
active ? "bg-sidebar-accent text-white" : "text-sidebar-foreground/85 hover:bg-white/[0.04] hover:text-white", active
? "bg-sidebar-accent text-white ring-1 ring-inset ring-white/[0.05]"
: "text-sidebar-foreground/80 hover:bg-white/[0.05] hover:text-white",
)} )}
> >
{active && <span className="absolute top-2 bottom-2 left-0 w-[3px] rounded-r-full bg-sidebar-primary" />} {active && <span className="absolute top-1.5 bottom-1.5 left-0 w-[3px] rounded-r-full bg-sidebar-primary" />}
{/* При наведении иконка окрашивается и чуть увеличивается (без анимации, если в системе «уменьшить движение»). */} {/* При наведении иконка окрашивается и чуть увеличивается (без анимации, если в системе «уменьшить движение»). */}
<Icon <Icon
className={cn( className={cn(
@ -235,7 +241,7 @@ function SidebarLink({ item, collapsed }: { item: SidebarNavItem; collapsed: boo
item.badgeTone === "warning" ? "bg-warning text-sidebar" : "bg-coral text-white", item.badgeTone === "warning" ? "bg-warning text-sidebar" : "bg-coral text-white",
collapsed collapsed
? "absolute top-0.5 right-1 min-w-4 px-1 text-3xs leading-4 ring-2 ring-sidebar" ? "absolute top-0.5 right-1 min-w-4 px-1 text-3xs leading-4 ring-2 ring-sidebar"
: "ml-auto min-w-5 px-1.5 text-2xs leading-5", : "ml-auto min-w-5 px-1.5 text-2xs leading-5 ring-1 ring-white/10",
)} )}
> >
{count > 999 ? "999+" : count} {count > 999 ? "999+" : count}
@ -254,22 +260,24 @@ function SidebarLink({ item, collapsed }: { item: SidebarNavItem; collapsed: boo
{/* Открытые карточки раздела — «зеркало» вкладок прямо в меню */} {/* Открытые карточки раздела — «зеркало» вкладок прямо в меню */}
{!collapsed && tabs.length > 0 && ( {!collapsed && tabs.length > 0 && (
<ul className="mt-0.5 ml-[21px] space-y-px border-l border-sidebar-border py-1 pl-2"> <ul className="mt-0.5 ml-[21px] space-y-px border-l border-sidebar-border/80 py-0.5 pl-2.5">
{visible.map((tab) => { {visible.map((tab) => {
const here = isHere(tab) const here = isHere(tab)
return ( return (
<li <li
key={tab.id} key={tab.id}
className={cn( className={cn(
"group/item flex h-7 items-center rounded-md text-sm transition-colors", "group/item flex h-7.5 items-center rounded-md text-sm transition-colors",
here ? "bg-white/[0.06] text-white" : "text-sidebar-muted hover:bg-white/[0.03] hover:text-sidebar-foreground", here
? "bg-white/[0.07] text-white ring-1 ring-inset ring-white/[0.04]"
: "text-sidebar-muted hover:bg-white/[0.04] hover:text-sidebar-foreground",
)} )}
> >
<button <button
type="button" type="button"
onClick={() => navigate(tab.href)} onClick={() => navigate(tab.href)}
title={tab.alert ? `${tab.label} · ${tab.alert}` : tab.label} title={tab.alert ? `${tab.label} · ${tab.alert}` : tab.label}
className="flex h-full min-w-0 flex-1 items-center gap-2 pl-2 text-left" className="flex h-full min-w-0 flex-1 items-center gap-2 pl-2 text-left outline-none focus-visible:text-white"
> >
<span className={cn("size-1.5 shrink-0 rounded-full", toneDot(tab.tone, "bg-sidebar-muted"))} /> <span className={cn("size-1.5 shrink-0 rounded-full", toneDot(tab.tone, "bg-sidebar-muted"))} />
<span className="truncate">{tab.label}</span> <span className="truncate">{tab.label}</span>
@ -282,7 +290,7 @@ function SidebarLink({ item, collapsed }: { item: SidebarNavItem; collapsed: boo
type="button" type="button"
aria-label={`Закрыть ${tab.label}`} aria-label={`Закрыть ${tab.label}`}
onClick={() => closeTab(item.tabsSection!, tab.id)} onClick={() => closeTab(item.tabsSection!, tab.id)}
className="absolute inset-0.5 grid place-items-center rounded text-sidebar-muted opacity-0 transition group-hover/item:opacity-100 hover:bg-white/10 hover:text-white focus-visible:opacity-100" className="absolute inset-0.5 grid place-items-center rounded text-sidebar-muted opacity-0 transition group-hover/item:opacity-100 hover:bg-white/10 hover:text-white focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-primary/60"
> >
<XIcon className="size-3.5" /> <XIcon className="size-3.5" />
</button> </button>
@ -296,7 +304,7 @@ function SidebarLink({ item, collapsed }: { item: SidebarNavItem; collapsed: boo
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<button <button
type="button" type="button"
className="flex h-6 w-full items-center gap-1.5 rounded-md px-2 text-2xs text-sidebar-muted transition hover:bg-white/[0.03] hover:text-sidebar-foreground data-[state=open]:text-sidebar-foreground" className="flex h-7 w-full items-center gap-1.5 rounded-md px-2 text-2xs text-sidebar-muted transition hover:bg-white/[0.04] hover:text-sidebar-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-primary/60 data-[state=open]:bg-white/[0.04] data-[state=open]:text-sidebar-foreground"
> >
ещё {hidden.length} ещё {hidden.length}
{hidden.some((t) => t.alert) && <span className="size-1.5 rounded-full bg-coral" />} {hidden.some((t) => t.alert) && <span className="size-1.5 rounded-full bg-coral" />}
@ -342,8 +350,8 @@ function UserMenu({ user, collapsed, menu }: { user: SidebarUser; collapsed: boo
type="button" type="button"
aria-label={collapsed ? user.name : undefined} aria-label={collapsed ? user.name : undefined}
className={cn( className={cn(
"flex min-w-0 items-center gap-2.5 rounded-lg p-1.5 text-left transition hover:bg-white/[0.05]", "flex min-w-0 items-center gap-2.5 rounded-lg text-left transition-colors hover:bg-white/[0.06] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-primary/60",
collapsed ? "justify-center" : "flex-1", collapsed ? "size-9 justify-center p-0" : "flex-1 p-1.5",
)} )}
> >
<Avatar className="size-8 rounded-lg"> <Avatar className="size-8 rounded-lg">
@ -379,7 +387,7 @@ function SidebarIconButton({ label, onClick, children }: { label: string; onClic
type="button" type="button"
aria-label={label} aria-label={label}
onClick={onClick} onClick={onClick}
className="grid size-8 shrink-0 place-items-center rounded-lg text-sidebar-muted transition hover:bg-white/[0.06] hover:text-white [&_svg]:size-4" className="grid size-8 shrink-0 place-items-center rounded-lg text-sidebar-muted transition-colors hover:bg-white/[0.07] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-primary/60 [&_svg]:size-4"
> >
{children} {children}
</button> </button>