@adoptai/genui-components 0.1.61 → 0.1.62

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.js CHANGED
@@ -20889,7 +20889,14 @@ function amountChip(item) {
20889
20889
  if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
20890
20890
  return `${sign}$${abs}`;
20891
20891
  }
20892
- function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20892
+ function DecisionQueueRenderer({
20893
+ data,
20894
+ submitted = null,
20895
+ onSubmit,
20896
+ hideSubmit,
20897
+ submitRef,
20898
+ onReady
20899
+ }) {
20893
20900
  var _a2;
20894
20901
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
20895
20902
  const items = (_a2 = data.items) != null ? _a2 : [];
@@ -20922,6 +20929,22 @@ function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20922
20929
  const final = decisions;
20923
20930
  onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
20924
20931
  };
20932
+ const onReadyRef = React45.useRef(onReady);
20933
+ React45.useEffect(() => {
20934
+ onReadyRef.current = onReady;
20935
+ });
20936
+ React45.useEffect(() => {
20937
+ if (!onReadyRef.current) return;
20938
+ const msg = allDecided ? composeQueueMessage(items, decisions) : null;
20939
+ onReadyRef.current(allDecided && !isSubmitted, msg, decisions.filter(Boolean));
20940
+ }, [decisions, allDecided, isSubmitted]);
20941
+ React45.useEffect(() => {
20942
+ if (!submitRef) return;
20943
+ submitRef.current = handleSubmit;
20944
+ return () => {
20945
+ submitRef.current = null;
20946
+ };
20947
+ }, [submitRef, allDecided, isSubmitted, decisions]);
20925
20948
  return /* @__PURE__ */ jsxs(
20926
20949
  "div",
20927
20950
  {
@@ -21106,7 +21129,7 @@ function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
21106
21129
  isSubmitted ? /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
21107
21130
  /* @__PURE__ */ jsx(Check, { size: 14, color: GREEN4 }),
21108
21131
  "Submitted"
21109
- ] }) : /* @__PURE__ */ jsx(
21132
+ ] }) : hideSubmit ? null : /* @__PURE__ */ jsx(
21110
21133
  "button",
21111
21134
  {
21112
21135
  type: "button",