ng-hub-ui-panels 21.2.0 → 22.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -28,12 +28,16 @@ This library is part of the **ng-hub-ui** ecosystem:
|
|
|
28
28
|
- [**ng-hub-ui-breadcrumbs**](https://www.npmjs.com/package/ng-hub-ui-breadcrumbs)
|
|
29
29
|
- [**ng-hub-ui-calendar**](https://www.npmjs.com/package/ng-hub-ui-calendar)
|
|
30
30
|
- [**ng-hub-ui-dropdown**](https://www.npmjs.com/package/ng-hub-ui-dropdown)
|
|
31
|
+
- [**ng-hub-ui-ds**](https://www.npmjs.com/package/ng-hub-ui-ds)
|
|
32
|
+
- [**ng-hub-ui-forms**](https://www.npmjs.com/package/ng-hub-ui-forms)
|
|
31
33
|
- [**ng-hub-ui-history**](https://www.npmjs.com/package/ng-hub-ui-history)
|
|
34
|
+
- [**ng-hub-ui-milestones**](https://www.npmjs.com/package/ng-hub-ui-milestones)
|
|
32
35
|
- [**ng-hub-ui-modal**](https://www.npmjs.com/package/ng-hub-ui-modal)
|
|
33
36
|
- [**ng-hub-ui-nav**](https://www.npmjs.com/package/ng-hub-ui-nav)
|
|
34
37
|
- [**ng-hub-ui-paginable**](https://www.npmjs.com/package/ng-hub-ui-paginable)
|
|
35
38
|
- [**ng-hub-ui-panels**](https://www.npmjs.com/package/ng-hub-ui-panels) ← You are here
|
|
36
39
|
- [**ng-hub-ui-portal**](https://www.npmjs.com/package/ng-hub-ui-portal)
|
|
40
|
+
- [**ng-hub-ui-skeleton**](https://www.npmjs.com/package/ng-hub-ui-skeleton)
|
|
37
41
|
- [**ng-hub-ui-sortable**](https://www.npmjs.com/package/ng-hub-ui-sortable)
|
|
38
42
|
- [**ng-hub-ui-stepper**](https://www.npmjs.com/package/ng-hub-ui-stepper)
|
|
39
43
|
- [**ng-hub-ui-utils**](https://www.npmjs.com/package/ng-hub-ui-utils)
|
|
@@ -48,6 +52,20 @@ This library is part of the **ng-hub-ui** ecosystem:
|
|
|
48
52
|
npm install ng-hub-ui-panels
|
|
49
53
|
```
|
|
50
54
|
|
|
55
|
+
> **Theming (recommended):** install the shared design tokens once so panels —
|
|
56
|
+
> and every other ng-hub-ui library — reads the same palette and dark mode:
|
|
57
|
+
>
|
|
58
|
+
> ```bash
|
|
59
|
+
> npm install ng-hub-ui-ds
|
|
60
|
+
> ```
|
|
61
|
+
> ```css
|
|
62
|
+
> @import 'ng-hub-ui-ds/styles/tokens/hub-tokens.css';
|
|
63
|
+
> ```
|
|
64
|
+
>
|
|
65
|
+
> It is an **optional** peer dependency: panels ships sensible fallbacks and
|
|
66
|
+
> works without it, but the tokens give consistent, themeable colours across the
|
|
67
|
+
> whole family (and power the alert variants).
|
|
68
|
+
|
|
51
69
|
### 2. Import
|
|
52
70
|
|
|
53
71
|
The components are standalone — import them directly where you use them:
|
|
@@ -89,6 +107,8 @@ its own.
|
|
|
89
107
|
- **Four visualizations** — `tabs`, `pills`, `accordion` and `card`, switched with a single `type` input.
|
|
90
108
|
- **Card layout & standalone** — `type="card"` renders every panel as an always-visible card; a single `<hub-panel>` also works on its own, outside any container.
|
|
91
109
|
- **Content header/footer slots** — `hubPanelHeader` and `hubPanelFooter` mark header/footer bands that render in every view (distinct from the `hubPanelHeading` nav label).
|
|
110
|
+
- **Semantic alerts** — `appearance="alert"` with a `variant` turns a panel into a themed callout (`role="alert"`) driven by the design-system semantic tokens, no per-colour CSS.
|
|
111
|
+
- **Strip accent** — `<hub-panels variant>` recolours the navigation strip (active/hover tab, active pill, active accordion header) from a single semantic accent; built-in variants use the exact design-system tints and any custom accent is picked up automatically.
|
|
92
112
|
- **Forms** — implements `ControlValueAccessor`; bind the active panel(s) to a `FormControl` or `ngModel` (single or `multiple`), with `bindValue` and `compareWith`.
|
|
93
113
|
- **Routing** — a panel with a `routerLink` turns the content area into a `<router-outlet>` that follows the URL.
|
|
94
114
|
- **Keyboard & a11y** — roving tabindex, Arrow/Home/End/Delete keys, and correct `role="tablist"`/`tab`/`tabpanel` and accordion `aria-expanded`/`aria-controls` semantics.
|
|
@@ -182,6 +202,62 @@ card by itself:
|
|
|
182
202
|
> render in **every** view. They are different from `hubPanelHeading`, which is the
|
|
183
203
|
> navigational tab label / accordion disclosure button.
|
|
184
204
|
|
|
205
|
+
### Alerts
|
|
206
|
+
|
|
207
|
+
A standalone `<hub-panel>` becomes a semantic **alert** with
|
|
208
|
+
`appearance="alert"` and a `variant`. Each variant maps to the design-system
|
|
209
|
+
`--hub-sys-color-<variant>-*` token family — there is no per-colour token set —
|
|
210
|
+
so the alert inherits every theme and dark mode automatically.
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<hub-panel appearance="alert" variant="success">Your changes were saved.</hub-panel>
|
|
214
|
+
<hub-panel appearance="alert" variant="danger">Something went wrong.</hub-panel>
|
|
215
|
+
<hub-panel appearance="alert" variant="warning">Your trial ends in 3 days.</hub-panel>
|
|
216
|
+
<hub-panel appearance="alert" variant="info">A new version is available.</hub-panel>
|
|
217
|
+
|
|
218
|
+
<!-- Omit the variant for a neutral alert -->
|
|
219
|
+
<hub-panel appearance="alert">A neutral notice.</hub-panel>
|
|
220
|
+
|
|
221
|
+
<!-- Alerts support the same header/footer slots as cards -->
|
|
222
|
+
<hub-panel appearance="alert" variant="danger">
|
|
223
|
+
<div hubPanelHeader>Payment failed</div>
|
|
224
|
+
Update your billing details to keep your subscription active.
|
|
225
|
+
<div hubPanelFooter><button class="btn btn-sm btn-danger">Update billing</button></div>
|
|
226
|
+
</hub-panel>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
> `variant` accepts the built-in `primary | success | danger | warning | info`
|
|
230
|
+
> (rendered with the exact design-system tints) **or any custom string**: the
|
|
231
|
+
> alert reads `--hub-sys-color-<variant>` from your app and derives its look with
|
|
232
|
+
> `color-mix`, so your own accent palette works with no changes here.
|
|
233
|
+
>
|
|
234
|
+
> ```html
|
|
235
|
+
> <!-- with `:root { --hub-sys-color-brand: #9333ea; }` defined in your app -->
|
|
236
|
+
> <hub-panel appearance="alert" variant="brand">On-brand callout</hub-panel>
|
|
237
|
+
> ```
|
|
238
|
+
>
|
|
239
|
+
> The alert appearance is ignored in the `tabs` / `pills` / `accordion` strip views.
|
|
240
|
+
|
|
241
|
+
### Strip accent (`variant`)
|
|
242
|
+
|
|
243
|
+
Give `<hub-panels>` a `variant` to set the **semantic accent of the navigation
|
|
244
|
+
strip** — the active/hover tab, the active pill and the active accordion header
|
|
245
|
+
all follow it. It re-bases a single `--hub-panels-accent` (with derived
|
|
246
|
+
`-emphasis` / `-subtle` roles), so changing one accent recolours the whole strip.
|
|
247
|
+
|
|
248
|
+
```html
|
|
249
|
+
<hub-panels variant="success"> … </hub-panels>
|
|
250
|
+
<hub-panels type="pills" variant="danger"> … </hub-panels>
|
|
251
|
+
<hub-panels type="accordion" variant="info"> … </hub-panels>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
> `variant` accepts the built-in `primary | success | danger | warning | info`
|
|
255
|
+
> (rendered with the exact design-system tints) **or any custom string**: the
|
|
256
|
+
> strip reads `--hub-sys-color-<variant>` from your app and derives the
|
|
257
|
+
> hover/active roles with `color-mix`, so your own accent palette works with no
|
|
258
|
+
> changes here. Defaults to `primary` when omitted. Same open-set pattern as the
|
|
259
|
+
> `<hub-panel appearance="alert">` accent.
|
|
260
|
+
|
|
185
261
|
### Vertical / Justified / Scrollable
|
|
186
262
|
|
|
187
263
|
```html
|
|
@@ -375,4 +451,4 @@ See [CHANGELOG.md](./CHANGELOG.md).
|
|
|
375
451
|
|
|
376
452
|
## 📄 License
|
|
377
453
|
|
|
378
|
-
MIT © Carlos Morcillo
|
|
454
|
+
MIT © [Carlos Morcillo](https://www.carlosmorcillo.com)
|