@molecule/app-stage-timeline-angular 0.0.0-stage → 0.0.1-stage
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 +10 -2
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/stage-timeline.component.d.ts +159 -0
- package/dist/stage-timeline.component.d.ts.map +1 -0
- package/dist/stage-timeline.component.js +379 -0
- package/dist/stage-timeline.component.js.map +1 -0
- package/dist/types.d.ts +42 -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 +74 -4
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,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @molecule/app-stage-timeline-angular
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Multi-stage horizontal progress timeline with current marker — onboarding, applicant tracking, kanban status flow
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @molecule/app-stage-timeline-angular
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
|
|
10
|
+
|
|
11
|
+
License: Apache-2.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular multi-stage horizontal progress timeline with a current-stage marker.
|
|
3
|
+
* Used by employee-onboarding, applicant-tracking, kanban-board status
|
|
4
|
+
* flows, and order-fulfillment progress trackers.
|
|
5
|
+
*
|
|
6
|
+
* Exports `<div mol-stage-timeline>` and `statusOf` — the Angular counterpart
|
|
7
|
+
* of `@molecule/app-stage-timeline-react`, with the same props (React names)
|
|
8
|
+
* and the same DOM for the same input.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Component } from '@angular/core'
|
|
13
|
+
* import { StageTimeline } from '@molecule/app-stage-timeline-angular'
|
|
14
|
+
*
|
|
15
|
+
* @Component({
|
|
16
|
+
* selector: 'app-hiring',
|
|
17
|
+
* standalone: true,
|
|
18
|
+
* imports: [StageTimeline],
|
|
19
|
+
* template: `<div mol-stage-timeline [stages]="stages" [currentIndex]="2"></div>`,
|
|
20
|
+
* })
|
|
21
|
+
* export class HiringPage {
|
|
22
|
+
* stages = [
|
|
23
|
+
* { id: 'applied', label: 'Applied' },
|
|
24
|
+
* { id: 'screen', label: 'Phone Screen' },
|
|
25
|
+
* { id: 'onsite', label: 'On-site' },
|
|
26
|
+
* { id: 'offer', label: 'Offer' },
|
|
27
|
+
* ]
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* - Must render inside the app's i18n provider and with a ClassMap bond
|
|
33
|
+
* wired (`useTranslation()` / `getClassMap()` throw otherwise).
|
|
34
|
+
* - Colors are read from `--mol-color-primary`, `--mol-color-on-primary`,
|
|
35
|
+
* `--mol-color-primary-container`, `--mol-color-outline`,
|
|
36
|
+
* `--mol-color-surface(-variant)`, `--mol-color-on-surface(-variant)`
|
|
37
|
+
* CSS custom properties with hardcoded light-theme fallbacks
|
|
38
|
+
* (blue #3366ff, black-alpha grays). Define those `--mol-color-*`
|
|
39
|
+
* variables in your theme (both light and dark) or the timeline stays
|
|
40
|
+
* default-blue and looks wrong in dark mode.
|
|
41
|
+
* - `currentIndex` semantics: stages before it render completed, after
|
|
42
|
+
* it upcoming; pass `-1` for "not started" and `stages.length` for
|
|
43
|
+
* "all done".
|
|
44
|
+
* - Stage dots render as buttons but are disabled unless that stage has
|
|
45
|
+
* an `onClick`.
|
|
46
|
+
* - Node-valued stage fields (`label`, `subtitle`) are `ng-template`
|
|
47
|
+
* references or plain text, as React's `ReactNode` fields are.
|
|
48
|
+
* - Stages are tracked by `id` (`@for (… ; track stage.id)`), so a re-passed
|
|
49
|
+
* or re-ordered list keeps each marker's DOM the way React's `key` does.
|
|
50
|
+
*
|
|
51
|
+
* @module
|
|
52
|
+
*/
|
|
53
|
+
export * from './stage-timeline.component.js';
|
|
54
|
+
export * from './types.js';
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular multi-stage horizontal progress timeline with a current-stage marker.
|
|
3
|
+
* Used by employee-onboarding, applicant-tracking, kanban-board status
|
|
4
|
+
* flows, and order-fulfillment progress trackers.
|
|
5
|
+
*
|
|
6
|
+
* Exports `<div mol-stage-timeline>` and `statusOf` — the Angular counterpart
|
|
7
|
+
* of `@molecule/app-stage-timeline-react`, with the same props (React names)
|
|
8
|
+
* and the same DOM for the same input.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Component } from '@angular/core'
|
|
13
|
+
* import { StageTimeline } from '@molecule/app-stage-timeline-angular'
|
|
14
|
+
*
|
|
15
|
+
* @Component({
|
|
16
|
+
* selector: 'app-hiring',
|
|
17
|
+
* standalone: true,
|
|
18
|
+
* imports: [StageTimeline],
|
|
19
|
+
* template: `<div mol-stage-timeline [stages]="stages" [currentIndex]="2"></div>`,
|
|
20
|
+
* })
|
|
21
|
+
* export class HiringPage {
|
|
22
|
+
* stages = [
|
|
23
|
+
* { id: 'applied', label: 'Applied' },
|
|
24
|
+
* { id: 'screen', label: 'Phone Screen' },
|
|
25
|
+
* { id: 'onsite', label: 'On-site' },
|
|
26
|
+
* { id: 'offer', label: 'Offer' },
|
|
27
|
+
* ]
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* - Must render inside the app's i18n provider and with a ClassMap bond
|
|
33
|
+
* wired (`useTranslation()` / `getClassMap()` throw otherwise).
|
|
34
|
+
* - Colors are read from `--mol-color-primary`, `--mol-color-on-primary`,
|
|
35
|
+
* `--mol-color-primary-container`, `--mol-color-outline`,
|
|
36
|
+
* `--mol-color-surface(-variant)`, `--mol-color-on-surface(-variant)`
|
|
37
|
+
* CSS custom properties with hardcoded light-theme fallbacks
|
|
38
|
+
* (blue #3366ff, black-alpha grays). Define those `--mol-color-*`
|
|
39
|
+
* variables in your theme (both light and dark) or the timeline stays
|
|
40
|
+
* default-blue and looks wrong in dark mode.
|
|
41
|
+
* - `currentIndex` semantics: stages before it render completed, after
|
|
42
|
+
* it upcoming; pass `-1` for "not started" and `stages.length` for
|
|
43
|
+
* "all done".
|
|
44
|
+
* - Stage dots render as buttons but are disabled unless that stage has
|
|
45
|
+
* an `onClick`.
|
|
46
|
+
* - Node-valued stage fields (`label`, `subtitle`) are `ng-template`
|
|
47
|
+
* references or plain text, as React's `ReactNode` fields are.
|
|
48
|
+
* - Stages are tracked by `id` (`@for (… ; track stage.id)`), so a re-passed
|
|
49
|
+
* or re-ordered list keeps each marker's DOM the way React's `key` does.
|
|
50
|
+
*
|
|
51
|
+
* @module
|
|
52
|
+
*/
|
|
53
|
+
export * from './stage-timeline.component.js';
|
|
54
|
+
export * from './types.js';
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
|
+
import type { StageStatus, StageTimelineStage } from './types.js';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a stage's rendering status given its index and the current index.
|
|
7
|
+
*
|
|
8
|
+
* @param i - Zero-based stage index.
|
|
9
|
+
* @param currentIndex - Index of the current stage (`-1` = none, `len` = all done).
|
|
10
|
+
* @returns The rendering status for stage `i`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function statusOf(i: number, currentIndex: number): StageStatus;
|
|
13
|
+
/**
|
|
14
|
+
* StageTimeline component.
|
|
15
|
+
*
|
|
16
|
+
* Multi-stage horizontal progress timeline with a current-stage marker. The
|
|
17
|
+
* host IS the root `<div>` (`div[mol-stage-timeline]`), matching React's root
|
|
18
|
+
* exactly: `role="list"` + the accessible label on the host, the connector rail
|
|
19
|
+
* and one marker per stage inside it. Node-valued stage fields (`label`,
|
|
20
|
+
* `subtitle`) are `ng-template` references rendered through
|
|
21
|
+
* {@link NgTemplateOutlet}; string / number fields render as text.
|
|
22
|
+
*/
|
|
23
|
+
export declare class StageTimeline {
|
|
24
|
+
/** Ordered stages to render, left-to-right. */
|
|
25
|
+
stages: StageTimelineStage[];
|
|
26
|
+
/**
|
|
27
|
+
* Index of the current stage (React's `currentIndex`): stages before it render
|
|
28
|
+
* completed, after it upcoming; `-1` = none, `stages.length` = all done.
|
|
29
|
+
*/
|
|
30
|
+
currentIndex: number;
|
|
31
|
+
/** `data-mol-id` attribute for AI-agent selectors. */
|
|
32
|
+
dataMolId?: string;
|
|
33
|
+
/** Extra classes appended via the ClassMap `cn()` helper. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
36
|
+
private readonly i18n;
|
|
37
|
+
/**
|
|
38
|
+
* The current class map.
|
|
39
|
+
* @returns The UIClassMap.
|
|
40
|
+
*/
|
|
41
|
+
cm(): UIClassMap;
|
|
42
|
+
/**
|
|
43
|
+
* Computes the root's class list.
|
|
44
|
+
* @returns The class string.
|
|
45
|
+
*/
|
|
46
|
+
classes(): string;
|
|
47
|
+
/**
|
|
48
|
+
* The root's accessible label.
|
|
49
|
+
* @returns The translated group label.
|
|
50
|
+
*/
|
|
51
|
+
groupLabel(): string;
|
|
52
|
+
/**
|
|
53
|
+
* The root's inline style — the grid geometry has no ClassMap resolver — or
|
|
54
|
+
* no style at all for an empty stage list (React's early return).
|
|
55
|
+
* @returns The CSS text.
|
|
56
|
+
*/
|
|
57
|
+
rootStyle(): string;
|
|
58
|
+
/**
|
|
59
|
+
* The connector rail's inline style (hidden behind the dots).
|
|
60
|
+
* @returns The CSS text.
|
|
61
|
+
*/
|
|
62
|
+
railStyle(): string;
|
|
63
|
+
/**
|
|
64
|
+
* The rail's filled portion: how full it should be (0–100%).
|
|
65
|
+
* @returns The CSS text.
|
|
66
|
+
*/
|
|
67
|
+
fillStyle(): string;
|
|
68
|
+
/**
|
|
69
|
+
* A stage's rendering status.
|
|
70
|
+
* @param i - The stage's zero-based index.
|
|
71
|
+
* @returns Its status.
|
|
72
|
+
*/
|
|
73
|
+
statusOfIndex(i: number): StageStatus;
|
|
74
|
+
/**
|
|
75
|
+
* Whether a stage is the current one.
|
|
76
|
+
* @param i - The stage's zero-based index.
|
|
77
|
+
* @returns True for the current stage.
|
|
78
|
+
*/
|
|
79
|
+
isCurrent(i: number): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether a stage is completed.
|
|
82
|
+
* @param i - The stage's zero-based index.
|
|
83
|
+
* @returns True for a completed stage.
|
|
84
|
+
*/
|
|
85
|
+
isCompleted(i: number): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The marker's text: a tick for a completed stage, its position otherwise.
|
|
88
|
+
* @param i - The stage's zero-based index.
|
|
89
|
+
* @returns The text to render.
|
|
90
|
+
*/
|
|
91
|
+
dotText(i: number): string;
|
|
92
|
+
/**
|
|
93
|
+
* The stage's accessible label, built from React's i18n key and default
|
|
94
|
+
* message (only a plain string label is carried into it).
|
|
95
|
+
* @param stage - The stage.
|
|
96
|
+
* @param i - The stage's zero-based index.
|
|
97
|
+
* @returns The aria label.
|
|
98
|
+
*/
|
|
99
|
+
stageAria(stage: StageTimelineStage, i: number): string;
|
|
100
|
+
/**
|
|
101
|
+
* The wrapper column's inline style.
|
|
102
|
+
* @returns The CSS text.
|
|
103
|
+
*/
|
|
104
|
+
stageWrapperStyle(): string;
|
|
105
|
+
/**
|
|
106
|
+
* The dot's inline style — geometry and status colors have no ClassMap
|
|
107
|
+
* resolver, and every color is a `--mol-color-*` token.
|
|
108
|
+
* @param stage - The stage the dot belongs to.
|
|
109
|
+
* @param i - The stage's zero-based index.
|
|
110
|
+
* @returns The CSS text.
|
|
111
|
+
*/
|
|
112
|
+
dotStyle(stage: StageTimelineStage, i: number): string;
|
|
113
|
+
/**
|
|
114
|
+
* The label span's class list.
|
|
115
|
+
* @param i - The stage's zero-based index.
|
|
116
|
+
* @returns The class string.
|
|
117
|
+
*/
|
|
118
|
+
labelClasses(i: number): string;
|
|
119
|
+
/**
|
|
120
|
+
* The label span's inline style.
|
|
121
|
+
* @param i - The stage's zero-based index.
|
|
122
|
+
* @returns The CSS text.
|
|
123
|
+
*/
|
|
124
|
+
labelStyle(i: number): string;
|
|
125
|
+
/**
|
|
126
|
+
* The subtitle span's class list.
|
|
127
|
+
* @returns The class string.
|
|
128
|
+
*/
|
|
129
|
+
subtitleClasses(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Calls a stage's own click handler with the native event, as React's
|
|
132
|
+
* `onClick={stage.onClick}` does.
|
|
133
|
+
* @param stage - The stage that was clicked.
|
|
134
|
+
* @param event - The click event.
|
|
135
|
+
*/
|
|
136
|
+
handleClick(stage: StageTimelineStage, event: Event): void;
|
|
137
|
+
/**
|
|
138
|
+
* Whether a stage field holds a node (an `ng-template` reference) rather than
|
|
139
|
+
* text.
|
|
140
|
+
* @param value - The stage field.
|
|
141
|
+
* @returns True when it renders through a template outlet.
|
|
142
|
+
*/
|
|
143
|
+
isTemplate(value: unknown): value is TemplateRef<unknown>;
|
|
144
|
+
/**
|
|
145
|
+
* Narrows a value to an embedded template.
|
|
146
|
+
* @param value - A stage field.
|
|
147
|
+
* @returns The template, or null.
|
|
148
|
+
*/
|
|
149
|
+
templateOf(value: unknown): TemplateRef<unknown> | null;
|
|
150
|
+
/**
|
|
151
|
+
* The text a stage field renders (React renders strings and numbers as text).
|
|
152
|
+
* @param value - The stage field.
|
|
153
|
+
* @returns The text, or `''` for a node value.
|
|
154
|
+
*/
|
|
155
|
+
textOf(value: unknown): string;
|
|
156
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StageTimeline, never>;
|
|
157
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StageTimeline, "div[mol-stage-timeline]", never, { "stages": { "alias": "stages"; "required": false; }; "currentIndex": { "alias": "currentIndex"; "required": false; }; "dataMolId": { "alias": "dataMolId"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=stage-timeline.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-timeline.component.d.ts","sourceRoot":"","sources":["../src/stage-timeline.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,WAAW,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EA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ACH,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAK/B;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAS7B;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAK1D;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAIzD;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAIvD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;yCApPnB,aAAa;2CAAb,aAAa;CAuPzB"}
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StageTimeline component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, TemplateRef } from '@angular/core';
|
|
8
|
+
import { useTranslation } from '@molecule/app-angular';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
const _forTrack0 = ($index, $item) => $item.id;
|
|
12
|
+
function StageTimeline_Conditional_0_For_4_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
13
|
+
i0.ɵɵelementContainer(0, 7);
|
|
14
|
+
} if (rf & 2) {
|
|
15
|
+
const stage_r2 = i0.ɵɵnextContext().$implicit;
|
|
16
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
17
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.templateOf(stage_r2.label));
|
|
18
|
+
} }
|
|
19
|
+
function StageTimeline_Conditional_0_For_4_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
20
|
+
i0.ɵɵtext(0);
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const stage_r2 = i0.ɵɵnextContext().$implicit;
|
|
23
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
24
|
+
i0.ɵɵtextInterpolate(ctx_r2.textOf(stage_r2.label));
|
|
25
|
+
} }
|
|
26
|
+
function StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
27
|
+
i0.ɵɵelementContainer(0, 7);
|
|
28
|
+
} if (rf & 2) {
|
|
29
|
+
const stage_r2 = i0.ɵɵnextContext(2).$implicit;
|
|
30
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
31
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.templateOf(stage_r2.subtitle));
|
|
32
|
+
} }
|
|
33
|
+
function StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
34
|
+
i0.ɵɵtext(0);
|
|
35
|
+
} if (rf & 2) {
|
|
36
|
+
const stage_r2 = i0.ɵɵnextContext(2).$implicit;
|
|
37
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
38
|
+
i0.ɵɵtextInterpolate(ctx_r2.textOf(stage_r2.subtitle));
|
|
39
|
+
} }
|
|
40
|
+
function StageTimeline_Conditional_0_For_4_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵelementStart(0, "span", 9);
|
|
42
|
+
i0.ɵɵconditionalCreate(1, StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_1_Template, 1, 1, "ng-container", 7)(2, StageTimeline_Conditional_0_For_4_Conditional_6_Conditional_2_Template, 1, 1);
|
|
43
|
+
i0.ɵɵelementEnd();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
const stage_r2 = i0.ɵɵnextContext().$implicit;
|
|
46
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
47
|
+
i0.ɵɵclassMap(ctx_r2.subtitleClasses());
|
|
48
|
+
i0.ɵɵadvance();
|
|
49
|
+
i0.ɵɵconditional(ctx_r2.isTemplate(stage_r2.subtitle) ? 1 : 2);
|
|
50
|
+
} }
|
|
51
|
+
function StageTimeline_Conditional_0_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
52
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
53
|
+
i0.ɵɵelementStart(0, "div", 4)(1, "button", 5);
|
|
54
|
+
i0.ɵɵlistener("click", function StageTimeline_Conditional_0_For_4_Template_button_click_1_listener($event) { const stage_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.handleClick(stage_r2, $event)); });
|
|
55
|
+
i0.ɵɵtext(2);
|
|
56
|
+
i0.ɵɵelementEnd();
|
|
57
|
+
i0.ɵɵelementStart(3, "span", 6);
|
|
58
|
+
i0.ɵɵconditionalCreate(4, StageTimeline_Conditional_0_For_4_Conditional_4_Template, 1, 1, "ng-container", 7)(5, StageTimeline_Conditional_0_For_4_Conditional_5_Template, 1, 1);
|
|
59
|
+
i0.ɵɵelementEnd();
|
|
60
|
+
i0.ɵɵconditionalCreate(6, StageTimeline_Conditional_0_For_4_Conditional_6_Template, 3, 3, "span", 8);
|
|
61
|
+
i0.ɵɵelementEnd();
|
|
62
|
+
} if (rf & 2) {
|
|
63
|
+
const stage_r2 = ctx.$implicit;
|
|
64
|
+
const ɵ$index_8_r4 = ctx.$index;
|
|
65
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
66
|
+
i0.ɵɵstyleMap(ctx_r2.stageWrapperStyle());
|
|
67
|
+
i0.ɵɵattribute("data-stage-id", stage_r2.id)("data-stage-status", ctx_r2.statusOfIndex(ɵ$index_8_r4))("aria-current", ctx_r2.isCurrent(ɵ$index_8_r4) ? "step" : null)("aria-label", ctx_r2.stageAria(stage_r2, ɵ$index_8_r4));
|
|
68
|
+
i0.ɵɵadvance();
|
|
69
|
+
i0.ɵɵstyleMap(ctx_r2.dotStyle(stage_r2, ɵ$index_8_r4));
|
|
70
|
+
i0.ɵɵproperty("disabled", !stage_r2.onClick);
|
|
71
|
+
i0.ɵɵattribute("aria-label", ctx_r2.stageAria(stage_r2, ɵ$index_8_r4));
|
|
72
|
+
i0.ɵɵadvance();
|
|
73
|
+
i0.ɵɵtextInterpolate(ctx_r2.dotText(ɵ$index_8_r4));
|
|
74
|
+
i0.ɵɵadvance();
|
|
75
|
+
i0.ɵɵstyleMap(ctx_r2.labelStyle(ɵ$index_8_r4));
|
|
76
|
+
i0.ɵɵclassMap(ctx_r2.labelClasses(ɵ$index_8_r4));
|
|
77
|
+
i0.ɵɵadvance();
|
|
78
|
+
i0.ɵɵconditional(ctx_r2.isTemplate(stage_r2.label) ? 4 : 5);
|
|
79
|
+
i0.ɵɵadvance(2);
|
|
80
|
+
i0.ɵɵconditional(stage_r2.subtitle ? 6 : -1);
|
|
81
|
+
} }
|
|
82
|
+
function StageTimeline_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
83
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
84
|
+
i0.ɵɵelement(1, "div", 1)(2, "div", 2);
|
|
85
|
+
i0.ɵɵelementEnd();
|
|
86
|
+
i0.ɵɵrepeaterCreate(3, StageTimeline_Conditional_0_For_4_Template, 7, 17, "div", 3, _forTrack0);
|
|
87
|
+
} if (rf & 2) {
|
|
88
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
89
|
+
i0.ɵɵstyleMap(ctx_r2.railStyle());
|
|
90
|
+
i0.ɵɵadvance(2);
|
|
91
|
+
i0.ɵɵstyleMap(ctx_r2.fillStyle());
|
|
92
|
+
i0.ɵɵadvance();
|
|
93
|
+
i0.ɵɵrepeater(ctx_r2.stages);
|
|
94
|
+
} }
|
|
95
|
+
/**
|
|
96
|
+
* Resolve a stage's rendering status given its index and the current index.
|
|
97
|
+
*
|
|
98
|
+
* @param i - Zero-based stage index.
|
|
99
|
+
* @param currentIndex - Index of the current stage (`-1` = none, `len` = all done).
|
|
100
|
+
* @returns The rendering status for stage `i`.
|
|
101
|
+
*/
|
|
102
|
+
export function statusOf(i, currentIndex) {
|
|
103
|
+
if (i < currentIndex)
|
|
104
|
+
return 'completed';
|
|
105
|
+
if (i === currentIndex)
|
|
106
|
+
return 'current';
|
|
107
|
+
return 'upcoming';
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* StageTimeline component.
|
|
111
|
+
*
|
|
112
|
+
* Multi-stage horizontal progress timeline with a current-stage marker. The
|
|
113
|
+
* host IS the root `<div>` (`div[mol-stage-timeline]`), matching React's root
|
|
114
|
+
* exactly: `role="list"` + the accessible label on the host, the connector rail
|
|
115
|
+
* and one marker per stage inside it. Node-valued stage fields (`label`,
|
|
116
|
+
* `subtitle`) are `ng-template` references rendered through
|
|
117
|
+
* {@link NgTemplateOutlet}; string / number fields render as text.
|
|
118
|
+
*/
|
|
119
|
+
export class StageTimeline {
|
|
120
|
+
/** Ordered stages to render, left-to-right. */
|
|
121
|
+
stages = [];
|
|
122
|
+
/**
|
|
123
|
+
* Index of the current stage (React's `currentIndex`): stages before it render
|
|
124
|
+
* completed, after it upcoming; `-1` = none, `stages.length` = all done.
|
|
125
|
+
*/
|
|
126
|
+
currentIndex = 0;
|
|
127
|
+
/** `data-mol-id` attribute for AI-agent selectors. */
|
|
128
|
+
dataMolId;
|
|
129
|
+
/** Extra classes appended via the ClassMap `cn()` helper. */
|
|
130
|
+
className;
|
|
131
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
132
|
+
i18n = useTranslation();
|
|
133
|
+
/**
|
|
134
|
+
* The current class map.
|
|
135
|
+
* @returns The UIClassMap.
|
|
136
|
+
*/
|
|
137
|
+
cm() {
|
|
138
|
+
return getClassMap();
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Computes the root's class list.
|
|
142
|
+
* @returns The class string.
|
|
143
|
+
*/
|
|
144
|
+
classes() {
|
|
145
|
+
return this.cm().cn(this.className);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The root's accessible label.
|
|
149
|
+
* @returns The translated group label.
|
|
150
|
+
*/
|
|
151
|
+
groupLabel() {
|
|
152
|
+
return this.i18n.t('stageTimeline.group', {}, { defaultValue: 'Stage timeline' });
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The root's inline style — the grid geometry has no ClassMap resolver — or
|
|
156
|
+
* no style at all for an empty stage list (React's early return).
|
|
157
|
+
* @returns The CSS text.
|
|
158
|
+
*/
|
|
159
|
+
rootStyle() {
|
|
160
|
+
if (this.stages.length === 0)
|
|
161
|
+
return '';
|
|
162
|
+
return `position: relative; display: grid; grid-template-columns: repeat(${this.stages.length}, minmax(0, 1fr)); align-items: start`;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The connector rail's inline style (hidden behind the dots).
|
|
166
|
+
* @returns The CSS text.
|
|
167
|
+
*/
|
|
168
|
+
railStyle() {
|
|
169
|
+
const inset = `${(0.5 / this.stages.length) * 100}%`;
|
|
170
|
+
return `position: absolute; top: 14px; left: ${inset}; right: ${inset}; height: 2px; pointer-events: none`;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The rail's filled portion: how full it should be (0–100%).
|
|
174
|
+
* @returns The CSS text.
|
|
175
|
+
*/
|
|
176
|
+
fillStyle() {
|
|
177
|
+
const denom = Math.max(1, this.stages.length - 1);
|
|
178
|
+
const fillRatio = Math.max(0, Math.min(1, this.currentIndex / denom));
|
|
179
|
+
return `position: absolute; top: 0px; bottom: 0px; left: 0px; width: ${fillRatio * 100}%; background: var(--mol-color-primary, #3366ff); transition: width 200ms ease`;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A stage's rendering status.
|
|
183
|
+
* @param i - The stage's zero-based index.
|
|
184
|
+
* @returns Its status.
|
|
185
|
+
*/
|
|
186
|
+
statusOfIndex(i) {
|
|
187
|
+
return statusOf(i, this.currentIndex);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Whether a stage is the current one.
|
|
191
|
+
* @param i - The stage's zero-based index.
|
|
192
|
+
* @returns True for the current stage.
|
|
193
|
+
*/
|
|
194
|
+
isCurrent(i) {
|
|
195
|
+
return this.statusOfIndex(i) === 'current';
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Whether a stage is completed.
|
|
199
|
+
* @param i - The stage's zero-based index.
|
|
200
|
+
* @returns True for a completed stage.
|
|
201
|
+
*/
|
|
202
|
+
isCompleted(i) {
|
|
203
|
+
return this.statusOfIndex(i) === 'completed';
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The marker's text: a tick for a completed stage, its position otherwise.
|
|
207
|
+
* @param i - The stage's zero-based index.
|
|
208
|
+
* @returns The text to render.
|
|
209
|
+
*/
|
|
210
|
+
dotText(i) {
|
|
211
|
+
return this.isCompleted(i) ? '✓' : String(i + 1);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The stage's accessible label, built from React's i18n key and default
|
|
215
|
+
* message (only a plain string label is carried into it).
|
|
216
|
+
* @param stage - The stage.
|
|
217
|
+
* @param i - The stage's zero-based index.
|
|
218
|
+
* @returns The aria label.
|
|
219
|
+
*/
|
|
220
|
+
stageAria(stage, i) {
|
|
221
|
+
return this.i18n.t('stageTimeline.stage', {
|
|
222
|
+
label: typeof stage.label === 'string' ? stage.label : '',
|
|
223
|
+
index: i + 1,
|
|
224
|
+
total: this.stages.length,
|
|
225
|
+
status: this.statusOfIndex(i),
|
|
226
|
+
}, { defaultValue: 'Stage {{index}} of {{total}}: {{label}} ({{status}})' });
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The wrapper column's inline style.
|
|
230
|
+
* @returns The CSS text.
|
|
231
|
+
*/
|
|
232
|
+
stageWrapperStyle() {
|
|
233
|
+
return 'position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0px';
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The dot's inline style — geometry and status colors have no ClassMap
|
|
237
|
+
* resolver, and every color is a `--mol-color-*` token.
|
|
238
|
+
* @param stage - The stage the dot belongs to.
|
|
239
|
+
* @param i - The stage's zero-based index.
|
|
240
|
+
* @returns The CSS text.
|
|
241
|
+
*/
|
|
242
|
+
dotStyle(stage, i) {
|
|
243
|
+
const completed = this.isCompleted(i);
|
|
244
|
+
const current = this.isCurrent(i);
|
|
245
|
+
const parts = [
|
|
246
|
+
'width: 28px',
|
|
247
|
+
'height: 28px',
|
|
248
|
+
'border-radius: 50%',
|
|
249
|
+
`border: 2px solid ${completed || current
|
|
250
|
+
? 'var(--mol-color-primary, #3366ff)'
|
|
251
|
+
: 'var(--mol-color-outline, rgba(0,0,0,0.25))'}`,
|
|
252
|
+
`background: ${completed
|
|
253
|
+
? 'var(--mol-color-primary, #3366ff)'
|
|
254
|
+
: current
|
|
255
|
+
? 'var(--mol-color-primary-container, rgba(51,102,255,0.18))'
|
|
256
|
+
: 'var(--mol-color-surface, transparent)'}`,
|
|
257
|
+
`color: ${completed ? 'var(--mol-color-on-primary, #fff)' : 'inherit'}`,
|
|
258
|
+
'display: inline-flex',
|
|
259
|
+
'align-items: center',
|
|
260
|
+
'justify-content: center',
|
|
261
|
+
'font-size: 14px',
|
|
262
|
+
'font-weight: 700',
|
|
263
|
+
`cursor: ${stage.onClick ? 'pointer' : 'default'}`,
|
|
264
|
+
];
|
|
265
|
+
if (current)
|
|
266
|
+
parts.push('box-shadow: 0 0 0 4px var(--mol-color-primary-container, rgba(51,102,255,0.18))');
|
|
267
|
+
parts.push('transition: box-shadow 200ms ease, background 200ms ease');
|
|
268
|
+
// React merges `{ ...dotStyle, padding: 0 }` onto the button.
|
|
269
|
+
parts.push('padding: 0px');
|
|
270
|
+
return parts.join('; ');
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The label span's class list.
|
|
274
|
+
* @param i - The stage's zero-based index.
|
|
275
|
+
* @returns The class string.
|
|
276
|
+
*/
|
|
277
|
+
labelClasses(i) {
|
|
278
|
+
const cm = this.cm();
|
|
279
|
+
return cm.cn(cm.textSize('xs'), cm.fontWeight(this.isCurrent(i) ? 'semibold' : 'normal'));
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The label span's inline style.
|
|
283
|
+
* @param i - The stage's zero-based index.
|
|
284
|
+
* @returns The CSS text.
|
|
285
|
+
*/
|
|
286
|
+
labelStyle(i) {
|
|
287
|
+
const color = this.isCurrent(i)
|
|
288
|
+
? 'var(--mol-color-primary, #3366ff)'
|
|
289
|
+
: this.isCompleted(i)
|
|
290
|
+
? 'var(--mol-color-on-surface, inherit)'
|
|
291
|
+
: 'var(--mol-color-on-surface-variant, #666)';
|
|
292
|
+
return `text-align: center; color: ${color}`;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* The subtitle span's class list.
|
|
296
|
+
* @returns The class string.
|
|
297
|
+
*/
|
|
298
|
+
subtitleClasses() {
|
|
299
|
+
return this.cm().textSize('xs');
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Calls a stage's own click handler with the native event, as React's
|
|
303
|
+
* `onClick={stage.onClick}` does.
|
|
304
|
+
* @param stage - The stage that was clicked.
|
|
305
|
+
* @param event - The click event.
|
|
306
|
+
*/
|
|
307
|
+
handleClick(stage, event) {
|
|
308
|
+
const onClick = stage.onClick;
|
|
309
|
+
onClick?.(event);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Whether a stage field holds a node (an `ng-template` reference) rather than
|
|
313
|
+
* text.
|
|
314
|
+
* @param value - The stage field.
|
|
315
|
+
* @returns True when it renders through a template outlet.
|
|
316
|
+
*/
|
|
317
|
+
isTemplate(value) {
|
|
318
|
+
return value instanceof TemplateRef;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Narrows a value to an embedded template.
|
|
322
|
+
* @param value - A stage field.
|
|
323
|
+
* @returns The template, or null.
|
|
324
|
+
*/
|
|
325
|
+
templateOf(value) {
|
|
326
|
+
return value instanceof TemplateRef ? value : null;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The text a stage field renders (React renders strings and numbers as text).
|
|
330
|
+
* @param value - The stage field.
|
|
331
|
+
* @returns The text, or `''` for a node value.
|
|
332
|
+
*/
|
|
333
|
+
textOf(value) {
|
|
334
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : '';
|
|
335
|
+
}
|
|
336
|
+
static ɵfac = function StageTimeline_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || StageTimeline)(); };
|
|
337
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StageTimeline, selectors: [["div", "mol-stage-timeline", ""]], hostAttrs: ["role", "list"], hostVars: 6, hostBindings: function StageTimeline_HostBindings(rf, ctx) { if (rf & 2) {
|
|
338
|
+
i0.ɵɵattribute("data-mol-id", ctx.dataMolId ?? "stage-timeline")("aria-label", ctx.groupLabel());
|
|
339
|
+
i0.ɵɵstyleMap(ctx.rootStyle());
|
|
340
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
341
|
+
} }, inputs: { stages: "stages", currentIndex: "currentIndex", dataMolId: "dataMolId", className: "className" }, decls: 1, vars: 1, consts: [["aria-hidden", "true", "data-mol-id", "stage-timeline-rail"], [2, "position", "absolute", "inset", "0px", "background", "var(--mol-color-surface-variant, rgba(0,0,0,0.12))"], ["data-mol-id", "stage-timeline-rail-fill"], ["role", "listitem", "data-mol-id", "stage-timeline-stage", 3, "style"], ["role", "listitem", "data-mol-id", "stage-timeline-stage"], ["type", "button", "data-mol-id", "stage-timeline-dot", 3, "click", "disabled"], ["data-mol-id", "stage-timeline-label"], [3, "ngTemplateOutlet"], ["data-mol-id", "stage-timeline-subtitle", 2, "text-align", "center", "color", "var(--mol-color-on-surface-variant, #888)", 3, "class"], ["data-mol-id", "stage-timeline-subtitle", 2, "text-align", "center", "color", "var(--mol-color-on-surface-variant, #888)"]], template: function StageTimeline_Template(rf, ctx) { if (rf & 1) {
|
|
342
|
+
i0.ɵɵconditionalCreate(0, StageTimeline_Conditional_0_Template, 5, 4);
|
|
343
|
+
} if (rf & 2) {
|
|
344
|
+
i0.ɵɵconditional(ctx.stages.length > 0 ? 0 : -1);
|
|
345
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
346
|
+
}
|
|
347
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StageTimeline, [{
|
|
348
|
+
type: Component,
|
|
349
|
+
args: [{
|
|
350
|
+
selector: 'div[mol-stage-timeline]',
|
|
351
|
+
standalone: true,
|
|
352
|
+
imports: [NgTemplateOutlet],
|
|
353
|
+
inputs: ['stages', 'currentIndex', 'dataMolId', 'className'],
|
|
354
|
+
host: {
|
|
355
|
+
role: 'list',
|
|
356
|
+
'[class]': 'classes()',
|
|
357
|
+
'[attr.data-mol-id]': "dataMolId ?? 'stage-timeline'",
|
|
358
|
+
'[attr.aria-label]': 'groupLabel()',
|
|
359
|
+
'[style]': 'rootStyle()',
|
|
360
|
+
},
|
|
361
|
+
// prettier-ignore
|
|
362
|
+
template: `
|
|
363
|
+
@if (stages.length > 0) {
|
|
364
|
+
<div aria-hidden="true" [style]="railStyle()" data-mol-id="stage-timeline-rail"><div style="position: absolute; inset: 0px; background: var(--mol-color-surface-variant, rgba(0,0,0,0.12))"></div><div data-mol-id="stage-timeline-rail-fill" [style]="fillStyle()"></div></div>
|
|
365
|
+
@for (stage of stages; track stage.id; let i = $index) {
|
|
366
|
+
<div role="listitem" [attr.data-stage-id]="stage.id" [attr.data-stage-status]="statusOfIndex(i)" data-mol-id="stage-timeline-stage" [attr.aria-current]="isCurrent(i) ? 'step' : null" [attr.aria-label]="stageAria(stage, i)" [style]="stageWrapperStyle()">
|
|
367
|
+
<button type="button" (click)="handleClick(stage, $event)" [disabled]="!stage.onClick" [attr.aria-label]="stageAria(stage, i)" data-mol-id="stage-timeline-dot" [style]="dotStyle(stage, i)">{{ dotText(i) }}</button>
|
|
368
|
+
<span [class]="labelClasses(i)" data-mol-id="stage-timeline-label" [style]="labelStyle(i)">@if (isTemplate(stage.label)) {<ng-container [ngTemplateOutlet]="templateOf(stage.label)"></ng-container>}@else {{{ textOf(stage.label) }}}</span>
|
|
369
|
+
@if (stage.subtitle) {
|
|
370
|
+
<span [class]="subtitleClasses()" data-mol-id="stage-timeline-subtitle" style="text-align: center; color: var(--mol-color-on-surface-variant, #888)">@if (isTemplate(stage.subtitle)) {<ng-container [ngTemplateOutlet]="templateOf(stage.subtitle)"></ng-container>}@else {{{ textOf(stage.subtitle) }}}</span>
|
|
371
|
+
}
|
|
372
|
+
</div>
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
`,
|
|
376
|
+
}]
|
|
377
|
+
}], null, null); })();
|
|
378
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(StageTimeline, { className: "StageTimeline", filePath: "stage-timeline.component.ts", lineNumber: 67 }); })();
|
|
379
|
+
//# sourceMappingURL=stage-timeline.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-timeline.component.js","sourceRoot":"","sources":["../src/stage-timeline.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;IA8CsF,2BAA0E;;;;IAA5D,oEAA4C;;;IAAwB,YAAyB;;;;IAAzB,mDAAyB;;;IAE5C,2BAA6E;;;;IAA/D,uEAA+C;;;IAAwB,YAA4B;;;;IAA5B,sDAA4B;;;IAAxS,+BAAqJ;IAA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A+C,CAAA;QACrE,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,KAAc;QACvB,OAAO,KAAK,YAAY,WAAW,CAAA;IACrC,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,KAAc;QACvB,OAAO,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;IACpD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAc;QACnB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACpF,CAAC;uGAtPU,aAAa;6DAAb,aAAa;2DAAA,gBACb,gBADA,gBAAY;YAAZ,cAAA,eAAW,CAAE;YAAb,cAAA,aAAS,CAAI;;YAdtB,qEAAyB;;YAAzB,gDAWC;4BAtBO,gBAAgB;;iFAyBf,aAAa;cA5BzB,SAAS;eAAC;gBACT,QAAQ,EAAE,yBAAyB;gBACnC,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,CAAC;gBAC5D,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM;oBACZ,SAAS,EAAE,WAAW;oBACtB,oBAAoB,EAAE,+BAA+B;oBACrD,mBAAmB,EAAE,cAAc;oBACnC,SAAS,EAAE,aAAa;iBACzB;gBACD,kBAAkB;gBAClB,QAAQ,EAAE;;;;;;;;;;;;;GAaT;aACF;;kFACY,aAAa"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-stage-timeline-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-stage-timeline-react`, same props and DOM.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateRef } from '@angular/core';
|
|
8
|
+
/** A single stage on the timeline. */
|
|
9
|
+
export interface StageTimelineStage {
|
|
10
|
+
/** Stable id (used as the render key + `data-stage-id`). */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Stage label: a template reference (a node), or text. */
|
|
13
|
+
label: string | number | TemplateRef<unknown>;
|
|
14
|
+
/** Optional secondary line (timestamp, owner, etc.): a template reference, or text. */
|
|
15
|
+
subtitle?: string | number | TemplateRef<unknown>;
|
|
16
|
+
/** Optional click handler. */
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
}
|
|
19
|
+
/** Per-stage rendering state. */
|
|
20
|
+
export type StageStatus = 'completed' | 'current' | 'upcoming';
|
|
21
|
+
/**
|
|
22
|
+
* Props accepted by {@link StageTimeline} — the same props
|
|
23
|
+
* `@molecule/app-stage-timeline-react` accepts. Node-valued stage fields
|
|
24
|
+
* (`label`, `subtitle`) are template references in Angular (an input cannot
|
|
25
|
+
* carry a node), or plain text.
|
|
26
|
+
*/
|
|
27
|
+
export interface StageTimelineProps {
|
|
28
|
+
/** Ordered stages to render, left-to-right. */
|
|
29
|
+
stages: StageTimelineStage[];
|
|
30
|
+
/**
|
|
31
|
+
* Index of the **current** stage (0-based). Stages before this index
|
|
32
|
+
* are rendered as `completed`; stages after are rendered as `upcoming`.
|
|
33
|
+
* Pass `-1` to render every stage as upcoming (e.g. before kickoff).
|
|
34
|
+
* Pass `stages.length` to render every stage as completed (process done).
|
|
35
|
+
*/
|
|
36
|
+
currentIndex: number;
|
|
37
|
+
/** `data-mol-id` attribute for AI-agent selectors. */
|
|
38
|
+
dataMolId?: string;
|
|
39
|
+
/** Extra classes appended via the ClassMap `cn()` helper. */
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,2DAA2D;IAC3D,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7C,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACjD,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,iCAAiC;AACjC,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-stage-timeline-angular",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-stage",
|
|
4
|
+
"description": "Multi-stage horizontal progress timeline with current marker — onboarding, applicant tracking, kanban status flow",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-stage-timeline-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
|
+
"stage-timeline",
|
|
28
|
+
"stepper",
|
|
29
|
+
"progress",
|
|
30
|
+
"angular"
|
|
31
|
+
],
|
|
32
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
37
|
+
"directory": "packages/app/features/stage-timeline-angular"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
},
|
|
42
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@angular/common": "^22.0.0",
|
|
48
|
+
"@angular/core": "^22.0.0",
|
|
49
|
+
"@angular/platform-browser": "^22.0.0",
|
|
50
|
+
"@molecule/app-angular": "^3.5.0",
|
|
51
|
+
"@molecule/app-i18n": "^1.0.1",
|
|
52
|
+
"@molecule/app-ui": "^1.0.1",
|
|
53
|
+
"@molecule/app-ui-angular": "^1.1.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@angular/common": "22.2.3",
|
|
57
|
+
"@angular/compiler": "22.2.3",
|
|
58
|
+
"@angular/compiler-cli": "22.2.3",
|
|
59
|
+
"@angular/core": "22.2.3",
|
|
60
|
+
"@angular/platform-browser": "22.2.3",
|
|
61
|
+
"@molecule/app-angular": "3.7.2",
|
|
62
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
63
|
+
"@molecule/app-i18n": "1.2.2",
|
|
64
|
+
"@molecule/app-icons": "1.0.4",
|
|
65
|
+
"@molecule/app-ui": "1.4.0",
|
|
66
|
+
"@molecule/app-ui-angular": "1.2.1",
|
|
67
|
+
"@molecule/app-ui-tailwind": "1.3.0",
|
|
68
|
+
"@testing-library/dom": "10.4.2",
|
|
69
|
+
"@types/node": "26.6.5",
|
|
70
|
+
"jsdom": "30.1.3",
|
|
71
|
+
"rxjs": "7.8.2",
|
|
72
|
+
"typescript": "6.0.3",
|
|
73
|
+
"vitest": "4.1.12",
|
|
74
|
+
"zone.js": "0.16.3"
|
|
75
|
+
}
|
|
76
|
+
}
|