@abpjs/theme-shared 2.7.0 → 2.9.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/dist/constants/styles.d.ts +9 -1
- package/dist/handlers/index.d.ts +1 -0
- package/dist/handlers/lazy-style.handler.d.ts +96 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +361 -211
- package/dist/index.mjs +153 -18
- package/dist/models/common.d.ts +6 -0
- package/dist/models/confirmation.d.ts +12 -2
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/lazy-styles.token.d.ts +38 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/nav-items.d.ts +110 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -34,18 +34,22 @@ __export(index_exports, {
|
|
|
34
34
|
AbpModalFooter: () => AbpModalFooter,
|
|
35
35
|
AbpModalHeader: () => AbpModalHeader,
|
|
36
36
|
Alert: () => Alert,
|
|
37
|
+
BOOTSTRAP: () => BOOTSTRAP,
|
|
37
38
|
Button: () => Button3,
|
|
38
|
-
ChakraDialog: () =>
|
|
39
|
+
ChakraDialog: () => import_react15.Dialog,
|
|
39
40
|
ChangePassword: () => ChangePassword,
|
|
40
41
|
Checkbox: () => Checkbox,
|
|
41
42
|
Confirmation: () => Confirmation,
|
|
42
43
|
ConfirmationDialog: () => ConfirmationDialog,
|
|
43
44
|
ConfirmationProvider: () => ConfirmationProvider,
|
|
45
|
+
DEFAULT_LAZY_STYLES: () => DEFAULT_LAZY_STYLES,
|
|
44
46
|
DEFAULT_STYLES: () => DEFAULT_STYLES,
|
|
45
47
|
ErrorComponent: () => ErrorComponent,
|
|
46
48
|
FormField: () => FormField,
|
|
47
49
|
HTTP_ERROR_CONFIG: () => HTTP_ERROR_CONFIG,
|
|
48
50
|
HttpErrorConfigContext: () => HttpErrorConfigContext,
|
|
51
|
+
LAZY_STYLES: () => LAZY_STYLES,
|
|
52
|
+
LazyStylesContext: () => LazyStylesContext,
|
|
49
53
|
LoaderBar: () => LoaderBar,
|
|
50
54
|
Modal: () => Modal,
|
|
51
55
|
ModalBody: () => AbpModalBody,
|
|
@@ -63,10 +67,16 @@ __export(index_exports, {
|
|
|
63
67
|
Toaster: () => Toaster,
|
|
64
68
|
ToasterProvider: () => ToasterProvider,
|
|
65
69
|
abpSystem: () => abpSystem,
|
|
70
|
+
addNavItem: () => addNavItem,
|
|
71
|
+
clearNavItems: () => clearNavItems,
|
|
66
72
|
createAbpSystem: () => createAbpSystem,
|
|
67
73
|
createErrorInterceptor: () => createErrorInterceptor,
|
|
74
|
+
createLazyStyleHref: () => createLazyStyleHref,
|
|
68
75
|
defaultAbpConfig: () => defaultAbpConfig,
|
|
69
|
-
defineConfig: () =>
|
|
76
|
+
defineConfig: () => import_react26.defineConfig,
|
|
77
|
+
getLoadedBootstrapDirection: () => getLoadedBootstrapDirection,
|
|
78
|
+
getNavItems: () => getNavItems,
|
|
79
|
+
getNavItemsSync: () => getNavItemsSync,
|
|
70
80
|
getPasswordSettings: () => getPasswordSettings,
|
|
71
81
|
getPasswordValidationRules: () => getPasswordValidationRules,
|
|
72
82
|
getPasswordValidators: () => getPasswordValidators,
|
|
@@ -74,12 +84,17 @@ __export(index_exports, {
|
|
|
74
84
|
getSeverityBorderColor: () => getSeverityBorderColor,
|
|
75
85
|
getSeverityColorScheme: () => getSeverityColorPalette,
|
|
76
86
|
httpErrorConfigFactory: () => httpErrorConfigFactory,
|
|
87
|
+
initLazyStyleHandler: () => initLazyStyleHandler,
|
|
77
88
|
injectThemeSharedStyles: () => injectThemeSharedStyles,
|
|
89
|
+
removeNavItem: () => removeNavItem,
|
|
90
|
+
subscribeToNavItems: () => subscribeToNavItems,
|
|
78
91
|
useConfirmation: () => useConfirmation,
|
|
79
92
|
useConfirmationContext: () => useConfirmationContext,
|
|
80
93
|
useConfirmationState: () => useConfirmationState,
|
|
81
94
|
useErrorHandler: () => useErrorHandler,
|
|
82
95
|
useHttpErrorConfig: () => useHttpErrorConfig,
|
|
96
|
+
useLazyStyleHandler: () => useLazyStyleHandler,
|
|
97
|
+
useLazyStyles: () => useLazyStyles,
|
|
83
98
|
useModal: () => useModal,
|
|
84
99
|
useModalContext: () => useModalContext,
|
|
85
100
|
useModalState: () => useModalState,
|
|
@@ -112,6 +127,7 @@ var Confirmation;
|
|
|
112
127
|
})(Confirmation || (Confirmation = {}));
|
|
113
128
|
|
|
114
129
|
// src/constants/styles.ts
|
|
130
|
+
var BOOTSTRAP = "bootstrap-{{dir}}.min.css";
|
|
115
131
|
var DEFAULT_STYLES = `
|
|
116
132
|
.is-invalid .form-control {
|
|
117
133
|
border-color: #dc3545;
|
|
@@ -127,6 +143,11 @@ var DEFAULT_STYLES = `
|
|
|
127
143
|
text-align: right;
|
|
128
144
|
}
|
|
129
145
|
|
|
146
|
+
/* RTL support - @since 2.9.0 */
|
|
147
|
+
[dir=rtl] .data-tables-filter {
|
|
148
|
+
text-align: left;
|
|
149
|
+
}
|
|
150
|
+
|
|
130
151
|
.pointer {
|
|
131
152
|
cursor: pointer;
|
|
132
153
|
}
|
|
@@ -308,10 +329,19 @@ function useHttpErrorConfig() {
|
|
|
308
329
|
return context ?? httpErrorConfigFactory();
|
|
309
330
|
}
|
|
310
331
|
|
|
311
|
-
// src/
|
|
332
|
+
// src/tokens/lazy-styles.token.ts
|
|
312
333
|
var import_react3 = require("react");
|
|
334
|
+
var DEFAULT_LAZY_STYLES = [BOOTSTRAP];
|
|
335
|
+
var LazyStylesContext = (0, import_react3.createContext)(DEFAULT_LAZY_STYLES);
|
|
336
|
+
function useLazyStyles() {
|
|
337
|
+
return (0, import_react3.useContext)(LazyStylesContext);
|
|
338
|
+
}
|
|
339
|
+
var LAZY_STYLES = DEFAULT_LAZY_STYLES;
|
|
340
|
+
|
|
341
|
+
// src/contexts/toaster.context.tsx
|
|
342
|
+
var import_react4 = require("react");
|
|
313
343
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
314
|
-
var ToasterContext = (0,
|
|
344
|
+
var ToasterContext = (0, import_react4.createContext)(null);
|
|
315
345
|
var toastCounter = 0;
|
|
316
346
|
function generateId() {
|
|
317
347
|
toastCounter += 1;
|
|
@@ -319,17 +349,17 @@ function generateId() {
|
|
|
319
349
|
}
|
|
320
350
|
var DEFAULT_LIFE = 5e3;
|
|
321
351
|
function ToasterProvider({ children }) {
|
|
322
|
-
const [toasts, setToasts] = (0,
|
|
323
|
-
const subscribersRef = (0,
|
|
324
|
-
(0,
|
|
352
|
+
const [toasts, setToasts] = (0, import_react4.useState)([]);
|
|
353
|
+
const subscribersRef = (0, import_react4.useRef)(/* @__PURE__ */ new Set());
|
|
354
|
+
(0, import_react4.useEffect)(() => {
|
|
325
355
|
subscribersRef.current.forEach((subscriber) => {
|
|
326
356
|
subscriber(toasts);
|
|
327
357
|
});
|
|
328
358
|
}, [toasts]);
|
|
329
|
-
const remove = (0,
|
|
359
|
+
const remove = (0, import_react4.useCallback)((id) => {
|
|
330
360
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
331
361
|
}, []);
|
|
332
|
-
const show = (0,
|
|
362
|
+
const show = (0, import_react4.useCallback)(
|
|
333
363
|
(message, title, severity = "info", options) => {
|
|
334
364
|
const id = typeof options?.id === "number" ? options.id : generateId();
|
|
335
365
|
const life = options?.sticky ? void 0 : options?.life ?? DEFAULT_LIFE;
|
|
@@ -353,23 +383,23 @@ function ToasterProvider({ children }) {
|
|
|
353
383
|
},
|
|
354
384
|
[remove]
|
|
355
385
|
);
|
|
356
|
-
const info = (0,
|
|
386
|
+
const info = (0, import_react4.useCallback)(
|
|
357
387
|
(message, title, options) => show(message, title, "info", options),
|
|
358
388
|
[show]
|
|
359
389
|
);
|
|
360
|
-
const success = (0,
|
|
390
|
+
const success = (0, import_react4.useCallback)(
|
|
361
391
|
(message, title, options) => show(message, title, "success", options),
|
|
362
392
|
[show]
|
|
363
393
|
);
|
|
364
|
-
const warn = (0,
|
|
394
|
+
const warn = (0, import_react4.useCallback)(
|
|
365
395
|
(message, title, options) => show(message, title, "warning", options),
|
|
366
396
|
[show]
|
|
367
397
|
);
|
|
368
|
-
const error = (0,
|
|
398
|
+
const error = (0, import_react4.useCallback)(
|
|
369
399
|
(message, title, options) => show(message, title, "error", options),
|
|
370
400
|
[show]
|
|
371
401
|
);
|
|
372
|
-
const clear = (0,
|
|
402
|
+
const clear = (0, import_react4.useCallback)((key) => {
|
|
373
403
|
setToasts((prev) => {
|
|
374
404
|
if (key) {
|
|
375
405
|
return prev.filter((toast) => toast.options?.containerKey !== key);
|
|
@@ -377,14 +407,14 @@ function ToasterProvider({ children }) {
|
|
|
377
407
|
return [];
|
|
378
408
|
});
|
|
379
409
|
}, []);
|
|
380
|
-
const subscribe = (0,
|
|
410
|
+
const subscribe = (0, import_react4.useCallback)((subscriber) => {
|
|
381
411
|
subscribersRef.current.add(subscriber);
|
|
382
412
|
subscriber(toasts);
|
|
383
413
|
return () => {
|
|
384
414
|
subscribersRef.current.delete(subscriber);
|
|
385
415
|
};
|
|
386
416
|
}, [toasts]);
|
|
387
|
-
const service = (0,
|
|
417
|
+
const service = (0, import_react4.useMemo)(
|
|
388
418
|
() => ({
|
|
389
419
|
info,
|
|
390
420
|
success,
|
|
@@ -397,28 +427,28 @@ function ToasterProvider({ children }) {
|
|
|
397
427
|
}),
|
|
398
428
|
[info, success, warn, error, show, remove, clear, subscribe]
|
|
399
429
|
);
|
|
400
|
-
const value = (0,
|
|
430
|
+
const value = (0, import_react4.useMemo)(
|
|
401
431
|
() => ({ service, toasts }),
|
|
402
432
|
[service, toasts]
|
|
403
433
|
);
|
|
404
434
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToasterContext.Provider, { value, children });
|
|
405
435
|
}
|
|
406
436
|
function useToaster() {
|
|
407
|
-
const context = (0,
|
|
437
|
+
const context = (0, import_react4.useContext)(ToasterContext);
|
|
408
438
|
if (!context) {
|
|
409
439
|
throw new Error("useToaster must be used within a ToasterProvider");
|
|
410
440
|
}
|
|
411
441
|
return context.service;
|
|
412
442
|
}
|
|
413
443
|
function useToasts() {
|
|
414
|
-
const context = (0,
|
|
444
|
+
const context = (0, import_react4.useContext)(ToasterContext);
|
|
415
445
|
if (!context) {
|
|
416
446
|
throw new Error("useToasts must be used within a ToasterProvider");
|
|
417
447
|
}
|
|
418
448
|
return context.toasts;
|
|
419
449
|
}
|
|
420
450
|
function useToasterContext() {
|
|
421
|
-
const context = (0,
|
|
451
|
+
const context = (0, import_react4.useContext)(ToasterContext);
|
|
422
452
|
if (!context) {
|
|
423
453
|
throw new Error("useToasterContext must be used within a ToasterProvider");
|
|
424
454
|
}
|
|
@@ -426,30 +456,30 @@ function useToasterContext() {
|
|
|
426
456
|
}
|
|
427
457
|
|
|
428
458
|
// src/contexts/confirmation.context.tsx
|
|
429
|
-
var
|
|
459
|
+
var import_react5 = require("react");
|
|
430
460
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
431
|
-
var ConfirmationContext = (0,
|
|
461
|
+
var ConfirmationContext = (0, import_react5.createContext)(null);
|
|
432
462
|
function generateId2() {
|
|
433
463
|
return `confirmation-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
434
464
|
}
|
|
435
465
|
function ConfirmationProvider({ children }) {
|
|
436
|
-
const [confirmation, setConfirmation] = (0,
|
|
437
|
-
const resolverRef = (0,
|
|
438
|
-
const subscribersRef = (0,
|
|
439
|
-
const escapeListenerRef = (0,
|
|
440
|
-
(0,
|
|
466
|
+
const [confirmation, setConfirmation] = (0, import_react5.useState)(null);
|
|
467
|
+
const resolverRef = (0, import_react5.useRef)(null);
|
|
468
|
+
const subscribersRef = (0, import_react5.useRef)(/* @__PURE__ */ new Set());
|
|
469
|
+
const escapeListenerRef = (0, import_react5.useRef)(false);
|
|
470
|
+
(0, import_react5.useEffect)(() => {
|
|
441
471
|
subscribersRef.current.forEach((subscriber) => {
|
|
442
472
|
subscriber(confirmation);
|
|
443
473
|
});
|
|
444
474
|
}, [confirmation]);
|
|
445
|
-
const respond = (0,
|
|
475
|
+
const respond = (0, import_react5.useCallback)((status) => {
|
|
446
476
|
if (resolverRef.current) {
|
|
447
477
|
resolverRef.current(status);
|
|
448
478
|
resolverRef.current = null;
|
|
449
479
|
}
|
|
450
480
|
setConfirmation(null);
|
|
451
481
|
}, []);
|
|
452
|
-
(0,
|
|
482
|
+
(0, import_react5.useEffect)(() => {
|
|
453
483
|
if (!escapeListenerRef.current) return;
|
|
454
484
|
const handleEscape = (event) => {
|
|
455
485
|
if (event.key === "Escape" && confirmation && confirmation.options?.closable !== false) {
|
|
@@ -461,7 +491,7 @@ function ConfirmationProvider({ children }) {
|
|
|
461
491
|
document.removeEventListener("keydown", handleEscape);
|
|
462
492
|
};
|
|
463
493
|
}, [confirmation, respond]);
|
|
464
|
-
const show = (0,
|
|
494
|
+
const show = (0, import_react5.useCallback)(
|
|
465
495
|
(message, title, severity = "neutral", options = {}) => {
|
|
466
496
|
if (resolverRef.current) {
|
|
467
497
|
resolverRef.current(Confirmation.Status.dismiss);
|
|
@@ -483,39 +513,39 @@ function ConfirmationProvider({ children }) {
|
|
|
483
513
|
},
|
|
484
514
|
[]
|
|
485
515
|
);
|
|
486
|
-
const info = (0,
|
|
516
|
+
const info = (0, import_react5.useCallback)(
|
|
487
517
|
(message, title, options) => show(message, title, "info", options),
|
|
488
518
|
[show]
|
|
489
519
|
);
|
|
490
|
-
const success = (0,
|
|
520
|
+
const success = (0, import_react5.useCallback)(
|
|
491
521
|
(message, title, options) => show(message, title, "success", options),
|
|
492
522
|
[show]
|
|
493
523
|
);
|
|
494
|
-
const warn = (0,
|
|
524
|
+
const warn = (0, import_react5.useCallback)(
|
|
495
525
|
(message, title, options) => show(message, title, "warning", options),
|
|
496
526
|
[show]
|
|
497
527
|
);
|
|
498
|
-
const error = (0,
|
|
528
|
+
const error = (0, import_react5.useCallback)(
|
|
499
529
|
(message, title, options) => show(message, title, "error", options),
|
|
500
530
|
[show]
|
|
501
531
|
);
|
|
502
|
-
const clear = (0,
|
|
532
|
+
const clear = (0, import_react5.useCallback)(
|
|
503
533
|
(status) => {
|
|
504
534
|
respond(status ?? Confirmation.Status.dismiss);
|
|
505
535
|
},
|
|
506
536
|
[respond]
|
|
507
537
|
);
|
|
508
|
-
const listenToEscape = (0,
|
|
538
|
+
const listenToEscape = (0, import_react5.useCallback)(() => {
|
|
509
539
|
escapeListenerRef.current = true;
|
|
510
540
|
}, []);
|
|
511
|
-
const subscribe = (0,
|
|
541
|
+
const subscribe = (0, import_react5.useCallback)((subscriber) => {
|
|
512
542
|
subscribersRef.current.add(subscriber);
|
|
513
543
|
subscriber(confirmation);
|
|
514
544
|
return () => {
|
|
515
545
|
subscribersRef.current.delete(subscriber);
|
|
516
546
|
};
|
|
517
547
|
}, [confirmation]);
|
|
518
|
-
const service = (0,
|
|
548
|
+
const service = (0, import_react5.useMemo)(
|
|
519
549
|
() => ({
|
|
520
550
|
info,
|
|
521
551
|
success,
|
|
@@ -528,28 +558,28 @@ function ConfirmationProvider({ children }) {
|
|
|
528
558
|
}),
|
|
529
559
|
[info, success, warn, error, show, clear, listenToEscape, subscribe]
|
|
530
560
|
);
|
|
531
|
-
const value = (0,
|
|
561
|
+
const value = (0, import_react5.useMemo)(
|
|
532
562
|
() => ({ service, confirmation, respond }),
|
|
533
563
|
[service, confirmation, respond]
|
|
534
564
|
);
|
|
535
565
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ConfirmationContext.Provider, { value, children });
|
|
536
566
|
}
|
|
537
567
|
function useConfirmation() {
|
|
538
|
-
const context = (0,
|
|
568
|
+
const context = (0, import_react5.useContext)(ConfirmationContext);
|
|
539
569
|
if (!context) {
|
|
540
570
|
throw new Error("useConfirmation must be used within a ConfirmationProvider");
|
|
541
571
|
}
|
|
542
572
|
return context.service;
|
|
543
573
|
}
|
|
544
574
|
function useConfirmationState() {
|
|
545
|
-
const context = (0,
|
|
575
|
+
const context = (0, import_react5.useContext)(ConfirmationContext);
|
|
546
576
|
if (!context) {
|
|
547
577
|
throw new Error("useConfirmationState must be used within a ConfirmationProvider");
|
|
548
578
|
}
|
|
549
579
|
return { confirmation: context.confirmation, respond: context.respond };
|
|
550
580
|
}
|
|
551
581
|
function useConfirmationContext() {
|
|
552
|
-
const context = (0,
|
|
582
|
+
const context = (0, import_react5.useContext)(ConfirmationContext);
|
|
553
583
|
if (!context) {
|
|
554
584
|
throw new Error("useConfirmationContext must be used within a ConfirmationProvider");
|
|
555
585
|
}
|
|
@@ -557,26 +587,26 @@ function useConfirmationContext() {
|
|
|
557
587
|
}
|
|
558
588
|
|
|
559
589
|
// src/contexts/modal.context.tsx
|
|
560
|
-
var
|
|
590
|
+
var import_react6 = require("react");
|
|
561
591
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
562
|
-
var ModalContext = (0,
|
|
592
|
+
var ModalContext = (0, import_react6.createContext)(null);
|
|
563
593
|
function ModalProvider({ children }) {
|
|
564
|
-
const [modalState, setModalState] = (0,
|
|
565
|
-
const [, setUpdateCounter] = (0,
|
|
566
|
-
const containerRef = (0,
|
|
567
|
-
const renderTemplate = (0,
|
|
594
|
+
const [modalState, setModalState] = (0, import_react6.useState)(null);
|
|
595
|
+
const [, setUpdateCounter] = (0, import_react6.useState)(0);
|
|
596
|
+
const containerRef = (0, import_react6.useRef)(null);
|
|
597
|
+
const renderTemplate = (0, import_react6.useCallback)((render, context) => {
|
|
568
598
|
setModalState({ render, context });
|
|
569
599
|
}, []);
|
|
570
|
-
const clearModal = (0,
|
|
600
|
+
const clearModal = (0, import_react6.useCallback)(() => {
|
|
571
601
|
setModalState(null);
|
|
572
602
|
}, []);
|
|
573
|
-
const getContainer = (0,
|
|
603
|
+
const getContainer = (0, import_react6.useCallback)(() => {
|
|
574
604
|
return containerRef;
|
|
575
605
|
}, []);
|
|
576
|
-
const detectChanges = (0,
|
|
606
|
+
const detectChanges = (0, import_react6.useCallback)(() => {
|
|
577
607
|
setUpdateCounter((prev) => prev + 1);
|
|
578
608
|
}, []);
|
|
579
|
-
const service = (0,
|
|
609
|
+
const service = (0, import_react6.useMemo)(
|
|
580
610
|
() => ({
|
|
581
611
|
renderTemplate,
|
|
582
612
|
clearModal,
|
|
@@ -585,7 +615,7 @@ function ModalProvider({ children }) {
|
|
|
585
615
|
}),
|
|
586
616
|
[renderTemplate, clearModal, getContainer, detectChanges]
|
|
587
617
|
);
|
|
588
|
-
const value = (0,
|
|
618
|
+
const value = (0, import_react6.useMemo)(
|
|
589
619
|
() => ({ service, modalState }),
|
|
590
620
|
[service, modalState]
|
|
591
621
|
);
|
|
@@ -595,21 +625,21 @@ function ModalProvider({ children }) {
|
|
|
595
625
|
] });
|
|
596
626
|
}
|
|
597
627
|
function useModal() {
|
|
598
|
-
const context = (0,
|
|
628
|
+
const context = (0, import_react6.useContext)(ModalContext);
|
|
599
629
|
if (!context) {
|
|
600
630
|
throw new Error("useModal must be used within a ModalProvider");
|
|
601
631
|
}
|
|
602
632
|
return context.service;
|
|
603
633
|
}
|
|
604
634
|
function useModalState() {
|
|
605
|
-
const context = (0,
|
|
635
|
+
const context = (0, import_react6.useContext)(ModalContext);
|
|
606
636
|
if (!context) {
|
|
607
637
|
throw new Error("useModalState must be used within a ModalProvider");
|
|
608
638
|
}
|
|
609
639
|
return context.modalState;
|
|
610
640
|
}
|
|
611
641
|
function useModalContext() {
|
|
612
|
-
const context = (0,
|
|
642
|
+
const context = (0, import_react6.useContext)(ModalContext);
|
|
613
643
|
if (!context) {
|
|
614
644
|
throw new Error("useModalContext must be used within a ModalProvider");
|
|
615
645
|
}
|
|
@@ -624,7 +654,7 @@ function ModalContainer() {
|
|
|
624
654
|
}
|
|
625
655
|
|
|
626
656
|
// src/handlers/error.handler.ts
|
|
627
|
-
var
|
|
657
|
+
var import_react7 = require("react");
|
|
628
658
|
var DEFAULT_ERROR_MESSAGES = {
|
|
629
659
|
400: "AbpUi::DefaultErrorMessage400",
|
|
630
660
|
401: "AbpUi::DefaultErrorMessage401",
|
|
@@ -636,22 +666,22 @@ var DEFAULT_ERROR_MESSAGES = {
|
|
|
636
666
|
function useErrorHandler(options = {}) {
|
|
637
667
|
const { navigate, loginPath = "/account/login" } = options;
|
|
638
668
|
const confirmation = useConfirmation();
|
|
639
|
-
const [errorComponentProps, setErrorComponentProps] = (0,
|
|
640
|
-
const navigateToLogin = (0,
|
|
669
|
+
const [errorComponentProps, setErrorComponentProps] = (0, import_react7.useState)(null);
|
|
670
|
+
const navigateToLogin = (0, import_react7.useCallback)(() => {
|
|
641
671
|
if (navigate) {
|
|
642
672
|
navigate(loginPath);
|
|
643
673
|
}
|
|
644
674
|
}, [navigate, loginPath]);
|
|
645
|
-
const showError = (0,
|
|
675
|
+
const showError = (0, import_react7.useCallback)(
|
|
646
676
|
async (message, title) => {
|
|
647
677
|
return confirmation.error(message, title || "AbpUi::Error");
|
|
648
678
|
},
|
|
649
679
|
[confirmation]
|
|
650
680
|
);
|
|
651
|
-
const clearErrorComponent = (0,
|
|
681
|
+
const clearErrorComponent = (0, import_react7.useCallback)(() => {
|
|
652
682
|
setErrorComponentProps(null);
|
|
653
683
|
}, []);
|
|
654
|
-
const createErrorComponent = (0,
|
|
684
|
+
const createErrorComponent = (0, import_react7.useCallback)(
|
|
655
685
|
(instance) => {
|
|
656
686
|
const props = {
|
|
657
687
|
title: instance.title || "Error",
|
|
@@ -664,7 +694,7 @@ function useErrorHandler(options = {}) {
|
|
|
664
694
|
},
|
|
665
695
|
[clearErrorComponent]
|
|
666
696
|
);
|
|
667
|
-
const handleError = (0,
|
|
697
|
+
const handleError = (0, import_react7.useCallback)(
|
|
668
698
|
async (error) => {
|
|
669
699
|
if (error.status === 401) {
|
|
670
700
|
navigateToLogin();
|
|
@@ -706,8 +736,8 @@ function isHttpErrorResponse(error) {
|
|
|
706
736
|
}
|
|
707
737
|
|
|
708
738
|
// src/components/toast/Toast.tsx
|
|
709
|
-
var
|
|
710
|
-
var
|
|
739
|
+
var import_react8 = require("react");
|
|
740
|
+
var import_react9 = require("@chakra-ui/react");
|
|
711
741
|
var import_core = require("@abpjs/core");
|
|
712
742
|
var import_lucide_react = require("lucide-react");
|
|
713
743
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -814,7 +844,7 @@ function getPlacement(position) {
|
|
|
814
844
|
var toasterCache = /* @__PURE__ */ new Map();
|
|
815
845
|
function getToaster(placement) {
|
|
816
846
|
if (!toasterCache.has(placement)) {
|
|
817
|
-
toasterCache.set(placement, (0,
|
|
847
|
+
toasterCache.set(placement, (0, import_react9.createToaster)({
|
|
818
848
|
placement,
|
|
819
849
|
pauseOnPageIdle: true
|
|
820
850
|
}));
|
|
@@ -824,14 +854,14 @@ function getToaster(placement) {
|
|
|
824
854
|
function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
825
855
|
const { toasts, service } = useToasterContext();
|
|
826
856
|
const { t } = (0, import_core.useLocalization)();
|
|
827
|
-
const displayedToastsRef = (0,
|
|
828
|
-
const placement = (0,
|
|
829
|
-
const toaster = (0,
|
|
830
|
-
const filteredToasts = (0,
|
|
857
|
+
const displayedToastsRef = (0, import_react8.useRef)(/* @__PURE__ */ new Set());
|
|
858
|
+
const placement = (0, import_react8.useMemo)(() => getPlacement(position), [position]);
|
|
859
|
+
const toaster = (0, import_react8.useMemo)(() => getToaster(placement), [placement]);
|
|
860
|
+
const filteredToasts = (0, import_react8.useMemo)(() => {
|
|
831
861
|
if (!containerKey) return toasts;
|
|
832
862
|
return toasts.filter((toast) => toast.options?.containerKey === containerKey);
|
|
833
863
|
}, [toasts, containerKey]);
|
|
834
|
-
(0,
|
|
864
|
+
(0, import_react8.useEffect)(() => {
|
|
835
865
|
const newToasts = filteredToasts.filter((toast) => !displayedToastsRef.current.has(toast.id));
|
|
836
866
|
newToasts.forEach((toast) => {
|
|
837
867
|
displayedToastsRef.current.add(toast.id);
|
|
@@ -864,11 +894,11 @@ function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
|
864
894
|
});
|
|
865
895
|
});
|
|
866
896
|
}, [filteredToasts, t, service, toaster]);
|
|
867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.Toaster, { toaster, insetInline: { mdDown: "4" }, children: (toast) => {
|
|
868
898
|
const severity = toast.meta?.severity || "info";
|
|
869
899
|
const closable = toast.meta?.closable !== false;
|
|
870
900
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
871
|
-
|
|
901
|
+
import_react9.Toast.Root,
|
|
872
902
|
{
|
|
873
903
|
bg: getSeverityBg(severity),
|
|
874
904
|
borderWidth: "1px",
|
|
@@ -876,13 +906,13 @@ function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
|
876
906
|
borderRadius: "lg",
|
|
877
907
|
boxShadow: "lg",
|
|
878
908
|
width: { md: "sm" },
|
|
879
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
880
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
881
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
882
|
-
toast.title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
883
|
-
toast.description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react9.Flex, { align: "flex-start", gap: 3, p: 4, children: [
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.Box, { flexShrink: 0, pt: "2px", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SeverityIcon, { severity }) }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react9.Stack, { gap: 1, flex: 1, children: [
|
|
912
|
+
toast.title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.Toast.Title, { fontWeight: "bold", fontSize: "sm", color: "fg", children: toast.title }),
|
|
913
|
+
toast.description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.Toast.Description, { fontSize: "sm", color: "gray.700", children: toast.description })
|
|
884
914
|
] }),
|
|
885
|
-
closable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
915
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.Toast.CloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.CloseButton, { size: "sm" }) })
|
|
886
916
|
] })
|
|
887
917
|
}
|
|
888
918
|
);
|
|
@@ -890,8 +920,8 @@ function ToastContainer({ position = "bottom-right", containerKey }) {
|
|
|
890
920
|
}
|
|
891
921
|
|
|
892
922
|
// src/components/confirmation/Confirmation.tsx
|
|
893
|
-
var
|
|
894
|
-
var
|
|
923
|
+
var import_react10 = require("react");
|
|
924
|
+
var import_react11 = require("@chakra-ui/react");
|
|
895
925
|
var import_core2 = require("@abpjs/core");
|
|
896
926
|
var import_lucide_react2 = require("lucide-react");
|
|
897
927
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -939,7 +969,7 @@ function getSeverityColorPalette2(severity) {
|
|
|
939
969
|
function ConfirmationDialog({ className }) {
|
|
940
970
|
const { confirmation, respond } = useConfirmationState();
|
|
941
971
|
const { t } = (0, import_core2.useLocalization)();
|
|
942
|
-
const cancelRef = (0,
|
|
972
|
+
const cancelRef = (0, import_react10.useRef)(null);
|
|
943
973
|
if (!confirmation) {
|
|
944
974
|
return null;
|
|
945
975
|
}
|
|
@@ -970,24 +1000,24 @@ function ConfirmationDialog({ className }) {
|
|
|
970
1000
|
}
|
|
971
1001
|
};
|
|
972
1002
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
973
|
-
|
|
1003
|
+
import_react11.Dialog.Root,
|
|
974
1004
|
{
|
|
975
1005
|
open: true,
|
|
976
1006
|
onOpenChange: handleOpenChange,
|
|
977
1007
|
role: "alertdialog",
|
|
978
1008
|
placement: "center",
|
|
979
1009
|
initialFocusEl: () => cancelRef.current,
|
|
980
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
981
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
982
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
983
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1010
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react11.Portal, { children: [
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Dialog.Backdrop, {}),
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Dialog.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react11.Dialog.Content, { className, maxWidth: "md", children: [
|
|
1013
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react11.Flex, { align: "center", gap: 3, children: [
|
|
984
1014
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SeverityIcon2, { severity }),
|
|
985
|
-
localizedTitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1015
|
+
localizedTitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Dialog.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Text, { fontWeight: "bold", fontSize: "lg", children: localizedTitle }) })
|
|
986
1016
|
] }) }),
|
|
987
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
988
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1017
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Text, { color: "gray.600", children: localizedMessage }) }),
|
|
1018
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react11.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react11.Flex, { gap: 3, children: [
|
|
989
1019
|
!options?.hideCancelBtn && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
990
|
-
|
|
1020
|
+
import_react11.Button,
|
|
991
1021
|
{
|
|
992
1022
|
ref: cancelRef,
|
|
993
1023
|
variant: "ghost",
|
|
@@ -996,7 +1026,7 @@ function ConfirmationDialog({ className }) {
|
|
|
996
1026
|
}
|
|
997
1027
|
),
|
|
998
1028
|
!options?.hideYesBtn && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
999
|
-
|
|
1029
|
+
import_react11.Button,
|
|
1000
1030
|
{
|
|
1001
1031
|
colorPalette: getSeverityColorPalette2(severity),
|
|
1002
1032
|
onClick: handleConfirm,
|
|
@@ -1011,7 +1041,7 @@ function ConfirmationDialog({ className }) {
|
|
|
1011
1041
|
}
|
|
1012
1042
|
|
|
1013
1043
|
// src/components/errors/ErrorComponent.tsx
|
|
1014
|
-
var
|
|
1044
|
+
var import_react12 = require("@chakra-ui/react");
|
|
1015
1045
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1016
1046
|
function ErrorComponent({
|
|
1017
1047
|
title = "Error",
|
|
@@ -1023,9 +1053,9 @@ function ErrorComponent({
|
|
|
1023
1053
|
onHomeClick,
|
|
1024
1054
|
homeButtonText = "Go Home"
|
|
1025
1055
|
}) {
|
|
1026
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react12.Container, { maxW: "container.md", py: 20, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react12.VStack, { gap: 6, textAlign: "center", children: [
|
|
1027
1057
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1028
|
-
|
|
1058
|
+
import_react12.Heading,
|
|
1029
1059
|
{
|
|
1030
1060
|
size: "4xl",
|
|
1031
1061
|
color: "red.500",
|
|
@@ -1033,10 +1063,10 @@ function ErrorComponent({
|
|
|
1033
1063
|
children: title
|
|
1034
1064
|
}
|
|
1035
1065
|
),
|
|
1036
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1037
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react12.Text, { fontSize: "lg", color: "gray.600", children: details }),
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react12.Box, { display: "flex", gap: 3, children: [
|
|
1038
1068
|
isHomeShow && onHomeClick && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1039
|
-
|
|
1069
|
+
import_react12.Button,
|
|
1040
1070
|
{
|
|
1041
1071
|
colorPalette: "green",
|
|
1042
1072
|
size: "lg",
|
|
@@ -1045,7 +1075,7 @@ function ErrorComponent({
|
|
|
1045
1075
|
}
|
|
1046
1076
|
),
|
|
1047
1077
|
showCloseButton && onDestroy && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1048
|
-
|
|
1078
|
+
import_react12.Button,
|
|
1049
1079
|
{
|
|
1050
1080
|
colorPalette: "blue",
|
|
1051
1081
|
size: "lg",
|
|
@@ -1058,7 +1088,7 @@ function ErrorComponent({
|
|
|
1058
1088
|
}
|
|
1059
1089
|
|
|
1060
1090
|
// src/components/loader-bar/LoaderBar.tsx
|
|
1061
|
-
var
|
|
1091
|
+
var import_react13 = require("react");
|
|
1062
1092
|
var import_core3 = require("@abpjs/core");
|
|
1063
1093
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1064
1094
|
function LoaderBar({
|
|
@@ -1069,17 +1099,17 @@ function LoaderBar({
|
|
|
1069
1099
|
stopDelay = 400
|
|
1070
1100
|
}) {
|
|
1071
1101
|
const { loading } = (0, import_core3.useLoader)();
|
|
1072
|
-
const [isLoading, setIsLoading] = (0,
|
|
1073
|
-
const [progressLevel, setProgressLevel] = (0,
|
|
1074
|
-
const intervalRef = (0,
|
|
1075
|
-
(0,
|
|
1102
|
+
const [isLoading, setIsLoading] = (0, import_react13.useState)(false);
|
|
1103
|
+
const [progressLevel, setProgressLevel] = (0, import_react13.useState)(0);
|
|
1104
|
+
const intervalRef = (0, import_react13.useRef)(null);
|
|
1105
|
+
(0, import_react13.useEffect)(() => {
|
|
1076
1106
|
if (loading) {
|
|
1077
1107
|
startLoading();
|
|
1078
1108
|
} else {
|
|
1079
1109
|
stopLoading();
|
|
1080
1110
|
}
|
|
1081
1111
|
}, [loading]);
|
|
1082
|
-
(0,
|
|
1112
|
+
(0, import_react13.useEffect)(() => {
|
|
1083
1113
|
return () => {
|
|
1084
1114
|
if (intervalRef.current) {
|
|
1085
1115
|
clearInterval(intervalRef.current);
|
|
@@ -1150,8 +1180,8 @@ function LoaderBar({
|
|
|
1150
1180
|
}
|
|
1151
1181
|
|
|
1152
1182
|
// src/components/modal/Modal.tsx
|
|
1153
|
-
var
|
|
1154
|
-
var
|
|
1183
|
+
var import_react14 = __toESM(require("react"));
|
|
1184
|
+
var import_react15 = require("@chakra-ui/react");
|
|
1155
1185
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1156
1186
|
function getSizeWidth(size) {
|
|
1157
1187
|
switch (size) {
|
|
@@ -1190,12 +1220,12 @@ function Modal({
|
|
|
1190
1220
|
preventScroll = true,
|
|
1191
1221
|
onInit
|
|
1192
1222
|
}) {
|
|
1193
|
-
const prevVisibleRef =
|
|
1194
|
-
const onInitRef =
|
|
1195
|
-
|
|
1223
|
+
const prevVisibleRef = import_react14.default.useRef(false);
|
|
1224
|
+
const onInitRef = import_react14.default.useRef(onInit);
|
|
1225
|
+
import_react14.default.useEffect(() => {
|
|
1196
1226
|
onInitRef.current = onInit;
|
|
1197
1227
|
}, [onInit]);
|
|
1198
|
-
|
|
1228
|
+
import_react14.default.useEffect(() => {
|
|
1199
1229
|
if (visible && !prevVisibleRef.current && onInitRef.current) {
|
|
1200
1230
|
onInitRef.current();
|
|
1201
1231
|
}
|
|
@@ -1208,7 +1238,7 @@ function Modal({
|
|
|
1208
1238
|
onVisibleChange?.(details.open);
|
|
1209
1239
|
};
|
|
1210
1240
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1211
|
-
|
|
1241
|
+
import_react15.Dialog.Root,
|
|
1212
1242
|
{
|
|
1213
1243
|
open: visible,
|
|
1214
1244
|
onOpenChange: handleOpenChange,
|
|
@@ -1219,10 +1249,10 @@ function Modal({
|
|
|
1219
1249
|
motionPreset,
|
|
1220
1250
|
trapFocus,
|
|
1221
1251
|
preventScroll,
|
|
1222
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1223
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1224
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1225
|
-
|
|
1252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react15.Portal, { children: [
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Dialog.Backdrop, {}),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Dialog.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1255
|
+
import_react15.Dialog.Content,
|
|
1226
1256
|
{
|
|
1227
1257
|
className: modalClass,
|
|
1228
1258
|
width: getSizeWidth(size),
|
|
@@ -1232,16 +1262,16 @@ function Modal({
|
|
|
1232
1262
|
minHeight,
|
|
1233
1263
|
children: [
|
|
1234
1264
|
(header || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1235
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1236
|
-
header && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1237
|
-
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react15.Flex, { justify: "space-between", align: "center", width: "100%", children: [
|
|
1266
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Dialog.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Text, { fontWeight: "bold", fontSize: "lg", children: header }) }),
|
|
1267
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Dialog.CloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.CloseButton, { size: "sm" }) })
|
|
1238
1268
|
] }) }),
|
|
1239
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Separator, {})
|
|
1240
1270
|
] }),
|
|
1241
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1271
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Dialog.Body, { py: 4, children }),
|
|
1242
1272
|
footer && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1243
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1244
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Separator, {}),
|
|
1274
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Flex, { gap: 3, justify: "flex-end", w: "100%", children: footer }) })
|
|
1245
1275
|
] })
|
|
1246
1276
|
]
|
|
1247
1277
|
}
|
|
@@ -1251,17 +1281,17 @@ function Modal({
|
|
|
1251
1281
|
);
|
|
1252
1282
|
}
|
|
1253
1283
|
function AbpModalHeader({ children, className }) {
|
|
1254
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Text, { fontWeight: "bold", fontSize: "lg", className, children });
|
|
1255
1285
|
}
|
|
1256
1286
|
function AbpModalBody({ children, className }) {
|
|
1257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Box, { color: "gray.600", className, children });
|
|
1258
1288
|
}
|
|
1259
1289
|
function AbpModalFooter({ children, className }) {
|
|
1260
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react15.Flex, { gap: 3, justify: "flex-end", className, children });
|
|
1261
1291
|
}
|
|
1262
1292
|
|
|
1263
1293
|
// src/components/ui/Alert.tsx
|
|
1264
|
-
var
|
|
1294
|
+
var import_react16 = require("@chakra-ui/react");
|
|
1265
1295
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1266
1296
|
function Alert({
|
|
1267
1297
|
status = "info",
|
|
@@ -1274,28 +1304,28 @@ function Alert({
|
|
|
1274
1304
|
borderRadius = "md"
|
|
1275
1305
|
}) {
|
|
1276
1306
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1277
|
-
|
|
1307
|
+
import_react16.Alert.Root,
|
|
1278
1308
|
{
|
|
1279
1309
|
status,
|
|
1280
1310
|
className,
|
|
1281
1311
|
mb,
|
|
1282
1312
|
borderRadius,
|
|
1283
1313
|
children: [
|
|
1284
|
-
showIcon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1314
|
+
showIcon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react16.Alert.Indicator, {}),
|
|
1285
1315
|
title ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1286
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1287
|
-
(description || children) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1288
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1316
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react16.Alert.Title, { children: title }),
|
|
1317
|
+
(description || children) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react16.Alert.Description, { children: description || children })
|
|
1318
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react16.Alert.Title, { children })
|
|
1289
1319
|
]
|
|
1290
1320
|
}
|
|
1291
1321
|
);
|
|
1292
1322
|
}
|
|
1293
1323
|
|
|
1294
1324
|
// src/components/ui/Button.tsx
|
|
1295
|
-
var
|
|
1296
|
-
var
|
|
1325
|
+
var import_react17 = require("react");
|
|
1326
|
+
var import_react18 = require("@chakra-ui/react");
|
|
1297
1327
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1298
|
-
var Button3 = (0,
|
|
1328
|
+
var Button3 = (0, import_react17.forwardRef)(
|
|
1299
1329
|
function Button4({
|
|
1300
1330
|
children,
|
|
1301
1331
|
type = "button",
|
|
@@ -1312,7 +1342,7 @@ var Button3 = (0, import_react16.forwardRef)(
|
|
|
1312
1342
|
ml
|
|
1313
1343
|
}, ref) {
|
|
1314
1344
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1315
|
-
|
|
1345
|
+
import_react18.Button,
|
|
1316
1346
|
{
|
|
1317
1347
|
ref,
|
|
1318
1348
|
type,
|
|
@@ -1334,10 +1364,10 @@ var Button3 = (0, import_react16.forwardRef)(
|
|
|
1334
1364
|
);
|
|
1335
1365
|
|
|
1336
1366
|
// src/components/ui/Checkbox.tsx
|
|
1337
|
-
var
|
|
1338
|
-
var
|
|
1367
|
+
var import_react19 = require("react");
|
|
1368
|
+
var import_react20 = require("@chakra-ui/react");
|
|
1339
1369
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1340
|
-
var Checkbox = (0,
|
|
1370
|
+
var Checkbox = (0, import_react19.forwardRef)(
|
|
1341
1371
|
function Checkbox2({
|
|
1342
1372
|
children,
|
|
1343
1373
|
checked,
|
|
@@ -1355,7 +1385,7 @@ var Checkbox = (0, import_react18.forwardRef)(
|
|
|
1355
1385
|
className
|
|
1356
1386
|
}, ref) {
|
|
1357
1387
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1358
|
-
|
|
1388
|
+
import_react20.Checkbox.Root,
|
|
1359
1389
|
{
|
|
1360
1390
|
checked,
|
|
1361
1391
|
defaultChecked,
|
|
@@ -1368,7 +1398,7 @@ var Checkbox = (0, import_react18.forwardRef)(
|
|
|
1368
1398
|
className,
|
|
1369
1399
|
children: [
|
|
1370
1400
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1371
|
-
|
|
1401
|
+
import_react20.Checkbox.HiddenInput,
|
|
1372
1402
|
{
|
|
1373
1403
|
ref,
|
|
1374
1404
|
id,
|
|
@@ -1377,8 +1407,8 @@ var Checkbox = (0, import_react18.forwardRef)(
|
|
|
1377
1407
|
onChange
|
|
1378
1408
|
}
|
|
1379
1409
|
),
|
|
1380
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1381
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react20.Checkbox.Control, {}),
|
|
1411
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react20.Checkbox.Label, { children })
|
|
1382
1412
|
]
|
|
1383
1413
|
}
|
|
1384
1414
|
);
|
|
@@ -1386,7 +1416,7 @@ var Checkbox = (0, import_react18.forwardRef)(
|
|
|
1386
1416
|
);
|
|
1387
1417
|
|
|
1388
1418
|
// src/components/ui/FormField.tsx
|
|
1389
|
-
var
|
|
1419
|
+
var import_react21 = require("@chakra-ui/react");
|
|
1390
1420
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1391
1421
|
function FormField({
|
|
1392
1422
|
label,
|
|
@@ -1399,20 +1429,20 @@ function FormField({
|
|
|
1399
1429
|
htmlFor,
|
|
1400
1430
|
className
|
|
1401
1431
|
}) {
|
|
1402
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1403
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react21.Field.Root, { invalid, disabled, className, children: [
|
|
1433
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react21.Field.Label, { htmlFor, children: [
|
|
1404
1434
|
label,
|
|
1405
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1435
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react21.Field.RequiredIndicator, {})
|
|
1406
1436
|
] }),
|
|
1407
1437
|
children,
|
|
1408
|
-
helperText && !invalid && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1409
|
-
invalid && errorText && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1438
|
+
helperText && !invalid && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react21.Field.HelperText, { children: helperText }),
|
|
1439
|
+
invalid && errorText && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react21.Field.ErrorText, { children: errorText })
|
|
1410
1440
|
] });
|
|
1411
1441
|
}
|
|
1412
1442
|
|
|
1413
1443
|
// src/components/change-password/ChangePassword.tsx
|
|
1414
|
-
var
|
|
1415
|
-
var
|
|
1444
|
+
var import_react22 = require("react");
|
|
1445
|
+
var import_react23 = require("@chakra-ui/react");
|
|
1416
1446
|
var import_react_hook_form = require("react-hook-form");
|
|
1417
1447
|
var import_core4 = require("@abpjs/core");
|
|
1418
1448
|
var import_lucide_react3 = require("lucide-react");
|
|
@@ -1438,7 +1468,7 @@ function ChangePassword({
|
|
|
1438
1468
|
}
|
|
1439
1469
|
});
|
|
1440
1470
|
const newPassword = watch("newPassword");
|
|
1441
|
-
(0,
|
|
1471
|
+
(0, import_react22.useEffect)(() => {
|
|
1442
1472
|
if (visible) {
|
|
1443
1473
|
reset();
|
|
1444
1474
|
}
|
|
@@ -1480,9 +1510,9 @@ function ChangePassword({
|
|
|
1480
1510
|
}
|
|
1481
1511
|
};
|
|
1482
1512
|
const modalFooter = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1483
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react23.Button, { variant: "ghost", mr: 3, onClick: handleClose, disabled: isSubmitting, children: t("AbpIdentity::Cancel") || "Cancel" }),
|
|
1484
1514
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1485
|
-
|
|
1515
|
+
import_react23.Button,
|
|
1486
1516
|
{
|
|
1487
1517
|
colorPalette: "blue",
|
|
1488
1518
|
type: "submit",
|
|
@@ -1504,14 +1534,14 @@ function ChangePassword({
|
|
|
1504
1534
|
header: t("AbpIdentity::ChangePassword") || "Change Password",
|
|
1505
1535
|
footer: modalFooter,
|
|
1506
1536
|
centered: true,
|
|
1507
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("form", { id: "change-password-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1508
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1509
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("form", { id: "change-password-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react23.VStack, { gap: 4, children: [
|
|
1538
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react23.Field.Root, { invalid: !!errors.password, children: [
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react23.Field.Label, { children: [
|
|
1510
1540
|
t("AbpIdentity::DisplayName:CurrentPassword") || "Current Password",
|
|
1511
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react23.Field.RequiredIndicator, {})
|
|
1512
1542
|
] }),
|
|
1513
1543
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1514
|
-
|
|
1544
|
+
import_react23.Input,
|
|
1515
1545
|
{
|
|
1516
1546
|
type: "password",
|
|
1517
1547
|
...register("password", {
|
|
@@ -1519,29 +1549,29 @@ function ChangePassword({
|
|
|
1519
1549
|
})
|
|
1520
1550
|
}
|
|
1521
1551
|
),
|
|
1522
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react23.Field.ErrorText, { children: errors.password?.message })
|
|
1523
1553
|
] }),
|
|
1524
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1525
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react23.Field.Root, { invalid: !!errors.newPassword, children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react23.Field.Label, { children: [
|
|
1526
1556
|
t("AbpIdentity::DisplayName:NewPassword") || "New Password",
|
|
1527
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1557
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react23.Field.RequiredIndicator, {})
|
|
1528
1558
|
] }),
|
|
1529
1559
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1530
|
-
|
|
1560
|
+
import_react23.Input,
|
|
1531
1561
|
{
|
|
1532
1562
|
type: "password",
|
|
1533
1563
|
...register("newPassword", passwordValidation)
|
|
1534
1564
|
}
|
|
1535
1565
|
),
|
|
1536
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react23.Field.ErrorText, { children: errors.newPassword?.message })
|
|
1537
1567
|
] }),
|
|
1538
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1539
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react23.Field.Root, { invalid: !!errors.repeatNewPassword, children: [
|
|
1569
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react23.Field.Label, { children: [
|
|
1540
1570
|
t("AbpIdentity::DisplayName:NewPasswordConfirm") || "Confirm New Password",
|
|
1541
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1571
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react23.Field.RequiredIndicator, {})
|
|
1542
1572
|
] }),
|
|
1543
1573
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1544
|
-
|
|
1574
|
+
import_react23.Input,
|
|
1545
1575
|
{
|
|
1546
1576
|
type: "password",
|
|
1547
1577
|
...register("repeatNewPassword", {
|
|
@@ -1550,7 +1580,7 @@ function ChangePassword({
|
|
|
1550
1580
|
})
|
|
1551
1581
|
}
|
|
1552
1582
|
),
|
|
1553
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1583
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react23.Field.ErrorText, { children: errors.repeatNewPassword?.message })
|
|
1554
1584
|
] })
|
|
1555
1585
|
] }) })
|
|
1556
1586
|
}
|
|
@@ -1558,8 +1588,8 @@ function ChangePassword({
|
|
|
1558
1588
|
}
|
|
1559
1589
|
|
|
1560
1590
|
// src/components/profile/Profile.tsx
|
|
1561
|
-
var
|
|
1562
|
-
var
|
|
1591
|
+
var import_react24 = require("react");
|
|
1592
|
+
var import_react25 = require("@chakra-ui/react");
|
|
1563
1593
|
var import_react_hook_form2 = require("react-hook-form");
|
|
1564
1594
|
var import_core5 = require("@abpjs/core");
|
|
1565
1595
|
var import_lucide_react4 = require("lucide-react");
|
|
@@ -1586,13 +1616,13 @@ function Profile({
|
|
|
1586
1616
|
}
|
|
1587
1617
|
});
|
|
1588
1618
|
const modalBusy = isSubmitting || loading;
|
|
1589
|
-
(0,
|
|
1619
|
+
(0, import_react24.useEffect)(() => {
|
|
1590
1620
|
if (visible) {
|
|
1591
1621
|
fetchProfile().then(() => {
|
|
1592
1622
|
});
|
|
1593
1623
|
}
|
|
1594
1624
|
}, [visible, fetchProfile]);
|
|
1595
|
-
(0,
|
|
1625
|
+
(0, import_react24.useEffect)(() => {
|
|
1596
1626
|
if (profile) {
|
|
1597
1627
|
reset({
|
|
1598
1628
|
userName: profile.userName || "",
|
|
@@ -1624,9 +1654,9 @@ function Profile({
|
|
|
1624
1654
|
}
|
|
1625
1655
|
};
|
|
1626
1656
|
const modalFooter = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
1627
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Button, { variant: "ghost", mr: 3, onClick: handleClose, disabled: modalBusy, children: t("AbpIdentity::Cancel") || "Cancel" }),
|
|
1628
1658
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1629
|
-
|
|
1659
|
+
import_react25.Button,
|
|
1630
1660
|
{
|
|
1631
1661
|
colorPalette: "blue",
|
|
1632
1662
|
type: "submit",
|
|
@@ -1649,14 +1679,14 @@ function Profile({
|
|
|
1649
1679
|
footer: modalFooter,
|
|
1650
1680
|
size: "lg",
|
|
1651
1681
|
centered: true,
|
|
1652
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("form", { id: "profile-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1653
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1654
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1682
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("form", { id: "profile-form", onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.VStack, { gap: 4, children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.Field.Root, { invalid: !!errors.userName, children: [
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.Field.Label, { children: [
|
|
1655
1685
|
t("AbpIdentity::DisplayName:UserName") || "Username",
|
|
1656
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.RequiredIndicator, {})
|
|
1657
1687
|
] }),
|
|
1658
1688
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1659
|
-
|
|
1689
|
+
import_react25.Input,
|
|
1660
1690
|
{
|
|
1661
1691
|
type: "text",
|
|
1662
1692
|
...register("userName", {
|
|
@@ -1668,13 +1698,13 @@ function Profile({
|
|
|
1668
1698
|
})
|
|
1669
1699
|
}
|
|
1670
1700
|
),
|
|
1671
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.ErrorText, { children: errors.userName?.message })
|
|
1672
1702
|
] }),
|
|
1673
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1674
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1675
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.HStack, { gap: 4, w: "full", children: [
|
|
1704
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.Field.Root, { invalid: !!errors.name, flex: 1, children: [
|
|
1705
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.Label, { children: t("AbpIdentity::DisplayName:Name") || "Name" }),
|
|
1676
1706
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1677
|
-
|
|
1707
|
+
import_react25.Input,
|
|
1678
1708
|
{
|
|
1679
1709
|
type: "text",
|
|
1680
1710
|
...register("name", {
|
|
@@ -1685,12 +1715,12 @@ function Profile({
|
|
|
1685
1715
|
})
|
|
1686
1716
|
}
|
|
1687
1717
|
),
|
|
1688
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1718
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.ErrorText, { children: errors.name?.message })
|
|
1689
1719
|
] }),
|
|
1690
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1691
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.Field.Root, { invalid: !!errors.surname, flex: 1, children: [
|
|
1721
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.Label, { children: t("AbpIdentity::DisplayName:Surname") || "Surname" }),
|
|
1692
1722
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1693
|
-
|
|
1723
|
+
import_react25.Input,
|
|
1694
1724
|
{
|
|
1695
1725
|
type: "text",
|
|
1696
1726
|
...register("surname", {
|
|
@@ -1701,16 +1731,16 @@ function Profile({
|
|
|
1701
1731
|
})
|
|
1702
1732
|
}
|
|
1703
1733
|
),
|
|
1704
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.ErrorText, { children: errors.surname?.message })
|
|
1705
1735
|
] })
|
|
1706
1736
|
] }),
|
|
1707
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1708
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.Field.Root, { invalid: !!errors.email, children: [
|
|
1738
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.Field.Label, { children: [
|
|
1709
1739
|
t("AbpIdentity::DisplayName:EmailAddress") || "Email Address",
|
|
1710
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1740
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.RequiredIndicator, {})
|
|
1711
1741
|
] }),
|
|
1712
1742
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1713
|
-
|
|
1743
|
+
import_react25.Input,
|
|
1714
1744
|
{
|
|
1715
1745
|
type: "email",
|
|
1716
1746
|
...register("email", {
|
|
@@ -1726,12 +1756,12 @@ function Profile({
|
|
|
1726
1756
|
})
|
|
1727
1757
|
}
|
|
1728
1758
|
),
|
|
1729
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.ErrorText, { children: errors.email?.message })
|
|
1730
1760
|
] }),
|
|
1731
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1732
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react25.Field.Root, { invalid: !!errors.phoneNumber, children: [
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.Label, { children: t("AbpIdentity::DisplayName:PhoneNumber") || "Phone Number" }),
|
|
1733
1763
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1734
|
-
|
|
1764
|
+
import_react25.Input,
|
|
1735
1765
|
{
|
|
1736
1766
|
type: "tel",
|
|
1737
1767
|
...register("phoneNumber", {
|
|
@@ -1742,7 +1772,7 @@ function Profile({
|
|
|
1742
1772
|
})
|
|
1743
1773
|
}
|
|
1744
1774
|
),
|
|
1745
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react25.Field.ErrorText, { children: errors.phoneNumber?.message })
|
|
1746
1776
|
] })
|
|
1747
1777
|
] }) })
|
|
1748
1778
|
}
|
|
@@ -1750,10 +1780,10 @@ function Profile({
|
|
|
1750
1780
|
}
|
|
1751
1781
|
|
|
1752
1782
|
// src/providers/ThemeSharedProvider.tsx
|
|
1753
|
-
var
|
|
1783
|
+
var import_react28 = require("@chakra-ui/react");
|
|
1754
1784
|
|
|
1755
1785
|
// src/theme/index.ts
|
|
1756
|
-
var
|
|
1786
|
+
var import_react26 = require("@chakra-ui/react");
|
|
1757
1787
|
var colors = {
|
|
1758
1788
|
brand: {
|
|
1759
1789
|
50: { value: "#e3f2fd" },
|
|
@@ -1956,7 +1986,7 @@ var semanticTokens = {
|
|
|
1956
1986
|
// },
|
|
1957
1987
|
// },
|
|
1958
1988
|
};
|
|
1959
|
-
var defaultAbpConfig = (0,
|
|
1989
|
+
var defaultAbpConfig = (0, import_react26.defineConfig)({
|
|
1960
1990
|
theme: {
|
|
1961
1991
|
tokens: {
|
|
1962
1992
|
colors,
|
|
@@ -1978,14 +2008,14 @@ var defaultAbpConfig = (0, import_react25.defineConfig)({
|
|
|
1978
2008
|
});
|
|
1979
2009
|
function createAbpSystem(overrides) {
|
|
1980
2010
|
if (overrides) {
|
|
1981
|
-
return (0,
|
|
2011
|
+
return (0, import_react26.createSystem)(import_react26.defaultConfig, defaultAbpConfig, overrides);
|
|
1982
2012
|
}
|
|
1983
|
-
return (0,
|
|
2013
|
+
return (0, import_react26.createSystem)(import_react26.defaultConfig, defaultAbpConfig);
|
|
1984
2014
|
}
|
|
1985
2015
|
var abpSystem = createAbpSystem();
|
|
1986
2016
|
|
|
1987
2017
|
// src/components/ui/color-mode.tsx
|
|
1988
|
-
var
|
|
2018
|
+
var import_react27 = require("@chakra-ui/react");
|
|
1989
2019
|
var import_next_themes = require("next-themes");
|
|
1990
2020
|
var React12 = __toESM(require("react"));
|
|
1991
2021
|
var import_lucide_react5 = require("lucide-react");
|
|
@@ -2011,8 +2041,8 @@ function ColorModeIcon() {
|
|
|
2011
2041
|
}
|
|
2012
2042
|
var ColorModeButton = React12.forwardRef(function ColorModeButton2(props, ref) {
|
|
2013
2043
|
const { toggleColorMode } = useColorMode();
|
|
2014
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2015
|
-
|
|
2044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react27.ClientOnly, { fallback: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react27.Skeleton, { boxSize: "9" }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2045
|
+
import_react27.IconButton,
|
|
2016
2046
|
{
|
|
2017
2047
|
onClick: toggleColorMode,
|
|
2018
2048
|
variant: "ghost",
|
|
@@ -2033,7 +2063,7 @@ var ColorModeButton = React12.forwardRef(function ColorModeButton2(props, ref) {
|
|
|
2033
2063
|
var LightMode = React12.forwardRef(
|
|
2034
2064
|
function LightMode2(props, ref) {
|
|
2035
2065
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2036
|
-
|
|
2066
|
+
import_react27.Span,
|
|
2037
2067
|
{
|
|
2038
2068
|
color: "fg",
|
|
2039
2069
|
display: "contents",
|
|
@@ -2049,7 +2079,7 @@ var LightMode = React12.forwardRef(
|
|
|
2049
2079
|
var DarkMode = React12.forwardRef(
|
|
2050
2080
|
function DarkMode2(props, ref) {
|
|
2051
2081
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2052
|
-
|
|
2082
|
+
import_react27.Span,
|
|
2053
2083
|
{
|
|
2054
2084
|
color: "fg",
|
|
2055
2085
|
display: "contents",
|
|
@@ -2085,7 +2115,74 @@ function ThemeSharedProvider({
|
|
|
2085
2115
|
renderConfirmation && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ConfirmationDialog, {})
|
|
2086
2116
|
] }) });
|
|
2087
2117
|
const colorModeProps = enableColorMode ? { defaultTheme: defaultColorMode } : { forcedTheme: "light" };
|
|
2088
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react28.ChakraProvider, { value: system, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react28.LocaleProvider, { locale, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorModeProvider, { ...colorModeProps, children: content }) }) });
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
// src/handlers/lazy-style.handler.ts
|
|
2122
|
+
var import_react29 = require("react");
|
|
2123
|
+
var import_core7 = require("@abpjs/core");
|
|
2124
|
+
function createLazyStyleHref(style, dir) {
|
|
2125
|
+
return style.replace("{{dir}}", dir);
|
|
2126
|
+
}
|
|
2127
|
+
function useLazyStyleHandler(options = {}) {
|
|
2128
|
+
const { styles = [BOOTSTRAP], initialDirection = "ltr" } = options;
|
|
2129
|
+
const [direction, setDirection] = (0, import_react29.useState)(initialDirection);
|
|
2130
|
+
const lazyLoadRef = (0, import_react29.useRef)(new import_core7.LazyLoadService());
|
|
2131
|
+
const loadedStylesRef = (0, import_react29.useRef)(/* @__PURE__ */ new Map());
|
|
2132
|
+
(0, import_react29.useEffect)(() => {
|
|
2133
|
+
document.body.dir = direction;
|
|
2134
|
+
const switchCSS = async () => {
|
|
2135
|
+
const lazyLoad = lazyLoadRef.current;
|
|
2136
|
+
for (const style of styles) {
|
|
2137
|
+
const href = createLazyStyleHref(style, direction);
|
|
2138
|
+
if (lazyLoad.isLoaded(href)) {
|
|
2139
|
+
continue;
|
|
2140
|
+
}
|
|
2141
|
+
const oldDir = direction === "ltr" ? "rtl" : "ltr";
|
|
2142
|
+
const oldHref = createLazyStyleHref(style, oldDir);
|
|
2143
|
+
const oldLink = loadedStylesRef.current.get(oldHref);
|
|
2144
|
+
if (oldLink && oldLink.parentNode) {
|
|
2145
|
+
oldLink.parentNode.removeChild(oldLink);
|
|
2146
|
+
lazyLoad.remove(oldHref);
|
|
2147
|
+
loadedStylesRef.current.delete(oldHref);
|
|
2148
|
+
}
|
|
2149
|
+
try {
|
|
2150
|
+
const link = document.createElement("link");
|
|
2151
|
+
link.rel = "stylesheet";
|
|
2152
|
+
link.href = href;
|
|
2153
|
+
document.head.appendChild(link);
|
|
2154
|
+
loadedStylesRef.current.set(href, link);
|
|
2155
|
+
} catch (error) {
|
|
2156
|
+
console.warn(`Failed to load style: ${href}`, error);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
switchCSS();
|
|
2161
|
+
}, [direction, styles]);
|
|
2162
|
+
return {
|
|
2163
|
+
direction,
|
|
2164
|
+
setDirection
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
function getLoadedBootstrapDirection(styles = [BOOTSTRAP]) {
|
|
2168
|
+
for (const style of styles) {
|
|
2169
|
+
const ltrHref = createLazyStyleHref(style, "ltr");
|
|
2170
|
+
const rtlHref = createLazyStyleHref(style, "rtl");
|
|
2171
|
+
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
2172
|
+
for (const link of links) {
|
|
2173
|
+
const href = link.href;
|
|
2174
|
+
if (href.includes(ltrHref)) return "ltr";
|
|
2175
|
+
if (href.includes(rtlHref)) return "rtl";
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
return void 0;
|
|
2179
|
+
}
|
|
2180
|
+
function initLazyStyleHandler(options = {}) {
|
|
2181
|
+
return () => {
|
|
2182
|
+
const { initialDirection = "ltr" } = options;
|
|
2183
|
+
document.body.dir = initialDirection;
|
|
2184
|
+
return { direction: initialDirection };
|
|
2185
|
+
};
|
|
2089
2186
|
}
|
|
2090
2187
|
|
|
2091
2188
|
// src/utils/styles.ts
|
|
@@ -2159,6 +2256,44 @@ function injectThemeSharedStyles() {
|
|
|
2159
2256
|
};
|
|
2160
2257
|
}
|
|
2161
2258
|
|
|
2259
|
+
// src/utils/nav-items.ts
|
|
2260
|
+
var navItems = [];
|
|
2261
|
+
var subscribers = /* @__PURE__ */ new Set();
|
|
2262
|
+
function addNavItem(item) {
|
|
2263
|
+
navItems = [...navItems, item].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
2264
|
+
notifySubscribers();
|
|
2265
|
+
}
|
|
2266
|
+
function removeNavItem(item) {
|
|
2267
|
+
navItems = navItems.filter((i) => i !== item);
|
|
2268
|
+
notifySubscribers();
|
|
2269
|
+
}
|
|
2270
|
+
function clearNavItems() {
|
|
2271
|
+
navItems = [];
|
|
2272
|
+
notifySubscribers();
|
|
2273
|
+
}
|
|
2274
|
+
function getNavItemsSync() {
|
|
2275
|
+
return [...navItems];
|
|
2276
|
+
}
|
|
2277
|
+
function subscribeToNavItems(callback) {
|
|
2278
|
+
subscribers.add(callback);
|
|
2279
|
+
callback([...navItems]);
|
|
2280
|
+
return () => {
|
|
2281
|
+
subscribers.delete(callback);
|
|
2282
|
+
};
|
|
2283
|
+
}
|
|
2284
|
+
function notifySubscribers() {
|
|
2285
|
+
const currentItems = [...navItems];
|
|
2286
|
+
subscribers.forEach((callback) => callback(currentItems));
|
|
2287
|
+
}
|
|
2288
|
+
function getNavItems() {
|
|
2289
|
+
return {
|
|
2290
|
+
subscribe: (callback) => {
|
|
2291
|
+
const unsubscribe = subscribeToNavItems(callback);
|
|
2292
|
+
return { unsubscribe };
|
|
2293
|
+
}
|
|
2294
|
+
};
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2162
2297
|
// src/utils/validation-utils.ts
|
|
2163
2298
|
var PASSWORD_SETTING_KEYS = {
|
|
2164
2299
|
requiredLength: "Abp.Identity.Password.RequiredLength",
|
|
@@ -2278,6 +2413,7 @@ function getPasswordValidationRules(store) {
|
|
|
2278
2413
|
AbpModalFooter,
|
|
2279
2414
|
AbpModalHeader,
|
|
2280
2415
|
Alert,
|
|
2416
|
+
BOOTSTRAP,
|
|
2281
2417
|
Button,
|
|
2282
2418
|
ChakraDialog,
|
|
2283
2419
|
ChangePassword,
|
|
@@ -2285,11 +2421,14 @@ function getPasswordValidationRules(store) {
|
|
|
2285
2421
|
Confirmation,
|
|
2286
2422
|
ConfirmationDialog,
|
|
2287
2423
|
ConfirmationProvider,
|
|
2424
|
+
DEFAULT_LAZY_STYLES,
|
|
2288
2425
|
DEFAULT_STYLES,
|
|
2289
2426
|
ErrorComponent,
|
|
2290
2427
|
FormField,
|
|
2291
2428
|
HTTP_ERROR_CONFIG,
|
|
2292
2429
|
HttpErrorConfigContext,
|
|
2430
|
+
LAZY_STYLES,
|
|
2431
|
+
LazyStylesContext,
|
|
2293
2432
|
LoaderBar,
|
|
2294
2433
|
Modal,
|
|
2295
2434
|
ModalBody,
|
|
@@ -2307,10 +2446,16 @@ function getPasswordValidationRules(store) {
|
|
|
2307
2446
|
Toaster,
|
|
2308
2447
|
ToasterProvider,
|
|
2309
2448
|
abpSystem,
|
|
2449
|
+
addNavItem,
|
|
2450
|
+
clearNavItems,
|
|
2310
2451
|
createAbpSystem,
|
|
2311
2452
|
createErrorInterceptor,
|
|
2453
|
+
createLazyStyleHref,
|
|
2312
2454
|
defaultAbpConfig,
|
|
2313
2455
|
defineConfig,
|
|
2456
|
+
getLoadedBootstrapDirection,
|
|
2457
|
+
getNavItems,
|
|
2458
|
+
getNavItemsSync,
|
|
2314
2459
|
getPasswordSettings,
|
|
2315
2460
|
getPasswordValidationRules,
|
|
2316
2461
|
getPasswordValidators,
|
|
@@ -2318,12 +2463,17 @@ function getPasswordValidationRules(store) {
|
|
|
2318
2463
|
getSeverityBorderColor,
|
|
2319
2464
|
getSeverityColorScheme,
|
|
2320
2465
|
httpErrorConfigFactory,
|
|
2466
|
+
initLazyStyleHandler,
|
|
2321
2467
|
injectThemeSharedStyles,
|
|
2468
|
+
removeNavItem,
|
|
2469
|
+
subscribeToNavItems,
|
|
2322
2470
|
useConfirmation,
|
|
2323
2471
|
useConfirmationContext,
|
|
2324
2472
|
useConfirmationState,
|
|
2325
2473
|
useErrorHandler,
|
|
2326
2474
|
useHttpErrorConfig,
|
|
2475
|
+
useLazyStyleHandler,
|
|
2476
|
+
useLazyStyles,
|
|
2327
2477
|
useModal,
|
|
2328
2478
|
useModalContext,
|
|
2329
2479
|
useModalState,
|