@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.
Files changed (34) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +811 -367
  3. package/dist/index.js.map +4 -4
  4. package/dist/packages/affix/index.js +164 -68
  5. package/dist/packages/affix/index.js.map +4 -4
  6. package/dist/packages/alert/index.js +296 -118
  7. package/dist/packages/alert/index.js.map +4 -4
  8. package/dist/packages/attention/index.js +117 -62
  9. package/dist/packages/attention/index.js.map +4 -4
  10. package/dist/packages/badge/index.js +3 -3
  11. package/dist/packages/badge/index.js.map +2 -2
  12. package/dist/packages/box/index.js +3 -3
  13. package/dist/packages/box/index.js.map +2 -2
  14. package/dist/packages/breadcrumbs/index.js +67 -53
  15. package/dist/packages/breadcrumbs/index.js.map +4 -4
  16. package/dist/packages/button/index.js +66 -52
  17. package/dist/packages/button/index.js.map +4 -4
  18. package/dist/packages/card/index.js +3 -3
  19. package/dist/packages/card/index.js.map +2 -2
  20. package/dist/packages/expandable/index.js +163 -67
  21. package/dist/packages/expandable/index.js.map +4 -4
  22. package/dist/packages/pill/index.d.ts +34 -0
  23. package/dist/packages/pill/index.js +1851 -0
  24. package/dist/packages/pill/index.js.map +7 -0
  25. package/dist/packages/pill/locales/en/messages.d.mts +1 -0
  26. package/dist/packages/pill/locales/fi/messages.d.mts +1 -0
  27. package/dist/packages/pill/locales/nb/messages.d.mts +1 -0
  28. package/dist/packages/select/index.js +116 -61
  29. package/dist/packages/select/index.js.map +4 -4
  30. package/dist/packages/textfield/index.js +3 -3
  31. package/dist/packages/textfield/index.js.map +2 -2
  32. package/dist/packages/toast/index.js +291 -113
  33. package/dist/packages/toast/index.js.map +4 -4
  34. package/package.json +6 -6
@@ -1029,7 +1029,7 @@ import { html as html3 } from "lit";
1029
1029
  import WarpElement from "@warp-ds/elements-core";
1030
1030
  import { ifDefined } from "lit/directives/if-defined.js";
1031
1031
 
1032
- // node_modules/.pnpm/@warp-ds+css@1.6.1/node_modules/@warp-ds/css/component-classes/index.js
1032
+ // node_modules/.pnpm/@warp-ds+css@1.7.0/node_modules/@warp-ds/css/component-classes/index.js
1033
1033
  var box = {
1034
1034
  box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
1035
1035
  // Relative here enables w-clickable
@@ -1189,9 +1189,9 @@ var modal = {
1189
1189
  content: "block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",
1190
1190
  footer: "flex justify-end shrink-0 px-16 sm:px-32",
1191
1191
  transitionTitle: "transition-all duration-300",
1192
- transitionTitleCenter: "justify-self-center",
1192
+ transitionTitleCenter: "justify-self-center self-center",
1193
1193
  transitionTitleColSpan: "col-span-2",
1194
- title: "-mt-4 sm:-mt-8 h-40 sm:h-48 grid gap-8 sm:gap-16 grid-cols-[auto_1fr_auto] items-center px-16 sm:px-32 border-b sm:border-b-0 shrink-0",
1194
+ 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",
1195
1195
  titleText: "mb-0 h4 sm:h3",
1196
1196
  titleButton: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} sm:min-h-[44px] sm:min-w-[44px] min-h-[32px] min-w-[32px]`,
1197
1197
  titleButtonLeft: "-ml-8 sm:-ml-12 justify-self-start",
@@ -1243,14 +1243,14 @@ var attention = {
1243
1243
  closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
1244
1244
  };
1245
1245
 
1246
- // node_modules/.pnpm/@warp-ds+icons@1.3.0/node_modules/@warp-ds/icons/dist/elements/search-16.js
1246
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/search-16.js
1247
1247
  import { LitElement } from "lit";
1248
1248
  import { unsafeStatic, html } from "lit/static-html.js";
1249
1249
 
1250
- // node_modules/.pnpm/@lingui+core@4.5.0/node_modules/@lingui/core/dist/index.mjs
1250
+ // node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
1251
1251
  var import_unraw = __toESM(require_dist(), 1);
1252
1252
 
1253
- // node_modules/.pnpm/@lingui+message-utils@4.5.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1253
+ // node_modules/.pnpm/@lingui+message-utils@4.7.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1254
1254
  var import_parser = __toESM(require_parser(), 1);
1255
1255
  function processTokens(tokens, mapText) {
1256
1256
  if (!tokens.filter((token) => token.type !== "content").length) {
@@ -1300,13 +1300,14 @@ Message: ${message}`);
1300
1300
  }
