@burojs/ui-shadcn 0.5.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-CS_JZ4Fd.js +31 -0
- package/dist/candidates-relation-picker-CS_JZ4Fd.js.map +1 -0
- package/dist/candidates-relation-picker-y5M6_oe4.cjs +31 -0
- package/dist/candidates-relation-picker-y5M6_oe4.cjs.map +1 -0
- package/dist/{check-confirm-dialog-CkaVTPT9.js → check-confirm-dialog-2j0gOd7x.js} +392 -103
- package/dist/check-confirm-dialog-2j0gOd7x.js.map +1 -0
- package/dist/{check-confirm-dialog-BRByTFpg.cjs → check-confirm-dialog-C-NHgMST.cjs} +476 -102
- 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-B3mZFL-K.cjs → filter-builder-DFu0JP-1.cjs} +959 -128
- package/dist/filter-builder-DFu0JP-1.cjs.map +1 -0
- package/dist/{filter-builder-DOnaXNfP.js → filter-builder-DaWHUZuV.js} +863 -116
- package/dist/filter-builder-DaWHUZuV.js.map +1 -0
- package/dist/{flow-runtime-B6zOHYqI.cjs → flow-runtime-BpmrIUb6.cjs} +61 -29
- package/dist/flow-runtime-BpmrIUb6.cjs.map +1 -0
- package/dist/{flow-runtime-D8h99FSg.js → flow-runtime-DyqTmK3H.js} +62 -30
- package/dist/flow-runtime-DyqTmK3H.js.map +1 -0
- package/dist/{flow-screen-CX05b3G9.cjs → flow-screen-Bcz9NF2V.cjs} +132 -88
- package/dist/flow-screen-Bcz9NF2V.cjs.map +1 -0
- package/dist/{flow-screen-CmbARSqg.js → flow-screen-DCdli6Ha.js} +132 -88
- package/dist/flow-screen-DCdli6Ha.js.map +1 -0
- package/dist/index.cjs +951 -605
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +618 -332
- package/dist/index.d.ts +618 -332
- package/dist/index.js +863 -522
- package/dist/index.js.map +1 -1
- package/dist/{inline-flow-host-B7U1OJUe.cjs → inline-flow-host-3vw7LzzD.cjs} +5 -5
- package/dist/inline-flow-host-3vw7LzzD.cjs.map +1 -0
- package/dist/{inline-flow-host-C3H2UpSA.js → inline-flow-host-C0rI9B7f.js} +5 -5
- package/dist/inline-flow-host-C0rI9B7f.js.map +1 -0
- package/dist/label-66W1qbke.js.map +1 -1
- package/dist/label-w6JYf2cF.cjs.map +1 -1
- package/dist/lazy-relation-picker-dialog-Bt8lrEIu.cjs +153 -0
- package/dist/lazy-relation-picker-dialog-Bt8lrEIu.cjs.map +1 -0
- package/dist/lazy-relation-picker-dialog-CAScLPb2.js +135 -0
- package/dist/lazy-relation-picker-dialog-CAScLPb2.js.map +1 -0
- package/dist/markdown/index.d.cts +2 -3
- package/dist/markdown/index.d.ts +2 -3
- package/dist/{page-flow-route-CyXSvXSE.js → page-flow-route-BHUEpn0I.js} +36 -23
- package/dist/page-flow-route-BHUEpn0I.js.map +1 -0
- package/dist/{page-flow-route-CQ7HsbBm.cjs → page-flow-route-DS8IVTVH.cjs} +41 -28
- package/dist/page-flow-route-DS8IVTVH.cjs.map +1 -0
- package/dist/{place-node-SIp4XYQH.cjs → place-node-CNb3w-c7.cjs} +2227 -999
- package/dist/place-node-CNb3w-c7.cjs.map +1 -0
- package/dist/{place-node--GdsP688.js → place-node-CfzQvh4Y.js} +2164 -984
- package/dist/place-node-CfzQvh4Y.js.map +1 -0
- package/dist/{related-list-cards-B6x9HQQp.js → related-list-cards-BIqqY69Y.js} +9 -4
- package/dist/{related-list-cards-B6x9HQQp.js.map → related-list-cards-BIqqY69Y.js.map} +1 -1
- package/dist/{related-list-cards-nxuODlIA.cjs → related-list-cards-CelMxl4q.cjs} +9 -4
- package/dist/{related-list-cards-nxuODlIA.cjs.map → related-list-cards-CelMxl4q.cjs.map} +1 -1
- package/dist/{related-list-timeline-DEdfd-rr.js → related-list-timeline-CRh7xwLD.js} +6 -7
- package/dist/related-list-timeline-CRh7xwLD.js.map +1 -0
- package/dist/{related-list-timeline-BYJKEbmA.cjs → related-list-timeline-DsLdi8sv.cjs} +5 -6
- package/dist/related-list-timeline-DsLdi8sv.cjs.map +1 -0
- package/dist/{related-rows-B4levHcR.js → related-rows--uP2iKQC.js} +27 -17
- package/dist/related-rows--uP2iKQC.js.map +1 -0
- package/dist/{related-rows-zh5f_4QR.cjs → related-rows-MPnLCmPF.cjs} +32 -22
- package/dist/related-rows-MPnLCmPF.cjs.map +1 -0
- package/dist/{search-access-CURsWn-U.js → relation-create-C43cdPQt.js} +596 -29
- package/dist/relation-create-C43cdPQt.js.map +1 -0
- package/dist/{search-access-B7G5oR8n.cjs → relation-create-DDEYcKfw.cjs} +630 -32
- package/dist/relation-create-DDEYcKfw.cjs.map +1 -0
- package/dist/{relation-many-picker-gdAOD-qK.js → relation-many-picker-BJhaEqxz.js} +210 -107
- package/dist/relation-many-picker-BJhaEqxz.js.map +1 -0
- package/dist/{relation-many-picker-B-NCEUgX.cjs → relation-many-picker-DzuGJpEl.cjs} +218 -115
- package/dist/relation-many-picker-DzuGJpEl.cjs.map +1 -0
- package/dist/{relation-picker-BAY77ivO.js → relation-picker-D-tBBZW_.js} +40 -45
- package/dist/relation-picker-D-tBBZW_.js.map +1 -0
- package/dist/{relation-picker-Da_uhFvA.cjs → relation-picker-DaIMzf2H.cjs} +45 -50
- package/dist/relation-picker-DaIMzf2H.cjs.map +1 -0
- package/dist/{relation-picker-dialog-M0pQaWlp.cjs → relation-picker-dialog-9Vg5vvR1.cjs} +142 -40
- package/dist/relation-picker-dialog-9Vg5vvR1.cjs.map +1 -0
- package/dist/{relation-picker-dialog-hA9rYrZB.js → relation-picker-dialog-DoEY8EkH.js} +143 -41
- 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-OSQyRA5b.cjs → resource-page-router-C_kGW2o_.cjs} +552 -303
- package/dist/resource-page-router-C_kGW2o_.cjs.map +1 -0
- package/dist/{resource-page-router-T4vS5gbJ.js → resource-page-router-Diw6S6TK.js} +507 -258
- 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-C7CiYA4Z.cjs → toaster-BbByOytP.cjs} +72 -80
- package/dist/toaster-BbByOytP.cjs.map +1 -0
- package/dist/{toaster-CfCRLgR-.js → toaster-Ct_YHGs6.js} +66 -68
- package/dist/toaster-Ct_YHGs6.js.map +1 -0
- package/dist/{use-dialog-filter-state-BDcgS5Oz.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-BBCC0OEK.cjs → use-dialog-filter-state-tNvqAAjh.cjs} +6 -5
- package/dist/use-dialog-filter-state-tNvqAAjh.cjs.map +1 -0
- package/dist/use-theme-DFlpXils.cjs.map +1 -1
- package/dist/use-theme-dnE3Od3I.js.map +1 -1
- 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-CX2PBu6l.js +0 -63
- package/dist/candidates-gate-CX2PBu6l.js.map +0 -1
- package/dist/candidates-gate-DiFI52r7.cjs +0 -70
- package/dist/candidates-gate-DiFI52r7.cjs.map +0 -1
- package/dist/candidates-relation-picker-CBsVcnPR.js +0 -82
- package/dist/candidates-relation-picker-CBsVcnPR.js.map +0 -1
- package/dist/candidates-relation-picker-Dd_GVLlu.cjs +0 -84
- package/dist/candidates-relation-picker-Dd_GVLlu.cjs.map +0 -1
- package/dist/check-confirm-dialog-BRByTFpg.cjs.map +0 -1
- package/dist/check-confirm-dialog-CkaVTPT9.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-B3mZFL-K.cjs.map +0 -1
- package/dist/filter-builder-DOnaXNfP.js.map +0 -1
- package/dist/flow-runtime-B6zOHYqI.cjs.map +0 -1
- package/dist/flow-runtime-D8h99FSg.js.map +0 -1
- package/dist/flow-screen-CX05b3G9.cjs.map +0 -1
- package/dist/flow-screen-CmbARSqg.js.map +0 -1
- package/dist/inline-flow-host-B7U1OJUe.cjs.map +0 -1
- package/dist/inline-flow-host-C3H2UpSA.js.map +0 -1
- package/dist/lazy-relation-picker-dialog-2oxnA6IR.js +0 -14
- package/dist/lazy-relation-picker-dialog-2oxnA6IR.js.map +0 -1
- package/dist/lazy-relation-picker-dialog-BfAGKzUG.cjs +0 -19
- package/dist/lazy-relation-picker-dialog-BfAGKzUG.cjs.map +0 -1
- package/dist/page-flow-route-CQ7HsbBm.cjs.map +0 -1
- package/dist/page-flow-route-CyXSvXSE.js.map +0 -1
- package/dist/peek-filter-CnqHwTMU.cjs +0 -51
- package/dist/peek-filter-CnqHwTMU.cjs.map +0 -1
- package/dist/peek-filter-ErLfO153.js +0 -28
- package/dist/peek-filter-ErLfO153.js.map +0 -1
- package/dist/place-node--GdsP688.js.map +0 -1
- package/dist/place-node-SIp4XYQH.cjs.map +0 -1
- package/dist/related-list-timeline-BYJKEbmA.cjs.map +0 -1
- package/dist/related-list-timeline-DEdfd-rr.js.map +0 -1
- package/dist/related-rows-B4levHcR.js.map +0 -1
- package/dist/related-rows-zh5f_4QR.cjs.map +0 -1
- package/dist/relation-create-BOaUe12G.cjs +0 -362
- package/dist/relation-create-BOaUe12G.cjs.map +0 -1
- package/dist/relation-create-Bg-eEJLs.js +0 -337
- package/dist/relation-create-Bg-eEJLs.js.map +0 -1
- package/dist/relation-many-picker-B-NCEUgX.cjs.map +0 -1
- package/dist/relation-many-picker-gdAOD-qK.js.map +0 -1
- package/dist/relation-picker-BAY77ivO.js.map +0 -1
- package/dist/relation-picker-Da_uhFvA.cjs.map +0 -1
- package/dist/relation-picker-dialog-M0pQaWlp.cjs.map +0 -1
- package/dist/relation-picker-dialog-hA9rYrZB.js.map +0 -1
- package/dist/resource-page-router-OSQyRA5b.cjs.map +0 -1
- package/dist/resource-page-router-T4vS5gbJ.js.map +0 -1
- package/dist/search-access-B7G5oR8n.cjs.map +0 -1
- package/dist/search-access-CURsWn-U.js.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-C7CiYA4Z.cjs.map +0 -1
- package/dist/toaster-CfCRLgR-.js.map +0 -1
- package/dist/use-dialog-filter-state-BBCC0OEK.cjs.map +0 -1
- package/dist/use-dialog-filter-state-BDcgS5Oz.js.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 { canonicalEntityNodeKey, compileFlow, 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({
|
|
@@ -821,11 +1099,12 @@ function useResolvedLabel(action, actionName, children, resource) {
|
|
|
821
1099
|
if (children != null) return children;
|
|
822
1100
|
const raw = `actions.${actionName}`;
|
|
823
1101
|
const own = `resources.${resource}.${raw}`;
|
|
824
|
-
|
|
825
|
-
if (
|
|
826
|
-
|
|
827
|
-
if (
|
|
828
|
-
|
|
1102
|
+
const ownLabel = resolveContentSlot(caps, [[`${own}.label`, own]]);
|
|
1103
|
+
if (ownLabel !== void 0) return ownLabel;
|
|
1104
|
+
const declared = declaredText(action.kind === "flow" ? "flow" : "action", action, "label");
|
|
1105
|
+
if (declared !== void 0) return declared;
|
|
1106
|
+
const sharedLabel = resolveContentSlot(caps, [[`${raw}.label`, raw]]);
|
|
1107
|
+
if (sharedLabel !== void 0) return sharedLabel;
|
|
829
1108
|
const camel = `actions.${camelizeActionName(actionName)}`;
|
|
830
1109
|
if (caps.has(camel)) return caps.t(camel);
|
|
831
1110
|
return humanizeKey(actionName);
|
|
@@ -840,36 +1119,41 @@ function actionResourceHandle(resource) {
|
|
|
840
1119
|
ref: normalizeEntityRef(resource)
|
|
841
1120
|
};
|
|
842
1121
|
}
|
|
843
|
-
function ActionButton(
|
|
1122
|
+
function ActionButton(input) {
|
|
1123
|
+
const { sources, ...rest } = input;
|
|
1124
|
+
const props = {
|
|
1125
|
+
...rest,
|
|
1126
|
+
resource: routeResourceKey(input.resource)
|
|
1127
|
+
};
|
|
844
1128
|
const def = useApp().registry.get(props.resource);
|
|
845
1129
|
const scope = props.scope ?? "row";
|
|
846
|
-
const
|
|
847
|
-
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
|
+
});
|
|
848
1139
|
if (!action) return null;
|
|
849
1140
|
if (isFlowAction(action)) return jsx(FlowActionButton, { ...props });
|
|
850
1141
|
if (availability.state === "absent" || availability.state === "hidden") return null;
|
|
851
|
-
if (!actionWhenHolds(action,
|
|
1142
|
+
if (!actionWhenHolds(action, actionWhenSources(whenSources, sources))) return null;
|
|
852
1143
|
if (action.kind === "link") return jsx(LinkActionButton, {
|
|
853
1144
|
...props,
|
|
1145
|
+
record,
|
|
854
1146
|
action,
|
|
855
1147
|
availability
|
|
856
1148
|
});
|
|
857
1149
|
if (action.kind === "modal") return jsx(ModalActionButton, {
|
|
858
1150
|
...props,
|
|
1151
|
+
record,
|
|
859
1152
|
action,
|
|
860
1153
|
availability
|
|
861
1154
|
});
|
|
862
1155
|
return null;
|
|
863
1156
|
}
|
|
864
|
-
function actionWhenHolds(action, record) {
|
|
865
|
-
const when = action.when;
|
|
866
|
-
if (when === void 0) return true;
|
|
867
|
-
return evaluateCondition(when, record === void 0 ? {} : { record: {
|
|
868
|
-
status: "ready",
|
|
869
|
-
value: record,
|
|
870
|
-
refreshing: false
|
|
871
|
-
} }, { mode: "show" }) === true;
|
|
872
|
-
}
|
|
873
1157
|
function presentModalAction(args) {
|
|
874
1158
|
const { present, action, resource, actionName, record, recordId, label } = args;
|
|
875
1159
|
const result = present({
|
|
@@ -897,17 +1181,20 @@ const reportedDeadRoutes = new Set();
|
|
|
897
1181
|
function deadRecordRoute(registry, action, to) {
|
|
898
1182
|
if (isBuiltinItemAction(action) || to === null || typeof to !== "object") return null;
|
|
899
1183
|
const target = to;
|
|
900
|
-
if (typeof target.resource !== "string") return null;
|
|
901
1184
|
if (target.action !== "show" && target.action !== "edit" && target.action !== "create") return null;
|
|
1185
|
+
let resource;
|
|
902
1186
|
let def;
|
|
903
1187
|
try {
|
|
904
|
-
|
|
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);
|
|
905
1192
|
} catch {
|
|
906
1193
|
return null;
|
|
907
1194
|
}
|
|
908
1195
|
if (def === void 0 || hasRecordPage(def, target.action)) return null;
|
|
909
1196
|
return {
|
|
910
|
-
resource
|
|
1197
|
+
resource,
|
|
911
1198
|
action: target.action
|
|
912
1199
|
};
|
|
913
1200
|
}
|
|
@@ -925,7 +1212,7 @@ function LinkActionButton({ resource, actionName, record, scope = "row", variant
|
|
|
925
1212
|
const safeRecord = record ?? { id: "" };
|
|
926
1213
|
const isDestructive = action.variant === "destructive";
|
|
927
1214
|
const buttonVariant = variant ?? (isDestructive ? "destructive" : "outline");
|
|
928
|
-
const recordId = record
|
|
1215
|
+
const recordId = String(recordKeyOf(app.registry.get(resource), record) ?? "");
|
|
929
1216
|
const testid = makeTestId(scope, resource, actionName, recordId, tid);
|
|
930
1217
|
const label = useResolvedLabel(action, actionName, children, resource);
|
|
931
1218
|
const editRoute = useBuiltinEditRoute(action, resource, recordId);
|
|
@@ -1031,11 +1318,12 @@ function LinkActionButton({ resource, actionName, record, scope = "row", variant
|
|
|
1031
1318
|
}
|
|
1032
1319
|
function ModalActionButton({ resource, actionName, record, scope = "row", variant, size, density, className, children, asMenuItem, action, availability }) {
|
|
1033
1320
|
const tid = useTestIds();
|
|
1321
|
+
const app = useApp();
|
|
1034
1322
|
const present = usePresentBlock();
|
|
1035
1323
|
const safeRecord = record ?? { id: "" };
|
|
1036
1324
|
const isDestructive = action.variant === "destructive";
|
|
1037
1325
|
const buttonVariant = variant ?? (isDestructive ? "destructive" : "outline");
|
|
1038
|
-
const recordId = record
|
|
1326
|
+
const recordId = String(recordKeyOf(app.registry.get(resource), record) ?? "");
|
|
1039
1327
|
const testid = makeTestId(scope, resource, actionName, recordId, tid);
|
|
1040
1328
|
const label = useResolvedLabel(action, actionName, children, resource);
|
|
1041
1329
|
if (availability.state === "disabled") return jsx(DisabledAction, {
|
|
@@ -1095,21 +1383,34 @@ function ModalActionButton({ resource, actionName, record, scope = "row", varian
|
|
|
1095
1383
|
}
|
|
1096
1384
|
//#endregion
|
|
1097
1385
|
//#region src/checks/check-confirm-dialog.tsx
|
|
1098
|
-
function
|
|
1099
|
-
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 ?? "",
|
|
1100
1394
|
params,
|
|
1101
1395
|
...resource === void 0 ? {} : { resource }
|
|
1102
1396
|
});
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
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
|
+
});
|
|
1402
|
+
if (declared !== void 0) return declared;
|
|
1403
|
+
const name = String(params?.name ?? checkId);
|
|
1404
|
+
return t(FRAMEWORK_TEXT_KEYS.checkFailed, {
|
|
1405
|
+
defaultValue: checkFailedDefault(name),
|
|
1406
|
+
params: {
|
|
1407
|
+
...params,
|
|
1408
|
+
name
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1109
1411
|
}
|
|
1110
1412
|
function checkIdOf(issue, index) {
|
|
1111
|
-
|
|
1112
|
-
return typeof id === "string" ? id : `${index}`;
|
|
1413
|
+
return issue.check?.id ?? `${index}`;
|
|
1113
1414
|
}
|
|
1114
1415
|
const SEVERITY_CLASSNAME = {
|
|
1115
1416
|
error: "text-destructive",
|
|
@@ -1118,11 +1419,12 @@ const SEVERITY_CLASSNAME = {
|
|
|
1118
1419
|
};
|
|
1119
1420
|
function ChecksList({ issues, testid, onRowClick, resource }) {
|
|
1120
1421
|
const t = useOptionalT();
|
|
1422
|
+
const caps = useI18nCaps(resource);
|
|
1121
1423
|
return issues.map((issue, index) => {
|
|
1122
1424
|
const checkId = checkIdOf(issue, index);
|
|
1123
1425
|
const anchor = issue.path[0];
|
|
1124
1426
|
const anchorable = typeof anchor === "string";
|
|
1125
|
-
const text = issueText(issue, t, resource);
|
|
1427
|
+
const text = issueText(issue, t, caps, resource);
|
|
1126
1428
|
const className = cn("text-sm", SEVERITY_CLASSNAME[issue.severity]);
|
|
1127
1429
|
return anchorable ? jsx("li", { children: jsx("button", {
|
|
1128
1430
|
type: "button",
|
|
@@ -1137,15 +1439,11 @@ function ChecksList({ issues, testid, onRowClick, resource }) {
|
|
|
1137
1439
|
}, `${checkId}-${index}`);
|
|
1138
1440
|
});
|
|
1139
1441
|
}
|
|
1140
|
-
function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel, tone }) {
|
|
1141
|
-
const
|
|
1442
|
+
function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel, cancelLabel, tone }) {
|
|
1443
|
+
const chromeT = useChromeT();
|
|
1142
1444
|
const { resource, open, busy, header, blockers, confirmable, proceed, cancel } = state;
|
|
1143
1445
|
const blocked = blockers.length > 0;
|
|
1144
|
-
const
|
|
1145
|
-
const heading = title ?? t("checks.dialogTitle", {
|
|
1146
|
-
defaultValue: "Please review",
|
|
1147
|
-
...bound
|
|
1148
|
-
});
|
|
1446
|
+
const heading = title ?? chromeT("checks.dialogTitle", { defaultValue: "Please review" });
|
|
1149
1447
|
const restoreFocusRef = useRef(null);
|
|
1150
1448
|
useEffect(() => {
|
|
1151
1449
|
if (typeof document === "undefined") return;
|
|
@@ -1182,10 +1480,7 @@ function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel,
|
|
|
1182
1480
|
children: [
|
|
1183
1481
|
blocked && jsx("li", {
|
|
1184
1482
|
className: "text-xs font-semibold uppercase tracking-wider text-destructive",
|
|
1185
|
-
children:
|
|
1186
|
-
defaultValue: "Cannot continue",
|
|
1187
|
-
...bound
|
|
1188
|
-
})
|
|
1483
|
+
children: chromeT("checks.blocked", { defaultValue: "Cannot continue" })
|
|
1189
1484
|
}),
|
|
1190
1485
|
jsx(ChecksList, {
|
|
1191
1486
|
issues: blockers,
|
|
@@ -1207,26 +1502,20 @@ function CheckConfirmDialog({ state, testid, onAnchorFocus, title, proceedLabel,
|
|
|
1207
1502
|
onClick: cancel,
|
|
1208
1503
|
"data-testid": `${testid}:cancel`,
|
|
1209
1504
|
disabled: busy,
|
|
1210
|
-
children:
|
|
1211
|
-
defaultValue: "Go back",
|
|
1212
|
-
...bound
|
|
1213
|
-
})
|
|
1505
|
+
children: cancelLabel ?? chromeT("checks.back", { defaultValue: "Go back" })
|
|
1214
1506
|
}), !blocked && jsx(Button, {
|
|
1215
1507
|
type: "button",
|
|
1216
1508
|
variant: tone === "destructive" ? "destructive" : "default",
|
|
1217
1509
|
onClick: proceed,
|
|
1218
1510
|
"data-testid": `${testid}:proceed`,
|
|
1219
1511
|
disabled: busy,
|
|
1220
|
-
children: proceedLabel ??
|
|
1221
|
-
defaultValue: "Continue anyway",
|
|
1222
|
-
...bound
|
|
1223
|
-
})
|
|
1512
|
+
children: proceedLabel ?? chromeT("checks.proceed", { defaultValue: "Continue anyway" })
|
|
1224
1513
|
})] })
|
|
1225
1514
|
]
|
|
1226
1515
|
})
|
|
1227
1516
|
});
|
|
1228
1517
|
}
|
|
1229
1518
|
//#endregion
|
|
1230
|
-
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 };
|
|
1231
1520
|
|
|
1232
|
-
//# sourceMappingURL=check-confirm-dialog-
|
|
1521
|
+
//# sourceMappingURL=check-confirm-dialog-2j0gOd7x.js.map
|