@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.
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import * as React4 from 'react';
4
4
  import React4__default, { forwardRef, useMemo, useId, useRef, useState, useEffect, createElement, createContext, useCallback, useContext, Children, isValidElement, Fragment as Fragment$1, useLayoutEffect } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import * as PopoverPrimitive from '@radix-ui/react-popover';
7
- import { ChevronDown, Search, Circle, Check, Wrench, ChevronRight, ChevronUp, ShoppingBag, Code2, FileText, Palette, Sparkles, ArrowLeft, Upload, ArrowUpRight, Plus, Pin, Blocks, Settings, TerminalSquare, FileOutput, Download, X, PanelLeft, PanelRight, Loader2, UploadCloud, RefreshCw, Bot, SquarePen, MessageSquare, Clock3, CheckCircle2, XCircle, CircleStop, AlertCircle, GitFork, PencilLine, Copy, RotateCcw, FileCode2, Files, TestTube2, Image, Video, Music2, Ellipsis, Trash2, Pencil } from 'lucide-react';
7
+ import { ChevronDown, Search, Circle, Check, Wrench, ChevronRight, ChevronUp, Sparkles, ShoppingBag, Code2, FileText, Palette, ArrowLeft, Upload, ArrowUpRight, Plus, Pin, Blocks, Settings, TerminalSquare, FileOutput, Download, X, PanelLeft, PanelRight, Loader2, UploadCloud, RefreshCw, Bot, SquarePen, MessageSquare, Clock3, CheckCircle2, XCircle, CircleStop, AlertCircle, GitFork, PencilLine, Copy, RotateCcw, FileCode2, Files, TestTube2, Image, Video, Music2, Ellipsis, Trash2, Pencil } from 'lucide-react';
8
8
  import { twMerge } from 'tailwind-merge';
9
9
  import * as DropdownMenu3 from '@radix-ui/react-dropdown-menu';
10
10
  import * as ContextMenu from '@radix-ui/react-context-menu';
@@ -19178,6 +19178,7 @@ var ICONS = {
19178
19178
  code: Code2,
19179
19179
  "shopping-bag": ShoppingBag
19180
19180
  };
19181
+ var QUICK_START_CATEGORY_ID = "__quick-start__";
19181
19182
  function TemplateVisual({ template }) {
19182
19183
  const Icon2 = ICONS[template.icon || "sparkles"];
19183
19184
  if (template.coverImageUrl) {
@@ -19201,21 +19202,47 @@ function AgentWorkbenchQuickStart({ viewModel, className, onIntent }) {
19201
19202
  })).filter((category) => category.sections.length > 0),
19202
19203
  [viewModel.categories, viewModel.mode]
19203
19204
  );
19204
- const activeCategory = categories.find((category) => category.id === activeCategoryId);
19205
+ const quickStartCategory = useMemo(() => {
19206
+ 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);
19207
+ if (templates.length === 0) return void 0;
19208
+ return {
19209
+ id: QUICK_START_CATEGORY_ID,
19210
+ label: messages.label,
19211
+ icon: "sparkles",
19212
+ sections: [
19213
+ {
19214
+ id: "quick-start",
19215
+ label: messages.label,
19216
+ templates
19217
+ }
19218
+ ]
19219
+ };
19220
+ }, [categories, messages.label]);
19221
+ const activeCategory = activeCategoryId === QUICK_START_CATEGORY_ID ? quickStartCategory : categories.find((category) => category.id === activeCategoryId);
19205
19222
  const activeSection = activeCategory?.sections.find((section) => section.id === activeSectionId) || activeCategory?.sections[0];
19206
19223
  const usesCompactList = activeSection?.templates.length ? activeSection.templates.every((template) => !template.coverImageUrl) : false;
19207
19224
  useEffect(() => {
19208
- if (activeCategoryId && !categories.some((category) => category.id === activeCategoryId)) {
19225
+ if (activeCategoryId && activeCategoryId !== QUICK_START_CATEGORY_ID && !categories.some((category) => category.id === activeCategoryId)) {
19209
19226
  setActiveCategoryId(void 0);
19210
19227
  setActiveSectionId(void 0);
19211
19228
  }
19212
- }, [activeCategoryId, categories]);
19229
+ if (activeCategoryId === QUICK_START_CATEGORY_ID && !quickStartCategory) {
19230
+ setActiveCategoryId(void 0);
19231
+ setActiveSectionId(void 0);
19232
+ }
19233
+ }, [activeCategoryId, categories, quickStartCategory]);
19213
19234
  if (categories.length === 0) return null;
19214
19235
  const selectCategory = (category) => {
19215
19236
  setActiveCategoryId(category.id);
19216
19237
  setActiveSectionId(category.sections[0]?.id);
19217
19238
  onIntent?.({ type: "change-category", categoryId: category.id });
19218
19239
  };
19240
+ const selectQuickStart = () => {
19241
+ if (!quickStartCategory) return;
19242
+ setActiveCategoryId(QUICK_START_CATEGORY_ID);
19243
+ setActiveSectionId(quickStartCategory.sections[0]?.id);
19244
+ onIntent?.({ type: "change-category" });
19245
+ };
19219
19246
  const selectSection = (sectionId) => {
19220
19247
  if (!activeCategory) return;
19221
19248
  setActiveSectionId(sectionId);
@@ -19264,13 +19291,28 @@ function AgentWorkbenchQuickStart({ viewModel, className, onIntent }) {
19264
19291
  }
19265
19292
  }
19266
19293
  ),
19267
- !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) => {
19268
- const Icon2 = ICONS[category.icon || "sparkles"];
19269
- 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: [
19270
- /* @__PURE__ */ jsx(Icon2, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
19271
- category.label
19272
- ] }, category.id);
19273
- }) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
19294
+ !activeCategory ? /* @__PURE__ */ jsxs("div", { className: "flex max-w-full items-center justify-center gap-2 overflow-x-auto px-1 pb-1", children: [
19295
+ quickStartCategory ? /* @__PURE__ */ jsxs(
19296
+ "button",
19297
+ {
19298
+ type: "button",
19299
+ 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",
19300
+ "aria-pressed": activeCategoryId === QUICK_START_CATEGORY_ID,
19301
+ onClick: selectQuickStart,
19302
+ children: [
19303
+ /* @__PURE__ */ jsx(Sparkles, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
19304
+ messages.label
19305
+ ]
19306
+ }
19307
+ ) : null,
19308
+ categories.map((category) => {
19309
+ const Icon2 = ICONS[category.icon || "sparkles"];
19310
+ 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: [
19311
+ /* @__PURE__ */ jsx(Icon2, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
19312
+ category.label
19313
+ ] }, category.id);
19314
+ })
19315
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
19274
19316
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 max-w-full items-center gap-1 overflow-x-auto pb-1", children: [
19275
19317
  /* @__PURE__ */ jsxs(
19276
19318
  "button",
@@ -19288,7 +19330,7 @@ function AgentWorkbenchQuickStart({ viewModel, className, onIntent }) {
19288
19330
  ]
19289
19331
  }
19290
19332
  ),
19291
- 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))
19333
+ 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))
19292
19334
  ] }),
19293
19335
  /* @__PURE__ */ jsx(
19294
19336
  "div",