Лист действий для Angular | ng-hub-ui-action-sheet

Лист действий для Angular, открываемый из сервиса: действия с ролями, плоские или сгруппированные, обработчики, способные отказать в закрытии, и закрытие фоном, клавиатурой или перетаскиванием.

Последнее обновление 20 сент. 2026 г.

Обзор

Почему команды ищут эту библиотеку

Используйте ng-hub-ui-action-sheet, когда строка или кнопка панели должна предложить несколько действий поверх текущего экрана, без компонента меню, который остаётся в странице ради листа, который никто ещё не открывал.

Установка

npm install ng-hub-ui-action-sheet

Перейти к

Идеально для

О библиотеке action-sheet

ng-hub-ui-action-sheet — standalone-библиотека Angular, которая открывает лист из сервиса и разрешается один раз тем, что выбрал читатель. У действий есть роль: `cancel` уходит в конец, где бы его ни объявили, а `destructive` получает цвет опасности. Действия перечисляются подряд или под заголовками групп, а handler может отказать в закрытии, так что подтверждение успевает отработать до исчезновения листа. Выходов три — фон, `Escape` и протягивание листа вниз, — каждый сообщает свою роль и сначала выполняет handler действия отмены. Лист — это `role="dialog"` с `aria-modal`, названный своим заголовком, и фокус входит в него при открытии.

Руководства по возможностям

Открытие листа

Лист открывается из сервиса и отвечает один раз, поэтому, пока он закрыт, на странице от него ничего не остаётся.

Примеры:
Открытие листа

Заголовок, три действия и выход; вызов разрешается выбором.

Nothing chosen yet
Код
Import:
Template:
Component:

Роли и обработчики

Роль решает, где стоит действие и как оно читается; обработчик решает, может ли лист закрыться.

Примеры:
Роли и обработчик, который отказывает

Деструктивное действие в первый раз падает и оставляет лист открытым.

The first attempt always fails, on purpose
Код
Import:
Template:
Component:

Сгруппированные действия

Блоки с собственными заголовками — для листа, который слишком длинен, чтобы плоский список читался.

Примеры:
Сгруппированные действия

Блоки с заголовками, текущий формат отмечен, одно действие отключено.

Export format: pdf
Код
Import:
Template:
Component:

Акцент и токены

Один семантический акцент на весь лист и CSS-переменная для каждого визуального решения под ним.

Примеры:
Акцент и токены

Тот же лист с семантическим акцентом и с фирменными токенами.

The accent colours the selected action; the branded sheet also changes its radius, its touch targets and the width it is allowed to take.

Код
Import:
Template:
Component:

Ключевые возможности

Последние изменения

Version 22.2.2 - 9/20/26, 12:00 AM

changed: The npm keywords name what the package does — sheet, dialog, menu, overlay, focus-trap, swipe-to-close, accessibility — instead of stopping at the generic ones. Keywords are what npm ranks a search on. Metadata only: no code, types or styles change.

Version 22.2.1 - 9/16/26, 12:00 AM

changed: Repository, issue and README links follow the move to the hub-env organization. Issues for every Hub UI package are now gathered in hub-env/hub-ui, and the repository and bugs fields of the manifest point at the new addresses. No code, types or styles change.

Version 22.2.0 - 9/8/26, 12:00 AM

deprecated: `HubActionSheetComponent` is announced for removal in 23.0.0. The entry point exported it while this page said the library has no template API; the page was the true half. The class cannot be used from a template — `sheetRef` demands a `HubActionSheetRef` whose closing half is `@internal` and wired by `HubActionSheet.open()`, so a hand-mounted sheet resolves its promise and then stays on screen behind a fixed backdrop that traps `Tab` across the document. Nothing changes at runtime; this release is the notice. See `BREAKING_CHANGES.md`.

changed: `public-api.ts` lists the component by name instead of re-exporting its whole file, so the symbol on its way out is named where it is exported. `HubResolvedActionSheetOptions` is unaffected and stays exported.

Version 22.1.0 - 9/7/26, 12:00 AM

