@cngx/common 0.1.0-rc.9 → 0.3.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.
Files changed (88) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +19 -8
  4. package/data/README.md +10 -10
  5. package/fesm2022/cngx-common-a11y.mjs +701 -263
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +83 -64
  8. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  9. package/fesm2022/cngx-common-button.mjs +1084 -0
  10. package/fesm2022/cngx-common-button.mjs.map +1 -0
  11. package/fesm2022/cngx-common-card.mjs +135 -76
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +749 -296
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +51 -29
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +695 -405
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +112 -112
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +668 -308
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7066 -2739
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2121 -492
  26. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  27. package/fesm2022/cngx-common-menu-button.mjs +557 -0
  28. package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
  29. package/fesm2022/cngx-common-popover.mjs +1207 -569
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +256 -261
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +202 -262
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +28 -61
  36. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  37. package/fesm2022/cngx-common.mjs +10 -10
  38. package/fesm2022/cngx-common.mjs.map +1 -1
  39. package/interactive/README.md +30 -19
  40. package/layout/README.md +1 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +14 -4
  43. package/popover/README.md +42 -5
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/ng-add/index.js +7 -7
  46. package/schematics/ng-add/schema.json +5 -0
  47. package/stepper/README.md +0 -1
  48. package/theming/components/cngx-accordion.css +36 -7
  49. package/theming/components/cngx-async.css +185 -37
  50. package/theming/components/cngx-backdrop.css +3 -1
  51. package/theming/components/cngx-badge.css +20 -5
  52. package/theming/components/cngx-bottom-sheet.css +2 -0
  53. package/theming/components/cngx-breadcrumb.css +3 -1
  54. package/theming/components/cngx-button-group.css +325 -0
  55. package/theming/components/cngx-button-toggle.css +55 -23
  56. package/theming/components/cngx-button.css +975 -0
  57. package/theming/components/cngx-data-grid.css +2 -0
  58. package/theming/components/cngx-dialog.css +3 -1
  59. package/theming/components/cngx-divider.css +24 -9
  60. package/theming/components/cngx-drawer.css +153 -0
  61. package/theming/components/cngx-icon-glyph.css +76 -0
  62. package/theming/components/cngx-listbox.css +79 -25
  63. package/theming/components/cngx-menu.css +112 -52
  64. package/theming/components/cngx-nav.css +1220 -0
  65. package/theming/components/cngx-popover-sheet.css +43 -11
  66. package/theming/components/cngx-popover.css +37 -13
  67. package/theming/components/cngx-recycler-placeholder.css +2 -0
  68. package/theming/components/cngx-ripple.css +74 -16
  69. package/theming/components/cngx-sidebar.css +71 -0
  70. package/theming/components/cngx-slider.css +3 -1
  71. package/theming/components/cngx-tooltip.css +2 -0
  72. package/timeline/README.md +2 -2
  73. package/types/cngx-common-a11y.d.ts +343 -120
  74. package/types/cngx-common-audio.d.ts +60 -88
  75. package/types/cngx-common-button.d.ts +698 -0
  76. package/types/cngx-common-card.d.ts +104 -78
  77. package/types/cngx-common-chart.d.ts +671 -384
  78. package/types/cngx-common-command.d.ts +44 -47
  79. package/types/cngx-common-data.d.ts +350 -342
  80. package/types/cngx-common-dialog.d.ts +91 -120
  81. package/types/cngx-common-display.d.ts +475 -300
  82. package/types/cngx-common-interactive.d.ts +4350 -1723
  83. package/types/cngx-common-layout.d.ts +1365 -286
  84. package/types/cngx-common-menu-button.d.ts +382 -0
  85. package/types/cngx-common-popover.d.ts +671 -289
  86. package/types/cngx-common-stepper.d.ts +217 -347
  87. package/types/cngx-common-tabs.d.ts +173 -386
  88. package/types/cngx-common-timeline.d.ts +25 -104
