@dilipod/ui 0.4.20 → 0.4.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dilipod/ui",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "Dilipod Design System - Shared UI components and styles",
5
5
  "author": "Dilipod <hello@dilipod.com>",
6
6
  "license": "MIT",
@@ -150,6 +150,9 @@ export function ImpactMetricsForm({
150
150
  // Net annual savings
151
151
  const netAnnualSavings = laborSavingsPerYear - workerCostPerYear
152
152
 
153
+ // ROI percentage: net savings relative to worker cost
154
+ const roiPercentage = workerCostPerYear > 0 ? (netAnnualSavings / workerCostPerYear) * 100 : 0
155
+
153
156
  return (
154
157
  <Card className={cn("border-[var(--cyan)]/20 bg-gradient-to-br from-white to-[var(--cyan)]/5", className)}>
155
158
  <CardContent className="p-5">
@@ -274,17 +277,25 @@ export function ImpactMetricsForm({
274
277
  €{netAnnualSavings.toLocaleString(undefined, { maximumFractionDigits: 0 })}
275
278
  </p>
276
279
  <p className="text-xs text-muted-foreground mt-0.5">
277
- €{laborSavingsPerYear.toLocaleString(undefined, { maximumFractionDigits: 0 })} − €{workerCostPerYear}
280
+ €{laborSavingsPerYear.toLocaleString(undefined, { maximumFractionDigits: 0 })} <span className="opacity-60">labor saved</span> − €{workerCostPerYear} <span className="opacity-60">worker cost</span>
278
281
  </p>
279
282
  </div>
280
283
  </div>
281
284
 
282
- {/* Implied frequency indicator */}
283
- {impliedFrequencyPerYear > 0 && (
284
- <p className="text-xs text-muted-foreground mt-4 pt-3 border-t border-border/50">
285
- Implied: ~{impliedFrequencyPerMonth}×/month ({impliedFrequencyPerYear}×/year)
285
+ {/* ROI & Implied frequency */}
286
+ <div className="mt-4 pt-3 border-t border-border/50 flex items-center justify-between">
287
+ <p className={cn(
288
+ "text-sm",
289
+ roiPercentage > 0 ? "font-bold text-[var(--cyan)]" : "text-muted-foreground"
290
+ )}>
291
+ ROI: {roiPercentage >= 0 ? '+' : ''}{roiPercentage.toLocaleString(undefined, { maximumFractionDigits: 0 })}%
286
292
  </p>
287
- )}
293
+ {impliedFrequencyPerYear > 0 && (
294
+ <p className="text-xs text-muted-foreground">
295
+ Implied: ~{impliedFrequencyPerMonth}×/month ({impliedFrequencyPerYear}×/year)
296
+ </p>
297
+ )}
298
+ </div>
288
299
  </CardContent>
289
300
  </Card>
290
301
  )
@@ -99,43 +99,41 @@ function ScenarioCard({
99
99
  const Icon = config.icon
100
100
 
101
101
  return (
102
- <div className="group relative border border-border rounded-sm p-4 hover:border-[var(--cyan)]/30 hover:bg-[var(--cyan)]/[0.02] transition-all">
103
- <div className="flex items-start justify-between gap-3">
104
- <div className="flex items-start gap-3 flex-1 min-w-0">
105
- <div className={cn('w-9 h-9 rounded-sm flex items-center justify-center shrink-0', config.bgColor)}>
106
- <Icon size={18} weight="fill" className={config.color} />
107
- </div>
108
- <div className="flex-1 min-w-0">
109
- <div className="flex items-center gap-2 mb-1.5">
110
- <Badge variant="outline" size="sm" className="font-medium">{config.label}</Badge>
111
- </div>
112
- <p className="text-sm text-[var(--black)]">
113
- <span className="font-medium">When:</span> {scenario.situation}
114
- </p>
115
- <p className="text-sm text-muted-foreground mt-1">
116
- <span className="text-[var(--black)] font-medium">Action:</span> {scenario.action}
117
- </p>
118
- </div>
102
+ <div className="group relative flex items-start justify-between gap-3 py-3 border-b border-border/50 last:border-b-0">
103
+ <div className="flex items-start gap-3 flex-1 min-w-0">
104
+ <div className={cn('w-8 h-8 rounded-full flex items-center justify-center shrink-0', config.bgColor)}>
105
+ <Icon size={16} weight="fill" className={config.color} />
119
106
  </div>
120
- <div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
121
- <Button
122
- variant="ghost"
123
- size="icon"
124
- className="h-8 w-8 text-muted-foreground hover:text-[var(--black)]"
125
- onClick={onEdit}
126
- >
127
- <PencilSimple size={16} />
128
- </Button>
129
- <Button
130
- variant="ghost"
131
- size="icon"
132
- className="h-8 w-8 text-muted-foreground hover:text-red-600 hover:bg-red-50"
133
- onClick={onDelete}
134
- >
135
- <Trash size={16} />
136
- </Button>
107
+ <div className="flex-1 min-w-0 pt-0.5">
108
+ <div className="flex items-center gap-2 mb-1.5">
109
+ <Badge variant="outline" size="sm" className="font-medium">{config.label}</Badge>
110
+ </div>
111
+ <p className="text-sm text-[var(--black)]">
112
+ <span className="font-medium">When:</span> {scenario.situation}
113
+ </p>
114
+ <p className="text-sm text-muted-foreground mt-0.5">
115
+ <span className="text-[var(--black)] font-medium">Action:</span> {scenario.action}
116
+ </p>
137
117
  </div>
138
118
  </div>
119
+ <div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
120
+ <Button
121
+ variant="ghost"
122
+ size="icon"
123
+ className="h-7 w-7 text-muted-foreground hover:text-[var(--black)]"
124
+ onClick={onEdit}
125
+ >
126
+ <PencilSimple size={14} />
127
+ </Button>
128
+ <Button
129
+ variant="ghost"
130
+ size="icon"
131
+ className="h-7 w-7 text-muted-foreground hover:text-red-600 hover:bg-red-50"
132
+ onClick={onDelete}
133
+ >
134
+ <Trash size={14} />
135
+ </Button>
136
+ </div>
139
137
  </div>
140
138
  )
141
139
  }
@@ -348,11 +346,11 @@ export function ScenariosManager({
348
346
  <button
349
347
  type="button"
350
348
  onClick={() => setIsExpanded(!isExpanded)}
351
- className="w-full flex items-center justify-between bg-muted/30 border border-border/50 px-4 py-3 rounded-lg hover:bg-muted/50 transition-colors"
349
+ className="w-full flex items-center justify-between border border-border/50 px-4 py-3 rounded-lg hover:bg-muted/30 transition-colors"
352
350
  >
353
- <div className="flex items-center gap-4">
354
- <div className="w-12 h-12 rounded-lg bg-[var(--cyan)]/10 flex items-center justify-center">
355
- <Lightning size={24} weight="fill" className="text-[var(--cyan)]" />
351
+ <div className="flex items-center gap-3">
352
+ <div className="w-10 h-10 rounded-lg bg-[var(--cyan)]/10 flex items-center justify-center">
353
+ <Lightning size={20} weight="fill" className="text-[var(--cyan)]" />
356
354
  </div>
357
355
  <div className="text-left">
358
356
  <div className="flex items-center gap-2">
@@ -366,34 +364,24 @@ export function ScenariosManager({
366
364
  </div>
367
365
  <p className="text-sm text-muted-foreground">
368
366
  {scenarios.length === 0
369
- ? 'Define rules for edge cases and escalations'
367
+ ? 'Define rules for edge cases'
370
368
  : `${scenarios.length} scenario${scenarios.length === 1 ? '' : 's'} defined`}
371
369
  </p>
372
370
  </div>
373
371
  </div>
374
- <div className="flex items-center gap-3">
375
- {isExpanded ? (
376
- <CaretUp size={20} className="text-muted-foreground" />
377
- ) : (
378
- <CaretDown size={20} className="text-muted-foreground" />
379
- )}
380
- </div>
372
+ {isExpanded ? (
373
+ <CaretUp size={20} className="text-muted-foreground" />
374
+ ) : (
375
+ <CaretDown size={20} className="text-muted-foreground" />
376
+ )}
381
377
  </button>
382
378
 
383
379
  {/* Expandable content */}
384
380
  {isExpanded && (
385
381
  <>
386
- {/* Add button */}
387
- <div className="flex justify-end">
388
- <Button variant="outline" size="sm" onClick={handleAddClick}>
389
- <Plus size={16} className="mr-1" />
390
- Add scenario
391
- </Button>
392
- </div>
393
-
394
382
  {/* Scenarios list */}
395
383
  {scenarios.length > 0 && (
396
- <div className="grid gap-3">
384
+ <div className="px-4">
397
385
  {scenarios.map((scenario) => (
398
386
  <ScenarioCard
399
387
  key={scenario.id}
@@ -407,10 +395,7 @@ export function ScenariosManager({
407
395
 
408
396
  {/* Empty state */}
409
397
  {scenarios.length === 0 && (
410
- <div className="border border-dashed border-border rounded-sm p-8 text-center">
411
- <div className="w-12 h-12 rounded-sm bg-muted flex items-center justify-center mx-auto mb-3">
412
- <Lightning size={24} className="text-muted-foreground" />
413
- </div>
398
+ <div className="px-4 py-6 text-center">
414
399
  <p className="text-sm text-muted-foreground mb-4">
415
400
  No scenarios yet. Add rules for how the worker should handle edge cases.
416
401
  </p>
@@ -421,9 +406,19 @@ export function ScenariosManager({
421
406
  </div>
422
407
  )}
423
408
 
409
+ {/* Add button - at the end of the list */}
410
+ {scenarios.length > 0 && (
411
+ <div className="px-4 pt-2">
412
+ <Button variant="ghost" size="sm" onClick={handleAddClick} className="text-muted-foreground hover:text-[var(--black)]">
413
+ <Plus size={16} className="mr-1.5" />
414
+ Add scenario
415
+ </Button>
416
+ </div>
417
+ )}
418
+
424
419
  {/* Suggestions */}
425
420
  {filteredSuggestions.length > 0 && !isComplete && (
426
- <div className="pt-2">
421
+ <div className="px-4 pt-2">
427
422
  <p className="text-xs text-muted-foreground mb-2">Suggested scenarios:</p>
428
423
  <div className="flex flex-wrap gap-2">
429
424
  {filteredSuggestions.map((suggestion, index) => (
@@ -440,16 +435,11 @@ export function ScenariosManager({
440
435
 
441
436
  {/* Complete button */}
442
437
  {canComplete && (
443
- <div className="pt-4 border-t border-border">
444
- <div className="flex items-center justify-between gap-4 bg-[var(--cyan)]/5 rounded-sm p-4 -mx-1">
445
- <div>
446
- <p className="text-sm font-medium text-[var(--black)]">
447
- Ready to proceed?
448
- </p>
449
- <p className="text-xs text-muted-foreground mt-0.5">
450
- Mark your scenarios as complete to continue with the onboarding.
451
- </p>
452
- </div>
438
+ <div className="px-4 pt-4 mt-2 border-t border-border/50">
439
+ <div className="flex items-center justify-between gap-4">
440
+ <p className="text-sm text-muted-foreground">
441
+ Mark your scenarios as complete to continue.
442
+ </p>
453
443
  <Button
454
444
  onClick={handleComplete}
455
445
  disabled={isCompleting}
@@ -466,7 +456,7 @@ export function ScenariosManager({
466
456
 
467
457
  {/* Complete state - only show when expanded */}
468
458
  {isComplete && (
469
- <div className="pt-4 border-t border-border">
459
+ <div className="px-4 pt-3 mt-2 border-t border-border/50">
470
460
  <p className="text-xs text-muted-foreground">
471
461
  You can still add or edit scenarios while we build your worker.
472
462
  </p>
@@ -97,7 +97,7 @@ export interface SimWorkflow {
97
97
  }>
98
98
  }
99
99
 
100
- export type WorkflowTemplate = 'blank' | 'request_analyzer' | 'documentation_updater' | 'execution_monitor' | 'usage_reporter' | 'custom'
100
+ export type WorkflowTemplate = 'blank' | 'request_analyzer' | 'knowledge_builder' | 'execution_monitor' | 'usage_reporter' | 'custom'
101
101
 
102
102
  export interface WorkflowViewerProps {
103
103
  /** The workflow definition to display */