@octaviaflow/core 3.0.18-beta.29 → 3.0.18-beta.30

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.cjs CHANGED
@@ -30626,92 +30626,35 @@ var ForEachNode = ({
30626
30626
  node
30627
30627
  }) => {
30628
30628
  const d = node.data ?? {};
30629
- const iteratorExpr = d.iterator ?? d.description ?? "items[]";
30630
- const collapsed = !!d.collapsed;
30631
- const disabled = !!d.disabled;
30632
- const hiddenCount = d.hiddenCount;
30633
- const bridge = useFlowNodeBridge();
30634
- const onChevronClick = (e) => {
30635
- e.stopPropagation();
30636
- bridge.toggleNodeCollapse(node.id);
30637
- };
30629
+ const branches = d.branches ?? [
30630
+ { id: "each", label: "Each" },
30631
+ { id: "done", label: "Done" }
30632
+ ];
30638
30633
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
30639
- "div",
30634
+ BaseNode,
30640
30635
  {
30641
- className: "ods-flow-foreach",
30642
- "data-collapsed": collapsed ? "true" : "false",
30643
- "data-disabled": disabled ? "true" : void 0,
30644
- style: {
30645
- width: node.width ?? 420,
30646
- height: collapsed ? 40 : node.height ?? 260
30647
- },
30636
+ kind: d.kind ?? "FOR EACH",
30637
+ icon: d.icon,
30638
+ title: d.title ?? "For each",
30639
+ chip: d.chip ?? d.badge,
30640
+ description: d.description ?? d.subtitle ?? d.iterator,
30641
+ valueChip: d.valueChip,
30642
+ status: d.status,
30643
+ accent: "amber",
30648
30644
  children: [
30649
- !collapsed && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(NodeResizer, { minWidth: 240, minHeight: 120 }),
30650
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "ods-flow-foreach__header", children: [
30651
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
30652
- "button",
30653
- {
30654
- type: "button",
30655
- className: "ods-flow-foreach__chevron",
30656
- "data-flow-no-drag": "true",
30657
- "aria-label": collapsed ? "Expand iterator" : "Collapse iterator",
30658
- "aria-expanded": !collapsed,
30659
- onClick: onChevronClick,
30660
- onPointerDown: (e) => e.stopPropagation(),
30661
- children: collapsed ? "\u25B8" : "\u25BE"
30662
- }
30663
- ),
30664
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ods-flow-foreach__icon", "aria-hidden": "true", children: "\u21BB" }),
30665
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "ods-flow-foreach__title", children: d.title ?? "For each" }),
30666
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("code", { className: "ods-flow-foreach__iterator", children: iteratorExpr }),
30667
- disabled && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
30668
- "span",
30669
- {
30670
- className: "ods-flow-foreach__disabled-badge",
30671
- "aria-label": "Disabled subflow",
30672
- children: "Disabled"
30673
- }
30674
- ),
30675
- collapsed && hiddenCount !== void 0 && hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("span", { className: "ods-flow-foreach__count", "aria-label": `${hiddenCount} hidden steps`, children: [
30676
- hiddenCount,
30677
- " steps"
30678
- ] })
30679
- ] }),
30680
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top", id: "__group_in", label: !collapsed ? "in" : void 0 }),
30681
- collapsed ? (
30682
- // Collapsed: single bottom exit so the container behaves like a
30683
- // regular action in the chain.
30684
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "source", position: "bottom", id: "__group_out" })
30685
- ) : (
30686
- // Expanded: two bottom outputs spread across the bottom edge.
30687
- // Index/total tell the Handle to position them at 33% and 66%
30688
- // along the edge (per `handleSideStyle`). `each` is left of
30689
- // centre, `__group_out` (labelled "done") is right of centre.
30690
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
30691
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
30692
- Handle,
30693
- {
30694
- type: "source",
30695
- position: "bottom",
30696
- id: "each",
30697
- label: "each",
30698
- index: 0,
30699
- total: 2
30700
- }
30701
- ),
30702
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
30703
- Handle,
30704
- {
30705
- type: "source",
30706
- position: "bottom",
30707
- id: "__group_out",
30708
- label: "done",
30709
- index: 1,
30710
- total: 2
30711
- }
30712
- )
30713
- ] })
30714
- )
30645
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Handle, { type: "target", position: "top" }),
30646
+ branches.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
30647
+ Handle,
30648
+ {
30649
+ type: "source",
30650
+ position: "bottom",
30651
+ id: b.id,
30652
+ index: i,
30653
+ total: branches.length,
30654
+ label: b.label
30655
+ },
30656
+ b.id
30657
+ ))
30715
30658
  ]
30716
30659
  }
30717
30660
  );