@warp-ds/elements 1.3.0-next.1 → 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.
@@ -1268,7 +1268,7 @@ var attention = {
1268
1268
  closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
1269
1269
  };
1270
1270
 
1271
- // node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1271
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1272
1272
  import { LitElement } from "lit";
1273
1273
  import { unsafeStatic, html } from "lit/static-html.js";
1274
1274
 
@@ -1623,25 +1623,66 @@ function setupI18n(params = {}) {
1623
1623
  }
1624
1624
  var i18n = setupI18n();
1625
1625
 
1626
- // node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1626
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1627
1627
  var messages = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
1628
1628
  var messages2 = JSON.parse('{"icon.title.chevron-down":"Downward arrow"}');
1629
1629
  var messages3 = JSON.parse('{"icon.title.chevron-down":"Nuoli alasp\xE4in"}');
1630
- var supportedLocales = ["en", "nb", "fi"];
1630
+ var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1631
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
+ };
1632
1667
  var getSupportedLocale = (usedLocale) => {
1633
1668
  return supportedLocales.find(
1634
1669
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
1635
- ) || defaultLocale2;
1670
+ ) || detectByHost();
1636
1671
  };
1637
1672
  function detectLocale() {
1673
+ var _a;
1638
1674
  if (typeof window === "undefined") {
1639
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
1675
+ const serverLocale = detectByBrand();
1640
1676
  return getSupportedLocale(serverLocale);
1641
1677
  }
1642
1678
  try {
1643
- const htmlLocale = document.documentElement.lang;
1644
- return getSupportedLocale(htmlLocale);
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);
1645
1686
  } catch (e) {
1646
1687
  console.warn("could not detect locale, falling back to source locale", e);
1647
1688
  return defaultLocale2;
@@ -1664,34 +1705,75 @@ activateI18n(messages2, messages, messages3);
1664
1705
  var IconChevronDown16 = class extends LitElement {
1665
1706
  render() {
1666
1707
  const title = i18n.t({ message: `Downward arrow`, id: "icon.title.chevron-down", comment: "Title for chevron-down icon" });
1667
- 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>`;
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-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>`;
1668
1709
  }
1669
1710
  };
1670
1711
  if (!customElements.get("w-icon-chevron-down-16")) {
1671
1712
  customElements.define("w-icon-chevron-down-16", IconChevronDown16);
1672
1713
  }
1673
1714
 
1674
- // node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/chevron-up-16.js
1715
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/chevron-up-16.js
1675
1716
  import { LitElement as LitElement2 } from "lit";
1676
1717
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1677
1718
  var messages4 = JSON.parse('{"icon.title.chevron-up":"Oppoverpil"}');
1678
1719
  var messages22 = JSON.parse('{"icon.title.chevron-up":"Upward arrow"}');
1679
1720
  var messages32 = JSON.parse('{"icon.title.chevron-up":"Nuoli yl\xF6sp\xE4in"}');
1680
- var supportedLocales2 = ["en", "nb", "fi"];
1721
+ var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1681
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
+ };
1682
1758
  var getSupportedLocale2 = (usedLocale) => {
1683
1759
  return supportedLocales2.find(
1684
1760
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
1685
- ) || defaultLocale3;
1761
+ ) || detectByHost2();
1686
1762
  };
1687
1763
  function detectLocale2() {
1764
+ var _a;
1688
1765
  if (typeof window === "undefined") {
1689
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
1766
+ const serverLocale = detectByBrand2();
1690
1767
  return getSupportedLocale2(serverLocale);
1691
1768
  }
1692
1769
  try {
1693
- const htmlLocale = document.documentElement.lang;
1694
- return getSupportedLocale2(htmlLocale);
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);
1695
1777
  } catch (e) {
1696
1778
  console.warn("could not detect locale, falling back to source locale", e);
1697
1779
  return defaultLocale3;