@kystverket/styrbord 1.2.1 → 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({ file: r, className: n, tabIndex: e }) {
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 = ({ file: r, className: n, tabIndex: e }) => /* @__PURE__ */ u.jsx("embed", { tabIndex: e, className: `${d0.previewFile} ${n || ""}`, src: r.src }), k8 = () => {
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) => {
@@ -6,6 +6,13 @@ declare const meta: {
6
6
  decorators: ((Story: import("@storybook/types").PartialStoryFn) => React.JSX.Element)[];
7
7
  tags: string[];
8
8
  argTypes: {};
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: string;
13
+ };
14
+ };
15
+ };
9
16
  };
10
17
  export default meta;
11
18
  type Story = StoryObj<typeof meta>;
@@ -9,6 +9,13 @@ declare const meta: {
9
9
  decorators: ((Story: import("@storybook/types").PartialStoryFn) => React.JSX.Element)[];
10
10
  tags: string[];
11
11
  argTypes: {};
12
+ parameters: {
13
+ docs: {
14
+ description: {
15
+ component: string;
16
+ };
17
+ };
18
+ };
12
19
  };
13
20
  export default meta;
14
21
  type Story = StoryObj<typeof meta>;
@@ -7,6 +7,13 @@ declare const meta: {
7
7
  decorators: ((Story: import("@storybook/types").PartialStoryFn) => React.JSX.Element)[];
8
8
  tags: string[];
9
9
  argTypes: {};
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: string;
14
+ };
15
+ };
16
+ };
10
17
  };
11
18
  export default meta;
12
19
  type Story = StoryObj<typeof meta>;
@@ -6,6 +6,13 @@ declare const meta: {
6
6
  decorators: ((Story: import("@storybook/types").PartialStoryFn) => React.JSX.Element)[];
7
7
  tags: string[];
8
8
  argTypes: {};
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: string;
13
+ };
14
+ };
15
+ };
9
16
  };
10
17
  export default meta;
11
18
  type Story = StoryObj<typeof meta>;
@@ -8,6 +8,11 @@ declare const _default: {
8
8
  customStyles: {
9
9
  justifyContent: string;
10
10
  };
11
+ docs: {
12
+ description: {
13
+ component: string;
14
+ };
15
+ };
11
16
  };
12
17
  };
13
18
  export default _default;
@@ -6,6 +6,13 @@ declare const meta: {
6
6
  decorators: ((Story: import("@storybook/types").PartialStoryFn) => React.JSX.Element)[];
7
7
  tags: string[];
8
8
  argTypes: {};
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: string;
13
+ };
14
+ };
15
+ };
9
16
  };
10
17
  export default meta;
11
18
  type Story = StoryObj<typeof meta>;
@@ -6,6 +6,13 @@ declare const meta: {
6
6
  decorators: ((Story: import("@storybook/types").PartialStoryFn) => React.JSX.Element)[];
7
7
  tags: string[];
8
8
  argTypes: {};
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: string;
13
+ };
14
+ };
15
+ };
9
16
  };
10
17
  export default meta;
11
18
  type Story = StoryObj<typeof meta>;
@@ -6,6 +6,13 @@ declare const meta: {
6
6
  decorators: ((Story: import("@storybook/types").PartialStoryFn) => React.JSX.Element)[];
7
7
  tags: string[];
8
8
  argTypes: {};
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: string;
13
+ };
14
+ };
15
+ };
9
16
  };
10
17
  export default meta;
11
18
  type Story = StoryObj<typeof meta>;
@@ -2,31 +2,25 @@ type ButtonOptions = {
2
2
  showDownload?: boolean;
3
3
  showOpenInNew?: boolean;
4
4
  };
5
- export type PdfFile = {
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
- export type ImageFile = {
14
+ type ImageFile = {
13
15
  contentType: 'image';
14
16
  src: string;
15
- fileName: string;
16
- fileSize?: string;
17
- buttons?: ButtonOptions;
18
17
  };
19
- export type JsonFile = {
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 = PdfFile | ImageFile | JsonFile;
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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kystverket/styrbord",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "repository": {