@mattilsynet/design 1.3.10 → 1.3.12
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.
- package/mtds/analytics/analytics.js +6 -6
- package/mtds/analytics/analytics.js.map +1 -1
- package/mtds/app/app-observer.js +1 -1
- package/mtds/app/app-toggle.js +10 -26
- package/mtds/app/app-toggle.js.map +1 -1
- package/mtds/app/app-toggle2.js +26 -10
- package/mtds/app/app-toggle2.js.map +1 -1
- package/mtds/app/app.js +1 -1
- package/mtds/field/field.d.ts +47 -7
- package/mtds/field/field.js +94 -69
- package/mtds/field/field.js.map +1 -1
- package/mtds/field/field.stories.d.ts +35 -2
- package/mtds/index.iife.js +7 -7
- package/mtds/layout/layout.d.ts +1 -1
- package/mtds/layout/layout.js.map +1 -1
- package/mtds/package.json.js +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +40 -40
- package/mtds/styles.module.css.js +47 -47
- package/mtds/utils.js +33 -33
- package/mtds/utils.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { IS_BROWSER as
|
|
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 (
|
|
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
|
|
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 (
|
|
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((
|
|
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
|
|
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;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ICK_EVENT as p, debounce as _ } from "../utils.js";
|
|
3
|
-
import "./app-
|
|
3
|
+
import "./app-toggle.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) => (
|
package/mtds/app/app-toggle.js
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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-toggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js
|
|
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;"}
|
package/mtds/app/app-toggle2.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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-toggle2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (
|
|
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;"}
|
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-
|
|
35
|
+
import d from "./app-toggle2.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) {
|
package/mtds/field/field.d.ts
CHANGED
|
@@ -9,14 +9,13 @@ type FieldBaseProps = {
|
|
|
9
9
|
helpText?: React.ReactNode;
|
|
10
10
|
helpTextLabel?: string;
|
|
11
11
|
label?: React.ReactNode;
|
|
12
|
-
options?:
|
|
13
|
-
label: string;
|
|
14
|
-
value: string;
|
|
15
|
-
}>;
|
|
12
|
+
options?: string[] | FieldComboboxSelected;
|
|
16
13
|
prefix?: string;
|
|
17
14
|
readOnly?: boolean;
|
|
18
15
|
suffix?: string;
|
|
19
16
|
validation?: React.ReactNode;
|
|
17
|
+
value?: React.ComponentPropsWithRef<"input">["value"];
|
|
18
|
+
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
20
19
|
};
|
|
21
20
|
export type FieldProps<As extends React.ElementType = "div"> = PolymorphicComponentPropWithRef<As, FieldBaseProps>;
|
|
22
21
|
type FieldComponent = <As extends React.ElementType = "div">(props: FieldProps<As>) => JSX.Element;
|
|
@@ -26,16 +25,57 @@ export type FieldDatalistProps = React.ComponentPropsWithoutRef<"datalist"> & {
|
|
|
26
25
|
"data-position"?: AnchorPosition;
|
|
27
26
|
};
|
|
28
27
|
export type FieldOptionProps = React.ComponentPropsWithoutRef<"option">;
|
|
28
|
+
export type FieldComboboxSelected = {
|
|
29
|
+
label: string;
|
|
30
|
+
value: string;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
}[];
|
|
29
33
|
export type FieldComboboxProps = ReactUcombobox & {
|
|
30
|
-
"data-multiple"?: boolean;
|
|
31
34
|
"data-creatable"?: boolean;
|
|
35
|
+
"data-multiple"?: boolean;
|
|
32
36
|
onAfterChange?: (e: CustomEvent<HTMLDataElement>) => void;
|
|
33
37
|
onBeforeChange?: (e: CustomEvent<HTMLDataElement>) => void;
|
|
34
38
|
onBeforeMatch?: (e: CustomEvent<HTMLOptionElement>) => void;
|
|
35
|
-
}
|
|
39
|
+
} & ({
|
|
40
|
+
"data-nofilter"?: boolean;
|
|
41
|
+
selected: FieldComboboxSelected;
|
|
42
|
+
options: FieldComboboxSelected;
|
|
43
|
+
onSelectedChange: (selected: FieldComboboxSelected) => void;
|
|
44
|
+
} | {
|
|
45
|
+
"data-nofilter"?: never;
|
|
46
|
+
selected?: never;
|
|
47
|
+
options?: never;
|
|
48
|
+
onSelectedChange?: never;
|
|
49
|
+
});
|
|
36
50
|
export declare const Field: FieldComponent & {
|
|
37
51
|
Affixes: React.ForwardRefExoticComponent<Omit<FieldProps<"div">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
-
Combobox: React.ForwardRefExoticComponent<Omit<
|
|
52
|
+
Combobox: React.ForwardRefExoticComponent<(Omit<React.ClassAttributes<UHTMLComboboxElement> & React.HTMLAttributes<UHTMLComboboxElement> & {
|
|
53
|
+
class?: string;
|
|
54
|
+
} & {
|
|
55
|
+
"data-creatable"?: boolean;
|
|
56
|
+
"data-multiple"?: boolean;
|
|
57
|
+
onAfterChange?: (e: CustomEvent<HTMLDataElement>) => void;
|
|
58
|
+
onBeforeChange?: (e: CustomEvent<HTMLDataElement>) => void;
|
|
59
|
+
onBeforeMatch?: (e: CustomEvent<HTMLOptionElement>) => void;
|
|
60
|
+
} & {
|
|
61
|
+
"data-nofilter"?: boolean;
|
|
62
|
+
selected: FieldComboboxSelected;
|
|
63
|
+
options: FieldComboboxSelected;
|
|
64
|
+
onSelectedChange: (selected: FieldComboboxSelected) => void;
|
|
65
|
+
}, "ref"> | Omit<React.ClassAttributes<UHTMLComboboxElement> & React.HTMLAttributes<UHTMLComboboxElement> & {
|
|
66
|
+
class?: string;
|
|
67
|
+
} & {
|
|
68
|
+
"data-creatable"?: boolean;
|
|
69
|
+
"data-multiple"?: boolean;
|
|
70
|
+
onAfterChange?: (e: CustomEvent<HTMLDataElement>) => void;
|
|
71
|
+
onBeforeChange?: (e: CustomEvent<HTMLDataElement>) => void;
|
|
72
|
+
onBeforeMatch?: (e: CustomEvent<HTMLOptionElement>) => void;
|
|
73
|
+
} & {
|
|
74
|
+
"data-nofilter"?: never;
|
|
75
|
+
selected?: never;
|
|
76
|
+
options?: never;
|
|
77
|
+
onSelectedChange?: never;
|
|
78
|
+
}, "ref">) & React.RefAttributes<UHTMLComboboxElement>>;
|
|
39
79
|
Datalist: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>, "ref"> & {
|
|
40
80
|
"data-nofilter"?: boolean;
|
|
41
81
|
"data-position"?: AnchorPosition;
|
package/mtds/field/field.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { clsx as
|
|
3
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as t, Fragment as R, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as W } from "../external/clsx/dist/clsx.js";
|
|
3
|
+
import { forwardRef as b, useRef as A, useImperativeHandle as B, useEffect as P } from "react";
|
|
4
4
|
import "../alert/alert.js";
|
|
5
5
|
import "../app/app.js";
|
|
6
6
|
import "../avatar/avatar.js";
|
|
@@ -14,8 +14,8 @@ import "../dialog/dialog.js";
|
|
|
14
14
|
import "../divider/divider.js";
|
|
15
15
|
import "../errorsummary/errorsummary.js";
|
|
16
16
|
import "../fieldset/fieldset.js";
|
|
17
|
-
import { HelpText as
|
|
18
|
-
import "../input/input.js";
|
|
17
|
+
import { HelpText as S } from "../helptext/helptext.js";
|
|
18
|
+
import { Input as T } from "../input/input.js";
|
|
19
19
|
import "../layout/layout.js";
|
|
20
20
|
import "../link/link.js";
|
|
21
21
|
import "../logo/logo.js";
|
|
@@ -31,85 +31,110 @@ import "../tag/tag.js";
|
|
|
31
31
|
import "../togglegroup/togglegroup.js";
|
|
32
32
|
import "../typography/typography.js";
|
|
33
33
|
import "../validation/validation.js";
|
|
34
|
-
import
|
|
35
|
-
import { toCustomElementProps as
|
|
36
|
-
const
|
|
37
|
-
"data-size":
|
|
38
|
-
as:
|
|
39
|
-
className:
|
|
40
|
-
count:
|
|
41
|
-
description:
|
|
42
|
-
error:
|
|
43
|
-
helpText:
|
|
44
|
-
helpTextLabel:
|
|
45
|
-
label:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
suffix: d,
|
|
34
|
+
import h from "../styles.module.css.js";
|
|
35
|
+
import { toCustomElementProps as C } from "../utils.js";
|
|
36
|
+
const z = (a) => typeof a == "string" ? { label: a, value: a } : a, q = b(function({
|
|
37
|
+
"data-size": e,
|
|
38
|
+
as: i,
|
|
39
|
+
className: c,
|
|
40
|
+
count: v,
|
|
41
|
+
description: g,
|
|
42
|
+
error: y,
|
|
43
|
+
helpText: d,
|
|
44
|
+
helpTextLabel: O,
|
|
45
|
+
label: s,
|
|
46
|
+
prefix: f,
|
|
47
|
+
style: j,
|
|
48
|
+
suffix: m,
|
|
50
49
|
validation: H,
|
|
51
|
-
...
|
|
52
|
-
},
|
|
53
|
-
const
|
|
54
|
-
"data-size":
|
|
55
|
-
className:
|
|
56
|
-
style:
|
|
50
|
+
...l
|
|
51
|
+
}, o) {
|
|
52
|
+
const r = i || "div", n = !!m || !!f, F = H || y, x = {
|
|
53
|
+
"data-size": e,
|
|
54
|
+
className: W(h.field, c),
|
|
55
|
+
style: j
|
|
57
56
|
};
|
|
58
|
-
return
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
}),
|
|
61
|
-
!!
|
|
62
|
-
!!
|
|
63
|
-
!!
|
|
64
|
-
|
|
65
|
-
!!
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
!!
|
|
68
|
-
] }) : /* @__PURE__ */
|
|
69
|
-
|
|
57
|
+
return i === "select" && !l.children && Object.assign(l, {
|
|
58
|
+
children: /* @__PURE__ */ t(R, { children: l.options?.map(z).map(({ label: u, value: p }) => /* @__PURE__ */ t("option", { value: p, children: u }, p)) })
|
|
59
|
+
}), i ? /* @__PURE__ */ N("div", { ...x, children: [
|
|
60
|
+
!!s && /* @__PURE__ */ t("label", { suppressHydrationWarning: !0, children: s }),
|
|
61
|
+
!!d && /* @__PURE__ */ t(S, { "aria-label": O, children: d }),
|
|
62
|
+
!!g && /* @__PURE__ */ t("p", { children: g }),
|
|
63
|
+
n ? /* @__PURE__ */ N(I, { children: [
|
|
64
|
+
!!f && /* @__PURE__ */ t("span", { children: f }),
|
|
65
|
+
/* @__PURE__ */ t(r, { className: h.input, ref: o, ...l }),
|
|
66
|
+
!!m && /* @__PURE__ */ t("span", { children: m })
|
|
67
|
+
] }) : /* @__PURE__ */ t(
|
|
68
|
+
r,
|
|
70
69
|
{
|
|
71
|
-
className:
|
|
70
|
+
className: typeof i == "string" ? h.input : void 0,
|
|
72
71
|
suppressHydrationWarning: !0,
|
|
73
|
-
ref:
|
|
74
|
-
...
|
|
72
|
+
ref: o,
|
|
73
|
+
...l
|
|
75
74
|
}
|
|
76
75
|
),
|
|
77
|
-
!!
|
|
78
|
-
!!
|
|
79
|
-
] }) : /* @__PURE__ */
|
|
80
|
-
}),
|
|
81
|
-
function({ className:
|
|
82
|
-
return /* @__PURE__ */
|
|
76
|
+
!!F && /* @__PURE__ */ t("div", { className: h.validation, children: F }),
|
|
77
|
+
!!v && /* @__PURE__ */ t("p", { "data-count": v })
|
|
78
|
+
] }) : /* @__PURE__ */ t("div", { ref: o, ...x, ...l });
|
|
79
|
+
}), I = b(
|
|
80
|
+
function({ className: e, ...i }, c) {
|
|
81
|
+
return /* @__PURE__ */ t("div", { className: W(h.affixes, e), ref: c, ...i });
|
|
83
82
|
}
|
|
84
|
-
),
|
|
85
|
-
function(
|
|
86
|
-
return /* @__PURE__ */
|
|
83
|
+
), L = b(
|
|
84
|
+
function(e, i) {
|
|
85
|
+
return /* @__PURE__ */ t("u-datalist", { ref: i, ...C(e) });
|
|
87
86
|
}
|
|
88
|
-
),
|
|
89
|
-
function(
|
|
90
|
-
return /* @__PURE__ */
|
|
87
|
+
), k = b(
|
|
88
|
+
function(e, i) {
|
|
89
|
+
return /* @__PURE__ */ t("u-option", { ref: i, ...C(e) });
|
|
91
90
|
}
|
|
92
|
-
),
|
|
93
|
-
function({
|
|
94
|
-
|
|
91
|
+
), G = b(
|
|
92
|
+
function({
|
|
93
|
+
"data-multiple": e,
|
|
94
|
+
"data-nofilter": i,
|
|
95
|
+
children: c,
|
|
96
|
+
onAfterChange: v,
|
|
97
|
+
onBeforeChange: g,
|
|
98
|
+
onBeforeMatch: y,
|
|
99
|
+
onSelectedChange: d,
|
|
100
|
+
options: O,
|
|
101
|
+
selected: s,
|
|
102
|
+
...f
|
|
103
|
+
}, j) {
|
|
104
|
+
const m = A(null), H = s !== void 0, l = A(d);
|
|
105
|
+
return l.current = d, B(j, () => m.current), P(() => {
|
|
106
|
+
const o = m.current, r = (n) => {
|
|
107
|
+
n.preventDefault();
|
|
108
|
+
const { isConnected: F, textContent: x, value: u } = n.detail, p = l.current, D = x?.trim() || "", E = s || [];
|
|
109
|
+
p?.(F ? E.filter((w) => w.value !== u) : e ? [...E, { value: u, label: D }] : [{ value: u, label: D }]);
|
|
110
|
+
};
|
|
111
|
+
return o?.addEventListener("beforechange", r), () => o?.removeEventListener("beforechange", r);
|
|
112
|
+
}, [e, s]), /* @__PURE__ */ t(
|
|
95
113
|
"u-combobox",
|
|
96
114
|
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
115
|
+
onbeforechange: g,
|
|
116
|
+
onbeforematch: y,
|
|
117
|
+
onafterchange: v,
|
|
118
|
+
"data-multiple": e,
|
|
119
|
+
ref: m,
|
|
120
|
+
...C(f),
|
|
121
|
+
children: H ? /* @__PURE__ */ N(R, { children: [
|
|
122
|
+
s?.map(({ children: o, label: r, value: n }) => /* @__PURE__ */ t("data", { value: n, suppressHydrationWarning: !0, children: o ?? r }, n)),
|
|
123
|
+
/* @__PURE__ */ t(T, {}),
|
|
124
|
+
/* @__PURE__ */ t("del", { ...C({ "aria-label": "Fjern tekst" }) }),
|
|
125
|
+
/* @__PURE__ */ t(L, { "data-nofilter": i || void 0, children: O?.map(z).map(({ children: o, label: r, value: n }) => /* @__PURE__ */ t(k, { value: n, label: r, children: o ?? r }, n)) })
|
|
126
|
+
] }) : c
|
|
102
127
|
}
|
|
103
128
|
);
|
|
104
129
|
}
|
|
105
|
-
),
|
|
106
|
-
Affixes:
|
|
107
|
-
Combobox:
|
|
108
|
-
Datalist:
|
|
109
|
-
Option:
|
|
130
|
+
), jt = Object.assign(q, {
|
|
131
|
+
Affixes: I,
|
|
132
|
+
Combobox: G,
|
|
133
|
+
Datalist: L,
|
|
134
|
+
Option: k
|
|
110
135
|
});
|
|
111
136
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
jt as Field,
|
|
138
|
+
q as FieldComp
|
|
114
139
|
};
|
|
115
140
|
//# sourceMappingURL=field.js.map
|
package/mtds/field/field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sources":["../../designsystem/field/field.tsx"],"sourcesContent":["import type {\n\tReactUcombobox,\n\tUHTMLComboboxElement,\n} from \"@u-elements/u-combobox\";\nimport clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport { HelpText } from \"../react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport { type AnchorPosition, toCustomElementProps } from \"../utils\";\n\ntype FieldBaseProps = {\n\tcount?: number;\n\tdescription?: React.ReactNode;\n\terror?: React.ReactNode; // Kept for backwards compatibility\n\thelpText?: React.ReactNode;\n\thelpTextLabel?: string;\n\tlabel?: React.ReactNode;\n\toptions?: Array<string | { label: string; value: string }>;\n\tprefix?: string;\n\treadOnly?: boolean; // Allow readoOnly also on <select>\n\tsuffix?: string;\n\tvalidation?: React.ReactNode;\n};\n\nexport type FieldProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, FieldBaseProps>;\n\ntype FieldComponent = <As extends React.ElementType = \"div\">(\n\tprops: FieldProps<As>,\n) => JSX.Element;\n\nexport const FieldComp: FieldComponent = forwardRef<null>(function Field<\n\tAs extends React.ElementType = \"div\",\n>(\n\t{\n\t\t\"data-size\": size,\n\t\tas,\n\t\tclassName,\n\t\tcount,\n\t\tdescription,\n\t\terror,\n\t\thelpText,\n\t\thelpTextLabel,\n\t\tlabel,\n\t\toptions,\n\t\tprefix,\n\t\tstyle,\n\t\tsuffix,\n\t\tvalidation,\n\t\t...rest\n\t}: FieldProps<As>,\n\tref?: PolymorphicRef<As>,\n) {\n\tconst Tag = as || \"div\";\n\tconst affixes = !!suffix || !!prefix;\n\tconst valid = validation || error; // error kept for backwards compatibility\n\tconst shared = {\n\t\t\"data-size\": size,\n\t\tclassName: clsx(styles.field, className),\n\t\tstyle,\n\t};\n\n\t// Render options if select\n\tif (as === \"select\" && !rest.children)\n\t\tObject.assign(rest, {\n\t\t\tchildren: (\n\t\t\t\t<>\n\t\t\t\t\t{options\n\t\t\t\t\t\t?.map((o) => (typeof o === \"string\" ? { label: o, value: o } : o))\n\t\t\t\t\t\t.map(({ label, value }) => (\n\t\t\t\t\t\t\t<option key={value} value={value}>\n\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t))}\n\t\t\t\t</>\n\t\t\t),\n\t\t});\n\n\t// Using suppressHydrationWarning to avoid Next.js vs field-observer.ts hydration conflict\n\treturn as ? (\n\t\t<div {...shared}>\n\t\t\t{!!label && <label suppressHydrationWarning>{label}</label>}\n\t\t\t{!!helpText && <HelpText aria-label={helpTextLabel}>{helpText}</HelpText>}\n\t\t\t{!!description && <p>{description}</p>}\n\t\t\t{affixes ? (\n\t\t\t\t<FieldAffixes>\n\t\t\t\t\t{!!prefix && <span>{prefix}</span>}\n\t\t\t\t\t<Tag className={styles.input} ref={ref} {...rest} />\n\t\t\t\t\t{!!suffix && <span>{suffix}</span>}\n\t\t\t\t</FieldAffixes>\n\t\t\t) : (\n\t\t\t\t<Tag\n\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{!!valid && <div className={styles.validation}>{valid}</div>}\n\t\t\t{!!count && <p data-count={count} />}\n\t\t</div>\n\t) : (\n\t\t<div ref={ref} {...shared} {...rest} />\n\t);\n}) as FieldComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nconst FieldAffixes = forwardRef<HTMLDivElement, FieldProps>(\n\tfunction FieldAffixes({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<div className={clsx(styles.affixes, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n);\n\nexport type FieldDatalistProps = React.ComponentPropsWithoutRef<\"datalist\"> & {\n\t\"data-nofilter\"?: boolean;\n\t\"data-position\"?: AnchorPosition;\n};\n\nconst FieldDatalist = forwardRef<HTMLDataListElement, FieldDatalistProps>(\n\tfunction FieldDatalist(props, ref) {\n\t\treturn <u-datalist ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport type FieldOptionProps = React.ComponentPropsWithoutRef<\"option\">;\n\nconst FieldOption = forwardRef<HTMLOptionElement, FieldOptionProps>(\n\tfunction FieldOption(props, ref) {\n\t\treturn <u-option ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport type FieldComboboxProps = ReactUcombobox & {\n\t\"data-multiple\"?: boolean;\n\t\"data-creatable\"?: boolean;\n\tonAfterChange?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonBeforeChange?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonBeforeMatch?: (e: CustomEvent<HTMLOptionElement>) => void; // Custom event to handle before change\n};\n\nconst FieldCombobox = forwardRef<UHTMLComboboxElement, FieldComboboxProps>(\n\tfunction FieldCombobox(\n\t\t{ onAfterChange, onBeforeChange, onBeforeMatch, ...props },\n\t\tref,\n\t) {\n\t\treturn (\n\t\t\t<u-combobox\n\t\t\t\tref={ref}\n\t\t\t\t/* @ts-expect-error React 19 supports custom events out of the box */\n\t\t\t\tonafterchange={onAfterChange}\n\t\t\t\tonbeforechange={onBeforeChange}\n\t\t\t\tonbeforematch={onBeforeMatch}\n\t\t\t\t{...toCustomElementProps(props)}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport const Field = Object.assign(FieldComp, {\n\tAffixes: FieldAffixes,\n\tCombobox: FieldCombobox,\n\tDatalist: FieldDatalist,\n\tOption: FieldOption,\n});\n"],"names":["FieldComp","forwardRef","size","as","className","count","description","error","helpText","helpTextLabel","label","options","prefix","style","suffix","validation","rest","ref","Tag","affixes","valid","shared","clsx","styles","jsx","Fragment","o","value","jsxs","HelpText","FieldAffixes","FieldDatalist","props","toCustomElementProps","FieldOption","FieldCombobox","onAfterChange","onBeforeChange","onBeforeMatch","Field"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCa,MAAAA,IAA4BC,EAAiB,SAGzD;AAAA,EACC,aAAaC;AAAA,EACb,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACJ,GACAC,GACC;AACD,QAAMC,IAAMf,KAAM,OACZgB,IAAU,CAAC,CAACL,KAAU,CAAC,CAACF,GACxBQ,IAAQL,KAAcR,GACtBc,IAAS;AAAA,IACd,aAAanB;AAAA,IACb,WAAWoB,EAAKC,EAAO,OAAOnB,CAAS;AAAA,IACvC,OAAAS;AAAA,EACD;AAGI,SAAAV,MAAO,YAAY,CAACa,EAAK,YAC5B,OAAO,OAAOA,GAAM;AAAA,IACnB,UACC,gBAAAQ,EAAAC,GAAA,EACE,UACEd,GAAA,IAAI,CAACe,MAAO,OAAOA,KAAM,WAAW,EAAE,OAAOA,GAAG,OAAOA,EAAE,IAAIA,CAAE,EAChE,IAAI,CAAC,EAAE,OAAAhB,GAAO,OAAAiB,EAAM,MACnB,gBAAAH,EAAA,UAAA,EAAmB,OAAAG,GAClB,UAAAjB,EADW,GAAAiB,CAEb,CACA,EACH,CAAA;AAAA,EAAA,CAED,GAGKxB,IACN,gBAAAyB,EAAC,OAAK,EAAA,GAAGP,GACP,UAAA;AAAA,IAAA,CAAC,CAACX,KAAS,gBAAAc,EAAC,SAAM,EAAA,0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SAAqB+B,GAAOf,GAAK;AAChC,6BAAQ,YAAS,EAAA,KAAAA,GAAW,GAAGgB,EAAqBD,CAAK,GAAG;AAAA,EAAA;AAE9D,GAUMG,IAAgBlC;AAAA,EACrB,SACC,EAAE,eAAAmC,GAAe,gBAAAC,GAAgB,eAAAC,GAAe,GAAGN,EAAM,GACzDf,GACC;AAEA,WAAA,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,KAAAP;AAAA,QAEA,eAAemB;AAAA,QACf,gBAAgBC;AAAA,QAChB,eAAeC;AAAA,QACd,GAAGL,EAAqBD,CAAK;AAAA,MAAA;AAAA,IAC/B;AAAA,EAAA;AAGH,GAEaO,KAAQ,OAAO,OAAOvC,GAAW;AAAA,EAC7C,SAAS8B;AAAA,EACT,UAAUK;AAAA,EACV,UAAUJ;AAAA,EACV,QAAQG;AACT,CAAC;"}
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../../designsystem/field/field.tsx"],"sourcesContent":["import type {\n\tReactUcombobox,\n\tUHTMLComboboxElement,\n} from \"@u-elements/u-combobox\";\nimport clsx from \"clsx\";\nimport {\n\tforwardRef,\n\ttype JSX,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n} from \"react\";\nimport { HelpText, Input } from \"../react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport { type AnchorPosition, toCustomElementProps } from \"../utils\";\n\ntype FieldBaseProps = {\n\tcount?: number;\n\tdescription?: React.ReactNode;\n\terror?: React.ReactNode; // Kept for backwards compatibility\n\thelpText?: React.ReactNode;\n\thelpTextLabel?: string;\n\tlabel?: React.ReactNode;\n\toptions?: string[] | FieldComboboxSelected;\n\tprefix?: string;\n\treadOnly?: boolean; // Allow readoOnly also on <select>\n\tsuffix?: string;\n\tvalidation?: React.ReactNode;\n\tvalue?: React.ComponentPropsWithRef<\"input\">[\"value\"];\n\tonInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n};\n\nexport type FieldProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, FieldBaseProps>;\n\ntype FieldComponent = <As extends React.ElementType = \"div\">(\n\tprops: FieldProps<As>,\n) => JSX.Element;\n\nconst toOption = (\n\to: FieldComboboxSelected[number] | string,\n): FieldComboboxSelected[number] =>\n\ttypeof o === \"string\" ? { label: o, value: o } : o;\n\nexport const FieldComp: FieldComponent = forwardRef<null>(function Field<\n\tAs extends React.ElementType = \"div\",\n>(\n\t{\n\t\t\"data-size\": size,\n\t\tas,\n\t\tclassName,\n\t\tcount,\n\t\tdescription,\n\t\terror,\n\t\thelpText,\n\t\thelpTextLabel,\n\t\tlabel,\n\t\tprefix,\n\t\tstyle,\n\t\tsuffix,\n\t\tvalidation,\n\t\t...rest\n\t}: FieldProps<As>,\n\tref?: PolymorphicRef<As>,\n) {\n\tconst Tag = as || \"div\";\n\tconst affixes = !!suffix || !!prefix;\n\tconst valid = validation || error; // error kept for backwards compatibility\n\tconst shared = {\n\t\t\"data-size\": size,\n\t\tclassName: clsx(styles.field, className),\n\t\tstyle,\n\t};\n\n\t// Render options if select\n\tif (as === \"select\" && !rest.children)\n\t\tObject.assign(rest, {\n\t\t\tchildren: (\n\t\t\t\t<>\n\t\t\t\t\t{(rest.options as FieldBaseProps[\"options\"])\n\t\t\t\t\t\t?.map(toOption)\n\t\t\t\t\t\t.map(({ label, value }) => (\n\t\t\t\t\t\t\t<option key={value} value={value}>\n\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t))}\n\t\t\t\t</>\n\t\t\t),\n\t\t});\n\n\t// Using suppressHydrationWarning to avoid Next.js vs field-observer.ts hydration conflict\n\treturn as ? (\n\t\t<div {...shared}>\n\t\t\t{!!label && <label suppressHydrationWarning>{label}</label>}\n\t\t\t{!!helpText && <HelpText aria-label={helpTextLabel}>{helpText}</HelpText>}\n\t\t\t{!!description && <p>{description}</p>}\n\t\t\t{affixes ? (\n\t\t\t\t<FieldAffixes>\n\t\t\t\t\t{!!prefix && <span>{prefix}</span>}\n\t\t\t\t\t<Tag className={styles.input} ref={ref} {...rest} />\n\t\t\t\t\t{!!suffix && <span>{suffix}</span>}\n\t\t\t\t</FieldAffixes>\n\t\t\t) : (\n\t\t\t\t<Tag\n\t\t\t\t\tclassName={typeof as === \"string\" ? styles.input : undefined}\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{!!valid && <div className={styles.validation}>{valid}</div>}\n\t\t\t{!!count && <p data-count={count} />}\n\t\t</div>\n\t) : (\n\t\t<div ref={ref} {...shared} {...rest} />\n\t);\n}) as FieldComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nconst FieldAffixes = forwardRef<HTMLDivElement, FieldProps>(\n\tfunction FieldAffixes({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<div className={clsx(styles.affixes, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n);\n\nexport type FieldDatalistProps = React.ComponentPropsWithoutRef<\"datalist\"> & {\n\t\"data-nofilter\"?: boolean;\n\t\"data-position\"?: AnchorPosition;\n};\n\nconst FieldDatalist = forwardRef<HTMLDataListElement, FieldDatalistProps>(\n\tfunction FieldDatalist(props, ref) {\n\t\treturn <u-datalist ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport type FieldOptionProps = React.ComponentPropsWithoutRef<\"option\">;\n\nconst FieldOption = forwardRef<HTMLOptionElement, FieldOptionProps>(\n\tfunction FieldOption(props, ref) {\n\t\treturn <u-option ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport type FieldComboboxSelected = {\n\tlabel: string;\n\tvalue: string;\n\tchildren?: React.ReactNode;\n}[];\nexport type FieldComboboxProps = ReactUcombobox & {\n\t\"data-creatable\"?: boolean;\n\t\"data-multiple\"?: boolean;\n\tonAfterChange?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonBeforeChange?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonBeforeMatch?: (e: CustomEvent<HTMLOptionElement>) => void; // Custom event to handle before change\n} & (\n\t\t| {\n\t\t\t\t\"data-nofilter\"?: boolean;\n\t\t\t\tselected: FieldComboboxSelected; // Allow value to be a string or an array of strings for multiple select\n\t\t\t\toptions: FieldComboboxSelected;\n\t\t\t\tonSelectedChange: (selected: FieldComboboxSelected) => void; // Allow onChange to be a function that returns void\n\t\t }\n\t\t| {\n\t\t\t\t\"data-nofilter\"?: never;\n\t\t\t\tselected?: never;\n\t\t\t\toptions?: never;\n\t\t\t\tonSelectedChange?: never;\n\t\t }\n\t);\n\nconst FieldCombobox = forwardRef<UHTMLComboboxElement, FieldComboboxProps>(\n\tfunction FieldCombobox(\n\t\t{\n\t\t\t\"data-multiple\": multiple,\n\t\t\t\"data-nofilter\": nofilter,\n\t\t\tchildren,\n\t\t\tonAfterChange,\n\t\t\tonBeforeChange,\n\t\t\tonBeforeMatch,\n\t\t\tonSelectedChange,\n\t\t\toptions,\n\t\t\tselected,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) {\n\t\tconst innerRef = useRef<UHTMLComboboxElement>(null);\n\t\tconst isControlled = selected !== undefined;\n\t\tconst handleSelected = useRef(onSelectedChange);\n\t\thandleSelected.current = onSelectedChange; // Keep the latest onSelectedChange function\n\n\t\tuseImperativeHandle(ref, () => innerRef.current as UHTMLComboboxElement); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tconst self = innerRef.current;\n\t\t\tconst handleBeforeChange = (event: CustomEvent<HTMLDataElement>) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst { isConnected: remove, textContent, value } = event.detail;\n\t\t\t\tconst onSelected = handleSelected.current;\n\t\t\t\tconst label = textContent?.trim() || \"\";\n\t\t\t\tconst prev = selected || [];\n\n\t\t\t\tif (remove) onSelected?.(prev.filter((i) => i.value !== value));\n\t\t\t\telse if (multiple) onSelected?.([...prev, { value, label }]);\n\t\t\t\telse onSelected?.([{ value, label }]);\n\t\t\t};\n\n\t\t\tself?.addEventListener(\"beforechange\", handleBeforeChange);\n\t\t\treturn () =>\n\t\t\t\tself?.removeEventListener(\"beforechange\", handleBeforeChange);\n\t\t}, [multiple, selected]);\n\n\t\treturn (\n\t\t\t<u-combobox\n\t\t\t\t/* @ts-expect-error React 19 supports custom events out of the box */\n\t\t\t\tonbeforechange={onBeforeChange}\n\t\t\t\tonbeforematch={onBeforeMatch}\n\t\t\t\tonafterchange={onAfterChange}\n\t\t\t\tdata-multiple={multiple}\n\t\t\t\tref={innerRef}\n\t\t\t\t{...toCustomElementProps(props)}\n\t\t\t>\n\t\t\t\t{isControlled ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{selected?.map(({ children, label, value }) => (\n\t\t\t\t\t\t\t<data key={value} value={value} suppressHydrationWarning>\n\t\t\t\t\t\t\t\t{children ?? label}\n\t\t\t\t\t\t\t</data>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t<Input />\n\t\t\t\t\t\t<del {...toCustomElementProps({ \"aria-label\": \"Fjern tekst\" })} />\n\t\t\t\t\t\t<FieldDatalist data-nofilter={nofilter || undefined}>\n\t\t\t\t\t\t\t{options?.map(toOption).map(({ children, label, value }) => (\n\t\t\t\t\t\t\t\t<FieldOption key={value} value={value} label={label}>\n\t\t\t\t\t\t\t\t\t{children ?? label}\n\t\t\t\t\t\t\t\t</FieldOption>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</FieldDatalist>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tchildren\n\t\t\t\t)}\n\t\t\t</u-combobox>\n\t\t);\n\t},\n);\n\nexport const Field = Object.assign(FieldComp, {\n\tAffixes: FieldAffixes,\n\tCombobox: FieldCombobox,\n\tDatalist: FieldDatalist,\n\tOption: FieldOption,\n});\n"],"names":["toOption","o","FieldComp","forwardRef","size","as","className","count","description","error","helpText","helpTextLabel","label","prefix","style","suffix","validation","rest","ref","Tag","affixes","valid","shared","clsx","styles","value","jsx","jsxs","HelpText","FieldAffixes","FieldDatalist","props","toCustomElementProps","FieldOption","FieldCombobox","multiple","nofilter","children","onAfterChange","onBeforeChange","onBeforeMatch","onSelectedChange","options","selected","innerRef","useRef","isControlled","handleSelected","useImperativeHandle","useEffect","self","handleBeforeChange","event","remove","textContent","onSelected","prev","i","Fragment","Input","Field"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAMA,IAAW,CAChBC,MAEA,OAAOA,KAAM,WAAW,EAAE,OAAOA,GAAG,OAAOA,EAAA,IAAMA,GAErCC,IAA4BC,EAAiB,SAGzD;AAAA,EACC,aAAaC;AAAA,EACb,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACJ,GACAC,GACC;AACD,QAAMC,IAAMd,KAAM,OACZe,IAAU,CAAC,CAACL,KAAU,CAAC,CAACF,GACxBQ,IAAQL,KAAcP,GACtBa,IAAS;AAAA,IACd,aAAalB;AAAA,IACb,WAAWmB,EAAKC,EAAO,OAAOlB,CAAS;AAAA,IACvC,OAAAQ;AAAA,EACD;AAGI,SAAAT,MAAO,YAAY,CAACY,EAAK,YAC5B,OAAO,OAAOA,GAAM;AAAA,IACnB,iCAEI,UAAKA,EAAA,SACJ,IAAIjB,CAAQ,EACb,IAAI,CAAC,EAAE,OAAAY,GAAO,OAAAa,EAAA,MACb,gBAAAC,EAAA,UAAA,EAAmB,OAAAD,GAClB,UAAAb,EAAAA,GADWa,CAEb,CACA,EACH,CAAA;AAAA,EAAA,CAED,GAGKpB,IACN,gBAAAsB,EAAC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,GAGtB,gBAAAjB;AAAA,MAAC;AAAA,MAAA;AAAA,QAEA,gBAAgBa;AAAA,QAChB,eAAeC;AAAA,QACf,eAAeF;AAAA,QACf,iBAAeH;AAAA,QACf,KAAKS;AAAA,QACJ,GAAGZ,EAAqBD,CAAK;AAAA,QAE7B,cAEE,gBAAAJ,EAAA+B,GAAA,EAAA,UAAA;AAAA,UAAAf,GAAU,IAAI,CAAC,EAAE,UAAAN,GAAU,OAAAzB,GAAO,OAAAa,EAAM,MACvC,gBAAAC,EAAA,QAAA,EAAiB,OAAAD,GAAc,0BAAwB,IACtD,UAAAY,KAAYzB,EAAA,GADHa,CAEX,CACA;AAAA,4BACAkC,GAAM,EAAA;AAAA,UACP,gBAAAjC,EAAC,SAAK,GAAGM,EAAqB,EAAE,cAAc,cAAe,CAAA,GAAG;AAAA,UAChE,gBAAAN,EAACI,GAAc,EAAA,iBAAeM,KAAY,QACxC,UAASM,GAAA,IAAI1C,CAAQ,EAAE,IAAI,CAAC,EAAE,UAAAqC,GAAU,OAAAzB,GAAO,OAAAa,EAC/C,MAAA,gBAAAC,EAACO,GAAwB,EAAA,OAAAR,GAAc,OAAAb,GACrC,UAAAyB,KAAYzB,KADIa,CAElB,CACA,EACF,CAAA;AAAA,QAAA,EAAA,CACD,IAEAY;AAAA,MAAA;AAAA,IAEF;AAAA,EAAA;AAGH,GAEauB,KAAQ,OAAO,OAAO1D,GAAW;AAAA,EAC7C,SAAS2B;AAAA,EACT,UAAUK;AAAA,EACV,UAAUJ;AAAA,EACV,QAAQG;AACT,CAAC;"}
|
|
@@ -112,7 +112,7 @@ declare const meta: {
|
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
suffix: {
|
|
116
116
|
description: string;
|
|
117
117
|
table: {
|
|
118
118
|
defaultValue: {
|
|
@@ -145,6 +145,39 @@ declare const meta: {
|
|
|
145
145
|
};
|
|
146
146
|
};
|
|
147
147
|
};
|
|
148
|
+
"data-nofilter": {
|
|
149
|
+
description: string;
|
|
150
|
+
table: {
|
|
151
|
+
defaultValue: {
|
|
152
|
+
summary: undefined;
|
|
153
|
+
};
|
|
154
|
+
type: {
|
|
155
|
+
summary: undefined;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
selected: {
|
|
160
|
+
description: string;
|
|
161
|
+
table: {
|
|
162
|
+
defaultValue: {
|
|
163
|
+
summary: undefined;
|
|
164
|
+
};
|
|
165
|
+
type: {
|
|
166
|
+
summary: undefined;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
onSelectedChange: {
|
|
171
|
+
description: string;
|
|
172
|
+
table: {
|
|
173
|
+
defaultValue: {
|
|
174
|
+
summary: undefined;
|
|
175
|
+
};
|
|
176
|
+
type: {
|
|
177
|
+
summary: undefined;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
};
|
|
148
181
|
};
|
|
149
182
|
decorators: ((Story: import('storybook/internal/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
150
183
|
[x: string]: any;
|
|
@@ -167,7 +200,7 @@ export declare const WithComboboxMultiple: Story;
|
|
|
167
200
|
export declare const WithComboboxAPI: Story;
|
|
168
201
|
export declare const WithComboboxCustomFilter: Story;
|
|
169
202
|
export declare const ReactWithCombobox: Story;
|
|
203
|
+
export declare const ReactWithComboboxWithChildren: Story;
|
|
170
204
|
export declare const ReactWithComboboxMultiple: Story;
|
|
171
205
|
export declare const ReactWithComboboxLong: Story;
|
|
172
|
-
export declare const ReactWithCombobxControlled: Story;
|
|
173
206
|
export declare const ReactWithCombobxCustomFilter: Story;
|