@genesislcap/foundation-ui 14.307.0 → 14.307.2

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.
@@ -40994,6 +40994,15 @@
40994
40994
  "default": "`Expired`",
40995
40995
  "attribute": "date-countdown-completed-message"
40996
40996
  },
40997
+ {
40998
+ "kind": "field",
40999
+ "name": "dateCountdownUnit",
41000
+ "type": {
41001
+ "text": "CountdownUnit"
41002
+ },
41003
+ "default": "'second'",
41004
+ "attribute": "date-countdown-unit"
41005
+ },
40997
41006
  {
40998
41007
  "kind": "field",
40999
41008
  "name": "dateInterval",
@@ -41222,6 +41231,15 @@
41222
41231
  "fieldName": "dateCountdownCompletedMessage",
41223
41232
  "description": "the string that will be shown when the countdown is complete"
41224
41233
  },
41234
+ {
41235
+ "name": "date-countdown-unit",
41236
+ "type": {
41237
+ "text": "CountdownUnit"
41238
+ },
41239
+ "default": "'second'",
41240
+ "fieldName": "dateCountdownUnit",
41241
+ "description": "the minimum unit of time shown in the countdown. Defaults to 'seconds'"
41242
+ },
41225
41243
  {
41226
41244
  "name": "background-color",
41227
41245
  "type": {
@@ -41303,6 +41321,15 @@
41303
41321
  "default": "`Expired`",
41304
41322
  "attribute": "date-countdown-completed-message",
41305
41323
  "fieldName": "dateCountdownCompletedMessage"
41324
+ },
41325
+ {
41326
+ "name": "date-countdown-unit",
41327
+ "type": {
41328
+ "text": "CountdownUnit"
41329
+ },
41330
+ "default": "'second'",
41331
+ "attribute": "date-countdown-unit",
41332
+ "fieldName": "dateCountdownUnit"
41306
41333
  }
41307
41334
  ],
