@arkitektbedriftene/fe-lib 5.1.0 → 5.1.1

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,8 @@
1
1
  export declare const richTextStyleObj: {
2
2
  fontSize: string;
3
3
  lineHeight: string;
4
+ whiteSpace: string;
5
+ wordBreak: string;
4
6
  "h1, h2, h3, h4, h5, h6": {
5
7
  fontWeight: string;
6
8
  lineHeight: string;
@@ -3,7 +3,7 @@ var Me = (t, r, e) => r in t ? Ce(t, r, { enumerable: !0, configurable: !0, writ
3
3
  var $ = (t, r, e) => Me(t, typeof r != "symbol" ? r + "" : r, e);
4
4
  import { createHeadlessEditor as Bt } from "@lexical/headless";
5
5
  import { $generateHtmlFromNodes as Pt } from "@lexical/html";
6
- import { $getRoot as V, ParagraphNode as Te, $createParagraphNode as G, $createTextNode as z, $setSelection as nt, $getNodeByKey as dt, DecoratorNode as xe, $applyNodeReplacement as Le, SELECTION_CHANGE_COMMAND as Q, $getSelection as y, COMMAND_PRIORITY_EDITOR as q, $isRangeSelection as R, $isRootOrShadowRoot as Ht, FORMAT_TEXT_COMMAND as A, COMMAND_PRIORITY_LOW as D, KEY_ARROW_DOWN_COMMAND as _e, KEY_ARROW_UP_COMMAND as we, KEY_ESCAPE_COMMAND as Ft, KEY_SPACE_COMMAND as ye, $getNearestNodeFromDOMNode as mt, KEY_ARROW_LEFT_COMMAND as Se, $isElementNode as Ne, createCommand as Ee, $insertNodes as Re, $createRangeSelection as Ut, COMMAND_PRIORITY_HIGH as Ie, FORMAT_ELEMENT_COMMAND as ht } from "lexical";
6
+ import { $getRoot as V, ParagraphNode as Te, $createParagraphNode as G, $createTextNode as z, $setSelection as nt, $getNodeByKey as dt, DecoratorNode as xe, $applyNodeReplacement as Le, SELECTION_CHANGE_COMMAND as Q, $getSelection as y, COMMAND_PRIORITY_EDITOR as q, $isRangeSelection as R, $isRootOrShadowRoot as Ht, FORMAT_TEXT_COMMAND as A, COMMAND_PRIORITY_LOW as D, KEY_ARROW_DOWN_COMMAND as we, KEY_ARROW_UP_COMMAND as _e, KEY_ESCAPE_COMMAND as Ft, KEY_SPACE_COMMAND as ye, $getNearestNodeFromDOMNode as mt, KEY_ARROW_LEFT_COMMAND as Se, $isElementNode as Ne, createCommand as Ee, $insertNodes as Re, $createRangeSelection as Ut, COMMAND_PRIORITY_HIGH as Ie, FORMAT_ELEMENT_COMMAND as ht } from "lexical";
7
7
  import { trimTextContentFromAnchor as Oe, $setBlocksType as ut, $getSelectionStyleValueForProperty as ze, $patchStyleText as $e, $isAtNodeEnd as yt } from "@lexical/selection";
8
8
  import { $dfs as Ae, $getNearestNodeOfType as De, $findMatchingParent as Wt, mergeRegister as ot, isHTMLElement as St, $wrapNodeInElement as Be, mediaFileReader as Pe, isMimeType as He } from "@lexical/utils";
9
9
  import { LinkNode as W, AutoLinkNode as jt, $isLinkNode as tt, TOGGLE_LINK_COMMAND as it } from "@lexical/link";
@@ -14,15 +14,15 @@ import { jsx as n, jsxs as h, Fragment as P } from "react/jsx-runtime";
14
14
  import { createContext as Qe, useState as p, useRef as J, useCallback as M, useContext as Ze, useEffect as L, useMemo as Qt, useLayoutEffect as tr } from "react";
15
15
  import { Box as B, Stack as er, Button as S, DropdownMenu as at, ToolbarButton as lt, DropdownMenuIconItem as T, ToolbarToggleGroup as et, ToolbarToggleItem as O, Popover as Zt, PopoverTrigger as te, PopoverContent as ee, OverlayCard as re, Toolbar as rr, ToolbarSeparator as Rt, styled as nr, Spinner as st, Dialog as ne, DialogHeader as or, TextInput as bt, DialogActions as ct, DropdownMenuItem as U, DropdownMenuSeparator as It, NavBar as ir, NavBarItem as gt, Combobox as ar } from "./ui.es.js";
16
16
  import { f as lr, g as sr, h as cr, G as f, i as dr, j as hr, k as ur, l as gr } from "./index.esm-Dzt91gSZ.js";
17
- import { useLexicalComposerContext as _ } from "@lexical/react/LexicalComposerContext.js";
17
+ import { useLexicalComposerContext as w } from "@lexical/react/LexicalComposerContext.js";
18
18
  import { HorizontalRuleNode as pr } from "@lexical/react/LexicalHorizontalRuleNode.js";
19
19
  import { LexicalComposer as mr } from "@lexical/react/LexicalComposer.js";
20
20
  import { RichTextPlugin as fr } from "@lexical/react/LexicalRichTextPlugin.js";
21
21
  import { LexicalErrorBoundary as kr } from "@lexical/react/LexicalErrorBoundary.js";
22
22
  import { useFloating as vt, autoUpdate as oe, size as br, flip as vr, offset as ie, shift as Cr, useInteractions as ae, useRole as le, FloatingPortal as se, inline as Mr, useDismiss as Tr } from "@floating-ui/react";
23
23
  import { s as xr, c as Lr } from "./stitches.config-CEYOm13b.js";
24
- import { ListPlugin as _r } from "@lexical/react/LexicalListPlugin.js";
25
- import { HistoryPlugin as wr } from "@lexical/react/LexicalHistoryPlugin.js";
24
+ import { ListPlugin as wr } from "@lexical/react/LexicalListPlugin.js";
25
+ import { HistoryPlugin as _r } from "@lexical/react/LexicalHistoryPlugin.js";
26
26
  import { TablePlugin as yr } from "@lexical/react/LexicalTablePlugin.js";
27
27
  import { HorizontalRulePlugin as Sr } from "@lexical/react/LexicalHorizontalRulePlugin.js";
28
28
  import { TabIndentationPlugin as Nr } from "@lexical/react/LexicalTabIndentationPlugin.js";
@@ -211,7 +211,7 @@ function $r({
211
211
  height: o,
212
212
  nodeKey: i
213
213
  }) {
214
- const { signUrl: a } = H(), [l, s] = p(a ? "" : t), [d, c] = p(!1), u = J(!1), [g] = _();
214
+ const { signUrl: a } = H(), [l, s] = p(a ? "" : t), [d, c] = p(!1), u = J(!1), [g] = w();
215
215
  L(() => {
216
216
  const m = async () => {
217
217
  s(await (a == null ? void 0 : a(t)) || t);
@@ -225,7 +225,7 @@ function $r({
225
225
  const m = dt(i);
226
226
  m && m.remove();
227
227
  });
228
- }, w = () => {
228
+ }, _ = () => {
229
229
  g.update(() => {
230
230
  var N;
231
231
  const m = dt(i);
@@ -277,7 +277,7 @@ function $r({
277
277
  icon: !0,
278
278
  size: "sm",
279
279
  css: { width: "20px", height: "20px" },
280
- onClick: w,
280
+ onClick: _,
281
281
  children: /* @__PURE__ */ n(sr, {})
282
282
  }
283
283
  ),
@@ -583,7 +583,7 @@ const ln = xr("div", {
583
583
  element: e
584
584
  };
585
585
  }, dn = () => {
586
- const [t] = _(), [r, e] = p("paragraph");
586
+ const [t] = w(), [r, e] = p("paragraph");
587
587
  L(() => t.registerCommand(
588
588
  Q,
589
589
  () => {
@@ -657,9 +657,9 @@ const ln = xr("div", {
657
657
  }
658
658
  ) });
659
659
  }, hn = () => {
660
- const [t] = _(), [r, e] = p(!1), [o, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, u] = p(!1), [g, v] = p(!1), [x, w] = p(!1), [k, m] = p(""), [C, N] = p(!1), I = M(() => {
660
+ const [t] = w(), [r, e] = p(!1), [o, i] = p(!1), [a, l] = p(!1), [s, d] = p(!1), [c, u] = p(!1), [g, v] = p(!1), [x, _] = p(!1), [k, m] = p(""), [C, N] = p(!1), I = M(() => {
661
661
  const b = y();
662
- R(b) && (e(b.hasFormat("bold")), i(b.hasFormat("italic")), l(b.hasFormat("underline")), d(b.hasFormat("strikethrough")), u(b.hasFormat("code")), v(b.hasFormat("superscript")), w(b.hasFormat("subscript")), m(ze(b, "color", "")));
662
+ R(b) && (e(b.hasFormat("bold")), i(b.hasFormat("italic")), l(b.hasFormat("underline")), d(b.hasFormat("strikethrough")), u(b.hasFormat("code")), v(b.hasFormat("superscript")), _(b.hasFormat("subscript")), m(ze(b, "color", "")));
663
663
  }, []);
664
664
  L(() => ot(
665
665
  t.registerCommand(
@@ -694,7 +694,7 @@ const ln = xr("div", {
694
694
  ), ve = M(
695
695
  () => t.dispatchCommand(A, "subscript"),
696
696
  [t]
697
- ), wt = Qt(() => {
697
+ ), _t = Qt(() => {
698
698
  const b = [];
699
699
  return r && b.push("bold"), o && b.push("italic"), a && b.push("underline"), s && b.push("strikethrough"), c && b.push("code"), g && b.push("superscript"), x && b.push("subscript"), k && b.push("color"), b;
700
700
  }, [
@@ -713,7 +713,7 @@ const ln = xr("div", {
713
713
  {
714
714
  type: "multiple",
715
715
  "aria-label": "Tekstformattering",
716
- value: wt,
716
+ value: _t,
717
717
  children: [
718
718
  /* @__PURE__ */ n(O, { onClick: Y, title: "Fet tekst", value: "bold", children: /* @__PURE__ */ n(Pr, { size: "1.25rem" }) }),
719
719
  /* @__PURE__ */ n(
@@ -744,7 +744,7 @@ const ln = xr("div", {
744
744
  {
745
745
  type: "multiple",
746
746
  "aria-label": "Tekstformattering",
747
- value: wt,
747
+ value: _t,
748
748
  css: { margin: "$1" },
749
749
  children: [
750
750
  /* @__PURE__ */ n(
@@ -788,7 +788,7 @@ const ln = xr("div", {
788
788
  { name: "Blå", value: "#2044b8" },
789
789
  { name: "Lilla", value: "#9c31de" }
790
790
  ], gn = ({ activeColor: t }) => {
791
- const [r] = _(), [e, o] = p(!1), i = (a) => {
791
+ const [r] = w(), [e, o] = p(!1), i = (a) => {
792
792
  r.update(() => {
793
793
  const l = y();
794
794
  l && $e(l, { color: a });
@@ -892,7 +892,7 @@ const ln = xr("div", {
892
892
  t
893
893
  ] });
894
894
  function fn() {
895
- const [t] = _();
895
+ const [t] = w();
896
896
  return L(() => ot(
897
897
  t.registerCommand(
898
898
  Gt,
@@ -900,12 +900,12 @@ function fn() {
900
900
  D
901
901
  ),
902
902
  t.registerCommand(
903
- _e,
903
+ we,
904
904
  (r) => At(r, t, !1),
905
905
  D
906
906
  ),
907
907
  t.registerCommand(
908
- we,
908
+ _e,
909
909
  (r) => At(r, t, !0),
910
910
  D
911
911
  ),
@@ -1051,9 +1051,9 @@ function vn() {
1051
1051
  }, [t]), null;
1052
1052
  }
1053
1053
  const Cn = () => /* @__PURE__ */ h(P, { children: [
1054
- /* @__PURE__ */ n(_r, {}),
1055
- /* @__PURE__ */ n(yr, {}),
1056
1054
  /* @__PURE__ */ n(wr, {}),
1055
+ /* @__PURE__ */ n(yr, {}),
1056
+ /* @__PURE__ */ n(_r, {}),
1057
1057
  /* @__PURE__ */ n(fn, {}),
1058
1058
  /* @__PURE__ */ n(Nr, {}),
1059
1059
  /* @__PURE__ */ n(vn, {}),
@@ -1061,7 +1061,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1061
1061
  ] }), Mn = ({
1062
1062
  state: t
1063
1063
  }) => {
1064
- const [r] = _(), e = J(!1);
1064
+ const [r] = w(), e = J(!1);
1065
1065
  return L(() => {
1066
1066
  !t || e.current || (e.current = !0, window.queueMicrotask(() => {
1067
1067
  try {
@@ -1146,7 +1146,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1146
1146
  css: g,
1147
1147
  signUrl: v,
1148
1148
  fileUpload: x,
1149
- editable: w = !0
1149
+ editable: _ = !0
1150
1150
  }) => {
1151
1151
  const { hasFocus: k, attributes: m } = zr({ onBlur: c }), C = J(null), N = Qt(
1152
1152
  () => ({ hasFocus: k, editorRef: C, signUrl: v, fileUpload: x }),
@@ -1162,7 +1162,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1162
1162
  },
1163
1163
  theme: Mt,
1164
1164
  nodes: o,
1165
- editable: w
1165
+ editable: _
1166
1166
  },
1167
1167
  children: [
1168
1168
  /* @__PURE__ */ h(
@@ -1199,7 +1199,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1199
1199
  /* @__PURE__ */ n(Cn, {}),
1200
1200
  i,
1201
1201
  /* @__PURE__ */ n(xn, { isLoading: t }),
1202
- w && !a && /* @__PURE__ */ n(pn, { children: l })
1202
+ _ && !a && /* @__PURE__ */ n(pn, { children: l })
1203
1203
  ]
1204
1204
  }
1205
1205
  ),
@@ -1211,6 +1211,8 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1211
1211
  }, Ln = {
1212
1212
  fontSize: "1rem",
1213
1213
  lineHeight: "1.5",
1214
+ whiteSpace: "pre-wrap",
1215
+ wordBreak: "break-word",
1214
1216
  "h1, h2, h3, h4, h5, h6": {
1215
1217
  fontWeight: "700",
1216
1218
  lineHeight: "1.2",
@@ -1411,11 +1413,11 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1411
1413
  defaultVariants: {
1412
1414
  size: "md"
1413
1415
  }
1414
- }, go = Lr(Ln), _n = ({
1416
+ }, go = Lr(Ln), wn = ({
1415
1417
  fileUpload: t,
1416
1418
  ...r
1417
1419
  }) => {
1418
- const [e] = _(), [o, i] = p(null), a = (s) => {
1420
+ const [e] = w(), [o, i] = p(null), a = (s) => {
1419
1421
  var c;
1420
1422
  const d = (c = s.target.files) == null ? void 0 : c[0];
1421
1423
  if (d) {
@@ -1458,7 +1460,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1458
1460
  ] })
1459
1461
  ] });
1460
1462
  }, po = () => {
1461
- const [t] = _(), { fileUpload: r } = H(), [e, o] = p(!1), i = M(() => {
1463
+ const [t] = w(), { fileUpload: r } = H(), [e, o] = p(!1), i = M(() => {
1462
1464
  t.dispatchCommand(Je, {
1463
1465
  rows: "3",
1464
1466
  columns: "3",
@@ -1485,7 +1487,7 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1485
1487
  }
1486
1488
  ),
1487
1489
  r && /* @__PURE__ */ n(
1488
- _n,
1490
+ wn,
1489
1491
  {
1490
1492
  open: e,
1491
1493
  onOpenChange: o,
@@ -1494,11 +1496,11 @@ const Cn = () => /* @__PURE__ */ h(P, { children: [
1494
1496
  )
1495
1497
  ] });
1496
1498
  };
1497
- function wn(t) {
1499
+ function _n(t) {
1498
1500
  return f({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "circle", attr: { cx: "256", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "416", cy: "256", r: "48" } }, { tag: "circle", attr: { cx: "96", cy: "256", r: "48" } }] })(t);
1499
1501
  }
1500
1502
  const mo = () => {
1501
- const [t] = _(), [r, e] = p(null), { hasFocus: o } = H();
1503
+ const [t] = w(), [r, e] = p(null), { hasFocus: o } = H();
1502
1504
  L(() => {
1503
1505
  !o && r && e(null);
1504
1506
  }, [o, r]);
@@ -1558,7 +1560,7 @@ const mo = () => {
1558
1560
  ref: i.setFloating,
1559
1561
  style: a,
1560
1562
  css: { padding: "2px", width: "18px", height: "18px" },
1561
- children: /* @__PURE__ */ n(wn, {})
1563
+ children: /* @__PURE__ */ n(_n, {})
1562
1564
  }
1563
1565
  ),
1564
1566
  children: [
@@ -1574,7 +1576,7 @@ const mo = () => {
1574
1576
  }
1575
1577
  ) : null;
1576
1578
  };
1577
- function _t(t) {
1579
+ function wt(t) {
1578
1580
  let r = t;
1579
1581
  const e = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi, o = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
1580
1582
  return r = String(r).trim(), r.match(e) || r.match(o) ? r : "https://";
@@ -1622,7 +1624,7 @@ function yn(t) {
1622
1624
  return t instanceof K;
1623
1625
  }
1624
1626
  const Sn = ({ onClose: t }) => {
1625
- const [r] = _(), e = M(
1627
+ const [r] = w(), e = M(
1626
1628
  (i) => {
1627
1629
  r.update(() => {
1628
1630
  const a = y();
@@ -1632,7 +1634,7 @@ const Sn = ({ onClose: t }) => {
1632
1634
  const s = Ut();
1633
1635
  s.setTextNodeRange(l, 0, l, i.length), nt(s);
1634
1636
  }
1635
- r.dispatchCommand(it, _t(i));
1637
+ r.dispatchCommand(it, wt(i));
1636
1638
  });
1637
1639
  },
1638
1640
  [r]
@@ -1650,7 +1652,7 @@ const Sn = ({ onClose: t }) => {
1650
1652
  onClose: t,
1651
1653
  getDocs: r
1652
1654
  }) => {
1653
- const [e] = _(), o = J(!1), [i, a] = p(null), [l, s] = p([]);
1655
+ const [e] = w(), o = J(!1), [i, a] = p(null), [l, s] = p([]);
1654
1656
  L(() => {
1655
1657
  o.current || (async () => {
1656
1658
  o.current = !0;
@@ -1668,8 +1670,8 @@ const Sn = ({ onClose: t }) => {
1668
1670
  if (R(u)) {
1669
1671
  const g = [];
1670
1672
  for (const [v, x] of c.entries()) {
1671
- const w = pe(x.value);
1672
- w.append(z(x.label)), g.push(w), v !== c.length - 1 && g.push(z(" "));
1673
+ const _ = pe(x.value);
1674
+ _.append(z(x.label)), g.push(_), v !== c.length - 1 && g.push(z(" "));
1673
1675
  }
1674
1676
  u.insertNodes(g);
1675
1677
  }
@@ -1706,7 +1708,7 @@ const Sn = ({ onClose: t }) => {
1706
1708
  fileUpload: r,
1707
1709
  filePrefix: e
1708
1710
  }) => {
1709
- const [o] = _(), [i, a] = p(null), l = async (d) => {
1711
+ const [o] = w(), [i, a] = p(null), l = async (d) => {
1710
1712
  var u;
1711
1713
  const c = (u = d.target.files) == null ? void 0 : u[0];
1712
1714
  if (c) {
@@ -1727,7 +1729,7 @@ const Sn = ({ onClose: t }) => {
1727
1729
  const u = Ut();
1728
1730
  u.setTextNodeRange(c, 0, c, i.name.length), nt(u);
1729
1731
  }
1730
- o.dispatchCommand(it, _t(i.url));
1732
+ o.dispatchCommand(it, wt(i.url));
1731
1733
  });
1732
1734
  }, [o, i]);
1733
1735
  return /* @__PURE__ */ h(P, { children: [
@@ -1792,7 +1794,7 @@ const Sn = ({ onClose: t }) => {
1792
1794
  getDocs: t,
1793
1795
  filePrefix: r
1794
1796
  }) => {
1795
- const [e] = _(), [o, i] = p(!1), [a, l] = p(!1), s = M(() => {
1797
+ const [e] = w(), [o, i] = p(!1), [a, l] = p(!1), s = M(() => {
1796
1798
  const d = y();
1797
1799
  if (R(d)) {
1798
1800
  const c = ge(d), u = c.getParent();
@@ -1826,7 +1828,7 @@ const Sn = ({ onClose: t }) => {
1826
1828
  )
1827
1829
  ] });
1828
1830
  }, bo = () => {
1829
- const [t] = _(), r = J(null), [e, o] = p(null), [i, a] = p(""), { hasFocus: l } = H();
1831
+ const [t] = w(), r = J(null), [e, o] = p(null), [i, a] = p(""), { hasFocus: l } = H();
1830
1832
  L(() => {
1831
1833
  e ? t.update(() => {
1832
1834
  a(e.getURL());
@@ -1882,7 +1884,7 @@ const Sn = ({ onClose: t }) => {
1882
1884
  Ie
1883
1885
  )
1884
1886
  ), [t, v, e]), !s) return null;
1885
- const w = _t(i);
1887
+ const _ = wt(i);
1886
1888
  return /* @__PURE__ */ n(se, { children: /* @__PURE__ */ h(
1887
1889
  re,
1888
1890
  {
@@ -1908,8 +1910,8 @@ const Sn = ({ onClose: t }) => {
1908
1910
  textOverflow: "ellipsis",
1909
1911
  marginRight: "$4"
1910
1912
  },
1911
- href: w,
1912
- title: w,
1913
+ href: _,
1914
+ title: _,
1913
1915
  target: "_blank",
1914
1916
  rel: "noreferrer",
1915
1917
  children: i
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektbedriftene/fe-lib",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./oidc": {