@bravostudioai/react 0.1.12 → 0.1.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"EncoreActionContext.js","sources":["../../src/contexts/EncoreActionContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport type EncoreActionPayload = {\n bravo: {\n cancel: () => void;\n action: any;\n };\n};\n\ntype EncoreActionContextType = {\n onAction?: (payload: EncoreActionPayload) => void | Promise<void>;\n};\n\nconst EncoreActionContext = React.createContext<EncoreActionContextType>({});\n\nexport default EncoreActionContext;\n\n\n"],"names":["EncoreActionContext","React"],"mappings":";AAaA,MAAMA,IAAsBC,EAAM,cAAuC,CAAA,CAAE;"}
1
+ {"version":3,"file":"EncoreActionContext.js","sources":["../../src/contexts/EncoreActionContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport type EncoreActionPayload = {\n bravo: {\n cancel: () => void;\n action: any;\n componentId?: string; // ID of the component that triggered the action\n };\n};\n\ntype EncoreActionContextType = {\n onAction?: (payload: EncoreActionPayload) => void | Promise<void>;\n};\n\nconst EncoreActionContext = React.createContext<EncoreActionContextType>({});\n\nexport default EncoreActionContext;\n"],"names":["EncoreActionContext","React"],"mappings":";AAcA,MAAMA,IAAsBC,EAAM,cAAuC,CAAA,CAAE;"}
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AA6hGf,QAAA,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAoDxD,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AAwjGf,QAAA,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAoDxD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -3,6 +3,7 @@ export type EncoreActionPayload = {
3
3
  bravo: {
4
4
  cancel: () => void;
5
5
  action: any;
6
+ componentId?: string;
6
7
  };
7
8
  };
8
9
  type EncoreActionContextType = {
@@ -1 +1 @@
1
- {"version":3,"file":"EncoreActionContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/EncoreActionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,MAAM,EAAE,GAAG,CAAC;KACb,CAAC;CACH,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC;AAEF,QAAA,MAAM,mBAAmB,wCAAmD,CAAC;AAE7E,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"EncoreActionContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/EncoreActionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,MAAM,EAAE,GAAG,CAAC;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC;AAEF,QAAA,MAAM,mBAAmB,wCAAmD,CAAC;AAE7E,eAAe,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bravostudioai/react",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -401,6 +401,12 @@ const useEncoreStyle = (
401
401
  result.width = style.layout.size.x * scale;
402
402
  }
403
403
 
404
+ // HUG sizing: explicitly do NOT set width
405
+ // Let flex layout determine width based on content
406
+ if (style.layout?.layoutSizingHorizontal === "HUG") {
407
+ // Don't set result.width
408
+ }
409
+
404
410
  if (style.layout?.layoutSizingVertical === "FIXED") {
405
411
  const scale = pageContext.scaleFactor ?? 1;
406
412
  result.height = style.layout.size.y * scale;
@@ -798,7 +804,7 @@ const EncoreLinkActionWrapper: React.FC<{
798
804
  };
799
805
  if (typeof onAction === "function") {
800
806
  try {
801
- await onAction({ bravo: { cancel, action } });
807
+ await onAction({ bravo: { cancel, action, componentId: id } });
802
808
  proceed = true;
803
809
  } catch (e) {
804
810
  // ignore callback errors to avoid breaking in-bravo behavior
@@ -896,6 +902,7 @@ const EncoreLinkActionWrapper: React.FC<{
896
902
  },
897
903
  event: "tap",
898
904
  },
905
+ componentId: id,
899
906
  },
900
907
  });
901
908
  console.log("✅ Input group change event fired");
@@ -1463,6 +1470,7 @@ const SelectInputComponent: React.FC<ComponentProps> = ({
1463
1470
  nodeId: id,
1464
1471
  params: { value: newValue },
1465
1472
  },
1473
+ componentId: id,
1466
1474
  },
1467
1475
  });
1468
1476
  } catch (e) {
@@ -2174,6 +2182,7 @@ const SliderComponent = ({ id, name, nodeData, children }) => {
2174
2182
  const idleTimeoutRef = React.useRef(null);
2175
2183
  const pageContext = useContext(EncorePageContext);
2176
2184
  const repeatingContainerContext = useContext(EncoreRepeatingContainerContext);
2185
+ const { onAction } = useContext(EncoreActionContext);
2177
2186
 
2178
2187
  // Control props from context
2179
2188
  const [controlProps, setControlProps] = React.useState({
@@ -2620,8 +2629,26 @@ const SliderComponent = ({ id, name, nodeData, children }) => {
2620
2629
  if (currentControlProps.onIndexChange) {
2621
2630
  currentControlProps.onIndexChange(index);
2622
2631
  }
2632
+
2633
+ // Trigger onAction for visibility in parent
2634
+ if (typeof onAction === "function") {
2635
+ try {
2636
+ onAction({
2637
+ bravo: {
2638
+ cancel: () => {},
2639
+ action: {
2640
+ action: "index-change",
2641
+ params: { index },
2642
+ },
2643
+ componentId: id,
2644
+ },
2645
+ });
2646
+ } catch (e) {
2647
+ // ignore
2648
+ }
2649
+ }
2623
2650
  },
2624
- [] // Empty deps - we use ref to access latest controlProps
2651
+ [onAction, id] // Depend on onAction to ensure we call the latest version
2625
2652
  );
2626
2653
 
2627
2654
  // 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
-