1301
1301
  }
1302
1302
 
1303
- // node_modules/.pnpm/@lingui+core@4.5.0/node_modules/@lingui/core/dist/index.mjs
1303
+ // node_modules/.pnpm/@lingui+core@4.7.0/node_modules/@lingui/core/dist/index.mjs
1304
1304
  var isString = (s) => typeof s === "string";
1305
1305
  var isFunction = (f) => typeof f === "function";
1306
1306
  var cache = /* @__PURE__ */ new Map();
1307
+ var defaultLocale = "en";
1307
1308
  function normalizeLocales(locales) {
1308
1309
  const out = Array.isArray(locales) ? locales : [locales];
1309
- return [...out, "en"];
1310
+ return [...out, defaultLocale];
1310
1311
  }
1311
1312
  function date(locales, value, format) {
1312
1313
  const _locales = normalizeLocales(locales);
@@ -1351,11 +1352,13 @@ function cacheKey(type, locales, options) {
1351
1352
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1352
1353
  }
1353
1354
  var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1354
- var getDefaultFormats = (locale, locales, formats = {}) => {
1355
- locales = locales || locale;
1356
- const style = (format) => isString(format) ? formats[format] || { style: format } : format;
1355
+ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1356
+ const locales = passedLocales || locale;
1357
+ const style = (format) => {
1358
+ return typeof format === "object" ? format : formats[format] || { style: format };
1359
+ };
1357
1360
  const replaceOctothorpe = (value, message) => {
1358
- const numberFormat = Object.keys(formats).length ? style("number") : {};
1361
+ const numberFormat = Object.keys(formats).length ? style("number") : void 0;
1359
1362
  const valueStr = number(locales, value, numberFormat);
1360
1363
  return message.replace("#", valueStr);
1361
1364
  };
@@ -1370,17 +1373,19 @@ var getDefaultFormats = (locale, locales, formats = {}) => {
1370
1373
  const message = plural(locales, true, value, cases);
1371
1374
  return replaceOctothorpe(value - offset, message);
1372
1375
  },
1373
- select: (value, rules) => {
1374
- var _a;
1375
- return (_a = rules[value]) != null ? _a : rules.other;
1376
- },
1376
+ select: selectFormatter,
1377
1377
  number: (value, format) => number(locales, value, style(format)),
1378
1378
  date: (value, format) => date(locales, value, style(format)),
1379
- undefined: (value) => value
1379
+ undefined: undefinedFormatter
1380
1380
  };
1381
1381
  };
