@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/renderer.js CHANGED
@@ -20728,7 +20728,14 @@ function amountChip(item) {
20728
20728
  if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
20729
20729
  return `${sign}$${abs}`;
20730
20730
  }
20731
- function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20731
+ function DecisionQueueRenderer({
20732
+ data,
20733
+ submitted = null,
20734
+ onSubmit,
20735
+ hideSubmit,
20736
+ submitRef,
20737
+ onReady
20738
+ }) {
20732
20739
  var _a;
20733
20740
  const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
20734
20741
  const items = (_a = data.items) != null ? _a : [];
@@ -20761,6 +20768,22 @@ function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20761
20768
  const final = decisions;
20762
20769
  onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
20763
20770
  };
20771
+ const onReadyRef = React45.useRef(onReady);
20772
+ React45.useEffect(() => {
20773
+ onReadyRef.current = onReady;
20774
+ });
20775
+ React45.useEffect(() => {
20776
+ if (!onReadyRef.current) return;
20777
+ const msg = allDecided ? composeQueueMessage(items, decisions) : null;
20778
+ onReadyRef.current(allDecided && !isSubmitted, msg, decisions.filter(Boolean));
20779
+ }, [decisions, allDecided, isSubmitted]);
20780
+ React45.useEffect(() => {
20781
+ if (!submitRef) return;
20782
+ submitRef.current = handleSubmit;
20783
+ return () => {
20784
+ submitRef.current = null;
20785
+ };
20786
+ }, [submitRef, allDecided, isSubmitted, decisions]);
20764
20787
  return /* @__PURE__ */ jsxs(
20765
20788
  "div",
20766
20789
  {
@@ -20945,7 +20968,7 @@ function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
20945
20968
  isSubmitted ? /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
20946
20969
  /* @__PURE__ */ jsx(Check, { size: 14, color: GREEN4 }),
20947
20970
  "Submitted"
20948
- ] }) : /* @__PURE__ */ jsx(
20971
+ ] }) : hideSubmit ? null : /* @__PURE__ */ jsx(
20949
20972
  "button",
20950
20973
  {
20951
20974
  type: "button",