mautourco-components 0.2.107 → 0.2.108
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 +1 -3
- package/dist/components/organisms/PaxSelector/PaxSelector.js +6 -3
- package/package.json +1 -1
- package/src/components/molecules/LocationDropdown/LocationDropdown.tsx +1 -3
- package/src/components/organisms/PaxSelector/PaxSelector.tsx +6 -4
|
@@ -47,9 +47,7 @@ var LocationDropdown = function (_a) {
|
|
|
47
47
|
// Scroll to input when dropdown opens (if scrollOnOpen is true)
|
|
48
48
|
useEffect(function () {
|
|
49
49
|
setTimeout(function () {
|
|
50
|
-
|
|
51
|
-
scrollIntoViewOnOpen(dropdownPanelRef, isOpen, scrollOnOpen);
|
|
52
|
-
}
|
|
50
|
+
scrollIntoViewOnOpen(dropdownPanelRef, isOpen, scrollOnOpen);
|
|
53
51
|
}, 10);
|
|
54
52
|
}, [isOpen, scrollOnOpen]);
|
|
55
53
|
// Reset search when dropdown closes
|
|
@@ -189,6 +189,7 @@ var PaxSelector = function (_a) {
|
|
|
189
189
|
var _t = useState(defaultRooms || [__assign(__assign({}, DEFAULT_PAX_DATA), { roomId: '1' })]), rooms = _t[0], setRooms = _t[1];
|
|
190
190
|
var containerRef = useRef(null);
|
|
191
191
|
var triggerRef = useRef(null);
|
|
192
|
+
var paxSelectorRef = useRef(null);
|
|
192
193
|
var hasInitialized = useRef(false);
|
|
193
194
|
var lastRoomRef = useRef(null);
|
|
194
195
|
var agesSectionRef = useRef(null);
|
|
@@ -327,14 +328,16 @@ var PaxSelector = function (_a) {
|
|
|
327
328
|
if (isOpen) {
|
|
328
329
|
document.addEventListener('mousedown', handleClickOutside);
|
|
329
330
|
}
|
|
330
|
-
onPaxOpenChange === null || onPaxOpenChange === void 0 ? void 0 : onPaxOpenChange();
|
|
331
331
|
return function () {
|
|
332
332
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
333
333
|
};
|
|
334
334
|
}, [isOpen, internalData, rooms, multipleRooms]);
|
|
335
335
|
// Scroll to input when dropdown opens (if scrollOnOpen is true)
|
|
336
336
|
useEffect(function () {
|
|
337
|
-
|
|
337
|
+
setTimeout(function () {
|
|
338
|
+
scrollIntoViewOnOpen(paxSelectorRef, isOpen, scrollOnOpen);
|
|
339
|
+
}, 10);
|
|
340
|
+
onPaxOpenChange === null || onPaxOpenChange === void 0 ? void 0 : onPaxOpenChange();
|
|
338
341
|
}, [isOpen, scrollOnOpen]);
|
|
339
342
|
// Scroll to age section when new age inputs are added (single room mode)
|
|
340
343
|
useEffect(function () {
|
|
@@ -441,7 +444,7 @@ var PaxSelector = function (_a) {
|
|
|
441
444
|
return "".concat(total, " pax");
|
|
442
445
|
};
|
|
443
446
|
var hasPax = getTotalPax() > 0;
|
|
444
|
-
return (_jsxs("div", { className: "pax-selector ".concat(disabled ? 'pax-selector--disabled' : '', " ").concat(className), ref: containerRef, children: [_jsxs("button", { ref: triggerRef, type: "button", className: "pax-selector__trigger", onClick: function () { return !disabled && setIsOpen(!isOpen); }, "aria-expanded": isOpen, "aria-haspopup": "true", disabled: disabled, children: [_jsx(Text, { size: "sm", variant: "regular", className: "pax-selector__label", children: label }), _jsxs("div", { className: "pax-selector__input ".concat(isOpen ? 'pax-selector__input--active' : '', " ").concat(disabled ? 'pax-selector__input--disabled' : ''), children: [_jsxs("div", { className: "pax-selector__input-content", children: [_jsx(Icon, { name: "user-icon", size: "sm", className: "pax-selector__input-icon" }), _jsx("span", { className: "pax-selector__input-text ".concat(!hasPax ? 'pax-selector__input-placeholder' : ''), children: getDisplayText() })] }), _jsx(Icon, { name: "chevron-down", size: "sm", className: "pax-selector__chevron ".concat(isOpen ? 'pax-selector__chevron--open' : '') })] })] }), isOpen && (_jsxs("div", { className: "pax-selector__dropdown", children: [multipleRooms ? (_jsxs(_Fragment, { children: [showAddRoom && (_jsxs("button", { type: "button", className: "pax-selector__add-room", onClick: handleAddRoom, children: [_jsx(Icon, { name: "home", size: "sm", className: "pax-selector__add-room-icon" }), "Add a room", _jsx(Icon, { name: "plus", size: "sm", className: "pax-selector__add-room-icon" })] })), _jsx("div", { className: "pax-selector__rooms", children: rooms.map(function (room, index) { return (_jsx(RoomEditor, { room: room, roomNumber: index + 1, showRemove: rooms.length > 1, maxAdults: maxAdults, maxTeens: maxTeens, maxChildren: maxChildren, maxInfants: maxInfants, onChange: function (updatedRoom) { return handleRoomChange(room.roomId, updatedRoom); }, onRemove: function () { return handleRemoveRoom(room.roomId); }, scrollToRef: index === rooms.length - 1 ? lastRoomRef : undefined, ageRange: ageRange, checkEmpty: checkEmpty }, room.roomId)); }) })] })) : (
|
|
447
|
+
return (_jsxs("div", { className: "pax-selector ".concat(disabled ? 'pax-selector--disabled' : '', " ").concat(className), ref: containerRef, children: [_jsxs("button", { ref: triggerRef, type: "button", className: "pax-selector__trigger", onClick: function () { return !disabled && setIsOpen(!isOpen); }, "aria-expanded": isOpen, "aria-haspopup": "true", disabled: disabled, children: [_jsx(Text, { size: "sm", variant: "regular", className: "pax-selector__label", children: label }), _jsxs("div", { className: "pax-selector__input ".concat(isOpen ? 'pax-selector__input--active' : '', " ").concat(disabled ? 'pax-selector__input--disabled' : ''), children: [_jsxs("div", { className: "pax-selector__input-content", children: [_jsx(Icon, { name: "user-icon", size: "sm", className: "pax-selector__input-icon" }), _jsx("span", { className: "pax-selector__input-text ".concat(!hasPax ? 'pax-selector__input-placeholder' : ''), children: getDisplayText() })] }), _jsx(Icon, { name: "chevron-down", size: "sm", className: "pax-selector__chevron ".concat(isOpen ? 'pax-selector__chevron--open' : '') })] })] }), isOpen && (_jsxs("div", { className: "pax-selector__dropdown", ref: paxSelectorRef, children: [multipleRooms ? (_jsxs(_Fragment, { children: [showAddRoom && (_jsxs("button", { type: "button", className: "pax-selector__add-room", onClick: handleAddRoom, children: [_jsx(Icon, { name: "home", size: "sm", className: "pax-selector__add-room-icon" }), "Add a room", _jsx(Icon, { name: "plus", size: "sm", className: "pax-selector__add-room-icon" })] })), _jsx("div", { className: "pax-selector__rooms", children: rooms.map(function (room, index) { return (_jsx(RoomEditor, { room: room, roomNumber: index + 1, showRemove: rooms.length > 1, maxAdults: maxAdults, maxTeens: maxTeens, maxChildren: maxChildren, maxInfants: maxInfants, onChange: function (updatedRoom) { return handleRoomChange(room.roomId, updatedRoom); }, onRemove: function () { return handleRemoveRoom(room.roomId); }, scrollToRef: index === rooms.length - 1 ? lastRoomRef : undefined, ageRange: ageRange, checkEmpty: checkEmpty }, room.roomId)); }) })] })) : (
|
|
445
448
|
/* Single Room Mode */
|
|
446
449
|
_jsxs(_Fragment, { children: [_jsxs("div", { className: "pax-selector__steppers", children: [_jsx(StepperRow, { label: "Adult", value: internalData.adults, max: maxAdults, onChange: function (val) { return handleDataChange('adults', val); } }), _jsx(StepperRow, { label: "Teen", value: internalData.teens, max: maxTeens, onChange: function (val) { return handleDataChange('teens', val); } }), _jsx(StepperRow, { label: "Child", value: internalData.children, max: maxChildren, onChange: function (val) { return handleDataChange('children', val); } }), _jsx(StepperRow, { label: "Infant", value: internalData.infants, max: maxInfants, onChange: function (val) { return handleDataChange('infants', val); } })] }), (internalData.teens > 0 ||
|
|
447
450
|
internalData.children > 0 ||
|
package/package.json
CHANGED
|
@@ -85,9 +85,7 @@ const LocationDropdown: React.FC<LocationDropdownProps> = ({
|
|
|
85
85
|
// Scroll to input when dropdown opens (if scrollOnOpen is true)
|
|
86
86
|
useEffect(() => {
|
|
87
87
|
setTimeout(() => {
|
|
88
|
-
|
|
89
|
-
scrollIntoViewOnOpen(dropdownPanelRef, isOpen, scrollOnOpen);
|
|
90
|
-
}
|
|
88
|
+
scrollIntoViewOnOpen(dropdownPanelRef, isOpen, scrollOnOpen);
|
|
91
89
|
}, 10);
|
|
92
90
|
}, [isOpen, scrollOnOpen]);
|
|
93
91
|
|
|
@@ -547,6 +547,7 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
547
547
|
);
|
|
548
548
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
549
549
|
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
550
|
+
const paxSelectorRef = useRef<HTMLDivElement>(null);
|
|
550
551
|
const hasInitialized = useRef(false);
|
|
551
552
|
const lastRoomRef = useRef<HTMLDivElement>(null);
|
|
552
553
|
const agesSectionRef = useRef<HTMLDivElement>(null);
|
|
@@ -702,8 +703,6 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
702
703
|
document.addEventListener('mousedown', handleClickOutside);
|
|
703
704
|
}
|
|
704
705
|
|
|
705
|
-
onPaxOpenChange?.();
|
|
706
|
-
|
|
707
706
|
return () => {
|
|
708
707
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
709
708
|
};
|
|
@@ -711,7 +710,10 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
711
710
|
|
|
712
711
|
// Scroll to input when dropdown opens (if scrollOnOpen is true)
|
|
713
712
|
useEffect(() => {
|
|
714
|
-
|
|
713
|
+
setTimeout(() => {
|
|
714
|
+
scrollIntoViewOnOpen(paxSelectorRef, isOpen, scrollOnOpen);
|
|
715
|
+
}, 10);
|
|
716
|
+
onPaxOpenChange?.();
|
|
715
717
|
}, [isOpen, scrollOnOpen]);
|
|
716
718
|
|
|
717
719
|
// Scroll to age section when new age inputs are added (single room mode)
|
|
@@ -877,7 +879,7 @@ const PaxSelector: React.FC<PaxSelectorProps> = ({
|
|
|
877
879
|
</button>
|
|
878
880
|
|
|
879
881
|
{isOpen && (
|
|
880
|
-
<div className="pax-selector__dropdown">
|
|
882
|
+
<div className="pax-selector__dropdown" ref={paxSelectorRef}>
|
|
881
883
|
{/* Multiple Rooms Mode */}
|
|
882
884
|
{multipleRooms ? (
|
|
883
885
|
<>
|