@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BuilderPayload } from "./schemas";
|
|
2
2
|
import type { BuilderState } from "./hooks";
|
|
3
3
|
import type { FileUploadResult, EntitySearch, EntityCreate } from "./fields";
|
|
4
|
+
import type { FieldSuggestion } from "./BuilderForm";
|
|
4
5
|
/** Single-block builder presentation. Two cosmetic variants of the SAME form:
|
|
5
6
|
* - "escalation": compact, accent left-rail, no title (the host/dock owns it),
|
|
6
7
|
* outlined "Continue" CTA, no in-card cancel. A high-urgency interruption
|
|
@@ -26,6 +27,9 @@ export interface BlockFormProps {
|
|
|
26
27
|
dense?: boolean;
|
|
27
28
|
/** Cosmetic variant. Defaults to "form". */
|
|
28
29
|
variant?: BlockFormVariant;
|
|
30
|
+
/** Agent-proposed values rendered as Apply chips under matching fields. */
|
|
31
|
+
fieldSuggestions?: FieldSuggestion[];
|
|
32
|
+
onApplySuggestion?: (suggestion: FieldSuggestion) => void;
|
|
29
33
|
}
|
|
30
|
-
export declare function BlockForm({ builder, state, onSubmit, onCancel, disabled, onFileUpload, onEntitySearch, onEntityCreate, hideActions, dense, variant, }: BlockFormProps): import("react/jsx-runtime").JSX.Element | null;
|
|
34
|
+
export declare function BlockForm({ builder, state, onSubmit, onCancel, disabled, onFileUpload, onEntitySearch, onEntityCreate, hideActions, dense, variant, fieldSuggestions, onApplySuggestion, }: BlockFormProps): import("react/jsx-runtime").JSX.Element | null;
|
|
31
35
|
//# sourceMappingURL=BlockForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockForm.d.ts","sourceRoot":"","sources":["../../src/builders/BlockForm.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW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CAAC,EACxB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,KAAK,EACL,OAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,EAAE,cAAc,kDAyJhB"}
|
|
@@ -16,6 +16,21 @@ export interface BuilderSubmission {
|
|
|
16
16
|
}>;
|
|
17
17
|
values?: Record<string, unknown>;
|
|
18
18
|
}
|
|
19
|
+
/** An agent-proposed value for one field (e.g. surfaced from an escalation
|
|
20
|
+
* discussion thread). Rendered as a "Suggested: X — Apply" chip under the
|
|
21
|
+
* matching field; Apply writes the value into the draft, where the user can
|
|
22
|
+
* still edit it freely before submitting. */
|
|
23
|
+
export interface FieldSuggestion {
|
|
24
|
+
/** Field name the suggestion targets. */
|
|
25
|
+
field: string;
|
|
26
|
+
/** Block id when the builder has several; defaults to the first block. */
|
|
27
|
+
block_id?: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
/** Display override for the value (e.g. "$6.69M" for 6692000). */
|
|
30
|
+
label?: string;
|
|
31
|
+
/** Short provenance note, e.g. "verified against sheet 4 · D47". */
|
|
32
|
+
note?: string;
|
|
33
|
+
}
|
|
19
34
|
export interface BuilderFormProps {
|
|
20
35
|
builder: BuilderPayload;
|
|
21
36
|
onSubmit: (submission: BuilderSubmission) => void;
|
|
@@ -43,6 +58,12 @@ export interface BuilderFormProps {
|
|
|
43
58
|
* the failing fields. Lets the host (dock) scroll to + focus the offending
|
|
44
59
|
* field and show a summary instead of the submit silently doing nothing. */
|
|
45
60
|
onValidationError?: (failure: ValidationFailure) => void;
|
|
61
|
+
/** Agent-proposed field values (see {@link FieldSuggestion}). Honoured by
|
|
62
|
+
* the form/escalation presentations; a suggestion whose field/block doesn't
|
|
63
|
+
* exist is silently ignored. */
|
|
64
|
+
fieldSuggestions?: FieldSuggestion[];
|
|
65
|
+
/** Fired when the user applies a suggestion (after the draft is updated). */
|
|
66
|
+
onApplySuggestion?: (suggestion: FieldSuggestion) => void;
|
|
46
67
|
}
|
|
47
|
-
export declare function BuilderFormResolver({ builder, onSubmit, onCancel, disabled, onFileUpload, onEntitySearch, onEntityCreate, onChange, submitRef, hideActions, dense, onValidationError, }: BuilderFormProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
export declare function BuilderFormResolver({ builder, onSubmit, onCancel, disabled, onFileUpload, onEntitySearch, onEntityCreate, onChange, submitRef, hideActions, dense, onValidationError, fieldSuggestions, onApplySuggestion, }: BuilderFormProps): import("react/jsx-runtime").JSX.Element;
|
|
48
69
|
//# sourceMappingURL=BuilderForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuilderForm.d.ts","sourceRoot":"","sources":["../../src/builders/BuilderForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7E;;;kDAGkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;IAChD,MAAM,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;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AC,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3D;AAED,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,EAAE,gBAAgB,2CA4HlB"}
|
package/dist/builders/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { builderSchema, builderBlockSchema, builderFieldSchema, builderFieldOpti
|
|
|
2
2
|
export type { BuilderPayload, BuilderBlock, BuilderField, BuilderFieldType, BuilderFieldOption, EntityOption, EntityCreateField, FileMapConfig, FileMapCategory, FileMapFile, FileMapValue, } from "./schemas";
|
|
3
3
|
export { validateBuilderPayload } from "./validateBuilder";
|
|
4
4
|
export { BuilderFormResolver } from "./BuilderForm";
|
|
5
|
-
export type { BuilderFormProps, BuilderSubmission } from "./BuilderForm";
|
|
5
|
+
export type { BuilderFormProps, BuilderSubmission, FieldSuggestion } from "./BuilderForm";
|
|
6
6
|
export { BuilderRecap } from "./BuilderRecap";
|
|
7
7
|
export type { BuilderRecapProps } from "./BuilderRecap";
|
|
8
8
|
export { BlockForm } from "./BlockForm";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/builders/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,eAAe,EAC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MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -235,7 +235,8 @@ var DEFAULT_INTERACTION = {
|
|
|
235
235
|
onStepSelect: void 0,
|
|
236
236
|
resolvedDecisions: void 0,
|
|
237
237
|
onDecisionResolve: void 0,
|
|
238
|
-
onDecisionSource: void 0
|
|
238
|
+
onDecisionSource: void 0,
|
|
239
|
+
onDecisionQueueSubmit: void 0
|
|
239
240
|
};
|
|
240
241
|
var GenUIInteractionContext = React4.createContext(DEFAULT_INTERACTION);
|
|
241
242
|
function useGenUIInteraction() {
|
|
@@ -289,8 +290,15 @@ function useContainerWidth(ref) {
|
|
|
289
290
|
var KEYFRAMES = `
|
|
290
291
|
@keyframes dcRise{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
|
|
291
292
|
.dc-rise{animation:dcRise 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
293
|
+
.dc-range{-webkit-appearance:none;appearance:none;width:100%;height:4px;border-radius:9999px;outline:none;cursor:pointer;background:transparent}
|
|
294
|
+
.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}
|
|
295
|
+
.dc-range::-webkit-slider-thumb:hover{transform:scale(1.12)}
|
|
296
|
+
.dc-range:active::-webkit-slider-thumb{cursor:grabbing}
|
|
297
|
+
.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}
|
|
298
|
+
.dc-range::-moz-range-track{height:4px;border-radius:9999px;background:transparent}
|
|
292
299
|
@media (prefers-reduced-motion: reduce){
|
|
293
300
|
.dc-rise{animation:none !important;opacity:1 !important;transform:none !important}
|
|
301
|
+
.dc-range::-webkit-slider-thumb{transition:none}
|
|
294
302
|
}`;
|
|
295
303
|
function SparkCheck({ size, color }) {
|
|
296
304
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -336,17 +344,240 @@ function FlagPill({ flag }) {
|
|
|
336
344
|
}
|
|
337
345
|
);
|
|
338
346
|
}
|
|
347
|
+
function formatFigure(value, unit) {
|
|
348
|
+
const body = Number.isInteger(value) ? `${value}` : `${Math.round(value * 100) / 100}`;
|
|
349
|
+
if (!unit) return body;
|
|
350
|
+
return unit === "%" ? `${body}%` : `${body} ${unit}`;
|
|
351
|
+
}
|
|
352
|
+
function clampToRange(raw, adjust) {
|
|
353
|
+
var _a;
|
|
354
|
+
const step = (_a = adjust.step) != null ? _a : Number.isInteger(adjust.min) && Number.isInteger(adjust.max) ? 1 : (adjust.max - adjust.min) / 100;
|
|
355
|
+
const snapped = Math.round((raw - adjust.min) / step) * step + adjust.min;
|
|
356
|
+
const fixed = Math.round(snapped * 1e6) / 1e6;
|
|
357
|
+
return Math.min(adjust.max, Math.max(adjust.min, fixed));
|
|
358
|
+
}
|
|
359
|
+
function ValueAdjuster({
|
|
360
|
+
option,
|
|
361
|
+
accent,
|
|
362
|
+
border,
|
|
363
|
+
muted,
|
|
364
|
+
onConfirm,
|
|
365
|
+
onBack
|
|
366
|
+
}) {
|
|
367
|
+
var _a, _b;
|
|
368
|
+
const adjust = option.adjust;
|
|
369
|
+
const suggested = clampToRange((_a = option.value) != null ? _a : adjust.min, adjust);
|
|
370
|
+
const [value, setValue] = React4__default.default.useState(suggested);
|
|
371
|
+
const [text, setText] = React4__default.default.useState(String(suggested));
|
|
372
|
+
const step = (_b = adjust.step) != null ? _b : Number.isInteger(adjust.min) && Number.isInteger(adjust.max) ? 1 : (adjust.max - adjust.min) / 100;
|
|
373
|
+
const pct = adjust.max > adjust.min ? (value - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
374
|
+
const suggestedPct = adjust.max > adjust.min ? (suggested - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
375
|
+
const moved = value !== suggested;
|
|
376
|
+
const commit = (raw) => {
|
|
377
|
+
const v = clampToRange(raw, adjust);
|
|
378
|
+
setValue(v);
|
|
379
|
+
setText(String(v));
|
|
380
|
+
};
|
|
381
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
382
|
+
"div",
|
|
383
|
+
{
|
|
384
|
+
className: "dc-rise",
|
|
385
|
+
"data-testid": "decision-card-adjuster",
|
|
386
|
+
style: {
|
|
387
|
+
display: "flex",
|
|
388
|
+
flexDirection: "column",
|
|
389
|
+
gap: 12,
|
|
390
|
+
border: `1px solid ${border}`,
|
|
391
|
+
borderRadius: 10,
|
|
392
|
+
padding: "12px 14px",
|
|
393
|
+
background: "#fafafa"
|
|
394
|
+
},
|
|
395
|
+
children: [
|
|
396
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
|
|
397
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: muted }, children: [
|
|
398
|
+
"Adjust \xB7 ",
|
|
399
|
+
option.label
|
|
400
|
+
] }),
|
|
401
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 } }),
|
|
402
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
403
|
+
"button",
|
|
404
|
+
{
|
|
405
|
+
type: "button",
|
|
406
|
+
onClick: onBack,
|
|
407
|
+
"data-testid": "decision-card-adjust-back",
|
|
408
|
+
style: { border: "none", background: "none", padding: 0, cursor: "pointer", fontSize: 12, fontWeight: 600, color: muted },
|
|
409
|
+
children: "Back"
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
] }),
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: 6 }, children: [
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
+
"input",
|
|
416
|
+
{
|
|
417
|
+
value: text,
|
|
418
|
+
onChange: (e) => {
|
|
419
|
+
setText(e.target.value);
|
|
420
|
+
const n = Number(e.target.value);
|
|
421
|
+
if (Number.isFinite(n)) setValue(clampToRange(n, adjust));
|
|
422
|
+
},
|
|
423
|
+
onBlur: () => commit(Number(text) || suggested),
|
|
424
|
+
onKeyDown: (e) => {
|
|
425
|
+
if (e.key === "Enter") {
|
|
426
|
+
const v = clampToRange(Number(text) || suggested, adjust);
|
|
427
|
+
commit(v);
|
|
428
|
+
onConfirm(v);
|
|
429
|
+
} else if (e.key === "ArrowUp") {
|
|
430
|
+
e.preventDefault();
|
|
431
|
+
commit(value + step);
|
|
432
|
+
} else if (e.key === "ArrowDown") {
|
|
433
|
+
e.preventDefault();
|
|
434
|
+
commit(value - step);
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
inputMode: "decimal",
|
|
438
|
+
"aria-label": `${option.label} value`,
|
|
439
|
+
"data-testid": "decision-card-adjust-input",
|
|
440
|
+
style: {
|
|
441
|
+
width: `${Math.max(3, String(text).length + 1)}ch`,
|
|
442
|
+
fontSize: 26,
|
|
443
|
+
fontWeight: 700,
|
|
444
|
+
fontVariantNumeric: "tabular-nums",
|
|
445
|
+
letterSpacing: "-0.02em",
|
|
446
|
+
color: "var(--foreground)",
|
|
447
|
+
border: "none",
|
|
448
|
+
borderBottom: `2px solid ${accent}`,
|
|
449
|
+
background: "transparent",
|
|
450
|
+
outline: "none",
|
|
451
|
+
padding: 0
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
adjust.unit && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, fontWeight: 600, color: muted }, children: adjust.unit }),
|
|
456
|
+
moved && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
457
|
+
"button",
|
|
458
|
+
{
|
|
459
|
+
type: "button",
|
|
460
|
+
onClick: () => commit(suggested),
|
|
461
|
+
"data-testid": "decision-card-adjust-reset",
|
|
462
|
+
style: {
|
|
463
|
+
marginLeft: 8,
|
|
464
|
+
border: "none",
|
|
465
|
+
background: "none",
|
|
466
|
+
padding: 0,
|
|
467
|
+
cursor: "pointer",
|
|
468
|
+
fontSize: 11.5,
|
|
469
|
+
fontWeight: 600,
|
|
470
|
+
color: muted,
|
|
471
|
+
textDecoration: "underline",
|
|
472
|
+
textUnderlineOffset: 2
|
|
473
|
+
},
|
|
474
|
+
children: [
|
|
475
|
+
"Reset to suggested (",
|
|
476
|
+
formatFigure(suggested, adjust.unit),
|
|
477
|
+
")"
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
483
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", height: 16, display: "flex", alignItems: "center" }, children: [
|
|
484
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
485
|
+
"div",
|
|
486
|
+
{
|
|
487
|
+
"aria-hidden": "true",
|
|
488
|
+
style: {
|
|
489
|
+
position: "absolute",
|
|
490
|
+
left: 0,
|
|
491
|
+
right: 0,
|
|
492
|
+
height: 4,
|
|
493
|
+
borderRadius: 9999,
|
|
494
|
+
background: `linear-gradient(to right, ${accent} ${pct}%, #e8e8e8 ${pct}%)`
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
moved && /* @__PURE__ */ jsxRuntime.jsx(
|
|
499
|
+
"div",
|
|
500
|
+
{
|
|
501
|
+
"aria-hidden": "true",
|
|
502
|
+
title: `Suggested: ${formatFigure(suggested, adjust.unit)}`,
|
|
503
|
+
style: {
|
|
504
|
+
position: "absolute",
|
|
505
|
+
left: `${suggestedPct}%`,
|
|
506
|
+
transform: "translateX(-50%)",
|
|
507
|
+
width: 2,
|
|
508
|
+
height: 10,
|
|
509
|
+
borderRadius: 1,
|
|
510
|
+
background: muted,
|
|
511
|
+
opacity: 0.55
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
516
|
+
"input",
|
|
517
|
+
{
|
|
518
|
+
type: "range",
|
|
519
|
+
className: "dc-range",
|
|
520
|
+
min: adjust.min,
|
|
521
|
+
max: adjust.max,
|
|
522
|
+
step,
|
|
523
|
+
value,
|
|
524
|
+
onChange: (e) => commit(Number(e.target.value)),
|
|
525
|
+
"aria-label": `${option.label} slider`,
|
|
526
|
+
"data-testid": "decision-card-adjust-slider",
|
|
527
|
+
style: { position: "relative", ["--dc-thumb"]: accent }
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
] }),
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 10.5, fontWeight: 600, color: muted, fontVariantNumeric: "tabular-nums" }, children: [
|
|
532
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFigure(adjust.min, adjust.unit) }),
|
|
533
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFigure(adjust.max, adjust.unit) })
|
|
534
|
+
] })
|
|
535
|
+
] }),
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
537
|
+
"button",
|
|
538
|
+
{
|
|
539
|
+
type: "button",
|
|
540
|
+
onClick: () => onConfirm(value),
|
|
541
|
+
"data-testid": "decision-card-adjust-confirm",
|
|
542
|
+
style: {
|
|
543
|
+
alignSelf: "flex-start",
|
|
544
|
+
border: `1px solid ${accent}`,
|
|
545
|
+
background: accent,
|
|
546
|
+
color: "white",
|
|
547
|
+
borderRadius: 8,
|
|
548
|
+
fontSize: 13,
|
|
549
|
+
fontWeight: 600,
|
|
550
|
+
padding: "9px 16px",
|
|
551
|
+
cursor: "pointer",
|
|
552
|
+
fontVariantNumeric: "tabular-nums",
|
|
553
|
+
transition: "opacity 0.15s"
|
|
554
|
+
},
|
|
555
|
+
onMouseEnter: (e) => e.currentTarget.style.opacity = "0.88",
|
|
556
|
+
onMouseLeave: (e) => e.currentTarget.style.opacity = "1",
|
|
557
|
+
children: [
|
|
558
|
+
option.label,
|
|
559
|
+
" \xB7 ",
|
|
560
|
+
formatFigure(value, adjust.unit)
|
|
561
|
+
]
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
}
|
|
339
568
|
function DecisionCardRenderer({
|
|
340
569
|
data,
|
|
341
570
|
resolved = null,
|
|
342
571
|
onResolve,
|
|
343
|
-
onOpenSource
|
|
572
|
+
onOpenSource,
|
|
573
|
+
eyebrow
|
|
344
574
|
}) {
|
|
345
|
-
var _a, _b;
|
|
575
|
+
var _a, _b, _c;
|
|
346
576
|
const { BORDER: BORDER2, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
347
577
|
const rootRef = React4__default.default.useRef(null);
|
|
348
578
|
const width = useContainerWidth(rootRef);
|
|
349
579
|
const stacked = width > 0 && width < STACK_BELOW;
|
|
580
|
+
const [adjustingIdx, setAdjustingIdx] = React4__default.default.useState(null);
|
|
350
581
|
const options = (_a = data.options) != null ? _a : [];
|
|
351
582
|
const recommendedIdx = Math.max(
|
|
352
583
|
0,
|
|
@@ -445,7 +676,7 @@ function DecisionCardRenderer({
|
|
|
445
676
|
},
|
|
446
677
|
children: [
|
|
447
678
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
448
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
+
eyebrow === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
449
680
|
"span",
|
|
450
681
|
{
|
|
451
682
|
style: {
|
|
@@ -455,7 +686,7 @@ function DecisionCardRenderer({
|
|
|
455
686
|
fontWeight: 700,
|
|
456
687
|
color: ACCENT2
|
|
457
688
|
},
|
|
458
|
-
children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
689
|
+
children: eyebrow !== void 0 ? eyebrow : data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
459
690
|
}
|
|
460
691
|
),
|
|
461
692
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -501,7 +732,20 @@ function DecisionCardRenderer({
|
|
|
501
732
|
]
|
|
502
733
|
}
|
|
503
734
|
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
504
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
735
|
+
adjustingIdx != null && ((_b = options[adjustingIdx]) == null ? void 0 : _b.adjust) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
736
|
+
ValueAdjuster,
|
|
737
|
+
{
|
|
738
|
+
option: options[adjustingIdx],
|
|
739
|
+
accent: ACCENT2,
|
|
740
|
+
border: BORDER2,
|
|
741
|
+
muted: MUTED2,
|
|
742
|
+
onBack: () => setAdjustingIdx(null),
|
|
743
|
+
onConfirm: (value) => {
|
|
744
|
+
setAdjustingIdx(null);
|
|
745
|
+
onResolve == null ? void 0 : onResolve(options[adjustingIdx].label, value);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
505
749
|
"div",
|
|
506
750
|
{
|
|
507
751
|
style: {
|
|
@@ -511,15 +755,21 @@ function DecisionCardRenderer({
|
|
|
511
755
|
gap: 8
|
|
512
756
|
},
|
|
513
757
|
children: options.map((opt, idx) => {
|
|
514
|
-
var _a2;
|
|
758
|
+
var _a2, _b2;
|
|
515
759
|
const primary = idx === recommendedIdx;
|
|
516
|
-
|
|
760
|
+
const adjustable = Boolean(opt.adjust);
|
|
761
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
517
762
|
"button",
|
|
518
763
|
{
|
|
519
764
|
type: "button",
|
|
520
|
-
onClick: () => onResolve == null ? void 0 : onResolve(opt.label),
|
|
765
|
+
onClick: () => adjustable ? setAdjustingIdx(idx) : onResolve == null ? void 0 : onResolve(opt.label),
|
|
766
|
+
"data-adjustable": adjustable || void 0,
|
|
521
767
|
style: {
|
|
522
768
|
width: stacked ? "100%" : "auto",
|
|
769
|
+
display: "inline-flex",
|
|
770
|
+
alignItems: "center",
|
|
771
|
+
justifyContent: stacked ? "flex-start" : "center",
|
|
772
|
+
gap: 7,
|
|
523
773
|
textAlign: stacked ? "left" : "center",
|
|
524
774
|
border: `1px solid ${primary ? ACCENT2 : BORDER2}`,
|
|
525
775
|
background: primary ? ACCENT2 : "white",
|
|
@@ -547,7 +797,28 @@ function DecisionCardRenderer({
|
|
|
547
797
|
e.currentTarget.style.background = "white";
|
|
548
798
|
}
|
|
549
799
|
},
|
|
550
|
-
children:
|
|
800
|
+
children: [
|
|
801
|
+
opt.label,
|
|
802
|
+
adjustable && typeof opt.value === "number" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
803
|
+
"span",
|
|
804
|
+
{
|
|
805
|
+
style: {
|
|
806
|
+
fontSize: 11.5,
|
|
807
|
+
fontWeight: 700,
|
|
808
|
+
fontVariantNumeric: "tabular-nums",
|
|
809
|
+
padding: "1px 7px",
|
|
810
|
+
borderRadius: 9999,
|
|
811
|
+
background: primary ? "rgba(255,255,255,0.22)" : "#f2f2f2",
|
|
812
|
+
color: primary ? "white" : MUTED2,
|
|
813
|
+
lineHeight: 1.5
|
|
814
|
+
},
|
|
815
|
+
children: [
|
|
816
|
+
formatFigure(opt.value, (_b2 = opt.adjust) == null ? void 0 : _b2.unit),
|
|
817
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { marginLeft: 4, opacity: 0.8 }, children: "\u270E" })
|
|
818
|
+
]
|
|
819
|
+
}
|
|
820
|
+
)
|
|
821
|
+
]
|
|
551
822
|
},
|
|
552
823
|
(_a2 = opt.id) != null ? _a2 : opt.label
|
|
553
824
|
);
|
|
@@ -586,7 +857,7 @@ function DecisionCardRenderer({
|
|
|
586
857
|
strokeLinejoin: "round"
|
|
587
858
|
}
|
|
588
859
|
) }),
|
|
589
|
-
(
|
|
860
|
+
(_c = data.source.label) != null ? _c : "View source for this figure"
|
|
590
861
|
]
|
|
591
862
|
}
|
|
592
863
|
)
|
|
@@ -595,20 +866,27 @@ function DecisionCardRenderer({
|
|
|
595
866
|
}
|
|
596
867
|
);
|
|
597
868
|
}
|
|
869
|
+
function composeResolution(p, option, value) {
|
|
870
|
+
var _a, _b, _c;
|
|
871
|
+
if (value == null) return option;
|
|
872
|
+
const unit = (_c = (_b = ((_a = p.options) != null ? _a : []).find((o) => o.label === option)) == null ? void 0 : _b.adjust) == null ? void 0 : _c.unit;
|
|
873
|
+
return `${option} \xB7 ${formatFigure(value, unit)}`;
|
|
874
|
+
}
|
|
598
875
|
function DecisionCardResolver(p) {
|
|
599
|
-
var _a, _b
|
|
876
|
+
var _a, _b;
|
|
600
877
|
const { resolvedDecisions, onDecisionResolve, onDecisionSource } = useGenUIInteraction();
|
|
601
878
|
const decisionId = (_a = p.id) != null ? _a : p.title;
|
|
602
879
|
const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
|
|
603
|
-
const initial =
|
|
880
|
+
const initial = hostResolved != null ? hostResolved : p.resolved ? composeResolution(p, p.resolved.option, p.resolved.value) : null;
|
|
604
881
|
const [localResolved, setLocalResolved] = React4__default.default.useState(initial);
|
|
605
882
|
React4__default.default.useEffect(() => {
|
|
606
883
|
if (hostResolved !== void 0) setLocalResolved(hostResolved);
|
|
607
884
|
}, [hostResolved]);
|
|
608
885
|
const resolved = hostResolved != null ? hostResolved : localResolved;
|
|
609
|
-
const handleResolve = (option) => {
|
|
610
|
-
|
|
611
|
-
|
|
886
|
+
const handleResolve = (option, value) => {
|
|
887
|
+
const resolution = composeResolution(p, option, value);
|
|
888
|
+
setLocalResolved(resolution);
|
|
889
|
+
onDecisionResolve == null ? void 0 : onDecisionResolve(decisionId, resolution);
|
|
612
890
|
};
|
|
613
891
|
const handleSource = () => {
|
|
614
892
|
var _a2;
|
|
@@ -617,7 +895,7 @@ function DecisionCardResolver(p) {
|
|
|
617
895
|
window.open(p.source.url, "_blank", "noopener,noreferrer");
|
|
618
896
|
}
|
|
619
897
|
};
|
|
620
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (
|
|
898
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "decision-card", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
621
899
|
DecisionCardRenderer,
|
|
622
900
|
{
|
|
623
901
|
data: p,
|
|
@@ -630,5 +908,6 @@ function DecisionCardResolver(p) {
|
|
|
630
908
|
|
|
631
909
|
exports.DecisionCardRenderer = DecisionCardRenderer;
|
|
632
910
|
exports.DecisionCardResolver = DecisionCardResolver;
|
|
911
|
+
exports.formatFigure = formatFigure;
|
|
633
912
|
//# sourceMappingURL=resolver.cjs.map
|
|
634
913
|
//# sourceMappingURL=resolver.cjs.map
|