catchup-library-web 1.0.0
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 +70 -0
- package/dist/index.d.mts +55 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +674 -0
- package/dist/index.mjs +641 -0
- package/package.json +24 -0
- package/src/components/buttons/ApproveButton.tsx +87 -0
- package/src/components/buttons/CancelButton.tsx +102 -0
- package/src/components/buttons/CreateButton.tsx +87 -0
- package/src/components/buttons/DeleteButton.tsx +95 -0
- package/src/components/buttons/PrimaryButton.tsx +88 -0
- package/src/components/buttons/SecondaryButton.tsx +94 -0
- package/src/components/images/BaseImage.tsx +93 -0
- package/src/components/loading/BaseLoading.tsx +50 -0
- package/src/index.ts +10 -0
- package/src/properties/ButtonProperties.ts +9 -0
- package/src/properties/CommonProperties.ts +4 -0
- package/src/properties/ImageProperties.ts +17 -0
- package/src/properties/LoadingProperties.ts +7 -0
- package/tsconfig.json +16 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __async = (__this, __arguments, generator) => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
var fulfilled = (value) => {
|
|
22
|
+
try {
|
|
23
|
+
step(generator.next(value));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
reject(e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var rejected = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
step(generator.throw(value));
|
|
31
|
+
} catch (e) {
|
|
32
|
+
reject(e);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
36
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/index.ts
|
|
41
|
+
var index_exports = {};
|
|
42
|
+
__export(index_exports, {
|
|
43
|
+
ApproveButton: () => ApproveButton_default,
|
|
44
|
+
BaseImage: () => BaseImage_default,
|
|
45
|
+
BaseLoading: () => BaseLoading_default,
|
|
46
|
+
CancelButton: () => CancelButton_default,
|
|
47
|
+
CreateButton: () => CreateButton_default,
|
|
48
|
+
DeleteButton: () => DeleteButton_default,
|
|
49
|
+
PrimaryButton: () => PrimaryButton_default,
|
|
50
|
+
SecondaryButton: () => SecondaryButton_default
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(index_exports);
|
|
53
|
+
|
|
54
|
+
// src/components/buttons/PrimaryButton.tsx
|
|
55
|
+
var import_react2 = require("react");
|
|
56
|
+
|
|
57
|
+
// src/components/images/BaseImage.tsx
|
|
58
|
+
var import_react = require("react");
|
|
59
|
+
|
|
60
|
+
// src/components/loading/BaseLoading.tsx
|
|
61
|
+
var import_react_loader_spinner = require("react-loader-spinner");
|
|
62
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
63
|
+
var BaseLoading = ({
|
|
64
|
+
height,
|
|
65
|
+
width,
|
|
66
|
+
size,
|
|
67
|
+
primaryColor,
|
|
68
|
+
secondaryColor
|
|
69
|
+
}) => {
|
|
70
|
+
let currentHeight;
|
|
71
|
+
let currentWidth;
|
|
72
|
+
if (size === "small") {
|
|
73
|
+
currentHeight = 18;
|
|
74
|
+
currentWidth = 18;
|
|
75
|
+
} else if (size === "medium") {
|
|
76
|
+
currentHeight = 48;
|
|
77
|
+
currentWidth = 48;
|
|
78
|
+
} else if (size === "large") {
|
|
79
|
+
currentHeight = 72;
|
|
80
|
+
currentWidth = 72;
|
|
81
|
+
} else if (size === "xlarge") {
|
|
82
|
+
currentHeight = 96;
|
|
83
|
+
currentWidth = 96;
|
|
84
|
+
} else {
|
|
85
|
+
currentHeight = height;
|
|
86
|
+
currentWidth = width;
|
|
87
|
+
}
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
+
import_react_loader_spinner.Oval,
|
|
90
|
+
{
|
|
91
|
+
height: currentHeight,
|
|
92
|
+
width: currentWidth,
|
|
93
|
+
wrapperStyle: {},
|
|
94
|
+
wrapperClass: "",
|
|
95
|
+
visible: true,
|
|
96
|
+
ariaLabel: "oval-loading",
|
|
97
|
+
color: primaryColor,
|
|
98
|
+
secondaryColor,
|
|
99
|
+
strokeWidth: 2,
|
|
100
|
+
strokeWidthSecondary: 2
|
|
101
|
+
}
|
|
102
|
+
) });
|
|
103
|
+
};
|
|
104
|
+
var BaseLoading_default = BaseLoading;
|
|
105
|
+
|
|
106
|
+
// src/components/images/BaseImage.tsx
|
|
107
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
108
|
+
var BaseImage = (props) => {
|
|
109
|
+
const {
|
|
110
|
+
ref,
|
|
111
|
+
size,
|
|
112
|
+
className,
|
|
113
|
+
widthClassName,
|
|
114
|
+
heightClassName,
|
|
115
|
+
src,
|
|
116
|
+
alt,
|
|
117
|
+
showLoading,
|
|
118
|
+
onLoad,
|
|
119
|
+
onClick,
|
|
120
|
+
dataToolTipId,
|
|
121
|
+
dataToolTipContent,
|
|
122
|
+
dataToolTipPlace,
|
|
123
|
+
dataToolTipVariant,
|
|
124
|
+
dataToolTipHTML
|
|
125
|
+
} = props;
|
|
126
|
+
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
127
|
+
const handleOnClick = (e) => {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
if (showLoading) {
|
|
130
|
+
setLoading(true);
|
|
131
|
+
onClick && onClick(e);
|
|
132
|
+
setLoading(false);
|
|
133
|
+
} else {
|
|
134
|
+
onClick && onClick(e);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
if (!src) return null;
|
|
138
|
+
let currentClassName;
|
|
139
|
+
let currentWidthClassName;
|
|
140
|
+
let currentHeightClassName;
|
|
141
|
+
if (size === "xsmall") {
|
|
142
|
+
currentWidthClassName = "w-4";
|
|
143
|
+
currentHeightClassName = "h-4";
|
|
144
|
+
} else if (size === "small") {
|
|
145
|
+
currentWidthClassName = "w-6";
|
|
146
|
+
currentHeightClassName = "h-6";
|
|
147
|
+
} else if (size === "medium") {
|
|
148
|
+
currentWidthClassName = "w-8";
|
|
149
|
+
currentHeightClassName = "h-8";
|
|
150
|
+
} else if (size === "large") {
|
|
151
|
+
currentWidthClassName = "w-10";
|
|
152
|
+
currentHeightClassName = "h-10";
|
|
153
|
+
} else if (size === "xlarge") {
|
|
154
|
+
currentWidthClassName = "w-12";
|
|
155
|
+
currentHeightClassName = "h-12";
|
|
156
|
+
} else if (size === "2xlarge") {
|
|
157
|
+
currentWidthClassName = "w-14";
|
|
158
|
+
currentHeightClassName = "h-14";
|
|
159
|
+
} else if (size === "3xlarge") {
|
|
160
|
+
currentWidthClassName = "w-16";
|
|
161
|
+
currentHeightClassName = "h-16";
|
|
162
|
+
} else if (size === "custom") {
|
|
163
|
+
currentClassName = className;
|
|
164
|
+
currentWidthClassName = widthClassName;
|
|
165
|
+
currentHeightClassName = heightClassName;
|
|
166
|
+
}
|
|
167
|
+
return loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BaseLoading_default, { size: "small", primaryColor: "#57C2D3", secondaryColor: "#57C2D3" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: `${currentWidthClassName ? currentWidthClassName : ""} ${currentHeightClassName ? currentHeightClassName : ""} ${currentClassName ? currentClassName : ""} cursor-pointer`,
|
|
171
|
+
onClick: handleOnClick,
|
|
172
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
173
|
+
"img",
|
|
174
|
+
{
|
|
175
|
+
ref,
|
|
176
|
+
className: "w-full",
|
|
177
|
+
src,
|
|
178
|
+
alt,
|
|
179
|
+
onLoad,
|
|
180
|
+
"data-tooltip-id": dataToolTipId,
|
|
181
|
+
"data-tooltip-content": dataToolTipContent,
|
|
182
|
+
"data-tooltip-place": dataToolTipPlace,
|
|
183
|
+
"data-tooltip-variant": dataToolTipVariant,
|
|
184
|
+
"data-tooltip-html": dataToolTipHTML
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
var BaseImage_default = BaseImage;
|
|
191
|
+
|
|
192
|
+
// src/components/buttons/PrimaryButton.tsx
|
|
193
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
194
|
+
var PrimaryButton = ({
|
|
195
|
+
title,
|
|
196
|
+
size,
|
|
197
|
+
onClick,
|
|
198
|
+
disabled,
|
|
199
|
+
iconPosition,
|
|
200
|
+
textOnly,
|
|
201
|
+
iconOnly
|
|
202
|
+
}) => {
|
|
203
|
+
const [loading, setLoading] = (0, import_react2.useState)(false);
|
|
204
|
+
const internalOnClick = () => __async(void 0, null, function* () {
|
|
205
|
+
if (loading) return;
|
|
206
|
+
if (disabled) return;
|
|
207
|
+
setLoading(true);
|
|
208
|
+
yield onClick();
|
|
209
|
+
setLoading(false);
|
|
210
|
+
});
|
|
211
|
+
let currentWidthClassName;
|
|
212
|
+
let currentHeightClassName;
|
|
213
|
+
let currentLoadingSize;
|
|
214
|
+
if (size === "small") {
|
|
215
|
+
currentWidthClassName = "w-32";
|
|
216
|
+
currentHeightClassName = "h-8";
|
|
217
|
+
currentLoadingSize = 14;
|
|
218
|
+
} else if (size === "medium") {
|
|
219
|
+
currentWidthClassName = "w-32";
|
|
220
|
+
currentHeightClassName = "h-10";
|
|
221
|
+
currentLoadingSize = 16;
|
|
222
|
+
} else if (size === "large") {
|
|
223
|
+
currentWidthClassName = "w-32";
|
|
224
|
+
currentHeightClassName = "h-12";
|
|
225
|
+
currentLoadingSize = 18;
|
|
226
|
+
} else if (size === "unlimited") {
|
|
227
|
+
currentLoadingSize = 14;
|
|
228
|
+
currentHeightClassName = "h-8";
|
|
229
|
+
}
|
|
230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
231
|
+
"button",
|
|
232
|
+
{
|
|
233
|
+
className: `border border-catchup-blue-500 bg-catchup-blue-500 text-catchup-white rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-blue-700 active:bg-catchup-blue-500"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
|
|
234
|
+
onClick: internalOnClick,
|
|
235
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
236
|
+
BaseLoading_default,
|
|
237
|
+
{
|
|
238
|
+
height: currentLoadingSize,
|
|
239
|
+
width: currentLoadingSize,
|
|
240
|
+
primaryColor: "#ffffff",
|
|
241
|
+
secondaryColor: "#ffffff"
|
|
242
|
+
}
|
|
243
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-row justify-center items-center gap-x-2 px-4", children: [
|
|
244
|
+
iconPosition === "left" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
245
|
+
BaseImage_default,
|
|
246
|
+
{
|
|
247
|
+
src: "/icons/new/primary-button-arrow-left.png",
|
|
248
|
+
alt: "arrow-left",
|
|
249
|
+
size: "xsmall"
|
|
250
|
+
}
|
|
251
|
+
) : null,
|
|
252
|
+
iconOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "", children: title }),
|
|
253
|
+
textOnly || iconPosition === "left" ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
254
|
+
BaseImage_default,
|
|
255
|
+
{
|
|
256
|
+
src: "/icons/primary-button-arrow-right.png",
|
|
257
|
+
alt: "arrow-right",
|
|
258
|
+
size: "xsmall"
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
] })
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
var PrimaryButton_default = PrimaryButton;
|
|
266
|
+
|
|
267
|
+
// src/components/buttons/SecondaryButton.tsx
|
|
268
|
+
var import_react3 = require("react");
|
|
269
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
270
|
+
var SecondaryButton = ({
|
|
271
|
+
title,
|
|
272
|
+
size,
|
|
273
|
+
onClick,
|
|
274
|
+
disabled,
|
|
275
|
+
iconPosition,
|
|
276
|
+
textOnly,
|
|
277
|
+
iconOnly
|
|
278
|
+
}) => {
|
|
279
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
280
|
+
const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
|
|
281
|
+
const internalOnClick = () => __async(void 0, null, function* () {
|
|
282
|
+
if (loading) return;
|
|
283
|
+
if (disabled) return;
|
|
284
|
+
setLoading(true);
|
|
285
|
+
yield onClick();
|
|
286
|
+
setLoading(false);
|
|
287
|
+
});
|
|
288
|
+
let currentWidthClassName;
|
|
289
|
+
let currentHeightClassName;
|
|
290
|
+
let currentLoadingSize;
|
|
291
|
+
if (size === "small") {
|
|
292
|
+
currentWidthClassName = "w-32";
|
|
293
|
+
currentHeightClassName = "h-8";
|
|
294
|
+
currentLoadingSize = 14;
|
|
295
|
+
} else if (size === "medium") {
|
|
296
|
+
currentWidthClassName = "w-32";
|
|
297
|
+
currentHeightClassName = "h-10";
|
|
298
|
+
currentLoadingSize = 16;
|
|
299
|
+
} else if (size === "large") {
|
|
300
|
+
currentWidthClassName = "w-32";
|
|
301
|
+
currentHeightClassName = "h-12";
|
|
302
|
+
currentLoadingSize = 18;
|
|
303
|
+
} else if (size === "unlimited") {
|
|
304
|
+
currentLoadingSize = 14;
|
|
305
|
+
currentHeightClassName = "h-8";
|
|
306
|
+
}
|
|
307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
308
|
+
"button",
|
|
309
|
+
{
|
|
310
|
+
className: `border border-catchup-gray-400 bg-catchup-white text-catchup-gray-600 rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-gray-400 hover:text-catchup-white hover:border-catchup-gray-400 active:bg-catchup-gray-500 active:border-catchup-gray-500 active:text-catchup-white"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
|
|
311
|
+
onClick: internalOnClick,
|
|
312
|
+
onMouseEnter: () => {
|
|
313
|
+
setIsHovered(true);
|
|
314
|
+
},
|
|
315
|
+
onMouseLeave: () => {
|
|
316
|
+
setIsHovered(false);
|
|
317
|
+
},
|
|
318
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
319
|
+
BaseLoading_default,
|
|
320
|
+
{
|
|
321
|
+
height: currentLoadingSize,
|
|
322
|
+
width: currentLoadingSize,
|
|
323
|
+
primaryColor: "#55777f",
|
|
324
|
+
secondaryColor: "#55777f"
|
|
325
|
+
}
|
|
326
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-row justify-center items-center gap-x-2 px-4", children: [
|
|
327
|
+
iconPosition === "left" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
328
|
+
BaseImage_default,
|
|
329
|
+
{
|
|
330
|
+
src: "/icons/new/secondary-button-arrow-left.png",
|
|
331
|
+
alt: "arrow-left",
|
|
332
|
+
size: "xsmall"
|
|
333
|
+
}
|
|
334
|
+
) : null,
|
|
335
|
+
iconOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "", children: title }),
|
|
336
|
+
textOnly || iconPosition === "left" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
337
|
+
BaseImage_default,
|
|
338
|
+
{
|
|
339
|
+
src: "/icons/secondary-button-arrow-right.png",
|
|
340
|
+
alt: "arrow-right",
|
|
341
|
+
size: "xsmall"
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
] })
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
};
|
|
348
|
+
var SecondaryButton_default = SecondaryButton;
|
|
349
|
+
|
|
350
|
+
// src/components/buttons/CreateButton.tsx
|
|
351
|
+
var import_react4 = require("react");
|
|
352
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
353
|
+
var CreateButton = ({
|
|
354
|
+
title,
|
|
355
|
+
size,
|
|
356
|
+
onClick,
|
|
357
|
+
disabled,
|
|
358
|
+
iconPosition,
|
|
359
|
+
textOnly,
|
|
360
|
+
iconOnly
|
|
361
|
+
}) => {
|
|
362
|
+
const [loading, setLoading] = (0, import_react4.useState)(false);
|
|
363
|
+
const internalOnClick = () => __async(void 0, null, function* () {
|
|
364
|
+
if (loading) return;
|
|
365
|
+
if (disabled) return;
|
|
366
|
+
setLoading(true);
|
|
367
|
+
yield onClick();
|
|
368
|
+
setLoading(false);
|
|
369
|
+
});
|
|
370
|
+
let currentWidthClassName;
|
|
371
|
+
let currentHeightClassName;
|
|
372
|
+
let currentLoadingSize;
|
|
373
|
+
if (size === "small") {
|
|
374
|
+
currentWidthClassName = "w-32";
|
|
375
|
+
currentHeightClassName = "h-8";
|
|
376
|
+
currentLoadingSize = 14;
|
|
377
|
+
} else if (size === "medium") {
|
|
378
|
+
currentWidthClassName = "w-32";
|
|
379
|
+
currentHeightClassName = "h-10";
|
|
380
|
+
currentLoadingSize = 16;
|
|
381
|
+
} else if (size === "large") {
|
|
382
|
+
currentWidthClassName = "w-32";
|
|
383
|
+
currentHeightClassName = "h-12";
|
|
384
|
+
currentLoadingSize = 18;
|
|
385
|
+
} else if (size === "unlimited") {
|
|
386
|
+
currentLoadingSize = 14;
|
|
387
|
+
currentHeightClassName = "h-8";
|
|
388
|
+
}
|
|
389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
390
|
+
"button",
|
|
391
|
+
{
|
|
392
|
+
className: `border border-catchup-blue-500 bg-catchup-blue-500 text-catchup-white rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-blue-700 active:bg-catchup-blue-500"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
|
|
393
|
+
onClick: internalOnClick,
|
|
394
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
395
|
+
BaseLoading_default,
|
|
396
|
+
{
|
|
397
|
+
height: currentLoadingSize,
|
|
398
|
+
width: currentLoadingSize,
|
|
399
|
+
primaryColor: "#ffffff",
|
|
400
|
+
secondaryColor: "#ffffff"
|
|
401
|
+
}
|
|
402
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-row justify-center items-center gap-x-2 px-4", children: [
|
|
403
|
+
iconPosition === "left" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
404
|
+
BaseImage_default,
|
|
405
|
+
{
|
|
406
|
+
src: "/icons/primary-button-create-white.png",
|
|
407
|
+
alt: "create",
|
|
408
|
+
size: "xsmall"
|
|
409
|
+
}
|
|
410
|
+
) : null,
|
|
411
|
+
iconOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "", children: title }),
|
|
412
|
+
textOnly || iconPosition === "left" ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
413
|
+
BaseImage_default,
|
|
414
|
+
{
|
|
415
|
+
src: "/icons/primary-button-create-white.png",
|
|
416
|
+
alt: "create",
|
|
417
|
+
size: "xsmall"
|
|
418
|
+
}
|
|
419
|
+
)
|
|
420
|
+
] })
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
};
|
|
424
|
+
var CreateButton_default = CreateButton;
|
|
425
|
+
|
|
426
|
+
// src/components/buttons/DeleteButton.tsx
|
|
427
|
+
var import_react5 = require("react");
|
|
428
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
429
|
+
var DeleteButton = ({
|
|
430
|
+
title,
|
|
431
|
+
size,
|
|
432
|
+
onClick,
|
|
433
|
+
disabled,
|
|
434
|
+
iconPosition,
|
|
435
|
+
textOnly,
|
|
436
|
+
iconOnly
|
|
437
|
+
}) => {
|
|
438
|
+
const [loading, setLoading] = (0, import_react5.useState)(false);
|
|
439
|
+
const [isHovered, setIsHovered] = (0, import_react5.useState)(false);
|
|
440
|
+
const internalOnClick = () => __async(void 0, null, function* () {
|
|
441
|
+
if (loading) return;
|
|
442
|
+
if (disabled) return;
|
|
443
|
+
setLoading(true);
|
|
444
|
+
yield onClick();
|
|
445
|
+
setLoading(false);
|
|
446
|
+
});
|
|
447
|
+
let currentWidthClassName;
|
|
448
|
+
let currentHeightClassName;
|
|
449
|
+
let currentLoadingSize;
|
|
450
|
+
if (size === "small") {
|
|
451
|
+
currentWidthClassName = "w-32";
|
|
452
|
+
currentHeightClassName = "h-8";
|
|
453
|
+
currentLoadingSize = 14;
|
|
454
|
+
} else if (size === "medium") {
|
|
455
|
+
currentWidthClassName = "w-32";
|
|
456
|
+
currentHeightClassName = "h-10";
|
|
457
|
+
currentLoadingSize = 16;
|
|
458
|
+
} else if (size === "large") {
|
|
459
|
+
currentWidthClassName = "w-32";
|
|
460
|
+
currentHeightClassName = "h-12";
|
|
461
|
+
currentLoadingSize = 18;
|
|
462
|
+
}
|
|
463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
464
|
+
"button",
|
|
465
|
+
{
|
|
466
|
+
className: `border border-catchup-red bg-catchup-white text-catchup-red rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-red hover:text-catchup-white hover:border-catchup-red active:bg-catchup-red active:hover:border-catchup-red active:text-catchup-white active:opacity-80"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
|
|
467
|
+
onClick: internalOnClick,
|
|
468
|
+
onMouseEnter: () => {
|
|
469
|
+
setIsHovered(true);
|
|
470
|
+
},
|
|
471
|
+
onMouseLeave: () => {
|
|
472
|
+
setIsHovered(false);
|
|
473
|
+
},
|
|
474
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
475
|
+
BaseLoading_default,
|
|
476
|
+
{
|
|
477
|
+
height: currentLoadingSize,
|
|
478
|
+
width: currentLoadingSize,
|
|
479
|
+
primaryColor: "#55777f",
|
|
480
|
+
secondaryColor: "#55777f"
|
|
481
|
+
}
|
|
482
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-row justify-center items-center gap-x-2", children: [
|
|
483
|
+
iconPosition === "left" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
484
|
+
BaseImage_default,
|
|
485
|
+
{
|
|
486
|
+
src: `${isHovered ? "/icons/remove-white.png" : "/icons/remove-red.png"}`,
|
|
487
|
+
alt: "remove-white",
|
|
488
|
+
size: "xsmall"
|
|
489
|
+
}
|
|
490
|
+
) : null,
|
|
491
|
+
iconOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "", children: title }),
|
|
492
|
+
textOnly || iconPosition === "left" ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
493
|
+
BaseImage_default,
|
|
494
|
+
{
|
|
495
|
+
src: `${isHovered ? "/icons/remove-white.png" : "/icons/remove-red.png"}`,
|
|
496
|
+
alt: "remove-white",
|
|
497
|
+
size: "xsmall"
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
] })
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
};
|
|
504
|
+
var DeleteButton_default = DeleteButton;
|
|
505
|
+
|
|
506
|
+
// src/components/buttons/CancelButton.tsx
|
|
507
|
+
var import_react6 = require("react");
|
|
508
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
509
|
+
var CancelButton = ({
|
|
510
|
+
title,
|
|
511
|
+
size,
|
|
512
|
+
onClick,
|
|
513
|
+
disabled,
|
|
514
|
+
iconPosition,
|
|
515
|
+
textOnly,
|
|
516
|
+
iconOnly
|
|
517
|
+
}) => {
|
|
518
|
+
const [loading, setLoading] = (0, import_react6.useState)(false);
|
|
519
|
+
const [isHovered, setIsHovered] = (0, import_react6.useState)(false);
|
|
520
|
+
const internalOnClick = () => __async(void 0, null, function* () {
|
|
521
|
+
if (loading) return;
|
|
522
|
+
if (disabled) return;
|
|
523
|
+
setLoading(true);
|
|
524
|
+
yield onClick();
|
|
525
|
+
setLoading(false);
|
|
526
|
+
});
|
|
527
|
+
let currentWidthClassName;
|
|
528
|
+
let currentHeightClassName;
|
|
529
|
+
let currentLoadingSize;
|
|
530
|
+
if (size === "small") {
|
|
531
|
+
currentWidthClassName = "w-32";
|
|
532
|
+
currentHeightClassName = "h-8";
|
|
533
|
+
currentLoadingSize = 14;
|
|
534
|
+
} else if (size === "medium") {
|
|
535
|
+
currentWidthClassName = "w-32";
|
|
536
|
+
currentHeightClassName = "h-10";
|
|
537
|
+
currentLoadingSize = 16;
|
|
538
|
+
} else if (size === "large") {
|
|
539
|
+
currentWidthClassName = "w-32";
|
|
540
|
+
currentHeightClassName = "h-12";
|
|
541
|
+
currentLoadingSize = 18;
|
|
542
|
+
} else if (size === "unlimited") {
|
|
543
|
+
currentLoadingSize = 14;
|
|
544
|
+
currentHeightClassName = "h-8";
|
|
545
|
+
}
|
|
546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
547
|
+
"button",
|
|
548
|
+
{
|
|
549
|
+
className: `border border-catchup-gray-400 bg-catchup-white text-catchup-gray-600 rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-gray-400 hover:text-catchup-white hover:border-catchup-gray-400 active:bg-catchup-gray-500 active:border-catchup-gray-500 active:text-catchup-white"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
|
|
550
|
+
onClick: internalOnClick,
|
|
551
|
+
onMouseEnter: () => {
|
|
552
|
+
setIsHovered(true);
|
|
553
|
+
},
|
|
554
|
+
onMouseLeave: () => {
|
|
555
|
+
setIsHovered(false);
|
|
556
|
+
},
|
|
557
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
558
|
+
BaseLoading_default,
|
|
559
|
+
{
|
|
560
|
+
height: currentLoadingSize,
|
|
561
|
+
width: currentLoadingSize,
|
|
562
|
+
primaryColor: "#55777f",
|
|
563
|
+
secondaryColor: "#55777f"
|
|
564
|
+
}
|
|
565
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-row justify-center items-center gap-x-2", children: [
|
|
566
|
+
iconPosition === "left" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
567
|
+
BaseImage_default,
|
|
568
|
+
{
|
|
569
|
+
src: `${isHovered ? "/icons/cancel-button-arrow-left-white.png" : "/icons/cancel-button-arrow-left.png"}`,
|
|
570
|
+
alt: "arrow-left",
|
|
571
|
+
size: "xsmall"
|
|
572
|
+
}
|
|
573
|
+
) : null,
|
|
574
|
+
iconOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "", children: title }),
|
|
575
|
+
textOnly || iconPosition === "left" ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
576
|
+
BaseImage_default,
|
|
577
|
+
{
|
|
578
|
+
src: `${isHovered ? "/icons/cancel-button-arrow-left-white.png" : "/icons/cancel-button-arrow-left.png"}`,
|
|
579
|
+
alt: "arrow-left",
|
|
580
|
+
size: "xsmall"
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
] })
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
};
|
|
587
|
+
var CancelButton_default = CancelButton;
|
|
588
|
+
|
|
589
|
+
// src/components/buttons/ApproveButton.tsx
|
|
590
|
+
var import_react7 = require("react");
|
|
591
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
592
|
+
var ApproveButton = ({
|
|
593
|
+
title,
|
|
594
|
+
size,
|
|
595
|
+
onClick,
|
|
596
|
+
disabled,
|
|
597
|
+
iconPosition,
|
|
598
|
+
textOnly,
|
|
599
|
+
iconOnly
|
|
600
|
+
}) => {
|
|
601
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
602
|
+
const internalOnClick = () => __async(void 0, null, function* () {
|
|
603
|
+
if (loading) return;
|
|
604
|
+
if (disabled) return;
|
|
605
|
+
setLoading(true);
|
|
606
|
+
yield onClick();
|
|
607
|
+
setLoading(false);
|
|
608
|
+
});
|
|
609
|
+
let currentWidthClassName;
|
|
610
|
+
let currentHeightClassName;
|
|
611
|
+
let currentLoadingSize;
|
|
612
|
+
if (size === "small") {
|
|
613
|
+
currentWidthClassName = "w-32";
|
|
614
|
+
currentHeightClassName = "h-8";
|
|
615
|
+
currentLoadingSize = 14;
|
|
616
|
+
} else if (size === "medium") {
|
|
617
|
+
currentWidthClassName = "w-32";
|
|
618
|
+
currentHeightClassName = "h-10";
|
|
619
|
+
currentLoadingSize = 16;
|
|
620
|
+
} else if (size === "large") {
|
|
621
|
+
currentWidthClassName = "w-32";
|
|
622
|
+
currentHeightClassName = "h-12";
|
|
623
|
+
currentLoadingSize = 18;
|
|
624
|
+
} else if (size === "unlimited") {
|
|
625
|
+
currentLoadingSize = 14;
|
|
626
|
+
currentHeightClassName = "h-8";
|
|
627
|
+
}
|
|
628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
629
|
+
"button",
|
|
630
|
+
{
|
|
631
|
+
className: `border border-catchup-green bg-catchup-green text-catchup-white rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-hover-green active:bg-catchup-green"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
|
|
632
|
+
onClick: internalOnClick,
|
|
633
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
634
|
+
BaseLoading_default,
|
|
635
|
+
{
|
|
636
|
+
height: currentLoadingSize,
|
|
637
|
+
width: currentLoadingSize,
|
|
638
|
+
primaryColor: "#ffffff",
|
|
639
|
+
secondaryColor: "#ffffff"
|
|
640
|
+
}
|
|
641
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-row justify-center items-center gap-x-2 px-4", children: [
|
|
642
|
+
iconPosition === "left" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
643
|
+
BaseImage_default,
|
|
644
|
+
{
|
|
645
|
+
src: "/icons/primary-button-arrow-left.png",
|
|
646
|
+
alt: "arrow-left",
|
|
647
|
+
size: "xsmall"
|
|
648
|
+
}
|
|
649
|
+
) : null,
|
|
650
|
+
iconOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "", children: title }),
|
|
651
|
+
textOnly || iconPosition === "left" ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
652
|
+
BaseImage_default,
|
|
653
|
+
{
|
|
654
|
+
src: "/icons/primary-button-arrow-right.png",
|
|
655
|
+
alt: "arrow-right",
|
|
656
|
+
size: "xsmall"
|
|
657
|
+
}
|
|
658
|
+
)
|
|
659
|
+
] })
|
|
660
|
+
}
|
|
661
|
+
);
|
|
662
|
+
};
|
|
663
|
+
var ApproveButton_default = ApproveButton;
|
|
664
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
665
|
+
0 && (module.exports = {
|
|
666
|
+
ApproveButton,
|
|
667
|
+
BaseImage,
|
|
668
|
+
BaseLoading,
|
|
669
|
+
CancelButton,
|
|
670
|
+
CreateButton,
|
|
671
|
+
DeleteButton,
|
|
672
|
+
PrimaryButton,
|
|
673
|
+
SecondaryButton
|
|
674
|
+
});
|