@open-mercato/core 0.6.7-develop.6785.1.1dd7cfac55 → 0.6.7-develop.6795.1.8a3f27921c
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/.turbo/turbo-build.log +1 -1
- package/dist/generated/entities.ids.generated.js +1 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/modules/auth/backend/settings/page.js +14 -9
- package/dist/modules/auth/backend/settings/page.js.map +2 -2
- package/dist/modules/customers/cli.js +17 -7
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +229 -216
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
- package/dist/modules/customers/search.js +50 -29
- package/dist/modules/customers/search.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/[id]/route.js +22 -9
- package/dist/modules/data_sync/api/mappings/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/route.js +13 -4
- package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +7 -2
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/api/run.js +7 -2
- package/dist/modules/data_sync/api/run.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js +7 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/route.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/runs.js +7 -2
- package/dist/modules/data_sync/api/runs.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/[id]/route.js +19 -6
- package/dist/modules/data_sync/api/schedules/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/route.js +13 -4
- package/dist/modules/data_sync/api/schedules/route.js.map +2 -2
- package/dist/modules/data_sync/api/validate.js +9 -4
- package/dist/modules/data_sync/api/validate.js.map +2 -2
- package/dist/modules/design_system/acl.js +9 -0
- package/dist/modules/design_system/acl.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.js +11 -0
- package/dist/modules/design_system/backend/design-system/page.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js +15 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js +52 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +7 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js +63 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js +163 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js.map +7 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js +9 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/banners.js +186 -0
- package/dist/modules/design_system/gallery/entries/banners.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/buttons.js +361 -0
- package/dist/modules/design_system/gallery/entries/buttons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/charts.js +457 -0
- package/dist/modules/design_system/gallery/entries/charts.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/dates.js +306 -0
- package/dist/modules/design_system/gallery/entries/dates.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/detail.js +358 -0
- package/dist/modules/design_system/gallery/entries/detail.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/display.js +785 -0
- package/dist/modules/design_system/gallery/entries/display.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/feedback.js +658 -0
- package/dist/modules/design_system/gallery/entries/feedback.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/filters.js +505 -0
- package/dist/modules/design_system/gallery/entries/filters.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/foundations.js +453 -0
- package/dist/modules/design_system/gallery/entries/foundations.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/icons.js +140 -0
- package/dist/modules/design_system/gallery/entries/icons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/inputs.js +1217 -0
- package/dist/modules/design_system/gallery/entries/inputs.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/messages.js +334 -0
- package/dist/modules/design_system/gallery/entries/messages.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/navigation.js +475 -0
- package/dist/modules/design_system/gallery/entries/navigation.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/notifications.js +257 -0
- package/dist/modules/design_system/gallery/entries/notifications.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/overlays.js +576 -0
- package/dist/modules/design_system/gallery/entries/overlays.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js +378 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/schedule.js +297 -0
- package/dist/modules/design_system/gallery/entries/schedule.js.map +7 -0
- package/dist/modules/design_system/gallery/registry.js +139 -0
- package/dist/modules/design_system/gallery/registry.js.map +7 -0
- package/dist/modules/design_system/gallery/types.js +1 -0
- package/dist/modules/design_system/gallery/types.js.map +7 -0
- package/dist/modules/design_system/index.js +9 -0
- package/dist/modules/design_system/index.js.map +7 -0
- package/dist/modules/design_system/setup.js +14 -0
- package/dist/modules/design_system/setup.js.map +7 -0
- package/dist/modules/inbox_ops/search.js +15 -4
- package/dist/modules/inbox_ops/search.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +11 -5
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/health/route.js +6 -3
- package/dist/modules/integrations/api/[id]/health/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/route.js +6 -3
- package/dist/modules/integrations/api/[id]/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/state/route.js +6 -3
- package/dist/modules/integrations/api/[id]/state/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/version/route.js +6 -3
- package/dist/modules/integrations/api/[id]/version/route.js.map +2 -2
- package/dist/modules/integrations/api/logs/route.js +6 -3
- package/dist/modules/integrations/api/logs/route.js.map +2 -2
- package/dist/modules/integrations/api/route.js +6 -3
- package/dist/modules/integrations/api/route.js.map +2 -2
- package/dist/modules/integrations/api/umes-read.js +2 -2
- package/dist/modules/integrations/api/umes-read.js.map +2 -2
- package/dist/modules/integrations/lib/organization-scope.js +2 -9
- package/dist/modules/integrations/lib/organization-scope.js.map +2 -2
- package/dist/modules/messages/search.js +10 -5
- package/dist/modules/messages/search.js.map +2 -2
- package/dist/modules/query_index/data/entities.js +2 -1
- package/dist/modules/query_index/data/entities.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +32 -50
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js +17 -0
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js.map +7 -0
- package/generated/entities.ids.generated.ts +1 -0
- package/package.json +16 -16
- package/src/modules/auth/backend/settings/page.tsx +17 -8
- package/src/modules/customers/cli.ts +17 -7
- package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +24 -13
- package/src/modules/customers/i18n/de.json +17 -0
- package/src/modules/customers/i18n/en.json +17 -0
- package/src/modules/customers/i18n/es.json +17 -0
- package/src/modules/customers/i18n/pl.json +17 -0
- package/src/modules/customers/search.ts +59 -27
- package/src/modules/data_sync/AGENTS.md +1 -0
- package/src/modules/data_sync/api/mappings/[id]/route.ts +22 -9
- package/src/modules/data_sync/api/mappings/route.ts +13 -4
- package/src/modules/data_sync/api/options.ts +7 -2
- package/src/modules/data_sync/api/run.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +8 -3
- package/src/modules/data_sync/api/runs/[id]/retry.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/route.ts +8 -3
- package/src/modules/data_sync/api/runs.ts +7 -2
- package/src/modules/data_sync/api/schedules/[id]/route.ts +19 -6
- package/src/modules/data_sync/api/schedules/route.ts +13 -4
- package/src/modules/data_sync/api/validate.ts +9 -4
- package/src/modules/design_system/AGENTS.md +34 -0
- package/src/modules/design_system/acl.ts +5 -0
- package/src/modules/design_system/backend/design-system/page.meta.ts +11 -0
- package/src/modules/design_system/backend/design-system/page.tsx +14 -0
- package/src/modules/design_system/gallery/components/CodeSnippet.tsx +55 -0
- package/src/modules/design_system/gallery/components/EntryCard.tsx +95 -0
- package/src/modules/design_system/gallery/components/GalleryShell.tsx +206 -0
- package/src/modules/design_system/gallery/components/VariantPreview.tsx +15 -0
- package/src/modules/design_system/gallery/entries/banners.tsx +226 -0
- package/src/modules/design_system/gallery/entries/buttons.tsx +422 -0
- package/src/modules/design_system/gallery/entries/charts.tsx +518 -0
- package/src/modules/design_system/gallery/entries/dates.tsx +325 -0
- package/src/modules/design_system/gallery/entries/detail.tsx +403 -0
- package/src/modules/design_system/gallery/entries/display.tsx +893 -0
- package/src/modules/design_system/gallery/entries/feedback.tsx +746 -0
- package/src/modules/design_system/gallery/entries/filters.tsx +570 -0
- package/src/modules/design_system/gallery/entries/foundations.tsx +529 -0
- package/src/modules/design_system/gallery/entries/icons.tsx +168 -0
- package/src/modules/design_system/gallery/entries/inputs.tsx +1516 -0
- package/src/modules/design_system/gallery/entries/messages.tsx +339 -0
- package/src/modules/design_system/gallery/entries/navigation.tsx +573 -0
- package/src/modules/design_system/gallery/entries/notifications.tsx +285 -0
- package/src/modules/design_system/gallery/entries/overlays.tsx +677 -0
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +430 -0
- package/src/modules/design_system/gallery/entries/schedule.tsx +307 -0
- package/src/modules/design_system/gallery/registry.ts +152 -0
- package/src/modules/design_system/gallery/types.ts +32 -0
- package/src/modules/design_system/i18n/.hardcoded-allowlist.json +71 -0
- package/src/modules/design_system/i18n/de.json +46 -0
- package/src/modules/design_system/i18n/en.json +46 -0
- package/src/modules/design_system/i18n/es.json +46 -0
- package/src/modules/design_system/i18n/pl.json +46 -0
- package/src/modules/design_system/index.ts +7 -0
- package/src/modules/design_system/setup.ts +12 -0
- package/src/modules/inbox_ops/i18n/de.json +3 -0
- package/src/modules/inbox_ops/i18n/en.json +3 -0
- package/src/modules/inbox_ops/i18n/es.json +3 -0
- package/src/modules/inbox_ops/i18n/pl.json +3 -0
- package/src/modules/inbox_ops/search.ts +20 -4
- package/src/modules/integrations/api/[id]/credentials/route.ts +11 -5
- package/src/modules/integrations/api/[id]/health/route.ts +6 -3
- package/src/modules/integrations/api/[id]/route.ts +6 -3
- package/src/modules/integrations/api/[id]/state/route.ts +6 -3
- package/src/modules/integrations/api/[id]/version/route.ts +6 -3
- package/src/modules/integrations/api/logs/route.ts +6 -3
- package/src/modules/integrations/api/route.ts +6 -3
- package/src/modules/integrations/api/umes-read.ts +2 -2
- package/src/modules/integrations/lib/organization-scope.ts +5 -25
- package/src/modules/messages/i18n/de.json +2 -0
- package/src/modules/messages/i18n/en.json +2 -0
- package/src/modules/messages/i18n/es.json +2 -0
- package/src/modules/messages/i18n/pl.json +2 -0
- package/src/modules/messages/search.ts +11 -5
- package/src/modules/query_index/data/entities.ts +7 -0
- package/src/modules/query_index/lib/engine.ts +40 -63
- package/src/modules/query_index/migrations/.snapshot-open-mercato.json +12 -0
- package/src/modules/query_index/migrations/Migration20260731105052_query_index.ts +35 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useSearchParams } from "next/navigation";
|
|
5
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
6
|
+
import { SectionPage } from "@open-mercato/ui/backend/section-page";
|
|
7
|
+
import { SearchInput } from "@open-mercato/ui/primitives/search-input";
|
|
8
|
+
import { Skeleton } from "@open-mercato/ui/primitives/skeleton";
|
|
9
|
+
import { EmptyState } from "@open-mercato/ui/primitives/empty-state";
|
|
10
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
11
|
+
import { ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
12
|
+
import { GALLERY_BASE_PATH, galleryFamilies } from "../registry.js";
|
|
13
|
+
import { EntryCard } from "./EntryCard.js";
|
|
14
|
+
function familyLabelFallback(id) {
|
|
15
|
+
return id.charAt(0).toUpperCase() + id.slice(1).replace(/[-_]/g, " ");
|
|
16
|
+
}
|
|
17
|
+
function matchesQuery(entry, query) {
|
|
18
|
+
const needle = query.trim().toLowerCase();
|
|
19
|
+
if (!needle) return true;
|
|
20
|
+
if (entry.id.toLowerCase().includes(needle) || entry.title.toLowerCase().includes(needle)) return true;
|
|
21
|
+
if (entry.keywords?.some((keyword) => keyword.toLowerCase().includes(needle))) return true;
|
|
22
|
+
return needle.includes(entry.id.toLowerCase()) || needle.includes(entry.title.toLowerCase());
|
|
23
|
+
}
|
|
24
|
+
function GalleryShell() {
|
|
25
|
+
const t = useT();
|
|
26
|
+
const searchParams = useSearchParams();
|
|
27
|
+
const [loaded, setLoaded] = React.useState({});
|
|
28
|
+
const [failed, setFailed] = React.useState({});
|
|
29
|
+
const [search, setSearch] = React.useState("");
|
|
30
|
+
const pendingRef = React.useRef(/* @__PURE__ */ new Set());
|
|
31
|
+
const familyParam = searchParams?.get("family") ?? null;
|
|
32
|
+
const entryParam = searchParams?.get("entry") ?? null;
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
setSearch("");
|
|
35
|
+
}, [familyParam]);
|
|
36
|
+
const activeFamily = galleryFamilies.find((family) => family.id === familyParam) ?? galleryFamilies[0];
|
|
37
|
+
const activeFamilyId = activeFamily?.id ?? null;
|
|
38
|
+
const loadFamily = React.useCallback((family) => {
|
|
39
|
+
if (pendingRef.current.has(family.id)) return;
|
|
40
|
+
pendingRef.current.add(family.id);
|
|
41
|
+
setFailed((prev) => prev[family.id] ? { ...prev, [family.id]: false } : prev);
|
|
42
|
+
family.load().then((mod) => {
|
|
43
|
+
setLoaded((prev) => prev[family.id] ? prev : { ...prev, [family.id]: mod.entries });
|
|
44
|
+
}).catch(() => {
|
|
45
|
+
pendingRef.current.delete(family.id);
|
|
46
|
+
setFailed((prev) => ({ ...prev, [family.id]: true }));
|
|
47
|
+
});
|
|
48
|
+
}, []);
|
|
49
|
+
const searching = search.trim().length > 0;
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (searching) {
|
|
52
|
+
for (const family of galleryFamilies) loadFamily(family);
|
|
53
|
+
} else if (activeFamily) {
|
|
54
|
+
loadFamily(activeFamily);
|
|
55
|
+
}
|
|
56
|
+
}, [searching, activeFamily, loadFamily]);
|
|
57
|
+
const activeEntries = activeFamilyId ? loaded[activeFamilyId] : void 0;
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
if (!entryParam || searching || !activeEntries) return;
|
|
60
|
+
const node = document.getElementById(`gallery-entry-${entryParam}`);
|
|
61
|
+
node?.scrollIntoView({ block: "start" });
|
|
62
|
+
}, [entryParam, searching, activeEntries]);
|
|
63
|
+
const sections = React.useMemo(
|
|
64
|
+
() => [
|
|
65
|
+
{
|
|
66
|
+
id: "families",
|
|
67
|
+
label: "Families",
|
|
68
|
+
labelKey: "design_system.gallery.familiesGroup",
|
|
69
|
+
items: galleryFamilies.map((family) => ({
|
|
70
|
+
id: family.id,
|
|
71
|
+
label: familyLabelFallback(family.id),
|
|
72
|
+
labelKey: family.labelKey,
|
|
73
|
+
icon: family.icon,
|
|
74
|
+
href: `${GALLERY_BASE_PATH}?family=${family.id}`
|
|
75
|
+
}))
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
[]
|
|
79
|
+
);
|
|
80
|
+
const renderFamilySkeleton = () => /* @__PURE__ */ jsxs("div", { className: "space-y-4", "data-testid": "gallery-family-skeleton", children: [
|
|
81
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" }),
|
|
82
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" })
|
|
83
|
+
] });
|
|
84
|
+
const renderSearchResults = () => {
|
|
85
|
+
const groups = galleryFamilies.map((family) => ({
|
|
86
|
+
family,
|
|
87
|
+
entries: (loaded[family.id] ?? []).filter((entry) => matchesQuery(entry, search))
|
|
88
|
+
})).filter((group) => group.entries.length > 0);
|
|
89
|
+
const stillLoading = galleryFamilies.some((family) => !loaded[family.id] && !failed[family.id]);
|
|
90
|
+
if (groups.length === 0 && stillLoading) return renderFamilySkeleton();
|
|
91
|
+
if (groups.length === 0) {
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
EmptyState,
|
|
94
|
+
{
|
|
95
|
+
title: t("design_system.gallery.noResults", "No components match your search")
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ jsx("div", { className: "space-y-8", children: groups.map(({ family, entries }) => /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
100
|
+
/* @__PURE__ */ jsx("h2", { className: "text-sm font-medium uppercase tracking-wider text-muted-foreground", children: t(family.labelKey, familyLabelFallback(family.id)) }),
|
|
101
|
+
entries.map((entry) => /* @__PURE__ */ jsx(EntryCard, { entry }, entry.id))
|
|
102
|
+
] }, family.id)) });
|
|
103
|
+
};
|
|
104
|
+
const renderActiveFamily = () => {
|
|
105
|
+
if (!activeFamily) return null;
|
|
106
|
+
const entries = loaded[activeFamily.id];
|
|
107
|
+
if (!entries && failed[activeFamily.id]) {
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
ErrorMessage,
|
|
110
|
+
{
|
|
111
|
+
label: t("design_system.gallery.loadFailed", "Could not load this family"),
|
|
112
|
+
action: /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => loadFamily(activeFamily), children: t("design_system.gallery.retry", "Retry") })
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (!entries) return renderFamilySkeleton();
|
|
117
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
118
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t(activeFamily.labelKey, familyLabelFallback(activeFamily.id)) }),
|
|
119
|
+
entries.length > 1 ? /* @__PURE__ */ jsx(
|
|
120
|
+
"nav",
|
|
121
|
+
{
|
|
122
|
+
"aria-label": t("design_system.gallery.familyContents", "Components in this family"),
|
|
123
|
+
className: "flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/30 p-2",
|
|
124
|
+
children: entries.map((entry) => /* @__PURE__ */ jsx(
|
|
125
|
+
"a",
|
|
126
|
+
{
|
|
127
|
+
href: `#gallery-entry-${entry.id}`,
|
|
128
|
+
className: "rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:shadow-focus",
|
|
129
|
+
children: entry.title
|
|
130
|
+
},
|
|
131
|
+
entry.id
|
|
132
|
+
))
|
|
133
|
+
}
|
|
134
|
+
) : null,
|
|
135
|
+
entries.map((entry) => /* @__PURE__ */ jsx(EntryCard, { entry }, entry.id))
|
|
136
|
+
] });
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ jsx(
|
|
139
|
+
SectionPage,
|
|
140
|
+
{
|
|
141
|
+
title: "Design system",
|
|
142
|
+
titleKey: "design_system.nav.title",
|
|
143
|
+
sections,
|
|
144
|
+
activePath: activeFamilyId ? `${GALLERY_BASE_PATH}?family=${activeFamilyId}` : GALLERY_BASE_PATH,
|
|
145
|
+
children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-5xl space-y-6", children: [
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
SearchInput,
|
|
148
|
+
{
|
|
149
|
+
value: search,
|
|
150
|
+
onChange: setSearch,
|
|
151
|
+
placeholder: t("design_system.gallery.searchPlaceholder", "Search components\u2026"),
|
|
152
|
+
"aria-label": t("design_system.gallery.searchPlaceholder", "Search components\u2026")
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
searching ? renderSearchResults() : renderActiveFamily()
|
|
156
|
+
] })
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
GalleryShell
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=GalleryShell.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/design_system/gallery/components/GalleryShell.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useSearchParams } from 'next/navigation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { SectionPage } from '@open-mercato/ui/backend/section-page'\nimport type { SectionNavGroup } from '@open-mercato/ui/backend/section-page'\nimport { SearchInput } from '@open-mercato/ui/primitives/search-input'\nimport { Skeleton } from '@open-mercato/ui/primitives/skeleton'\nimport { EmptyState } from '@open-mercato/ui/primitives/empty-state'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport type { GalleryEntry, GalleryFamily } from '../types'\nimport { GALLERY_BASE_PATH, galleryFamilies } from '../registry'\nimport { EntryCard } from './EntryCard'\n\n/** 'buttons' \u2192 'Buttons' \u2014 untranslated fallback when a family labelKey has no message. */\nfunction familyLabelFallback(id: string): string {\n return id.charAt(0).toUpperCase() + id.slice(1).replace(/[-_]/g, ' ')\n}\n\nfunction matchesQuery(entry: GalleryEntry, query: string): boolean {\n const needle = query.trim().toLowerCase()\n if (!needle) return true\n if (entry.id.toLowerCase().includes(needle) || entry.title.toLowerCase().includes(needle)) return true\n if (entry.keywords?.some((keyword) => keyword.toLowerCase().includes(needle))) return true\n // 'radiobutton' should still find 'radio' \u2014 match when the query CONTAINS the id/title too.\n return needle.includes(entry.id.toLowerCase()) || needle.includes(entry.title.toLowerCase())\n}\n\ntype LoadedEntries = Record<string, GalleryEntry[]>\n\nexport function GalleryShell() {\n const t = useT()\n const searchParams = useSearchParams()\n const [loaded, setLoaded] = React.useState<LoadedEntries>({})\n const [failed, setFailed] = React.useState<Record<string, boolean>>({})\n const [search, setSearch] = React.useState('')\n const pendingRef = React.useRef(new Set<string>())\n\n const familyParam = searchParams?.get('family') ?? null\n const entryParam = searchParams?.get('entry') ?? null\n\n // Clicking a family in the section nav exits search mode \u2014 otherwise the\n // query keeps precedence and family navigation appears dead.\n React.useEffect(() => {\n setSearch('')\n }, [familyParam])\n const activeFamily: GalleryFamily | undefined =\n galleryFamilies.find((family) => family.id === familyParam) ?? galleryFamilies[0]\n const activeFamilyId = activeFamily?.id ?? null\n\n const loadFamily = React.useCallback((family: GalleryFamily) => {\n if (pendingRef.current.has(family.id)) return\n pendingRef.current.add(family.id)\n setFailed((prev) => (prev[family.id] ? { ...prev, [family.id]: false } : prev))\n family\n .load()\n .then((mod) => {\n setLoaded((prev) => (prev[family.id] ? prev : { ...prev, [family.id]: mod.entries }))\n })\n .catch(() => {\n pendingRef.current.delete(family.id)\n setFailed((prev) => ({ ...prev, [family.id]: true }))\n })\n }, [])\n\n // Lazy-load the active family; when searching, load every family so results\n // span the whole gallery.\n const searching = search.trim().length > 0\n React.useEffect(() => {\n if (searching) {\n for (const family of galleryFamilies) loadFamily(family)\n } else if (activeFamily) {\n loadFamily(activeFamily)\n }\n }, [searching, activeFamily, loadFamily])\n\n // Deep link: ?entry=<id> scrolls the entry into view once its family loaded.\n const activeEntries = activeFamilyId ? loaded[activeFamilyId] : undefined\n React.useEffect(() => {\n if (!entryParam || searching || !activeEntries) return\n const node = document.getElementById(`gallery-entry-${entryParam}`)\n node?.scrollIntoView({ block: 'start' })\n }, [entryParam, searching, activeEntries])\n\n const sections: SectionNavGroup[] = React.useMemo(\n () => [\n {\n id: 'families',\n label: 'Families',\n labelKey: 'design_system.gallery.familiesGroup',\n items: galleryFamilies.map((family) => ({\n id: family.id,\n label: familyLabelFallback(family.id),\n labelKey: family.labelKey,\n icon: family.icon,\n href: `${GALLERY_BASE_PATH}?family=${family.id}`,\n })),\n },\n ],\n [],\n )\n\n const renderFamilySkeleton = () => (\n <div className=\"space-y-4\" data-testid=\"gallery-family-skeleton\">\n <Skeleton className=\"h-40 w-full\" />\n <Skeleton className=\"h-40 w-full\" />\n </div>\n )\n\n const renderSearchResults = () => {\n const groups = galleryFamilies\n .map((family) => ({\n family,\n entries: (loaded[family.id] ?? []).filter((entry) => matchesQuery(entry, search)),\n }))\n .filter((group) => group.entries.length > 0)\n const stillLoading = galleryFamilies.some((family) => !loaded[family.id] && !failed[family.id])\n if (groups.length === 0 && stillLoading) return renderFamilySkeleton()\n if (groups.length === 0) {\n return (\n <EmptyState\n title={t('design_system.gallery.noResults', 'No components match your search')}\n />\n )\n }\n return (\n <div className=\"space-y-8\">\n {groups.map(({ family, entries }) => (\n <div key={family.id} className=\"space-y-4\">\n <h2 className=\"text-sm font-medium uppercase tracking-wider text-muted-foreground\">\n {t(family.labelKey, familyLabelFallback(family.id))}\n </h2>\n {entries.map((entry) => (\n <EntryCard key={entry.id} entry={entry} />\n ))}\n </div>\n ))}\n </div>\n )\n }\n\n const renderActiveFamily = () => {\n if (!activeFamily) return null\n const entries = loaded[activeFamily.id]\n if (!entries && failed[activeFamily.id]) {\n return (\n <ErrorMessage\n label={t('design_system.gallery.loadFailed', 'Could not load this family')}\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => loadFamily(activeFamily)}>\n {t('design_system.gallery.retry', 'Retry')}\n </Button>\n }\n />\n )\n }\n if (!entries) return renderFamilySkeleton()\n return (\n <div className=\"space-y-4\">\n <h2 className=\"text-lg font-semibold\">\n {t(activeFamily.labelKey, familyLabelFallback(activeFamily.id))}\n </h2>\n {entries.length > 1 ? (\n <nav\n aria-label={t('design_system.gallery.familyContents', 'Components in this family')}\n className=\"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/30 p-2\"\n >\n {entries.map((entry) => (\n <a\n key={entry.id}\n href={`#gallery-entry-${entry.id}`}\n className=\"rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:shadow-focus\"\n >\n {entry.title}\n </a>\n ))}\n </nav>\n ) : null}\n {entries.map((entry) => (\n <EntryCard key={entry.id} entry={entry} />\n ))}\n </div>\n )\n }\n\n return (\n <SectionPage\n title=\"Design system\"\n titleKey=\"design_system.nav.title\"\n sections={sections}\n activePath={activeFamilyId ? `${GALLERY_BASE_PATH}?family=${activeFamilyId}` : GALLERY_BASE_PATH}\n >\n <div className=\"mx-auto w-full max-w-5xl space-y-6\">\n <SearchInput\n value={search}\n onChange={setSearch}\n placeholder={t('design_system.gallery.searchPlaceholder', 'Search components\u2026')}\n aria-label={t('design_system.gallery.searchPlaceholder', 'Search components\u2026')}\n />\n {searching ? renderSearchResults() : renderActiveFamily()}\n </div>\n </SectionPage>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAyGI,SACE,KADF;AAvGJ,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAE5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAE7B,SAAS,mBAAmB,uBAAuB;AACnD,SAAS,iBAAiB;AAG1B,SAAS,oBAAoB,IAAoB;AAC/C,SAAO,GAAG,OAAO,CAAC,EAAE,YAAY,IAAI,GAAG,MAAM,CAAC,EAAE,QAAQ,SAAS,GAAG;AACtE;AAEA,SAAS,aAAa,OAAqB,OAAwB;AACjE,QAAM,SAAS,MAAM,KAAK,EAAE,YAAY;AACxC,MAAI,CAAC,OAAQ,QAAO;AACpB,MAAI,MAAM,GAAG,YAAY,EAAE,SAAS,MAAM,KAAK,MAAM,MAAM,YAAY,EAAE,SAAS,MAAM,EAAG,QAAO;AAClG,MAAI,MAAM,UAAU,KAAK,CA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AAE,CAAC,GAChE;AAAA,MACC,QAAQ,SAAS,IAChB;AAAA,QAAC;AAAA;AAAA,UACC,cAAY,EAAE,wCAAwC,2BAA2B;AAAA,UACjF,WAAU;AAAA,UAET,kBAAQ,IAAI,CAAC,UACZ;AAAA,YAAC;AAAA;AAAA,cAEC,MAAM,kBAAkB,MAAM,EAAE;AAAA,cAChC,WAAU;AAAA,cAET,gBAAM;AAAA;AAAA,YAJF,MAAM;AAAA,UAKb,CACD;AAAA;AAAA,MACH,IACE;AAAA,MACH,QAAQ,IAAI,CAAC,UACZ,oBAAC,aAAyB,SAAV,MAAM,EAAkB,CACzC;AAAA,OACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,UAAS;AAAA,MACT;AAAA,MACA,YAAY,iBAAiB,GAAG,iBAAiB,WAAW,cAAc,KAAK;AAAA,MAE/E,+BAAC,SAAI,WAAU,sCACb;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,YACP,UAAU;AAAA,YACV,aAAa,EAAE,2CAA2C,yBAAoB;AAAA,YAC9E,cAAY,EAAE,2CAA2C,yBAAoB;AAAA;AAAA,QAC/E;AAAA,QACC,YAAY,oBAAoB,IAAI,mBAAmB;AAAA,SAC1D;AAAA;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function VariantPreview({ children }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-3 rounded-md border border-border bg-background p-4", children });
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
VariantPreview
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=VariantPreview.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/design_system/gallery/components/VariantPreview.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\n\n/**\n * Bordered stage a variant renders inside. Chrome uses semantic tokens only \u2014\n * the stage must never impose colors of its own on the previewed component.\n */\nexport function VariantPreview({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"flex flex-wrap items-center gap-3 rounded-md border border-border bg-background p-4\">\n {children}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAUI;AAFG,SAAS,eAAe,EAAE,SAAS,GAAkC;AAC1E,SACE,oBAAC,SAAI,WAAU,uFACZ,UACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CircleCheck, Rocket, Sparkles } from "lucide-react";
|
|
3
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
4
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
5
|
+
import { NextStepCallout } from "@open-mercato/ui/backend/NextStepCallout";
|
|
6
|
+
import { ContextHelp } from "@open-mercato/ui/backend/ContextHelp";
|
|
7
|
+
const flashMessagesEntry = {
|
|
8
|
+
id: "flash-messages",
|
|
9
|
+
title: "FlashMessages",
|
|
10
|
+
importPath: "@open-mercato/ui/backend/FlashMessages",
|
|
11
|
+
variants: [
|
|
12
|
+
{
|
|
13
|
+
id: "kinds",
|
|
14
|
+
title: "flash() kinds (toast via the AppShell singleton)",
|
|
15
|
+
render: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => flash("Changes saved", "success"), children: "Fire success" }),
|
|
17
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => flash("Sync scheduled", "info"), children: "Fire info" }),
|
|
18
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => flash("Quota almost reached", "warning"), children: "Fire warning" }),
|
|
19
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => flash("Save failed", "error"), children: "Fire error" })
|
|
20
|
+
] }),
|
|
21
|
+
code: `import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
22
|
+
|
|
23
|
+
// FlashMessages is mounted once by AppShell \u2014 never mount your own.
|
|
24
|
+
flash('Changes saved', 'success')
|
|
25
|
+
flash('Sync scheduled', 'info')
|
|
26
|
+
flash('Quota almost reached', 'warning')
|
|
27
|
+
flash('Save failed', 'error')`
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
const nextStepCalloutEntry = {
|
|
32
|
+
id: "next-step-callout",
|
|
33
|
+
title: "NextStepCallout",
|
|
34
|
+
importPath: "@open-mercato/ui/backend/NextStepCallout",
|
|
35
|
+
variants: [
|
|
36
|
+
{
|
|
37
|
+
id: "basic",
|
|
38
|
+
title: "Basic",
|
|
39
|
+
render: () => /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
|
|
40
|
+
NextStepCallout,
|
|
41
|
+
{
|
|
42
|
+
icon: /* @__PURE__ */ jsx(Rocket, { className: "size-6" }),
|
|
43
|
+
title: "Publish your catalog",
|
|
44
|
+
description: "Products are imported and priced. Publishing makes them visible on every sales channel.",
|
|
45
|
+
actionLabel: "Publish catalog",
|
|
46
|
+
actionIcon: /* @__PURE__ */ jsx(Sparkles, { className: "mr-2 size-4" }),
|
|
47
|
+
onAction: () => {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
code: `import { Rocket, Sparkles } from 'lucide-react'
|
|
52
|
+
import { NextStepCallout } from '@open-mercato/ui/backend/NextStepCallout'
|
|
53
|
+
|
|
54
|
+
<NextStepCallout
|
|
55
|
+
icon={<Rocket className="size-6" />}
|
|
56
|
+
title="Publish your catalog"
|
|
57
|
+
description="Products are imported and priced. Publishing makes them visible on every sales channel."
|
|
58
|
+
actionLabel="Publish catalog"
|
|
59
|
+
actionIcon={<Sparkles className="mr-2 size-4" />}
|
|
60
|
+
onAction={handlePublish}
|
|
61
|
+
/>`
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "with-steps",
|
|
65
|
+
title: "With steps",
|
|
66
|
+
render: () => /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
|
|
67
|
+
NextStepCallout,
|
|
68
|
+
{
|
|
69
|
+
title: "Finish store setup",
|
|
70
|
+
description: "Two steps are done \u2014 connect a payment provider to start selling.",
|
|
71
|
+
steps: [
|
|
72
|
+
{ id: "import", label: "Import products", state: "completed" },
|
|
73
|
+
{ id: "pricing", label: "Set pricing", state: "completed" },
|
|
74
|
+
{ id: "payments", label: "Connect payments", state: "active" },
|
|
75
|
+
{ id: "launch", label: "Launch", state: "pending" }
|
|
76
|
+
],
|
|
77
|
+
actionLabel: "Connect payments",
|
|
78
|
+
onAction: () => {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
) }),
|
|
82
|
+
code: `import { NextStepCallout } from '@open-mercato/ui/backend/NextStepCallout'
|
|
83
|
+
|
|
84
|
+
<NextStepCallout
|
|
85
|
+
title="Finish store setup"
|
|
86
|
+
description="Two steps are done \u2014 connect a payment provider to start selling."
|
|
87
|
+
steps={[
|
|
88
|
+
{ id: 'import', label: 'Import products', state: 'completed' },
|
|
89
|
+
{ id: 'pricing', label: 'Set pricing', state: 'completed' },
|
|
90
|
+
{ id: 'payments', label: 'Connect payments', state: 'active' },
|
|
91
|
+
{ id: 'launch', label: 'Launch', state: 'pending' },
|
|
92
|
+
]}
|
|
93
|
+
actionLabel="Connect payments"
|
|
94
|
+
onAction={handleConnect}
|
|
95
|
+
/>`
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "with-status",
|
|
99
|
+
title: "With status progress",
|
|
100
|
+
render: () => /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
|
|
101
|
+
NextStepCallout,
|
|
102
|
+
{
|
|
103
|
+
title: "Index your products",
|
|
104
|
+
description: "Search stays disabled until the first indexing run completes.",
|
|
105
|
+
actionLabel: "Re-run indexing",
|
|
106
|
+
onAction: () => {
|
|
107
|
+
},
|
|
108
|
+
busy: true,
|
|
109
|
+
status: {
|
|
110
|
+
tone: "info",
|
|
111
|
+
icon: /* @__PURE__ */ jsx(CircleCheck, { className: "size-4" }),
|
|
112
|
+
label: "Indexing in progress",
|
|
113
|
+
progressValue: 64,
|
|
114
|
+
progressDescription: "1,280 of 2,000 products indexed"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
) }),
|
|
118
|
+
code: `import { CircleCheck } from 'lucide-react'
|
|
119
|
+
import { NextStepCallout } from '@open-mercato/ui/backend/NextStepCallout'
|
|
120
|
+
|
|
121
|
+
<NextStepCallout
|
|
122
|
+
title="Index your products"
|
|
123
|
+
description="Search stays disabled until the first indexing run completes."
|
|
124
|
+
actionLabel="Re-run indexing"
|
|
125
|
+
onAction={handleReindex}
|
|
126
|
+
busy
|
|
127
|
+
status={{
|
|
128
|
+
tone: 'info',
|
|
129
|
+
icon: <CircleCheck className="size-4" />,
|
|
130
|
+
label: 'Indexing in progress',
|
|
131
|
+
progressValue: 64,
|
|
132
|
+
progressDescription: '1,280 of 2,000 products indexed',
|
|
133
|
+
}}
|
|
134
|
+
/>`
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
};
|
|
138
|
+
const contextHelpEntry = {
|
|
139
|
+
id: "context-help",
|
|
140
|
+
title: "ContextHelp",
|
|
141
|
+
importPath: "@open-mercato/ui/backend/ContextHelp",
|
|
142
|
+
variants: [
|
|
143
|
+
{
|
|
144
|
+
id: "default",
|
|
145
|
+
title: "default (collapsed)",
|
|
146
|
+
render: () => /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsx(ContextHelp, { title: "How do exchange rates work?", children: "Rates refresh nightly from the configured provider. Manual overrides stay pinned until you clear them." }) }),
|
|
147
|
+
code: `import { ContextHelp } from '@open-mercato/ui/backend/ContextHelp'
|
|
148
|
+
|
|
149
|
+
<ContextHelp title="How do exchange rates work?">
|
|
150
|
+
Rates refresh nightly from the configured provider. Manual overrides
|
|
151
|
+
stay pinned until you clear them.
|
|
152
|
+
</ContextHelp>`
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "default-open",
|
|
156
|
+
title: "defaultOpen",
|
|
157
|
+
render: () => /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsx(ContextHelp, { title: "Why is this field required?", defaultOpen: true, children: "The tax office identifier is mandatory for invoices issued to companies registered in the EU." }) }),
|
|
158
|
+
code: `import { ContextHelp } from '@open-mercato/ui/backend/ContextHelp'
|
|
159
|
+
|
|
160
|
+
<ContextHelp title="Why is this field required?" defaultOpen>
|
|
161
|
+
The tax office identifier is mandatory for invoices issued to
|
|
162
|
+
companies registered in the EU.
|
|
163
|
+
</ContextHelp>`
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "info-icon",
|
|
167
|
+
title: "Info icon (bulb={false})",
|
|
168
|
+
render: () => /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsx(ContextHelp, { title: "About draft orders", bulb: false, defaultOpen: true, children: "Draft orders are invisible to customers and skip stock reservation until they are confirmed." }) }),
|
|
169
|
+
code: `import { ContextHelp } from '@open-mercato/ui/backend/ContextHelp'
|
|
170
|
+
|
|
171
|
+
<ContextHelp title="About draft orders" bulb={false} defaultOpen>
|
|
172
|
+
Draft orders are invisible to customers and skip stock reservation
|
|
173
|
+
until they are confirmed.
|
|
174
|
+
</ContextHelp>`
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
};
|
|
178
|
+
const entries = [
|
|
179
|
+
flashMessagesEntry,
|
|
180
|
+
nextStepCalloutEntry,
|
|
181
|
+
contextHelpEntry
|
|
182
|
+
];
|
|
183
|
+
export {
|
|
184
|
+
entries
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=banners.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/design_system/gallery/entries/banners.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport { CircleCheck, Rocket, Sparkles } from 'lucide-react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { NextStepCallout } from '@open-mercato/ui/backend/NextStepCallout'\nimport { ContextHelp } from '@open-mercato/ui/backend/ContextHelp'\nimport type { GalleryEntry } from '../types'\n\n// Component titles and variant names are proper nouns from the codebase and\n// are deliberately not translated. `code` MUST contain the entry's importPath\n// (enforced by the registry-integrity test) and is always reviewed alongside\n// its sibling `render`.\n\n// `FlashMessages` itself is a singleton mounted by AppShell \u2014 the gallery only\n// demonstrates the imperative `flash()` API; the triggered toast renders\n// through the already-mounted singleton.\nconst flashMessagesEntry: GalleryEntry = {\n id: 'flash-messages',\n title: 'FlashMessages',\n importPath: '@open-mercato/ui/backend/FlashMessages',\n variants: [\n {\n id: 'kinds',\n title: 'flash() kinds (toast via the AppShell singleton)',\n render: () => (\n <>\n <Button variant=\"outline\" onClick={() => flash('Changes saved', 'success')}>\n Fire success\n </Button>\n <Button variant=\"outline\" onClick={() => flash('Sync scheduled', 'info')}>\n Fire info\n </Button>\n <Button variant=\"outline\" onClick={() => flash('Quota almost reached', 'warning')}>\n Fire warning\n </Button>\n <Button variant=\"outline\" onClick={() => flash('Save failed', 'error')}>\n Fire error\n </Button>\n </>\n ),\n code: `import { flash } from '@open-mercato/ui/backend/FlashMessages'\n\n// FlashMessages is mounted once by AppShell \u2014 never mount your own.\nflash('Changes saved', 'success')\nflash('Sync scheduled', 'info')\nflash('Quota almost reached', 'warning')\nflash('Save failed', 'error')`,\n },\n ],\n}\n\nconst nextStepCalloutEntry: GalleryEntry = {\n id: 'next-step-callout',\n title: 'NextStepCallout',\n importPath: '@open-mercato/ui/backend/NextStepCallout',\n variants: [\n {\n id: 'basic',\n title: 'Basic',\n render: () => (\n <div className=\"w-full\">\n <NextStepCallout\n icon={<Rocket className=\"size-6\" />}\n title=\"Publish your catalog\"\n description=\"Products are imported and priced. Publishing makes them visible on every sales channel.\"\n actionLabel=\"Publish catalog\"\n actionIcon={<Sparkles className=\"mr-2 size-4\" />}\n onAction={() => {}}\n />\n </div>\n ),\n code: `import { Rocket, Sparkles } from 'lucide-react'\nimport { NextStepCallout } from '@open-mercato/ui/backend/NextStepCallout'\n\n<NextStepCallout\n icon={<Rocket className=\"size-6\" />}\n title=\"Publish your catalog\"\n description=\"Products are imported and priced. Publishing makes them visible on every sales channel.\"\n actionLabel=\"Publish catalog\"\n actionIcon={<Sparkles className=\"mr-2 size-4\" />}\n onAction={handlePublish}\n/>`,\n },\n {\n id: 'with-steps',\n title: 'With steps',\n render: () => (\n <div className=\"w-full\">\n <NextStepCallout\n title=\"Finish store setup\"\n description=\"Two steps are done \u2014 connect a payment provider to start selling.\"\n steps={[\n { id: 'import', label: 'Import products', state: 'completed' },\n { id: 'pricing', label: 'Set pricing', state: 'completed' },\n { id: 'payments', label: 'Connect payments', state: 'active' },\n { id: 'launch', label: 'Launch', state: 'pending' },\n ]}\n actionLabel=\"Connect payments\"\n onAction={() => {}}\n />\n </div>\n ),\n code: `import { NextStepCallout } from '@open-mercato/ui/backend/NextStepCallout'\n\n<NextStepCallout\n title=\"Finish store setup\"\n description=\"Two steps are done \u2014 connect a payment provider to start selling.\"\n steps={[\n { id: 'import', label: 'Import products', state: 'completed' },\n { id: 'pricing', label: 'Set pricing', state: 'completed' },\n { id: 'payments', label: 'Connect payments', state: 'active' },\n { id: 'launch', label: 'Launch', state: 'pending' },\n ]}\n actionLabel=\"Connect payments\"\n onAction={handleConnect}\n/>`,\n },\n {\n id: 'with-status',\n title: 'With status progress',\n render: () => (\n <div className=\"w-full\">\n <NextStepCallout\n title=\"Index your products\"\n description=\"Search stays disabled until the first indexing run completes.\"\n actionLabel=\"Re-run indexing\"\n onAction={() => {}}\n busy\n status={{\n tone: 'info',\n icon: <CircleCheck className=\"size-4\" />,\n label: 'Indexing in progress',\n progressValue: 64,\n progressDescription: '1,280 of 2,000 products indexed',\n }}\n />\n </div>\n ),\n code: `import { CircleCheck } from 'lucide-react'\nimport { NextStepCallout } from '@open-mercato/ui/backend/NextStepCallout'\n\n<NextStepCallout\n title=\"Index your products\"\n description=\"Search stays disabled until the first indexing run completes.\"\n actionLabel=\"Re-run indexing\"\n onAction={handleReindex}\n busy\n status={{\n tone: 'info',\n icon: <CircleCheck className=\"size-4\" />,\n label: 'Indexing in progress',\n progressValue: 64,\n progressDescription: '1,280 of 2,000 products indexed',\n }}\n/>`,\n },\n ],\n}\n\nconst contextHelpEntry: GalleryEntry = {\n id: 'context-help',\n title: 'ContextHelp',\n importPath: '@open-mercato/ui/backend/ContextHelp',\n variants: [\n {\n id: 'default',\n title: 'default (collapsed)',\n render: () => (\n <div className=\"w-full max-w-md\">\n <ContextHelp title=\"How do exchange rates work?\">\n Rates refresh nightly from the configured provider. Manual overrides\n stay pinned until you clear them.\n </ContextHelp>\n </div>\n ),\n code: `import { ContextHelp } from '@open-mercato/ui/backend/ContextHelp'\n\n<ContextHelp title=\"How do exchange rates work?\">\n Rates refresh nightly from the configured provider. Manual overrides\n stay pinned until you clear them.\n</ContextHelp>`,\n },\n {\n id: 'default-open',\n title: 'defaultOpen',\n render: () => (\n <div className=\"w-full max-w-md\">\n <ContextHelp title=\"Why is this field required?\" defaultOpen>\n The tax office identifier is mandatory for invoices issued to\n companies registered in the EU.\n </ContextHelp>\n </div>\n ),\n code: `import { ContextHelp } from '@open-mercato/ui/backend/ContextHelp'\n\n<ContextHelp title=\"Why is this field required?\" defaultOpen>\n The tax office identifier is mandatory for invoices issued to\n companies registered in the EU.\n</ContextHelp>`,\n },\n {\n id: 'info-icon',\n title: 'Info icon (bulb={false})',\n render: () => (\n <div className=\"w-full max-w-md\">\n <ContextHelp title=\"About draft orders\" bulb={false} defaultOpen>\n Draft orders are invisible to customers and skip stock reservation\n until they are confirmed.\n </ContextHelp>\n </div>\n ),\n code: `import { ContextHelp } from '@open-mercato/ui/backend/ContextHelp'\n\n<ContextHelp title=\"About draft orders\" bulb={false} defaultOpen>\n Draft orders are invisible to customers and skip stock reservation\n until they are confirmed.\n</ContextHelp>`,\n },\n ],\n}\n\nexport const entries: GalleryEntry[] = [\n flashMessagesEntry,\n nextStepCalloutEntry,\n contextHelpEntry,\n]\n"],
|
|
5
|
+
"mappings": "AAyBQ,mBACE,KADF;AAxBR,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAW5B,MAAM,qBAAmC;AAAA,EACvC,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,UAAU;AAAA,IACR;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,QAAQ,MACN,iCACE;AAAA,4BAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,MAAM,iBAAiB,SAAS,GAAG,0BAE5E;AAAA,QACA,oBAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,MAAM,kBAAkB,MAAM,GAAG,uBAE1E;AAAA,QACA,oBAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,MAAM,wBAAwB,SAAS,GAAG,0BAEnF;AAAA,QACA,oBAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,MAAM,eAAe,OAAO,GAAG,wBAExE;AAAA,SACF;AAAA,MAEF,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOR;AAAA,EACF;AACF;AAEA,MAAM,uBAAqC;AAAA,EACzC,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,UAAU;AAAA,IACR;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MAC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