@multiplatform.one/backoffice 7.51.0 → 7.53.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/dist/cjs/i18n/en.cjs +2 -1
- package/dist/cjs/i18n/en.native.js +2 -1
- package/dist/cjs/i18n/en.native.js.map +1 -1
- package/dist/cjs/list/DoctypeListScreen.cjs +76 -80
- package/dist/cjs/list/DoctypeListScreen.native.js +83 -87
- package/dist/cjs/list/DoctypeListScreen.native.js.map +1 -1
- package/dist/cjs/shell/BackofficeShell.cjs +66 -57
- package/dist/cjs/shell/BackofficeShell.native.js +83 -71
- package/dist/cjs/shell/BackofficeShell.native.js.map +1 -1
- package/dist/cjs/shell/shellTopBarSlot.cjs +62 -0
- package/dist/cjs/shell/shellTopBarSlot.native.js +70 -0
- package/dist/cjs/shell/shellTopBarSlot.native.js.map +1 -0
- package/dist/cjs/views/ViewSwitcherMenu.cjs +22 -7
- package/dist/cjs/views/ViewSwitcherMenu.native.js +23 -7
- package/dist/cjs/views/ViewSwitcherMenu.native.js.map +1 -1
- package/dist/esm/i18n/en.mjs +2 -1
- package/dist/esm/i18n/en.mjs.map +1 -1
- package/dist/esm/i18n/en.native.js +2 -1
- package/dist/esm/i18n/en.native.js.map +1 -1
- package/dist/esm/list/DoctypeListScreen.mjs +77 -81
- package/dist/esm/list/DoctypeListScreen.mjs.map +1 -1
- package/dist/esm/list/DoctypeListScreen.native.js +84 -88
- package/dist/esm/list/DoctypeListScreen.native.js.map +1 -1
- package/dist/esm/shell/BackofficeShell.mjs +66 -57
- package/dist/esm/shell/BackofficeShell.mjs.map +1 -1
- package/dist/esm/shell/BackofficeShell.native.js +83 -71
- package/dist/esm/shell/BackofficeShell.native.js.map +1 -1
- package/dist/esm/shell/shellTopBarSlot.mjs +35 -0
- package/dist/esm/shell/shellTopBarSlot.mjs.map +1 -0
- package/dist/esm/shell/shellTopBarSlot.native.js +40 -0
- package/dist/esm/shell/shellTopBarSlot.native.js.map +1 -0
- package/dist/esm/views/ViewSwitcherMenu.mjs +21 -7
- package/dist/esm/views/ViewSwitcherMenu.mjs.map +1 -1
- package/dist/esm/views/ViewSwitcherMenu.native.js +22 -7
- package/dist/esm/views/ViewSwitcherMenu.native.js.map +1 -1
- package/dist/jsx/i18n/en.mjs +2 -1
- package/dist/jsx/i18n/en.mjs.map +1 -1
- package/dist/jsx/i18n/en.native.js +2 -1
- package/dist/jsx/i18n/en.native.js.map +1 -1
- package/dist/jsx/list/DoctypeListScreen.mjs +77 -81
- package/dist/jsx/list/DoctypeListScreen.mjs.map +1 -1
- package/dist/jsx/list/DoctypeListScreen.native.js +83 -87
- package/dist/jsx/list/DoctypeListScreen.native.js.map +1 -1
- package/dist/jsx/shell/BackofficeShell.mjs +66 -57
- package/dist/jsx/shell/BackofficeShell.mjs.map +1 -1
- package/dist/jsx/shell/BackofficeShell.native.js +83 -71
- package/dist/jsx/shell/BackofficeShell.native.js.map +1 -1
- package/dist/jsx/shell/shellTopBarSlot.mjs +35 -0
- package/dist/jsx/shell/shellTopBarSlot.mjs.map +1 -0
- package/dist/jsx/shell/shellTopBarSlot.native.js +70 -0
- package/dist/jsx/shell/shellTopBarSlot.native.js.map +1 -0
- package/dist/jsx/views/ViewSwitcherMenu.mjs +21 -7
- package/dist/jsx/views/ViewSwitcherMenu.mjs.map +1 -1
- package/dist/jsx/views/ViewSwitcherMenu.native.js +23 -7
- package/dist/jsx/views/ViewSwitcherMenu.native.js.map +1 -1
- package/package.json +12 -12
- package/src/desk/DeskPokemon.stories.tsx +7 -0
- package/src/i18n/en.ts +1 -0
- package/src/list/DoctypeListScreen.compactHead.screen.spec.tsx +197 -0
- package/src/list/DoctypeListScreen.tsx +113 -94
- package/src/shell/BackofficeShell.tsx +82 -66
- package/src/shell/shellTopBarSlot.tsx +61 -0
- package/src/views/ViewSwitcherMenu.tsx +23 -8
- package/types/i18n/en.d.ts +1 -0
- package/types/i18n/en.d.ts.map +1 -1
- package/types/list/DoctypeListScreen.d.ts.map +1 -1
- package/types/shell/BackofficeShell.d.ts.map +1 -1
- package/types/shell/shellTopBarSlot.d.ts +29 -0
- package/types/shell/shellTopBarSlot.d.ts.map +1 -0
- package/types/views/ViewSwitcherMenu.d.ts +7 -0
- package/types/views/ViewSwitcherMenu.d.ts.map +1 -1
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
AsyncBoundary,
|
|
12
12
|
DropdownMenu,
|
|
13
13
|
EmptyState,
|
|
14
|
+
type DropdownMenuEntry,
|
|
14
15
|
H1,
|
|
15
16
|
PageHeader,
|
|
16
17
|
Paragraph,
|
|
@@ -82,7 +83,7 @@ import type { FrappeFilters } from "../shared/types";
|
|
|
82
83
|
import { type DoctypeMeta } from "../shared/useDoctypeMeta";
|
|
83
84
|
import { deriveAvailableViews } from "../views/viewAvailability";
|
|
84
85
|
import { useViewSource } from "../views/viewMeta";
|
|
85
|
-
import { ViewSwitcherMenu } from "../views/ViewSwitcherMenu";
|
|
86
|
+
import { useViewMenuEntries, ViewSwitcherMenu } from "../views/ViewSwitcherMenu";
|
|
86
87
|
import { useFrappeApp } from "../shared/useFrappeApp";
|
|
87
88
|
import { useUserRoles } from "../shared/useUserRoles";
|
|
88
89
|
import { AddTagsDialog } from "./AddTagsDialog";
|
|
@@ -101,9 +102,9 @@ import { toggleFacetFilter } from "./sidebar-stats";
|
|
|
101
102
|
import { ListFilterBar } from "./ListFilterBar";
|
|
102
103
|
import { ListToolsButton } from "./list-tools-sheet";
|
|
103
104
|
import { LIST_PAGE_SIZE, ListPaging } from "./list-paging";
|
|
104
|
-
import { SortControl } from "./filter-sort";
|
|
105
105
|
import { ListSidebar } from "./ListSidebar";
|
|
106
106
|
import { useShellSidebarPanel } from "../shell/shellSidebarSlot";
|
|
107
|
+
import { useShellTopBarAction } from "../shell/shellTopBarSlot";
|
|
107
108
|
import {
|
|
108
109
|
parseFiltersParam,
|
|
109
110
|
parseSortParam,
|
|
@@ -218,7 +219,7 @@ export function DoctypeListScreen({
|
|
|
218
219
|
const sessionUser = useSessionUser();
|
|
219
220
|
// Compact list chrome below 640 (theme `compact` size class — matchMedia
|
|
220
221
|
// on web, window dimensions on native; BackofficeShell drawer precedent):
|
|
221
|
-
// one
|
|
222
|
+
// one control row (search, Filter & sort, "…"), New in the top bar.
|
|
222
223
|
const compactChrome = useLayoutSizeClass() === "compact";
|
|
223
224
|
|
|
224
225
|
// Write-on-visit for the shared recents store (workspace "Continue where
|
|
@@ -900,6 +901,36 @@ export function DoctypeListScreen({
|
|
|
900
901
|
: null,
|
|
901
902
|
);
|
|
902
903
|
|
|
904
|
+
const handleViewChange = useCallback(
|
|
905
|
+
(view: BackofficeView) => {
|
|
906
|
+
if (view !== "list") navigator.navigate(paths.view(doctype, view));
|
|
907
|
+
},
|
|
908
|
+
[navigator, paths, doctype],
|
|
909
|
+
);
|
|
910
|
+
const viewEntries = useViewMenuEntries({
|
|
911
|
+
views: availableViews,
|
|
912
|
+
current: "list",
|
|
913
|
+
onViewChange: handleViewChange,
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
// LC-128 (FZ-7974): on a phone New is the top bar's trailing action. A
|
|
917
|
+
// shell above takes it into its banner; without one it ends the page's
|
|
918
|
+
// control row.
|
|
919
|
+
const compactNewButton = (
|
|
920
|
+
<ActionButton
|
|
921
|
+
accent
|
|
922
|
+
circular
|
|
923
|
+
icon={PlusIcon}
|
|
924
|
+
onPress={() => setQuickEntryOpen(true)}
|
|
925
|
+
aria-label={t("list.new", {
|
|
926
|
+
defaultValue: "New {{doctype}}",
|
|
927
|
+
doctype,
|
|
928
|
+
})}
|
|
929
|
+
testID="backoffice-list-new"
|
|
930
|
+
/>
|
|
931
|
+
);
|
|
932
|
+
const shellTookNew = useShellTopBarAction(compactChrome && showNew ? compactNewButton : null);
|
|
933
|
+
|
|
903
934
|
if (metaError && !meta && !metaRefused) {
|
|
904
935
|
return (
|
|
905
936
|
<YStack flex={1}>
|
|
@@ -950,9 +981,6 @@ export function DoctypeListScreen({
|
|
|
950
981
|
defaultValue_one: "{{count}} result",
|
|
951
982
|
defaultValue_other: "{{count}} results",
|
|
952
983
|
});
|
|
953
|
-
const handleViewChange = (view: BackofficeView) => {
|
|
954
|
-
if (view !== "list") navigator.navigate(paths.view(doctype, view));
|
|
955
|
-
};
|
|
956
984
|
|
|
957
985
|
// One dense toolbar: title + count on the left, every list control on
|
|
958
986
|
// the right. Views are a dropdown (desk ListViewSelect) so they cannot
|
|
@@ -1032,101 +1060,92 @@ export function DoctypeListScreen({
|
|
|
1032
1060
|
</XStack>
|
|
1033
1061
|
);
|
|
1034
1062
|
|
|
1035
|
-
// Phone chrome (FZ-
|
|
1036
|
-
//
|
|
1037
|
-
//
|
|
1038
|
-
//
|
|
1063
|
+
// Phone chrome: ONE control row (FZ-7974, LC-128 amendment). The banner
|
|
1064
|
+
// names the doctype and carries New as its trailing action; search takes
|
|
1065
|
+
// the row, Filter & sort (quick and saved filters, sort) is one trailing
|
|
1066
|
+
// control, and views, refresh and Open in Desk ride the "…" menu. Pills
|
|
1067
|
+
// follow only when a filter applies; the result count rides the list's
|
|
1068
|
+
// own tail.
|
|
1039
1069
|
const filterCount = Array.isArray(baseFilters) ? baseFilters.length : 0;
|
|
1070
|
+
const compactMoreEntries: DropdownMenuEntry[] = [
|
|
1071
|
+
...viewEntries,
|
|
1072
|
+
...(viewEntries.length > 0 ? [{ separator: true as const }] : []),
|
|
1073
|
+
{
|
|
1074
|
+
key: "refresh",
|
|
1075
|
+
label: t("list.refresh", "Refresh"),
|
|
1076
|
+
icon: <ArrowsClockwiseIcon />,
|
|
1077
|
+
onSelect: handleRefresh,
|
|
1078
|
+
},
|
|
1079
|
+
...(deskHref
|
|
1080
|
+
? [
|
|
1081
|
+
{
|
|
1082
|
+
key: "open-in-desk",
|
|
1083
|
+
label: t("list.openInDesk", "Open in Desk"),
|
|
1084
|
+
icon: <ArrowSquareOutIcon />,
|
|
1085
|
+
onSelect: () => openInNewTab(deskHref),
|
|
1086
|
+
},
|
|
1087
|
+
]
|
|
1088
|
+
: []),
|
|
1089
|
+
];
|
|
1040
1090
|
const compactHeader = (
|
|
1041
1091
|
<YStack gap="$3">
|
|
1042
|
-
{/* LC-153:
|
|
1092
|
+
{/* LC-153: the phone list head row is a bar, so its controls go plain. */}
|
|
1043
1093
|
<Surface bar>
|
|
1044
|
-
<XStack gap="$2" alignItems="center">
|
|
1045
|
-
<
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1094
|
+
<XStack gap="$2" alignItems="center" testID="backoffice-list-controls">
|
|
1095
|
+
<YStack flex={1} minWidth={0}>
|
|
1096
|
+
<SearchInput
|
|
1097
|
+
key={doctype}
|
|
1098
|
+
defaultValue=""
|
|
1099
|
+
onSearch={setSearchText}
|
|
1100
|
+
clearable
|
|
1101
|
+
placeholder={t("list.searchPlaceholder", {
|
|
1102
|
+
defaultValue: "Search {{doctype}}",
|
|
1103
|
+
doctype,
|
|
1104
|
+
})}
|
|
1105
|
+
aria-label={t("list.searchPlaceholder", {
|
|
1106
|
+
defaultValue: "Search {{doctype}}",
|
|
1107
|
+
doctype,
|
|
1108
|
+
})}
|
|
1109
|
+
/>
|
|
1110
|
+
</YStack>
|
|
1111
|
+
{!metaRefused && (
|
|
1112
|
+
<ListToolsButton
|
|
1113
|
+
doctype={doctype}
|
|
1114
|
+
meta={meta}
|
|
1115
|
+
filters={baseFilters}
|
|
1116
|
+
onFiltersChange={handleBaseFiltersChange}
|
|
1117
|
+
sortField={sortField}
|
|
1118
|
+
sortOrder={sortOrder}
|
|
1119
|
+
onSortChange={handleSortChange}
|
|
1120
|
+
renderTrigger={(open) => (
|
|
1049
1121
|
<ActionButton
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
aria-label={
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
aria-label={t("list.new", {
|
|
1076
|
-
defaultValue: "New {{doctype}}",
|
|
1077
|
-
doctype,
|
|
1078
|
-
})}
|
|
1079
|
-
testID="backoffice-list-new"
|
|
1080
|
-
>
|
|
1081
|
-
{t("list.newShort", "New")}
|
|
1082
|
-
</ActionButton>
|
|
1083
|
-
)}
|
|
1084
|
-
</XStack>
|
|
1122
|
+
icon={FunnelIcon}
|
|
1123
|
+
onPress={open}
|
|
1124
|
+
aria-label={
|
|
1125
|
+
filterCount
|
|
1126
|
+
? t("list.tools.titleCount", {
|
|
1127
|
+
count: filterCount,
|
|
1128
|
+
defaultValue: "Filter & sort ({{count}})",
|
|
1129
|
+
})
|
|
1130
|
+
: t("list.tools.title", "Filter & sort")
|
|
1131
|
+
}
|
|
1132
|
+
testID="backoffice-list-tools"
|
|
1133
|
+
>
|
|
1134
|
+
{filterCount ? String(filterCount) : undefined}
|
|
1135
|
+
</ActionButton>
|
|
1136
|
+
)}
|
|
1137
|
+
/>
|
|
1138
|
+
)}
|
|
1139
|
+
<DropdownMenu items={compactMoreEntries} placement="bottom-end">
|
|
1140
|
+
<ActionButton
|
|
1141
|
+
icon={DotsThreeIcon}
|
|
1142
|
+
aria-label={t("list.more", "More actions")}
|
|
1143
|
+
testID="backoffice-list-more"
|
|
1144
|
+
/>
|
|
1145
|
+
</DropdownMenu>
|
|
1146
|
+
{showNew && !shellTookNew ? compactNewButton : null}
|
|
1085
1147
|
</XStack>
|
|
1086
1148
|
</Surface>
|
|
1087
|
-
<SearchInput
|
|
1088
|
-
key={doctype}
|
|
1089
|
-
defaultValue=""
|
|
1090
|
-
onSearch={setSearchText}
|
|
1091
|
-
clearable
|
|
1092
|
-
placeholder={t("list.searchPlaceholder", {
|
|
1093
|
-
defaultValue: "Search {{doctype}}",
|
|
1094
|
-
doctype,
|
|
1095
|
-
})}
|
|
1096
|
-
aria-label={t("list.searchPlaceholder", {
|
|
1097
|
-
defaultValue: "Search {{doctype}}",
|
|
1098
|
-
doctype,
|
|
1099
|
-
})}
|
|
1100
|
-
/>
|
|
1101
|
-
{!metaRefused && (
|
|
1102
|
-
<XStack gap="$2" alignItems="center">
|
|
1103
|
-
<ListToolsButton
|
|
1104
|
-
doctype={doctype}
|
|
1105
|
-
meta={meta}
|
|
1106
|
-
filters={baseFilters}
|
|
1107
|
-
onFiltersChange={handleBaseFiltersChange}
|
|
1108
|
-
sortField={sortField}
|
|
1109
|
-
sortOrder={sortOrder}
|
|
1110
|
-
onSortChange={handleSortChange}
|
|
1111
|
-
renderTrigger={(open) => (
|
|
1112
|
-
<ActionButton outlined icon={FunnelIcon} onPress={open}>
|
|
1113
|
-
{filterCount
|
|
1114
|
-
? t("list.filters.filterCount", {
|
|
1115
|
-
count: filterCount,
|
|
1116
|
-
defaultValue: "Filter ({{count}})",
|
|
1117
|
-
})
|
|
1118
|
-
: t("list.filters.filter", "Filter")}
|
|
1119
|
-
</ActionButton>
|
|
1120
|
-
)}
|
|
1121
|
-
/>
|
|
1122
|
-
<SortControl
|
|
1123
|
-
meta={meta}
|
|
1124
|
-
sortField={sortField}
|
|
1125
|
-
sortOrder={sortOrder}
|
|
1126
|
-
onSortChange={handleSortChange}
|
|
1127
|
-
/>
|
|
1128
|
-
</XStack>
|
|
1129
|
-
)}
|
|
1130
1149
|
{!metaRefused && filterCount > 0 && (
|
|
1131
1150
|
<FilterChips meta={meta} filters={baseFilters} onFiltersChange={handleBaseFiltersChange} />
|
|
1132
1151
|
)}
|
|
@@ -68,6 +68,7 @@ import {
|
|
|
68
68
|
useShellSidebarSlotState,
|
|
69
69
|
type ShellSidebarPanel,
|
|
70
70
|
} from "./shellSidebarSlot";
|
|
71
|
+
import { ShellTopBarSlotProvider, useShellTopBarSlotState } from "./shellTopBarSlot";
|
|
71
72
|
import { WORKSPACE_SIDEBAR_WIDTH, WorkspaceSidebar } from "./WorkspaceSidebar";
|
|
72
73
|
|
|
73
74
|
// Capability-check the barrel instead of a named import: GNOME's curated
|
|
@@ -163,6 +164,7 @@ export function BackofficeShell({ children, activePath, onNavigate, title }: Bac
|
|
|
163
164
|
const [sidebarOpen, setSidebarOpen] = useState(false);
|
|
164
165
|
const sidebarSlot = useShellSidebarSlotState();
|
|
165
166
|
const pagePanel = sidebarSlot.panel;
|
|
167
|
+
const topBarSlot = useShellTopBarSlotState();
|
|
166
168
|
|
|
167
169
|
const resolvedActivePath = activePath ?? location.path;
|
|
168
170
|
const navigate = onNavigate ?? navigator.navigate;
|
|
@@ -255,8 +257,14 @@ export function BackofficeShell({ children, activePath, onNavigate, title }: Bac
|
|
|
255
257
|
</XStack>
|
|
256
258
|
)}
|
|
257
259
|
|
|
258
|
-
{/* Right chrome
|
|
260
|
+
{/* Right chrome: the page's own action (LC-128, FZ-7974) leads the
|
|
261
|
+
shell's global controls. */}
|
|
259
262
|
<XStack alignItems="center" gap="$1" flexShrink={0}>
|
|
263
|
+
{topBarSlot.action ? (
|
|
264
|
+
<XStack alignItems="center" data-testid="backoffice-shell-page-action">
|
|
265
|
+
{topBarSlot.action}
|
|
266
|
+
</XStack>
|
|
267
|
+
) : null}
|
|
260
268
|
{isNarrow && capabilities.awesomebar.enabled && (
|
|
261
269
|
<BackofficeAwesomebar focusRef={awesomebarRef} />
|
|
262
270
|
)}
|
|
@@ -285,83 +293,91 @@ export function BackofficeShell({ children, activePath, onNavigate, title }: Bac
|
|
|
285
293
|
|
|
286
294
|
return (
|
|
287
295
|
<ShellSidebarSlotProvider value={sidebarEnabled ? sidebarSlot.value : null}>
|
|
288
|
-
<
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
{/* Top navbar — Frappe inverted-L: full width above the rail. */}
|
|
296
|
-
<XStack
|
|
297
|
-
role="banner"
|
|
298
|
-
{...knobProps.surface}
|
|
299
|
-
borderWidth={0}
|
|
300
|
-
borderRadius={0}
|
|
301
|
-
{...knobProps.bar.frame}
|
|
302
|
-
alignItems="center"
|
|
303
|
-
gap="$2"
|
|
304
|
-
flexShrink={0}
|
|
296
|
+
<ShellTopBarSlotProvider value={topBarSlot.value}>
|
|
297
|
+
<YStack
|
|
298
|
+
flex={1}
|
|
299
|
+
height="100%"
|
|
300
|
+
width="100%"
|
|
301
|
+
overflow="hidden"
|
|
302
|
+
data-testid="backoffice-shell"
|
|
305
303
|
>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
</XStack>
|
|
312
|
-
<ShellHairline axis="horizontal" testId="backoffice-shell-banner-rule" />
|
|
304
|
+
{isWeb ? (
|
|
305
|
+
<SkipLink targetId="backoffice-main">
|
|
306
|
+
{t("shell.skipToContent", "Skip to content")}
|
|
307
|
+
</SkipLink>
|
|
308
|
+
) : null}
|
|
313
309
|
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
{/* Top navbar — Frappe inverted-L: full width above the rail. */}
|
|
311
|
+
<XStack
|
|
312
|
+
role="banner"
|
|
313
|
+
{...knobProps.surface}
|
|
314
|
+
borderWidth={0}
|
|
315
|
+
borderRadius={0}
|
|
316
|
+
{...knobProps.bar.frame}
|
|
317
|
+
alignItems="center"
|
|
318
|
+
gap="$2"
|
|
319
|
+
flexShrink={0}
|
|
320
|
+
>
|
|
321
|
+
<Surface size={knobProps.bar.sizeToken} bar>
|
|
322
|
+
{slots.renderShellHeader
|
|
323
|
+
? slots.renderShellHeader({ defaultContent: headerContent })
|
|
324
|
+
: headerContent}
|
|
325
|
+
</Surface>
|
|
326
|
+
</XStack>
|
|
327
|
+
<ShellHairline axis="horizontal" testId="backoffice-shell-banner-rule" />
|
|
328
|
+
|
|
329
|
+
<XStack flex={1} minWidth={0} position="relative" overflow="hidden">
|
|
330
|
+
{sidebarEnabled && !isNarrow && sidebarOpen && rail}
|
|
316
331
|
|
|
317
|
-
|
|
332
|
+
{/* Narrow: the nav opens as a bottom sheet off the hamburger
|
|
318
333
|
(phones take sheets, not side drawers), titled with the desk name
|
|
319
334
|
the compact banner gives up to the surface title. SheetModal owns
|
|
320
335
|
Escape and scrim dismissal. */}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
>
|
|
333
|
-
<YStack
|
|
334
|
-
role="navigation"
|
|
335
|
-
flex={1}
|
|
336
|
-
minHeight={0}
|
|
337
|
-
width="100%"
|
|
338
|
-
data-testid="backoffice-sidebar-drawer"
|
|
336
|
+
{sidebarEnabled && isNarrow && (
|
|
337
|
+
<SheetModal
|
|
338
|
+
open={sidebarOpen}
|
|
339
|
+
onOpenChange={setSidebarOpen}
|
|
340
|
+
snapPoint={85}
|
|
341
|
+
fill
|
|
342
|
+
header={
|
|
343
|
+
<SizableText {...knobProps.heading} numberOfLines={1}>
|
|
344
|
+
{deskTitle}
|
|
345
|
+
</SizableText>
|
|
346
|
+
}
|
|
339
347
|
>
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
<YStack
|
|
349
|
+
role="navigation"
|
|
350
|
+
flex={1}
|
|
351
|
+
minHeight={0}
|
|
352
|
+
width="100%"
|
|
353
|
+
data-testid="backoffice-sidebar-drawer"
|
|
354
|
+
>
|
|
355
|
+
{sidebarContent}
|
|
356
|
+
</YStack>
|
|
357
|
+
</SheetModal>
|
|
358
|
+
)}
|
|
344
359
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
360
|
+
{/* Routed content — pages own their own headers/breadcrumbs */}
|
|
361
|
+
<YStack
|
|
362
|
+
role="main"
|
|
363
|
+
id="backoffice-main"
|
|
364
|
+
tabIndex={-1}
|
|
365
|
+
flex={1}
|
|
366
|
+
minWidth={0}
|
|
367
|
+
minHeight={0}
|
|
368
|
+
overflow="hidden"
|
|
369
|
+
>
|
|
370
|
+
{children}
|
|
371
|
+
</YStack>
|
|
372
|
+
</XStack>
|
|
358
373
|
|
|
359
|
-
|
|
374
|
+
{/* THE backoffice toast host: one shell-level viewport so every desk
|
|
360
375
|
surface (list, form, report, kanban, …) renders notify()/showToast
|
|
361
376
|
feedback without mounting its own. Double-mount safe — a second
|
|
362
377
|
viewport lower in the tree no-ops (components Toast contract). */}
|
|
363
|
-
|
|
364
|
-
|
|
378
|
+
{ToastViewport ? <ToastViewport /> : null}
|
|
379
|
+
</YStack>
|
|
380
|
+
</ShellTopBarSlotProvider>
|
|
365
381
|
</ShellSidebarSlotProvider>
|
|
366
382
|
);
|
|
367
383
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LC-128 (amended by FZ-7974): on a phone a page's primary action rides the
|
|
3
|
+
* shell's top bar, trailing the page title, instead of spending a row of the
|
|
4
|
+
* page on it. A page registers its action here; the shell draws it in the
|
|
5
|
+
* banner. Without a shell above (bare stories, embedded screens) there is no
|
|
6
|
+
* slot, `useShellTopBarAction` returns false and the page keeps the action
|
|
7
|
+
* in its own control row.
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
createContext,
|
|
11
|
+
useContext,
|
|
12
|
+
useLayoutEffect,
|
|
13
|
+
useMemo,
|
|
14
|
+
useState,
|
|
15
|
+
type ReactNode,
|
|
16
|
+
} from "react";
|
|
17
|
+
|
|
18
|
+
interface ShellTopBarSlotValue {
|
|
19
|
+
setAction: (action: ReactNode | null) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ShellTopBarSlotContext = createContext<ShellTopBarSlotValue | null>(null);
|
|
23
|
+
|
|
24
|
+
/** Shell side: owns the registered action and exposes the setter. */
|
|
25
|
+
export function useShellTopBarSlotState(): {
|
|
26
|
+
action: ReactNode | null;
|
|
27
|
+
value: ShellTopBarSlotValue;
|
|
28
|
+
} {
|
|
29
|
+
const [action, setAction] = useState<ReactNode | null>(null);
|
|
30
|
+
const value = useMemo(() => ({ setAction }), []);
|
|
31
|
+
return { action, value };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function ShellTopBarSlotProvider({
|
|
35
|
+
value,
|
|
36
|
+
children,
|
|
37
|
+
}: {
|
|
38
|
+
value: ShellTopBarSlotValue | null;
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}) {
|
|
41
|
+
return (
|
|
42
|
+
<ShellTopBarSlotContext.Provider value={value}>{children}</ShellTopBarSlotContext.Provider>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Page side: register `action` (or `null` to withdraw it) with the shell's
|
|
48
|
+
* top bar. Re-registers after every render of the caller so the action
|
|
49
|
+
* tracks the page's state. Returns whether a shell took it.
|
|
50
|
+
*/
|
|
51
|
+
export function useShellTopBarAction(action: ReactNode | null): boolean {
|
|
52
|
+
const slot = useContext(ShellTopBarSlotContext);
|
|
53
|
+
useLayoutEffect(() => {
|
|
54
|
+
slot?.setAction(action);
|
|
55
|
+
});
|
|
56
|
+
useLayoutEffect(() => {
|
|
57
|
+
if (!slot) return;
|
|
58
|
+
return () => slot.setAction(null);
|
|
59
|
+
}, [slot]);
|
|
60
|
+
return slot !== null;
|
|
61
|
+
}
|
|
@@ -55,27 +55,42 @@ export interface ViewSwitcherMenuProps {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* The views as checkable menu entries, current check-marked; empty when
|
|
59
|
+
* there is nothing to switch to. The switcher's own menu and the compact
|
|
60
|
+
* list's "…" menu (FZ-7974) share them.
|
|
61
61
|
*/
|
|
62
|
-
export function
|
|
63
|
-
|
|
62
|
+
export function useViewMenuEntries({
|
|
63
|
+
views,
|
|
64
|
+
current,
|
|
65
|
+
onViewChange,
|
|
66
|
+
}: ViewSwitcherMenuProps): DropdownMenuEntry[] {
|
|
64
67
|
const labels = useViewLabels();
|
|
65
|
-
if (views.length <= 1) return
|
|
66
|
-
|
|
67
|
-
const items: DropdownMenuEntry[] = views.map((candidate) => {
|
|
68
|
+
if (views.length <= 1) return [];
|
|
69
|
+
return views.map((candidate) => {
|
|
68
70
|
const ViewIcon = VIEW_ICONS[candidate];
|
|
69
71
|
return {
|
|
70
72
|
key: candidate,
|
|
71
73
|
label: labels[candidate],
|
|
72
74
|
icon: <ViewIcon size="$3" />,
|
|
73
75
|
checked: candidate === current,
|
|
76
|
+
closeOnSelect: true,
|
|
74
77
|
onSelect: () => {
|
|
75
78
|
if (candidate !== current) onViewChange(candidate);
|
|
76
79
|
},
|
|
77
80
|
};
|
|
78
81
|
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Single-select dropdown of the views this doctype can actually render.
|
|
86
|
+
* Hidden when there is nothing to switch to. The current view is always
|
|
87
|
+
* check-marked; picking another fires `onViewChange`.
|
|
88
|
+
*/
|
|
89
|
+
export function ViewSwitcherMenu({ views, current, onViewChange }: ViewSwitcherMenuProps) {
|
|
90
|
+
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
91
|
+
const labels = useViewLabels();
|
|
92
|
+
const items = useViewMenuEntries({ views, current, onViewChange });
|
|
93
|
+
if (items.length === 0) return null;
|
|
79
94
|
|
|
80
95
|
return (
|
|
81
96
|
<DropdownMenu items={items} closeOnSelect placement="bottom-end">
|
package/types/i18n/en.d.ts
CHANGED
package/types/i18n/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqtBL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoctypeListScreen.d.ts","sourceRoot":"","sources":["../../src/list/DoctypeListScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DoctypeListScreen.d.ts","sourceRoot":"","sources":["../../src/list/DoctypeListScreen.tsx"],"names":[],"mappings":"AAyCA,OAAO,EAUL,KAAK,OAAO,EACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAEV,eAAe,EAIhB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAS1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAmC5D,MAAM,WAAW,sBAAsB;IACrC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAClC;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,8EAA8E;IAC9E,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,KAAK,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;IACtF,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gFAAgF;IAChF,cAAc,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAC9C;AAoBD,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,KAAK,EAAE,cAAc,EACrB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,GACf,EAAE,sBAAsB,2CAuoCxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeShell.d.ts","sourceRoot":"","sources":["../../src/shell/BackofficeShell.tsx"],"names":[],"mappings":"AA8CA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BackofficeShell.d.ts","sourceRoot":"","sources":["../../src/shell/BackofficeShell.tsx"],"names":[],"mappings":"AA8CA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmC/B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA6DD,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,oBAAoB,2CAqOhG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LC-128 (amended by FZ-7974): on a phone a page's primary action rides the
|
|
3
|
+
* shell's top bar, trailing the page title, instead of spending a row of the
|
|
4
|
+
* page on it. A page registers its action here; the shell draws it in the
|
|
5
|
+
* banner. Without a shell above (bare stories, embedded screens) there is no
|
|
6
|
+
* slot, `useShellTopBarAction` returns false and the page keeps the action
|
|
7
|
+
* in its own control row.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode } from "react";
|
|
10
|
+
interface ShellTopBarSlotValue {
|
|
11
|
+
setAction: (action: ReactNode | null) => void;
|
|
12
|
+
}
|
|
13
|
+
/** Shell side: owns the registered action and exposes the setter. */
|
|
14
|
+
export declare function useShellTopBarSlotState(): {
|
|
15
|
+
action: ReactNode | null;
|
|
16
|
+
value: ShellTopBarSlotValue;
|
|
17
|
+
};
|
|
18
|
+
export declare function ShellTopBarSlotProvider({ value, children, }: {
|
|
19
|
+
value: ShellTopBarSlotValue | null;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Page side: register `action` (or `null` to withdraw it) with the shell's
|
|
24
|
+
* top bar. Re-registers after every render of the caller so the action
|
|
25
|
+
* tracks the page's state. Returns whether a shell took it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useShellTopBarAction(action: ReactNode | null): boolean;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=shellTopBarSlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellTopBarSlot.d.ts","sourceRoot":"","sources":["../../src/shell/shellTopBarSlot.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,UAAU,oBAAoB;IAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;CAC/C;AAID,qEAAqE;AACrE,wBAAgB,uBAAuB,IAAI;IACzC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAIA;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAIA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAUtE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DropdownMenuEntry } from "@multiplatform.one/components";
|
|
1
2
|
import type { BackofficeView } from "../navigation/paths";
|
|
2
3
|
export declare function useViewLabels(): Record<BackofficeView, string>;
|
|
3
4
|
export interface ViewSwitcherMenuProps {
|
|
@@ -5,6 +6,12 @@ export interface ViewSwitcherMenuProps {
|
|
|
5
6
|
current: BackofficeView;
|
|
6
7
|
onViewChange: (view: BackofficeView) => void;
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* The views as checkable menu entries, current check-marked; empty when
|
|
11
|
+
* there is nothing to switch to. The switcher's own menu and the compact
|
|
12
|
+
* list's "…" menu (FZ-7974) share them.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useViewMenuEntries({ views, current, onViewChange, }: ViewSwitcherMenuProps): DropdownMenuEntry[];
|
|
8
15
|
/**
|
|
9
16
|
* Single-select dropdown of the views this doctype can actually render.
|
|
10
17
|
* Hidden when there is nothing to switch to. The current view is always
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewSwitcherMenu.d.ts","sourceRoot":"","sources":["../../src/views/ViewSwitcherMenu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ViewSwitcherMenu.d.ts","sourceRoot":"","sources":["../../src/views/ViewSwitcherMenu.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAe7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAc1D,wBAAgB,aAAa,IAAI,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAW9D;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,OAAO,EAAE,cAAc,CAAC;IACxB,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,OAAO,EACP,YAAY,GACb,EAAE,qBAAqB,GAAG,iBAAiB,EAAE,CAgB7C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,kDAmBvF"}
|