mautourco-components 0.2.87 → 0.2.89
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/ServiceSelector/ServiceSelector.d.ts +3 -2
- package/dist/components/molecules/ServiceSelector/ServiceSelector.js +6 -6
- package/dist/components/organisms/Booking/index.d.ts +1 -1
- package/dist/styles/components/organism/pax-selector.css +2 -1
- package/package.json +1 -1
- package/src/components/molecules/ServiceSelector/ServiceSelector.tsx +8 -5
- package/src/components/organisms/Booking/index.ts +5 -1
- package/src/styles/components/organism/pax-selector.css +2 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import '../../../styles/components/molecule/service-selector.css';
|
|
3
2
|
export type ServiceType = 'transfer' | 'accommodation' | 'excursion';
|
|
4
3
|
export interface ServiceOption {
|
|
@@ -19,7 +18,9 @@ export interface ServiceSelectorProps {
|
|
|
19
18
|
className?: string;
|
|
20
19
|
/** Options to display */
|
|
21
20
|
options?: ServiceOption[];
|
|
21
|
+
/** Whether to use the default background color */
|
|
22
|
+
useDefaultBackground?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export declare const DEFAULT_SERVICE_SELECTOR_OPTIONS: ServiceOption[];
|
|
24
|
-
declare
|
|
25
|
+
declare function ServiceSelector({ value, onChange, disabled, options, useDefaultBackground, className, }: ServiceSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export default ServiceSelector;
|
|
@@ -25,10 +25,10 @@ var DEFAULT_OPTIONS = [
|
|
|
25
25
|
},
|
|
26
26
|
];
|
|
27
27
|
export var DEFAULT_SERVICE_SELECTOR_OPTIONS = DEFAULT_OPTIONS;
|
|
28
|
-
|
|
29
|
-
var value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.options, options = _c === void 0 ? DEFAULT_OPTIONS : _c, _d = _a.className, className =
|
|
30
|
-
var
|
|
31
|
-
var
|
|
28
|
+
function ServiceSelector(_a) {
|
|
29
|
+
var value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.options, options = _c === void 0 ? DEFAULT_OPTIONS : _c, _d = _a.useDefaultBackground, useDefaultBackground = _d === void 0 ? false : _d, _e = _a.className, className = _e === void 0 ? '' : _e;
|
|
30
|
+
var _f = useState(value), selectedValue = _f[0], setSelectedValue = _f[1];
|
|
31
|
+
var _g = useState(false), isOpen = _g[0], setIsOpen = _g[1];
|
|
32
32
|
var dropdownRef = useRef(null);
|
|
33
33
|
// Close dropdown when clicking outside
|
|
34
34
|
useEffect(function () {
|
|
@@ -58,7 +58,7 @@ var ServiceSelector = function (_a) {
|
|
|
58
58
|
if (disabled)
|
|
59
59
|
return 'disabled';
|
|
60
60
|
// If a service is selected, always show selected state (even if open)
|
|
61
|
-
if (selectedValue)
|
|
61
|
+
if (selectedValue && !useDefaultBackground)
|
|
62
62
|
return 'selected';
|
|
63
63
|
if (isOpen)
|
|
64
64
|
return 'open';
|
|
@@ -81,5 +81,5 @@ var ServiceSelector = function (_a) {
|
|
|
81
81
|
var isDisabled = option.disabled || disabled;
|
|
82
82
|
return (_jsxs("button", { 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, { size: "base", variant: "bold", color: isSelected ? 'inverted' : 'default', className: "service-selector__option-text", children: option.label }), option.badge && (_jsx("span", { className: "service-selector__option-badge", children: option.badge }))] }, option.value));
|
|
83
83
|
}) }) }) })] }));
|
|
84
|
-
}
|
|
84
|
+
}
|
|
85
85
|
export default ServiceSelector;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './Booking';
|
|
2
|
-
export type { BookingDocketProps } from './BookingDocket/BookingDocket';
|
|
2
|
+
export type { BookingDocketItem, BookingDocketProps, BookingResumeData, } from './BookingDocket/BookingDocket';
|
|
3
3
|
export type { BookingStepProps } from './BookingStep/BookingStep';
|
|
@@ -133,7 +133,8 @@
|
|
|
133
133
|
position: absolute;
|
|
134
134
|
top: calc(100% + 8px);
|
|
135
135
|
left: 0;
|
|
136
|
-
|
|
136
|
+
right: 0;
|
|
137
|
+
width: 100%;
|
|
137
138
|
background: var(--color-elevation-level-1, #ffffff);
|
|
138
139
|
border: 1px solid var(--color-border-subtle, #e5e5e5);
|
|
139
140
|
border-radius: 12px;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn } from '@/src/lib/utils';
|
|
2
|
-
import
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import '../../../styles/components/molecule/service-selector.css';
|
|
4
4
|
import Icon from '../../atoms/Icon/Icon';
|
|
5
5
|
import { Text } from '../../atoms/Typography/Typography';
|
|
@@ -26,6 +26,8 @@ export interface ServiceSelectorProps {
|
|
|
26
26
|
className?: string;
|
|
27
27
|
/** Options to display */
|
|
28
28
|
options?: ServiceOption[];
|
|
29
|
+
/** Whether to use the default background color */
|
|
30
|
+
useDefaultBackground?: boolean;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
const DEFAULT_OPTIONS: ServiceOption[] = [
|
|
@@ -50,13 +52,14 @@ const DEFAULT_OPTIONS: ServiceOption[] = [
|
|
|
50
52
|
|
|
51
53
|
export const DEFAULT_SERVICE_SELECTOR_OPTIONS: ServiceOption[] = DEFAULT_OPTIONS;
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
function ServiceSelector({
|
|
54
56
|
value,
|
|
55
57
|
onChange,
|
|
56
58
|
disabled = false,
|
|
57
59
|
options = DEFAULT_OPTIONS,
|
|
60
|
+
useDefaultBackground = false,
|
|
58
61
|
className = '',
|
|
59
|
-
})
|
|
62
|
+
}: ServiceSelectorProps) {
|
|
60
63
|
const [selectedValue, setSelectedValue] = useState(value);
|
|
61
64
|
const [isOpen, setIsOpen] = useState(false);
|
|
62
65
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
@@ -91,7 +94,7 @@ const ServiceSelector: React.FC<ServiceSelectorProps> = ({
|
|
|
91
94
|
const getDropdownState = () => {
|
|
92
95
|
if (disabled) return 'disabled';
|
|
93
96
|
// If a service is selected, always show selected state (even if open)
|
|
94
|
-
if (selectedValue) return 'selected';
|
|
97
|
+
if (selectedValue && !useDefaultBackground) return 'selected';
|
|
95
98
|
if (isOpen) return 'open';
|
|
96
99
|
return 'default';
|
|
97
100
|
};
|
|
@@ -182,6 +185,6 @@ const ServiceSelector: React.FC<ServiceSelectorProps> = ({
|
|
|
182
185
|
</PopoverContent>
|
|
183
186
|
</Popover>
|
|
184
187
|
);
|
|
185
|
-
}
|
|
188
|
+
}
|
|
186
189
|
|
|
187
190
|
export default ServiceSelector;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export * from './Booking';
|
|
2
|
-
export type {
|
|
2
|
+
export type {
|
|
3
|
+
BookingDocketItem,
|
|
4
|
+
BookingDocketProps,
|
|
5
|
+
BookingResumeData,
|
|
6
|
+
} from './BookingDocket/BookingDocket';
|
|
3
7
|
export type { BookingStepProps } from './BookingStep/BookingStep';
|
|
@@ -117,7 +117,8 @@
|
|
|
117
117
|
position: absolute;
|
|
118
118
|
top: calc(100% + 8px);
|
|
119
119
|
left: 0;
|
|
120
|
-
|
|
120
|
+
right: 0;
|
|
121
|
+
width: 100%;
|
|
121
122
|
background: var(--color-elevation-level-1, #ffffff);
|
|
122
123
|
border: 1px solid var(--color-border-subtle, #e5e5e5);
|
|
123
124
|
border-radius: 12px;
|