@nivaro/react 0.2.51 → 0.2.53
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 +207 -6
- package/dist/index.js +442 -439
- package/dist/layout-editor.d.ts +80 -0
- package/dist/layout-editor.js +11 -0
- package/dist/shared/components/ItemEditForm.js +4015 -3835
- package/dist/shared/components/RecordDrilldownSheet.js +114 -97
- package/dist/shared/components/RecordReadView.js +637 -570
- package/dist/shared/components/ai/ExplainButton.js +1 -1
- package/dist/shared/components/item-edit/GroupSection.js +489 -466
- package/dist/shared/components/item-edit/HeaderBand.js +47 -44
- package/dist/shared/components/item-edit/M2MStagingContext.js +3 -3
- package/dist/shared/components/item-edit/O2MStagingContext.js +1 -1
- package/dist/shared/components/item-edit/RecordGrantTools.js +206 -0
- package/dist/shared/components/item-edit/StepsBar.js +49 -43
- package/dist/shared/components/item-edit/SummaryPanel.js +1 -1
- package/dist/shared/components/item-edit/config-update.js +6 -0
- package/dist/shared/components/item-edit/layout-editing-quiet.js +25 -0
- package/dist/shared/components/layout-editor/AddPanel.js +301 -0
- package/dist/shared/components/layout-editor/DesignNode.js +173 -0
- package/dist/shared/components/layout-editor/EditorCanvas.js +52 -0
- package/dist/shared/components/layout-editor/EditorTopBar.js +241 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +179 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +393 -0
- package/dist/shared/components/layout-editor/LayoutsRail.js +89 -0
- package/dist/shared/components/layout-editor/add-target.js +103 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +86 -0
- package/dist/shared/components/layout-editor/canvases/PdfCanvas.js +90 -0
- package/dist/shared/components/layout-editor/canvases/TableColumnsCanvas.js +246 -0
- package/dist/shared/components/layout-editor/collection-meta.js +22 -0
- package/dist/shared/components/layout-editor/design-canvas.js +81 -0
- package/dist/shared/components/layout-editor/design-context.js +21 -0
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +225 -0
- package/dist/shared/components/layout-editor/dnd/collision.js +107 -0
- package/dist/shared/components/layout-editor/dnd/node.js +164 -0
- package/dist/shared/components/layout-editor/dnd/order.js +122 -0
- package/dist/shared/components/layout-editor/editors/DefaultValuesEditor.js +223 -0
- package/dist/shared/components/layout-editor/editors/QuickPickerStepsEditor.js +129 -0
- package/dist/shared/components/layout-editor/editors/ReadPresentationEditor.js +134 -0
- package/dist/shared/components/layout-editor/editors/RecordConditionsEditor.js +249 -0
- package/dist/shared/components/layout-editor/editors/RolesPicker.js +77 -0
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +556 -0
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +150 -0
- package/dist/shared/components/layout-editor/editors/controls.js +73 -0
- package/dist/shared/components/layout-editor/editors/editor-api.js +21 -0
- package/dist/shared/components/layout-editor/editors/editor-queries.js +25 -0
- package/dist/shared/components/layout-editor/editors/field-default-value.js +131 -0
- package/dist/shared/components/layout-editor/editors/grid-presets.js +310 -0
- package/dist/shared/components/layout-editor/editors/inline-display.js +157 -0
- package/dist/shared/components/layout-editor/editors/layout-picker.js +80 -0
- package/dist/shared/components/layout-editor/editors/layout-rows.js +55 -0
- package/dist/shared/components/layout-editor/editors/lock-conditions.js +109 -0
- package/dist/shared/components/layout-editor/editors/o2m-agg-field.js +25 -0
- package/dist/shared/components/layout-editor/editors/pdf-field-config.js +107 -0
- package/dist/shared/components/layout-editor/editors/report-widget-config.js +94 -0
- package/dist/shared/components/layout-editor/editors/row-rule-check.js +225 -0
- package/dist/shared/components/layout-editor/editors/row-rule-row.js +1353 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +245 -0
- package/dist/shared/components/layout-editor/focus-buffer.js +32 -0
- package/dist/shared/components/layout-editor/host.js +15 -0
- package/dist/shared/components/layout-editor/inspector/AdvancedTab.js +296 -0
- package/dist/shared/components/layout-editor/inspector/GridTab.js +767 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +456 -0
- package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +268 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +332 -0
- package/dist/shared/components/layout-editor/inspector/LookTab.js +310 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +333 -0
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +323 -0
- package/dist/shared/components/layout-editor/inspector/SlotInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/SubtitleInspector.js +154 -0
- package/dist/shared/components/layout-editor/inspector/WidgetInspector.js +262 -0
- package/dist/shared/components/layout-editor/inspector/applies.js +27 -0
- package/dist/shared/components/layout-editor/inspector/field-context.js +134 -0
- package/dist/shared/components/layout-editor/inspector/interfaces.js +126 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +595 -0
- package/dist/shared/components/layout-editor/inspector/model.js +307 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +121 -0
- package/dist/shared/components/layout-editor/overview/overview-api.js +141 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +62 -0
- package/dist/shared/components/layout-editor/overview/record-count.js +65 -0
- package/dist/shared/components/layout-editor/panel-frame.js +99 -0
- package/dist/shared/components/layout-editor/panel-style.js +19 -0
- package/dist/shared/components/layout-editor/pickers/field-picker.js +230 -0
- package/dist/shared/components/layout-editor/pickers/icon-picker.js +233 -0
- package/dist/shared/components/layout-editor/pickers/relation-label.js +34 -0
- package/dist/shared/components/layout-editor/pickers/relation-picker.js +136 -0
- package/dist/shared/components/layout-editor/record-queries.js +15 -0
- package/dist/shared/components/layout-editor/settings/AddendumSection.js +52 -0
- package/dist/shared/components/layout-editor/settings/ButtonsSection.js +45 -0
- package/dist/shared/components/layout-editor/settings/DefaultsSection.js +67 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +146 -0
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +37 -0
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +70 -0
- package/dist/shared/components/layout-editor/settings/PdfSection.js +176 -0
- package/dist/shared/components/layout-editor/settings/ReadSection.js +79 -0
- package/dist/shared/components/layout-editor/settings/TextSetting.js +55 -0
- package/dist/shared/components/layout-editor/settings/ToggleSetting.js +33 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +179 -0
- package/dist/shared/components/layout-editor/settings/WhoSection.js +213 -0
- package/dist/shared/components/layout-editor/settings/controls.js +214 -0
- package/dist/shared/components/layout-editor/settings/section-props.js +17 -0
- package/dist/shared/components/layout-editor/settings/settings-api.js +151 -0
- package/dist/shared/components/layout-editor/settings/settings-registry.js +445 -0
- package/dist/shared/components/layout-editor/slot-names.js +20 -0
- package/dist/shared/components/layout-editor/summary-pref.js +21 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +474 -0
- package/dist/shared/components/pipeline/relations.js +28 -23
- package/dist/shared/components/ui/popover.js +17 -17
- package/dist/shared/components/ui/scroll-area.js +38 -0
- package/dist/shared/hooks/useRelationOptions.js +60 -0
- package/dist/shared/lib/layout-grants.js +9 -0
- package/dist/shared/lib/layout-ops.js +348 -0
- package/dist/shared/lib/layout-slots.js +11 -7
- package/dist/shared/lib/request-gate.js +1 -1
- package/package.json +5 -1
|
@@ -1,71 +1,74 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as D, Fragment as R, jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useRef as m, useCallback as O, cloneElement as k } from "react";
|
|
3
3
|
import { headerChangedCells as $, headerNeedsDense as j, headerFoldedCells as x } from "../../lib/header-strip.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
l
|
|
10
|
-
|
|
4
|
+
import { useLayoutDesign as M } from "../layout-editor/design-context.js";
|
|
5
|
+
import { HeaderOverflowChip as T } from "./HeaderOverflowChip.js";
|
|
6
|
+
function B() {
|
|
7
|
+
const [a, i] = S(!1), o = m(!1);
|
|
8
|
+
o.current = a;
|
|
9
|
+
const [l, d] = S([]), s = m([]);
|
|
10
|
+
s.current = l;
|
|
11
|
+
const y = m(/* @__PURE__ */ new Map()), u = m(/* @__PURE__ */ new Map()), e = m(null), n = O((r) => {
|
|
11
12
|
var v;
|
|
12
|
-
if ((v =
|
|
13
|
+
if ((v = e.current) == null || v.call(e), e.current = null, !r || typeof ResizeObserver > "u") return;
|
|
13
14
|
let f = 0;
|
|
14
|
-
const
|
|
15
|
+
const w = () => {
|
|
15
16
|
f = 0;
|
|
16
|
-
const c = j(
|
|
17
|
-
c !==
|
|
18
|
-
const h = c ? x(
|
|
19
|
-
t(h) !== t(
|
|
20
|
-
},
|
|
21
|
-
f || (f = window.requestAnimationFrame(
|
|
22
|
-
}, p = new ResizeObserver(
|
|
23
|
-
p.observe(
|
|
24
|
-
for (const c of
|
|
25
|
-
const
|
|
26
|
-
for (const t of
|
|
27
|
-
const h = $(
|
|
17
|
+
const c = j(r, o.current, u.current);
|
|
18
|
+
c !== o.current && i(c);
|
|
19
|
+
const h = c ? x(r, o.current, y.current) : [], t = (C) => C.map((F) => `${F.key}${F.empty ? "e" : ""}`).join();
|
|
20
|
+
t(h) !== t(s.current) && d(h);
|
|
21
|
+
}, b = () => {
|
|
22
|
+
f || (f = window.requestAnimationFrame(w));
|
|
23
|
+
}, p = new ResizeObserver(b);
|
|
24
|
+
p.observe(r);
|
|
25
|
+
for (const c of r.children) p.observe(c);
|
|
26
|
+
const g = new MutationObserver((c) => {
|
|
27
|
+
for (const t of r.children) p.observe(t);
|
|
28
|
+
const h = $(r, c);
|
|
28
29
|
for (const t of h.shown)
|
|
29
|
-
|
|
30
|
-
for (const t of h.folded)
|
|
31
|
-
|
|
30
|
+
y.current.delete(t), u.current.delete(t);
|
|
31
|
+
for (const t of h.folded) u.current.delete(t);
|
|
32
|
+
b();
|
|
32
33
|
});
|
|
33
|
-
|
|
34
|
-
p.disconnect(),
|
|
34
|
+
g.observe(r, { childList: !0, subtree: !0, characterData: !0 }), w(), e.current = () => {
|
|
35
|
+
p.disconnect(), g.disconnect(), f && window.cancelAnimationFrame(f);
|
|
35
36
|
};
|
|
36
37
|
}, []);
|
|
37
|
-
return { headerDense: a, headerFolded:
|
|
38
|
+
return { headerDense: a, headerFolded: l, headerTilesRef: n };
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
let
|
|
42
|
-
return
|
|
43
|
-
}),
|
|
44
|
-
|
|
40
|
+
function K({ tiles: a, folded: i }) {
|
|
41
|
+
const o = new Set(i.map((e) => String(e.key))), l = /* @__PURE__ */ new Set(), d = a.map((e, n) => {
|
|
42
|
+
let r = String(e.key ?? n);
|
|
43
|
+
return l.has(r) && (r = `${r}#${n}`), l.add(r), r;
|
|
44
|
+
}), s = a.filter((e, n) => o.has(d[n])), u = M() ? s.map(
|
|
45
|
+
(e) => k(e, { "data-design-copy": "" })
|
|
46
|
+
) : s;
|
|
47
|
+
return /* @__PURE__ */ D(R, { children: [
|
|
45
48
|
a.map(
|
|
46
|
-
(e,
|
|
49
|
+
(e, n) => (
|
|
47
50
|
// Folded: marked on the tile itself, which keeps its own key — a
|
|
48
51
|
// wrapper changed the key and remounted the tile on every fold, so a
|
|
49
52
|
// widget refetched and re-rendered each time. Out of flow but in the
|
|
50
53
|
// DOM, in place.
|
|
51
|
-
|
|
54
|
+
k(
|
|
52
55
|
e,
|
|
53
|
-
|
|
56
|
+
o.has(d[n]) ? { "data-header-cell": d[n], "data-header-folded": "", "aria-hidden": "true" } : { "data-header-cell": d[n] }
|
|
54
57
|
)
|
|
55
58
|
)
|
|
56
59
|
),
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
s.length > 0 && /* @__PURE__ */ H(
|
|
61
|
+
T,
|
|
59
62
|
{
|
|
60
|
-
count:
|
|
63
|
+
count: s.length,
|
|
61
64
|
allEmpty: i.every((e) => e.empty),
|
|
62
65
|
labels: i.map((e) => e.label),
|
|
63
|
-
children:
|
|
66
|
+
children: u
|
|
64
67
|
}
|
|
65
68
|
)
|
|
66
69
|
] });
|
|
67
70
|
}
|
|
68
71
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
K as HeaderTiles,
|
|
73
|
+
B as useHeaderBand
|
|
71
74
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext as u,
|
|
1
|
+
import { useContext as u, useState as w, useRef as R, useCallback as x, useMemo as M, createContext as s } from "react";
|
|
2
2
|
const S = s(null);
|
|
3
3
|
function h() {
|
|
4
4
|
return u(S);
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as D, useQuery as j, useMutation as F } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as I, EyeOff as L, CalendarClock as Q, ChevronsUpDown as R, Check as B } from "lucide-react";
|
|
4
|
+
import { useState as c, useId as K, useMemo as M } from "react";
|
|
5
|
+
import { toast as f } from "sonner";
|
|
6
|
+
import { useNivaroClient as $ } from "../../context.js";
|
|
7
|
+
import { get as V, post as q } from "../../lib/commands.js";
|
|
8
|
+
import { titleCase as W, cn as z } from "../../lib/utils.js";
|
|
9
|
+
import { Button as w } from "../ui/button.js";
|
|
10
|
+
import { Command as A, CommandInput as H, CommandList as U, CommandEmpty as G, CommandItem as J } from "../ui/command.js";
|
|
11
|
+
import { Input as S } from "../ui/input.js";
|
|
12
|
+
import { Popover as _, PopoverTrigger as E, PopoverContent as P } from "../ui/popover.js";
|
|
13
|
+
function O(l, r) {
|
|
14
|
+
return l instanceof Error && l.message ? l.message : r;
|
|
15
|
+
}
|
|
16
|
+
function ce({
|
|
17
|
+
collection: l,
|
|
18
|
+
itemId: r,
|
|
19
|
+
layoutSlug: d
|
|
20
|
+
}) {
|
|
21
|
+
const u = $(), x = D(), m = ["picker-exclusion", l, r], { data: s } = j({
|
|
22
|
+
queryKey: m,
|
|
23
|
+
queryFn: () => u.request(
|
|
24
|
+
V(`/picker-exclusions/status/${l}/${r}`)
|
|
25
|
+
).then((a) => a.data),
|
|
26
|
+
staleTime: 6e4
|
|
27
|
+
}), i = (s == null ? void 0 : s.excluded) ?? !1, o = F({
|
|
28
|
+
mutationFn: () => {
|
|
29
|
+
const a = { collection: l, item_id: r, layout: d ?? null };
|
|
30
|
+
return u.request(
|
|
31
|
+
i ? { _method: "DELETE", _path: "/picker-exclusions", _body: a } : q("/picker-exclusions", a)
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
onSuccess: () => {
|
|
35
|
+
x.invalidateQueries({ queryKey: m }), f.success(i ? "Record re-enabled in pickers" : "Record excluded from pickers");
|
|
36
|
+
},
|
|
37
|
+
onError: (a) => f.error(O(a, "Could not change picker visibility"))
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ n(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
"data-record-picker-exclusion": !0,
|
|
44
|
+
"data-excluded": i ? "true" : "false",
|
|
45
|
+
disabled: o.isPending,
|
|
46
|
+
onClick: () => o.mutate(),
|
|
47
|
+
"data-tip": i ? "This record is hidden from pickers — click to offer it again" : "Hide this record from every picker that would offer it",
|
|
48
|
+
className: "inline-flex items-center",
|
|
49
|
+
children: [
|
|
50
|
+
o.isPending ? /* @__PURE__ */ t(I, { className: "animate-spin" }) : /* @__PURE__ */ t(L, {}),
|
|
51
|
+
i ? "Re-enable in pickers" : "Disable in pickers"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function de({
|
|
57
|
+
collection: l,
|
|
58
|
+
itemId: r,
|
|
59
|
+
fields: d,
|
|
60
|
+
layoutSlug: u
|
|
61
|
+
}) {
|
|
62
|
+
const x = $(), [m, s] = c(!1), [i, o] = c(!1), [a, N] = c(""), [g, v] = c(""), [p, C] = c(""), h = K(), k = M(
|
|
63
|
+
() => d.filter((e) => !e.field.startsWith("__") && !e.field.includes(".")).map((e) => ({ field: e.field, label: e.label || W(e.field) })),
|
|
64
|
+
[d]
|
|
65
|
+
), b = k.find((e) => e.field === a), y = F({
|
|
66
|
+
mutationFn: () => x.request(
|
|
67
|
+
q("/scheduled-changes", {
|
|
68
|
+
collection: l,
|
|
69
|
+
item_id: r,
|
|
70
|
+
change_type: "field_update",
|
|
71
|
+
changes: { [a]: g },
|
|
72
|
+
// datetime-local is the viewer's local time; the API stores UTC.
|
|
73
|
+
scheduled_at: new Date(p).toISOString(),
|
|
74
|
+
layout: u ?? null
|
|
75
|
+
})
|
|
76
|
+
),
|
|
77
|
+
onSuccess: () => {
|
|
78
|
+
s(!1), N(""), v(""), C(""), f.success("Change scheduled");
|
|
79
|
+
},
|
|
80
|
+
onError: (e) => f.error(O(e, "Could not schedule the change"))
|
|
81
|
+
}), T = p !== "" && !Number.isNaN(new Date(p).getTime());
|
|
82
|
+
return /* @__PURE__ */ n(_, { open: m, onOpenChange: s, children: [
|
|
83
|
+
/* @__PURE__ */ t(E, { asChild: !0, children: /* @__PURE__ */ n(
|
|
84
|
+
"button",
|
|
85
|
+
{
|
|
86
|
+
type: "button",
|
|
87
|
+
"data-record-schedule-change": !0,
|
|
88
|
+
"data-tip": "Set a field to a new value at a time you choose",
|
|
89
|
+
className: "inline-flex items-center",
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ t(Q, {}),
|
|
92
|
+
"Schedule a change…"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
) }),
|
|
96
|
+
/* @__PURE__ */ n(P, { side: "left", align: "start", className: "w-80 p-4", "data-schedule-change-panel": !0, children: [
|
|
97
|
+
/* @__PURE__ */ t("p", { className: "mb-3 text-[13px] font-medium", children: "Schedule a field change" }),
|
|
98
|
+
/* @__PURE__ */ n("div", { className: "space-y-3", children: [
|
|
99
|
+
/* @__PURE__ */ n("div", { children: [
|
|
100
|
+
/* @__PURE__ */ t("span", { className: "mb-1 block text-[11px] font-medium text-muted-foreground", children: "Field" }),
|
|
101
|
+
/* @__PURE__ */ n(_, { open: i, onOpenChange: o, children: [
|
|
102
|
+
/* @__PURE__ */ t(E, { asChild: !0, children: /* @__PURE__ */ n(
|
|
103
|
+
w,
|
|
104
|
+
{
|
|
105
|
+
type: "button",
|
|
106
|
+
variant: "outline",
|
|
107
|
+
role: "combobox",
|
|
108
|
+
"aria-expanded": i,
|
|
109
|
+
"aria-label": "Field",
|
|
110
|
+
className: "h-8 w-full justify-between text-[12px] font-normal",
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: (b == null ? void 0 : b.label) ?? "Select a field…" }),
|
|
113
|
+
/* @__PURE__ */ t(R, { className: "ml-1 h-3 w-3 shrink-0 opacity-50" })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
) }),
|
|
117
|
+
/* @__PURE__ */ t(P, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", children: /* @__PURE__ */ n(A, { children: [
|
|
118
|
+
/* @__PURE__ */ t(H, { placeholder: "Search fields…", className: "h-8 text-[12px]" }),
|
|
119
|
+
/* @__PURE__ */ n(U, { children: [
|
|
120
|
+
/* @__PURE__ */ t(G, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No field matches" }),
|
|
121
|
+
k.map((e) => /* @__PURE__ */ n(
|
|
122
|
+
J,
|
|
123
|
+
{
|
|
124
|
+
value: `${e.label} ${e.field}`,
|
|
125
|
+
onSelect: () => {
|
|
126
|
+
N(e.field), o(!1);
|
|
127
|
+
},
|
|
128
|
+
className: "text-[12px]",
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ t(
|
|
131
|
+
B,
|
|
132
|
+
{
|
|
133
|
+
className: z(
|
|
134
|
+
"mr-2 h-3.5 w-3.5",
|
|
135
|
+
a === e.field ? "opacity-100" : "opacity-0"
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: e.label }),
|
|
140
|
+
/* @__PURE__ */ t("span", { className: "ml-auto pl-2 text-[11px] text-muted-foreground", children: e.field })
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
e.field
|
|
144
|
+
))
|
|
145
|
+
] })
|
|
146
|
+
] }) })
|
|
147
|
+
] })
|
|
148
|
+
] }),
|
|
149
|
+
/* @__PURE__ */ n("div", { children: [
|
|
150
|
+
/* @__PURE__ */ t(
|
|
151
|
+
"label",
|
|
152
|
+
{
|
|
153
|
+
htmlFor: `${h}-value`,
|
|
154
|
+
className: "mb-1 block text-[11px] font-medium text-muted-foreground",
|
|
155
|
+
children: "New value"
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ t(
|
|
159
|
+
S,
|
|
160
|
+
{
|
|
161
|
+
id: `${h}-value`,
|
|
162
|
+
value: g,
|
|
163
|
+
onChange: (e) => v(e.target.value),
|
|
164
|
+
className: "h-8 text-[12px]"
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
] }),
|
|
168
|
+
/* @__PURE__ */ n("div", { children: [
|
|
169
|
+
/* @__PURE__ */ t(
|
|
170
|
+
"label",
|
|
171
|
+
{
|
|
172
|
+
htmlFor: `${h}-at`,
|
|
173
|
+
className: "mb-1 block text-[11px] font-medium text-muted-foreground",
|
|
174
|
+
children: "When"
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ t(
|
|
178
|
+
S,
|
|
179
|
+
{
|
|
180
|
+
id: `${h}-at`,
|
|
181
|
+
type: "datetime-local",
|
|
182
|
+
value: p,
|
|
183
|
+
onChange: (e) => C(e.target.value),
|
|
184
|
+
className: "h-8 text-[12px]"
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }),
|
|
188
|
+
/* @__PURE__ */ t(
|
|
189
|
+
w,
|
|
190
|
+
{
|
|
191
|
+
type: "button",
|
|
192
|
+
size: "sm",
|
|
193
|
+
className: "h-8 w-full bg-nvr-cyan text-[12px] text-white hover:bg-nvr-cyan/90",
|
|
194
|
+
disabled: !a || !g || !T || y.isPending,
|
|
195
|
+
onClick: () => y.mutate(),
|
|
196
|
+
children: y.isPending ? "Scheduling…" : "Schedule change"
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] })
|
|
200
|
+
] })
|
|
201
|
+
] });
|
|
202
|
+
}
|
|
203
|
+
export {
|
|
204
|
+
ce as PickerExclusionToggle,
|
|
205
|
+
de as ScheduleChangeButton
|
|
206
|
+
};
|
|
@@ -1,51 +1,56 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Check as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { Check as N } from "lucide-react";
|
|
3
|
+
import { cn as c } from "../../lib/utils.js";
|
|
4
|
+
import { useDesignWrap as R } from "../layout-editor/DesignNode.js";
|
|
5
|
+
import { useLayoutDesign as C } from "../layout-editor/design-context.js";
|
|
6
|
+
const g = 10, W = 2, p = 12;
|
|
7
|
+
function D(t, n, e, r) {
|
|
6
8
|
return t === n ? "active" : r != null && r.has(t) ? "error" : e.has(t) ? "done" : "inactive";
|
|
7
9
|
}
|
|
8
|
-
function
|
|
10
|
+
function P(t, n) {
|
|
9
11
|
if (t && n) return "none";
|
|
10
|
-
const e =
|
|
12
|
+
const e = g;
|
|
11
13
|
return t ? `polygon(0 0, calc(100% - ${e}px) 0, 100% 50%, calc(100% - ${e}px) 100%, 0 100%)` : n ? `polygon(0 0, 100% 0, 100% 100%, 0 100%, ${e}px 50%)` : `polygon(0 0, calc(100% - ${e}px) 0, 100% 50%, calc(100% - ${e}px) 100%, 0 100%, ${e}px 50%)`;
|
|
12
14
|
}
|
|
13
|
-
function
|
|
15
|
+
function j(t, n) {
|
|
14
16
|
if (t && n) return "none";
|
|
15
|
-
const e =
|
|
17
|
+
const e = g, r = W;
|
|
16
18
|
return n ? `polygon(0 0, 100% 0, 100% 100%, 0 100%, ${e}px 50%)` : t ? `polygon(0 0, calc(100% - ${e + r}px) 0, calc(100% - ${r}px) 50%, calc(100% - ${e + r}px) 100%, 0 100%)` : `polygon(0 0, calc(100% - ${e + r}px) 0, calc(100% - ${r}px) 50%, calc(100% - ${e + r}px) 100%, 0 100%, ${e}px 50%)`;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function E(t, n) {
|
|
19
21
|
if (t && n) return `${p}px ${p}px 0 0`;
|
|
20
22
|
if (t) return `${p}px 0 0 0`;
|
|
21
23
|
if (n) return `0 ${p}px 0 0`;
|
|
22
24
|
}
|
|
23
|
-
function
|
|
25
|
+
function H({
|
|
24
26
|
steps: t,
|
|
25
27
|
active: n,
|
|
26
28
|
completed: e,
|
|
27
29
|
errorSteps: r,
|
|
28
30
|
dirtySteps: f,
|
|
29
|
-
onStepClick:
|
|
30
|
-
embedded:
|
|
31
|
+
onStepClick: y,
|
|
32
|
+
embedded: $ = !1,
|
|
33
|
+
hiddenSteps: i
|
|
31
34
|
}) {
|
|
32
|
-
|
|
35
|
+
const w = R(), _ = C() != null;
|
|
36
|
+
return /* @__PURE__ */ o(
|
|
33
37
|
"div",
|
|
34
38
|
{
|
|
35
|
-
className:
|
|
39
|
+
className: c(
|
|
36
40
|
"relative flex h-9",
|
|
37
|
-
|
|
41
|
+
$ ? "border-b border-slate-200 dark:border-border" : "rounded-lg shadow-[0_0_0_1px_#e2e8f0,0_1px_3px_-1px_rgba(0,0,0,0.06)] dark:shadow-none dark:border dark:border-border"
|
|
38
42
|
),
|
|
39
|
-
children: t.map((
|
|
40
|
-
const
|
|
41
|
-
return /* @__PURE__ */ v(
|
|
43
|
+
children: t.map((a, d) => {
|
|
44
|
+
const s = d === 0, u = d === t.length - 1, b = D(a.key, n, e, r), l = b === "active", v = b === "done", x = b === "error", h = E(s, u), k = /* @__PURE__ */ m(
|
|
42
45
|
"div",
|
|
43
46
|
{
|
|
44
|
-
|
|
47
|
+
"data-design-tab": _ ? "" : void 0,
|
|
48
|
+
"data-design-hidden": i != null && i.has(a.key) ? "" : void 0,
|
|
49
|
+
className: c("relative min-w-0 flex-1", (i == null ? void 0 : i.has(a.key)) && "opacity-40"),
|
|
45
50
|
style: {
|
|
46
|
-
clipPath:
|
|
47
|
-
zIndex: t.length -
|
|
48
|
-
marginLeft:
|
|
51
|
+
clipPath: P(s, u),
|
|
52
|
+
zIndex: t.length - d,
|
|
53
|
+
marginLeft: s ? 0 : -g,
|
|
49
54
|
// overflow + translateZ: promotes wrapper to compositing layer so
|
|
50
55
|
// Chrome properly clips clip-path'd children to border-radius
|
|
51
56
|
overflow: "hidden",
|
|
@@ -53,52 +58,52 @@ function E({
|
|
|
53
58
|
borderRadius: h
|
|
54
59
|
},
|
|
55
60
|
children: [
|
|
56
|
-
!
|
|
61
|
+
!u && /* @__PURE__ */ o(
|
|
57
62
|
"div",
|
|
58
63
|
{
|
|
59
64
|
className: "pointer-events-none absolute inset-0 bg-[#cbd5e1] dark:bg-[#334155]",
|
|
60
65
|
style: { borderRadius: h }
|
|
61
66
|
}
|
|
62
67
|
),
|
|
63
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ m(
|
|
64
69
|
"button",
|
|
65
70
|
{
|
|
66
71
|
type: "button",
|
|
67
|
-
onClick: () =>
|
|
72
|
+
onClick: () => y(a.key),
|
|
68
73
|
style: {
|
|
69
|
-
clipPath:
|
|
70
|
-
paddingLeft:
|
|
74
|
+
clipPath: j(s, u),
|
|
75
|
+
paddingLeft: s ? 12 : 12 + g,
|
|
71
76
|
paddingRight: 12,
|
|
72
77
|
borderRadius: h
|
|
73
78
|
},
|
|
74
|
-
className:
|
|
79
|
+
className: c(
|
|
75
80
|
"group absolute inset-0 flex items-center gap-2 py-0 text-left transition-colors duration-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan",
|
|
76
|
-
|
|
81
|
+
l ? "bg-[#172940] dark:bg-nvr-cyan/[0.1]" : x ? "bg-[#fef2f2] hover:bg-red-100/60 dark:bg-red-500/[0.05] dark:hover:bg-red-500/[0.08]" : "bg-[#f1f5f9] hover:bg-slate-200/70 dark:bg-[#1e293b] dark:hover:bg-white/[0.04]"
|
|
77
82
|
),
|
|
78
83
|
children: [
|
|
79
|
-
|
|
80
|
-
/* @__PURE__ */
|
|
84
|
+
l && /* @__PURE__ */ o("span", { className: "pointer-events-none absolute inset-x-0 top-0 h-[2px] bg-nvr-cyan" }),
|
|
85
|
+
/* @__PURE__ */ o(
|
|
81
86
|
"span",
|
|
82
87
|
{
|
|
83
|
-
className:
|
|
88
|
+
className: c(
|
|
84
89
|
"flex h-[15px] w-[15px] shrink-0 items-center justify-center rounded-full text-[9px] font-bold leading-none transition-colors duration-100",
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
l && "nvr-state-pulse",
|
|
91
|
+
l || v ? "bg-nvr-cyan text-[#172940]" : x ? "bg-red-500 text-white" : "bg-slate-300 text-slate-500 dark:bg-white/[0.12] dark:text-slate-400"
|
|
87
92
|
),
|
|
88
|
-
children:
|
|
93
|
+
children: v ? /* @__PURE__ */ o(N, { className: "nvr-pop h-[7px] w-[7px]", strokeWidth: 3 }) : x ? "!" : d + 1
|
|
89
94
|
}
|
|
90
95
|
),
|
|
91
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ o(
|
|
92
97
|
"span",
|
|
93
98
|
{
|
|
94
|
-
className:
|
|
99
|
+
className: c(
|
|
95
100
|
"min-w-0 truncate text-[11px] font-semibold leading-none transition-colors duration-100",
|
|
96
|
-
|
|
101
|
+
l ? "text-white dark:text-nvr-cyan" : v ? "text-slate-400 dark:text-slate-500" : x ? "text-red-600 dark:text-red-400" : "text-slate-400 group-hover:text-slate-600 dark:text-slate-500 dark:group-hover:text-slate-300"
|
|
97
102
|
),
|
|
98
|
-
children:
|
|
103
|
+
children: a.label
|
|
99
104
|
}
|
|
100
105
|
),
|
|
101
|
-
(f == null ? void 0 : f.has(
|
|
106
|
+
(f == null ? void 0 : f.has(a.key)) && !l && /* @__PURE__ */ o(
|
|
102
107
|
"span",
|
|
103
108
|
{
|
|
104
109
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400",
|
|
@@ -110,12 +115,13 @@ function E({
|
|
|
110
115
|
)
|
|
111
116
|
]
|
|
112
117
|
},
|
|
113
|
-
|
|
118
|
+
a.key
|
|
114
119
|
);
|
|
120
|
+
return a.key.startsWith("__") ? k : w({ kind: "group", key: a.key }, k, { asChild: !0, pass: !0 });
|
|
115
121
|
})
|
|
116
122
|
}
|
|
117
123
|
);
|
|
118
124
|
}
|
|
119
125
|
export {
|
|
120
|
-
|
|
126
|
+
H as StepsBar
|
|
121
127
|
};
|
|
@@ -485,7 +485,7 @@ function Re({
|
|
|
485
485
|
},
|
|
486
486
|
className: q(
|
|
487
487
|
"flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
|
|
488
|
-
g === m.field ? "text-emerald-500" : "text-slate-
|
|
488
|
+
g === m.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
|
|
489
489
|
),
|
|
490
490
|
children: g === m.field ? /* @__PURE__ */ n(ie, { className: "h-3 w-3" }) : /* @__PURE__ */ n(se, { className: "h-3 w-3" })
|
|
491
491
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState as l, useRef as n, useEffect as a, useCallback as f } from "react";
|
|
2
|
+
const m = 2500;
|
|
3
|
+
function E(c) {
|
|
4
|
+
const [i, r] = l(!1), e = n(0), t = n(null);
|
|
5
|
+
a(
|
|
6
|
+
() => () => {
|
|
7
|
+
e.current++, t.current && clearTimeout(t.current);
|
|
8
|
+
},
|
|
9
|
+
[]
|
|
10
|
+
);
|
|
11
|
+
const o = f((s) => {
|
|
12
|
+
const u = ++e.current;
|
|
13
|
+
t.current && clearTimeout(t.current), r(!0), Promise.resolve(s).catch(() => {
|
|
14
|
+
}).then(() => {
|
|
15
|
+
u === e.current && (t.current = setTimeout(() => {
|
|
16
|
+
u === e.current && r(!1);
|
|
17
|
+
}, m));
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
return { layoutEditing: c || i, settle: o };
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
m as LAYOUT_PUSH_SETTLE_MS,
|
|
24
|
+
E as useLayoutEditingQuiet
|
|
25
|
+
};
|