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