@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/resolver.cjs CHANGED
@@ -20756,7 +20756,14 @@ function amountChip(item) {
20756
20756
  if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
20757
20757
  return `${sign}$${abs}`;
20758
20758
  }
20759
- function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20759
+ function DecisionQueueRenderer({
20760
+ data,
20761
+ submitted = null,
20762
+ onSubmit,
20763
+ hideSubmit,
20764
+ submitRef,
20765
+ onReady
20766
+ }) {
20760
20767
  var _a;
20761
20768
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
20762
20769
  const items = (_a = data.items) != null ? _a : [];
@@ -20789,6 +20796,22 @@ function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20789
20796
  const final = decisions;
20790
20797
  onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
20791
20798
  };
20799
+ const onReadyRef = React45__default.default.useRef(onReady);
20800
+ React45__default.default.useEffect(() => {
20801
+ onReadyRef.current = onReady;
20802
+ });
20803
+ React45__default.default.useEffect(() => {
20804
+ if (!onReadyRef.current) return;
20805
+ const msg = allDecided ? composeQueueMessage(items, decisions) : null;
20806
+ onReadyRef.current(allDecided && !isSubmitted, msg, decisions.filter(Boolean));
20807
+ }, [decisions, allDecided, isSubmitted]);
20808
+ React45__default.default.useEffect(() => {
20809
+ if (!submitRef) return;
20810
+ submitRef.current = handleSubmit;
20811
+ return () => {
20812
+ submitRef.current = null;
20813
+ };
20814
+ }, [submitRef, allDecided, isSubmitted, decisions]);
20792
20815
  return /* @__PURE__ */ jsxRuntime.jsxs(
20793
20816
  "div",
20794
20817
  {
@@ -20973,7 +20996,7 @@ function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20973
20996
  isSubmitted ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
20974
20997
  /* @__PURE__ */ jsxRuntime.jsx(Check, { size: 14, color: GREEN4 }),
20975
20998
  "Submitted"
20976
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
20999
+ ] }) : hideSubmit ? null : /* @__PURE__ */ jsxRuntime.jsx(
20977
21000
  "button",
20978
21001
  {
20979
21002
  type: "button",