41308
41335
  "superclass": {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/number-field/utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,GAClC,OAAO,MAAM,EACb,QAAQ,MAAM,KACb;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAI5B,CAAC;AAEF,eAAO,MAAM,kBA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,GAAG,MAAM,EAAE,MAAM,MAAM,KAAG,MAgDnF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,GAAG,MAAM,EAAE,MAAM,MAAM,KAAG,MA+CnF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,MAAM,GAAG,MAAM,KAAG,MA8BnE,CAAC"}
@@ -1,8 +1,13 @@
1
1
  import { FoundationElement } from '@microsoft/fast-foundation';
2
+ /**
3
+ * @public
4
+ * Unit for date countdown. Rounds down to the nearest whole number. If not seconds and time is greater than zero but less than the smallest unit it will show >1m or >1h.
5
+ */
6
+ export type CountdownUnit = 'hour' | 'minute' | 'second';
2
7
  /**
3
8
  * @internal
4
9
  */
5
- export declare const formatTimeForCountDown: (totalMilliseconds: number) => string;
10
+ export declare const formatTimeForCountDown: (totalMilliseconds: number, minUnit?: CountdownUnit) => string;
6
11
  /**
7
12
  * @tagname %%prefix%%-status-pill
8
13
  */
@@ -107,6 +112,16 @@ export declare class StatusPill extends FoundationElement {
107
112
  * ```
108
113
  */
109
114
  dateCountdownCompletedMessage: string;
115
+ /**
116
+ * @attr date-countdown-unit - the minimum unit of time shown in the countdown. Defaults to 'seconds'
117
+ * @example
118
+ * Status pill with countdown min unit
119
+ * ```html
120
+ * <rapid-status-pill date-countdown-unit='minutes'>
121
+ * </rapid-status-pill>
122
+ * ```
123
+ */
124
+ dateCountdownUnit: CountdownUnit;
110
125
  /**
111
126
  * @internal
112
127
  */
@@ -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;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,mBAAmB,MAAM,KAAG,MAmBlE,CAAC;AAEF;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;IAC/C;;;;;;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AAC;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,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACoC,aAAa,EAAE,MAAM,CAAC;IAE7D;;;;;;;;OAQG;IACsD,6BAA6B,EAAE,MAAM,CAClF;IAEZ;;;;;;;;OAQG;IACyC,iBAAiB,EAAE,aAAa,CAAY;IAExF;;OAEG;IACS,SAAS,EAAE,MAAM,CAAC;IAE9B,OAAO,CAAC,YAAY,CAAC;IAErB;;OAEG;IACH,oBAAoB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IAWvC,oBAAoB;IAKpB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,mBAAmB;CAO5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;qBAI/B,CAAC"}
@@ -2,6 +2,7 @@ import { NumberParser } from '@genesislcap/foundation-utils';
2
2
  const formattedInputPrecision = 12;
3
3
  const FORMAT_TEST_NUMBER = 12345.6;
4
4
  const DECIMAL_BASE = 10;
5
+ const MAX_DIGIT = DECIMAL_BASE - 1;
5
6
  export const getSeparatorsFromParser = (value, locale) => {
6
7
  var _a;
7
8
  const parts = new Intl.NumberFormat(locale).formatToParts(FORMAT_TEST_NUMBER);
@@ -196,11 +197,10 @@ export const incrementWithPrecision = (valueString, step) => {
196
197
  return (value + step).toString();
197
198
  }
198
199
  const decimalPart = valueStr.substring(decimalIndex + 1);
199
- const decimalPlaces = decimalPart.length;
200
200
  const lastDigitIndex = decimalPart.length - 1;
201
201
  const lastDigit = parseInt(decimalPart.charAt(lastDigitIndex));
202
202
  const newLastDigit = lastDigit + 1;
203
- if (newLastDigit <= 9) {
203
+ if (newLastDigit <= MAX_DIGIT) {
204
204
  const newDecimalPart = decimalPart.substring(0, lastDigitIndex) + newLastDigit;
205
205
  return valueStr.substring(0, decimalIndex + 1) + newDecimalPart;
206
206
  }
@@ -210,7 +210,7 @@ export const incrementWithPrecision = (valueString, step) => {
210
210
  for (let i = lastDigitIndex; i >= 0; i -= 1) {
211
211
  const digit = parseInt(decimalPart.charAt(i));
212
212
  const newDigit = digit + carry;
213
- if (newDigit <= 9) {
213
+ if (newDigit <= MAX_DIGIT) {
214
214
  newDecimalPart = newDigit + newDecimalPart;
215
215
  carry = 0;
216
216
  }
@@ -248,7 +248,6 @@ export const decrementWithPrecision = (valueString, step) => {
248
248
  return (value - step).toString();
249
249
  }
250
250
  const decimalPart = valueStr.substring(decimalIndex + 1);
251
- const decimalPlaces = decimalPart.length;
252
251
  const lastDigitIndex = decimalPart.length - 1;
253
252
  const lastDigit = parseInt(decimalPart.charAt(lastDigitIndex));
254
253
  const newLastDigit = lastDigit - 1;
@@ -267,7 +266,7 @@ export const decrementWithPrecision = (valueString, step) => {
267
266
  borrow = 0;
268
267
  }
269
268
  else {
270
- newDecimalPart = '9' + newDecimalPart;
269
+ newDecimalPart = MAX_DIGIT.toString() + newDecimalPart;
271
270
  borrow = 1;
272
271
  }
273
272
  }
@@ -11,23 +11,42 @@ const SECONDS_IN_MINUTE = 60;
11
11
  /**
12
12
  * @internal
13
13
  */
14
- export const formatTimeForCountDown = (totalMilliseconds) => {
14
+ export const formatTimeForCountDown = (totalMilliseconds, minUnit = 'second') => {
15
15
  let totalSeconds = totalMilliseconds / ONE_SECOND_IN_MILIS;
16
16
  const days = Math.floor(totalSeconds / SECONDS_IN_DAY);
17
17
  totalSeconds %= SECONDS_IN_DAY;
18
18
  const hours = Math.floor(totalSeconds / SECONDS_IN_HOUR);
19
19
  totalSeconds %= SECONDS_IN_HOUR;
20
20
  const minutes = Math.floor(totalSeconds / SECONDS_IN_MINUTE);
21
- const seconds = totalSeconds % SECONDS_IN_MINUTE;
21
+ const seconds = Math.floor(totalSeconds % SECONDS_IN_MINUTE);
22
22
  const parts = [];
23
23
  if (days)
24
24
  parts.push(`${days}d`);
25
- if (hours)
26
- parts.push(`${hours}h`);
27
- if (minutes)
28
- parts.push(`${minutes}m`);
29
- if (seconds)
30
- parts.push(`${seconds}s`);
25
+ switch (minUnit) {
26
+ case 'minute':
27
+ if (hours)
28
+ parts.push(`${hours}h`);
29
+ if (minutes)
30
+ parts.push(`${minutes}m`);
31
+ if (!minutes && seconds)
32
+ parts.push('< 1m'); // if less than one minute but remaining minutes show less than 1 minute
33
+ break;
34
+ case 'hour':
35
+ if (hours)
36
+ parts.push(`${hours}h`);
37
+ if (!hours && (minutes || seconds))
38
+ parts.push('< 1h'); // if less than one hour but remaining minutes show less than 1 hour.
39
+ break;
40
+ case 'second':
41
+ default:
42
+ if (hours)
43
+ parts.push(`${hours}h`);
44
+ if (minutes)
45
+ parts.push(`${minutes}m`);
46
+ if (seconds)
47
+ parts.push(`${seconds}s`);
48
+ break;
49
+ }
31
50
  return parts.length ? parts.join(' ') : '0s';
32
51
  };
33
52
  /**
@@ -56,6 +75,16 @@ export class StatusPill extends FoundationElement {
56
75
  * ```
57
76
  */
58
77
  this.dateCountdownCompletedMessage = `Expired`;
78
+ /**
79
+ * @attr date-countdown-unit - the minimum unit of time shown in the countdown. Defaults to 'seconds'
80
+ * @example
81
+ * Status pill with countdown min unit
82
+ * ```html
83
+ * <rapid-status-pill date-countdown-unit='minutes'>
84
+ * </rapid-status-pill>
85
+ * ```
86
+ */
87
+ this.dateCountdownUnit = 'second';
59
88
  }
60
89
  /**
61
90
  * @internal
@@ -93,7 +122,7 @@ export class StatusPill extends FoundationElement {
93
122
  clearInterval(this.dateInterval);
94
123
  }
95
124
  else {
96
- this.countdown = formatTimeForCountDown(diff);
125
+ this.countdown = formatTimeForCountDown(diff, this.dateCountdownUnit);
97
126
  }
98
127
  }
99
128
  clearCountdownTimer() {
@@ -134,6 +163,9 @@ __decorate([
134
163
  __decorate([
135
164
  attr({ attribute: 'date-countdown-completed-message' })
136
165
  ], StatusPill.prototype, "dateCountdownCompletedMessage", void 0);
166
+ __decorate([
167
+ attr({ attribute: 'date-countdown-unit' })
168
+ ], StatusPill.prototype, "dateCountdownUnit", void 0);
137
169
  __decorate([
138
170
  observable
139
171
  ], StatusPill.prototype, "countdown", void 0);
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.307.0",
4
+ "version": "14.307.2",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -83,13 +83,13 @@
83
83
  }
84
84
  },
85
85
  "devDependencies": {
86
- "@genesislcap/foundation-testing": "14.307.0",
87
- "@genesislcap/genx": "14.307.0",
88
- "@genesislcap/rollup-builder": "14.307.0",
89
- "@genesislcap/ts-builder": "14.307.0",
90
- "@genesislcap/uvu-playwright-builder": "14.307.0",
91
- "@genesislcap/vite-builder": "14.307.0",
92
- "@genesislcap/webpack-builder": "14.307.0",
86
+ "@genesislcap/foundation-testing": "14.307.2",
87
+ "@genesislcap/genx": "14.307.2",
88
+ "@genesislcap/rollup-builder": "14.307.2",
89
+ "@genesislcap/ts-builder": "14.307.2",
90
+ "@genesislcap/uvu-playwright-builder": "14.307.2",
91
+ "@genesislcap/vite-builder": "14.307.2",
92
+ "@genesislcap/webpack-builder": "14.307.2",
93
93
  "copyfiles": "^2.4.1",
94
94
  "rxjs": "^7.5.4"
95
95
  },
@@ -99,15 +99,15 @@
99
99
  "@fortawesome/free-regular-svg-icons": "^6.2.1",
100
100
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
101
101
  "@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
102
- "@genesislcap/expression-builder": "14.307.0",
103
- "@genesislcap/foundation-comms": "14.307.0",
104
- "@genesislcap/foundation-criteria": "14.307.0",
105
- "@genesislcap/foundation-errors": "14.307.0",
106
- "@genesislcap/foundation-events": "14.307.0",
107
- "@genesislcap/foundation-logger": "14.307.0",
108
- "@genesislcap/foundation-notifications": "14.307.0",
109
- "@genesislcap/foundation-user": "14.307.0",
110
- "@genesislcap/foundation-utils": "14.307.0",
102
+ "@genesislcap/expression-builder": "14.307.2",
103
+ "@genesislcap/foundation-comms": "14.307.2",
104
+ "@genesislcap/foundation-criteria": "14.307.2",
105
+ "@genesislcap/foundation-errors": "14.307.2",
106
+ "@genesislcap/foundation-events": "14.307.2",
107
+ "@genesislcap/foundation-logger": "14.307.2",
108
+ "@genesislcap/foundation-notifications": "14.307.2",
109
+ "@genesislcap/foundation-user": "14.307.2",
110
+ "@genesislcap/foundation-utils": "14.307.2",
111
111
  "@microsoft/fast-colors": "5.3.1",
112
112
  "@microsoft/fast-components": "2.30.6",
113
113
  "@microsoft/fast-element": "1.14.0",
@@ -128,5 +128,5 @@
128
128
  "access": "public"
129
129
  },
130
130
  "customElements": "dist/custom-elements.json",
131
- "gitHead": "6a075391e3bb335bd43da0069693ade3f5565042"
131
+ "gitHead": "a3bfd4199f20640443c512431840c7e8dedc5b4c"
132
132
  }