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