@@ -0,0 +1,698 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, Signal, Type, Provider, EnvironmentProviders } from '@angular/core';
3
+ import * as _cngx_common_interactive from '@cngx/common/interactive';
4
+ import { CngxHostInteractionState } from '@cngx/common/interactive';
5
+
6
+ /**
7
+ * Emphasis. `secondary` is a tonal fill, `ghost` has no chrome until hover, `link` is inline text
8
+ * without control height.
9
+ *
10
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button.types.ts
11
+ * @since 0.3.0
12
+ */
13
+ type CngxButtonVariant = 'solid' | 'secondary' | 'outline' | 'ghost' | 'link';
14
+ /**
15
+ * Intent, orthogonal to the variant.
16
+ *
17
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button.types.ts
18
+ * @since 0.3.0
19
+ */
20
+ type CngxButtonTone = 'neutral' | 'primary' | 'danger';
21
+ /**
22
+ * `md` equals the form-control row height.
23
+ *
24
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button.types.ts
25
+ * @since 0.3.0
26
+ */
27
+ type CngxButtonSize = 'xs' | 'sm' | 'md' | 'lg';
28
+ /**
29
+ * Native `type`; an `<a>` host renders none.
30
+ *
31
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button.types.ts
32
+ * @since 0.3.0
33
+ */
34
+ type CngxButtonType = 'button' | 'submit' | 'reset';
35
+
36
+ /**
37
+ * Content before the label: icon, avatar, badge or `<kbd>`. Trims the inline-start padding.
38
+ * Rendered by `cngxButton`, `cngxMenuButton`, `cngxActionButton`, `cngxPopoverAction` and
39
+ * `cngxPopoverDismiss`.
40
+ *
41
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/slots.ts
42
+ * @since 0.3.0
43
+ * @relatedTo CngxButton, CngxButtonEnd, CngxMenuButton
44
+ * <example-url>/#/common/button/button/start-and-end-slots</example-url>
45
+ */
46
+ declare class CngxButtonStart {
47
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButtonStart, never>;
48
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxButtonStart, "[cngxButtonStart]", never, {}, {}, never, never, true, never>;
49
+ }
50
+ /**
51
+ * Content after the label: caret, count or shortcut hint. Trims the inline-end padding.
52
+ * Rendered by `cngxButton`, `cngxMenuButton`, `cngxActionButton`, `cngxPopoverAction` and
53
+ * `cngxPopoverDismiss`.
54
+ *
55
+ * ```html
56
+ * <button cngxButton>Export <kbd cngxButtonEnd>E</kbd></button>
57
+ * ```
58
+ *
59
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/slots.ts
60
+ * @since 0.3.0
61
+ * @relatedTo CngxButton, CngxButtonStart, CngxMenuButton
62
+ * <example-url>/#/common/button/button/start-and-end-slots</example-url>
63
+ */
64
+ declare class CngxButtonEnd {
65
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButtonEnd, never>;
66
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxButtonEnd, "[cngxButtonEnd]", never, {}, {}, never, never, true, never>;
67
+ }
68
+
69
+ /**
70
+ * Button state a composing molecule reads without importing a button class.
71
+ *
72
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-state.token.ts
73
+ * @since 0.3.0
74
+ * @relatedTo CNGX_BUTTON_STATE, CngxButtonBrain
75
+ */
76
+ interface CngxButtonState {
77
+ /**
78
+ * Refuses activation: `disabled`, a host refusal, a run or its held busy layer, or a refusing
79
+ * runner (`cngxAsyncClick` with `[enabled]="false"`).
80
+ */
81
+ readonly blocked: Signal<boolean>;
82
+ /** A co-hosted run is pending or the host reflects one. Ungated. */
83
+ readonly busy: Signal<boolean>;
84
+ /** Disabled-reason id while it applies, else `null`. Reference it to explain a refusal. */
85
+ readonly activeReasonId: Signal<string | null>;
86
+ }
87
+ /**
88
+ * Provided by every host on `CngxButtonBrain`. A split button reads its main action through it.
89
+ *
90
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-state.token.ts
91
+ * @since 0.3.0
92
+ * @relatedTo CngxButton, CngxIconButton, CngxSplitButton, CngxButtonBrain, CngxSplitCaret, CngxActionButton
93
+ */
94
+ declare const CNGX_BUTTON_STATE: InjectionToken<CngxButtonState>;
95
+
96
+ /**
97
+ * The state and ARIA contract of every cngx button, as a host directive. Declare it in
98
+ * `hostDirectives` and name the host with `provideButtonHost`; the host keeps its template and
99
+ * CSS. The attributes it writes and a full host are in the README, "Building a custom button
100
+ * host".
101
+ *
102
+ * Provides `CNGX_BUTTON_STATE` (read by `cngxSplitButton`), `CNGX_HOST_INTERACTION_STATE` (read
103
+ * by a co-hosted `cngxAsyncClick` or `cngxMenuTrigger`) and `CNGX_DESCRIBED_BY`.
104
+ *
105
+ * An `iconOnly` host without an accessible name after two stable cycles warns
106
+ * [`CNGX1071`](/error-codes/cngx1071.md). A host without `provideButtonHost` throws
107
+ * [`CNGX1075`](/error-codes/cngx1075.md).
108
+ *
109
+ * @wcag AA
110
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-brain.directive.ts
111
+ * @since 0.3.0
112
+ * @relatedTo provideButtonHost, CNGX_BUTTON_HOST_STATE, CNGX_BUTTON_STATE, CngxButton, CngxAsyncClick, CNGX_BUTTON_HOST, CngxIconButton, CngxCloseButton, CNGX_ASYNC_RUN_STATE, provideActionStatusHost
113
+ * <example-url>/#/common/button/composition/custom-host</example-url>
114
+ * @axis level molecule
115
+ */
116
+ declare class CngxButtonBrain implements CngxButtonState {
117
+ /** Emphasis. Hosts alias it to their selector; `''` (bare attribute) falls through. */
118
+ readonly variant: _angular_core.InputSignalWithTransform<CngxButtonVariant | undefined, "" | CngxButtonVariant | undefined>;
119
+ /** Intent. */
120
+ readonly tone: _angular_core.InputSignal<CngxButtonTone | undefined>;
121
+ /** Size. */
122
+ readonly size: _angular_core.InputSignal<CngxButtonSize | undefined>;
123
+ /** Rendered as `aria-disabled`: stays focusable, activation is swallowed. */
124
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
125
+ /** Why the button is disabled; referenced through `aria-describedby` while `disabled` is set. */
126
+ readonly disabledReason: _angular_core.InputSignal<string | undefined>;
127
+ /**
128
+ * Space-separated description ids. Bind runtime ids here, not through
129
+ * `[attr.aria-describedby]`: the static attribute is read once at creation. Merged after the
130
+ * static attribute, before the disabled reason and co-hosted contributors (`[cngxTooltip]`).
131
+ */
132
+ readonly describedBy: _angular_core.InputSignal<string | null>;
133
+ /** Native `type` on a `<button>` host, `'button'` by default; ignored on `<a>`. */
134
+ readonly type: _angular_core.InputSignal<CngxButtonType | undefined>;
135
+ private readonly descriptor;
136
+ private readonly hostState;
137
+ private readonly hostBusy;
138
+ /** `disabled`, the host's own refusal or a run the host reflects. */
139
+ readonly refusing: _angular_core.Signal<boolean>;
140
+ private readonly core;
141
+ /** Resolved emphasis. */
142
+ readonly variantValue: _angular_core.Signal<CngxButtonVariant>;
143
+ /** Resolved intent. */
144
+ readonly toneValue: _angular_core.Signal<CngxButtonTone>;
145
+ /** Resolved size. */
146
+ readonly sizeValue: _angular_core.Signal<CngxButtonSize>;
147
+ /** A co-hosted run is pending or the host reflects one. Ungated. */
148
+ readonly busy: _angular_core.Signal<boolean>;
149
+ /**
150
+ * The busy layer shows, gated on the `CNGX_LOADING_CONFIG` show delay and min-dwell.
151
+ * `CngxButtonAdornment` renders it.
152
+ */
153
+ readonly busyVisible: _angular_core.Signal<boolean>;
154
+ /**
155
+ * Refusing, busy or refused by the co-hosted runner. Every click is swallowed, an expanded popup
156
+ * trigger's included.
157
+ */
158
+ readonly blocked: _angular_core.Signal<boolean>;
159
+ /** Busy glyph from `provideButtonSpinner`, or `null` for the built-in spinner. */
160
+ readonly spinner: _angular_core.Type<unknown> | null;
161
+ /**
162
+ * @internal The action status on this element (`CngxActionStatusBrain`), or `null`. Read on
163
+ * self only, so a button projected into an action host never sees the outer host's status.
164
+ */
165
+ readonly actionStatus: () => _cngx_common_interactive.CngxActionStatus | null;
166
+ /** Id of the reason span `CngxButtonAdornment` renders. */
167
+ readonly reasonId: string;
168
+ /** `reasonId` while `disabled` has a reason, else `null`. */
169
+ readonly activeReasonId: _angular_core.Signal<string | null>;
170
+ /**
171
+ * Folded in by a co-hosted runner or trigger. Spread it when overriding
172
+ * `CNGX_HOST_INTERACTION_STATE`.
173
+ */
174
+ readonly interaction: CngxHostInteractionState;
175
+ protected readonly busyAttr: _angular_core.Signal<"true" | null>;
176
+ protected readonly pendingAttr: _angular_core.Signal<"true" | null>;
177
+ protected readonly ariaDisabled: _angular_core.Signal<"true" | null>;
178
+ protected readonly ariaBusy: _angular_core.Signal<"true" | null>;
179
+ protected readonly describedByValue: _angular_core.Signal<string | null>;
180
+ protected readonly hostType: _angular_core.Signal<CngxButtonType | null>;
181
+ constructor();
182
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButtonBrain, never>;
183
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxButtonBrain, never, ["cngxButtonBrain"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "disabledReason": { "alias": "disabledReason"; "required": false; "isSignal": true; }; "describedBy": { "alias": "cngxDescribedBy"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
184
+ }
185
+
186
+ /**
187
+ * The base button, an attribute component on the native `<button>` or `<a>`. `variant` is the
188
+ * selector value. State and ARIA come from `CngxButtonBrain`; see the README for the axes and
189
+ * accessibility.
190
+ *
191
+ * ```html
192
+ * <button cngxButton="outline" tone="primary">Save draft</button>
193
+ * <button [cngxButton]="variant()" type="submit">Submit</button>
194
+ * <a cngxButton="link" routerLink="/help">Help</a>
195
+ * <button cngxButton [cngxAsyncClick]="save">
196
+ * <svg cngxButtonStart aria-hidden="true" viewBox="0 0 24 24">...</svg>
197
+ * Save
198
+ * </button>
199
+ * ```
200
+ *
201
+ * @wcag AA
202
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button.component.ts
203
+ * @since 0.3.0
204
+ * @relatedTo CngxIconButton, CngxButtonBrain, CngxButtonStart, CngxButtonEnd, CngxAsyncClick, provideButtonConfig, CngxMenuButton, CngxButtonGroup, CngxActionButton
205
+ * <example-url>/#/common/button/button/variants</example-url>
206
+ * <example-url>/#/common/button/button/tones</example-url>
207
+ * <example-url>/#/common/button/button/sizes</example-url>
208
+ * <example-url>/#/common/button/button/start-and-end-slots</example-url>
209
+ * <example-url>/#/common/button/button/disabled-with-reason</example-url>
210
+ * <example-url>/#/common/button/button/async-click-busy</example-url>
211
+ * <example-url>/#/common/button/button/aligned-with-inputs</example-url>
212
+ * <example-url>/#/common/button/button/link-host</example-url>
213
+ * @axis level atom
214
+ */
215
+ declare class CngxButton {
216
+ protected readonly startSlot: _angular_core.Signal<CngxButtonStart | undefined>;
217
+ protected readonly endSlot: _angular_core.Signal<CngxButtonEnd | undefined>;
218
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButton, never>;
219
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxButton, "button[cngxButton], a[cngxButton]", ["cngxButton"], {}, {}, ["startSlot", "endSlot"], ["[cngxButtonStart]", "*", "[cngxButtonEnd]"], true, [{ directive: typeof CngxButtonBrain; inputs: { "variant": "cngxButton"; "tone": "tone"; "size": "size"; "disabled": "disabled"; "disabledReason": "disabledReason"; "cngxDescribedBy": "cngxDescribedBy"; "type": "type"; }; outputs: {}; }]>;
220
+ }
221
+
222
+ /**
223
+ * Square icon-only button on the `CngxButton` brain, `ghost` by default. Project an `svg`, `img`
224
+ * or `cngx-icon`; wrap a `mat-icon` in a `cngx-icon`.
225
+ *
226
+ * The glyph is `aria-hidden`, so nothing projected becomes the name. Set `aria-label`,
227
+ * `aria-labelledby` or `title`, else it warns [`CNGX1071`](/error-codes/cngx1071.md). On a coarse
228
+ * pointer the box floors to `--cngx-target-min` on both axes; the icon keeps its size.
229
+ *
230
+ * @wcag AA
231
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/icon-button.component.ts
232
+ * @since 0.3.0
233
+ * @relatedTo CngxButton, CngxButtonBrain, CngxAsyncClick, provideButtonConfig, CngxSplitButton, CngxIconMenuButton, CngxCloseButton
234
+ * <example-url>/#/common/button/icon-button/basic</example-url>
235
+ * <example-url>/#/common/button/icon-button/with-badge</example-url>
236
+ * @axis level atom
237
+ */
238
+ declare class CngxIconButton {
239
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxIconButton, never>;
240
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxIconButton, "button[cngxIconButton], a[cngxIconButton]", ["cngxIconButton"], {}, {}, never, ["*"], true, [{ directive: typeof CngxButtonBrain; inputs: { "variant": "cngxIconButton"; "tone": "tone"; "size": "size"; "disabled": "disabled"; "disabledReason": "disabledReason"; "cngxDescribedBy": "cngxDescribedBy"; "type": "type"; }; outputs: {}; }]>;
241
+ }
242
+
243
+ /**
244
+ * Close glyph for every `button[cngxCloseButton]` that projects none.
245
+ * `provideFeedback(withCloseIcon(MyIcon))` forwards to it.
246
+ *
247
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/close-button.component.ts
248
+ * @since 0.3.0
249
+ * @relatedTo provideButtonCloseIcon, injectButtonCloseIcon, CngxCloseButton
250
+ * <example-url>/#/common/button/close-button/provided-icon</example-url>
251
+ */
252
+ declare const CNGX_BUTTON_CLOSE_ICON: InjectionToken<Type<unknown>>;
253
+ /**
254
+ * Close glyph for every close button below that projects none. `providers` or `viewProviders`;
255
+ * the nearest wins.
256
+ *
257
+ * ```ts
258
+ * bootstrapApplication(App, { providers: [provideButtonCloseIcon(MaterialCloseIcon)] });
259
+ * ```
260
+ *
261
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/close-button.component.ts
262
+ * @since 0.3.0
263
+ * @relatedTo CNGX_BUTTON_CLOSE_ICON, injectButtonCloseIcon, CngxCloseButton
264
+ * <example-url>/#/common/button/close-button/provided-icon</example-url>
265
+ */
266
+ declare function provideButtonCloseIcon(component: Type<unknown>): Provider;
267
+ /**
268
+ * The {@link provideButtonCloseIcon} glyph, or `null` for the default X. For custom dismiss hosts.
269
+ *
270
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/close-button.component.ts
271
+ * @since 0.3.0
272
+ * @relatedTo CNGX_BUTTON_CLOSE_ICON, provideButtonCloseIcon
273
+ */
274
+ declare function injectButtonCloseIcon(): Type<unknown> | null;
275
+ /**
276
+ * Dismiss button with the X glyph, on the icon-button geometry. Name the dismissed thing in
277
+ * `aria-label` (`"Close session-expired alert"`, not `"Close"`), else it warns
278
+ * [`CNGX1071`](/error-codes/cngx1071.md).
279
+ *
280
+ * Pins `ghost`, `sm` and `neutral` against the group and the config; inputs still win. Under the
281
+ * Material bridge the default `sm` takes the 40px M3 icon-button box with a 24px glyph.
282
+ *
283
+ * ```html
284
+ * <button cngxCloseButton aria-label="Dismiss toast" [disabled]="saving()" disabledReason="Saving">
285
+ * <svg aria-hidden="true" viewBox="0 0 24 24">...</svg>
286
+ * </button>
287
+ * ```
288
+ *
289
+ * @wcag AA
290
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/close-button.component.ts
291
+ * @since 0.3.0
292
+ * @relatedTo provideButtonCloseIcon, CngxIconButton, CngxButtonBrain, CngxAlert, CngxToastOutlet, CngxPopoverPanel, withCloseIcon
293
+ * <example-url>/#/common/button/close-button/basic</example-url>
294
+ * <example-url>/#/common/button/close-button/projected-icon</example-url>
295
+ * <example-url>/#/common/button/close-button/provided-icon</example-url>
296
+ * <example-url>/#/common/button/close-button/contextual-labels</example-url>
297
+ * <example-url>/#/common/button/close-button/inside-a-dismissible-card</example-url>
298
+ * @axis level molecule
299
+ */
300
+ declare class CngxCloseButton {
301
+ /** @internal - app-wide glyph from `CNGX_BUTTON_CLOSE_ICON`. */
302
+ protected readonly customIcon: Type<unknown> | null;
303
+ /** @internal - default X glyph from the shared icon set. */
304
+ protected readonly closeIcon: {
305
+ readonly viewBox: "0 0 24 24";
306
+ readonly d: "M6 6l12 12M18 6L6 18";
307
+ readonly paint: "stroke";
308
+ readonly micro: {
309
+ readonly viewBox: "0 0 12 12";
310
+ readonly d: "M2 3L3 2L10 9L9 10ZM9 2L10 3L3 10L2 9Z";
311
+ };
312
+ readonly small: {
313
+ readonly viewBox: "0 0 16 16";
314
+ readonly d: "M3 4L4 3L13 12L12 13ZM12 3L13 4L4 13L3 12Z";
315
+ };
316
+ };
317
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxCloseButton, never>;
318
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxCloseButton, "button[cngxCloseButton]", ["cngxCloseButton"], {}, {}, never, ["*"], true, [{ directive: typeof CngxButtonBrain; inputs: { "variant": "cngxCloseButton"; "tone": "tone"; "size": "size"; "disabled": "disabled"; "disabledReason": "disabledReason"; "cngxDescribedBy": "cngxDescribedBy"; "type": "type"; }; outputs: {}; }]>;
319
+ }
320
+
321
+ /**
322
+ * Custom busy glyph in place of the built-in spinner. Only the glyph changes: the `aria-hidden`
323
+ * layer and its show delay and min-dwell stay.
324
+ *
325
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-spinner.token.ts
326
+ * @since 0.3.0
327
+ * @relatedTo provideButtonSpinner, injectButtonSpinner, CngxButtonBrain, CngxButton
328
+ * <example-url>/#/common/button/button/custom-spinner</example-url>
329
+ */
330
+ declare const CNGX_BUTTON_SPINNER: InjectionToken<Type<unknown>>;
331
+ /**
332
+ * Busy glyph for every cngx button below. `providers` or `viewProviders`; the nearest wins.
333
+ *
334
+ * ```ts
335
+ * bootstrapApplication(App, { providers: [provideButtonSpinner(MyDotsSpinner)] });
336
+ * ```
337
+ *
338
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-spinner.token.ts
339
+ * @since 0.3.0
340
+ * @relatedTo CNGX_BUTTON_SPINNER, injectButtonSpinner
341
+ * <example-url>/#/common/button/button/custom-spinner</example-url>
342
+ */
343
+ declare function provideButtonSpinner(component: Type<unknown>): Provider;
344
+ /**
345
+ * The {@link provideButtonSpinner} glyph, or `null` for the built-in spinner.
346
+ *
347
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-spinner.token.ts
348
+ * @since 0.3.0
349
+ * @relatedTo CNGX_BUTTON_SPINNER, provideButtonSpinner
350
+ */
351
+ declare function injectButtonSpinner(): Type<unknown> | null;
352
+
353
+ /**
354
+ * Defaults for every host on `CngxButtonBrain`. Each axis resolves
355
+ * `input ?? fixed ?? group ?? config ?? default` (README, "Axes"). An unset key falls through to
356
+ * the host default, which is how the icon buttons keep `ghost` unless the app picks a variant.
357
+ *
358
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
359
+ * @since 0.3.0
360
+ * @relatedTo provideButtonConfig, provideButtonConfigAt, injectButtonConfig
361
+ */
362
+ interface CngxButtonConfig {
363
+ readonly variant?: CngxButtonVariant;
364
+ readonly tone?: CngxButtonTone;
365
+ readonly size?: CngxButtonSize;
366
+ }
367
+ /**
368
+ * The resolved {@link CngxButtonConfig}. Empty by default.
369
+ *
370
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
371
+ * @since 0.3.0
372
+ * @relatedTo provideButtonConfig, injectButtonConfig, withButtonVariant, withButtonTone, withButtonSize
373
+ */
374
+ declare const CNGX_BUTTON_CONFIG: InjectionToken<CngxButtonConfig>;
375
+ /**
376
+ * Feature returned by a `withButton*` config function, passed to `provideButtonConfig` or
377
+ * `provideButtonConfigAt`.
378
+ *
379
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
380
+ * @since 0.3.0
381
+ * @relatedTo provideButtonConfig, provideButtonConfigAt
382
+ */
383
+ interface CngxButtonConfigFeature {
384
+ readonly config: CngxButtonConfig;
385
+ }
386
+ /**
387
+ * Default emphasis in scope. An input, a pinned axis or a group still wins.
388
+ *
389
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
390
+ * @since 0.3.0
391
+ * @relatedTo provideButtonConfig, provideButtonConfigAt
392
+ */
393
+ declare function withButtonVariant(variant: CngxButtonVariant): CngxButtonConfigFeature;
394
+ /**
395
+ * Default intent in scope. An input or a pinned tone still wins, so the close button stays
396
+ * `neutral`.
397
+ *
398
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
399
+ * @since 0.3.0
400
+ * @relatedTo provideButtonConfig, provideButtonConfigAt
401
+ */
402
+ declare function withButtonTone(tone: CngxButtonTone): CngxButtonConfigFeature;
403
+ /**
404
+ * Default size in scope. An input, a pinned size or a group still wins.
405
+ *
406
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
407
+ * @since 0.3.0
408
+ * @relatedTo provideButtonConfig, provideButtonConfigAt
409
+ */
410
+ declare function withButtonSize(size: CngxButtonSize): CngxButtonConfigFeature;
411
+ /**
412
+ * App-wide button defaults from `withButton*` features.
413
+ *
414
+ * ```ts
415
+ * bootstrapApplication(AppComponent, {
416
+ * providers: [provideButtonConfig(withButtonVariant('outline'), withButtonSize('sm'))],
417
+ * });
418
+ * ```
419
+ *
420
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
421
+ * @since 0.3.0
422
+ * @relatedTo withButtonVariant, withButtonTone, withButtonSize, provideButtonConfigAt
423
+ */
424
+ declare function provideButtonConfig(...features: CngxButtonConfigFeature[]): EnvironmentProviders;
425
+ /**
426
+ * `viewProviders` twin of {@link provideButtonConfig}. Merges over the parent scope's config, so
427
+ * nested scopes cascade.
428
+ *
429
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
430
+ * @since 0.3.0
431
+ * @relatedTo provideButtonConfig, withButtonVariant, withButtonTone, withButtonSize
432
+ */
433
+ declare function provideButtonConfigAt(...features: CngxButtonConfigFeature[]): Provider[];
434
+ /**
435
+ * The config resolved for the current injector. For custom hosts and segments that size
436
+ * themselves like a button, as `CngxButtonGroupAddon` does.
437
+ *
438
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-config.ts
439
+ * @since 0.3.0
440
+ * @relatedTo CNGX_BUTTON_CONFIG, provideButtonConfig
441
+ */
442
+ declare function injectButtonConfig(): CngxButtonConfig;
443
+
444
+ /**
445
+ * What a button group hands its children. `undefined` falls through to the config.
446
+ *
447
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-group.token.ts
448
+ * @since 0.3.0
449
+ * @relatedTo CNGX_BUTTON_GROUP, CngxButtonGroup
450
+ */
451
+ interface CngxButtonGroupContext {
452
+ readonly variant: Signal<CngxButtonVariant | undefined>;
453
+ readonly size: Signal<CngxButtonSize | undefined>;
454
+ }
455
+ /**
456
+ * Provided by a button group so children read it without importing the group class.
457
+ *
458
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-group.token.ts
459
+ * @since 0.3.0
460
+ * @relatedTo CngxButton, CngxButtonGroup, CngxButtonGroupAddon, CngxButtonBrain
461
+ */
462
+ declare const CNGX_BUTTON_GROUP: InjectionToken<CngxButtonGroupContext>;
463
+
464
+ /**
465
+ * The busy layer and the reason span of a button family host, rendered once for every host. Put
466
+ * it last in the host template. It reads the host's `CngxButtonBrain`: the busy layer shows while
467
+ * `busyVisible` holds (with `provideButtonSpinner`'s glyph, or the built-in ring), and the hidden
468
+ * reason span carries the id the brain's `aria-describedby` points at while `disabled` has a
469
+ * reason. On an action host (`CNGX_ACTION_STATUS` present) the busy layer yields to an active
470
+ * status label. The element is `display: contents`, so it adds no box and no flex gap.
471
+ *
472
+ * ```html
473
+ * <span class="cngx-button__label"><ng-content /></span>
474
+ * <cngx-button-adornment />
475
+ * ```
476
+ *
477
+ * @wcag AA
478
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-adornment.component.ts
479
+ * @since 0.3.0
480
+ * @relatedTo CngxButtonBrain, provideButtonHost, CngxActionStatusBrain
481
+ * <example-url>/#/common/button/button/async-click-busy</example-url>
482
+ * <example-url>/#/common/button/button/disabled-with-reason</example-url>
483
+ * @axis level atom
484
+ */
485
+ declare class CngxButtonAdornment {
486
+ /** @internal */
487
+ protected readonly brain: CngxButtonBrain;
488
+ /** @internal */
489
+ protected readonly busy: _angular_core.Signal<boolean>;
490
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButtonAdornment, never>;
491
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxButtonAdornment, "cngx-button-adornment", never, {}, {}, never, never, true, never>;
492
+ }
493
+
494
+ /**
495
+ * Static facts about a button host, read by `CngxButtonBrain`.
496
+ *
497
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-host.token.ts
498
+ * @since 0.3.0
499
+ * @relatedTo provideButtonHost, CngxButtonBrain
500
+ */
501
+ interface CngxButtonHostDescriptor {
502
+ /** Selector name, e.g. `'cngxIconButton'`, printed by dev diagnostics. */
503
+ readonly name: string;
504
+ /** Last fallback of the variant chain. */
505
+ readonly defaultVariant: CngxButtonVariant;
506
+ /** Axes pinned against the group and the config; the input still wins. */
507
+ readonly fixed?: {
508
+ readonly variant?: CngxButtonVariant;
509
+ readonly tone?: CngxButtonTone;
510
+ readonly size?: CngxButtonSize;
511
+ };
512
+ /** No visible text: turns on the [`CNGX1071`](/error-codes/cngx1071.md) name check. */
513
+ readonly iconOnly?: boolean;
514
+ }
515
+ /**
516
+ * The host descriptor of `CngxButtonBrain`, set through {@link provideButtonHost}. A host fact,
517
+ * not a consumer option.
518
+ *
519
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-host.token.ts
520
+ * @since 0.3.0
521
+ * @relatedTo CngxButtonBrain, provideButtonHost, CNGX_BUTTON_HOST_STATE
522
+ */
523
+ declare const CNGX_BUTTON_HOST: InjectionToken<CngxButtonHostDescriptor>;
524
+ /**
525
+ * The {@link CNGX_BUTTON_HOST} descriptor. Goes in the `providers` of the class that declares
526
+ * `CngxButtonBrain` in its `hostDirectives`. Full host in the README, "Building a custom button
527
+ * host".
528
+ *
529
+ * ```ts
530
+ * providers: [provideButtonHost('appChipButton', { defaultVariant: 'outline' })]
531
+ * ```
532
+ *
533
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-host.token.ts
534
+ * @since 0.3.0
535
+ * @relatedTo CngxButtonBrain, CNGX_BUTTON_HOST, CngxActionButton
536
+ */
537
+ declare function provideButtonHost(name: string, descriptor: Omit<CngxButtonHostDescriptor, 'name'>): Provider;
538
+ /**
539
+ * Refusal and a run a host adds on top of the brain's inputs, e.g. a split caret blocked by its
540
+ * main action.
541
+ *
542
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-host.token.ts
543
+ * @since 0.3.0
544
+ * @relatedTo CNGX_BUTTON_HOST_STATE, CngxButtonBrain, CngxSplitCaret
545
+ */
546
+ interface CngxButtonHostState {
547
+ /** Folded into `blocked`; never references the disabled reason. */
548
+ readonly refusing: Signal<boolean>;
549
+ /**
550
+ * A run the co-hosted runner does not own. Reads busy and refuses activation. Without a runner
551
+ * it also drives `busyVisible()` on the `CNGX_LOADING_CONFIG` timing.
552
+ */
553
+ readonly busy?: Signal<boolean>;
554
+ }
555
+ /**
556
+ * Optional host state on the host element. Read on first use, so a factory may inject the host
557
+ * component.
558
+ *
559
+ * ```ts
560
+ * providers: [
561
+ * { provide: CNGX_BUTTON_HOST_STATE, useFactory: () => inject(AppCaret).hostState },
562
+ * ]
563
+ * ```
564
+ *
565
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-host.token.ts
566
+ * @since 0.3.0
567
+ * @relatedTo CngxButtonBrain, CNGX_BUTTON_HOST, CngxSplitCaret
568
+ */
569
+ declare const CNGX_BUTTON_HOST_STATE: InjectionToken<CngxButtonHostState>;
570
+
571
+ /**
572
+ * Providers for a button host on `CngxActionStatusBrain`, next to {@link provideButtonHost}.
573
+ * `CNGX_HOST_INTERACTION_STATE` adds the `CNGX_ACTION_STATUS` announcement, so the runner's live
574
+ * region speaks what the host shows (without it the region stays silent).
575
+ * `CNGX_BUTTON_HOST_STATE` makes a bound `[externalState]` in flight refuse clicks and read busy.
576
+ *
577
+ * ```ts
578
+ * @Component({
579
+ * selector: 'button[appSaveButton]',
580
+ * hostDirectives: [
581
+ * CngxButtonBrain,
582
+ * { directive: CngxAsyncClick, inputs: ['cngxAsyncClick: action'] },
583
+ * { directive: CngxActionStatusBrain, inputs: ['succeededLabel', 'failedLabel'] },
584
+ * ],
585
+ * providers: [
586
+ * provideButtonHost('appSaveButton', { defaultVariant: 'solid' }),
587
+ * provideActionStatusHost(),
588
+ * ],
589
+ * template: '...',
590
+ * })
591
+ * class AppSaveButton {}
592
+ * ```
593
+ *
594
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/action-status-host.ts
595
+ * @since 0.3.0
596
+ * @relatedTo provideButtonHost, CngxButtonBrain, CngxActionStatusBrain, CNGX_ACTION_STATUS, CNGX_BUTTON_HOST_STATE, CngxActionButton
597
+ */
598
+ declare function provideActionStatusHost(): Provider[];
599
+
600
+ /**
601
+ * Main axis of a `cngxButtonGroup`.
602
+ *
603
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-group.directive.ts
604
+ * @since 0.3.0
605
+ * @relatedTo CngxButtonGroup
606
+ */
607
+ type CngxButtonGroupOrientation = 'horizontal' | 'vertical';
608
+ /**
609
+ * Joins buttons, icon buttons, addons and separators into one framed `role="group"` row or
610
+ * column. Seams collapse to one border; a hovered or focused segment is lifted so its ring is
611
+ * never clipped. `variant` and `size` reach every button inside; `tone` is per button.
612
+ *
613
+ * A group with a group child is a toolbar: the sub-groups sit apart, the gap floored to
614
+ * `--cngx-target-gap` on a coarse pointer. Wrap a loose button next to sub-groups in its own
615
+ * group.
616
+ *
617
+ * Needs `aria-label` or `aria-labelledby`, else warns [`CNGX1072`](/error-codes/cngx1072.md).
618
+ * The geometry ships in the global `cngx.css` bundle, not on the directive.
619
+ *
620
+ * ```html
621
+ * <div cngxButtonGroup variant="outline" aria-label="History">
622
+ * <button cngxButton>Undo</button>
623
+ * <button cngxButton>Redo</button>
624
+ * </div>
625
+ * ```
626
+ *
627
+ * @wcag AA
628
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-group.directive.ts
629
+ * @since 0.3.0
630
+ * @relatedTo CngxButton, CngxIconButton, CngxButtonGroupAddon, CngxButtonGroupSeparator, CNGX_BUTTON_GROUP, CngxSplitButton, CngxIconMenuButton, CngxButtonToggleGroup
631
+ * <example-url>/#/common/button/group/basic</example-url>
632
+ * <example-url>/#/common/button/group/vertical</example-url>
633
+ * <example-url>/#/common/button/group/with-addon</example-url>
634
+ * <example-url>/#/common/button/group/icon-toolbar</example-url>
635
+ * <example-url>/#/common/menu-button/split-button/basic</example-url>
636
+ * @axis level molecule
637
+ */
638
+ declare class CngxButtonGroup implements CngxButtonGroupContext {
639
+ private readonly parent;
640
+ /** Emphasis for the buttons inside. Falls through to an outer group. */
641
+ readonly variantInput: _angular_core.InputSignal<CngxButtonVariant | undefined>;
642
+ /** Size for the buttons and addons inside. Falls through to an outer group. */
643
+ readonly sizeInput: _angular_core.InputSignal<CngxButtonSize | undefined>;
644
+ /** `vertical` stacks the segments. */
645
+ readonly orientation: _angular_core.InputSignal<CngxButtonGroupOrientation>;
646
+ /** This group's input, else the outer group's. */
647
+ readonly variant: _angular_core.Signal<CngxButtonVariant | undefined>;
648
+ /** This group's input, else the outer group's. */
649
+ readonly size: _angular_core.Signal<CngxButtonSize | undefined>;
650
+ constructor();
651
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButtonGroup, never>;
652
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxButtonGroup, "[cngxButtonGroup]", ["cngxButtonGroup"], { "variantInput": { "alias": "variant"; "required": false; "isSignal": true; }; "sizeInput": { "alias": "size"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
653
+ }
654
+
655
+ /**
656
+ * A non-interactive segment in a `cngxButtonGroup` for an avatar, icon, count or short text. It
657
+ * takes the row height of the buttons beside it and their padding and type tokens, so a theme
658
+ * that re-sets them (the Material bridge) reaches it too. No role; its text is read in document
659
+ * order.
660
+ *
661
+ * ```html
662
+ * <div cngxButtonGroup variant="outline" aria-label="Assignee">
663
+ * <span cngxButtonGroupAddon><cngx-avatar name="Ada Lovelace" size="sm" /></span>
664
+ * <button cngxButton>Reassign</button>
665
+ * </div>
666
+ * ```
667
+ *
668
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-group-addon.directive.ts
669
+ * @since 0.3.0
670
+ * @relatedTo CngxButtonGroup, CngxButtonGroupSeparator, CngxButton
671
+ * <example-url>/#/common/button/group/with-addon</example-url>
672
+ */
673
+ declare class CngxButtonGroupAddon {
674
+ private readonly group;
675
+ private readonly config;
676
+ /** Resolved row size. */
677
+ protected readonly size: _angular_core.Signal<CngxButtonSize>;
678
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButtonGroupAddon, never>;
679
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxButtonGroupAddon, "[cngxButtonGroupAddon]", never, {}, {}, never, never, true, never>;
680
+ }
681
+
682
+ /**
683
+ * Divider between segments of a `cngxButtonGroup`, drawn as a border so it survives forced
684
+ * colors, and follows the orientation. `aria-hidden="true"`: when the split carries meaning, use
685
+ * two labelled groups.
686
+ *
687
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/button/button-group-separator.directive.ts
688
+ * @since 0.3.0
689
+ * @relatedTo CngxButtonGroup, CngxButtonGroupAddon
690
+ * <example-url>/#/common/button/group/basic</example-url>
691
+ */
692
+ declare class CngxButtonGroupSeparator {
693
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxButtonGroupSeparator, never>;
694
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxButtonGroupSeparator, "[cngxButtonGroupSeparator]", never, {}, {}, never, never, true, never>;
695
+ }
696
+
697
+ export { CNGX_BUTTON_CLOSE_ICON, CNGX_BUTTON_CONFIG, CNGX_BUTTON_GROUP, CNGX_BUTTON_HOST, CNGX_BUTTON_HOST_STATE, CNGX_BUTTON_SPINNER, CNGX_BUTTON_STATE, CngxButton, CngxButtonAdornment, CngxButtonBrain, CngxButtonEnd, CngxButtonGroup, CngxButtonGroupAddon, CngxButtonGroupSeparator, CngxButtonStart, CngxCloseButton, CngxIconButton, injectButtonCloseIcon, injectButtonConfig, injectButtonSpinner, provideActionStatusHost, provideButtonCloseIcon, provideButtonConfig, provideButtonConfigAt, provideButtonHost, provideButtonSpinner, withButtonSize, withButtonTone, withButtonVariant };
698
+ export type { CngxButtonConfig, CngxButtonConfigFeature, CngxButtonGroupContext, CngxButtonGroupOrientation, CngxButtonHostDescriptor, CngxButtonHostState, CngxButtonSize, CngxButtonState, CngxButtonTone, CngxButtonType, CngxButtonVariant };