@rufous/ui 0.1.22 → 0.1.27

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.
Files changed (39) hide show
  1. package/dist/Buttons/addButton.cjs +1 -1
  2. package/dist/Buttons/addButton.js +1 -1
  3. package/dist/Buttons/index.cjs +1 -1
  4. package/dist/Buttons/index.js +1 -1
  5. package/dist/Dialogs/BaseDialog.cjs +125 -0
  6. package/dist/Dialogs/BaseDialog.css +224 -0
  7. package/dist/Dialogs/BaseDialog.d.cts +30 -0
  8. package/dist/Dialogs/BaseDialog.d.ts +30 -0
  9. package/dist/Dialogs/BaseDialog.js +64 -0
  10. package/dist/Dialogs/index.cjs +131 -0
  11. package/dist/Dialogs/index.css +224 -0
  12. package/dist/Dialogs/index.d.cts +2 -0
  13. package/dist/Dialogs/index.d.ts +2 -0
  14. package/dist/Dialogs/index.js +64 -0
  15. package/dist/chunk-CPLUOEPG.js +91 -0
  16. package/dist/chunk-DE73YGRW.js +8 -0
  17. package/dist/{chunk-5TL73FV7.js → chunk-MB7R5AKK.js} +1 -1
  18. package/dist/chunk-WXXJX3FF.js +8 -0
  19. package/dist/icons/closeIcon.cjs +37 -0
  20. package/dist/icons/closeIcon.d.cts +8 -0
  21. package/dist/icons/closeIcon.d.ts +8 -0
  22. package/dist/icons/closeIcon.js +6 -0
  23. package/dist/icons/index.cjs +14 -0
  24. package/dist/icons/index.d.cts +2 -0
  25. package/dist/icons/index.d.ts +2 -0
  26. package/dist/icons/index.js +48 -40
  27. package/dist/icons/rufousAiIcon.js +3 -4
  28. package/dist/main.cjs +113 -16
  29. package/dist/main.css +146 -0
  30. package/dist/main.d.cts +3 -0
  31. package/dist/main.d.ts +3 -0
  32. package/dist/main.js +53 -41
  33. package/dist/style.css +146 -0
  34. package/dist/styles/button.css +54 -0
  35. package/dist/styles/dialog.css +91 -0
  36. package/dist/styles/dialog.d.cts +2 -0
  37. package/dist/styles/dialog.d.ts +2 -0
  38. package/package.json +1 -1
  39. /package/dist/{chunk-CC7BNJL3.js → chunk-QGUQF6OF.js} +0 -0
@@ -34,6 +34,6 @@ __export(addButton_exports, {
34
34
  module.exports = __toCommonJS(addButton_exports);
35
35
  var React = __toESM(require("react"), 1);
36
36
  var AddButton = ({ children, ...props }) => {
37
- return /* @__PURE__ */ React.createElement("button", { className: "add-btn", ...props }, "+", children);
37
+ return /* @__PURE__ */ React.createElement("button", { className: "add-btn", ...props }, "+ ", children);
38
38
  };
39
39
  var addButton_default = AddButton;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  addButton_default
3
- } from "../chunk-5TL73FV7.js";
3
+ } from "../chunk-MB7R5AKK.js";
4
4
  export {
5
5
  addButton_default as default
6
6
  };
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(Buttons_exports);
38
38
  // lib/Buttons/addButton.tsx
39
39
  var React = __toESM(require("react"), 1);
40
40
  var AddButton = ({ children, ...props }) => {
41
- return /* @__PURE__ */ React.createElement("button", { className: "add-btn", ...props }, "+", children);
41
+ return /* @__PURE__ */ React.createElement("button", { className: "add-btn", ...props }, "+ ", children);
42
42
  };
43
43
  var addButton_default = AddButton;
44
44
 
@@ -1,7 +1,7 @@
1
1
  import "../chunk-JSGUIKOH.js";
