@adoptai/genui-components 0.1.59 → 0.1.61
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/builders/BlockForm.d.ts +5 -1
- package/dist/builders/BlockForm.d.ts.map +1 -1
- package/dist/builders/BuilderForm.d.ts +22 -1
- package/dist/builders/BuilderForm.d.ts.map +1 -1
- package/dist/builders/index.d.ts +1 -1
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/composites/decision-card/resolver.cjs +296 -17
- package/dist/composites/decision-card/resolver.cjs.map +1 -1
- package/dist/composites/decision-card/resolver.d.ts +9 -2
- package/dist/composites/decision-card/resolver.d.ts.map +1 -1
- package/dist/composites/decision-card/resolver.js +296 -18
- package/dist/composites/decision-card/resolver.js.map +1 -1
- package/dist/composites/decision-queue/resolver.d.ts +22 -0
- package/dist/composites/decision-queue/resolver.d.ts.map +1 -0
- package/dist/composites/workflow-stepper/resolver.cjs +2 -1
- package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
- package/dist/composites/workflow-stepper/resolver.js +2 -1
- package/dist/composites/workflow-stepper/resolver.js.map +1 -1
- package/dist/index.cjs +881 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +881 -46
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +790 -28
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +790 -28
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +790 -28
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +790 -28
- package/dist/resolver.js.map +1 -1
- package/dist/schemas/decision-card.d.ts +37 -0
- package/dist/schemas/decision-card.d.ts.map +1 -1
- package/dist/schemas/decision-queue.d.ts +227 -0
- package/dist/schemas/decision-queue.d.ts.map +1 -0
- package/dist/schemas/index.cjs +191 -5
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.ts +264 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +191 -5
- package/dist/schemas/index.js.map +1 -1
- package/dist/shared/InteractionContext.d.ts +10 -0
- package/dist/shared/InteractionContext.d.ts.map +1 -1
- package/dist/tool-definitions.json +236 -4
- package/package.json +1 -1
package/dist/resolver.js
CHANGED
|
@@ -5525,7 +5525,14 @@ var decisionCardSchema = z.object({
|
|
|
5525
5525
|
z.object({
|
|
5526
5526
|
id: z.string().optional(),
|
|
5527
5527
|
label: z.string(),
|
|
5528
|
-
recommended: z.boolean().optional()
|
|
5528
|
+
recommended: z.boolean().optional(),
|
|
5529
|
+
value: z.number().optional(),
|
|
5530
|
+
adjust: z.object({
|
|
5531
|
+
min: z.number(),
|
|
5532
|
+
max: z.number(),
|
|
5533
|
+
step: z.number().optional(),
|
|
5534
|
+
unit: z.string().optional()
|
|
5535
|
+
}).optional()
|
|
5529
5536
|
})
|
|
5530
5537
|
).min(1).max(5),
|
|
5531
5538
|
source: z.object({
|
|
@@ -5533,7 +5540,8 @@ var decisionCardSchema = z.object({
|
|
|
5533
5540
|
url: z.string().optional()
|
|
5534
5541
|
}).optional(),
|
|
5535
5542
|
resolved: z.object({
|
|
5536
|
-
option: z.string()
|
|
5543
|
+
option: z.string(),
|
|
5544
|
+
value: z.number().optional()
|
|
5537
5545
|
}).optional()
|
|
5538
5546
|
});
|
|
5539
5547
|
var decisionCardTool = {
|
|
@@ -5576,13 +5584,28 @@ var decisionCardTool = {
|
|
|
5576
5584
|
type: "array",
|
|
5577
5585
|
minItems: 1,
|
|
5578
5586
|
maxItems: 5,
|
|
5579
|
-
description: "Mutually-exclusive resolution choices; mark one `recommended` to make it primary",
|
|
5587
|
+
description: "Mutually-exclusive resolution choices; mark one `recommended` to make it primary. An option that carries a numeric figure the user may want to tune (e.g. 'Book reserve' at 50 units) should set `value` (your suggested figure) and `adjust` ({min,max[,step,unit]}) \u2014 the card then lets the user fine-tune the number within that range before confirming.",
|
|
5580
5588
|
items: {
|
|
5581
5589
|
type: "object",
|
|
5582
5590
|
properties: {
|
|
5583
5591
|
id: { type: "string" },
|
|
5584
5592
|
label: { type: "string" },
|
|
5585
|
-
recommended: { type: "boolean" }
|
|
5593
|
+
recommended: { type: "boolean" },
|
|
5594
|
+
value: {
|
|
5595
|
+
type: "number",
|
|
5596
|
+
description: "Suggested numeric figure for this option (the starting point of the adjuster)"
|
|
5597
|
+
},
|
|
5598
|
+
adjust: {
|
|
5599
|
+
type: "object",
|
|
5600
|
+
description: "Allow the user to tune `value` within this inclusive range before resolving",
|
|
5601
|
+
properties: {
|
|
5602
|
+
min: { type: "number" },
|
|
5603
|
+
max: { type: "number" },
|
|
5604
|
+
step: { type: "number", description: "Increment granularity; defaults to a sensible step for the range" },
|
|
5605
|
+
unit: { type: "string", description: "Short unit suffix shown after the number, e.g. 'units', '%', 'hrs'" }
|
|
5606
|
+
},
|
|
5607
|
+
required: ["min", "max"]
|
|
5608
|
+
}
|
|
5586
5609
|
},
|
|
5587
5610
|
required: ["label"]
|
|
5588
5611
|
}
|
|
@@ -5599,7 +5622,8 @@ var decisionCardTool = {
|
|
|
5599
5622
|
type: "object",
|
|
5600
5623
|
description: "Pre-resolved state for transcript replay",
|
|
5601
5624
|
properties: {
|
|
5602
|
-
option: { type: "string" }
|
|
5625
|
+
option: { type: "string" },
|
|
5626
|
+
value: { type: "number", description: "Adjusted figure the user confirmed, when the option was adjustable" }
|
|
5603
5627
|
},
|
|
5604
5628
|
required: ["option"]
|
|
5605
5629
|
}
|
|
@@ -5607,6 +5631,167 @@ var decisionCardTool = {
|
|
|
5607
5631
|
required: ["type", "title", "question", "options"]
|
|
5608
5632
|
}
|
|
5609
5633
|
};
|
|
5634
|
+
var decisionQueueItemSchema = z.object({
|
|
5635
|
+
id: z.string().optional(),
|
|
5636
|
+
decision_type: z.string().optional(),
|
|
5637
|
+
title: z.string(),
|
|
5638
|
+
question: z.string(),
|
|
5639
|
+
amount: z.number().optional(),
|
|
5640
|
+
currency: z.string().optional(),
|
|
5641
|
+
amount_label: z.string().optional(),
|
|
5642
|
+
severity: z.enum(["low", "medium", "high"]).optional(),
|
|
5643
|
+
flags: z.array(
|
|
5644
|
+
z.object({
|
|
5645
|
+
field: z.string().optional(),
|
|
5646
|
+
issue: z.string(),
|
|
5647
|
+
severity: z.enum(["low", "medium", "high"]).optional()
|
|
5648
|
+
})
|
|
5649
|
+
).max(6).optional(),
|
|
5650
|
+
options: z.array(
|
|
5651
|
+
z.object({
|
|
5652
|
+
id: z.string().optional(),
|
|
5653
|
+
label: z.string(),
|
|
5654
|
+
recommended: z.boolean().optional(),
|
|
5655
|
+
value: z.number().optional(),
|
|
5656
|
+
adjust: z.object({
|
|
5657
|
+
min: z.number(),
|
|
5658
|
+
max: z.number(),
|
|
5659
|
+
step: z.number().optional(),
|
|
5660
|
+
unit: z.string().optional()
|
|
5661
|
+
}).optional()
|
|
5662
|
+
})
|
|
5663
|
+
).min(1).max(5),
|
|
5664
|
+
source: z.object({
|
|
5665
|
+
label: z.string().optional(),
|
|
5666
|
+
url: z.string().optional()
|
|
5667
|
+
}).optional()
|
|
5668
|
+
});
|
|
5669
|
+
var decisionQueueSchema = z.object({
|
|
5670
|
+
type: z.literal("decision-queue"),
|
|
5671
|
+
id: z.string().optional(),
|
|
5672
|
+
title: z.string().optional(),
|
|
5673
|
+
description: z.string().optional(),
|
|
5674
|
+
submit_label: z.string().optional(),
|
|
5675
|
+
items: z.array(decisionQueueItemSchema).min(2).max(12),
|
|
5676
|
+
resolved: z.object({
|
|
5677
|
+
decisions: z.array(
|
|
5678
|
+
z.object({
|
|
5679
|
+
id: z.string().optional(),
|
|
5680
|
+
title: z.string(),
|
|
5681
|
+
option: z.string(),
|
|
5682
|
+
value: z.number().optional()
|
|
5683
|
+
})
|
|
5684
|
+
)
|
|
5685
|
+
}).optional()
|
|
5686
|
+
});
|
|
5687
|
+
var OPTION_ITEM_JSON = {
|
|
5688
|
+
type: "object",
|
|
5689
|
+
properties: {
|
|
5690
|
+
id: { type: "string" },
|
|
5691
|
+
label: { type: "string" },
|
|
5692
|
+
recommended: { type: "boolean" },
|
|
5693
|
+
value: {
|
|
5694
|
+
type: "number",
|
|
5695
|
+
description: "Suggested numeric figure for this option (starting point of the adjuster)"
|
|
5696
|
+
},
|
|
5697
|
+
adjust: {
|
|
5698
|
+
type: "object",
|
|
5699
|
+
description: "Allow the user to tune `value` within this inclusive range before deciding",
|
|
5700
|
+
properties: {
|
|
5701
|
+
min: { type: "number" },
|
|
5702
|
+
max: { type: "number" },
|
|
5703
|
+
step: { type: "number" },
|
|
5704
|
+
unit: { type: "string", description: "Short unit suffix, e.g. 'units', '%', 'hrs'" }
|
|
5705
|
+
},
|
|
5706
|
+
required: ["min", "max"]
|
|
5707
|
+
}
|
|
5708
|
+
},
|
|
5709
|
+
required: ["label"]
|
|
5710
|
+
};
|
|
5711
|
+
var decisionQueueTool = {
|
|
5712
|
+
name: "render_decision_queue",
|
|
5713
|
+
description: "Render a SEQUENTIAL QUEUE of 2-12 related human-in-the-loop judgments, decided one at a time at full decision-card richness (amount at stake, data-quality flags, adjustable figures, source links) and submitted TOGETHER as one reply. Use whenever MORE THAN ONE decision is pending in the same turn \u2014 never emit multiple loose decision-cards. Give deferrable items an explicit 'leave open'-style option so the user can always complete the queue. For a single judgment use decision-card; for typed field input (names, dates, uploads) use render_builder.",
|
|
5714
|
+
input_schema: {
|
|
5715
|
+
type: "object",
|
|
5716
|
+
properties: {
|
|
5717
|
+
type: { type: "string", enum: ["decision-queue"] },
|
|
5718
|
+
id: { type: "string", description: "Stable id for update-in-place rendering" },
|
|
5719
|
+
title: {
|
|
5720
|
+
type: "string",
|
|
5721
|
+
description: "Batch headline shown in the header, e.g. 'Reconciliation exceptions'"
|
|
5722
|
+
},
|
|
5723
|
+
description: { type: "string", description: "One-line context above the queue" },
|
|
5724
|
+
submit_label: { type: "string", description: "CTA label; defaults to 'Submit N decisions'" },
|
|
5725
|
+
items: {
|
|
5726
|
+
type: "array",
|
|
5727
|
+
minItems: 2,
|
|
5728
|
+
maxItems: 12,
|
|
5729
|
+
description: "The pending judgments, in the order the user should take them. Each is a full decision-card body (no `type`).",
|
|
5730
|
+
items: {
|
|
5731
|
+
type: "object",
|
|
5732
|
+
properties: {
|
|
5733
|
+
id: { type: "string" },
|
|
5734
|
+
decision_type: {
|
|
5735
|
+
type: "string",
|
|
5736
|
+
description: "Short category eyebrow, e.g. 'Duplicate', 'Capitalization'"
|
|
5737
|
+
},
|
|
5738
|
+
title: { type: "string" },
|
|
5739
|
+
question: { type: "string" },
|
|
5740
|
+
amount: { type: "number" },
|
|
5741
|
+
currency: { type: "string" },
|
|
5742
|
+
amount_label: { type: "string" },
|
|
5743
|
+
severity: { type: "string", enum: ["low", "medium", "high"] },
|
|
5744
|
+
flags: {
|
|
5745
|
+
type: "array",
|
|
5746
|
+
maxItems: 6,
|
|
5747
|
+
items: {
|
|
5748
|
+
type: "object",
|
|
5749
|
+
properties: {
|
|
5750
|
+
field: { type: "string" },
|
|
5751
|
+
issue: { type: "string" },
|
|
5752
|
+
severity: { type: "string", enum: ["low", "medium", "high"] }
|
|
5753
|
+
},
|
|
5754
|
+
required: ["issue"]
|
|
5755
|
+
}
|
|
5756
|
+
},
|
|
5757
|
+
options: {
|
|
5758
|
+
type: "array",
|
|
5759
|
+
minItems: 1,
|
|
5760
|
+
maxItems: 5,
|
|
5761
|
+
items: OPTION_ITEM_JSON
|
|
5762
|
+
},
|
|
5763
|
+
source: {
|
|
5764
|
+
type: "object",
|
|
5765
|
+
properties: { label: { type: "string" }, url: { type: "string" } }
|
|
5766
|
+
}
|
|
5767
|
+
},
|
|
5768
|
+
required: ["title", "question", "options"]
|
|
5769
|
+
}
|
|
5770
|
+
},
|
|
5771
|
+
resolved: {
|
|
5772
|
+
type: "object",
|
|
5773
|
+
description: "Pre-resolved state for transcript replay",
|
|
5774
|
+
properties: {
|
|
5775
|
+
decisions: {
|
|
5776
|
+
type: "array",
|
|
5777
|
+
items: {
|
|
5778
|
+
type: "object",
|
|
5779
|
+
properties: {
|
|
5780
|
+
id: { type: "string" },
|
|
5781
|
+
title: { type: "string" },
|
|
5782
|
+
option: { type: "string" },
|
|
5783
|
+
value: { type: "number" }
|
|
5784
|
+
},
|
|
5785
|
+
required: ["title", "option"]
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5788
|
+
},
|
|
5789
|
+
required: ["decisions"]
|
|
5790
|
+
}
|
|
5791
|
+
},
|
|
5792
|
+
required: ["type", "items"]
|
|
5793
|
+
}
|
|
5794
|
+
};
|
|
5610
5795
|
var tabbyAuthSchema = z.object({
|
|
5611
5796
|
type: z.literal("tabby-auth"),
|
|
5612
5797
|
app: z.string(),
|
|
@@ -5699,6 +5884,7 @@ var schemaRegistry = {
|
|
|
5699
5884
|
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
5700
5885
|
"document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
|
|
5701
5886
|
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool },
|
|
5887
|
+
"decision-queue": { schema: decisionQueueSchema, tool: decisionQueueTool },
|
|
5702
5888
|
"tabby-auth": { schema: tabbyAuthSchema, tool: tabbyAuthTool }
|
|
5703
5889
|
};
|
|
5704
5890
|
|
|
@@ -6437,17 +6623,17 @@ function SparklineTableResolver(p) {
|
|
|
6437
6623
|
// src/composites/heatmap-table/resolver.tsx
|
|
6438
6624
|
init_theme();
|
|
6439
6625
|
init_ThemeContext();
|
|
6440
|
-
function heatColor(
|
|
6441
|
-
const clamped = Math.max(-3, Math.min(3,
|
|
6626
|
+
function heatColor(z62) {
|
|
6627
|
+
const clamped = Math.max(-3, Math.min(3, z62));
|
|
6442
6628
|
const abs = Math.abs(clamped);
|
|
6443
6629
|
const lightness = 95 - abs * 8;
|
|
6444
6630
|
const hue = clamped >= 0 ? 142 : 0;
|
|
6445
6631
|
return `hsl(${hue} 60% ${lightness}%)`;
|
|
6446
6632
|
}
|
|
6447
|
-
function heatTextColor(
|
|
6448
|
-
const abs = Math.abs(
|
|
6449
|
-
if (abs > 2) return
|
|
6450
|
-
if (abs > 1) return
|
|
6633
|
+
function heatTextColor(z62) {
|
|
6634
|
+
const abs = Math.abs(z62);
|
|
6635
|
+
if (abs > 2) return z62 >= 0 ? "#14532d" : "#7f1d1d";
|
|
6636
|
+
if (abs > 1) return z62 >= 0 ? "#166534" : "#991b1b";
|
|
6451
6637
|
return "var(--foreground)";
|
|
6452
6638
|
}
|
|
6453
6639
|
var th2 = {
|
|
@@ -17495,7 +17681,8 @@ var DEFAULT_INTERACTION = {
|
|
|
17495
17681
|
onStepSelect: void 0,
|
|
17496
17682
|
resolvedDecisions: void 0,
|
|
17497
17683
|
onDecisionResolve: void 0,
|
|
17498
|
-
onDecisionSource: void 0
|
|
17684
|
+
onDecisionSource: void 0,
|
|
17685
|
+
onDecisionQueueSubmit: void 0
|
|
17499
17686
|
};
|
|
17500
17687
|
var GenUIInteractionContext = createContext(DEFAULT_INTERACTION);
|
|
17501
17688
|
function useGenUIInteraction() {
|
|
@@ -19890,8 +20077,15 @@ function useContainerWidth2(ref) {
|
|
|
19890
20077
|
var KEYFRAMES2 = `
|
|
19891
20078
|
@keyframes dcRise{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
|
|
19892
20079
|
.dc-rise{animation:dcRise 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
20080
|
+
.dc-range{-webkit-appearance:none;appearance:none;width:100%;height:4px;border-radius:9999px;outline:none;cursor:pointer;background:transparent}
|
|
20081
|
+
.dc-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background:white;border:2px solid var(--dc-thumb,#ff5000);box-shadow:0 1px 3px rgba(0,0,0,0.18);cursor:grab;transition:transform 0.12s}
|
|
20082
|
+
.dc-range::-webkit-slider-thumb:hover{transform:scale(1.12)}
|
|
20083
|
+
.dc-range:active::-webkit-slider-thumb{cursor:grabbing}
|
|
20084
|
+
.dc-range::-moz-range-thumb{width:12px;height:12px;border-radius:50%;background:white;border:2px solid var(--dc-thumb,#ff5000);box-shadow:0 1px 3px rgba(0,0,0,0.18);cursor:grab}
|
|
20085
|
+
.dc-range::-moz-range-track{height:4px;border-radius:9999px;background:transparent}
|
|
19893
20086
|
@media (prefers-reduced-motion: reduce){
|
|
19894
20087
|
.dc-rise{animation:none !important;opacity:1 !important;transform:none !important}
|
|
20088
|
+
.dc-range::-webkit-slider-thumb{transition:none}
|
|
19895
20089
|
}`;
|
|
19896
20090
|
function SparkCheck({ size, color }) {
|
|
19897
20091
|
return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
@@ -19937,17 +20131,240 @@ function FlagPill({ flag }) {
|
|
|
19937
20131
|
}
|
|
19938
20132
|
);
|
|
19939
20133
|
}
|
|
20134
|
+
function formatFigure(value, unit) {
|
|
20135
|
+
const body = Number.isInteger(value) ? `${value}` : `${Math.round(value * 100) / 100}`;
|
|
20136
|
+
if (!unit) return body;
|
|
20137
|
+
return unit === "%" ? `${body}%` : `${body} ${unit}`;
|
|
20138
|
+
}
|
|
20139
|
+
function clampToRange(raw, adjust) {
|
|
20140
|
+
var _a;
|
|
20141
|
+
const step = (_a = adjust.step) != null ? _a : Number.isInteger(adjust.min) && Number.isInteger(adjust.max) ? 1 : (adjust.max - adjust.min) / 100;
|
|
20142
|
+
const snapped = Math.round((raw - adjust.min) / step) * step + adjust.min;
|
|
20143
|
+
const fixed = Math.round(snapped * 1e6) / 1e6;
|
|
20144
|
+
return Math.min(adjust.max, Math.max(adjust.min, fixed));
|
|
20145
|
+
}
|
|
20146
|
+
function ValueAdjuster({
|
|
20147
|
+
option,
|
|
20148
|
+
accent,
|
|
20149
|
+
border,
|
|
20150
|
+
muted,
|
|
20151
|
+
onConfirm,
|
|
20152
|
+
onBack
|
|
20153
|
+
}) {
|
|
20154
|
+
var _a, _b;
|
|
20155
|
+
const adjust = option.adjust;
|
|
20156
|
+
const suggested = clampToRange((_a = option.value) != null ? _a : adjust.min, adjust);
|
|
20157
|
+
const [value, setValue] = React45.useState(suggested);
|
|
20158
|
+
const [text, setText] = React45.useState(String(suggested));
|
|
20159
|
+
const step = (_b = adjust.step) != null ? _b : Number.isInteger(adjust.min) && Number.isInteger(adjust.max) ? 1 : (adjust.max - adjust.min) / 100;
|
|
20160
|
+
const pct = adjust.max > adjust.min ? (value - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
20161
|
+
const suggestedPct = adjust.max > adjust.min ? (suggested - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
20162
|
+
const moved = value !== suggested;
|
|
20163
|
+
const commit = (raw) => {
|
|
20164
|
+
const v = clampToRange(raw, adjust);
|
|
20165
|
+
setValue(v);
|
|
20166
|
+
setText(String(v));
|
|
20167
|
+
};
|
|
20168
|
+
return /* @__PURE__ */ jsxs(
|
|
20169
|
+
"div",
|
|
20170
|
+
{
|
|
20171
|
+
className: "dc-rise",
|
|
20172
|
+
"data-testid": "decision-card-adjuster",
|
|
20173
|
+
style: {
|
|
20174
|
+
display: "flex",
|
|
20175
|
+
flexDirection: "column",
|
|
20176
|
+
gap: 12,
|
|
20177
|
+
border: `1px solid ${border}`,
|
|
20178
|
+
borderRadius: 10,
|
|
20179
|
+
padding: "12px 14px",
|
|
20180
|
+
background: "#fafafa"
|
|
20181
|
+
},
|
|
20182
|
+
children: [
|
|
20183
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
|
|
20184
|
+
/* @__PURE__ */ jsxs("span", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: muted }, children: [
|
|
20185
|
+
"Adjust \xB7 ",
|
|
20186
|
+
option.label
|
|
20187
|
+
] }),
|
|
20188
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
20189
|
+
/* @__PURE__ */ jsx(
|
|
20190
|
+
"button",
|
|
20191
|
+
{
|
|
20192
|
+
type: "button",
|
|
20193
|
+
onClick: onBack,
|
|
20194
|
+
"data-testid": "decision-card-adjust-back",
|
|
20195
|
+
style: { border: "none", background: "none", padding: 0, cursor: "pointer", fontSize: 12, fontWeight: 600, color: muted },
|
|
20196
|
+
children: "Back"
|
|
20197
|
+
}
|
|
20198
|
+
)
|
|
20199
|
+
] }),
|
|
20200
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: 6 }, children: [
|
|
20201
|
+
/* @__PURE__ */ jsx(
|
|
20202
|
+
"input",
|
|
20203
|
+
{
|
|
20204
|
+
value: text,
|
|
20205
|
+
onChange: (e) => {
|
|
20206
|
+
setText(e.target.value);
|
|
20207
|
+
const n = Number(e.target.value);
|
|
20208
|
+
if (Number.isFinite(n)) setValue(clampToRange(n, adjust));
|
|
20209
|
+
},
|
|
20210
|
+
onBlur: () => commit(Number(text) || suggested),
|
|
20211
|
+
onKeyDown: (e) => {
|
|
20212
|
+
if (e.key === "Enter") {
|
|
20213
|
+
const v = clampToRange(Number(text) || suggested, adjust);
|
|
20214
|
+
commit(v);
|
|
20215
|
+
onConfirm(v);
|
|
20216
|
+
} else if (e.key === "ArrowUp") {
|
|
20217
|
+
e.preventDefault();
|
|
20218
|
+
commit(value + step);
|
|
20219
|
+
} else if (e.key === "ArrowDown") {
|
|
20220
|
+
e.preventDefault();
|
|
20221
|
+
commit(value - step);
|
|
20222
|
+
}
|
|
20223
|
+
},
|
|
20224
|
+
inputMode: "decimal",
|
|
20225
|
+
"aria-label": `${option.label} value`,
|
|
20226
|
+
"data-testid": "decision-card-adjust-input",
|
|
20227
|
+
style: {
|
|
20228
|
+
width: `${Math.max(3, String(text).length + 1)}ch`,
|
|
20229
|
+
fontSize: 26,
|
|
20230
|
+
fontWeight: 700,
|
|
20231
|
+
fontVariantNumeric: "tabular-nums",
|
|
20232
|
+
letterSpacing: "-0.02em",
|
|
20233
|
+
color: "var(--foreground)",
|
|
20234
|
+
border: "none",
|
|
20235
|
+
borderBottom: `2px solid ${accent}`,
|
|
20236
|
+
background: "transparent",
|
|
20237
|
+
outline: "none",
|
|
20238
|
+
padding: 0
|
|
20239
|
+
}
|
|
20240
|
+
}
|
|
20241
|
+
),
|
|
20242
|
+
adjust.unit && /* @__PURE__ */ jsx("span", { style: { fontSize: 13, fontWeight: 600, color: muted }, children: adjust.unit }),
|
|
20243
|
+
moved && /* @__PURE__ */ jsxs(
|
|
20244
|
+
"button",
|
|
20245
|
+
{
|
|
20246
|
+
type: "button",
|
|
20247
|
+
onClick: () => commit(suggested),
|
|
20248
|
+
"data-testid": "decision-card-adjust-reset",
|
|
20249
|
+
style: {
|
|
20250
|
+
marginLeft: 8,
|
|
20251
|
+
border: "none",
|
|
20252
|
+
background: "none",
|
|
20253
|
+
padding: 0,
|
|
20254
|
+
cursor: "pointer",
|
|
20255
|
+
fontSize: 11.5,
|
|
20256
|
+
fontWeight: 600,
|
|
20257
|
+
color: muted,
|
|
20258
|
+
textDecoration: "underline",
|
|
20259
|
+
textUnderlineOffset: 2
|
|
20260
|
+
},
|
|
20261
|
+
children: [
|
|
20262
|
+
"Reset to suggested (",
|
|
20263
|
+
formatFigure(suggested, adjust.unit),
|
|
20264
|
+
")"
|
|
20265
|
+
]
|
|
20266
|
+
}
|
|
20267
|
+
)
|
|
20268
|
+
] }),
|
|
20269
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
20270
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative", height: 16, display: "flex", alignItems: "center" }, children: [
|
|
20271
|
+
/* @__PURE__ */ jsx(
|
|
20272
|
+
"div",
|
|
20273
|
+
{
|
|
20274
|
+
"aria-hidden": "true",
|
|
20275
|
+
style: {
|
|
20276
|
+
position: "absolute",
|
|
20277
|
+
left: 0,
|
|
20278
|
+
right: 0,
|
|
20279
|
+
height: 4,
|
|
20280
|
+
borderRadius: 9999,
|
|
20281
|
+
background: `linear-gradient(to right, ${accent} ${pct}%, #e8e8e8 ${pct}%)`
|
|
20282
|
+
}
|
|
20283
|
+
}
|
|
20284
|
+
),
|
|
20285
|
+
moved && /* @__PURE__ */ jsx(
|
|
20286
|
+
"div",
|
|
20287
|
+
{
|
|
20288
|
+
"aria-hidden": "true",
|
|
20289
|
+
title: `Suggested: ${formatFigure(suggested, adjust.unit)}`,
|
|
20290
|
+
style: {
|
|
20291
|
+
position: "absolute",
|
|
20292
|
+
left: `${suggestedPct}%`,
|
|
20293
|
+
transform: "translateX(-50%)",
|
|
20294
|
+
width: 2,
|
|
20295
|
+
height: 10,
|
|
20296
|
+
borderRadius: 1,
|
|
20297
|
+
background: muted,
|
|
20298
|
+
opacity: 0.55
|
|
20299
|
+
}
|
|
20300
|
+
}
|
|
20301
|
+
),
|
|
20302
|
+
/* @__PURE__ */ jsx(
|
|
20303
|
+
"input",
|
|
20304
|
+
{
|
|
20305
|
+
type: "range",
|
|
20306
|
+
className: "dc-range",
|
|
20307
|
+
min: adjust.min,
|
|
20308
|
+
max: adjust.max,
|
|
20309
|
+
step,
|
|
20310
|
+
value,
|
|
20311
|
+
onChange: (e) => commit(Number(e.target.value)),
|
|
20312
|
+
"aria-label": `${option.label} slider`,
|
|
20313
|
+
"data-testid": "decision-card-adjust-slider",
|
|
20314
|
+
style: { position: "relative", ["--dc-thumb"]: accent }
|
|
20315
|
+
}
|
|
20316
|
+
)
|
|
20317
|
+
] }),
|
|
20318
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 10.5, fontWeight: 600, color: muted, fontVariantNumeric: "tabular-nums" }, children: [
|
|
20319
|
+
/* @__PURE__ */ jsx("span", { children: formatFigure(adjust.min, adjust.unit) }),
|
|
20320
|
+
/* @__PURE__ */ jsx("span", { children: formatFigure(adjust.max, adjust.unit) })
|
|
20321
|
+
] })
|
|
20322
|
+
] }),
|
|
20323
|
+
/* @__PURE__ */ jsxs(
|
|
20324
|
+
"button",
|
|
20325
|
+
{
|
|
20326
|
+
type: "button",
|
|
20327
|
+
onClick: () => onConfirm(value),
|
|
20328
|
+
"data-testid": "decision-card-adjust-confirm",
|
|
20329
|
+
style: {
|
|
20330
|
+
alignSelf: "flex-start",
|
|
20331
|
+
border: `1px solid ${accent}`,
|
|
20332
|
+
background: accent,
|
|
20333
|
+
color: "white",
|
|
20334
|
+
borderRadius: 8,
|
|
20335
|
+
fontSize: 13,
|
|
20336
|
+
fontWeight: 600,
|
|
20337
|
+
padding: "9px 16px",
|
|
20338
|
+
cursor: "pointer",
|
|
20339
|
+
fontVariantNumeric: "tabular-nums",
|
|
20340
|
+
transition: "opacity 0.15s"
|
|
20341
|
+
},
|
|
20342
|
+
onMouseEnter: (e) => e.currentTarget.style.opacity = "0.88",
|
|
20343
|
+
onMouseLeave: (e) => e.currentTarget.style.opacity = "1",
|
|
20344
|
+
children: [
|
|
20345
|
+
option.label,
|
|
20346
|
+
" \xB7 ",
|
|
20347
|
+
formatFigure(value, adjust.unit)
|
|
20348
|
+
]
|
|
20349
|
+
}
|
|
20350
|
+
)
|
|
20351
|
+
]
|
|
20352
|
+
}
|
|
20353
|
+
);
|
|
20354
|
+
}
|
|
19940
20355
|
function DecisionCardRenderer({
|
|
19941
20356
|
data,
|
|
19942
20357
|
resolved = null,
|
|
19943
20358
|
onResolve,
|
|
19944
|
-
onOpenSource
|
|
20359
|
+
onOpenSource,
|
|
20360
|
+
eyebrow
|
|
19945
20361
|
}) {
|
|
19946
|
-
var _a, _b;
|
|
20362
|
+
var _a, _b, _c;
|
|
19947
20363
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
19948
20364
|
const rootRef = React45.useRef(null);
|
|
19949
20365
|
const width = useContainerWidth2(rootRef);
|
|
19950
20366
|
const stacked = width > 0 && width < STACK_BELOW;
|
|
20367
|
+
const [adjustingIdx, setAdjustingIdx] = React45.useState(null);
|
|
19951
20368
|
const options = (_a = data.options) != null ? _a : [];
|
|
19952
20369
|
const recommendedIdx = Math.max(
|
|
19953
20370
|
0,
|
|
@@ -20046,7 +20463,7 @@ function DecisionCardRenderer({
|
|
|
20046
20463
|
},
|
|
20047
20464
|
children: [
|
|
20048
20465
|
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
20049
|
-
/* @__PURE__ */ jsx(
|
|
20466
|
+
eyebrow === null ? null : /* @__PURE__ */ jsx(
|
|
20050
20467
|
"span",
|
|
20051
20468
|
{
|
|
20052
20469
|
style: {
|
|
@@ -20056,7 +20473,7 @@ function DecisionCardRenderer({
|
|
|
20056
20473
|
fontWeight: 700,
|
|
20057
20474
|
color: ACCENT2
|
|
20058
20475
|
},
|
|
20059
|
-
children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20476
|
+
children: eyebrow !== void 0 ? eyebrow : data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20060
20477
|
}
|
|
20061
20478
|
),
|
|
20062
20479
|
/* @__PURE__ */ jsx(
|
|
@@ -20102,7 +20519,20 @@ function DecisionCardRenderer({
|
|
|
20102
20519
|
]
|
|
20103
20520
|
}
|
|
20104
20521
|
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20105
|
-
/* @__PURE__ */ jsx(
|
|
20522
|
+
adjustingIdx != null && ((_b = options[adjustingIdx]) == null ? void 0 : _b.adjust) ? /* @__PURE__ */ jsx(
|
|
20523
|
+
ValueAdjuster,
|
|
20524
|
+
{
|
|
20525
|
+
option: options[adjustingIdx],
|
|
20526
|
+
accent: ACCENT2,
|
|
20527
|
+
border: BORDER4,
|
|
20528
|
+
muted: MUTED2,
|
|
20529
|
+
onBack: () => setAdjustingIdx(null),
|
|
20530
|
+
onConfirm: (value) => {
|
|
20531
|
+
setAdjustingIdx(null);
|
|
20532
|
+
onResolve == null ? void 0 : onResolve(options[adjustingIdx].label, value);
|
|
20533
|
+
}
|
|
20534
|
+
}
|
|
20535
|
+
) : /* @__PURE__ */ jsx(
|
|
20106
20536
|
"div",
|
|
20107
20537
|
{
|
|
20108
20538
|
style: {
|
|
@@ -20112,15 +20542,21 @@ function DecisionCardRenderer({
|
|
|
20112
20542
|
gap: 8
|
|
20113
20543
|
},
|
|
20114
20544
|
children: options.map((opt, idx) => {
|
|
20115
|
-
var _a2;
|
|
20545
|
+
var _a2, _b2;
|
|
20116
20546
|
const primary = idx === recommendedIdx;
|
|
20117
|
-
|
|
20547
|
+
const adjustable = Boolean(opt.adjust);
|
|
20548
|
+
return /* @__PURE__ */ jsxs(
|
|
20118
20549
|
"button",
|
|
20119
20550
|
{
|
|
20120
20551
|
type: "button",
|
|
20121
|
-
onClick: () => onResolve == null ? void 0 : onResolve(opt.label),
|
|
20552
|
+
onClick: () => adjustable ? setAdjustingIdx(idx) : onResolve == null ? void 0 : onResolve(opt.label),
|
|
20553
|
+
"data-adjustable": adjustable || void 0,
|
|
20122
20554
|
style: {
|
|
20123
20555
|
width: stacked ? "100%" : "auto",
|
|
20556
|
+
display: "inline-flex",
|
|
20557
|
+
alignItems: "center",
|
|
20558
|
+
justifyContent: stacked ? "flex-start" : "center",
|
|
20559
|
+
gap: 7,
|
|
20124
20560
|
textAlign: stacked ? "left" : "center",
|
|
20125
20561
|
border: `1px solid ${primary ? ACCENT2 : BORDER4}`,
|
|
20126
20562
|
background: primary ? ACCENT2 : "white",
|
|
@@ -20148,7 +20584,28 @@ function DecisionCardRenderer({
|
|
|
20148
20584
|
e.currentTarget.style.background = "white";
|
|
20149
20585
|
}
|
|
20150
20586
|
},
|
|
20151
|
-
children:
|
|
20587
|
+
children: [
|
|
20588
|
+
opt.label,
|
|
20589
|
+
adjustable && typeof opt.value === "number" && /* @__PURE__ */ jsxs(
|
|
20590
|
+
"span",
|
|
20591
|
+
{
|
|
20592
|
+
style: {
|
|
20593
|
+
fontSize: 11.5,
|
|
20594
|
+
fontWeight: 700,
|
|
20595
|
+
fontVariantNumeric: "tabular-nums",
|
|
20596
|
+
padding: "1px 7px",
|
|
20597
|
+
borderRadius: 9999,
|
|
20598
|
+
background: primary ? "rgba(255,255,255,0.22)" : "#f2f2f2",
|
|
20599
|
+
color: primary ? "white" : MUTED2,
|
|
20600
|
+
lineHeight: 1.5
|
|
20601
|
+
},
|
|
20602
|
+
children: [
|
|
20603
|
+
formatFigure(opt.value, (_b2 = opt.adjust) == null ? void 0 : _b2.unit),
|
|
20604
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { marginLeft: 4, opacity: 0.8 }, children: "\u270E" })
|
|
20605
|
+
]
|
|
20606
|
+
}
|
|
20607
|
+
)
|
|
20608
|
+
]
|
|
20152
20609
|
},
|
|
20153
20610
|
(_a2 = opt.id) != null ? _a2 : opt.label
|
|
20154
20611
|
);
|
|
@@ -20187,7 +20644,7 @@ function DecisionCardRenderer({
|
|
|
20187
20644
|
strokeLinejoin: "round"
|
|
20188
20645
|
}
|
|
20189
20646
|
) }),
|
|
20190
|
-
(
|
|
20647
|
+
(_c = data.source.label) != null ? _c : "View source for this figure"
|
|
20191
20648
|
]
|
|
20192
20649
|
}
|
|
20193
20650
|
)
|
|
@@ -20196,20 +20653,27 @@ function DecisionCardRenderer({
|
|
|
20196
20653
|
}
|
|
20197
20654
|
);
|
|
20198
20655
|
}
|
|
20656
|
+
function composeResolution(p, option, value) {
|
|
20657
|
+
var _a, _b, _c;
|
|
20658
|
+
if (value == null) return option;
|
|
20659
|
+
const unit = (_c = (_b = ((_a = p.options) != null ? _a : []).find((o) => o.label === option)) == null ? void 0 : _b.adjust) == null ? void 0 : _c.unit;
|
|
20660
|
+
return `${option} \xB7 ${formatFigure(value, unit)}`;
|
|
20661
|
+
}
|
|
20199
20662
|
function DecisionCardResolver(p) {
|
|
20200
|
-
var _a, _b
|
|
20663
|
+
var _a, _b;
|
|
20201
20664
|
const { resolvedDecisions, onDecisionResolve, onDecisionSource } = useGenUIInteraction();
|
|
20202
20665
|
const decisionId = (_a = p.id) != null ? _a : p.title;
|
|
20203
20666
|
const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
|
|
20204
|
-
const initial =
|
|
20667
|
+
const initial = hostResolved != null ? hostResolved : p.resolved ? composeResolution(p, p.resolved.option, p.resolved.value) : null;
|
|
20205
20668
|
const [localResolved, setLocalResolved] = React45.useState(initial);
|
|
20206
20669
|
React45.useEffect(() => {
|
|
20207
20670
|
if (hostResolved !== void 0) setLocalResolved(hostResolved);
|
|
20208
20671
|
}, [hostResolved]);
|
|
20209
20672
|
const resolved = hostResolved != null ? hostResolved : localResolved;
|
|
20210
|
-
const handleResolve = (option) => {
|
|
20211
|
-
|
|
20212
|
-
|
|
20673
|
+
const handleResolve = (option, value) => {
|
|
20674
|
+
const resolution = composeResolution(p, option, value);
|
|
20675
|
+
setLocalResolved(resolution);
|
|
20676
|
+
onDecisionResolve == null ? void 0 : onDecisionResolve(decisionId, resolution);
|
|
20213
20677
|
};
|
|
20214
20678
|
const handleSource = () => {
|
|
20215
20679
|
var _a2;
|
|
@@ -20218,7 +20682,7 @@ function DecisionCardResolver(p) {
|
|
|
20218
20682
|
window.open(p.source.url, "_blank", "noopener,noreferrer");
|
|
20219
20683
|
}
|
|
20220
20684
|
};
|
|
20221
|
-
return /* @__PURE__ */ jsx(ComponentActions, { filename: (
|
|
20685
|
+
return /* @__PURE__ */ jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "decision-card", children: /* @__PURE__ */ jsx(
|
|
20222
20686
|
DecisionCardRenderer,
|
|
20223
20687
|
{
|
|
20224
20688
|
data: p,
|
|
@@ -20229,6 +20693,302 @@ function DecisionCardResolver(p) {
|
|
|
20229
20693
|
) });
|
|
20230
20694
|
}
|
|
20231
20695
|
init_ThemeContext();
|
|
20696
|
+
var GREEN4 = "#15803d";
|
|
20697
|
+
var KEYFRAMES3 = `
|
|
20698
|
+
@keyframes dqSettle{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
|
|
20699
|
+
.dq-settle{animation:dqSettle 0.24s cubic-bezier(0.22,1,0.36,1) both}
|
|
20700
|
+
@keyframes dqFocus{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
|
|
20701
|
+
.dq-focus{animation:dqFocus 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
20702
|
+
@media (prefers-reduced-motion: reduce){
|
|
20703
|
+
.dq-settle,.dq-focus{animation:none !important;opacity:1 !important;transform:none !important}
|
|
20704
|
+
}`;
|
|
20705
|
+
function figureOf(item, decision) {
|
|
20706
|
+
var _a, _b, _c;
|
|
20707
|
+
if (decision.value == null) return decision.option;
|
|
20708
|
+
const unit = (_c = (_b = ((_a = item.options) != null ? _a : []).find((o) => o.label === decision.option)) == null ? void 0 : _b.adjust) == null ? void 0 : _c.unit;
|
|
20709
|
+
return `${decision.option} \xB7 ${formatFigure(decision.value, unit)}`;
|
|
20710
|
+
}
|
|
20711
|
+
function composeQueueMessage(items, decisions) {
|
|
20712
|
+
const lines = items.map((item, i) => {
|
|
20713
|
+
const d = decisions[i];
|
|
20714
|
+
return `${i + 1}. ${item.title} \u2192 ${d ? figureOf(item, d) : "(undecided)"}`;
|
|
20715
|
+
});
|
|
20716
|
+
const done = decisions.filter(Boolean).length;
|
|
20717
|
+
return `Decisions (${done}/${items.length}):
|
|
20718
|
+
${lines.join("\n")}`;
|
|
20719
|
+
}
|
|
20720
|
+
function Check({ size, color }) {
|
|
20721
|
+
return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7", stroke: color, strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
20722
|
+
}
|
|
20723
|
+
function amountChip(item) {
|
|
20724
|
+
if (typeof item.amount !== "number") return null;
|
|
20725
|
+
const abs = Math.abs(item.amount);
|
|
20726
|
+
const sign = item.amount < 0 ? "-" : "";
|
|
20727
|
+
if (abs >= 1e6) return `${sign}$${(abs / 1e6).toFixed(abs >= 1e7 ? 0 : 1)}M`;
|
|
20728
|
+
if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
|
|
20729
|
+
return `${sign}$${abs}`;
|
|
20730
|
+
}
|
|
20731
|
+
function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
|
|
20732
|
+
var _a;
|
|
20733
|
+
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
20734
|
+
const items = (_a = data.items) != null ? _a : [];
|
|
20735
|
+
const [decisions, setDecisions] = React45.useState(
|
|
20736
|
+
() => items.map(() => void 0)
|
|
20737
|
+
);
|
|
20738
|
+
const firstUndecided = decisions.findIndex((d) => !d);
|
|
20739
|
+
const [focusIdx, setFocusIdx] = React45.useState(firstUndecided >= 0 ? firstUndecided : null);
|
|
20740
|
+
const isSubmitted = submitted != null;
|
|
20741
|
+
const shown = isSubmitted ? items.map(
|
|
20742
|
+
(item, i) => {
|
|
20743
|
+
var _a2;
|
|
20744
|
+
return (_a2 = submitted.find((d) => d.id && d.id === item.id || d.title === item.title)) != null ? _a2 : submitted[i];
|
|
20745
|
+
}
|
|
20746
|
+
) : decisions;
|
|
20747
|
+
const decidedCount = shown.filter(Boolean).length;
|
|
20748
|
+
const allDecided = decidedCount === items.length;
|
|
20749
|
+
const decide = (idx, option, value) => {
|
|
20750
|
+
const item = items[idx];
|
|
20751
|
+
const next = decisions.slice();
|
|
20752
|
+
next[idx] = { id: item.id, title: item.title, option, value };
|
|
20753
|
+
setDecisions(next);
|
|
20754
|
+
const order = [...Array(items.length).keys()];
|
|
20755
|
+
const after = order.slice(idx + 1).concat(order.slice(0, idx + 1));
|
|
20756
|
+
const target = after.find((j) => j !== idx && !next[j]);
|
|
20757
|
+
setFocusIdx(target != null ? target : null);
|
|
20758
|
+
};
|
|
20759
|
+
const handleSubmit = () => {
|
|
20760
|
+
if (!allDecided || isSubmitted) return;
|
|
20761
|
+
const final = decisions;
|
|
20762
|
+
onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
|
|
20763
|
+
};
|
|
20764
|
+
return /* @__PURE__ */ jsxs(
|
|
20765
|
+
"div",
|
|
20766
|
+
{
|
|
20767
|
+
"data-testid": "decision-queue",
|
|
20768
|
+
"data-submitted": isSubmitted || void 0,
|
|
20769
|
+
style: {
|
|
20770
|
+
position: "relative",
|
|
20771
|
+
width: "100%",
|
|
20772
|
+
minWidth: 0,
|
|
20773
|
+
boxSizing: "border-box",
|
|
20774
|
+
borderRadius: "0.75rem",
|
|
20775
|
+
border: `1px solid ${BORDER4}`,
|
|
20776
|
+
background: "white",
|
|
20777
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)",
|
|
20778
|
+
padding: "16px 18px",
|
|
20779
|
+
display: "flex",
|
|
20780
|
+
flexDirection: "column",
|
|
20781
|
+
gap: 12,
|
|
20782
|
+
overflow: "hidden"
|
|
20783
|
+
},
|
|
20784
|
+
children: [
|
|
20785
|
+
/* @__PURE__ */ jsx("style", { children: KEYFRAMES3 }),
|
|
20786
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
20787
|
+
/* @__PURE__ */ jsx(
|
|
20788
|
+
"span",
|
|
20789
|
+
{
|
|
20790
|
+
style: {
|
|
20791
|
+
fontSize: 10.5,
|
|
20792
|
+
textTransform: "uppercase",
|
|
20793
|
+
letterSpacing: "0.07em",
|
|
20794
|
+
fontWeight: 700,
|
|
20795
|
+
color: isSubmitted ? GREEN4 : ACCENT2
|
|
20796
|
+
},
|
|
20797
|
+
children: isSubmitted ? "Decisions submitted" : "Decisions need you"
|
|
20798
|
+
}
|
|
20799
|
+
),
|
|
20800
|
+
data.title && /* @__PURE__ */ jsx(
|
|
20801
|
+
"p",
|
|
20802
|
+
{
|
|
20803
|
+
style: {
|
|
20804
|
+
fontFamily: "var(--font-serif)",
|
|
20805
|
+
fontSize: 16,
|
|
20806
|
+
fontWeight: 400,
|
|
20807
|
+
color: "var(--foreground)",
|
|
20808
|
+
letterSpacing: "-0.01em",
|
|
20809
|
+
margin: 0,
|
|
20810
|
+
lineHeight: 1.25
|
|
20811
|
+
},
|
|
20812
|
+
children: data.title
|
|
20813
|
+
}
|
|
20814
|
+
),
|
|
20815
|
+
data.description && /* @__PURE__ */ jsx("p", { style: { fontSize: 12.5, color: MUTED2, margin: 0, lineHeight: 1.45 }, children: data.description })
|
|
20816
|
+
] }),
|
|
20817
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: items.map((item, idx) => {
|
|
20818
|
+
var _a2, _b, _c;
|
|
20819
|
+
const decision = shown[idx];
|
|
20820
|
+
const focused = !isSubmitted && focusIdx === idx;
|
|
20821
|
+
if (focused) {
|
|
20822
|
+
return /* @__PURE__ */ jsx("div", { className: "dq-focus", "data-testid": `decision-queue-focus-${idx}`, children: /* @__PURE__ */ jsx(
|
|
20823
|
+
DecisionCardRenderer,
|
|
20824
|
+
{
|
|
20825
|
+
data: __spreadValues({ type: "decision-card" }, item),
|
|
20826
|
+
resolved: null,
|
|
20827
|
+
onResolve: (option, value) => decide(idx, option, value),
|
|
20828
|
+
eyebrow: `${idx + 1} of ${items.length}${item.decision_type ? ` \xB7 ${item.decision_type}` : ""}`
|
|
20829
|
+
}
|
|
20830
|
+
) }, (_a2 = item.id) != null ? _a2 : `q-${idx}`);
|
|
20831
|
+
}
|
|
20832
|
+
if (decision) {
|
|
20833
|
+
return /* @__PURE__ */ jsxs(
|
|
20834
|
+
"button",
|
|
20835
|
+
{
|
|
20836
|
+
type: "button",
|
|
20837
|
+
className: "dq-settle",
|
|
20838
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
20839
|
+
disabled: isSubmitted,
|
|
20840
|
+
title: isSubmitted ? void 0 : "Change this decision",
|
|
20841
|
+
"data-testid": `decision-queue-receipt-${idx}`,
|
|
20842
|
+
style: {
|
|
20843
|
+
display: "flex",
|
|
20844
|
+
alignItems: "center",
|
|
20845
|
+
gap: 8,
|
|
20846
|
+
width: "100%",
|
|
20847
|
+
textAlign: "left",
|
|
20848
|
+
border: "1px solid #dcfce7",
|
|
20849
|
+
background: "#f6fef9",
|
|
20850
|
+
borderRadius: 8,
|
|
20851
|
+
padding: "7px 11px",
|
|
20852
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
20853
|
+
font: "inherit"
|
|
20854
|
+
},
|
|
20855
|
+
children: [
|
|
20856
|
+
/* @__PURE__ */ jsx(Check, { size: 13, color: GREEN4 }),
|
|
20857
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: "var(--foreground)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: item.title }),
|
|
20858
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { color: MUTED2, fontSize: 12 }, children: "\u2192" }),
|
|
20859
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: GREEN4, fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap" }, children: figureOf(item, decision) }),
|
|
20860
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
20861
|
+
!isSubmitted && /* @__PURE__ */ jsx("span", { style: { fontSize: 11, fontWeight: 600, color: MUTED2 }, children: "Change" })
|
|
20862
|
+
]
|
|
20863
|
+
},
|
|
20864
|
+
(_b = item.id) != null ? _b : `q-${idx}`
|
|
20865
|
+
);
|
|
20866
|
+
}
|
|
20867
|
+
return /* @__PURE__ */ jsxs(
|
|
20868
|
+
"button",
|
|
20869
|
+
{
|
|
20870
|
+
type: "button",
|
|
20871
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
20872
|
+
disabled: isSubmitted,
|
|
20873
|
+
"data-testid": `decision-queue-upcoming-${idx}`,
|
|
20874
|
+
style: {
|
|
20875
|
+
display: "flex",
|
|
20876
|
+
alignItems: "center",
|
|
20877
|
+
gap: 8,
|
|
20878
|
+
width: "100%",
|
|
20879
|
+
textAlign: "left",
|
|
20880
|
+
border: `1px dashed ${BORDER4}`,
|
|
20881
|
+
background: "white",
|
|
20882
|
+
borderRadius: 8,
|
|
20883
|
+
padding: "7px 11px",
|
|
20884
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
20885
|
+
font: "inherit",
|
|
20886
|
+
opacity: 0.75
|
|
20887
|
+
},
|
|
20888
|
+
children: [
|
|
20889
|
+
/* @__PURE__ */ jsx(
|
|
20890
|
+
"span",
|
|
20891
|
+
{
|
|
20892
|
+
"aria-hidden": "true",
|
|
20893
|
+
style: { width: 13, height: 13, borderRadius: "50%", border: `1.5px solid ${MUTED2}`, flexShrink: 0, boxSizing: "border-box" }
|
|
20894
|
+
}
|
|
20895
|
+
),
|
|
20896
|
+
/* @__PURE__ */ jsxs("span", { style: { fontSize: 12.5, fontWeight: 600, color: MUTED2, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
20897
|
+
item.decision_type ? `${item.decision_type} \xB7 ` : "",
|
|
20898
|
+
item.title
|
|
20899
|
+
] }),
|
|
20900
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
20901
|
+
amountChip(item) && /* @__PURE__ */ jsx("span", { style: { fontSize: 11.5, fontWeight: 700, color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: amountChip(item) })
|
|
20902
|
+
]
|
|
20903
|
+
},
|
|
20904
|
+
(_c = item.id) != null ? _c : `q-${idx}`
|
|
20905
|
+
);
|
|
20906
|
+
}) }),
|
|
20907
|
+
/* @__PURE__ */ jsxs(
|
|
20908
|
+
"div",
|
|
20909
|
+
{
|
|
20910
|
+
style: {
|
|
20911
|
+
display: "flex",
|
|
20912
|
+
alignItems: "center",
|
|
20913
|
+
gap: 10,
|
|
20914
|
+
paddingTop: 10,
|
|
20915
|
+
borderTop: `1px solid #f0f0f0`
|
|
20916
|
+
},
|
|
20917
|
+
children: [
|
|
20918
|
+
/* @__PURE__ */ jsx("span", { style: { display: "inline-flex", gap: 4 }, "aria-hidden": "true", children: items.map((_, i) => /* @__PURE__ */ jsx(
|
|
20919
|
+
"span",
|
|
20920
|
+
{
|
|
20921
|
+
style: {
|
|
20922
|
+
width: 7,
|
|
20923
|
+
height: 7,
|
|
20924
|
+
borderRadius: "50%",
|
|
20925
|
+
background: shown[i] ? isSubmitted ? GREEN4 : ACCENT2 : "#e8e8e8",
|
|
20926
|
+
transition: "background 0.2s"
|
|
20927
|
+
}
|
|
20928
|
+
},
|
|
20929
|
+
`dot-${i}`
|
|
20930
|
+
)) }),
|
|
20931
|
+
/* @__PURE__ */ jsxs(
|
|
20932
|
+
"span",
|
|
20933
|
+
{
|
|
20934
|
+
style: { fontSize: 11.5, fontWeight: 600, color: MUTED2, fontVariantNumeric: "tabular-nums" },
|
|
20935
|
+
"data-testid": "decision-queue-progress",
|
|
20936
|
+
children: [
|
|
20937
|
+
decidedCount,
|
|
20938
|
+
"/",
|
|
20939
|
+
items.length,
|
|
20940
|
+
" decided"
|
|
20941
|
+
]
|
|
20942
|
+
}
|
|
20943
|
+
),
|
|
20944
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
20945
|
+
isSubmitted ? /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
|
|
20946
|
+
/* @__PURE__ */ jsx(Check, { size: 14, color: GREEN4 }),
|
|
20947
|
+
"Submitted"
|
|
20948
|
+
] }) : /* @__PURE__ */ jsx(
|
|
20949
|
+
"button",
|
|
20950
|
+
{
|
|
20951
|
+
type: "button",
|
|
20952
|
+
onClick: handleSubmit,
|
|
20953
|
+
disabled: !allDecided,
|
|
20954
|
+
"data-testid": "decision-queue-submit",
|
|
20955
|
+
style: {
|
|
20956
|
+
border: `1px solid ${allDecided ? ACCENT2 : BORDER4}`,
|
|
20957
|
+
background: allDecided ? ACCENT2 : "#f6f6f6",
|
|
20958
|
+
color: allDecided ? "white" : MUTED2,
|
|
20959
|
+
borderRadius: 8,
|
|
20960
|
+
fontSize: 13,
|
|
20961
|
+
fontWeight: 600,
|
|
20962
|
+
padding: "8px 16px",
|
|
20963
|
+
cursor: allDecided ? "pointer" : "default",
|
|
20964
|
+
fontVariantNumeric: "tabular-nums",
|
|
20965
|
+
transition: "background 0.15s, border-color 0.15s, color 0.15s"
|
|
20966
|
+
},
|
|
20967
|
+
children: data.submit_label || `Submit ${items.length} decision${items.length === 1 ? "" : "s"}`
|
|
20968
|
+
}
|
|
20969
|
+
)
|
|
20970
|
+
]
|
|
20971
|
+
}
|
|
20972
|
+
)
|
|
20973
|
+
]
|
|
20974
|
+
}
|
|
20975
|
+
);
|
|
20976
|
+
}
|
|
20977
|
+
function DecisionQueueResolver(p) {
|
|
20978
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20979
|
+
const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
|
|
20980
|
+
const queueId = (_b = (_a = p.id) != null ? _a : p.title) != null ? _b : "decision-queue";
|
|
20981
|
+
const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
|
|
20982
|
+
const [localSubmitted, setLocalSubmitted] = React45.useState(null);
|
|
20983
|
+
const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
|
|
20984
|
+
const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
|
|
20985
|
+
const handleSubmit = (decisions, message) => {
|
|
20986
|
+
setLocalSubmitted(decisions);
|
|
20987
|
+
onDecisionQueueSubmit == null ? void 0 : onDecisionQueueSubmit(queueId, decisions, message);
|
|
20988
|
+
};
|
|
20989
|
+
return /* @__PURE__ */ jsx(ComponentActions, { filename: (_f = p.title) != null ? _f : "decision-queue", children: /* @__PURE__ */ jsx(DecisionQueueRenderer, { data: p, submitted, onSubmit: handleSubmit }) });
|
|
20990
|
+
}
|
|
20991
|
+
init_ThemeContext();
|
|
20232
20992
|
var CONNECTED_GREEN3 = "#15803d";
|
|
20233
20993
|
var CONNECTED_GREEN_BG = "#dcfce7";
|
|
20234
20994
|
var PENDING_AMBER = "#92400e";
|
|
@@ -20660,6 +21420,8 @@ function resolveUI(rawPayload) {
|
|
|
20660
21420
|
return /* @__PURE__ */ jsx(DocumentFieldExtractionResolver, __spreadValues({}, payload));
|
|
20661
21421
|
case "decision-card":
|
|
20662
21422
|
return /* @__PURE__ */ jsx(DecisionCardResolver, __spreadValues({}, payload));
|
|
21423
|
+
case "decision-queue":
|
|
21424
|
+
return /* @__PURE__ */ jsx(DecisionQueueResolver, __spreadValues({}, payload));
|
|
20663
21425
|
case "tabby-auth":
|
|
20664
21426
|
return /* @__PURE__ */ jsx(TabbyAuthResolver, __spreadValues({}, payload));
|
|
20665
21427
|
default: {
|