@molecule/app-progress-bar-angular 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,147 @@
1
+ /**
2
+ * ProgressBar component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import type { AfterViewInit } from '@angular/core';
7
+ import type { UIClassMap } from '@molecule/app-ui';
8
+ import type { ProgressBarProps } from './types.js';
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * ProgressBar component.
12
+ *
13
+ * Labeled progress bar with optional value display: a `[label ... valueLabel]`
14
+ * header row above a track, with the track and fill styled by the ClassMap
15
+ * progress tokens. The host IS the outer `<div>` (`div[mol-progress-bar]`),
16
+ * matching React's root exactly. Node props (`label`, `valueLabel`) are
17
+ * projected content (`[slot=<name>]`) or plain string inputs.
18
+ *
19
+ * This is the Angular counterpart of `@molecule/app-progress-bar-react`: the
20
+ * same props (React names), the same ClassMap tokens, and the same DOM for the
21
+ * same input.
22
+ *
23
+ * @remarks
24
+ * Angular projection needs the `<ng-content>` capture points mounted, so the
25
+ * optional header regions render optimistically and
26
+ * {@link ProgressBar.ngAfterViewInit} withdraws the ones nothing was projected
27
+ * into (React would not render them at all).
28
+ */
29
+ export declare class ProgressBar implements AfterViewInit {
30
+ /** Current numeric value. */
31
+ value: number;
32
+ /** Maximum (defaults to `100` at read time). */
33
+ max?: number;
34
+ /** Optional label rendered above the track — a string input, or `[slot=label]` content. */
35
+ label?: ProgressBarProps['label'];
36
+ /** Optional value display on the right of the label row — a string input, or `[slot=valueLabel]` content. */
37
+ valueLabel?: ProgressBarProps['valueLabel'];
38
+ /** Size preset — maps to ClassMap `progressHeight` (defaults to `'md'`). */
39
+ size?: 'sm' | 'md' | 'lg';
40
+ /** Color variant — maps to ClassMap `progressColor` (defaults to `'primary'`). */
41
+ color?: 'primary' | 'success' | 'warning' | 'error' | 'info';
42
+ /** Extra classes on the outer wrapper. */
43
+ className?: string;
44
+ /** The optional label span (projected content lands here; read once). */
45
+ private labelEl?;
46
+ /** The optional value-label span (projected content lands here; read once). */
47
+ private valueLabelEl?;
48
+ /** Whether a `[slot=label]` projection landed (true until the first view proves otherwise). */
49
+ private readonly labelProjected;
50
+ /** Whether a `[slot=valueLabel]` projection landed (true until the first view proves otherwise). */
51
+ private readonly valueLabelProjected;
52
+ /**
53
+ * Reads the optional header regions' first render: when neither a text input
54
+ * nor projected content landed, React would not render the region at all, so
55
+ * the optimistic render is withdrawn.
56
+ */
57
+ ngAfterViewInit(): void;
58
+ /**
59
+ * The current class map.
60
+ * @returns The UIClassMap.
61
+ */
62
+ cm(): UIClassMap;
63
+ /**
64
+ * Whether a text label input renders (React's `label && …`).
65
+ * @returns True when the label renders as text.
66
+ */
67
+ get hasLabel(): boolean;
68
+ /**
69
+ * Whether a text value-label input renders (React's `valueLabel && …`).
70
+ * @returns True when the value label renders as text.
71
+ */
72
+ get hasValueLabel(): boolean;
73
+ /**
74
+ * Whether the label span renders: a truthy text input or a `[slot=label]` projection.
75
+ * @returns True when the label shows.
76
+ */
77
+ get showLabel(): boolean;
78
+ /**
79
+ * Whether the value-label span renders.
80
+ * @returns True when the value label shows.
81
+ */
82
+ get showValueLabel(): boolean;
83
+ /**
84
+ * Whether the header row renders at all (React's `(label || valueLabel)`).
85
+ * @returns True when the header row shows.
86
+ */
87
+ get showHeader(): boolean;
88
+ /**
89
+ * The maximum width (React's default parameter: a later-bound write of
90
+ * `undefined` must not erase the `100` default).
91
+ * @returns The maximum.
92
+ */
93
+ maxValue(): number;
94
+ /**
95
+ * The size preset (React's `size = 'md'`).
96
+ * @returns The size.
97
+ */
98
+ sizeValue(): 'sm' | 'md' | 'lg';
99
+ /**
100
+ * The color variant (React's `color = 'primary'`).
101
+ * @returns The color.
102
+ */
103
+ colorValue(): 'primary' | 'success' | 'warning' | 'error' | 'info';
104
+ /**
105
+ * The fill percentage React computes (`max === 0` renders empty).
106
+ * @returns The percentage in the 0–100 range.
107
+ */
108
+ fillPercent(): number;
109
+ /**
110
+ * The fill's inline style (React's `{ width: '<pct>%' }`).
111
+ * @returns The style attribute text.
112
+ */
113
+ fillStyleText(): string | null;
114
+ /**
115
+ * The host's class list (React's `cm.cn(cm.stack(2), className)`).
116
+ * @returns The class string.
117
+ */
118
+ classes(): string;
119
+ /**
120
+ * The header row's class list (React's `cm.flex({ justify: 'between', align: 'center' })`).
121
+ * @returns The class string.
122
+ */
123
+ headerClasses(): string;
124
+ /**
125
+ * The label span's class list (React's `cm.cn(cm.textSize('sm'), cm.fontWeight('medium'))`).
126
+ * @returns The class string.
127
+ */
128
+ labelClasses(): string;
129
+ /**
130
+ * The value-label span's class list (React's `cm.textSize('sm')`).
131
+ * @returns The class string.
132
+ */
133
+ valueLabelClasses(): string;
134
+ /**
135
+ * The track's class list (React's `cm.cn(cm.progress(), cm.progressHeight(size))`).
136
+ * @returns The class string.
137
+ */
138
+ trackClasses(): string;
139
+ /**
140
+ * The fill's class list (React's `cm.cn(cm.progressBar(), cm.progressColor(color))`).
141
+ * @returns The class string.
142
+ */
143
+ fillClasses(): string;
144
+ static ɵfac: i0.ɵɵFactoryDeclaration<ProgressBar, never>;
145
+ static ɵcmp: i0.ɵɵComponentDeclaration<ProgressBar, "div[mol-progress-bar]", never, { "value": { "alias": "value"; "required": false; }; "max": { "alias": "max"; "required": false; }; "label": { "alias": "label"; "required": false; }; "valueLabel": { "alias": "valueLabel"; "required": false; }; "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=label]", "[slot=valueLabel]"], true, never>;
146
+ }
147
+ //# sourceMappingURL=progress-bar.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-bar.component.d.ts","sourceRoot":"","sources":["../src/progress-bar.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,eAAe,CAAA;AAG9D,OAAO,KAAK,E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OAGG;IACH,SAAS,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI;IAI/B;;;OAGG;IACH,UAAU,IAAI,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM;IAIlE;;;OAGG;IACH,WAAW,IAAI,MAAM;IAKrB;;;OAGG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B;;;OAGG;IACH,OAAO,IAAI,MAAM;IAKjB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAKtB;;;OAGG;IACH,iBAAiB,IAAI,MAAM;IAI3B;;;OAGG;IACH,YAAY,IAAI,MAAM;IAKtB;;;OAGG;IACH,WAAW,IAAI,MAAM;yCA/KV,WAAW;2CAAX,WAAW;CAmLvB"}
@@ -0,0 +1,304 @@
1
+ import { Component, signal, ViewChild } from '@angular/core';
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ import { styleText } from '@molecule/app-ui-angular';
4
+ import * as i0 from "@angular/core";
5
+ const _c0 = ["labelEl"];
6
+ const _c1 = ["valueLabelEl"];
7
+ const _c2 = [[["", "slot", "label"]], [["", "slot", "valuelabel"]]];
8
+ const _c3 = ["[slot=label]", "[slot=valueLabel]"];
9
+ function ProgressBar_Conditional_0_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
10
+ i0.ɵɵtext(0);
11
+ } if (rf & 2) {
12
+ const ctx_r0 = i0.ɵɵnextContext(3);
13
+ i0.ɵɵtextInterpolate(ctx_r0.label);
14
+ } }
15
+ function ProgressBar_Conditional_0_Conditional_1_Template(rf, ctx) { if (rf & 1) {
16
+ i0.ɵɵdomElementStart(0, "span", null, 0);
17
+ i0.ɵɵconditionalCreate(2, ProgressBar_Conditional_0_Conditional_1_Conditional_2_Template, 1, 1);
18
+ i0.ɵɵprojection(3);
19
+ i0.ɵɵdomElementEnd();
20
+ } if (rf & 2) {
21
+ const ctx_r0 = i0.ɵɵnextContext(2);
22
+ i0.ɵɵclassMap(ctx_r0.labelClasses());
23
+ i0.ɵɵadvance(2);
24
+ i0.ɵɵconditional(ctx_r0.hasLabel ? 2 : -1);
25
+ } }
26
+ function ProgressBar_Conditional_0_Conditional_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
27
+ i0.ɵɵtext(0);
28
+ } if (rf & 2) {
29
+ const ctx_r0 = i0.ɵɵnextContext(3);
30
+ i0.ɵɵtextInterpolate(ctx_r0.valueLabel);
31
+ } }
32
+ function ProgressBar_Conditional_0_Conditional_2_Template(rf, ctx) { if (rf & 1) {
33
+ i0.ɵɵdomElementStart(0, "span", null, 1);
34
+ i0.ɵɵconditionalCreate(2, ProgressBar_Conditional_0_Conditional_2_Conditional_2_Template, 1, 1);
35
+ i0.ɵɵprojection(3, 1);
36
+ i0.ɵɵdomElementEnd();
37
+ } if (rf & 2) {
38
+ const ctx_r0 = i0.ɵɵnextContext(2);
39
+ i0.ɵɵclassMap(ctx_r0.valueLabelClasses());
40
+ i0.ɵɵadvance(2);
41
+ i0.ɵɵconditional(ctx_r0.hasValueLabel ? 2 : -1);
42
+ } }
43
+ function ProgressBar_Conditional_0_Template(rf, ctx) { if (rf & 1) {
44
+ i0.ɵɵdomElementStart(0, "div");
45
+ i0.ɵɵconditionalCreate(1, ProgressBar_Conditional_0_Conditional_1_Template, 4, 3, "span", 2);
46
+ i0.ɵɵconditionalCreate(2, ProgressBar_Conditional_0_Conditional_2_Template, 4, 3, "span", 2);
47
+ i0.ɵɵdomElementEnd();
48
+ } if (rf & 2) {
49
+ const ctx_r0 = i0.ɵɵnextContext();
50
+ i0.ɵɵclassMap(ctx_r0.headerClasses());
51
+ i0.ɵɵadvance();
52
+ i0.ɵɵconditional(ctx_r0.showLabel ? 1 : -1);
53
+ i0.ɵɵadvance();
54
+ i0.ɵɵconditional(ctx_r0.showValueLabel ? 2 : -1);
55
+ } }
56
+ /**
57
+ * Whether a node is something a caller can see (an element, or a non-blank
58
+ * text node).
59
+ *
60
+ * @param node - The DOM node.
61
+ * @returns True when it renders anything.
62
+ */
63
+ const hasRenderable = (node) => node.nodeType === Node.ELEMENT_NODE ||
64
+ (node.nodeType === Node.TEXT_NODE && (node.textContent ?? '').trim().length > 0);
65
+ /**
66
+ * Whether a projected region landed: the region's own children after the
67
+ * label the component interpolated itself (React would not render the region
68
+ * at all without one).
69
+ *
70
+ * @param el - The element.
71
+ * @param ownText - Whether the element's first child is the component's own interpolated text.
72
+ * @returns True when the caller projected content into it.
73
+ */
74
+ const hasProjection = (el, ownText) => Array.from(el.childNodes)
75
+ .slice(ownText ? 1 : 0)
76
+ .some(hasRenderable);
77
+ /**
78
+ * ProgressBar component.
79
+ *
80
+ * Labeled progress bar with optional value display: a `[label ... valueLabel]`
81
+ * header row above a track, with the track and fill styled by the ClassMap
82
+ * progress tokens. The host IS the outer `<div>` (`div[mol-progress-bar]`),
83
+ * matching React's root exactly. Node props (`label`, `valueLabel`) are
84
+ * projected content (`[slot=<name>]`) or plain string inputs.
85
+ *
86
+ * This is the Angular counterpart of `@molecule/app-progress-bar-react`: the
87
+ * same props (React names), the same ClassMap tokens, and the same DOM for the
88
+ * same input.
89
+ *
90
+ * @remarks
91
+ * Angular projection needs the `<ng-content>` capture points mounted, so the
92
+ * optional header regions render optimistically and
93
+ * {@link ProgressBar.ngAfterViewInit} withdraws the ones nothing was projected
94
+ * into (React would not render them at all).
95
+ */
96
+ export class ProgressBar {
97
+ /** Current numeric value. */
98
+ value;
99
+ /** Maximum (defaults to `100` at read time). */
100
+ max;
101
+ /** Optional label rendered above the track — a string input, or `[slot=label]` content. */
102
+ label;
103
+ /** Optional value display on the right of the label row — a string input, or `[slot=valueLabel]` content. */
104
+ valueLabel;
105
+ /** Size preset — maps to ClassMap `progressHeight` (defaults to `'md'`). */
106
+ size;
107
+ /** Color variant — maps to ClassMap `progressColor` (defaults to `'primary'`). */
108
+ color;
109
+ /** Extra classes on the outer wrapper. */
110
+ className;
111
+ /** The optional label span (projected content lands here; read once). */
112
+ labelEl;
113
+ /** The optional value-label span (projected content lands here; read once). */
114
+ valueLabelEl;
115
+ /** Whether a `[slot=label]` projection landed (true until the first view proves otherwise). */
116
+ labelProjected = signal(true, /* @ts-ignore */
117
+ ...(ngDevMode ? [{ debugName: "labelProjected" }] : /* istanbul ignore next */ []));
118
+ /** Whether a `[slot=valueLabel]` projection landed (true until the first view proves otherwise). */
119
+ valueLabelProjected = signal(true, /* @ts-ignore */
120
+ ...(ngDevMode ? [{ debugName: "valueLabelProjected" }] : /* istanbul ignore next */ []));
121
+ /**
122
+ * Reads the optional header regions' first render: when neither a text input
123
+ * nor projected content landed, React would not render the region at all, so
124
+ * the optimistic render is withdrawn.
125
+ */
126
+ ngAfterViewInit() {
127
+ const label = this.labelEl?.nativeElement;
128
+ if (label)
129
+ this.labelProjected.set(hasProjection(label, this.hasLabel));
130
+ const valueLabel = this.valueLabelEl?.nativeElement;
131
+ if (valueLabel)
132
+ this.valueLabelProjected.set(hasProjection(valueLabel, this.hasValueLabel));
133
+ }
134
+ /**
135
+ * The current class map.
136
+ * @returns The UIClassMap.
137
+ */
138
+ cm() {
139
+ return getClassMap();
140
+ }
141
+ /**
142
+ * Whether a text label input renders (React's `label && …`).
143
+ * @returns True when the label renders as text.
144
+ */
145
+ get hasLabel() {
146
+ return this.label !== undefined && this.label !== null && !!this.label;
147
+ }
148
+ /**
149
+ * Whether a text value-label input renders (React's `valueLabel && …`).
150
+ * @returns True when the value label renders as text.
151
+ */
152
+ get hasValueLabel() {
153
+ return this.valueLabel !== undefined && this.valueLabel !== null && !!this.valueLabel;
154
+ }
155
+ /**
156
+ * Whether the label span renders: a truthy text input or a `[slot=label]` projection.
157
+ * @returns True when the label shows.
158
+ */
159
+ get showLabel() {
160
+ return this.hasLabel || this.labelProjected();
161
+ }
162
+ /**
163
+ * Whether the value-label span renders.
164
+ * @returns True when the value label shows.
165
+ */
166
+ get showValueLabel() {
167
+ return this.hasValueLabel || this.valueLabelProjected();
168
+ }
169
+ /**
170
+ * Whether the header row renders at all (React's `(label || valueLabel)`).
171
+ * @returns True when the header row shows.
172
+ */
173
+ get showHeader() {
174
+ return this.showLabel || this.showValueLabel;
175
+ }
176
+ /**
177
+ * The maximum width (React's default parameter: a later-bound write of
178
+ * `undefined` must not erase the `100` default).
179
+ * @returns The maximum.
180
+ */
181
+ maxValue() {
182
+ return this.max ?? 100;
183
+ }
184
+ /**
185
+ * The size preset (React's `size = 'md'`).
186
+ * @returns The size.
187
+ */
188
+ sizeValue() {
189
+ return this.size ?? 'md';
190
+ }
191
+ /**
192
+ * The color variant (React's `color = 'primary'`).
193
+ * @returns The color.
194
+ */
195
+ colorValue() {
196
+ return this.color ?? 'primary';
197
+ }
198
+ /**
199
+ * The fill percentage React computes (`max === 0` renders empty).
200
+ * @returns The percentage in the 0–100 range.
201
+ */
202
+ fillPercent() {
203
+ const max = this.maxValue();
204
+ return max === 0 ? 0 : Math.max(0, Math.min(100, (this.value / max) * 100));
205
+ }
206
+ /**
207
+ * The fill's inline style (React's `{ width: '<pct>%' }`).
208
+ * @returns The style attribute text.
209
+ */
210
+ fillStyleText() {
211
+ return styleText({ width: `${this.fillPercent()}%` });
212
+ }
213
+ /**
214
+ * The host's class list (React's `cm.cn(cm.stack(2), className)`).
215
+ * @returns The class string.
216
+ */
217
+ classes() {
218
+ const cm = this.cm();
219
+ return cm.cn(cm.stack(2), this.className);
220
+ }
221
+ /**
222
+ * The header row's class list (React's `cm.flex({ justify: 'between', align: 'center' })`).
223
+ * @returns The class string.
224
+ */
225
+ headerClasses() {
226
+ return this.cm().flex({ justify: 'between', align: 'center' });
227
+ }
228
+ /**
229
+ * The label span's class list (React's `cm.cn(cm.textSize('sm'), cm.fontWeight('medium'))`).
230
+ * @returns The class string.
231
+ */
232
+ labelClasses() {
233
+ const cm = this.cm();
234
+ return cm.cn(cm.textSize('sm'), cm.fontWeight('medium'));
235
+ }
236
+ /**
237
+ * The value-label span's class list (React's `cm.textSize('sm')`).
238
+ * @returns The class string.
239
+ */
240
+ valueLabelClasses() {
241
+ return this.cm().textSize('sm');
242
+ }
243
+ /**
244
+ * The track's class list (React's `cm.cn(cm.progress(), cm.progressHeight(size))`).
245
+ * @returns The class string.
246
+ */
247
+ trackClasses() {
248
+ const cm = this.cm();
249
+ return cm.cn(cm.progress(), cm.progressHeight(this.sizeValue()));
250
+ }
251
+ /**
252
+ * The fill's class list (React's `cm.cn(cm.progressBar(), cm.progressColor(color))`).
253
+ * @returns The class string.
254
+ */
255
+ fillClasses() {
256
+ const cm = this.cm();
257
+ return cm.cn(cm.progressBar(), cm.progressColor(this.colorValue()));
258
+ }
259
+ static ɵfac = function ProgressBar_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ProgressBar)(); };
260
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ProgressBar, selectors: [["div", "mol-progress-bar", ""]], viewQuery: function ProgressBar_Query(rf, ctx) { if (rf & 1) {
261
+ i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
262
+ } if (rf & 2) {
263
+ let _t;
264
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelEl = _t.first);
265
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.valueLabelEl = _t.first);
266
+ } }, hostVars: 2, hostBindings: function ProgressBar_HostBindings(rf, ctx) { if (rf & 2) {
267
+ i0.ɵɵclassMap(ctx.classes());
268
+ } }, inputs: { value: "value", max: "max", label: "label", valueLabel: "valueLabel", size: "size", color: "color", className: "className" }, ngContentSelectors: _c3, decls: 3, vars: 10, consts: [["labelEl", ""], ["valueLabelEl", ""], [3, "class"], ["role", "progressbar"]], template: function ProgressBar_Template(rf, ctx) { if (rf & 1) {
269
+ i0.ɵɵprojectionDef(_c2);
270
+ i0.ɵɵconditionalCreate(0, ProgressBar_Conditional_0_Template, 3, 4, "div", 2);
271
+ i0.ɵɵdomElementStart(1, "div", 3);
272
+ i0.ɵɵdomElement(2, "div");
273
+ i0.ɵɵdomElementEnd();
274
+ } if (rf & 2) {
275
+ i0.ɵɵconditional(ctx.showHeader ? 0 : -1);
276
+ i0.ɵɵadvance();
277
+ i0.ɵɵclassMap(ctx.trackClasses());
278
+ i0.ɵɵattribute("aria-valuenow", ctx.value)("aria-valuemin", 0)("aria-valuemax", ctx.maxValue());
279
+ i0.ɵɵadvance();
280
+ i0.ɵɵstyleMap(ctx.fillStyleText());
281
+ i0.ɵɵclassMap(ctx.fillClasses());
282
+ } }, encapsulation: 2 });
283
+ }
284
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProgressBar, [{
285
+ type: Component,
286
+ args: [{
287
+ selector: 'div[mol-progress-bar]',
288
+ standalone: true,
289
+ inputs: ['value', 'max', 'label', 'valueLabel', 'size', 'color', 'className'],
290
+ host: {
291
+ '[class]': 'classes()',
292
+ },
293
+ // prettier-ignore
294
+ template: `@if (showHeader) {<div [class]="headerClasses()">@if (showLabel) {<span #labelEl [class]="labelClasses()">@if (hasLabel) {{{ label }}}<ng-content select="[slot=label]" /></span>}@if (showValueLabel) {<span #valueLabelEl [class]="valueLabelClasses()">@if (hasValueLabel) {{{ valueLabel }}}<ng-content select="[slot=valueLabel]" /></span>}</div>}<div [class]="trackClasses()" role="progressbar" [attr.aria-valuenow]="value" [attr.aria-valuemin]="0" [attr.aria-valuemax]="maxValue()"><div [class]="fillClasses()" [style]="fillStyleText()"></div></div>`,
295
+ }]
296
+ }], null, { labelEl: [{
297
+ type: ViewChild,
298
+ args: ['labelEl']
299
+ }], valueLabelEl: [{
300
+ type: ViewChild,
301
+ args: ['valueLabelEl']
302
+ }] }); })();
303
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ProgressBar, { className: "ProgressBar", filePath: "progress-bar.component.ts", lineNumber: 70 }); })();
304
+ //# sourceMappingURL=progress-bar.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-bar.component.js","sourceRoot":"","sources":["../src/progress-bar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K,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC;gBAC7E,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,kBAAkB;gBAClB,QAAQ,EAAE,siBAAsiB;aACjjB;;kBAkBE,SAAS;mBAAC,SAAS;;kBAEnB,SAAS;mBAAC,cAAc;;kFAnBd,WAAW"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * ProgressCard component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import type { AfterViewInit } from '@angular/core';
7
+ import type { UIClassMap } from '@molecule/app-ui';
8
+ import type { ProgressCardProps } from './types.js';
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * ProgressCard component.
12
+ *
13
+ * `<Card>`-wrapped progress display with title, optional icon and description,
14
+ * the progress bar itself, and an optional extras slot below. The host IS the
15
+ * Card `div` (`div[mol-progress-card]`), matching React's root exactly — same
16
+ * classes. Node props (`title`, `description`, `icon`, `valueLabel`,
17
+ * `children`) are projected content (`[slot=<name>]`, or the default
18
+ * projection) or plain string inputs.
19
+ *
20
+ * This is the Angular counterpart of `@molecule/app-progress-bar-react`: the
21
+ * same props (React names), the same ClassMap tokens, and the same DOM for the
22
+ * same input.
23
+ *
24
+ * @remarks
25
+ * Angular projection needs the `<ng-content>` capture points mounted, so the
26
+ * optional description and value-label regions render optimistically and
27
+ * {@link ProgressCard.ngAfterViewInit} withdraws the ones nothing was
28
+ * projected into (React would not render them at all).
29
+ */
30
+ export declare class ProgressCard implements AfterViewInit {
31
+ /** Card title — a string input, or `[slot=title]` projected content. */
32
+ title?: ProgressCardProps['title'];
33
+ /** Optional supporting description below the title — a string input, or `[slot=description]` content. */
34
+ description?: ProgressCardProps['description'];
35
+ /** Optional icon shown in the card header — `[slot=icon]` projected content (or a string input). */
36
+ icon?: ProgressCardProps['icon'];
37
+ /** Current value. */
38
+ value: number;
39
+ /** Maximum (defaults to `100` at read time). */
40
+ max?: number;
41
+ /** Value display on the right of the header — a string input, or `[slot=valueLabel]` content. */
42
+ valueLabel?: ProgressCardProps['valueLabel'];
43
+ /** ProgressBar color (defaults to `'primary'`). */
44
+ color?: 'primary' | 'success' | 'warning' | 'error' | 'info';
45
+ /** Extra classes on the Card wrapper. */
46
+ className?: string;
47
+ /** The optional description paragraph (projected content lands here; read once). */
48
+ private descriptionEl?;
49
+ /** The optional value-label span (projected content lands here; read once). */
50
+ private valueLabelEl?;
51
+ /** Whether a `[slot=description]` projection landed (true until the first view proves otherwise). */
52
+ private readonly descriptionProjected;
53
+ /** Whether a `[slot=valueLabel]` projection landed (true until the first view proves otherwise). */
54
+ private readonly valueLabelProjected;
55
+ /**
56
+ * Reads the optional regions' first render: when neither a text input nor
57
+ * projected content landed, React would not render the region at all, so the
58
+ * optimistic render is withdrawn.
59
+ */
60
+ ngAfterViewInit(): void;
61
+ /**
62
+ * The current class map.
63
+ * @returns The UIClassMap.
64
+ */
65
+ cm(): UIClassMap;
66
+ /**
67
+ * Whether a text icon input renders (a projected icon is not).
68
+ * @returns True when the icon renders as text.
69
+ */
70
+ get hasIcon(): boolean;
71
+ /**
72
+ * Whether a text title input renders (a projected title is not).
73
+ * @returns True when the title renders as text.
74
+ */
75
+ get hasTitle(): boolean;
76
+ /**
77
+ * Whether a text description input is present (React's `description && …`).
78
+ * @returns True when the description renders as text.
79
+ */
80
+ get hasDescription(): boolean;
81
+ /**
82
+ * Whether a text value-label input is present (React's `valueLabel && …`).
83
+ * @returns True when the value label renders as text.
84
+ */
85
+ get hasValueLabel(): boolean;
86
+ /**
87
+ * Whether the description paragraph renders.
88
+ * @returns True when the description shows.
89
+ */
90
+ get showDescription(): boolean;
91
+ /**
92
+ * Whether the value-label span renders.
93
+ * @returns True when the value label shows.
94
+ */
95
+ get showValueLabel(): boolean;
96
+ /**
97
+ * The maximum (React's default parameter: a later-bound write of `undefined`
98
+ * must not erase the `100` default).
99
+ * @returns The maximum.
100
+ */
101
+ maxValue(): number;
102
+ /**
103
+ * The color variant (React's `color = 'primary'`).
104
+ * @returns The color.
105
+ */
106
+ colorValue(): 'primary' | 'success' | 'warning' | 'error' | 'info';
107
+ /**
108
+ * The host's class list (React's `<Card className>` classes).
109
+ * @returns The class string.
110
+ */
111
+ classes(): string;
112
+ /**
113
+ * The stack wrapper's class list (React's `cm.stack(3)`).
114
+ * @returns The class string.
115
+ */
116
+ stackClasses(): string;
117
+ /**
118
+ * The header row's class list (React's `cm.flex({ justify: 'between', align: 'start', gap: 'sm' })`).
119
+ * @returns The class string.
120
+ */
121
+ headerClasses(): string;
122
+ /**
123
+ * The left group's class list (React's `cm.flex({ align: 'center', gap: 'sm' })`).
124
+ * @returns The class string.
125
+ */
126
+ leftClasses(): string;
127
+ /**
128
+ * The title heading's class list (React's `cm.cn(cm.textSize('base'), cm.fontWeight('semibold'))`).
129
+ * @returns The class string.
130
+ */
131
+ titleClasses(): string;
132
+ /**
133
+ * The description paragraph's class list (React's `cm.textSize('sm')`).
134
+ * @returns The class string.
135
+ */
136
+ descriptionClasses(): string;
137
+ /**
138
+ * The value-label span's class list (React's `cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'))`).
139
+ * @returns The class string.
140
+ */
141
+ valueLabelClasses(): string;
142
+ static ɵfac: i0.ɵɵFactoryDeclaration<ProgressCard, never>;
143
+ static ɵcmp: i0.ɵɵComponentDeclaration<ProgressCard, "div[mol-progress-card]", never, { "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "value": { "alias": "value"; "required": false; }; "max": { "alias": "max"; "required": false; }; "valueLabel": { "alias": "valueLabel"; "required": false; }; "color": { "alias": "color"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=icon]", "[slot=title]", "[slot=description]", "[slot=valueLabel]", "*"], true, never>;
144
+ }
145
+ //# sourceMappingURL=progress-card.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-card.component.d.ts","sourceRoot":"","sources":["../src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