@genesislcap/foundation-ui 14.401.4 → 14.402.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/dist/custom-elements.json +850 -782
- package/dist/dts/status-pill/status-pill.d.ts +33 -0
- package/dist/dts/status-pill/status-pill.d.ts.map +1 -1
- package/dist/dts/status-pill/status-pill.template.d.ts.map +1 -1
- package/dist/esm/status-pill/status-pill.js +70 -3
- package/dist/esm/status-pill/status-pill.template.js +28 -26
- package/package.json +19 -19
|
@@ -122,18 +122,51 @@ export declare class StatusPill extends FoundationElement {
|
|
|
122
122
|
* ```
|
|
123
123
|
*/
|
|
124
124
|
dateCountdownUnit: CountdownUnit;
|
|
125
|
+
/**
|
|
126
|
+
* @attr date-countdown-visible-after - a timestamp (in milliseconds) that controls
|
|
127
|
+
* when the countdown (and pill) becomes visible. If present, the pill will only
|
|
128
|
+
* be shown once the current time is equal to or after this timestamp.
|
|
129
|
+
* @example
|
|
130
|
+
* Show pill and countdown only after a specific start time
|
|
131
|
+
* ```html
|
|
132
|
+
* <rapid-status-pill
|
|
133
|
+
* date-countdown="1750955880385"
|
|
134
|
+
* date-countdown-visible-after="1750952280385"
|
|
135
|
+
* ></rapid-status-pill>
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
dateCountdownVisibleAfter: number;
|
|
139
|
+
/**
|
|
140
|
+
* @attr hide-when-countdown-completed - if true, the status pill will be removed
|
|
141
|
+
* from the template once the countdown has expired.
|
|
142
|
+
*/
|
|
143
|
+
hideWhenCountdownCompleted: boolean;
|
|
125
144
|
/**
|
|
126
145
|
* @internal
|
|
127
146
|
*/
|
|
128
147
|
countdown: string;
|
|
148
|
+
/**
|
|
149
|
+
* @internal
|
|
150
|
+
* Tracks whether the countdown has reached or passed its target.
|
|
151
|
+
*/
|
|
152
|
+
isCountdownExpired: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* @internal
|
|
155
|
+
* Controls whether the pill should be rendered based on the optional
|
|
156
|
+
* date-countdown-visible-after start time.
|
|
157
|
+
*/
|
|
158
|
+
isCountdownVisible: boolean;
|
|
129
159
|
private dateInterval;
|
|
130
160
|
/**
|
|
131
161
|
* @internal
|
|
132
162
|
*/
|
|
133
163
|
dateCountdownChanged(oldValue: any, newValue: any): void;
|
|
164
|
+
dateCountdownVisibleAfterChanged(oldValue: any, newValue: any): void;
|
|
165
|
+
connectedCallback(): void;
|
|
134
166
|
disconnectedCallback(): void;
|
|
135
167
|
private setUpDateCountdown;
|
|
136
168
|
private updateCountdown;
|
|
169
|
+
private updateVisibilityFromStartTime;
|
|
137
170
|
private clearCountdownTimer;
|
|
138
171
|
}
|
|
139
172
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-pill.d.ts","sourceRoot":"","sources":["../../../src/status-pill/status-pill.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAU/D;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,mBAAmB,MAAM,EACzB,UAAS,aAAwB,KAChC,MAoCF,CAAC;AAEF;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;IAC/C;;;;;;;;OAQG;IACsC,eAAe,EAAE,MAAM,CAAC;IAEjE;;;;;;;;OAQG;IAC+B,QAAQ,EAAE,MAAM,CAAC;IAEnD;;;;;;;;OAQG;IAC8B,OAAO,EAAE,MAAM,CAAC;IAEjD;;;;;;;;OAQG;IACkC,WAAW,EAAE,MAAM,CAAC;IAEzD;;;;;;;;OAQG;IACmD,0BAA0B,EAAE,MAAM,CAAC;IAEzF;;;;;;;;OAQG;IAC+B,QAAQ,EAAE,MAAM,CAAQ;IAE1D;;;;;;;;OAQG;IACgC,SAAS,EAAE,MAAM,CAAC;IAErD;;;;;;;;OAQG;IACG,IAAI,EAA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ACyC,iBAAiB,EAAE,aAAa,CAAY;IAExF;;;;;;;;;;;;OAYG;IACkD,yBAAyB,EAAE,MAAM,CAAC;IAEvF;;;OAGG;IAEH,0BAA0B,EAAE,OAAO,CAAS;IAE5C;;OAEG;IACS,SAAS,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACS,kBAAkB,EAAE,OAAO,CAAS;IAEhD;;;;OAIG;IACS,kBAAkB,EAAE,OAAO,CAAQ;IAE/C,OAAO,CAAC,YAAY,CAAC;IAErB;;OAEG;IACH,oBAAoB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IAYvC,gCAAgC,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IAMnD,iBAAiB;IAKjB,oBAAoB;IAKpB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,eAAe;IAgCvB,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,mBAAmB;CAO5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;qBAI/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-pill.template.d.ts","sourceRoot":"","sources":["../../../src/status-pill/status-pill.template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"status-pill.template.d.ts","sourceRoot":"","sources":["../../../src/status-pill/status-pill.template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAiDhD,eAAO,MAAM,4BAA4B,iEAExC,CAAC"}
|
|
@@ -85,6 +85,22 @@ export class StatusPill extends FoundationElement {
|
|
|
85
85
|
* ```
|
|
86
86
|
*/
|
|
87
87
|
this.dateCountdownUnit = 'second';
|
|
88
|
+
/**
|
|
89
|
+
* @attr hide-when-countdown-completed - if true, the status pill will be removed
|
|
90
|
+
* from the template once the countdown has expired.
|
|
91
|
+
*/
|
|
92
|
+
this.hideWhenCountdownCompleted = false;
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
* Tracks whether the countdown has reached or passed its target.
|
|
96
|
+
*/
|
|
97
|
+
this.isCountdownExpired = false;
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
* Controls whether the pill should be rendered based on the optional
|
|
101
|
+
* date-countdown-visible-after start time.
|
|
102
|
+
*/
|
|
103
|
+
this.isCountdownVisible = true;
|
|
88
104
|
}
|
|
89
105
|
/**
|
|
90
106
|
* @internal
|
|
@@ -95,9 +111,19 @@ export class StatusPill extends FoundationElement {
|
|
|
95
111
|
this.clearCountdownTimer();
|
|
96
112
|
return;
|
|
97
113
|
}
|
|
114
|
+
this.isCountdownExpired = false;
|
|
98
115
|
this.setUpDateCountdown(newValue);
|
|
99
116
|
}
|
|
100
117
|
}
|
|
118
|
+
dateCountdownVisibleAfterChanged(oldValue, newValue) {
|
|
119
|
+
if (oldValue !== newValue) {
|
|
120
|
+
this.updateVisibilityFromStartTime();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
connectedCallback() {
|
|
124
|
+
this.updateVisibilityFromStartTime();
|
|
125
|
+
super.connectedCallback();
|
|
126
|
+
}
|
|
101
127
|
disconnectedCallback() {
|
|
102
128
|
this.clearCountdownTimer();
|
|
103
129
|
super.disconnectedCallback();
|
|
@@ -117,20 +143,49 @@ export class StatusPill extends FoundationElement {
|
|
|
117
143
|
updateCountdown(targetDate) {
|
|
118
144
|
const now = new Date().getTime();
|
|
119
145
|
const diff = Math.floor(targetDate.getTime() - now);
|
|
146
|
+
const visibleAfterMs = this.dateCountdownVisibleAfter !== undefined && this.dateCountdownVisibleAfter !== null
|
|
147
|
+
? Number(this.dateCountdownVisibleAfter)
|
|
148
|
+
: undefined;
|
|
149
|
+
if (visibleAfterMs !== undefined && !isNaN(visibleAfterMs) && now < visibleAfterMs) {
|
|
150
|
+
// Not yet reached the start time; hide the entire pill/countdown.
|
|
151
|
+
this.isCountdownVisible = false;
|
|
152
|
+
this.countdown = null;
|
|
153
|
+
this.isCountdownExpired = false;
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.isCountdownVisible = true;
|
|
120
157
|
if (diff <= 0) {
|
|
121
|
-
this.
|
|
122
|
-
|
|
158
|
+
if (this.hideWhenCountdownCompleted) {
|
|
159
|
+
this.isCountdownExpired = true;
|
|
160
|
+
this.clearCountdownTimer();
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
this.countdown = this.dateCountdownCompletedMessage;
|
|
164
|
+
clearInterval(this.dateInterval);
|
|
165
|
+
}
|
|
123
166
|
}
|
|
124
167
|
else {
|
|
125
168
|
this.countdown = formatTimeForCountDown(diff, this.dateCountdownUnit);
|
|
126
169
|
}
|
|
127
170
|
}
|
|
171
|
+
updateVisibilityFromStartTime() {
|
|
172
|
+
const visibleAfterMs = this.dateCountdownVisibleAfter !== undefined && this.dateCountdownVisibleAfter !== null
|
|
173
|
+
? Number(this.dateCountdownVisibleAfter)
|
|
174
|
+
: undefined;
|
|
175
|
+
if (visibleAfterMs !== undefined && !isNaN(visibleAfterMs)) {
|
|
176
|
+
const now = Date.now();
|
|
177
|
+
this.isCountdownVisible = now >= visibleAfterMs;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this.isCountdownVisible = true;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
128
183
|
clearCountdownTimer() {
|
|
129
184
|
if (this.dateInterval) {
|
|
130
185
|
clearInterval(this.dateInterval);
|
|
131
186
|
this.dateInterval = null;
|
|
132
|
-
this.countdown = null;
|
|
133
187
|
}
|
|
188
|
+
this.countdown = null;
|
|
134
189
|
}
|
|
135
190
|
}
|
|
136
191
|
__decorate([
|
|
@@ -166,9 +221,21 @@ __decorate([
|
|
|
166
221
|
__decorate([
|
|
167
222
|
attr({ attribute: 'date-countdown-unit' })
|
|
168
223
|
], StatusPill.prototype, "dateCountdownUnit", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
attr({ attribute: 'date-countdown-visible-after' })
|
|
226
|
+
], StatusPill.prototype, "dateCountdownVisibleAfter", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
attr({ mode: 'boolean', attribute: 'hide-when-countdown-completed' })
|
|
229
|
+
], StatusPill.prototype, "hideWhenCountdownCompleted", void 0);
|
|
169
230
|
__decorate([
|
|
170
231
|
observable
|
|
171
232
|
], StatusPill.prototype, "countdown", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
observable
|
|
235
|
+
], StatusPill.prototype, "isCountdownExpired", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
observable
|
|
238
|
+
], StatusPill.prototype, "isCountdownVisible", void 0);
|
|
172
239
|
/**
|
|
173
240
|
* The Foundation Status Pill
|
|
174
241
|
*
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { html, when } from '@microsoft/fast-element';
|
|
2
2
|
import { getPrefix } from '../utils';
|
|
3
3
|
const getPrefixedStatusPillTemplate = (prefix) => html `
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
${when((x) => x.isCountdownVisible && !(x.hideWhenCountdownCompleted && x.isCountdownExpired), html `
|
|
5
|
+
<div
|
|
6
|
+
data-test-id="status-pill"
|
|
7
|
+
part="status-pill"
|
|
8
|
+
class="status-pill"
|
|
9
|
+
style="color: ${(x) => x.textColor || ''}; background: ${(x) => x.backgroundColor || ''};"
|
|
10
|
+
>
|
|
11
|
+
${when((x) => x.iconName, html `
|
|
12
|
+
<${prefix}-icon name="${(x) => x.iconName}" size="${(x) => x.iconSize}"></${prefix}-icon>
|
|
13
|
+
`)}
|
|
14
|
+
${when((x) => x.iconSrc, html `
|
|
15
|
+
<img alt="${(x) => x.iconSrc}" class="status-pill-image" src="${(x) => x.iconSrc}" />
|
|
16
|
+
`)}
|
|
17
|
+
${when((x) => x.iconInitial, html `
|
|
18
|
+
<div
|
|
19
|
+
data-test-id="status-pill-initial"
|
|
20
|
+
class="status-pill-initial"
|
|
21
|
+
style="color:${(x) => x.textColor}; background-color: ${(x) => x.iconInitialBackgroundColor}"
|
|
22
|
+
>
|
|
23
|
+
${(x) => x.iconInitial.substring(0, 1)}
|
|
24
|
+
</div>
|
|
25
|
+
`)}
|
|
26
|
+
<span data-test-id="status-pill-text">${(x) => x.text}</span>
|
|
27
|
+
${when((x) => x.countdown, html `
|
|
28
|
+
<span data-test-id="status-pill-countdown">${(x) => x.countdown}</span>
|
|
29
|
+
`)}
|
|
30
|
+
</div>
|
|
31
|
+
`)}
|
|
30
32
|
`;
|
|
31
33
|
export const foundationStatusPillTemplate = html `
|
|
32
34
|
${(x) => getPrefixedStatusPillTemplate(getPrefix(x))}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-ui",
|
|
3
3
|
"description": "Genesis Foundation UI",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.402.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -85,13 +85,13 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@genesislcap/foundation-testing": "14.
|
|
89
|
-
"@genesislcap/genx": "14.
|
|
90
|
-
"@genesislcap/rollup-builder": "14.
|
|
91
|
-
"@genesislcap/ts-builder": "14.
|
|
92
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
93
|
-
"@genesislcap/vite-builder": "14.
|
|
94
|
-
"@genesislcap/webpack-builder": "14.
|
|
88
|
+
"@genesislcap/foundation-testing": "14.402.0",
|
|
89
|
+
"@genesislcap/genx": "14.402.0",
|
|
90
|
+
"@genesislcap/rollup-builder": "14.402.0",
|
|
91
|
+
"@genesislcap/ts-builder": "14.402.0",
|
|
92
|
+
"@genesislcap/uvu-playwright-builder": "14.402.0",
|
|
93
|
+
"@genesislcap/vite-builder": "14.402.0",
|
|
94
|
+
"@genesislcap/webpack-builder": "14.402.0",
|
|
95
95
|
"copyfiles": "^2.4.1"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
@@ -100,16 +100,16 @@
|
|
|
100
100
|
"@fortawesome/free-regular-svg-icons": "^6.2.1",
|
|
101
101
|
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
|
102
102
|
"@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
|
|
103
|
-
"@genesislcap/expression-builder": "14.
|
|
104
|
-
"@genesislcap/foundation-ai": "14.
|
|
105
|
-
"@genesislcap/foundation-comms": "14.
|
|
106
|
-
"@genesislcap/foundation-criteria": "14.
|
|
107
|
-
"@genesislcap/foundation-errors": "14.
|
|
108
|
-
"@genesislcap/foundation-events": "14.
|
|
109
|
-
"@genesislcap/foundation-logger": "14.
|
|
110
|
-
"@genesislcap/foundation-notifications": "14.
|
|
111
|
-
"@genesislcap/foundation-user": "14.
|
|
112
|
-
"@genesislcap/foundation-utils": "14.
|
|
103
|
+
"@genesislcap/expression-builder": "14.402.0",
|
|
104
|
+
"@genesislcap/foundation-ai": "14.402.0",
|
|
105
|
+
"@genesislcap/foundation-comms": "14.402.0",
|
|
106
|
+
"@genesislcap/foundation-criteria": "14.402.0",
|
|
107
|
+
"@genesislcap/foundation-errors": "14.402.0",
|
|
108
|
+
"@genesislcap/foundation-events": "14.402.0",
|
|
109
|
+
"@genesislcap/foundation-logger": "14.402.0",
|
|
110
|
+
"@genesislcap/foundation-notifications": "14.402.0",
|
|
111
|
+
"@genesislcap/foundation-user": "14.402.0",
|
|
112
|
+
"@genesislcap/foundation-utils": "14.402.0",
|
|
113
113
|
"@microsoft/fast-colors": "5.3.1",
|
|
114
114
|
"@microsoft/fast-components": "2.30.6",
|
|
115
115
|
"@microsoft/fast-element": "1.14.0",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"access": "public"
|
|
132
132
|
},
|
|
133
133
|
"customElements": "dist/custom-elements.json",
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "7ffded0edb096db3e60298c0d0a216071aa1d970"
|
|
135
135
|
}
|