mautourco-components 0.2.8 → 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.
@@ -5,6 +5,7 @@ interface IconProps {
5
5
  size?: "xs" | "sm" | "md" | "lg" | "xl";
6
6
  className?: string;
7
7
  color?: string;
8
+ style?: React.CSSProperties;
8
9
  }
9
10
  declare const Icon: React.FC<IconProps>;
10
11
  export default Icon;
@@ -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(ChevronDownIcon, __assign({}, iconProps));
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.size, size = _c === void 0 ? 'md' : _c, _d = _a.className, className = _d === void 0 ? '' : _d, color = _a.color;
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 getDirectionStyle = function () {
26
- switch (direction) {
27
- case 'up': return { transform: 'rotate(0deg)' };
28
- case 'down': return { transform: 'rotate(0deg)' };
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
- return (_jsx("svg", __assign({ className: classes, style: directionStyle, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, { children: getPath() })));
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;
@@ -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,2 @@
1
+ export { default } from './ServiceSelector';
2
+ export type { ServiceSelectorProps, ServiceType, ServiceOption } from './ServiceSelector';
@@ -0,0 +1 @@
1
+ export { default } from './ServiceSelector';
@@ -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" | "secondary" | "outline" | "default" | "destructive" | "ghost" | null | undefined;
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';