genesys-spark 4.23.0 → 4.24.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/index.js +51 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -158,6 +158,26 @@ function checkAndLoadFonts(fonts) {
|
|
|
158
158
|
})).then(function () { }); // flatten the promise array
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
//https://inindca.atlassian.net/browse/COMUI-2673
|
|
162
|
+
// utility to get the closest element passing shadow dom boundaries
|
|
163
|
+
function getClosestElement(node, selector) {
|
|
164
|
+
if (!node) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
if (node instanceof ShadowRoot) {
|
|
168
|
+
return getClosestElement(node.host, selector);
|
|
169
|
+
}
|
|
170
|
+
if (node instanceof HTMLElement) {
|
|
171
|
+
if (node.matches(selector)) {
|
|
172
|
+
return node;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
return getClosestElement(node.parentNode, selector);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return getClosestElement(node.parentNode, selector);
|
|
179
|
+
}
|
|
180
|
+
|
|
161
181
|
/**
|
|
162
182
|
* Provides an [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat)
|
|
163
183
|
* object for formatting dates and times. Unlike the native version, `locale` is
|
|
@@ -219,7 +239,7 @@ function relativeTimeFormat(localeOrOptions, options) {
|
|
|
219
239
|
function determineDisplayLocale(element) {
|
|
220
240
|
var _a;
|
|
221
241
|
if (element === void 0) { element = document.body; }
|
|
222
|
-
var domLocale = (_a = element
|
|
242
|
+
var domLocale = (_a = getClosestElement(element, '*[lang]')) === null || _a === void 0 ? void 0 : _a.lang;
|
|
223
243
|
if (!domLocale || browserHasRegionData(domLocale)) {
|
|
224
244
|
// If we can't find a locale in the DOM, or we find a locale without a region that matches the
|
|
225
245
|
// users's browser locale, use the browser locale.
|
|
@@ -239,16 +259,44 @@ function browserHasRegionData(localeString) {
|
|
|
239
259
|
return (localeString.length == 2 &&
|
|
240
260
|
navigator.language.startsWith("".concat(localeString, "-")));
|
|
241
261
|
}
|
|
262
|
+
function getFormat(locale) {
|
|
263
|
+
var date = new Date('July 5, 2000 15:00:00 UTC+00:00');
|
|
264
|
+
var options = {
|
|
265
|
+
year: 'numeric',
|
|
266
|
+
month: 'numeric',
|
|
267
|
+
day: 'numeric'
|
|
268
|
+
};
|
|
269
|
+
var dateTimeFormat = new Intl.DateTimeFormat(locale, options);
|
|
270
|
+
var parts = dateTimeFormat.formatToParts(date);
|
|
271
|
+
var dateString = parts
|
|
272
|
+
.map(function (_a) {
|
|
273
|
+
var type = _a.type, value = _a.value;
|
|
274
|
+
switch (type) {
|
|
275
|
+
case 'day':
|
|
276
|
+
return "dd";
|
|
277
|
+
case 'month':
|
|
278
|
+
return "mm";
|
|
279
|
+
case 'year':
|
|
280
|
+
return "yyyy";
|
|
281
|
+
default:
|
|
282
|
+
return value;
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
.join('');
|
|
286
|
+
// review locales with two character date delimiters https://inindca.atlassian.net/browse/COMUI-2679
|
|
287
|
+
return dateString.replace(/\s/g, '').replace(//g, '');
|
|
288
|
+
}
|
|
242
289
|
|
|
243
290
|
var intl = /*#__PURE__*/Object.freeze({
|
|
244
291
|
__proto__: null,
|
|
245
292
|
dateTimeFormat: dateTimeFormat,
|
|
246
293
|
determineDisplayLocale: determineDisplayLocale,
|
|
294
|
+
getFormat: getFormat,
|
|
247
295
|
relativeTimeFormat: relativeTimeFormat
|
|
248
296
|
});
|
|
249
297
|
|
|
250
|
-
var COMPONENT_ASSET_PREFIX = '/spark-components/build-assets/4.
|
|
251
|
-
var CHART_COMPONENT_ASSET_PREFIX = '/spark-components/build-assets/4.
|
|
298
|
+
var COMPONENT_ASSET_PREFIX = '/spark-components/build-assets/4.24.0-128/genesys-webcomponents/';
|
|
299
|
+
var CHART_COMPONENT_ASSET_PREFIX = '/spark-components/build-assets/4.24.0-128/genesys-chart-webcomponents/';
|
|
252
300
|
/**
|
|
253
301
|
* TODO
|
|
254
302
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genesys-spark",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.24.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"eslint-config-genesys-spark-components": "file:../../shared-configs/eslint-config-genesys-spark-components",
|
|
30
30
|
"jest": "^29.7.0",
|
|
31
31
|
"jest-environment-jsdom": "^29.7.0",
|
|
32
|
-
"rollup": "^
|
|
32
|
+
"rollup": "^4.12.1",
|
|
33
33
|
"ts-jest": "^29.1.2"
|
|
34
34
|
}
|
|
35
35
|
}
|