feat(ui): register favorite star and glyph-only actions

This commit is contained in:
Codex
2026-11-17 18:14:08 +03:00
parent 753d4d6edc
commit 3473cd9ef1
8 changed files with 21 additions and 4 deletions
+4 -1
View File
@@ -235,7 +235,7 @@ const iconGroups: Array<{ title: string; note: string; icons: IconName[] }> = [
{
title: "Состояние и доступ",
note: "Вся платформа",
icons: ["check", "alert", "info", "info-plain", "activity", "lock", "unlock", "key", "shield", "circle", "eye", "eye-off"],
icons: ["check", "alert", "info", "info-plain", "activity", "lock", "unlock", "key", "shield", "circle", "eye", "eye-off", "star"],
},
{
title: "Сущности",
@@ -250,6 +250,7 @@ const iconGroups: Array<{ title: string; note: string; icons: IconName[] }> = [
];
const iconLabels: Record<IconName, string> = {
star: "Избранное",
pipette: "Пипетка",
ruler: "Линейка", section: "Секущая плоскость", isolate: "Изолировать элемент",
power: "Питание",
@@ -1859,6 +1860,8 @@ export function CatalogApp() {
<div className="catalog-icon-catalog">
<Preview title="Размеры и поверхности" note="glyph 16 px" className="catalog-preview--wide">
<div className="catalog-window-actions-demo">
<IconButton surface="none" label="В избранное" aria-pressed="false"><Icon name="star" /></IconButton>
<IconButton surface="none" label="Убрать из избранного" aria-pressed="true"><Icon name="star" fill="currentColor" /></IconButton>
<IconButton label="Камера включена" aria-pressed="true"><Icon name="camera" /></IconButton>
<IconButton label="План"><Icon name="plan" /></IconButton>
<IconButton label="Добавить"><Icon name="plus" /></IconButton>
+5
View File
@@ -0,0 +1,5 @@
# Favorites
Use the registered `star` icon in an IconButton with `aria-pressed`. The unset state is outline-only; the selected glyph uses `fill="currentColor"`. Keep the same hit target in both states. Place a card favorite action in its upper trailing corner, independent of opening the card. Persist the domain value at its owner; filtering favorites must not change it.
For a star without a surrounding disc, use `IconButton surface="none"`. The shared component owns the transparent surface and foreground; applications only position it. Keyboard focus and the hit target remain unchanged.
+1 -1
View File
@@ -2530,7 +2530,7 @@
},
"packages/ui-react": {
"name": "@nodedc/ui-react",
"version": "0.7.5",
"version": "0.7.6",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/ui-react",
"version": "0.7.5",
"version": "0.7.6",
"type": "module",
"files": [
"dist"
+5
View File
@@ -65,12 +65,16 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button
export interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
label: string;
shape?: "circle" | "rounded";
/** Glyph-only action; keeps the normal hit target and keyboard focus. */
surface?: "default" | "none";
loading?: boolean;
}
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton({
label,
shape = "circle",
surface = "default",
style,
className,
children,
type = "button",
@@ -84,6 +88,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(functio
type={type}
className={cn("nodedc-icon-button", className)}
data-shape={shape === "circle" ? undefined : shape}
style={surface === "none" ? { ...style, background: "transparent", boxShadow: "none", color: "var(--nodedc-text-primary)" } : style}
aria-label={label}
title={label}
{...props}
+2
View File
@@ -64,6 +64,7 @@ import {
ShieldCheck,
SlidersHorizontal,
Square,
Star,
Terminal,
Trash2,
UploadCloud,
@@ -156,6 +157,7 @@ const icons = {
shield: ShieldCheck,
sliders: SlidersHorizontal,
stop: Square,
star: Star,
terminal: Terminal,
trash: Trash2,
upload: UploadCloud,
+1
View File
@@ -176,6 +176,7 @@
],
"rules": [
"Icon-only actions are circular by default.",
"IconButton surface=none keeps the normal hit target and focus while removing the disc. Favorite stars use outline/filled glyph states; see docs/FAVORITES.md.",
"Groups over rendered imagery use nodedc-scene-controls: Button, IconButton, Select and SegmentedControl share the opaque field surface and interaction states; all viewport controls use the same 70-percent geometry, and rails must not inherit the translucent header background.",
"Controlled toggle actions expose aria-pressed and use the canonical active surface without changing geometry.",
"Filled accent actions derive foreground contrast from the actual accent.",
+2 -1
View File
@@ -107,7 +107,8 @@
"shield",
"circle",
"eye",
"eye-off"
"eye-off",
"star"
]
},
{