@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.
@@ -1243,7 +1243,7 @@ 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.4.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
 
@@ -1598,25 +1598,66 @@ function setupI18n(params = {}) {
1598
1598
  }
1599
1599
  var i18n = setupI18n();
1600
1600
 
1601
- // node_modules/.pnpm/@warp-ds+icons@1.4.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
1602
1602
  var messages = JSON.parse('{"icon.title.search":"Forst\xF8rrelsesglass"}');
1603
1603
  var messages2 = JSON.parse('{"icon.title.search":"Magnifying glass"}');
1604
1604
  var messages3 = JSON.parse('{"icon.title.search":"Suurennuslasi"}');
1605
- var supportedLocales = ["en", "nb", "fi"];
1605
+ var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1606
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
+ };
1607
1642
  var getSupportedLocale = (usedLocale) => {
1608
1643
  return supportedLocales.find(
1609
1644
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
1610
- ) || defaultLocale2;
1645
+ ) || detectByHost();
1611
1646
  };
1612
1647
  function detectLocale() {
1648
+ var _a;
1613
1649
  if (typeof window === "undefined") {
1614
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
1650
+ const serverLocale = detectByBrand();
1615
1651
  return getSupportedLocale(serverLocale);
1616
1652
  }
1617
1653
  try {
1618
- const htmlLocale = document.documentElement.lang;
1619
- 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);
1620
1661
  } catch (e) {
1621
1662
  console.warn("could not detect locale, falling back to source locale", e);
1622
1663
  return defaultLocale2;
@@ -1639,34 +1680,75 @@ activateI18n(messages2, messages, messages3);
1639
1680
  var IconSearch16 = class extends LitElement {
1640
1681
  render() {
1641
1682
  const title = i18n.t({ message: `Magnifying glass`, id: "icon.title.search", comment: "Title for search icon" });
1642
- 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>`;
1643
1684
  }
1644
1685
  };
1645
1686
  if (!customElements.get("w-icon-search-16")) {
1646
1687
  customElements.define("w-icon-search-16", IconSearch16);
1647
1688
  }
1648
1689
 
1649
- // node_modules/.pnpm/@warp-ds+icons@1.4.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
1650
1691
  import { LitElement as LitElement2 } from "lit";
1651
1692
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1652
1693
  var messages4 = JSON.parse('{"icon.title.close":"Kryss"}');
1653
1694
  var messages22 = JSON.parse('{"icon.title.close":"Cross"}');
1654
1695
  var messages32 = JSON.parse('{"icon.title.close":"Rasti"}');
1655
- var supportedLocales2 = ["en", "nb", "fi"];
1696
+ var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1656
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
+ };
1657
1733
  var getSupportedLocale2 = (usedLocale) => {
1658
1734
  return supportedLocales2.find(
1659
1735
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
1660
- ) || defaultLocale3;
1736
+ ) || detectByHost2();
1661
1737
  };
1662
1738
  function detectLocale2() {
1739
+ var _a;
1663
1740
  if (typeof window === "undefined") {
1664
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
1741
+ const serverLocale = detectByBrand2();
1665
1742
  return getSupportedLocale2(serverLocale);
1666
1743
  }
1667
1744
  try {
1668
- const htmlLocale = document.documentElement.lang;
1669
- 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);
1670
1752
  } catch (e) {
1671
1753
  console.warn("could not detect locale, falling back to source locale", e);
1672
1754
  return defaultLocale3;
@@ -1689,7 +1771,7 @@ activateI18n2(messages22, messages4, messages32);
1689
1771
  var IconClose16 = class extends LitElement2 {
1690
1772
  render() {
1691
1773
  const title = i18n.t({ message: `Cross`, id: "icon.title.close", comment: "Title for close icon" });
1692
- 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>`;
1693
1775
  }
1694
1776
  };
1695
1777
  if (!customElements.get("w-icon-close-16")) {