@dilipod/ui 0.4.18 → 0.4.19

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
@@ -10,7 +10,7 @@ import { clsx } from 'clsx';
10
10
  import { twMerge } from 'tailwind-merge';
11
11
  import * as SheetPrimitive from '@radix-ui/react-dialog';
12
12
  import * as react_star from '@phosphor-icons/react';
13
- import { X, CaretDown, Circle, CaretLeft, DotsThree, CaretRight, Check, House, Info, WarningCircle, Play, Download, Folder, ArrowSquareOut, CircleNotch, File, FileVideo, Lightning, Plus, CheckCircle, PaperPlaneTilt, CaretUp, Eye, TreeStructure, Code, PencilSimple, WebhooksLogo, Copy, CloudArrowUp, CloudArrowDown, ArrowsClockwise, DownloadSimple, ClockCounterClockwise, ArrowsLeftRight, Minus, Pencil, FileImage, FilePdf, FileDoc, Question, Warning, Trash, Robot, Globe, GitBranch, Package, Timer } from '@phosphor-icons/react';
13
+ import { X, CaretDown, Circle, CaretLeft, DotsThree, CaretRight, Check, House, Info, WarningCircle, Play, Download, Folder, ArrowSquareOut, CircleNotch, File, FileVideo, Lightning, CheckCircle, CaretUp, Plus, PaperPlaneTilt, Eye, TreeStructure, Code, PencilSimple, WebhooksLogo, Copy, CloudArrowUp, CloudArrowDown, ArrowsClockwise, DownloadSimple, ClockCounterClockwise, ArrowsLeftRight, Minus, Pencil, FileImage, FilePdf, FileDoc, Question, Warning, Trash, Robot, Globe, GitBranch, Package, Timer } from '@phosphor-icons/react';
14
14
  import 'react-dom';
15
15
  import * as SwitchPrimitive from '@radix-ui/react-switch';
16
16
  import * as SliderPrimitive from '@radix-ui/react-slider';
@@ -4386,12 +4386,14 @@ function ScenariosManager({
4386
4386
  isLoading,
4387
4387
  isComplete = false,
4388
4388
  minScenariosToComplete = 1,
4389
+ defaultExpanded = true,
4389
4390
  className
4390
4391
  }) {
4391
4392
  const [dialogOpen, setDialogOpen] = React51.useState(false);
4392
4393
  const [editingScenario, setEditingScenario] = React51.useState(null);
4393
4394
  const [deletingId, setDeletingId] = React51.useState(null);
4394
4395
  const [isCompleting, setIsCompleting] = React51.useState(false);
4396
+ const [isExpanded, setIsExpanded] = React51.useState(defaultExpanded);
4395
4397
  const canComplete = scenarios.length >= minScenariosToComplete && !isComplete && onComplete;
4396
4398
  const handleAddClick = () => {
4397
4399
  setEditingScenario(null);
@@ -4434,74 +4436,85 @@ function ScenariosManager({
4434
4436
  )
4435
4437
  );
4436
4438
  return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4", className), children: [
4437
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
4438
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
4439
- /* @__PURE__ */ jsx("div", { className: "w-10 h-10 rounded-sm bg-[var(--cyan)]/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(Lightning, { size: 20, weight: "fill", className: "text-[var(--cyan)]" }) }),
4440
- /* @__PURE__ */ jsxs("div", { children: [
4441
- /* @__PURE__ */ jsx("h3", { className: "font-semibold text-[var(--black)]", children: "Scenarios" }),
4442
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: scenarios.length === 0 ? "Define rules for edge cases and escalations" : `${scenarios.length} scenario${scenarios.length === 1 ? "" : "s"} defined` })
4443
- ] })
4444
- ] }),
4445
- /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: handleAddClick, children: [
4439
+ /* @__PURE__ */ jsxs(
4440
+ "button",
4441
+ {
4442
+ type: "button",
4443
+ onClick: () => setIsExpanded(!isExpanded),
4444
+ className: "w-full flex items-center justify-between hover:bg-muted/30 -mx-2 px-2 py-1 rounded-sm transition-colors",
4445
+ children: [
4446
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
4447
+ /* @__PURE__ */ jsx("div", { className: "w-10 h-10 rounded-sm bg-[var(--cyan)]/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(Lightning, { size: 20, weight: "fill", className: "text-[var(--cyan)]" }) }),
4448
+ /* @__PURE__ */ jsxs("div", { className: "text-left", children: [
4449
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-[var(--black)]", children: "Scenarios" }),
4450
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: scenarios.length === 0 ? "Define rules for edge cases and escalations" : `${scenarios.length} scenario${scenarios.length === 1 ? "" : "s"} defined` })
4451
+ ] })
4452
+ ] }),
4453
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4454
+ isComplete && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[var(--cyan)]", children: [
4455
+ /* @__PURE__ */ jsx(CheckCircle, { size: 16, weight: "fill" }),
4456
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Complete" })
4457
+ ] }),
4458
+ isExpanded ? /* @__PURE__ */ jsx(CaretUp, { size: 20, className: "text-muted-foreground" }) : /* @__PURE__ */ jsx(CaretDown, { size: 20, className: "text-muted-foreground" })
4459
+ ] })
4460
+ ]
4461
+ }
4462
+ ),
4463
+ isExpanded && /* @__PURE__ */ jsxs(Fragment, { children: [
4464
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: handleAddClick, children: [
4446
4465
  /* @__PURE__ */ jsx(Plus, { size: 16, className: "mr-1" }),
4447
4466
  "Add scenario"
4448
- ] })
4449
- ] }),
4450
- scenarios.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid gap-3", children: scenarios.map((scenario) => /* @__PURE__ */ jsx(
4451
- ScenarioCard,
4452
- {
4453
- scenario,
4454
- onEdit: () => handleEditClick(scenario),
4455
- onDelete: () => handleDelete(scenario.id)
4456
- },
4457
- scenario.id
4458
- )) }),
4459
- scenarios.length === 0 && /* @__PURE__ */ jsxs("div", { className: "border border-dashed border-border rounded-sm p-8 text-center", children: [
4460
- /* @__PURE__ */ jsx("div", { className: "w-12 h-12 rounded-sm bg-muted flex items-center justify-center mx-auto mb-3", children: /* @__PURE__ */ jsx(Lightning, { size: 24, className: "text-muted-foreground" }) }),
4461
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: "No scenarios yet. Add rules for how the worker should handle edge cases." }),
4462
- /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: handleAddClick, children: [
4463
- /* @__PURE__ */ jsx(Plus, { size: 16, className: "mr-1.5" }),
4464
- "Add your first scenario"
4465
- ] })
4466
- ] }),
4467
- filteredSuggestions.length > 0 && !isComplete && /* @__PURE__ */ jsxs("div", { className: "pt-2", children: [
4468
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-2", children: "Suggested scenarios:" }),
4469
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: filteredSuggestions.map((suggestion, index) => /* @__PURE__ */ jsx(
4470
- SuggestionChip,
4467
+ ] }) }),
4468
+ scenarios.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid gap-3", children: scenarios.map((scenario) => /* @__PURE__ */ jsx(
4469
+ ScenarioCard,
4471
4470
  {
4472
- suggestion,
4473
- onAdd: () => handleSuggestionAdd(suggestion),
4474
- disabled: isLoading
4471
+ scenario,
4472
+ onEdit: () => handleEditClick(scenario),
4473
+ onDelete: () => handleDelete(scenario.id)
4475
4474
  },
