mautourco-components 0.2.7 → 0.2.9
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/atoms/Icon/Icon.d.ts +1 -0
- package/dist/components/atoms/Icon/Icon.js +3 -4
- package/dist/components/atoms/Icon/icons/Chevron.d.ts +2 -0
- package/dist/components/atoms/Icon/icons/Chevron.js +10 -10
- package/dist/components/atoms/Typography/Typography.d.ts +2 -0
- package/dist/components/atoms/Typography/Typography.js +13 -4
- package/dist/components/molecules/RatingTab/RatingTab.js +1 -1
- package/dist/components/molecules/ServiceSelector/ServiceSelector.d.ts +22 -0
- package/dist/components/molecules/ServiceSelector/ServiceSelector.js +85 -0
- package/dist/components/molecules/ServiceSelector/index.d.ts +2 -0
- package/dist/components/molecules/ServiceSelector/index.js +1 -0
- package/dist/components/organisms/PaxSelector/PaxSelector.js +3 -3
- package/dist/components/organisms/SearchBarTransfer/SearchBarTransfer.js +2 -2
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/styles/components/molecule/service-selector.css +2310 -0
- package/dist/styles/components/organism/pax-selector.css +3 -15
- package/dist/styles/components/organism/search-bar-transfer.css +4 -10
- package/dist/styles/components/rating-tab.css +1 -3
- package/package.json +1 -1
- package/src/components/atoms/Icon/Icon.tsx +4 -3
- package/src/components/atoms/Icon/icons/Chevron.tsx +30 -11
- package/src/components/atoms/Typography/Typography.tsx +29 -2
- package/src/components/molecules/RatingTab/RatingTab.tsx +1 -1
- package/src/components/molecules/ServiceSelector/ServiceSelector.tsx +179 -0
- package/src/components/molecules/ServiceSelector/index.ts +3 -0
- package/src/components/organisms/PaxSelector/PaxSelector.tsx +4 -4
- package/src/components/organisms/SearchBarTransfer/SearchBarTransfer.tsx +3 -3
- package/src/styles/components/molecule/service-selector.css +228 -0
- package/src/styles/components/organism/pax-selector.css +3 -15
- package/src/styles/components/organism/search-bar-transfer.css +4 -10
- package/src/styles/components/rating-tab.css +1 -3
- package/src/components/atoms/Icon/icons/ChevronDownIcon.tsx +0 -46
|
@@ -25,7 +25,6 @@ import EyeIcon from "./icons/EyeIcon";
|
|
|
25
25
|
import InfoIcon from "./icons/InfoIcon";
|
|
26
26
|
import CheckCircleIcon from "./icons/CheckCircleIcon";
|
|
27
27
|
import StrollerIcon from "./icons/StrollerIcon";
|
|
28
|
-
import ChevronDownIcon from "./icons/ChevronDownIcon";
|
|
29
28
|
import CarIcon from "./icons/CarIcon";
|
|
30
29
|
import MoreIcon from "./icons/MoreIcon";
|
|
31
30
|
import Settings from "./icons/Settings";
|
|
@@ -43,8 +42,8 @@ import PlaneIcon from "./icons/PlaneIcon";
|
|
|
43
42
|
import ShipIcon from "./icons/ShipIcon";
|
|
44
43
|
import BuildingIcon from "./icons/BuildingIcon";
|
|
45
44
|
var Icon = function (_a) {
|
|
46
|
-
var name = _a.name, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.className, className = _c === void 0 ? "" : _c, color = _a.color;
|
|
47
|
-
var iconProps = { size: size, className: className, color: color };
|
|
45
|
+
var name = _a.name, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.className, className = _c === void 0 ? "" : _c, color = _a.color, style = _a.style;
|
|
46
|
+
var iconProps = { size: size, className: className, color: color, style: style };
|
|
48
47
|
switch (name) {
|
|
49
48
|
case "chevron-down":
|
|
50
49
|
return _jsx(Chevron, __assign({ direction: "down" }, iconProps));
|
|
@@ -85,7 +84,7 @@ var Icon = function (_a) {
|
|
|
85
84
|
case "stroller":
|
|
86
85
|
return _jsx(StrollerIcon, __assign({}, iconProps));
|
|
87
86
|
case "chevron-down-new":
|
|
88
|
-
return _jsx(
|
|
87
|
+
return _jsx(Chevron, __assign({ direction: "down", variant: "filled" }, iconProps));
|
|
89
88
|
case "car":
|
|
90
89
|
return _jsx(CarIcon, __assign({}, iconProps));
|
|
91
90
|
case "more":
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface ChevronProps {
|
|
3
3
|
direction?: 'up' | 'down' | 'left' | 'right';
|
|
4
|
+
variant?: 'outline' | 'filled';
|
|
4
5
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
6
|
className?: string;
|
|
6
7
|
color?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
7
9
|
}
|
|
8
10
|
declare const Chevron: React.FC<ChevronProps>;
|
|
9
11
|
export default Chevron;
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
var Chevron = function (_a) {
|
|
14
|
-
var _b = _a.direction, direction = _b === void 0 ? 'down' : _b, _c = _a.
|
|
14
|
+
var _b = _a.direction, direction = _b === void 0 ? 'down' : _b, _c = _a.variant, variant = _c === void 0 ? 'outline' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.className, className = _e === void 0 ? '' : _e, color = _a.color, style = _a.style;
|
|
15
15
|
var getSizeClasses = function () {
|
|
16
16
|
switch (size) {
|
|
17
17
|
case 'xs': return 'w-3 h-3';
|
|
@@ -22,14 +22,13 @@ var Chevron = function (_a) {
|
|
|
22
22
|
default: return 'w-5 h-5';
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
case 'left': return { transform: 'rotate(360deg)' };
|
|
30
|
-
case 'right': return { transform: 'rotate(360deg)' };
|
|
31
|
-
default: return { transform: 'rotate(0deg)' };
|
|
25
|
+
var getRotationStyle = function () {
|
|
26
|
+
if (variant === 'filled') {
|
|
27
|
+
var rotations = { up: 180, down: 0, left: 90, right: -90 };
|
|
28
|
+
return { transform: "rotate(".concat(rotations[direction] || 0, "deg)") };
|
|
32
29
|
}
|
|
30
|
+
// Outline variant doesn't need rotation (paths handle direction)
|
|
31
|
+
return { transform: 'rotate(0deg)' };
|
|
33
32
|
};
|
|
34
33
|
var getPath = function () {
|
|
35
34
|
switch (direction) {
|
|
@@ -46,9 +45,10 @@ var Chevron = function (_a) {
|
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
47
|
var sizeClasses = getSizeClasses();
|
|
49
|
-
var directionStyle = getDirectionStyle();
|
|
50
48
|
var colorClass = color ? "text-".concat(color) : 'text-current';
|
|
51
49
|
var classes = "".concat(sizeClasses, " ").concat(colorClass, " ").concat(className);
|
|
52
|
-
|
|
50
|
+
var rotationStyle = getRotationStyle();
|
|
51
|
+
var combinedStyle = style ? __assign(__assign({}, rotationStyle), style) : rotationStyle;
|
|
52
|
+
return variant === 'filled' ? (_jsx("svg", __assign({ className: classes, style: combinedStyle, viewBox: "0 0 15 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M12.4707 0.571533H2.07621C0.87817 0.571533 0.163582 1.90675 0.828137 2.90358L6.02536 10.6994C6.6191 11.59 7.92778 11.59 8.52151 10.6994L13.7187 2.90358C14.3833 1.90675 13.6687 0.571533 12.4707 0.571533Z", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.14286" }) }))) : (_jsx("svg", __assign({ className: classes, style: combinedStyle, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, { children: getPath() })));
|
|
53
53
|
};
|
|
54
54
|
export default Chevron;
|
|
@@ -4,9 +4,11 @@ type BodySizeInput = BodyTokenSize | 'base' | 'xl';
|
|
|
4
4
|
type Variant = 'light' | 'regular' | 'medium' | 'bold' | 'black';
|
|
5
5
|
type Leading = 'none' | '4' | '5' | '6' | '7';
|
|
6
6
|
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
type TextColor = 'default' | 'accent' | 'subtle' | 'light' | 'brand' | 'inverted' | 'state-default' | 'state-hover' | 'state-filled' | 'state-disabled' | 'state-error' | 'state-success';
|
|
7
8
|
interface BaseProps {
|
|
8
9
|
variant?: Variant;
|
|
9
10
|
leading?: Leading;
|
|
11
|
+
color?: TextColor;
|
|
10
12
|
className?: string;
|
|
11
13
|
children: React.ReactNode;
|
|
12
14
|
onClick?: React.MouseEventHandler<Element>;
|
|
@@ -66,9 +66,16 @@ var buildVariantClass = function (base, variant) {
|
|
|
66
66
|
return undefined;
|
|
67
67
|
return "".concat(base, "--").concat(variant);
|
|
68
68
|
};
|
|
69
|
+
var getColorStyle = function (color) {
|
|
70
|
+
if (!color)
|
|
71
|
+
return {};
|
|
72
|
+
return {
|
|
73
|
+
color: "var(--color-text-".concat(color, ", inherit)"),
|
|
74
|
+
};
|
|
75
|
+
};
|
|
69
76
|
export var Heading = function (_a) {
|
|
70
77
|
var _b;
|
|
71
|
-
var _c = _a.level, level = _c === void 0 ? 2 : _c, _d = _a.variant, variant = _d === void 0 ? 'bold' : _d, leading = _a.leading, as = _a.as, _e = _a.className, className = _e === void 0 ? '' : _e, children = _a.children, onClick = _a.onClick;
|
|
78
|
+
var _c = _a.level, level = _c === void 0 ? 2 : _c, _d = _a.variant, variant = _d === void 0 ? 'bold' : _d, leading = _a.leading, color = _a.color, as = _a.as, _e = _a.className, className = _e === void 0 ? '' : _e, children = _a.children, onClick = _a.onClick;
|
|
72
79
|
var Tag = as || "h".concat(level);
|
|
73
80
|
var baseClass = (_b = headingTokenClass[level]) !== null && _b !== void 0 ? _b : headingTokenClass[2];
|
|
74
81
|
var variantClass = buildVariantClass(baseClass, variant);
|
|
@@ -80,10 +87,11 @@ export var Heading = function (_a) {
|
|
|
80
87
|
]
|
|
81
88
|
.filter(Boolean)
|
|
82
89
|
.join(' ');
|
|
83
|
-
|
|
90
|
+
var colorStyle = getColorStyle(color);
|
|
91
|
+
return (_jsx(Tag, __assign({ className: classes, style: colorStyle, onClick: onClick }, { children: children })));
|
|
84
92
|
};
|
|
85
93
|
export var Text = function (_a) {
|
|
86
|
-
var _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.variant, variant = _c === void 0 ? 'regular' : _c, leading = _a.leading, as = _a.as, _d = _a.className, className = _d === void 0 ? '' : _d, children = _a.children, onClick = _a.onClick;
|
|
94
|
+
var _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.variant, variant = _c === void 0 ? 'regular' : _c, leading = _a.leading, color = _a.color, as = _a.as, _d = _a.className, className = _d === void 0 ? '' : _d, children = _a.children, onClick = _a.onClick;
|
|
87
95
|
var Tag = as || 'p';
|
|
88
96
|
var normalizedSize = bodySizeAlias[size];
|
|
89
97
|
var _e = getBodyClass(normalizedSize, leading), baseClass = _e.className, lineHeightHandled = _e.lineHeightHandled;
|
|
@@ -96,5 +104,6 @@ export var Text = function (_a) {
|
|
|
96
104
|
]
|
|
97
105
|
.filter(Boolean)
|
|
98
106
|
.join(' ');
|
|
99
|
-
|
|
107
|
+
var colorStyle = getColorStyle(color);
|
|
108
|
+
return (_jsx(Tag, __assign({ className: classes, style: colorStyle, onClick: onClick }, { children: children })));
|
|
100
109
|
};
|
|
@@ -36,6 +36,6 @@ var RatingTab = function (_a) {
|
|
|
36
36
|
};
|
|
37
37
|
var stateClass = disabled ? 'rating-tab--disabled' : checked ? 'rating-tab--active' : 'rating-tab--default';
|
|
38
38
|
var containerClasses = ['rating-tab', stateClass, className].filter(Boolean).join(' ');
|
|
39
|
-
return (_jsxs("div", __assign({ className: containerClasses, role: "checkbox", "aria-checked": checked, "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, onClick: handleToggle, onKeyDown: handleKeyDown }, { children: [_jsxs("div", __assign({ className: "rating-tab__left" }, { children: [_jsx("div", __assign({ className: "rating-tab__checkbox" }, { children: checked && _jsx(Check, { size: "sm", className: "rating-tab__checkbox-icon" }) })), _jsx(Text, __assign({ size: "sm", className: "rating-tab__label" }, { children: label }))] })), _jsx(RatingStar, { value: ratingValue, max: maxStars })] })));
|
|
39
|
+
return (_jsxs("div", __assign({ className: containerClasses, role: "checkbox", "aria-checked": checked, "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, onClick: handleToggle, onKeyDown: handleKeyDown }, { children: [_jsxs("div", __assign({ className: "rating-tab__left" }, { children: [_jsx("div", __assign({ className: "rating-tab__checkbox" }, { children: checked && _jsx(Check, { size: "sm", className: "rating-tab__checkbox-icon" }) })), _jsx(Text, __assign({ size: "sm", color: "default", className: "rating-tab__label" }, { children: label }))] })), _jsx(RatingStar, { value: ratingValue, max: maxStars })] })));
|
|
40
40
|
};
|
|
41
41
|
export default RatingTab;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../../styles/components/molecule/service-selector.css';
|
|
3
|
+
export type ServiceType = 'transfer' | 'accommodation' | 'excursion';
|
|
4
|
+
export interface ServiceOption {
|
|
5
|
+
value: ServiceType;
|
|
6
|
+
label: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
badge?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ServiceSelectorProps {
|
|
12
|
+
/** Selected service */
|
|
13
|
+
value?: ServiceType;
|
|
14
|
+
/** Change handler */
|
|
15
|
+
onChange: (value: ServiceType) => void;
|
|
16
|
+
/** Disabled state */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Additional CSS classes */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const ServiceSelector: React.FC<ServiceSelectorProps>;
|
|
22
|
+
export default ServiceSelector;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState, useRef, useEffect } from 'react';
|
|
14
|
+
import Icon from '../../atoms/Icon/Icon';
|
|
15
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
16
|
+
import '../../../styles/components/molecule/service-selector.css';
|
|
17
|
+
var DEFAULT_OPTIONS = [
|
|
18
|
+
{
|
|
19
|
+
value: 'accommodation',
|
|
20
|
+
label: 'Accommodation',
|
|
21
|
+
icon: 'building',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 'transfer',
|
|
25
|
+
label: 'Transfer',
|
|
26
|
+
icon: 'car',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: 'excursion',
|
|
30
|
+
label: 'Excursion',
|
|
31
|
+
icon: 'map-pin',
|
|
32
|
+
disabled: true,
|
|
33
|
+
badge: 'Coming soon',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
var ServiceSelector = function (_a) {
|
|
37
|
+
var value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
|
|
38
|
+
var _d = useState(false), isOpen = _d[0], setIsOpen = _d[1];
|
|
39
|
+
var dropdownRef = useRef(null);
|
|
40
|
+
// Close dropdown when clicking outside
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
var handleClickOutside = function (event) {
|
|
43
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
44
|
+
setIsOpen(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
48
|
+
return function () {
|
|
49
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
var handleToggleDropdown = function () {
|
|
53
|
+
if (!disabled) {
|
|
54
|
+
setIsOpen(!isOpen);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var handleOptionSelect = function (option) {
|
|
58
|
+
if (disabled || option.disabled)
|
|
59
|
+
return;
|
|
60
|
+
onChange(option.value);
|
|
61
|
+
setIsOpen(false);
|
|
62
|
+
};
|
|
63
|
+
var getDropdownState = function () {
|
|
64
|
+
if (disabled)
|
|
65
|
+
return 'disabled';
|
|
66
|
+
// If a service is selected, always show selected state (even if open)
|
|
67
|
+
if (value)
|
|
68
|
+
return 'selected';
|
|
69
|
+
if (isOpen)
|
|
70
|
+
return 'open';
|
|
71
|
+
return 'default';
|
|
72
|
+
};
|
|
73
|
+
var selectedOption = value ? DEFAULT_OPTIONS.find(function (opt) { return opt.value === value; }) : null;
|
|
74
|
+
var displayText = selectedOption ? selectedOption.label : 'Select a service';
|
|
75
|
+
return (_jsxs("div", __assign({ ref: dropdownRef, className: "service-selector ".concat(className) }, { children: [_jsxs("button", __assign({ type: "button", className: "service-selector__trigger service-selector__trigger--".concat(getDropdownState()), onClick: handleToggleDropdown, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "listbox" }, { children: [_jsxs("div", __assign({ className: "service-selector__trigger-content" }, { children: [selectedOption && (_jsx(Icon, { name: selectedOption.icon, size: "md", className: "service-selector__trigger-icon" })), _jsx(Text, __assign({ size: "base", variant: "bold", className: "service-selector__trigger-text" }, { children: displayText }))] })), _jsx(Icon, { name: "chevron-down-new", size: "sm", className: "service-selector__trigger-chevron", style: {
|
|
76
|
+
transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
77
|
+
transition: 'transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
78
|
+
transformOrigin: 'center'
|
|
79
|
+
} })] })), isOpen && (_jsx("div", __assign({ className: "service-selector__panel", role: "listbox" }, { children: _jsx("div", __assign({ className: "service-selector__content" }, { children: _jsx("div", __assign({ className: "service-selector__options-wrapper" }, { children: DEFAULT_OPTIONS.map(function (option) {
|
|
80
|
+
var isSelected = value === option.value;
|
|
81
|
+
var isDisabled = option.disabled || disabled;
|
|
82
|
+
return (_jsxs("button", __assign({ type: "button", className: "service-selector__option ".concat(isSelected ? 'service-selector__option--selected' : '', " ").concat(isDisabled ? 'service-selector__option--disabled' : ''), onClick: function () { return handleOptionSelect(option); }, disabled: isDisabled, role: "option", "aria-selected": isSelected }, { children: [_jsx(Icon, { name: option.icon, size: "md", className: "service-selector__option-icon ".concat(isSelected ? 'service-selector__option-icon--selected' : '') }), _jsx(Text, __assign({ size: "base", variant: "bold", color: isSelected ? 'inverted' : 'default', className: "service-selector__option-text" }, { children: option.label })), option.badge && (_jsx("span", __assign({ className: "service-selector__option-badge" }, { children: option.badge })))] }), option.value));
|
|
83
|
+
}) })) })) })))] })));
|
|
84
|
+
};
|
|
85
|
+
export default ServiceSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ServiceSelector';
|
|
@@ -149,7 +149,7 @@ var StepperRow = function (_a) {
|
|
|
149
149
|
onChange(value + 1);
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
-
return (_jsxs("div", __assign({ className: "pax-selector__stepper" }, { children: [_jsx(Text, __assign({ size: "base", variant: "bold", className: "pax-selector__stepper-label" }, { children: label })), _jsxs("div", __assign({ className: "pax-selector__stepper-controls" }, { children: [_jsx("button", __assign({ type: "button", className: "pax-selector__stepper-btn", onClick: handleDecrement, disabled: value <= min, "aria-label": "Decrease ".concat(label) }, { children: _jsx(Icon, { name: "minus", size: "sm" }) })), _jsx("span", __assign({ className: "pax-selector__stepper-count" }, { children: value })), _jsx("button", __assign({ type: "button", className: "pax-selector__stepper-btn", onClick: handleIncrement, disabled: value >= max, "aria-label": "Increase ".concat(label) }, { children: _jsx(Icon, { name: "plus", size: "sm" }) }))] }))] })));
|
|
152
|
+
return (_jsxs("div", __assign({ className: "pax-selector__stepper" }, { children: [_jsx(Text, __assign({ size: "base", variant: "bold", color: "default", className: "pax-selector__stepper-label" }, { children: label })), _jsxs("div", __assign({ className: "pax-selector__stepper-controls" }, { children: [_jsx("button", __assign({ type: "button", className: "pax-selector__stepper-btn", onClick: handleDecrement, disabled: value <= min, "aria-label": "Decrease ".concat(label) }, { children: _jsx(Icon, { name: "minus", size: "sm" }) })), _jsx("span", __assign({ className: "pax-selector__stepper-count" }, { children: value })), _jsx("button", __assign({ type: "button", className: "pax-selector__stepper-btn", onClick: handleIncrement, disabled: value >= max, "aria-label": "Increase ".concat(label) }, { children: _jsx(Icon, { name: "plus", size: "sm" }) }))] }))] })));
|
|
153
153
|
};
|
|
154
154
|
var ClientTypeSelector = function (_a) {
|
|
155
155
|
var value = _a.value, onChange = _a.onChange;
|
|
@@ -223,7 +223,7 @@ var RoomEditor = function (_a) {
|
|
|
223
223
|
var teenAgeChunks = chunkAges(room.teenAges || [], 'Teen');
|
|
224
224
|
var childAgeChunks = chunkAges(room.childAges || [], 'Child');
|
|
225
225
|
var infantAgeChunks = chunkAges(room.infantAges || [], 'Infant');
|
|
226
|
-
return (_jsxs("div", __assign({ className: "pax-selector__room-container" }, { children: [_jsxs("div", __assign({ className: "pax-selector__room-header" }, { children: [_jsxs("div", __assign({ className: "pax-selector__room-title" }, { children: [_jsxs(Text, __assign({ size: "lg", variant: "bold", className: "pax-selector__room-name" }, { children: ["Room ", roomNumber] })), _jsx(Icon, { name: "home", size: "md", className: "pax-selector__room-icon" })] })), showRemove && (_jsxs("button", __assign({ type: "button", className: "pax-selector__room-remove", onClick: onRemove, "aria-label": "Remove room ".concat(roomNumber) }, { children: [_jsx(Icon, { name: "close", size: "sm", className: "pax-selector__room-remove-icon" }), _jsx("span", __assign({ className: "pax-selector__room-remove-text" }, { children: "Remove" }))] })))] })), _jsxs("div", __assign({ className: "pax-selector__room-content" }, { children: [_jsxs("div", __assign({ className: "pax-selector__steppers" }, { children: [_jsx(StepperRow, { label: "Adult", value: room.adults, max: maxAdults, onChange: function (val) { return handleFieldChange('adults', val); } }), _jsx(StepperRow, { label: "Teen", value: room.teens, max: maxTeens, onChange: function (val) { return handleFieldChange('teens', val); } }), _jsx(StepperRow, { label: "Child", value: room.children, max: maxChildren, onChange: function (val) { return handleFieldChange('children', val); } }), _jsx(StepperRow, { label: "Infant", value: room.infants, max: maxInfants, onChange: function (val) { return handleFieldChange('infants', val); } })] })), ((room.teens > 0) || (room.children > 0) || (room.infants > 0)) && (_jsxs("div", __assign({ className: "pax-selector__age-section" }, { children: [_jsx(Text, __assign({ size: "base", variant: "bold", className: "pax-selector__age-section-title" }, { children: "Please specify the age :" })), _jsxs("div", __assign({ className: "pax-selector__age-groups" }, { children: [room.teens > 0 && teenAgeChunks.map(function (chunk, chunkIndex) { return (_jsx("div", __assign({ className: "pax-selector__age-row" }, { children: chunk.map(function (age, ageIndex) {
|
|
226
|
+
return (_jsxs("div", __assign({ className: "pax-selector__room-container" }, { children: [_jsxs("div", __assign({ className: "pax-selector__room-header" }, { children: [_jsxs("div", __assign({ className: "pax-selector__room-title" }, { children: [_jsxs(Text, __assign({ size: "lg", variant: "bold", color: "accent", className: "pax-selector__room-name" }, { children: ["Room ", roomNumber] })), _jsx(Icon, { name: "home", size: "md", className: "pax-selector__room-icon" })] })), showRemove && (_jsxs("button", __assign({ type: "button", className: "pax-selector__room-remove", onClick: onRemove, "aria-label": "Remove room ".concat(roomNumber) }, { children: [_jsx(Icon, { name: "close", size: "sm", className: "pax-selector__room-remove-icon" }), _jsx("span", __assign({ className: "pax-selector__room-remove-text" }, { children: "Remove" }))] })))] })), _jsxs("div", __assign({ className: "pax-selector__room-content" }, { children: [_jsxs("div", __assign({ className: "pax-selector__steppers" }, { children: [_jsx(StepperRow, { label: "Adult", value: room.adults, max: maxAdults, onChange: function (val) { return handleFieldChange('adults', val); } }), _jsx(StepperRow, { label: "Teen", value: room.teens, max: maxTeens, onChange: function (val) { return handleFieldChange('teens', val); } }), _jsx(StepperRow, { label: "Child", value: room.children, max: maxChildren, onChange: function (val) { return handleFieldChange('children', val); } }), _jsx(StepperRow, { label: "Infant", value: room.infants, max: maxInfants, onChange: function (val) { return handleFieldChange('infants', val); } })] })), ((room.teens > 0) || (room.children > 0) || (room.infants > 0)) && (_jsxs("div", __assign({ className: "pax-selector__age-section" }, { children: [_jsx(Text, __assign({ size: "base", variant: "bold", color: "default", className: "pax-selector__age-section-title" }, { children: "Please specify the age :" })), _jsxs("div", __assign({ className: "pax-selector__age-groups" }, { children: [room.teens > 0 && teenAgeChunks.map(function (chunk, chunkIndex) { return (_jsx("div", __assign({ className: "pax-selector__age-row" }, { children: chunk.map(function (age, ageIndex) {
|
|
227
227
|
var actualIndex = chunkIndex * 2 + ageIndex;
|
|
228
228
|
return (_jsx(AgeSelector, { label: "Teen", value: age, onChange: function (selectedAge) { return handleAgeChange('teenAges', actualIndex, selectedAge); }, ageRange: CHILD_CATEGORY_AGES, required: true }, "teen-".concat(actualIndex)));
|
|
229
229
|
}) }), "teen-chunk-".concat(chunkIndex))); }), room.children > 0 && childAgeChunks.map(function (chunk, chunkIndex) { return (_jsx("div", __assign({ className: "pax-selector__age-row" }, { children: chunk.map(function (age, ageIndex) {
|
|
@@ -371,7 +371,7 @@ var PaxSelector = function (_a) {
|
|
|
371
371
|
var hasPax = getTotalPax() > 0;
|
|
372
372
|
return (_jsxs("div", __assign({ className: "pax-selector ".concat(className), ref: containerRef }, { children: [_jsxs("button", __assign({ type: "button", className: "pax-selector__trigger", onClick: function () { return setIsOpen(!isOpen); }, "aria-expanded": isOpen, "aria-haspopup": "true" }, { children: [_jsx(Text, __assign({ size: "sm", variant: "regular", className: "pax-selector__label" }, { children: label })), _jsxs("div", __assign({ className: "pax-selector__input ".concat(isOpen ? 'pax-selector__input--active' : '') }, { children: [_jsxs("div", __assign({ className: "pax-selector__input-content" }, { children: [_jsx(Icon, { name: "user-icon", size: "sm", className: "pax-selector__input-icon" }), _jsx("span", __assign({ 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", __assign({ className: "pax-selector__dropdown" }, { children: [multipleRooms ? (_jsxs(_Fragment, { children: [showAddRoom && (_jsxs("button", __assign({ 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", __assign({ 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); } }, room.roomId)); }) }))] })) : (
|
|
373
373
|
/* Single Room Mode */
|
|
374
|
-
_jsxs(_Fragment, { children: [_jsxs("div", __assign({ 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) || (internalData.children > 0) || (internalData.infants > 0)) && (_jsxs("div", __assign({ className: "pax-selector__age-section" }, { children: [_jsx(Text, __assign({ size: "base", variant: "bold", className: "pax-selector__age-section-title" }, { children: "Please specify the age :" })), _jsx("div", __assign({ className: "pax-selector__age-groups" }, { children: (function () {
|
|
374
|
+
_jsxs(_Fragment, { children: [_jsxs("div", __assign({ 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) || (internalData.children > 0) || (internalData.infants > 0)) && (_jsxs("div", __assign({ className: "pax-selector__age-section" }, { children: [_jsx(Text, __assign({ size: "base", variant: "bold", color: "default", className: "pax-selector__age-section-title" }, { children: "Please specify the age :" })), _jsx("div", __assign({ className: "pax-selector__age-groups" }, { children: (function () {
|
|
375
375
|
var chunkAges = function (ages, category) {
|
|
376
376
|
var chunks = [];
|
|
377
377
|
for (var i = 0; i < ages.length; i += 2) {
|
|
@@ -164,7 +164,7 @@ var SearchBarTransfer = function (_a) {
|
|
|
164
164
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(data);
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
return (_jsxs("div", __assign({ className: "search-bar-transfer ".concat(className) }, { children: [_jsxs("div", __assign({ className: "search-bar-transfer__header" }, { children: [_jsx(Heading, __assign({ level: 5, variant: "bold",
|
|
167
|
+
return (_jsxs("div", __assign({ className: "search-bar-transfer ".concat(className) }, { children: [_jsxs("div", __assign({ className: "search-bar-transfer__header" }, { children: [_jsx(Heading, __assign({ level: 5, variant: "bold", color: "accent" }, { children: "Select your transfer details" })), _jsx("div", __assign({ className: "search-bar-transfer__mode-selector" }, { children: _jsx(SegmentedButton, { options: modeOptions, value: mode, onChange: handleModeChange, name: "transfer-mode" }) }))] })), mode === "roundtrip" ? (_jsx(RoundTrip, { id: "roundtrip-main", locations: locations, paxData: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.paxData, arrivalDate: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.arrivalDate, departureDate: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.departureDate, pickupDropoffPoint: (_b = roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.pickupDropoffPoint) === null || _b === void 0 ? void 0 : _b.id, accommodation: (_c = roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.accommodation) === null || _c === void 0 ? void 0 : _c.id, onChange: setRoundTripData })) : (_jsxs(_Fragment, { children: [_jsxs("div", __assign({ className: "search-bar-transfer__transfer-type" }, { children: [_jsx(Text, __assign({ size: "lg", variant: "bold", color: "subtle", as: "div", className: "search-bar-transfer__transfer-type-label" }, { children: "Select a transfer type you want to add" })), _jsxs("div", __assign({ className: "search-bar-transfer__add-buttons" }, { children: [_jsx(Button, __assign({ variant: "outline-secondary", size: "sm", leadingIcon: "plus", onClick: function () { return handleAddTransfer("arrival"); } }, { children: "Add Arrival" })), _jsx(Button, __assign({ variant: "outline-secondary", size: "sm", leadingIcon: "plus", onClick: function () { return handleAddTransfer("departure"); } }, { children: "Add Departure" })), _jsx(Button, __assign({ variant: "outline-secondary", size: "sm", leadingIcon: "plus", onClick: function () { return handleAddTransfer("inter-hotel"); } }, { children: "Add Inter-Hotel" }))] }))] })), transferLines.length > 0 && (_jsx("div", __assign({ className: "search-bar-transfer__transfer-lines" }, { children: (function () {
|
|
168
168
|
// Group transfers by type
|
|
169
169
|
var groupedTransfers = {
|
|
170
170
|
arrival: [],
|
|
@@ -183,7 +183,7 @@ var SearchBarTransfer = function (_a) {
|
|
|
183
183
|
departure: { label: "Departure", icon: "departure" },
|
|
184
184
|
"inter-hotel": { label: "Inter-Hotel", icon: "building" },
|
|
185
185
|
};
|
|
186
|
-
return nonEmptyGroups.map(function (type, groupIndex) { return (_jsxs(React.Fragment, { children: [_jsxs("div", __assign({ className: "search-bar-transfer__category-header" }, { children: [_jsx(Icon, { name: categoryInfo[type].icon, size: "md" }), _jsx(Text, __assign({ size: "md", variant: "bold", as: "span" }, { children: categoryInfo[type].label }))] })), groupedTransfers[type].map(function (line) {
|
|
186
|
+
return nonEmptyGroups.map(function (type, groupIndex) { return (_jsxs(React.Fragment, { children: [_jsxs("div", __assign({ className: "search-bar-transfer__category-header" }, { children: [_jsx(Icon, { name: categoryInfo[type].icon, size: "md" }), _jsx(Text, __assign({ size: "md", variant: "bold", color: "default", as: "span" }, { children: categoryInfo[type].label }))] })), groupedTransfers[type].map(function (line) {
|
|
187
187
|
var _a, _b;
|
|
188
188
|
return (_jsx(TransferLine, { id: line.id, type: line.type, paxData: line.paxData, transferDate: line.transferDate, pickupPoint: (_a = line.pickupPoint) === null || _a === void 0 ? void 0 : _a.id, dropoffPoint: (_b = line.dropoffPoint) === null || _b === void 0 ? void 0 : _b.id, locations: locations, onDataChange: function (data) { return handleTransferLineChange(line.id, data); }, onDelete: function () { return handleDeleteTransferLine(line.id); }, showDelete: transferLines.length > 1 }, line.id));
|
|
189
189
|
}), groupIndex < nonEmptyGroups.length - 1 && (_jsx("svg", __assign({ className: "search-bar-transfer__divider", xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "1", viewBox: "0 0 1076 1", fill: "none", preserveAspectRatio: "none" }, { children: _jsx("path", { d: "M0 0.5L1076 0.499906", stroke: "var(--color-border-medium, #A3A3A3)", strokeWidth: "1", strokeDasharray: "10 10" }) })))] }, type)); });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "
|
|
4
|
+
variant?: "link" | "outline" | "default" | "secondary" | "destructive" | "ghost" | null | undefined;
|
|
5
5
|
size?: "sm" | "lg" | "default" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { default as CalendarInput } from './components/molecules/Calendar/Calend
|
|
|
16
16
|
export { default as TimePicker } from './components/molecules/Calendar/TimePicker';
|
|
17
17
|
export { default as RatingTab } from './components/molecules/RatingTab/RatingTab';
|
|
18
18
|
export { default as LocationDropdown } from './components/molecules/LocationDropdown/LocationDropdown';
|
|
19
|
+
export { default as ServiceSelector } from './components/molecules/ServiceSelector/ServiceSelector';
|
|
19
20
|
export { TopNavigation } from './components/organisms/TopNavigation/TopNavigation';
|
|
20
21
|
export { Footer } from './components/organisms/Footer/Footer';
|
|
21
22
|
export { Dialog } from './components/organisms/Dialog/Dialog';
|
|
@@ -43,6 +44,7 @@ export type { DialogProps, DialogSize } from './components/organisms/Dialog/Dial
|
|
|
43
44
|
export type { CardContainerProps, CardContainerSpacing } from './components/organisms/CardContainer/CardContainer';
|
|
44
45
|
export type { PaxSelectorProps, PaxData, ClientType } from './components/organisms/PaxSelector/PaxSelector';
|
|
45
46
|
export type { LocationDropdownProps, LocationOption, LocationGroup, LocationData } from './components/molecules/LocationDropdown/LocationDropdown';
|
|
47
|
+
export type { ServiceSelectorProps, ServiceType, ServiceOption } from './components/molecules/ServiceSelector/ServiceSelector';
|
|
46
48
|
export type { DateTimePickerProps } from './components/organisms/DateTimePicker/DateTimePicker';
|
|
47
49
|
export type { RoundTripProps, RoundTripData, RoundTripTransfer } from './components/organisms/RoundTrip/RoundTrip';
|
|
48
50
|
export type { TransferLineProps, TransferLineData, TransferType } from './components/organisms/TransferLine/TransferLine';
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { default as CalendarInput } from './components/molecules/Calendar/Calend
|
|
|
18
18
|
export { default as TimePicker } from './components/molecules/Calendar/TimePicker';
|
|
19
19
|
export { default as RatingTab } from './components/molecules/RatingTab/RatingTab';
|
|
20
20
|
export { default as LocationDropdown } from './components/molecules/LocationDropdown/LocationDropdown';
|
|
21
|
+
export { default as ServiceSelector } from './components/molecules/ServiceSelector/ServiceSelector';
|
|
21
22
|
// Organisms - Complex components
|
|
22
23
|
export { TopNavigation } from './components/organisms/TopNavigation/TopNavigation';
|
|
23
24
|
export { Footer } from './components/organisms/Footer/Footer';
|