mautourco-components 0.2.65 → 0.2.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/molecules/TooltipDisplay/TooltipDisplay.js +1 -1
- package/dist/components/organisms/Table/columns/index.d.ts +1 -0
- package/dist/components/organisms/Table/columns/quotation-columns.d.ts +1 -0
- package/dist/components/organisms/Table/columns/quotation-columns.js +9 -4
- package/package.json +1 -1
- package/src/components/molecules/TooltipDisplay/TooltipDisplay.tsx +1 -1
- package/src/components/organisms/Table/columns/quotation-columns.tsx +35 -9
|
@@ -3,5 +3,5 @@ import { Text } from '../../atoms/Typography/Typography';
|
|
|
3
3
|
import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip';
|
|
4
4
|
export function TooltipDisplay(props) {
|
|
5
5
|
var children = props.children, content = props.content, _a = props.side, side = _a === void 0 ? 'right' : _a, _b = props.maxWidth, maxWidth = _b === void 0 ? '300px' : _b;
|
|
6
|
-
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: "text-[var(--color-icon-branded)]",
|
|
6
|
+
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: "text-[var(--color-icon-branded)]", children: children }), _jsx(TooltipContent, { className: "max-w-[".concat(maxWidth, "]"), side: side, style: { maxWidth: maxWidth }, children: _jsx(Text, { variant: "medium", size: "sm", className: "!text-white", children: content }) })] }));
|
|
7
7
|
}
|
|
@@ -5,6 +5,7 @@ declare const columns: {
|
|
|
5
5
|
isChild?: boolean;
|
|
6
6
|
quote: import("../../../..").QuotationListItem;
|
|
7
7
|
}) => (action: import("../../../..").ActionDropdownType) => void;
|
|
8
|
+
onBookNow?: (type: "request" | "book", value?: import("../../../..").QuotationListItem) => void;
|
|
8
9
|
keywords?: string;
|
|
9
10
|
}) => import("../TableCell").ColumnType<import("../../../..").QuotationListItem>[];
|
|
10
11
|
detailResume: (params?: {
|
|
@@ -7,5 +7,6 @@ export declare const quotationColumns: (params: {
|
|
|
7
7
|
isChild?: boolean;
|
|
8
8
|
quote: QuotationListItem;
|
|
9
9
|
}) => (action: ActionDropdownType) => void;
|
|
10
|
+
onBookNow?: (type: 'request' | 'book', value?: QuotationListItem) => void;
|
|
10
11
|
keywords?: string;
|
|
11
12
|
}) => ColumnType<QuotationListItem>[];
|
|
@@ -4,10 +4,11 @@ import Chip from '../../../atoms/Chip/Chip';
|
|
|
4
4
|
import { Text } from '../../../atoms/Typography/Typography';
|
|
5
5
|
import { ActionDropdown } from '../../../molecules/ActionDropdown/ActionDropdown';
|
|
6
6
|
import { DateDisplay } from '../../../molecules/DateDisplay/DateDisplay';
|
|
7
|
+
import { TooltipDisplay } from '../../../molecules/TooltipDisplay/TooltipDisplay';
|
|
7
8
|
import { cn } from '../../../../lib/utils';
|
|
8
9
|
import { actionDropdownData, chipVariant, clientTypeMap } from '../constant';
|
|
9
10
|
export var quotationColumns = function (_a) {
|
|
10
|
-
var onExpand = _a.onExpand, onAction = _a.onAction, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
|
|
11
|
+
var onExpand = _a.onExpand, onAction = _a.onAction, onBookNow = _a.onBookNow, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
|
|
11
12
|
return [
|
|
12
13
|
{
|
|
13
14
|
header: 'Quote nb.',
|
|
@@ -92,9 +93,13 @@ export var quotationColumns = function (_a) {
|
|
|
92
93
|
if (raw.date[0]) {
|
|
93
94
|
isPast = new Date(raw.date[0]) < new Date();
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
var buttonType = isOnRequest ? 'request' : 'book';
|
|
97
|
+
var getButton = function () {
|
|
98
|
+
return (_jsx(Button, { variant: isOnRequest ? 'outline-secondary' : 'secondary', size: "sm", onClick: isPast ? undefined : function () { return onBookNow === null || onBookNow === void 0 ? void 0 : onBookNow(buttonType, raw); }, className: cn('table__button', {
|
|
99
|
+
'opacity-50 !cursor-not-allowed': isPast,
|
|
100
|
+
}), children: isOnRequest ? 'Request to book' : 'Book now' }));
|
|
101
|
+
};
|
|
102
|
+
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: [isPast ? (_jsx(TooltipDisplay, { content: "This quotation cannot be booked because the service dates have already passed.", side: "left", maxWidth: "325px", children: getButton() })) : (getButton()), _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 () { })) }) })] })) }));
|
|
98
103
|
},
|
|
99
104
|
},
|
|
100
105
|
];
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ export function TooltipDisplay(props: TooltipDisplayProps) {
|
|
|
21
21
|
const { children, content, side = 'right', maxWidth = '300px' } = props;
|
|
22
22
|
return (
|
|
23
23
|
<Tooltip>
|
|
24
|
-
<TooltipTrigger className="text-[var(--color-icon-branded)]"
|
|
24
|
+
<TooltipTrigger className="text-[var(--color-icon-branded)]">
|
|
25
25
|
{children}
|
|
26
26
|
</TooltipTrigger>
|
|
27
27
|
<TooltipContent className={`max-w-[${maxWidth}]`} side={side} style={{ maxWidth }}>
|
|
@@ -3,6 +3,7 @@ import Chip from '@/src/components/atoms/Chip/Chip';
|
|
|
3
3
|
import { Text } from '@/src/components/atoms/Typography/Typography';
|
|
4
4
|
import { ActionDropdown } from '@/src/components/molecules/ActionDropdown/ActionDropdown';
|
|
5
5
|
import { DateDisplay } from '@/src/components/molecules/DateDisplay/DateDisplay';
|
|
6
|
+
import { TooltipDisplay } from '@/src/components/molecules/TooltipDisplay/TooltipDisplay';
|
|
6
7
|
import { cn } from '@/src/lib/utils';
|
|
7
8
|
import { ActionDropdownType } from '@/src/types/table/action-dropdown-type.types';
|
|
8
9
|
import { QuotationListItem } from '@/src/types/table/quotation.types';
|
|
@@ -15,8 +16,14 @@ export const quotationColumns: (params: {
|
|
|
15
16
|
isChild?: boolean;
|
|
16
17
|
quote: QuotationListItem;
|
|
17
18
|
}) => (action: ActionDropdownType) => void;
|
|
19
|
+
onBookNow?: (type: 'request' | 'book', value?: QuotationListItem) => void;
|
|
18
20
|
keywords?: string;
|
|
19
|
-
}) => ColumnType<QuotationListItem>[] = ({
|
|
21
|
+
}) => ColumnType<QuotationListItem>[] = ({
|
|
22
|
+
onExpand,
|
|
23
|
+
onAction,
|
|
24
|
+
onBookNow,
|
|
25
|
+
keywords = '',
|
|
26
|
+
}) => [
|
|
20
27
|
{
|
|
21
28
|
header: 'Quote nb.',
|
|
22
29
|
key: 'file_nb',
|
|
@@ -158,6 +165,22 @@ export const quotationColumns: (params: {
|
|
|
158
165
|
isPast = new Date(raw.date[0]) < new Date();
|
|
159
166
|
}
|
|
160
167
|
|
|
168
|
+
const buttonType = isOnRequest ? 'request' : 'book';
|
|
169
|
+
|
|
170
|
+
const getButton = () => {
|
|
171
|
+
return (
|
|
172
|
+
<Button
|
|
173
|
+
variant={isOnRequest ? 'outline-secondary' : 'secondary'}
|
|
174
|
+
size="sm"
|
|
175
|
+
onClick={isPast ? undefined : () => onBookNow?.(buttonType, raw)}
|
|
176
|
+
className={cn('table__button', {
|
|
177
|
+
'opacity-50 !cursor-not-allowed': isPast,
|
|
178
|
+
})}>
|
|
179
|
+
{isOnRequest ? 'Request to book' : 'Book now'}
|
|
180
|
+
</Button>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
161
184
|
return (
|
|
162
185
|
<div>
|
|
163
186
|
{hasChildren ? (
|
|
@@ -171,14 +194,17 @@ export const quotationColumns: (params: {
|
|
|
171
194
|
</Button>
|
|
172
195
|
) : (
|
|
173
196
|
<div className="flex items-center gap-x-8">
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
197
|
+
{isPast ? (
|
|
198
|
+
<TooltipDisplay
|
|
199
|
+
content="This quotation cannot be booked because the service dates have already passed."
|
|
200
|
+
side="left"
|
|
201
|
+
maxWidth="325px">
|
|
202
|
+
{getButton()}
|
|
203
|
+
</TooltipDisplay>
|
|
204
|
+
) : (
|
|
205
|
+
getButton()
|
|
206
|
+
)}
|
|
207
|
+
|
|
182
208
|
<div>
|
|
183
209
|
<ActionDropdown
|
|
184
210
|
data={actionDropdownData(
|