@molecule/app-status-badge-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 ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,336 @@
1
- # Temporary Holding Version
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-15T10:25:36.496Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-status-badge-angular
10
+
11
+ Angular status-badge and status-pill components.
12
+
13
+ Both components map a small `StatusKind` union (`success`/`warning`/
14
+ `error`/`info`/`neutral`) to ClassMap-driven styling so apps can
15
+ restyle by swapping the ClassMap bond rather than rewriting
16
+ components.
17
+
18
+ `<span mol-status-badge kind="…">children</span>` — the contract is
19
+ `kind` + projected children (there are NO `label`/`color` props).
20
+ `appearance='ui'` (default) carries the framework `<Badge>`'s ClassMap
21
+ styling and works with any ClassMap bond.
22
+ `<span mol-status-pill kind="…">children</span>` adds a small colored
23
+ status dot before the label.
24
+
25
+ This is the Angular counterpart of `@molecule/app-status-badge-react`: the
26
+ same props (React names) and the same DOM for the same input. Node props are
27
+ projected content: the icon is `[slot=icon]`, everything else is the default
28
+ projection.
29
+
30
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
31
+ > It is written to be read by coding agents as much as by people, and is generated from this
32
+ > package's source — edit `src/index.ts` JSDoc, not this file.
33
+
34
+ ## Quick Start
35
+
36
+ ```ts
37
+ import { Component } from '@angular/core'
38
+ import { StatusBadge, StatusPill } from '@molecule/app-status-badge-angular'
39
+
40
+ @Component({
41
+ selector: 'app-row',
42
+ standalone: true,
43
+ imports: [StatusBadge, StatusPill],
44
+ template: `
45
+ <span mol-status-badge kind="success">Open</span>
46
+ <span mol-status-badge kind="warning" appearance="uppercase-pill">
47
+ <span slot="icon" aria-hidden="true">!</span>
48
+ Pending
49
+ </span>
50
+ <span mol-status-pill kind="error">Overdue</span>
51
+ `,
52
+ })
53
+ export class Row {}
54
+ ```
55
+
56
+ ## Type
57
+
58
+ `feature`
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ npm install @molecule/app-status-badge-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
64
+ ```
65
+
66
+ ## API
67
+
68
+ ### Interfaces
69
+
70
+ #### `StatusBadgeProps`
71
+
72
+ Props accepted by {@link StatusBadge} — the same props
73
+ `@molecule/app-status-badge-react` accepts. Node props (`children`, `icon`)
74
+ are projected content in Angular (an input cannot carry a node), so they are
75
+ typed `unknown`: pass them in the host template, not as values. `icon` is
76
+ selected by `[slot=icon]`; everything else is the default projection.
77
+
78
+ ```typescript
79
+ interface StatusBadgeProps {
80
+ /** Semantic kind — maps to ClassMap badge color variants. */
81
+ kind?: StatusKind
82
+ /** Badge label, projected as the element's default content. */
83
+ children?: unknown
84
+ /** Optional leading icon, projected as `[slot=icon]` content. */
85
+ icon?: unknown
86
+ /**
87
+ * Visual appearance variant.
88
+ * - `'ui'` (default) — the ClassMap badge styling, honoring the active
89
+ * ClassMap bond and working with any theme.
90
+ * - `'uppercase-pill'` — a compact uppercase pill that colors itself with
91
+ * the SAME ClassMap `badge` tokens, then layers `cm.uppercase` +
92
+ * `cm.trackingWide` for the uppercase treatment.
93
+ */
94
+ appearance?: 'ui' | 'uppercase-pill'
95
+ /** Extra classes passed through to the rendered element. */
96
+ className?: string
97
+ }
98
+ ```
99
+
100
+ #### `StatusPillProps`
101
+
102
+ Props accepted by {@link StatusPill} — the same props
103
+ `@molecule/app-status-badge-react` accepts. `children` is projected content.
104
+
105
+ ```typescript
106
+ interface StatusPillProps {
107
+ /** Semantic kind. */
108
+ kind?: StatusKind
109
+ /** Pill label, projected as the element's default content. */
110
+ children?: unknown
111
+ /** Render a leading dot indicator. Defaults to true. */
112
+ dot?: boolean
113
+ /** Extra classes. */
114
+ className?: string
115
+ }
116
+ ```
117
+
118
+ ### Types
119
+
120
+ #### `StatusKind`
121
+
122
+ Semantic status kind used to select badge color variants.
123
+
124
+ ```typescript
125
+ type StatusKind = 'success' | 'warning' | 'error' | 'info' | 'neutral'
126
+ ```
127
+
128
+ ### Classes
129
+
130
+ #### `StatusBadge`
131
+
132
+ Semantic status badge — maps status kinds to ClassMap color variants.
133
+
134
+ The host IS the span React renders (`span[mol-status-badge]`), so both
135
+ appearances stay a single `<span>`: `'ui'` (default) carries the ClassMap
136
+ `badge` classes of the framework `<Badge>`, and `'uppercase-pill'` the same
137
+ per-kind colors plus `cm.uppercase` + `cm.trackingWide`. The optional icon
138
+ is projected as `[slot=icon]` content inside React's
139
+ `<span class="mr-1">…</span>` wrapper; the wrapper is detached when the
140
+ projection carries no nodes, exactly as React renders nothing for an absent
141
+ icon.
142
+
143
+ ```typescript
144
+ @Component({
145
+ selector: 'span[mol-status-badge]',
146
+ standalone: true,
147
+ inputs: ['kind', 'appearance', 'className'],
148
+ host: {
149
+ '[class]': 'classes()',
150
+ },
151
+ template: `<span [class]="iconClass()" #iconSlot
152
+ ><ng-content select="[slot=icon]"></ng-content
153
+ ></span>
154
+ <ng-content></ng-content>`,
155
+ })
156
+ export class StatusBadge implements AfterViewInit {
157
+ /** Semantic kind — maps to ClassMap badge color variants (defaults to `'neutral'`). */
158
+ kind?: StatusKind
159
+ /** Visual appearance variant (defaults to `'ui'`). */
160
+ appearance?: 'ui' | 'uppercase-pill'
161
+ /** Extra classes passed through to the rendered element. */
162
+ className?: string
163
+
164
+ /** The icon wrapper (always in the template; detached when unused). */
165
+ @ViewChild('iconSlot') iconSlot?: ElementRef<HTMLSpanElement>
166
+
167
+ private readonly sync = new SlotWrapper(inject(ElementRef), inject(Renderer2))
168
+
169
+ /**
170
+ * The current class map.
171
+ * @returns The UIClassMap.
172
+ */
173
+ cm(): UIClassMap {
174
+ return getClassMap()
175
+ }
176
+
177
+ /**
178
+ * The semantic kind (React's `kind = 'neutral'` default parameter).
179
+ * @returns The kind.
180
+ */
181
+ kindValue(): StatusKind {
182
+ return this.kind ?? 'neutral'
183
+ }
184
+
185
+ /**
186
+ * Computes the root span's class list, per appearance: React's `<Badge>`
187
+ * classes for `'ui'`, the uppercase pill's classes for `'uppercase-pill'`.
188
+ * @returns The class string.
189
+ */
190
+ classes(): string {
191
+ const cm = this.cm()
192
+ const color = KIND_TO_COLOR[this.kindValue()]
193
+ if ((this.appearance ?? 'ui') === 'uppercase-pill') {
194
+ return cm.cn(cm.badge({ variant: color }), cm.uppercase, cm.trackingWide, this.className)
195
+ }
196
+ return cm.cn(cm.badge({ variant: color }), this.className)
197
+ }
198
+
199
+ /**
200
+ * Computes the icon wrapper's class list (`cm.sp('mr', 1)`).
201
+ * @returns The class string.
202
+ */
203
+ iconClass(): string {
204
+ return this.cm().sp('mr', 1)
205
+ }
206
+
207
+ /**
208
+ * Detaches the icon wrapper when its slot projection carries no nodes —
209
+ * React renders no wrapper for an absent icon. The `<ng-content>` capture
210
+ * point must stay mounted, so presence is read here and the wrapper removed
211
+ * from the DOM instead.
212
+ */
213
+ ngAfterViewInit(): void {
214
+ const icon = this.iconSlot?.nativeElement
215
+ this.sync.sync(icon, icon ? hasNodes(icon) : false)
216
+ }
217
+ }
218
+ ```
219
+
220
+ #### `StatusPill`
221
+
222
+ Rounded status pill with an optional leading colored dot.
223
+
224
+ The host IS the span React renders (`span[mol-status-pill]`). The pill has NO
225
+ background surface of its own — only the dot carries color — so add a
226
+ surface via `className` if you need a filled pill. The label is the default
227
+ projection; the dot is a boolean prop, exactly as in React.
228
+
229
+ ```typescript
230
+ @Component({
231
+ selector: 'span[mol-status-pill]',
232
+ standalone: true,
233
+ inputs: ['kind', 'dot', 'className'],
234
+ host: {
235
+ '[class]': 'classes()',
236
+ },
237
+ template: `@if (showDot()) {
238
+ <span [class]="dotClass()" aria-hidden="true"></span>
239
+ }
240
+ <ng-content></ng-content>`,
241
+ })
242
+ export class StatusPill {
243
+ /** Semantic kind (defaults to `'neutral'`). */
244
+ kind?: StatusKind
245
+ /** Whether the leading dot renders (defaults to true). */
246
+ dot?: boolean
247
+ /** Extra classes. */
248
+ className?: string
249
+
250
+ /**
251
+ * The current class map.
252
+ * @returns The UIClassMap.
253
+ */
254
+ cm(): UIClassMap {
255
+ return getClassMap()
256
+ }
257
+
258
+ /**
259
+ * The semantic kind (React's `kind = 'neutral'` default parameter).
260
+ * @returns The kind.
261
+ */
262
+ kindValue(): StatusKind {
263
+ return this.kind ?? 'neutral'
264
+ }
265
+
266
+ /**
267
+ * Whether the leading dot renders (React's `dot = true` default parameter).
268
+ * @returns True while the dot renders.
269
+ */
270
+ showDot(): boolean {
271
+ return this.dot ?? true
272
+ }
273
+
274
+ /**
275
+ * Computes the root span's class list.
276
+ * @returns The class string.
277
+ */
278
+ classes(): string {
279
+ return this.cm().cn(
280
+ this.cm().flex({ align: 'center', gap: 'xs' }),
281
+ this.cm().sp('px', 3),
282
+ this.cm().sp('py', 1),
283
+ this.cm().roundedFull,
284
+ this.cm().textSize('xs'),
285
+ this.cm().fontWeight('medium'),
286
+ this.className,
287
+ )
288
+ }
289
+
290
+ /**
291
+ * Computes the dot span's class list (`cm.w(2)` + `cm.h(2)` + `cm.roundedFull`
292
+ * + the kind's color token).
293
+ * @returns The class string.
294
+ */
295
+ dotClass(): string {
296
+ const cm = this.cm()
297
+ return cm.cn(cm.w(2), cm.h(2), cm.roundedFull, DOT_COLOR[this.kindValue()])
298
+ }
299
+ }
300
+ ```
301
+
302
+ ## Injection Notes
303
+
304
+ ### Requirements
305
+
306
+ Peer dependencies:
307
+
308
+ - `@angular/common` ^22.0.0
309
+ - `@angular/core` ^22.0.0
310
+ - `@angular/platform-browser` ^22.0.0
311
+ - `@molecule/app-angular` ^3.5.0
312
+ - `@molecule/app-ui` ^1.0.1
313
+ - `@molecule/app-ui-angular` ^1.1.0
314
+
315
+ ### Runtime Dependencies
316
+
317
+ - `@angular/common`
318
+ - `@angular/core`
319
+ - `@angular/platform-browser`
320
+ - `@molecule/app-angular`
321
+ - `@molecule/app-ui`
322
+ - `@molecule/app-ui-angular`
323
+
324
+ - Requires a wired ClassMap bond (e.g. `@molecule/app-ui-tailwind`) —
325
+ `getClassMap()` throws before bonding.
326
+ - The host element IS the badge span (`span[mol-status-badge]` /
327
+ `span[mol-status-pill]`), so the rendered DOM is exactly React's.
328
+ - The `'uppercase-pill'` variant colors through the same ClassMap `badge`
329
+ tokens and layers `cm.uppercase` + `cm.trackingWide`, so every kind is
330
+ visibly colored in every theme.
331
+ - `<StatusPill>` has no background surface of its own — only the dot is
332
+ colored; add a surface via `className` if you need a filled pill. Its
333
+ `neutral` dot uses `bg-outline`, which also needs a theme `outline` color
334
+ token to be visible.
335
+ - Labels are the projected children — pass already-translated strings
336
+ (`t('...')`); the components render no text of their own.
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Angular status-badge and status-pill components.
3
+ *
4
+ * Both components map a small `StatusKind` union (`success`/`warning`/
5
+ * `error`/`info`/`neutral`) to ClassMap-driven styling so apps can
6
+ * restyle by swapping the ClassMap bond rather than rewriting
7
+ * components.
8
+ *
9
+ * `<span mol-status-badge kind="…">children</span>` — the contract is
10
+ * `kind` + projected children (there are NO `label`/`color` props).
11
+ * `appearance='ui'` (default) carries the framework `<Badge>`'s ClassMap
12
+ * styling and works with any ClassMap bond.
13
+ * `<span mol-status-pill kind="…">children</span>` adds a small colored
14
+ * status dot before the label.
15
+ *
16
+ * This is the Angular counterpart of `@molecule/app-status-badge-react`: the
17
+ * same props (React names) and the same DOM for the same input. Node props are
18
+ * projected content: the icon is `[slot=icon]`, everything else is the default
19
+ * projection.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { Component } from '@angular/core'
24
+ * import { StatusBadge, StatusPill } from '@molecule/app-status-badge-angular'
25
+ *
26
+ * @Component({
27
+ * selector: 'app-row',
28
+ * standalone: true,
29
+ * imports: [StatusBadge, StatusPill],
30
+ * template: `
31
+ * <span mol-status-badge kind="success">Open</span>
32
+ * <span mol-status-badge kind="warning" appearance="uppercase-pill">
33
+ * <span slot="icon" aria-hidden="true">!</span>
34
+ * Pending
35
+ * </span>
36
+ * <span mol-status-pill kind="error">Overdue</span>
37
+ * `,
38
+ * })
39
+ * export class Row {}
40
+ * ```
41
+ *
42
+ * @remarks
43
+ * - Requires a wired ClassMap bond (e.g. `@molecule/app-ui-tailwind`) —
44
+ * `getClassMap()` throws before bonding.
45
+ * - The host element IS the badge span (`span[mol-status-badge]` /
46
+ * `span[mol-status-pill]`), so the rendered DOM is exactly React's.
47
+ * - The `'uppercase-pill'` variant colors through the same ClassMap `badge`
48
+ * tokens and layers `cm.uppercase` + `cm.trackingWide`, so every kind is
49
+ * visibly colored in every theme.
50
+ * - `<StatusPill>` has no background surface of its own — only the dot is
51
+ * colored; add a surface via `className` if you need a filled pill. Its
52
+ * `neutral` dot uses `bg-outline`, which also needs a theme `outline` color
53
+ * token to be visible.
54
+ * - Labels are the projected children — pass already-translated strings
55
+ * (`t('...')`); the components render no text of their own.
56
+ *
57
+ * @module
58
+ */
59
+ export * from './status-badge.component.js';
60
+ export * from './status-pill.component.js';
61
+ export * from './types.js';
62
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Angular status-badge and status-pill components.
3
+ *
4
+ * Both components map a small `StatusKind` union (`success`/`warning`/
5
+ * `error`/`info`/`neutral`) to ClassMap-driven styling so apps can
6
+ * restyle by swapping the ClassMap bond rather than rewriting
7
+ * components.
8
+ *
9
+ * `<span mol-status-badge kind="…">children</span>` — the contract is
10
+ * `kind` + projected children (there are NO `label`/`color` props).
11
+ * `appearance='ui'` (default) carries the framework `<Badge>`'s ClassMap
12
+ * styling and works with any ClassMap bond.
13
+ * `<span mol-status-pill kind="…">children</span>` adds a small colored
14
+ * status dot before the label.
15
+ *
16
+ * This is the Angular counterpart of `@molecule/app-status-badge-react`: the
17
+ * same props (React names) and the same DOM for the same input. Node props are
18
+ * projected content: the icon is `[slot=icon]`, everything else is the default
19
+ * projection.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { Component } from '@angular/core'
24
+ * import { StatusBadge, StatusPill } from '@molecule/app-status-badge-angular'
25
+ *
26
+ * @Component({
27
+ * selector: 'app-row',
28
+ * standalone: true,
29
+ * imports: [StatusBadge, StatusPill],
30
+ * template: `
31
+ * <span mol-status-badge kind="success">Open</span>
32
+ * <span mol-status-badge kind="warning" appearance="uppercase-pill">
33
+ * <span slot="icon" aria-hidden="true">!</span>
34
+ * Pending
35
+ * </span>
36
+ * <span mol-status-pill kind="error">Overdue</span>
37
+ * `,
38
+ * })
39
+ * export class Row {}
40
+ * ```
41
+ *
42
+ * @remarks
43
+ * - Requires a wired ClassMap bond (e.g. `@molecule/app-ui-tailwind`) —
44
+ * `getClassMap()` throws before bonding.
45
+ * - The host element IS the badge span (`span[mol-status-badge]` /
46
+ * `span[mol-status-pill]`), so the rendered DOM is exactly React's.
47
+ * - The `'uppercase-pill'` variant colors through the same ClassMap `badge`
48
+ * tokens and layers `cm.uppercase` + `cm.trackingWide`, so every kind is
49
+ * visibly colored in every theme.
50
+ * - `<StatusPill>` has no background surface of its own — only the dot is
51
+ * colored; add a surface via `className` if you need a filled pill. Its
52
+ * `neutral` dot uses `bg-outline`, which also needs a theme `outline` color
53
+ * token to be visible.
54
+ * - Labels are the projected children — pass already-translated strings
55
+ * (`t('...')`); the components render no text of their own.
56
+ *
57
+ * @module
58
+ */
59
+ export * from './status-badge.component.js';
60
+ export * from './status-pill.component.js';
61
+ export * from './types.js';
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,YAAY,CAAA"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * StatusBadge component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import type { AfterViewInit } from '@angular/core';
7
+ import { ElementRef } from '@angular/core';
8
+ import type { UIClassMap } from '@molecule/app-ui';
9
+ import type { StatusKind } from './types.js';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * Semantic status badge — maps status kinds to ClassMap color variants.
13
+ *
14
+ * The host IS the span React renders (`span[mol-status-badge]`), so both
15
+ * appearances stay a single `<span>`: `'ui'` (default) carries the ClassMap
16
+ * `badge` classes of the framework `<Badge>`, and `'uppercase-pill'` the same
17
+ * per-kind colors plus `cm.uppercase` + `cm.trackingWide`. The optional icon
18
+ * is projected as `[slot=icon]` content inside React's
19
+ * `<span class="mr-1">…</span>` wrapper; the wrapper is detached when the
20
+ * projection carries no nodes, exactly as React renders nothing for an absent
21
+ * icon.
22
+ */
23
+ export declare class StatusBadge implements AfterViewInit {
24
+ /** Semantic kind — maps to ClassMap badge color variants (defaults to `'neutral'`). */
25
+ kind?: StatusKind;
26
+ /** Visual appearance variant (defaults to `'ui'`). */
27
+ appearance?: 'ui' | 'uppercase-pill';
28
+ /** Extra classes passed through to the rendered element. */
29
+ className?: string;
30
+ /** The icon wrapper (always in the template; detached when unused). */
31
+ iconSlot?: ElementRef<HTMLSpanElement>;
32
+ private readonly sync;
33
+ /**
34
+ * The current class map.
35
+ * @returns The UIClassMap.
36
+ */
37
+ cm(): UIClassMap;
38
+ /**
39
+ * The semantic kind (React's `kind = 'neutral'` default parameter).
40
+ * @returns The kind.
41
+ */
42
+ kindValue(): StatusKind;
43
+ /**
44
+ * Computes the root span's class list, per appearance: React's `<Badge>`
45
+ * classes for `'ui'`, the uppercase pill's classes for `'uppercase-pill'`.
46
+ * @returns The class string.
47
+ */
48
+ classes(): string;
49
+ /**
50
+ * Computes the icon wrapper's class list (`cm.sp('mr', 1)`).
51
+ * @returns The class string.
52
+ */
53
+ iconClass(): string;
54
+ /**
55
+ * Detaches the icon wrapper when its slot projection carries no nodes —
56
+ * React renders no wrapper for an absent icon. The `<ng-content>` capture
57
+ * point must stay mounted, so presence is read here and the wrapper removed
58
+ * from the DOM instead.
59
+ */
60
+ ngAfterViewInit(): void;
61
+ static ɵfac: i0.ɵɵFactoryDeclaration<StatusBadge, never>;
62
+ static ɵcmp: i0.ɵɵComponentDeclaration<StatusBadge, "span[mol-status-badge]", never, { "kind": { "alias": "kind"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=icon]", "*"], true, never>;
63
+ }
64
+ //# sourceMappingURL=status-badge.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-badge.component.d.ts","sourceRoot":"","sources":["../src/status-badge.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAa,UAAU,EAAgC,MAAM,eAAe,CAAA;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;;AAU5C;;;;;;;;;;;GAWG;AACH,qBAYa,WAAY,YAAW,aAAa;IAC/C,uFAAuF;IACvF,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,sDAAsD;IACtD,UAAU,CAAC,EAAE,IAAI,GAAG,gBAAgB,CAAA;IACpC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,uEAAuE;IAChD,QAAQ,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAE7D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyD;IAE9E;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,SAAS,IAAI,UAAU;IAIvB;;;;OAIG;IACH,OAAO,IAAI,MAAM;IASjB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;;;OAKG;IACH,eAAe,IAAI,IAAI;yCAzDZ,WAAW;2CAAX,WAAW;CA6DvB"}
@@ -0,0 +1,118 @@
1
+ import { Component, ElementRef, inject, Renderer2, ViewChild } from '@angular/core';
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ import { hasNodes, SlotWrapper } from '@molecule/app-ui-angular';
4
+ import * as i0 from "@angular/core";
5
+ const _c0 = ["iconSlot"];
6
+ const _c1 = [[["", "slot", "icon"]], "*"];
7
+ const _c2 = ["[slot=icon]", "*"];
8
+ const KIND_TO_COLOR = {
9
+ success: 'success',
10
+ warning: 'warning',
11
+ error: 'error',
12
+ info: 'info',
13
+ neutral: 'secondary',
14
+ };
15
+ /**
16
+ * Semantic status badge — maps status kinds to ClassMap color variants.
17
+ *
18
+ * The host IS the span React renders (`span[mol-status-badge]`), so both
19
+ * appearances stay a single `<span>`: `'ui'` (default) carries the ClassMap
20
+ * `badge` classes of the framework `<Badge>`, and `'uppercase-pill'` the same
21
+ * per-kind colors plus `cm.uppercase` + `cm.trackingWide`. The optional icon
22
+ * is projected as `[slot=icon]` content inside React's
23
+ * `<span class="mr-1">…</span>` wrapper; the wrapper is detached when the
24
+ * projection carries no nodes, exactly as React renders nothing for an absent
25
+ * icon.
26
+ */
27
+ export class StatusBadge {
28
+ /** Semantic kind — maps to ClassMap badge color variants (defaults to `'neutral'`). */
29
+ kind;
30
+ /** Visual appearance variant (defaults to `'ui'`). */
31
+ appearance;
32
+ /** Extra classes passed through to the rendered element. */
33
+ className;
34
+ /** The icon wrapper (always in the template; detached when unused). */
35
+ iconSlot;
36
+ sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
37
+ /**
38
+ * The current class map.
39
+ * @returns The UIClassMap.
40
+ */
41
+ cm() {
42
+ return getClassMap();
43
+ }
44
+ /**
45
+ * The semantic kind (React's `kind = 'neutral'` default parameter).
46
+ * @returns The kind.
47
+ */
48
+ kindValue() {
49
+ return this.kind ?? 'neutral';
50
+ }
51
+ /**
52
+ * Computes the root span's class list, per appearance: React's `<Badge>`
53
+ * classes for `'ui'`, the uppercase pill's classes for `'uppercase-pill'`.
54
+ * @returns The class string.
55
+ */
56
+ classes() {
57
+ const cm = this.cm();
58
+ const color = KIND_TO_COLOR[this.kindValue()];
59
+ if ((this.appearance ?? 'ui') === 'uppercase-pill') {
60
+ return cm.cn(cm.badge({ variant: color }), cm.uppercase, cm.trackingWide, this.className);
61
+ }
62
+ return cm.cn(cm.badge({ variant: color }), this.className);
63
+ }
64
+ /**
65
+ * Computes the icon wrapper's class list (`cm.sp('mr', 1)`).
66
+ * @returns The class string.
67
+ */
68
+ iconClass() {
69
+ return this.cm().sp('mr', 1);
70
+ }
71
+ /**
72
+ * Detaches the icon wrapper when its slot projection carries no nodes —
73
+ * React renders no wrapper for an absent icon. The `<ng-content>` capture
74
+ * point must stay mounted, so presence is read here and the wrapper removed
75
+ * from the DOM instead.
76
+ */
77
+ ngAfterViewInit() {
78
+ const icon = this.iconSlot?.nativeElement;
79
+ this.sync.sync(icon, icon ? hasNodes(icon) : false);
80
+ }
81
+ static ɵfac = function StatusBadge_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || StatusBadge)(); };
82
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StatusBadge, selectors: [["span", "mol-status-badge", ""]], viewQuery: function StatusBadge_Query(rf, ctx) { if (rf & 1) {
83
+ i0.ɵɵviewQuery(_c0, 5);
84
+ } if (rf & 2) {
85
+ let _t;
86
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.iconSlot = _t.first);
87
+ } }, hostVars: 2, hostBindings: function StatusBadge_HostBindings(rf, ctx) { if (rf & 2) {
88
+ i0.ɵɵclassMap(ctx.classes());
89
+ } }, inputs: { kind: "kind", appearance: "appearance", className: "className" }, ngContentSelectors: _c2, decls: 4, vars: 2, consts: [["iconSlot", ""]], template: function StatusBadge_Template(rf, ctx) { if (rf & 1) {
90
+ i0.ɵɵprojectionDef(_c1);
91
+ i0.ɵɵdomElementStart(0, "span", null, 0);
92
+ i0.ɵɵprojection(2);
93
+ i0.ɵɵdomElementEnd();
94
+ i0.ɵɵprojection(3, 1);
95
+ } if (rf & 2) {
96
+ i0.ɵɵclassMap(ctx.iconClass());
97
+ } }, encapsulation: 2 });
98
+ }
99
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StatusBadge, [{
100
+ type: Component,
101
+ args: [{
102
+ selector: 'span[mol-status-badge]',
103
+ standalone: true,
104
+ inputs: ['kind', 'appearance', 'className'],
105
+ host: {
106
+ '[class]': 'classes()',
107
+ },
108
+ template: `<span [class]="iconClass()" #iconSlot
109
+ ><ng-content select="[slot=icon]"></ng-content
110
+ ></span>
111
+ <ng-content></ng-content>`,
112
+ }]
113
+ }], null, { iconSlot: [{
114
+ type: ViewChild,
115
+ args: ['iconSlot']
116
+ }] }); })();
117
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(StatusBadge, { className: "StatusBadge", filePath: "status-badge.component.ts", lineNumber: 48 }); })();
118
+ //# sourceMappingURL=status-badge.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-badge.component.js","sourceRoot":"","sources":["../src/status-badge.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGnF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;;;;;AAIhE,MAAM,aAAa,GAA+E;IAChG,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,WAAW;CACrB,CAAA;AAED;;;;;;;;;;;GAWG;AAaH,MAAM,OAAO,WAAW;IACtB,uFAAuF;IACvF,IAAI,CAAa;IACjB,sDAAsD;IACtD,UAAU,CAA0B;IACpC,4DAA4D;IAC5D,SAAS,CAAS;IAElB,uEAAuE;IAChD,QAAQ,CAA8B;IAE5C,IAAI,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAA;IAE9E;;;OAGG;IACH,EAAE;QACA,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,IAAI,IAAI,SAAS,CAAA;IAC/B,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QACpB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAC7C,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,gBAAgB,EAAE,CAAC;YACnD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAC3F,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAC5D,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IAC9B,CAAC;IAED;;;;;OAKG;IACH,eAAe;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAA;QACzC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACrD,CAAC;qGA5DU,WAAW;6DAAX,WAAW;;;;;;YAAX,cAAA,aAAS,CAAE;;;YALX,wCACN;YAAA,kBACF;YAAA,oBAAO;YACR,qBAAyB;;YAHV,8BAAqB;;;iFAK3B,WAAW;cAZvB,SAAS;eAAC;gBACT,QAAQ,EAAE,wBAAwB;gBAClC,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC;gBAC3C,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,QAAQ,EAAE;;;8BAGkB;aAC7B;;kBAUE,SAAS;mBAAC,UAAU;;kFATV,WAAW"}
@@ -0,0 +1,48 @@
1
+ import type { UIClassMap } from '@molecule/app-ui';
2
+ import type { StatusKind } from './types.js';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Rounded status pill with an optional leading colored dot.
6
+ *
7
+ * The host IS the span React renders (`span[mol-status-pill]`). The pill has NO
8
+ * background surface of its own — only the dot carries color — so add a
9
+ * surface via `className` if you need a filled pill. The label is the default
10
+ * projection; the dot is a boolean prop, exactly as in React.
11
+ */
12
+ export declare class StatusPill {
13
+ /** Semantic kind (defaults to `'neutral'`). */
14
+ kind?: StatusKind;
15
+ /** Whether the leading dot renders (defaults to true). */
16
+ dot?: boolean;
17
+ /** Extra classes. */
18
+ className?: string;
19
+ /**
20
+ * The current class map.
21
+ * @returns The UIClassMap.
22
+ */
23
+ cm(): UIClassMap;
24
+ /**
25
+ * The semantic kind (React's `kind = 'neutral'` default parameter).
26
+ * @returns The kind.
27
+ */
28
+ kindValue(): StatusKind;
29
+ /**
30
+ * Whether the leading dot renders (React's `dot = true` default parameter).
31
+ * @returns True while the dot renders.
32
+ */
33
+ showDot(): boolean;
34
+ /**
35
+ * Computes the root span's class list.
36
+ * @returns The class string.
37
+ */
38
+ classes(): string;
39
+ /**
40
+ * Computes the dot span's class list (`cm.w(2)` + `cm.h(2)` + `cm.roundedFull`
41
+ * + the kind's color token).
42
+ * @returns The class string.
43
+ */
44
+ dotClass(): string;
45
+ static ɵfac: i0.ɵɵFactoryDeclaration<StatusPill, never>;
46
+ static ɵcmp: i0.ɵɵComponentDeclaration<StatusPill, "span[mol-status-pill]", never, { "kind": { "alias": "kind"; "required": false; }; "dot": { "alias": "dot"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["*"], true, never>;
47
+ }
48
+ //# sourceMappingURL=status-pill.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-pill.component.d.ts","sourceRoot":"","sources":["../src/status-pill.component.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;;AAU5C;;;;;;;GAOG;AACH,qBAYa,UAAU;IACrB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,SAAS,IAAI,UAAU;IAIvB;;;OAGG;IACH,OAAO,IAAI,OAAO;IAIlB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAYjB;;;;OAIG;IACH,QAAQ,IAAI,MAAM;yCArDP,UAAU;2CAAV,UAAU;CAyDtB"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * StatusPill component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { Component } from '@angular/core';
7
+ import { getClassMap } from '@molecule/app-ui';
8
+ import * as i0 from "@angular/core";
9
+ const _c0 = ["*"];
10
+ function StatusPill_Conditional_0_Template(rf, ctx) { if (rf & 1) {
11
+ i0.ɵɵdomElement(0, "span", 1);
12
+ } if (rf & 2) {
13
+ const ctx_r0 = i0.ɵɵnextContext();
14
+ i0.ɵɵclassMap(ctx_r0.dotClass());
15
+ } }
16
+ const DOT_COLOR = {
17
+ success: 'bg-success',
18
+ warning: 'bg-warning',
19
+ error: 'bg-error',
20
+ info: 'bg-info',
21
+ neutral: 'bg-outline',
22
+ };
23
+ /**
24
+ * Rounded status pill with an optional leading colored dot.
25
+ *
26
+ * The host IS the span React renders (`span[mol-status-pill]`). The pill has NO
27
+ * background surface of its own — only the dot carries color — so add a
28
+ * surface via `className` if you need a filled pill. The label is the default
29
+ * projection; the dot is a boolean prop, exactly as in React.
30
+ */
31
+ export class StatusPill {
32
+ /** Semantic kind (defaults to `'neutral'`). */
33
+ kind;
34
+ /** Whether the leading dot renders (defaults to true). */
35
+ dot;
36
+ /** Extra classes. */
37
+ className;
38
+ /**
39
+ * The current class map.
40
+ * @returns The UIClassMap.
41
+ */
42
+ cm() {
43
+ return getClassMap();
44
+ }
45
+ /**
46
+ * The semantic kind (React's `kind = 'neutral'` default parameter).
47
+ * @returns The kind.
48
+ */
49
+ kindValue() {
50
+ return this.kind ?? 'neutral';
51
+ }
52
+ /**
53
+ * Whether the leading dot renders (React's `dot = true` default parameter).
54
+ * @returns True while the dot renders.
55
+ */
56
+ showDot() {
57
+ return this.dot ?? true;
58
+ }
59
+ /**
60
+ * Computes the root span's class list.
61
+ * @returns The class string.
62
+ */
63
+ classes() {
64
+ return this.cm().cn(this.cm().flex({ align: 'center', gap: 'xs' }), this.cm().sp('px', 3), this.cm().sp('py', 1), this.cm().roundedFull, this.cm().textSize('xs'), this.cm().fontWeight('medium'), this.className);
65
+ }
66
+ /**
67
+ * Computes the dot span's class list (`cm.w(2)` + `cm.h(2)` + `cm.roundedFull`
68
+ * + the kind's color token).
69
+ * @returns The class string.
70
+ */
71
+ dotClass() {
72
+ const cm = this.cm();
73
+ return cm.cn(cm.w(2), cm.h(2), cm.roundedFull, DOT_COLOR[this.kindValue()]);
74
+ }
75
+ static ɵfac = function StatusPill_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || StatusPill)(); };
76
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StatusPill, selectors: [["span", "mol-status-pill", ""]], hostVars: 2, hostBindings: function StatusPill_HostBindings(rf, ctx) { if (rf & 2) {
77
+ i0.ɵɵclassMap(ctx.classes());
78
+ } }, inputs: { kind: "kind", dot: "dot", className: "className" }, ngContentSelectors: _c0, decls: 2, vars: 1, consts: [["aria-hidden", "true", 3, "class"], ["aria-hidden", "true"]], template: function StatusPill_Template(rf, ctx) { if (rf & 1) {
79
+ i0.ɵɵprojectionDef();
80
+ i0.ɵɵconditionalCreate(0, StatusPill_Conditional_0_Template, 1, 2, "span", 0);
81
+ i0.ɵɵprojection(1);
82
+ } if (rf & 2) {
83
+ i0.ɵɵconditional(ctx.showDot() ? 0 : -1);
84
+ } }, encapsulation: 2 });
85
+ }
86
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StatusPill, [{
87
+ type: Component,
88
+ args: [{
89
+ selector: 'span[mol-status-pill]',
90
+ standalone: true,
91
+ inputs: ['kind', 'dot', 'className'],
92
+ host: {
93
+ '[class]': 'classes()',
94
+ },
95
+ template: `@if (showDot()) {
96
+ <span [class]="dotClass()" aria-hidden="true"></span>
97
+ }
98
+ <ng-content></ng-content>`,
99
+ }]
100
+ }], null, null); })();
101
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(StatusPill, { className: "StatusPill", filePath: "status-pill.component.ts", lineNumber: 42 }); })();
102
+ //# sourceMappingURL=status-pill.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-pill.component.js","sourceRoot":"","sources":["../src/status-pill.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;IA4BxC,6BAAqD;;;IAA/C,gCAAoB;;AAxBhC,MAAM,SAAS,GAA+B;IAC5C,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;CACtB,CAAA;AAED;;;;;;;GAOG;AAaH,MAAM,OAAO,UAAU;IACrB,+CAA+C;IAC/C,IAAI,CAAa;IACjB,0DAA0D;IAC1D,GAAG,CAAU;IACb,qBAAqB;IACrB,SAAS,CAAS;IAElB;;;OAGG;IACH,EAAE;QACA,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,IAAI,IAAI,SAAS,CAAA;IAC/B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAA;IACzB,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CACjB,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAC9C,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EACrB,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EACrB,IAAI,CAAC,EAAE,EAAE,CAAC,WAAW,EACrB,IAAI,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EACxB,IAAI,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC9B,IAAI,CAAC,SAAS,CACf,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QACpB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAC7E,CAAC;oGAxDU,UAAU;6DAAV,UAAU;YAAV,cAAA,aAAS,CAAC;;;YALV,6EAAiB;YAG1B,kBAAyB;;YAHhB,wCAER;;;iFAGQ,UAAU;cAZtB,SAAS;eAAC;gBACT,QAAQ,EAAE,uBAAuB;gBACjC,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC;gBACpC,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,QAAQ,EAAE;;;8BAGkB;aAC7B;;kFACY,UAAU"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Types of `@molecule/app-status-badge-angular` — the Angular counterparts of
3
+ * `@molecule/app-status-badge-react`'s two components: the same props (React
4
+ * names) and the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ /** Semantic status kind used to select badge color variants. */
9
+ export type StatusKind = 'success' | 'warning' | 'error' | 'info' | 'neutral';
10
+ /**
11
+ * Props accepted by {@link StatusBadge} — the same props
12
+ * `@molecule/app-status-badge-react` accepts. Node props (`children`, `icon`)
13
+ * are projected content in Angular (an input cannot carry a node), so they are
14
+ * typed `unknown`: pass them in the host template, not as values. `icon` is
15
+ * selected by `[slot=icon]`; everything else is the default projection.
16
+ */
17
+ export interface StatusBadgeProps {
18
+ /** Semantic kind — maps to ClassMap badge color variants. */
19
+ kind?: StatusKind;
20
+ /** Badge label, projected as the element's default content. */
21
+ children?: unknown;
22
+ /** Optional leading icon, projected as `[slot=icon]` content. */
23
+ icon?: unknown;
24
+ /**
25
+ * Visual appearance variant.
26
+ * - `'ui'` (default) — the ClassMap badge styling, honoring the active
27
+ * ClassMap bond and working with any theme.
28
+ * - `'uppercase-pill'` — a compact uppercase pill that colors itself with
29
+ * the SAME ClassMap `badge` tokens, then layers `cm.uppercase` +
30
+ * `cm.trackingWide` for the uppercase treatment.
31
+ */
32
+ appearance?: 'ui' | 'uppercase-pill';
33
+ /** Extra classes passed through to the rendered element. */
34
+ className?: string;
35
+ }
36
+ /**
37
+ * Props accepted by {@link StatusPill} — the same props
38
+ * `@molecule/app-status-badge-react` accepts. `children` is projected content.
39
+ */
40
+ export interface StatusPillProps {
41
+ /** Semantic kind. */
42
+ kind?: StatusKind;
43
+ /** Pill label, projected as the element's default content. */
44
+ children?: unknown;
45
+ /** Render a leading dot indicator. Defaults to true. */
46
+ dot?: boolean;
47
+ /** Extra classes. */
48
+ className?: string;
49
+ }
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAE7E;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,gBAAgB,CAAA;IACpC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wDAAwD;IACxD,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Types of `@molecule/app-status-badge-angular` — the Angular counterparts of
3
+ * `@molecule/app-status-badge-react`'s two components: the same props (React
4
+ * names) and the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "@molecule/app-status-badge-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Angular status badge / pill with semantic kinds",
5
+ "homepage": "https://www.molecule.dev/packages/app-status-badge-angular",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "ngc",
21
+ "dev": "ngc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "status-badge",
28
+ "angular"
29
+ ],
30
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/molecule-dev/molecule.git",
35
+ "directory": "packages/app/features/status-badge-angular"
36
+ },
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
40
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@angular/common": "^22.0.0",
46
+ "@angular/core": "^22.0.0",
47
+ "@angular/platform-browser": "^22.0.0",
48
+ "@molecule/app-angular": "^3.5.0",
49
+ "@molecule/app-ui": "^1.0.1",
50
+ "@molecule/app-ui-angular": "^1.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@angular/common": "22.2.3",
54
+ "@angular/compiler": "22.2.3",
55
+ "@angular/compiler-cli": "22.2.3",
56
+ "@angular/core": "22.2.3",
57
+ "@angular/platform-browser": "22.2.3",
58
+ "@molecule/app-angular": "3.7.1",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-ui": "1.4.0",
63
+ "@molecule/app-ui-angular": "1.2.0",
64
+ "@types/node": "26.6.5",
65
+ "jsdom": "30.1.3",
66
+ "rxjs": "7.8.2",
67
+ "typescript": "6.0.3",
68
+ "vitest": "4.1.12",
69
+ "zone.js": "0.16.3"
70
+ }
71
+ }