@nivaro/react 0.3.33 → 0.3.34
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +79 -5
- package/dist/index.js +338 -329
- package/dist/shared/components/ItemEditForm.js +5494 -5302
- package/dist/shared/components/ProfileView.js +46 -44
- package/dist/shared/components/ReportView.js +208 -205
- package/dist/shared/components/SearchHighlight.js +30 -0
- package/dist/shared/components/TipLayer.js +39 -37
- package/dist/shared/components/item-edit/CatalogPickerField.js +1484 -1232
- package/dist/shared/components/item-edit/FieldAffordances.js +370 -203
- package/dist/shared/components/item-edit/FieldRow.js +396 -354
- package/dist/shared/components/item-edit/PersonalDefaultPill.js +50 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +42 -41
- package/dist/shared/components/item-edit/catalog-search.js +34 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +34 -34
- package/dist/shared/components/item-edit/personal-default-checks.js +134 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +358 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +130 -111
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +76 -75
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/profile/MyDefaultsCard.js +667 -0
- package/dist/shared/components/profile/PersonProfile.js +42 -40
- package/dist/shared/components/profile/my-defaults-labels.js +76 -0
- package/dist/shared/components/profile/primitives.js +72 -67
- package/dist/shared/lib/personal-defaults.js +76 -0
- package/dist/shared/lib/request-gate.js +78 -76
- package/dist/shared/lib/search-text.js +111 -0
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as c, Fragment as p } from "react";
|
|
3
|
+
import { highlightParts as s } from "../lib/search-text.js";
|
|
4
|
+
import { cn as d } from "../lib/utils.js";
|
|
5
|
+
function x({
|
|
6
|
+
text: e,
|
|
7
|
+
query: i,
|
|
8
|
+
synonyms: h,
|
|
9
|
+
className: m,
|
|
10
|
+
markClassName: o
|
|
11
|
+
}) {
|
|
12
|
+
const n = c(() => s(e, i, { synonyms: h }), [e, i, h]);
|
|
13
|
+
return n.some((r) => r.match) ? /* @__PURE__ */ t("span", { className: m, children: n.map(
|
|
14
|
+
(r, a) => r.match ? /* @__PURE__ */ t(
|
|
15
|
+
"mark",
|
|
16
|
+
{
|
|
17
|
+
"data-search-hit": !0,
|
|
18
|
+
className: d("rounded-sm bg-nvr-cyan/20 px-0 text-inherit", o),
|
|
19
|
+
children: r.text
|
|
20
|
+
},
|
|
21
|
+
a
|
|
22
|
+
) : (
|
|
23
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: parts are positional and never reorder
|
|
24
|
+
/* @__PURE__ */ t(p, { children: r.text }, a)
|
|
25
|
+
)
|
|
26
|
+
) }) : /* @__PURE__ */ t("span", { className: m, children: e ?? "" });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
x as SearchHighlight
|
|
30
|
+
};
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as m, useRef as
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useRef as v, useEffect as h, useLayoutEffect as x } from "react";
|
|
3
3
|
import { createPortal as b } from "react-dom";
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
const [e,
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const u = [];
|
|
5
|
+
function R() {
|
|
6
|
+
const [e, o] = m(null), [t, s] = m(!1), d = v(null);
|
|
7
|
+
return h(() => (u.push(s), u[0] === s && s(!0), () => {
|
|
8
|
+
var n;
|
|
9
|
+
const r = u.indexOf(s);
|
|
10
|
+
r < 0 || (u.splice(r, 1), r === 0 && ((n = u[0]) == null || n.call(u, !0)));
|
|
11
|
+
}), []), h(() => {
|
|
10
12
|
if (!t) return;
|
|
11
|
-
const
|
|
12
|
-
var
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
15
|
-
|
|
13
|
+
const r = (c) => {
|
|
14
|
+
var l, p;
|
|
15
|
+
const i = (p = (l = c.target) == null ? void 0 : l.closest) == null ? void 0 : p.call(l, "[data-tip]"), f = i == null ? void 0 : i.getAttribute("data-tip");
|
|
16
|
+
if (!i || !f || i.getAttribute("aria-expanded") === "true") {
|
|
17
|
+
o((w) => w && null);
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
return window.addEventListener("mouseover",
|
|
22
|
-
window.removeEventListener("mouseover",
|
|
20
|
+
const a = i.getBoundingClientRect();
|
|
21
|
+
o({ x: a.left, y: a.bottom + 4, text: f });
|
|
22
|
+
}, n = () => o(null);
|
|
23
|
+
return window.addEventListener("mouseover", r), window.addEventListener("pointerdown", n, !0), window.addEventListener("scroll", n, !0), () => {
|
|
24
|
+
window.removeEventListener("mouseover", r), window.removeEventListener("pointerdown", n, !0), window.removeEventListener("scroll", n, !0);
|
|
23
25
|
};
|
|
24
|
-
}, [t]),
|
|
26
|
+
}, [t]), x(() => {
|
|
25
27
|
if (!e) return;
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
const
|
|
29
|
-
let { x:
|
|
30
|
-
|
|
28
|
+
const r = d.current;
|
|
29
|
+
if (!r) return;
|
|
30
|
+
const n = r.getBoundingClientRect();
|
|
31
|
+
let { x: c, y: i } = e;
|
|
32
|
+
n.right > window.innerWidth - 8 && (c = Math.max(8, window.innerWidth - n.width - 8)), n.bottom > window.innerHeight - 8 && (i = Math.max(8, e.y - n.height - 30)), (c !== e.x || i !== e.y) && o({ ...e, x: c, y: i });
|
|
31
33
|
}, [e]), !t || !e ? null : b(
|
|
32
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ g(
|
|
33
35
|
"div",
|
|
34
36
|
{
|
|
35
|
-
ref:
|
|
37
|
+
ref: d,
|
|
36
38
|
style: { position: "fixed", left: e.x, top: e.y, zIndex: 120 },
|
|
37
39
|
className: "pointer-events-none max-w-[340px] whitespace-pre-wrap break-words rounded-md bg-[#0f172a] px-2 py-1 text-[11px] font-medium leading-snug text-white shadow-lg dark:bg-[#334155]",
|
|
38
40
|
children: e.text
|
|
@@ -41,20 +43,20 @@ function O() {
|
|
|
41
43
|
document.body
|
|
42
44
|
);
|
|
43
45
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
const t =
|
|
46
|
+
function O(e) {
|
|
47
|
+
const o = v(null);
|
|
48
|
+
return x(() => {
|
|
49
|
+
const t = o.current;
|
|
48
50
|
if (!t) return;
|
|
49
|
-
const
|
|
51
|
+
const s = () => {
|
|
50
52
|
(t.scrollWidth > t.clientWidth + 1 || t.scrollHeight > t.clientHeight + 1) && e ? t.setAttribute("data-tip", e) : t.removeAttribute("data-tip");
|
|
51
53
|
};
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
return
|
|
55
|
-
}, [e]),
|
|
54
|
+
if (s(), typeof ResizeObserver > "u") return;
|
|
55
|
+
const d = new ResizeObserver(s);
|
|
56
|
+
return d.observe(t), () => d.disconnect();
|
|
57
|
+
}, [e]), o;
|
|
56
58
|
}
|
|
57
59
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
R as TipLayer,
|
|
61
|
+
O as useOverflowTip
|
|
60
62
|
};
|