4476
- index
4477
- )) })
4478
- ] }),
4479
- canComplete && /* @__PURE__ */ jsx("div", { className: "pt-4 border-t border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4 bg-[var(--cyan)]/5 rounded-sm p-4 -mx-1", children: [
4480
- /* @__PURE__ */ jsxs("div", { children: [
4481
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-[var(--black)]", children: "Ready to proceed?" }),
4482
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: "Mark your scenarios as complete to continue with the onboarding." })
4475
+ scenario.id
4476
+ )) }),
4477
+ scenarios.length === 0 && /* @__PURE__ */ jsxs("div", { className: "border border-dashed border-border rounded-sm p-8 text-center", children: [
4478
+ /* @__PURE__ */ jsx("div", { className: "w-12 h-12 rounded-sm bg-muted flex items-center justify-center mx-auto mb-3", children: /* @__PURE__ */ jsx(Lightning, { size: 24, className: "text-muted-foreground" }) }),
4479
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: "No scenarios yet. Add rules for how the worker should handle edge cases." }),
4480
+ /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: handleAddClick, children: [
4481
+ /* @__PURE__ */ jsx(Plus, { size: 16, className: "mr-1.5" }),
4482
+ "Add your first scenario"
4483
+ ] })
4483
4484
  ] }),
4484
- /* @__PURE__ */ jsxs(
4485
- Button,
4486
- {
4487
- onClick: handleComplete,
4488
- disabled: isCompleting,
4489
- loading: isCompleting,
4490
- size: "sm",
4491
- className: "shrink-0",
4492
- children: [
4493
- /* @__PURE__ */ jsx(Check, { size: 16, className: "mr-1.5" }),
4494
- "Mark complete"
4495
- ]
4496
- }
4497
- )
4498
- ] }) }),
4499
- isComplete && /* @__PURE__ */ jsxs("div", { className: "pt-4 border-t border-border", children: [
4500
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[var(--cyan)]", children: [
4501
- /* @__PURE__ */ jsx(CheckCircle, { size: 16, weight: "fill" }),
4502
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Scenarios completed" })
4485
+ filteredSuggestions.length > 0 && !isComplete && /* @__PURE__ */ jsxs("div", { className: "pt-2", children: [
4486
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-2", children: "Suggested scenarios:" }),
4487
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: filteredSuggestions.map((suggestion, index) => /* @__PURE__ */ jsx(
4488
+ SuggestionChip,
4489
+ {
4490
+ suggestion,
4491
+ onAdd: () => handleSuggestionAdd(suggestion),
4492
+ disabled: isLoading
4493
+ },
4494
+ index
4495
+ )) })
4503
4496
  ] }),
4504
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "You can still add or edit scenarios while we build your worker." })
4497
+ canComplete && /* @__PURE__ */ jsx("div", { className: "pt-4 border-t border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4 bg-[var(--cyan)]/5 rounded-sm p-4 -mx-1", children: [
4498
+ /* @__PURE__ */ jsxs("div", { children: [
4499
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-[var(--black)]", children: "Ready to proceed?" }),
4500
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: "Mark your scenarios as complete to continue with the onboarding." })
4501
+ ] }),
4502
+ /* @__PURE__ */ jsxs(
4503
+ Button,
4504
+ {
4505
+ onClick: handleComplete,
4506
+ disabled: isCompleting,
4507
+ loading: isCompleting,
4508
+ size: "sm",
4509
+ className: "shrink-0",
4510
+ children: [
4511
+ /* @__PURE__ */ jsx(Check, { size: 16, className: "mr-1.5" }),
4512
+ "Mark complete"
4513
+ ]
4514
+ }
4515
+ )
4516
+ ] }) }),
4517
+ isComplete && /* @__PURE__ */ jsx("div", { className: "pt-4 border-t border-border", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "You can still add or edit scenarios while we build your worker." }) })
4505
4518
  ] }),
4506
4519
  /* @__PURE__ */ jsx(
4507
4520
  ScenarioDialog,