mautourco-components 0.2.33 → 0.2.34

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.
@@ -11,6 +11,8 @@ export interface ToastProps {
11
11
  className?: string;
12
12
  /** Icon name */
13
13
  iconName?: IconName;
14
+ /** Show icon */
15
+ showIcon?: boolean;
14
16
  }
15
17
  /**
16
18
  * Toast component - A brief, auto-dismissing message that appears to notify the user.
@@ -12,7 +12,7 @@ import { Text } from '../../atoms/Typography/Typography';
12
12
  * @returns
13
13
  */
14
14
  var Toast = function (_a) {
15
- var text = _a.text, _b = _a.type, type = _b === void 0 ? 'informational' : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.iconName, iconName = _d === void 0 ? 'badge-alert' : _d;
16
- return (_jsx("div", { className: "toast toast--".concat(type, " ").concat(className).trim(), children: _jsxs("div", { className: "toast__container", children: [_jsx("div", { className: "toast__icon-wrapper", children: _jsx(Icon, { name: iconName, size: "md", className: "toast__icon" }) }), _jsx(Text, { size: "sm", variant: "bold", leading: "5", className: "toast__text", children: text })] }) }));
15
+ var text = _a.text, _b = _a.type, type = _b === void 0 ? 'informational' : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.iconName, iconName = _d === void 0 ? 'badge-alert' : _d, _e = _a.showIcon, showIcon = _e === void 0 ? true : _e;
16
+ return (_jsx("div", { className: "toast toast--".concat(type, " ").concat(className).trim(), children: _jsxs("div", { className: "toast__container", children: [showIcon && (_jsx("div", { className: "toast__icon-wrapper", children: _jsx(Icon, { name: iconName, size: "md", className: "toast__icon" }) })), _jsx(Text, { size: "sm", variant: "bold", leading: "5", className: "toast__text", children: text })] }) }));
17
17
  };
18
18
  export default Toast;
@@ -0,0 +1,7 @@
1
+ export interface DialogQuoteRenameProps {
2
+ open: boolean;
3
+ setOpen: (open: boolean) => void;
4
+ quoteName: string;
5
+ onSubmit: (quoteName: string) => void;
6
+ }
7
+ export declare const DialogQuoteRename: (props: DialogQuoteRenameProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import Button from '../../atoms/Button/Button';
4
+ import Input from '../../atoms/Inputs/Input/Input';
5
+ import { Text } from '../../atoms/Typography/Typography';
6
+ import { DialogBookingConfirm } from '../DialogBookingConfirm';
7
+ export var DialogQuoteRename = function (props) {
8
+ var open = props.open, setOpen = props.setOpen, quoteName = props.quoteName, onSubmit = props.onSubmit;
9
+ var _a = useState(quoteName), value = _a[0], setValue = _a[1];
10
+ var handleQuoteNameChange = function (e) {
11
+ setValue(e.target.value);
12
+ };
13
+ return (_jsx(DialogBookingConfirm, { open: open, setOpen: setOpen, title: "Rename Quotation", className: "!max-w-[500px]", children: _jsxs("div", { className: "space-y-9", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("label", { htmlFor: "quote-name", children: _jsx(Text, { as: "span", size: "sm", children: "Quotation name" }) }), _jsx(Input, { id: "quote-name", value: value, onChange: handleQuoteNameChange })] }), _jsxs("div", { className: "grid grid-cols-2 gap-x-4 pb-2", children: [_jsx(Button, { variant: "outline-secondary", onClick: function () { return setOpen(false); }, size: "sm", children: "Cancel" }), _jsx(Button, { variant: "secondary", onClick: function () { return onSubmit(value); }, size: "sm", children: "Save changes" })] })] }) }));
14
+ };
@@ -45,5 +45,5 @@ export var DialogSendingMailContent = function (props) {
45
45
  } }), _jsx(FormField, { control: form.control, name: "message", rules: { required: true }, render: function (_a) {
46
46
  var field = _a.field;
47
47
  return (_jsx(FormItem, { children: _jsxs("div", { className: "relative", children: [_jsx(FormControl, { children: _jsx(Textarea, __assign({ placeholder: "Write your email here... *" }, field)) }), _jsx(FormMessage, { className: "absolute bottom-0 translate-y-4" })] }) }));
48
- } }), _jsx(Button, { type: "button", size: "sm", onClick: onPreviewAttachment, children: "Preview Attachment" })] }), _jsx(Toast, { type: "warning", className: "mt-8", text: "Disclaimer: Email formatting may appear distorted in certain older email clients (e.g Outlook Classic ). Content will remain intact, but the visual layout may differ from the original" }), _jsxs("div", { className: "flex justify-end gap-4 [&>*]:w-[250px] pb-2 pt-9", children: [_jsx(Button, { type: "button", variant: "outline-secondary", size: "sm", onClick: onCancel, children: "Cancel" }), _jsx(Button, { type: "submit", variant: "secondary", size: "sm", children: "Send" })] })] }) })));
48
+ } }), _jsx(Button, { type: "button", size: "sm", onClick: onPreviewAttachment, children: "Preview Attachment" })] }), _jsx(Toast, { showIcon: false, type: "warning", className: "mt-8", text: "Disclaimer: Email formatting may appear distorted in certain older email clients (e.g Outlook Classic ). Content will remain intact, but the visual layout may differ from the original" }), _jsxs("div", { className: "flex justify-end gap-4 [&>*]:w-[250px] pb-2 pt-9", children: [_jsx(Button, { type: "button", variant: "outline-secondary", size: "sm", onClick: onCancel, children: "Cancel" }), _jsx(Button, { type: "submit", variant: "secondary", size: "sm", children: "Send" })] })] }) })));
49
49
  };
