Release 0.20.0: dismissible sidebar cards, footerExtra above footer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f0468527cb
commit
d88896f40d
|
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
Установка версии: `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.20.0] — 2026-11-05
|
||||||
|
|
||||||
|
### Новое
|
||||||
|
- `SidebarCards`: у карточки проп `onDismiss`. Если он передан, при наведении и фокусе с клавиатуры на карточке появляется крестик: закрыть без перехода. Что значит «закрыть», решает приложение: например, отметить уведомление прочитанным и убрать его из `items`.
|
||||||
|
|
||||||
|
### Изменено
|
||||||
|
- `AppSidebar`: строка `footerExtra` теперь стоит над плашкой футера с пользователем, а не внутри неё, и без своего разделителя снизу.
|
||||||
|
|
||||||
## [0.19.0] — 2026-11-05
|
## [0.19.0] — 2026-11-05
|
||||||
|
|
||||||
### Новое
|
### Новое
|
||||||
|
|
|
||||||
|
|
@ -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.19.0"
|
npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^0.20.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
`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) — правки видны сразу.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@medkit/ui",
|
"name": "@medkit/ui",
|
||||||
"version": "0.19.0",
|
"version": "0.20.0",
|
||||||
"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": {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ export interface AppSidebarProps {
|
||||||
user?: SidebarUser
|
user?: SidebarUser
|
||||||
/** Пункты меню пользователя (DropdownMenuLabel, DropdownMenuItem…). */
|
/** Пункты меню пользователя (DropdownMenuLabel, DropdownMenuItem…). */
|
||||||
userMenu?: React.ReactNode
|
userMenu?: React.ReactNode
|
||||||
/** Строка в футере над пользователем (часы, окружение); получает свёрнутость меню. */
|
/** Строка над футером с пользователем (часы, окружение); получает свёрнутость меню. */
|
||||||
footerExtra?: (collapsed: boolean) => React.ReactNode
|
footerExtra?: (collapsed: boolean) => React.ReactNode
|
||||||
className?: string
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
@ -195,8 +195,9 @@ export function AppSidebar({
|
||||||
{hasCards && cardsFit && !collapsed && <SidebarCards {...cards!} />}
|
{hasCards && cardsFit && !collapsed && <SidebarCards {...cards!} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{footerExtra && <div className="shrink-0 px-3 pb-2">{footerExtra(collapsed)}</div>}
|
||||||
|
|
||||||
<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="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)]">
|
||||||
{footerExtra && <div className="mb-2 border-b border-sidebar-border pb-2">{footerExtra(collapsed)}</div>}
|
|
||||||
<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}>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { type LucideIcon } from "lucide-react"
|
import { XIcon, type LucideIcon } from "lucide-react"
|
||||||
|
|
||||||
import { useMediaQuery } from "../hooks/use-media-query"
|
import { useMediaQuery } from "../hooks/use-media-query"
|
||||||
import { ShellLink } from "./shell-provider"
|
import { ShellLink } from "./shell-provider"
|
||||||
|
|
@ -13,6 +13,8 @@ export interface SidebarCard {
|
||||||
readonly to: string
|
readonly to: string
|
||||||
/** Перед переходом (например, отметить прочитанным). */
|
/** Перед переходом (например, отметить прочитанным). */
|
||||||
readonly onClick?: () => void
|
readonly onClick?: () => void
|
||||||
|
/** Есть — при наведении на карточке крестик: закрыть без перехода. */
|
||||||
|
readonly onDismiss?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SidebarCardsProps {
|
export interface SidebarCardsProps {
|
||||||
|
|
@ -57,7 +59,7 @@ export function SidebarCards({ label, items, interval = 6000 }: SidebarCardsProp
|
||||||
// Только фокус с клавиатуры: после клика мышью ссылка остаётся в фокусе, и листание бы не возобновилось.
|
// Только фокус с клавиатуры: после клика мышью ссылка остаётся в фокусе, и листание бы не возобновилось.
|
||||||
onFocus={(e) => e.target.matches(":focus-visible") && setPaused(true)}
|
onFocus={(e) => e.target.matches(":focus-visible") && setPaused(true)}
|
||||||
onBlur={() => setPaused(false)}
|
onBlur={() => setPaused(false)}
|
||||||
className="rounded-lg border border-white/[0.08] bg-white/[0.04] p-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] transition-colors hover:border-white/[0.12] hover:bg-white/[0.07]"
|
className="group/card relative rounded-lg border border-white/[0.08] bg-white/[0.04] p-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] transition-colors hover:border-white/[0.12] hover:bg-white/[0.07]"
|
||||||
>
|
>
|
||||||
<ShellLink
|
<ShellLink
|
||||||
href={card.to}
|
href={card.to}
|
||||||
|
|
@ -65,7 +67,8 @@ export function SidebarCards({ label, items, interval = 6000 }: SidebarCardsProp
|
||||||
className="block rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-primary/60"
|
className="block rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-primary/60"
|
||||||
>
|
>
|
||||||
<span key={card.id} className="block motion-safe:duration-300 motion-safe:animate-in motion-safe:fade-in">
|
<span key={card.id} className="block motion-safe:duration-300 motion-safe:animate-in motion-safe:fade-in">
|
||||||
<span className="flex h-5 items-center gap-1.5 text-xs font-medium text-white">
|
{/* Отступ только пока виден крестик: без него название не обрезается раньше времени. */}
|
||||||
|
<span className="flex h-5 items-center gap-1.5 text-xs font-medium text-white group-focus-within/card:pr-5 group-hover/card:pr-5">
|
||||||
{Icon && <Icon className="size-3.5 shrink-0 text-sidebar-primary" />}
|
{Icon && <Icon className="size-3.5 shrink-0 text-sidebar-primary" />}
|
||||||
<span className="truncate">{card.title}</span>
|
<span className="truncate">{card.title}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -74,6 +77,16 @@ export function SidebarCards({ label, items, interval = 6000 }: SidebarCardsProp
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</ShellLink>
|
</ShellLink>
|
||||||
|
{card.onDismiss && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label={`Закрыть: ${card.title}`}
|
||||||
|
onClick={card.onDismiss}
|
||||||
|
className="absolute top-2.5 right-1.5 grid size-5 place-items-center rounded text-sidebar-muted opacity-0 transition group-hover/card: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" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue