@emiketic/lib-mantine 1.0.0 → 1.0.2
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/index.js +215 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +627 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +9 -5
- package/dist/index.cjs +0 -663
- package/dist/index.cjs.map +0 -1
- /package/dist/{index.d.cts → index.d.mts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,28 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
ClientOnly: () => ClientOnly,
|
|
35
|
+
ConfirmBar: () => ConfirmBar_default,
|
|
36
|
+
ContentLoader: () => ContentLoader_default,
|
|
37
|
+
ImageInput: () => ImageInput_default,
|
|
38
|
+
Logo: () => Logo_default,
|
|
39
|
+
NativePDFViewer: () => NativePDFViewer,
|
|
40
|
+
NoData: () => NoData_default,
|
|
41
|
+
PageContainer: () => PageContainer_default,
|
|
42
|
+
PhoneInput: () => PhoneInput_default,
|
|
43
|
+
TextEditor: () => TextEditor_default,
|
|
44
|
+
ThemeToggle: () => ThemeToggle_default
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(src_exports);
|
|
47
|
+
|
|
1
48
|
// src/components/ClientOnly/index.tsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
49
|
+
var import_react = require("react");
|
|
50
|
+
var import_core = require("@mantine/core");
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
5
52
|
function ClientOnly({
|
|
6
53
|
children,
|
|
7
54
|
withLoader = false,
|
|
8
55
|
...delegated
|
|
9
56
|
}) {
|
|
10
|
-
const [hasMounted, setHasMounted] = useState(false);
|
|
11
|
-
useEffect(() => {
|
|
57
|
+
const [hasMounted, setHasMounted] = (0, import_react.useState)(false);
|
|
58
|
+
(0, import_react.useEffect)(() => {
|
|
12
59
|
setHasMounted(true);
|
|
13
60
|
}, []);
|
|
14
61
|
if (!hasMounted) {
|
|
15
62
|
if (withLoader) {
|
|
16
|
-
return /* @__PURE__ */ jsx(LoadingOverlay, {});
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.LoadingOverlay, {});
|
|
17
64
|
}
|
|
18
65
|
return null;
|
|
19
66
|
}
|
|
20
|
-
return /* @__PURE__ */ jsx("div", { ...delegated, children });
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...delegated, children });
|
|
21
68
|
}
|
|
22
69
|
|
|
23
70
|
// src/components/ConfirmBar/index.tsx
|
|
24
|
-
|
|
25
|
-
|
|
71
|
+
var import_core2 = require("@mantine/core");
|
|
72
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
26
73
|
function ConfirmBar({
|
|
27
74
|
onConfirm = () => {
|
|
28
75
|
},
|
|
@@ -35,10 +82,10 @@ function ConfirmBar({
|
|
|
35
82
|
withCancel = true,
|
|
36
83
|
...props
|
|
37
84
|
}) {
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
withCancel ? /* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
Button,
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.Box, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { h: "100%", justify: "flex-end", align: "center", children: [
|
|
86
|
+
withCancel ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.Button, { onClick: () => onCancel(), variant: "subtle", children: labelProps?.cancel ?? "Cancel" }) : null,
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
88
|
+
import_core2.Button,
|
|
42
89
|
{
|
|
43
90
|
onClick: () => onConfirm(),
|
|
44
91
|
disabled,
|
|
@@ -53,9 +100,9 @@ function ConfirmBar({
|
|
|
53
100
|
var ConfirmBar_default = ConfirmBar;
|
|
54
101
|
|
|
55
102
|
// src/components/ContentLoader/index.tsx
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
103
|
+
var import_react2 = require("react");
|
|
104
|
+
var import_core3 = require("@mantine/core");
|
|
105
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
59
106
|
function ContentLoader({
|
|
60
107
|
numberOfBars = 3,
|
|
61
108
|
numberOfBarGroups = 3,
|
|
@@ -69,25 +116,25 @@ function ContentLoader({
|
|
|
69
116
|
if (!visible) {
|
|
70
117
|
return null;
|
|
71
118
|
}
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
withCircle ? /* @__PURE__ */
|
|
74
|
-
Array.from({ length: numberOfBarGroups }).map((_, index) => /* @__PURE__ */
|
|
75
|
-
Array.from({ length: Math.ceil(numberOfBars / numberOfBarGroups) }).map((_2, index2) => /* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core3.Stack, { gap: "sm", px: "5rem", py: "md", ...props, children: [
|
|
120
|
+
withCircle ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Skeleton, { height: 70, circle: true, mb: "xl" }) : null,
|
|
121
|
+
Array.from({ length: numberOfBarGroups }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react2.Fragment, { children: [
|
|
122
|
+
Array.from({ length: Math.ceil(numberOfBars / numberOfBarGroups) }).map((_2, index2) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react2.Fragment, { children: [
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Skeleton, { height: barHeight, radius: "xl" }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Skeleton, { height: barHeight, mt: barSpacing, radius: "xl" }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Skeleton, { height: barHeight, mt: barSpacing, width: "70%", radius: "xl" })
|
|
79
126
|
] }, index2)),
|
|
80
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Space, { h: barGroupSpacing })
|
|
81
128
|
] }, index))
|
|
82
129
|
] });
|
|
83
130
|
}
|
|
84
131
|
var ContentLoader_default = ContentLoader;
|
|
85
132
|
|
|
86
133
|
// src/components/ImageInput/index.tsx
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
134
|
+
var import_react3 = require("react");
|
|
135
|
+
var import_core4 = require("@mantine/core");
|
|
136
|
+
var import_icons_react = require("@tabler/icons-react");
|
|
137
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
91
138
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5e5;
|
|
92
139
|
var isClient = () => typeof window !== "undefined";
|
|
93
140
|
function ImageInput({
|
|
@@ -96,11 +143,11 @@ function ImageInput({
|
|
|
96
143
|
maxFileSizeBytes = DEFAULT_MAX_FILE_SIZE_BYTES,
|
|
97
144
|
...props
|
|
98
145
|
}) {
|
|
99
|
-
const [imageUrl, setImageUrl] =
|
|
146
|
+
const [imageUrl, setImageUrl] = (0, import_react3.useState)(null);
|
|
100
147
|
const largeFile = isClient() && value && value instanceof File && value.size >= maxFileSizeBytes;
|
|
101
148
|
const isFileValue = isClient() && value instanceof File;
|
|
102
149
|
const isString = typeof value == "string";
|
|
103
|
-
|
|
150
|
+
(0, import_react3.useEffect)(() => {
|
|
104
151
|
if (isFileValue) {
|
|
105
152
|
setImageUrl(URL.createObjectURL(value));
|
|
106
153
|
} else if (isString) {
|
|
@@ -108,8 +155,8 @@ function ImageInput({
|
|
|
108
155
|
}
|
|
109
156
|
}, [value, isFileValue, isString]);
|
|
110
157
|
if (props.disabled && !isFileValue) {
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
Avatar,
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
159
|
+
import_core4.Avatar,
|
|
113
160
|
{
|
|
114
161
|
size: "xl",
|
|
115
162
|
src: imageUrl,
|
|
@@ -117,9 +164,9 @@ function ImageInput({
|
|
|
117
164
|
}
|
|
118
165
|
);
|
|
119
166
|
}
|
|
120
|
-
return /* @__PURE__ */
|
|
121
|
-
withPreview && /* @__PURE__ */
|
|
122
|
-
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core4.Group, { children: [
|
|
168
|
+
withPreview && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.Paper, { radius: "md", p: "sm", withBorder: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
169
|
+
import_core4.Image,
|
|
123
170
|
{
|
|
124
171
|
w: "5rem",
|
|
125
172
|
h: "5rem",
|
|
@@ -129,11 +176,11 @@ function ImageInput({
|
|
|
129
176
|
...props.previewProps
|
|
130
177
|
}
|
|
131
178
|
) }),
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
FileInput,
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
180
|
+
import_core4.FileInput,
|
|
134
181
|
{
|
|
135
182
|
styles: { input: { fontSize: "var(--mantine-font-size-xs)" } },
|
|
136
|
-
leftSection: /* @__PURE__ */
|
|
183
|
+
leftSection: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.ActionIcon, { variant: "light", size: "xs", color: "gray", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons_react.IconUpload, {}) }),
|
|
137
184
|
placeholder: "Upload",
|
|
138
185
|
error: largeFile ? `File size must be under ${maxFileSizeBytes / 1e3} KB` : void 0,
|
|
139
186
|
onChange: (file) => {
|
|
@@ -150,12 +197,12 @@ function ImageInput({
|
|
|
150
197
|
var ImageInput_default = ImageInput;
|
|
151
198
|
|
|
152
199
|
// src/components/Logo/index.tsx
|
|
153
|
-
|
|
154
|
-
|
|
200
|
+
var import_react4 = require("react");
|
|
201
|
+
var import_core6 = require("@mantine/core");
|
|
155
202
|
|
|
156
203
|
// src/utils/colors.ts
|
|
157
|
-
|
|
158
|
-
|
|
204
|
+
var import_chroma_js = __toESM(require("chroma-js"));
|
|
205
|
+
var import_core5 = require("@mantine/core");
|
|
159
206
|
function loadImage(imageUrl) {
|
|
160
207
|
return new Promise((resolve, reject) => {
|
|
161
208
|
const image = new Image();
|
|
@@ -177,7 +224,7 @@ function extractQuantizedPixels(imageData) {
|
|
|
177
224
|
const red = quantizeChannel(imageData[index] ?? 0);
|
|
178
225
|
const green = quantizeChannel(imageData[index + 1] ?? 0);
|
|
179
226
|
const blue = quantizeChannel(imageData[index + 2] ?? 0);
|
|
180
|
-
colors.push(
|
|
227
|
+
colors.push((0, import_chroma_js.default)(red, green, blue).hex());
|
|
181
228
|
}
|
|
182
229
|
return colors;
|
|
183
230
|
}
|
|
@@ -194,7 +241,7 @@ function extractEdgeQuantizedPixels(imageData, width, height) {
|
|
|
194
241
|
const red = quantizeChannel(imageData[pixelIndex] ?? 0);
|
|
195
242
|
const green = quantizeChannel(imageData[pixelIndex + 1] ?? 0);
|
|
196
243
|
const blue = quantizeChannel(imageData[pixelIndex + 2] ?? 0);
|
|
197
|
-
edgeColors.push(
|
|
244
|
+
edgeColors.push((0, import_chroma_js.default)(red, green, blue).hex());
|
|
198
245
|
}
|
|
199
246
|
}
|
|
200
247
|
return edgeColors;
|
|
@@ -233,7 +280,7 @@ var getDominantColorFromImageUrl = async (imageUrl, fallbackDominantColor = "#00
|
|
|
233
280
|
const edgePixels = extractEdgeQuantizedPixels(imageData, canvas.width, canvas.height);
|
|
234
281
|
const background = getMostFrequentColor(edgePixels) ?? getMostFrequentColor(allPixels);
|
|
235
282
|
const dominant = getMostFrequentColor(
|
|
236
|
-
background ? allPixels.filter((hex) =>
|
|
283
|
+
background ? allPixels.filter((hex) => import_chroma_js.default.distance(hex, background, "rgb") > 28) : allPixels
|
|
237
284
|
) ?? getMostFrequentColor(allPixels);
|
|
238
285
|
return {
|
|
239
286
|
dominant: dominant ?? fallbackDominantColor,
|
|
@@ -245,14 +292,14 @@ var getDominantColorFromImageUrl = async (imageUrl, fallbackDominantColor = "#00
|
|
|
245
292
|
};
|
|
246
293
|
|
|
247
294
|
// src/components/Logo/index.tsx
|
|
248
|
-
|
|
249
|
-
|
|
295
|
+
var import_icons_react2 = require("@tabler/icons-react");
|
|
296
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
250
297
|
function Logo({ withColorPair = true, ...props }) {
|
|
251
|
-
const [logoColorPair, setLogoColorPair] =
|
|
298
|
+
const [logoColorPair, setLogoColorPair] = (0, import_react4.useState)({
|
|
252
299
|
dominant: "#000000",
|
|
253
300
|
background: "#ffffff"
|
|
254
301
|
});
|
|
255
|
-
|
|
302
|
+
(0, import_react4.useEffect)(() => {
|
|
256
303
|
let isMounted = true;
|
|
257
304
|
if (props.src && withColorPair) {
|
|
258
305
|
getDominantColorFromImageUrl(props.src).then(({ dominant, background }) => {
|
|
@@ -267,8 +314,8 @@ function Logo({ withColorPair = true, ...props }) {
|
|
|
267
314
|
isMounted = false;
|
|
268
315
|
};
|
|
269
316
|
}, [props.src, withColorPair]);
|
|
270
|
-
return /* @__PURE__ */
|
|
271
|
-
|
|
317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
318
|
+
import_core6.Avatar,
|
|
272
319
|
{
|
|
273
320
|
size: "5rem",
|
|
274
321
|
radius: "lg",
|
|
@@ -282,16 +329,16 @@ function Logo({ withColorPair = true, ...props }) {
|
|
|
282
329
|
},
|
|
283
330
|
imageProps: { referrerPolicy: "no-referrer" },
|
|
284
331
|
...props,
|
|
285
|
-
children: /* @__PURE__ */
|
|
332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core6.ThemeIcon, { variant: "transparent", size: "5rem", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons_react2.IconBuildingSkyscraper, { size: 48 * 1.5, stroke: 1 }) })
|
|
286
333
|
}
|
|
287
334
|
);
|
|
288
335
|
}
|
|
289
336
|
var Logo_default = Logo;
|
|
290
337
|
|
|
291
338
|
// src/components/NativePDFViewer/index.tsx
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
339
|
+
var import_react5 = require("react");
|
|
340
|
+
var import_core7 = require("@mantine/core");
|
|
341
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
295
342
|
function getBrowser() {
|
|
296
343
|
const { userAgent } = navigator;
|
|
297
344
|
const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
|
|
@@ -311,7 +358,7 @@ function NativePDFViewer({
|
|
|
311
358
|
withToolbar = true,
|
|
312
359
|
fallback = "Cannot display PDF on this browser. Use a different browser or download the PDF."
|
|
313
360
|
}) {
|
|
314
|
-
const [loading, setLoading] =
|
|
361
|
+
const [loading, setLoading] = (0, import_react5.useState)(false);
|
|
315
362
|
const toolbarHeight = {
|
|
316
363
|
Safari: 0,
|
|
317
364
|
Edge: 40,
|
|
@@ -330,8 +377,8 @@ function NativePDFViewer({
|
|
|
330
377
|
if (!mediaUrl) {
|
|
331
378
|
return null;
|
|
332
379
|
}
|
|
333
|
-
return /* @__PURE__ */
|
|
334
|
-
|
|
380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
381
|
+
import_core7.Box,
|
|
335
382
|
{
|
|
336
383
|
w: "100%",
|
|
337
384
|
h: toolbarHeight ? `calc(100% + ${toolbarHeight}px)` : "100%",
|
|
@@ -339,8 +386,8 @@ function NativePDFViewer({
|
|
|
339
386
|
transform: toolbarHeight ? `translateY(-${toolbarHeight}px)` : void 0
|
|
340
387
|
},
|
|
341
388
|
children: [
|
|
342
|
-
loading ? /* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
389
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core7.Center, { h: "100%", w: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core7.Loader, { size: "xl" }) }) : null,
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
344
391
|
"object",
|
|
345
392
|
{
|
|
346
393
|
data: `${mediaUrl}${optionsString}`,
|
|
@@ -349,7 +396,7 @@ function NativePDFViewer({
|
|
|
349
396
|
height: "100%",
|
|
350
397
|
onLoad: () => setLoading(false),
|
|
351
398
|
onError: () => setLoading(false),
|
|
352
|
-
children: /* @__PURE__ */
|
|
399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core7.Box, { children: renderFallback() })
|
|
353
400
|
}
|
|
354
401
|
)
|
|
355
402
|
]
|
|
@@ -358,16 +405,16 @@ function NativePDFViewer({
|
|
|
358
405
|
}
|
|
359
406
|
|
|
360
407
|
// src/components/NoData/index.tsx
|
|
361
|
-
|
|
362
|
-
|
|
408
|
+
var import_core8 = require("@mantine/core");
|
|
409
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
363
410
|
function NoData({ title, children, alertProps, ...props }) {
|
|
364
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core8.Center, { h: "100%", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core8.Alert, { p: "3rem", title: title ?? "No data", ...alertProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core8.Center, { children }) }) });
|
|
365
412
|
}
|
|
366
413
|
var NoData_default = NoData;
|
|
367
414
|
|
|
368
415
|
// src/components/PageContainer/index.tsx
|
|
369
|
-
|
|
370
|
-
|
|
416
|
+
var import_core9 = require("@mantine/core");
|
|
417
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
371
418
|
function PageContainer({
|
|
372
419
|
children,
|
|
373
420
|
title,
|
|
@@ -383,7 +430,7 @@ function PageContainer({
|
|
|
383
430
|
}) {
|
|
384
431
|
function getTitle() {
|
|
385
432
|
if (title) {
|
|
386
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core9.Title, { order: 2, ...titleProps, children: title });
|
|
387
434
|
}
|
|
388
435
|
return null;
|
|
389
436
|
}
|
|
@@ -391,64 +438,61 @@ function PageContainer({
|
|
|
391
438
|
if (header) {
|
|
392
439
|
return header;
|
|
393
440
|
}
|
|
394
|
-
return /* @__PURE__ */
|
|
441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core9.Group, { justify: "space-between", w: "100%", ...headerProps, children: [
|
|
395
442
|
getTitle(),
|
|
396
443
|
rightSection
|
|
397
444
|
] });
|
|
398
445
|
}
|
|
399
446
|
function getContent() {
|
|
400
447
|
if (fullPage) {
|
|
401
|
-
return /* @__PURE__ */
|
|
448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core9.Box, { ...contentProps, children });
|
|
402
449
|
}
|
|
403
|
-
return /* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core9.Stack, { gap: "xl", ...outerContentProps, children: [
|
|
404
451
|
getHeader(),
|
|
405
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core9.Stack, { px: "xl", py: "lg", h: "100%", w: "100%", ...contentProps, children })
|
|
406
453
|
] });
|
|
407
454
|
}
|
|
408
455
|
if (withContentScroll) {
|
|
409
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core9.ScrollArea, { h: "100vh", p: 0, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core9.Container, { fluid: true, children: getContent() }) });
|
|
410
457
|
}
|
|
411
|
-
return /* @__PURE__ */
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core9.Container, { p: 0, w: "100%", fluid: true, children: getContent() });
|
|
412
459
|
}
|
|
413
460
|
var PageContainer_default = PageContainer;
|
|
414
461
|
|
|
415
462
|
// src/components/PhoneInput/index.tsx
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
import { Group as Group4, Select, TextInput } from "@mantine/core";
|
|
423
|
-
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
424
|
-
var COUNTRY_CODES = getCountries();
|
|
463
|
+
var import_react6 = require("react");
|
|
464
|
+
var import_countries_list = require("countries-list");
|
|
465
|
+
var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
|
|
466
|
+
var import_core10 = require("@mantine/core");
|
|
467
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
468
|
+
var COUNTRY_CODES = (0, import_libphonenumber_js.getCountries)();
|
|
425
469
|
function PhoneInput({ value, defaultValue, defaultCountryCode, ...props }) {
|
|
426
470
|
const valueNumber = value ?? "";
|
|
427
|
-
const valueNumberData =
|
|
471
|
+
const valueNumberData = (0, import_libphonenumber_js.default)(valueNumber);
|
|
428
472
|
let valueNumberCountryCode;
|
|
429
473
|
if (valueNumberData?.isValid()) {
|
|
430
474
|
valueNumberCountryCode = valueNumberData.country;
|
|
431
475
|
}
|
|
432
|
-
const [selectedCountryCode, setSelectedCountryCode] =
|
|
476
|
+
const [selectedCountryCode, setSelectedCountryCode] = (0, import_react6.useState)(
|
|
433
477
|
defaultCountryCode
|
|
434
478
|
);
|
|
435
|
-
const selectedCountryCodeCallingNumber = selectedCountryCode ? getCountryCallingCode(selectedCountryCode) : void 0;
|
|
436
|
-
|
|
479
|
+
const selectedCountryCodeCallingNumber = selectedCountryCode ? (0, import_libphonenumber_js.getCountryCallingCode)(selectedCountryCode) : void 0;
|
|
480
|
+
(0, import_react6.useEffect)(() => {
|
|
437
481
|
if (selectedCountryCode && selectedCountryCode !== valueNumberCountryCode) {
|
|
438
482
|
const code = selectedCountryCode ?? defaultCountryCode ?? "";
|
|
439
|
-
const callingCode = getCountryCallingCode(code);
|
|
483
|
+
const callingCode = (0, import_libphonenumber_js.getCountryCallingCode)(code);
|
|
440
484
|
if (props.onChange) {
|
|
441
485
|
const numberUpdate = `+${callingCode}${valueNumber.replace(callingCode, "")}`;
|
|
442
|
-
const numberUpdateData =
|
|
486
|
+
const numberUpdateData = (0, import_libphonenumber_js.default)(numberUpdate, selectedCountryCode);
|
|
443
487
|
if (numberUpdateData?.isValid()) {
|
|
444
488
|
props.onChange(`+${callingCode}${valueNumber.replace(callingCode, "")}`);
|
|
445
489
|
}
|
|
446
490
|
}
|
|
447
491
|
}
|
|
448
492
|
}, [selectedCountryCode]);
|
|
449
|
-
return /* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
Select,
|
|
493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core10.Group, { wrap: "nowrap", children: [
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
495
|
+
import_core10.Select,
|
|
452
496
|
{
|
|
453
497
|
label: "Country code",
|
|
454
498
|
size: "sm",
|
|
@@ -463,27 +507,27 @@ function PhoneInput({ value, defaultValue, defaultCountryCode, ...props }) {
|
|
|
463
507
|
}
|
|
464
508
|
},
|
|
465
509
|
data: COUNTRY_CODES.map((code) => {
|
|
466
|
-
const countryCallingCode = getCountryCallingCode(code);
|
|
467
|
-
const countryName = getCountryData(code).name;
|
|
510
|
+
const countryCallingCode = (0, import_libphonenumber_js.getCountryCallingCode)(code);
|
|
511
|
+
const countryName = (0, import_countries_list.getCountryData)(code).name;
|
|
468
512
|
return {
|
|
469
513
|
value: code,
|
|
470
|
-
label: `${countryName} ${getEmojiFlag(code)} +${countryCallingCode}`
|
|
514
|
+
label: `${countryName} ${(0, import_countries_list.getEmojiFlag)(code)} +${countryCallingCode}`
|
|
471
515
|
};
|
|
472
516
|
}),
|
|
473
|
-
rightSection: props.disabled ? /* @__PURE__ */
|
|
517
|
+
rightSection: props.disabled ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, {}) : void 0,
|
|
474
518
|
disabled: props.disabled,
|
|
475
519
|
searchable: true
|
|
476
520
|
}
|
|
477
521
|
),
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
TextInput,
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
523
|
+
import_core10.TextInput,
|
|
480
524
|
{
|
|
481
525
|
...props,
|
|
482
526
|
defaultValue: valueNumberData?.nationalNumber,
|
|
483
527
|
onChange: (e) => {
|
|
484
528
|
if (props.onChange && selectedCountryCodeCallingNumber) {
|
|
485
529
|
const numberUpdate = `+${selectedCountryCodeCallingNumber}${e.currentTarget.value.replace(selectedCountryCodeCallingNumber, "")}`;
|
|
486
|
-
const numberUpdateData =
|
|
530
|
+
const numberUpdateData = (0, import_libphonenumber_js.default)(numberUpdate, selectedCountryCode);
|
|
487
531
|
if (numberUpdateData?.isValid()) {
|
|
488
532
|
props.onChange(numberUpdateData.number);
|
|
489
533
|
}
|
|
@@ -496,16 +540,16 @@ function PhoneInput({ value, defaultValue, defaultCountryCode, ...props }) {
|
|
|
496
540
|
var PhoneInput_default = PhoneInput;
|
|
497
541
|
|
|
498
542
|
// src/components/TextEditor/index.tsx
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
543
|
+
var import_react7 = require("react");
|
|
544
|
+
var import_extension_highlight = __toESM(require("@tiptap/extension-highlight"));
|
|
545
|
+
var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
|
|
546
|
+
var import_extension_superscript = __toESM(require("@tiptap/extension-superscript"));
|
|
547
|
+
var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
|
|
548
|
+
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
549
|
+
var import_react8 = require("@tiptap/react");
|
|
550
|
+
var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
|
|
551
|
+
var import_tiptap = require("@mantine/tiptap");
|
|
552
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
509
553
|
function TextEditor({
|
|
510
554
|
content,
|
|
511
555
|
value,
|
|
@@ -515,91 +559,85 @@ function TextEditor({
|
|
|
515
559
|
},
|
|
516
560
|
...props
|
|
517
561
|
}) {
|
|
518
|
-
const editor = useEditor({
|
|
562
|
+
const editor = (0, import_react8.useEditor)({
|
|
519
563
|
editable: true,
|
|
520
564
|
extensions: [
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
Link,
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
565
|
+
import_starter_kit.default,
|
|
566
|
+
import_extension_underline.default,
|
|
567
|
+
import_tiptap.Link,
|
|
568
|
+
import_extension_superscript.default,
|
|
569
|
+
import_extension_subscript.default,
|
|
570
|
+
import_extension_highlight.default,
|
|
571
|
+
import_extension_text_align.default.configure({ types: ["heading", "paragraph"] })
|
|
528
572
|
],
|
|
529
573
|
content
|
|
530
574
|
});
|
|
531
|
-
|
|
575
|
+
(0, import_react7.useEffect)(() => {
|
|
532
576
|
onChangeEditorHTML(editor?.getHTML());
|
|
533
577
|
onChange(editor?.getHTML());
|
|
534
578
|
}, [editor?.state, editor, onChangeEditorHTML, onChange]);
|
|
535
|
-
return /* @__PURE__ */
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_tiptap.RichTextEditor, { editor, ...props, children: [
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_tiptap.RichTextEditor.Toolbar, { sticky: true, stickyOffset: 60, children: [
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_tiptap.RichTextEditor.ControlsGroup, { children: [
|
|
582
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Bold, {}),
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Italic, {}),
|
|
584
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Underline, {}),
|
|
585
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Strikethrough, {}),
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.ClearFormatting, {}),
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Highlight, {}),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Code, {})
|
|
545
589
|
] }),
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_tiptap.RichTextEditor.ControlsGroup, { children: [
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.H1, {}),
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.H2, {}),
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.H3, {}),
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.H4, {})
|
|
551
595
|
] }),
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
558
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_tiptap.RichTextEditor.ControlsGroup, { children: [
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Blockquote, {}),
|
|
598
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Hr, {}),
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.BulletList, {}),
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.OrderedList, {}),
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Subscript, {}),
|
|
602
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Superscript, {})
|
|
559
603
|
] }),
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_tiptap.RichTextEditor.ControlsGroup, { children: [
|
|
605
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Link, {}),
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Unlink, {})
|
|
563
607
|
] }),
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
/* @__PURE__ */
|
|
566
|
-
/* @__PURE__ */
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_tiptap.RichTextEditor.ControlsGroup, { children: [
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.AlignLeft, {}),
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.AlignCenter, {}),
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.AlignJustify, {}),
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.AlignRight, {})
|
|
569
613
|
] })
|
|
570
614
|
] }),
|
|
571
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_tiptap.RichTextEditor.Content, {})
|
|
572
616
|
] });
|
|
573
617
|
}
|
|
574
618
|
var TextEditor_default = TextEditor;
|
|
575
619
|
|
|
576
620
|
// src/components/ThemeToggle/index.tsx
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
Tooltip,
|
|
581
|
-
useComputedColorScheme,
|
|
582
|
-
useMantineColorScheme
|
|
583
|
-
} from "@mantine/core";
|
|
584
|
-
import { IconMoon as IconSwitchDark, IconSun as IconSwitchLight } from "@tabler/icons-react";
|
|
585
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
621
|
+
var import_core11 = require("@mantine/core");
|
|
622
|
+
var import_icons_react3 = require("@tabler/icons-react");
|
|
623
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
586
624
|
function ThemeToggle({ ...props }) {
|
|
587
|
-
const { setColorScheme } = useMantineColorScheme();
|
|
588
|
-
const computedColorScheme = useComputedColorScheme("light", { getInitialValueInEffect: true });
|
|
589
|
-
return /* @__PURE__ */
|
|
590
|
-
Tooltip,
|
|
625
|
+
const { setColorScheme } = (0, import_core11.useMantineColorScheme)();
|
|
626
|
+
const computedColorScheme = (0, import_core11.useComputedColorScheme)("light", { getInitialValueInEffect: true });
|
|
627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
628
|
+
import_core11.Tooltip,
|
|
591
629
|
{
|
|
592
630
|
label: computedColorScheme === "light" ? "Switch to dark mode" : "Switch to light mode",
|
|
593
631
|
position: "bottom",
|
|
594
632
|
withinPortal: true,
|
|
595
|
-
children: /* @__PURE__ */
|
|
596
|
-
Switch,
|
|
633
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ClientOnly, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
634
|
+
import_core11.Switch,
|
|
597
635
|
{
|
|
598
636
|
styles: { track: { cursor: "pointer" } },
|
|
599
637
|
defaultChecked: computedColorScheme === "dark",
|
|
600
638
|
onChange: () => setColorScheme(computedColorScheme === "light" ? "dark" : "light"),
|
|
601
|
-
onLabel: /* @__PURE__ */
|
|
602
|
-
offLabel: /* @__PURE__ */
|
|
639
|
+
onLabel: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core11.ThemeIcon, { size: props.size ?? "sm", variant: "transparent", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons_react3.IconMoon, {}) }),
|
|
640
|
+
offLabel: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_core11.ThemeIcon, { size: props.size ?? "sm", color: "yellow", variant: "transparent", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons_react3.IconSun, {}) }),
|
|
603
641
|
color: "dark",
|
|
604
642
|
size: "md",
|
|
605
643
|
...props
|
|
@@ -609,17 +647,18 @@ function ThemeToggle({ ...props }) {
|
|
|
609
647
|
);
|
|
610
648
|
}
|
|
611
649
|
var ThemeToggle_default = ThemeToggle;
|
|
612
|
-
export
|
|
650
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
651
|
+
0 && (module.exports = {
|
|
613
652
|
ClientOnly,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
653
|
+
ConfirmBar,
|
|
654
|
+
ContentLoader,
|
|
655
|
+
ImageInput,
|
|
656
|
+
Logo,
|
|
618
657
|
NativePDFViewer,
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
};
|
|
658
|
+
NoData,
|
|
659
|
+
PageContainer,
|
|
660
|
+
PhoneInput,
|
|
661
|
+
TextEditor,
|
|
662
|
+
ThemeToggle
|
|
663
|
+
});
|
|
625
664
|
//# sourceMappingURL=index.js.map
|