@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.
- package/LICENSE +202 -0
- package/README.md +566 -2
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/progress-bar.component.d.ts +147 -0
- package/dist/progress-bar.component.d.ts.map +1 -0
- package/dist/progress-bar.component.js +304 -0
- package/dist/progress-bar.component.js.map +1 -0
- package/dist/progress-card.component.d.ts +145 -0
- package/dist/progress-card.component.d.ts.map +1 -0
- package/dist/progress-card.component.js +324 -0
- package/dist/progress-card.component.js.map +1 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
package/README.md
CHANGED
|
@@ -1,3 +1,567 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-15T09:56:46.607Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-progress-bar-angular
|
|
10
|
+
|
|
11
|
+
Angular labeled progress bar and progress-card wrapper — the counterpart of
|
|
12
|
+
`@molecule/app-progress-bar-react`, with the same props and the same DOM.
|
|
13
|
+
|
|
14
|
+
Exports:
|
|
15
|
+
|
|
16
|
+
- `<ProgressBar>` (`div[mol-progress-bar]`) — standalone bar with optional
|
|
17
|
+
label + value display.
|
|
18
|
+
- `<ProgressCard>` (`div[mol-progress-card]`) — Card-wrapped progress
|
|
19
|
+
display (title, icon, description, bar, optional extras slot).
|
|
20
|
+
|
|
21
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
22
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
23
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { Component } from '@angular/core'
|
|
29
|
+
import { ProgressBar, ProgressCard } from '@molecule/app-progress-bar-angular'
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
selector: 'app-dashboard',
|
|
33
|
+
standalone: true,
|
|
34
|
+
imports: [ProgressBar, ProgressCard],
|
|
35
|
+
template: `
|
|
36
|
+
<div mol-progress-bar [value]="65" label="Upload progress" valueLabel="65%"></div>
|
|
37
|
+
<div
|
|
38
|
+
mol-progress-card
|
|
39
|
+
[title]="'Storage used'"
|
|
40
|
+
[description]="'8.5 GB of 10 GB'"
|
|
41
|
+
[value]="85"
|
|
42
|
+
valueLabel="85%"
|
|
43
|
+
color="warning"
|
|
44
|
+
></div>
|
|
45
|
+
`,
|
|
46
|
+
})
|
|
47
|
+
export class Dashboard {}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Type
|
|
51
|
+
|
|
52
|
+
`feature`
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install @molecule/app-progress-bar-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
### Interfaces
|
|
63
|
+
|
|
64
|
+
#### `ProgressBarProps`
|
|
65
|
+
|
|
66
|
+
Props accepted by {@link ProgressBar} — the same props
|
|
67
|
+
`@molecule/app-progress-bar-react` accepts. Node props (`label`,
|
|
68
|
+
`valueLabel`) are typed `unknown`: pass a plain string as the input, or
|
|
69
|
+
project content as `[slot=<name>]` children of the host element.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
interface ProgressBarProps {
|
|
73
|
+
/** Current numeric value. */
|
|
74
|
+
value: number
|
|
75
|
+
/** Maximum (defaults to 100). */
|
|
76
|
+
max?: number
|
|
77
|
+
/** Optional label rendered above the track — a string input, or `[slot=label]` content. */
|
|
78
|
+
label?: unknown
|
|
79
|
+
/** Optional value display on the right of the label row — a string input, or `[slot=valueLabel]` content. */
|
|
80
|
+
valueLabel?: unknown
|
|
81
|
+
/** Size preset — maps to ClassMap `progressHeight`. */
|
|
82
|
+
size?: 'sm' | 'md' | 'lg'
|
|
83
|
+
/** Color variant — maps to ClassMap `progressColor`. */
|
|
84
|
+
color?: 'primary' | 'success' | 'warning' | 'error' | 'info'
|
|
85
|
+
/** Extra classes on the outer wrapper. */
|
|
86
|
+
className?: string
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### `ProgressCardProps`
|
|
91
|
+
|
|
92
|
+
Props accepted by {@link ProgressCard} — the same props
|
|
93
|
+
`@molecule/app-progress-bar-react` accepts. Node props (`title`,
|
|
94
|
+
`description`, `icon`, `valueLabel`, `children`) are typed `unknown`: pass a
|
|
95
|
+
plain string as the input, or project content as `[slot=<name>]` children of
|
|
96
|
+
the host element.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
interface ProgressCardProps {
|
|
100
|
+
/** Card title — a string input, or `[slot=title]` projected content. */
|
|
101
|
+
title?: unknown
|
|
102
|
+
/** Optional supporting description below the title — a string input, or `[slot=description]` content. */
|
|
103
|
+
description?: unknown
|
|
104
|
+
/** Optional icon shown in the card header — `[slot=icon]` projected content (or a string input). */
|
|
105
|
+
icon?: unknown
|
|
106
|
+
/** Current value. */
|
|
107
|
+
value: number
|
|
108
|
+
/** Maximum (defaults to 100). */
|
|
109
|
+
max?: number
|
|
110
|
+
/** Value display on the right of the header — a string input, or `[slot=valueLabel]` content. */
|
|
111
|
+
valueLabel?: unknown
|
|
112
|
+
/** ProgressBar color. */
|
|
113
|
+
color?: 'primary' | 'success' | 'warning' | 'error' | 'info'
|
|
114
|
+
/** Extra classes on the Card wrapper. */
|
|
115
|
+
className?: string
|
|
116
|
+
/** Additional content rendered below the bar, projected as the element's default content. */
|
|
117
|
+
children?: unknown
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Classes
|
|
122
|
+
|
|
123
|
+
#### `ProgressBar`
|
|
124
|
+
|
|
125
|
+
ProgressBar component.
|
|
126
|
+
|
|
127
|
+
Labeled progress bar with optional value display: a `[label ... valueLabel]`
|
|
128
|
+
header row above a track, with the track and fill styled by the ClassMap
|
|
129
|
+
progress tokens. The host IS the outer `<div>` (`div[mol-progress-bar]`),
|
|
130
|
+
matching React's root exactly. Node props (`label`, `valueLabel`) are
|
|
131
|
+
projected content (`[slot=<name>]`) or plain string inputs.
|
|
132
|
+
|
|
133
|
+
This is the Angular counterpart of `@molecule/app-progress-bar-react`: the
|
|
134
|
+
same props (React names), the same ClassMap tokens, and the same DOM for the
|
|
135
|
+
same input.
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
@Component({
|
|
139
|
+
selector: 'div[mol-progress-bar]',
|
|
140
|
+
standalone: true,
|
|
141
|
+
inputs: ['value', 'max', 'label', 'valueLabel', 'size', 'color', 'className'],
|
|
142
|
+
host: {
|
|
143
|
+
'[class]': 'classes()',
|
|
144
|
+
},
|
|
145
|
+
// prettier-ignore
|
|
146
|
+
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>`,
|
|
147
|
+
})
|
|
148
|
+
export class ProgressBar implements AfterViewInit {
|
|
149
|
+
/** Current numeric value. */
|
|
150
|
+
value!: number
|
|
151
|
+
/** Maximum (defaults to `100` at read time). */
|
|
152
|
+
max?: number
|
|
153
|
+
/** Optional label rendered above the track — a string input, or `[slot=label]` content. */
|
|
154
|
+
label?: ProgressBarProps['label']
|
|
155
|
+
/** Optional value display on the right of the label row — a string input, or `[slot=valueLabel]` content. */
|
|
156
|
+
valueLabel?: ProgressBarProps['valueLabel']
|
|
157
|
+
/** Size preset — maps to ClassMap `progressHeight` (defaults to `'md'`). */
|
|
158
|
+
size?: 'sm' | 'md' | 'lg'
|
|
159
|
+
/** Color variant — maps to ClassMap `progressColor` (defaults to `'primary'`). */
|
|
160
|
+
color?: 'primary' | 'success' | 'warning' | 'error' | 'info'
|
|
161
|
+
/** Extra classes on the outer wrapper. */
|
|
162
|
+
className?: string
|
|
163
|
+
|
|
164
|
+
/** The optional label span (projected content lands here; read once). */
|
|
165
|
+
@ViewChild('labelEl') private labelEl?: ElementRef<HTMLSpanElement>
|
|
166
|
+
/** The optional value-label span (projected content lands here; read once). */
|
|
167
|
+
@ViewChild('valueLabelEl') private valueLabelEl?: ElementRef<HTMLSpanElement>
|
|
168
|
+
|
|
169
|
+
/** Whether a `[slot=label]` projection landed (true until the first view proves otherwise). */
|
|
170
|
+
private readonly labelProjected = signal(true)
|
|
171
|
+
/** Whether a `[slot=valueLabel]` projection landed (true until the first view proves otherwise). */
|
|
172
|
+
private readonly valueLabelProjected = signal(true)
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Reads the optional header regions' first render: when neither a text input
|
|
176
|
+
* nor projected content landed, React would not render the region at all, so
|
|
177
|
+
* the optimistic render is withdrawn.
|
|
178
|
+
*/
|
|
179
|
+
ngAfterViewInit(): void {
|
|
180
|
+
const label = this.labelEl?.nativeElement
|
|
181
|
+
if (label) this.labelProjected.set(hasProjection(label, this.hasLabel))
|
|
182
|
+
const valueLabel = this.valueLabelEl?.nativeElement
|
|
183
|
+
if (valueLabel) this.valueLabelProjected.set(hasProjection(valueLabel, this.hasValueLabel))
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The current class map.
|
|
188
|
+
* @returns The UIClassMap.
|
|
189
|
+
*/
|
|
190
|
+
cm(): UIClassMap {
|
|
191
|
+
return getClassMap()
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Whether a text label input renders (React's `label && …`).
|
|
196
|
+
* @returns True when the label renders as text.
|
|
197
|
+
*/
|
|
198
|
+
get hasLabel(): boolean {
|
|
199
|
+
return this.label !== undefined && this.label !== null && !!this.label
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Whether a text value-label input renders (React's `valueLabel && …`).
|
|
204
|
+
* @returns True when the value label renders as text.
|
|
205
|
+
*/
|
|
206
|
+
get hasValueLabel(): boolean {
|
|
207
|
+
return this.valueLabel !== undefined && this.valueLabel !== null && !!this.valueLabel
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Whether the label span renders: a truthy text input or a `[slot=label]` projection.
|
|
212
|
+
* @returns True when the label shows.
|
|
213
|
+
*/
|
|
214
|
+
get showLabel(): boolean {
|
|
215
|
+
return this.hasLabel || this.labelProjected()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Whether the value-label span renders.
|
|
220
|
+
* @returns True when the value label shows.
|
|
221
|
+
*/
|
|
222
|
+
get showValueLabel(): boolean {
|
|
223
|
+
return this.hasValueLabel || this.valueLabelProjected()
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Whether the header row renders at all (React's `(label || valueLabel)`).
|
|
228
|
+
* @returns True when the header row shows.
|
|
229
|
+
*/
|
|
230
|
+
get showHeader(): boolean {
|
|
231
|
+
return this.showLabel || this.showValueLabel
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The maximum width (React's default parameter: a later-bound write of
|
|
236
|
+
* `undefined` must not erase the `100` default).
|
|
237
|
+
* @returns The maximum.
|
|
238
|
+
*/
|
|
239
|
+
maxValue(): number {
|
|
240
|
+
return this.max ?? 100
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The size preset (React's `size = 'md'`).
|
|
245
|
+
* @returns The size.
|
|
246
|
+
*/
|
|
247
|
+
sizeValue(): 'sm' | 'md' | 'lg' {
|
|
248
|
+
return this.size ?? 'md'
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The color variant (React's `color = 'primary'`).
|
|
253
|
+
* @returns The color.
|
|
254
|
+
*/
|
|
255
|
+
colorValue(): 'primary' | 'success' | 'warning' | 'error' | 'info' {
|
|
256
|
+
return this.color ?? 'primary'
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* The fill percentage React computes (`max === 0` renders empty).
|
|
261
|
+
* @returns The percentage in the 0–100 range.
|
|
262
|
+
*/
|
|
263
|
+
fillPercent(): number {
|
|
264
|
+
const max = this.maxValue()
|
|
265
|
+
return max === 0 ? 0 : Math.max(0, Math.min(100, (this.value / max) * 100))
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The fill's inline style (React's `{ width: '<pct>%' }`).
|
|
270
|
+
* @returns The style attribute text.
|
|
271
|
+
*/
|
|
272
|
+
fillStyleText(): string | null {
|
|
273
|
+
return styleText({ width: `${this.fillPercent()}%` })
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* The host's class list (React's `cm.cn(cm.stack(2), className)`).
|
|
278
|
+
* @returns The class string.
|
|
279
|
+
*/
|
|
280
|
+
classes(): string {
|
|
281
|
+
const cm = this.cm()
|
|
282
|
+
return cm.cn(cm.stack(2), this.className)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The header row's class list (React's `cm.flex({ justify: 'between', align: 'center' })`).
|
|
287
|
+
* @returns The class string.
|
|
288
|
+
*/
|
|
289
|
+
headerClasses(): string {
|
|
290
|
+
return this.cm().flex({ justify: 'between', align: 'center' })
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* The label span's class list (React's `cm.cn(cm.textSize('sm'), cm.fontWeight('medium'))`).
|
|
295
|
+
* @returns The class string.
|
|
296
|
+
*/
|
|
297
|
+
labelClasses(): string {
|
|
298
|
+
const cm = this.cm()
|
|
299
|
+
return cm.cn(cm.textSize('sm'), cm.fontWeight('medium'))
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* The value-label span's class list (React's `cm.textSize('sm')`).
|
|
304
|
+
* @returns The class string.
|
|
305
|
+
*/
|
|
306
|
+
valueLabelClasses(): string {
|
|
307
|
+
return this.cm().textSize('sm')
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The track's class list (React's `cm.cn(cm.progress(), cm.progressHeight(size))`).
|
|
312
|
+
* @returns The class string.
|
|
313
|
+
*/
|
|
314
|
+
trackClasses(): string {
|
|
315
|
+
const cm = this.cm()
|
|
316
|
+
return cm.cn(cm.progress(), cm.progressHeight(this.sizeValue()))
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* The fill's class list (React's `cm.cn(cm.progressBar(), cm.progressColor(color))`).
|
|
321
|
+
* @returns The class string.
|
|
322
|
+
*/
|
|
323
|
+
fillClasses(): string {
|
|
324
|
+
const cm = this.cm()
|
|
325
|
+
return cm.cn(cm.progressBar(), cm.progressColor(this.colorValue()))
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### `ProgressCard`
|
|
331
|
+
|
|
332
|
+
ProgressCard component.
|
|
333
|
+
|
|
334
|
+
`<Card>`-wrapped progress display with title, optional icon and description,
|
|
335
|
+
the progress bar itself, and an optional extras slot below. The host IS the
|
|
336
|
+
Card `div` (`div[mol-progress-card]`), matching React's root exactly — same
|
|
337
|
+
classes. Node props (`title`, `description`, `icon`, `valueLabel`,
|
|
338
|
+
`children`) are projected content (`[slot=<name>]`, or the default
|
|
339
|
+
projection) or plain string inputs.
|
|
340
|
+
|
|
341
|
+
This is the Angular counterpart of `@molecule/app-progress-bar-react`: the
|
|
342
|
+
same props (React names), the same ClassMap tokens, and the same DOM for the
|
|
343
|
+
same input.
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
@Component({
|
|
347
|
+
selector: 'div[mol-progress-card]',
|
|
348
|
+
standalone: true,
|
|
349
|
+
imports: [ProgressBar],
|
|
350
|
+
inputs: ['title', 'description', 'icon', 'value', 'max', 'valueLabel', 'color', 'className'],
|
|
351
|
+
host: {
|
|
352
|
+
'[class]': 'classes()',
|
|
353
|
+
},
|
|
354
|
+
// prettier-ignore
|
|
355
|
+
template: `<div [class]="stackClasses()"><div [class]="headerClasses()"><div [class]="leftClasses()">@if (hasIcon) {{{ icon }}}<ng-content select="[slot=icon]"></ng-content><div><h3 [class]="titleClasses()">@if (hasTitle) {{{ title }}}<ng-content select="[slot=title]"></ng-content></h3>@if (showDescription) {<p #descriptionEl [class]="descriptionClasses()">@if (hasDescription) {{{ description }}}<ng-content select="[slot=description]"></ng-content></p>}</div></div>@if (showValueLabel) {<span #valueLabelEl [class]="valueLabelClasses()">@if (hasValueLabel) {{{ valueLabel }}}<ng-content select="[slot=valueLabel]"></ng-content></span>}</div><div mol-progress-bar [value]="value" [max]="maxValue()" [color]="colorValue()"></div><ng-content></ng-content></div>`,
|
|
356
|
+
})
|
|
357
|
+
export class ProgressCard implements AfterViewInit {
|
|
358
|
+
/** Card title — a string input, or `[slot=title]` projected content. */
|
|
359
|
+
title?: ProgressCardProps['title']
|
|
360
|
+
/** Optional supporting description below the title — a string input, or `[slot=description]` content. */
|
|
361
|
+
description?: ProgressCardProps['description']
|
|
362
|
+
/** Optional icon shown in the card header — `[slot=icon]` projected content (or a string input). */
|
|
363
|
+
icon?: ProgressCardProps['icon']
|
|
364
|
+
/** Current value. */
|
|
365
|
+
value!: number
|
|
366
|
+
/** Maximum (defaults to `100` at read time). */
|
|
367
|
+
max?: number
|
|
368
|
+
/** Value display on the right of the header — a string input, or `[slot=valueLabel]` content. */
|
|
369
|
+
valueLabel?: ProgressCardProps['valueLabel']
|
|
370
|
+
/** ProgressBar color (defaults to `'primary'`). */
|
|
371
|
+
color?: 'primary' | 'success' | 'warning' | 'error' | 'info'
|
|
372
|
+
/** Extra classes on the Card wrapper. */
|
|
373
|
+
className?: string
|
|
374
|
+
|
|
375
|
+
/** The optional description paragraph (projected content lands here; read once). */
|
|
376
|
+
@ViewChild('descriptionEl') private descriptionEl?: ElementRef<HTMLParagraphElement>
|
|
377
|
+
/** The optional value-label span (projected content lands here; read once). */
|
|
378
|
+
@ViewChild('valueLabelEl') private valueLabelEl?: ElementRef<HTMLSpanElement>
|
|
379
|
+
|
|
380
|
+
/** Whether a `[slot=description]` projection landed (true until the first view proves otherwise). */
|
|
381
|
+
private readonly descriptionProjected = signal(true)
|
|
382
|
+
/** Whether a `[slot=valueLabel]` projection landed (true until the first view proves otherwise). */
|
|
383
|
+
private readonly valueLabelProjected = signal(true)
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Reads the optional regions' first render: when neither a text input nor
|
|
387
|
+
* projected content landed, React would not render the region at all, so the
|
|
388
|
+
* optimistic render is withdrawn.
|
|
389
|
+
*/
|
|
390
|
+
ngAfterViewInit(): void {
|
|
391
|
+
const description = this.descriptionEl?.nativeElement
|
|
392
|
+
if (description) this.descriptionProjected.set(hasProjection(description, this.hasDescription))
|
|
393
|
+
const valueLabel = this.valueLabelEl?.nativeElement
|
|
394
|
+
if (valueLabel) this.valueLabelProjected.set(hasProjection(valueLabel, this.hasValueLabel))
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* The current class map.
|
|
399
|
+
* @returns The UIClassMap.
|
|
400
|
+
*/
|
|
401
|
+
cm(): UIClassMap {
|
|
402
|
+
return getClassMap()
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Whether a text icon input renders (a projected icon is not).
|
|
407
|
+
* @returns True when the icon renders as text.
|
|
408
|
+
*/
|
|
409
|
+
get hasIcon(): boolean {
|
|
410
|
+
return this.icon !== undefined && this.icon !== null && this.icon !== false && this.icon !== ''
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Whether a text title input renders (a projected title is not).
|
|
415
|
+
* @returns True when the title renders as text.
|
|
416
|
+
*/
|
|
417
|
+
get hasTitle(): boolean {
|
|
418
|
+
return this.title !== undefined && this.title !== null
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Whether a text description input is present (React's `description && …`).
|
|
423
|
+
* @returns True when the description renders as text.
|
|
424
|
+
*/
|
|
425
|
+
get hasDescription(): boolean {
|
|
426
|
+
return (
|
|
427
|
+
this.description !== undefined &&
|
|
428
|
+
this.description !== null &&
|
|
429
|
+
this.description !== false &&
|
|
430
|
+
this.description !== ''
|
|
431
|
+
)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Whether a text value-label input is present (React's `valueLabel && …`).
|
|
436
|
+
* @returns True when the value label renders as text.
|
|
437
|
+
*/
|
|
438
|
+
get hasValueLabel(): boolean {
|
|
439
|
+
return (
|
|
440
|
+
this.valueLabel !== undefined &&
|
|
441
|
+
this.valueLabel !== null &&
|
|
442
|
+
this.valueLabel !== false &&
|
|
443
|
+
this.valueLabel !== ''
|
|
444
|
+
)
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Whether the description paragraph renders.
|
|
449
|
+
* @returns True when the description shows.
|
|
450
|
+
*/
|
|
451
|
+
get showDescription(): boolean {
|
|
452
|
+
return this.hasDescription || this.descriptionProjected()
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Whether the value-label span renders.
|
|
457
|
+
* @returns True when the value label shows.
|
|
458
|
+
*/
|
|
459
|
+
get showValueLabel(): boolean {
|
|
460
|
+
return this.hasValueLabel || this.valueLabelProjected()
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* The maximum (React's default parameter: a later-bound write of `undefined`
|
|
465
|
+
* must not erase the `100` default).
|
|
466
|
+
* @returns The maximum.
|
|
467
|
+
*/
|
|
468
|
+
maxValue(): number {
|
|
469
|
+
return this.max ?? 100
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* The color variant (React's `color = 'primary'`).
|
|
474
|
+
* @returns The color.
|
|
475
|
+
*/
|
|
476
|
+
colorValue(): 'primary' | 'success' | 'warning' | 'error' | 'info' {
|
|
477
|
+
return this.color ?? 'primary'
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* The host's class list (React's `<Card className>` classes).
|
|
482
|
+
* @returns The class string.
|
|
483
|
+
*/
|
|
484
|
+
classes(): string {
|
|
485
|
+
const cm = this.cm()
|
|
486
|
+
return cm.cn(cm.card({ variant: 'elevated' }), cm.cardPadding('md'), this.className)
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* The stack wrapper's class list (React's `cm.stack(3)`).
|
|
491
|
+
* @returns The class string.
|
|
492
|
+
*/
|
|
493
|
+
stackClasses(): string {
|
|
494
|
+
return this.cm().stack(3)
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* The header row's class list (React's `cm.flex({ justify: 'between', align: 'start', gap: 'sm' })`).
|
|
499
|
+
* @returns The class string.
|
|
500
|
+
*/
|
|
501
|
+
headerClasses(): string {
|
|
502
|
+
return this.cm().flex({ justify: 'between', align: 'start', gap: 'sm' })
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* The left group's class list (React's `cm.flex({ align: 'center', gap: 'sm' })`).
|
|
507
|
+
* @returns The class string.
|
|
508
|
+
*/
|
|
509
|
+
leftClasses(): string {
|
|
510
|
+
return this.cm().flex({ align: 'center', gap: 'sm' })
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* The title heading's class list (React's `cm.cn(cm.textSize('base'), cm.fontWeight('semibold'))`).
|
|
515
|
+
* @returns The class string.
|
|
516
|
+
*/
|
|
517
|
+
titleClasses(): string {
|
|
518
|
+
const cm = this.cm()
|
|
519
|
+
return cm.cn(cm.textSize('base'), cm.fontWeight('semibold'))
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* The description paragraph's class list (React's `cm.textSize('sm')`).
|
|
524
|
+
* @returns The class string.
|
|
525
|
+
*/
|
|
526
|
+
descriptionClasses(): string {
|
|
527
|
+
return this.cm().textSize('sm')
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* The value-label span's class list (React's `cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'))`).
|
|
532
|
+
* @returns The class string.
|
|
533
|
+
*/
|
|
534
|
+
valueLabelClasses(): string {
|
|
535
|
+
const cm = this.cm()
|
|
536
|
+
return cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'))
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
## Injection Notes
|
|
542
|
+
|
|
543
|
+
### Requirements
|
|
544
|
+
|
|
545
|
+
Peer dependencies:
|
|
546
|
+
|
|
547
|
+
- `@angular/common` ^22.0.0
|
|
548
|
+
- `@angular/core` ^22.0.0
|
|
549
|
+
- `@angular/platform-browser` ^22.0.0
|
|
550
|
+
- `@molecule/app-angular` ^3.5.0
|
|
551
|
+
- `@molecule/app-ui` ^1.0.1
|
|
552
|
+
- `@molecule/app-ui-angular` ^1.1.0
|
|
553
|
+
|
|
554
|
+
### Runtime Dependencies
|
|
555
|
+
|
|
556
|
+
- `@angular/common`
|
|
557
|
+
- `@angular/core`
|
|
558
|
+
- `@angular/platform-browser`
|
|
559
|
+
- `@molecule/app-angular`
|
|
560
|
+
- `@molecule/app-ui`
|
|
561
|
+
- `@molecule/app-ui-angular`
|
|
562
|
+
|
|
563
|
+
All text (`label`, `valueLabel`, `title`, `description`) is pass-through —
|
|
564
|
+
supply already-translated strings; the package renders no text of its own.
|
|
565
|
+
Requires a wired ClassMap bond: the track/fill styles come from the
|
|
566
|
+
`progress*` ClassMap tokens, so colors follow the active theme. Node props
|
|
567
|
+
are projected content (`[slot=<name>]`) or plain string inputs.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular labeled progress bar and progress-card wrapper — the counterpart of
|
|
3
|
+
* `@molecule/app-progress-bar-react`, with the same props and the same DOM.
|
|
4
|
+
*
|
|
5
|
+
* Exports:
|
|
6
|
+
* - `<ProgressBar>` (`div[mol-progress-bar]`) — standalone bar with optional
|
|
7
|
+
* label + value display.
|
|
8
|
+
* - `<ProgressCard>` (`div[mol-progress-card]`) — Card-wrapped progress
|
|
9
|
+
* display (title, icon, description, bar, optional extras slot).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { ProgressBar, ProgressCard } from '@molecule/app-progress-bar-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'app-dashboard',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [ProgressBar, ProgressCard],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div mol-progress-bar [value]="65" label="Upload progress" valueLabel="65%"></div>
|
|
22
|
+
* <div mol-progress-card
|
|
23
|
+
* [title]="'Storage used'"
|
|
24
|
+
* [description]="'8.5 GB of 10 GB'"
|
|
25
|
+
* [value]="85"
|
|
26
|
+
* valueLabel="85%"
|
|
27
|
+
* color="warning"></div>
|
|
28
|
+
* `,
|
|
29
|
+
* })
|
|
30
|
+
* export class Dashboard {}
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* All text (`label`, `valueLabel`, `title`, `description`) is pass-through —
|
|
35
|
+
* supply already-translated strings; the package renders no text of its own.
|
|
36
|
+
* Requires a wired ClassMap bond: the track/fill styles come from the
|
|
37
|
+
* `progress*` ClassMap tokens, so colors follow the active theme. Node props
|
|
38
|
+
* are projected content (`[slot=<name>]`) or plain string inputs.
|
|
39
|
+
*
|
|
40
|
+
* @module
|
|
41
|
+
*/
|
|
42
|
+
export * from './progress-bar.component.js';
|
|
43
|
+
export * from './progress-card.component.js';
|
|
44
|
+
export * from './types.js';
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular labeled progress bar and progress-card wrapper — the counterpart of
|
|
3
|
+
* `@molecule/app-progress-bar-react`, with the same props and the same DOM.
|
|
4
|
+
*
|
|
5
|
+
* Exports:
|
|
6
|
+
* - `<ProgressBar>` (`div[mol-progress-bar]`) — standalone bar with optional
|
|
7
|
+
* label + value display.
|
|
8
|
+
* - `<ProgressCard>` (`div[mol-progress-card]`) — Card-wrapped progress
|
|
9
|
+
* display (title, icon, description, bar, optional extras slot).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { ProgressBar, ProgressCard } from '@molecule/app-progress-bar-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'app-dashboard',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [ProgressBar, ProgressCard],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div mol-progress-bar [value]="65" label="Upload progress" valueLabel="65%"></div>
|
|
22
|
+
* <div mol-progress-card
|
|
23
|
+
* [title]="'Storage used'"
|
|
24
|
+
* [description]="'8.5 GB of 10 GB'"
|
|
25
|
+
* [value]="85"
|
|
26
|
+
* valueLabel="85%"
|
|
27
|
+
* color="warning"></div>
|
|
28
|
+
* `,
|
|
29
|
+
* })
|
|
30
|
+
* export class Dashboard {}
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* All text (`label`, `valueLabel`, `title`, `description`) is pass-through —
|
|
35
|
+
* supply already-translated strings; the package renders no text of its own.
|
|
36
|
+
* Requires a wired ClassMap bond: the track/fill styles come from the
|
|
37
|
+
* `progress*` ClassMap tokens, so colors follow the active theme. Node props
|
|
38
|
+
* are projected content (`[slot=<name>]`) or plain string inputs.
|
|
39
|
+
*
|
|
40
|
+
* @module
|
|
41
|
+
*/
|
|
42
|
+
export * from './progress-bar.component.js';
|
|
43
|
+
export * from './progress-card.component.js';
|
|
44
|
+
export * from './types.js';
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
|