mautourco-components 0.1.2 → 0.2.1
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/README.md +10 -6
- package/dist/components/atoms/Checkbox/Checkbox.js +7 -1
- package/dist/components/atoms/Icon/Icon.d.ts +1 -1
- package/dist/components/atoms/Icon/Icon.js +22 -1
- package/dist/components/atoms/Icon/icons/BuildingIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/BuildingIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/CalendarOutlineIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/CalendarOutlineIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/HomeIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/HomeIcon.js +25 -0
- package/dist/components/atoms/Icon/icons/MinusIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MinusIcon.js +25 -0
- package/dist/components/atoms/Icon/icons/PlaneIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/PlaneIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/PlusIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/PlusIcon.js +25 -0
- package/dist/components/atoms/Icon/icons/ShipIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/ShipIcon.js +36 -0
- package/dist/components/atoms/Illustration/Illustration.d.ts +14 -0
- package/dist/components/atoms/Illustration/Illustration.js +33 -0
- package/dist/components/atoms/Illustration/illustrations.d.ts +51 -0
- package/dist/components/atoms/Illustration/illustrations.js +97 -0
- package/dist/components/atoms/RatingStar/RatingStar.d.ts +40 -0
- package/dist/components/atoms/RatingStar/RatingStar.js +54 -0
- package/dist/components/atoms/SegmentedButton/SegmentedButton.d.ts +27 -0
- package/dist/components/atoms/SegmentedButton/SegmentedButton.js +49 -0
- package/dist/components/atoms/Slider/Slider.d.ts +52 -0
- package/dist/components/atoms/Slider/Slider.js +30 -0
- package/dist/components/molecules/Calendar/CalendarInput.d.ts +34 -0
- package/dist/components/molecules/Calendar/CalendarInput.js +49 -0
- package/dist/components/molecules/Calendar/DateTime.d.ts +25 -0
- package/dist/components/molecules/Calendar/DateTime.js +106 -0
- package/dist/components/molecules/Calendar/TimePicker.d.ts +16 -0
- package/dist/components/molecules/Calendar/TimePicker.js +91 -0
- package/dist/components/molecules/LocationDropdown/LocationDropdown.d.ts +34 -0
- package/dist/components/molecules/LocationDropdown/LocationDropdown.js +120 -0
- package/dist/components/molecules/LocationDropdown/index.d.ts +2 -0
- package/dist/components/molecules/LocationDropdown/index.js +1 -0
- package/dist/components/molecules/RatingTab/RatingTab.d.ts +39 -0
- package/dist/components/molecules/RatingTab/RatingTab.js +41 -0
- package/dist/components/molecules/TabGroup/TabGroup.d.ts +17 -0
- package/dist/components/molecules/TabGroup/TabGroup.js +30 -0
- package/dist/components/organisms/CardContainer/CardContainer.d.ts +37 -0
- package/dist/components/organisms/CardContainer/CardContainer.js +27 -0
- package/dist/components/organisms/DateTimePicker/DateTimePicker.d.ts +15 -0
- package/dist/components/organisms/DateTimePicker/DateTimePicker.js +66 -0
- package/dist/components/organisms/Dialog/Dialog.d.ts +103 -0
- package/dist/components/organisms/Dialog/Dialog.js +162 -0
- package/dist/components/organisms/PaxSelector/PaxSelector.d.ts +63 -0
- package/dist/components/organisms/PaxSelector/PaxSelector.js +402 -0
- package/dist/components/organisms/RoundTrip/RoundTrip.d.ts +54 -0
- package/dist/components/organisms/RoundTrip/RoundTrip.js +179 -0
- package/dist/components/organisms/RoundTrip/index.d.ts +2 -0
- package/dist/components/organisms/RoundTrip/index.js +1 -0
- package/dist/components/organisms/SearchBarTransfer/SearchBarTransfer.d.ts +35 -0
- package/dist/components/organisms/SearchBarTransfer/SearchBarTransfer.js +192 -0
- package/dist/components/organisms/SearchBarTransfer/index.d.ts +2 -0
- package/dist/components/organisms/SearchBarTransfer/index.js +1 -0
- package/dist/components/organisms/TransferLine/TransferLine.d.ts +53 -0
- package/dist/components/organisms/TransferLine/TransferLine.js +179 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +56 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/calendar.js +87 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.js +42 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +18 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.js +13 -0
- package/dist/styles/components/avatar.css +2165 -0
- package/dist/styles/components/calendar.css +2214 -0
- package/dist/styles/components/checkbox.css +2212 -0
- package/dist/styles/components/dropdown.css +2295 -0
- package/dist/styles/components/forms.css +2229 -0
- package/dist/styles/components/illustration.css +2081 -0
- package/dist/styles/components/molecule/calendarInput.css +2308 -0
- package/dist/styles/components/molecule/dateTime.css +2092 -0
- package/dist/styles/components/molecule/location-dropdown.css +2405 -0
- package/dist/styles/components/molecule/timePicker.css +2204 -0
- package/dist/styles/components/multiselect-dropdown.css +2312 -0
- package/dist/styles/components/organism/card-container.css +2128 -0
- package/dist/styles/components/organism/dialog.css +2441 -0
- package/dist/styles/components/organism/footer.css +2387 -0
- package/dist/styles/components/organism/pax-selector.css +2800 -0
- package/dist/styles/components/organism/round-trip.css +2143 -0
- package/dist/styles/components/organism/search-bar-transfer.css +2258 -0
- package/dist/styles/components/organism/topnavigation.css +2499 -0
- package/dist/styles/components/organism/transfer-line.css +2208 -0
- package/dist/styles/components/rating-star.css +2113 -0
- package/dist/styles/components/rating-tab.css +2157 -0
- package/dist/styles/components/scrollbar.css +2143 -0
- package/dist/styles/components/segmented-button.css +2218 -0
- package/dist/styles/components/selected-value.css +2159 -0
- package/dist/styles/components/slider.css +2164 -0
- package/dist/styles/components/typography.css +2417 -0
- package/dist/styles/tokens/_tokens.scss +2072 -0
- package/dist/styles/tokens/tokens.css +2075 -0
- package/package.json +24 -12
- package/src/components/atoms/Button/Button.css +34 -34
- package/src/components/atoms/Checkbox/Checkbox.tsx +83 -69
- package/src/components/atoms/Icon/Icon.tsx +30 -2
- package/src/components/atoms/Icon/icons/BuildingIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/CalendarOutlineIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/HomeIcon.tsx +52 -0
- package/src/components/atoms/Icon/icons/MinusIcon.tsx +45 -0
- package/src/components/atoms/Icon/icons/PlaneIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/PlusIcon.tsx +45 -0
- package/src/components/atoms/Icon/icons/ShipIcon.tsx +50 -0
- package/src/components/atoms/Illustration/Illustration.tsx +28 -0
- package/src/components/atoms/Illustration/illustrations.ts +116 -0
- package/src/components/atoms/RatingStar/RatingStar.tsx +114 -0
- package/src/components/atoms/SegmentedButton/SegmentedButton.tsx +94 -0
- package/src/components/atoms/Slider/Slider.tsx +95 -0
- package/src/components/molecules/Calendar/CalendarInput.tsx +135 -0
- package/src/components/molecules/Calendar/DateTime.tsx +172 -0
- package/src/components/molecules/Calendar/TimePicker.tsx +174 -0
- package/src/components/molecules/LocationDropdown/LocationDropdown.tsx +234 -0
- package/src/components/molecules/LocationDropdown/index.ts +2 -0
- package/src/components/molecules/RatingTab/RatingTab.tsx +96 -0
- package/src/components/molecules/TabGroup/TabGroup.tsx +60 -0
- package/src/components/molecules/UserCard/UserCard.stories.tsx +2 -2
- package/src/components/organisms/CardContainer/CardContainer.tsx +66 -0
- package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +110 -0
- package/src/components/organisms/Dialog/Dialog.tsx +352 -0
- package/src/components/organisms/PaxSelector/PaxSelector.tsx +979 -0
- package/src/components/organisms/RoundTrip/RoundTrip.tsx +335 -0
- package/src/components/organisms/RoundTrip/index.ts +2 -0
- package/src/components/organisms/SearchBarTransfer/SearchBarTransfer.tsx +388 -0
- package/src/components/organisms/SearchBarTransfer/index.ts +2 -0
- package/src/components/organisms/TransferLine/TransferLine.tsx +369 -0
- package/src/components/ui/button.tsx +60 -0
- package/src/components/ui/calendar.tsx +246 -0
- package/src/components/ui/popover.tsx +46 -0
- package/src/styles/components/calendar.css +86 -0
- package/src/styles/components/checkbox.css +130 -132
- package/src/styles/components/dropdown.css +40 -40
- package/src/styles/components/forms.css +51 -51
- package/src/styles/components/illustration.css +7 -0
- package/src/styles/components/molecule/calendarInput.css +157 -0
- package/src/styles/components/molecule/dateTime.css +14 -0
- package/src/styles/components/molecule/location-dropdown.css +204 -0
- package/src/styles/components/molecule/timePicker.css +79 -0
- package/src/styles/components/multiselect-dropdown.css +230 -231
- package/src/styles/components/organism/card-container.css +49 -0
- package/src/styles/components/organism/dialog.css +241 -0
- package/src/styles/components/organism/pax-selector.css +702 -0
- package/src/styles/components/organism/round-trip.css +55 -0
- package/src/styles/components/organism/search-bar-transfer.css +128 -0
- package/src/styles/components/organism/transfer-line.css +86 -0
- package/src/styles/components/rating-star.css +39 -0
- package/src/styles/components/rating-tab.css +83 -0
- package/src/styles/components/segmented-button.css +134 -0
- package/src/styles/components/selected-value.css +16 -16
- package/src/styles/components/slider.css +86 -0
- package/src/styles/components/typography.css +36 -36
- package/src/styles/tokens/tokens.css +1093 -1093
- package/dist/components/atoms/Typography/Heading/Heading.d.ts +0 -9
- package/dist/components/atoms/Typography/Heading/Heading.js +0 -25
- package/dist/components/atoms/Typography/Text/Text.d.ts +0 -10
- package/dist/components/atoms/Typography/Text/Text.js +0 -77
|
@@ -0,0 +1,120 @@
|
|
|
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, Fragment as _Fragment } 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/location-dropdown.css';
|
|
17
|
+
var LocationDropdown = function (_a) {
|
|
18
|
+
var _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.groups, groups = _c === void 0 ? [] : _c, _d = _a.selectedValue, selectedValue = _d === void 0 ? null : _d, _e = _a.placeholder, placeholder = _e === void 0 ? 'Select a location' : _e, label = _a.label, onSelectionChange = _a.onSelectionChange, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.error, error = _g === void 0 ? false : _g, _h = _a.className, className = _h === void 0 ? '' : _h, _j = _a.type, type = _j === void 0 ? 'airport-port' : _j, _k = _a.maxHeight, maxHeight = _k === void 0 ? 240 : _k, _l = _a.direction, direction = _l === void 0 ? undefined : _l, _m = _a.showGroupTitles, showGroupTitles = _m === void 0 ? true : _m;
|
|
19
|
+
var _o = useState(false), isOpen = _o[0], setIsOpen = _o[1];
|
|
20
|
+
var dropdownRef = useRef(null);
|
|
21
|
+
// Close dropdown when clicking outside
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
var handleClickOutside = function (event) {
|
|
24
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
25
|
+
setIsOpen(false);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
29
|
+
return function () {
|
|
30
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
var handleToggleDropdown = function () {
|
|
34
|
+
if (!disabled) {
|
|
35
|
+
setIsOpen(!isOpen);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var handleOptionSelect = function (option) {
|
|
39
|
+
if (disabled)
|
|
40
|
+
return;
|
|
41
|
+
var locationData = {
|
|
42
|
+
id: option.id,
|
|
43
|
+
locationName: option.label,
|
|
44
|
+
};
|
|
45
|
+
onSelectionChange(locationData);
|
|
46
|
+
setIsOpen(false);
|
|
47
|
+
};
|
|
48
|
+
var getSelectedOption = function () {
|
|
49
|
+
if (!selectedValue)
|
|
50
|
+
return null;
|
|
51
|
+
// Search in flat options
|
|
52
|
+
var flatOption = options.find(function (opt) { return opt.id === selectedValue; });
|
|
53
|
+
if (flatOption)
|
|
54
|
+
return flatOption;
|
|
55
|
+
// Search in groups
|
|
56
|
+
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
|
|
57
|
+
var group = groups_1[_i];
|
|
58
|
+
var groupOption = group.options.find(function (opt) { return opt.id === selectedValue; });
|
|
59
|
+
if (groupOption)
|
|
60
|
+
return groupOption;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
};
|
|
64
|
+
var getIconForType = function (optionType) {
|
|
65
|
+
switch (optionType) {
|
|
66
|
+
case 'airport':
|
|
67
|
+
return 'plane';
|
|
68
|
+
case 'port':
|
|
69
|
+
return 'ship';
|
|
70
|
+
case 'accommodation':
|
|
71
|
+
return 'map-pin';
|
|
72
|
+
default:
|
|
73
|
+
return 'map-pin';
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var getInputIcon = function () {
|
|
77
|
+
if (selectedOption) {
|
|
78
|
+
// For airports, show arrival/departure based on direction
|
|
79
|
+
console.log({ direction: direction });
|
|
80
|
+
if (selectedOption.type === 'airport' && direction) {
|
|
81
|
+
return direction === 'pickup' ? 'arrival' : 'departure';
|
|
82
|
+
}
|
|
83
|
+
return getIconForType(selectedOption.type);
|
|
84
|
+
}
|
|
85
|
+
// Use arrival/departure icons based on direction for pickup/dropoff types
|
|
86
|
+
if ((type === 'pickup-dropoff' || type === 'airport-port') && direction) {
|
|
87
|
+
return direction === 'pickup' ? 'arrival' : 'departure';
|
|
88
|
+
}
|
|
89
|
+
return 'map-pin';
|
|
90
|
+
};
|
|
91
|
+
var getOptionIcon = function (option, isSelected) {
|
|
92
|
+
// For selected airports, show arrival/departure based on direction
|
|
93
|
+
if (isSelected && option.type === 'airport' && direction) {
|
|
94
|
+
return direction === 'pickup' ? 'arrival' : 'departure';
|
|
95
|
+
}
|
|
96
|
+
// For other types (port, accommodation), show their specific icon
|
|
97
|
+
return getIconForType(option.type);
|
|
98
|
+
};
|
|
99
|
+
var getDropdownState = function () {
|
|
100
|
+
if (disabled)
|
|
101
|
+
return 'disabled';
|
|
102
|
+
if (error)
|
|
103
|
+
return 'error';
|
|
104
|
+
if (isOpen)
|
|
105
|
+
return 'open';
|
|
106
|
+
if (selectedValue)
|
|
107
|
+
return 'selected';
|
|
108
|
+
return 'default';
|
|
109
|
+
};
|
|
110
|
+
var selectedOption = getSelectedOption();
|
|
111
|
+
var displayText = selectedOption ? selectedOption.label : placeholder;
|
|
112
|
+
// Prepare all options (flat or grouped)
|
|
113
|
+
var allOptions = groups.length > 0 ? groups : [{ id: 'default', label: '', options: options }];
|
|
114
|
+
return (_jsxs("div", __assign({ ref: dropdownRef, className: "location-dropdown location-dropdown--".concat(type, " ").concat(className) }, { children: [label && (_jsx("div", __assign({ className: "location-dropdown__label" }, { children: _jsx(Text, __assign({ size: "sm", variant: "medium" }, { children: label })) }))), _jsxs("div", __assign({ className: "location-dropdown__input location-dropdown__input--".concat(getDropdownState()), onClick: handleToggleDropdown }, { children: [_jsxs("div", __assign({ className: "location-dropdown__input-content" }, { children: [_jsx(Icon, { name: getInputIcon(), size: "sm", className: "location-dropdown__input-icon ".concat(!selectedOption ? 'location-dropdown__input-icon--placeholder' : '') }), _jsx("span", __assign({ className: "location-dropdown__input-text ".concat(!selectedOption ? 'location-dropdown__input-text--placeholder' : '') }, { children: displayText }))] })), _jsx(Icon, { name: "chevron-down", size: "sm", className: "location-dropdown__input-chevron" })] })), isOpen && (_jsx("div", __assign({ className: "location-dropdown__panel" }, { children: _jsx("div", __assign({ className: "location-dropdown__content", style: { maxHeight: "".concat(maxHeight, "px") } }, { children: _jsx("div", __assign({ className: "location-dropdown__options-wrapper" }, { children: allOptions.map(function (group, groupIndex) { return (_jsxs("div", __assign({ className: "location-dropdown__group" }, { children: [showGroupTitles && group.label && groups.length > 0 && (_jsxs(_Fragment, { children: [groupIndex > 0 && _jsx("div", { className: "location-dropdown__divider" }), _jsx("div", __assign({ className: "location-dropdown__group-header" }, { children: _jsx(Text, __assign({ size: "xs", variant: "bold" }, { children: group.label })) }))] })), _jsx("div", __assign({ className: "location-dropdown__group-options" }, { children: group.options.map(function (option) {
|
|
115
|
+
var isSelected = selectedValue === option.id;
|
|
116
|
+
var isDisabled = option.disabled || disabled;
|
|
117
|
+
return (_jsxs("div", __assign({ className: "location-dropdown__option ".concat(isSelected ? 'location-dropdown__option--selected' : '', " ").concat(isDisabled ? 'location-dropdown__option--disabled' : ''), onClick: function () { return !isDisabled && handleOptionSelect(option); } }, { children: [_jsx(Icon, { name: getOptionIcon(option, isSelected), size: "sm", className: "location-dropdown__option-icon" }), _jsx("span", __assign({ className: "location-dropdown__option-text" }, { children: option.label }))] }), option.id));
|
|
118
|
+
}) }))] }), group.id)); }) })) })) })))] })));
|
|
119
|
+
};
|
|
120
|
+
export default LocationDropdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './LocationDropdown';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface RatingTabProps {
|
|
3
|
+
/**
|
|
4
|
+
* Label displayed next to the checkbox (e.g. "5 stars").
|
|
5
|
+
*/
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Rating value displayed in the star row (0–max, typically 1–5).
|
|
9
|
+
*/
|
|
10
|
+
ratingValue: number;
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of stars.
|
|
13
|
+
*/
|
|
14
|
+
maxStars?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Whether this tab is selected.
|
|
17
|
+
*/
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the tab is disabled.
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Called when the selection state changes.
|
|
25
|
+
*/
|
|
26
|
+
onChange?: (checked: boolean) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Additional CSS classes for the container.
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* RatingTab molecule
|
|
34
|
+
*
|
|
35
|
+
* Combines a checkbox-like selector, a label and the RatingStar atom.
|
|
36
|
+
* Used for filters like "5 stars", "4 stars", etc.
|
|
37
|
+
*/
|
|
38
|
+
declare const RatingTab: React.FC<RatingTabProps>;
|
|
39
|
+
export default RatingTab;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 Check from '../../atoms/Icon/icons/Check';
|
|
14
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
15
|
+
import RatingStar from '../../atoms/RatingStar/RatingStar';
|
|
16
|
+
/**
|
|
17
|
+
* RatingTab molecule
|
|
18
|
+
*
|
|
19
|
+
* Combines a checkbox-like selector, a label and the RatingStar atom.
|
|
20
|
+
* Used for filters like "5 stars", "4 stars", etc.
|
|
21
|
+
*/
|
|
22
|
+
var RatingTab = function (_a) {
|
|
23
|
+
var label = _a.label, ratingValue = _a.ratingValue, _b = _a.maxStars, maxStars = _b === void 0 ? 5 : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, onChange = _a.onChange, _e = _a.className, className = _e === void 0 ? '' : _e;
|
|
24
|
+
var handleToggle = function () {
|
|
25
|
+
if (disabled || !onChange)
|
|
26
|
+
return;
|
|
27
|
+
onChange(!checked);
|
|
28
|
+
};
|
|
29
|
+
var handleKeyDown = function (event) {
|
|
30
|
+
if (disabled || !onChange)
|
|
31
|
+
return;
|
|
32
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
onChange(!checked);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var stateClass = disabled ? 'rating-tab--disabled' : checked ? 'rating-tab--active' : 'rating-tab--default';
|
|
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 })] })));
|
|
40
|
+
};
|
|
41
|
+
export default RatingTab;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TabProps } from '../../atoms/Tab/Tab';
|
|
2
|
+
export type TabItem<T = string> = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: T;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface TabGroupProps<T = string> {
|
|
8
|
+
items: TabItem<T>[];
|
|
9
|
+
size?: TabProps['size'];
|
|
10
|
+
variant?: TabProps['variant'];
|
|
11
|
+
active?: T;
|
|
12
|
+
defaultActive?: T;
|
|
13
|
+
onChange?: (value: T) => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function TabGroup<T = string>({ items, size, variant, active, defaultActive, onChange, className, }: TabGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default TabGroup;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import Tab from '../../atoms/Tab/Tab';
|
|
15
|
+
export function TabGroup(_a) {
|
|
16
|
+
var _b;
|
|
17
|
+
var items = _a.items, _c = _a.size, size = _c === void 0 ? 'lg' : _c, _d = _a.variant, variant = _d === void 0 ? 'inline' : _d, active = _a.active, defaultActive = _a.defaultActive, onChange = _a.onChange, _e = _a.className, className = _e === void 0 ? '' : _e;
|
|
18
|
+
var _f = React.useState(defaultActive !== null && defaultActive !== void 0 ? defaultActive : (_b = items[0]) === null || _b === void 0 ? void 0 : _b.value), internalActive = _f[0], setInternalActive = _f[1];
|
|
19
|
+
var isControlled = active !== undefined;
|
|
20
|
+
var current = (isControlled ? active : internalActive);
|
|
21
|
+
var handleClick = function (item) {
|
|
22
|
+
if (item.disabled)
|
|
23
|
+
return;
|
|
24
|
+
if (!isControlled)
|
|
25
|
+
setInternalActive(item.value);
|
|
26
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(item.value);
|
|
27
|
+
};
|
|
28
|
+
return (_jsx("div", __assign({ className: "tab-group flex ".concat(className), role: "tablist" }, { children: items.map(function (it) { return (_jsx(Tab, __assign({ isActive: current === it.value, size: size, variant: variant, disabled: it.disabled, onClick: function () { return handleClick(it); } }, { children: it.label }), String(it.value))); }) })));
|
|
29
|
+
}
|
|
30
|
+
export default TabGroup;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type CardContainerSpacing = 'compact' | 'normal' | 'relaxed' | 'chill';
|
|
3
|
+
export interface CardContainerProps {
|
|
4
|
+
/**
|
|
5
|
+
* The content to be displayed inside the card container
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Spacing variant for the card container padding
|
|
10
|
+
* - compact: 8px padding
|
|
11
|
+
* - normal: 12px padding
|
|
12
|
+
* - relaxed: 16px padding
|
|
13
|
+
* - chill: 24px padding
|
|
14
|
+
*/
|
|
15
|
+
spacing?: CardContainerSpacing;
|
|
16
|
+
/**
|
|
17
|
+
* Additional CSS classes to apply to the card container
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional click handler
|
|
22
|
+
*/
|
|
23
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Optional data attributes for testing or tracking
|
|
26
|
+
*/
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* CardContainer is a versatile UI element that groups related content,
|
|
31
|
+
* such as text, images, buttons, or interactive elements.
|
|
32
|
+
*
|
|
33
|
+
* It supports different spacing variants to control the visual density
|
|
34
|
+
* and padding of the container.
|
|
35
|
+
*/
|
|
36
|
+
export declare const CardContainer: React.FC<CardContainerProps>;
|
|
37
|
+
export default CardContainer;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* CardContainer is a versatile UI element that groups related content,
|
|
15
|
+
* such as text, images, buttons, or interactive elements.
|
|
16
|
+
*
|
|
17
|
+
* It supports different spacing variants to control the visual density
|
|
18
|
+
* and padding of the container.
|
|
19
|
+
*/
|
|
20
|
+
export var CardContainer = function (_a) {
|
|
21
|
+
var children = _a.children, _b = _a.spacing, spacing = _b === void 0 ? 'normal' : _b, _c = _a.className, className = _c === void 0 ? '' : _c, onClick = _a.onClick, testId = _a["data-testid"];
|
|
22
|
+
var baseClass = 'card-container';
|
|
23
|
+
var spacingClass = "card-container--spacing-".concat(spacing);
|
|
24
|
+
var classes = [baseClass, spacingClass, className].filter(Boolean).join(' ');
|
|
25
|
+
return (_jsx("div", __assign({ className: classes, onClick: onClick, "data-testid": testId }, { children: children })));
|
|
26
|
+
};
|
|
27
|
+
export default CardContainer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DateTimeProps } from "../../molecules/Calendar/DateTime";
|
|
3
|
+
export interface DateTimePickerProps extends Partial<DateTimeProps> {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onValueChange?: (value: string | string[]) => void;
|
|
7
|
+
/** Whether the calendar icon has full bg*/
|
|
8
|
+
iconBGFull?: boolean;
|
|
9
|
+
/** Position of the calendar icon: left or right */
|
|
10
|
+
iconPosition?: "left" | "right";
|
|
11
|
+
/** Show chevron on the right when icon is on the left */
|
|
12
|
+
showChevron?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const DateTimePicker: React.FC<DateTimePickerProps>;
|
|
15
|
+
export default DateTimePicker;
|
|
@@ -0,0 +1,66 @@
|
|
|
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 React, { useState } from "react";
|
|
14
|
+
import CalendarInput from "../../molecules/Calendar/CalendarInput";
|
|
15
|
+
import DateTime from "../../molecules/Calendar/DateTime";
|
|
16
|
+
import { Popover, PopoverTrigger, PopoverContent } from "../../ui/popover";
|
|
17
|
+
import { format } from "date-fns";
|
|
18
|
+
var formatDateRange = function (dateRange) {
|
|
19
|
+
var _a;
|
|
20
|
+
if (!dateRange || !dateRange.from)
|
|
21
|
+
return "";
|
|
22
|
+
var from = dateRange.from;
|
|
23
|
+
var to = (_a = dateRange.to) !== null && _a !== void 0 ? _a : dateRange.from;
|
|
24
|
+
if (+from === +to)
|
|
25
|
+
return format(from, "dd/MM/yyyy");
|
|
26
|
+
return "".concat(format(from, "dd/MM/yyyy"), " - ").concat(format(to, "dd/MM/yyyy"));
|
|
27
|
+
};
|
|
28
|
+
var DateTimePicker = function (_a) {
|
|
29
|
+
var _b = _a.placeholder, placeholder = _b === void 0 ? "Select date" : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.mode, mode = _d === void 0 ? "both" : _d, _e = _a.selectionMode, selectionMode = _e === void 0 ? "range" : _e, _f = _a.numberOfMonths, numberOfMonths = _f === void 0 ? 2 : _f, _g = _a.disableBeforeToday, disableBeforeToday = _g === void 0 ? true : _g, _h = _a.disableToday, disableToday = _h === void 0 ? false : _h, onValueChange = _a.onValueChange, _j = _a.iconBGFull, iconBGFull = _j === void 0 ? true : _j, _k = _a.iconPosition, iconPosition = _k === void 0 ? "right" : _k, _l = _a.showChevron, showChevron = _l === void 0 ? false : _l;
|
|
30
|
+
var _m = useState(""), value = _m[0], setValue = _m[1];
|
|
31
|
+
var _o = useState(undefined), selectedDateRange = _o[0], setSelectedDateRange = _o[1];
|
|
32
|
+
var _p = useState(undefined), selectedTime = _p[0], setSelectedTime = _p[1];
|
|
33
|
+
var _q = useState(false), isOpen = _q[0], setIsOpen = _q[1];
|
|
34
|
+
var handleDtChange = React.useCallback(function (payload) {
|
|
35
|
+
var _a;
|
|
36
|
+
var datePart = formatDateRange(payload.dateRange);
|
|
37
|
+
var time = payload.time ? "".concat(payload.time.hour, ":").concat(payload.time.minute, " ").concat(payload.time.meridiem) : "";
|
|
38
|
+
var combined = [datePart, time].filter(Boolean).join(" ");
|
|
39
|
+
setValue(combined);
|
|
40
|
+
setSelectedDateRange(payload.dateRange);
|
|
41
|
+
setSelectedTime(payload.time);
|
|
42
|
+
// Return date strings in yyyy-MM-dd format for both modes
|
|
43
|
+
if (payload.dateRange) {
|
|
44
|
+
if (selectionMode === "range") {
|
|
45
|
+
// Return array of date strings for range mode
|
|
46
|
+
var from = payload.dateRange.from;
|
|
47
|
+
var to = (_a = payload.dateRange.to) !== null && _a !== void 0 ? _a : payload.dateRange.from;
|
|
48
|
+
if (from && to) {
|
|
49
|
+
var fromStr = format(from, "yyyy-MM-dd");
|
|
50
|
+
var toStr = format(to, "yyyy-MM-dd");
|
|
51
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange([fromStr, toStr]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Return single date string in yyyy-MM-dd format for single mode
|
|
56
|
+
var date = payload.dateRange.from;
|
|
57
|
+
if (date) {
|
|
58
|
+
var dateStr = format(date, "yyyy-MM-dd");
|
|
59
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(dateStr);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, [onValueChange, selectionMode]);
|
|
64
|
+
return (_jsxs(Popover, __assign({ open: isOpen, onOpenChange: setIsOpen }, { children: [_jsx(PopoverTrigger, __assign({ asChild: true }, { children: _jsx("div", { children: _jsx(CalendarInput, { placeholder: placeholder, value: value, disabled: disabled, iconBGFull: iconBGFull, iconPosition: iconPosition, showChevron: showChevron, isOpen: isOpen }) }) })), _jsx(PopoverContent, __assign({ className: "w-auto p-0 border-transparent" }, { children: _jsx(DateTime, { mode: mode, selectionMode: selectionMode, numberOfMonths: numberOfMonths, disableBeforeToday: disableBeforeToday, disableToday: disableToday, onChange: handleDtChange, defaultDateRange: selectedDateRange, defaultTime: selectedTime }) }))] })));
|
|
65
|
+
};
|
|
66
|
+
export default DateTimePicker;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../../styles/components/organism/dialog.css';
|
|
3
|
+
/**
|
|
4
|
+
* Size variants for the Dialog component
|
|
5
|
+
*/
|
|
6
|
+
export type DialogSize = 'desktop' | 'tablet' | 'mobile' | 'full' | 'responsive';
|
|
7
|
+
/**
|
|
8
|
+
* Props for the Dialog component
|
|
9
|
+
*/
|
|
10
|
+
export interface DialogProps {
|
|
11
|
+
/**
|
|
12
|
+
* Whether the dialog is open
|
|
13
|
+
*/
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Callback when the dialog should close
|
|
17
|
+
*/
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Title displayed in the dialog header
|
|
21
|
+
*/
|
|
22
|
+
title: string;
|
|
23
|
+
/**
|
|
24
|
+
* Content to be rendered in the dialog body
|
|
25
|
+
*/
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Footer content or buttons. If not provided, default Cancel/Save buttons are shown
|
|
29
|
+
*/
|
|
30
|
+
footer?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Size variant of the dialog
|
|
33
|
+
* @default 'responsive'
|
|
34
|
+
*/
|
|
35
|
+
size?: DialogSize;
|
|
36
|
+
/**
|
|
37
|
+
* Text for the primary action button (when using default footer)
|
|
38
|
+
* @default 'Save and update'
|
|
39
|
+
*/
|
|
40
|
+
primaryButtonText?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Text for the secondary action button (when using default footer)
|
|
43
|
+
* @default 'Cancel'
|
|
44
|
+
*/
|
|
45
|
+
secondaryButtonText?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Callback for primary button click (when using default footer)
|
|
48
|
+
*/
|
|
49
|
+
onPrimaryClick?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback for secondary button click (when using default footer)
|
|
52
|
+
*/
|
|
53
|
+
onSecondaryClick?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to show the footer
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
showFooter?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether to show the close button in the header
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
showCloseButton?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether clicking the overlay closes the dialog
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
closeOnOverlayClick?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether pressing Escape closes the dialog
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
closeOnEscape?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Additional CSS classes for the dialog content
|
|
76
|
+
*/
|
|
77
|
+
className?: string;
|
|
78
|
+
/**
|
|
79
|
+
* ID for aria-labelledby
|
|
80
|
+
*/
|
|
81
|
+
ariaLabelledBy?: string;
|
|
82
|
+
/**
|
|
83
|
+
* ID for aria-describedby
|
|
84
|
+
*/
|
|
85
|
+
ariaDescribedBy?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Dialog component - A modal dialog that adapts to different screen sizes
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <Dialog
|
|
93
|
+
* isOpen={isOpen}
|
|
94
|
+
* onClose={() => setIsOpen(false)}
|
|
95
|
+
* title="Edit Information"
|
|
96
|
+
* onPrimaryClick={handleSave}
|
|
97
|
+
* >
|
|
98
|
+
* <p>Your content here</p>
|
|
99
|
+
* </Dialog>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare const Dialog: React.FC<DialogProps>;
|
|
103
|
+
export default Dialog;
|