@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.
@@ -2082,27 +2082,68 @@ var activateI18n = (enMessages, nbMessages, fiMessages) => {
2082
2082
  i18n.activate(locale);
2083
2083
  };
2084
2084
 
2085
- // node_modules/.pnpm/@warp-ds+icons@1.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
2085
+ // node_modules/.pnpm/@warp-ds+icons@2.0.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
2086
2086
  import { LitElement } from "lit";
2087
2087
  import { unsafeStatic, html } from "lit/static-html.js";
2088
2088
  var messages4 = JSON.parse('{"icon.title.close":"Kryss"}');
2089
2089
  var messages22 = JSON.parse('{"icon.title.close":"Cross"}');
2090
2090
  var messages32 = JSON.parse('{"icon.title.close":"Rasti"}');
2091
- var supportedLocales2 = ["en", "nb", "fi"];
2091
+ var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
2092
2092
  var defaultLocale3 = "en";
2093
+ var detectByBrand = () => {
2094
+ let value;
2095
+ switch (process.env.NMP_BRAND) {
2096
+ case "FINN":
2097
+ value = "nb";
2098
+ break;
2099
+ case "TORI":
2100
+ value = "fi";
2101
+ break;
2102
+ case "BLOCKET":
2103
+ value = "sv";
2104
+ break;
2105
+ case "DBA":
2106
+ value = "da";
2107
+ break;
2108
+ default:
2109
+ value = "en";
2110
+ }
2111
+ return value;
2112
+ };
2113
+ var detectByHost = () => {
2114
+ var _a;
2115
+ const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
2116
+ if (hostname.includes("finn")) {
2117
+ return "nb";
2118
+ } else if (hostname.includes("tori")) {
2119
+ return "fi";
2120
+ } else if (hostname.includes("blocket")) {
2121
+ return "sv";
2122
+ } else if (hostname.includes("dba")) {
2123
+ return "da";
2124
+ } else {
2125
+ return defaultLocale3;
2126
+ }
2127
+ };
2093
2128
  var getSupportedLocale2 = (usedLocale) => {
2094
2129
  return supportedLocales2.find(
2095
2130
  (locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
2096
- ) || defaultLocale3;
2131
+ ) || detectByHost();
2097
2132
  };
2098
2133
  function detectLocale2() {
2134
+ var _a;
2099
2135
  if (typeof window === "undefined") {
2100
- const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
2136
+ const serverLocale = detectByBrand();
2101
2137
  return getSupportedLocale2(serverLocale);
2102
2138
  }
2103
2139
  try {
2104
- const htmlLocale = document.documentElement.lang;
2105
- return getSupportedLocale2(htmlLocale);
2140
+ const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
2141
+ const hostLocale = detectByHost();
2142
+ if (!supportedLocales2.includes(htmlLocale)) {
2143
+ console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
2144
+ return getSupportedLocale2(hostLocale);
2145
+ }
2146
+ return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
2106
2147
  } catch (e2) {
2107
2148
  console.warn("could not detect locale, falling back to source locale", e2);
2108
2149
  return defaultLocale3;
@@ -2125,7 +2166,7 @@ activateI18n2(messages22, messages4, messages32);
2125
2166
  var IconClose16 = class extends LitElement {
2126
2167
  render() {
2127
2168
  const title = i18n.t({ message: `Cross`, id: "icon.title.close", comment: "Title for close icon" });
2128
- return html`<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">${unsafeStatic(`<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>`;
2169
+ return html`<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">${unsafeStatic(`<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>`;
2129
2170
  }
2130
2171
  };
2131
2172
  if (!customElements.get("w-icon-close-16")) {