@inf-monkeys-tech/monkeys-design 2.0.30 → 2.0.32

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.
@@ -3,7 +3,7 @@ import { createContext, forwardRef, useImperativeHandle, useContext, useMemo, us
3
3
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
- import { ChevronDown, Check, ChevronRight, Circle, ChevronUp, ArrowUp, ArrowDown, Pencil, Trash2, Image, File, LoaderCircle, CircleAlert, RotateCcw, X, Paperclip, FileText, Mic, Send, Square, ShoppingBag, Code2, Search, Palette, Sparkles, ArrowLeft, Upload, ArrowUpRight, Plus, Pin, Blocks, Settings, Clock3, TerminalSquare, FileOutput, Download, PanelLeft, PanelRight, Loader2, ListFilter, Link2, TriangleAlert, RefreshCw, ExternalLink, PanelRightClose, Wrench, BookOpen, Bot, SquarePen, MessageSquare, CheckCircle2, XCircle, CircleStop, AlertCircle, GitFork, PencilLine, Copy, FileCode2, Files, TestTube2, Globe2, Film, Presentation, FileImage, Music2, Ellipsis } from 'lucide-react';
6
+ import { ChevronDown, Check, ChevronRight, Circle, ChevronUp, ArrowUp, ArrowDown, Pencil, Trash2, Image, File, LoaderCircle, CircleAlert, RotateCcw, X, Paperclip, FileText, Mic, Send, Square, Sparkles, ShoppingBag, Code2, Search, Palette, ArrowLeft, Upload, ArrowUpRight, Plus, Pin, Blocks, Settings, Clock3, TerminalSquare, FileOutput, Download, PanelLeft, PanelRight, Loader2, ListFilter, Link2, TriangleAlert, RefreshCw, ExternalLink, PanelRightClose, Wrench, BookOpen, Bot, SquarePen, MessageSquare, CheckCircle2, XCircle, CircleStop, AlertCircle, GitFork, PencilLine, Copy, FileCode2, Files, TestTube2, Globe2, Film, Presentation, FileImage, Music2, Ellipsis } from 'lucide-react';
7
7
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
8
8
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
9
9
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -1786,6 +1786,7 @@ var ICONS = {
1786
1786
  code: Code2,
1787
1787
  "shopping-bag": ShoppingBag
1788
1788
  };
1789
+ var QUICK_START_CATEGORY_ID = "__quick-start__";
1789
1790
  function TemplateVisual({ template }) {
1790
1791
  const Icon2 = ICONS[template.icon || "sparkles"];
1791
1792
  if (template.coverImageUrl) {
@@ -1809,21 +1810,47 @@ function AgentWorkbenchQuickStart({ viewModel, className, onIntent }) {
1809
1810
  })).filter((category) => category.sections.length > 0),
1810
1811
  [viewModel.categories, viewModel.mode]
1811
1812
  );
1812
- const activeCategory = categories.find((category) => category.id === activeCategoryId);
1813
+ const quickStartCategory = useMemo(() => {
1814
+ const templates = categories.flatMap((category) => category.sections.filter((section) => section.id === "quick-start")).map((section) => section.templates).flat().filter((template, index, allTemplates) => allTemplates.findIndex((item) => item.id === template.id) === index);
1815
+ if (templates.length === 0) return void 0;
1816
+ return {
1817
+ id: QUICK_START_CATEGORY_ID,
1818
+ label: messages.label,
1819
+ icon: "sparkles",
1820
+ sections: [
1821
+ {
1822
+ id: "quick-start",
1823
+ label: messages.label,
1824
+ templates
1825
+ }
1826
+ ]
1827
+ };
1828
+ }, [categories, messages.label]);
1829
+ const activeCategory = activeCategoryId === QUICK_START_CATEGORY_ID ? quickStartCategory : categories.find((category) => category.id === activeCategoryId);
1813
1830
  const activeSection = activeCategory?.sections.find((section) => section.id === activeSectionId) || activeCategory?.sections[0];
1814
1831
  const usesCompactList = activeSection?.templates.length ? activeSection.templates.every((template) => !template.coverImageUrl) : false;