2
2
  import {
3
3
  addButton_default
4
- } from "../chunk-5TL73FV7.js";
4
+ } from "../chunk-MB7R5AKK.js";
5
5
  import {
6
6
  cancelButton_default
7
7
  } from "../chunk-UF3Q3GWG.js";
@@ -0,0 +1,125 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // lib/Dialogs/BaseDialog.tsx
30
+ var BaseDialog_exports = {};
31
+ __export(BaseDialog_exports, {
32
+ default: () => BaseDialog_default
33
+ });
34
+ module.exports = __toCommonJS(BaseDialog_exports);
35
+ var React3 = __toESM(require("react"), 1);
36
+ var import_react2 = require("react");
37
+
38
+ // lib/icons/closeIcon.tsx
39
+ var React = __toESM(require("react"), 1);
40
+ var CloseIcon = ({ color = "#3a3a3a", ...props }) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "336", height: "336", viewBox: "0 0 336 336", fill: "none", ...props }, /* @__PURE__ */ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M132.323 167.676L0 299.999L35.3553 335.356L167.68 203.032L300.003 335.356L335.36 299.999L203.037 167.676L335.357 35.3553L300 0L167.68 132.319L35.3593 0L0.00398954 35.3553L132.323 167.676Z", fill: color }));
41
+ var closeIcon_default = CloseIcon;
42
+
43
+ // lib/Contexts/rufousThemeProvider.tsx
44
+ var import_react = __toESM(require("react"), 1);
45
+ var RufousThemeContext = (0, import_react.createContext)(null);
46
+ var useRufousTheme = () => (0, import_react.useContext)(RufousThemeContext);
47
+
48
+ // lib/Dialogs/BaseDialog.tsx
49
+ var BaseDialog = ({
50
+ open = false,
51
+ onConfirm,
52
+ onClose,
53
+ onCancel,
54
+ children,
55
+ minWidth,
56
+ minHeight,
57
+ customButtons,
58
+ cancelText = "Cancel",
59
+ confirmText = "Ok",
60
+ submitText = "Submit",
61
+ title = "",
62
+ isLoading = false,
63
+ disableConfirmBtn = false,
64
+ fullScreen = false,
65
+ loading = false,
66
+ showCloseButton = true,
67
+ buttonAlign = "flex-end",
68
+ showCancelButton = true,
69
+ formatTitle = true,
70
+ fullWidth = false,
71
+ className,
72
+ dialogBodyStyle = {}
73
+ }) => {
74
+ const { theme } = useRufousTheme();
75
+ const successBtnRef = (0, import_react2.useRef)(null);
76
+ if (!open) return null;
77
+ const renderButtons = () => /* @__PURE__ */ React3.createElement("div", { className: "dialog-footer", style: { justifyContent: buttonAlign } }, showCancelButton && /* @__PURE__ */ React3.createElement(
78
+ "button",
79
+ {
80
+ className: "btn-cancel",
81
+ onClick: onCancel || onClose,
82
+ disabled: isLoading
83
+ },
84
+ cancelText
85
+ ), onConfirm && /* @__PURE__ */ React3.createElement(
86
+ "button",
87
+ {
88
+ ref: successBtnRef,
89
+ className: "btn-confirm",
90
+ disabled: disableConfirmBtn || loading,
91
+ onClick: async () => {
92
+ if (successBtnRef.current) successBtnRef.current.disabled = true;
93
+ await onConfirm?.();
94
+ if (successBtnRef.current) successBtnRef.current.disabled = false;
95
+ }
96
+ },
97
+ loading ? /* @__PURE__ */ React3.createElement("span", { className: "spinner" }) : /* @__PURE__ */ React3.createElement("span", null, confirmText)
98
+ ));
99
+ return /* @__PURE__ */ React3.createElement("div", { className: `dialog-overlay ${fullScreen ? "fullscreen" : ""}` }, /* @__PURE__ */ React3.createElement(
100
+ "div",
101
+ {
102
+ className: `dialog-container ${className || ""}`,
103
+ style: {
104
+ minWidth: minWidth || (fullScreen ? "100%" : "685px"),
105
+ minHeight,
106
+ width: fullWidth ? "100%" : "auto"
107
+ }
108
+ },
109
+ /* @__PURE__ */ React3.createElement("div", { className: "dialog-title" }, /* @__PURE__ */ React3.createElement("h2", null, formatTitle ? title?.charAt(0).toUpperCase() + title?.slice(1).toLowerCase() : title), showCloseButton && /* @__PURE__ */ React3.createElement("button", { className: "btn-close", onClick: onClose }, /* @__PURE__ */ React3.createElement(closeIcon_default, { color: theme?.customStyles?.iconColor || "#707070" }))),
110
+ /* @__PURE__ */ React3.createElement("div", { className: "dialog-divider" }),
111
+ /* @__PURE__ */ React3.createElement(
112
+ "div",
113
+ {
114
+ className: "dialog-body",
115
+ style: {
116
+ ...fullScreen ? { height: "100%" } : { maxHeight: "700px", minHeight },
117
+ ...dialogBodyStyle
118
+ }
119
+ },
120
+ children
121
+ ),
122
+ customButtons || renderButtons()
123
+ ));
124
+ };
125
+ var BaseDialog_default = BaseDialog;
@@ -0,0 +1,224 @@
1
+ /* lib/styles/button.css */
2
+ .cancel-btn {
3
+ text-transform: uppercase;
4
+ min-width: 84px;
5
+ font-weight: normal;
6
+ font-size: 12px;
7
+ padding: 7px 10px;
8
+ border: 1px solid rgb(164, 27, 6);
9
+ border-radius: 34px;
10
+ background: #fff;
11
+ color: rgb(164, 27, 6);
12
+ cursor: pointer;
13
+ transition:
14
+ background-color 250ms,
15
+ box-shadow 250ms,
16
+ border-color 250ms,
17
+ color 250ms;
18
+ box-shadow:
19
+ rgba(0, 0, 0, 0.2) 0px 3px 1px -2px,
20
+ rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,
21
+ rgba(0, 0, 0, 0.12) 0px 1px 5px 0px;
22
+ }
23
+ .cancel-btn:hover {
24
+ box-shadow:
25
+ rgba(0, 0, 0, 0.2) 0px 2px 4px -1px,
26
+ rgba(0, 0, 0, 0.14) 0px 4px 5px 0px,
27
+ rgba(0, 0, 0, 0.12) 0px 1px 10px 0px;
28
+ }
29
+ .cancel-btn:disabled {
30
+ background-color: #e0e0e0;
31
+ cursor: not-allowed;
32
+ }
33
+ .submit-btn {
34
+ display: -webkit-inline-box;
35
+ display: -webkit-inline-flex;
36
+ display: -ms-inline-flexbox;
37
+ display: inline-flex;
38
+ -webkit-align-items: center;
39
+ -webkit-box-align: center;
40
+ -ms-flex-align: center;
41
+ align-items: center;
42
+ -webkit-box-pack: center;
43
+ -ms-flex-pack: center;
44
+ -webkit-justify-content: center;
45
+ justify-content: center;
46
+ position: relative;
47
+ box-sizing: border-box;
48
+ -webkit-tap-highlight-color: transparent;
49
+ background-color: transparent;
50
+ outline: 0;
51
+ margin: 0;
52
+ cursor: pointer;
53
+ -webkit-user-select: none;
54
+ -moz-user-select: none;
55
+ -ms-user-select: none;
56
+ user-select: none;
57
+ vertical-align: middle;
58
+ -moz-appearance: none;
59
+ -webkit-appearance: none;
60
+ -webkit-text-decoration: none;
61
+ text-decoration: none;
62
+ color: inherit;
63
+ font-family:
64
+ "Roboto",
65
+ "Helvetica",
66
+ "Arial",
67
+ sans-serif;
68
+ font-weight: 500;
69
+ font-size: 0.875rem;
70
+ line-height: 1.75;
71
+ letter-spacing: 0.02857em;
72
+ min-width: 64px;
73
+ padding: 6px 8px;
74
+ border-radius: 4px;
75
+ -webkit-transition:
76
+ background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
77
+ box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
78
+ border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
79
+ color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
80
+ transition:
81
+ background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
82
+ box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
83
+ border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
84
+ color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
85
+ background: #a81c07;
86
+ border: 1px solid #a81c07;
87
+ background-color: #9b1906;
88
+ color: #fff;
89
+ font-size: 12px;
90
+ text-transform: uppercase;
91
+ min-width: 92px;
92
+ height: 38px;
93
+ border: none;
94
+ border-radius: 6px;
95
+ cursor: pointer;
96
+ transition: background-color 250ms ease-in-out;
97
+ font-size: 600;
98
+ }
99
+ .submit-btn:hover {
100
+ background-color: #9b1906;
101
+ }
102
+ .submit-btn:disabled {
103
+ background-color: #e0e0e0;
104
+ cursor: not-allowed;
105
+ }
106
+ .add-btn {
107
+ background: #ffffff;
108
+ border: 1px solid #a41b06;
109
+ border-radius: 34px;
110
+ font-weight: normal;
111
+ font-size: 12px;
112
+ padding: 7px 12px;
113
+ color: #a41b06;
114
+ cursor: pointer;
115
+ transition: all 0.25s ease-in-out;
116
+ text-transform: uppercase;
117
+ box-shadow: none;
118
+ }
119
+ .add-btn:hover {
120
+ background: #a41b06;
121
+ color: #ffffff;
122
+ }
123
+
124
+ /* lib/styles/dialog.css */
125
+ .dialog-overlay {
126
+ position: fixed;
127
+ inset: 0;
128
+ background: rgba(0, 0, 0, 0.5);
129
+ display: flex;
130
+ justify-content: center;
131
+ align-items: center;
132
+ z-index: 1300;
133
+ }
134
+ .dialog-container {
135
+ background: white;
136
+ border-radius: 8px;
137
+ max-height: 90vh;
138
+ display: flex;
139
+ flex-direction: column;
140
+ }
141
+ .dialog-title {
142
+ background: #fff;
143
+ padding: 8px 16px;
144
+ position: sticky;
145
+ top: 0;
146
+ display: flex;
147
+ justify-content: space-between;
148
+ align-items: center;
149
+ color: #707070;
150
+ z-index: 2;
151
+ }
152
+ .dialog-title h2 {
153
+ font-size: 1.125rem;
154
+ margin: 0;
155
+ }
156
+ .btn-close {
157
+ background: none;
158
+ border: none;
159
+ cursor: pointer;
160
+ }
161
+ .dialog-divider {
162
+ border-top: 1px solid #e0e0e0;
163
+ }
164
+ .dialog-body {
165
+ overflow: auto;
166
+ padding: 16px 30px;
167
+ flex: 1;
168
+ }
169
+ .dialog-footer {
170
+ display: flex;
171
+ gap: 8px;
172
+ padding: 8px 16px;
173
+ }
174
+ .btn-cancel {
175
+ border: 1px solid #a41b06;
176
+ border-radius: 34px;
177
+ padding: 7px 10px;
178
+ background: #fff;
179
+ color: #a41b06;
180
+ font-size: 12px;
181
+ cursor: pointer;
182
+ }
183
+ .btn-cancel:hover {
184
+ background: #f5f5f5;
185
+ }
186
+ .btn-confirm {
187
+ border-radius: 34px;
188
+ padding: 7px 16px;
189
+ background: #a21b07;
190
+ color: white;
191
+ font-size: 12px;
192
+ cursor: pointer;
193
+ border: none;
194
+ }
195
+ .btn-confirm:hover {
196
+ background: #a21b07;
197
+ }
198
+ .spinner {
199
+ border: 2px solid #f3f3f3;
200
+ border-top: 2px solid #c5c5c5;
201
+ border-radius: 50%;
202
+ width: 16px;
203
+ height: 16px;
204
+ animation: spin 1s linear infinite;
205
+ display: inline-block;
206
+ }
207
+ @keyframes spin {
208
+ 0% {
209
+ transform: rotate(0deg);
210
+ }
211
+ 100% {
212
+ transform: rotate(360deg);
213
+ }
214
+ }
215
+
216
+ /* lib/style.css */
217
+ .theme-rufous .act-icon svg {
218
+ color: #a81c08 !important;
219
+ }
220
+ .theme-default .act-icon svg {
221
+ color: #707070 !important;
222
+ }
223
+ .act-icon {
224
+ }
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+
3
+ interface BaseDialogProps {
4
+ open?: boolean;
5
+ onConfirm?: () => Promise<void> | void;
6
+ onClose?: () => void;
7
+ onCancel?: () => void;
8
+ children?: React.ReactNode;
9
+ minWidth?: number | string;
10
+ minHeight?: number | string;
11
+ customButtons?: React.ReactNode;
12
+ cancelText?: string;
13
+ confirmText?: string;
14
+ submitText?: string;
15
+ title?: string;
16
+ isLoading?: boolean;
17
+ disableConfirmBtn?: boolean;
18
+ fullScreen?: boolean;
19
+ loading?: boolean;
20
+ showCloseButton?: boolean;
21
+ buttonAlign?: "flex-start" | "flex-end" | "center";
22
+ showCancelButton?: boolean;
23
+ formatTitle?: boolean;
24
+ fullWidth?: boolean;
25
+ className?: string;
26
+ dialogBodyStyle?: React.CSSProperties;
27
+ }
28
+ declare const BaseDialog: React.FC<BaseDialogProps>;
29
+
30
+ export { BaseDialog as default };
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+
3
+ interface BaseDialogProps {
4
+ open?: boolean;
5
+ onConfirm?: () => Promise<void> | void;
6
+ onClose?: () => void;
7
+ onCancel?: () => void;
8
+ children?: React.ReactNode;
9
+ minWidth?: number | string;
10
+ minHeight?: number | string;
11
+ customButtons?: React.ReactNode;
12
+ cancelText?: string;
13
+ confirmText?: string;
14
+ submitText?: string;
15
+ title?: string;
16
+ isLoading?: boolean;
17
+ disableConfirmBtn?: boolean;
18
+ fullScreen?: boolean;
19
+ loading?: boolean;
20
+ showCloseButton?: boolean;
21
+ buttonAlign?: "flex-start" | "flex-end" | "center";
22
+ showCancelButton?: boolean;
23
+ formatTitle?: boolean;
24
+ fullWidth?: boolean;
25
+ className?: string;
26
+ dialogBodyStyle?: React.CSSProperties;
27
+ }
28
+ declare const BaseDialog: React.FC<BaseDialogProps>;
29
+
30
+ export { BaseDialog as default };
@@ -0,0 +1,64 @@
1
+ import {
2
+ BaseDialog_default
3
+ } from "../chunk-CPLUOEPG.js";
4
+ import "../chunk-QGUQF6OF.js";
5
+ import "../chunk-QJPQC544.js";
6
+ import "../chunk-ITZTTNM2.js";
7
+ import "../chunk-WWAHNTUH.js";
8
+ import "../chunk-6KIFTMUN.js";
9
+ import "../chunk-ZJAV3FEQ.js";
10
+ import "../chunk-NMMC4ATV.js";
11
+ import "../chunk-DXJ745NZ.js";
12
+ import "../chunk-BH53P2UM.js";
13
+ import "../chunk-XPRBPIS5.js";
14
+ import "../chunk-WG3Q6GZN.js";
15
+ import "../chunk-RJ43D3XB.js";
16
+ import "../chunk-DE73YGRW.js";
17
+ import "../chunk-DMP72IAP.js";
18
+ import "../chunk-QZFGQ5JM.js";
19
+ import "../chunk-CSKTBLQQ.js";
20
+ import "../chunk-ZDVP4SUD.js";
21
+ import "../chunk-5BB3H3YO.js";
22
+ import "../chunk-WZTZFC36.js";
23
+ import "../chunk-QA2AYT4A.js";
24
+ import "../chunk-WHGVO3HV.js";
25
+ import "../chunk-FOUXNPQA.js";
26
+ import "../chunk-C7B23GTE.js";
27
+ import "../chunk-XCLXQOLP.js";
28
+ import "../chunk-ZJYLZ6I6.js";
29
+ import "../chunk-RNA4TTYR.js";
30
+ import "../chunk-NSW6ZGZF.js";
31
+ import "../chunk-KYJ3475B.js";
32
+ import "../chunk-N4EJKMJK.js";
33
+ import "../chunk-MKK7M3BH.js";
34
+ import "../chunk-GESVGIAP.js";
35
+ import "../chunk-QIEQRNBE.js";
36
+ import "../chunk-BYJP2WNC.js";
37
+ import "../chunk-GYLL3HRD.js";
38
+ import "../chunk-QONKYAQ5.js";
39
+ import "../chunk-H372BAXA.js";
40
+ import "../chunk-FSRABKKC.js";
41
+ import "../chunk-ZAYWFYP4.js";
42
+ import "../chunk-5UEJAVFK.js";
43
+ import "../chunk-WZAU77G7.js";
44
+ import "../chunk-7WNPZ4B7.js";
45
+ import "../chunk-WXXJX3FF.js";
46
+ import "../chunk-6FEUS4CQ.js";
47
+ import "../chunk-PPNZC5ZQ.js";
48
+ import "../chunk-JI5XMLWT.js";
49
+ import "../chunk-WXANSSXF.js";
50
+ import "../chunk-XPJVVKOU.js";
51
+ import "../chunk-GL43GPEM.js";
52
+ import "../chunk-IOEQAR2M.js";
53
+ import "../chunk-BCGCLMKA.js";
54
+ import "../chunk-2FHTGYR4.js";
55
+ import "../chunk-AH6RCYDL.js";
56
+ import "../chunk-3IBCGGN3.js";
57
+ import "../chunk-MNPAE2ZF.js";
58
+ import "../chunk-JSGUIKOH.js";
59
+ import "../chunk-MB7R5AKK.js";
60
+ import "../chunk-UF3Q3GWG.js";
61
+ import "../chunk-7DL4MCF7.js";
62
+ export {
63
+ BaseDialog_default as default
64
+ };
@@ -0,0 +1,131 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // lib/Dialogs/index.ts
30
+ var Dialogs_exports = {};
31
+ __export(Dialogs_exports, {
32
+ BaseDialog: () => BaseDialog_default
33
+ });
34
+ module.exports = __toCommonJS(Dialogs_exports);
35
+
36
+ // lib/Dialogs/BaseDialog.tsx
37
+ var React3 = __toESM(require("react"), 1);
38
+ var import_react2 = require("react");
39
+
40
+ // lib/icons/closeIcon.tsx
41
+ var React = __toESM(require("react"), 1);
42
+ var CloseIcon = ({ color = "#3a3a3a", ...props }) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "336", height: "336", viewBox: "0 0 336 336", fill: "none", ...props }, /* @__PURE__ */ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M132.323 167.676L0 299.999L35.3553 335.356L167.68 203.032L300.003 335.356L335.36 299.999L203.037 167.676L335.357 35.3553L300 0L167.68 132.319L35.3593 0L0.00398954 35.3553L132.323 167.676Z", fill: color }));
43
+ var closeIcon_default = CloseIcon;
44
+
45
+ // lib/Contexts/rufousThemeProvider.tsx
46
+ var import_react = __toESM(require("react"), 1);
47
+ var RufousThemeContext = (0, import_react.createContext)(null);
48
+ var useRufousTheme = () => (0, import_react.useContext)(RufousThemeContext);
49
+
50
+ // lib/Dialogs/BaseDialog.tsx
51
+ var BaseDialog = ({
52
+ open = false,
53
+ onConfirm,
54
+ onClose,
55
+ onCancel,
56
+ children,
57
+ minWidth,
58
+ minHeight,
59
+ customButtons,
60
+ cancelText = "Cancel",
61
+ confirmText = "Ok",
62
+ submitText = "Submit",
63
+ title = "",
64
+ isLoading = false,
65
+ disableConfirmBtn = false,
66
+ fullScreen = false,
67
+ loading = false,
68
+ showCloseButton = true,
69
+ buttonAlign = "flex-end",
70
+ showCancelButton = true,
71
+ formatTitle = true,
72
+ fullWidth = false,
73
+ className,
74
+ dialogBodyStyle = {}
75
+ }) => {
76
+ const { theme } = useRufousTheme();
77
+ const successBtnRef = (0, import_react2.useRef)(null);
78
+ if (!open) return null;
79
+ const renderButtons = () => /* @__PURE__ */ React3.createElement("div", { className: "dialog-footer", style: { justifyContent: buttonAlign } }, showCancelButton && /* @__PURE__ */ React3.createElement(
80
+ "button",
81
+ {
82
+ className: "btn-cancel",
83
+ onClick: onCancel || onClose,
84
+ disabled: isLoading
85
+ },
86
+ cancelText
87
+ ), onConfirm && /* @__PURE__ */ React3.createElement(
88
+ "button",
89
+ {
90
+ ref: successBtnRef,
91
+ className: "btn-confirm",
92
+ disabled: disableConfirmBtn || loading,
93
+ onClick: async () => {
94
+ if (successBtnRef.current) successBtnRef.current.disabled = true;
95
+ await onConfirm?.();
96
+ if (successBtnRef.current) successBtnRef.current.disabled = false;
97
+ }
98
+ },
99
+ loading ? /* @__PURE__ */ React3.createElement("span", { className: "spinner" }) : /* @__PURE__ */ React3.createElement("span", null, confirmText)
100
+ ));
101
+ return /* @__PURE__ */ React3.createElement("div", { className: `dialog-overlay ${fullScreen ? "fullscreen" : ""}` }, /* @__PURE__ */ React3.createElement(
102
+ "div",
103
+ {
104
+ className: `dialog-container ${className || ""}`,
105
+ style: {
106
+ minWidth: minWidth || (fullScreen ? "100%" : "685px"),
107
+ minHeight,
108
+ width: fullWidth ? "100%" : "auto"
109
+ }
110
+ },
111
+ /* @__PURE__ */ React3.createElement("div", { className: "dialog-title" }, /* @__PURE__ */ React3.createElement("h2", null, formatTitle ? title?.charAt(0).toUpperCase() + title?.slice(1).toLowerCase() : title), showCloseButton && /* @__PURE__ */ React3.createElement("button", { className: "btn-close", onClick: onClose }, /* @__PURE__ */ React3.createElement(closeIcon_default, { color: theme?.customStyles?.iconColor || "#707070" }))),
112
+ /* @__PURE__ */ React3.createElement("div", { className: "dialog-divider" }),
113
+ /* @__PURE__ */ React3.createElement(
114
+ "div",
115
+ {
116
+ className: "dialog-body",
117
+ style: {
118
+ ...fullScreen ? { height: "100%" } : { maxHeight: "700px", minHeight },
119
+ ...dialogBodyStyle
120
+ }
121
+ },
122
+ children
123
+ ),
124
+ customButtons || renderButtons()
125
+ ));
126
+ };
127
+ var BaseDialog_default = BaseDialog;
128
+ // Annotate the CommonJS export names for ESM import in node:
129
+ 0 && (module.exports = {
130
+ BaseDialog
131
+ });