@bravostudioai/react 0.1.12 → 0.1.13
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/package.json
CHANGED
package/src/components.tsx
CHANGED
|
@@ -798,7 +798,7 @@ const EncoreLinkActionWrapper: React.FC<{
|
|
|
798
798
|
};
|
|
799
799
|
if (typeof onAction === "function") {
|
|
800
800
|
try {
|
|
801
|
-
await onAction({ bravo: { cancel, action } });
|
|
801
|
+
await onAction({ bravo: { cancel, action, componentId: id } });
|
|
802
802
|
proceed = true;
|
|
803
803
|
} catch (e) {
|
|
804
804
|
// ignore callback errors to avoid breaking in-bravo behavior
|
|
@@ -896,6 +896,7 @@ const EncoreLinkActionWrapper: React.FC<{
|
|
|
896
896
|
},
|
|
897
897
|
event: "tap",
|
|
898
898
|
},
|
|
899
|
+
componentId: id,
|
|
899
900
|
},
|
|
900
901
|
});
|
|
901
902
|
console.log("✅ Input group change event fired");
|
|
@@ -1463,6 +1464,7 @@ const SelectInputComponent: React.FC<ComponentProps> = ({
|
|
|
1463
1464
|
nodeId: id,
|
|
1464
1465
|
params: { value: newValue },
|
|
1465
1466
|
},
|
|
1467
|
+
componentId: id,
|
|
1466
1468
|
},
|
|
1467
1469
|
});
|
|
1468
1470
|
} catch (e) {
|
|
@@ -2174,6 +2176,7 @@ const SliderComponent = ({ id, name, nodeData, children }) => {
|
|
|
2174
2176
|
const idleTimeoutRef = React.useRef(null);
|
|
2175
2177
|
const pageContext = useContext(EncorePageContext);
|
|
2176
2178
|
const repeatingContainerContext = useContext(EncoreRepeatingContainerContext);
|
|
2179
|
+
const { onAction } = useContext(EncoreActionContext);
|
|
2177
2180
|
|
|
2178
2181
|
// Control props from context
|
|
2179
2182
|
const [controlProps, setControlProps] = React.useState({
|
|
@@ -2620,8 +2623,26 @@ const SliderComponent = ({ id, name, nodeData, children }) => {
|
|
|
2620
2623
|
if (currentControlProps.onIndexChange) {
|
|
2621
2624
|
currentControlProps.onIndexChange(index);
|
|
2622
2625
|
}
|
|
2626
|
+
|
|
2627
|
+
// Trigger onAction for visibility in parent
|
|
2628
|
+
if (typeof onAction === "function") {
|
|
2629
|
+
try {
|
|
2630
|
+
onAction({
|
|
2631
|
+
bravo: {
|
|
2632
|
+
cancel: () => {},
|
|
2633
|
+
action: {
|
|
2634
|
+
action: "index-change",
|
|
2635
|
+
params: { index },
|
|
2636
|
+
},
|
|
2637
|
+
componentId: id,
|
|
2638
|
+
},
|
|
2639
|
+
});
|
|
2640
|
+
} catch (e) {
|
|
2641
|
+
// ignore
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2623
2644
|
},
|
|
2624
|
-
[] //
|
|
2645
|
+
[onAction, id] // Depend on onAction to ensure we call the latest version
|
|
2625
2646
|
);
|
|
2626
2647
|
|
|
2627
2648
|
// Set up scroll event listeners
|
|
@@ -4,6 +4,7 @@ export type EncoreActionPayload = {
|
|
|
4
4
|
bravo: {
|
|
5
5
|
cancel: () => void;
|
|
6
6
|
action: any;
|
|
7
|
+
componentId?: string; // ID of the component that triggered the action
|
|
7
8
|
};
|
|
8
9
|
};
|
|
9
10
|
|
|
@@ -14,5 +15,3 @@ type EncoreActionContextType = {
|
|
|
14
15
|
const EncoreActionContext = React.createContext<EncoreActionContextType>({});
|
|
15
16
|
|
|
16
17
|
export default EncoreActionContext;
|
|
17
|
-
|
|
18
|
-
|