@nivaro/react 0.3.32 → 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 +89 -8
- package/dist/index.js +338 -328
- package/dist/shared/components/ForceReloadBanner.js +56 -46
- package/dist/shared/components/ItemEditForm.js +5637 -5442
- 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/dist/shared/lib/unsaved-work.js +86 -38
- package/package.json +1 -1
|
@@ -5,25 +5,26 @@ import { cn as l } from "../../lib/utils.js";
|
|
|
5
5
|
import { Tabs as A, TabsList as I, TabsTrigger as S, TabsContent as o } from "../ui/tabs.js";
|
|
6
6
|
import { DayTimelineCard as T } from "./DayTimeline.js";
|
|
7
7
|
import { DelegationCard as P } from "./DelegationCard.js";
|
|
8
|
-
import {
|
|
8
|
+
import { MyDefaultsCard as D } from "./MyDefaultsCard.js";
|
|
9
|
+
import { SuspensionBanner as U, AccessCard as F, UserScopesCard as M, UserDirectoryCard as O, SessionsCard as j, ApiTokenCard as E } from "./PersonAccess.js";
|
|
9
10
|
import { AccessSummaryCard as L } from "./PersonAccessSummary.js";
|
|
10
|
-
import { StatsCard as
|
|
11
|
-
import { ForceReloadCard as
|
|
12
|
-
import { PersonAiMemoryCard as
|
|
13
|
-
import { CompareAccessCard as
|
|
14
|
-
import { WorkingOnCard as
|
|
15
|
-
import { PersonHeader as
|
|
16
|
-
import { AboutCard as
|
|
17
|
-
import { PersonWeekCard as
|
|
18
|
-
import { usePersonProfile as
|
|
19
|
-
function
|
|
11
|
+
import { StatsCard as R, ActivityFeedCard as V, SignInsCard as W, JourneyCard as B } from "./PersonActivity.js";
|
|
12
|
+
import { ForceReloadCard as H, SignOutEverywhereCard as J, MergeCard as q, OffboardingCard as z } from "./PersonAdminTools.js";
|
|
13
|
+
import { PersonAiMemoryCard as G } from "./PersonAiMemory.js";
|
|
14
|
+
import { CompareAccessCard as K } from "./PersonCompare.js";
|
|
15
|
+
import { WorkingOnCard as Q, TeamLoadCard as X, WhyCard as Y } from "./PersonExtras.js";
|
|
16
|
+
import { PersonHeader as Z } from "./PersonHeader.js";
|
|
17
|
+
import { AboutCard as $, PeopleCard as ee, AvailabilityCard as re, ResponsibilitiesCard as ae } from "./PersonOverview.js";
|
|
18
|
+
import { PersonWeekCard as de } from "./PersonWeek.js";
|
|
19
|
+
import { usePersonProfile as se, useInvalidatePerson as te } from "./types.js";
|
|
20
|
+
function Ae({
|
|
20
21
|
userId: i,
|
|
21
22
|
className: n,
|
|
22
23
|
initialTab: f = "overview"
|
|
23
24
|
}) {
|
|
24
|
-
var
|
|
25
|
-
const t = _(), s = !!(t != null && t.isAdmin), { data: e, isLoading: h, isError:
|
|
26
|
-
if (h || !e && !
|
|
25
|
+
var v, u, g;
|
|
26
|
+
const t = _(), s = !!(t != null && t.isAdmin), { data: e, isLoading: h, isError: y } = se(i), x = te(i), [N, C] = b(f), [c, k] = b("feed");
|
|
27
|
+
if (h || !e && !y) return /* @__PURE__ */ r(ie, { className: n });
|
|
27
28
|
if (!e)
|
|
28
29
|
return /* @__PURE__ */ a(
|
|
29
30
|
"div",
|
|
@@ -39,19 +40,19 @@ function we({
|
|
|
39
40
|
]
|
|
40
41
|
}
|
|
41
42
|
);
|
|
42
|
-
const w = !!(t != null && t.userId) && !!((
|
|
43
|
+
const w = !!(t != null && t.userId) && !!((v = e.manager) != null && v.id) && String(e.manager.id).toUpperCase() === String(t.userId).toUpperCase(), p = /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
43
44
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
44
|
-
/* @__PURE__ */ r(
|
|
45
|
-
/* @__PURE__ */ r(
|
|
45
|
+
/* @__PURE__ */ r($, { profile: e, isAdmin: s }),
|
|
46
|
+
/* @__PURE__ */ r(Q, { profile: e }),
|
|
46
47
|
e.direct_reports.length > 0 && /* @__PURE__ */ r(
|
|
47
|
-
|
|
48
|
+
X,
|
|
48
49
|
{
|
|
49
50
|
userId: e.id,
|
|
50
51
|
firstName: e.first_name ?? e.name,
|
|
51
52
|
expectedRows: e.direct_reports.length
|
|
52
53
|
}
|
|
53
54
|
),
|
|
54
|
-
/* @__PURE__ */ r(
|
|
55
|
+
/* @__PURE__ */ r(ee, { profile: e })
|
|
55
56
|
] }),
|
|
56
57
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
57
58
|
s ? /* @__PURE__ */ r(
|
|
@@ -72,15 +73,15 @@ function we({
|
|
|
72
73
|
},
|
|
73
74
|
forUser: { id: e.id, firstName: e.first_name ?? e.name },
|
|
74
75
|
coversFor: e.covers_for,
|
|
75
|
-
onSaved:
|
|
76
|
+
onSaved: x
|
|
76
77
|
}
|
|
77
|
-
) : /* @__PURE__ */ r(
|
|
78
|
-
/* @__PURE__ */ r(
|
|
79
|
-
(s || w) && /* @__PURE__ */ r(
|
|
78
|
+
) : /* @__PURE__ */ r(re, { profile: e }),
|
|
79
|
+
/* @__PURE__ */ r(ae, { profile: e, isAdmin: s }),
|
|
80
|
+
(s || w) && /* @__PURE__ */ r(de, { profile: e })
|
|
80
81
|
] })
|
|
81
82
|
] });
|
|
82
83
|
return /* @__PURE__ */ a("div", { className: l("flex flex-col gap-4", n), "data-nvr-person": e.id, children: [
|
|
83
|
-
/* @__PURE__ */ r(
|
|
84
|
+
/* @__PURE__ */ r(Z, { profile: e, isAdmin: s }),
|
|
84
85
|
s && /* @__PURE__ */ r(U, { profile: e }),
|
|
85
86
|
s ? /* @__PURE__ */ a(A, { value: N, onValueChange: (d) => C(d), children: [
|
|
86
87
|
/* @__PURE__ */ r(
|
|
@@ -105,14 +106,14 @@ function we({
|
|
|
105
106
|
))
|
|
106
107
|
}
|
|
107
108
|
),
|
|
108
|
-
/* @__PURE__ */ r(o, { value: "overview", className: "mt-4 focus-visible:outline-none", children:
|
|
109
|
+
/* @__PURE__ */ r(o, { value: "overview", className: "mt-4 focus-visible:outline-none", children: p }),
|
|
109
110
|
/* @__PURE__ */ r(o, { value: "access", className: "mt-4 focus-visible:outline-none", children: /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
110
111
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
111
|
-
/* @__PURE__ */ r(
|
|
112
|
+
/* @__PURE__ */ r(F, { profile: e }),
|
|
112
113
|
/* @__PURE__ */ r(L, { userId: e.id }),
|
|
113
|
-
/* @__PURE__ */ r(
|
|
114
|
-
/* @__PURE__ */ r(
|
|
115
|
-
/* @__PURE__ */ r(
|
|
114
|
+
/* @__PURE__ */ r(M, { userId: e.id }),
|
|
115
|
+
/* @__PURE__ */ r(Y, { profile: e }),
|
|
116
|
+
/* @__PURE__ */ r(K, { profile: e })
|
|
116
117
|
] }),
|
|
117
118
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
118
119
|
/* @__PURE__ */ r(O, { profile: e }),
|
|
@@ -151,30 +152,31 @@ function we({
|
|
|
151
152
|
),
|
|
152
153
|
c === "day" && s ? /* @__PURE__ */ r(T, { userId: e.id }) : /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
153
154
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
154
|
-
/* @__PURE__ */ r(
|
|
155
|
-
/* @__PURE__ */ r(
|
|
155
|
+
/* @__PURE__ */ r(R, { userId: e.id }),
|
|
156
|
+
/* @__PURE__ */ r(V, { userId: e.id })
|
|
156
157
|
] }),
|
|
157
158
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
158
|
-
/* @__PURE__ */ r(
|
|
159
|
-
/* @__PURE__ */ r(
|
|
159
|
+
/* @__PURE__ */ r(W, { profile: e }),
|
|
160
|
+
/* @__PURE__ */ r(B, { userId: e.id })
|
|
160
161
|
] })
|
|
161
162
|
] })
|
|
162
163
|
] }),
|
|
163
164
|
/* @__PURE__ */ r(o, { value: "tools", className: "mt-4 focus-visible:outline-none", children: /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
164
165
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
165
|
-
/* @__PURE__ */ r(B, { profile: e }),
|
|
166
166
|
/* @__PURE__ */ r(H, { profile: e }),
|
|
167
|
-
/* @__PURE__ */ r(J, { profile: e })
|
|
167
|
+
/* @__PURE__ */ r(J, { profile: e }),
|
|
168
|
+
/* @__PURE__ */ r(q, { profile: e })
|
|
168
169
|
] }),
|
|
169
170
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
170
|
-
/* @__PURE__ */ r(
|
|
171
|
-
/* @__PURE__ */ r(
|
|
171
|
+
/* @__PURE__ */ r(z, { profile: e }),
|
|
172
|
+
/* @__PURE__ */ r(G, { profile: e }),
|
|
173
|
+
/* @__PURE__ */ r(D, { userId: e.id, name: e.first_name ?? e.name })
|
|
172
174
|
] })
|
|
173
175
|
] }) })
|
|
174
|
-
] }) :
|
|
176
|
+
] }) : p
|
|
175
177
|
] });
|
|
176
178
|
}
|
|
177
|
-
function
|
|
179
|
+
function ie({ className: i }) {
|
|
178
180
|
return /* @__PURE__ */ a("div", { className: l("flex animate-pulse flex-col gap-4", i), "aria-busy": "true", children: [
|
|
179
181
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-5 rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
|
|
180
182
|
/* @__PURE__ */ r("div", { className: "h-[76px] w-[76px] rounded-full bg-slate-100 dark:bg-muted" }),
|
|
@@ -191,5 +193,5 @@ function te({ className: i }) {
|
|
|
191
193
|
] });
|
|
192
194
|
}
|
|
193
195
|
export {
|
|
194
|
-
|
|
196
|
+
Ae as PersonProfile
|
|
195
197
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { get as g } from "../../lib/commands.js";
|
|
2
|
+
import { isEmptyValue as S } from "../../lib/personal-defaults.js";
|
|
3
|
+
import { loadUserCard as b } from "../../lib/user-cards.js";
|
|
4
|
+
import { choiceLabel as k } from "../../lib/utils.js";
|
|
5
|
+
import { formatDisplayValue as x } from "../item-edit/GroupSection.js";
|
|
6
|
+
import { parseJson as A } from "../item-edit/helpers.js";
|
|
7
|
+
import { pickedCollection as j } from "../item-edit/personal-default-checks.js";
|
|
8
|
+
import { USER_SYSTEM_COLS as L, userDisplayLabel as D, renderDisplayTemplate as E } from "../pipeline/relations.js";
|
|
9
|
+
function _(t) {
|
|
10
|
+
return t && typeof t == "object" && !Array.isArray(t) && "id" in t ? t.id : t;
|
|
11
|
+
}
|
|
12
|
+
function T(t, i, c, n) {
|
|
13
|
+
var l;
|
|
14
|
+
if (!t) return { kind: "unknown" };
|
|
15
|
+
const s = j(i, c, t.field);
|
|
16
|
+
if (s) {
|
|
17
|
+
const f = Array.isArray(n) ? n : S(n) ? [] : [n];
|
|
18
|
+
return { kind: "records", target: s.target, ids: f.map((p) => String(_(p))) };
|
|
19
|
+
}
|
|
20
|
+
const u = (l = A(t.options)) == null ? void 0 : l.choices;
|
|
21
|
+
return Array.isArray(u) && u.length > 0 && (t.interface ?? "") !== "tags" ? { kind: "text", text: (Array.isArray(n) ? n : [n]).map((e) => {
|
|
22
|
+
const o = u.find(
|
|
23
|
+
(r) => String(r && typeof r == "object" ? r.value : r) === String(e)
|
|
24
|
+
), a = o && typeof o == "object" ? o.text : o;
|
|
25
|
+
return a != null && a !== "" ? k(String(a)) : String(e);
|
|
26
|
+
}).join(", ") } : typeof n == "boolean" ? { kind: "text", text: n ? "Yes" : "No" } : (t.interface ?? "").startsWith("file") ? { kind: "unknown" } : { kind: "text", text: x(n, t) };
|
|
27
|
+
}
|
|
28
|
+
function y(t) {
|
|
29
|
+
var c;
|
|
30
|
+
const i = t;
|
|
31
|
+
return (i == null ? void 0 : i.status) ?? ((c = i == null ? void 0 : i.response) == null ? void 0 : c.status);
|
|
32
|
+
}
|
|
33
|
+
const h = (t, i) => `${t}:${i}`;
|
|
34
|
+
async function U(t, i, c) {
|
|
35
|
+
const n = /* @__PURE__ */ new Map();
|
|
36
|
+
return await Promise.all(
|
|
37
|
+
[...i].map(async ([s, u]) => {
|
|
38
|
+
const l = [...new Set(u)];
|
|
39
|
+
if (l.length === 0) return;
|
|
40
|
+
if (L.has(s)) {
|
|
41
|
+
const e = await Promise.all(l.map((o) => b(t, o).catch(() => null)));
|
|
42
|
+
l.forEach((o, a) => {
|
|
43
|
+
const r = e[a];
|
|
44
|
+
if (!r) return;
|
|
45
|
+
const m = D(r).trim();
|
|
46
|
+
n.set(h(s, o), m && m !== o ? m : null);
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (/^(nivaro|directus)_/i.test(s)) return;
|
|
51
|
+
const f = await c(s).catch(() => null), p = f ? [...f.matchAll(/\{\{([\w.]+)\}\}/g)].map((e) => e[1].trim()) : [];
|
|
52
|
+
for (let e = 0; e < l.length; e += 200) {
|
|
53
|
+
const o = l.slice(e, e + 200), a = await t.request(
|
|
54
|
+
g(`/items/${s}`, {
|
|
55
|
+
filter: JSON.stringify({ id: { _in: o } }),
|
|
56
|
+
limit: o.length,
|
|
57
|
+
fields: p.length ? ["id", ...p].join(",") : "*",
|
|
58
|
+
labels: 1
|
|
59
|
+
})
|
|
60
|
+
).catch((r) => {
|
|
61
|
+
if (y(r) === 403 || y(r) === 404) return null;
|
|
62
|
+
throw r;
|
|
63
|
+
});
|
|
64
|
+
for (const r of (a == null ? void 0 : a.data) ?? []) {
|
|
65
|
+
const m = String(r.id), d = E(f, r).trim(), w = /[\p{L}\p{N}]/u.test(d) && d !== m;
|
|
66
|
+
n.set(h(s, m), w ? d : null);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
), n;
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
T as describeValue,
|
|
74
|
+
h as labelKey,
|
|
75
|
+
U as loadDefaultLabels
|
|
76
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsxs as c, jsx as a, Fragment as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as c, jsx as a, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useEffect as g, Children as k } from "react";
|
|
3
3
|
import { useNavigation as b } from "../../context.js";
|
|
4
4
|
import { cn as o } from "../../lib/utils.js";
|
|
5
|
-
import { UserAvatar as
|
|
6
|
-
function
|
|
5
|
+
import { UserAvatar as h } from "../UserAvatar.js";
|
|
6
|
+
function P({
|
|
7
7
|
icon: e,
|
|
8
8
|
title: t,
|
|
9
9
|
hint: r,
|
|
10
10
|
children: n,
|
|
11
11
|
actions: d,
|
|
12
|
-
tone:
|
|
13
|
-
className:
|
|
14
|
-
testId:
|
|
12
|
+
tone: s = "default",
|
|
13
|
+
className: l,
|
|
14
|
+
testId: u
|
|
15
15
|
}) {
|
|
16
16
|
return /* @__PURE__ */ c(
|
|
17
17
|
"section",
|
|
18
18
|
{
|
|
19
|
-
"data-profile-card":
|
|
19
|
+
"data-profile-card": u,
|
|
20
20
|
className: o(
|
|
21
21
|
"rounded-lg border bg-white dark:bg-card",
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
s === "danger" ? "border-amber-200 dark:border-amber-500/30" : "border-slate-200 dark:border-border",
|
|
23
|
+
l
|
|
24
24
|
),
|
|
25
25
|
children: [
|
|
26
26
|
/* @__PURE__ */ c("header", { className: "flex items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
@@ -29,7 +29,7 @@ function $({
|
|
|
29
29
|
{
|
|
30
30
|
className: o(
|
|
31
31
|
"shrink-0",
|
|
32
|
-
|
|
32
|
+
s === "danger" ? "text-amber-500" : "text-nvr-navy dark:text-nvr-cyan"
|
|
33
33
|
),
|
|
34
34
|
children: e
|
|
35
35
|
}
|
|
@@ -56,27 +56,27 @@ function j({
|
|
|
56
56
|
onChange: r,
|
|
57
57
|
placeholder: n,
|
|
58
58
|
type: d = "text",
|
|
59
|
-
disabled:
|
|
60
|
-
hint:
|
|
61
|
-
inputClassName:
|
|
59
|
+
disabled: s,
|
|
60
|
+
hint: l,
|
|
61
|
+
inputClassName: u
|
|
62
62
|
}) {
|
|
63
63
|
return /* @__PURE__ */ c("label", { className: "block", children: [
|
|
64
64
|
/* @__PURE__ */ c("span", { className: "mb-1 flex items-baseline justify-between text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:text-slate-400", children: [
|
|
65
65
|
e,
|
|
66
|
-
|
|
66
|
+
l && /* @__PURE__ */ a("span", { className: "normal-case tracking-normal text-slate-400 dark:text-slate-500", children: l })
|
|
67
67
|
] }),
|
|
68
68
|
/* @__PURE__ */ a(
|
|
69
69
|
"input",
|
|
70
70
|
{
|
|
71
71
|
type: d,
|
|
72
72
|
value: t,
|
|
73
|
-
onChange: (
|
|
73
|
+
onChange: (i) => r == null ? void 0 : r(i.target.value),
|
|
74
74
|
placeholder: n,
|
|
75
|
-
disabled:
|
|
75
|
+
disabled: s,
|
|
76
76
|
className: o(
|
|
77
77
|
"h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-700 outline-none transition-colors focus:border-nvr-cyan focus-visible:ring-2 focus-visible:ring-nvr-cyan/25 dark:border-border dark:bg-background dark:text-slate-200",
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
s && "cursor-not-allowed bg-slate-50 text-slate-400 dark:bg-muted/40 dark:text-slate-500",
|
|
79
|
+
u
|
|
80
80
|
)
|
|
81
81
|
}
|
|
82
82
|
)
|
|
@@ -112,43 +112,48 @@ function A({
|
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function T({
|
|
116
116
|
onConfirm: e,
|
|
117
117
|
children: t,
|
|
118
118
|
confirmLabel: r = "Confirm?",
|
|
119
119
|
className: n,
|
|
120
120
|
armedClassName: d,
|
|
121
|
-
title:
|
|
122
|
-
|
|
121
|
+
title: s,
|
|
122
|
+
confirmTitle: l,
|
|
123
|
+
disabled: u
|
|
123
124
|
}) {
|
|
124
|
-
const [i, m] =
|
|
125
|
-
return
|
|
125
|
+
const [i, m] = p(!1);
|
|
126
|
+
return g(() => {
|
|
126
127
|
if (!i) return;
|
|
127
|
-
const
|
|
128
|
-
return () => window.clearTimeout(
|
|
129
|
-
}, [i]), /* @__PURE__ */
|
|
128
|
+
const x = window.setTimeout(() => m(!1), 3e3);
|
|
129
|
+
return () => window.clearTimeout(x);
|
|
130
|
+
}, [i]), /* @__PURE__ */ c(
|
|
130
131
|
"button",
|
|
131
132
|
{
|
|
132
133
|
type: "button",
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
|
|
134
|
+
"data-tip": i ? void 0 : s,
|
|
135
|
+
"data-armed": i ? "" : void 0,
|
|
136
|
+
"aria-label": i ? l ?? (typeof r == "string" ? r : s ? `${s}?` : void 0) : s,
|
|
137
|
+
disabled: u,
|
|
136
138
|
onClick: () => {
|
|
137
139
|
i ? (m(!1), e()) : m(!0);
|
|
138
140
|
},
|
|
139
141
|
className: o(n, i && d),
|
|
140
|
-
children:
|
|
142
|
+
children: [
|
|
143
|
+
i ? r : t,
|
|
144
|
+
/* @__PURE__ */ a("span", { className: "sr-only", "aria-live": "polite", children: i ? "Press again to confirm" : "" })
|
|
145
|
+
]
|
|
141
146
|
}
|
|
142
147
|
);
|
|
143
148
|
}
|
|
144
|
-
function
|
|
149
|
+
function B({ label: e, children: t }) {
|
|
145
150
|
return /* @__PURE__ */ c("div", { className: "bg-white px-3 py-2 dark:bg-card", children: [
|
|
146
151
|
/* @__PURE__ */ a("p", { className: "text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: e }),
|
|
147
152
|
/* @__PURE__ */ a("div", { className: "mt-0.5 text-[12.5px] text-slate-700 dark:text-slate-200", children: t })
|
|
148
153
|
] });
|
|
149
154
|
}
|
|
150
|
-
function
|
|
151
|
-
const r =
|
|
155
|
+
function E({ children: e, cols: t = 3 }) {
|
|
156
|
+
const r = k.toArray(e).filter(Boolean).length, n = t === 3 ? 6 : t, d = (n - r % n) % n;
|
|
152
157
|
return /* @__PURE__ */ c(
|
|
153
158
|
"div",
|
|
154
159
|
{
|
|
@@ -159,12 +164,12 @@ function B({ children: e, cols: t = 3 }) {
|
|
|
159
164
|
),
|
|
160
165
|
children: [
|
|
161
166
|
e,
|
|
162
|
-
Array.from({ length: d }, (
|
|
167
|
+
Array.from({ length: d }, (s, l) => /* @__PURE__ */ a("div", { className: "bg-white dark:bg-card", "aria-hidden": !0 }, `fill-${l}`))
|
|
163
168
|
]
|
|
164
169
|
}
|
|
165
170
|
);
|
|
166
171
|
}
|
|
167
|
-
const
|
|
172
|
+
const v = {
|
|
168
173
|
neutral: "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
169
174
|
brand: "bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan",
|
|
170
175
|
amber: "bg-amber-50 text-amber-700 dark:bg-amber-500/10 dark:text-amber-400",
|
|
@@ -172,7 +177,7 @@ const h = {
|
|
|
172
177
|
green: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400",
|
|
173
178
|
violet: "bg-violet-50 text-violet-700 dark:bg-violet-500/10 dark:text-violet-400"
|
|
174
179
|
};
|
|
175
|
-
function
|
|
180
|
+
function I({
|
|
176
181
|
tone: e = "neutral",
|
|
177
182
|
children: t,
|
|
178
183
|
title: r,
|
|
@@ -185,43 +190,43 @@ function E({
|
|
|
185
190
|
title: r,
|
|
186
191
|
className: o(
|
|
187
192
|
"inline-flex items-center gap-1 rounded-full px-2 py-px text-[10.5px] font-semibold",
|
|
188
|
-
|
|
193
|
+
v[e]
|
|
189
194
|
),
|
|
190
195
|
children: t
|
|
191
196
|
}
|
|
192
197
|
);
|
|
193
198
|
}
|
|
194
|
-
function
|
|
195
|
-
var n, d,
|
|
199
|
+
function N(e) {
|
|
200
|
+
var n, d, s, l;
|
|
196
201
|
const t = `${((n = e.first_name) == null ? void 0 : n[0]) ?? ""}${((d = e.last_name) == null ? void 0 : d[0]) ?? ""}`.trim();
|
|
197
202
|
if (t) return t.toUpperCase();
|
|
198
203
|
const r = (e.name ?? "").split(/\s+/).filter(Boolean);
|
|
199
|
-
return r.length >= 2 ? `${r[0][0]}${r[r.length - 1][0]}`.toUpperCase() : (((
|
|
204
|
+
return r.length >= 2 ? `${r[0][0]}${r[r.length - 1][0]}`.toUpperCase() : (((s = r[0]) == null ? void 0 : s[0]) ?? ((l = e.email) == null ? void 0 : l[0]) ?? "?").toUpperCase();
|
|
200
205
|
}
|
|
201
|
-
function
|
|
206
|
+
function y() {
|
|
202
207
|
const e = b();
|
|
203
208
|
return (t) => e.userUrl ? e.userUrl(t) : `/users/${t}`;
|
|
204
209
|
}
|
|
205
|
-
function
|
|
210
|
+
function K({
|
|
206
211
|
person: e,
|
|
207
212
|
meta: t,
|
|
208
213
|
size: r = "sm"
|
|
209
214
|
}) {
|
|
210
|
-
const n = b(),
|
|
215
|
+
const n = b(), s = y()(e.id), l = r === "md" ? "h-7 w-7 text-[11px]" : "h-5 w-5 text-[9px]", u = /* @__PURE__ */ c(f, { children: [
|
|
211
216
|
/* @__PURE__ */ a(
|
|
212
|
-
|
|
217
|
+
h,
|
|
213
218
|
{
|
|
214
219
|
userId: e.id,
|
|
215
220
|
alt: e.name,
|
|
216
|
-
className: o("shrink-0 rounded-full",
|
|
221
|
+
className: o("shrink-0 rounded-full", l),
|
|
217
222
|
fallback: /* @__PURE__ */ a(
|
|
218
223
|
"span",
|
|
219
224
|
{
|
|
220
225
|
className: o(
|
|
221
226
|
"flex shrink-0 select-none items-center justify-center rounded-full bg-[#c7f0fb] font-semibold text-[#04516b] dark:bg-nvr-cyan/15 dark:text-nvr-cyan",
|
|
222
|
-
|
|
227
|
+
l
|
|
223
228
|
),
|
|
224
|
-
children:
|
|
229
|
+
children: N(e)
|
|
225
230
|
}
|
|
226
231
|
)
|
|
227
232
|
}
|
|
@@ -233,34 +238,34 @@ function I({
|
|
|
233
238
|
] }),
|
|
234
239
|
t && /* @__PURE__ */ a("span", { className: "block truncate text-[11px] text-slate-400", children: t })
|
|
235
240
|
] })
|
|
236
|
-
] }),
|
|
237
|
-
return
|
|
241
|
+
] }), i = "group/person inline-flex max-w-full items-center gap-2 rounded-md text-left align-middle";
|
|
242
|
+
return s ? /* @__PURE__ */ a(
|
|
238
243
|
"a",
|
|
239
244
|
{
|
|
240
|
-
href:
|
|
245
|
+
href: s,
|
|
241
246
|
"data-person-link": e.id,
|
|
242
|
-
onClick: (
|
|
243
|
-
|
|
247
|
+
onClick: (m) => {
|
|
248
|
+
m.metaKey || m.ctrlKey || m.shiftKey || m.button !== 0 || (m.preventDefault(), n.navigate(s));
|
|
244
249
|
},
|
|
245
|
-
className: o(
|
|
246
|
-
children:
|
|
250
|
+
className: o(i, "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),
|
|
251
|
+
children: u
|
|
247
252
|
}
|
|
248
|
-
) : /* @__PURE__ */ a("span", { className:
|
|
253
|
+
) : /* @__PURE__ */ a("span", { className: i, children: u });
|
|
249
254
|
}
|
|
250
|
-
function
|
|
255
|
+
function O({ children: e }) {
|
|
251
256
|
return /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: e });
|
|
252
257
|
}
|
|
253
258
|
export {
|
|
254
|
-
|
|
255
|
-
|
|
259
|
+
T as ConfirmButton,
|
|
260
|
+
O as EmptyLine,
|
|
256
261
|
j as Field,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
262
|
+
B as Meta,
|
|
263
|
+
E as MetaGrid,
|
|
264
|
+
v as PILL_TONES,
|
|
265
|
+
K as PersonChip,
|
|
266
|
+
I as Pill,
|
|
267
|
+
P as SectionCard,
|
|
263
268
|
A as Toggle,
|
|
264
|
-
|
|
265
|
-
|
|
269
|
+
N as personInitials,
|
|
270
|
+
y as usePersonUrl
|
|
266
271
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
function y(t) {
|
|
2
|
+
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
3
|
+
}
|
|
4
|
+
function p(t) {
|
|
5
|
+
return Array.isArray(t) ? t.map(p) : t && typeof t == "object" && "id" in t ? t.id : t;
|
|
6
|
+
}
|
|
7
|
+
function d(t) {
|
|
8
|
+
const n = p(t);
|
|
9
|
+
return Array.isArray(n) ? n.map((e) => String(p(e))).sort() : String(n);
|
|
10
|
+
}
|
|
11
|
+
function w(t, n) {
|
|
12
|
+
return JSON.stringify(d(t)) === JSON.stringify(d(n));
|
|
13
|
+
}
|
|
14
|
+
function h(t, n) {
|
|
15
|
+
const e = /* @__PURE__ */ new Set([t]), c = [];
|
|
16
|
+
let i = [t];
|
|
17
|
+
for (; i.length; ) {
|
|
18
|
+
const s = [];
|
|
19
|
+
for (const r of i)
|
|
20
|
+
for (const o of n(r))
|
|
21
|
+
o.upstream || e.has(o.parent_field) || (e.add(o.parent_field), c.push(o.parent_field), s.push(o.parent_field));
|
|
22
|
+
i = s;
|
|
23
|
+
}
|
|
24
|
+
return c;
|
|
25
|
+
}
|
|
26
|
+
function g(t, n, e) {
|
|
27
|
+
const c = {};
|
|
28
|
+
for (const i of h(t, e))
|
|
29
|
+
y(n[i]) || (c[i] = p(n[i]));
|
|
30
|
+
return c;
|
|
31
|
+
}
|
|
32
|
+
function k(t, n) {
|
|
33
|
+
const e = new Set(t), c = new Map(
|
|
34
|
+
t.map((o) => [o, h(o, n).filter((l) => e.has(l) && l !== o)])
|
|
35
|
+
), i = /* @__PURE__ */ new Set(), s = [];
|
|
36
|
+
let r = [...t];
|
|
37
|
+
for (; r.length; ) {
|
|
38
|
+
const l = r.find((u) => {
|
|
39
|
+
var a;
|
|
40
|
+
return (a = c.get(u)) == null ? void 0 : a.every((f) => i.has(f));
|
|
41
|
+
}) ?? r[0];
|
|
42
|
+
i.add(l), s.push(l), r = r.filter((u) => u !== l);
|
|
43
|
+
}
|
|
44
|
+
return s;
|
|
45
|
+
}
|
|
46
|
+
function S(t, n) {
|
|
47
|
+
let e = null, c = null;
|
|
48
|
+
const i = [...t].sort(
|
|
49
|
+
(s, r) => s.updated_at < r.updated_at ? 1 : s.updated_at > r.updated_at ? -1 : 0
|
|
50
|
+
);
|
|
51
|
+
for (const s of i) {
|
|
52
|
+
let r = 0, o = null;
|
|
53
|
+
const l = {};
|
|
54
|
+
for (const [a, f] of Object.entries(s.context ?? {}))
|
|
55
|
+
if (y(n[a])) l[a] = f;
|
|
56
|
+
else if (w(f, n[a])) r++;
|
|
57
|
+
else {
|
|
58
|
+
o = a;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
if (o) {
|
|
62
|
+
c || (c = o);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const u = Object.keys(s.context ?? {}).length;
|
|
66
|
+
(!e || r > e.score || r === e.score && u > e.size) && (e = { c: s, score: r, size: u, fill: l });
|
|
67
|
+
}
|
|
68
|
+
return e ? { pick: e.c, fillParents: e.fill, blockedBy: null } : { pick: null, fillParents: {}, blockedBy: c };
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
g as captureContext,
|
|
72
|
+
h as cascadeParents,
|
|
73
|
+
y as isEmptyValue,
|
|
74
|
+
k as orderTopDown,
|
|
75
|
+
S as pickDefault
|
|
76
|
+
};
|