@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.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 +22 -48
- package/action-button/README.md +9 -11
- package/empty-state/README.md +11 -26
- package/feedback/README.md +3 -3
- package/fesm2022/cngx-ui-action-button.mjs +30 -26
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +26 -21
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +498 -261
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +32 -5
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +79 -104
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +111 -83
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-material.mjs +14 -3
- package/fesm2022/cngx-ui-material.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +22 -3
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +107 -28
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +61 -20
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +14 -5
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +484 -161
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +75 -39
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +2 -1
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/layout/README.md +9 -44
- package/mat-stepper/README.md +7 -10
- package/mat-tabs/README.md +13 -13
- package/mat-tabs/styles/mat-tabs.css +339 -213
- package/material/README.md +19 -19
- package/overlay/README.md +11 -11
- package/package.json +5 -4
- package/sidenav/README.md +4 -19
- package/skeleton/README.md +3 -17
- package/speak/README.md +15 -15
- package/stepper/README.md +139 -5
- package/tabs/README.md +4 -4
- package/theming/system-tokens.css +29 -0
- package/types/cngx-ui-action-button.d.ts +28 -13
- package/types/cngx-ui-empty-state.d.ts +21 -9
- package/types/cngx-ui-feedback.d.ts +437 -121
- package/types/cngx-ui-layout.d.ts +38 -8
- package/types/cngx-ui-mat-stepper.d.ts +58 -43
- package/types/cngx-ui-mat-tabs.d.ts +122 -72
- package/types/cngx-ui-material.d.ts +12 -1
- package/types/cngx-ui-overlay.d.ts +25 -4
- package/types/cngx-ui-sidenav.d.ts +106 -12
- package/types/cngx-ui-skeleton.d.ts +62 -8
- package/types/cngx-ui-speak.d.ts +10 -2
- package/types/cngx-ui-stepper.d.ts +280 -56
- package/types/cngx-ui-tabs.d.ts +38 -10
- package/types/cngx-ui.d.ts +1 -0
- package/speak/speak-button-theme.scss +0 -78
package/overlay/README.md
CHANGED
|
@@ -37,10 +37,10 @@ export class ExampleComponent {
|
|
|
37
37
|
|
|
38
38
|
Key features:
|
|
39
39
|
|
|
40
|
-
- **Type-safe result streams**
|
|
41
|
-
- **Sensible defaults**
|
|
42
|
-
- **Simple API**
|
|
43
|
-
- **Backdrop dismiss**
|
|
40
|
+
- **Type-safe result streams** - `CngxOverlayRef<R>` with generic result type
|
|
41
|
+
- **Sensible defaults** - Centered backdrop by default; customize via CDK `OverlayConfig`
|
|
42
|
+
- **Simple API** - `open(component, config)` and `close(result)`
|
|
43
|
+
- **Backdrop dismiss** - Auto-closes on backdrop click (configurable)
|
|
44
44
|
|
|
45
45
|
## Configuration
|
|
46
46
|
|
|
@@ -71,18 +71,18 @@ Default behavior:
|
|
|
71
71
|
|
|
72
72
|
`CngxOverlay` provides the CDK overlay service and component portal attachment. Accessibility is the responsibility of the overlay component:
|
|
73
73
|
|
|
74
|
-
- **Focus trap**
|
|
75
|
-
- **Backdrop dismissal**
|
|
76
|
-
- **Focus restoration**
|
|
77
|
-
- **ARIA roles**
|
|
74
|
+
- **Focus trap** - Use CDK's `cdkTrapFocus` on your overlay content
|
|
75
|
+
- **Backdrop dismissal** - Backdrop click auto-closes; use `closeOnBackdropClick` in your component
|
|
76
|
+
- **Focus restoration** - Store focus before opening, restore on close (standard pattern)
|
|
77
|
+
- **ARIA roles** - Overlay component must declare `role="dialog"`, `role="menu"`, etc.
|
|
78
78
|
|
|
79
79
|
## Composition
|
|
80
80
|
|
|
81
81
|
`CngxOverlay` composes:
|
|
82
82
|
|
|
83
|
-
- **CDK Overlay service**
|
|
84
|
-
- **ComponentPortal**
|
|
85
|
-
- **Injector.create**
|
|
83
|
+
- **CDK Overlay service** - Position strategies, scroll strategies, portal attachment
|
|
84
|
+
- **ComponentPortal** - Attaches components to the overlay DOM
|
|
85
|
+
- **Injector.create** - Creates a child injector with the overlay ref available to the component
|
|
86
86
|
|
|
87
87
|
## Type Safety
|
|
88
88
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cngx/ui",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
4
|
"description": "Material-backed organisms (overlay, layout, feedback shell, empty-state) for the cngx Angular component library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cngx",
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"tslib": "^2.3.0"
|
|
33
33
|
},
|
|
34
34
|
"sideEffects": false,
|
|
35
|
-
"module": "fesm2022/cngx-ui.mjs",
|
|
36
|
-
"typings": "types/cngx-ui.d.ts",
|
|
37
35
|
"exports": {
|
|
36
|
+
"./theming/*.css": "./theming/*.css",
|
|
38
37
|
"./package.json": {
|
|
39
38
|
"default": "./package.json"
|
|
40
39
|
},
|
|
@@ -94,5 +93,7 @@
|
|
|
94
93
|
"types": "./types/cngx-ui-tabs.d.ts",
|
|
95
94
|
"default": "./fesm2022/cngx-ui-tabs.mjs"
|
|
96
95
|
}
|
|
97
|
-
}
|
|
96
|
+
},
|
|
97
|
+
"module": "fesm2022/cngx-ui.mjs",
|
|
98
|
+
"typings": "types/cngx-ui.d.ts"
|
|
98
99
|
}
|
package/sidenav/README.md
CHANGED
|
@@ -68,12 +68,10 @@ Key features:
|
|
|
68
68
|
|
|
69
69
|
## Accessibility
|
|
70
70
|
|
|
71
|
-
`CngxSidenav` is fully accessible:
|
|
72
|
-
|
|
73
71
|
- **ARIA roles:** Sidebar carries `role="complementary"` with optional `[attr.aria-label]`. In overlay mode, `aria-hidden="true"` when closed.
|
|
74
72
|
- **Keyboard interaction:**
|
|
75
|
-
- `Escape`
|
|
76
|
-
- Custom shortcut (if configured)
|
|
73
|
+
- `Escape` - Closes overlay mode sidenav
|
|
74
|
+
- Custom shortcut (if configured) - Toggles opened state globally
|
|
77
75
|
- **Screen reader:** Complementary landmark announces the sidebar label; scroll lock prevents reading body content when sidebar is open in overlay.
|
|
78
76
|
- **Focus management:** On overlay close, focus is not automatically restored (consumer must manage).
|
|
79
77
|
|
|
@@ -86,19 +84,6 @@ Key features:
|
|
|
86
84
|
- **Scroll lock:** Coordinate with `CngxSidenavLayout` via `hasOverlay` computed
|
|
87
85
|
- **Resize:** Pointer-capture drag with RAFed position updates
|
|
88
86
|
|
|
89
|
-
## Styling
|
|
90
|
-
|
|
91
|
-
All dimensions and colors use CSS Custom Properties with Material 3 defaults:
|
|
92
|
-
|
|
93
|
-
```scss
|
|
94
|
-
// Override in your component or global styles
|
|
95
|
-
:host {
|
|
96
|
-
--cngx-sidenav-width: 320px;
|
|
97
|
-
--cngx-sidenav-transition-duration: 0.3s;
|
|
98
|
-
--cngx-sidenav-bg: var(--mat-sys-surface-container, #f9fafb);
|
|
99
|
-
--cngx-sidenav-color: var(--mat-sys-on-surface, #333);
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
87
|
|
|
103
88
|
## Material Theme
|
|
104
89
|
|
|
@@ -106,8 +91,8 @@ Include the theme SCSS files in your global stylesheet:
|
|
|
106
91
|
|
|
107
92
|
```scss
|
|
108
93
|
@use '@angular/material' as mat;
|
|
109
|
-
@use '@cngx/
|
|
110
|
-
@use '@cngx/
|
|
94
|
+
@use '@cngx/themes/material/sidenav-theme' as sidenav;
|
|
95
|
+
@use '@cngx/themes/material/nav-link-theme' as nav-link;
|
|
111
96
|
|
|
112
97
|
$theme: mat.define-theme((...));
|
|
113
98
|
|
package/skeleton/README.md
CHANGED
|
@@ -39,15 +39,13 @@ export class ExampleComponent {
|
|
|
39
39
|
- **Repetition:** Repeats placeholder template via `[count]` input
|
|
40
40
|
- **Shimmer animation:** Optional shimmer effect that respects `prefers-reduced-motion`
|
|
41
41
|
- **Async state integration:** Automatically hides when data arrives (via `[state]` input)
|
|
42
|
-
- **DOM efficiency:** Uses `display: contents`
|
|
42
|
+
- **DOM efficiency:** Uses `display: contents` - no wrapper overhead
|
|
43
43
|
- **ARIA:** Sets `aria-busy="true"` while loading
|
|
44
44
|
|
|
45
|
-
The component is composable with `CngxSkeletonPlaceholder` directive (content projection). No boilerplate `@if/@for` needed
|
|
45
|
+
The component is composable with `CngxSkeletonPlaceholder` directive (content projection). No boilerplate `@if/@for` needed - the component handles template repetition internally.
|
|
46
46
|
|
|
47
47
|
## Accessibility
|
|
48
48
|
|
|
49
|
-
`CngxSkeletonContainer` is fully accessible:
|
|
50
|
-
|
|
51
49
|
- **ARIA attributes:** `[attr.aria-busy]="isLoading()"` signals that content is being loaded.
|
|
52
50
|
- **Reduced motion:** Shimmer animation is disabled when `prefers-reduced-motion: reduce` is set.
|
|
53
51
|
- **Screen reader:** Skeletons are visual placeholders; their content is not announced. When loading completes, real content replaces placeholders seamlessly.
|
|
@@ -60,19 +58,7 @@ The component is composable with `CngxSkeletonPlaceholder` directive (content pr
|
|
|
60
58
|
- **Placeholder projection:** `CngxSkeletonPlaceholder` directive for template marking
|
|
61
59
|
- **Reduced motion detection:** Inline `matchMedia` listener for `prefers-reduced-motion`
|
|
62
60
|
|
|
63
|
-
## Styling
|
|
64
|
-
|
|
65
|
-
All animation values use CSS Custom Properties:
|
|
66
61
|
|
|
67
|
-
```scss
|
|
68
|
-
// Override in your component or global styles
|
|
69
|
-
:host {
|
|
70
|
-
--cngx-spin-duration: 1.5s;
|
|
71
|
-
--cngx-spin-easing: cubic-bezier(0.4, 0, 0.2, 1);
|
|
72
|
-
--cngx-pulse-duration: 2s;
|
|
73
|
-
--cngx-pulse-easing: ease-in-out;
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
62
|
|
|
77
63
|
## Material Theme
|
|
78
64
|
|
|
@@ -80,7 +66,7 @@ Include the theme SCSS in your global stylesheet:
|
|
|
80
66
|
|
|
81
67
|
```scss
|
|
82
68
|
@use '@angular/material' as mat;
|
|
83
|
-
@use '@cngx/
|
|
69
|
+
@use '@cngx/themes/material/skeleton-theme' as skeleton;
|
|
84
70
|
|
|
85
71
|
$theme: mat.define-theme((...));
|
|
86
72
|
|
package/speak/README.md
CHANGED
|
@@ -34,18 +34,18 @@ export class ExampleComponent {
|
|
|
34
34
|
|
|
35
35
|
`CngxSpeakButton` is a ready-made speaker button that connects to a `CngxSpeak` directive via an explicit `[speakRef]` input. It provides:
|
|
36
36
|
|
|
37
|
-
- **Speaker and stop icons**
|
|
38
|
-
- **Accessible labels**
|
|
39
|
-
- **Cognitive accessibility**
|
|
40
|
-
- **Full theming control**
|
|
41
|
-
- **No ancestor injection**
|
|
37
|
+
- **Speaker and stop icons** - Built-in SVGs that toggle based on speaking state
|
|
38
|
+
- **Accessible labels** - ARIA labels that reflect the current state ("Read aloud" / "Stop speaking")
|
|
39
|
+
- **Cognitive accessibility** - Part of CngxSpeak, targeting dyslexia and reading ease
|
|
40
|
+
- **Full theming control** - CSS custom properties for styling, Material theme SCSS integration
|
|
41
|
+
- **No ancestor injection** - Explicit `[speakRef]` wiring prevents hidden dependencies
|
|
42
42
|
|
|
43
43
|
## Accessibility
|
|
44
44
|
|
|
45
45
|
`CngxSpeakButton` is designed for cognitive accessibility:
|
|
46
46
|
|
|
47
47
|
- **ARIA labels:** Button label dynamically changes between "Read aloud" (idle) and "Stop speaking" (active).
|
|
48
|
-
- **Icon semantics:** SVG icons are marked `aria-hidden="true"`
|
|
48
|
+
- **Icon semantics:** SVG icons are marked `aria-hidden="true"` - the text label carries the meaning.
|
|
49
49
|
- **CngxSpeak integration:** The underlying `CngxSpeak` directive handles the speech synthesis API, managing pause/resume, focus restoration, and `prefers-reduced-motion` respect.
|
|
50
50
|
- **Cognitive focus:** Targets users with dyslexia, ADHD, and reading difficulties by providing auditory reinforcement alongside visual text.
|
|
51
51
|
|
|
@@ -53,11 +53,11 @@ export class ExampleComponent {
|
|
|
53
53
|
|
|
54
54
|
`CngxSpeakButton` is a simple wrapper around:
|
|
55
55
|
|
|
56
|
-
- **CngxSpeak directive**
|
|
57
|
-
- **Built-in SVGs**
|
|
58
|
-
- **CSS custom properties**
|
|
56
|
+
- **CngxSpeak directive** - Provides the `speaking()` signal and `toggle()` method
|
|
57
|
+
- **Built-in SVGs** - Speaker icon (idle state) and stop icon (speaking state)
|
|
58
|
+
- **CSS custom properties** - Full theming support
|
|
59
59
|
|
|
60
|
-
No host directives or internal atoms
|
|
60
|
+
No host directives or internal atoms - purely a UI shell for the speech synthesis API.
|
|
61
61
|
|
|
62
62
|
## Material Theme
|
|
63
63
|
|
|
@@ -65,7 +65,7 @@ Include the theme SCSS in your global stylesheet:
|
|
|
65
65
|
|
|
66
66
|
```scss
|
|
67
67
|
@use '@angular/material' as mat;
|
|
68
|
-
@use '@cngx/
|
|
68
|
+
@use '@cngx/themes/material/speak-button-theme' as speak;
|
|
69
69
|
|
|
70
70
|
$theme: mat.define-theme((...));
|
|
71
71
|
|
|
@@ -85,9 +85,9 @@ The theme mixin provides:
|
|
|
85
85
|
|
|
86
86
|
CngxSpeak / CngxSpeakButton are part of cngx's commitment to cognitive accessibility. Rather than treating a11y as an audit checkbox, these components embed accessibility into the architecture:
|
|
87
87
|
|
|
88
|
-
- **Dyslexia support**
|
|
89
|
-
- **ADHD support**
|
|
90
|
-
- **Aging users**
|
|
91
|
-
- **Non-native speakers**
|
|
88
|
+
- **Dyslexia support** - Auditory reinforcement helps users with dyslexia parse text more effectively
|
|
89
|
+
- **ADHD support** - Multi-modal input (visual + audio) aids concentration and retention
|
|
90
|
+
- **Aging users** - Larger, clear button with obvious visual feedback
|
|
91
|
+
- **Non-native speakers** - Audio pronunciation aids comprehension
|
|
92
92
|
|
|
93
93
|
The philosophy is: communication is architecture, not a side effect. Every component owes users clarity at every point in time.
|
package/stepper/README.md
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
# @cngx/ui/stepper
|
|
2
2
|
|
|
3
|
-
CNGX-standard `<cngx-stepper>` organism. Composes the `CngxStepperPresenter` brain (from `@cngx/common/stepper`) with `CngxRovingTabindex` and `CngxFocusRestore` via `hostDirectives`. W3C step pattern compliant
|
|
3
|
+
CNGX-standard `<cngx-stepper>` organism. Composes the `CngxStepperPresenter` brain (from `@cngx/common/stepper`) with `CngxRovingTabindex` and `CngxFocusRestore` via `hostDirectives`. W3C step pattern compliant - `role="group"` + `aria-roledescription="stepper"` host, `role="region"` panels, reactive `aria-current` / `aria-busy` / `aria-describedby` on every step button.
|
|
4
4
|
|
|
5
5
|
## What it does
|
|
6
6
|
|
|
7
|
-
`<cngx-stepper>` is the cngx-native stepper skin: thin component, signals everywhere, full ARIA, optional commit-action lifecycle, optional router sync, optional error aggregation. Material consumers reach for `<cngx-mat-stepper>` (sibling `@cngx/ui/mat-stepper` entry) instead
|
|
7
|
+
`<cngx-stepper>` is the cngx-native stepper skin: thin component, signals everywhere, full ARIA, optional commit-action lifecycle, optional router sync, optional error aggregation. Material consumers reach for `<cngx-mat-stepper>` (sibling `@cngx/ui/mat-stepper` entry) instead - both share the same `CngxStepperPresenter` brain.
|
|
8
8
|
|
|
9
|
-
The organism's body is template + reactive ARIA only. All state lives in the presenter (composed via `hostDirectives`). The component class is ~260 LOC; the template is ~70 lines; structural CSS lives in `styles/stepper-base.css`, thematic CSS in `stepper.component.css`
|
|
9
|
+
The organism's body is template + reactive ARIA only. All state lives in the presenter (composed via `hostDirectives`). The component class is ~260 LOC; the template is ~70 lines; structural CSS lives in `styles/stepper-base.css`, thematic CSS in `stepper.component.css` - both routed through `--cngx-stepper-*` custom properties for theming.
|
|
10
10
|
|
|
11
11
|
## Exports
|
|
12
12
|
|
|
13
|
-
| Export
|
|
14
|
-
|
|
13
|
+
| Export | Selector | Description |
|
|
14
|
+
|-|-|-|
|
|
15
15
|
| `CngxStepper` | `cngx-stepper` | The organism. Composes `CngxStepperPresenter` (presenter brain), `CngxRovingTabindex` (keyboard nav), `CngxFocusRestore` (focus management) via `hostDirectives`. |
|
|
16
|
+
| `CngxProgressBarStepper` | `cngx-progress-bar-stepper` | Variant. Bar-style progress rendered via the embedded `<cngx-progress>` primitive. See [Progress-Bar Stepper](#progress-bar-stepper). |
|
|
17
|
+
| `CngxDotStepper` | `cngx-dot-stepper` | Variant. Mobile-first dot indicator. See [Dot Stepper](#dot-stepper). |
|
|
18
|
+
| `CngxTextStepper` | `cngx-text-stepper` | Variant. Inline `Step N of M` text. See [Text Stepper](#text-stepper). |
|
|
16
19
|
|
|
17
20
|
```html
|
|
18
21
|
<cngx-stepper [(activeStepIndex)]="active" aria-label="Wizard">
|
|
@@ -38,3 +41,134 @@ The organism is W3C step-pattern compliant:
|
|
|
38
41
|
- Step panel: `role="region"` + `aria-labelledby="<step-id>-header"` + `[hidden]="!isActive"`.
|
|
39
42
|
- Group header: `role="group"` + `aria-roledescription="step group"` + `data-step-depth` + `data-state` + `aria-describedby` (rolls up children's aggregated status).
|
|
40
43
|
- Live region: planned for Phase 3 commit-lifecycle SR announcements; deliberately NOT composed via `hostDirectives` because `CngxLiveRegion` would clobber the host's `role="group"` landmark.
|
|
44
|
+
|
|
45
|
+
## Skins
|
|
46
|
+
|
|
47
|
+
`<cngx-stepper>` ships five thematic skins selectable via the `[skin]` Input or the `withStepperSkin(...)` config feature. Structure, ARIA, slots, and keyboard behaviour are identical across all five; only the CSS layer driven by `[data-skin]` changes.
|
|
48
|
+
|
|
49
|
+
| Skin | Visual | Use case |
|
|
50
|
+
|-|-|-|
|
|
51
|
+
| `classic` | Numbered circles with connectors. The Phase A re-tuned default. | Default wizards, A11y-first flows. |
|
|
52
|
+
| `linear-minimal` | Label + 6px dot + dashed connector. | Long wizards on dense pages. |
|
|
53
|
+
| `stripe-status-rich` | Label + state pill (Done / In progress / Up next / Errored). | Sales / checkout flows where status legibility wins. |
|
|
54
|
+
| `path-chevron` | Boarding-pass chevron tiles. | High-identity branded flows. |
|
|
55
|
+
| `pill-segment` | iOS-style segmented control. | Compact toolbars. |
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { provideStepperConfig, withStepperSkin } from '@cngx/common/stepper';
|
|
59
|
+
|
|
60
|
+
bootstrapApplication(AppComponent, {
|
|
61
|
+
providers: [provideStepperConfig(withStepperSkin('path-chevron'))],
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Per-instance override:
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<cngx-stepper skin="linear-minimal" aria-label="Wizard">...</cngx-stepper>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Under 480px viewports the classic strip auto-collapses to `<cngx-text-stepper>` (default) or `<cngx-dot-stepper>`. Configure via `withStepperMobileCollapse('text' | 'dots' | 'off')`.
|
|
72
|
+
|
|
73
|
+
## Progress-Bar Stepper
|
|
74
|
+
|
|
75
|
+
`CngxProgressBarStepper` renders the active step ratio as a determinate `<cngx-progress>` bar. Thin Level-4 organism composing `CngxStepperPresenter` via `hostDirectives` plus the embedded `CngxProgress` primitive - no reinvented `<div role="progressbar">`. Material consumers inherit Material progress palette automatically via `@cngx/themes/material/feedback-theme`.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { CngxStep } from '@cngx/common/stepper';
|
|
79
|
+
import { CngxProgressBarStepper } from '@cngx/ui/stepper';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<cngx-progress-bar-stepper
|
|
84
|
+
[(activeStepIndex)]="active"
|
|
85
|
+
[showStepCount]="true"
|
|
86
|
+
aria-label="Onboarding"
|
|
87
|
+
>
|
|
88
|
+
<div cngxStep label="Account"></div>
|
|
89
|
+
<div cngxStep label="Profile"></div>
|
|
90
|
+
<div cngxStep label="Preferences"></div>
|
|
91
|
+
<div cngxStep label="Finish"></div>
|
|
92
|
+
</cngx-progress-bar-stepper>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`[showStepCount]` appends a `Step N of M` caption sourced from `CngxStepperI18n.textStepperFormat`.
|
|
96
|
+
|
|
97
|
+
## Dot Stepper
|
|
98
|
+
|
|
99
|
+
`CngxDotStepper` renders one dot per step inside a `<div role="group" aria-roledescription="Step indicator">` per the W3C APG step-indicator pattern. The active dot carries `aria-current="step"`; arrow keys route through the presenter when `[linear]="false"`. Each dot uses `role="img"` with a `Step N of M` label - a name-permitting role, since this is sequential flow, not a tablist.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { CngxStep } from '@cngx/common/stepper';
|
|
103
|
+
import { CngxDotStepper } from '@cngx/ui/stepper';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<cngx-dot-stepper
|
|
108
|
+
[(activeStepIndex)]="active"
|
|
109
|
+
aria-label="Carousel slides"
|
|
110
|
+
tabindex="0"
|
|
111
|
+
>
|
|
112
|
+
<div cngxStep label="Slide 1"></div>
|
|
113
|
+
<div cngxStep label="Slide 2"></div>
|
|
114
|
+
<div cngxStep label="Slide 3"></div>
|
|
115
|
+
</cngx-dot-stepper>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Theming via `--cngx-dot-step-active-fill` / `--cngx-dot-step-completed-fill` / `--cngx-dot-step-upcoming-bg`. The Material bridge mixin maps each to the matching `--mat-sys-*` token.
|
|
119
|
+
|
|
120
|
+
## Text Stepper
|
|
121
|
+
|
|
122
|
+
`CngxTextStepper` is the smallest stepper - a single `<span aria-live="polite">` reading `Step N of M`. Pure typography inheritance from the consumer's context, no theme bridge required. `[showCurrentLabel]` appends the active step's label after the count.
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { CngxStep } from '@cngx/common/stepper';
|
|
126
|
+
import { CngxTextStepper } from '@cngx/ui/stepper';
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<header>
|
|
131
|
+
<h3>Checkout</h3>
|
|
132
|
+
<cngx-text-stepper [(activeStepIndex)]="active" [showCurrentLabel]="true">
|
|
133
|
+
<div cngxStep label="Customer"></div>
|
|
134
|
+
<div cngxStep label="Payment"></div>
|
|
135
|
+
<div cngxStep label="Review"></div>
|
|
136
|
+
</cngx-text-stepper>
|
|
137
|
+
</header>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Override the format via `withStepperI18nLabels({ textStepperFormat: (cur, total) => 'Schritt ' + cur + '/' + total })`.
|
|
141
|
+
|
|
142
|
+
## Swipe navigation (mobile)
|
|
143
|
+
|
|
144
|
+
Steppers are **indicators**, not carousels: they reflect `activeStepIndex`, they do not own the slide content. So swipe is not built in - you compose it. Wire `CngxSwipe` (from `@cngx/common/interactive`) onto the **content panel** and route the direction into the same two-way `activeStepIndex` signal. Because the gesture lives on the content, it works identically with any indicator variant (dot, text, progress-bar).
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { CngxSwipe, type SwipeDirection } from '@cngx/common/interactive';
|
|
148
|
+
import { CngxDotStepper } from '@cngx/ui/stepper';
|
|
149
|
+
|
|
150
|
+
readonly active = signal(0);
|
|
151
|
+
|
|
152
|
+
onSwipe(direction: SwipeDirection): void {
|
|
153
|
+
if (direction === 'left') {
|
|
154
|
+
this.active.update(i => Math.min(i + 1, this.lastIndex));
|
|
155
|
+
} else if (direction === 'right') {
|
|
156
|
+
this.active.update(i => Math.max(i - 1, 0));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```html
|
|
162
|
+
<cngx-dot-stepper [(activeStepIndex)]="active" aria-label="Slides">
|
|
163
|
+
<div cngxStep label="Slide 1"></div>
|
|
164
|
+
<div cngxStep label="Slide 2"></div>
|
|
165
|
+
<div cngxStep label="Slide 3"></div>
|
|
166
|
+
</cngx-dot-stepper>
|
|
167
|
+
|
|
168
|
+
<!-- Swipe sits on the content, axis-pinned so a vertical scroll never fires it. -->
|
|
169
|
+
<section cngxSwipe axis="x" (swiped)="onSwipe($event)">…</section>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Keyboard navigation (arrow keys, Home / End) is built into the indicator and needs no wiring; swipe is the touch counterpart you add yourself.
|
|
173
|
+
|
|
174
|
+
**Caveat:** only wire swipe onto panels that are genuinely paged content (onboarding, galleries). Do not make a panel that holds real form fields swipe-navigable - a horizontal drag while editing inputs is ambiguous and fights native gestures. For form wizards, keep explicit Back / Next controls.
|
package/tabs/README.md
CHANGED
|
@@ -9,13 +9,13 @@ You want a tab strip with:
|
|
|
9
9
|
- Async-aware tab activation (optimistic or pessimistic commit, per-tab busy and error markers).
|
|
10
10
|
- An overflow menu when the tabs do not fit available width.
|
|
11
11
|
- Full keyboard navigation (roving tabindex, arrow keys, `Home`/`End`, `Enter`/`Space`).
|
|
12
|
-
- No Material runtime
|
|
12
|
+
- No Material runtime - either because you ship your own design system or because the bundle cost matters.
|
|
13
13
|
|
|
14
14
|
If you want the same behaviour rendered in Material 3, import `@cngx/ui/mat-tabs` instead. The brain is shared between the two skins.
|
|
15
15
|
|
|
16
16
|
## Mental model
|
|
17
17
|
|
|
18
|
-
`<cngx-tab-group>` is a presenter applied as a `hostDirective`. The tab group component itself is thin
|
|
18
|
+
`<cngx-tab-group>` is a presenter applied as a `hostDirective`. The tab group component itself is thin - it forwards inputs and renders a CDK-based `<div role="tablist">`. All the state - active tab, commit lifecycle, overflow recompute, ARIA wiring - lives in the presenter from `@cngx/common/tabs`. That separation is what makes a Material twin possible without duplication.
|
|
19
19
|
|
|
20
20
|
Two pieces give the tab strip its character:
|
|
21
21
|
|
|
@@ -24,5 +24,5 @@ Two pieces give the tab strip its character:
|
|
|
24
24
|
|
|
25
25
|
## Companion entries
|
|
26
26
|
|
|
27
|
-
- **`@cngx/common/tabs`**
|
|
28
|
-
- **`@cngx/ui/mat-tabs`**
|
|
27
|
+
- **`@cngx/common/tabs`** - the headless brain, configuration cascade, slot directives.
|
|
28
|
+
- **`@cngx/ui/mat-tabs`** - Material twin of this skin.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Domain-specific system tokens for `@cngx/ui`. Empty placeholder -
|
|
4
|
+
* the file exists so each lib's `theming/` layer has a canonical
|
|
5
|
+
* home that ng-packagr already ships. Populate when a need arises
|
|
6
|
+
* for tokens that belong to this lib's domain: Material-bridged
|
|
7
|
+
* organisms like feedback, sidenav, stepper, tabs, speak, skeleton,
|
|
8
|
+
* action-button, and empty-state. Typical fit is a bridge token
|
|
9
|
+
* between cngx naming and `--mat-sys-*` Material system tokens.
|
|
10
|
+
*
|
|
11
|
+
* **Inheritance**
|
|
12
|
+
*
|
|
13
|
+
* - System tokens shared across all libs - `@cngx/core/theming/
|
|
14
|
+
* system-tokens.css`
|
|
15
|
+
* - Per-component tokens - `<comp>.css` next to the component
|
|
16
|
+
* - Material-bridge `*-theme.scss` files - parallel to this CSS
|
|
17
|
+
* layer, not part of it
|
|
18
|
+
*
|
|
19
|
+
* **Pair with**
|
|
20
|
+
*
|
|
21
|
+
* - `@cngx/themes/material/*` - the Material 3 bridges that consume
|
|
22
|
+
* cngx tokens declared here once this file is populated
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
@layer cngx.tokens {
|
|
26
|
+
/* Add @property declarations here when ui-domain system tokens
|
|
27
|
+
* are needed. Empty layer-block is valid CSS and serves as the
|
|
28
|
+
* structural anchor for future additions. */
|
|
29
|
+
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import * as _cngx_core_utils from '@cngx/core/utils';
|
|
2
|
-
import { CngxAsyncState } from '@cngx/core/utils';
|
|
3
1
|
import * as _angular_core from '@angular/core';
|
|
4
2
|
import { AsyncAction, CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';
|
|
3
|
+
import { CngxAsyncState } from '@cngx/core/utils';
|
|
5
4
|
|
|
6
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Visual variant for the action button - maps to a CSS class.
|
|
7
|
+
*
|
|
8
|
+
* @category ui/action-button
|
|
9
|
+
*/
|
|
7
10
|
type ActionButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
8
11
|
/**
|
|
9
|
-
* Action button
|
|
12
|
+
* Action button organism with built-in status communication.
|
|
10
13
|
*
|
|
11
14
|
* Coordinates between the `CngxAsyncClick` atom (mechanism, ARIA, lifecycle)
|
|
12
15
|
* and the consumer (intent, styling, labels). Provides template projection
|
|
13
16
|
* for pending/succeeded/failed states and an `aria-live` region for screen
|
|
14
17
|
* reader announcements.
|
|
15
18
|
*
|
|
16
|
-
* Uses `display: contents`
|
|
19
|
+
* Uses `display: contents` - the host produces no DOM box. The inner `<button>`
|
|
17
20
|
* carries the `[cngxAsyncClick]` directive directly.
|
|
18
21
|
*
|
|
19
22
|
* For full control, use `[cngxAsyncClick]` directly on any element instead.
|
|
@@ -37,7 +40,7 @@ type ActionButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
|
37
40
|
* Save Draft
|
|
38
41
|
* <ng-template cngxPending><mat-spinner diameter="18" /> Saving...</ng-template>
|
|
39
42
|
* <ng-template cngxSucceeded>Saved!</ng-template>
|
|
40
|
-
* <ng-template cngxFailed let-err>{{ err }}
|
|
43
|
+
* <ng-template cngxFailed let-err>{{ err }} - retry?</ng-template>
|
|
41
44
|
* </cngx-action-button>
|
|
42
45
|
* ```
|
|
43
46
|
*
|
|
@@ -47,6 +50,16 @@ type ActionButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
|
47
50
|
* Save
|
|
48
51
|
* </cngx-action-button>
|
|
49
52
|
* ```
|
|
53
|
+
*
|
|
54
|
+
* @category ui/action-button
|
|
55
|
+
* @docsKind primary
|
|
56
|
+
* @wcag AA
|
|
57
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/action-button/action-button.ts
|
|
58
|
+
* @since 0.1.0
|
|
59
|
+
* @relatedTo CngxAsyncClick, CngxPending, CngxSucceeded, CngxFailed, CngxToaster
|
|
60
|
+
* <example-url>http://localhost:4200/#/ui/action-button/async-button/random-outcome</example-url>
|
|
61
|
+
* <example-url>http://localhost:4200/#/ui/action-button/async-button/string-labels</example-url>
|
|
62
|
+
* <example-url>http://localhost:4200/#/ui/action-button/async-button/template-slots</example-url>
|
|
50
63
|
*/
|
|
51
64
|
declare class CngxActionButton {
|
|
52
65
|
private readonly toaster;
|
|
@@ -59,7 +72,7 @@ declare class CngxActionButton {
|
|
|
59
72
|
readonly enabled: _angular_core.InputSignal<boolean>;
|
|
60
73
|
/** Button type attribute. Defaults to `'button'` to prevent accidental form submits. */
|
|
61
74
|
readonly type: _angular_core.InputSignal<"button" | "submit" | "reset">;
|
|
62
|
-
/** Visual variant
|
|
75
|
+
/** Visual variant - sets CSS class `cngx-action-button--{variant}`. */
|
|
63
76
|
readonly variant: _angular_core.InputSignal<ActionButtonVariant>;
|
|
64
77
|
/** SR announcement on success. Falls back to `succeededLabel`, then `'Action succeeded'`. */
|
|
65
78
|
readonly succeededAnnouncement: _angular_core.InputSignal<string | undefined>;
|
|
@@ -90,16 +103,18 @@ declare class CngxActionButton {
|
|
|
90
103
|
readonly toastErrorDetail: _angular_core.InputSignal<boolean>;
|
|
91
104
|
/** Duration for success toasts in ms. */
|
|
92
105
|
readonly toastSuccessDuration: _angular_core.InputSignal<number>;
|
|
93
|
-
/** Duration for error toasts
|
|
106
|
+
/** Duration for error toasts - `'persistent'` means manual dismiss only. */
|
|
94
107
|
readonly toastErrorDuration: _angular_core.InputSignal<number | "persistent">;
|
|
95
|
-
/** @internal
|
|
108
|
+
/** @internal - inner CngxAsyncClick directive instance. Non-required to allow safe pre-view-init reads. */
|
|
96
109
|
private readonly asyncClick;
|
|
97
110
|
/**
|
|
98
|
-
* @internal
|
|
99
|
-
*
|
|
111
|
+
* @internal - effective status: reflects external `[externalState]` if
|
|
112
|
+
* bound (through the shared `CngxAsyncStatus` reflection - one home for
|
|
113
|
+
* the state→display-bucket mapping), otherwise reads the inner
|
|
114
|
+
* `CngxAsyncClick` directive.
|
|
100
115
|
*/
|
|
101
|
-
protected readonly effectiveStatus: _angular_core.Signal<
|
|
102
|
-
/** @internal
|
|
116
|
+
protected readonly effectiveStatus: _angular_core.Signal<"idle" | "pending" | "success" | "error" | "loading" | "refreshing">;
|
|
117
|
+
/** @internal - effective error value from external state or inner directive. */
|
|
103
118
|
protected readonly effectiveError: _angular_core.Signal<unknown>;
|
|
104
119
|
private readonly lastUpdatedState;
|
|
105
120
|
/**
|
|
@@ -2,15 +2,15 @@ import * as _angular_core from '@angular/core';
|
|
|
2
2
|
import { CngxAsyncState } from '@cngx/core/utils';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Empty-state display
|
|
5
|
+
* Empty-state display organism for grids, tables, lists, and dashboards.
|
|
6
6
|
*
|
|
7
7
|
* Communicates why a view is empty and what the user can do next.
|
|
8
8
|
* Supports three UX contexts via the parent's `emptyReason`:
|
|
9
|
-
* - **first-use**
|
|
10
|
-
* - **no-results**
|
|
11
|
-
* - **cleared**
|
|
9
|
+
* - **first-use** - onboarding, show what's possible
|
|
10
|
+
* - **no-results** - recovery, offer filter reset or search change
|
|
11
|
+
* - **cleared** - confirmation, everything is done
|
|
12
12
|
*
|
|
13
|
-
* Icon is provided via the `[cngxEmptyStateIcon]` content slot
|
|
13
|
+
* Icon is provided via the `[cngxEmptyStateIcon]` content slot - no Material
|
|
14
14
|
* dependency. Consumers project `<mat-icon>`, `<svg>`, or any icon system.
|
|
15
15
|
*
|
|
16
16
|
* ```html
|
|
@@ -19,16 +19,28 @@ import { CngxAsyncState } from '@cngx/core/utils';
|
|
|
19
19
|
* <button cngxEmptyStateAction (click)="resetSearch()">Reset</button>
|
|
20
20
|
* </cngx-empty-state>
|
|
21
21
|
* ```
|
|
22
|
+
*
|
|
23
|
+
* @category ui/empty-state
|
|
24
|
+
* @docsKind primary
|
|
25
|
+
* @wcag AA
|
|
26
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/empty-state/empty-state.component.ts
|
|
27
|
+
* @since 0.1.0
|
|
28
|
+
* @relatedTo CngxAsyncState, CngxSkeletonContainer
|
|
29
|
+
* <example-url>http://localhost:4200/#/ui/empty-state/default-no-icon-projected</example-url>
|
|
30
|
+
* <example-url>http://localhost:4200/#/ui/empty-state/inside-a-card-grid</example-url>
|
|
31
|
+
* <example-url>http://localhost:4200/#/ui/empty-state/inside-a-list</example-url>
|
|
32
|
+
* <example-url>http://localhost:4200/#/ui/empty-state/inside-a-table</example-url>
|
|
33
|
+
* <example-url>http://localhost:4200/#/ui/empty-state/with-custom-icon-actions</example-url>
|
|
22
34
|
*/
|
|
23
35
|
declare class CngxEmptyState {
|
|
24
36
|
private readonly uid;
|
|
25
|
-
/** Primary message
|
|
37
|
+
/** Primary message - what state the user is in. */
|
|
26
38
|
readonly title: _angular_core.InputSignal<string>;
|
|
27
|
-
/** Supporting detail
|
|
39
|
+
/** Supporting detail - clarifies context and suggests next steps. */
|
|
28
40
|
readonly description: _angular_core.InputSignal<string | undefined>;
|
|
29
|
-
/** Bind an async state
|
|
41
|
+
/** Bind an async state - auto-hides when data is not empty. */
|
|
30
42
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
31
|
-
/** @internal
|
|
43
|
+
/** @internal - hidden when state is bound and data is not empty or still loading. */
|
|
32
44
|
protected readonly shouldHide: _angular_core.Signal<boolean>;
|
|
33
45
|
/** @internal */
|
|
34
46
|
protected readonly titleId: string;
|