fixed: A `:root` in the application now reaches the sheet. The `--hub-action-sheet-*` defaults were declared in a `:root, :host` block, and the encapsulation shim turns the `:root` half into a selector nothing matches — so what survived declared every token straight on the `<hub-action-sheet>` element, and a declaration on an element beats an inherited value whatever its specificity. Every `:root` an application wrote for this library was dead, `!important` included. Each token is now read where it is painted, `var(--hub-action-sheet-x, <default>)`, with the same component → design-system → literal chain as before. See `BREAKING_CHANGES.md`: a `:root` block that never did anything starts doing it.

fixed: A `panelClass` that re-bases `--hub-action-sheet-accent` now recolours the selected action. The accent roles were derived on the host, above the element the class lands on, so the derived value was already fixed by the time the branded class changed the slot. They are derived where the colour is painted, so `:root`, `panelClass` and `variant` all recompute the selection.

changed: `--hub-action-sheet-accent-emphasis` is declared on the sheet element rather than on the host. Nothing in the component paints with it — it is the accent family's third role, there for a consumer dressing the sheet — and declaring it beside the accent means a `panelClass` re-basing the slot recomputes it.

changed: The two READMEs and `docs/css-variables-reference.md` say why both entry points work. Setting a token on `:root` and setting it through `panelClass` were documented side by side without saying which wins, and one of the two did not work at all.

Version 22.0.2 - 9/6/26, 12:00 AM

added: `FUNCTIONALITIES.md`, the map every other library in the family already had, so a reader can tell a feature that only lives in a code snippet from one a live example demonstrates.

changed: The configuration surface the package exports is written down: `HUB_ACTION_SHEET_CONFIG`, `HUB_ACTION_SHEET_DEFAULTS` and the `HubActionSheetConfig` interface, whose `variant` and `panelClass` settle an application's accent and sheet class once. Until now the only way to find any of it was to read the sources.

changed: `HubActionSheetRef.settled` is listed in the API tables. It is public and both READMEs already documented it, but the page a reader looks at first did not.

changed: The page's changelog is the released one. It stopped at `22.0.0`, dated before the published `22.0.1`, and its `22.0.0` entry left out `provideHubActionSheet()` and the CSS variable theming the release notes list; a changelog that lags the registry teaches the reader not to trust it.

changed: Both READMEs describe a library on the stable line rather than one in its early stages, and list the family that exists today. The Spanish one also dropped its note announcing documentation pages that have been live for a week, since two READMEs that disagree are worse than one that is merely terse.

fixed: `docs/css-variables-reference.md` gave `--hub-ref-space-1` a default of `0.5rem`, twice the `0.25rem` both readings of the token actually fall back to, so anyone sizing their own scale from that table was working from the wrong number. The two design-system tokens it omitted, `--hub-sys-color-surface-subtle` and `--hub-sys-color-ink`, are listed as well.

fixed: The hover background of an action falls back to `#f8f9fa`, the value it is declared with, instead of an `rgba(0, 0, 0, 0.05)` literal that could never be reached and contradicted the documented default.

fixed: The action with the `selected` role announces itself with `aria-current="true"` instead of `aria-checked`, which is not defined for a plain button and left the state visible only to readers who could see the sheet.

Version 22.0.1 - 9/1/26, 12:00 AM

changed: The `homepage` in the package manifest points at this library's own documentation page rather than at the site root. Metadata only — nothing a consumer imports is affected.

Version 22.0.0 - 8/30/26, 12:00 AM

added: `HubActionSheet.open()` returns a `HubActionSheetRef` whose `result` resolves once, with the role and data of the chosen action or with how the sheet was dismissed.

added: Actions with roles: `cancel` is set apart at the end wherever it was declared, `destructive` reads in the danger colour, `selected` is marked, and a handler returning `false` keeps the sheet open.

added: Grouped actions with an optional title per block, plus header and sub-header.

added: Dismissal by backdrop, `Escape` and by dragging the sheet down, each reporting its own role and running the cancel action first.

added: `role="dialog"` with `aria-modal`, focus moved in on open, trapped while the sheet lives and returned to the opener on close.

added: `provideHubActionSheet()` sets the defaults every sheet starts from — the four behaviour flags plus `variant` and `panelClass` — overridable per call.

added: CSS variable theming through the `--hub-action-sheet-*` tokens, with the semantic accent on the single-slot contract the rest of the family uses (`variant`), and motion that steps aside under `prefers-reduced-motion`.

removed: The placeholder `ActionSheet` component (selector `lib-action-sheet`) that the pre-release package shipped.

Связанные библиотеки