@mattilsynet/design 1.3.9 → 1.3.11

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.
@@ -1,25 +1,25 @@
1
- import { IS_BROWSER as l } from "../utils.js";
1
+ import { IS_BROWSER as r } from "../utils.js";
2
2
  const s = "mattilsynet.matomo.cloud";
3
3
  let a = !0;
4
4
  function d(o, n = {}) {
5
- if (l) {
5
+ if (r) {
6
6
  if (window._paq || (window._paq = [], window._paq.push(["HeatmapSessionRecording::disable"]), window._paq.push(["enableLinkTracking"]), window._paq.push(["setTrackerUrl", `https://${s}/matomo.php`]), document.querySelector('script[src*="matomo.js"]') || document.head.append(
7
7
  Object.assign(document.createElement("script"), {
8
8
  async: !0,
9
9
  src: `https://cdn.matomo.cloud/${s}/matomo.js`
10
10
  })
11
11
  )), o === "init") {
12
- const { matomoId: e, enabled: t = !0 } = n;
13
- a = t, window._paq.push(["setSiteId", e]);
12
+ const { matomoId: e, enabled: t } = n;
13
+ a = t ?? window.location.hostname === "localhost", window._paq.push(["setSiteId", e]);
14
14
  }
15
15
  if (a === "debug") return console.info(`Analytics: "${o}"`, n);
16
- if (!(a === !1 || window.location.hostname === "localhost"))
16
+ if (a !== !1)
17
17
  if (o === "pageview") {
18
18
  const { url: e, title: t } = n;
19
19
  window._paq.push(["setCustomUrl", e || location.href]), window._paq.push(["setDocumentTitle", t || document.title]), window._paq.push(["trackPageView"]);
20
20
  } else if (o === "event") {
21
21
  const { category: e, action: t, name: i, value: c } = n, p = ["trackEvent", e, t, i, c];
22
- window._paq.push(p.filter((r) => r !== void 0));
22
+ window._paq.push(p.filter((l) => l !== void 0));
23
23
  } else if (o === "search") {
24
24
  const {
25
25
  query: e,
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sources":["../../designsystem/analytics/analytics.ts"],"sourcesContent":["import { IS_BROWSER } from \"../utils\";\n\nconst MATOMO = \"mattilsynet.matomo.cloud\";\nlet ENABLED: AnalyticsActions[\"init\"][\"enabled\"] = true;\n\ntype Matomo = (string | number | boolean)[];\ndeclare global {\n\tinterface Window {\n\t\t_paq?: Matomo[];\n\t\t_mtm?: Record<string, string | number>[];\n\t}\n}\n\n// window._paq = window._paq || [];\n// window._mtm = window._mtm || [];\n\n// window._paq.push([\"setCustomUrl\", `${document.location.href}&eirik`]);\n// window._paq.push([\"setDocumentTitle\", \"Eirik 3\"]);\n// window._mtm.push({\n// \tevent: \"mtm.Start\",\n// \t\"mtm.startTime\": new Date().getTime(),\n// \tcustomTitle: \"Eirik 1\",\n// \tcustomUrl: `${document.location.href}&eirik`,\n// });\n\n// window._mtm.push({\n// \tevent: \"mtm.PageView\",\n// \tcustomTitle: \"Eirik 2\",\n// \tcustomUrl: `${document.location.href}&eirik`,\n// });\n\n// const containerId = \"A9utKk3O\";\n\n// document.head.append(\n// \tObject.assign(document.createElement(\"script\"), {\n// \t\tsrc: `https://cdn.matomo.cloud/mattilsynet.matomo.cloud/container_${containerId}.js`,\n// \t\tasync: true,\n// \t\tonload: () => console.log(window._paq),\n// \t}),\n// );\n\nexport type AnalyticsActions = {\n\tinit: {\n\t\tmatomoId: number | string;\n\t\tenabled?: boolean | \"debug\";\n\t};\n\tpageview: {\n\t\turl?: string;\n\t\ttitle?: string;\n\t};\n\tevent: {\n\t\tcategory: string;\n\t\taction: string;\n\t\tname?: string;\n\t\tvalue?: number;\n\t};\n\tsearch: {\n\t\tquery: string;\n\t\tcategory?: string;\n\t\tresults?: number;\n\t};\n\tmatomo: Matomo;\n};\n\nexport function analytics<Action extends keyof AnalyticsActions>(\n\taction: Action,\n\targs = {} as AnalyticsActions[Action],\n) {\n\tif (!IS_BROWSER) return;\n\tif (!window._paq) {\n\t\twindow._paq = [];\n\t\twindow._paq.push([\"HeatmapSessionRecording::disable\"]); // Disable heatmaps by default as this require cookies\n\t\twindow._paq.push([\"enableLinkTracking\"]);\n\t\twindow._paq.push([\"setTrackerUrl\", `https://${MATOMO}/matomo.php`]);\n\t\tdocument.querySelector('script[src*=\"matomo.js\"]') ||\n\t\t\tdocument.head.append(\n\t\t\t\tObject.assign(document.createElement(\"script\"), {\n\t\t\t\t\tasync: true,\n\t\t\t\t\tsrc: `https://cdn.matomo.cloud/${MATOMO}/matomo.js`,\n\t\t\t\t}),\n\t\t\t);\n\t}\n\tif (action === \"init\") {\n\t\tconst { matomoId, enabled = true } = args as AnalyticsActions[\"init\"];\n\t\tENABLED = enabled;\n\t\twindow._paq.push([\"setSiteId\", matomoId]);\n\t}\n\n\tif (ENABLED === \"debug\") return console.info(`Analytics: \"${action}\"`, args);\n\tif (ENABLED === false || window.location.hostname === \"localhost\") return;\n\n\tif (action === \"pageview\") {\n\t\tconst { url, title } = args as AnalyticsActions[\"pageview\"];\n\t\twindow._paq.push([\"setCustomUrl\", url || location.href]);\n\t\twindow._paq.push([\"setDocumentTitle\", title || document.title]);\n\t\twindow._paq.push([\"trackPageView\"]);\n\t} else if (action === \"event\") {\n\t\tconst { category, action, name, value } = args as AnalyticsActions[\"event\"];\n\t\tconst event = [\"trackEvent\", category, action, name, value];\n\t\twindow._paq.push(event.filter((v) => v !== undefined));\n\t} else if (action === \"search\") {\n\t\tconst {\n\t\t\tquery,\n\t\t\tcategory = false,\n\t\t\tresults = false,\n\t\t} = args as AnalyticsActions[\"search\"];\n\t\twindow._paq.push([\"trackSiteSearch\", query, category, results]);\n\t} else if (action === \"matomo\") {\n\t\twindow._paq.push(args as AnalyticsActions[\"matomo\"]);\n\t}\n}\n"],"names":["MATOMO","ENABLED","analytics","action","args","IS_BROWSER","matomoId","enabled","url","title","category","name","value","event","v","query","results"],"mappings":";AAEA,MAAMA,IAAS;AACf,IAAIC,IAA+C;AA6D5C,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,GAcL;AAAA,QAbK,OAAO,SACX,OAAO,OAAO,CAAC,GACf,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWL,CAAM,aAAa,CAAC,GAClE,SAAS,cAAc,0BAA0B,KAChD,SAAS,KAAK;AAAA,MACb,OAAO,OAAO,SAAS,cAAc,QAAQ,GAAG;AAAA,QAC/C,OAAO;AAAA,QACP,KAAK,4BAA4BA,CAAM;AAAA,MACvC,CAAA;AAAA,IACF,IAEEG,MAAW,QAAQ;AACtB,YAAM,EAAE,UAAAG,GAAU,SAAAC,IAAU,GAAS,IAAAH;AAC3B,MAAAH,IAAAM,GACV,OAAO,KAAK,KAAK,CAAC,aAAaD,CAAQ,CAAC;AAAA,IAAA;AAGrC,QAAAL,MAAY,QAAgB,QAAA,QAAQ,KAAK,eAAeE,CAAM,KAAKC,CAAI;AAC3E,QAAI,EAAAH,MAAY,MAAS,OAAO,SAAS,aAAa;AAEtD,UAAIE,MAAW,YAAY;AACpB,cAAA,EAAE,KAAAK,GAAK,OAAAC,EAAA,IAAUL;AACvB,eAAO,KAAK,KAAK,CAAC,gBAAgBI,KAAO,SAAS,IAAI,CAAC,GACvD,OAAO,KAAK,KAAK,CAAC,oBAAoBC,KAAS,SAAS,KAAK,CAAC,GAC9D,OAAO,KAAK,KAAK,CAAC,eAAe,CAAC;AAAA,MAAA,WACxBN,MAAW,SAAS;AAC9B,cAAM,EAAE,UAAAO,GAAU,QAAAP,GAAQ,MAAAQ,GAAM,OAAAC,MAAUR,GACpCS,IAAQ,CAAC,cAAcH,GAAUP,GAAQQ,GAAMC,CAAK;AACnD,eAAA,KAAK,KAAKC,EAAM,OAAO,CAACC,MAAMA,MAAM,MAAS,CAAC;AAAA,MAAA,WAC3CX,MAAW,UAAU;AACzB,cAAA;AAAA,UACL,OAAAY;AAAA,UACA,UAAAL,IAAW;AAAA,UACX,SAAAM,IAAU;AAAA,QAAA,IACPZ;AACJ,eAAO,KAAK,KAAK,CAAC,mBAAmBW,GAAOL,GAAUM,CAAO,CAAC;AAAA,MAAA,MAC/D,CAAWb,MAAW,YACd,OAAA,KAAK,KAAKC,CAAkC;AAAA;AAErD;"}
1
+ {"version":3,"file":"analytics.js","sources":["../../designsystem/analytics/analytics.ts"],"sourcesContent":["import { IS_BROWSER } from \"../utils\";\n\nconst MATOMO = \"mattilsynet.matomo.cloud\";\nlet ENABLED: AnalyticsActions[\"init\"][\"enabled\"] = true;\n\ntype Matomo = (string | number | boolean)[];\ndeclare global {\n\tinterface Window {\n\t\t_paq?: Matomo[];\n\t\t_mtm?: Record<string, string | number>[];\n\t}\n}\n\n// window._paq = window._paq || [];\n// window._mtm = window._mtm || [];\n\n// window._paq.push([\"setCustomUrl\", `${document.location.href}&eirik`]);\n// window._paq.push([\"setDocumentTitle\", \"Eirik 3\"]);\n// window._mtm.push({\n// \tevent: \"mtm.Start\",\n// \t\"mtm.startTime\": new Date().getTime(),\n// \tcustomTitle: \"Eirik 1\",\n// \tcustomUrl: `${document.location.href}&eirik`,\n// });\n\n// window._mtm.push({\n// \tevent: \"mtm.PageView\",\n// \tcustomTitle: \"Eirik 2\",\n// \tcustomUrl: `${document.location.href}&eirik`,\n// });\n\n// const containerId = \"A9utKk3O\";\n\n// document.head.append(\n// \tObject.assign(document.createElement(\"script\"), {\n// \t\tsrc: `https://cdn.matomo.cloud/mattilsynet.matomo.cloud/container_${containerId}.js`,\n// \t\tasync: true,\n// \t\tonload: () => console.log(window._paq),\n// \t}),\n// );\n\nexport type AnalyticsActions = {\n\tinit: {\n\t\tmatomoId: number | string;\n\t\tenabled?: boolean | \"debug\";\n\t};\n\tpageview: {\n\t\turl?: string;\n\t\ttitle?: string;\n\t};\n\tevent: {\n\t\tcategory: string;\n\t\taction: string;\n\t\tname?: string;\n\t\tvalue?: number;\n\t};\n\tsearch: {\n\t\tquery: string;\n\t\tcategory?: string;\n\t\tresults?: number;\n\t};\n\tmatomo: Matomo;\n};\n\nexport function analytics<Action extends keyof AnalyticsActions>(\n\taction: Action,\n\targs = {} as AnalyticsActions[Action],\n) {\n\tif (!IS_BROWSER) return;\n\tif (!window._paq) {\n\t\twindow._paq = [];\n\t\twindow._paq.push([\"HeatmapSessionRecording::disable\"]); // Disable heatmaps by default as this require cookies\n\t\twindow._paq.push([\"enableLinkTracking\"]);\n\t\twindow._paq.push([\"setTrackerUrl\", `https://${MATOMO}/matomo.php`]);\n\t\tdocument.querySelector('script[src*=\"matomo.js\"]') ||\n\t\t\tdocument.head.append(\n\t\t\t\tObject.assign(document.createElement(\"script\"), {\n\t\t\t\t\tasync: true,\n\t\t\t\t\tsrc: `https://cdn.matomo.cloud/${MATOMO}/matomo.js`,\n\t\t\t\t}),\n\t\t\t);\n\t}\n\tif (action === \"init\") {\n\t\tconst { matomoId, enabled } = args as AnalyticsActions[\"init\"];\n\t\tENABLED = enabled ?? window.location.hostname === \"localhost\";\n\t\twindow._paq.push([\"setSiteId\", matomoId]);\n\t}\n\n\tif (ENABLED === \"debug\") return console.info(`Analytics: \"${action}\"`, args);\n\tif (ENABLED === false) return;\n\n\tif (action === \"pageview\") {\n\t\tconst { url, title } = args as AnalyticsActions[\"pageview\"];\n\t\twindow._paq.push([\"setCustomUrl\", url || location.href]);\n\t\twindow._paq.push([\"setDocumentTitle\", title || document.title]);\n\t\twindow._paq.push([\"trackPageView\"]);\n\t} else if (action === \"event\") {\n\t\tconst { category, action, name, value } = args as AnalyticsActions[\"event\"];\n\t\tconst event = [\"trackEvent\", category, action, name, value];\n\t\twindow._paq.push(event.filter((v) => v !== undefined));\n\t} else if (action === \"search\") {\n\t\tconst {\n\t\t\tquery,\n\t\t\tcategory = false,\n\t\t\tresults = false,\n\t\t} = args as AnalyticsActions[\"search\"];\n\t\twindow._paq.push([\"trackSiteSearch\", query, category, results]);\n\t} else if (action === \"matomo\") {\n\t\twindow._paq.push(args as AnalyticsActions[\"matomo\"]);\n\t}\n}\n"],"names":["MATOMO","ENABLED","analytics","action","args","IS_BROWSER","matomoId","enabled","url","title","category","name","value","event","v","query","results"],"mappings":";AAEA,MAAMA,IAAS;AACf,IAAIC,IAA+C;AA6D5C,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,GAcL;AAAA,QAbK,OAAO,SACX,OAAO,OAAO,CAAC,GACf,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWL,CAAM,aAAa,CAAC,GAClE,SAAS,cAAc,0BAA0B,KAChD,SAAS,KAAK;AAAA,MACb,OAAO,OAAO,SAAS,cAAc,QAAQ,GAAG;AAAA,QAC/C,OAAO;AAAA,QACP,KAAK,4BAA4BA,CAAM;AAAA,MACvC,CAAA;AAAA,IACF,IAEEG,MAAW,QAAQ;AAChB,YAAA,EAAE,UAAAG,GAAU,SAAAC,EAAA,IAAYH;AACpB,MAAAH,IAAAM,KAAW,OAAO,SAAS,aAAa,aAClD,OAAO,KAAK,KAAK,CAAC,aAAaD,CAAQ,CAAC;AAAA,IAAA;AAGrC,QAAAL,MAAY,QAAgB,QAAA,QAAQ,KAAK,eAAeE,CAAM,KAAKC,CAAI;AAC3E,QAAIH,MAAY;AAEhB,UAAIE,MAAW,YAAY;AACpB,cAAA,EAAE,KAAAK,GAAK,OAAAC,EAAA,IAAUL;AACvB,eAAO,KAAK,KAAK,CAAC,gBAAgBI,KAAO,SAAS,IAAI,CAAC,GACvD,OAAO,KAAK,KAAK,CAAC,oBAAoBC,KAAS,SAAS,KAAK,CAAC,GAC9D,OAAO,KAAK,KAAK,CAAC,eAAe,CAAC;AAAA,MAAA,WACxBN,MAAW,SAAS;AAC9B,cAAM,EAAE,UAAAO,GAAU,QAAAP,GAAQ,MAAAQ,GAAM,OAAAC,MAAUR,GACpCS,IAAQ,CAAC,cAAcH,GAAUP,GAAQQ,GAAMC,CAAK;AACnD,eAAA,KAAK,KAAKC,EAAM,OAAO,CAACC,MAAMA,MAAM,MAAS,CAAC;AAAA,MAAA,WAC3CX,MAAW,UAAU;AACzB,cAAA;AAAA,UACL,OAAAY;AAAA,UACA,UAAAL,IAAW;AAAA,UACX,SAAAM,IAAU;AAAA,QAAA,IACPZ;AACJ,eAAO,KAAK,KAAK,CAAC,mBAAmBW,GAAOL,GAAUM,CAAO,CAAC;AAAA,MAAA,MAC/D,CAAWb,MAAW,YACd,OAAA,KAAK,KAAKC,CAAkC;AAAA;AAErD;"}
@@ -1,6 +1,6 @@
1
1
  import m from "../styles.module.css.js";
2
2
  import { onLoaded as T, onMutation as w, on as r, QUICK_EVENT as p, debounce as _ } from "../utils.js";
3
- import "./app-toggle.js";
3
+ import "./app-toggle2.js";
4
4
  const f = m.app.split(" ")[0], P = m.sticky.split(" ")[0], E = '[data-command="toggle-app-expanded"]', g = `.${f} > dialog,.${f} dialog ~ main`, S = (e) => {
5
5
  document.startViewTransition ? document.startViewTransition(e) : e();
6
6
  }, h = (e) => (
@@ -1,11 +1,27 @@
1
- typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
- const e = "--mtds-app-expanded", d = new CSSStyleSheet(), o = () => !window.localStorage.getItem(e)?.includes("false");
3
- document.adoptedStyleSheets.push(d), window.mtdsToggleAppExpanded = (n) => {
4
- try {
5
- const t = n ?? !o();
6
- d.replaceSync?.(`:root { ${e}: var(${e}--${t})}`), window.localStorage.setItem(e, t);
7
- } catch {
8
- }
9
- }, window.mtdsToggleAppExpanded(o());
10
- })();
1
+ const t = `if (
2
+ typeof window !== "undefined" &&
3
+ window.CSSStyleSheet &&
4
+ document.adoptedStyleSheets
5
+ )
6
+ (() => {
7
+ const key = "--mtds-app-expanded";
8
+ const sheet = new CSSStyleSheet();
9
+ const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
+
11
+ document.adoptedStyleSheets.push(sheet);
12
+ window.mtdsToggleAppExpanded = (force) => {
13
+ try {
14
+ const next = force ?? !prev();
15
+ sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
+ window.localStorage.setItem(key, next);
17
+ } catch (_err) {} // localStorage is full or replaceSync is not supported
18
+ };
19
+
20
+ // Set and store initial state
21
+ window.mtdsToggleAppExpanded(prev());
22
+ })();
23
+ `;
24
+ export {
25
+ t as default
26
+ };
11
27
  //# sourceMappingURL=app-toggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (_err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM,CAAC,OAAO,aAAa,QAAQF,CAAG,GAAG,SAAS,OAAO;AAEtE,WAAS,mBAAmB,KAAKC,CAAK,GACtC,OAAO,wBAAwB,CAACE,MAAU;AACzC,QAAI;AACH,YAAMC,IAAOD,KAAS,CAACD,EAAM;AAC7B,MAAAD,EAAM,cAAc,WAAWD,CAAG,SAASA,CAAG,KAAKI,CAAI,IAAI,GAC3D,OAAO,aAAa,QAAQJ,GAAKI,CAAI;AAAA,IACzC,QAAkB;AAAA,IAAE;AAAA,EACjB,GAGD,OAAO,sBAAsBF,GAAM;AACrC,GAAK;"}
1
+ {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (_err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAeA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,27 +1,11 @@
1
- const t = `if (
2
- typeof window !== "undefined" &&
3
- window.CSSStyleSheet &&
4
- document.adoptedStyleSheets
5
- )
6
- (() => {
7
- const key = "--mtds-app-expanded";
8
- const sheet = new CSSStyleSheet();
9
- const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
-
11
- document.adoptedStyleSheets.push(sheet);
12
- window.mtdsToggleAppExpanded = (force) => {
13
- try {
14
- const next = force ?? !prev();
15
- sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
- window.localStorage.setItem(key, next);
17
- } catch (_err) {} // localStorage is full or replaceSync is not supported
18
- };
19
-
20
- // Set and store initial state
21
- window.mtdsToggleAppExpanded(prev());
22
- })();
23
- `;
24
- export {
25
- t as default
26
- };
1
+ typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
+ const e = "--mtds-app-expanded", d = new CSSStyleSheet(), o = () => !window.localStorage.getItem(e)?.includes("false");
3
+ document.adoptedStyleSheets.push(d), window.mtdsToggleAppExpanded = (n) => {
4
+ try {
5
+ const t = n ?? !o();
6
+ d.replaceSync?.(`:root { ${e}: var(${e}--${t})}`), window.localStorage.setItem(e, t);
7
+ } catch {
8
+ }
9
+ }, window.mtdsToggleAppExpanded(o());
10
+ })();
27
11
  //# sourceMappingURL=app-toggle2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (_err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAeA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (_err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM,CAAC,OAAO,aAAa,QAAQF,CAAG,GAAG,SAAS,OAAO;AAEtE,WAAS,mBAAmB,KAAKC,CAAK,GACtC,OAAO,wBAAwB,CAACE,MAAU;AACzC,QAAI;AACH,YAAMC,IAAOD,KAAS,CAACD,EAAM;AAC7B,MAAAD,EAAM,cAAc,WAAWD,CAAG,SAASA,CAAG,KAAKI,CAAI,IAAI,GAC3D,OAAO,aAAa,QAAQJ,GAAKI,CAAI;AAAA,IACzC,QAAkB;AAAA,IAAE;AAAA,EACjB,GAGD,OAAO,sBAAsBF,GAAM;AACrC,GAAK;"}
package/mtds/app/app.js CHANGED
@@ -32,7 +32,7 @@ import "../togglegroup/togglegroup.js";
32
32
  import "../typography/typography.js";
33
33
  import "../validation/validation.js";
34
34
  import a from "../styles.module.css.js";
35
- import d from "./app-toggle2.js";
35
+ import d from "./app-toggle.js";
36
36
  const f = p(function({ as: t, className: r, ...m }, n) {
37
37
  return /* @__PURE__ */ o(t || "div", { className: e(a.app, r), ref: n, ...m });
38
38
  }), u = p(function({ as: t, className: r, ...m }, n) {
@@ -14,8 +14,8 @@ function s(t, e, o) {
14
14
  return o === void 0 ? t.getAttribute(e) : (o === null ? t.removeAttribute(e) : t.getAttribute(e) !== o && t.setAttribute(e, o), null);
15
15
  }
16
16
  var q = (t, e, o) => {
17
- for (const i of o[0].split(","))
18
- o[0] = i, Element.prototype[`${t}EventListener`].apply(e, o);
17
+ for (const n of o[0].split(","))
18
+ o[0] = n, Element.prototype[`${t}EventListener`].apply(e, o);
19
19
  }, O = (t, ...e) => q("add", t, e), it = (t, ...e) => q("remove", t, e), x = /* @__PURE__ */ new WeakMap(), L = (t, e) => {
20
20
  if (e === void 0) return x.get(t);
21
21
  try {
@@ -24,30 +24,30 @@ var q = (t, e, o) => {
24
24
  }
25
25
  if (e) {
26
26
  const o = new MutationObserver(
27
- (i) => t.handleEvent({ type: "mutation", detail: i })
27
+ (n) => t.handleEvent({ type: "mutation", detail: n })
28
28
  );
29
29
  o.observe(t, e), x.set(t, o);
30
30
  }
31
31
  }, nt = (t) => {
32
32
  const e = "key" in t && (t.key === " " || t.key === "Enter");
33
33
  return e && t.preventDefault(), e && t.target instanceof HTMLElement && t.target.click(), e;
34
- }, rt = (t) => {
34
+ }, at = (t) => {
35
35
  var e;
36
36
  const o = ((e = t.getRootNode) == null ? void 0 : e.call(t)) || t.ownerDocument;
37
37
  return o instanceof Document || o instanceof ShadowRoot ? o : document;
38
- }, at = 0, lt = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++at).toString(32)}`), t.id) : "", C = (t, e, o) => {
39
- const i = document.createElement(t);
40
- if (e && (i.textContent = e), o) for (const [n, r] of Object.entries(o)) s(i, n, r);
41
- return i;
38
+ }, rt = 0, lt = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++rt).toString(32)}`), t.id) : "", I = (t, e, o) => {
39
+ const n = document.createElement(t);
40
+ if (e && (n.textContent = e), o) for (const [i, a] of Object.entries(o)) s(n, i, a);
41
+ return n;
42
42
  }, st = {
43
43
  define: (t, e) => !w || window.customElements.get(t) || window.customElements.define(t, e)
44
44
  }, y, ut = 0, M = (t) => {
45
- y || (y = C("div"), y.style.cssText = "position:fixed;overflow:hidden;width:1px;white-space:nowrap", s(y, "aria-live", "assertive")), y.isConnected || document.body.append(y), t && (y.textContent = `${t}${ut++ % 2 ? " " : ""}`);
45
+ y || (y = I("div"), y.style.cssText = "position:fixed;overflow:hidden;width:1px;white-space:nowrap", s(y, "aria-live", "assertive")), y.isConnected || document.body.append(y), t && (y.textContent = `${t}${ut++ % 2 ? " " : ""}`);
46
46
  }, K = (t, e, o = "") => {
47
- var i, n;
48
- const r = { bubbles: !0, composed: !0, data: e, inputType: o }, a = HTMLInputElement.prototype;
49
- t.dispatchEvent(new InputEvent("beforeinput", r)), (n = (i = Object.getOwnPropertyDescriptor(a, "value")) == null ? void 0 : i.set) == null || n.call(t, e), t.dispatchEvent(new InputEvent("input", r)), t.dispatchEvent(new Event("change", { bubbles: !0 }));
50
- }, A = !1, N = (t) => (t?.type === "mouseup" && (A = !1), t?.type === "mousedown" && (A = !0, O(document, "mouseup", N, { once: !0 })), A), j = "beforeinput,blur,focus,click,input,keydown,mousedown", U = { once: !0, passive: !0 }, ct = Z && !V, dt = V || tt, k = "false", T = {
47
+ var n, i;
48
+ const a = { bubbles: !0, composed: !0, data: e, inputType: o }, r = HTMLInputElement.prototype;
49
+ t.dispatchEvent(new InputEvent("beforeinput", a)), (i = (n = Object.getOwnPropertyDescriptor(r, "value")) == null ? void 0 : n.set) == null || i.call(t, e), t.dispatchEvent(new InputEvent("input", a)), t.dispatchEvent(new Event("change", { bubbles: !0 }));
50
+ }, A = !1, N = (t) => (t?.type === "mouseup" && (A = !1), t?.type === "mousedown" && (A = !0, O(document, "mouseup", N, { once: !0 })), A), j = "beforeinput,blur,focus,click,input,keydown,mousedown", U = { once: !0, passive: !0 }, ct = Z && !V, dt = V || tt, k = "false", C = {
51
51
  added: "Added",
52
52
  empty: "No selected",
53
53
  found: "Navigate left to find %d selected",
@@ -55,12 +55,12 @@ var q = (t, e, o) => {
55
55
  of: "of",
56
56
  remove: "Press to remove",
57
57
  removed: "Removed"
58
- }, vt = class extends ot {
58
+ }, pt = class extends ot {
59
59
  constructor() {
60
- super(), this._itemText = "", this._speak = "", this._texts = Q({}, T), this._value = "", this.attachShadow({ mode: "open" }).append(
61
- C("slot"),
60
+ super(), this._item = "", this._speak = "", this._texts = Q({}, C), this._value = "", this.attachShadow({ mode: "open" }).append(
61
+ I("slot"),
62
62
  // Content slot
63
- C(
63
+ I(
64
64
  "style",
65
65
  `:host(:not([hidden])) { display: block; cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) } /* Must be display block in Safari to allow focus inside */
66
66
  :host(:not([data-multiple])) ::slotted(data),
@@ -76,29 +76,29 @@ var q = (t, e, o) => {
76
76
  // Locally store value to store value before input-click
77
77
  // Using ES2015 syntax for backwards compatibility
78
78
  static get observedAttributes() {
79
- return Object.keys(T).map((t) => `data-sr-${t}`);
79
+ return Object.keys(C).map((t) => `data-sr-${t}`);
80
80
  }
81
81
  connectedCallback() {
82
- this._root = rt(this), O(this, j, this, !0), L(this, {
83
- attributeFilter: ["value"],
84
- // Respond to changes in <data> value,
82
+ this._root = at(this), O(this, j, this, !0), L(this, {
83
+ attributeFilter: ["value", "id"],
84
+ // Respond to changes in <data> value or change of id for <datalist> to reconnect with input
85
85
  attributes: !0,
86
86
  characterData: !0,
87
87
  // Respond to changes in <data> textContent
88
88
  childList: !0,
89
89
  subtree: !0
90
- }), setTimeout(I, 0, this), setTimeout(S, 0, this);
90
+ }), setTimeout(T, 0, this), setTimeout(S, 0, this);
91
91
  }
92
92
  attributeChangedCallback(t, e, o) {
93
- const i = t.split("data-sr-")[1];
94
- T[i] && (this._texts[i] = o || T[i]);
93
+ const n = t.split("data-sr-")[1];
94
+ C[n] && (this._texts[n] = o || C[n]);
95
95
  }
96
96
  disconnectedCallback() {
97
97
  L(this, !1), it(this, j, this, !0), this._items = this._clear = this._focus = this._control = void 0, this._list = this._options = this._root = void 0;
98
98
  }
99
99
  handleEvent(t) {
100
100
  const e = t.target;
101
- t.type === "beforeinput" && (this._value = e?.value || ""), t.type === "blur" && ft(this), t.type === "click" && ht(this, t), t.type === "focus" && pt(this, t), t.type === "input" && _t(this, t), t.type === "keydown" && bt(this, t), t.type === "mousedown" && N(t), t.type === "mutation" && I(this, t);
101
+ t.type === "beforeinput" && (this._value = e?.value || ""), t.type === "blur" && ft(this), t.type === "click" && ht(this, t), t.type === "focus" && vt(this, t), t.type === "input" && _t(this, t), t.type === "keydown" && bt(this, t), t.type === "mousedown" && N(t), t.type === "mutation" && T(this, t);
102
102
  }
103
103
  get multiple() {
104
104
  var t;
@@ -143,114 +143,111 @@ var q = (t, e, o) => {
143
143
  }, b = (t) => {
144
144
  var e;
145
145
  return ((e = t?.textContent) == null ? void 0 : e.trim()) || "";
146
- }, D = (t) => t instanceof HTMLDataElement, I = (t, e) => {
147
- var o, i;
148
- const { _focus: n, _texts: r, items: a, control: l, list: d, multiple: c } = t;
149
- let v = `${b((o = l?.labels) == null ? void 0 : o[0])}, ${c ? a.length ? r.found.replace("%d", `${a.length}`) : r.empty : ""}`;
150
- const u = [];
146
+ }, D = (t) => t instanceof HTMLDataElement, T = (t, e) => {
147
+ var o, n;
148
+ const { _focus: i, _texts: a, items: r, control: l, list: d, multiple: u } = t;
149
+ let p = `${b((o = l?.labels) == null ? void 0 : o[0])}, ${u ? r.length ? a.found.replace("%d", `${r.length}`) : a.empty : ""}`;
150
+ const c = [];
151
151
  for (const { addedNodes: m, removedNodes: h } of e?.detail || []) {
152
- for (const p of m) D(p) && u.unshift(p);
153
- for (const p of h) D(p) && u.push(p);
154
- }
155
- const g = c ? u.length === 1 : u[0] === n;
156
- if (n && l && g) {
157
- const m = s(l, "inputmode"), h = D(n) ? l : n;
158
- t._speak = `${r[u[0].isConnected ? "added" : "removed"]} ${b(u[0])}, `, (dt || n === l) && M(t._speak), l !== h && (s(l, "aria-expanded", null), s(l, "inputmode", "none"), v = " ", l.focus()), setTimeout(() => {
159
- var p;
160
- s(l, "aria-expanded", "true"), s(l, "inputmode", m), (p = h?.focus) == null || p.call(h), t._speak = "", ct ? O(t, "blur", () => I(t), U) : setTimeout(I, 100, t);
152
+ for (const v of m) D(v) && c.unshift(v);
153
+ for (const v of h) D(v) && c.push(v);
154
+ }
155
+ const g = u ? c.length === 1 : c[0] === i;
156
+ if (i && l && g) {
157
+ const m = s(l, "inputmode"), h = D(i) ? l : i;
158
+ t._speak = `${a[c[0].isConnected ? "added" : "removed"]} ${b(c[0])}, `, (dt || i === l) && M(t._speak), l !== h && (s(l, "aria-expanded", null), s(l, "inputmode", "none"), p = " ", l.focus()), setTimeout(() => {
159
+ var v;
160
+ s(l, "aria-expanded", "true"), s(l, "inputmode", m), (v = h?.focus) == null || v.call(h), t._speak = "", ct ? O(t, "blur", () => T(t), U) : setTimeout(T, 100, t);
161
161
  }, 100);
162
162
  }
163
163
  let f = 0;
164
164
  const _ = t.querySelector("select");
165
- for (const m of a) {
166
- const h = _?.options[f], p = b(m), $ = m.value || p, Y = `${t._speak}${p}, ${r.remove}, ${++f} ${r.of} ${a.length}`;
167
- s(m, "role", "button"), s(m, "value", $), s(m, "tabindex", "-1"), s(m, "aria-label", Y), h ? Object.assign(h, { textContent: p, value: $ }) : _?.appendChild(new Option(p, $, !0, !0));
165
+ for (const m of r) {
166
+ const h = _?.options[f], v = b(m), $ = m.value || v, Y = `${t._speak}${v}, ${a.remove}, ${++f} ${a.of} ${r.length}`;
167
+ s(m, "role", "button"), s(m, "value", $), s(m, "tabindex", "-1"), s(m, "aria-label", Y), h ? Object.assign(h, { textContent: v, value: $ }) : _?.appendChild(new Option(v, $, !0, !0));
168
168
  }
169
- _ && s(_, "multiple", c ? "" : null);
169
+ _ && s(_, "multiple", u ? "" : null);
170
170
  for (const m of [..._?.options || []].slice(f)) m.remove();
171
- !c && f > 1 && console.warn("u-combobox: Multiple <data> found in single mode."), d && s(d, "aria-multiselectable", `${c}`), l && s(l, "list", lt(d)), l && s(l, "aria-label", `${t._speak}${v}`);
172
- const R = b(a[0]);
173
- R !== t._itemText && S(t, !1), t._itemText = R, X(t), W(t), (i = L(t)) == null || i.takeRecords();
171
+ !u && f > 1 && console.warn("u-combobox: Multiple <data> found in single mode."), d && s(d, "aria-multiselectable", `${u}`), l && s(l, "list", lt(d)), l && s(l, "aria-label", `${t._speak}${p}`);
172
+ const R = b(r[0]);
173
+ R !== t._item && S(t), t._item = R, X(t), W(t), (n = L(t)) == null || n.takeRecords();
174
174
  }, X = (t) => {
175
175
  var e;
176
176
  t.clear && s(t.clear, "role", "button"), t.clear && (t.clear.hidden = !((e = t.control) != null && e.value));
177
177
  }, W = (t) => {
178
178
  var e;
179
- const { _speak: o, options: i = [], values: n } = t;
180
- for (const r of i) {
181
- const a = (e = s(r, "value")) != null ? e : b(r);
182
- s(r, "aria-label", o ? `${o}${b(r)}` : null), s(r, "selected", n.includes(a) ? "" : null);
183
- }
184
- }, S = (t, e = !0) => {
185
- const { multiple: o, control: i, items: n } = t, r = b(n[0]);
186
- if (!(o || !i || r === i.value)) {
187
- if (e) return K(i, r, "insertText");
188
- i.value = r;
189
- }
179
+ const { _speak: o, options: n = [], values: i } = t;
180
+ for (const a of n) {
181
+ const r = (e = s(a, "value")) != null ? e : b(a);
182
+ s(a, "aria-label", o ? `${o}${b(a)}` : null), s(a, "selected", i.includes(r) ? "" : null);
183
+ }
184
+ }, S = (t) => {
185
+ const { multiple: e, control: o, items: n } = t, i = b(n[0]);
186
+ !e && o && i !== o.value && K(o, i, i ? "insertText" : "deleteContent");
190
187
  }, P = (t, e = !0) => {
191
188
  var o;
192
- const { _texts: i, options: n = [], creatable: r, control: a, items: l, multiple: d } = t, c = ((o = a?.value) == null ? void 0 : o.trim()) || "", v = c.toLowerCase() || null;
193
- let u = [...n].find(
194
- (f) => (s(f, "label") || b(f)).trim().toLowerCase() === v
189
+ const { _texts: n, options: i = [], creatable: a, control: r, items: l, multiple: d } = t, u = ((o = r?.value) == null ? void 0 : o.trim()) || "", p = u.toLowerCase() || null;
190
+ let c = [...i].find(
191
+ (f) => (s(f, "label") || b(f)).trim().toLowerCase() === p
195
192
  );
196
- const g = { bubbles: !0, cancelable: !0, detail: u };
197
- if (t.dispatchEvent(new CustomEvent("beforematch", g)) || (u = [...n].find((f) => f.selected)), e)
198
- return W(t), u ? E(t, u, !1) : r && c ? E(t, { value: c }, !1) : (!d && l[0] ? E(t, l[0]) : S(t), M(i.invalid));
199
- for (const f of n) f.selected = f === u;
193
+ const g = { bubbles: !0, cancelable: !0, detail: c };
194
+ if (t.dispatchEvent(new CustomEvent("beforematch", g)) || (c = [...i].find((f) => f.selected)), e)
195
+ return W(t), c ? E(t, c, !1) : a && u ? E(t, { value: u }, !1) : (!d && !u && l[0] ? E(t, l[0]) : S(t), M(n.invalid));
196
+ for (const f of i) f.selected = f === c;
200
197
  }, E = (t, e, o = !0) => {
201
- const { control: i, items: n, multiple: r } = t, a = C("data", e.label || e.value, {
198
+ const { control: n, items: i, multiple: a } = t, r = I("data", e.label || e.value, {
202
199
  value: e.value
203
- }), l = [...n].find((v) => v.value === e.value), d = { bubbles: !0, cancelable: !0, detail: l || a };
200
+ }), l = [...i].find((p) => p.value === e.value), d = { bubbles: !0, cancelable: !0, detail: l || r };
204
201
  if (l && !o) return S(t);
205
202
  if (t.dispatchEvent(new CustomEvent("beforechange", d))) {
206
- if (!r) for (const v of [...n]) v.remove();
207
- l ? l.remove() : i?.insertAdjacentElement("beforebegin", a), t.dispatchEvent(new CustomEvent("afterchange", d));
203
+ if (!a) for (const p of [...i]) p.remove();
204
+ l ? l.remove() : n?.insertAdjacentElement("beforebegin", r), t.dispatchEvent(new CustomEvent("afterchange", d));
208
205
  }
209
- }, pt = (t, { target: e }) => {
206
+ }, vt = (t, { target: e }) => {
210
207
  e instanceof HTMLElement && (t._focus = e), M();
211
208
  }, ft = (t) => N() || setTimeout(mt, 0, t), mt = (t) => {
212
209
  var e;
213
210
  !t._focus || t.contains((e = t._root) == null ? void 0 : e.activeElement) || (t.multiple || P(t), t._focus = void 0);
214
211
  }, ht = (t, e) => {
215
- const { clientX: o, clientY: i, target: n } = e, { clear: r, control: a, items: l } = t;
216
- if (r?.contains(n))
217
- return a && K(a, "", "deleteContentBackward"), a?.focus();
212
+ const { clientX: o, clientY: n, target: i } = e, { clear: a, control: r, items: l } = t;
213
+ if (a?.contains(i))
214
+ return r && K(r, "", "deleteContentBackward"), r?.focus();
218
215
  for (const d of l) {
219
- const { top: c, right: v, bottom: u, left: g } = d.getBoundingClientRect();
220
- if (d.contains(n)) return E(t, d);
221
- if (i >= c && i <= u && o >= g && o <= v) return d.focus();
216
+ const { top: u, right: p, bottom: c, left: g } = d.getBoundingClientRect();
217
+ if (d.contains(i)) return E(t, d);
218
+ if (n >= u && n <= c && o >= g && o <= p) return d.focus();
222
219
  }
223
- n === t && a?.focus();
220
+ i === t && r?.focus();
224
221
  }, _t = (t, e) => {
225
222
  var o;
226
- const { options: i = [], control: n, multiple: r } = t, a = ((o = n?.value) == null ? void 0 : o.trim()) || "";
227
- if (e instanceof InputEvent ? !e.inputType || e.inputType === "insertReplacementText" : !!a) {
228
- e.stopImmediatePropagation(), n && (n.value = t._value);
229
- for (const d of i)
230
- if (d.value && d.value === a)
231
- return E(t, d, r);
232
- } else r || P(t, !1);
223
+ const { options: n = [], control: i, multiple: a } = t, r = ((o = i?.value) == null ? void 0 : o.trim()) || "";
224
+ if (e instanceof InputEvent ? !e.inputType || e.inputType === "insertReplacementText" : !!r) {
225
+ e.stopImmediatePropagation(), i && (i.value = t._value);
226
+ for (const d of n)
227
+ if (d.value && d.value === r)
228
+ return E(t, d, a);
229
+ } else a || P(t, !1);
233
230
  X(t);
234
231
  }, bt = (t, e) => {
235
232
  var o;
236
233
  if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
237
- const { clear: i, control: n, items: r } = t, { key: a, repeat: l, target: d } = e, c = n && n === d, v = c && n?.selectionEnd;
238
- let u = c ? r.length : [...r].indexOf(d);
239
- if (c && a === "Tab" && i && !i.hidden && (e.preventDefault(), i.tabIndex = -1, i.focus(), O(i, "blur", () => s(i, "tabindex", null), U)), !(!c && nt(e) || u === -1)) {
240
- if (a === "ArrowRight" && !c) u += 1;
241
- else if (a === "ArrowLeft" && !v) u -= 1;
242
- else if (a === "Enter" && c) {
243
- const g = s(n, "form");
244
- return s(n, "form", "#"), requestAnimationFrame(() => s(n, "form", g)), P(t);
245
- } else if ((a === "Backspace" || a === "Delete") && !v) {
246
- if (e.preventDefault(), !l && r[u]) return E(t, r[u]);
247
- c && (u -= 1);
248
- } else return c || n?.focus();
249
- e.preventDefault(), (o = r[Math.max(0, u)] || n) == null || o.focus();
234
+ const { clear: n, control: i, items: a } = t, { key: r, repeat: l, target: d } = e, u = i && i === d, p = u && i?.selectionEnd;
235
+ let c = u ? a.length : [...a].indexOf(d);
236
+ if (u && r === "Tab" && n && !n.hidden && (e.preventDefault(), n.tabIndex = -1, n.focus(), O(n, "blur", () => s(n, "tabindex", null), U)), !(!u && nt(e) || c === -1)) {
237
+ if (r === "ArrowRight" && !u) c += 1;
238
+ else if (r === "ArrowLeft" && !p) c -= 1;
239
+ else if (r === "Enter" && u) {
240
+ const g = s(i, "form");
241
+ return s(i, "form", "#"), requestAnimationFrame(() => s(i, "form", g)), P(t);
242
+ } else if ((r === "Backspace" || r === "Delete") && !p) {
243
+ if (e.preventDefault(), !l && a[c]) return E(t, a[c]);
244
+ u && (c -= 1);
245
+ } else return u || i?.focus();
246
+ e.preventDefault(), (o = a[Math.max(0, c)] || i) == null || o.focus();
250
247
  }
251
248
  };
252
- st.define("u-combobox", vt);
249
+ st.define("u-combobox", pt);
253
250
  export {
254
- vt as UHTMLComboboxElement
251
+ pt as UHTMLComboboxElement
255
252
  };
256
253
  //# sourceMappingURL=u-combobox.js.map