@@ -66,7 +66,10 @@ export var DialogSendingMailMultiple = function (props) {
66
66
  if (remainingQuotes.length > 1) {
67
67
  setSelectedQuotes(function (prev) {
68
68
  if (prev.includes(id)) {
69
- return prev.filter(function (quoteId) { return quoteId !== id; });
69
+ if (prev.length > 1) {
70
+ return prev.filter(function (quoteId) { return quoteId !== id; });
71
+ }
72
+ return prev;
70
73
  }
71
74
  return __spreadArray(__spreadArray([], prev, true), [id], false);
72
75
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Motorco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -15,6 +15,8 @@ export interface ToastProps {
15
15
  className?: string;
16
16
  /** Icon name */
17
17
  iconName?: IconName;
18
+ /** Show icon */
19
+ showIcon?: boolean;
18
20
  }
19
21
 
20
22
  /**
@@ -31,13 +33,16 @@ const Toast: React.FC<ToastProps> = ({
31
33
  type = 'informational',
32
34
  className = '',
33
35
  iconName = 'badge-alert',
36
+ showIcon = true,
34
37
  }) => {
35
38
  return (
36
39
  <div className={`toast toast--${type} ${className}`.trim()}>
37
40
  <div className="toast__container">
38
- <div className="toast__icon-wrapper">
39
- <Icon name={iconName} size="md" className="toast__icon" />
40
- </div>
41
+ {showIcon && (
42
+ <div className="toast__icon-wrapper">
43
+ <Icon name={iconName} size="md" className="toast__icon" />
44
+ </div>
45
+ )}
41
46
  <Text size="sm" variant="bold" leading="5" className="toast__text">
42
47
  {text}
43
48
  </Text>
@@ -0,0 +1,48 @@
1
+ import React, { useState } from 'react';
2
+ import Button from '../../atoms/Button/Button';
3
+ import Input from '../../atoms/Inputs/Input/Input';
4
+ import { Text } from '../../atoms/Typography/Typography';
5
+ import { DialogBookingConfirm } from '../DialogBookingConfirm';
6
+
7
+ export interface DialogQuoteRenameProps {
8
+ open: boolean;
9
+ setOpen: (open: boolean) => void;
10
+ quoteName: string;
11
+ onSubmit: (quoteName: string) => void;
12
+ }
13
+
14
+ export const DialogQuoteRename = (props: DialogQuoteRenameProps) => {
15
+ const { open, setOpen, quoteName, onSubmit } = props;
16
+ const [value, setValue] = useState(quoteName);
17
+
18
+ const handleQuoteNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
19
+ setValue(e.target.value);
20
+ };
21
+
22
+ return (
23
+ <DialogBookingConfirm
24
+ open={open}
25
+ setOpen={setOpen}
26
+ title="Rename Quotation"
27
+ className="!max-w-[500px]">
28
+ <div className="space-y-9">
29
+ <div className="space-y-2">
30
+ <label htmlFor="quote-name">
31
+ <Text as="span" size="sm">
32
+ Quotation name
33
+ </Text>
34
+ </label>
35
+ <Input id="quote-name" value={value} onChange={handleQuoteNameChange} />
36
+ </div>
37
+ <div className="grid grid-cols-2 gap-x-4 pb-2">
38
+ <Button variant="outline-secondary" onClick={() => setOpen(false)} size="sm">
39
+ Cancel
40
+ </Button>
41
+ <Button variant="secondary" onClick={() => onSubmit(value)} size="sm">
42
+ Save changes
43
+ </Button>
44
+ </div>
45
+ </div>
46
+ </DialogBookingConfirm>
47
+ );
48
+ };
@@ -97,6 +97,7 @@ export const DialogSendingMailContent: React.FC<DialogSendingMailContentProps> =
97
97
  </Button>
98
98
  </div>
99
99
  <Toast
100
+ showIcon={false}
100
101
  type="warning"
101
102
  className="mt-8"
102
103
  text="Disclaimer: Email formatting may appear distorted in certain older email clients (e.g Outlook Classic ). Content will remain intact, but the visual layout may differ from the original"
@@ -61,7 +61,10 @@ export const DialogSendingMailMultiple: React.FC<DialogSendingMailMultipleProps>
61
61
  if (remainingQuotes.length > 1) {
62
62
  setSelectedQuotes((prev) => {
63
63
  if (prev.includes(id)) {
64
- return prev.filter((quoteId) => quoteId !== id);
64
+ if (prev.length > 1) {
65
+ return prev.filter((quoteId) => quoteId !== id);
66
+ }
67
+ return prev;
65
68
  }
66
69
  return [...prev, id];
67
70
  });