@arkitektbedriftene/fe-lib 2.0.7 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { type CSS } from "@ui";
3
- export declare const CompanyLogo: ({ companyId, maxWidth, fallback, width, css, }: {
3
+ export declare const CompanyLogo: import("react").ForwardRefExoticComponent<{
4
4
  companyId: number | string;
5
5
  maxWidth: string;
6
6
  fallback?: string | undefined;
@@ -11,9 +11,13 @@ export declare const CompanyLogo: ({ companyId, maxWidth, fallback, width, css,
11
11
  themeMap: {};
12
12
  utils: {};
13
13
  }> | undefined;
14
- }) => JSX.Element | null;
14
+ } & import("react").RefAttributes<HTMLImageElement>>;
15
15
  export declare const createCompanyLogoElement: ({ companyId, maxWidth, width, }: {
16
16
  companyId: string | number;
17
17
  maxWidth: string;
18
18
  width?: number | undefined;
19
19
  }) => HTMLImageElement;
20
+ export declare const getCompanyLogoUrl: ({ companyId, width, }: {
21
+ companyId: string | number;
22
+ width?: number | undefined;
23
+ }) => string;
@@ -1,46 +1,53 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useState as a } from "react";
3
- import { Box as p } from "./ui.es.js";
4
- const l = ({
5
- companyId: r,
6
- maxWidth: e,
7
- fallback: o = void 0,
8
- width: t = 500,
9
- css: s
10
- }) => {
11
- const [n, c] = a(
12
- `https://prod-content-ab.azurewebsites.net/api/Logo/${r}?width=${t}`
13
- ), i = () => {
14
- c(o);
15
- };
16
- return n ? /* @__PURE__ */ m(
17
- p,
18
- {
19
- as: "img",
20
- src: n,
21
- onError: n !== o ? i : void 0,
22
- css: {
23
- maxWidth: e,
24
- maxHeight: `calc(${e} / 2)`,
25
- ...s
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import { forwardRef as p, useState as u } from "react";
3
+ import { Box as d } from "./ui.es.js";
4
+ const E = p(
5
+ ({
6
+ companyId: r,
7
+ maxWidth: o,
8
+ fallback: t = void 0,
9
+ width: e = 500,
10
+ css: c
11
+ }, m) => {
12
+ const [n, a] = u(
13
+ s({ companyId: r, width: e })
14
+ ), i = () => {
15
+ a(t);
16
+ };
17
+ return n ? /* @__PURE__ */ g(
18
+ d,
19
+ {
20
+ ref: m,
21
+ as: "img",
22
+ src: n,
23
+ onError: n !== t ? i : void 0,
24
+ css: {
25
+ maxWidth: o,
26
+ maxHeight: `calc(${o} / 2)`,
27
+ ...c
28
+ }
26
29
  }
27
- }
28
- ) : null;
29
- }, h = ({
30
+ ) : null;
31
+ }
32
+ ), L = ({
30
33
  companyId: r,
31
- maxWidth: e,
32
- width: o = 500
34
+ maxWidth: o,
35
+ width: t = 500
33
36
  }) => {
34
- const t = document.createElement("img");
35
- return t.style.maxWidth = e, t.style.maxHeight = `calc(${e} / 2)`, t.addEventListener(
37
+ const e = document.createElement("img");
38
+ return e.style.maxWidth = o, e.style.maxHeight = `calc(${o} / 2)`, e.addEventListener(
36
39
  "error",
37
40
  () => {
38
- t.remove();
41
+ e.remove();
39
42
  },
40
43
  { once: !0 }
41
- ), t.src = `https://prod-content-ab.azurewebsites.net/api/Logo/${r}?width=${o}`, t;
42
- };
44
+ ), e.src = s({ companyId: r, width: t }), e;
45
+ }, s = ({
46
+ companyId: r,
47
+ width: o = 500
48
+ }) => `https://prod-content-ab.azurewebsites.net/api/Logo/${r}?width=${o}`;
43
49
  export {
44
- l as CompanyLogo,
45
- h as createCompanyLogoElement
50
+ E as CompanyLogo,
51
+ L as createCompanyLogoElement,
52
+ s as getCompanyLogoUrl
46
53
  };
@@ -14,7 +14,7 @@ export declare const stateToHTML: (state: SerializedEditorState | string | null
14
14
  export declare const syncStateToHTML: (state: SerializedEditorState | string | null | undefined, nodes: CreateEditorArgs["nodes"], options?: {
15
15
  maxLines?: number | null;
16
16
  onlyMainContent?: boolean;
17
- }) => Promise<{
17
+ }) => {
18
18
  html: string;
19
19
  trimCount: number;
20
- }>;
20
+ };
@@ -118,7 +118,7 @@ const sr = ({
118
118
  return i.read(() => {
119
119
  l = St(i);
120
120
  }), { html: l, trimCount: n };
121
- }, In = async (t, r, e) => {
121
+ }, In = (t, r, e) => {
122
122
  let n = 0;
123
123
  const i = Nt({
124
124
  nodes: r,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektbedriftene/fe-lib",
3
- "version": "2.0.7",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {