@warp-ds/elements 1.2.3-next.2 → 1.3.0-next.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.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +811 -367
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.js +164 -68
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/alert/index.js +296 -118
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/attention/index.js +117 -62
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/badge/index.js +3 -3
- package/dist/packages/badge/index.js.map +2 -2
- package/dist/packages/box/index.js +3 -3
- package/dist/packages/box/index.js.map +2 -2
- package/dist/packages/breadcrumbs/index.js +67 -53
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/button/index.js +66 -52
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/card/index.js +3 -3
- package/dist/packages/card/index.js.map +2 -2
- package/dist/packages/expandable/index.js +163 -67
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/pill/index.d.ts +34 -0
- package/dist/packages/pill/index.js +1851 -0
- package/dist/packages/pill/index.js.map +7 -0
- package/dist/packages/pill/locales/en/messages.d.mts +1 -0
- package/dist/packages/pill/locales/fi/messages.d.mts +1 -0
- package/dist/packages/pill/locales/nb/messages.d.mts +1 -0
- package/dist/packages/select/index.js +116 -61
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/textfield/index.js +3 -3
- package/dist/packages/textfield/index.js.map +2 -2
- package/dist/packages/toast/index.js +291 -113
- package/dist/packages/toast/index.js.map +4 -4
- package/package.json +6 -6
|
@@ -1033,7 +1033,7 @@ import WarpElement from "@warp-ds/elements-core";
|
|
|
1033
1033
|
import { classMap } from "lit/directives/class-map.js";
|
|
1034
1034
|
import { when } from "lit/directives/when.js";
|
|
1035
1035
|
|
|
1036
|
-
// node_modules/.pnpm/@warp-ds+css@1.
|
|
1036
|
+
// node_modules/.pnpm/@warp-ds+css@1.7.0/node_modules/@warp-ds/css/component-classes/index.js
|
|
1037
1037
|
var box = {
|
|
1038
1038
|
box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
|
|
1039
1039
|
// Relative here enables w-clickable
|
|
@@ -1212,9 +1212,9 @@ var modal = {
|
|
|
1212
1212
|
content: "block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",
|
|
1213
1213
|
footer: "flex justify-end shrink-0 px-16 sm:px-32",
|
|
1214
1214
|
transitionTitle: "transition-all duration-300",
|
|
1215
|
-
transitionTitleCenter: "justify-self-center",
|
|
1215
|
+
transitionTitleCenter: "justify-self-center self-center",
|
|
1216
1216
|
transitionTitleColSpan: "col-span-2",
|
|
1217
|
-
title: "-mt-4 sm:-mt-8 h-40 sm:h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-
|
|
1217
|
+
title: "py-8 sm:py-0 -mt-4 sm:-mt-8 min-h-40 sm:min-h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-start px-16 sm:px-32 border-b sm:border-b-0 shrink-0",
|
|
1218
1218
|
titleText: "mb-0 h4 sm:h3",
|
|
1219
1219
|
titleButton: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} sm:min-h-[44px] sm:min-w-[44px] min-h-[32px] min-w-[32px]`,
|
|
1220
1220
|
titleButtonLeft: "-ml-8 sm:-ml-12 justify-self-start",
|
|
@@ -1339,14 +1339,14 @@ var collapse = (el, done) => {
|
|
|
1339
1339
|
return returnPromise;
|
|
1340
1340
|
};
|
|
1341
1341
|
|
|
1342
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1342
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/warning-16.js
|
|
1343
1343
|
import { LitElement } from "lit";
|
|
1344
1344
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
1345
1345
|
|
|
1346
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1346
|
+
// node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
|
|
1347
1347
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1348
1348
|
|
|
1349
|
-
// node_modules/.pnpm/@lingui+message-utils@4.
|
|
1349
|
+
// node_modules/.pnpm/@lingui+message-utils@4.7.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1350
1350
|
var import_parser = __toESM(require_parser(), 1);
|
|
1351
1351
|
function processTokens(tokens, mapText) {
|
|
1352
1352
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
@@ -1396,13 +1396,14 @@ Message: ${message}`);
|
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
1398
|
|
|
1399
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1399
|
+
// node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
|
|
1400
1400
|
var isString = (s) => typeof s === "string";
|
|
1401
1401
|
var isFunction = (f) => typeof f === "function";
|
|
1402
1402
|
var cache = /* @__PURE__ */ new Map();
|
|
1403
|
+
var defaultLocale = "en";
|
|
1403
1404
|
function normalizeLocales(locales) {
|
|
1404
1405
|
const out = Array.isArray(locales) ? locales : [locales];
|
|
1405
|
-
return [...out,
|
|
1406
|
+
return [...out, defaultLocale];
|
|
1406
1407
|
}
|
|
1407
1408
|
function date(locales, value, format) {
|
|
1408
1409
|
const _locales = normalizeLocales(locales);
|
|
@@ -1447,11 +1448,13 @@ function cacheKey(type, locales, options) {
|
|
|
1447
1448
|
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1448
1449
|
}
|
|
1449
1450
|
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
|
|
1450
|
-
var getDefaultFormats = (locale,
|
|
1451
|
-
locales =
|
|
1452
|
-
const style = (format) =>
|
|
1451
|
+
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1452
|
+
const locales = passedLocales || locale;
|
|
1453
|
+
const style = (format) => {
|
|
1454
|
+
return typeof format === "object" ? format : formats[format] || { style: format };
|
|
1455
|
+
};
|
|
1453
1456
|
const replaceOctothorpe = (value, message) => {
|
|
1454
|
-
const numberFormat = Object.keys(formats).length ? style("number") :
|
|
1457
|
+
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
1455
1458
|
const valueStr = number(locales, value, numberFormat);
|
|
1456
1459
|
return message.replace("#", valueStr);
|
|
1457
1460
|
};
|
|
@@ -1466,17 +1469,19 @@ var getDefaultFormats = (locale, locales, formats = {}) => {
|
|
|
1466
1469
|
const message = plural(locales, true, value, cases);
|
|
1467
1470
|
return replaceOctothorpe(value - offset, message);
|
|
1468
1471
|
},
|
|
1469
|
-
select:
|
|
1470
|
-
var _a;
|
|
1471
|
-
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1472
|
-
},
|
|
1472
|
+
select: selectFormatter,
|
|
1473
1473
|
number: (value, format) => number(locales, value, style(format)),
|
|
1474
1474
|
date: (value, format) => date(locales, value, style(format)),
|
|
1475
|
-
undefined:
|
|
1475
|
+
undefined: undefinedFormatter
|
|
1476
1476
|
};
|
|
1477
1477
|
};
|
|
1478
|
+
var selectFormatter = (value, rules) => {
|
|
1479
|
+
var _a;
|
|
1480
|
+
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1481
|
+
};
|
|
1482
|
+
var undefinedFormatter = (value) => value;
|
|
1478
1483
|
function interpolate(translation, locale, locales) {
|
|
1479
|
-
return (values
|
|
1484
|
+
return (values = {}, formats) => {
|
|
1480
1485
|
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1481
1486
|
const formatMessage = (message) => {
|
|
1482
1487
|
if (!Array.isArray(message))
|
|
@@ -1486,14 +1491,15 @@ function interpolate(translation, locale, locales) {
|
|
|
1486
1491
|
return message2 + token;
|
|
1487
1492
|
const [name, type, format] = token;
|
|
1488
1493
|
let interpolatedFormat = {};
|
|
1489
|
-
if (format != null &&
|
|
1490
|
-
Object.
|
|
1491
|
-
interpolatedFormat[key] = formatMessage(
|
|
1494
|
+
if (format != null && typeof format === "object") {
|
|
1495
|
+
Object.entries(format).forEach(([key, value2]) => {
|
|
1496
|
+
interpolatedFormat[key] = formatMessage(value2);
|
|
1492
1497
|
});
|
|
1493
1498
|
} else {
|
|
1494
1499
|
interpolatedFormat = format;
|
|
1495
1500
|
}
|
|
1496
|
-
const
|
|
1501
|
+
const formatter = formatters[type];
|
|
1502
|
+
const value = formatter(values[name], interpolatedFormat);
|
|
1497
1503
|
if (value == null)
|
|
1498
1504
|
return message2;
|
|
1499
1505
|
return message2 + value;
|
|
@@ -1505,7 +1511,7 @@ function interpolate(translation, locale, locales) {
|
|
|
1505
1511
|
}
|
|
1506
1512
|
if (isString(result))
|
|
1507
1513
|
return result.trim();
|
|
1508
|
-
return result;
|
|
1514
|
+
return result ? String(result) : "";
|
|
1509
1515
|
};
|
|
1510
1516
|
}
|
|
1511
1517
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -1519,25 +1525,29 @@ var EventEmitter = class {
|
|
|
1519
1525
|
__publicField$1(this, "_events", {});
|
|
1520
1526
|
}
|
|
1521
1527
|
on(event, listener) {
|
|
1522
|
-
|
|
1523
|
-
|
|
1528
|
+
var _a2;
|
|
1529
|
+
var _a;
|
|
1530
|
+
(_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
|
|
1524
1531
|
this._events[event].push(listener);
|
|
1525
1532
|
return () => this.removeListener(event, listener);
|
|
1526
1533
|
}
|
|
1527
1534
|
removeListener(event, listener) {
|
|
1528
|
-
|
|
1535
|
+
const maybeListeners = this._getListeners(event);
|
|
1536
|
+
if (!maybeListeners)
|
|
1529
1537
|
return;
|
|
1530
|
-
const index =
|
|
1538
|
+
const index = maybeListeners.indexOf(listener);
|
|
1531
1539
|
if (~index)
|
|
1532
|
-
|
|
1540
|
+
maybeListeners.splice(index, 1);
|
|
1533
1541
|
}
|
|
1534
1542
|
emit(event, ...args) {
|
|
1535
|
-
|
|
1543
|
+
const maybeListeners = this._getListeners(event);
|
|
1544
|
+
if (!maybeListeners)
|
|
1536
1545
|
return;
|
|
1537
|
-
|
|
1546
|
+
maybeListeners.map((listener) => listener.apply(this, args));
|
|
1538
1547
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1548
|
+
_getListeners(event) {
|
|
1549
|
+
const maybeListeners = this._events[event];
|
|
1550
|
+
return Array.isArray(maybeListeners) ? maybeListeners : false;
|
|
1541
1551
|
}
|
|
1542
1552
|
};
|
|
1543
1553
|
var __defProp2 = Object.defineProperty;
|
|
@@ -1548,23 +1558,22 @@ var __publicField2 = (obj, key, value) => {
|
|
|
1548
1558
|
};
|
|
1549
1559
|
var I18n = class extends EventEmitter {
|
|
1550
1560
|
constructor(params) {
|
|
1561
|
+
var _a;
|
|
1551
1562
|
super();
|
|
1552
|
-
__publicField2(this, "_locale");
|
|
1563
|
+
__publicField2(this, "_locale", "");
|
|
1553
1564
|
__publicField2(this, "_locales");
|
|
1554
|
-
__publicField2(this, "_localeData");
|
|
1555
|
-
__publicField2(this, "_messages");
|
|
1565
|
+
__publicField2(this, "_localeData", {});
|
|
1566
|
+
__publicField2(this, "_messages", {});
|
|
1556
1567
|
__publicField2(this, "_missing");
|
|
1557
1568
|
__publicField2(this, "t", this._.bind(this));
|
|
1558
|
-
this._messages = {};
|
|
1559
|
-
this._localeData = {};
|
|
1560
1569
|
if (params.missing != null)
|
|
1561
1570
|
this._missing = params.missing;
|
|
1562
1571
|
if (params.messages != null)
|
|
1563
1572
|
this.load(params.messages);
|
|
1564
1573
|
if (params.localeData != null)
|
|
1565
1574
|
this.loadLocaleData(params.localeData);
|
|
1566
|
-
if (params.locale
|
|
1567
|
-
this.activate(params.locale, params.locales);
|
|
1575
|
+
if (typeof params.locale === "string" || params.locales) {
|
|
1576
|
+
this.activate((_a = params.locale) != null ? _a : defaultLocale, params.locales);
|
|
1568
1577
|
}
|
|
1569
1578
|
}
|
|
1570
1579
|
get locale() {
|
|
@@ -1585,15 +1594,17 @@ var I18n = class extends EventEmitter {
|
|
|
1585
1594
|
return (_a = this._localeData[this._locale]) != null ? _a : {};
|
|
1586
1595
|
}
|
|
1587
1596
|
_loadLocaleData(locale, localeData) {
|
|
1588
|
-
|
|
1597
|
+
const maybeLocaleData = this._localeData[locale];
|
|
1598
|
+
if (!maybeLocaleData) {
|
|
1589
1599
|
this._localeData[locale] = localeData;
|
|
1590
1600
|
} else {
|
|
1591
|
-
Object.assign(
|
|
1601
|
+
Object.assign(maybeLocaleData, localeData);
|
|
1592
1602
|
}
|
|
1593
1603
|
}
|
|
1594
1604
|
/**
|
|
1595
1605
|
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1596
1606
|
*/
|
|
1607
|
+
// @ts-ignore deprecated, so ignore the reported error
|
|
1597
1608
|
loadLocaleData(localeOrAllData, localeData) {
|
|
1598
1609
|
if (localeData != null) {
|
|
1599
1610
|
this._loadLocaleData(localeOrAllData, localeData);
|
|
@@ -1605,18 +1616,19 @@ var I18n = class extends EventEmitter {
|
|
|
1605
1616
|
this.emit("change");
|
|
1606
1617
|
}
|
|
1607
1618
|
_load(locale, messages10) {
|
|
1608
|
-
|
|
1619
|
+
const maybeMessages = this._messages[locale];
|
|
1620
|
+
if (!maybeMessages) {
|
|
1609
1621
|
this._messages[locale] = messages10;
|
|
1610
1622
|
} else {
|
|
1611
|
-
Object.assign(
|
|
1623
|
+
Object.assign(maybeMessages, messages10);
|
|
1612
1624
|
}
|
|
1613
1625
|
}
|
|
1614
1626
|
load(localeOrMessages, messages10) {
|
|
1615
|
-
if (messages10
|
|
1627
|
+
if (typeof localeOrMessages == "string" && typeof messages10 === "object") {
|
|
1616
1628
|
this._load(localeOrMessages, messages10);
|
|
1617
1629
|
} else {
|
|
1618
|
-
Object.
|
|
1619
|
-
(locale) => this._load(locale,
|
|
1630
|
+
Object.entries(localeOrMessages).forEach(
|
|
1631
|
+
([locale, messages25]) => this._load(locale, messages25)
|
|
1620
1632
|
);
|
|
1621
1633
|
}
|
|
1622
1634
|
this.emit("change");
|
|
@@ -1640,13 +1652,15 @@ var I18n = class extends EventEmitter {
|
|
|
1640
1652
|
this._locales = locales;
|
|
1641
1653
|
this.emit("change");
|
|
1642
1654
|
}
|
|
1643
|
-
_(id, values
|
|
1655
|
+
_(id, values, options) {
|
|
1656
|
+
let message = options == null ? void 0 : options.message;
|
|
1644
1657
|
if (!isString(id)) {
|
|
1645
1658
|
values = id.values || values;
|
|
1646
1659
|
message = id.message;
|
|
1647
1660
|
id = id.id;
|
|
1648
1661
|
}
|
|
1649
|
-
const
|
|
1662
|
+
const messageForId = this.messages[id];
|
|
1663
|
+
const messageMissing = messageForId === void 0;
|
|
1650
1664
|
const missing = this._missing;
|
|
1651
1665
|
if (missing && messageMissing) {
|
|
1652
1666
|
return isFunction(missing) ? missing(this._locale, id) : missing;
|
|
@@ -1654,7 +1668,7 @@ var I18n = class extends EventEmitter {
|
|
|
1654
1668
|
if (messageMissing) {
|
|
1655
1669
|
this.emit("missing", { id, locale: this._locale });
|
|
1656
1670
|
}
|
|
1657
|
-
let translation =
|
|
1671
|
+
let translation = messageForId || message || id;
|
|
1658
1672
|
if (true) {
|
|
1659
1673
|
translation = isString(translation) ? compileMessage(translation) : translation;
|
|
1660
1674
|
}
|
|
@@ -1666,7 +1680,7 @@ var I18n = class extends EventEmitter {
|
|
|
1666
1680
|
translation,
|
|
1667
1681
|
this._locale,
|
|
1668
1682
|
this._locales
|
|
1669
|
-
)(values, formats);
|
|
1683
|
+
)(values, options == null ? void 0 : options.formats);
|
|
1670
1684
|
}
|
|
1671
1685
|
date(value, format) {
|
|
1672
1686
|
return date(this._locales || this._locale, value, format);
|
|
@@ -1680,28 +1694,69 @@ function setupI18n(params = {}) {
|
|
|
1680
1694
|
}
|
|
1681
1695
|
var i18n = setupI18n();
|
|
1682
1696
|
|
|
1683
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1684
|
-
var messages = JSON.parse('{"icon.title.
|
|
1685
|
-
var messages2 = JSON.parse('{"icon.title.
|
|
1686
|
-
var messages3 = JSON.parse('{"icon.title.
|
|
1687
|
-
var supportedLocales = ["en", "nb", "fi"];
|
|
1688
|
-
var
|
|
1697
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/warning-16.js
|
|
1698
|
+
var messages = JSON.parse('{"icon.title.warning":"Varseltrekant med utropstegn"}');
|
|
1699
|
+
var messages2 = JSON.parse('{"icon.title.warning":"Warning triangle with exclamation point"}');
|
|
1700
|
+
var messages3 = JSON.parse('{"icon.title.warning":"Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
|
|
1701
|
+
var supportedLocales = ["en", "nb", "fi", "da", "sv"];
|
|
1702
|
+
var defaultLocale2 = "en";
|
|
1703
|
+
var detectByBrand = () => {
|
|
1704
|
+
let value;
|
|
1705
|
+
switch (process.env.NMP_BRAND) {
|
|
1706
|
+
case "FINN":
|
|
1707
|
+
value = "nb";
|
|
1708
|
+
break;
|
|
1709
|
+
case "TORI":
|
|
1710
|
+
value = "fi";
|
|
1711
|
+
break;
|
|
1712
|
+
case "BLOCKET":
|
|
1713
|
+
value = "sv";
|
|
1714
|
+
break;
|
|
1715
|
+
case "DBA":
|
|
1716
|
+
value = "da";
|
|
1717
|
+
break;
|
|
1718
|
+
default:
|
|
1719
|
+
value = "en";
|
|
1720
|
+
}
|
|
1721
|
+
return value;
|
|
1722
|
+
};
|
|
1723
|
+
var detectByHost = () => {
|
|
1724
|
+
var _a;
|
|
1725
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1726
|
+
if (hostname.includes("finn")) {
|
|
1727
|
+
return "nb";
|
|
1728
|
+
} else if (hostname.includes("tori")) {
|
|
1729
|
+
return "fi";
|
|
1730
|
+
} else if (hostname.includes("blocket")) {
|
|
1731
|
+
return "sv";
|
|
1732
|
+
} else if (hostname.includes("dba")) {
|
|
1733
|
+
return "da";
|
|
1734
|
+
} else {
|
|
1735
|
+
return defaultLocale2;
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1689
1738
|
var getSupportedLocale = (usedLocale) => {
|
|
1690
1739
|
return supportedLocales.find(
|
|
1691
1740
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1692
|
-
) ||
|
|
1741
|
+
) || detectByHost();
|
|
1693
1742
|
};
|
|
1694
1743
|
function detectLocale() {
|
|
1744
|
+
var _a;
|
|
1695
1745
|
if (typeof window === "undefined") {
|
|
1696
|
-
const serverLocale =
|
|
1746
|
+
const serverLocale = detectByBrand();
|
|
1697
1747
|
return getSupportedLocale(serverLocale);
|
|
1698
1748
|
}
|
|
1699
1749
|
try {
|
|
1700
|
-
const htmlLocale = document.documentElement.lang;
|
|
1701
|
-
|
|
1750
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1751
|
+
const hostLocale = detectByHost();
|
|
1752
|
+
if (!supportedLocales.includes(htmlLocale)) {
|
|
1753
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1754
|
+
return getSupportedLocale(hostLocale);
|
|
1755
|
+
}
|
|
1756
|
+
return getSupportedLocale(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1702
1757
|
} catch (e) {
|
|
1703
1758
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1704
|
-
return
|
|
1759
|
+
return defaultLocale2;
|
|
1705
1760
|
}
|
|
1706
1761
|
}
|
|
1707
1762
|
var getMessages = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1718,40 +1773,81 @@ var activateI18n = (enMessages, nbMessages, fiMessages) => {
|
|
|
1718
1773
|
i18n.activate(locale);
|
|
1719
1774
|
};
|
|
1720
1775
|
activateI18n(messages2, messages, messages3);
|
|
1721
|
-
var
|
|
1776
|
+
var IconWarning16 = class extends LitElement {
|
|
1722
1777
|
render() {
|
|
1723
|
-
const title = i18n.t({ message: `
|
|
1724
|
-
return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-
|
|
1778
|
+
const title = i18n.t({ message: `Warning triangle with exclamation point`, id: "icon.title.warning", comment: "Title for warning icon" });
|
|
1779
|
+
return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-warning-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" d="m.712 14.07 6.25-12.994a1 1 0 0 1 1.792-.022l6.635 12.995a1 1 0 0 1-.89 1.455H1.613a1 1 0 0 1-.902-1.434Z"></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M8 6v4.992M8 13v.333"></path></svg>`;
|
|
1725
1780
|
}
|
|
1726
1781
|
};
|
|
1727
|
-
if (!customElements.get("w-icon-
|
|
1728
|
-
customElements.define("w-icon-
|
|
1782
|
+
if (!customElements.get("w-icon-warning-16")) {
|
|
1783
|
+
customElements.define("w-icon-warning-16", IconWarning16);
|
|
1729
1784
|
}
|
|
1730
1785
|
|
|
1731
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1786
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/error-16.js
|
|
1732
1787
|
import { LitElement as LitElement2 } from "lit";
|
|
1733
1788
|
import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
|
|
1734
|
-
var messages4 = JSON.parse('{"icon.title.
|
|
1735
|
-
var messages22 = JSON.parse('{"icon.title.
|
|
1736
|
-
var messages32 = JSON.parse('{"icon.title.
|
|
1737
|
-
var supportedLocales2 = ["en", "nb", "fi"];
|
|
1738
|
-
var
|
|
1789
|
+
var messages4 = JSON.parse('{"icon.title.error":"\xC5ttekant med utropstegn"}');
|
|
1790
|
+
var messages22 = JSON.parse('{"icon.title.error":"Octagon with exclamation point"}');
|
|
1791
|
+
var messages32 = JSON.parse('{"icon.title.error":"Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
|
|
1792
|
+
var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
|
|
1793
|
+
var defaultLocale3 = "en";
|
|
1794
|
+
var detectByBrand2 = () => {
|
|
1795
|
+
let value;
|
|
1796
|
+
switch (process.env.NMP_BRAND) {
|
|
1797
|
+
case "FINN":
|
|
1798
|
+
value = "nb";
|
|
1799
|
+
break;
|
|
1800
|
+
case "TORI":
|
|
1801
|
+
value = "fi";
|
|
1802
|
+
break;
|
|
1803
|
+
case "BLOCKET":
|
|
1804
|
+
value = "sv";
|
|
1805
|
+
break;
|
|
1806
|
+
case "DBA":
|
|
1807
|
+
value = "da";
|
|
1808
|
+
break;
|
|
1809
|
+
default:
|
|
1810
|
+
value = "en";
|
|
1811
|
+
}
|
|
1812
|
+
return value;
|
|
1813
|
+
};
|
|
1814
|
+
var detectByHost2 = () => {
|
|
1815
|
+
var _a;
|
|
1816
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1817
|
+
if (hostname.includes("finn")) {
|
|
1818
|
+
return "nb";
|
|
1819
|
+
} else if (hostname.includes("tori")) {
|
|
1820
|
+
return "fi";
|
|
1821
|
+
} else if (hostname.includes("blocket")) {
|
|
1822
|
+
return "sv";
|
|
1823
|
+
} else if (hostname.includes("dba")) {
|
|
1824
|
+
return "da";
|
|
1825
|
+
} else {
|
|
1826
|
+
return defaultLocale3;
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1739
1829
|
var getSupportedLocale2 = (usedLocale) => {
|
|
1740
1830
|
return supportedLocales2.find(
|
|
1741
1831
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1742
|
-
) ||
|
|
1832
|
+
) || detectByHost2();
|
|
1743
1833
|
};
|
|
1744
1834
|
function detectLocale2() {
|
|
1835
|
+
var _a;
|
|
1745
1836
|
if (typeof window === "undefined") {
|
|
1746
|
-
const serverLocale =
|
|
1837
|
+
const serverLocale = detectByBrand2();
|
|
1747
1838
|
return getSupportedLocale2(serverLocale);
|
|
1748
1839
|
}
|
|
1749
1840
|
try {
|
|
1750
|
-
const htmlLocale = document.documentElement.lang;
|
|
1751
|
-
|
|
1841
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1842
|
+
const hostLocale = detectByHost2();
|
|
1843
|
+
if (!supportedLocales2.includes(htmlLocale)) {
|
|
1844
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1845
|
+
return getSupportedLocale2(hostLocale);
|
|
1846
|
+
}
|
|
1847
|
+
return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1752
1848
|
} catch (e) {
|
|
1753
1849
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1754
|
-
return
|
|
1850
|
+
return defaultLocale3;
|
|
1755
1851
|
}
|
|
1756
1852
|
}
|
|
1757
1853
|
var getMessages2 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1768,40 +1864,81 @@ var activateI18n2 = (enMessages, nbMessages, fiMessages) => {
|
|
|
1768
1864
|
i18n.activate(locale);
|
|
1769
1865
|
};
|
|
1770
1866
|
activateI18n2(messages22, messages4, messages32);
|
|
1771
|
-
var
|
|
1867
|
+
var IconError16 = class extends LitElement2 {
|
|
1772
1868
|
render() {
|
|
1773
|
-
const title = i18n.t({ message: `
|
|
1774
|
-
return html2`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-
|
|
1869
|
+
const title = i18n.t({ message: `Octagon with exclamation point`, id: "icon.title.error", comment: "Title for error icon" });
|
|
1870
|
+
return html2`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-error-16-part">${unsafeStatic2(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M.5 11.107 4.748 15.5h6.503l4.248-4.393V4.893L11.252.5H4.748L.5 4.893z"></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M8 11.398a.25.25 0 1 1 0-.5m0 .5a.25.25 0 1 0 0-.5"></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M8 8.5V3"></path></svg>`;
|
|
1775
1871
|
}
|
|
1776
1872
|
};
|
|
1777
|
-
if (!customElements.get("w-icon-
|
|
1778
|
-
customElements.define("w-icon-
|
|
1873
|
+
if (!customElements.get("w-icon-error-16")) {
|
|
1874
|
+
customElements.define("w-icon-error-16", IconError16);
|
|
1779
1875
|
}
|
|
1780
1876
|
|
|
1781
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1877
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/success-16.js
|
|
1782
1878
|
import { LitElement as LitElement3 } from "lit";
|
|
1783
1879
|
import { unsafeStatic as unsafeStatic3, html as html3 } from "lit/static-html.js";
|
|
1784
|
-
var messages5 = JSON.parse('{"icon.title.
|
|
1785
|
-
var messages23 = JSON.parse('{"icon.title.
|
|
1786
|
-
var messages33 = JSON.parse('{"icon.title.
|
|
1787
|
-
var supportedLocales3 = ["en", "nb", "fi"];
|
|
1788
|
-
var
|
|
1880
|
+
var messages5 = JSON.parse('{"icon.title.success":"Sirkel med sjekkmerke"}');
|
|
1881
|
+
var messages23 = JSON.parse('{"icon.title.success":"Circle with checkmark"}');
|
|
1882
|
+
var messages33 = JSON.parse('{"icon.title.success":"Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"}');
|
|
1883
|
+
var supportedLocales3 = ["en", "nb", "fi", "da", "sv"];
|
|
1884
|
+
var defaultLocale4 = "en";
|
|
1885
|
+
var detectByBrand3 = () => {
|
|
1886
|
+
let value;
|
|
1887
|
+
switch (process.env.NMP_BRAND) {
|
|
1888
|
+
case "FINN":
|
|
1889
|
+
value = "nb";
|
|
1890
|
+
break;
|
|
1891
|
+
case "TORI":
|
|
1892
|
+
value = "fi";
|
|
1893
|
+
break;
|
|
1894
|
+
case "BLOCKET":
|
|
1895
|
+
value = "sv";
|
|
1896
|
+
break;
|
|
1897
|
+
case "DBA":
|
|
1898
|
+
value = "da";
|
|
1899
|
+
break;
|
|
1900
|
+
default:
|
|
1901
|
+
value = "en";
|
|
1902
|
+
}
|
|
1903
|
+
return value;
|
|
1904
|
+
};
|
|
1905
|
+
var detectByHost3 = () => {
|
|
1906
|
+
var _a;
|
|
1907
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1908
|
+
if (hostname.includes("finn")) {
|
|
1909
|
+
return "nb";
|
|
1910
|
+
} else if (hostname.includes("tori")) {
|
|
1911
|
+
return "fi";
|
|
1912
|
+
} else if (hostname.includes("blocket")) {
|
|
1913
|
+
return "sv";
|
|
1914
|
+
} else if (hostname.includes("dba")) {
|
|
1915
|
+
return "da";
|
|
1916
|
+
} else {
|
|
1917
|
+
return defaultLocale4;
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1789
1920
|
var getSupportedLocale3 = (usedLocale) => {
|
|
1790
1921
|
return supportedLocales3.find(
|
|
1791
1922
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1792
|
-
) ||
|
|
1923
|
+
) || detectByHost3();
|
|
1793
1924
|
};
|
|
1794
1925
|
function detectLocale3() {
|
|
1926
|
+
var _a;
|
|
1795
1927
|
if (typeof window === "undefined") {
|
|
1796
|
-
const serverLocale =
|
|
1928
|
+
const serverLocale = detectByBrand3();
|
|
1797
1929
|
return getSupportedLocale3(serverLocale);
|
|
1798
1930
|
}
|
|
1799
1931
|
try {
|
|
1800
|
-
const htmlLocale = document.documentElement.lang;
|
|
1801
|
-
|
|
1932
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1933
|
+
const hostLocale = detectByHost3();
|
|
1934
|
+
if (!supportedLocales3.includes(htmlLocale)) {
|
|
1935
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1936
|
+
return getSupportedLocale3(hostLocale);
|
|
1937
|
+
}
|
|
1938
|
+
return getSupportedLocale3(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1802
1939
|
} catch (e) {
|
|
1803
1940
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1804
|
-
return
|
|
1941
|
+
return defaultLocale4;
|
|
1805
1942
|
}
|
|
1806
1943
|
}
|
|
1807
1944
|
var getMessages3 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1818,40 +1955,81 @@ var activateI18n3 = (enMessages, nbMessages, fiMessages) => {
|
|
|
1818
1955
|
i18n.activate(locale);
|
|
1819
1956
|
};
|
|
1820
1957
|
activateI18n3(messages23, messages5, messages33);
|
|
1821
|
-
var
|
|
1958
|
+
var IconSuccess16 = class extends LitElement3 {
|
|
1822
1959
|
render() {
|
|
1823
|
-
const title = i18n.t({ message: `
|
|
1824
|
-
return html3`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-
|
|
1960
|
+
const title = i18n.t({ message: `Circle with checkmark`, id: "icon.title.success", comment: "Title for success icon" });
|
|
1961
|
+
return html3`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-success-16-part">${unsafeStatic3(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="m4 8.815 1.633 2.318a.7.7 0 0 0 1.138.034l5.228-6.615"></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M.5 7.999a7.5 7.5 0 1 0 15 0 7.5 7.5 0 0 0-15 0"></path></svg>`;
|
|
1825
1962
|
}
|
|
1826
1963
|
};
|
|
1827
|
-
if (!customElements.get("w-icon-
|
|
1828
|
-
customElements.define("w-icon-
|
|
1964
|
+
if (!customElements.get("w-icon-success-16")) {
|
|
1965
|
+
customElements.define("w-icon-success-16", IconSuccess16);
|
|
1829
1966
|
}
|
|
1830
1967
|
|
|
1831
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1968
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
|
|
1832
1969
|
import { LitElement as LitElement4 } from "lit";
|
|
1833
1970
|
import { unsafeStatic as unsafeStatic4, html as html4 } from "lit/static-html.js";
|
|
1834
1971
|
var messages6 = JSON.parse('{"icon.title.close":"Kryss"}');
|
|
1835
1972
|
var messages24 = JSON.parse('{"icon.title.close":"Cross"}');
|
|
1836
1973
|
var messages34 = JSON.parse('{"icon.title.close":"Rasti"}');
|
|
1837
|
-
var supportedLocales4 = ["en", "nb", "fi"];
|
|
1838
|
-
var
|
|
1974
|
+
var supportedLocales4 = ["en", "nb", "fi", "da", "sv"];
|
|
1975
|
+
var defaultLocale5 = "en";
|
|
1976
|
+
var detectByBrand4 = () => {
|
|
1977
|
+
let value;
|
|
1978
|
+
switch (process.env.NMP_BRAND) {
|
|
1979
|
+
case "FINN":
|
|
1980
|
+
value = "nb";
|
|
1981
|
+
break;
|
|
1982
|
+
case "TORI":
|
|
1983
|
+
value = "fi";
|
|
1984
|
+
break;
|
|
1985
|
+
case "BLOCKET":
|
|
1986
|
+
value = "sv";
|
|
1987
|
+
break;
|
|
1988
|
+
case "DBA":
|
|
1989
|
+
value = "da";
|
|
1990
|
+
break;
|
|
1991
|
+
default:
|
|
1992
|
+
value = "en";
|
|
1993
|
+
}
|
|
1994
|
+
return value;
|
|
1995
|
+
};
|
|
1996
|
+
var detectByHost4 = () => {
|
|
1997
|
+
var _a;
|
|
1998
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1999
|
+
if (hostname.includes("finn")) {
|
|
2000
|
+
return "nb";
|
|
2001
|
+
} else if (hostname.includes("tori")) {
|
|
2002
|
+
return "fi";
|
|
2003
|
+
} else if (hostname.includes("blocket")) {
|
|
2004
|
+
return "sv";
|
|
2005
|
+
} else if (hostname.includes("dba")) {
|
|
2006
|
+
return "da";
|
|
2007
|
+
} else {
|
|
2008
|
+
return defaultLocale5;
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
1839
2011
|
var getSupportedLocale4 = (usedLocale) => {
|
|
1840
2012
|
return supportedLocales4.find(
|
|
1841
2013
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1842
|
-
) ||
|
|
2014
|
+
) || detectByHost4();
|
|
1843
2015
|
};
|
|
1844
2016
|
function detectLocale4() {
|
|
2017
|
+
var _a;
|
|
1845
2018
|
if (typeof window === "undefined") {
|
|
1846
|
-
const serverLocale =
|
|
2019
|
+
const serverLocale = detectByBrand4();
|
|
1847
2020
|
return getSupportedLocale4(serverLocale);
|
|
1848
2021
|
}
|
|
1849
2022
|
try {
|
|
1850
|
-
const htmlLocale = document.documentElement.lang;
|
|
1851
|
-
|
|
2023
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
2024
|
+
const hostLocale = detectByHost4();
|
|
2025
|
+
if (!supportedLocales4.includes(htmlLocale)) {
|
|
2026
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
2027
|
+
return getSupportedLocale4(hostLocale);
|
|
2028
|
+
}
|
|
2029
|
+
return getSupportedLocale4(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1852
2030
|
} catch (e) {
|
|
1853
2031
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1854
|
-
return
|
|
2032
|
+
return defaultLocale5;
|
|
1855
2033
|
}
|
|
1856
2034
|
}
|
|
1857
2035
|
var getMessages4 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1871,7 +2049,7 @@ activateI18n4(messages24, messages6, messages34);
|
|
|
1871
2049
|
var IconClose16 = class extends LitElement4 {
|
|
1872
2050
|
render() {
|
|
1873
2051
|
const title = i18n.t({ message: `Cross`, id: "icon.title.close", comment: "Title for close icon" });
|
|
1874
|
-
return html4`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-close-16-part">${unsafeStatic4(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m12.5 3.5-9
|
|
2052
|
+
return html4`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-close-16-part">${unsafeStatic4(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m12.5 3.5-9 9m0-9 9 9"></path></svg>`;
|
|
1875
2053
|
}
|
|
1876
2054
|
};
|
|
1877
2055
|
if (!customElements.get("w-icon-close-16")) {
|
|
@@ -1889,11 +2067,11 @@ var messages9 = JSON.parse('{"toast.aria.error":"Error","toast.aria.successful":
|
|
|
1889
2067
|
|
|
1890
2068
|
// packages/i18n.ts
|
|
1891
2069
|
var supportedLocales5 = ["en", "nb", "fi"];
|
|
1892
|
-
var
|
|
2070
|
+
var defaultLocale6 = "en";
|
|
1893
2071
|
var getSupportedLocale5 = (usedLocale) => {
|
|
1894
2072
|
return supportedLocales5.find(
|
|
1895
2073
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1896
|
-
) ||
|
|
2074
|
+
) || defaultLocale6;
|
|
1897
2075
|
};
|
|
1898
2076
|
function detectLocale5() {
|
|
1899
2077
|
if (typeof window === "undefined") {
|
|
@@ -1905,7 +2083,7 @@ function detectLocale5() {
|
|
|
1905
2083
|
return getSupportedLocale5(htmlLocale);
|
|
1906
2084
|
} catch (e) {
|
|
1907
2085
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1908
|
-
return
|
|
2086
|
+
return defaultLocale6;
|
|
1909
2087
|
}
|
|
1910
2088
|
}
|
|
1911
2089
|
var getMessages5 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -2006,11 +2184,11 @@ var WarpToast = class extends WarpElement {
|
|
|
2006
2184
|
}
|
|
2007
2185
|
get _iconMarkup() {
|
|
2008
2186
|
if (this._warning)
|
|
2009
|
-
return html5`<w-icon-
|
|
2187
|
+
return html5`<w-icon-warning-16></w-icon-warning-16>`;
|
|
2010
2188
|
if (this._error)
|
|
2011
|
-
return html5`<w-icon-
|
|
2189
|
+
return html5`<w-icon-error-16></w-icon-error-16>`;
|
|
2012
2190
|
else
|
|
2013
|
-
return html5`<w-icon-
|
|
2191
|
+
return html5`<w-icon-success-16></w-icon-success-16>`;
|
|
2014
2192
|
}
|
|
2015
2193
|
async collapse() {
|
|
2016
2194
|
return new Promise((resolve) => {
|