mn-angular-lib 1.0.177 → 1.0.179

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 (66) hide show
  1. package/fesm2022/mn-angular-lib-alert.mjs +535 -0
  2. package/fesm2022/mn-angular-lib-alert.mjs.map +1 -0
  3. package/fesm2022/mn-angular-lib-bottom-sheet.mjs +356 -0
  4. package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -0
  5. package/fesm2022/mn-angular-lib-button.mjs +382 -0
  6. package/fesm2022/mn-angular-lib-button.mjs.map +1 -0
  7. package/fesm2022/mn-angular-lib-calendar-core.mjs +377 -0
  8. package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -0
  9. package/fesm2022/mn-angular-lib-calendar.mjs +1513 -0
  10. package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -0
  11. package/fesm2022/mn-angular-lib-collection.mjs +2277 -0
  12. package/fesm2022/mn-angular-lib-collection.mjs.map +1 -0
  13. package/fesm2022/mn-angular-lib-core.mjs +1232 -0
  14. package/fesm2022/mn-angular-lib-core.mjs.map +1 -0
  15. package/fesm2022/mn-angular-lib-display.mjs +728 -0
  16. package/fesm2022/mn-angular-lib-display.mjs.map +1 -0
  17. package/fesm2022/mn-angular-lib-forms.mjs +4260 -0
  18. package/fesm2022/mn-angular-lib-forms.mjs.map +1 -0
  19. package/fesm2022/mn-angular-lib-keyboard.mjs +195 -0
  20. package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -0
  21. package/fesm2022/mn-angular-lib-modal-core.mjs +945 -0
  22. package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -0
  23. package/fesm2022/mn-angular-lib-modal-ui.mjs +2016 -0
  24. package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -0
  25. package/fesm2022/mn-angular-lib-modal.mjs +126 -0
  26. package/fesm2022/mn-angular-lib-modal.mjs.map +1 -0
  27. package/fesm2022/mn-angular-lib-rich-text-editor.mjs +275 -0
  28. package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -0
  29. package/fesm2022/mn-angular-lib-segmented.mjs +246 -0
  30. package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -0
  31. package/fesm2022/mn-angular-lib-tab.mjs +573 -0
  32. package/fesm2022/mn-angular-lib-tab.mjs.map +1 -0
  33. package/fesm2022/mn-angular-lib.mjs +21 -15509
  34. package/fesm2022/mn-angular-lib.mjs.map +1 -1
  35. package/package.json +66 -1
  36. package/src/lib/styles/index.css +2 -2
  37. package/types/mn-angular-lib-alert.d.ts +258 -0
  38. package/types/mn-angular-lib-bottom-sheet.d.ts +173 -0
  39. package/types/mn-angular-lib-button.d.ts +318 -0
  40. package/types/mn-angular-lib-calendar-core.d.ts +378 -0
  41. package/types/mn-angular-lib-calendar.d.ts +636 -0
  42. package/types/mn-angular-lib-collection.d.ts +1550 -0
  43. package/types/mn-angular-lib-core.d.ts +756 -0
  44. package/types/mn-angular-lib-display.d.ts +1075 -0
  45. package/types/mn-angular-lib-forms.d.ts +3235 -0
  46. package/types/mn-angular-lib-keyboard.d.ts +128 -0
  47. package/types/mn-angular-lib-modal-core.d.ts +1130 -0
  48. package/types/mn-angular-lib-modal-ui.d.ts +492 -0
  49. package/types/mn-angular-lib-modal.d.ts +27 -0
  50. package/types/mn-angular-lib-rich-text-editor.d.ts +157 -0
  51. package/types/mn-angular-lib-segmented.d.ts +395 -0
  52. package/types/mn-angular-lib-tab.d.ts +313 -0
  53. package/types/mn-angular-lib.d.ts +16 -10816
  54. /package/{src/lib/features → alert/src}/mn-alert/mn-alert-outlet/mn-alert-outlet.css +0 -0
  55. /package/{src/lib/features → bottom-sheet/src}/mn-bottom-sheet/mn-bottom-sheet.component.css +0 -0
  56. /package/{src/lib/features → button/src}/mn-skeleton/mn-skeleton.css +0 -0
  57. /package/{src/lib/features → collection/src}/mn-list/mn-list.component.css +0 -0
  58. /package/{src/lib/features → forms/src}/mn-checkbox/mn-checkbox.css +0 -0
  59. /package/{src/lib/features → forms/src}/mn-dropdown/mn-dropdown.css +0 -0
  60. /package/{src/lib/features → forms/src}/mn-multi-select/mn-multi-select.css +0 -0
  61. /package/{src/lib/features → keyboard/src}/mn-keyboard/mn-keyboard.component.css +0 -0
  62. /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-confirmation-body/mn-confirmation-body.component.css +0 -0
  63. /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-form-body/mn-form-body.component.css +0 -0
  64. /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-modal-shell/mn-modal-shell.component.css +0 -0
  65. /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-wizard-body/mn-wizard-body.component.css +0 -0
  66. /package/{src/lib/features → rich-text-editor/src}/mn-rich-text-editor/mn-rich-text-editor.component.css +0 -0
