labellife-design-tool 2.2.3 → 2.2.4

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/cjs/index.js CHANGED
@@ -10689,6 +10689,32 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
10689
10689
  }
10690
10690
  }, [fields.length]);
10691
10691
  var totalCount = initialTotalRef.current || fields.length;
10692
+
10693
+ // Back-from-summary: triggered by parent incrementing backTrigger prop
10694
+ // Must be defined and its useEffect called BEFORE any early returns (Rules of Hooks)
10695
+ var handleBackFromSummary = function handleBackFromSummary() {
10696
+ var last = completedHistoryRef.current.pop();
10697
+ if (!last) return;
10698
+ var el = last.el,
10699
+ previousValue = last.previousValue;
10700
+ if (el) {
10701
+ var isImage = el.custom && el.custom.inputType === 'image';
10702
+ el.set(isImage ? {
10703
+ src: previousValue || ''
10704
+ } : {
10705
+ text: previousValue || ''
10706
+ });
10707
+ isGoingBackRef.current = true;
10708
+ store._unresolveInputField(el);
10709
+ }
10710
+ // displayIndex stays unchanged — it already points to the last step (N-1)
10711
+ };
10712
+ React.useEffect(function () {
10713
+ if (backTrigger !== prevBackTriggerRef.current) {
10714
+ prevBackTriggerRef.current = backTrigger;
10715
+ handleBackFromSummary();
10716
+ }
10717
+ }, [backTrigger]);
10692
10718
  if (!enabled || fields.length === 0) return null;
10693
10719
 
10694
10720
  // Always show the first remaining field — the array shrinks as fields are resolved
@@ -10764,31 +10790,6 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
10764
10790
  };
10765
10791
  var canGoBack = displayIndex > 0;
10766
10792
 
10767
- // Back-from-summary: triggered by parent incrementing backTrigger prop
10768
- var handleBackFromSummary = function handleBackFromSummary() {
10769
- var last = completedHistoryRef.current.pop();
10770
- if (!last) return;
10771
- var el = last.el,
10772
- previousValue = last.previousValue;
10773
- if (el) {
10774
- var isImage = el.custom && el.custom.inputType === 'image';
10775
- el.set(isImage ? {
10776
- src: previousValue || ''
10777
- } : {
10778
- text: previousValue || ''
10779
- });
10780
- isGoingBackRef.current = true;
10781
- store._unresolveInputField(el);
10782
- }
10783
- // displayIndex stays unchanged — it already points to the last step (N-1)
10784
- };
10785
- React.useEffect(function () {
10786
- if (backTrigger !== prevBackTriggerRef.current) {
10787
- prevBackTriggerRef.current = backTrigger;
10788
- handleBackFromSummary();
10789
- }
10790
- }, [backTrigger]);
10791
-
10792
10793
  // ── Resolve which dialog component to use ───────────────────────────
10793
10794
  // Priority: per-type custom dialog > global CustomDialog > built-in
10794
10795
  var TYPE_DIALOG_MAP = {