@kystverket/styrbord 1.2.2 → 1.2.3
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/dist/main.js
CHANGED
|
@@ -370,7 +370,11 @@ const r8 = "_frame_ilave_1", a8 = "_content_ilave_17", i8 = "_file_ilave_22", s8
|
|
|
370
370
|
if (r.contentType === "pdf") return /* @__PURE__ */ u.jsx(x8, { tabIndex: t, file: r, className: n });
|
|
371
371
|
if (r.contentType === "json") return /* @__PURE__ */ u.jsx(L8, { tabIndex: t, file: r, className: n });
|
|
372
372
|
}, y8 = ({ file: r, className: n }) => /* @__PURE__ */ u.jsx("img", { src: r.src, className: `${d0.image} ${n || ""}` }), w8 = ({ file: r, className: n }) => /* @__PURE__ */ u.jsx("img", { className: `${d0.previewFile} ${n || ""}`, src: r.src }), b8 = ({ file: r, className: n }) => /* @__PURE__ */ u.jsx(B, { align: "center", justify: "center", className: `${d0.thumbnail} ${d0.flexCenter} ${n || ""}`, children: /* @__PURE__ */ u.jsx("p", { children: r.fileName }) });
|
|
373
|
-
function L8({
|
|
373
|
+
function L8({
|
|
374
|
+
file: r,
|
|
375
|
+
className: n,
|
|
376
|
+
tabIndex: e
|
|
377
|
+
}) {
|
|
374
378
|
const t = (s) => {
|
|
375
379
|
const o = window.getSelection(), l = document.createRange();
|
|
376
380
|
l.selectNodeContents(s), o == null || o.removeAllRanges(), o == null || o.addRange(l);
|
|
@@ -390,7 +394,11 @@ function L8({ file: r, className: n, tabIndex: e }) {
|
|
|
390
394
|
}
|
|
391
395
|
);
|
|
392
396
|
}
|
|
393
|
-
const _8 = ({ file: r, className: n }) => /* @__PURE__ */ u.jsx(B, { className: `${d0.thumbnail} ${d0.flexCenter} ${n || ""}`, children: /* @__PURE__ */ u.jsx("p", { children: r.fileName }) }), x8 = ({
|
|
397
|
+
const _8 = ({ file: r, className: n }) => /* @__PURE__ */ u.jsx(B, { className: `${d0.thumbnail} ${d0.flexCenter} ${n || ""}`, children: /* @__PURE__ */ u.jsx("p", { children: r.fileName }) }), x8 = ({
|
|
398
|
+
file: r,
|
|
399
|
+
className: n,
|
|
400
|
+
tabIndex: e
|
|
401
|
+
}) => /* @__PURE__ */ u.jsx("embed", { tabIndex: e, className: `${d0.previewFile} ${n || ""}`, src: r.src }), k8 = () => {
|
|
394
402
|
const r = k2(null), n = k2(!1), e = k2(!1), t = k2(0), a = k2(0), i = r1((l) => {
|
|
395
403
|
r.current && (n.current = !0, e.current = !1, t.current = l.pageX - r.current.offsetLeft, a.current = r.current.scrollLeft);
|
|
396
404
|
}, []), s = r1((l) => {
|
|
@@ -2,31 +2,25 @@ type ButtonOptions = {
|
|
|
2
2
|
showDownload?: boolean;
|
|
3
3
|
showOpenInNew?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export type
|
|
6
|
-
contentType: 'pdf';
|
|
7
|
-
src: string;
|
|
5
|
+
export type FileInfo = {
|
|
8
6
|
fileName: string;
|
|
9
7
|
fileSize?: string;
|
|
10
8
|
buttons?: ButtonOptions;
|
|
9
|
+
} & (PdfFile | ImageFile | JsonFile);
|
|
10
|
+
type PdfFile = {
|
|
11
|
+
contentType: 'pdf';
|
|
12
|
+
src: string;
|
|
11
13
|
};
|
|
12
|
-
|
|
14
|
+
type ImageFile = {
|
|
13
15
|
contentType: 'image';
|
|
14
16
|
src: string;
|
|
15
|
-
fileName: string;
|
|
16
|
-
fileSize?: string;
|
|
17
|
-
buttons?: ButtonOptions;
|
|
18
17
|
};
|
|
19
|
-
|
|
18
|
+
type JsonFile = {
|
|
20
19
|
contentType: 'json';
|
|
21
20
|
data: Record<string, unknown>;
|
|
22
|
-
fileName: string;
|
|
23
|
-
fileSize?: string;
|
|
24
|
-
buttons?: ButtonOptions;
|
|
25
|
-
};
|
|
26
|
-
export declare const defaultButtonsByType: {
|
|
27
|
-
pdf: ButtonOptions;
|
|
28
|
-
image: ButtonOptions;
|
|
29
|
-
json: ButtonOptions;
|
|
30
21
|
};
|
|
31
|
-
export type FileInfo =
|
|
22
|
+
export type FileInfoByContentType<T extends FileInfo['contentType']> = Extract<FileInfo, {
|
|
23
|
+
contentType: T;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const defaultButtonsByType: Record<FileInfo['contentType'], ButtonOptions>;
|
|
32
26
|
export {};
|