@@ -0,0 +1,313 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Signal, DoCheck, AfterViewInit, AfterViewChecked, OnDestroy, EventEmitter } from '@angular/core';
3
+ import { MnCollectionState } from 'mn-angular-lib/collection';
4
+
5
+ /**
6
+ * Configuration for a single tab item.
7
+ */
8
+ type MnTabItem = {
9
+ /** Translation key or label text for the tab. */
10
+ label: string;
11
+ /**
12
+ * Stable value this tab is written as in the URL while the tab bar mirrors
13
+ * its selection there (see {@link MnTabDataSource.urlParam}).
14
+ *
15
+ * Defaults to a slug of the last segment of {@link label}
16
+ * (`matches.hub.tab.entrants` → `entrants`, `members.tabMembers` →
17
+ * `tab-members`). Set it when that slug is not the URL you want to hand out,
18
+ * or when the label key may be renamed — a shared link is only as stable as
19
+ * the value in it.
20
+ */
21
+ id?: string;
22
+ /** Callback invoked when this tab becomes active. */
23
+ onClick?: () => void;
24
+ /** Callback invoked when this tab is deactivated. */
25
+ onDeactivate?: () => void;
26
+ /** Optional notification count shown as a badge on the tab. Accepts a plain number or a Signal<number>. Hidden when 0 or absent. */
27
+ badge?: number | Signal<number>;
28
+ };
29
+ /**
30
+ * Data source configuration for the mn-tab component.
31
+ */
32
+ type MnTabDataSource = {
33
+ /** List of tab items to display. */
34
+ items: MnTabItem[];
35
+ /** Index of the tab that should be active by default. */
36
+ defaultActive: number;
37
+ /**
38
+ * Lifecycle state of the tab set. When {@link MnCollectionState.LOADING} the tab
39
+ * bar renders a loading skeleton; any other state renders the real tabs.
40
+ */
41
+ state?: MnCollectionState;
42
+ /**
43
+ * Number of placeholder tabs to render while {@link state} is LOADING.
44
+ * Defaults to the number of known `items`, falling back to 3 when no items are
45
+ * known yet. Set this only when the real tabs are not yet known at load time
46
+ * (e.g. tabs that depend on data being fetched) to predict the final count.
47
+ */
48
+ skeletonCount?: number;
49
+ /**
50
+ * Query parameter the active tab is mirrored in, so a reload or a shared
51
+ * link lands on the tab the user was looking at. Defaults to `'tab'`; pass
52
+ * `false` to keep this tab bar out of the URL.
53
+ *
54
+ * Each tab bar that can be on screen at the same time as another needs its
55
+ * own parameter name — two bars sharing one name fight over it. Turn it off
56
+ * for a tab bar whose selection is not worth sharing, such as one inside a
57
+ * modal, which would otherwise write to the URL of the page behind it.
58
+ *
59
+ * Only user selections are written, so a page nobody has clicked a tab on
60
+ * keeps a clean URL and falls back to {@link defaultActive}. Restoring a tab
61
+ * from the URL runs that tab's {@link MnTabItem.onClick} and emits
62
+ * `activeChange`, so a consumer tracking the active tab itself hears about
63
+ * the restored one.
64
+ */
65
+ urlParam?: string | false;
66
+ };
67
+
68
+ /**
69
+ * Tab component that renders a horizontal tab bar.
70
+ * Supports translation keys for labels via MnTranslatePipe.
71
+ *
72
+ * The active tab is mirrored in the URL query string by default, so a reload,
73
+ * a back button or a shared link lands on the same tab; see
74
+ * {@link MnTabDataSource.urlParam} to rename that parameter or switch it off.
75
+ */
76
+ declare class MnTabComponent implements DoCheck, AfterViewInit, AfterViewChecked, OnDestroy {
77
+ /**
78
+ * Router the active tab is written to. Optional: a tab bar used outside a
79
+ * routed application still works, it just has no URL to mirror into.
80
+ */
81
+ private readonly router;
82
+ /** Route the tab value is read back from; absent for the same reason as {@link router}. */
83
+ private readonly route;
84
+ /** Watches the URL so a deep link, a back button or an in-app link moves the tab bar. */
85
+ private readonly queryParamsSub?;
86
+ /**
87
+ * URL keys of the current items, memoised on the items array so a slug is
88
+ * computed once per tab set rather than on every change-detection pass.
89
+ */
90
+ private urlKeyCache?;
91
+ /** URL key of {@link currentActive}, so a rebuilt tab set can be recognised as the same tab. */
92
+ private currentKey?;
93
+ /**
94
+ * Key of a selection whose URL write has not landed yet. Navigation is
95
+ * asynchronous, so a consumer that rebuilds its tabs in response to the click
96
+ * can be resolved against a URL that still names the previous tab; until the
97
+ * write completes, this is the truth about what the user picked.
98
+ */
99
+ private pendingKey?;
100
+ /** Set on destroy so a deferred restore can't announce a tab nobody is showing. */
101
+ private destroyed;
102
+ /** The horizontally-scrolling wrapper the edge fade is painted onto. */
103
+ private scrollContainer?;
104
+ /** The tab row; queried for the active tab so the indicator can measure it. */
105
+ private tabList?;
106
+ /** The shared underline that slides to the active tab. */
107
+ private indicator?;
108
+ /** Pending indicator remeasure, cancelled on destroy so a post-destroy frame can't read a detached ref. */
109
+ private indicatorFrame?;
110
+ /**
111
+ * True while a click-initiated slide is animating. The active tab's
112
+ * `font-bold` widens the row, which fires {@link resizeObserver}; without
113
+ * this guard the observer's snap ({@link updateIndicator} with `animate:
114
+ * false`) would land the indicator at its target the same frame the slide
115
+ * starts, so the transition never paints. Set synchronously in
116
+ * {@link setActive} — before the frame runs — so the guard doesn't depend on
117
+ * rAF-vs-ResizeObserver callback ordering.
118
+ */
119
+ private sliding;
120
+ /** Clears {@link sliding} after the slide finishes; re-armed per click, cancelled on destroy. */
121
+ private slidingTimer?;
122
+ /** Slide duration in ms; matches the indicator's `duration-300` transition. */
123
+ private static readonly SLIDE_MS;
124
+ /** How far the fade reaches in from each overflowing edge. */
125
+ private static readonly FADE;
126
+ /** Data source containing tab items and default active index. */
127
+ dataSource: MnTabDataSource;
128
+ /**
129
+ * Whether to enable horizontal scrolling when items overflow.
130
+ * When true, tabs scroll horizontally instead of overflowing their container.
131
+ *
132
+ * Defaults to `true`: the tab bar never wraps (`flex-nowrap`), so without
133
+ * scrolling an overflowing bar would clip its last tabs or push the page width
134
+ * on narrow screens. When the tabs already fit, `overflow-x-auto` is a no-op,
135
+ * so this default only ever changes behaviour for the overflow case it fixes.
136
+ */
137
+ scrollable: boolean;
138
+ /**
139
+ * Whether tabs should stretch to fill the available width.
140
+ * Defaults to false, so tabs only take as much space as their content.
141
+ */
142
+ justified: boolean;
143
+ /** Emits the newly activated tab item whenever the active tab changes. */
144
+ activeChange: EventEmitter<MnTabItem>;
145
+ /** The currently active tab item. */
146
+ currentActive?: MnTabItem;
147
+ /** Watches the wrapper and the tab row so the fade re-evaluates on width or content changes. */
148
+ private resizeObserver?;
149
+ /**
150
+ * Whether the tab bar is loading and should render skeleton tabs, from
151
+ * {@link MnTabDataSource.state}.
152
+ */
153
+ get isLoadingState(): boolean;
154
+ /**
155
+ * Index array sizing the loading skeleton: `skeletonCount` when provided,
156
+ * otherwise the number of known items, falling back to a default when none.
157
+ */
158
+ get skeletonTabs(): number[];
159
+ constructor();
160
+ /**
161
+ * Re-resolves the active tab on every change-detection pass.
162
+ *
163
+ * The data source is often populated or rebuilt asynchronously (tabs that
164
+ * depend on fetched data or permissions). Resolving the active tab only once
165
+ * at init would leave {@link currentActive} pointing at a stale item — the
166
+ * tab bar would then highlight nothing and swallow the first click — so the
167
+ * selection is kept in sync with whatever the data source currently holds.
168
+ */
169
+ ngDoCheck(): void;
170
+ /**
171
+ * Starts watching the scroll wrapper so the edge fade stays honest. A scroll
172
+ * moves the fade to whichever side now hides tabs; a resize (viewport change)
173
+ * or a change to the tab row's width (tabs added, relabelled, skeleton →
174
+ * loaded) re-checks whether either edge overflows at all.
175
+ */
176
+ ngAfterViewInit(): void;
177
+ /** Wrapper geometry (`scrollWidth:clientWidth`) at the last fade evaluation. */
178
+ private lastFadeGeometry;
179
+ /**
180
+ * Re-evaluates the edge fade when the wrapper's scrollable extent changes without its box
181
+ * changing. {@link resizeObserver} only sees border-box changes, and the tab row is a
182
+ * block-level flex container that keeps its parent's width while its tabs overflow inside it,
183
+ * so tabs that arrive after init (permission-gated tabs, badge counts, skeleton → loaded) grow
184
+ * `scrollWidth` without firing it; until a resize or scroll the fade stayed off. Two property
185
+ * reads per pass; the repaint only runs when they moved.
186
+ */
187
+ ngAfterViewChecked(): void;
188
+ ngOnDestroy(): void;
189
+ /**
190
+ * Paints a fade over whichever edge has tabs scrolled out of view — a soft
191
+ * dissolve that reads as "more this way", the affordance a hidden scrollbar
192
+ * otherwise costs us. Uses a mask (content → transparent) rather than a
193
+ * background-coloured overlay, so it needs no knowledge of the theme.
194
+ */
195
+ updateEdgeFades(): void;
196
+ /**
197
+ * Sets the given tab item as active, invoking deactivate/activate callbacks,
198
+ * and records the selection in the URL so it survives a reload or a share.
199
+ * @param item - The tab item to activate.
200
+ */
201
+ setActive(item: MnTabItem): void;
202
+ /**
203
+ * Whether a tab is the bar's single Tab stop: the active tab, or the first tab while none is
204
+ * active yet. Every other tab is reached with the arrow keys, so Tab leaves the bar in one press.
205
+ * @param item - The tab to check.
206
+ * @returns True for the one tab that keeps `tabindex="0"`.
207
+ */
208
+ isTabStop(item: MnTabItem): boolean;
209
+ /**
210
+ * Keyboard handling on a tab. Left and Right move to the previous or next tab and wrap at the
211
+ * ends, Home and End jump to the first and last; the tab moved to is activated at once
212
+ * (automatic activation) and receives focus. Enter and Space activate the focused tab, handled
213
+ * on keydown so Space does not scroll the page first. Other keys are left alone.
214
+ * @param event - The keydown on a tab.
215
+ * @param item - The tab the key was pressed on.
216
+ */
217
+ onTabKeydown(event: KeyboardEvent, item: MnTabItem): void;
218
+ /**
219
+ * Moves focus to the tab at `index` and scrolls it into view inside a scrollable bar. Focusing
220
+ * works before change detection has moved `tabindex="0"` onto it, because a script may focus an
221
+ * element with `tabindex="-1"`.
222
+ * @param index - Position of the tab in the data source's items.
223
+ */
224
+ private focusTab;
225
+ /**
226
+ * Moves the selection to `item` and tells the consumer about it: the
227
+ * deactivate/activate/emit sequence a click produces, shared by the click
228
+ * path and the URL-driven ones (deep link, back button), which owe the
229
+ * consumer the same notifications.
230
+ * @param item - The tab item to activate.
231
+ */
232
+ private activate;
233
+ /**
234
+ * Marks a click-driven slide as in progress and schedules the guard to lift
235
+ * once the transition has finished. A timeout (not `transitionend`) so the
236
+ * flag still clears under `motion-reduce`, where no transition event fires.
237
+ */
238
+ private beginSlide;
239
+ /**
240
+ * Moves the shared underline to the active tab. When `animate` is false the
241
+ * move is snapped (no slide) by disabling the transition for one reflow —
242
+ * used on init, async selection and resize, where a slide would read as jank.
243
+ * @param animate - Whether the move should slide (true) or snap (false).
244
+ */
245
+ private updateIndicator;
246
+ /**
247
+ * Remeasures the indicator on the next animation frame, so the read happens
248
+ * after layout reflects the latest active-tab classes. Coalesces bursts and
249
+ * is cancellable on destroy.
250
+ * @param animate - Whether the resulting move should slide.
251
+ */
252
+ private scheduleIndicator;
253
+ /**
254
+ * Returns the resolved badge value for a tab item, supporting both plain numbers and Signal<number>.
255
+ * @param item - The tab item whose badge to resolve.
256
+ */
257
+ getBadge(item: MnTabItem): number | undefined;
258
+ /**
259
+ * Ensures {@link currentActive} references a tab that still exists in the data
260
+ * source, preferring the tab named in the URL and falling back to the
261
+ * configured default tab when the current selection is missing or stale
262
+ * (e.g. after the items array is replaced).
263
+ */
264
+ private syncActiveTab;
265
+ /**
266
+ * Records `item` as the selection, remembering its URL key so the same tab is
267
+ * recognised after the consumer rebuilds the items array.
268
+ * @param item - The newly selected tab.
269
+ */
270
+ private select;
271
+ /**
272
+ * Runs the restored tab's callbacks a change-detection pass later, unless the
273
+ * selection moved on in the meantime (a click, or another tab set arriving).
274
+ * @param item - The tab restored from the URL.
275
+ */
276
+ private announceRestored;
277
+ /**
278
+ * Activates the tab a URL value names, when it is not the tab already on
279
+ * screen. Values naming no known tab are ignored: another tab bar on the page
280
+ * may own that parameter, and a stale link should leave the default standing.
281
+ * @param key - The value read from the query parameter, if any.
282
+ */
283
+ private activateUrlKey;
284
+ /**
285
+ * The query parameter this tab bar mirrors into, or undefined when there is
286
+ * nothing to mirror into (no router) or the consumer switched it off.
287
+ */
288
+ private urlParam;
289
+ /**
290
+ * The tab the current URL asks for, if it names one of `items`.
291
+ * @param items - The tab set to resolve the URL value against.
292
+ */
293
+ private itemFromUrl;
294
+ /**
295
+ * Records the active tab in the query string, replacing the current history
296
+ * entry: switching tabs is not a navigation to walk back through, and back
297
+ * should leave the page rather than retrace its tabs.
298
+ * @param item - The tab that just became active.
299
+ */
300
+ private writeUrl;
301
+ /**
302
+ * The URL key of every tab, in item order: the item's `id`, else a slug of
303
+ * its label. Repeats are numbered so each tab still round-trips through the
304
+ * URL; give such tabs an explicit `id` to choose the value yourself.
305
+ * @param items - The tab set to key.
306
+ */
307
+ private urlKeys;
308
+ static ɵfac: i0.ɵɵFactoryDeclaration<MnTabComponent, never>;
309
+ static ɵcmp: i0.ɵɵComponentDeclaration<MnTabComponent, "mn-tab", never, { "dataSource": { "alias": "dataSource"; "required": false; }; "scrollable": { "alias": "scrollable"; "required": false; }; "justified": { "alias": "justified"; "required": false; }; }, { "activeChange": "activeChange"; }, never, never, true, never>;
310
+ }
311
+
312
+ export { MnTabComponent };
313
+ export type { MnTabDataSource, MnTabItem };