mautourco-components 0.1.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 +187 -0
- package/dist/components/atoms/Avatar/Avatar.d.ts +14 -0
- package/dist/components/atoms/Avatar/Avatar.js +31 -0
- package/dist/components/atoms/Button/Button.d.ts +27 -0
- package/dist/components/atoms/Button/Button.js +35 -0
- package/dist/components/atoms/Checkbox/Checkbox.d.ts +13 -0
- package/dist/components/atoms/Checkbox/Checkbox.js +33 -0
- package/dist/components/atoms/Icon/Icon.d.ts +10 -0
- package/dist/components/atoms/Icon/Icon.js +102 -0
- package/dist/components/atoms/Icon/icons/ArrivalIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/ArrivalIcon.js +31 -0
- package/dist/components/atoms/Icon/icons/CalendarIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/CalendarIcon.js +41 -0
- package/dist/components/atoms/Icon/icons/CarIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/CarIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Check.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Check.js +30 -0
- package/dist/components/atoms/Icon/icons/CheckCircleIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/CheckCircleIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Chevron.d.ts +9 -0
- package/dist/components/atoms/Icon/icons/Chevron.js +54 -0
- package/dist/components/atoms/Icon/icons/ChevronDownIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/ChevronDownIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Close.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Close.js +30 -0
- package/dist/components/atoms/Icon/icons/DeleteIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/DeleteIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/DepartureIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/DepartureIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/EyeIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/EyeIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/FacebookIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/FacebookIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/InfoIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/InfoIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/LinkedInIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/LinkedInIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/MapPinIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MapPinIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/MautoucoLogo.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MautoucoLogo.js +37 -0
- package/dist/components/atoms/Icon/icons/MenuIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MenuIcon.js +37 -0
- package/dist/components/atoms/Icon/icons/MoreIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/MoreIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/Search.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Search.js +30 -0
- package/dist/components/atoms/Icon/icons/Settings.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Settings.js +30 -0
- package/dist/components/atoms/Icon/icons/StrollerIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/StrollerIcon.js +30 -0
- package/dist/components/atoms/Icon/icons/TwitterIcon.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/TwitterIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/User.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/User.js +30 -0
- package/dist/components/atoms/Icon/icons/UserIcon.d.ts +12 -0
- package/dist/components/atoms/Icon/icons/UserIcon.js +41 -0
- package/dist/components/atoms/Icon/icons/Youtube.d.ts +8 -0
- package/dist/components/atoms/Icon/icons/Youtube.js +36 -0
- package/dist/components/atoms/Inputs/DropdownInput/DropdownInput.d.ts +12 -0
- package/dist/components/atoms/Inputs/DropdownInput/DropdownInput.js +53 -0
- package/dist/components/atoms/Inputs/Input/Input.d.ts +15 -0
- package/dist/components/atoms/Inputs/Input/Input.js +27 -0
- package/dist/components/atoms/Inputs/Textarea/Textarea.d.ts +14 -0
- package/dist/components/atoms/Inputs/Textarea/Textarea.js +15 -0
- package/dist/components/atoms/Link/Link.d.ts +44 -0
- package/dist/components/atoms/Link/Link.js +76 -0
- package/dist/components/atoms/SelectedValue/SelectedValue.d.ts +11 -0
- package/dist/components/atoms/SelectedValue/SelectedValue.js +29 -0
- package/dist/components/atoms/Spinner/Spinner.d.ts +9 -0
- package/dist/components/atoms/Spinner/Spinner.js +38 -0
- package/dist/components/atoms/Spinner/variants/ButtonSpinner.d.ts +8 -0
- package/dist/components/atoms/Spinner/variants/ButtonSpinner.js +19 -0
- package/dist/components/atoms/Spinner/variants/LoadingSpinner.d.ts +7 -0
- package/dist/components/atoms/Spinner/variants/LoadingSpinner.js +7 -0
- package/dist/components/atoms/Tab/Tab.d.ts +22 -0
- package/dist/components/atoms/Tab/Tab.js +54 -0
- package/dist/components/atoms/Typography/Heading/Heading.d.ts +9 -0
- package/dist/components/atoms/Typography/Heading/Heading.js +25 -0
- package/dist/components/atoms/Typography/Text/Text.d.ts +10 -0
- package/dist/components/atoms/Typography/Text/Text.js +77 -0
- package/dist/components/atoms/Typography/Typography.d.ts +24 -0
- package/dist/components/atoms/Typography/Typography.js +100 -0
- package/dist/components/molecules/MultiSelectDropdown/MultiSelectDropdown.d.ts +29 -0
- package/dist/components/molecules/MultiSelectDropdown/MultiSelectDropdown.js +106 -0
- package/dist/components/molecules/UserCard/UserCard.d.ts +20 -0
- package/dist/components/molecules/UserCard/UserCard.js +57 -0
- package/dist/components/organisms/Footer/Footer.d.ts +38 -0
- package/dist/components/organisms/Footer/Footer.js +74 -0
- package/dist/components/organisms/TopNavigation/DesktopNav.d.ts +33 -0
- package/dist/components/organisms/TopNavigation/DesktopNav.js +26 -0
- package/dist/components/organisms/TopNavigation/MobileNav.d.ts +32 -0
- package/dist/components/organisms/TopNavigation/MobileNav.js +45 -0
- package/dist/components/organisms/TopNavigation/TopNavigation.d.ts +33 -0
- package/dist/components/organisms/TopNavigation/TopNavigation.js +20 -0
- package/dist/hooks/useMobile.d.ts +5 -0
- package/dist/hooks/useMobile.js +26 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +28 -0
- package/dist/styles/tokens/tokens.d.ts +3108 -0
- package/dist/styles/tokens/tokens.js +2652 -0
- package/package.json +90 -0
- package/src/components/atoms/Avatar/Avatar.tsx +60 -0
- package/src/components/atoms/Button/Button.css +200 -0
- package/src/components/atoms/Button/Button.tsx +82 -0
- package/src/components/atoms/Checkbox/Checkbox.tsx +69 -0
- package/src/components/atoms/Icon/Icon.tsx +135 -0
- package/src/components/atoms/Icon/icons/ArrivalIcon.tsx +52 -0
- package/src/components/atoms/Icon/icons/CalendarIcon.tsx +63 -0
- package/src/components/atoms/Icon/icons/CarIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/Check.tsx +36 -0
- package/src/components/atoms/Icon/icons/CheckCircleIcon.tsx +48 -0
- package/src/components/atoms/Icon/icons/Chevron.tsx +73 -0
- package/src/components/atoms/Icon/icons/ChevronDownIcon.tsx +46 -0
- package/src/components/atoms/Icon/icons/Close.tsx +40 -0
- package/src/components/atoms/Icon/icons/DeleteIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/DepartureIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/EyeIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/FacebookIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/InfoIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/LinkedInIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/MapPinIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/MautoucoLogo.tsx +93 -0
- package/src/components/atoms/Icon/icons/MenuIcon.tsx +49 -0
- package/src/components/atoms/Icon/icons/MoreIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/Search.tsx +37 -0
- package/src/components/atoms/Icon/icons/Settings.tsx +38 -0
- package/src/components/atoms/Icon/icons/StrollerIcon.tsx +44 -0
- package/src/components/atoms/Icon/icons/TwitterIcon.tsx +50 -0
- package/src/components/atoms/Icon/icons/User.tsx +37 -0
- package/src/components/atoms/Icon/icons/UserIcon.tsx +63 -0
- package/src/components/atoms/Icon/icons/Youtube.tsx +50 -0
- package/src/components/atoms/Inputs/DropdownInput/DropdownInput.tsx +96 -0
- package/src/components/atoms/Inputs/Input/Input.tsx +66 -0
- package/src/components/atoms/Inputs/Textarea/Textarea.tsx +51 -0
- package/src/components/atoms/Link/Link.tsx +168 -0
- package/src/components/atoms/SelectedValue/SelectedValue.tsx +59 -0
- package/src/components/atoms/Spinner/Spinner.tsx +56 -0
- package/src/components/atoms/Spinner/variants/ButtonSpinner.tsx +37 -0
- package/src/components/atoms/Spinner/variants/LoadingSpinner.tsx +22 -0
- package/src/components/atoms/Tab/Tab.css +147 -0
- package/src/components/atoms/Tab/Tab.tsx +96 -0
- package/src/components/atoms/Typography/Typography.tsx +153 -0
- package/src/components/molecules/MultiSelectDropdown/MultiSelectDropdown.tsx +245 -0
- package/src/components/molecules/UserCard/UserCard.stories.tsx +36 -0
- package/src/components/molecules/UserCard/UserCard.tsx +173 -0
- package/src/components/organisms/Footer/Footer.tsx +290 -0
- package/src/components/organisms/TopNavigation/DesktopNav.tsx +122 -0
- package/src/components/organisms/TopNavigation/MobileNav.tsx +212 -0
- package/src/components/organisms/TopNavigation/TopNavigation.tsx +45 -0
- package/src/styles/components/avatar.css +58 -0
- package/src/styles/components/checkbox.css +132 -0
- package/src/styles/components/dropdown.css +214 -0
- package/src/styles/components/forms.css +147 -0
- package/src/styles/components/multiselect-dropdown.css +231 -0
- package/src/styles/components/organism/footer.css +113 -0
- package/src/styles/components/organism/topnavigation.css +162 -0
- package/src/styles/components/scrollbar.css +63 -0
- package/src/styles/components/selected-value.css +80 -0
- package/src/styles/components/typography.css +251 -0
- package/src/styles/tokens/_tokens.scss +2072 -0
- package/src/styles/tokens/tokens.css +2075 -0
- package/src/styles/tokens/tokens.js +2653 -0
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
var headingTokenClass = {
|
|
14
|
+
1: 'heading-3xl',
|
|
15
|
+
2: 'heading-2xl',
|
|
16
|
+
3: 'heading-xl',
|
|
17
|
+
4: 'heading-lg',
|
|
18
|
+
5: 'heading-md',
|
|
19
|
+
6: 'heading-sm',
|
|
20
|
+
};
|
|
21
|
+
var leadingFallback = {
|
|
22
|
+
none: 'leading-none',
|
|
23
|
+
'4': 'leading-4',
|
|
24
|
+
'5': 'leading-5',
|
|
25
|
+
'6': 'leading-6',
|
|
26
|
+
'7': 'leading-7',
|
|
27
|
+
};
|
|
28
|
+
var bodySizeAlias = {
|
|
29
|
+
xs: 'xs',
|
|
30
|
+
sm: 'sm',
|
|
31
|
+
md: 'md',
|
|
32
|
+
lg: 'lg',
|
|
33
|
+
base: 'md',
|
|
34
|
+
xl: 'lg',
|
|
35
|
+
};
|
|
36
|
+
var defaultBodyLeading = {
|
|
37
|
+
xs: '5',
|
|
38
|
+
sm: '6',
|
|
39
|
+
md: '6',
|
|
40
|
+
lg: '7',
|
|
41
|
+
};
|
|
42
|
+
var tokenBodyLeadings = {
|
|
43
|
+
xs: ['leading-5', 'leading-4', 'leading-none'],
|
|
44
|
+
sm: ['leading-6', 'leading-5', 'leading-none'],
|
|
45
|
+
md: ['leading-6', 'leading-7', 'leading-none'],
|
|
46
|
+
lg: ['leading-7', 'leading-6', 'leading-none'],
|
|
47
|
+
};
|
|
48
|
+
var mapLeadingToToken = function (leading) {
|
|
49
|
+
if (leading === 'none')
|
|
50
|
+
return 'leading-none';
|
|
51
|
+
return "leading-".concat(leading);
|
|
52
|
+
};
|
|
53
|
+
var getBodyClass = function (size, leading) {
|
|
54
|
+
var availableLeadings = tokenBodyLeadings[size];
|
|
55
|
+
var desiredLeading = leading ? mapLeadingToToken(leading) : mapLeadingToToken(defaultBodyLeading[size]);
|
|
56
|
+
var resolvedLeading = availableLeadings.includes(desiredLeading)
|
|
57
|
+
? desiredLeading
|
|
58
|
+
: availableLeadings[0];
|
|
59
|
+
return {
|
|
60
|
+
className: "body-".concat(size, "-").concat(resolvedLeading),
|
|
61
|
+
lineHeightHandled: desiredLeading === resolvedLeading,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
var buildVariantClass = function (base, variant) {
|
|
65
|
+
if (!base)
|
|
66
|
+
return undefined;
|
|
67
|
+
return "".concat(base, "--").concat(variant);
|
|
68
|
+
};
|
|
69
|
+
export var Heading = function (_a) {
|
|
70
|
+
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;
|
|
72
|
+
var Tag = as || "h".concat(level);
|
|
73
|
+
var baseClass = (_b = headingTokenClass[level]) !== null && _b !== void 0 ? _b : headingTokenClass[2];
|
|
74
|
+
var variantClass = buildVariantClass(baseClass, variant);
|
|
75
|
+
var classes = [
|
|
76
|
+
baseClass,
|
|
77
|
+
variantClass,
|
|
78
|
+
leading ? leadingFallback[leading] : '',
|
|
79
|
+
className,
|
|
80
|
+
]
|
|
81
|
+
.filter(Boolean)
|
|
82
|
+
.join(' ');
|
|
83
|
+
return (_jsx(Tag, __assign({ className: classes, onClick: onClick }, { children: children })));
|
|
84
|
+
};
|
|
85
|
+
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;
|
|
87
|
+
var Tag = as || 'p';
|
|
88
|
+
var normalizedSize = bodySizeAlias[size];
|
|
89
|
+
var _e = getBodyClass(normalizedSize, leading), baseClass = _e.className, lineHeightHandled = _e.lineHeightHandled;
|
|
90
|
+
var variantClass = buildVariantClass(baseClass, variant);
|
|
91
|
+
var classes = [
|
|
92
|
+
baseClass,
|
|
93
|
+
variantClass,
|
|
94
|
+
leading && !lineHeightHandled ? leadingFallback[leading] : '',
|
|
95
|
+
className,
|
|
96
|
+
]
|
|
97
|
+
.filter(Boolean)
|
|
98
|
+
.join(' ');
|
|
99
|
+
return (_jsx(Tag, __assign({ className: classes, onClick: onClick }, { children: children })));
|
|
100
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface MultiSelectOption {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
imageUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MultiSelectGroup {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
options: MultiSelectOption[];
|
|
12
|
+
imageUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MultiSelectDropdownProps {
|
|
15
|
+
options: MultiSelectOption[];
|
|
16
|
+
selectedValues: string[];
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
onSelectionChange: (selectedIds: string[]) => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
error?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
maxDisplayedChips?: number;
|
|
23
|
+
selectedValueVariant?: 'filled' | 'text';
|
|
24
|
+
searchable?: boolean;
|
|
25
|
+
searchPlaceholder?: string;
|
|
26
|
+
groups?: MultiSelectGroup[];
|
|
27
|
+
}
|
|
28
|
+
declare const MultiSelectDropdown: React.FC<MultiSelectDropdownProps>;
|
|
29
|
+
export default MultiSelectDropdown;
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { useState, useRef, useEffect } from 'react';
|
|
23
|
+
import DropdownInput from '../../atoms/Inputs/DropdownInput/DropdownInput';
|
|
24
|
+
import Input from '../../atoms/Inputs/Input/Input';
|
|
25
|
+
import Checkbox from '../../atoms/Checkbox/Checkbox';
|
|
26
|
+
import SelectedValue from '../../atoms/SelectedValue/SelectedValue';
|
|
27
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
28
|
+
var MultiSelectDropdown = function (_a) {
|
|
29
|
+
var options = _a.options, selectedValues = _a.selectedValues, _b = _a.placeholder, placeholder = _b === void 0 ? 'Select items' : _b, onSelectionChange = _a.onSelectionChange, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.error, error = _d === void 0 ? false : _d, _e = _a.className, className = _e === void 0 ? '' : _e, _f = _a.maxDisplayedChips, maxDisplayedChips = _f === void 0 ? 3 : _f, _g = _a.selectedValueVariant, selectedValueVariant = _g === void 0 ? 'filled' : _g, _h = _a.searchable, searchable = _h === void 0 ? false : _h, _j = _a.searchPlaceholder, searchPlaceholder = _j === void 0 ? 'Search' : _j, groups = _a.groups;
|
|
30
|
+
var _k = useState(false), isOpen = _k[0], setIsOpen = _k[1];
|
|
31
|
+
var _l = useState(''), query = _l[0], setQuery = _l[1];
|
|
32
|
+
var dropdownRef = useRef(null);
|
|
33
|
+
// Close dropdown when clicking outside
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
var handleClickOutside = function (event) {
|
|
36
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
37
|
+
setIsOpen(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
41
|
+
return function () {
|
|
42
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
var handleToggleDropdown = function () {
|
|
46
|
+
if (!disabled) {
|
|
47
|
+
setIsOpen(!isOpen);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var handleOptionToggle = function (optionId) {
|
|
51
|
+
if (disabled)
|
|
52
|
+
return;
|
|
53
|
+
var isSelected = selectedValues.includes(optionId);
|
|
54
|
+
var newSelectedValues;
|
|
55
|
+
if (isSelected) {
|
|
56
|
+
newSelectedValues = selectedValues.filter(function (id) { return id !== optionId; });
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
newSelectedValues = __spreadArray(__spreadArray([], selectedValues, true), [optionId], false);
|
|
60
|
+
}
|
|
61
|
+
onSelectionChange(newSelectedValues);
|
|
62
|
+
};
|
|
63
|
+
var handleRemoveChip = function (optionId) {
|
|
64
|
+
if (disabled)
|
|
65
|
+
return;
|
|
66
|
+
var newSelectedValues = selectedValues.filter(function (id) { return id !== optionId; });
|
|
67
|
+
onSelectionChange(newSelectedValues);
|
|
68
|
+
};
|
|
69
|
+
var getSelectedOptions = function () {
|
|
70
|
+
return options.filter(function (option) { return selectedValues.includes(option.id); });
|
|
71
|
+
};
|
|
72
|
+
var getFilteredOptions = function () {
|
|
73
|
+
if (!searchable || query.trim() === '')
|
|
74
|
+
return options;
|
|
75
|
+
var q = query.toLowerCase();
|
|
76
|
+
return options.filter(function (o) { return o.label.toLowerCase().includes(q); });
|
|
77
|
+
};
|
|
78
|
+
var getDisplayedChips = function () {
|
|
79
|
+
var selectedOptions = getSelectedOptions();
|
|
80
|
+
return selectedOptions.slice(0, maxDisplayedChips);
|
|
81
|
+
};
|
|
82
|
+
var getHiddenCount = function () {
|
|
83
|
+
return Math.max(0, selectedValues.length - maxDisplayedChips);
|
|
84
|
+
};
|
|
85
|
+
var getDropdownState = function () {
|
|
86
|
+
if (disabled)
|
|
87
|
+
return 'disabled';
|
|
88
|
+
if (error)
|
|
89
|
+
return 'error';
|
|
90
|
+
if (selectedValues.length > 0)
|
|
91
|
+
return 'selected';
|
|
92
|
+
return 'default';
|
|
93
|
+
};
|
|
94
|
+
return (_jsxs("div", __assign({ ref: dropdownRef, className: "multiselect-dropdown ".concat(className) }, { children: [_jsxs("div", __assign({ className: "multiselect-dropdown__input-container" }, { children: [_jsx(DropdownInput, { placeholder: selectedValues.length === 0 ? placeholder : '', state: getDropdownState(), onClick: handleToggleDropdown, className: "multiselect-dropdown__input" }), selectedValues.length > 0 && (_jsxs("div", __assign({ className: "multiselect-dropdown__chips" }, { children: [getDisplayedChips().map(function (option) { return (_jsx(SelectedValue, { value: option.label, onRemove: function () { return handleRemoveChip(option.id); }, className: "multiselect-dropdown__chip", size: "xs", iconSize: "xs", variant: selectedValueVariant }, option.id)); }), getHiddenCount() > 0 && (_jsxs("div", __assign({ className: "multiselect-dropdown__hidden-count" }, { children: ["+", getHiddenCount()] })))] })))] })), isOpen && (_jsxs("div", __assign({ className: "multiselect-dropdown__panel" }, { children: [_jsxs("div", __assign({ className: "multiselect-dropdown__menu" }, { children: [searchable && (_jsx("div", __assign({ className: "multiselect-dropdown__search" }, { children: _jsx(Input, { placeholder: searchPlaceholder, value: query, onChange: function (e) { return setQuery(e.target.value); }, icon: "search", iconPosition: "trailing" }) }))), _jsx("div", __assign({ className: "multiselect-dropdown__options" }, { children: groups && groups.length > 0 ? (groups.map(function (group) { return (_jsxs("div", __assign({ className: "multiselect-dropdown__group" }, { children: [_jsxs("div", __assign({ className: "multiselect-dropdown__group-header" }, { children: [group.imageUrl && (_jsx("span", __assign({ className: "multiselect-dropdown__group-icon", "aria-hidden": "true" }, { children: _jsx("img", { src: group.imageUrl, alt: "" }) }))), _jsx(Text, __assign({ size: "sm", variant: "medium" }, { children: group.label }))] })), _jsx("div", __assign({ className: "multiselect-dropdown__group-options" }, { children: getFilteredOptions()
|
|
95
|
+
.filter(function (o) { return group.options.some(function (go) { return go.id === o.id; }); })
|
|
96
|
+
.map(function (option) { return (_jsx("div", __assign({ className: "multiselect-dropdown__option" }, { children: _jsx(Checkbox, { checked: selectedValues.includes(option.id), disabled: option.disabled || disabled, label: option.label, leadingContent: option.imageUrl ? (_jsx("span", __assign({ className: "multiselect-dropdown__option-icon", "aria-hidden": "true" }, { children: _jsx("img", { src: option.imageUrl, alt: "" }) }))) : undefined, onChange: function (checked) {
|
|
97
|
+
if (checked !== selectedValues.includes(option.id)) {
|
|
98
|
+
handleOptionToggle(option.id);
|
|
99
|
+
}
|
|
100
|
+
} }) }), option.id)); }) }))] }), group.id)); })) : (getFilteredOptions().map(function (option) { return (_jsx("div", __assign({ className: "multiselect-dropdown__option" }, { children: _jsx(Checkbox, { checked: selectedValues.includes(option.id), disabled: option.disabled || disabled, label: option.label, leadingContent: option.imageUrl ? (_jsx("span", __assign({ className: "multiselect-dropdown__option-icon", "aria-hidden": "true" }, { children: _jsx("img", { src: option.imageUrl, alt: "" }) }))) : undefined, onChange: function (checked) {
|
|
101
|
+
if (checked !== selectedValues.includes(option.id)) {
|
|
102
|
+
handleOptionToggle(option.id);
|
|
103
|
+
}
|
|
104
|
+
} }) }), option.id)); })) }))] })), _jsx("div", __assign({ className: "multiselect-dropdown__footer" }, { children: _jsxs(Text, __assign({ size: "sm", variant: "regular", leading: "5", className: "multiselect-dropdown__footer-text" }, { children: [selectedValues.length, " item selected"] })) }))] })))] })));
|
|
105
|
+
};
|
|
106
|
+
export default MultiSelectDropdown;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type User = {
|
|
3
|
+
name: string;
|
|
4
|
+
agency: string;
|
|
5
|
+
isAdmin: boolean;
|
|
6
|
+
};
|
|
7
|
+
type Agency = {
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
localisation: string;
|
|
11
|
+
};
|
|
12
|
+
export interface UserCardProps {
|
|
13
|
+
user: User;
|
|
14
|
+
agencies: Agency[];
|
|
15
|
+
onSelectAgency?: (agency: Agency) => void;
|
|
16
|
+
selectedAgency?: Agency;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const UserCard: React.FC<UserCardProps>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { useEffect, useMemo, useRef, useState } from "react";
|
|
14
|
+
import { Avatar } from "../../atoms/Avatar/Avatar";
|
|
15
|
+
export var UserCard = function (_a) {
|
|
16
|
+
var user = _a.user, agencies = _a.agencies, onSelectAgency = _a.onSelectAgency, selectedAgency = _a.selectedAgency, _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
17
|
+
var _c = useState(false), open = _c[0], setOpen = _c[1];
|
|
18
|
+
var _d = useState(""), query = _d[0], setQuery = _d[1];
|
|
19
|
+
var rootRef = useRef(null);
|
|
20
|
+
var searchRef = useRef(null);
|
|
21
|
+
// Close dropdown on outside click
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
if (!user.isAdmin || !open)
|
|
24
|
+
return;
|
|
25
|
+
var handleClickOutside = function (e) {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)))
|
|
28
|
+
setOpen(false);
|
|
29
|
+
};
|
|
30
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
31
|
+
return function () { return document.removeEventListener("mousedown", handleClickOutside); };
|
|
32
|
+
}, [open, user.isAdmin]);
|
|
33
|
+
// Auto-focus search input when dropdown opens
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
if (user.isAdmin && open)
|
|
36
|
+
setTimeout(function () { var _a; return (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 0);
|
|
37
|
+
}, [open, user.isAdmin]);
|
|
38
|
+
// Filter agencies based on query
|
|
39
|
+
var filteredAgencies = useMemo(function () {
|
|
40
|
+
var q = query.trim().toLowerCase();
|
|
41
|
+
if (!q)
|
|
42
|
+
return agencies;
|
|
43
|
+
return agencies.filter(function (a) {
|
|
44
|
+
return a.name.toLowerCase().includes(q) ||
|
|
45
|
+
a.localisation.toLowerCase().includes(q);
|
|
46
|
+
});
|
|
47
|
+
}, [agencies, query]);
|
|
48
|
+
var handleSelect = function (a) {
|
|
49
|
+
onSelectAgency === null || onSelectAgency === void 0 ? void 0 : onSelectAgency(a);
|
|
50
|
+
setOpen(false);
|
|
51
|
+
setQuery("");
|
|
52
|
+
};
|
|
53
|
+
return (_jsxs("div", __assign({ ref: rootRef, className: "relative inline-flex items-center gap-3 ".concat(className, " ").concat(user.isAdmin ? "cursor-pointer rounded-[11px] border border-[#D9D9D9] bg-white px-[13px] py-2" : "") }, { children: [_jsxs("div", __assign({ className: "flex items-center gap-3" }, { children: [_jsx(Avatar, { name: user.name, size: "md", shape: "circle" }), _jsxs("div", __assign({ className: "flex flex-col leading-tight" }, { children: [_jsxs("div", __assign({ className: "text-[13px] text-muted-foreground" }, { children: ["Welcome back,", " ", _jsx("span", __assign({ className: "font-medium text-foreground" }, { children: user.name })), " ", _jsx("span", __assign({ "aria-hidden": true }, { children: "\uD83D\uDC4B" }))] })), _jsx("div", __assign({ className: "text-[13px] font-semibold text-foreground" }, { children: selectedAgency ? selectedAgency.name : user.agency }))] }))] })), user.isAdmin && (_jsxs(_Fragment, { children: [_jsx("button", __assign({ type: "button", "aria-expanded": open, "aria-haspopup": "listbox", onClick: function () { return setOpen(function (v) { return !v; }); }, className: "inline-flex h-8 w-8 items-center justify-center rounded-lg bg-teal-600 text-white shadow-[0_2px_6px_rgba(0,0,0,0.15)] outline-none focus-visible:ring-2 focus-visible:ring-teal-300", title: "Open agency selector" }, { children: _jsx("svg", __assign({ width: "18", height: "18", viewBox: "0 0 24 24", "aria-hidden": "true", className: "transition-transform ".concat(open ? "rotate-180" : "") }, { children: _jsx("path", { d: "M6 9l6 6 6-6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) })), open && (_jsxs("div", __assign({ className: "absolute right-0 top-12 z-50 w-[340px] rounded-2xl border border-black/5 bg-white p-3 shadow-[0_12px_30px_rgba(0,0,0,0.15)]" }, { children: [_jsxs("div", __assign({ className: "relative mb-3" }, { children: [_jsx("input", { ref: searchRef, value: query, onChange: function (e) { return setQuery(e.target.value); }, placeholder: "Search", className: "w-full rounded-xl border border-black/10 bg-white px-10 py-2 text-sm outline-none focus:border-black/20 shadow-[inset_0_1px_2px_rgba(0,0,0,0.06)]" }), _jsx("div", __assign({ className: "absolute -translate-y-1/2 pointer-events-none left-3 top-1/2" }, { children: _jsx("svg", __assign({ width: "18", height: "18", viewBox: "0 0 24 24" }, { children: _jsx("path", { d: "M21 21l-4.3-4.3M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15z", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) })) }))] })), _jsxs("ul", __assign({ role: "listbox", className: "pr-1 overflow-auto max-h-64" }, { children: [filteredAgencies.map(function (a) {
|
|
54
|
+
var isActive = (selectedAgency === null || selectedAgency === void 0 ? void 0 : selectedAgency.id) === a.id;
|
|
55
|
+
return (_jsx("li", { children: _jsxs("button", __assign({ type: "button", onClick: function () { return handleSelect(a); }, className: "flex w-full items-center justify-between gap-3 rounded-lg px-2 py-2 text-left hover:bg-black/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-teal-300 ".concat(isActive ? "bg-black/[0.04]" : ""), "aria-selected": isActive, role: "option" }, { children: [_jsx("span", __assign({ className: "text-[14px]" }, { children: a.name })), _jsx("span", __assign({ className: "text-[13px] font-semibold" }, { children: a.localisation }))] })) }, a.id));
|
|
56
|
+
}), filteredAgencies.length === 0 && (_jsx("li", __assign({ className: "px-2 py-6 text-sm text-center text-muted-foreground" }, { children: "No results" })))] }))] })))] }))] })));
|
|
57
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type FooterLink = {
|
|
3
|
+
label: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
};
|
|
7
|
+
type FooterColumn = {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
links: FooterLink[];
|
|
11
|
+
};
|
|
12
|
+
type SocialLink = {
|
|
13
|
+
id: string;
|
|
14
|
+
icon: React.ReactNode;
|
|
15
|
+
label: string;
|
|
16
|
+
href: string;
|
|
17
|
+
};
|
|
18
|
+
type ContactBlock = {
|
|
19
|
+
title: string;
|
|
20
|
+
addressLines: string[];
|
|
21
|
+
phone?: string;
|
|
22
|
+
fax?: string;
|
|
23
|
+
email?: string;
|
|
24
|
+
};
|
|
25
|
+
export interface FooterProps {
|
|
26
|
+
logo?: React.ReactNode;
|
|
27
|
+
columns?: FooterColumn[];
|
|
28
|
+
contact?: ContactBlock;
|
|
29
|
+
socials?: SocialLink[];
|
|
30
|
+
className?: string;
|
|
31
|
+
homeUrl?: string;
|
|
32
|
+
onLinkClick?: (link: {
|
|
33
|
+
label: string;
|
|
34
|
+
route: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare const Footer: React.FC<FooterProps>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
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 } from "react";
|
|
14
|
+
import { Text } from "../../atoms/Typography/Typography";
|
|
15
|
+
import { Link } from "../../atoms/Link/Link";
|
|
16
|
+
import Icon from "../../atoms/Icon/Icon";
|
|
17
|
+
export var Footer = function (_a) {
|
|
18
|
+
var _b;
|
|
19
|
+
var logo = _a.logo, _c = _a.columns, columns = _c === void 0 ? defaultColumns : _c, _d = _a.contact, contact = _d === void 0 ? defaultContact : _d, _e = _a.socials, socials = _e === void 0 ? defaultSocials : _e, _f = _a.className, className = _f === void 0 ? "" : _f, homeUrl = _a.homeUrl, onLinkClick = _a.onLinkClick;
|
|
20
|
+
var _g = useState((_b = columns[0]) === null || _b === void 0 ? void 0 : _b.id), openSection = _g[0], setOpenSection = _g[1];
|
|
21
|
+
var toggleSection = function (id) {
|
|
22
|
+
setOpenSection(function (prev) { return (prev === id ? null : id); });
|
|
23
|
+
};
|
|
24
|
+
var year = new Date().getFullYear();
|
|
25
|
+
return (_jsx("footer", __assign({ className: "footer" }, { children: _jsxs("div", __assign({ className: "footer__wrapper" }, { children: [_jsxs("div", __assign({ className: "footer__desktop" }, { children: [_jsxs("div", __assign({ className: "footer__top-row" }, { children: [_jsxs("div", __assign({ className: "footer__content-left" }, { children: [columns.map(function (col) { return (_jsxs("div", __assign({ className: "footer__column" }, { children: [_jsx(Text, __assign({ as: "h4", className: "footer__column-title" }, { children: col.title })), _jsx("div", __assign({ className: "footer__column-links" }, { children: col.links.map(function (link) { return (_jsx(Link, __assign({ href: link.href, onClick: link.onClick, theme: "dark", className: "text-xs no-underline hover:opacity-80" }, { children: link.label }), link.label)); }) }))] }), col.id)); }), _jsxs("div", __assign({ className: "footer__contact" }, { children: [_jsx(Text, __assign({ as: "h4", className: "footer__column-title" }, { children: contact.title })), _jsxs("div", __assign({ className: "footer__contact-info" }, { children: [contact.addressLines.map(function (line) { return (_jsx("p", { children: line }, line)); }), contact.phone && _jsxs("p", { children: ["Tel: ", contact.phone] }), contact.fax && _jsxs("p", { children: ["Fax: ", contact.fax] }), contact.email && (_jsx(Link, __assign({ href: "mailto:".concat(contact.email), theme: "dark", className: "text-xs no-underline" }, { children: contact.email })))] }))] })), _jsxs("div", __assign({ className: "footer__socials" }, { children: [_jsx(Text, __assign({ as: "h4", className: "footer__column-title" }, { children: "Socials" })), _jsx("div", __assign({ className: "footer__socials-icons" }, { children: socials.map(function (s) { return (_jsx("a", __assign({ href: s.href, "aria-label": s.label, className: "footer__social-link" }, { children: s.icon }), s.id)); }) }))] }))] })), logo && (_jsx("div", __assign({ className: "footer__logo-section" }, { children: _jsxs("div", __assign({ className: "footer__logo-container" }, { children: [_jsx("a", __assign({ href: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/", onClick: function (e) {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick({ label: "Home", route: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/" });
|
|
28
|
+
} }, { children: logo })), _jsxs(Text, __assign({ as: "p", className: "footer__copyright" }, { children: ["\u00A9 ", year, " Mautourco, All Rights Reserved"] }))] })) })))] })), !logo && (_jsxs(Text, __assign({ as: "p", className: "footer__copyright-standalone" }, { children: ["\u00A9 ", year, " Mautourco, All Rights Reserved"] })))] })), _jsxs("div", __assign({ className: "footer__mobile" }, { children: [columns.map(function (col) { return (_jsxs("div", __assign({ className: "footer__mobile-section" }, { children: [_jsxs("button", __assign({ type: "button", onClick: function () { return toggleSection(col.id); }, className: "footer__mobile-section-button" }, { children: [_jsx("span", { children: col.title }), _jsx("span", __assign({ className: "footer__mobile-section-icon ".concat(openSection === col.id ? "footer__mobile-section-icon--rotated" : "") }, { children: _jsx(Icon, { name: "chevron-down", size: "sm", color: "white" }) }))] })), openSection === col.id && (_jsx("div", __assign({ className: "footer__mobile-section-content" }, { children: col.links.map(function (link) { return (_jsx(Link, __assign({ href: link.href, onClick: link.onClick, theme: "dark", className: "text-xs no-underline" }, { children: link.label }), link.label)); }) })))] }), col.id)); }), _jsxs("div", __assign({ className: "footer__mobile-contact" }, { children: [_jsx(Text, __assign({ as: "h4", className: "footer__mobile-contact-title" }, { children: contact.title })), _jsxs("div", __assign({ className: "footer__mobile-contact-info" }, { children: [contact.addressLines.map(function (line) { return (_jsx("p", { children: line }, line)); }), contact.phone && _jsxs("p", { children: ["Tel: ", contact.phone] }), contact.fax && _jsxs("p", { children: ["Fax: ", contact.fax] }), contact.email && (_jsx(Link, __assign({ href: "mailto:".concat(contact.email), theme: "dark", className: "text-xs no-underline" }, { children: contact.email })))] }))] })), _jsxs("div", __assign({ className: "footer__mobile-footer" }, { children: [_jsx("a", __assign({ href: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/", onClick: function (e) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick({ label: "Home", route: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/" });
|
|
31
|
+
} }, { children: logo })), _jsxs(Text, __assign({ as: "p", className: "footer__mobile-copyright" }, { children: ["\u00A9 ", year, " Mautourco, All Rights Reserved"] }))] }))] }))] })) })));
|
|
32
|
+
};
|
|
33
|
+
var defaultColumns = [
|
|
34
|
+
{
|
|
35
|
+
id: "menu-1",
|
|
36
|
+
title: "Menu Title",
|
|
37
|
+
links: [
|
|
38
|
+
{ label: "Menu Item", href: "#" },
|
|
39
|
+
{ label: "Menu Item", href: "#" },
|
|
40
|
+
{ label: "Menu Item", href: "#" },
|
|
41
|
+
{ label: "Menu Item", href: "#" },
|
|
42
|
+
{ label: "Menu Item", href: "#" },
|
|
43
|
+
{ label: "Menu Item", href: "#" },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "menu-2",
|
|
48
|
+
title: "Menu Title",
|
|
49
|
+
links: [
|
|
50
|
+
{ label: "Menu Item", href: "#" },
|
|
51
|
+
{ label: "Menu Item", href: "#" },
|
|
52
|
+
{ label: "Menu Item", href: "#" },
|
|
53
|
+
{ label: "Menu Item", href: "#" },
|
|
54
|
+
{ label: "Menu Item", href: "#" },
|
|
55
|
+
{ label: "Menu Item", href: "#" },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
var defaultContact = {
|
|
60
|
+
title: "Contact Us",
|
|
61
|
+
addressLines: [
|
|
62
|
+
"84, Gustave Colin Street,",
|
|
63
|
+
"Forest Side 74414, Mauritius",
|
|
64
|
+
],
|
|
65
|
+
phone: "+ (230) 604 3000",
|
|
66
|
+
fax: "+ (230) 674 3720",
|
|
67
|
+
email: "info@mautourco.com",
|
|
68
|
+
};
|
|
69
|
+
var defaultSocials = [
|
|
70
|
+
{ id: "fb", label: "Facebook", href: "#", icon: _jsx("span", { children: "\uF09A" }) },
|
|
71
|
+
{ id: "ig", label: "Instagram", href: "#", icon: _jsx("span", { children: "\uF16D" }) },
|
|
72
|
+
{ id: "in", label: "LinkedIn", href: "#", icon: _jsx("span", { children: "\uF0E1" }) },
|
|
73
|
+
{ id: "yt", label: "YouTube", href: "#", icon: _jsx("span", { children: "\uF167" }) },
|
|
74
|
+
];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Link = {
|
|
3
|
+
label: string;
|
|
4
|
+
route: string;
|
|
5
|
+
isButton?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type User = {
|
|
9
|
+
name: string;
|
|
10
|
+
agency: string;
|
|
11
|
+
isAdmin: boolean;
|
|
12
|
+
};
|
|
13
|
+
type Agency = {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
localisation: string;
|
|
17
|
+
};
|
|
18
|
+
export interface DesktopNavProps {
|
|
19
|
+
links: Link[];
|
|
20
|
+
onLinkClick?: (link: Link) => void;
|
|
21
|
+
onLogin?: () => void;
|
|
22
|
+
onLogout?: () => void;
|
|
23
|
+
user?: User;
|
|
24
|
+
active?: string;
|
|
25
|
+
logoUrl: string | React.FC<React.SVGProps<SVGSVGElement>>;
|
|
26
|
+
homeUrl?: string;
|
|
27
|
+
selectedAgency?: Agency;
|
|
28
|
+
onAgencyChange?: (agency: Agency) => void;
|
|
29
|
+
agencies?: Agency[];
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const DesktopNav: React.FC<DesktopNavProps>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Button from "../../atoms/Button/Button";
|
|
14
|
+
import { UserCard } from "../../molecules/UserCard/UserCard";
|
|
15
|
+
export var DesktopNav = function (_a) {
|
|
16
|
+
var links = _a.links, onLinkClick = _a.onLinkClick, onLogin = _a.onLogin, onLogout = _a.onLogout, user = _a.user, active = _a.active, logoUrl = _a.logoUrl, homeUrl = _a.homeUrl, selectedAgency = _a.selectedAgency, onAgencyChange = _a.onAgencyChange, agencies = _a.agencies, _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
17
|
+
var Logo = typeof logoUrl === "function" ? logoUrl : null;
|
|
18
|
+
var handleLogoClick = function (e) {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick({ label: "Home", route: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/" });
|
|
21
|
+
};
|
|
22
|
+
return (_jsxs("header", __assign({ className: "header" }, { children: [_jsx("div", __assign({ className: "header-logo" }, { children: _jsx("a", __assign({ href: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/", onClick: handleLogoClick, className: "header-logo__link" }, { children: Logo ? (_jsx(Logo, { className: "header-logo__image" })) : (_jsx("img", { src: logoUrl, alt: "Mautourco", className: "header-logo__image", draggable: false })) })) })), _jsxs("nav", __assign({ className: "header-nav" }, { children: [_jsx("ul", __assign({ className: "header-nav__items" }, { children: links === null || links === void 0 ? void 0 : links.map(function (it) {
|
|
23
|
+
var isActive = it.label === active;
|
|
24
|
+
return (_jsx("li", __assign({ className: "header__item ".concat(isActive ? "header__item--active" : "") }, { children: _jsx("a", __assign({ href: it.route, className: "header__item__link" }, { children: it.isButton ? (_jsx(Button, __assign({ size: "sm", variant: "outline-secondary" }, { children: it.label }))) : (_jsx(_Fragment, { children: it.label })) })) }), it.label));
|
|
25
|
+
}) })), _jsx("div", __assign({ className: "header-nav__user-section ".concat(user ? "header-nav__user-connected-section" : "") }, { children: user ? (_jsx("div", __assign({ className: "header-nav__user-container" }, { children: _jsx(UserCard, { user: user, agencies: agencies || [], selectedAgency: selectedAgency, onSelectAgency: onAgencyChange }) }))) : (_jsx(Button, __assign({ size: "sm", variant: "secondary", onClick: onLogin }, { children: "Login" }))) }))] }))] })));
|
|
26
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Link = {
|
|
3
|
+
label: string;
|
|
4
|
+
route: string;
|
|
5
|
+
isButton?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type User = {
|
|
9
|
+
name: string;
|
|
10
|
+
agency: string;
|
|
11
|
+
isAdmin: boolean;
|
|
12
|
+
};
|
|
13
|
+
type Agency = {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
localisation: string;
|
|
17
|
+
};
|
|
18
|
+
export interface MobileNavProps {
|
|
19
|
+
links: Link[];
|
|
20
|
+
onLinkClick?: (link: Link) => void;
|
|
21
|
+
onLogin?: () => void;
|
|
22
|
+
onLogout?: () => void;
|
|
23
|
+
user?: User;
|
|
24
|
+
active?: string;
|
|
25
|
+
logoUrl: string | React.FC<React.SVGProps<SVGSVGElement>>;
|
|
26
|
+
selectedAgency?: Agency;
|
|
27
|
+
onAgencyChange?: (agency: Agency) => void;
|
|
28
|
+
agencies?: Agency[];
|
|
29
|
+
homeUrl?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const MobileNav: React.FC<MobileNavProps>;
|
|
32
|
+
export default MobileNav;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 React from "react";
|
|
14
|
+
import Icon from "../../atoms/Icon/Icon";
|
|
15
|
+
import Button from "../../atoms/Button/Button";
|
|
16
|
+
import { UserCard } from "../../molecules/UserCard/UserCard";
|
|
17
|
+
export var MobileNav = function (_a) {
|
|
18
|
+
var links = _a.links, onLinkClick = _a.onLinkClick, onLogin = _a.onLogin, onLogout = _a.onLogout, user = _a.user, active = _a.active, logoUrl = _a.logoUrl, selectedAgency = _a.selectedAgency, onAgencyChange = _a.onAgencyChange, agencies = _a.agencies, homeUrl = _a.homeUrl;
|
|
19
|
+
var _b = React.useState(false), open = _b[0], setOpen = _b[1];
|
|
20
|
+
var closeRef = React.useRef(null);
|
|
21
|
+
var Logo = typeof logoUrl === "function" ? logoUrl : null;
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsxs("header", __assign({ className: "header" }, { children: [_jsx("button", __assign({ "aria-label": "Open Menu", onClick: function () { return setOpen(true); } }, { children: _jsx(Icon, { name: "menu", size: "sm" }) })), _jsx("div", __assign({ className: "header-logo" }, { children: _jsx("a", __assign({ href: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/", className: "header-logo__link", onClick: function (e) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick({ label: "Home", route: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/" });
|
|
25
|
+
} }, { children: Logo ? (_jsx(Logo, { className: "header-logo__image" })) : (_jsx("img", { src: logoUrl, alt: "Mautourco", className: "header-logo__image", draggable: false })) })) })), _jsx("div", __assign({ className: "header-user-actions" }, { children: !user && (_jsx(Button, __assign({ size: "sm", variant: "secondary", onClick: function () {
|
|
26
|
+
onLogin === null || onLogin === void 0 ? void 0 : onLogin();
|
|
27
|
+
setOpen(false);
|
|
28
|
+
} }, { children: "Login" }))) }))] })), _jsx("div", { "aria-hidden": !open, className: "mobile-nav__backdrop ".concat(open ? "mobile-nav__backdrop--open" : "mobile-nav__backdrop--closed"), onClick: function () { return setOpen(false); } }), _jsxs("aside", __assign({ role: "dialog", "aria-modal": "true", "aria-label": "Main menu", className: "\n mobile-nav__sheet\n ".concat(open ? "mobile-nav__sheet--open" : "mobile-nav__sheet--closed", "\n ") }, { children: [_jsxs("div", __assign({ className: "mobile-nav__header" }, { children: [_jsx("div", { children: _jsx("button", __assign({ ref: closeRef, "aria-label": "Close menu", onClick: function () { return setOpen(false); }, className: "mobile-nav__close-button" }, { children: _jsx(Icon, { name: "close", size: "sm" }) })) }), user ? (_jsx(UserCard, { user: user, agencies: agencies || [], selectedAgency: selectedAgency, onSelectAgency: onAgencyChange })) : (_jsx("a", __assign({ href: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/", className: "header-logo__link", onClick: function (e) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick({ label: "Home", route: homeUrl !== null && homeUrl !== void 0 ? homeUrl : "/" });
|
|
31
|
+
} }, { children: Logo ? (_jsx(Logo, { className: "header-logo__image-mobile" })) : (_jsx("img", { src: logoUrl, alt: "Mautourco", className: "header-logo__image-mobile", draggable: false })) })))] })), _jsx("nav", __assign({ className: "mobile-nav__content" }, { children: _jsx("ul", __assign({ className: "mobile-nav__list" }, { children: links.map(function (l, i) {
|
|
32
|
+
var activeItem = active && active === l.label;
|
|
33
|
+
return (_jsx("li", __assign({ className: "header__item ".concat(activeItem ? "header__item--active" : "") }, { children: _jsx("button", __assign({ disabled: l.disabled, onClick: function () {
|
|
34
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick(l);
|
|
35
|
+
setOpen(false);
|
|
36
|
+
}, className: "mobile-nav__item-button" }, { children: l.label })) }), "".concat(l.route, "-").concat(i)));
|
|
37
|
+
}) })) })), _jsx("div", __assign({ className: "mobile-nav__footer" }, { children: user ? (_jsx("div", __assign({ className: "mobile-nav__user-info" }, { children: _jsx(Button, __assign({ onClick: function () {
|
|
38
|
+
onLogout === null || onLogout === void 0 ? void 0 : onLogout();
|
|
39
|
+
setOpen(false);
|
|
40
|
+
}, className: "mobile-nav__logout-button" }, { children: "Logout" })) }))) : (_jsx(Button, __assign({ size: "sm", variant: "secondary", onClick: function () {
|
|
41
|
+
onLogin === null || onLogin === void 0 ? void 0 : onLogin();
|
|
42
|
+
setOpen(false);
|
|
43
|
+
} }, { children: "Login" }))) }))] }))] }));
|
|
44
|
+
};
|
|
45
|
+
export default MobileNav;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Link = {
|
|
3
|
+
label: string;
|
|
4
|
+
route: string;
|
|
5
|
+
isButton?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type User = {
|
|
9
|
+
name: string;
|
|
10
|
+
agency: string;
|
|
11
|
+
isAdmin: boolean;
|
|
12
|
+
};
|
|
13
|
+
type Agency = {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
localisation: string;
|
|
17
|
+
};
|
|
18
|
+
export interface TopNavigationProps {
|
|
19
|
+
links: Link[];
|
|
20
|
+
onLinkClick?: (link: Link) => void;
|
|
21
|
+
onLogin?: () => void;
|
|
22
|
+
onLogout?: () => void;
|
|
23
|
+
user?: User;
|
|
24
|
+
active?: string;
|
|
25
|
+
logoUrl: string | React.FC<React.SVGProps<SVGSVGElement>>;
|
|
26
|
+
homeUrl?: string;
|
|
27
|
+
selectedAgency?: Agency;
|
|
28
|
+
onAgencyChange?: (agency: Agency) => void;
|
|
29
|
+
agencies?: Agency[];
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const TopNavigation: React.FC<TopNavigationProps>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { useMobile } from "../../../hooks/useMobile";
|
|
14
|
+
import MobileNav from "./MobileNav";
|
|
15
|
+
import { DesktopNav } from "./DesktopNav";
|
|
16
|
+
export var TopNavigation = function (props) {
|
|
17
|
+
var _a = useMobile(), isMobile = _a.isMobile, isTablet = _a.isTablet;
|
|
18
|
+
var isSmallScreen = isMobile || isTablet;
|
|
19
|
+
return isSmallScreen ? _jsx(MobileNav, __assign({}, props)) : _jsx(DesktopNav, __assign({}, props));
|
|
20
|
+
};
|