@burojs/ui-shadcn 0.3.0 → 0.5.0
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/README.md +26 -7
- package/dist/bulk-summary-CwSd6Yjb.cjs +108 -0
- package/dist/bulk-summary-CwSd6Yjb.cjs.map +1 -0
- package/dist/bulk-summary-GxMDP4bw.js +108 -0
- package/dist/bulk-summary-GxMDP4bw.js.map +1 -0
- package/dist/button-BxnnE28H.cjs +55 -0
- package/dist/button-BxnnE28H.cjs.map +1 -0
- package/dist/button-MWVeZaqj.js +44 -0
- package/dist/button-MWVeZaqj.js.map +1 -0
- package/dist/candidates-gate-CX2PBu6l.js +63 -0
- package/dist/candidates-gate-CX2PBu6l.js.map +1 -0
- package/dist/candidates-gate-DiFI52r7.cjs +70 -0
- package/dist/candidates-gate-DiFI52r7.cjs.map +1 -0
- package/dist/candidates-relation-picker-CBsVcnPR.js +82 -0
- package/dist/candidates-relation-picker-CBsVcnPR.js.map +1 -0
- package/dist/candidates-relation-picker-Dd_GVLlu.cjs +84 -0
- package/dist/candidates-relation-picker-Dd_GVLlu.cjs.map +1 -0
- package/dist/check-confirm-dialog-BRByTFpg.cjs +1534 -0
- package/dist/check-confirm-dialog-BRByTFpg.cjs.map +1 -0
- package/dist/check-confirm-dialog-CkaVTPT9.js +1232 -0
- package/dist/check-confirm-dialog-CkaVTPT9.js.map +1 -0
- package/dist/dialog-B_rt9S1c.js +63 -0
- package/dist/dialog-B_rt9S1c.js.map +1 -0
- package/dist/dialog-DRNUq9EA.cjs +112 -0
- package/dist/dialog-DRNUq9EA.cjs.map +1 -0
- package/dist/filter-builder-B3mZFL-K.cjs +1761 -0
- package/dist/filter-builder-B3mZFL-K.cjs.map +1 -0
- package/dist/filter-builder-DOnaXNfP.js +1605 -0
- package/dist/filter-builder-DOnaXNfP.js.map +1 -0
- package/dist/flow-runtime-B6zOHYqI.cjs +255 -0
- package/dist/flow-runtime-B6zOHYqI.cjs.map +1 -0
- package/dist/flow-runtime-D8h99FSg.js +252 -0
- package/dist/flow-runtime-D8h99FSg.js.map +1 -0
- package/dist/flow-screen-CX05b3G9.cjs +705 -0
- package/dist/flow-screen-CX05b3G9.cjs.map +1 -0
- package/dist/flow-screen-CmbARSqg.js +701 -0
- package/dist/flow-screen-CmbARSqg.js.map +1 -0
- package/dist/index.cjs +6453 -17494
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3754 -3621
- package/dist/index.d.ts +3754 -3621
- package/dist/index.js +6217 -17219
- package/dist/index.js.map +1 -1
- package/dist/inline-flow-host-B7U1OJUe.cjs +112 -0
- package/dist/inline-flow-host-B7U1OJUe.cjs.map +1 -0
- package/dist/inline-flow-host-C3H2UpSA.js +112 -0
- package/dist/inline-flow-host-C3H2UpSA.js.map +1 -0
- package/dist/input-BI0czGyI.cjs +23 -0
- package/dist/input-BI0czGyI.cjs.map +1 -0
- package/dist/input-CUPStzZO.js +17 -0
- package/dist/input-CUPStzZO.js.map +1 -0
- package/dist/label-66W1qbke.js +29 -0
- package/dist/label-66W1qbke.js.map +1 -0
- package/dist/label-w6JYf2cF.cjs +36 -0
- package/dist/label-w6JYf2cF.cjs.map +1 -0
- package/dist/layout/theme-storage-key.cjs +5 -10
- package/dist/layout/theme-storage-key.cjs.map +1 -1
- package/dist/layout/theme-storage-key.d.cts +2 -23
- package/dist/layout/theme-storage-key.d.ts +2 -23
- package/dist/layout/theme-storage-key.js +5 -2
- package/dist/layout/theme-storage-key.js.map +1 -1
- package/dist/lazy-relation-picker-dialog-2oxnA6IR.js +14 -0
- package/dist/lazy-relation-picker-dialog-2oxnA6IR.js.map +1 -0
- package/dist/lazy-relation-picker-dialog-BfAGKzUG.cjs +19 -0
- package/dist/lazy-relation-picker-dialog-BfAGKzUG.cjs.map +1 -0
- package/dist/markdown/index.cjs +424 -511
- package/dist/markdown/index.cjs.map +1 -1
- package/dist/markdown/index.d.cts +1072 -34
- package/dist/markdown/index.d.ts +1072 -34
- package/dist/markdown/index.js +411 -459
- package/dist/markdown/index.js.map +1 -1
- package/dist/page-flow-route-CQ7HsbBm.cjs +277 -0
- package/dist/page-flow-route-CQ7HsbBm.cjs.map +1 -0
- package/dist/page-flow-route-CyXSvXSE.js +277 -0
- package/dist/page-flow-route-CyXSvXSE.js.map +1 -0
- package/dist/peek-filter-CnqHwTMU.cjs +51 -0
- package/dist/peek-filter-CnqHwTMU.cjs.map +1 -0
- package/dist/peek-filter-ErLfO153.js +28 -0
- package/dist/peek-filter-ErLfO153.js.map +1 -0
- package/dist/place-node--GdsP688.js +7315 -0
- package/dist/place-node--GdsP688.js.map +1 -0
- package/dist/place-node-SIp4XYQH.cjs +7833 -0
- package/dist/place-node-SIp4XYQH.cjs.map +1 -0
- package/dist/related-list-cards-B6x9HQQp.js +42 -0
- package/dist/related-list-cards-B6x9HQQp.js.map +1 -0
- package/dist/related-list-cards-nxuODlIA.cjs +42 -0
- package/dist/related-list-cards-nxuODlIA.cjs.map +1 -0
- package/dist/related-list-timeline-BYJKEbmA.cjs +142 -0
- package/dist/related-list-timeline-BYJKEbmA.cjs.map +1 -0
- package/dist/related-list-timeline-DEdfd-rr.js +142 -0
- package/dist/related-list-timeline-DEdfd-rr.js.map +1 -0
- package/dist/related-rows-B4levHcR.js +186 -0
- package/dist/related-rows-B4levHcR.js.map +1 -0
- package/dist/related-rows-zh5f_4QR.cjs +209 -0
- package/dist/related-rows-zh5f_4QR.cjs.map +1 -0
- package/dist/relation-create-BOaUe12G.cjs +362 -0
- package/dist/relation-create-BOaUe12G.cjs.map +1 -0
- package/dist/relation-create-Bg-eEJLs.js +337 -0
- package/dist/relation-create-Bg-eEJLs.js.map +1 -0
- package/dist/relation-many-picker-B-NCEUgX.cjs +465 -0
- package/dist/relation-many-picker-B-NCEUgX.cjs.map +1 -0
- package/dist/relation-many-picker-gdAOD-qK.js +464 -0
- package/dist/relation-many-picker-gdAOD-qK.js.map +1 -0
- package/dist/relation-picker-BAY77ivO.js +462 -0
- package/dist/relation-picker-BAY77ivO.js.map +1 -0
- package/dist/relation-picker-Da_uhFvA.cjs +479 -0
- package/dist/relation-picker-Da_uhFvA.cjs.map +1 -0
- package/dist/relation-picker-dialog-M0pQaWlp.cjs +300 -0
- package/dist/relation-picker-dialog-M0pQaWlp.cjs.map +1 -0
- package/dist/relation-picker-dialog-hA9rYrZB.js +299 -0
- package/dist/relation-picker-dialog-hA9rYrZB.js.map +1 -0
- package/dist/resource-page-router-OSQyRA5b.cjs +1779 -0
- package/dist/resource-page-router-OSQyRA5b.cjs.map +1 -0
- package/dist/resource-page-router-T4vS5gbJ.js +1582 -0
- package/dist/resource-page-router-T4vS5gbJ.js.map +1 -0
- package/dist/rich-text-DFerywgz.js +457 -0
- package/dist/rich-text-DFerywgz.js.map +1 -0
- package/dist/rich-text-vTyVjDoa.cjs +460 -0
- package/dist/rich-text-vTyVjDoa.cjs.map +1 -0
- package/dist/search-access-B7G5oR8n.cjs +812 -0
- package/dist/search-access-B7G5oR8n.cjs.map +1 -0
- package/dist/search-access-CURsWn-U.js +669 -0
- package/dist/search-access-CURsWn-U.js.map +1 -0
- package/dist/shell-BPlk8hEa.js +205 -0
- package/dist/shell-BPlk8hEa.js.map +1 -0
- package/dist/shell-DxhlsPwm.cjs +271 -0
- package/dist/shell-DxhlsPwm.cjs.map +1 -0
- package/dist/skeleton-U2noefj5.js +13 -0
- package/dist/skeleton-U2noefj5.js.map +1 -0
- package/dist/skeleton-_1gP7wan.cjs +18 -0
- package/dist/skeleton-_1gP7wan.cjs.map +1 -0
- package/dist/styles.css +255 -17
- package/dist/theme/theme-css.cjs +95 -96
- package/dist/theme/theme-css.cjs.map +1 -1
- package/dist/theme/theme-css.d.cts +10 -8
- package/dist/theme/theme-css.d.ts +10 -8
- package/dist/theme/theme-css.js +94 -94
- package/dist/theme/theme-css.js.map +1 -1
- package/dist/theme/theme-storage.cjs +34 -39
- package/dist/theme/theme-storage.cjs.map +1 -1
- package/dist/theme/theme-storage.d.cts +3 -1
- package/dist/theme/theme-storage.d.ts +3 -1
- package/dist/theme/theme-storage.js +33 -37
- package/dist/theme/theme-storage.js.map +1 -1
- package/dist/theme-storage-key-pYlp4aDS.d.cts +31 -0
- package/dist/theme-storage-key-pYlp4aDS.d.ts +31 -0
- package/dist/toaster-C7CiYA4Z.cjs +248 -0
- package/dist/toaster-C7CiYA4Z.cjs.map +1 -0
- package/dist/toaster-CfCRLgR-.js +164 -0
- package/dist/toaster-CfCRLgR-.js.map +1 -0
- package/dist/use-dialog-filter-state-BBCC0OEK.cjs +92 -0
- package/dist/use-dialog-filter-state-BBCC0OEK.cjs.map +1 -0
- package/dist/use-dialog-filter-state-BDcgS5Oz.js +87 -0
- package/dist/use-dialog-filter-state-BDcgS5Oz.js.map +1 -0
- package/dist/use-theme-DFlpXils.cjs +257 -0
- package/dist/use-theme-DFlpXils.cjs.map +1 -0
- package/dist/use-theme-dnE3Od3I.js +175 -0
- package/dist/use-theme-dnE3Od3I.js.map +1 -0
- package/package.json +18 -17
- package/dist/chunk-ABUQPOOE.js +0 -11
- package/dist/chunk-ABUQPOOE.js.map +0 -1
- package/dist/chunk-DBGGWBFG.cjs +0 -199
- package/dist/chunk-DBGGWBFG.cjs.map +0 -1
- package/dist/chunk-FMX4GLCQ.js +0 -6
- package/dist/chunk-FMX4GLCQ.js.map +0 -1
- package/dist/chunk-UC57Z243.js +0 -143
- package/dist/chunk-UC57Z243.js.map +0 -1
- package/dist/chunk-UPGPO75B.js +0 -164
- package/dist/chunk-UPGPO75B.js.map +0 -1
- package/dist/chunk-VXJAXJ3U.cjs +0 -8
- package/dist/chunk-VXJAXJ3U.cjs.map +0 -1
- package/dist/chunk-W7AEYE7A.cjs +0 -13
- package/dist/chunk-W7AEYE7A.cjs.map +0 -1
- package/dist/chunk-YF5IW525.cjs +0 -155
- package/dist/chunk-YF5IW525.cjs.map +0 -1
- package/dist/rich-text-6V7WZ3WV.cjs +0 -518
- package/dist/rich-text-6V7WZ3WV.cjs.map +0 -1
- package/dist/rich-text-N2FZEJJV.js +0 -491
- package/dist/rich-text-N2FZEJJV.js.map +0 -1
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { l as cn } from "./use-theme-dnE3Od3I.js";
|
|
2
|
+
import { d as useLinkComponent, f as Popover, g as PopoverTrigger, h as PopoverContent } from "./toaster-CfCRLgR-.js";
|
|
3
|
+
import { t as Button } from "./button-MWVeZaqj.js";
|
|
4
|
+
import { S as CommandList, b as CommandInput, f as useRowTitle, g as Command, n as narrowSearchDecl, t as namesHiddenField, v as CommandEmpty, x as CommandItem } from "./search-access-CURsWn-U.js";
|
|
5
|
+
import { t as Skeleton } from "./skeleton-U2noefj5.js";
|
|
6
|
+
import { t as LazyRelationPickerDialog } from "./lazy-relation-picker-dialog-2oxnA6IR.js";
|
|
7
|
+
import { n as useSelectCreate, r as RelationViewButton, t as RelationCreateButton } from "./relation-create-Bg-eEJLs.js";
|
|
8
|
+
import { composeListFilter, normalizeFixedFilters, relationOpenOf, resolveResourceLabel, resourceKey } from "@burojs/core";
|
|
9
|
+
import { useApp, useI18nCaps, useList, useListAccess, useOptionalT, useRelatedRecord } from "@burojs/react";
|
|
10
|
+
import { IconCheck, IconChevronDown, IconLoader2 } from "@tabler/icons-react";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { Suspense, lazy } from "react";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
//#region src/fields/lazy-candidates-picker.tsx
|
|
15
|
+
const CandidatesRelationPicker = lazy(() => import("./candidates-relation-picker-CBsVcnPR.js").then((module) => ({ default: module.CandidatesRelationPicker })));
|
|
16
|
+
function LazyCandidatesRelationPicker(props) {
|
|
17
|
+
return jsx(Suspense, {
|
|
18
|
+
fallback: jsx(Skeleton, {
|
|
19
|
+
"data-buro-skeleton": "",
|
|
20
|
+
"data-testid": "relation-candidates-loading",
|
|
21
|
+
className: "h-9 w-full"
|
|
22
|
+
}),
|
|
23
|
+
children: jsx(CandidatesRelationPicker, { ...props })
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/fields/relation-picker.tsx
|
|
28
|
+
const DEBOUNCE_MS = 250;
|
|
29
|
+
function RelationPicker({ to, value, onChange, by, searchField, pageSize = 10, clearable = true, placeholder, name, id, testid, fixedFilters, createSeeds, candidatesGate, rowFits, fieldName, open: openMode, disabled, required, className, ariaInvalid, ariaDescribedBy, ariaErrorMessage }) {
|
|
30
|
+
const app = useApp();
|
|
31
|
+
const caps = useI18nCaps();
|
|
32
|
+
const t = useOptionalT();
|
|
33
|
+
const targetDef = app.registry.get(to);
|
|
34
|
+
const rowTitle = useRowTitle(to, targetDef?.displayField);
|
|
35
|
+
const targetLabel = resolveResourceLabel(caps, to, "single", targetDef).toLowerCase();
|
|
36
|
+
const RouterLink = useLinkComponent();
|
|
37
|
+
const tid = testid ?? `relation-picker:${to}`;
|
|
38
|
+
const childPrefix = `relation-picker:${to}`;
|
|
39
|
+
const effectiveSearchField = searchField ?? targetDef?.displayField ?? "name";
|
|
40
|
+
const triggerRef = React.useRef(null);
|
|
41
|
+
const focusTrigger = React.useCallback(() => triggerRef.current?.focus(), []);
|
|
42
|
+
const [open, setOpen] = React.useState(false);
|
|
43
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
44
|
+
const gated = candidatesGate !== void 0;
|
|
45
|
+
const [dialogMounted, setDialogMounted] = React.useState(false);
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
if (gated) setDialogOpen(false);
|
|
48
|
+
}, [gated]);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (dialogOpen) setDialogMounted(true);
|
|
51
|
+
}, [dialogOpen]);
|
|
52
|
+
const [search, setSearch] = React.useState("");
|
|
53
|
+
const [debouncedSearch, setDebouncedSearch] = React.useState("");
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
const handle = setTimeout(() => setDebouncedSearch(search), DEBOUNCE_MS);
|
|
56
|
+
return () => clearTimeout(handle);
|
|
57
|
+
}, [search]);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
if (!open) {
|
|
60
|
+
setSearch("");
|
|
61
|
+
setDebouncedSearch("");
|
|
62
|
+
}
|
|
63
|
+
}, [open]);
|
|
64
|
+
const { record: selectedRecord, isLoading: selectedLoading } = useRelatedRecord(to, value, by === void 0 ? void 0 : { by });
|
|
65
|
+
const targetIdField = (targetDef?.data)?.idField;
|
|
66
|
+
const valueField = by ?? (typeof targetIdField === "string" && targetIdField.length > 0 ? targetIdField : "id");
|
|
67
|
+
const access = useListAccess(to);
|
|
68
|
+
const accessReady = access.status === "ready";
|
|
69
|
+
const searchDecl = React.useMemo(() => narrowSearchDecl(targetDef?.views?.list?.search ?? { fields: [effectiveSearchField] }, (name) => access.fieldVisible(name)), [
|
|
70
|
+
targetDef,
|
|
71
|
+
effectiveSearchField,
|
|
72
|
+
access
|
|
73
|
+
]);
|
|
74
|
+
const filter = React.useMemo(() => composeListFilter({
|
|
75
|
+
fixed: normalizeFixedFilters(fixedFilters),
|
|
76
|
+
search: debouncedSearch,
|
|
77
|
+
searchDecl,
|
|
78
|
+
searchContext: {
|
|
79
|
+
resource: to,
|
|
80
|
+
def: targetDef
|
|
81
|
+
}
|
|
82
|
+
}), [
|
|
83
|
+
fixedFilters,
|
|
84
|
+
debouncedSearch,
|
|
85
|
+
searchDecl,
|
|
86
|
+
to,
|
|
87
|
+
targetDef
|
|
88
|
+
]);
|
|
89
|
+
const blocked = !accessReady || candidatesGate !== void 0 || namesHiddenField(filter, (name) => access.fieldVisible(name));
|
|
90
|
+
const idField = typeof targetIdField === "string" && targetIdField.length > 0 ? targetIdField : "id";
|
|
91
|
+
const { create, reader: createReader } = useSelectCreate({
|
|
92
|
+
to,
|
|
93
|
+
by,
|
|
94
|
+
valueField,
|
|
95
|
+
idField,
|
|
96
|
+
fixedFilters,
|
|
97
|
+
held: gated,
|
|
98
|
+
searchDecl,
|
|
99
|
+
searchContext: {
|
|
100
|
+
resource: to,
|
|
101
|
+
def: targetDef
|
|
102
|
+
},
|
|
103
|
+
onValue: (picked) => {
|
|
104
|
+
onChange(picked);
|
|
105
|
+
setDialogOpen(false);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const listQuery = useList(to, {
|
|
109
|
+
...filter ? { filter } : {},
|
|
110
|
+
pagination: {
|
|
111
|
+
kind: "offset",
|
|
112
|
+
page: 1,
|
|
113
|
+
pageSize
|
|
114
|
+
},
|
|
115
|
+
...fixedFilters && fixedFilters.length > 0 ? { providerOptionsOverride: { ignoreScope: true } } : {},
|
|
116
|
+
enabled: open && targetDef != null && !blocked
|
|
117
|
+
});
|
|
118
|
+
const rows = listQuery.data?.data ?? [];
|
|
119
|
+
const triggerLabel = renderTriggerLabel({
|
|
120
|
+
rowTitle,
|
|
121
|
+
optionRows: rows,
|
|
122
|
+
valueField,
|
|
123
|
+
value,
|
|
124
|
+
selectedRecord,
|
|
125
|
+
selectedLoading,
|
|
126
|
+
targetDef,
|
|
127
|
+
targetLabel,
|
|
128
|
+
placeholder,
|
|
129
|
+
t
|
|
130
|
+
});
|
|
131
|
+
if (!targetDef) {
|
|
132
|
+
if (process.env.NODE_ENV !== "production") console.warn(`[RelationPicker] target resource '${to}' not registered — picker disabled`);
|
|
133
|
+
return jsxs(Button, {
|
|
134
|
+
type: "button",
|
|
135
|
+
variant: "outline",
|
|
136
|
+
disabled: true,
|
|
137
|
+
"data-testid": `${childPrefix}:unregistered`,
|
|
138
|
+
className: cn("w-full justify-between font-normal", className),
|
|
139
|
+
name,
|
|
140
|
+
id,
|
|
141
|
+
"aria-required": required,
|
|
142
|
+
children: [jsx("span", {
|
|
143
|
+
className: "truncate text-muted-foreground",
|
|
144
|
+
children: value == null || value === "" ? placeholder ?? t("field.select", { defaultValue: "Select…" }) : String(value)
|
|
145
|
+
}), jsx(IconChevronDown, {
|
|
146
|
+
className: "h-4 w-4 opacity-50",
|
|
147
|
+
"aria-hidden": true
|
|
148
|
+
})]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
if (candidatesGate?.kind === "pending") return jsxs(Button, {
|
|
152
|
+
type: "button",
|
|
153
|
+
variant: "outline",
|
|
154
|
+
disabled: true,
|
|
155
|
+
"data-testid": tid,
|
|
156
|
+
"data-buro-candidates": "pending",
|
|
157
|
+
className: cn("w-full justify-between font-normal", className),
|
|
158
|
+
name,
|
|
159
|
+
id,
|
|
160
|
+
"aria-required": required,
|
|
161
|
+
"aria-busy": "true",
|
|
162
|
+
children: [jsx("span", {
|
|
163
|
+
className: "truncate text-muted-foreground",
|
|
164
|
+
children: triggerLabel
|
|
165
|
+
}), jsx(IconLoader2, {
|
|
166
|
+
className: "h-4 w-4 shrink-0 animate-spin opacity-50",
|
|
167
|
+
"aria-hidden": true
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
if (candidatesGate?.kind === "forbidden") return jsxs("div", {
|
|
171
|
+
className: "flex flex-col gap-1",
|
|
172
|
+
children: [jsxs(Button, {
|
|
173
|
+
type: "button",
|
|
174
|
+
variant: "outline",
|
|
175
|
+
disabled: true,
|
|
176
|
+
"data-testid": tid,
|
|
177
|
+
"data-buro-candidates": "forbidden",
|
|
178
|
+
className: cn("w-full justify-between font-normal", className),
|
|
179
|
+
name,
|
|
180
|
+
id,
|
|
181
|
+
"aria-required": required,
|
|
182
|
+
"aria-describedby": candidatesGate.testId,
|
|
183
|
+
children: [jsx("span", {
|
|
184
|
+
className: cn("truncate text-left", value == null && "text-muted-foreground"),
|
|
185
|
+
children: triggerLabel
|
|
186
|
+
}), jsx(IconChevronDown, {
|
|
187
|
+
className: "h-4 w-4 shrink-0 opacity-50",
|
|
188
|
+
"aria-hidden": true
|
|
189
|
+
})]
|
|
190
|
+
}), jsx("p", {
|
|
191
|
+
id: candidatesGate.testId,
|
|
192
|
+
"data-testid": candidatesGate.testId,
|
|
193
|
+
className: "text-xs text-muted-foreground",
|
|
194
|
+
children: candidatesGate.message
|
|
195
|
+
})]
|
|
196
|
+
});
|
|
197
|
+
const targetBasePath = targetDef.basePath ?? `/${to}`;
|
|
198
|
+
const outside = rowFits !== void 0 && value != null && value !== "" && selectedRecord != null && rowFits(selectedRecord) === false;
|
|
199
|
+
const isLoading = listQuery.isLoading || listQuery.isFetching;
|
|
200
|
+
const error = listQuery.isError ? listQuery.error : null;
|
|
201
|
+
function handleSelect(rowId) {
|
|
202
|
+
onChange(rowId);
|
|
203
|
+
setOpen(false);
|
|
204
|
+
}
|
|
205
|
+
function handleClear() {
|
|
206
|
+
onChange(null);
|
|
207
|
+
setOpen(false);
|
|
208
|
+
}
|
|
209
|
+
return jsxs(Popover, {
|
|
210
|
+
open,
|
|
211
|
+
onOpenChange: setOpen,
|
|
212
|
+
children: [
|
|
213
|
+
jsxs("div", {
|
|
214
|
+
className: "flex items-center gap-1",
|
|
215
|
+
children: [jsx(PopoverTrigger, {
|
|
216
|
+
asChild: true,
|
|
217
|
+
children: jsxs(Button, {
|
|
218
|
+
ref: triggerRef,
|
|
219
|
+
type: "button",
|
|
220
|
+
variant: "outline",
|
|
221
|
+
role: "combobox",
|
|
222
|
+
"aria-expanded": open,
|
|
223
|
+
"aria-haspopup": "listbox",
|
|
224
|
+
"aria-required": required,
|
|
225
|
+
"aria-invalid": ariaInvalid || void 0,
|
|
226
|
+
"aria-describedby": ariaDescribedBy,
|
|
227
|
+
...ariaErrorMessage ? { "aria-errormessage": ariaErrorMessage } : {},
|
|
228
|
+
disabled,
|
|
229
|
+
"data-testid": tid,
|
|
230
|
+
name,
|
|
231
|
+
id,
|
|
232
|
+
className: cn("w-full justify-between font-normal", className),
|
|
233
|
+
children: [jsx("span", {
|
|
234
|
+
className: cn("truncate text-left", value == null && "text-muted-foreground"),
|
|
235
|
+
children: triggerLabel
|
|
236
|
+
}), jsx(IconChevronDown, {
|
|
237
|
+
className: "h-4 w-4 shrink-0 opacity-50",
|
|
238
|
+
"aria-hidden": true
|
|
239
|
+
})]
|
|
240
|
+
})
|
|
241
|
+
}), !disabled && jsx(RelationViewButton, {
|
|
242
|
+
to,
|
|
243
|
+
value,
|
|
244
|
+
by,
|
|
245
|
+
ignoreScope: fixedFilters !== void 0 && fixedFilters.length > 0,
|
|
246
|
+
fieldName: fieldName ?? name ?? to,
|
|
247
|
+
beforeOpen: focusTrigger,
|
|
248
|
+
...openMode === void 0 ? {} : { open: openMode }
|
|
249
|
+
})]
|
|
250
|
+
}),
|
|
251
|
+
outside && jsx("p", {
|
|
252
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
253
|
+
"data-testid": `${childPrefix}:not-matching`,
|
|
254
|
+
children: t("relationPicker.notMatching", { defaultValue: "Does not match the current filter" })
|
|
255
|
+
}),
|
|
256
|
+
jsx(PopoverContent, {
|
|
257
|
+
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
258
|
+
align: "start",
|
|
259
|
+
children: candidatesGate?.kind === "empty" ? jsx("p", {
|
|
260
|
+
className: "px-3 py-6 text-center text-sm text-muted-foreground",
|
|
261
|
+
"data-testid": candidatesGate.testId,
|
|
262
|
+
children: candidatesGate.message
|
|
263
|
+
}) : jsxs(Command, {
|
|
264
|
+
shouldFilter: false,
|
|
265
|
+
children: [
|
|
266
|
+
searchDecl !== void 0 && jsx(CommandInput, {
|
|
267
|
+
value: search,
|
|
268
|
+
onValueChange: setSearch,
|
|
269
|
+
placeholder: t("toolbar.search", {
|
|
270
|
+
params: { name: targetLabel },
|
|
271
|
+
defaultValue: `Search ${targetLabel}…`
|
|
272
|
+
}),
|
|
273
|
+
"data-testid": `${childPrefix}:search`,
|
|
274
|
+
"aria-label": t("toolbar.search", {
|
|
275
|
+
params: { name: targetLabel },
|
|
276
|
+
defaultValue: `Search ${targetLabel}`
|
|
277
|
+
})
|
|
278
|
+
}),
|
|
279
|
+
jsxs(CommandList, {
|
|
280
|
+
"data-testid": `${childPrefix}:list`,
|
|
281
|
+
children: [
|
|
282
|
+
isLoading && jsxs("div", {
|
|
283
|
+
className: "flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",
|
|
284
|
+
"data-testid": `${childPrefix}:loading`,
|
|
285
|
+
children: [jsx(IconLoader2, {
|
|
286
|
+
className: "h-4 w-4 animate-spin",
|
|
287
|
+
"aria-hidden": true
|
|
288
|
+
}), jsx("span", { children: t("table.loading", { defaultValue: "Loading…" }) })]
|
|
289
|
+
}),
|
|
290
|
+
!isLoading && error && jsx("div", {
|
|
291
|
+
className: "px-3 py-6 text-center text-sm text-muted-foreground",
|
|
292
|
+
"data-testid": `${childPrefix}:error`,
|
|
293
|
+
title: error.message,
|
|
294
|
+
children: t("relation.failed", { defaultValue: "Failed to load options." })
|
|
295
|
+
}),
|
|
296
|
+
!isLoading && !error && rows.length === 0 && jsx(CommandEmpty, {
|
|
297
|
+
"data-testid": `${childPrefix}:empty`,
|
|
298
|
+
children: t("relation.noResults", { defaultValue: "No results." })
|
|
299
|
+
}),
|
|
300
|
+
!isLoading && !error && rows.map((row) => {
|
|
301
|
+
const rowId = row[valueField];
|
|
302
|
+
if (rowId === null || rowId === void 0 || rowId === "") return null;
|
|
303
|
+
const idStr = String(rowId);
|
|
304
|
+
const label = rowTitle(row);
|
|
305
|
+
const isSelected = value != null && String(value) === idStr;
|
|
306
|
+
return jsxs(CommandItem, {
|
|
307
|
+
value: `${label} ${idStr}`,
|
|
308
|
+
"data-testid": `${childPrefix}:option:${idStr}`,
|
|
309
|
+
onSelect: () => handleSelect(rowId),
|
|
310
|
+
children: [
|
|
311
|
+
jsx(IconCheck, {
|
|
312
|
+
className: cn("mr-2 h-4 w-4 shrink-0", isSelected ? "opacity-100" : "opacity-0"),
|
|
313
|
+
"aria-hidden": true
|
|
314
|
+
}),
|
|
315
|
+
jsx("span", {
|
|
316
|
+
className: "truncate",
|
|
317
|
+
children: label
|
|
318
|
+
}),
|
|
319
|
+
label === idStr ? null : jsxs("span", {
|
|
320
|
+
className: "ml-auto shrink-0 pl-2 text-xs text-muted-foreground",
|
|
321
|
+
children: ["#", idStr]
|
|
322
|
+
})
|
|
323
|
+
]
|
|
324
|
+
}, idStr);
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
}),
|
|
328
|
+
jsxs("div", {
|
|
329
|
+
className: "flex items-center justify-between gap-2 border-t px-3 py-2 text-sm",
|
|
330
|
+
children: [clearable && value != null && value !== "" ? jsx("button", {
|
|
331
|
+
type: "button",
|
|
332
|
+
onClick: handleClear,
|
|
333
|
+
"data-testid": `${childPrefix}:clear`,
|
|
334
|
+
className: "text-muted-foreground hover:text-foreground focus:outline-hidden focus-visible:underline",
|
|
335
|
+
children: t("relationPicker.clear", { defaultValue: "Clear" })
|
|
336
|
+
}) : jsx("span", { "aria-hidden": true }), jsxs("div", {
|
|
337
|
+
className: "flex items-center gap-3",
|
|
338
|
+
children: [
|
|
339
|
+
jsx("button", {
|
|
340
|
+
type: "button",
|
|
341
|
+
onClick: () => {
|
|
342
|
+
setOpen(false);
|
|
343
|
+
setDialogOpen(true);
|
|
344
|
+
},
|
|
345
|
+
"data-testid": `${childPrefix}:advanced`,
|
|
346
|
+
className: "text-foreground hover:underline focus:outline-hidden focus-visible:underline",
|
|
347
|
+
children: t("relationPicker.advancedSearch", { defaultValue: "Advanced search" })
|
|
348
|
+
}),
|
|
349
|
+
!disabled && jsx(RelationCreateButton, {
|
|
350
|
+
to,
|
|
351
|
+
fieldName: fieldName ?? name ?? to,
|
|
352
|
+
create,
|
|
353
|
+
seeds: createSeeds,
|
|
354
|
+
search,
|
|
355
|
+
beforeOpen: () => {
|
|
356
|
+
setOpen(false);
|
|
357
|
+
focusTrigger();
|
|
358
|
+
},
|
|
359
|
+
className: "text-foreground hover:underline focus:outline-hidden focus-visible:underline disabled:opacity-50"
|
|
360
|
+
}),
|
|
361
|
+
jsxs(RouterLink, {
|
|
362
|
+
href: targetBasePath,
|
|
363
|
+
"data-testid": `${childPrefix}:view-all`,
|
|
364
|
+
className: "text-muted-foreground hover:text-foreground hover:underline focus:outline-hidden focus-visible:underline",
|
|
365
|
+
children: [t("relationPicker.viewAll", { defaultValue: "Open list" }), " →"]
|
|
366
|
+
})
|
|
367
|
+
]
|
|
368
|
+
})]
|
|
369
|
+
})
|
|
370
|
+
]
|
|
371
|
+
})
|
|
372
|
+
}),
|
|
373
|
+
dialogMounted && !gated && jsx(LazyRelationPickerDialog, {
|
|
374
|
+
to,
|
|
375
|
+
open: dialogOpen,
|
|
376
|
+
onOpenChange: setDialogOpen,
|
|
377
|
+
onSelect: (rowId) => onChange(rowId),
|
|
378
|
+
valueField,
|
|
379
|
+
searchField,
|
|
380
|
+
fixedFilters,
|
|
381
|
+
...disabled ? {} : { create },
|
|
382
|
+
createSeeds,
|
|
383
|
+
fieldName: fieldName ?? name ?? to,
|
|
384
|
+
onBeforeCreate: focusTrigger
|
|
385
|
+
}),
|
|
386
|
+
createReader
|
|
387
|
+
]
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
function renderTriggerLabel({ value, selectedRecord, selectedLoading, targetLabel, placeholder, optionRows, valueField, t, rowTitle }) {
|
|
391
|
+
if (value == null || value === "") return placeholder ?? t("relation.select", {
|
|
392
|
+
params: { name: targetLabel },
|
|
393
|
+
defaultValue: `Select ${targetLabel}…`
|
|
394
|
+
});
|
|
395
|
+
if (selectedLoading) return t("table.loading", { defaultValue: "Loading…" });
|
|
396
|
+
if (selectedRecord) return rowTitle(selectedRecord);
|
|
397
|
+
const fromOptions = optionRows?.find((r) => String(r[valueField]) === String(value));
|
|
398
|
+
if (fromOptions) return rowTitle(fromOptions);
|
|
399
|
+
return String(value);
|
|
400
|
+
}
|
|
401
|
+
function RelationPickerInput(props) {
|
|
402
|
+
const { name, id, value, testid, field, required } = props;
|
|
403
|
+
const meta = field?.meta;
|
|
404
|
+
let to;
|
|
405
|
+
try {
|
|
406
|
+
to = meta?.to === void 0 ? void 0 : resourceKey(meta.to);
|
|
407
|
+
} catch {
|
|
408
|
+
to = void 0;
|
|
409
|
+
}
|
|
410
|
+
if (!to) {
|
|
411
|
+
if (process.env.NODE_ENV !== "production") console.warn(`[RelationPickerInput] no meta.to on field '${field?.name ?? name}' — relation picker disabled`);
|
|
412
|
+
return jsx(Button, {
|
|
413
|
+
type: "button",
|
|
414
|
+
variant: "outline",
|
|
415
|
+
disabled: true,
|
|
416
|
+
"data-testid": `${testid ?? `relation-picker:${name}`}:no-target`,
|
|
417
|
+
className: "w-full justify-between font-normal",
|
|
418
|
+
name,
|
|
419
|
+
id,
|
|
420
|
+
"aria-required": required,
|
|
421
|
+
children: jsx("span", {
|
|
422
|
+
className: "truncate text-muted-foreground",
|
|
423
|
+
children: value == null || value === "" ? "—" : String(value)
|
|
424
|
+
})
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
if (Array.isArray(meta?.candidates) && meta.candidates.length > 0) return jsx(LazyCandidatesRelationPicker, { ...props });
|
|
428
|
+
return jsx(FieldRelationPicker, {
|
|
429
|
+
props,
|
|
430
|
+
to
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
function FieldRelationPicker({ props, to, extra }) {
|
|
434
|
+
const { name, id, value, onChange, testid, field, disabled, required, relationSeeds } = props;
|
|
435
|
+
const { ariaInvalid, ariaDescribedBy, ariaErrorMessage } = props;
|
|
436
|
+
const meta = field?.meta;
|
|
437
|
+
return jsx(RelationPicker, {
|
|
438
|
+
to,
|
|
439
|
+
value,
|
|
440
|
+
onChange: (v) => onChange(v),
|
|
441
|
+
...typeof meta?.by === "string" ? { by: meta.by } : {},
|
|
442
|
+
name,
|
|
443
|
+
id,
|
|
444
|
+
testid: testid ?? `relation-picker:${to}`,
|
|
445
|
+
searchField: meta?.searchField,
|
|
446
|
+
fixedFilters: extra === void 0 ? props.fixedFilters : extra.fixedFilters,
|
|
447
|
+
...extra?.candidatesGate === void 0 ? {} : { candidatesGate: extra.candidatesGate },
|
|
448
|
+
...extra?.rowFits === void 0 ? {} : { rowFits: extra.rowFits },
|
|
449
|
+
...relationSeeds === void 0 ? {} : { createSeeds: relationSeeds },
|
|
450
|
+
fieldName: field?.name ?? name,
|
|
451
|
+
open: relationOpenOf(field ?? {}),
|
|
452
|
+
disabled,
|
|
453
|
+
required,
|
|
454
|
+
ariaInvalid,
|
|
455
|
+
ariaDescribedBy,
|
|
456
|
+
ariaErrorMessage
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
//#endregion
|
|
460
|
+
export { RelationPicker as n, RelationPickerInput as r, FieldRelationPicker as t };
|
|
461
|
+
|
|
462
|
+
//# sourceMappingURL=relation-picker-BAY77ivO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-picker-BAY77ivO.js","names":[],"sources":["../src/fields/lazy-candidates-picker.tsx","../src/fields/relation-picker.tsx"],"sourcesContent":["import { type ReactElement, Suspense, lazy } from 'react';\nimport type { FieldInputProps } from './registry.js';\nimport { Skeleton } from '../primitives/skeleton.js';\n\nconst CandidatesRelationPicker = lazy(() =>\n import('./candidates-relation-picker.js').then((module) => ({\n default: module.CandidatesRelationPicker,\n })),\n);\n\n/**\n * A relation select whose field declares `candidates`: the candidates path is a chunk of its own,\n * so a form without candidates never loads it. Until it arrives a skeleton stands in; no read\n * is sent for the options meanwhile.\n */\nexport function LazyCandidatesRelationPicker(props: FieldInputProps): ReactElement {\n return (\n <Suspense\n fallback={\n <Skeleton\n data-buro-skeleton=\"\"\n data-testid=\"relation-candidates-loading\"\n className=\"h-9 w-full\"\n />\n }\n >\n <CandidatesRelationPicker {...props} />\n </Suspense>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport { IconCheck, IconChevronDown, IconLoader2 } from '@tabler/icons-react';\nimport {\n composeListFilter,\n normalizeFixedFilters,\n resolveResourceLabel,\n resourceKey,\n type ErasedResourceHandle,\n type FilterExpression,\n type FixedFilterInput,\n type RelationOpen,\n relationOpenOf,\n type ResourceRefInput,\n type SearchDecl,\n} from '@burojs/core';\nimport {\n useApp,\n useI18nCaps,\n useList,\n useListAccess,\n useOptionalT,\n useRelatedRecord,\n} from '@burojs/react';\nimport type { CandidatesGate } from './candidates-gate.js';\nimport { namesHiddenField, narrowSearchDecl } from './search-access.js';\nimport { useRowTitle } from '../resource/use-row-title.js';\nimport { cn } from '../lib/cn.js';\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { Button } from '../primitives/button.js';\nimport {\n Command,\n CommandEmpty,\n CommandInput,\n CommandItem,\n CommandList,\n} from '../primitives/command.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../primitives/popover.js';\nimport { LazyCandidatesRelationPicker } from './lazy-candidates-picker.js';\nimport { LazyRelationPickerDialog } from './lazy-relation-picker-dialog.js';\nimport { RelationCreateButton, useSelectCreate } from './relation-create.js';\nimport { RelationViewButton } from './relation-view-button.js';\nimport type { FieldInputProps } from './registry.js';\n\n/** The portable erased AST — the only `fixedFilters` shape this module deals in. */\ntype ErasedExpression = FilterExpression<ErasedResourceHandle>;\n\n/**\n * Single-select relation picker (Relations item 2, v1).\n *\n * Renders a dropdown trigger labelled with the currently-selected\n * record's display name. Clicking opens a popover containing:\n * - a debounced search input that filters target rows by `searchField`\n * (defaults to the target's `displayField`) using the data\n * provider's `contains` operator,\n * - up to `pageSize` (default 10) result rows,\n * - a \"Clear\" button when `clearable` is true and a value is set,\n * - a \"View all\" link to the target's standalone list page so\n * operators can fall back to the full list when the inline search\n * can't find what they need.\n *\n * Multi-select / fuller modal / quick-create are deferred to v2 — see\n * docs/superpowers/specs/2026-05-04-relation-picker.md.\n *\n * Failure modes (mirrors RelationDisplay's fail-soft policy):\n * - target not registered → trigger renders the raw value, picker\n * is disabled. Caller still gets onChange(null) only via clear.\n * - useList errors → popover shows muted \"Failed to load\" with the\n * error message in the title; \"View all\" still works.\n * - target row for `value` not found → trigger shows the raw id\n * (so the operator can at least see what was stored).\n */\n\nexport interface RelationPickerProps {\n /** Target resource name (matches `f.relation({ to: '...' })`). */\n to: string;\n /** Currently-selected FK value, or null/undefined when empty. */\n value: string | number | null | undefined;\n /** Called with the new selected id (or `by` value), or null when cleared. */\n onChange: (next: string | number | null) => void;\n /**\n * The target field the value holds (`meta.by`, spec 4.2): options write `row[by]` and the\n * selected value is resolved by it. Absent: the target's id field.\n */\n by?: string;\n /**\n * Field whose value is matched against the search text. Defaults to\n * the target's `displayField` (which is what the trigger label\n * already shows, so it's the natural search target).\n */\n searchField?: string;\n /** Initial fetch / max visible rows. Defaults to 10. */\n pageSize?: number;\n /** Show a clear button. Defaults to true. */\n clearable?: boolean;\n /** Trigger placeholder when value is empty. */\n placeholder?: string;\n /** HTML name attribute for the trigger button. */\n name?: string;\n /** HTML id attribute. */\n id?: string;\n /** Test-id override. Defaults to `relation-picker:<to>`. */\n testid?: string;\n /**\n * Extra filters ANDed onto every query (inline popover + advanced modal) —\n * the same `FixedFilterInput` shape `useResourceList` takes: a bare AST\n * expression (`@burojs/core`'s `FilterExpression`, e.g.\n * `{ field: 'is_active', op: 'eq', value: true }`), or `{ filter, lock?,\n * label? }` for finer control. A bare expression defaults to `lock: true`\n * — the field is hidden from the modal's filter builder, with no badge —\n * which is what keeps the picker from ever offering an out-of-scope\n * record. Pass `{ filter, lock: false }` to keep the field open to the\n * user, and add `label` to render it as an undeletable badge instead.\n */\n fixedFilters?: readonly FixedFilterInput[];\n /**\n * The trusted `defaults` of a create opened from this select (P6-31): the registry field's\n * static `eq` literals, handed down by the form controller. Never read from `fixedFilters` or\n * `field.meta`.\n */\n createSeeds?: Readonly<Record<string, unknown>>;\n /**\n * What the field's `candidates` say about reading the target right now (P7 3.4): `pending`\n * draws a disabled trigger, `empty` a popover that says what to choose first, `forbidden` a\n * disabled trigger and why. While set, nothing is read for the options. Absent: read normally.\n */\n candidatesGate?: CandidatesGate;\n /**\n * Whether a loaded row fits the resolved candidate filters (already in `fixedFilters`):\n * `false` makes the field say the chosen row \"does not match the current filter\" (P7 3.4).\n */\n rowFits?: (row: Record<string, unknown>) => boolean | undefined;\n /** The form field holding the key (the \"view\" and \"+ create\" test ids); defaults to `name`. */\n fieldName?: string;\n /** The field's `ui.open` (P7 3.6): what the \"view\" button opens, or no button for `none`. */\n open?: RelationOpen;\n disabled?: boolean;\n required?: boolean;\n className?: string;\n /** Forwarded to the trigger button when the field is in an invalid state. */\n ariaInvalid?: boolean;\n /** Forwarded to the trigger button as `aria-describedby` (help text only; error id goes via ariaErrorMessage). */\n ariaDescribedBy?: string;\n /** Forwarded to the trigger button as `aria-errormessage` (WAI-ARIA 1.2). */\n ariaErrorMessage?: string;\n}\n\nconst DEBOUNCE_MS = 250;\n\nexport function RelationPicker({\n to,\n value,\n onChange,\n by,\n searchField,\n pageSize = 10,\n clearable = true,\n placeholder,\n name,\n id,\n testid,\n fixedFilters,\n createSeeds,\n candidatesGate,\n rowFits,\n fieldName,\n open: openMode,\n disabled,\n required,\n className,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n}: RelationPickerProps): React.ReactElement {\n const app = useApp();\n const caps = useI18nCaps();\n const t = useOptionalT();\n const targetDef = app.registry.get(to);\n const rowTitle = useRowTitle(to, targetDef?.displayField);\n // Lowercased: the label sits mid-sentence in «Select location…».\n const targetLabel = resolveResourceLabel(caps, to, 'single', targetDef).toLowerCase();\n const RouterLink = useLinkComponent();\n // Trigger testid honours the prop override (so callers like\n // the record form get a deterministic per-field id like\n // `form-field-input:<resource>:<view>:<field>`), but child elements\n // (search, options, view-all, clear) keep a stable per-target prefix\n // so e2e tests don't have to know the parent form's testid path.\n const tid = testid ?? `relation-picker:${to}`;\n const childPrefix = `relation-picker:${to}`;\n\n // Resolve the field used for search. If the caller didn't override\n // and the target has no displayField, fall back to 'name' (the most\n // common label column on Hasura tables) — same fail-soft as\n // recordDisplayName.\n const effectiveSearchField = searchField ?? targetDef?.displayField ?? 'name';\n\n const triggerRef = React.useRef<HTMLButtonElement | null>(null);\n // An overlay opened from this select returns focus to the trigger when it closes: the shell\n // records the focused element as it mounts.\n const focusTrigger = React.useCallback(() => triggerRef.current?.focus(), []);\n const [open, setOpen] = React.useState(false);\n const [dialogOpen, setDialogOpen] = React.useState(false);\n // The dialog is mounted on its first open, and only while no candidates gate holds the read:\n // without the candidate filters it would list rows the field must not offer.\n const gated = candidatesGate !== undefined;\n const [dialogMounted, setDialogMounted] = React.useState(false);\n React.useEffect(() => {\n if (gated) setDialogOpen(false);\n }, [gated]);\n React.useEffect(() => {\n if (dialogOpen) setDialogMounted(true);\n }, [dialogOpen]);\n const [search, setSearch] = React.useState('');\n const [debouncedSearch, setDebouncedSearch] = React.useState('');\n\n // Debounce the search text so each keystroke doesn't fire a request —\n // react-query will dedup but the popover can flicker.\n React.useEffect(() => {\n const handle = setTimeout(() => setDebouncedSearch(search), DEBOUNCE_MS);\n return () => clearTimeout(handle);\n }, [search]);\n\n // Reset search when the popover closes so reopening starts clean.\n React.useEffect(() => {\n if (!open) {\n setSearch('');\n setDebouncedSearch('');\n }\n }, [open]);\n\n // Trigger label: fetch the currently-selected target row to show its\n // display name. Skipped when value is empty (useRelatedRecord handles\n // that). Same hook RelationDisplay uses, so the cache is shared.\n // An input resolves the selected value whatever the field's `resolve` says (spec 4.3).\n const { record: selectedRecord, isLoading: selectedLoading } = useRelatedRecord(\n to,\n value,\n by === undefined ? undefined : { by },\n );\n // What an option writes and is compared on: `row[by]`, else the target's id field.\n const targetIdField = (targetDef?.data as { readonly idField?: unknown } | undefined)?.idField;\n const valueField =\n by ?? (typeof targetIdField === 'string' && targetIdField.length > 0 ? targetIdField : 'id');\n\n // List the picker options. `useList` returns `{ data: { data, total } }`.\n //\n // Composed through the SAME `composeListFilter` core the dialog\n // (`RelationPickerDialog`/`useDialogFilterState`) and the list page use —\n // this popover is a distinct composition SITE (fixed scope + free-text\n // search only, no builder group), not a second set of rules. Search\n // resolution mirrors the dialog's: the target's declared\n // `views.list.search` always wins; `effectiveSearchField` (the\n // `searchField` prop, else `displayField`, else `'name'`) is the fallback,\n // wrapped as a single-field declaration so it goes through the exact same\n // `searchToFilter` path a real declaration would. Before this, the popover\n // hand-rolled `{ field: effectiveSearchField, op: 'contains', value }`\n // unconditionally, ignoring a declared `views.list.search` entirely — one\n // control (popover vs. \"advanced search\") giving two different answers\n // for the same typed text.\n const access = useListAccess(to);\n const accessReady = access.status === 'ready';\n // The search set loses every field its user may not view; none left is no search box and no\n // search predicate (P5 spec 3.7).\n const searchDecl = React.useMemo<SearchDecl | undefined>(\n () =>\n narrowSearchDecl(\n targetDef?.views?.list?.search ?? { fields: [effectiveSearchField] },\n (name) => access.fieldVisible(name),\n ),\n [targetDef, effectiveSearchField, access],\n );\n const filter = React.useMemo<ErasedExpression | undefined>(\n () =>\n composeListFilter({\n fixed: normalizeFixedFilters(fixedFilters),\n search: debouncedSearch,\n searchDecl,\n searchContext: { resource: to, def: targetDef },\n }),\n [fixedFilters, debouncedSearch, searchDecl, to, targetDef],\n );\n // An author predicate or a function search naming a hidden field forbids the read.\n const blocked =\n !accessReady ||\n candidatesGate !== undefined ||\n namesHiddenField(filter, (name) => access.fieldVisible(name));\n\n // The select's one pending create, shared by the popover and the \"Advanced search\" dialog.\n const idField =\n typeof targetIdField === 'string' && targetIdField.length > 0 ? targetIdField : 'id';\n const { create, reader: createReader } = useSelectCreate({\n to,\n by,\n valueField,\n idField,\n fixedFilters,\n held: gated,\n searchDecl,\n searchContext: { resource: to, def: targetDef },\n // As a pick does: the value is written and the \"Advanced search\" dialog, when the create\n // came from it, is done.\n onValue: (picked) => {\n onChange(picked);\n setDialogOpen(false);\n },\n });\n\n const listQuery = useList(to, {\n ...(filter ? { filter } : {}),\n pagination: { kind: 'offset', page: 1, pageSize },\n // Explicit fixedFilters → caller owns the scope; skip ambient sidebar scope\n // so its filter isn't contradicted (see RelationPickerDialog for why).\n ...(fixedFilters && fixedFilters.length > 0\n ? { providerOptionsOverride: { ignoreScope: true } }\n : {}),\n enabled: open && targetDef != null && !blocked,\n });\n\n const rows = (listQuery.data?.data ?? []) as Array<{ id: unknown } & Record<string, unknown>>;\n // ⚠️ The rows the popover already loaded are a better label source than a\n // second round-trip. `selectedRecord` comes from the batched relation\n // aggregator; immediately after picking an option that batch has not\n // resolved the new id yet, so the trigger fell through to its raw-id\n // fallback and showed «4» instead of «Склад готовой продукции». The picker\n // is holding the chosen record in `rows` — use it.\n const triggerLabel = renderTriggerLabel({\n rowTitle,\n optionRows: rows,\n valueField,\n value,\n selectedRecord,\n selectedLoading,\n targetDef,\n targetLabel,\n placeholder,\n t,\n });\n\n // Target not registered — degrade gracefully: render a disabled\n // trigger with the raw value so the operator can still SEE the\n // stored FK, but they can't pick a new one because we have no\n // basePath to drive a \"View all\" link or a useList query.\n if (!targetDef) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(`[RelationPicker] target resource '${to}' not registered — picker disabled`);\n }\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={`${childPrefix}:unregistered`}\n className={cn('w-full justify-between font-normal', className)}\n name={name}\n id={id}\n aria-required={required}\n >\n <span className=\"truncate text-muted-foreground\">\n {value == null || value === ''\n ? (placeholder ?? t('field.select', { defaultValue: 'Select…' }))\n : String(value)}\n </span>\n <IconChevronDown className=\"h-4 w-4 opacity-50\" aria-hidden />\n </Button>\n );\n }\n\n // The candidates say the target must not be read yet (P7 3.4): a disabled trigger, no popover.\n if (candidatesGate?.kind === 'pending') {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={tid}\n data-buro-candidates=\"pending\"\n className={cn('w-full justify-between font-normal', className)}\n name={name}\n id={id}\n aria-required={required}\n aria-busy=\"true\"\n >\n <span className=\"truncate text-muted-foreground\">{triggerLabel}</span>\n <IconLoader2 className=\"h-4 w-4 shrink-0 animate-spin opacity-50\" aria-hidden />\n </Button>\n );\n }\n if (candidatesGate?.kind === 'forbidden') {\n return (\n <div className=\"flex flex-col gap-1\">\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={tid}\n data-buro-candidates=\"forbidden\"\n className={cn('w-full justify-between font-normal', className)}\n name={name}\n id={id}\n aria-required={required}\n aria-describedby={candidatesGate.testId}\n >\n <span className={cn('truncate text-left', value == null && 'text-muted-foreground')}>\n {triggerLabel}\n </span>\n <IconChevronDown className=\"h-4 w-4 shrink-0 opacity-50\" aria-hidden />\n </Button>\n <p\n id={candidatesGate.testId}\n data-testid={candidatesGate.testId}\n className=\"text-xs text-muted-foreground\"\n >\n {candidatesGate.message}\n </p>\n </div>\n );\n }\n\n const targetBasePath = targetDef.basePath ?? `/${to}`;\n // The chosen row stays as it is when it falls outside the candidates; the field says so.\n const outside =\n rowFits !== undefined &&\n value != null &&\n value !== '' &&\n selectedRecord != null &&\n rowFits(selectedRecord as Record<string, unknown>) === false;\n const isLoading = listQuery.isLoading || listQuery.isFetching;\n const error = listQuery.isError ? (listQuery.error as unknown as Error) : null;\n\n function handleSelect(rowId: unknown): void {\n // IDs arrive as strings or numbers depending on the data provider.\n // Pass through as-is so callers can compare to their\n // schema (e.g. UUID strings stay strings).\n onChange(rowId as string | number);\n setOpen(false);\n }\n\n function handleClear(): void {\n onChange(null);\n setOpen(false);\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <div className=\"flex items-center gap-1\">\n <PopoverTrigger asChild>\n <Button\n ref={triggerRef}\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n disabled={disabled}\n data-testid={tid}\n name={name}\n id={id}\n className={cn('w-full justify-between font-normal', className)}\n >\n <span className={cn('truncate text-left', value == null && 'text-muted-foreground')}>\n {triggerLabel}\n </span>\n <IconChevronDown className=\"h-4 w-4 shrink-0 opacity-50\" aria-hidden />\n </Button>\n </PopoverTrigger>\n {!disabled && (\n <RelationViewButton\n to={to}\n value={value}\n by={by}\n ignoreScope={fixedFilters !== undefined && fixedFilters.length > 0}\n fieldName={fieldName ?? name ?? to}\n beforeOpen={focusTrigger}\n {...(openMode === undefined ? {} : { open: openMode })}\n />\n )}\n </div>\n {outside && (\n <p\n className=\"mt-1 text-xs text-muted-foreground\"\n data-testid={`${childPrefix}:not-matching`}\n >\n {t('relationPicker.notMatching', { defaultValue: 'Does not match the current filter' })}\n </p>\n )}\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n {candidatesGate?.kind === 'empty' ? (\n <p\n className=\"px-3 py-6 text-center text-sm text-muted-foreground\"\n data-testid={candidatesGate.testId}\n >\n {candidatesGate.message}\n </p>\n ) : (\n /* shouldFilter={false}: cmdk's built-in client filter is disabled\n because filtering happens server-side via useList's `contains`\n operator. cmdk still drives keyboard navigation, focus,\n highlighted-item state, and Enter-to-select. */\n <Command shouldFilter={false}>\n {searchDecl !== undefined && (\n <CommandInput\n value={search}\n onValueChange={setSearch}\n placeholder={t('toolbar.search', {\n params: { name: targetLabel },\n defaultValue: `Search ${targetLabel}…`,\n })}\n data-testid={`${childPrefix}:search`}\n aria-label={t('toolbar.search', {\n params: { name: targetLabel },\n defaultValue: `Search ${targetLabel}`,\n })}\n />\n )}\n <CommandList data-testid={`${childPrefix}:list`}>\n {isLoading && (\n <div\n className=\"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground\"\n data-testid={`${childPrefix}:loading`}\n >\n <IconLoader2 className=\"h-4 w-4 animate-spin\" aria-hidden />\n <span>{t('table.loading', { defaultValue: 'Loading…' })}</span>\n </div>\n )}\n {!isLoading && error && (\n <div\n className=\"px-3 py-6 text-center text-sm text-muted-foreground\"\n data-testid={`${childPrefix}:error`}\n title={error.message}\n >\n {t('relation.failed', { defaultValue: 'Failed to load options.' })}\n </div>\n )}\n {!isLoading && !error && rows.length === 0 && (\n <CommandEmpty data-testid={`${childPrefix}:empty`}>\n {t('relation.noResults', { defaultValue: 'No results.' })}\n </CommandEmpty>\n )}\n {!isLoading &&\n !error &&\n rows.map((row) => {\n const rowId = row[valueField];\n // A row without the value the field stores cannot be chosen (no fallback to id).\n if (rowId === null || rowId === undefined || rowId === '') return null;\n const idStr = String(rowId);\n const label = rowTitle(row);\n const isSelected = value != null && String(value) === idStr;\n return (\n <CommandItem\n key={idStr}\n // cmdk uses `value` for keyboard-search semantics;\n // setting it to `${label} ${idStr}` lets users type\n // either the label OR the id and the highlighted\n // option still tracks correctly across renders.\n value={`${label} ${idStr}`}\n data-testid={`${childPrefix}:option:${idStr}`}\n onSelect={() => handleSelect(rowId)}\n >\n <IconCheck\n className={cn(\n 'mr-2 h-4 w-4 shrink-0',\n isSelected ? 'opacity-100' : 'opacity-0',\n )}\n aria-hidden\n />\n <span className=\"truncate\">{label}</span>\n {/* A label that already is the id (a target whose `displayField` is\n `id`) would print it twice (REF-40). */}\n {label === idStr ? null : (\n <span className=\"ml-auto shrink-0 pl-2 text-xs text-muted-foreground\">\n #{idStr}\n </span>\n )}\n </CommandItem>\n );\n })}\n </CommandList>\n <div className=\"flex items-center justify-between gap-2 border-t px-3 py-2 text-sm\">\n {clearable && value != null && value !== '' ? (\n <button\n type=\"button\"\n onClick={handleClear}\n data-testid={`${childPrefix}:clear`}\n className=\"text-muted-foreground hover:text-foreground focus:outline-hidden focus-visible:underline\"\n >\n {t('relationPicker.clear', { defaultValue: 'Clear' })}\n </button>\n ) : (\n <span aria-hidden />\n )}\n <div className=\"flex items-center gap-3\">\n {/* #11 — escalation to the full-list modal: search + sort +\n paginate + create, for when the inline popover isn't enough. */}\n <button\n type=\"button\"\n onClick={() => {\n setOpen(false);\n setDialogOpen(true);\n }}\n data-testid={`${childPrefix}:advanced`}\n className=\"text-foreground hover:underline focus:outline-hidden focus-visible:underline\"\n >\n {t('relationPicker.advancedSearch', { defaultValue: 'Advanced search' })}\n </button>\n {!disabled && (\n <RelationCreateButton\n to={to}\n fieldName={fieldName ?? name ?? to}\n create={create}\n seeds={createSeeds}\n search={search}\n beforeOpen={() => {\n setOpen(false);\n focusTrigger();\n }}\n className=\"text-foreground hover:underline focus:outline-hidden focus-visible:underline disabled:opacity-50\"\n />\n )}\n <RouterLink\n href={targetBasePath}\n data-testid={`${childPrefix}:view-all`}\n className=\"text-muted-foreground hover:text-foreground hover:underline focus:outline-hidden focus-visible:underline\"\n >\n {t('relationPicker.viewAll', { defaultValue: 'Open list' })} →\n </RouterLink>\n </div>\n </div>\n </Command>\n )}\n </PopoverContent>\n {/*\n The RAW `searchField` prop, not `effectiveSearchField` — the dialog\n (Task 5, SP3) does its OWN target-declaration → prop → displayField\n resolution via `useDialogFilterState`, so handing it an already-\n resolved value here would just have this component's own\n `displayField ?? 'name'` fallback (built for the POPOVER's simpler\n contains-only search) silently stand in for the dialog's, rather\n than letting the target's declared `views.list.search` win when the\n caller passed no override at all.\n */}\n {dialogMounted && !gated && (\n <LazyRelationPickerDialog\n to={to}\n open={dialogOpen}\n onOpenChange={setDialogOpen}\n onSelect={(rowId) => onChange(rowId)}\n valueField={valueField}\n searchField={searchField}\n fixedFilters={fixedFilters}\n {...(disabled ? {} : { create })}\n createSeeds={createSeeds}\n fieldName={fieldName ?? name ?? to}\n onBeforeCreate={focusTrigger}\n />\n )}\n {createReader}\n </Popover>\n );\n}\n\ninterface TriggerLabelArgs {\n value: string | number | null | undefined;\n selectedRecord: ReturnType<typeof useRelatedRecord>['record'];\n selectedLoading: boolean;\n /** Rows already loaded for the popover; used as a same-tick label source. */\n optionRows?: Array<{ id: unknown } & Record<string, unknown>>;\n /** The row field the value holds (`by`, else the id field). */\n valueField: string;\n targetDef: ReturnType<ReturnType<typeof useApp>['registry']['get']>;\n /** The resolved, lowercased target label. */\n targetLabel: string;\n placeholder?: string;\n /** The row title under the viewer's field view (id when the display field is hidden). */\n rowTitle: (row: Record<string, unknown>) => string;\n t: (key: string, options?: { params?: Record<string, unknown>; defaultValue?: string }) => string;\n}\n\nfunction renderTriggerLabel({\n value,\n selectedRecord,\n selectedLoading,\n targetLabel,\n placeholder,\n optionRows,\n valueField,\n t,\n rowTitle,\n}: TriggerLabelArgs): React.ReactNode {\n if (value == null || value === '') {\n return (\n placeholder ??\n t('relation.select', {\n params: { name: targetLabel },\n defaultValue: `Select ${targetLabel}…`,\n })\n );\n }\n if (selectedLoading) {\n return t('table.loading', { defaultValue: 'Loading…' });\n }\n if (selectedRecord) {\n return rowTitle(selectedRecord);\n }\n // Not resolved by the aggregator yet (or at all). If the popover already\n // loaded this record as an option — which it always has right after the\n // user picked it — label from that instead of showing a bare id.\n const fromOptions = optionRows?.find((r) => String(r[valueField]) === String(value));\n if (fromOptions) {\n return rowTitle(fromOptions);\n }\n // Genuinely unknown (404 / not in the loaded page) — show the raw id so the\n // operator can at least see what was stored.\n return String(value);\n}\n\n/**\n * Form-field adapter wrapping `<RelationPicker>` for use as a default\n * Input renderer in the field registry. Reads `field.meta.to` for the\n * target resource name. When `meta.to` is absent we degrade to a plain\n * (disabled) text representation of the value with a console warning —\n * same fail-soft as RelationDisplay.\n */\nexport function RelationPickerInput(props: FieldInputProps): React.ReactElement {\n const { name, id, value, testid, field, required } = props;\n const meta = field?.meta as { to?: ResourceRefInput; candidates?: unknown } | undefined;\n let to: string | undefined;\n try {\n to = meta?.to === undefined ? undefined : resourceKey(meta.to);\n } catch {\n to = undefined;\n }\n\n if (!to) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n `[RelationPickerInput] no meta.to on field '${field?.name ?? name}' — relation picker disabled`,\n );\n }\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={`${testid ?? `relation-picker:${name}`}:no-target`}\n className=\"w-full justify-between font-normal\"\n name={name}\n id={id}\n aria-required={required}\n >\n <span className=\"truncate text-muted-foreground\">\n {value == null || value === '' ? '—' : String(value)}\n </span>\n </Button>\n );\n }\n\n // The candidates path is loaded only for a field that declares candidates.\n if (Array.isArray(meta?.candidates) && meta.candidates.length > 0)\n return <LazyCandidatesRelationPicker {...props} />;\n return <FieldRelationPicker props={props} to={to} />;\n}\n\n/** The form field's props as `RelationPicker` takes them; `extra` carries the candidates' part. */\nexport function FieldRelationPicker({\n props,\n to,\n extra,\n}: {\n props: FieldInputProps;\n to: string;\n extra?: {\n fixedFilters: FieldInputProps['fixedFilters'];\n candidatesGate?: CandidatesGate;\n rowFits?: (row: Record<string, unknown>) => boolean | undefined;\n };\n}): React.ReactElement {\n const { name, id, value, onChange, testid, field, disabled, required, relationSeeds } = props;\n const { ariaInvalid, ariaDescribedBy, ariaErrorMessage } = props;\n const meta = field?.meta as { by?: unknown; searchField?: string } | undefined;\n return (\n <RelationPicker\n to={to}\n value={value as string | number | null | undefined}\n onChange={(v) => onChange(v)}\n {...(typeof meta?.by === 'string' ? { by: meta.by } : {})}\n name={name}\n id={id}\n testid={testid ?? `relation-picker:${to}`}\n searchField={meta?.searchField}\n fixedFilters={extra === undefined ? props.fixedFilters : extra.fixedFilters}\n {...(extra?.candidatesGate === undefined ? {} : { candidatesGate: extra.candidatesGate })}\n {...(extra?.rowFits === undefined ? {} : { rowFits: extra.rowFits })}\n {...(relationSeeds === undefined ? {} : { createSeeds: relationSeeds })}\n fieldName={field?.name ?? name}\n open={relationOpenOf(field ?? {})}\n disabled={disabled}\n required={required}\n ariaInvalid={ariaInvalid}\n ariaDescribedBy={ariaDescribedBy}\n ariaErrorMessage={ariaErrorMessage}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAIA,MAAM,2BAA2B,WAC/B,OAAO,2CAAkC,CAAC,MAAM,YAAY,EAC1D,SAAS,OAAO,yBAClB,EAAE,CACJ;AAOA,SAAgB,6BAA6B,OAAsC;CACjF,OACE,IAAC,UAAD;EACE,UACE,IAAC,UAAD;GACE,sBAAmB;GACnB,eAAY;GACZ,WAAU;EACX,CAAA;EAGH,UAAA,IAAC,0BAAD,EAA0B,GAAI,MAAQ,CAAA;CAC9B,CAAA;AAEd;;;ACuHA,MAAM,cAAc;AAEpB,SAAgB,eAAe,EAC7B,IACA,OACA,UACA,IACA,aACA,WAAW,IACX,YAAY,MACZ,aACA,MACA,IACA,QACA,cACA,aACA,gBACA,SACA,WACA,MAAM,UACN,UACA,UACA,WACA,aACA,iBAC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