1815
1832
  useEffect(() => {
1816
- if (activeCategoryId && !categories.some((category) => category.id === activeCategoryId)) {
1833
+ if (activeCategoryId && activeCategoryId !== QUICK_START_CATEGORY_ID && !categories.some((category) => category.id === activeCategoryId)) {
1817
1834
  setActiveCategoryId(void 0);
1818
1835
  setActiveSectionId(void 0);
1819
1836
  }
1820
- }, [activeCategoryId, categories]);
1837
+ if (activeCategoryId === QUICK_START_CATEGORY_ID && !quickStartCategory) {
1838
+ setActiveCategoryId(void 0);
1839
+ setActiveSectionId(void 0);
1840
+ }
1841
+ }, [activeCategoryId, categories, quickStartCategory]);
1821
1842
  if (categories.length === 0) return null;
1822
1843
  const selectCategory = (category) => {
1823
1844
  setActiveCategoryId(category.id);
1824
1845
  setActiveSectionId(category.sections[0]?.id);
1825
1846
  onIntent?.({ type: "change-category", categoryId: category.id });
1826
1847
  };
1848
+ const selectQuickStart = () => {
1849
+ if (!quickStartCategory) return;
1850
+ setActiveCategoryId(QUICK_START_CATEGORY_ID);
1851
+ setActiveSectionId(quickStartCategory.sections[0]?.id);
1852
+ onIntent?.({ type: "change-category" });
1853
+ };
1827
1854
  const selectSection = (sectionId) => {
1828
1855
  if (!activeCategory) return;
1829
1856
  setActiveSectionId(sectionId);
@@ -1872,13 +1899,28 @@ function AgentWorkbenchQuickStart({ viewModel, className, onIntent }) {
1872
1899
  }
1873
1900
  }
1874
1901
  ),
1875
- !activeCategory ? /* @__PURE__ */ jsx("div", { className: "flex max-w-full items-center justify-center gap-2 overflow-x-auto px-1 pb-1", children: categories.map((category) => {
1876
- const Icon2 = ICONS[category.icon || "sparkles"];
1877
- return /* @__PURE__ */ jsxs("button", { type: "button", className: "inline-flex h-10 shrink-0 items-center gap-2 rounded-full border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", onClick: () => selectCategory(category), children: [
1878
- /* @__PURE__ */ jsx(Icon2, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
1879
- category.label
1880
- ] }, category.id);
1881
- }) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
1902
+ !activeCategory ? /* @__PURE__ */ jsxs("div", { className: "flex max-w-full items-center justify-center gap-2 overflow-x-auto px-1 pb-1", children: [
1903
+ quickStartCategory ? /* @__PURE__ */ jsxs(
1904
+ "button",
1905
+ {
1906
+ type: "button",
1907
+ className: "inline-flex h-10 shrink-0 items-center gap-2 rounded-full border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1908
+ "aria-pressed": activeCategoryId === QUICK_START_CATEGORY_ID,
1909
+ onClick: selectQuickStart,
1910
+ children: [
1911
+ /* @__PURE__ */ jsx(Sparkles, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
1912
+ messages.label
1913
+ ]
1914
+ }
1915
+ ) : null,
1916
+ categories.map((category) => {
1917
+ const Icon2 = ICONS[category.icon || "sparkles"];
1918
+ return /* @__PURE__ */ jsxs("button", { type: "button", className: "inline-flex h-10 shrink-0 items-center gap-2 rounded-full border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", onClick: () => selectCategory(category), children: [
1919
+ /* @__PURE__ */ jsx(Icon2, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
1920
+ category.label
1921
+ ] }, category.id);
1922
+ })
1923
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
1882
1924
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 max-w-full items-center gap-1 overflow-x-auto pb-1", children: [
1883
1925
  /* @__PURE__ */ jsxs(
1884
1926
  "button",
@@ -1896,7 +1938,7 @@ function AgentWorkbenchQuickStart({ viewModel, className, onIntent }) {
1896
1938
  ]
1897
1939
  }
1898
1940
  ),
1899
- activeCategory.sections.map((section) => /* @__PURE__ */ jsx("button", { type: "button", "aria-pressed": activeSection?.id === section.id, className: cn2("h-9 shrink-0 rounded-full px-4 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", activeSection?.id === section.id ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground"), onClick: () => selectSection(section.id), children: section.label }, section.id))
1941
+ activeCategory.sections.map((section, index) => /* @__PURE__ */ jsx("button", { type: "button", "aria-pressed": activeSection?.id === section.id, className: cn2("h-9 shrink-0 rounded-full px-4 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", activeSection?.id === section.id ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground"), onClick: () => selectSection(section.id), children: activeCategory.id !== QUICK_START_CATEGORY_ID && index === 0 ? activeCategory.label : section.label }, section.id))
1900
1942
  ] }),
1901
1943
  /* @__PURE__ */ jsx(
1902
1944
  "div",