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