@burojs/ui-shadcn 0.6.0 → 0.7.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 +9 -0
- package/dist/bulk-summary-BWSAS7k2.js +143 -0
- package/dist/bulk-summary-BWSAS7k2.js.map +1 -0
- package/dist/bulk-summary-CrEij5vq.cjs +143 -0
- package/dist/bulk-summary-CrEij5vq.cjs.map +1 -0
- package/dist/{candidates-relation-picker-B116Bmqi.js → candidates-relation-picker-CS_JZ4Fd.js} +3 -3
- package/dist/{candidates-relation-picker-B116Bmqi.js.map → candidates-relation-picker-CS_JZ4Fd.js.map} +1 -1
- package/dist/{candidates-relation-picker-Cy0rTxvI.cjs → candidates-relation-picker-y5M6_oe4.cjs} +4 -4
- package/dist/{candidates-relation-picker-Cy0rTxvI.cjs.map → candidates-relation-picker-y5M6_oe4.cjs.map} +1 -1
- package/dist/{check-confirm-dialog-bRT8lt0d.js → check-confirm-dialog-2j0gOd7x.js} +384 -108
- package/dist/check-confirm-dialog-2j0gOd7x.js.map +1 -0
- package/dist/{check-confirm-dialog--gPFnEeg.cjs → check-confirm-dialog-C-NHgMST.cjs} +468 -107
- package/dist/check-confirm-dialog-C-NHgMST.cjs.map +1 -0
- package/dist/{dialog-B_rt9S1c.js → dialog-C123sVQ8.js} +4 -4
- package/dist/dialog-C123sVQ8.js.map +1 -0
- package/dist/{dialog-DRNUq9EA.cjs → dialog-vmMdfUWs.cjs} +3 -3
- package/dist/dialog-vmMdfUWs.cjs.map +1 -0
- package/dist/{filter-builder-nXqtM_h4.cjs → filter-builder-DFu0JP-1.cjs} +923 -120
- package/dist/filter-builder-DFu0JP-1.cjs.map +1 -0
- package/dist/{filter-builder-Bhn-dhZV.js → filter-builder-DaWHUZuV.js} +839 -108
- package/dist/filter-builder-DaWHUZuV.js.map +1 -0
- package/dist/{flow-runtime-D3avVH0I.cjs → flow-runtime-BpmrIUb6.cjs} +61 -29
- package/dist/flow-runtime-BpmrIUb6.cjs.map +1 -0
- package/dist/{flow-runtime-s6lkRPKF.js → flow-runtime-DyqTmK3H.js} +62 -30
- package/dist/flow-runtime-DyqTmK3H.js.map +1 -0
- package/dist/{flow-screen-Ci_Sik4Y.cjs → flow-screen-Bcz9NF2V.cjs} +128 -87
- package/dist/flow-screen-Bcz9NF2V.cjs.map +1 -0
- package/dist/{flow-screen-CCvgDI9G.js → flow-screen-DCdli6Ha.js} +128 -87
- package/dist/flow-screen-DCdli6Ha.js.map +1 -0
- package/dist/index.cjs +731 -906
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +455 -247
- package/dist/index.d.ts +455 -247
- package/dist/index.js +647 -828
- package/dist/index.js.map +1 -1
- package/dist/{inline-flow-host-DV1et3c6.cjs → inline-flow-host-3vw7LzzD.cjs} +5 -5
- package/dist/inline-flow-host-3vw7LzzD.cjs.map +1 -0
- package/dist/{inline-flow-host-B6FI0ctQ.js → inline-flow-host-C0rI9B7f.js} +5 -5
- package/dist/inline-flow-host-C0rI9B7f.js.map +1 -0
- package/dist/{candidates-gate-D33jXLHO.cjs → lazy-relation-picker-dialog-Bt8lrEIu.cjs} +10 -10
- package/dist/lazy-relation-picker-dialog-Bt8lrEIu.cjs.map +1 -0
- package/dist/{candidates-gate-Bb70LPAy.js → lazy-relation-picker-dialog-CAScLPb2.js} +11 -11
- package/dist/lazy-relation-picker-dialog-CAScLPb2.js.map +1 -0
- package/dist/{page-flow-route-i3ZfJ1sd.js → page-flow-route-BHUEpn0I.js} +36 -23
- package/dist/page-flow-route-BHUEpn0I.js.map +1 -0
- package/dist/{page-flow-route-hdnULWqd.cjs → page-flow-route-DS8IVTVH.cjs} +41 -28
- package/dist/page-flow-route-DS8IVTVH.cjs.map +1 -0
- package/dist/{place-node-C5SmIAYU.cjs → place-node-CNb3w-c7.cjs} +1869 -947
- package/dist/place-node-CNb3w-c7.cjs.map +1 -0
- package/dist/{place-node-NraNYKPx.js → place-node-CfzQvh4Y.js} +1824 -926
- package/dist/place-node-CfzQvh4Y.js.map +1 -0
- package/dist/{related-list-cards-BWZ9GfOG.js → related-list-cards-BIqqY69Y.js} +9 -4
- package/dist/{related-list-cards-BWZ9GfOG.js.map → related-list-cards-BIqqY69Y.js.map} +1 -1
- package/dist/{related-list-cards-CFq3meUn.cjs → related-list-cards-CelMxl4q.cjs} +9 -4
- package/dist/{related-list-cards-CFq3meUn.cjs.map → related-list-cards-CelMxl4q.cjs.map} +1 -1
- package/dist/{related-list-timeline-yrPsjA3F.js → related-list-timeline-CRh7xwLD.js} +6 -7
- package/dist/related-list-timeline-CRh7xwLD.js.map +1 -0
- package/dist/{related-list-timeline-CCzl71aA.cjs → related-list-timeline-DsLdi8sv.cjs} +5 -6
- package/dist/related-list-timeline-DsLdi8sv.cjs.map +1 -0
- package/dist/{related-rows-o0_t-Yce.js → related-rows--uP2iKQC.js} +25 -14
- package/dist/related-rows--uP2iKQC.js.map +1 -0
- package/dist/{related-rows-ea43qhhy.cjs → related-rows-MPnLCmPF.cjs} +27 -16
- package/dist/related-rows-MPnLCmPF.cjs.map +1 -0
- package/dist/{search-access-CPPmfuvy.js → relation-create-C43cdPQt.js} +595 -13
- package/dist/relation-create-C43cdPQt.js.map +1 -0
- package/dist/{search-access-Dugvttlg.cjs → relation-create-DDEYcKfw.cjs} +633 -14
- package/dist/relation-create-DDEYcKfw.cjs.map +1 -0
- package/dist/{relation-many-picker-bvkjkv-k.js → relation-many-picker-BJhaEqxz.js} +203 -102
- package/dist/relation-many-picker-BJhaEqxz.js.map +1 -0
- package/dist/{relation-many-picker-C8zFEjwd.cjs → relation-many-picker-DzuGJpEl.cjs} +211 -110
- package/dist/relation-many-picker-DzuGJpEl.cjs.map +1 -0
- package/dist/{relation-picker-Z0ZJJ5uS.js → relation-picker-D-tBBZW_.js} +23 -59
- package/dist/relation-picker-D-tBBZW_.js.map +1 -0
- package/dist/{relation-picker-gag0qSR5.cjs → relation-picker-DaIMzf2H.cjs} +29 -71
- package/dist/relation-picker-DaIMzf2H.cjs.map +1 -0
- package/dist/{relation-picker-dialog-0IzkjmiA.cjs → relation-picker-dialog-9Vg5vvR1.cjs} +133 -35
- package/dist/relation-picker-dialog-9Vg5vvR1.cjs.map +1 -0
- package/dist/{relation-picker-dialog-B6nIiJBf.js → relation-picker-dialog-DoEY8EkH.js} +134 -36
- package/dist/relation-picker-dialog-DoEY8EkH.js.map +1 -0
- package/dist/relation-select-B8Fq4o-t.js +48 -0
- package/dist/relation-select-B8Fq4o-t.js.map +1 -0
- package/dist/relation-select-Cr3CfNLy.cjs +55 -0
- package/dist/relation-select-Cr3CfNLy.cjs.map +1 -0
- package/dist/{resource-page-router-PXfMW9nh.cjs → resource-page-router-C_kGW2o_.cjs} +543 -300
- package/dist/resource-page-router-C_kGW2o_.cjs.map +1 -0
- package/dist/{resource-page-router-3RUf9d1j.js → resource-page-router-Diw6S6TK.js} +498 -255
- package/dist/resource-page-router-Diw6S6TK.js.map +1 -0
- package/dist/{rich-text-vTyVjDoa.cjs → rich-text-C_7JCvRo.cjs} +2 -2
- package/dist/{rich-text-vTyVjDoa.cjs.map → rich-text-C_7JCvRo.cjs.map} +1 -1
- package/dist/{rich-text-DFerywgz.js → rich-text-RcPBf6hr.js} +2 -2
- package/dist/{rich-text-DFerywgz.js.map → rich-text-RcPBf6hr.js.map} +1 -1
- package/dist/success-notices-Dl3M1fZP.cjs +46 -0
- package/dist/success-notices-Dl3M1fZP.cjs.map +1 -0
- package/dist/success-notices-LDEgEkc4.js +41 -0
- package/dist/success-notices-LDEgEkc4.js.map +1 -0
- package/dist/{toaster-Cr51X7bz.cjs → toaster-BbByOytP.cjs} +60 -15
- package/dist/toaster-BbByOytP.cjs.map +1 -0
- package/dist/{toaster-C02XbB9r.js → toaster-Ct_YHGs6.js} +43 -16
- package/dist/toaster-Ct_YHGs6.js.map +1 -0
- package/dist/{use-dialog-filter-state-C--oMAZG.js → use-dialog-filter-state-B_MqzHaT.js} +5 -4
- package/dist/use-dialog-filter-state-B_MqzHaT.js.map +1 -0
- package/dist/{use-dialog-filter-state-Dhe8PcB5.cjs → use-dialog-filter-state-tNvqAAjh.cjs} +6 -5
- package/dist/use-dialog-filter-state-tNvqAAjh.cjs.map +1 -0
- package/package.json +11 -11
- package/dist/bulk-summary-CwSd6Yjb.cjs +0 -108
- package/dist/bulk-summary-CwSd6Yjb.cjs.map +0 -1
- package/dist/bulk-summary-GxMDP4bw.js +0 -108
- package/dist/bulk-summary-GxMDP4bw.js.map +0 -1
- package/dist/candidates-gate-Bb70LPAy.js.map +0 -1
- package/dist/candidates-gate-D33jXLHO.cjs.map +0 -1
- package/dist/check-confirm-dialog--gPFnEeg.cjs.map +0 -1
- package/dist/check-confirm-dialog-bRT8lt0d.js.map +0 -1
- package/dist/dialog-B_rt9S1c.js.map +0 -1
- package/dist/dialog-DRNUq9EA.cjs.map +0 -1
- package/dist/filter-builder-Bhn-dhZV.js.map +0 -1
- package/dist/filter-builder-nXqtM_h4.cjs.map +0 -1
- package/dist/flow-runtime-D3avVH0I.cjs.map +0 -1
- package/dist/flow-runtime-s6lkRPKF.js.map +0 -1
- package/dist/flow-screen-CCvgDI9G.js.map +0 -1
- package/dist/flow-screen-Ci_Sik4Y.cjs.map +0 -1
- package/dist/inline-flow-host-B6FI0ctQ.js.map +0 -1
- package/dist/inline-flow-host-DV1et3c6.cjs.map +0 -1
- package/dist/page-flow-route-hdnULWqd.cjs.map +0 -1
- package/dist/page-flow-route-i3ZfJ1sd.js.map +0 -1
- package/dist/place-node-C5SmIAYU.cjs.map +0 -1
- package/dist/place-node-NraNYKPx.js.map +0 -1
- package/dist/related-list-timeline-CCzl71aA.cjs.map +0 -1
- package/dist/related-list-timeline-yrPsjA3F.js.map +0 -1
- package/dist/related-rows-ea43qhhy.cjs.map +0 -1
- package/dist/related-rows-o0_t-Yce.js.map +0 -1
- package/dist/relation-create-IA40t1hi.cjs +0 -364
- package/dist/relation-create-IA40t1hi.cjs.map +0 -1
- package/dist/relation-create-h6F9B4C4.js +0 -339
- package/dist/relation-create-h6F9B4C4.js.map +0 -1
- package/dist/relation-many-picker-C8zFEjwd.cjs.map +0 -1
- package/dist/relation-many-picker-bvkjkv-k.js.map +0 -1
- package/dist/relation-picker-Z0ZJJ5uS.js.map +0 -1
- package/dist/relation-picker-dialog-0IzkjmiA.cjs.map +0 -1
- package/dist/relation-picker-dialog-B6nIiJBf.js.map +0 -1
- package/dist/relation-picker-gag0qSR5.cjs.map +0 -1
- package/dist/resource-page-router-3RUf9d1j.js.map +0 -1
- package/dist/resource-page-router-PXfMW9nh.cjs.map +0 -1
- package/dist/search-access-CPPmfuvy.js.map +0 -1
- package/dist/search-access-Dugvttlg.cjs.map +0 -1
- package/dist/shell-BPlk8hEa.js +0 -205
- package/dist/shell-BPlk8hEa.js.map +0 -1
- package/dist/shell-DxhlsPwm.cjs +0 -271
- package/dist/shell-DxhlsPwm.cjs.map +0 -1
- package/dist/toaster-C02XbB9r.js.map +0 -1
- package/dist/toaster-Cr51X7bz.cjs.map +0 -1
- package/dist/use-dialog-filter-state-C--oMAZG.js.map +0 -1
- package/dist/use-dialog-filter-state-Dhe8PcB5.cjs.map +0 -1
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { l as cn } from "./use-theme-dnE3Od3I.js";
|
|
2
|
-
import {
|
|
2
|
+
import { l as useLinkComponent, m as PopoverTrigger, n as toast, p as PopoverContent, u as Popover } from "./toaster-Ct_YHGs6.js";
|
|
3
3
|
import { t as Button } from "./button-MWVeZaqj.js";
|
|
4
|
-
import { a as DialogFooter, i as DialogDescription, o as DialogHeader, r as DialogContent, s as DialogTitle, t as Dialog } from "./dialog-
|
|
5
|
-
import { FRAMEWORK_TEXT_KEYS, canonicalEntityNodeKey, checkFailedDefault, compileFlow, declaredText, docAddressToArticle, hasRecordPage, hrefFor, humanizeKey, isBuiltinItemAction, normalizeEntityRef, recordEntries, resolveContentSlot, resolveDocSee } from "@burojs/core";
|
|
6
|
-
import { buildDI, conjoinHostPage, modeForSurface, resolveRoute, useApp, useAvailabilityResolver, useComponent, useDoc, useDocPanel, useDocTopics, useEntryGate, useFlowRowResolver, useHostPage, useI18nCaps, useOptionalRouterAdapter, useOptionalT, usePresentBlock, usePresentFlow, useProjectedTitle, useQuick, useQuickEntry, useTestIds, useUIInstance } from "@burojs/react";
|
|
4
|
+
import { a as DialogFooter, i as DialogDescription, o as DialogHeader, r as DialogContent, s as DialogTitle, t as Dialog } from "./dialog-C123sVQ8.js";
|
|
5
|
+
import { FRAMEWORK_TEXT_KEYS, canonicalEntityNodeKey, checkFailedDefault, compileFlow, declaredText, docAddressToArticle, flowRecordOf, hasRecordPage, hrefFor, humanizeKey, isBuiltinItemAction, normalizeEntityRef, recordEntries, resolveContentSlot, resolveDocSee, routeResourceKey, textsValueAt } from "@burojs/core";
|
|
6
|
+
import { buildDI, conjoinHostPage, modeForSurface, recordKeyOf, resolveRoute, useActionWhenSources, useApp, useAvailabilityResolver, useChromeT, useComponent, useDoc, useDocPanel, useDocTopics, useEntryGate, useFlowRowResolver, useHostPage, useI18nCaps, useOptionalRouterAdapter, useOptionalT, usePresentBlock, usePresentFlow, useProjectedTitle, useQuick, useQuickEntry, useTestIds, useUIInstance } from "@burojs/react";
|
|
7
7
|
import { IconArrowRight, IconArrowUpRight, IconArrowsLeftRight, IconBan, IconBell, IconBox, IconBoxMultiple, IconBuilding, IconCheck, IconChevronRight, IconCircle, IconCircleCaretRight, IconCircleCheck, IconCircleX, IconClipboardList, IconClock, IconCopy, IconDots, IconEye, IconFileOff, IconFilePencil, IconFileText, IconFileX, IconGitBranch, IconHammer, IconHash, IconHistory, IconInfoHexagon, IconKey, IconKeyOff, IconLink, IconList, IconLoader2, IconMapPin, IconNetwork, IconPackage, IconPackageExport, IconPackageImport, IconPackageOff, IconPackages, IconPencil, IconPlayerPlay, IconPlayerTrackNext, IconPlus, IconQrcode, IconRefresh, IconRotate, IconScript, IconSettings, IconShieldCheck, IconTag, IconTool, IconTrash, IconTruck, IconUserPlus, IconUsers, IconX } from "@tabler/icons-react";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import { Component, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { Component, createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
11
13
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
12
14
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
13
|
-
import {
|
|
15
|
+
import { actionWhenHolds, actionWhenSources, isFlowAction } from "@burojs/core/internal";
|
|
14
16
|
//#region src/doc/doc-info.tsx
|
|
15
17
|
function DocInfo({ address, name, testId, className }) {
|
|
16
18
|
const doc = useDoc(address);
|
|
@@ -100,6 +102,69 @@ function DocInfo({ address, name, testId, className }) {
|
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
104
|
//#endregion
|
|
105
|
+
//#region src/primitives/sheet.tsx
|
|
106
|
+
const Sheet = SheetPrimitive.Root;
|
|
107
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
108
|
+
const SheetClose = SheetPrimitive.Close;
|
|
109
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
110
|
+
const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => jsx(SheetPrimitive.Overlay, {
|
|
111
|
+
className: cn("fixed inset-0 z-50 bg-overlay/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-[var(--duration-panel)] ease-[var(--ease-overlay)]", className),
|
|
112
|
+
...props,
|
|
113
|
+
ref
|
|
114
|
+
}));
|
|
115
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
116
|
+
const sheetVariants = cva("fixed z-50 gap-4 bg-background text-foreground p-6 shadow-lg duration-[var(--duration-panel)] ease-[var(--ease-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out", {
|
|
117
|
+
variants: { side: {
|
|
118
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
119
|
+
bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
120
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
121
|
+
right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
|
|
122
|
+
} },
|
|
123
|
+
defaultVariants: { side: "right" }
|
|
124
|
+
});
|
|
125
|
+
const SheetContent = React.forwardRef(({ side = "right", className, children, showClose = true, ...props }, ref) => {
|
|
126
|
+
const chromeT = useChromeT();
|
|
127
|
+
return jsxs(SheetPortal, { children: [jsx(SheetOverlay, {}), jsxs(SheetPrimitive.Content, {
|
|
128
|
+
ref,
|
|
129
|
+
className: cn(sheetVariants({ side }), className),
|
|
130
|
+
...props,
|
|
131
|
+
children: [children, showClose && jsxs(SheetPrimitive.Close, {
|
|
132
|
+
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",
|
|
133
|
+
children: [jsx(IconX, { className: "h-4 w-4" }), jsx("span", {
|
|
134
|
+
className: "sr-only",
|
|
135
|
+
children: chromeT("actions.close", { defaultValue: "Close" })
|
|
136
|
+
})]
|
|
137
|
+
})]
|
|
138
|
+
})] });
|
|
139
|
+
});
|
|
140
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
141
|
+
function SheetHeader({ className, ...props }) {
|
|
142
|
+
return jsx("div", {
|
|
143
|
+
className: cn("flex flex-col space-y-2 text-center sm:text-left", className),
|
|
144
|
+
...props
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
SheetHeader.displayName = "SheetHeader";
|
|
148
|
+
function SheetFooter({ className, ...props }) {
|
|
149
|
+
return jsx("div", {
|
|
150
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
151
|
+
...props
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
SheetFooter.displayName = "SheetFooter";
|
|
155
|
+
const SheetTitle = React.forwardRef(({ className, ...props }, ref) => jsx(SheetPrimitive.Title, {
|
|
156
|
+
ref,
|
|
157
|
+
className: cn("text-lg font-semibold text-foreground", className),
|
|
158
|
+
...props
|
|
159
|
+
}));
|
|
160
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
161
|
+
const SheetDescription = React.forwardRef(({ className, ...props }, ref) => jsx(SheetPrimitive.Description, {
|
|
162
|
+
ref,
|
|
163
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
164
|
+
...props
|
|
165
|
+
}));
|
|
166
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
167
|
+
//#endregion
|
|
103
168
|
//#region src/primitives/tooltip.tsx
|
|
104
169
|
const TooltipProvider = TooltipPrimitive.Provider;
|
|
105
170
|
const Tooltip = TooltipPrimitive.Root;
|
|
@@ -256,6 +321,162 @@ function Icon({ name, className }) {
|
|
|
256
321
|
});
|
|
257
322
|
}
|
|
258
323
|
//#endregion
|
|
324
|
+
//#region src/ui-presentations/shell.tsx
|
|
325
|
+
const OwnTitleContext = createContext(false);
|
|
326
|
+
function focusOwnHeading(event) {
|
|
327
|
+
const container = event.currentTarget;
|
|
328
|
+
if (!(container instanceof HTMLElement)) return;
|
|
329
|
+
const heading = container.querySelector("[data-buro-overlay-heading]");
|
|
330
|
+
if (!(heading instanceof HTMLElement)) return;
|
|
331
|
+
event.preventDefault();
|
|
332
|
+
heading.focus();
|
|
333
|
+
}
|
|
334
|
+
function WrappedDialogContent({ wrapper, copy, children }) {
|
|
335
|
+
return wrapper ? jsxs(Fragment$1, { children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: copy.title }), jsx(DialogDescription, {
|
|
336
|
+
className: copy.description === void 0 ? "sr-only" : void 0,
|
|
337
|
+
children: copy.description ?? ""
|
|
338
|
+
})] }), children] }) : jsxs(Fragment$1, { children: [
|
|
339
|
+
jsx(DialogTitle, {
|
|
340
|
+
className: "sr-only",
|
|
341
|
+
children: copy.title
|
|
342
|
+
}),
|
|
343
|
+
jsx(DialogDescription, {
|
|
344
|
+
className: "sr-only",
|
|
345
|
+
children: copy.description ?? ""
|
|
346
|
+
}),
|
|
347
|
+
children
|
|
348
|
+
] });
|
|
349
|
+
}
|
|
350
|
+
function WrappedSheetContent({ wrapper, copy, children }) {
|
|
351
|
+
return wrapper ? jsxs(Fragment$1, { children: [jsxs(SheetHeader, { children: [jsx(SheetTitle, { children: copy.title }), jsx(SheetDescription, {
|
|
352
|
+
className: copy.description === void 0 ? "sr-only" : void 0,
|
|
353
|
+
children: copy.description ?? ""
|
|
354
|
+
})] }), children] }) : jsxs(Fragment$1, { children: [
|
|
355
|
+
jsx(SheetTitle, {
|
|
356
|
+
className: "sr-only",
|
|
357
|
+
children: copy.title
|
|
358
|
+
}),
|
|
359
|
+
jsx(SheetDescription, {
|
|
360
|
+
className: "sr-only",
|
|
361
|
+
children: copy.description ?? ""
|
|
362
|
+
}),
|
|
363
|
+
children
|
|
364
|
+
] });
|
|
365
|
+
}
|
|
366
|
+
function useFocusRestoration() {
|
|
367
|
+
const returnFocus = useRef(typeof document === "undefined" || !(document.activeElement instanceof HTMLElement) ? null : document.activeElement);
|
|
368
|
+
useEffect(() => () => {
|
|
369
|
+
const element = returnFocus.current;
|
|
370
|
+
queueMicrotask(() => {
|
|
371
|
+
if (element?.isConnected && element !== document.body) {
|
|
372
|
+
element.focus();
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const main = document.querySelector("main");
|
|
376
|
+
if (main === null) return;
|
|
377
|
+
if (!main.hasAttribute("tabindex")) main.setAttribute("tabindex", "-1");
|
|
378
|
+
main.focus();
|
|
379
|
+
});
|
|
380
|
+
}, []);
|
|
381
|
+
}
|
|
382
|
+
function keepForPopover(event) {
|
|
383
|
+
const target = event.target;
|
|
384
|
+
if (target instanceof Element && target.closest("[data-buro-popover]") !== null) event.preventDefault();
|
|
385
|
+
}
|
|
386
|
+
const REDUCED_MOTION = "motion-reduce:animate-none motion-reduce:transition-none";
|
|
387
|
+
function DialogPresentationShell({ dismiss, wrapper, copy, ownTitle = false, children }) {
|
|
388
|
+
useFocusRestoration();
|
|
389
|
+
return jsx(Dialog, {
|
|
390
|
+
open: true,
|
|
391
|
+
onOpenChange: (open) => {
|
|
392
|
+
if (!open) dismiss();
|
|
393
|
+
},
|
|
394
|
+
children: ownTitle ? jsx(DialogContent, {
|
|
395
|
+
className: `flex max-h-[85vh] flex-col ${REDUCED_MOTION}`,
|
|
396
|
+
overlayClassName: REDUCED_MOTION,
|
|
397
|
+
showClose: wrapper,
|
|
398
|
+
"aria-describedby": void 0,
|
|
399
|
+
"aria-modal": "true",
|
|
400
|
+
onOpenAutoFocus: focusOwnHeading,
|
|
401
|
+
onPointerDownOutside: keepForPopover,
|
|
402
|
+
children: jsx(OwnTitleContext.Provider, {
|
|
403
|
+
value: true,
|
|
404
|
+
children
|
|
405
|
+
})
|
|
406
|
+
}) : jsx(DialogContent, {
|
|
407
|
+
className: REDUCED_MOTION,
|
|
408
|
+
overlayClassName: REDUCED_MOTION,
|
|
409
|
+
showClose: wrapper,
|
|
410
|
+
"aria-modal": "true",
|
|
411
|
+
onPointerDownOutside: keepForPopover,
|
|
412
|
+
children: jsx(WrappedDialogContent, {
|
|
413
|
+
wrapper,
|
|
414
|
+
copy,
|
|
415
|
+
children
|
|
416
|
+
})
|
|
417
|
+
})
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
function SheetPresentationShell({ dismiss, wrapper, copy, ownTitle = false, children }) {
|
|
421
|
+
useFocusRestoration();
|
|
422
|
+
return jsx(Sheet, {
|
|
423
|
+
open: true,
|
|
424
|
+
onOpenChange: (open) => {
|
|
425
|
+
if (!open) dismiss();
|
|
426
|
+
},
|
|
427
|
+
children: ownTitle ? jsx(SheetContent, {
|
|
428
|
+
side: "right",
|
|
429
|
+
className: `flex flex-col sm:max-w-xl ${REDUCED_MOTION}`,
|
|
430
|
+
showClose: wrapper,
|
|
431
|
+
"aria-describedby": void 0,
|
|
432
|
+
"aria-modal": "true",
|
|
433
|
+
onOpenAutoFocus: focusOwnHeading,
|
|
434
|
+
onPointerDownOutside: keepForPopover,
|
|
435
|
+
children: jsx(OwnTitleContext.Provider, {
|
|
436
|
+
value: true,
|
|
437
|
+
children
|
|
438
|
+
})
|
|
439
|
+
}) : jsx(SheetContent, {
|
|
440
|
+
side: "right",
|
|
441
|
+
className: `sm:max-w-xl ${REDUCED_MOTION}`,
|
|
442
|
+
showClose: wrapper,
|
|
443
|
+
"aria-modal": "true",
|
|
444
|
+
onPointerDownOutside: keepForPopover,
|
|
445
|
+
children: jsx(WrappedSheetContent, {
|
|
446
|
+
wrapper,
|
|
447
|
+
copy,
|
|
448
|
+
children
|
|
449
|
+
})
|
|
450
|
+
})
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/flows/overlay-heading.tsx
|
|
455
|
+
function useFocusOnMount(ref) {
|
|
456
|
+
useEffect(() => {
|
|
457
|
+
const heading = ref.current;
|
|
458
|
+
if (heading === null) return;
|
|
459
|
+
const active = document.activeElement;
|
|
460
|
+
if (active === document.body || active === heading.closest("[role=\"dialog\"]")) heading.focus();
|
|
461
|
+
}, [ref]);
|
|
462
|
+
}
|
|
463
|
+
function OwnTitleHeading({ label }) {
|
|
464
|
+
const ownTitle = useContext(OwnTitleContext);
|
|
465
|
+
const ref = useRef(null);
|
|
466
|
+
useFocusOnMount(ref);
|
|
467
|
+
const heading = jsx("h2", {
|
|
468
|
+
ref,
|
|
469
|
+
tabIndex: -1,
|
|
470
|
+
"data-buro-overlay-heading": "",
|
|
471
|
+
className: "text-lg font-semibold",
|
|
472
|
+
children: label
|
|
473
|
+
});
|
|
474
|
+
return ownTitle ? jsx(SheetPrimitive.Title, {
|
|
475
|
+
asChild: true,
|
|
476
|
+
children: heading
|
|
477
|
+
}) : heading;
|
|
478
|
+
}
|
|
479
|
+
//#endregion
|
|
259
480
|
//#region src/flows/load-runtime.tsx
|
|
260
481
|
function retrying(importer) {
|
|
261
482
|
let loading;
|
|
@@ -267,11 +488,11 @@ function retrying(importer) {
|
|
|
267
488
|
return loading;
|
|
268
489
|
};
|
|
269
490
|
}
|
|
270
|
-
const loadFlowRuntime = retrying(() => import("./flow-runtime-
|
|
271
|
-
const loadFlowScreen = retrying(() => import("./flow-screen-
|
|
272
|
-
const loadPageFlowRoute = retrying(() => import("./page-flow-route-
|
|
273
|
-
const loadInlineFlowHost = retrying(() => import("./inline-flow-host-
|
|
274
|
-
const loadBulkSummary = retrying(() => import("./bulk-summary-
|
|
491
|
+
const loadFlowRuntime = retrying(() => import("./flow-runtime-DyqTmK3H.js"));
|
|
492
|
+
const loadFlowScreen = retrying(() => import("./flow-screen-DCdli6Ha.js"));
|
|
493
|
+
const loadPageFlowRoute = retrying(() => import("./page-flow-route-BHUEpn0I.js"));
|
|
494
|
+
const loadInlineFlowHost = retrying(() => import("./inline-flow-host-C0rI9B7f.js"));
|
|
495
|
+
const loadBulkSummary = retrying(() => import("./bulk-summary-BWSAS7k2.js"));
|
|
275
496
|
function preloadFlowRuntime() {
|
|
276
497
|
loadFlowRuntime().catch(() => void 0);
|
|
277
498
|
}
|
|
@@ -312,8 +533,7 @@ var FlowBoundary = class extends Component {
|
|
|
312
533
|
}
|
|
313
534
|
};
|
|
314
535
|
function loadFailedText(t) {
|
|
315
|
-
|
|
316
|
-
return value === "block.failed" ? "This section could not be loaded." : value;
|
|
536
|
+
return t("block.failed", { defaultValue: "This section could not be loaded." });
|
|
317
537
|
}
|
|
318
538
|
function FailedRun({ onDone }) {
|
|
319
539
|
const t = useOptionalT();
|
|
@@ -354,31 +574,45 @@ function RuntimeBulkFlowRunner(props) {
|
|
|
354
574
|
children: jsx(Runner, { ...props })
|
|
355
575
|
});
|
|
356
576
|
}
|
|
357
|
-
function FlowLoadFailed({ onRetry }) {
|
|
577
|
+
function FlowLoadFailed({ label, onRetry }) {
|
|
358
578
|
const t = useOptionalT();
|
|
579
|
+
const chromeT = useChromeT();
|
|
359
580
|
const instance = useUIInstance();
|
|
360
|
-
const retryText =
|
|
361
|
-
const closeText = t("flow.close"
|
|
581
|
+
const retryText = chromeT("actions.retry", { defaultValue: "Retry" });
|
|
582
|
+
const closeText = t("flow.close", { defaultValue: "Close" });
|
|
362
583
|
return jsxs("div", {
|
|
363
584
|
role: "alert",
|
|
364
585
|
"data-buro-flow-load": "failed",
|
|
365
586
|
className: "flex flex-col gap-3 text-sm",
|
|
366
|
-
children: [
|
|
367
|
-
|
|
368
|
-
children:
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
587
|
+
children: [
|
|
588
|
+
label === void 0 ? null : jsx(OwnTitleHeading, { label }),
|
|
589
|
+
jsx("p", { children: loadFailedText(t) }),
|
|
590
|
+
jsxs("div", {
|
|
591
|
+
className: "flex justify-end gap-2",
|
|
592
|
+
children: [jsx(Button, {
|
|
593
|
+
type: "button",
|
|
594
|
+
variant: "ghost",
|
|
595
|
+
onClick: () => instance.dismiss(),
|
|
596
|
+
children: closeText
|
|
597
|
+
}), jsx(Button, {
|
|
598
|
+
type: "button",
|
|
599
|
+
onClick: onRetry,
|
|
600
|
+
children: retryText
|
|
601
|
+
})]
|
|
602
|
+
})
|
|
603
|
+
]
|
|
379
604
|
});
|
|
380
605
|
}
|
|
381
606
|
//#endregion
|
|
607
|
+
//#region src/lib/reason-text.ts
|
|
608
|
+
function reasonText(caps, reason, resource) {
|
|
609
|
+
if (reason === "") return reason;
|
|
610
|
+
return resolveContentSlot(caps, [reason], {
|
|
611
|
+
resource,
|
|
612
|
+
default: reason
|
|
613
|
+
}) ?? reason;
|
|
614
|
+
}
|
|
615
|
+
//#endregion
|
|
382
616
|
//#region src/actions/action-inner.tsx
|
|
383
617
|
function ActionInner({ icon, label }) {
|
|
384
618
|
return jsxs(Fragment$1, { children: [icon ? jsx(Icon, { name: icon }) : null, label] });
|
|
@@ -436,10 +670,6 @@ function withActionTooltip(control, label, compact, reason) {
|
|
|
436
670
|
}
|
|
437
671
|
//#endregion
|
|
438
672
|
//#region src/flows/chrome.ts
|
|
439
|
-
const text = (t, key, fallback, params) => {
|
|
440
|
-
const value = t(key, params === void 0 ? void 0 : { params });
|
|
441
|
-
return value === key ? fallback : value;
|
|
442
|
-
};
|
|
443
673
|
function findDeclared(def, name) {
|
|
444
674
|
const actions = def?.actions ?? {};
|
|
445
675
|
for (const place of [
|
|
@@ -453,15 +683,39 @@ function findDeclared(def, name) {
|
|
|
453
683
|
if (found !== void 0) return found;
|
|
454
684
|
}
|
|
455
685
|
}
|
|
686
|
+
function declaredFlow(app, resource, actionName) {
|
|
687
|
+
try {
|
|
688
|
+
return resource === "" ? app.registry.appActions.get(actionName) : findDeclared(app.registry.get(resource), actionName);
|
|
689
|
+
} catch {
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function useFlowDialogTexts(resource, actionName, labelText) {
|
|
694
|
+
const app = useApp();
|
|
695
|
+
const caps = useI18nCaps("");
|
|
696
|
+
const texts = declaredFlow(app, resource, actionName)?.texts;
|
|
697
|
+
const prefix = resource === "" ? `appActions.${actionName}` : `resources.${resource}.actions.${actionName}`;
|
|
698
|
+
const own = (path) => {
|
|
699
|
+
const key = `${prefix}.${path.join(".")}`;
|
|
700
|
+
return caps.has(key) ? caps.t(key) : textsValueAt(texts, path);
|
|
701
|
+
};
|
|
702
|
+
return {
|
|
703
|
+
confirmTitle: own(["confirm", "title"]) ?? labelText,
|
|
704
|
+
confirmProceed: own(["confirm", "proceed"]) ?? labelText,
|
|
705
|
+
dismiss: own(["dismiss"])
|
|
706
|
+
};
|
|
707
|
+
}
|
|
456
708
|
function useFlowChrome(resource, actionName, children) {
|
|
457
709
|
const app = useApp();
|
|
458
710
|
const declared = (resource === "" ? void 0 : findDeclared(app.registry.get(resource), actionName)) ?? {};
|
|
459
711
|
const label = useResolvedLabel(declared, actionName, children, resource);
|
|
712
|
+
const labelText = typeof label === "string" ? label : humanizeKey(actionName);
|
|
460
713
|
return {
|
|
461
714
|
label,
|
|
462
|
-
labelText
|
|
715
|
+
labelText,
|
|
463
716
|
icon: resolveActionIcon(declared, actionName),
|
|
464
|
-
destructive: declared.variant === "destructive"
|
|
717
|
+
destructive: declared.variant === "destructive",
|
|
718
|
+
...useFlowDialogTexts(resource, actionName, labelText)
|
|
465
719
|
};
|
|
466
720
|
}
|
|
467
721
|
//#endregion
|
|
@@ -573,14 +827,19 @@ function FlowControl(props) {
|
|
|
573
827
|
testId: `${testid}:info`
|
|
574
828
|
})] });
|
|
575
829
|
}
|
|
576
|
-
function FlowActionButton(
|
|
830
|
+
function FlowActionButton(input) {
|
|
831
|
+
const props = {
|
|
832
|
+
...input,
|
|
833
|
+
resource: routeResourceKey(input.resource)
|
|
834
|
+
};
|
|
577
835
|
const { resource, actionName, record, scope = "row", children } = props;
|
|
578
836
|
const control = useFlowRowResolver(resource)(actionName, record);
|
|
579
837
|
const chrome = useFlowChrome(resource, actionName, children);
|
|
580
838
|
const tid = useTestIds();
|
|
581
|
-
const
|
|
839
|
+
const app = useApp();
|
|
840
|
+
const testid = makeTestId(scope, resource, actionName, String(recordKeyOf(app.registry.get(resource), record) ?? ""), tid);
|
|
582
841
|
const [running, setRunning] = useState(false);
|
|
583
|
-
const runRecord = control.record ?? record;
|
|
842
|
+
const runRecord = useFlowRecord(resource, actionName, control.record ?? record);
|
|
584
843
|
const hosted = useHostedFlow(resource, actionName, runRecord, chrome.labelText);
|
|
585
844
|
const onRun = () => {
|
|
586
845
|
if (running) return;
|
|
@@ -612,6 +871,17 @@ function FlowActionButton(props) {
|
|
|
612
871
|
onClose: () => setRunning(false)
|
|
613
872
|
}) : null] });
|
|
614
873
|
}
|
|
874
|
+
function useFlowRecord(resource, actionName, record) {
|
|
875
|
+
const def = useApp().registry.get(resource);
|
|
876
|
+
const compiled = useMemo(() => {
|
|
877
|
+
try {
|
|
878
|
+
return def === void 0 ? null : compileFlow(def, actionName);
|
|
879
|
+
} catch {
|
|
880
|
+
return null;
|
|
881
|
+
}
|
|
882
|
+
}, [def, actionName]);
|
|
883
|
+
return compiled === null ? void 0 : flowRecordOf(compiled, record);
|
|
884
|
+
}
|
|
615
885
|
function useHostedFlow(resource, actionName, record, label) {
|
|
616
886
|
const app = useApp();
|
|
617
887
|
const def = app.registry.get(resource);
|
|
@@ -622,7 +892,7 @@ function useHostedFlow(resource, actionName, record, label) {
|
|
|
622
892
|
return null;
|
|
623
893
|
}
|
|
624
894
|
}, [def, actionName]);
|
|
625
|
-
const title = useProjectedTitle(resource, record
|
|
895
|
+
const title = useProjectedTitle(resource, recordKeyOf(def, record), record);
|
|
626
896
|
const presentFlow = usePresentFlow();
|
|
627
897
|
const hasHost = compiled?.hasHost === true;
|
|
628
898
|
const recordId = record?.[compiled?.idField ?? "id"] ?? record?.id;
|
|
@@ -651,8 +921,9 @@ function useHostedFlow(resource, actionName, record, label) {
|
|
|
651
921
|
function FlowMenuItem(props) {
|
|
652
922
|
const chrome = useFlowChrome(props.resource, props.actionName);
|
|
653
923
|
const tid = useTestIds();
|
|
654
|
-
const
|
|
655
|
-
const
|
|
924
|
+
const def = useApp().registry.get(props.resource);
|
|
925
|
+
const testid = makeTestId(props.scope, props.resource, props.actionName, String(recordKeyOf(def, props.record) ?? ""), tid);
|
|
926
|
+
const runRecord = useFlowRecord(props.resource, props.actionName, props.control.record ?? props.record);
|
|
656
927
|
const hosted = useHostedFlow(props.resource, props.actionName, runRecord, chrome.labelText);
|
|
657
928
|
return jsx(FlowControl, {
|
|
658
929
|
state: conjoinHostPage(props.control.state, hosted.hostPage),
|
|
@@ -706,7 +977,7 @@ function listSlot(region, resource) {
|
|
|
706
977
|
return `list.${region}.${canonicalResourceName(resource)}`;
|
|
707
978
|
}
|
|
708
979
|
function useListSlot(region, resource) {
|
|
709
|
-
return useComponent(listSlot(region, resource));
|
|
980
|
+
return useComponent(listSlot(region, routeResourceKey(resource)));
|
|
710
981
|
}
|
|
711
982
|
//#endregion
|
|
712
983
|
//#region src/actions/builtin-edit-route.ts
|
|
@@ -755,12 +1026,10 @@ function useBuiltinEditRoute(action, resource, recordId) {
|
|
|
755
1026
|
}
|
|
756
1027
|
//#endregion
|
|
757
1028
|
//#region src/actions/action-button.tsx
|
|
758
|
-
function DisabledAction({ reason, label, icon, testid, size, variant, className, asMenuItem, resource, density = "regular", actionName, surface }) {
|
|
1029
|
+
function DisabledAction({ reason, label, icon, testid, size, variant, className, asMenuItem, resource: resourceInput, density = "regular", actionName, surface }) {
|
|
1030
|
+
const resource = resourceInput === void 0 ? void 0 : routeResourceKey(resourceInput);
|
|
759
1031
|
const i18nCaps = useI18nCaps(resource);
|
|
760
|
-
const text = reason ? resolveContentSlot(i18nCaps, [
|
|
761
|
-
resource,
|
|
762
|
-
default: reason
|
|
763
|
-
}) : resolveContentSlot(i18nCaps, ["availability.denied"], {
|
|
1032
|
+
const text = reason ? reasonText(i18nCaps, reason, resource) : resolveContentSlot(i18nCaps, ["availability.denied"], {
|
|
764
1033
|
resource,
|
|
765
1034
|
default: "This action isn't available"
|
|
766
1035
|
});
|
|
@@ -769,15 +1038,24 @@ function DisabledAction({ reason, label, icon, testid, size, variant, className,
|
|
|
769
1038
|
e.stopPropagation();
|
|
770
1039
|
toast(text);
|
|
771
1040
|
};
|
|
1041
|
+
const reasonId = useId();
|
|
772
1042
|
if (asMenuItem) return jsx(DropdownMenuItem, {
|
|
773
1043
|
"aria-disabled": "true",
|
|
1044
|
+
"aria-describedby": reasonId,
|
|
774
1045
|
"data-testid": testid,
|
|
775
1046
|
onSelect: (e) => e.preventDefault(),
|
|
776
1047
|
onClick,
|
|
777
1048
|
className: "opacity-60",
|
|
778
1049
|
children: jsx(ActionInner, {
|
|
779
1050
|
icon,
|
|
780
|
-
label
|
|
1051
|
+
label: jsxs("span", {
|
|
1052
|
+
className: "flex min-w-0 flex-col",
|
|
1053
|
+
children: [jsx("span", { children: label }), jsx("span", {
|
|
1054
|
+
id: reasonId,
|
|
1055
|
+
className: "text-xs text-muted-foreground",
|
|
1056
|
+
children: text
|
|
1057
|
+
})]
|
|
1058
|
+
})
|
|
781
1059
|
})
|
|
782
1060
|
});
|
|
783
1061
|
const chrome = resolveControlChrome({
|
|
@@ -841,36 +1119,41 @@ function actionResourceHandle(resource) {
|
|
|
841
1119
|
ref: normalizeEntityRef(resource)
|
|
842
1120
|
};
|
|
843
1121
|
}
|
|
844
|
-
function ActionButton(
|
|
1122
|
+
function ActionButton(input) {
|
|
1123
|
+
const { sources, ...rest } = input;
|
|
1124
|
+
const props = {
|
|
1125
|
+
...rest,
|
|
1126
|
+
resource: routeResourceKey(input.resource)
|
|
1127
|
+
};
|
|
845
1128
|
const def = useApp().registry.get(props.resource);
|
|
846
1129
|
const scope = props.scope ?? "row";
|
|
847
|
-
const
|
|
848
|
-
const
|
|
1130
|
+
const resolveAvailability = useAvailabilityResolver(props.resource, modeForSurface(scope));
|
|
1131
|
+
const itemAction = findAction(def?.actions?.item, props.actionName);
|
|
1132
|
+
const action = itemAction ?? findAction(def?.actions?.resource, props.actionName);
|
|
1133
|
+
const record = itemAction === void 0 ? void 0 : props.record;
|
|
1134
|
+
const availability = resolveAvailability(props.actionName, record);
|
|
1135
|
+
const whenSources = useActionWhenSources({
|
|
1136
|
+
resource: props.resource,
|
|
1137
|
+
record
|
|
1138
|
+
});
|
|
849
1139
|
if (!action) return null;
|
|
850
1140
|
if (isFlowAction(action)) return jsx(FlowActionButton, { ...props });
|
|
851
1141
|
if (availability.state === "absent" || availability.state === "hidden") return null;
|
|
852
|
-
if (!actionWhenHolds(action,
|
|
1142
|
+
if (!actionWhenHolds(action, actionWhenSources(whenSources, sources))) return null;
|
|
853
1143
|
if (action.kind === "link") return jsx(LinkActionButton, {
|
|
854
1144
|
...props,
|
|
1145
|
+
record,
|
|
855
1146
|
action,
|
|
856
1147
|
availability
|
|
857
1148
|
});
|
|
858
1149
|
if (action.kind === "modal") return jsx(ModalActionButton, {
|
|
859
1150
|
...props,
|
|
1151
|
+
record,
|
|
860
1152
|
action,
|
|
861
1153
|
availability
|
|
862
1154
|
});
|
|
863
1155
|
return null;
|
|
864
1156
|
}
|
|
865
|
-
function actionWhenHolds(action, record) {
|
|
866
|
-
const when = action.when;
|
|
867
|
-
if (when === void 0) return true;
|
|
868
|
-
return evaluateCondition(when, record === void 0 ? {} : { record: {
|
|
869
|
-
status: "ready",
|
|
870
|
-
value: record,
|
|
871
|
-
refreshing: false
|
|
872
|
-
} }, { mode: "show" }) === true;
|
|
873
|
-
}
|
|
874
1157
|
function presentModalAction(args) {
|
|
875
1158
|
const { present, action, resource, actionName, record, recordId, label } = args;
|
|
876
1159
|
const result = present({
|
|
@@ -898,17 +1181,20 @@ const reportedDeadRoutes = new Set();
|
|
|
898
1181
|
function deadRecordRoute(registry, action, to) {
|
|
899
1182
|
if (isBuiltinItemAction(action) || to === null || typeof to !== "object") return null;
|
|
900
1183
|
const target = to;
|
|
901
|
-
if (typeof target.resource !== "string") return null;
|
|
902
1184
|
if (target.action !== "show" && target.action !== "edit" && target.action !== "create") return null;
|
|
1185
|
+
let resource;
|
|
903
1186
|
let def;
|
|
904
1187
|
try {
|
|
905
|
-
|
|
1188
|
+
if (typeof target.resource === "string") resource = target.resource;
|
|
1189
|
+
else if (target.resource !== null && typeof target.resource === "object") resource = routeResourceKey(target.resource);
|
|
1190
|
+
else return null;
|
|
1191
|
+
def = registry.get(resource);
|
|
906
1192
|
} catch {
|
|
907
1193
|
return null;
|
|
908
1194
|
}
|
|
909
1195
|
if (def === void 0 || hasRecordPage(def, target.action)) return null;
|
|
910
1196
|
return {
|
|
911
|
-
resource
|
|
1197
|
+
resource,
|
|
912
1198
|
action: target.action
|
|
913
1199
|
};
|
|
914
1200
|
}
|
|
@@ -926,7 +1212,7 @@ function LinkActionButton({ resource, actionName, record, scope = "row", variant
|
|
|
926
1212
|
const safeRecord = record ?? { id: "" };
|
|
927
1213
|
const isDestructive = action.variant === "destructive";
|
|
928
1214
|
const buttonVariant = variant ?? (isDestructive ? "destructive" : "outline");
|
|
929
|
-
const recordId = record
|
|
1215
|
+
const recordId = String(recordKeyOf(app.registry.get(resource), record) ?? "");
|
|
930
1216
|
const testid = makeTestId(scope, resource, actionName, recordId, tid);
|
|
931
1217
|
const label = useResolvedLabel(action, actionName, children, resource);
|
|
932
1218
|
const editRoute = useBuiltinEditRoute(action, resource, recordId);
|
|
@@ -1032,11 +1318,12 @@ function LinkActionButton({ resource, actionName, record, scope = "row", variant
|
|
|
1032
1318
|
}
|
|
1033
1319
|
function ModalActionButton({ resource, actionName, record, scope = "row", variant, size, density, className, children, asMenuItem, action, availability }) {
|
|
1034
1320
|
const tid = useTestIds();
|
|
1321
|
+
const app = useApp();
|
|
1035
1322
|
const present = usePresentBlock();
|
|
1036
1323
|
const safeRecord = record ?? { id: "" };
|
|
1037
1324
|
const isDestructive = action.variant === "destructive";
|
|
1038
1325
|
const buttonVariant = variant ?? (isDestructive ? "destructive" : "outline");
|
|
1039
|
-
const recordId = record
|
|
1326
|
+
const recordId = String(recordKeyOf(app.registry.get(resource), record) ?? "");
|
|
1040
1327
|
const testid = makeTestId(scope, resource, actionName, recordId, tid);
|
|
1041
1328
|
const label = useResolvedLabel(action, actionName, children, resource);
|
|
1042
1329
|
if (availability.state === "disabled") return jsx(DisabledAction, {
|
|
@@ -1096,33 +1383,34 @@ function ModalActionButton({ resource, actionName, record, scope = "row", varian
|
|
|
1096
1383
|
}
|
|
1097
1384
|
//#endregion
|
|
1098
1385
|
//#region src/checks/check-confirm-dialog.tsx
|
|
1099
|
-
function
|
|
1100
|
-
const
|
|
1386
|
+
function issueText(issue, t, caps, resource) {
|
|
1387
|
+
const params = issue.message.params;
|
|
1388
|
+
const checkId = issue.check?.id;
|
|
1389
|
+
const ownCheck = checkId !== void 0 && issue.message.key === `checks.${checkId}`;
|
|
1390
|
+
const declared = typeof issue.message.default === "string" ? issue.message.default : ownCheck ? void 0 : issue.message.key;
|
|
1391
|
+
if (issue.message.params?.resolved === true) return declared ?? issue.message.key;
|
|
1392
|
+
if (!ownCheck) return t(issue.message.key, {
|
|
1393
|
+
defaultValue: declared ?? "",
|
|
1101
1394
|
params,
|
|
1102
1395
|
...resource === void 0 ? {} : { resource }
|
|
1103
1396
|
});
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
const ownCheck = typeof checkId === "string" && issue.message.key === `checks.${checkId}`;
|
|
1110
|
-
const declared = typeof issue.message.default === "string" ? issue.message.default : ownCheck ? void 0 : issue.message.key;
|
|
1111
|
-
if (issue.params?.resolved === true) return declared ?? issue.message.key;
|
|
1112
|
-
if (!ownCheck) return translateOrFallback(t, issue.message.key, declared ?? "", params, resource);
|
|
1113
|
-
const miss = "\0";
|
|
1114
|
-
const bundled = [`${issue.message.key}.message`, issue.message.key].map((key) => translateOrFallback(t, key, miss, params, resource)).find((text) => text !== miss);
|
|
1115
|
-
if (bundled !== void 0) return bundled;
|
|
1397
|
+
const entryKey = [`${issue.message.key}.message`, issue.message.key].find((key) => caps.has(key, { resource }));
|
|
1398
|
+
if (entryKey !== void 0) return caps.t(entryKey, {
|
|
1399
|
+
resource,
|
|
1400
|
+
params
|
|
1401
|
+
});
|
|
1116
1402
|
if (declared !== void 0) return declared;
|
|
1117
1403
|
const name = String(params?.name ?? checkId);
|
|
1118
|
-
return
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1404
|
+
return t(FRAMEWORK_TEXT_KEYS.checkFailed, {
|
|
1405
|
+
defaultValue: checkFailedDefault(name),
|
|
1406
|
+
params: {
|
|
1407
|
+
...params,
|
|
1408
|
+
name
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1122
1411
|
}
|
|
1123
1412
|
function checkIdOf(issue, index) {
|
|
1124
|
-
|
|
1125
|
-
return typeof id === "string" ? id : `${index}`;
|
|
1413
|
+
return issue.check?.id ?? `${index}`;
|
|
1126
1414
|
}
|
|
1127
1415
|
const SEVERITY_CLASSNAME = {
|
|
1128
1416
|
error: "text-destructive",
|
|
@@ -1131,11 +1419,12 @@ const SEVERITY_CLASSNAME = {
|
|
|
1131
1419
|
};
|
|
1132
1420
|
function ChecksList({ issues, testid, onRowClick, resource }) {
|
|
1133
1421
|
const t = useOptionalT();
|
|
1422
|
+
const caps = useI18nCaps(resource);
|
|
1134
1423
|
return issues.map((issue, index) => {
|
|
1135
1424
|
const checkId = checkIdOf(issue, index);
|
|
1136
1425
|
const anchor = issue.path[0];
|
|
1137
1426
|
const anchorable = typeof anchor === "string";
|
|
1138
|
-
const text = issueText(issue, t, resource);
|
|
1427
|
+
const text = issueText(issue, t, caps, resource);
|
|
1139
1428
|
const className = cn("text-sm", SEVERITY_CLASSNAME[issue.severity]);
|
|
1140
1429
|
return anchorable ? jsx("li", { children: jsx("button", {
|
|
1141
1430
|
type: "button",
|
|
@@ -1150,15 +1439,11 @@ function ChecksList({ issues, testid, onRowClick, resource }) {
|
|
|
1150
1439
|
}, `${checkId}-${index}`);
|
|
1151
1440
|
});
|
|
1152
1441
|
}
|
|
1153
|
-
function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel, tone }) {
|
|
1154
|
-
const
|
|
1442
|
+
function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel, cancelLabel, tone }) {
|
|
1443
|
+
const chromeT = useChromeT();
|
|
1155
1444
|
const { resource, open, busy, header, blockers, confirmable, proceed, cancel } = state;
|
|
1156
1445
|
const blocked = blockers.length > 0;
|
|
1157
|
-
const
|
|
1158
|
-
const heading = title ?? t("checks.dialogTitle", {
|
|
1159
|
-
defaultValue: "Please review",
|
|
1160
|
-
...bound
|
|
1161
|
-
});
|
|
1446
|
+
const heading = title ?? chromeT("checks.dialogTitle", { defaultValue: "Please review" });
|
|
1162
1447
|
const restoreFocusRef = useRef(null);
|
|
1163
1448
|
useEffect(() => {
|
|
1164
1449
|
if (typeof document === "undefined") return;
|
|
@@ -1195,10 +1480,7 @@ function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel,
|
|
|
1195
1480
|
children: [
|
|
1196
1481
|
blocked && jsx("li", {
|
|
1197
1482
|
className: "text-xs font-semibold uppercase tracking-wider text-destructive",
|
|
1198
|
-
children:
|
|
1199
|
-
defaultValue: "Cannot continue",
|
|
1200
|
-
...bound
|
|
1201
|
-
})
|
|
1483
|
+
children: chromeT("checks.blocked", { defaultValue: "Cannot continue" })
|
|
1202
1484
|
}),
|
|
1203
1485
|
jsx(ChecksList, {
|
|
1204
1486
|
issues: blockers,
|
|
@@ -1220,26 +1502,20 @@ function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel,
|
|
|
1220
1502
|
onClick: cancel,
|
|
1221
1503
|
"data-testid": `${testid}:cancel`,
|
|
1222
1504
|
disabled: busy,
|
|
1223
|
-
children:
|
|
1224
|
-
defaultValue: "Go back",
|
|
1225
|
-
...bound
|
|
1226
|
-
})
|
|
1505
|
+
children: cancelLabel ?? chromeT("checks.back", { defaultValue: "Go back" })
|
|
1227
1506
|
}), !blocked && jsx(Button, {
|
|
1228
1507
|
type: "button",
|
|
1229
1508
|
variant: tone === "destructive" ? "destructive" : "default",
|
|
1230
1509
|
onClick: proceed,
|
|
1231
1510
|
"data-testid": `${testid}:proceed`,
|
|
1232
1511
|
disabled: busy,
|
|
1233
|
-
children: proceedLabel ??
|
|
1234
|
-
defaultValue: "Continue anyway",
|
|
1235
|
-
...bound
|
|
1236
|
-
})
|
|
1512
|
+
children: proceedLabel ?? chromeT("checks.proceed", { defaultValue: "Continue anyway" })
|
|
1237
1513
|
})] })
|
|
1238
1514
|
]
|
|
1239
1515
|
})
|
|
1240
1516
|
});
|
|
1241
1517
|
}
|
|
1242
1518
|
//#endregion
|
|
1243
|
-
export {
|
|
1519
|
+
export { Tooltip as $, OwnTitleHeading as A, DropdownMenuContent as B, loadBulkSummary as C, loadPageFlowRoute as D, loadInlineFlowHost as E, Icon as F, DropdownMenuRadioGroup as G, DropdownMenuItem as H, hasIcon as I, DropdownMenuShortcut as J, DropdownMenuRadioItem as K, registerIcons as L, DialogPresentationShell as M, OwnTitleContext as N, preloadFlowRuntime as O, SheetPresentationShell as P, DropdownMenuTrigger as Q, DropdownMenu as R, RuntimeFlowRunner as S, loadFlowScreen as T, DropdownMenuLabel as U, DropdownMenuGroup as V, DropdownMenuPortal as W, DropdownMenuSubContent as X, DropdownMenuSub as Y, DropdownMenuSubTrigger as Z, reasonText as _, modeForSurface as a, SheetContent as at, RuntimeAppFlowRunner as b, useListSlot as c, SheetHeader as ct, useToBrowserHref as d, DocInfo as dt, TooltipContent as et, FlowActionButton as f, ActionInner as g, useFlowDialogTexts as h, makeTestId as i, SheetClose as it, useFocusOnMount as j, useLoaded as k, isExternalHref as l, SheetTitle as lt, useFlowChrome as m, ActionButton as n, TooltipTrigger as nt, canonicalResourceName as o, SheetDescription as ot, FlowMenuItem as p, DropdownMenuSeparator as q, DisabledAction as r, Sheet as rt, listSlot as s, SheetFooter as st, CheckConfirmDialog as t, TooltipProvider as tt, openExternal as u, SheetTrigger as ut, FlowBoundary as v, loadFailedText as w, RuntimeBulkFlowRunner as x, FlowLoadFailed as y, DropdownMenuCheckboxItem as z };
|
|
1244
1520
|
|
|
1245
|
-
//# sourceMappingURL=check-confirm-dialog-
|
|
1521
|
+
//# sourceMappingURL=check-confirm-dialog-2j0gOd7x.js.map
|