MCPcopy
hub / github.com/nilbuild/driver.js / handleOverlayClick

Function handleOverlayClick

src/driver.ts:62–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 }
61
62 function handleOverlayClick() {
63 const overlayClickBehavior = getConfig("overlayClickBehavior");
64
65 if (getConfig("allowClose") && overlayClickBehavior === "close") {
66 destroy();
67 return;
68 }
69
70 if (typeof overlayClickBehavior === "function") {
71 const activeStep = getState("__activeStep");
72 const activeElement = getState("__activeElement");
73
74 overlayClickBehavior(activeElement, activeStep!, {
75 config: getConfig(),
76 state: getState(),
77 driver: getCurrentDriver(),
78 });
79
80 return;
81 }
82
83 if (overlayClickBehavior === "nextStep") {
84 const activeStep = getState("activeStep");
85 const activeElement = getState("activeElement");
86
87 const steps = getConfig("steps") || [];
88 const isLastStep = getState("activeIndex") === steps.length - 1;
89 const onDoneClick = activeStep?.popover?.onDoneClick || getConfig("onDoneClick");
90 if (isLastStep && onDoneClick) {
91 onDoneClick(activeElement, activeStep!, {
92 config: getConfig(),
93 state: getState(),
94 driver: getCurrentDriver(),
95 });
96 return;
97 }
98
99 const onNextClick = activeStep?.popover?.onNextClick || getConfig("onNextClick");
100 if (onNextClick) {
101 onNextClick(activeElement, activeStep!, {
102 config: getConfig(),
103 state: getState(),
104 driver: getCurrentDriver(),
105 });
106 return;
107 }
108
109 moveNext();
110 }
111 }
112
113 function moveNext() {
114 const activeIndex = getState("activeIndex");

Callers

nothing calls this directly

Calls 5

getConfigFunction · 0.90
getStateFunction · 0.90
getCurrentDriverFunction · 0.90
destroyFunction · 0.85
moveNextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…