@mk-kit/ui 0.52.1 → 0.54.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.
@@ -0,0 +1,158 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import * as _mk_kit_ui_core from '@mk-kit/ui/core';
3
+ import { MkSize, MkTone } from '@mk-kit/ui/core';
4
+
5
+ /**
6
+ * Spinner — a circular indeterminate loading indicator. Exposes `role="status"`
7
+ * with a visually-hidden label so assistive tech announces the loading state.
8
+ * The animation slows under `prefers-reduced-motion`.
9
+ *
10
+ * ```html
11
+ * <mk-spinner />
12
+ * <mk-spinner size="lg" tone="neutral" label="Fetching results" />
13
+ * ```
14
+ */
15
+ declare class MkSpinner {
16
+ protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
17
+ /** Size scale. */
18
+ readonly size: _angular_core.InputSignal<MkSize>;
19
+ /** Semantic color tone. */
20
+ readonly tone: _angular_core.InputSignal<MkTone>;
21
+ /** Visually-hidden status label announced to screen readers. */
22
+ readonly label: _angular_core.InputSignal<string>;
23
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkSpinner, never>;
24
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSpinner, "mk-spinner", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
25
+ }
26
+
27
+ /** Visual treatment for a {@link MkBadge}. */
28
+ type MkBadgeVariant = 'solid' | 'soft' | 'outline';
29
+ /**
30
+ * Badge — a compact status pill, typically for counts or short state labels.
31
+ * Set `dot` for a minimal notification indicator with no text.
32
+ *
33
+ * ```html
34
+ * <mk-badge tone="success">Active</mk-badge>
35
+ * <mk-badge tone="danger" variant="solid">3</mk-badge>
36
+ * <mk-badge tone="danger" dot aria-label="Unread messages" />
37
+ * ```
38
+ */
39
+ declare class MkBadge {
40
+ /** Semantic color tone. */
41
+ readonly tone: _angular_core.InputSignal<MkTone>;
42
+ /** Visual treatment. */
43
+ readonly variant: _angular_core.InputSignal<MkBadgeVariant>;
44
+ /** Size scale. */
45
+ readonly size: _angular_core.InputSignal<MkSize>;
46
+ /** Render as a tiny dot (no text) for notification indicators. */
47
+ readonly dot: _angular_core.InputSignalWithTransform<boolean, unknown>;
48
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkBadge, never>;
49
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkBadge, "mk-badge", never, { "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "dot": { "alias": "dot"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
50
+ }
51
+
52
+ /** Corner of the host an {@link MkBadgeOverlay} is anchored to. */
53
+ type MkBadgeOverlayPosition = 'top-end' | 'top-start' | 'bottom-end' | 'bottom-start';
54
+ /**
55
+ * Badge overlay — anchors a small badge (count, dot or short text) to a corner
56
+ * of ANY element: an icon button, an avatar, a tab label. The host stays a
57
+ * single tab stop; the badge is a decorative, non-focusable child.
58
+ *
59
+ * - Numbers above `mkBadgeOverlayMax` (default 99) collapse to `99+`.
60
+ * - `mkBadgeOverlayDot` renders a textless dot ("something is new").
61
+ * - `mkBadgeOverlayAriaLabel` is the screen-reader text ("3 unread"). It is
62
+ * rendered in a visually hidden span and wired to the host with
63
+ * `aria-describedby`, so it is announced after the host's own name even
64
+ * when the host has an `aria-label`. When it is given, the visible badge is
65
+ * `aria-hidden` so the count is not read twice.
66
+ * - Positions use logical insets, so `top-end` sits at the top-right in LTR
67
+ * and the top-left in RTL.
68
+ *
69
+ * The badge is painted with the global `.mk-badge-overlay` styles from
70
+ * `@mk-kit/ui/styles.css` and follows the `--mk-*` tone tokens.
71
+ *
72
+ * ```html
73
+ * <button mkButton iconOnly aria-label="Notifications"
74
+ * [mkBadgeOverlay]="unread()" mkBadgeOverlayTone="danger"
75
+ * [mkBadgeOverlayAriaLabel]="unread() + ' unread'">
76
+ * <mk-icon name="bell" />
77
+ * </button>
78
+ *
79
+ * <mk-avatar name="Ada Lovelace" mkBadgeOverlay mkBadgeOverlayDot
80
+ * mkBadgeOverlayTone="success" mkBadgeOverlayPosition="bottom-end" />
81
+ * ```
82
+ */
83
+ declare class MkBadgeOverlay {
84
+ private readonly host;
85
+ private readonly renderer;
86
+ private readonly document;
87
+ private readonly isBrowser;
88
+ /**
89
+ * Badge content — a count or a short label. `null` / empty hides the badge
90
+ * unless `mkBadgeOverlayDot` is set. Numeric strings are treated as numbers
91
+ * so `mkBadgeOverlay="120"` also collapses to `99+`.
92
+ */
93
+ readonly content: _angular_core.InputSignal<string | number | null | undefined>;
94
+ /** Corner the badge is anchored to (logical: `end` flips in RTL). */
95
+ readonly position: _angular_core.InputSignal<MkBadgeOverlayPosition>;
96
+ /** Semantic color tone (same scale as `mk-badge`). */
97
+ readonly tone: _angular_core.InputSignal<MkTone>;
98
+ /** Render a textless dot instead of the content. */
99
+ readonly dot: _angular_core.InputSignalWithTransform<boolean, unknown>;
100
+ /** Numbers above this render as `<max>+`. `0` disables the cap. */
101
+ readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
102
+ /** Hide the badge while keeping the directive (and its aria wiring) in place. */
103
+ readonly hidden: _angular_core.InputSignalWithTransform<boolean, unknown>;
104
+ /**
105
+ * Screen-reader text for the badge, e.g. `"3 unread"`. Announced as the
106
+ * host's description; the visible badge becomes `aria-hidden`.
107
+ */
108
+ readonly ariaLabel: _angular_core.InputSignal<string>;
109
+ /** The text painted in the badge (`''` in dot mode). */
110
+ readonly label: _angular_core.Signal<string>;
111
+ /** Whether the badge is currently rendered. */
112
+ readonly visible: _angular_core.Signal<boolean>;
113
+ private readonly srId;
114
+ private badge;
115
+ private sr;
116
+ /** Set when WE made the host positioned, so we can undo it on removal. */
117
+ private positionedHost;
118
+ constructor();
119
+ private attach;
120
+ private detach;
121
+ /** Create / update / remove the hidden description and its aria-describedby link. */
122
+ private syncSr;
123
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkBadgeOverlay, never>;
124
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkBadgeOverlay, "[mkBadgeOverlay]", never, { "content": { "alias": "mkBadgeOverlay"; "required": false; "isSignal": true; }; "position": { "alias": "mkBadgeOverlayPosition"; "required": false; "isSignal": true; }; "tone": { "alias": "mkBadgeOverlayTone"; "required": false; "isSignal": true; }; "dot": { "alias": "mkBadgeOverlayDot"; "required": false; "isSignal": true; }; "max": { "alias": "mkBadgeOverlayMax"; "required": false; "isSignal": true; }; "hidden": { "alias": "mkBadgeOverlayHidden"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "mkBadgeOverlayAriaLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
125
+ }
126
+
127
+ /**
128
+ * EmptyState — a centered placeholder for "nothing here yet" situations: empty
129
+ * tables, no search results, a fresh dashboard, a cleared inbox. Provide a
130
+ * `title` (and usually a `description`), an `icon` or projected media, and
131
+ * call-to-action buttons via the actions slot.
132
+ *
133
+ * Slots: `[mkEmptyStateMedia]` (custom illustration, overrides `icon`), default
134
+ * content (extra body), `[mkEmptyStateActions]` (buttons).
135
+ *
136
+ * ```html
137
+ * <mk-empty-state icon="search" title="No results"
138
+ * description="Try adjusting your filters.">
139
+ * <button mkButton mkEmptyStateActions variant="outline">Clear filters</button>
140
+ * </mk-empty-state>
141
+ * ```
142
+ */
143
+ declare class MkEmptyState {
144
+ /** Name of a registered icon shown above the title (ignored if media is projected). */
145
+ readonly icon: _angular_core.InputSignal<string>;
146
+ /** Main heading, e.g. "No invoices yet". */
147
+ readonly title: _angular_core.InputSignal<string>;
148
+ /** Supporting sentence under the title. */
149
+ readonly description: _angular_core.InputSignal<string>;
150
+ /** Overall scale of the block. */
151
+ readonly size: _angular_core.InputSignal<MkSize>;
152
+ protected readonly iconSize: () => 28 | 48 | 36;
153
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkEmptyState, never>;
154
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkEmptyState, "mk-empty-state", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, ["[mkEmptyStateMedia]", "*", "[mkEmptyStateActions]"], true, never>;
155
+ }
156
+
157
+ export { MkBadge, MkBadgeOverlay, MkEmptyState, MkSpinner };
158
+ export type { MkBadgeOverlayPosition, MkBadgeVariant };
@@ -1094,6 +1094,12 @@ declare class MkTableDataSource<T> {
1094
1094
  * pending debounced filter, since the request reads the live filter value.
1095
1095
  */
1096
1096
  refresh(): void;
1097
+ /**
1098
+ * Back to page 1 and load — the "filters changed outside the search box"
1099
+ * case. Unlike {@link setPage}, this loads even when already on page 1, so
1100
+ * callers no longer need `page() === 1 ? refresh() : setPage(1)`.
1101
+ */
1102
+ reload(): void;
1097
1103
  /**
1098
1104
  * Pipe an `mkSort` directive's changes into {@link setSort}. Idempotent per
1099
1105
  * directive instance; all subscriptions are released by {@link destroy}.
@@ -1117,6 +1123,24 @@ declare class MkTableDataSource<T> {
1117
1123
  private unsubscribeActive;
1118
1124
  private clearSub;
1119
1125
  }
1126
+ /** Options for {@link mkClientFetcher}. */
1127
+ interface MkClientFetcherOptions<T> {
1128
+ /** Row matcher for `setFilter` text; default: case-insensitive substring over every string/number field. */
1129
+ match?: (row: T, query: string) => boolean;
1130
+ /** Comparator for an active sort; default: locale compare on `row[sort.active]`. */
1131
+ compare?: (a: T, b: T, sort: MkSortState) => number;
1132
+ }
1133
+ /**
1134
+ * In-memory {@link MkDataFetcher}: filter, sort and slice a full row set that
1135
+ * the app already holds (an API that returns everything). Lets a client-side
1136
+ * list use {@link MkTableDataSource} — same pager, footer and API as a
1137
+ * server-paged one — without hand-rolling `filtered/sorted/paged` computeds.
1138
+ *
1139
+ * ```ts
1140
+ * ds = new MkTableDataSource(mkClientFetcher(() => this.rows()));
1141
+ * ```
1142
+ */
1143
+ declare function mkClientFetcher<T>(rows: () => readonly T[], opts?: MkClientFetcherOptions<T>): (req: MkDataRequest) => Promise<MkDataPage<T>>;
1120
1144
 
1121
- export { MkSort, MkSortHeader, MkTable, MkTableCell, MkTableDataSource, MkTableRowDetail, mkCompactFilters, mkDownloadText, mkExportCsv, mkToCsv };
1122
- export type { MkCellEdit, MkColumnResize, MkCsvColumn, MkCsvExportOptions, MkCsvOptions, MkDataFetcher, MkDataPage, MkDataRequest, MkGroupToggle, MkSortChange, MkSortDirection, MkSortState, MkSortable, MkTableAlign, MkTableCellContext, MkTableColumn, MkTableDataSourceOptions, MkTableDensity, MkTableExportOptions, MkTableExportRows, MkTableExportRowsOptions, MkTableFilterKind, MkTableFilterOption, MkTableFilterRange, MkTableFilters, MkTableGroup, MkTreeToggle };
1145
+ export { MkSort, MkSortHeader, MkTable, MkTableCell, MkTableDataSource, MkTableRowDetail, mkClientFetcher, mkCompactFilters, mkDownloadText, mkExportCsv, mkToCsv };
1146
+ export type { MkCellEdit, MkClientFetcherOptions, MkColumnResize, MkCsvColumn, MkCsvExportOptions, MkCsvOptions, MkDataFetcher, MkDataPage, MkDataRequest, MkGroupToggle, MkSortChange, MkSortDirection, MkSortState, MkSortable, MkTableAlign, MkTableCellContext, MkTableColumn, MkTableDataSourceOptions, MkTableDensity, MkTableExportOptions, MkTableExportRows, MkTableExportRowsOptions, MkTableFilterKind, MkTableFilterOption, MkTableFilterRange, MkTableFilters, MkTableGroup, MkTreeToggle };
@@ -11,7 +11,9 @@ export * from '@mk-kit/ui/navigation';
11
11
  export * from '@mk-kit/ui/forms';
12
12
  export * from '@mk-kit/ui/datetime';
13
13
  export * from '@mk-kit/ui/table';
14
+ export * from '@mk-kit/ui/status';
14
15
  export * from '@mk-kit/ui/data';
16
+ export * from '@mk-kit/ui/kanban';
15
17
  export * from '@mk-kit/ui/feedback';
16
18
  export * from '@mk-kit/ui/rich-text';
17
19
  export * from '@mk-kit/ui/block-editor';