@arkitektbedriftene/fe-lib 0.3.7 → 0.3.8

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,9 +1,9 @@
1
1
  import { j as G } from "./jsx-runtime-d0aa4c5b.js";
2
2
  import * as y from "react";
3
3
  import ve, { forwardRef as at, useLayoutEffect as Yt, useEffect as Kt, useRef as vn, createContext as xn, useMemo as wn, useContext as Xt, isValidElement as Sn, cloneElement as En } from "react";
4
- import * as $n from "react-dom";
5
- import { createPortal as Rn } from "react-dom";
6
- var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap: R, gridColumnGap: R, rowGap: R, gridRowGap: R, inset: R, insetBlock: R, insetBlockEnd: R, insetBlockStart: R, insetInline: R, insetInlineEnd: R, insetInlineStart: R, margin: R, marginTop: R, marginRight: R, marginBottom: R, marginLeft: R, marginBlock: R, marginBlockEnd: R, marginBlockStart: R, marginInline: R, marginInlineEnd: R, marginInlineStart: R, padding: R, paddingTop: R, paddingRight: R, paddingBottom: R, paddingLeft: R, paddingBlock: R, paddingBlockEnd: R, paddingBlockStart: R, paddingInline: R, paddingInlineEnd: R, paddingInlineStart: R, top: R, right: R, bottom: R, left: R, scrollMargin: R, scrollMarginTop: R, scrollMarginRight: R, scrollMarginBottom: R, scrollMarginLeft: R, scrollMarginX: R, scrollMarginY: R, scrollMarginBlock: R, scrollMarginBlockEnd: R, scrollMarginBlockStart: R, scrollMarginInline: R, scrollMarginInlineEnd: R, scrollMarginInlineStart: R, scrollPadding: R, scrollPaddingTop: R, scrollPaddingRight: R, scrollPaddingBottom: R, scrollPaddingLeft: R, scrollPaddingX: R, scrollPaddingY: R, scrollPaddingBlock: R, scrollPaddingBlockEnd: R, scrollPaddingBlockStart: R, scrollPaddingInline: R, scrollPaddingInlineEnd: R, scrollPaddingInlineStart: R, fontSize: "fontSizes", background: N, backgroundColor: N, backgroundImage: N, borderImage: N, border: N, borderBlock: N, borderBlockEnd: N, borderBlockStart: N, borderBottom: N, borderBottomColor: N, borderColor: N, borderInline: N, borderInlineEnd: N, borderInlineStart: N, borderLeft: N, borderLeftColor: N, borderRight: N, borderRightColor: N, borderTop: N, borderTopColor: N, caretColor: N, color: N, columnRuleColor: N, fill: N, outline: N, outlineColor: N, stroke: N, textDecorationColor: N, fontFamily: "fonts", fontWeight: "fontWeights", lineHeight: "lineHeights", letterSpacing: "letterSpacings", blockSize: V, minBlockSize: V, maxBlockSize: V, inlineSize: V, minInlineSize: V, maxInlineSize: V, width: V, minWidth: V, maxWidth: V, height: V, minHeight: V, maxHeight: V, flexBasis: V, gridTemplateColumns: V, gridTemplateRows: V, borderWidth: "borderWidths", borderTopWidth: "borderWidths", borderRightWidth: "borderWidths", borderBottomWidth: "borderWidths", borderLeftWidth: "borderWidths", borderStyle: "borderStyles", borderTopStyle: "borderStyles", borderRightStyle: "borderStyles", borderBottomStyle: "borderStyles", borderLeftStyle: "borderStyles", borderRadius: "radii", borderTopLeftRadius: "radii", borderTopRightRadius: "radii", borderBottomRightRadius: "radii", borderBottomLeftRadius: "radii", boxShadow: "shadows", textShadow: "shadows", transition: "transitions", zIndex: "zIndices" }, kn = (e, t) => typeof t == "function" ? { "()": Function.prototype.toString.call(t) } : t, Te = () => {
4
+ import * as Rn from "react-dom";
5
+ import { createPortal as $n } from "react-dom";
6
+ var N = "colors", V = "sizes", $ = "space", Cn = { gap: $, gridGap: $, columnGap: $, gridColumnGap: $, rowGap: $, gridRowGap: $, inset: $, insetBlock: $, insetBlockEnd: $, insetBlockStart: $, insetInline: $, insetInlineEnd: $, insetInlineStart: $, margin: $, marginTop: $, marginRight: $, marginBottom: $, marginLeft: $, marginBlock: $, marginBlockEnd: $, marginBlockStart: $, marginInline: $, marginInlineEnd: $, marginInlineStart: $, padding: $, paddingTop: $, paddingRight: $, paddingBottom: $, paddingLeft: $, paddingBlock: $, paddingBlockEnd: $, paddingBlockStart: $, paddingInline: $, paddingInlineEnd: $, paddingInlineStart: $, top: $, right: $, bottom: $, left: $, scrollMargin: $, scrollMarginTop: $, scrollMarginRight: $, scrollMarginBottom: $, scrollMarginLeft: $, scrollMarginX: $, scrollMarginY: $, scrollMarginBlock: $, scrollMarginBlockEnd: $, scrollMarginBlockStart: $, scrollMarginInline: $, scrollMarginInlineEnd: $, scrollMarginInlineStart: $, scrollPadding: $, scrollPaddingTop: $, scrollPaddingRight: $, scrollPaddingBottom: $, scrollPaddingLeft: $, scrollPaddingX: $, scrollPaddingY: $, scrollPaddingBlock: $, scrollPaddingBlockEnd: $, scrollPaddingBlockStart: $, scrollPaddingInline: $, scrollPaddingInlineEnd: $, scrollPaddingInlineStart: $, fontSize: "fontSizes", background: N, backgroundColor: N, backgroundImage: N, borderImage: N, border: N, borderBlock: N, borderBlockEnd: N, borderBlockStart: N, borderBottom: N, borderBottomColor: N, borderColor: N, borderInline: N, borderInlineEnd: N, borderInlineStart: N, borderLeft: N, borderLeftColor: N, borderRight: N, borderRightColor: N, borderTop: N, borderTopColor: N, caretColor: N, color: N, columnRuleColor: N, fill: N, outline: N, outlineColor: N, stroke: N, textDecorationColor: N, fontFamily: "fonts", fontWeight: "fontWeights", lineHeight: "lineHeights", letterSpacing: "letterSpacings", blockSize: V, minBlockSize: V, maxBlockSize: V, inlineSize: V, minInlineSize: V, maxInlineSize: V, width: V, minWidth: V, maxWidth: V, height: V, minHeight: V, maxHeight: V, flexBasis: V, gridTemplateColumns: V, gridTemplateRows: V, borderWidth: "borderWidths", borderTopWidth: "borderWidths", borderRightWidth: "borderWidths", borderBottomWidth: "borderWidths", borderLeftWidth: "borderWidths", borderStyle: "borderStyles", borderTopStyle: "borderStyles", borderRightStyle: "borderStyles", borderBottomStyle: "borderStyles", borderLeftStyle: "borderStyles", borderRadius: "radii", borderTopLeftRadius: "radii", borderTopRightRadius: "radii", borderBottomRightRadius: "radii", borderBottomLeftRadius: "radii", boxShadow: "shadows", textShadow: "shadows", transition: "transitions", zIndex: "zIndices" }, kn = (e, t) => typeof t == "function" ? { "()": Function.prototype.toString.call(t) } : t, Te = () => {
7
7
  const e = /* @__PURE__ */ Object.create(null);
8
8
  return (t, n, ...r) => {
9
9
  const o = ((i) => JSON.stringify(i, kn))(t);
@@ -13,7 +13,7 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
13
13
  for (const t in e)
14
14
  return !0;
15
15
  return !1;
16
- }, { hasOwnProperty: Tn } = Object.prototype, rt = (e) => e.includes("-") ? e : e.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase()), In = /\s+(?![^()]*\))/, xe = (e) => (t) => e(...typeof t == "string" ? String(t).split(In) : [t]), vt = { appearance: (e) => ({ WebkitAppearance: e, appearance: e }), backfaceVisibility: (e) => ({ WebkitBackfaceVisibility: e, backfaceVisibility: e }), backdropFilter: (e) => ({ WebkitBackdropFilter: e, backdropFilter: e }), backgroundClip: (e) => ({ WebkitBackgroundClip: e, backgroundClip: e }), boxDecorationBreak: (e) => ({ WebkitBoxDecorationBreak: e, boxDecorationBreak: e }), clipPath: (e) => ({ WebkitClipPath: e, clipPath: e }), content: (e) => ({ content: e.includes('"') || e.includes("'") || /^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(e) ? e : `"${e}"` }), hyphens: (e) => ({ WebkitHyphens: e, hyphens: e }), maskImage: (e) => ({ WebkitMaskImage: e, maskImage: e }), maskSize: (e) => ({ WebkitMaskSize: e, maskSize: e }), tabSize: (e) => ({ MozTabSize: e, tabSize: e }), textSizeAdjust: (e) => ({ WebkitTextSizeAdjust: e, textSizeAdjust: e }), userSelect: (e) => ({ WebkitUserSelect: e, userSelect: e }), marginBlock: xe((e, t) => ({ marginBlockStart: e, marginBlockEnd: t || e })), marginInline: xe((e, t) => ({ marginInlineStart: e, marginInlineEnd: t || e })), maxSize: xe((e, t) => ({ maxBlockSize: e, maxInlineSize: t || e })), minSize: xe((e, t) => ({ minBlockSize: e, minInlineSize: t || e })), paddingBlock: xe((e, t) => ({ paddingBlockStart: e, paddingBlockEnd: t || e })), paddingInline: xe((e, t) => ({ paddingInlineStart: e, paddingInlineEnd: t || e })) }, Ge = /([\d.]+)([^]*)/, Pn = (e, t) => e.length ? e.reduce((n, r) => (n.push(...t.map((o) => o.includes("&") ? o.replace(/&/g, /[ +>|~]/.test(r) && /&.*&/.test(o) ? `:is(${r})` : r) : r + " " + o)), n), []) : t, An = (e, t) => e in Bn && typeof t == "string" ? t.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/, (n, r, o, i) => r + (o === "stretch" ? `-moz-available${i};${rt(e)}:${r}-webkit-fill-available` : `-moz-fit-content${i};${rt(e)}:${r}fit-content`) + i) : String(t), Bn = { blockSize: 1, height: 1, inlineSize: 1, maxBlockSize: 1, maxHeight: 1, maxInlineSize: 1, maxWidth: 1, minBlockSize: 1, minHeight: 1, minInlineSize: 1, minWidth: 1, width: 1 }, J = (e) => e ? e + "-" : "", Ut = (e, t, n) => e.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g, (r, o, i, s, l) => s == "$" == !!i ? r : (o || s == "--" ? "calc(" : "") + "var(--" + (s === "$" ? J(t) + (l.includes("$") ? "" : J(n)) + l.replace(/\$/g, "-") : l) + ")" + (o || s == "--" ? "*" + (o || "") + (i || "1") + ")" : "")), On = /\s*,\s*(?![^()]*\))/, Dn = Object.prototype.toString, $e = (e, t, n, r, o) => {
16
+ }, { hasOwnProperty: Tn } = Object.prototype, rt = (e) => e.includes("-") ? e : e.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase()), In = /\s+(?![^()]*\))/, xe = (e) => (t) => e(...typeof t == "string" ? String(t).split(In) : [t]), vt = { appearance: (e) => ({ WebkitAppearance: e, appearance: e }), backfaceVisibility: (e) => ({ WebkitBackfaceVisibility: e, backfaceVisibility: e }), backdropFilter: (e) => ({ WebkitBackdropFilter: e, backdropFilter: e }), backgroundClip: (e) => ({ WebkitBackgroundClip: e, backgroundClip: e }), boxDecorationBreak: (e) => ({ WebkitBoxDecorationBreak: e, boxDecorationBreak: e }), clipPath: (e) => ({ WebkitClipPath: e, clipPath: e }), content: (e) => ({ content: e.includes('"') || e.includes("'") || /^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(e) ? e : `"${e}"` }), hyphens: (e) => ({ WebkitHyphens: e, hyphens: e }), maskImage: (e) => ({ WebkitMaskImage: e, maskImage: e }), maskSize: (e) => ({ WebkitMaskSize: e, maskSize: e }), tabSize: (e) => ({ MozTabSize: e, tabSize: e }), textSizeAdjust: (e) => ({ WebkitTextSizeAdjust: e, textSizeAdjust: e }), userSelect: (e) => ({ WebkitUserSelect: e, userSelect: e }), marginBlock: xe((e, t) => ({ marginBlockStart: e, marginBlockEnd: t || e })), marginInline: xe((e, t) => ({ marginInlineStart: e, marginInlineEnd: t || e })), maxSize: xe((e, t) => ({ maxBlockSize: e, maxInlineSize: t || e })), minSize: xe((e, t) => ({ minBlockSize: e, minInlineSize: t || e })), paddingBlock: xe((e, t) => ({ paddingBlockStart: e, paddingBlockEnd: t || e })), paddingInline: xe((e, t) => ({ paddingInlineStart: e, paddingInlineEnd: t || e })) }, Ge = /([\d.]+)([^]*)/, Pn = (e, t) => e.length ? e.reduce((n, r) => (n.push(...t.map((o) => o.includes("&") ? o.replace(/&/g, /[ +>|~]/.test(r) && /&.*&/.test(o) ? `:is(${r})` : r) : r + " " + o)), n), []) : t, An = (e, t) => e in Bn && typeof t == "string" ? t.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/, (n, r, o, i) => r + (o === "stretch" ? `-moz-available${i};${rt(e)}:${r}-webkit-fill-available` : `-moz-fit-content${i};${rt(e)}:${r}fit-content`) + i) : String(t), Bn = { blockSize: 1, height: 1, inlineSize: 1, maxBlockSize: 1, maxHeight: 1, maxInlineSize: 1, maxWidth: 1, minBlockSize: 1, minHeight: 1, minInlineSize: 1, minWidth: 1, width: 1 }, J = (e) => e ? e + "-" : "", Ut = (e, t, n) => e.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g, (r, o, i, s, l) => s == "$" == !!i ? r : (o || s == "--" ? "calc(" : "") + "var(--" + (s === "$" ? J(t) + (l.includes("$") ? "" : J(n)) + l.replace(/\$/g, "-") : l) + ")" + (o || s == "--" ? "*" + (o || "") + (i || "1") + ")" : "")), On = /\s*,\s*(?![^()]*\))/, Dn = Object.prototype.toString, Re = (e, t, n, r, o) => {
17
17
  let i, s, l;
18
18
  const c = (a, m, d) => {
19
19
  let f, u;
@@ -37,7 +37,7 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
37
37
  }
38
38
  if (x && (S = f.slice(1) in r.media ? "@media " + r.media[f.slice(1)] : f, f = S.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g, (I, A, k, O, D, L) => {
39
39
  const M = Ge.test(A), B = 0.0625 * (M ? -1 : 1), [b, v] = M ? [O, A] : [A, O];
40
- return "(" + (k[0] === "=" ? "" : k[0] === ">" === M ? "max-" : "min-") + b + ":" + (k[0] !== "=" && k.length === 1 ? v.replace(Ge, (T, $, w) => Number($) + B * (k === ">" ? 1 : -1) + w) : v) + (D ? ") and (" + (D[0] === ">" ? "min-" : "max-") + b + ":" + (D.length === 1 ? L.replace(Ge, (T, $, w) => Number($) + B * (D === ">" ? -1 : 1) + w) : L) : "") + ")";
40
+ return "(" + (k[0] === "=" ? "" : k[0] === ">" === M ? "max-" : "min-") + b + ":" + (k[0] !== "=" && k.length === 1 ? v.replace(Ge, (T, R, w) => Number(R) + B * (k === ">" ? 1 : -1) + w) : v) + (D ? ") and (" + (D[0] === ">" ? "min-" : "max-") + b + ":" + (D.length === 1 ? L.replace(Ge, (T, R, w) => Number(R) + B * (D === ">" ? -1 : 1) + w) : L) : "") + ")";
41
41
  })), C) {
42
42
  const I = x ? d.concat(f) : [...d], A = x ? [...m] : Pn(m, f.split(On));
43
43
  i !== void 0 && o(xt(...i)), i = void 0, c(u, A, I);
@@ -204,7 +204,7 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
204
204
  g[h] = i[h];
205
205
  const p = /* @__PURE__ */ new Set([...o]);
206
206
  for (const [h, x, P, E] of t.composers) {
207
- n.rules.styled.cache.has(h) || (n.rules.styled.cache.add(h), $e(x, [`.${h}`], [], e, (A) => {
207
+ n.rules.styled.cache.has(h) || (n.rules.styled.cache.add(h), Re(x, [`.${h}`], [], e, (A) => {
208
208
  c.styled.apply(A);
209
209
  }));
210
210
  const C = Et(P, g, e.media), I = Et(E, g, e.media, !0);
@@ -214,7 +214,7 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
214
214
  const L = `${h}-${ue(O)}-${k}`;
215
215
  p.add(L);
216
216
  const M = (D ? n.rules.resonevar : n.rules.onevar).cache, B = D ? c.resonevar : c.onevar;
217
- M.has(L) || (M.add(L), $e(O, [`.${L}`], [], e, (b) => {
217
+ M.has(L) || (M.add(L), Re(O, [`.${L}`], [], e, (b) => {
218
218
  B.apply(b);
219
219
  }));
220
220
  }
@@ -222,14 +222,14 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
222
222
  if (A !== void 0)
223
223
  for (const [k, O] of A) {
224
224
  const D = `${h}-${ue(O)}-${k}`;
225
- p.add(D), n.rules.allvar.cache.has(D) || (n.rules.allvar.cache.add(D), $e(O, [`.${D}`], [], e, (L) => {
225
+ p.add(D), n.rules.allvar.cache.has(D) || (n.rules.allvar.cache.add(D), Re(O, [`.${D}`], [], e, (L) => {
226
226
  c.allvar.apply(L);
227
227
  }));
228
228
  }
229
229
  }
230
230
  if (typeof f == "object" && f) {
231
231
  const h = `${r}-i${ue(f)}-css`;
232
- p.add(h), n.rules.inline.cache.has(h) || (n.rules.inline.cache.add(h), $e(f, [`.${h}`], [], e, (x) => {
232
+ p.add(h), n.rules.inline.cache.has(h) || (n.rules.inline.cache.add(h), Re(f, [`.${h}`], [], e, (x) => {
233
233
  c.inline.apply(x);
234
234
  }));
235
235
  }
@@ -295,7 +295,7 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
295
295
  l = l.includes('"') || l.includes("'") ? l : `"${l}"`, t.sheet.insertRule(`@import ${l};`, s++);
296
296
  delete o["@import"];
297
297
  }
298
- $e(o, [], [], e, (s) => {
298
+ Re(o, [], [], e, (s) => {
299
299
  t.rules.global.apply(s);
300
300
  });
301
301
  }
@@ -308,7 +308,7 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
308
308
  if (!t.rules.global.cache.has(r)) {
309
309
  t.rules.global.cache.add(r);
310
310
  const i = [];
311
- $e(n, [], [], e, (l) => i.push(l));
311
+ Re(n, [], [], e, (l) => i.push(l));
312
312
  const s = `@keyframes ${r}{${i.join("")}}`;
313
313
  t.rules.global.apply(s);
314
314
  }
@@ -374,8 +374,8 @@ var N = "colors", V = "sizes", R = "space", Cn = { gap: R, gridGap: R, columnGap
374
374
  };
375
375
  }))(t), t;
376
376
  };
377
- let $t = 9999;
378
- const Ze = () => ($t--, $t), { styled: he, css: qt, keyframes: Ie, globalCss: ni } = Qn({
377
+ let Rt = 9999;
378
+ const Ze = () => (Rt--, Rt), { styled: he, css: qt, keyframes: Ie, globalCss: ni } = Qn({
379
379
  theme: {
380
380
  colors: {
381
381
  gray50: "#F9FAFA",
@@ -983,11 +983,11 @@ const Ne = Math.min, fe = Math.max, We = Math.round, De = Math.floor, ne = (e) =
983
983
  right: "left",
984
984
  bottom: "top",
985
985
  top: "bottom"
986
- }, $r = {
986
+ }, Rr = {
987
987
  start: "end",
988
988
  end: "start"
989
989
  };
990
- function Rt(e, t, n) {
990
+ function $t(e, t, n) {
991
991
  return fe(e, Ne(t, n));
992
992
  }
993
993
  function Ke(e, t) {
@@ -1011,7 +1011,7 @@ function Ue(e) {
1011
1011
  function en(e) {
1012
1012
  return Jt(Ue(e));
1013
1013
  }
1014
- function Rr(e, t, n) {
1014
+ function $r(e, t, n) {
1015
1015
  n === void 0 && (n = !1);
1016
1016
  const r = Xe(e), o = en(e), i = Qt(o);
1017
1017
  let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
@@ -1022,7 +1022,7 @@ function Cr(e) {
1022
1022
  return [it(e), t, it(t)];
1023
1023
  }
1024
1024
  function it(e) {
1025
- return e.replace(/start|end/g, (t) => $r[t]);
1025
+ return e.replace(/start|end/g, (t) => Rr[t]);
1026
1026
  }
1027
1027
  function kr(e, t, n) {
1028
1028
  const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
@@ -1253,7 +1253,7 @@ const Br = function(e) {
1253
1253
  const C = [l, ...E], I = await tn(t, S), A = [];
1254
1254
  let k = ((r = i.flip) == null ? void 0 : r.overflows) || [];
1255
1255
  if (m && A.push(I[h]), d) {
1256
- const M = Rr(o, s, P);
1256
+ const M = $r(o, s, P);
1257
1257
  A.push(I[M[0]], I[M[1]]);
1258
1258
  }
1259
1259
  if (k = [...k, {
@@ -1277,7 +1277,7 @@ const Br = function(e) {
1277
1277
  switch (u) {
1278
1278
  case "bestFit": {
1279
1279
  var L;
1280
- const v = (L = k.map((T) => [T.placement, T.overflows.filter(($) => $ > 0).reduce(($, w) => $ + w, 0)]).sort((T, $) => T[1] - $[1])[0]) == null ? void 0 : L[0];
1280
+ const v = (L = k.map((T) => [T.placement, T.overflows.filter((R) => R > 0).reduce((R, w) => R + w, 0)]).sort((T, R) => T[1] - R[1])[0]) == null ? void 0 : L[0];
1281
1281
  v && (b = v);
1282
1282
  break;
1283
1283
  }
@@ -1378,11 +1378,11 @@ const Dr = function(e) {
1378
1378
  let u = a[f], g = a[d];
1379
1379
  if (i) {
1380
1380
  const S = f === "y" ? "top" : "left", h = f === "y" ? "bottom" : "right", x = u + m[S], P = u - m[h];
1381
- u = Rt(x, u, P);
1381
+ u = $t(x, u, P);
1382
1382
  }
1383
1383
  if (s) {
1384
1384
  const S = d === "y" ? "top" : "left", h = d === "y" ? "bottom" : "right", x = g + m[S], P = g - m[h];
1385
- g = Rt(x, g, P);
1385
+ g = $t(x, g, P);
1386
1386
  }
1387
1387
  const p = l.fn({
1388
1388
  ...t,
@@ -1822,31 +1822,31 @@ function no(e) {
1822
1822
  isPositioned: !1
1823
1823
  }), [f, u] = y.useState(r);
1824
1824
  He(f, r) || u(r);
1825
- const [g, p] = y.useState(null), [S, h] = y.useState(null), x = y.useCallback(($) => {
1826
- $ !== I.current && (I.current = $, p($));
1827
- }, []), P = y.useCallback(($) => {
1828
- $ !== A.current && (A.current = $, h($));
1825
+ const [g, p] = y.useState(null), [S, h] = y.useState(null), x = y.useCallback((R) => {
1826
+ R !== I.current && (I.current = R, p(R));
1827
+ }, []), P = y.useCallback((R) => {
1828
+ R !== A.current && (A.current = R, h(R));
1829
1829
  }, []), E = i || g, C = s || S, I = y.useRef(null), A = y.useRef(null), k = y.useRef(m), O = c != null, D = Pt(c), L = Pt(o), M = y.useCallback(() => {
1830
1830
  if (!I.current || !A.current)
1831
1831
  return;
1832
- const $ = {
1832
+ const R = {
1833
1833
  placement: t,
1834
1834
  strategy: n,
1835
1835
  middleware: f
1836
1836
  };
1837
- L.current && ($.platform = L.current), to(I.current, A.current, $).then((w) => {
1837
+ L.current && (R.platform = L.current), to(I.current, A.current, R).then((w) => {
1838
1838
  const F = {
1839
1839
  ...w,
1840
1840
  isPositioned: !0
1841
1841
  };
1842
- B.current && !He(k.current, F) && (k.current = F, $n.flushSync(() => {
1842
+ B.current && !He(k.current, F) && (k.current = F, Rn.flushSync(() => {
1843
1843
  d(F);
1844
1844
  }));
1845
1845
  });
1846
1846
  }, [f, t, n, L]);
1847
1847
  Me(() => {
1848
- a === !1 && k.current.isPositioned && (k.current.isPositioned = !1, d(($) => ({
1849
- ...$,
1848
+ a === !1 && k.current.isPositioned && (k.current.isPositioned = !1, d((R) => ({
1849
+ ...R,
1850
1850
  isPositioned: !1
1851
1851
  })));
1852
1852
  }, [a]);
@@ -1869,16 +1869,16 @@ function no(e) {
1869
1869
  reference: E,
1870
1870
  floating: C
1871
1871
  }), [E, C]), T = y.useMemo(() => {
1872
- const $ = {
1872
+ const R = {
1873
1873
  position: n,
1874
1874
  left: 0,
1875
1875
  top: 0
1876
1876
  };
1877
1877
  if (!v.floating)
1878
- return $;
1878
+ return R;
1879
1879
  const w = It(v.floating, m.x), F = It(v.floating, m.y);
1880
1880
  return l ? {
1881
- ...$,
1881
+ ...R,
1882
1882
  transform: "translate(" + w + "px, " + F + "px)",
1883
1883
  ...an(v.floating) >= 1.5 && {
1884
1884
  willChange: "transform"
@@ -2076,13 +2076,6 @@ var ro = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
2076
2076
  shadowRootFilter: xo
2077
2077
  }) : r = io(t, n.includeContainer, Bt.bind(null, n)), wo(r);
2078
2078
  };
2079
- function ii(e) {
2080
- return y.useMemo(() => e.every((t) => t == null) ? null : (t) => {
2081
- e.forEach((n) => {
2082
- typeof n == "function" ? n(t) : n != null && (n.current = t);
2083
- });
2084
- }, e);
2085
- }
2086
2079
  const So = y[/* @__PURE__ */ "useInsertionEffect".toString()], Eo = So || ((e) => e());
2087
2080
  function Ee(e) {
2088
2081
  const t = y.useRef(() => {
@@ -2108,9 +2101,9 @@ function lt() {
2108
2101
  return e;
2109
2102
  }, lt.apply(this, arguments);
2110
2103
  }
2111
- let Qe = !1, $o = 0;
2112
- const Ot = () => "floating-ui-" + $o++;
2113
- function Ro() {
2104
+ let Qe = !1, Ro = 0;
2105
+ const Ot = () => "floating-ui-" + Ro++;
2106
+ function $o() {
2114
2107
  const [e, t] = y.useState(() => Qe ? Ot() : void 0);
2115
2108
  return Z(() => {
2116
2109
  e == null && t(Ot());
@@ -2118,7 +2111,7 @@ function Ro() {
2118
2111
  Qe || (Qe = !0);
2119
2112
  }, []), e;
2120
2113
  }
2121
- const Co = y[/* @__PURE__ */ "useId".toString()], gt = Co || Ro;
2114
+ const Co = y[/* @__PURE__ */ "useId".toString()], gt = Co || $o;
2122
2115
  function ko() {
2123
2116
  const e = /* @__PURE__ */ new Map();
2124
2117
  return {
@@ -2142,7 +2135,7 @@ const To = /* @__PURE__ */ y.createContext(null), Io = /* @__PURE__ */ y.createC
2142
2135
  function qe(e) {
2143
2136
  return "data-floating-ui-" + e;
2144
2137
  }
2145
- function Re(e) {
2138
+ function $e(e) {
2146
2139
  const t = vn(e);
2147
2140
  return Z(() => {
2148
2141
  t.current = e;
@@ -2171,7 +2164,7 @@ function Po(e, t) {
2171
2164
  mouseOnly: f = !1,
2172
2165
  restMs: u = 0,
2173
2166
  move: g = !0
2174
- } = t, p = ht(), S = pt(), h = Re(d), x = Re(m), P = y.useRef(), E = y.useRef(), C = y.useRef(), I = y.useRef(), A = y.useRef(!0), k = y.useRef(!1), O = y.useRef(() => {
2167
+ } = t, p = ht(), S = pt(), h = $e(d), x = $e(m), P = y.useRef(), E = y.useRef(), C = y.useRef(), I = y.useRef(), A = y.useRef(!0), k = y.useRef(!1), O = y.useRef(() => {
2175
2168
  }), D = y.useCallback(() => {
2176
2169
  var b;
2177
2170
  const v = (b = o.current.openEvent) == null ? void 0 : b.type;
@@ -2202,8 +2195,8 @@ function Po(e, t) {
2202
2195
  }, [l, n, r, a, h, D]);
2203
2196
  const L = y.useCallback(function(b, v, T) {
2204
2197
  v === void 0 && (v = !0), T === void 0 && (T = "hover");
2205
- const $ = et(x.current, "close", P.current);
2206
- $ && !C.current ? (clearTimeout(E.current), E.current = setTimeout(() => r(!1, b, T), $)) : v && (clearTimeout(E.current), r(!1, b, T));
2198
+ const R = et(x.current, "close", P.current);
2199
+ R && !C.current ? (clearTimeout(E.current), E.current = setTimeout(() => r(!1, b, T), R)) : v && (clearTimeout(E.current), r(!1, b, T));
2207
2200
  }, [x, r]), M = y.useCallback(() => {
2208
2201
  O.current(), C.current = void 0;
2209
2202
  }, []), B = y.useCallback(() => {
@@ -2249,7 +2242,7 @@ function Po(e, t) {
2249
2242
  }
2250
2243
  (P.current === "touch" ? !de(l, w.relatedTarget) : !0) && L(w);
2251
2244
  }
2252
- function $(w) {
2245
+ function R(w) {
2253
2246
  b() || h.current == null || h.current({
2254
2247
  ...e,
2255
2248
  tree: p,
@@ -2262,10 +2255,10 @@ function Po(e, t) {
2262
2255
  }
2263
2256
  if (W(s)) {
2264
2257
  const w = s;
2265
- return n && w.addEventListener("mouseleave", $), l == null || l.addEventListener("mouseleave", $), g && w.addEventListener("mousemove", v, {
2258
+ return n && w.addEventListener("mouseleave", R), l == null || l.addEventListener("mouseleave", R), g && w.addEventListener("mousemove", v, {
2266
2259
  once: !0
2267
2260
  }), w.addEventListener("mouseenter", v), w.addEventListener("mouseleave", T), () => {
2268
- n && w.removeEventListener("mouseleave", $), l == null || l.removeEventListener("mouseleave", $), g && w.removeEventListener("mousemove", v), w.removeEventListener("mouseenter", v), w.removeEventListener("mouseleave", T);
2261
+ n && w.removeEventListener("mouseleave", R), l == null || l.removeEventListener("mouseleave", R), g && w.removeEventListener("mousemove", v), w.removeEventListener("mouseenter", v), w.removeEventListener("mouseleave", T);
2269
2262
  };
2270
2263
  }
2271
2264
  }, [s, l, a, e, f, u, g, L, M, B, r, n, p, x, h, o]), Z(() => {
@@ -2274,9 +2267,9 @@ function Po(e, t) {
2274
2267
  const T = ce(l).body;
2275
2268
  if (T.setAttribute(Dt, ""), T.style.pointerEvents = "none", k.current = !0, W(s) && l) {
2276
2269
  var v;
2277
- const $ = s, w = p == null || (v = p.nodesRef.current.find((F) => F.id === S)) == null || (v = v.context) == null ? void 0 : v.elements.floating;
2278
- return w && (w.style.pointerEvents = ""), $.style.pointerEvents = "auto", l.style.pointerEvents = "auto", () => {
2279
- $.style.pointerEvents = "", l.style.pointerEvents = "";
2270
+ const R = s, w = p == null || (v = p.nodesRef.current.find((F) => F.id === S)) == null || (v = v.context) == null ? void 0 : v.elements.floating;
2271
+ return w && (w.style.pointerEvents = ""), R.style.pointerEvents = "auto", l.style.pointerEvents = "auto", () => {
2272
+ R.style.pointerEvents = "", l.style.pointerEvents = "";
2280
2273
  };
2281
2274
  }
2282
2275
  }
@@ -2475,7 +2468,7 @@ function Fo(e) {
2475
2468
  }), f && i && /* @__PURE__ */ y.createElement("span", {
2476
2469
  "aria-owns": i.id,
2477
2470
  style: bn
2478
- }), i && /* @__PURE__ */ Rn(t, i), f && i && /* @__PURE__ */ y.createElement(Lt, {
2471
+ }), i && /* @__PURE__ */ $n(t, i), f && i && /* @__PURE__ */ y.createElement(Lt, {
2479
2472
  "data-type": "outside",
2480
2473
  ref: a,
2481
2474
  onFocus: (u) => {
@@ -2584,29 +2577,29 @@ function Ho(e, t) {
2584
2577
  return;
2585
2578
  const T = x ? Le(x.nodesRef.current, o) : [];
2586
2579
  if (!A && (v.stopPropagation(), T.length > 0)) {
2587
- let $ = !0;
2580
+ let R = !0;
2588
2581
  if (T.forEach((w) => {
2589
2582
  var F;
2590
2583
  if ((F = w.context) != null && F.open && !w.context.dataRef.current.__escapeKeyBubbles) {
2591
- $ = !1;
2584
+ R = !1;
2592
2585
  return;
2593
2586
  }
2594
- }), !$)
2587
+ }), !R)
2595
2588
  return;
2596
2589
  }
2597
2590
  r(!1, vr(v) ? v.nativeEvent : v, "escape-key");
2598
2591
  }), M = Ee((v) => {
2599
2592
  var T;
2600
- const $ = () => {
2593
+ const R = () => {
2601
2594
  var w;
2602
- L(v), (w = Se(v)) == null || w.removeEventListener("keydown", $);
2595
+ L(v), (w = Se(v)) == null || w.removeEventListener("keydown", R);
2603
2596
  };
2604
- (T = Se(v)) == null || T.addEventListener("keydown", $);
2597
+ (T = Se(v)) == null || T.addEventListener("keydown", R);
2605
2598
  }), B = Ee((v) => {
2606
2599
  const T = C.current;
2607
2600
  C.current = !1;
2608
- const $ = I.current;
2609
- if (I.current = !1, f === "click" && $ || T || typeof E == "function" && !E(v))
2601
+ const R = I.current;
2602
+ if (I.current = !1, f === "click" && R || T || typeof E == "function" && !E(v))
2610
2603
  return;
2611
2604
  const w = Se(v), F = "[" + qe("inert") + "]", _ = ce(l).querySelectorAll(F);
2612
2605
  let K = W(w) ? w : null;
@@ -2648,11 +2641,11 @@ function Ho(e, t) {
2648
2641
  r(!1, v, "outside-press");
2649
2642
  }), b = Ee((v) => {
2650
2643
  var T;
2651
- const $ = () => {
2644
+ const R = () => {
2652
2645
  var w;
2653
- B(v), (w = Se(v)) == null || w.removeEventListener(f, $);
2646
+ B(v), (w = Se(v)) == null || w.removeEventListener(f, R);
2654
2647
  };
2655
- (T = Se(v)) == null || T.addEventListener(f, $);
2648
+ (T = Se(v)) == null || T.addEventListener(f, R);
2656
2649
  });
2657
2650
  return y.useEffect(() => {
2658
2651
  if (!n || !a)
@@ -2663,16 +2656,16 @@ function Ho(e, t) {
2663
2656
  }
2664
2657
  const T = ce(l);
2665
2658
  m && T.addEventListener("keydown", O ? M : L, O), E && T.addEventListener(f, D ? b : B, D);
2666
- let $ = [];
2667
- return p && (W(s) && ($ = ee(s)), W(l) && ($ = $.concat(ee(l))), !W(i) && i && i.contextElement && ($ = $.concat(ee(i.contextElement)))), $ = $.filter((w) => {
2659
+ let R = [];
2660
+ return p && (W(s) && (R = ee(s)), W(l) && (R = R.concat(ee(l))), !W(i) && i && i.contextElement && (R = R.concat(ee(i.contextElement)))), R = R.filter((w) => {
2668
2661
  var F;
2669
2662
  return w !== ((F = T.defaultView) == null ? void 0 : F.visualViewport);
2670
- }), $.forEach((w) => {
2663
+ }), R.forEach((w) => {
2671
2664
  w.addEventListener("scroll", v, {
2672
2665
  passive: !0
2673
2666
  });
2674
2667
  }), () => {
2675
- m && T.removeEventListener("keydown", O ? M : L, O), E && T.removeEventListener(f, D ? b : B, D), $.forEach((w) => {
2668
+ m && T.removeEventListener("keydown", O ? M : L, O), E && T.removeEventListener(f, D ? b : B, D), R.forEach((w) => {
2676
2669
  w.removeEventListener("scroll", v);
2677
2670
  });
2678
2671
  };
@@ -2966,7 +2959,7 @@ function qo(e, t) {
2966
2959
  status: S
2967
2960
  } = Uo(e, {
2968
2961
  duration: s
2969
- }), h = Re(n), x = Re(r), P = Re(o), E = Re(i);
2962
+ }), h = $e(n), x = $e(r), P = $e(o), E = $e(i);
2970
2963
  return Z(() => {
2971
2964
  const C = we(h.current, a), I = we(P.current, a), A = we(E.current, a), k = we(x.current, a) || Object.keys(C).reduce((O, D) => (O[D] = "", O), {});
2972
2965
  if (S === "initial" && g((O) => ({
@@ -3039,7 +3032,7 @@ function Zo(e) {
3039
3032
  const {
3040
3033
  clientX: I,
3041
3034
  clientY: A
3042
- } = E, k = [I, A], O = Se(E), D = E.type === "mouseleave", L = de(p.floating, O), M = de(p.domReference, O), B = p.domReference.getBoundingClientRect(), b = p.floating.getBoundingClientRect(), v = g.split("-")[0], T = f > b.right - b.width / 2, $ = u > b.bottom - b.height / 2, w = Go(k, B), F = b.width > B.width, _ = b.height > B.height, K = (F ? B : b).left, be = (F ? B : b).right, re = (_ ? B : b).top, z = (_ ? B : b).bottom;
3035
+ } = E, k = [I, A], O = Se(E), D = E.type === "mouseleave", L = de(p.floating, O), M = de(p.domReference, O), B = p.domReference.getBoundingClientRect(), b = p.floating.getBoundingClientRect(), v = g.split("-")[0], T = f > b.right - b.width / 2, R = u > b.bottom - b.height / 2, w = Go(k, B), F = b.width > B.width, _ = b.height > B.height, K = (F ? B : b).left, be = (F ? B : b).right, re = (_ ? B : b).top, z = (_ ? B : b).bottom;
3043
3036
  if (L && (i = !0, !D))
3044
3037
  return;
3045
3038
  if (M && (i = !1), M && !D) {
@@ -3082,11 +3075,11 @@ function Zo(e) {
3082
3075
  return [se, le, ...ye];
3083
3076
  }
3084
3077
  case "left": {
3085
- const se = [j + t + 1, _ ? H + t / 2 : $ ? H + t * 4 : H - t * 4], le = [j + t + 1, _ ? H - t / 2 : $ ? H + t * 4 : H - t * 4];
3086
- return [...[[$ || _ ? b.right - t : b.left, b.top], [$ ? _ ? b.right - t : b.left : b.right - t, b.bottom]], se, le];
3078
+ const se = [j + t + 1, _ ? H + t / 2 : R ? H + t * 4 : H - t * 4], le = [j + t + 1, _ ? H - t / 2 : R ? H + t * 4 : H - t * 4];
3079
+ return [...[[R || _ ? b.right - t : b.left, b.top], [R ? _ ? b.right - t : b.left : b.right - t, b.bottom]], se, le];
3087
3080
  }
3088
3081
  case "right": {
3089
- const se = [j - t, _ ? H + t / 2 : $ ? H + t * 4 : H - t * 4], le = [j - t, _ ? H - t / 2 : $ ? H + t * 4 : H - t * 4], ye = [[$ || _ ? b.left + t : b.right, b.top], [$ ? _ ? b.left + t : b.right : b.left + t, b.bottom]];
3082
+ const se = [j - t, _ ? H + t / 2 : R ? H + t * 4 : H - t * 4], le = [j - t, _ ? H - t / 2 : R ? H + t * 4 : H - t * 4], ye = [[R || _ ? b.left + t : b.right, b.top], [R ? _ ? b.left + t : b.right : b.left + t, b.bottom]];
3090
3083
  return [se, le, ...ye];
3091
3084
  }
3092
3085
  }
@@ -3109,7 +3102,7 @@ function Zo(e) {
3109
3102
  }
3110
3103
  const Jo = he("div"), bt = xn(
3111
3104
  {}
3112
- ), si = ({
3105
+ ), ii = ({
3113
3106
  children: e,
3114
3107
  offset: t,
3115
3108
  open: n,
@@ -3163,13 +3156,13 @@ const Jo = he("div"), bt = xn(
3163
3156
  ]
3164
3157
  );
3165
3158
  return /* @__PURE__ */ G.jsx(bt.Provider, { value: P, children: e });
3166
- }, li = ({ children: e }) => {
3159
+ }, si = ({ children: e }) => {
3167
3160
  const { getReferenceProps: t, refs: n } = Xt(bt);
3168
3161
  return /* @__PURE__ */ G.jsx(G.Fragment, { children: Sn(e) && En(e, {
3169
3162
  ref: n.setReference,
3170
3163
  ...t()
3171
3164
  }) });
3172
- }, ci = ({ children: e, overlayCardProps: t }) => {
3165
+ }, li = ({ children: e, overlayCardProps: t }) => {
3173
3166
  const {
3174
3167
  getFloatingProps: n,
3175
3168
  isMounted: r,
@@ -3194,14 +3187,13 @@ export {
3194
3187
  oi as A,
3195
3188
  Jo as B,
3196
3189
  gr as O,
3197
- si as P,
3190
+ ii as P,
3198
3191
  ir as S,
3199
- li as a,
3200
- ci as b,
3192
+ si as a,
3193
+ li as b,
3201
3194
  qt as c,
3202
3195
  ri as d,
3203
3196
  ni as g,
3204
3197
  Ie as k,
3205
- he as s,
3206
- ii as u
3198
+ he as s
3207
3199
  };
@@ -1,11 +1,10 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import { type InitialConfigType } from "@lexical/react/LexicalComposer";
3
- export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbar, refs, }: {
3
+ export declare const RichTextEditor: ({ isLoading, children, placeholderText, nodes, plugins, toolbar, }: {
4
4
  isLoading: boolean;
5
5
  children: ReactNode;
6
6
  placeholderText?: string | undefined;
7
7
  nodes: InitialConfigType["nodes"];
8
8
  plugins?: ReactNode;
9
9
  toolbar?: ReactNode;
10
- refs?: import("react").RefObject<HTMLElement>[] | undefined;
11
10
  }) => JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { type RefObject } from "react";
2
+ export declare const richTextContext: import("react").Context<{
3
+ hasFocus: boolean;
4
+ editorRef: RefObject<HTMLElement | null>;
5
+ }>;
6
+ export declare const useHasFocusWithin: ({ onBlur }: {
7
+ onBlur?: (() => void) | undefined;
8
+ }) => {
9
+ hasFocus: boolean;
10
+ attributes: {
11
+ onFocus: () => void;
12
+ onBlur: () => void;
13
+ };
14
+ };
15
+ export declare const useRichTextContext: () => {
16
+ hasFocus: boolean;
17
+ editorRef: RefObject<HTMLElement | null>;
18
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './state';
2
2
  export * from './config';
3
3
  export * from './Editor';
4
+ export * from './editorContext';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Spinner: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
4
4
  }, "color" | "css" | "size"> & import("@stitches/react/types/styled-component").TransformProps<{
5
5
  size?: "xs" | "sm" | "md" | "lg" | undefined;
6
6
  color?: "inherit" | "dark" | "light" | undefined;