Release 0.10.0: StatusBadge/Chip sizes, EditDialog and FilterBar panel refresh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
00c54130ac
commit
eca5298725
16
CHANGELOG.md
16
CHANGELOG.md
|
|
@ -2,6 +2,22 @@
|
|||
|
||||
Установка версии: `npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^X.Y.Z"`. На 0.x `^0.7.0` не подхватывает 0.8.0 — минорную версию поднимаем в зависимости явно.
|
||||
|
||||
## [0.10.0] — 2026-10-26
|
||||
|
||||
### Новое
|
||||
- `StatusBadge`: проп `size` — `"sm"` для плотных строк таблиц, `"md"` (по умолчанию, как раньше), `"lg"` для шапки карточки или страницы.
|
||||
- `Chip`: размер `size="lg"` — крупный чип высотой 32px.
|
||||
|
||||
### Изменено
|
||||
- `EditDialog`: новая шапка — иконка на цветной плашке, заголовок и описание рядом; подвал на сером фоне с подсказкой «Enter в поле — сохранить».
|
||||
- `FilterBar`: на «Ещё» вместо счётчика — точка над подписью, когда включены расширенные фильтры, как у «Сбросить»; число — в подсказке. Панель справа — плавающая карточка с отступом от края и иконкой в заголовке, кнопки внизу обычного размера.
|
||||
- `FilterSwitch`: строка-карточка с рамкой, нажимается целиком; включённая подсвечена акцентным цветом.
|
||||
- `Dialog`, `AlertDialog`, `Sheet`: фон — цвет карточки (`bg-card`) вместо фона страницы. Бегунок `Switch` — тоже цвета карточки, с лёгкой тенью.
|
||||
|
||||
### Исправлено
|
||||
- `DateRangeInput`: пустота перед «—» была вдвое больше, чем после, — поле шире текста даты. У растянутого поля (`className="w-full"`) кнопка календаря теперь у правого края.
|
||||
- `DataTable`: у последней строки в растянутой таблице не было линии снизу; у прокрученной до конца линия не задваивается с рамкой.
|
||||
|
||||
## [0.9.2] — 2026-10-26
|
||||
|
||||
### Изменено
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ src/styles.css тема (токены, шрифты, тёмный режим)
|
|||
Пакет ставится прямо из git, версии — теги `vX.Y.Z`:
|
||||
|
||||
```bash
|
||||
npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^0.9.2"
|
||||
npm i "git+https://git.med-logic.ru/medlogic/medkit.git#semver:^0.10.0"
|
||||
```
|
||||
|
||||
`package-lock.json` фиксирует коммит; обновиться до свежего тега — `npm update @medkit/ui`. В medicine-ui kit подключён git-submodule в `packages/medkit` (npm workspace) — правки видны сразу.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@medkit/ui",
|
||||
"version": "0.9.2",
|
||||
"version": "0.10.0",
|
||||
"private": true,
|
||||
"description": "Medkit — UI kit МИС «Медицина»: React 19 + Tailwind 4 + Radix (shadcn/ui)",
|
||||
"repository": {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ const toneClass: Record<ChipTone, Record<ChipVariant | "hover", string>> = {
|
|||
}
|
||||
|
||||
const sizeClass = {
|
||||
sm: { root: "h-5 gap-1 px-1.5 text-2xs", remove: "pr-0.5", x: "size-4" },
|
||||
md: { root: "h-6 gap-1.5 px-2.5 text-xs", remove: "pr-1", x: "size-4.5" },
|
||||
sm: { root: "h-5 gap-1 px-1.5 text-2xs", remove: "pr-0.5", x: "size-4", count: "text-2xs" },
|
||||
md: { root: "h-6 gap-1.5 px-2.5 text-xs", remove: "pr-1", x: "size-4.5", count: "text-2xs" },
|
||||
lg: { root: "h-8 gap-2 px-3 text-sm [&_svg]:size-3.5", remove: "pr-1.5", x: "size-5.5", count: "text-xs" },
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +73,7 @@ export function Chip({
|
|||
}: {
|
||||
tone?: ChipTone
|
||||
variant?: ChipVariant
|
||||
size?: "sm" | "md"
|
||||
size?: "sm" | "md" | "lg"
|
||||
selected?: boolean
|
||||
onClick?: () => void
|
||||
count?: number
|
||||
|
|
@ -100,7 +101,7 @@ export function Chip({
|
|||
<>
|
||||
{icon}
|
||||
{children}
|
||||
{count != null && <span className="font-mono text-2xs tabular-nums opacity-70">{count}</span>}
|
||||
{count != null && <span className={cn("font-mono tabular-nums opacity-70", sizes.count)}>{count}</span>}
|
||||
</>
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,13 @@ export function nextSort(current: SortState | null, id: string): SortState | nul
|
|||
* `grow`-колонка сжимается первой, а уже `cardsBelow` (640px) строки показываются карточками `renderCard`.
|
||||
* Если колонки всё равно не влезают — оберните таблицу в `<ScrollArea horizontal>`.
|
||||
*/
|
||||
/**
|
||||
* Линия строки. У последней — тень вместо border: тень не входит в область прокрутки,
|
||||
* поэтому в растянутой таблице линия видна, а у прокрученной до конца не задваивается с рамкой снизу.
|
||||
*/
|
||||
const rowLine =
|
||||
"border-b border-border/60 last:border-b-0 last:*:shadow-[0_1px_0_color-mix(in_oklab,var(--border)_60%,transparent)]"
|
||||
|
||||
export function DataTable<T>({
|
||||
columns,
|
||||
rows,
|
||||
|
|
@ -189,7 +196,8 @@ export function DataTable<T>({
|
|||
{...extra}
|
||||
onClick={onRowClick ? (e) => onRowClick(row, e) : extra?.onClick}
|
||||
className={cn(
|
||||
"border-b border-border/60 transition-colors last:border-b-0",
|
||||
rowLine,
|
||||
"transition-colors",
|
||||
onRowClick && "cursor-pointer hover:bg-muted/50",
|
||||
rowClassName?.(row, i),
|
||||
extra?.className,
|
||||
|
|
@ -205,7 +213,7 @@ export function DataTable<T>({
|
|||
})}
|
||||
{skeleton &&
|
||||
Array.from({ length: 6 }, (_, i) => (
|
||||
<tr key={i} className="border-b border-border/60 last:border-b-0">
|
||||
<tr key={i} className={rowLine}>
|
||||
{visible.map((col, c) => (
|
||||
<td key={col.id} className="px-3 py-3.5 first:pl-5 last:pr-5">
|
||||
<Skeleton className={cn("h-3.5", c === 0 ? "w-12" : c % 2 ? "w-3/4" : "w-1/2")} />
|
||||
|
|
|
|||
|
|
@ -88,7 +88,9 @@ export function DateRangeInput({
|
|||
popover.setOpen(false)
|
||||
}
|
||||
|
||||
const input = "w-[6.6rem] flex-none px-2.5 tabular"
|
||||
// Ширина — по тексту даты (≈5em у 14–16px) плюс отступы поля: без хвоста справа,
|
||||
// иначе пустота перед «—» вдвое больше, чем после.
|
||||
const input = "w-[calc(5.1em+1.125rem)] flex-none px-2.5 tabular"
|
||||
// Фокус после закрытия календаря возвращается в то поле, где человек был последним.
|
||||
const remember = (e: React.FocusEvent<HTMLInputElement>) => {
|
||||
popover.returnFocus.current = e.currentTarget
|
||||
|
|
@ -128,7 +130,8 @@ export function DateRangeInput({
|
|||
onKeyDown={popover.onKeyDown}
|
||||
className={input}
|
||||
/>
|
||||
<InputGroupAddon align="inline-end">
|
||||
{/* ml-auto — у растянутого поля (className="w-full") кнопка остаётся у правого края. */}
|
||||
<InputGroupAddon align="inline-end" className="ml-auto">
|
||||
<InputGroupButton
|
||||
size="icon-xs"
|
||||
aria-label="Открыть календарь"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import type { LucideIcon } from "lucide-react"
|
|||
|
||||
import { Button } from "../ui/button"
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../ui/dialog"
|
||||
import { Kbd } from "../ui/kbd"
|
||||
import { cn } from "../lib/utils"
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +33,12 @@ export function EditDialog({
|
|||
}) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className={cn("gap-0 p-0 sm:max-w-xl", className)}>
|
||||
<DialogContent
|
||||
className={cn(
|
||||
"gap-0 overflow-hidden rounded-xl border-0 p-0 shadow-2xl ring-1 ring-primary/15 sm:max-w-xl",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<form
|
||||
noValidate
|
||||
onSubmit={(e) => {
|
||||
|
|
@ -40,15 +46,22 @@ export function EditDialog({
|
|||
if (canSave) onSave()
|
||||
}}
|
||||
>
|
||||
<DialogHeader className="border-b px-5 py-4">
|
||||
<DialogTitle className="flex items-center gap-2 text-base">
|
||||
{Icon && <Icon className="size-4 text-primary" />}
|
||||
{title}
|
||||
</DialogTitle>
|
||||
<DialogHeader className="flex-row items-center gap-3 border-b border-primary/10 bg-primary/5 px-5 py-4 pr-12 text-left sm:text-left">
|
||||
{Icon && (
|
||||
<span className="grid size-9 shrink-0 place-items-center rounded-lg bg-primary text-primary-foreground shadow-sm shadow-primary/30">
|
||||
<Icon className="size-4.5" />
|
||||
</span>
|
||||
)}
|
||||
<div className="min-w-0 space-y-0.5">
|
||||
<DialogTitle className="text-base">{title}</DialogTitle>
|
||||
{description && <DialogDescription className="text-xs">{description}</DialogDescription>}
|
||||
</div>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4 px-5 py-5">{children}</div>
|
||||
<DialogFooter className="border-t px-5 py-3">
|
||||
<DialogFooter className="items-center border-t bg-muted/50 px-5 py-3">
|
||||
<span className="mr-auto hidden items-center gap-1.5 text-xs text-muted-foreground sm:flex">
|
||||
<Kbd className="border bg-background">Enter</Kbd> в поле — сохранить
|
||||
</span>
|
||||
<Button type="button" variant="ghost" onClick={() => onOpenChange(false)}>
|
||||
Отмена
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { RotateCwIcon, SlidersHorizontalIcon } from "lucide-react"
|
|||
|
||||
import { cn } from "../lib/utils"
|
||||
import { Button } from "../ui/button"
|
||||
import { Label } from "../ui/label"
|
||||
import { ScrollArea } from "../ui/scroll-area"
|
||||
import {
|
||||
Sheet,
|
||||
|
|
@ -19,7 +18,7 @@ import { Switch } from "../ui/switch"
|
|||
|
||||
/**
|
||||
* Панель фильтров списка: основные фильтры в строку, расширенные (`more`) — в панели справа,
|
||||
* которую открывает кнопка «Ещё» со счётчиком включённых; «Ещё» и «Сбросить» (с точкой, когда есть что сбросить) — всегда справа.
|
||||
* которую открывает кнопка «Ещё»; «Ещё» и «Сбросить» — всегда справа, с точкой над подписью, когда что-то включено.
|
||||
* Поиску внутри дают `className="min-w-40 flex-1"` — он забирает свободное место.
|
||||
* Фильтры в панели применяются сразу, как и в строке; поля внутри — `FormField`, переключатели — `FilterSwitch`.
|
||||
*/
|
||||
|
|
@ -34,7 +33,7 @@ export function FilterBar({
|
|||
}: {
|
||||
/** Расширенные фильтры — показываются в панели справа по кнопке «Ещё». */
|
||||
more?: React.ReactNode
|
||||
/** Сколько из `more` включено — счётчик на кнопке «Ещё». */
|
||||
/** Сколько из `more` включено: точка на «Ещё», число — в подсказке. */
|
||||
moreCount?: number
|
||||
/** Заголовок панели. */
|
||||
moreTitle?: string
|
||||
|
|
@ -55,30 +54,43 @@ export function FilterBar({
|
|||
{more != null && (
|
||||
<Sheet>
|
||||
<SheetTrigger asChild>
|
||||
<Button variant="outline" size="sm" className="shrink-0">
|
||||
<SlidersHorizontalIcon /> Ещё
|
||||
<Count value={moreCount} />
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
title={moreCount ? `Включено расширенных фильтров: ${moreCount}` : undefined}
|
||||
className="shrink-0"
|
||||
>
|
||||
<SlidersHorizontalIcon />
|
||||
<Dotted on={moreCount > 0}>Ещё</Dotted>
|
||||
</Button>
|
||||
</SheetTrigger>
|
||||
<SheetContent side="right" className="gap-0 sm:max-w-sm">
|
||||
{/* Как модальное окно кита (EditDialog): плавающая карточка с отступом от края,
|
||||
шапка с иконкой, поля — на белых карточках, «Отмена/Готово» — внизу. */}
|
||||
<SheetContent
|
||||
side="right"
|
||||
className="inset-y-2 right-2 h-auto w-[calc(100%-1rem)] gap-0 overflow-hidden rounded-xl border sm:max-w-sm"
|
||||
>
|
||||
<SheetHeader className="border-b px-5 py-4 pr-12">
|
||||
<SheetTitle>{moreTitle}</SheetTitle>
|
||||
<SheetTitle className="flex items-center gap-2 text-base">
|
||||
<SlidersHorizontalIcon className="size-4 text-primary" />
|
||||
{moreTitle}
|
||||
</SheetTitle>
|
||||
{/* Описание нужно Radix для доступности; видно только скринридерам. */}
|
||||
<SheetDescription className="sr-only">Фильтры применяются сразу</SheetDescription>
|
||||
</SheetHeader>
|
||||
<ScrollArea className="min-h-0 flex-1">
|
||||
<div className="flex flex-col gap-5 p-5">{more}</div>
|
||||
<div className="flex flex-col gap-4 p-5">{more}</div>
|
||||
</ScrollArea>
|
||||
<SheetFooter className="flex-row justify-between border-t px-5 py-3">
|
||||
<SheetFooter className="flex-row items-center justify-between border-t px-5 py-3">
|
||||
{onReset ? (
|
||||
<Button variant="ghost" size="sm" disabled={!activeCount} onClick={onReset} className="text-muted-foreground">
|
||||
<Button variant="ghost" disabled={!activeCount} onClick={onReset} className="text-muted-foreground">
|
||||
<RotateCwIcon /> Сбросить все
|
||||
</Button>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
<SheetClose asChild>
|
||||
<Button size="sm">Готово</Button>
|
||||
<Button>Готово</Button>
|
||||
</SheetClose>
|
||||
</SheetFooter>
|
||||
</SheetContent>
|
||||
|
|
@ -94,11 +106,7 @@ export function FilterBar({
|
|||
className="text-muted-foreground"
|
||||
>
|
||||
<RotateCwIcon />
|
||||
{/* Точка над концом подписи — «есть что сбросить»; вне потока, ширина кнопки не меняется. */}
|
||||
<span className="relative">
|
||||
Сбросить
|
||||
{activeCount > 0 && <span aria-hidden className="absolute -top-0.5 -right-2 size-1.5 rounded-full bg-primary" />}
|
||||
</span>
|
||||
<Dotted on={activeCount > 0}>Сбросить</Dotted>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -107,7 +115,10 @@ export function FilterBar({
|
|||
)
|
||||
}
|
||||
|
||||
/** Переключатель для панели расширенных фильтров: подпись слева, тумблер справа, подсказка под подписью. */
|
||||
/**
|
||||
* Переключатель для панели расширенных фильтров: строка-карточка — подпись и подсказка слева,
|
||||
* тумблер справа; нажимается вся строка. Включённая строка подсвечена рамкой акцентного цвета.
|
||||
*/
|
||||
export function FilterSwitch({
|
||||
id,
|
||||
label,
|
||||
|
|
@ -122,28 +133,29 @@ export function FilterSwitch({
|
|||
onCheckedChange: (checked: boolean) => void
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-start justify-between gap-4">
|
||||
<div className="space-y-0.5">
|
||||
<Label htmlFor={id} className="font-normal">
|
||||
{label}
|
||||
</Label>
|
||||
{hint && <p className="text-xs text-muted-foreground">{hint}</p>}
|
||||
</div>
|
||||
<label
|
||||
htmlFor={id}
|
||||
className={cn(
|
||||
"flex cursor-pointer items-center justify-between gap-4 rounded-lg border bg-card px-3.5 py-3 shadow-xs transition-colors hover:border-primary/30",
|
||||
checked && "border-primary/40 bg-primary/5",
|
||||
)}
|
||||
>
|
||||
<span className="space-y-0.5">
|
||||
<span className="block text-sm font-medium">{label}</span>
|
||||
{hint && <span className="block text-xs text-muted-foreground">{hint}</span>}
|
||||
</span>
|
||||
<Switch id={id} checked={checked} onCheckedChange={onCheckedChange} />
|
||||
</div>
|
||||
</label>
|
||||
)
|
||||
}
|
||||
|
||||
/** Счётчик на «Ещё»: ноль — еле заметный, чтобы было видно, что расширенные фильтры есть, но не включены. */
|
||||
function Count({ value }: { value: number }) {
|
||||
/** Подпись кнопки с точкой над концом, когда что-то включено; точка вне потока — ширина кнопки не меняется. */
|
||||
function Dotted({ on, children }: { on: boolean; children: React.ReactNode }) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
"grid min-w-4.5 place-items-center rounded-full px-1 text-2xs font-semibold tabular",
|
||||
value > 0 ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground/60",
|
||||
)}
|
||||
>
|
||||
{value}
|
||||
// mr-1 — запас под точку внутри кнопки, чтобы она не прилипала к рамке; есть всегда, ширина постоянная.
|
||||
<span className="relative mr-1">
|
||||
{children}
|
||||
{on && <span aria-hidden className="absolute top-0.5 -right-2 size-1.5 rounded-full bg-primary" />}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,15 +45,26 @@ export function StatusDot({
|
|||
)
|
||||
}
|
||||
|
||||
/** Статус с цветной точкой: «Работает», «Записан», «Неявка»… `pulse` — точка мигает («Подключение…»). */
|
||||
const sizeClass = {
|
||||
sm: "gap-1 px-1.5 py-px text-2xs",
|
||||
md: "gap-1.5 px-2 py-0.5 text-xs",
|
||||
lg: "gap-2 px-2.5 py-1 text-sm",
|
||||
}
|
||||
|
||||
/**
|
||||
* Статус с цветной точкой: «Работает», «Записан», «Неявка»… `pulse` — точка мигает («Подключение…»).
|
||||
* `size="sm"` — в плотных строках таблиц и рядом с мелкими метками, `"lg"` — в шапке карточки или страницы.
|
||||
*/
|
||||
export function StatusBadge({
|
||||
tone,
|
||||
size = "md",
|
||||
dot = true,
|
||||
pulse,
|
||||
className,
|
||||
children,
|
||||
}: {
|
||||
tone: StatusTone
|
||||
size?: "sm" | "md" | "lg"
|
||||
dot?: boolean
|
||||
pulse?: boolean
|
||||
className?: string
|
||||
|
|
@ -62,12 +73,13 @@ export function StatusBadge({
|
|||
return (
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-xs font-semibold whitespace-nowrap",
|
||||
"inline-flex items-center rounded-md border font-semibold whitespace-nowrap",
|
||||
sizeClass[size],
|
||||
toneClass[tone],
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{dot && <StatusDot pulse={pulse} />}
|
||||
{dot && <StatusDot pulse={pulse} className={cn(size === "lg" && "size-2")} />}
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ function AlertDialogContent({
|
|||
data-slot="alert-dialog-content"
|
||||
data-size={size}
|
||||
className={cn(
|
||||
"group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
|
||||
"group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function DialogContent({
|
|||
<DialogPrimitive.Content
|
||||
data-slot="dialog-content"
|
||||
className={cn(
|
||||
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
||||
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function SheetContent({
|
|||
<SheetPrimitive.Content
|
||||
data-slot="sheet-content"
|
||||
className={cn(
|
||||
"fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",
|
||||
"fixed z-50 flex flex-col gap-4 bg-card shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",
|
||||
side === "right" &&
|
||||
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
||||
side === "left" &&
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function Switch({
|
|||
<SwitchPrimitive.Thumb
|
||||
data-slot="switch-thumb"
|
||||
className={cn(
|
||||
"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
|
||||
"pointer-events-none block rounded-full bg-card shadow-xs ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
|
||||
)}
|
||||
/>
|
||||
</SwitchPrimitive.Root>
|
||||
|
|
|
|||
Loading…
Reference in New Issue