mautourco-components 0.2.113 → 0.2.115
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/components/molecules/LocationDropdown/LocationDropdown.js +9 -2
- package/dist/components/organisms/TransferLine/TransferLine.js +1 -0
- package/package.json +1 -1
- package/src/components/molecules/LocationDropdown/LocationDropdown.tsx +10 -2
- package/src/components/organisms/TransferLine/TransferLine.tsx +1 -0
|
@@ -32,6 +32,11 @@ var LocationDropdown = function (_a) {
|
|
|
32
32
|
var dropdownPanelRef = useRef(null);
|
|
33
33
|
var inputRef = useRef(null);
|
|
34
34
|
var searchInputRef = useRef(null);
|
|
35
|
+
var getDefaultLabel = function (id) {
|
|
36
|
+
var _a;
|
|
37
|
+
var option = options.find(function (o) { return o.id === id; });
|
|
38
|
+
return (_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : '';
|
|
39
|
+
};
|
|
35
40
|
// Close dropdown when clicking outside
|
|
36
41
|
useEffect(function () {
|
|
37
42
|
var handleClickOutside = function (event) {
|
|
@@ -61,8 +66,9 @@ var LocationDropdown = function (_a) {
|
|
|
61
66
|
if (!selectedValue && defaultValue && !disabled) {
|
|
62
67
|
var defaultLocationData = {
|
|
63
68
|
id: defaultValue.id,
|
|
64
|
-
locationName: defaultValue.
|
|
69
|
+
locationName: getDefaultLabel(defaultValue.id),
|
|
65
70
|
};
|
|
71
|
+
console.log('defaultLocationData selected ===>', defaultLocationData);
|
|
66
72
|
onSelectionChange(defaultLocationData);
|
|
67
73
|
}
|
|
68
74
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -77,8 +83,9 @@ var LocationDropdown = function (_a) {
|
|
|
77
83
|
return;
|
|
78
84
|
var locationData = {
|
|
79
85
|
id: option.id,
|
|
80
|
-
locationName: option.
|
|
86
|
+
locationName: getDefaultLabel(option.id),
|
|
81
87
|
};
|
|
88
|
+
console.log('locationData selected ===>', locationData);
|
|
82
89
|
onSelectionChange(locationData);
|
|
83
90
|
setIsOpen(false);
|
|
84
91
|
setSearchQuery('');
|
|
@@ -186,6 +186,7 @@ var TransferLine = function (_a) {
|
|
|
186
186
|
};
|
|
187
187
|
// Helper to convert LocationData to LocationOption
|
|
188
188
|
var toLocationOption = function (locationData, position) {
|
|
189
|
+
console.log('locationData ===>', locationData);
|
|
189
190
|
if (!locationData)
|
|
190
191
|
return null;
|
|
191
192
|
// Try to find in the options to get the type
|
package/package.json
CHANGED
|
@@ -69,6 +69,11 @@ const LocationDropdown: React.FC<LocationDropdownProps> = ({
|
|
|
69
69
|
const inputRef = useRef<HTMLDivElement>(null);
|
|
70
70
|
const searchInputRef = useRef<HTMLInputElement>(null);
|
|
71
71
|
|
|
72
|
+
const getDefaultLabel = (id: string | number) => {
|
|
73
|
+
const option = options.find((o) => o.id === id);
|
|
74
|
+
return option?.label ?? '';
|
|
75
|
+
};
|
|
76
|
+
|
|
72
77
|
// Close dropdown when clicking outside
|
|
73
78
|
useEffect(() => {
|
|
74
79
|
const handleClickOutside = (event: MouseEvent) => {
|
|
@@ -102,8 +107,10 @@ const LocationDropdown: React.FC<LocationDropdownProps> = ({
|
|
|
102
107
|
if (!selectedValue && defaultValue && !disabled) {
|
|
103
108
|
const defaultLocationData: LocationData = {
|
|
104
109
|
id: defaultValue.id,
|
|
105
|
-
locationName: defaultValue.
|
|
110
|
+
locationName: getDefaultLabel(defaultValue.id),
|
|
106
111
|
};
|
|
112
|
+
|
|
113
|
+
console.log('defaultLocationData selected ===>', defaultLocationData);
|
|
107
114
|
onSelectionChange(defaultLocationData);
|
|
108
115
|
}
|
|
109
116
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -119,8 +126,9 @@ const LocationDropdown: React.FC<LocationDropdownProps> = ({
|
|
|
119
126
|
if (disabled) return;
|
|
120
127
|
const locationData: LocationData = {
|
|
121
128
|
id: option.id,
|
|
122
|
-
locationName: option.
|
|
129
|
+
locationName: getDefaultLabel(option.id),
|
|
123
130
|
};
|
|
131
|
+
console.log('locationData selected ===>', locationData);
|
|
124
132
|
onSelectionChange(locationData);
|
|
125
133
|
setIsOpen(false);
|
|
126
134
|
setSearchQuery('');
|
|
@@ -291,6 +291,7 @@ const TransferLine: React.FC<TransferLineProps> = ({
|
|
|
291
291
|
locationData: LocationData | null,
|
|
292
292
|
position: 'pickup' | 'dropoff'
|
|
293
293
|
): LocationOption | null => {
|
|
294
|
+
console.log('locationData ===>', locationData);
|
|
294
295
|
if (!locationData) return null;
|
|
295
296
|
|
|
296
297
|
// Try to find in the options to get the type
|