mautourco-components 0.2.78 → 0.2.79
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.
|
@@ -28,6 +28,10 @@ var CarBookingCard = function (_a) {
|
|
|
28
28
|
var _u = useState([]), selectedSupplements = _u[0], setSelectedSupplements = _u[1];
|
|
29
29
|
var dropdownRef = useRef(null);
|
|
30
30
|
var panelRef = useRef(null);
|
|
31
|
+
// Synchronize internal isSelected state with the state prop when it changes from parent
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
setIsSelected(state === 'selected');
|
|
34
|
+
}, [state]);
|
|
31
35
|
var resolvedShowSupplement = showSupplement !== null && showSupplement !== void 0 ? showSupplement : Boolean(supplements.length > 0 && transfers.length > 0);
|
|
32
36
|
var hasSupplementsSelected = selectedSupplements.some(function (s) { return s.value > 0; });
|
|
33
37
|
// Close dropdown when clicking outside
|
package/package.json
CHANGED
|
@@ -104,6 +104,11 @@ const CarBookingCard: React.FC<CarBookingCardProps> = ({
|
|
|
104
104
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
105
105
|
const panelRef = useRef<HTMLDivElement>(null);
|
|
106
106
|
|
|
107
|
+
// Synchronize internal isSelected state with the state prop when it changes from parent
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
setIsSelected(state === 'selected');
|
|
110
|
+
}, [state]);
|
|
111
|
+
|
|
107
112
|
const resolvedShowSupplement =
|
|
108
113
|
showSupplement ?? Boolean(supplements.length > 0 && transfers.length > 0);
|
|
109
114
|
|