From 3473cd9ef180626fef5235bce166d82150e49cdb Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 17 Nov 2026 18:14:08 +0300 Subject: [PATCH] feat(ui): register favorite star and glyph-only actions --- apps/catalog/src/CatalogApp.tsx | 5 ++++- docs/FAVORITES.md | 5 +++++ package-lock.json | 2 +- packages/ui-react/package.json | 2 +- packages/ui-react/src/Button.tsx | 5 +++++ packages/ui-react/src/Icon.tsx | 2 ++ registry/components.json | 1 + registry/icons.json | 3 ++- 8 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 docs/FAVORITES.md diff --git a/apps/catalog/src/CatalogApp.tsx b/apps/catalog/src/CatalogApp.tsx index 3bbb716..4d565cb 100644 --- a/apps/catalog/src/CatalogApp.tsx +++ b/apps/catalog/src/CatalogApp.tsx @@ -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 = { + star: "Избранное", pipette: "Пипетка", ruler: "Линейка", section: "Секущая плоскость", isolate: "Изолировать элемент", power: "Питание", @@ -1859,6 +1860,8 @@ export function CatalogApp() {
+ + diff --git a/docs/FAVORITES.md b/docs/FAVORITES.md new file mode 100644 index 0000000..1365442 --- /dev/null +++ b/docs/FAVORITES.md @@ -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. diff --git a/package-lock.json b/package-lock.json index 951b37d..fe48f8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/packages/ui-react/package.json b/packages/ui-react/package.json index 345f43f..cd8237f 100644 --- a/packages/ui-react/package.json +++ b/packages/ui-react/package.json @@ -1,6 +1,6 @@ { "name": "@nodedc/ui-react", - "version": "0.7.5", + "version": "0.7.6", "type": "module", "files": [ "dist" diff --git a/packages/ui-react/src/Button.tsx b/packages/ui-react/src/Button.tsx index 5c9f341..8ea15af 100644 --- a/packages/ui-react/src/Button.tsx +++ b/packages/ui-react/src/Button.tsx @@ -65,12 +65,16 @@ export const Button = forwardRef(function Button export interface IconButtonProps extends ButtonHTMLAttributes { 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(function IconButton({ label, shape = "circle", + surface = "default", + style, className, children, type = "button", @@ -84,6 +88,7 @@ export const IconButton = forwardRef(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} diff --git a/packages/ui-react/src/Icon.tsx b/packages/ui-react/src/Icon.tsx index e00bc25..034fb05 100644 --- a/packages/ui-react/src/Icon.tsx +++ b/packages/ui-react/src/Icon.tsx @@ -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, diff --git a/registry/components.json b/registry/components.json index 22d796c..7be6720 100644 --- a/registry/components.json +++ b/registry/components.json @@ -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.", diff --git a/registry/icons.json b/registry/icons.json index 1fa519c..6b8f7a8 100644 --- a/registry/icons.json +++ b/registry/icons.json @@ -107,7 +107,8 @@ "shield", "circle", "eye", - "eye-off" + "eye-off", + "star" ] }, {