@warp-ds/elements 1.3.0-next.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1698,27 +1698,68 @@ var activateI18n = (enMessages, nbMessages, fiMessages) => {
1698
1698
  i18n.activate(locale);
1699
1699
  };
1700
1700
 
1701
- // node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1701
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1702
1702
  import { LitElement } from "lit";
1703
1703
  import { unsafeStatic, html } from "lit/static-html.js";
1704
1704
  var messages4 = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
1705
1705
  var messages22 = JSON.parse('{"icon.title.chevron-down":"Downward arrow"}');
1706
1706
  var messages32 = JSON.parse('{"icon.title.chevron-down":"Nuoli alasp\xE4in"}');
1707
- var supportedLocales2 = ["en", "nb", "fi"];
1707
+ var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1708
1708
  var defaultLocale3 = "en";
1709
+ var detectByBrand = () => {
1710
+ let value;
1711
+ switch (process.env.NMP_BRAND) {
1712
+ case "FINN":
1713
+ value = "nb";
1714
+ break;
1715
+ case "TORI":
1716
+ value = "fi";
1717
+ break;
1718
+ case "BLOCKET":
1719
+ value = "sv";
1720
+ break;
1721
+ case "DBA":
1722
+ value = "da";
1723
+ break;
1724
+ default:
1725
+ value = "en";
1726
+ }
1727
+ return value;
1728
+ };
1729
+ var detectByHost = () => {
1730
+ var _a;
1731
+ const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
1732
+ if (hostname.includes("finn")) {
1733
+ return "nb";
1734
+ } else if (hostname.includes("tori")) {
1735
+ return "fi";
1736
+ } else if (hostname.includes("blocket")) {
1737
+ return "sv";
1738
+ } else if (hostname.includes("dba")) {
1739
+ return "da";
1740
+ } else {
1741
+ return defaultLocale3;
1742
+ }
1743
+ };
1709
1744
  var getSupportedLocale2 = (usedLocale) => {
1710
1745
  return supportedLocales2.find(
1711
1746
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
1712
- ) || defaultLocale3;
1747
+ ) || detectByHost();
1713
1748
  };
1714
1749
  function detectLocale2() {
1750
+ var _a;
1715
1751
  if (typeof window === "undefined") {
1716
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
1752
+ const serverLocale = detectByBrand();
1717
1753
  return getSupportedLocale2(serverLocale);
1718
1754
  }
1719
1755
  try {
1720
- const htmlLocale = document.documentElement.lang;
1721
- return getSupportedLocale2(htmlLocale);
1756
+ const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
1757
+ const hostLocale = detectByHost();
1758
+ if (!supportedLocales2.includes(htmlLocale)) {
1759
+ console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
1760
+ return getSupportedLocale2(hostLocale);
1761
+ }
1762
+ return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
1722
1763
  } catch (e) {
1723
1764
  console.warn("could not detect locale, falling back to source locale", e);
1724
1765
  return defaultLocale3;
@@ -1741,7 +1782,7 @@ activateI18n2(messages22, messages4, messages32);
1741
1782
  var IconChevronDown16 = class extends LitElement {
1742
1783
  render() {
1743
1784
  const title = i18n.t({ message: `Downward arrow`, id: "icon.title.chevron-down", comment: "Title for chevron-down icon" });
1744
- return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-chevron-down-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M2.5 5.5 8 11l5.5-5.5"></path></svg>`;
1785
+ return html`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-chevron-down-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m2.667 5.333 5.5 5.5 5.5-5.5"></path></svg>`;
1745
1786
  }
1746
1787
  };
1747
1788
  if (!customElements.get("w-icon-chevron-down-16")) {