@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
|
@@ -1028,7 +1028,7 @@ var require_parser = __commonJS({
|
|
|
1028
1028
|
import WarpElement from "@warp-ds/elements-core";
|
|
1029
1029
|
import { css, html as html5 } from "lit";
|
|
1030
1030
|
|
|
1031
|
-
// node_modules/.pnpm/@warp-ds+css@1.
|
|
1031
|
+
// node_modules/.pnpm/@warp-ds+css@1.7.0/node_modules/@warp-ds/css/component-classes/index.js
|
|
1032
1032
|
var box = {
|
|
1033
1033
|
box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
|
|
1034
1034
|
// Relative here enables w-clickable
|
|
@@ -1188,9 +1188,9 @@ var modal = {
|
|
|
1188
1188
|
content: "block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",
|
|
1189
1189
|
footer: "flex justify-end shrink-0 px-16 sm:px-32",
|
|
1190
1190
|
transitionTitle: "transition-all duration-300",
|
|
1191
|
-
transitionTitleCenter: "justify-self-center",
|
|
1191
|
+
transitionTitleCenter: "justify-self-center self-center",
|
|
1192
1192
|
transitionTitleColSpan: "col-span-2",
|
|
1193
|
-
title: "-mt-4 sm:-mt-8 h-40 sm:h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-
|
|
1193
|
+
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",
|
|
1194
1194
|
titleText: "mb-0 h4 sm:h3",
|
|
1195
1195
|
titleButton: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} sm:min-h-[44px] sm:min-w-[44px] min-h-[32px] min-w-[32px]`,
|
|
1196
1196
|
titleButtonLeft: "-ml-8 sm:-ml-12 justify-self-start",
|
|
@@ -1268,14 +1268,14 @@ var r = function() {
|
|
|
1268
1268
|
}, []).join(" ");
|
|
1269
1269
|
};
|
|
1270
1270
|
|
|
1271
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1271
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/info-16.js
|
|
1272
1272
|
import { LitElement } from "lit";
|
|
1273
1273
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
1274
1274
|
|
|
1275
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1275
|
+
// node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
|
|
1276
1276
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1277
1277
|
|
|
1278
|
-
// node_modules/.pnpm/@lingui+message-utils@4.
|
|
1278
|
+
// node_modules/.pnpm/@lingui+message-utils@4.7.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1279
1279
|
var import_parser = __toESM(require_parser(), 1);
|
|
1280
1280
|
function processTokens(tokens, mapText) {
|
|
1281
1281
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
@@ -1325,13 +1325,14 @@ Message: ${message}`);
|
|
|
1325
1325
|
}
|
|
1326
1326
|
}
|
|
1327
1327
|
|
|
1328
|
-
// node_modules/.pnpm/@lingui+core@4.
|
|
1328
|
+
// node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
|
|
1329
1329
|
var isString = (s) => typeof s === "string";
|
|
1330
1330
|
var isFunction = (f) => typeof f === "function";
|
|
1331
1331
|
var cache = /* @__PURE__ */ new Map();
|
|
1332
|
+
var defaultLocale = "en";
|
|
1332
1333
|
function normalizeLocales(locales) {
|
|
1333
1334
|
const out = Array.isArray(locales) ? locales : [locales];
|
|
1334
|
-
return [...out,
|
|
1335
|
+
return [...out, defaultLocale];
|
|
1335
1336
|
}
|
|
1336
1337
|
function date(locales, value, format) {
|
|
1337
1338
|
const _locales = normalizeLocales(locales);
|
|
@@ -1376,11 +1377,13 @@ function cacheKey(type, locales, options) {
|
|
|
1376
1377
|
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1377
1378
|
}
|
|
1378
1379
|
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
|
|
1379
|
-
var getDefaultFormats = (locale,
|
|
1380
|
-
locales =
|
|
1381
|
-
const style = (format) =>
|
|
1380
|
+
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1381
|
+
const locales = passedLocales || locale;
|
|
1382
|
+
const style = (format) => {
|
|
1383
|
+
return typeof format === "object" ? format : formats[format] || { style: format };
|
|
1384
|
+
};
|
|
1382
1385
|
const replaceOctothorpe = (value, message) => {
|
|
1383
|
-
const numberFormat = Object.keys(formats).length ? style("number") :
|
|
1386
|
+
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
1384
1387
|
const valueStr = number(locales, value, numberFormat);
|
|
1385
1388
|
return message.replace("#", valueStr);
|
|
1386
1389
|
};
|
|
@@ -1395,17 +1398,19 @@ var getDefaultFormats = (locale, locales, formats = {}) => {
|
|
|
1395
1398
|
const message = plural(locales, true, value, cases);
|
|
1396
1399
|
return replaceOctothorpe(value - offset, message);
|
|
1397
1400
|
},
|
|
1398
|
-
select:
|
|
1399
|
-
var _a;
|
|
1400
|
-
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1401
|
-
},
|
|
1401
|
+
select: selectFormatter,
|
|
1402
1402
|
number: (value, format) => number(locales, value, style(format)),
|
|
1403
1403
|
date: (value, format) => date(locales, value, style(format)),
|
|
1404
|
-
undefined:
|
|
1404
|
+
undefined: undefinedFormatter
|
|
1405
1405
|
};
|
|
1406
1406
|
};
|
|
1407
|
+
var selectFormatter = (value, rules) => {
|
|
1408
|
+
var _a;
|
|
1409
|
+
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1410
|
+
};
|
|
1411
|
+
var undefinedFormatter = (value) => value;
|
|
1407
1412
|
function interpolate(translation, locale, locales) {
|
|
1408
|
-
return (values
|
|
1413
|
+
return (values = {}, formats) => {
|
|
1409
1414
|
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1410
1415
|
const formatMessage = (message) => {
|
|
1411
1416
|
if (!Array.isArray(message))
|
|
@@ -1415,14 +1420,15 @@ function interpolate(translation, locale, locales) {
|
|
|
1415
1420
|
return message2 + token;
|
|
1416
1421
|
const [name, type, format] = token;
|
|
1417
1422
|
let interpolatedFormat = {};
|
|
1418
|
-
if (format != null &&
|
|
1419
|
-
Object.
|
|
1420
|
-
interpolatedFormat[key] = formatMessage(
|
|
1423
|
+
if (format != null && typeof format === "object") {
|
|
1424
|
+
Object.entries(format).forEach(([key, value2]) => {
|
|
1425
|
+
interpolatedFormat[key] = formatMessage(value2);
|
|
1421
1426
|
});
|
|
1422
1427
|
} else {
|
|
1423
1428
|
interpolatedFormat = format;
|
|
1424
1429
|
}
|
|
1425
|
-
const
|
|
1430
|
+
const formatter = formatters[type];
|
|
1431
|
+
const value = formatter(values[name], interpolatedFormat);
|
|
1426
1432
|
if (value == null)
|
|
1427
1433
|
return message2;
|
|
1428
1434
|
return message2 + value;
|
|
@@ -1434,7 +1440,7 @@ function interpolate(translation, locale, locales) {
|
|
|
1434
1440
|
}
|
|
1435
1441
|
if (isString(result))
|
|
1436
1442
|
return result.trim();
|
|
1437
|
-
return result;
|
|
1443
|
+
return result ? String(result) : "";
|
|
1438
1444
|
};
|
|
1439
1445
|
}
|
|
1440
1446
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -1448,25 +1454,29 @@ var EventEmitter = class {
|
|
|
1448
1454
|
__publicField$1(this, "_events", {});
|
|
1449
1455
|
}
|
|
1450
1456
|
on(event, listener) {
|
|
1451
|
-
|
|
1452
|
-
|
|
1457
|
+
var _a2;
|
|
1458
|
+
var _a;
|
|
1459
|
+
(_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
|
|
1453
1460
|
this._events[event].push(listener);
|
|
1454
1461
|
return () => this.removeListener(event, listener);
|
|
1455
1462
|
}
|
|
1456
1463
|
removeListener(event, listener) {
|
|
1457
|
-
|
|
1464
|
+
const maybeListeners = this._getListeners(event);
|
|
1465
|
+
if (!maybeListeners)
|
|
1458
1466
|
return;
|
|
1459
|
-
const index =
|
|
1467
|
+
const index = maybeListeners.indexOf(listener);
|
|
1460
1468
|
if (~index)
|
|
1461
|
-
|
|
1469
|
+
maybeListeners.splice(index, 1);
|
|
1462
1470
|
}
|
|
1463
1471
|
emit(event, ...args) {
|
|
1464
|
-
|
|
1472
|
+
const maybeListeners = this._getListeners(event);
|
|
1473
|
+
if (!maybeListeners)
|
|
1465
1474
|
return;
|
|
1466
|
-
|
|
1475
|
+
maybeListeners.map((listener) => listener.apply(this, args));
|
|
1467
1476
|
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1477
|
+
_getListeners(event) {
|
|
1478
|
+
const maybeListeners = this._events[event];
|
|
1479
|
+
return Array.isArray(maybeListeners) ? maybeListeners : false;
|
|
1470
1480
|
}
|
|
1471
1481
|
};
|
|
1472
1482
|
var __defProp2 = Object.defineProperty;
|
|
@@ -1477,23 +1487,22 @@ var __publicField2 = (obj, key, value) => {
|
|
|
1477
1487
|
};
|
|
1478
1488
|
var I18n = class extends EventEmitter {
|
|
1479
1489
|
constructor(params) {
|
|
1490
|
+
var _a;
|
|
1480
1491
|
super();
|
|
1481
|
-
__publicField2(this, "_locale");
|
|
1492
|
+
__publicField2(this, "_locale", "");
|
|
1482
1493
|
__publicField2(this, "_locales");
|
|
1483
|
-
__publicField2(this, "_localeData");
|
|
1484
|
-
__publicField2(this, "_messages");
|
|
1494
|
+
__publicField2(this, "_localeData", {});
|
|
1495
|
+
__publicField2(this, "_messages", {});
|
|
1485
1496
|
__publicField2(this, "_missing");
|
|
1486
1497
|
__publicField2(this, "t", this._.bind(this));
|
|
1487
|
-
this._messages = {};
|
|
1488
|
-
this._localeData = {};
|
|
1489
1498
|
if (params.missing != null)
|
|
1490
1499
|
this._missing = params.missing;
|
|
1491
1500
|
if (params.messages != null)
|
|
1492
1501
|
this.load(params.messages);
|
|
1493
1502
|
if (params.localeData != null)
|
|
1494
1503
|
this.loadLocaleData(params.localeData);
|
|
1495
|
-
if (params.locale
|
|
1496
|
-
this.activate(params.locale, params.locales);
|
|
1504
|
+
if (typeof params.locale === "string" || params.locales) {
|
|
1505
|
+
this.activate((_a = params.locale) != null ? _a : defaultLocale, params.locales);
|
|
1497
1506
|
}
|
|
1498
1507
|
}
|
|
1499
1508
|
get locale() {
|
|
@@ -1514,15 +1523,17 @@ var I18n = class extends EventEmitter {
|
|
|
1514
1523
|
return (_a = this._localeData[this._locale]) != null ? _a : {};
|
|
1515
1524
|
}
|
|
1516
1525
|
_loadLocaleData(locale, localeData) {
|
|
1517
|
-
|
|
1526
|
+
const maybeLocaleData = this._localeData[locale];
|
|
1527
|
+
if (!maybeLocaleData) {
|
|
1518
1528
|
this._localeData[locale] = localeData;
|
|
1519
1529
|
} else {
|
|
1520
|
-
Object.assign(
|
|
1530
|
+
Object.assign(maybeLocaleData, localeData);
|
|
1521
1531
|
}
|
|
1522
1532
|
}
|
|
1523
1533
|
/**
|
|
1524
1534
|
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1525
1535
|
*/
|
|
1536
|
+
// @ts-ignore deprecated, so ignore the reported error
|
|
1526
1537
|
loadLocaleData(localeOrAllData, localeData) {
|
|
1527
1538
|
if (localeData != null) {
|
|
1528
1539
|
this._loadLocaleData(localeOrAllData, localeData);
|
|
@@ -1534,18 +1545,19 @@ var I18n = class extends EventEmitter {
|
|
|
1534
1545
|
this.emit("change");
|
|
1535
1546
|
}
|
|
1536
1547
|
_load(locale, messages7) {
|
|
1537
|
-
|
|
1548
|
+
const maybeMessages = this._messages[locale];
|
|
1549
|
+
if (!maybeMessages) {
|
|
1538
1550
|
this._messages[locale] = messages7;
|
|
1539
1551
|
} else {
|
|
1540
|
-
Object.assign(
|
|
1552
|
+
Object.assign(maybeMessages, messages7);
|
|
1541
1553
|
}
|
|
1542
1554
|
}
|
|
1543
1555
|
load(localeOrMessages, messages7) {
|
|
1544
|
-
if (messages7
|
|
1556
|
+
if (typeof localeOrMessages == "string" && typeof messages7 === "object") {
|
|
1545
1557
|
this._load(localeOrMessages, messages7);
|
|
1546
1558
|
} else {
|
|
1547
|
-
Object.
|
|
1548
|
-
(locale) => this._load(locale,
|
|
1559
|
+
Object.entries(localeOrMessages).forEach(
|
|
1560
|
+
([locale, messages25]) => this._load(locale, messages25)
|
|
1549
1561
|
);
|
|
1550
1562
|
}
|
|
1551
1563
|
this.emit("change");
|
|
@@ -1569,13 +1581,15 @@ var I18n = class extends EventEmitter {
|
|
|
1569
1581
|
this._locales = locales;
|
|
1570
1582
|
this.emit("change");
|
|
1571
1583
|
}
|
|
1572
|
-
_(id, values
|
|
1584
|
+
_(id, values, options) {
|
|
1585
|
+
let message = options == null ? void 0 : options.message;
|
|
1573
1586
|
if (!isString(id)) {
|
|
1574
1587
|
values = id.values || values;
|
|
1575
1588
|
message = id.message;
|
|
1576
1589
|
id = id.id;
|
|
1577
1590
|
}
|
|
1578
|
-
const
|
|
1591
|
+
const messageForId = this.messages[id];
|
|
1592
|
+
const messageMissing = messageForId === void 0;
|
|
1579
1593
|
const missing = this._missing;
|
|
1580
1594
|
if (missing && messageMissing) {
|
|
1581
1595
|
return isFunction(missing) ? missing(this._locale, id) : missing;
|
|
@@ -1583,7 +1597,7 @@ var I18n = class extends EventEmitter {
|
|
|
1583
1597
|
if (messageMissing) {
|
|
1584
1598
|
this.emit("missing", { id, locale: this._locale });
|
|
1585
1599
|
}
|
|
1586
|
-
let translation =
|
|
1600
|
+
let translation = messageForId || message || id;
|
|
1587
1601
|
if (true) {
|
|
1588
1602
|
translation = isString(translation) ? compileMessage(translation) : translation;
|
|
1589
1603
|
}
|
|
@@ -1595,7 +1609,7 @@ var I18n = class extends EventEmitter {
|
|
|
1595
1609
|
translation,
|
|
1596
1610
|
this._locale,
|
|
1597
1611
|
this._locales
|
|
1598
|
-
)(values, formats);
|
|
1612
|
+
)(values, options == null ? void 0 : options.formats);
|
|
1599
1613
|
}
|
|
1600
1614
|
date(value, format) {
|
|
1601
1615
|
return date(this._locales || this._locale, value, format);
|
|
@@ -1609,28 +1623,69 @@ function setupI18n(params = {}) {
|
|
|
1609
1623
|
}
|
|
1610
1624
|
var i18n = setupI18n();
|
|
1611
1625
|
|
|
1612
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1613
|
-
var messages = JSON.parse('{"icon.title.
|
|
1614
|
-
var messages2 = JSON.parse('{"icon.title.
|
|
1615
|
-
var messages3 = JSON.parse('{"icon.title.
|
|
1616
|
-
var supportedLocales = ["en", "nb", "fi"];
|
|
1617
|
-
var
|
|
1626
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/info-16.js
|
|
1627
|
+
var messages = JSON.parse('{"icon.title.info":"Informasjonssirkel"}');
|
|
1628
|
+
var messages2 = JSON.parse('{"icon.title.info":"Information circle"}');
|
|
1629
|
+
var messages3 = JSON.parse('{"icon.title.info":"Ympyr\xE4, jonka sis\xE4ll\xE4 on i-kirjain"}');
|
|
1630
|
+
var supportedLocales = ["en", "nb", "fi", "da", "sv"];
|
|
1631
|
+
var defaultLocale2 = "en";
|
|
1632
|
+
var detectByBrand = () => {
|
|
1633
|
+
let value;
|
|
1634
|
+
switch (process.env.NMP_BRAND) {
|
|
1635
|
+
case "FINN":
|
|
1636
|
+
value = "nb";
|
|
1637
|
+
break;
|
|
1638
|
+
case "TORI":
|
|
1639
|
+
value = "fi";
|
|
1640
|
+
break;
|
|
1641
|
+
case "BLOCKET":
|
|
1642
|
+
value = "sv";
|
|
1643
|
+
break;
|
|
1644
|
+
case "DBA":
|
|
1645
|
+
value = "da";
|
|
1646
|
+
break;
|
|
1647
|
+
default:
|
|
1648
|
+
value = "en";
|
|
1649
|
+
}
|
|
1650
|
+
return value;
|
|
1651
|
+
};
|
|
1652
|
+
var detectByHost = () => {
|
|
1653
|
+
var _a;
|
|
1654
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1655
|
+
if (hostname.includes("finn")) {
|
|
1656
|
+
return "nb";
|
|
1657
|
+
} else if (hostname.includes("tori")) {
|
|
1658
|
+
return "fi";
|
|
1659
|
+
} else if (hostname.includes("blocket")) {
|
|
1660
|
+
return "sv";
|
|
1661
|
+
} else if (hostname.includes("dba")) {
|
|
1662
|
+
return "da";
|
|
1663
|
+
} else {
|
|
1664
|
+
return defaultLocale2;
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1618
1667
|
var getSupportedLocale = (usedLocale) => {
|
|
1619
1668
|
return supportedLocales.find(
|
|
1620
1669
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1621
|
-
) ||
|
|
1670
|
+
) || detectByHost();
|
|
1622
1671
|
};
|
|
1623
1672
|
function detectLocale() {
|
|
1673
|
+
var _a;
|
|
1624
1674
|
if (typeof window === "undefined") {
|
|
1625
|
-
const serverLocale =
|
|
1675
|
+
const serverLocale = detectByBrand();
|
|
1626
1676
|
return getSupportedLocale(serverLocale);
|
|
1627
1677
|
}
|
|
1628
1678
|
try {
|
|
1629
|
-
const htmlLocale = document.documentElement.lang;
|
|
1630
|
-
|
|
1679
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1680
|
+
const hostLocale = detectByHost();
|
|
1681
|
+
if (!supportedLocales.includes(htmlLocale)) {
|
|
1682
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1683
|
+
return getSupportedLocale(hostLocale);
|
|
1684
|
+
}
|
|
1685
|
+
return getSupportedLocale(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1631
1686
|
} catch (e) {
|
|
1632
1687
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1633
|
-
return
|
|
1688
|
+
return defaultLocale2;
|
|
1634
1689
|
}
|
|
1635
1690
|
}
|
|
1636
1691
|
var getMessages = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1647,40 +1702,81 @@ var activateI18n = (enMessages, nbMessages, fiMessages) => {
|
|
|
1647
1702
|
i18n.activate(locale);
|
|
1648
1703
|
};
|
|
1649
1704
|
activateI18n(messages2, messages, messages3);
|
|
1650
|
-
var
|
|
1705
|
+
var IconInfo16 = class extends LitElement {
|
|
1651
1706
|
render() {
|
|
1652
|
-
const title = i18n.t({ message: `
|
|
1653
|
-
return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-
|
|
1707
|
+
const title = i18n.t({ message: `Information circle`, id: "icon.title.info", comment: "Title for info icon" });
|
|
1708
|
+
return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-info-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" d="M8 6.5v5"></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M8 4v.5"></path><path stroke="currentColor" stroke-miterlimit="10" d="M8 .5a7.5 7.5 0 1 1 0 15 7.5 7.5 0 0 1 0-15Z"></path></svg>`;
|
|
1654
1709
|
}
|
|
1655
1710
|
};
|
|
1656
|
-
if (!customElements.get("w-icon-
|
|
1657
|
-
customElements.define("w-icon-
|
|
1711
|
+
if (!customElements.get("w-icon-info-16")) {
|
|
1712
|
+
customElements.define("w-icon-info-16", IconInfo16);
|
|
1658
1713
|
}
|
|
1659
1714
|
|
|
1660
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1715
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/warning-16.js
|
|
1661
1716
|
import { LitElement as LitElement2 } from "lit";
|
|
1662
1717
|
import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
|
|
1663
|
-
var messages4 = JSON.parse('{"icon.title.
|
|
1664
|
-
var messages22 = JSON.parse('{"icon.title.
|
|
1665
|
-
var messages32 = JSON.parse('{"icon.title.
|
|
1666
|
-
var supportedLocales2 = ["en", "nb", "fi"];
|
|
1667
|
-
var
|
|
1718
|
+
var messages4 = JSON.parse('{"icon.title.warning":"Varseltrekant med utropstegn"}');
|
|
1719
|
+
var messages22 = JSON.parse('{"icon.title.warning":"Warning triangle with exclamation point"}');
|
|
1720
|
+
var messages32 = JSON.parse('{"icon.title.warning":"Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
|
|
1721
|
+
var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
|
|
1722
|
+
var defaultLocale3 = "en";
|
|
1723
|
+
var detectByBrand2 = () => {
|
|
1724
|
+
let value;
|
|
1725
|
+
switch (process.env.NMP_BRAND) {
|
|
1726
|
+
case "FINN":
|
|
1727
|
+
value = "nb";
|
|
1728
|
+
break;
|
|
1729
|
+
case "TORI":
|
|
1730
|
+
value = "fi";
|
|
1731
|
+
break;
|
|
1732
|
+
case "BLOCKET":
|
|
1733
|
+
value = "sv";
|
|
1734
|
+
break;
|
|
1735
|
+
case "DBA":
|
|
1736
|
+
value = "da";
|
|
1737
|
+
break;
|
|
1738
|
+
default:
|
|
1739
|
+
value = "en";
|
|
1740
|
+
}
|
|
1741
|
+
return value;
|
|
1742
|
+
};
|
|
1743
|
+
var detectByHost2 = () => {
|
|
1744
|
+
var _a;
|
|
1745
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1746
|
+
if (hostname.includes("finn")) {
|
|
1747
|
+
return "nb";
|
|
1748
|
+
} else if (hostname.includes("tori")) {
|
|
1749
|
+
return "fi";
|
|
1750
|
+
} else if (hostname.includes("blocket")) {
|
|
1751
|
+
return "sv";
|
|
1752
|
+
} else if (hostname.includes("dba")) {
|
|
1753
|
+
return "da";
|
|
1754
|
+
} else {
|
|
1755
|
+
return defaultLocale3;
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1668
1758
|
var getSupportedLocale2 = (usedLocale) => {
|
|
1669
1759
|
return supportedLocales2.find(
|
|
1670
1760
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1671
|
-
) ||
|
|
1761
|
+
) || detectByHost2();
|
|
1672
1762
|
};
|
|
1673
1763
|
function detectLocale2() {
|
|
1764
|
+
var _a;
|
|
1674
1765
|
if (typeof window === "undefined") {
|
|
1675
|
-
const serverLocale =
|
|
1766
|
+
const serverLocale = detectByBrand2();
|
|
1676
1767
|
return getSupportedLocale2(serverLocale);
|
|
1677
1768
|
}
|
|
1678
1769
|
try {
|
|
1679
|
-
const htmlLocale = document.documentElement.lang;
|
|
1680
|
-
|
|
1770
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1771
|
+
const hostLocale = detectByHost2();
|
|
1772
|
+
if (!supportedLocales2.includes(htmlLocale)) {
|
|
1773
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1774
|
+
return getSupportedLocale2(hostLocale);
|
|
1775
|
+
}
|
|
1776
|
+
return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1681
1777
|
} catch (e) {
|
|
1682
1778
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1683
|
-
return
|
|
1779
|
+
return defaultLocale3;
|
|
1684
1780
|
}
|
|
1685
1781
|
}
|
|
1686
1782
|
var getMessages2 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1697,40 +1793,81 @@ var activateI18n2 = (enMessages, nbMessages, fiMessages) => {
|
|
|
1697
1793
|
i18n.activate(locale);
|
|
1698
1794
|
};
|
|
1699
1795
|
activateI18n2(messages22, messages4, messages32);
|
|
1700
|
-
var
|
|
1796
|
+
var IconWarning16 = class extends LitElement2 {
|
|
1701
1797
|
render() {
|
|
1702
|
-
const title = i18n.t({ message: `
|
|
1703
|
-
return html2`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-
|
|
1798
|
+
const title = i18n.t({ message: `Warning triangle with exclamation point`, id: "icon.title.warning", comment: "Title for warning icon" });
|
|
1799
|
+
return html2`<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">${unsafeStatic2(`<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>`;
|
|
1704
1800
|
}
|
|
1705
1801
|
};
|
|
1706
|
-
if (!customElements.get("w-icon-
|
|
1707
|
-
customElements.define("w-icon-
|
|
1802
|
+
if (!customElements.get("w-icon-warning-16")) {
|
|
1803
|
+
customElements.define("w-icon-warning-16", IconWarning16);
|
|
1708
1804
|
}
|
|
1709
1805
|
|
|
1710
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1806
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/error-16.js
|
|
1711
1807
|
import { LitElement as LitElement3 } from "lit";
|
|
1712
1808
|
import { unsafeStatic as unsafeStatic3, html as html3 } from "lit/static-html.js";
|
|
1713
|
-
var messages5 = JSON.parse('{"icon.title.
|
|
1714
|
-
var messages23 = JSON.parse('{"icon.title.
|
|
1715
|
-
var messages33 = JSON.parse('{"icon.title.
|
|
1716
|
-
var supportedLocales3 = ["en", "nb", "fi"];
|
|
1717
|
-
var
|
|
1809
|
+
var messages5 = JSON.parse('{"icon.title.error":"\xC5ttekant med utropstegn"}');
|
|
1810
|
+
var messages23 = JSON.parse('{"icon.title.error":"Octagon with exclamation point"}');
|
|
1811
|
+
var messages33 = JSON.parse('{"icon.title.error":"Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
|
|
1812
|
+
var supportedLocales3 = ["en", "nb", "fi", "da", "sv"];
|
|
1813
|
+
var defaultLocale4 = "en";
|
|
1814
|
+
var detectByBrand3 = () => {
|
|
1815
|
+
let value;
|
|
1816
|
+
switch (process.env.NMP_BRAND) {
|
|
1817
|
+
case "FINN":
|
|
1818
|
+
value = "nb";
|
|
1819
|
+
break;
|
|
1820
|
+
case "TORI":
|
|
1821
|
+
value = "fi";
|
|
1822
|
+
break;
|
|
1823
|
+
case "BLOCKET":
|
|
1824
|
+
value = "sv";
|
|
1825
|
+
break;
|
|
1826
|
+
case "DBA":
|
|
1827
|
+
value = "da";
|
|
1828
|
+
break;
|
|
1829
|
+
default:
|
|
1830
|
+
value = "en";
|
|
1831
|
+
}
|
|
1832
|
+
return value;
|
|
1833
|
+
};
|
|
1834
|
+
var detectByHost3 = () => {
|
|
1835
|
+
var _a;
|
|
1836
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1837
|
+
if (hostname.includes("finn")) {
|
|
1838
|
+
return "nb";
|
|
1839
|
+
} else if (hostname.includes("tori")) {
|
|
1840
|
+
return "fi";
|
|
1841
|
+
} else if (hostname.includes("blocket")) {
|
|
1842
|
+
return "sv";
|
|
1843
|
+
} else if (hostname.includes("dba")) {
|
|
1844
|
+
return "da";
|
|
1845
|
+
} else {
|
|
1846
|
+
return defaultLocale4;
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1718
1849
|
var getSupportedLocale3 = (usedLocale) => {
|
|
1719
1850
|
return supportedLocales3.find(
|
|
1720
1851
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1721
|
-
) ||
|
|
1852
|
+
) || detectByHost3();
|
|
1722
1853
|
};
|
|
1723
1854
|
function detectLocale3() {
|
|
1855
|
+
var _a;
|
|
1724
1856
|
if (typeof window === "undefined") {
|
|
1725
|
-
const serverLocale =
|
|
1857
|
+
const serverLocale = detectByBrand3();
|
|
1726
1858
|
return getSupportedLocale3(serverLocale);
|
|
1727
1859
|
}
|
|
1728
1860
|
try {
|
|
1729
|
-
const htmlLocale = document.documentElement.lang;
|
|
1730
|
-
|
|
1861
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1862
|
+
const hostLocale = detectByHost3();
|
|
1863
|
+
if (!supportedLocales3.includes(htmlLocale)) {
|
|
1864
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1865
|
+
return getSupportedLocale3(hostLocale);
|
|
1866
|
+
}
|
|
1867
|
+
return getSupportedLocale3(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1731
1868
|
} catch (e) {
|
|
1732
1869
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1733
|
-
return
|
|
1870
|
+
return defaultLocale4;
|
|
1734
1871
|
}
|
|
1735
1872
|
}
|
|
1736
1873
|
var getMessages3 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1747,40 +1884,81 @@ var activateI18n3 = (enMessages, nbMessages, fiMessages) => {
|
|
|
1747
1884
|
i18n.activate(locale);
|
|
1748
1885
|
};
|
|
1749
1886
|
activateI18n3(messages23, messages5, messages33);
|
|
1750
|
-
var
|
|
1887
|
+
var IconError16 = class extends LitElement3 {
|
|
1751
1888
|
render() {
|
|
1752
|
-
const title = i18n.t({ message: `
|
|
1753
|
-
return html3`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-
|
|
1889
|
+
const title = i18n.t({ message: `Octagon with exclamation point`, id: "icon.title.error", comment: "Title for error icon" });
|
|
1890
|
+
return html3`<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">${unsafeStatic3(`<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>`;
|
|
1754
1891
|
}
|
|
1755
1892
|
};
|
|
1756
|
-
if (!customElements.get("w-icon-
|
|
1757
|
-
customElements.define("w-icon-
|
|
1893
|
+
if (!customElements.get("w-icon-error-16")) {
|
|
1894
|
+
customElements.define("w-icon-error-16", IconError16);
|
|
1758
1895
|
}
|
|
1759
1896
|
|
|
1760
|
-
// node_modules/.pnpm/@warp-ds+icons@
|
|
1897
|
+
// node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/success-16.js
|
|
1761
1898
|
import { LitElement as LitElement4 } from "lit";
|
|
1762
1899
|
import { unsafeStatic as unsafeStatic4, html as html4 } from "lit/static-html.js";
|
|
1763
|
-
var messages6 = JSON.parse('{"icon.title.
|
|
1764
|
-
var messages24 = JSON.parse('{"icon.title.
|
|
1765
|
-
var messages34 = JSON.parse('{"icon.title.
|
|
1766
|
-
var supportedLocales4 = ["en", "nb", "fi"];
|
|
1767
|
-
var
|
|
1900
|
+
var messages6 = JSON.parse('{"icon.title.success":"Sirkel med sjekkmerke"}');
|
|
1901
|
+
var messages24 = JSON.parse('{"icon.title.success":"Circle with checkmark"}');
|
|
1902
|
+
var messages34 = JSON.parse('{"icon.title.success":"Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"}');
|
|
1903
|
+
var supportedLocales4 = ["en", "nb", "fi", "da", "sv"];
|
|
1904
|
+
var defaultLocale5 = "en";
|
|
1905
|
+
var detectByBrand4 = () => {
|
|
1906
|
+
let value;
|
|
1907
|
+
switch (process.env.NMP_BRAND) {
|
|
1908
|
+
case "FINN":
|
|
1909
|
+
value = "nb";
|
|
1910
|
+
break;
|
|
1911
|
+
case "TORI":
|
|
1912
|
+
value = "fi";
|
|
1913
|
+
break;
|
|
1914
|
+
case "BLOCKET":
|
|
1915
|
+
value = "sv";
|
|
1916
|
+
break;
|
|
1917
|
+
case "DBA":
|
|
1918
|
+
value = "da";
|
|
1919
|
+
break;
|
|
1920
|
+
default:
|
|
1921
|
+
value = "en";
|
|
1922
|
+
}
|
|
1923
|
+
return value;
|
|
1924
|
+
};
|
|
1925
|
+
var detectByHost4 = () => {
|
|
1926
|
+
var _a;
|
|
1927
|
+
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1928
|
+
if (hostname.includes("finn")) {
|
|
1929
|
+
return "nb";
|
|
1930
|
+
} else if (hostname.includes("tori")) {
|
|
1931
|
+
return "fi";
|
|
1932
|
+
} else if (hostname.includes("blocket")) {
|
|
1933
|
+
return "sv";
|
|
1934
|
+
} else if (hostname.includes("dba")) {
|
|
1935
|
+
return "da";
|
|
1936
|
+
} else {
|
|
1937
|
+
return defaultLocale5;
|
|
1938
|
+
}
|
|
1939
|
+
};
|
|
1768
1940
|
var getSupportedLocale4 = (usedLocale) => {
|
|
1769
1941
|
return supportedLocales4.find(
|
|
1770
1942
|
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1771
|
-
) ||
|
|
1943
|
+
) || detectByHost4();
|
|
1772
1944
|
};
|
|
1773
1945
|
function detectLocale4() {
|
|
1946
|
+
var _a;
|
|
1774
1947
|
if (typeof window === "undefined") {
|
|
1775
|
-
const serverLocale =
|
|
1948
|
+
const serverLocale = detectByBrand4();
|
|
1776
1949
|
return getSupportedLocale4(serverLocale);
|
|
1777
1950
|
}
|
|
1778
1951
|
try {
|
|
1779
|
-
const htmlLocale = document.documentElement.lang;
|
|
1780
|
-
|
|
1952
|
+
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1953
|
+
const hostLocale = detectByHost4();
|
|
1954
|
+
if (!supportedLocales4.includes(htmlLocale)) {
|
|
1955
|
+
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1956
|
+
return getSupportedLocale4(hostLocale);
|
|
1957
|
+
}
|
|
1958
|
+
return getSupportedLocale4(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1781
1959
|
} catch (e) {
|
|
1782
1960
|
console.warn("could not detect locale, falling back to source locale", e);
|
|
1783
|
-
return
|
|
1961
|
+
return defaultLocale5;
|
|
1784
1962
|
}
|
|
1785
1963
|
}
|
|
1786
1964
|
var getMessages4 = (locale, enMsg, nbMsg, fiMsg) => {
|
|
@@ -1797,14 +1975,14 @@ var activateI18n4 = (enMessages, nbMessages, fiMessages) => {
|
|
|
1797
1975
|
i18n.activate(locale);
|
|
1798
1976
|
};
|
|
1799
1977
|
activateI18n4(messages24, messages6, messages34);
|
|
1800
|
-
var
|
|
1978
|
+
var IconSuccess16 = class extends LitElement4 {
|
|
1801
1979
|
render() {
|
|
1802
|
-
const title = i18n.t({ message: `
|
|
1803
|
-
return html4`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-
|
|
1980
|
+
const title = i18n.t({ message: `Circle with checkmark`, id: "icon.title.success", comment: "Title for success icon" });
|
|
1981
|
+
return html4`<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">${unsafeStatic4(`<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>`;
|
|
1804
1982
|
}
|
|
1805
1983
|
};
|
|
1806
|
-
if (!customElements.get("w-icon-
|
|
1807
|
-
customElements.define("w-icon-
|
|
1984
|
+
if (!customElements.get("w-icon-success-16")) {
|
|
1985
|
+
customElements.define("w-icon-success-16", IconSuccess16);
|
|
1808
1986
|
}
|
|
1809
1987
|
|
|
1810
1988
|
// packages/alert/index.js
|
|
@@ -1843,13 +2021,13 @@ var WarpAlert = class extends WarpElement {
|
|
|
1843
2021
|
}
|
|
1844
2022
|
get _icon() {
|
|
1845
2023
|
if (this.variant === variants.info)
|
|
1846
|
-
return html5`<w-icon-
|
|
2024
|
+
return html5`<w-icon-info-16></w-icon-info-16>`;
|
|
1847
2025
|
if (this.variant === variants.warning)
|
|
1848
|
-
return html5`<w-icon-
|
|
2026
|
+
return html5`<w-icon-warning-16></w-icon-warning-16>`;
|
|
1849
2027
|
if (this.variant === variants.negative)
|
|
1850
|
-
return html5`<w-icon-
|
|
2028
|
+
return html5`<w-icon-error-16></w-icon-error-16>`;
|
|
1851
2029
|
if (this.variant === variants.positive)
|
|
1852
|
-
return html5`<w-icon-
|
|
2030
|
+
return html5`<w-icon-success-16></w-icon-success-16>`;
|
|
1853
2031
|
else
|
|
1854
2032
|
return "";
|
|
1855
2033
|
}
|