mautourco-components 0.2.49 → 0.2.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/organisms/QuoteHeader/QuoteHeader.d.ts +1 -0
- package/dist/components/organisms/QuoteHeader/QuoteHeader.js +5 -5
- package/dist/components/organisms/Table/columns/booking-columns.js +1 -1
- package/dist/components/organisms/Table/columns/quotation-columns.js +1 -1
- package/package.json +4 -4
- package/src/components/organisms/QuoteHeader/QuoteHeader.tsx +4 -1
- package/src/components/organisms/Table/columns/booking-columns.tsx +4 -2
- package/src/components/organisms/Table/columns/quotation-columns.tsx +8 -6
|
@@ -9,5 +9,6 @@ export interface QuoteHeaderProps {
|
|
|
9
9
|
onNewQuote: () => void;
|
|
10
10
|
onFilterChange?: (filter: FilterType, value: string) => void;
|
|
11
11
|
currentFilter?: Record<FilterType, string>;
|
|
12
|
+
filters?: Record<string, any>;
|
|
12
13
|
}
|
|
13
14
|
export declare function QuoteHeader(props: QuoteHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -45,14 +45,14 @@ var filterConfig = {
|
|
|
45
45
|
};
|
|
46
46
|
export function QuoteHeader(props) {
|
|
47
47
|
var _a;
|
|
48
|
-
var _b = props.current, current = _b === void 0 ? 'quotation' : _b, currentFilter = props.currentFilter, onNavigate = props.onNavigate, onNewQuote = props.onNewQuote, onFilterChange = props.onFilterChange;
|
|
49
|
-
var
|
|
48
|
+
var _b = props.current, current = _b === void 0 ? 'quotation' : _b, currentFilter = props.currentFilter, onNavigate = props.onNavigate, onNewQuote = props.onNewQuote, onFilterChange = props.onFilterChange, _c = props.filters, filters = _c === void 0 ? filterConfig : _c;
|
|
49
|
+
var _d = useState(currentFilter || {
|
|
50
50
|
date: '',
|
|
51
51
|
clientType: '',
|
|
52
52
|
fileStatus: '',
|
|
53
53
|
search: '',
|
|
54
|
-
}), currentValue =
|
|
55
|
-
var
|
|
54
|
+
}), currentValue = _d[0], setCurrentValue = _d[1];
|
|
55
|
+
var _e = useState((_a = currentFilter === null || currentFilter === void 0 ? void 0 : currentFilter.search) !== null && _a !== void 0 ? _a : ''), searchValue = _e[0], setSearchValue = _e[1];
|
|
56
56
|
// Create a ref to store the debounced function
|
|
57
57
|
var debouncedFilterChangeRef = useRef(debounce(function (value) {
|
|
58
58
|
onFilterChange === null || onFilterChange === void 0 ? void 0 : onFilterChange('search', value);
|
|
@@ -92,7 +92,7 @@ export function QuoteHeader(props) {
|
|
|
92
92
|
setSearchValue('');
|
|
93
93
|
}
|
|
94
94
|
}, [currentFilter]);
|
|
95
|
-
return (_jsxs("div", { className: "quote-header", children: [_jsx(Heading, { level: 4, as: "h1", className: "quote-header__title", color: "accent", children: "Quotation & Booking" }), _jsxs("div", { className: "flex gap-4", children: [_jsx(Button, { variant: current === 'quotation' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('quotation'); }, children: "Quotation" }), _jsx(Button, { variant: current === 'booking' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('booking'); }, children: "Booking" })] }), _jsxs("div", { className: "quote-header__search-container", children: [_jsx(Input, { placeholder: "Search", icon: "search", iconPosition: "leading", className: "quote-header__search", value: searchValue, onChange: handleInputChange }), _jsx(Button, { variant: "primary", leadingIcon: "plus-circle", iconSize: "md", size: "sm", onClick: onNewQuote, children: "New quote" })] }), _jsx("div", { className: "quote-header__filters", children: Object.entries(
|
|
95
|
+
return (_jsxs("div", { className: "quote-header", children: [_jsx(Heading, { level: 4, as: "h1", className: "quote-header__title", color: "accent", children: "Quotation & Booking" }), _jsxs("div", { className: "flex gap-4", children: [_jsx(Button, { variant: current === 'quotation' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('quotation'); }, children: "Quotation" }), _jsx(Button, { variant: current === 'booking' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('booking'); }, children: "Booking" })] }), _jsxs("div", { className: "quote-header__search-container", children: [_jsx(Input, { placeholder: "Search", icon: "search", iconPosition: "leading", className: "quote-header__search", value: searchValue, onChange: handleInputChange }), _jsx(Button, { variant: "primary", leadingIcon: "plus-circle", iconSize: "md", size: "sm", onClick: onNewQuote, children: "New quote" })] }), _jsx("div", { className: "quote-header__filters", children: Object.entries(filters).map(function (_a) {
|
|
96
96
|
var key = _a[0], value = _a[1];
|
|
97
97
|
return (_jsx(DropdownInput, { placeholder: value.placeholder, options: value.options, value: currentValue[key], onSelect: function (value) {
|
|
98
98
|
var _a;
|
|
@@ -89,7 +89,7 @@ export var bookingColumns = function (_a) {
|
|
|
89
89
|
var _a;
|
|
90
90
|
var handleAction = (_a = onAction === null || onAction === void 0 ? void 0 : onAction(raw)) !== null && _a !== void 0 ? _a : (function () { });
|
|
91
91
|
var actionData = actionDropdownData(handleAction);
|
|
92
|
-
return (_jsxs("div", { className: "flex items-center justify-between gap-x-
|
|
92
|
+
return (_jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [renderStatusContent(raw.status), _jsx("div", { children: _jsx(ActionDropdown, { data: actionData }) })] }));
|
|
93
93
|
},
|
|
94
94
|
},
|
|
95
95
|
];
|
|
@@ -88,7 +88,7 @@ export var quotationColumns = function (_a) {
|
|
|
88
88
|
var isExpanded = (_a = raw.children) === null || _a === void 0 ? void 0 : _a.some(function (child) { return child.visible; });
|
|
89
89
|
var buttonLabel = isExpanded ? 'See less' : 'See more';
|
|
90
90
|
var isOnRequest = raw.status.toLowerCase() === 'on request';
|
|
91
|
-
return (_jsx("div", { children: hasChildren ? (_jsx(Button, { variant: "outline-primary", size: "sm", trailingIcon: "chevron-down", className: cn('table__button', isExpanded && 'table__button-expanded'), onClick: function () { return onExpand === null || onExpand === void 0 ? void 0 : onExpand(raw, index, childIndex); }, children: buttonLabel })) : (_jsxs("div", { className: "flex items-center gap-x-8", children: [_jsx(Button, { variant: isOnRequest ? 'outline-secondary' : 'secondary', size: "sm", className: "table__button", children: isOnRequest ? 'Request to book' : 'Book now' }), _jsx(ActionDropdown, { data: actionDropdownData((_b = onAction === null || onAction === void 0 ? void 0 : onAction({ isChild: childIndex !== undefined, quote: raw })) !== null && _b !== void 0 ? _b : (function () { })) })] })) }));
|
|
91
|
+
return (_jsx("div", { children: hasChildren ? (_jsx(Button, { variant: "outline-primary", size: "sm", trailingIcon: "chevron-down", className: cn('table__button', isExpanded && 'table__button-expanded'), onClick: function () { return onExpand === null || onExpand === void 0 ? void 0 : onExpand(raw, index, childIndex); }, children: buttonLabel })) : (_jsxs("div", { className: "flex items-center gap-x-8", children: [_jsx(Button, { variant: isOnRequest ? 'outline-secondary' : 'secondary', size: "sm", className: "table__button", children: isOnRequest ? 'Request to book' : 'Book now' }), _jsx("div", { children: _jsx(ActionDropdown, { data: actionDropdownData((_b = onAction === null || onAction === void 0 ? void 0 : onAction({ isChild: childIndex !== undefined, quote: raw })) !== null && _b !== void 0 ? _b : (function () { })) }) })] })) }));
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
94
|
];
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mautourco-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "Bibliothèque de composants
|
|
5
|
+
"description": "Bibliothèque de composants Mautourco pour le redesign",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"engines": {
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
],
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "https://github.com/Mautourco-mauritius/design_system.git"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"react",
|
|
23
23
|
"components",
|
|
24
24
|
"design-system",
|
|
25
|
-
"
|
|
25
|
+
"mautourco"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hookform/resolvers": "^5.2.2",
|
|
@@ -26,6 +26,8 @@ export interface QuoteHeaderProps {
|
|
|
26
26
|
onFilterChange?: (filter: FilterType, value: string) => void;
|
|
27
27
|
|
|
28
28
|
currentFilter?: Record<FilterType, string>;
|
|
29
|
+
|
|
30
|
+
filters?: Record<string, any>;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
const filterConfig = {
|
|
@@ -50,6 +52,7 @@ export function QuoteHeader(props: QuoteHeaderProps) {
|
|
|
50
52
|
onNavigate,
|
|
51
53
|
onNewQuote,
|
|
52
54
|
onFilterChange,
|
|
55
|
+
filters = filterConfig,
|
|
53
56
|
} = props;
|
|
54
57
|
const [currentValue, setCurrentValue] = useState<Record<FilterType, string>>(
|
|
55
58
|
currentFilter || {
|
|
@@ -144,7 +147,7 @@ export function QuoteHeader(props: QuoteHeaderProps) {
|
|
|
144
147
|
</Button>
|
|
145
148
|
</div>
|
|
146
149
|
<div className="quote-header__filters">
|
|
147
|
-
{Object.entries(
|
|
150
|
+
{Object.entries(filters).map(([key, value]) => (
|
|
148
151
|
<DropdownInput
|
|
149
152
|
key={key}
|
|
150
153
|
placeholder={value.placeholder}
|
|
@@ -138,9 +138,11 @@ export const bookingColumns: (params: {
|
|
|
138
138
|
const actionData = actionDropdownData(handleAction);
|
|
139
139
|
|
|
140
140
|
return (
|
|
141
|
-
<div className="flex items-center justify-between gap-x-
|
|
141
|
+
<div className="flex items-center justify-between gap-x-2">
|
|
142
142
|
{renderStatusContent(raw.status)}
|
|
143
|
-
<
|
|
143
|
+
<div>
|
|
144
|
+
<ActionDropdown data={actionData} />
|
|
145
|
+
</div>
|
|
144
146
|
</div>
|
|
145
147
|
);
|
|
146
148
|
},
|
|
@@ -171,12 +171,14 @@ export const quotationColumns: (params: {
|
|
|
171
171
|
className="table__button">
|
|
172
172
|
{isOnRequest ? 'Request to book' : 'Book now'}
|
|
173
173
|
</Button>
|
|
174
|
-
<
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
(
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
<div>
|
|
175
|
+
<ActionDropdown
|
|
176
|
+
data={actionDropdownData(
|
|
177
|
+
onAction?.({ isChild: childIndex !== undefined, quote: raw }) ??
|
|
178
|
+
(() => {})
|
|
179
|
+
)}
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
180
182
|
</div>
|
|
181
183
|
)}
|
|
182
184
|
</div>
|