1382
+ var selectFormatter = (value, rules) => {
1383
+ var _a;
1384
+ return (_a = rules[value]) != null ? _a : rules.other;
1385
+ };
1386
+ var undefinedFormatter = (value) => value;
1382
1387
  function interpolate(translation, locale, locales) {
1383
- return (values, formats = {}) => {
1388
+ return (values = {}, formats) => {
1384
1389
  const formatters = getDefaultFormats(locale, locales, formats);
1385
1390
  const formatMessage = (message) => {
1386
1391
  if (!Array.isArray(message))
@@ -1390,14 +1395,15 @@ function interpolate(translation, locale, locales) {
1390
1395
  return message2 + token;
1391
1396
  const [name, type, format] = token;
1392
1397
  let interpolatedFormat = {};
1393
- if (format != null && !isString(format)) {
1394
- Object.keys(format).forEach((key) => {
1395
- interpolatedFormat[key] = formatMessage(format[key]);
1398
+ if (format != null && typeof format === "object") {
1399
+ Object.entries(format).forEach(([key, value2]) => {
1400
+ interpolatedFormat[key] = formatMessage(value2);
1396
1401
  });
1397
1402
  } else {
1398
1403
  interpolatedFormat = format;
1399
1404
  }
1400
- const value = formatters[type](values[name], interpolatedFormat);
1405
+ const formatter = formatters[type];
1406
+ const value = formatter(values[name], interpolatedFormat);
1401
1407
  if (value == null)
1402
1408
  return message2;
1403
1409
  return message2 + value;
@@ -1409,7 +1415,7 @@ function interpolate(translation, locale, locales) {
1409
1415
  }
1410
1416
  if (isString(result))
1411
1417
  return result.trim();
1412
- return result;
1418
+ return result ? String(result) : "";
1413
1419
  };
1414
1420
  }
1415
1421
  var __defProp$1 = Object.defineProperty;
@@ -1423,25 +1429,29 @@ var EventEmitter = class {
1423
1429
  __publicField$1(this, "_events", {});
1424
1430
  }
1425
1431
  on(event, listener) {
1426
- if (!this._hasEvent(event))
1427
- this._events[event] = [];
1432
+ var _a2;
1433
+ var _a;
1434
+ (_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
1428
1435
  this._events[event].push(listener);
1429
1436
  return () => this.removeListener(event, listener);
1430
1437
  }
1431
1438
  removeListener(event, listener) {
1432
- if (!this._hasEvent(event))
1439
+ const maybeListeners = this._getListeners(event);
1440
+ if (!maybeListeners)
1433
1441
  return;
1434
- const index = this._events[event].indexOf(listener);
1442
+ const index = maybeListeners.indexOf(listener);
1435
1443
  if (~index)
1436
- this._events[event].splice(index, 1);
1444
+ maybeListeners.splice(index, 1);
1437
1445
  }
1438
1446
  emit(event, ...args) {
1439
- if (!this._hasEvent(event))
1447
+ const maybeListeners = this._getListeners(event);
1448
+ if (!maybeListeners)
1440
1449
  return;
1441
- this._events[event].map((listener) => listener.apply(this, args));
1450
+ maybeListeners.map((listener) => listener.apply(this, args));
1442
1451
  }
1443
- _hasEvent(event) {
1444
- return Array.isArray(this._events[event]);
1452
+ _getListeners(event) {
1453
+ const maybeListeners = this._events[event];
1454
+ return Array.isArray(maybeListeners) ? maybeListeners : false;
1445
1455
  }
1446
1456
  };
1447
1457
  var __defProp2 = Object.defineProperty;
@@ -1452,23 +1462,22 @@ var __publicField2 = (obj, key, value) => {
1452
1462
  };
1453
1463
  var I18n = class extends EventEmitter {
1454
1464
  constructor(params) {
1465
+ var _a;
1455
1466
  super();
1456
- __publicField2(this, "_locale");
1467
+ __publicField2(this, "_locale", "");
1457
1468
  __publicField2(this, "_locales");
1458
- __publicField2(this, "_localeData");
1459
- __publicField2(this, "_messages");
1469
+ __publicField2(this, "_localeData", {});
1470
+ __publicField2(this, "_messages", {});
1460
1471
  __publicField2(this, "_missing");
1461
1472
  __publicField2(this, "t", this._.bind(this));
1462
- this._messages = {};
1463
- this._localeData = {};
1464
1473
  if (params.missing != null)
1465
1474
  this._missing = params.missing;
1466
1475
  if (params.messages != null)
1467
1476
  this.load(params.messages);
1468
1477
  if (params.localeData != null)
1469
1478
  this.loadLocaleData(params.localeData);
1470
- if (params.locale != null || params.locales != null) {
1471
- this.activate(params.locale, params.locales);
1479
+ if (typeof params.locale === "string" || params.locales) {
1480
+ this.activate((_a = params.locale) != null ? _a : defaultLocale, params.locales);
1472
1481
  }
1473
1482
  }
1474
1483
  get locale() {
@@ -1489,15 +1498,17 @@ var I18n = class extends EventEmitter {
1489
1498
  return (_a = this._localeData[this._locale]) != null ? _a : {};
1490
1499
  }
1491
1500
  _loadLocaleData(locale, localeData) {
1492
- if (this._localeData[locale] == null) {
1501
+ const maybeLocaleData = this._localeData[locale];
1502
+ if (!maybeLocaleData) {
1493
1503
  this._localeData[locale] = localeData;
1494
1504
  } else {
1495
- Object.assign(this._localeData[locale], localeData);
1505
+ Object.assign(maybeLocaleData, localeData);
1496
1506
  }
1497
1507
  }
1498
1508
  /**
1499
1509
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1500
1510
  */
1511
+ // @ts-ignore deprecated, so ignore the reported error
1501
1512
  loadLocaleData(localeOrAllData, localeData) {
1502
1513
  if (localeData != null) {
1503
1514
  this._loadLocaleData(localeOrAllData, localeData);
@@ -1509,18 +1520,19 @@ var I18n = class extends EventEmitter {
1509
1520
  this.emit("change");
1510
1521
  }
1511
1522
  _load(locale, messages5) {
1512
- if (this._messages[locale] == null) {
1523
+ const maybeMessages = this._messages[locale];
1524
+ if (!maybeMessages) {
1513
1525
  this._messages[locale] = messages5;
1514
1526
  } else {
1515
- Object.assign(this._messages[locale], messages5);
1527
+ Object.assign(maybeMessages, messages5);
1516
1528
  }
1517
1529
  }
1518
1530
  load(localeOrMessages, messages5) {
1519
- if (messages5 != null) {
1531
+ if (typeof localeOrMessages == "string" && typeof messages5 === "object") {
1520
1532
  this._load(localeOrMessages, messages5);
1521
1533
  } else {
1522
- Object.keys(localeOrMessages).forEach(
1523
- (locale) => this._load(locale, localeOrMessages[locale])
1534
+ Object.entries(localeOrMessages).forEach(
1535
+ ([locale, messages23]) => this._load(locale, messages23)
1524
1536
  );
1525
1537
  }
1526
1538
  this.emit("change");
@@ -1544,13 +1556,15 @@ var I18n = class extends EventEmitter {
1544
1556
  this._locales = locales;
1545
1557
  this.emit("change");
1546
1558
  }
1547
- _(id, values = {}, { message, formats } = {}) {
1559
+ _(id, values, options) {
1560
+ let message = options == null ? void 0 : options.message;
1548
1561
  if (!isString(id)) {
1549
1562
  values = id.values || values;
1550
1563
  message = id.message;
1551
1564
  id = id.id;
1552
1565
  }
1553
- const messageMissing = !this.messages[id];
1566
+ const messageForId = this.messages[id];
1567
+ const messageMissing = messageForId === void 0;
1554
1568
  const missing = this._missing;
1555
1569
  if (missing && messageMissing) {
1556
1570
  return isFunction(missing) ? missing(this._locale, id) : missing;
@@ -1558,7 +1572,7 @@ var I18n = class extends EventEmitter {
1558
1572
  if (messageMissing) {
1559
1573
  this.emit("missing", { id, locale: this._locale });
1560
1574
  }
1561
- let translation = this.messages[id] || message || id;
1575
+ let translation = messageForId || message || id;
1562
1576
  if (true) {
1563
1577
  translation = isString(translation) ? compileMessage(translation) : translation;
1564
1578
  }
@@ -1570,7 +1584,7 @@ var I18n = class extends EventEmitter {
1570
1584
  translation,
1571
1585
  this._locale,
1572
1586
  this._locales
1573
- )(values, formats);
1587
+ )(values, options == null ? void 0 : options.formats);
1574
1588
  }
1575
1589
  date(value, format) {
1576
1590
  return date(this._locales || this._locale, value, format);
@@ -1584,28 +1598,69 @@ function setupI18n(params = {}) {
1584
1598
  }
1585
1599
  var i18n = setupI18n();
1586
1600
 
1587
- // node_modules/.pnpm/@warp-ds+icons@1.3.0/node_modules/@warp-ds/icons/dist/elements/search-16.js
1601
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/search-16.js
1588
1602
  var messages = JSON.parse('{"icon.title.search":"Forst\xF8rrelsesglass"}');
1589
1603
  var messages2 = JSON.parse('{"icon.title.search":"Magnifying glass"}');
1590
1604
  var messages3 = JSON.parse('{"icon.title.search":"Suurennuslasi"}');
1591
- var supportedLocales = ["en", "nb", "fi"];
1592
- var defaultLocale = "en";
1605
+ var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1606
+ var defaultLocale2 = "en";
1607
+ var detectByBrand = () => {
1608
+ let value;
1609
+ switch (process.env.NMP_BRAND) {
1610
+ case "FINN":
1611
+ value = "nb";
1612
+ break;
1613
+ case "TORI":
1614
+ value = "fi";
1615
+ break;
1616
+ case "BLOCKET":
1617
+ value = "sv";
1618
+ break;
1619
+ case "DBA":
1620
+ value = "da";
1621
+ break;
1622
+ default:
1623
+ value = "en";
1624
+ }
1625
+ return value;
1626
+ };
1627
+ var detectByHost = () => {
1628
+ var _a;
1629
+ const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
1630
+ if (hostname.includes("finn")) {
1631
+ return "nb";
1632
+ } else if (hostname.includes("tori")) {
1633
+ return "fi";
1634
+ } else if (hostname.includes("blocket")) {
1635
+ return "sv";
1636
+ } else if (hostname.includes("dba")) {
1637
+ return "da";
1638
+ } else {
1639
+ return defaultLocale2;
1640
+ }
1641
+ };
1593
1642
  var getSupportedLocale = (usedLocale) => {
1594
1643
  return supportedLocales.find(
1595
1644
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
1596
- ) || defaultLocale;
1645
+ ) || detectByHost();
1597
1646
  };
1598
1647
  function detectLocale() {
1648
+ var _a;
1599
1649
  if (typeof window === "undefined") {
1600
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
1650
+ const serverLocale = detectByBrand();
1601
1651
  return getSupportedLocale(serverLocale);
1602
1652
  }
1603
1653
  try {
1604
- const htmlLocale = document.documentElement.lang;
1605
- return getSupportedLocale(htmlLocale);
1654
+ const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
1655
+ const hostLocale = detectByHost();
1656
+ if (!supportedLocales.includes(htmlLocale)) {
1657
+ console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
1658
+ return getSupportedLocale(hostLocale);
1659
+ }
1660
+ return getSupportedLocale(htmlLocale != null ? htmlLocale : hostLocale);
1606
1661
  } catch (e) {
1607
1662
  console.warn("could not detect locale, falling back to source locale", e);
1608
- return defaultLocale;
1663
+ return defaultLocale2;
1609
1664
  }
1610
1665
  }
1611
1666
  var getMessages = (locale, enMsg, nbMsg, fiMsg) => {
@@ -1625,37 +1680,78 @@ activateI18n(messages2, messages, messages3);
1625
1680
  var IconSearch16 = class extends LitElement {
1626
1681
  render() {
1627
1682
  const title = i18n.t({ message: `Magnifying glass`, id: "icon.title.search", comment: "Title for search icon" });
1628
- return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-search-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M8.796 11.803A5.684 5.684 0 1 0 4.349 1.341a5.684 5.684 0 0 0 4.447 10.462ZM11 11l4 4"></path></svg>`;
1683
+ return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-search-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M8.905 12.102A6.042 6.042 0 1 0 4.18.981a6.042 6.042 0 0 0 4.726 11.121Zm1.909-1.289L15.5 15.5"></path></svg>`;
1629
1684
  }
1630
1685
  };
1631
1686
  if (!customElements.get("w-icon-search-16")) {
1632
1687
  customElements.define("w-icon-search-16", IconSearch16);
1633
1688
  }
1634
1689
 
1635
- // node_modules/.pnpm/@warp-ds+icons@1.3.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
1690
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
1636
1691
  import { LitElement as LitElement2 } from "lit";
1637
1692
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1638
1693
  var messages4 = JSON.parse('{"icon.title.close":"Kryss"}');
1639
1694
  var messages22 = JSON.parse('{"icon.title.close":"Cross"}');
1640
1695
  var messages32 = JSON.parse('{"icon.title.close":"Rasti"}');
1641
- var supportedLocales2 = ["en", "nb", "fi"];
1642
- var defaultLocale2 = "en";
1696
+ var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1697
+ var defaultLocale3 = "en";
1698
+ var detectByBrand2 = () => {
1699
+ let value;
1700
+ switch (process.env.NMP_BRAND) {
1701
+ case "FINN":
1702
+ value = "nb";
1703
+ break;
1704
+ case "TORI":
1705
+ value = "fi";
1706
+ break;
1707
+ case "BLOCKET":
1708
+ value = "sv";
1709
+ break;
1710
+ case "DBA":
1711
+ value = "da";
1712
+ break;
1713
+ default:
1714
+ value = "en";
1715
+ }
1716
+ return value;
1717
+ };
1718
+ var detectByHost2 = () => {
1719
+ var _a;
1720
+ const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
1721
+ if (hostname.includes("finn")) {
1722
+ return "nb";
1723
+ } else if (hostname.includes("tori")) {
1724
+ return "fi";
1725
+ } else if (hostname.includes("blocket")) {
1726
+ return "sv";
1727
+ } else if (hostname.includes("dba")) {
1728
+ return "da";
1729
+ } else {
1730
+ return defaultLocale3;
1731
+ }
1732
+ };
1643
1733
  var getSupportedLocale2 = (usedLocale) => {
1644
1734
  return supportedLocales2.find(
1645
1735
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
1646
- ) || defaultLocale2;
1736
+ ) || detectByHost2();
1647
1737
  };
1648
1738
  function detectLocale2() {
1739
+ var _a;
1649
1740
  if (typeof window === "undefined") {
1650
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
1741
+ const serverLocale = detectByBrand2();
1651
1742
  return getSupportedLocale2(serverLocale);
1652
1743
  }
1653
1744
  try {
1654
- const htmlLocale = document.documentElement.lang;
1655
- return getSupportedLocale2(htmlLocale);
1745
+ const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
1746
+ const hostLocale = detectByHost2();
1747
+ if (!supportedLocales2.includes(htmlLocale)) {
1748
+ console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
1749
+ return getSupportedLocale2(hostLocale);
1750
+ }
1751
+ return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
1656
1752
  } catch (e) {
1657
1753
  console.warn("could not detect locale, falling back to source locale", e);
1658
- return defaultLocale2;
1754
+ return defaultLocale3;
1659
1755
  }
1660
1756
  }
1661
1757
  var getMessages2 = (locale, enMsg, nbMsg, fiMsg) => {
@@ -1675,7 +1771,7 @@ activateI18n2(messages22, messages4, messages32);
1675
1771
  var IconClose16 = class extends LitElement2 {
1676
1772
  render() {
1677
1773
  const title = i18n.t({ message: `Cross`, id: "icon.title.close", comment: "Title for close icon" });
1678
- return html2`<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">${unsafeStatic2(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m12.5 3.5-9 9M3.5 3.5l9 9"></path></svg>`;
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-close-16-part">${unsafeStatic2(`<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>`;
1679
1775
  }
1680
1776
  };
1681
1777
  if (!customElements.get("w-icon-close-16")) {