@abpjs/theme-shared 0.7.6

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.
Files changed (36) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +568 -0
  3. package/dist/components/confirmation/Confirmation.d.ts +27 -0
  4. package/dist/components/confirmation/index.d.ts +1 -0
  5. package/dist/components/index.d.ts +4 -0
  6. package/dist/components/modal/Modal.d.ts +114 -0
  7. package/dist/components/modal/index.d.ts +1 -0
  8. package/dist/components/toast/Toast.d.ts +43 -0
  9. package/dist/components/toast/index.d.ts +1 -0
  10. package/dist/components/ui/Alert.d.ts +50 -0
  11. package/dist/components/ui/Button.d.ts +70 -0
  12. package/dist/components/ui/Checkbox.d.ts +64 -0
  13. package/dist/components/ui/FormField.d.ts +50 -0
  14. package/dist/components/ui/color-mode.d.ts +19 -0
  15. package/dist/components/ui/index.d.ts +16 -0
  16. package/dist/components/ui/provider.d.ts +2 -0
  17. package/dist/components/ui/toaster.d.ts +3 -0
  18. package/dist/components/ui/tooltip.d.ts +11 -0
  19. package/dist/contexts/confirmation.context.d.ts +100 -0
  20. package/dist/contexts/index.d.ts +2 -0
  21. package/dist/contexts/toaster.context.d.ts +91 -0
  22. package/dist/handlers/error.handler.d.ts +110 -0
  23. package/dist/handlers/index.d.ts +1 -0
  24. package/dist/hooks/index.d.ts +3 -0
  25. package/dist/index.d.ts +17 -0
  26. package/dist/index.js +1305 -0
  27. package/dist/index.mjs +1281 -0
  28. package/dist/models/confirmation.d.ts +21 -0
  29. package/dist/models/index.d.ts +2 -0
  30. package/dist/models/toaster.d.ts +48 -0
  31. package/dist/providers/ThemeSharedProvider.d.ts +135 -0
  32. package/dist/providers/index.d.ts +1 -0
  33. package/dist/theme/index.d.ts +42 -0
  34. package/dist/utils/index.d.ts +1 -0
  35. package/dist/utils/styles.d.ts +14 -0
  36. package/package.json +57 -0
package/dist/index.js ADDED
@@ -0,0 +1,1305 @@
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 index_exports = {};
32
+ __export(index_exports, {
33
+ AbpModalBody: () => AbpModalBody,
34
+ AbpModalFooter: () => AbpModalFooter,
35
+ AbpModalHeader: () => AbpModalHeader,
36
+ Alert: () => Alert,
37
+ Button: () => Button2,
38
+ ChakraDialog: () => import_react8.Dialog,
39
+ Checkbox: () => Checkbox,
40
+ ConfirmationDialog: () => ConfirmationDialog,
41
+ ConfirmationProvider: () => ConfirmationProvider,
42
+ FormField: () => FormField,
43
+ Modal: () => Modal,
44
+ ModalBody: () => AbpModalBody,
45
+ ModalFooter: () => AbpModalFooter,
46
+ ModalHeader: () => AbpModalHeader,
47
+ THEME_SHARED_STYLES: () => THEME_SHARED_STYLES,
48
+ ThemeSharedProvider: () => ThemeSharedProvider,
49
+ ToastContainer: () => ToastContainer,
50
+ Toaster: () => Toaster,
51
+ ToasterProvider: () => ToasterProvider,
52
+ abpSystem: () => abpSystem,
53
+ createAbpSystem: () => createAbpSystem,
54
+ createErrorInterceptor: () => createErrorInterceptor,
55
+ defaultAbpConfig: () => defaultAbpConfig,
56
+ defineConfig: () => import_react15.defineConfig,
57
+ getSeverityBg: () => getSeverityBg,
58
+ getSeverityBorderColor: () => getSeverityBorderColor,
59
+ getSeverityColorScheme: () => getSeverityColorPalette,
60
+ injectThemeSharedStyles: () => injectThemeSharedStyles,
61
+ useConfirmation: () => useConfirmation,
62
+ useConfirmationContext: () => useConfirmationContext,
63
+ useConfirmationState: () => useConfirmationState,
64
+ useErrorHandler: () => useErrorHandler,
65
+ useToaster: () => useToaster,
66
+ useToasterContext: () => useToasterContext,
67
+ useToasts: () => useToasts
68
+ });
69
+ module.exports = __toCommonJS(index_exports);
70
+
71
+ // src/models/toaster.ts
72
+ var Toaster;
73
+ ((Toaster2) => {
74
+ let Status;
75
+ ((Status2) => {
76
+ Status2["confirm"] = "confirm";
77
+ Status2["reject"] = "reject";
78
+ Status2["dismiss"] = "dismiss";
79
+ })(Status = Toaster2.Status || (Toaster2.Status = {}));
80
+ })(Toaster || (Toaster = {}));
81
+
82
+ // src/contexts/toaster.context.tsx
83
+ var import_react = require("react");
84
+ var import_jsx_runtime = require("react/jsx-runtime");
85
+ var ToasterContext = (0, import_react.createContext)(null);
86
+ var toastCounter = 0;
87
+ function generateId() {
88
+ toastCounter += 1;
89
+ return `toast-${Date.now()}-${toastCounter}-${Math.random().toString(36).substring(2, 9)}`;
90
+ }
91
+ var DEFAULT_LIFE = 5e3;
92
+ function ToasterProvider({ children }) {
93
+ const [toasts, setToasts] = (0, import_react.useState)([]);
94
+ const resolversRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
95
+ const remove = (0, import_react.useCallback)((id) => {
96
+ setToasts((prev) => prev.filter((t) => t.id !== id));
97
+ const resolver = resolversRef.current.get(id);
98
+ if (resolver) {
99
+ resolver(Toaster.Status.dismiss);
100
+ resolversRef.current.delete(id);
101
+ }
102
+ }, []);
103
+ const show = (0, import_react.useCallback)(
104
+ (message, title, severity, options) => {
105
+ const id = options?.id?.toString() || generateId();
106
+ const life = options?.sticky ? void 0 : options?.life ?? DEFAULT_LIFE;
107
+ const toast = {
108
+ id,
109
+ message,
110
+ title,
111
+ severity,
112
+ ...options
113
+ };
114
+ setToasts((prev) => [...prev, toast]);
115
+ if (life) {
116
+ setTimeout(() => {
117
+ remove(id);
118
+ }, life);
119
+ }
120
+ return new Promise((resolve) => {
121
+ resolversRef.current.set(id, resolve);
122
+ });
123
+ },
124
+ [remove]
125
+ );
126
+ const info = (0, import_react.useCallback)(
127
+ (message, title, options) => show(message, title, "info", options),
128
+ [show]
129
+ );
130
+ const success = (0, import_react.useCallback)(
131
+ (message, title, options) => show(message, title, "success", options),
132
+ [show]
133
+ );
134
+ const warn = (0, import_react.useCallback)(
135
+ (message, title, options) => show(message, title, "warn", options),
136
+ [show]
137
+ );
138
+ const error = (0, import_react.useCallback)(
139
+ (message, title, options) => show(message, title, "error", options),
140
+ [show]
141
+ );
142
+ const addAll = (0, import_react.useCallback)(
143
+ (messages) => {
144
+ messages.forEach((msg) => {
145
+ show(msg.message, msg.title, msg.severity, msg);
146
+ });
147
+ },
148
+ [show]
149
+ );
150
+ const clear = (0, import_react.useCallback)((status) => {
151
+ setToasts((prev) => {
152
+ prev.forEach((toast) => {
153
+ const resolver = resolversRef.current.get(toast.id);
154
+ if (resolver) {
155
+ resolver(status ?? Toaster.Status.dismiss);
156
+ resolversRef.current.delete(toast.id);
157
+ }
158
+ });
159
+ return [];
160
+ });
161
+ }, []);
162
+ const service = (0, import_react.useMemo)(
163
+ () => ({
164
+ info,
165
+ success,
166
+ warn,
167
+ error,
168
+ addAll,
169
+ clear,
170
+ remove
171
+ }),
172
+ [info, success, warn, error, addAll, clear, remove]
173
+ );
174
+ const value = (0, import_react.useMemo)(
175
+ () => ({ service, toasts }),
176
+ [service, toasts]
177
+ );
178
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToasterContext.Provider, { value, children });
179
+ }
180
+ function useToaster() {
181
+ const context = (0, import_react.useContext)(ToasterContext);
182
+ if (!context) {
183
+ throw new Error("useToaster must be used within a ToasterProvider");
184
+ }
185
+ return context.service;
186
+ }
187
+ function useToasts() {
188
+ const context = (0, import_react.useContext)(ToasterContext);
189
+ if (!context) {
190
+ throw new Error("useToasts must be used within a ToasterProvider");
191
+ }
192
+ return context.toasts;
193
+ }
194
+ function useToasterContext() {
195
+ const context = (0, import_react.useContext)(ToasterContext);
196
+ if (!context) {
197
+ throw new Error("useToasterContext must be used within a ToasterProvider");
198
+ }
199
+ return context;
200
+ }
201
+
202
+ // src/contexts/confirmation.context.tsx
203
+ var import_react2 = require("react");
204
+ var import_jsx_runtime2 = require("react/jsx-runtime");
205
+ var ConfirmationContext = (0, import_react2.createContext)(null);
206
+ function generateId2() {
207
+ return `confirmation-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
208
+ }
209
+ function ConfirmationProvider({ children }) {
210
+ const [confirmation, setConfirmation] = (0, import_react2.useState)(null);
211
+ const resolverRef = (0, import_react2.useRef)(null);
212
+ const respond = (0, import_react2.useCallback)((status) => {
213
+ if (resolverRef.current) {
214
+ resolverRef.current(status);
215
+ resolverRef.current = null;
216
+ }
217
+ setConfirmation(null);
218
+ }, []);
219
+ const show = (0, import_react2.useCallback)(
220
+ (message, title, severity, options = {}) => {
221
+ if (resolverRef.current) {
222
+ resolverRef.current(Toaster.Status.dismiss);
223
+ }
224
+ const id = options.id?.toString() || generateId2();
225
+ const confirmationMessage = {
226
+ id,
227
+ message,
228
+ title,
229
+ severity,
230
+ options
231
+ };
232
+ setConfirmation(confirmationMessage);
233
+ return new Promise((resolve) => {
234
+ resolverRef.current = resolve;
235
+ });
236
+ },
237
+ []
238
+ );
239
+ const info = (0, import_react2.useCallback)(
240
+ (message, title, options) => show(message, title, "info", options),
241
+ [show]
242
+ );
243
+ const success = (0, import_react2.useCallback)(
244
+ (message, title, options) => show(message, title, "success", options),
245
+ [show]
246
+ );
247
+ const warn = (0, import_react2.useCallback)(
248
+ (message, title, options) => show(message, title, "warn", options),
249
+ [show]
250
+ );
251
+ const error = (0, import_react2.useCallback)(
252
+ (message, title, options) => show(message, title, "error", options),
253
+ [show]
254
+ );
255
+ const clear = (0, import_react2.useCallback)(
256
+ (status) => {
257
+ respond(status ?? Toaster.Status.dismiss);
258
+ },
259
+ [respond]
260
+ );
261
+ const service = (0, import_react2.useMemo)(
262
+ () => ({
263
+ info,
264
+ success,
265
+ warn,
266
+ error,
267
+ clear
268
+ }),
269
+ [info, success, warn, error, clear]
270
+ );
271
+ const value = (0, import_react2.useMemo)(
272
+ () => ({ service, confirmation, respond }),
273
+ [service, confirmation, respond]
274
+ );
275
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ConfirmationContext.Provider, { value, children });
276
+ }
277
+ function useConfirmation() {
278
+ const context = (0, import_react2.useContext)(ConfirmationContext);
279
+ if (!context) {
280
+ throw new Error("useConfirmation must be used within a ConfirmationProvider");
281
+ }
282
+ return context.service;
283
+ }
284
+ function useConfirmationState() {
285
+ const context = (0, import_react2.useContext)(ConfirmationContext);
286
+ if (!context) {
287
+ throw new Error("useConfirmationState must be used within a ConfirmationProvider");
288
+ }
289
+ return { confirmation: context.confirmation, respond: context.respond };
290
+ }
291
+ function useConfirmationContext() {
292
+ const context = (0, import_react2.useContext)(ConfirmationContext);
293
+ if (!context) {
294
+ throw new Error("useConfirmationContext must be used within a ConfirmationProvider");
295
+ }
296
+ return context;
297
+ }
298
+
299
+ // src/handlers/error.handler.ts
300
+ var import_react3 = require("react");
301
+ var DEFAULT_ERROR_MESSAGES = {
302
+ 400: "AbpUi::DefaultErrorMessage400",
303
+ 401: "AbpUi::DefaultErrorMessage401",
304
+ 403: "AbpUi::DefaultErrorMessage403",
305
+ 404: "AbpUi::DefaultErrorMessage404",
306
+ 500: "AbpUi::DefaultErrorMessage500",
307
+ 503: "AbpUi::DefaultErrorMessage503"
308
+ };
309
+ function useErrorHandler(options = {}) {
310
+ const { navigate, loginPath = "/account/login" } = options;
311
+ const confirmation = useConfirmation();
312
+ const navigateToLogin = (0, import_react3.useCallback)(() => {
313
+ if (navigate) {
314
+ navigate(loginPath);
315
+ }
316
+ }, [navigate, loginPath]);
317
+ const showError = (0, import_react3.useCallback)(
318
+ async (message, title) => {
319
+ return confirmation.error(message, title || "AbpUi::Error");
320
+ },
321
+ [confirmation]
322
+ );
323
+ const handleError = (0, import_react3.useCallback)(
324
+ async (error) => {
325
+ if (error.status === 401) {
326
+ navigateToLogin();
327
+ return;
328
+ }
329
+ let message = error.error?.error?.message;
330
+ let title = "AbpUi::Error";
331
+ if (!message) {
332
+ message = DEFAULT_ERROR_MESSAGES[error.status] || "AbpUi::DefaultErrorMessage";
333
+ }
334
+ const validationErrors = error.error?.error?.validationErrors;
335
+ if (validationErrors && validationErrors.length > 0) {
336
+ message = validationErrors.map((e) => e.message).join("\n");
337
+ title = "AbpUi::ValidationError";
338
+ }
339
+ await showError(message, title);
340
+ },
341
+ [navigateToLogin, showError]
342
+ );
343
+ return {
344
+ handleError,
345
+ showError,
346
+ navigateToLogin
347
+ };
348
+ }
349
+ function createErrorInterceptor(errorHandler) {
350
+ return async (error) => {
351
+ if (isHttpErrorResponse(error)) {
352
+ await errorHandler.handleError(error);
353
+ }
354
+ return Promise.reject(error);
355
+ };
356
+ }
357
+ function isHttpErrorResponse(error) {
358
+ return typeof error === "object" && error !== null && "status" in error && typeof error.status === "number";
359
+ }
360
+
361
+ // src/components/toast/Toast.tsx
362
+ var import_react4 = require("react");
363
+ var import_react5 = require("@chakra-ui/react");
364
+ var import_core = require("@abpjs/core");
365
+ var import_lucide_react = require("lucide-react");
366
+ var import_jsx_runtime3 = require("react/jsx-runtime");
367
+ function SeverityIcon({ severity }) {
368
+ const iconProps = { size: 20 };
369
+ switch (severity) {
370
+ case "success":
371
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
372
+ case "info":
373
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
374
+ case "warn":
375
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
376
+ case "error":
377
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.XCircle, { ...iconProps, color: "var(--chakra-colors-red-500)" });
378
+ }
379
+ }
380
+ function getSeverityColorPalette(severity) {
381
+ switch (severity) {
382
+ case "success":
383
+ return "green";
384
+ case "info":
385
+ return "blue";
386
+ case "warn":
387
+ return "yellow";
388
+ case "error":
389
+ return "red";
390
+ }
391
+ }
392
+ function getSeverityBg(severity) {
393
+ switch (severity) {
394
+ case "success":
395
+ return "green.50";
396
+ case "info":
397
+ return "blue.50";
398
+ case "warn":
399
+ return "yellow.50";
400
+ case "error":
401
+ return "red.50";
402
+ }
403
+ }
404
+ function getSeverityBorderColor(severity) {
405
+ switch (severity) {
406
+ case "success":
407
+ return "green.200";
408
+ case "info":
409
+ return "blue.200";
410
+ case "warn":
411
+ return "yellow.200";
412
+ case "error":
413
+ return "red.200";
414
+ }
415
+ }
416
+ function mapSeverityToType(severity) {
417
+ switch (severity) {
418
+ case "success":
419
+ return "success";
420
+ case "info":
421
+ return "info";
422
+ case "warn":
423
+ return "warning";
424
+ case "error":
425
+ return "error";
426
+ }
427
+ }
428
+ function getPlacement(position) {
429
+ switch (position) {
430
+ case "top":
431
+ return "top";
432
+ case "top-left":
433
+ return "top-start";
434
+ // Logical: start = left in LTR, right in RTL
435
+ case "top-right":
436
+ return "top-end";
437
+ // Logical: end = right in LTR, left in RTL
438
+ case "bottom":
439
+ return "bottom";
440
+ case "bottom-left":
441
+ return "bottom-start";
442
+ case "bottom-right":
443
+ default:
444
+ return "bottom-end";
445
+ }
446
+ }
447
+ var toasterCache = /* @__PURE__ */ new Map();
448
+ function getToaster(placement) {
449
+ if (!toasterCache.has(placement)) {
450
+ toasterCache.set(placement, (0, import_react5.createToaster)({
451
+ placement,
452
+ pauseOnPageIdle: true
453
+ }));
454
+ }
455
+ return toasterCache.get(placement);
456
+ }
457
+ function ToastContainer({ position = "bottom-right" }) {
458
+ const { toasts, service } = useToasterContext();
459
+ const { t } = (0, import_core.useLocalization)();
460
+ const displayedToastsRef = (0, import_react4.useRef)(/* @__PURE__ */ new Set());
461
+ const placement = (0, import_react4.useMemo)(() => getPlacement(position), [position]);
462
+ const toaster = (0, import_react4.useMemo)(() => getToaster(placement), [placement]);
463
+ (0, import_react4.useEffect)(() => {
464
+ const newToasts = toasts.filter((toast) => !displayedToastsRef.current.has(toast.id));
465
+ newToasts.forEach((toast) => {
466
+ displayedToastsRef.current.add(toast.id);
467
+ const localizedMessage = t(
468
+ toast.message,
469
+ ...toast.messageLocalizationParams || []
470
+ );
471
+ const localizedTitle = toast.title ? t(toast.title, ...toast.titleLocalizationParams || []) : void 0;
472
+ requestAnimationFrame(() => {
473
+ toaster.create({
474
+ id: toast.id,
475
+ title: localizedTitle,
476
+ description: localizedMessage,
477
+ type: mapSeverityToType(toast.severity),
478
+ duration: toast.sticky ? void 0 : toast.life || 5e3,
479
+ meta: {
480
+ closable: toast.closable !== false,
481
+ severity: toast.severity
482
+ },
483
+ onStatusChange: (details) => {
484
+ if (details.status === "unmounted") {
485
+ displayedToastsRef.current.delete(toast.id);
486
+ service.remove(toast.id);
487
+ }
488
+ }
489
+ });
490
+ });
491
+ });
492
+ }, [toasts, t, service, toaster]);
493
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Toaster, { toaster, insetInline: { mdDown: "4" }, children: (toast) => {
494
+ const severity = toast.meta?.severity || "info";
495
+ const closable = toast.meta?.closable !== false;
496
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
497
+ import_react5.Toast.Root,
498
+ {
499
+ bg: getSeverityBg(severity),
500
+ borderWidth: "1px",
501
+ borderColor: getSeverityBorderColor(severity),
502
+ borderRadius: "lg",
503
+ boxShadow: "lg",
504
+ width: { md: "sm" },
505
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react5.Flex, { align: "flex-start", gap: 3, p: 4, children: [
506
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Box, { flexShrink: 0, pt: "2px", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SeverityIcon, { severity }) }),
507
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react5.Stack, { gap: 1, flex: 1, children: [
508
+ toast.title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Toast.Title, { fontWeight: "bold", fontSize: "sm", color: "fg", children: toast.title }),
509
+ toast.description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Toast.Description, { fontSize: "sm", color: "gray.700", children: toast.description })
510
+ ] }),
511
+ closable && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.Toast.CloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.CloseButton, { size: "sm" }) })
512
+ ] })
513
+ }
514
+ );
515
+ } }) });
516
+ }
517
+
518
+ // src/components/confirmation/Confirmation.tsx
519
+ var import_react6 = require("react");
520
+ var import_react7 = require("@chakra-ui/react");
521
+ var import_core2 = require("@abpjs/core");
522
+ var import_lucide_react2 = require("lucide-react");
523
+ var import_jsx_runtime4 = require("react/jsx-runtime");
524
+ function SeverityIcon2({ severity }) {
525
+ const iconProps = { size: 24 };
526
+ switch (severity) {
527
+ case "success":
528
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.CheckCircle, { ...iconProps, color: "var(--chakra-colors-green-500)" });
529
+ case "info":
530
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Info, { ...iconProps, color: "var(--chakra-colors-blue-500)" });
531
+ case "warn":
532
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.AlertTriangle, { ...iconProps, color: "var(--chakra-colors-yellow-500)" });
533
+ case "error":
534
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.XCircle, { ...iconProps, color: "var(--chakra-colors-red-500)" });
535
+ }
536
+ }
537
+ function getSeverityColorPalette2(severity) {
538
+ switch (severity) {
539
+ case "success":
540
+ return "green";
541
+ case "info":
542
+ return "blue";
543
+ case "warn":
544
+ return "yellow";
545
+ case "error":
546
+ return "red";
547
+ }
548
+ }
549
+ function ConfirmationDialog({ className }) {
550
+ const { confirmation, respond } = useConfirmationState();
551
+ const { t } = (0, import_core2.useLocalization)();
552
+ const cancelRef = (0, import_react6.useRef)(null);
553
+ if (!confirmation) {
554
+ return null;
555
+ }
556
+ const { message, title, severity, options } = confirmation;
557
+ const localizedMessage = t(
558
+ message,
559
+ ...options.messageLocalizationParams || []
560
+ );
561
+ const localizedTitle = title ? t(title, ...options.titleLocalizationParams || []) : void 0;
562
+ const yesCopy = options.yesCopy ? t(options.yesCopy) : t("AbpUi::Yes");
563
+ const cancelCopy = options.cancelCopy ? t(options.cancelCopy) : t("AbpUi::Cancel");
564
+ const handleConfirm = () => {
565
+ respond(Toaster.Status.confirm);
566
+ };
567
+ const handleCancel = () => {
568
+ respond(Toaster.Status.reject);
569
+ };
570
+ const handleDismiss = () => {
571
+ respond(Toaster.Status.dismiss);
572
+ };
573
+ const handleOpenChange = (details) => {
574
+ if (!details.open) {
575
+ handleDismiss();
576
+ }
577
+ };
578
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
579
+ import_react7.Dialog.Root,
580
+ {
581
+ open: true,
582
+ onOpenChange: handleOpenChange,
583
+ role: "alertdialog",
584
+ placement: "center",
585
+ initialFocusEl: () => cancelRef.current,
586
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react7.Portal, { children: [
587
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Backdrop, {}),
588
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react7.Dialog.Content, { className, maxWidth: "md", children: [
589
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react7.Flex, { align: "center", gap: 3, children: [
590
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SeverityIcon2, { severity }),
591
+ localizedTitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Text, { fontWeight: "bold", fontSize: "lg", children: localizedTitle }) })
592
+ ] }) }),
593
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Text, { color: "gray.600", children: localizedMessage }) }),
594
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react7.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react7.Flex, { gap: 3, children: [
595
+ !options.hideCancelBtn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
596
+ import_react7.Button,
597
+ {
598
+ ref: cancelRef,
599
+ variant: "ghost",
600
+ onClick: handleCancel,
601
+ children: cancelCopy
602
+ }
603
+ ),
604
+ !options.hideYesBtn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
605
+ import_react7.Button,
606
+ {
607
+ colorPalette: getSeverityColorPalette2(severity),
608
+ onClick: handleConfirm,
609
+ children: yesCopy
610
+ }
611
+ )
612
+ ] }) })
613
+ ] }) })
614
+ ] })
615
+ }
616
+ );
617
+ }
618
+
619
+ // src/components/modal/Modal.tsx
620
+ var import_react8 = require("@chakra-ui/react");
621
+ var import_jsx_runtime5 = require("react/jsx-runtime");
622
+ function getSizeWidth(size) {
623
+ switch (size) {
624
+ case "sm":
625
+ return "sm";
626
+ case "md":
627
+ return "md";
628
+ case "lg":
629
+ return "lg";
630
+ case "xl":
631
+ return "xl";
632
+ case "full":
633
+ return "full";
634
+ default:
635
+ return "md";
636
+ }
637
+ }
638
+ function Modal({
639
+ visible,
640
+ onVisibleChange,
641
+ size = "md",
642
+ centered = true,
643
+ modalClass,
644
+ header,
645
+ children,
646
+ footer,
647
+ showCloseButton = true,
648
+ closeOnOverlayClick = true,
649
+ closeOnEscape = true,
650
+ scrollBehavior = "inside",
651
+ motionPreset = "scale",
652
+ trapFocus = true,
653
+ preventScroll = true
654
+ }) {
655
+ const handleOpenChange = (details) => {
656
+ onVisibleChange?.(details.open);
657
+ };
658
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
659
+ import_react8.Dialog.Root,
660
+ {
661
+ open: visible,
662
+ onOpenChange: handleOpenChange,
663
+ placement: centered ? "center" : "top",
664
+ closeOnInteractOutside: closeOnOverlayClick,
665
+ closeOnEscape,
666
+ scrollBehavior,
667
+ motionPreset,
668
+ trapFocus,
669
+ preventScroll,
670
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react8.Portal, { children: [
671
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Dialog.Backdrop, {}),
672
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Dialog.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
673
+ import_react8.Dialog.Content,
674
+ {
675
+ className: modalClass,
676
+ width: getSizeWidth(size),
677
+ maxWidth: size === "full" ? "100vw" : void 0,
678
+ maxHeight: size === "full" ? "100vh" : void 0,
679
+ children: [
680
+ (header || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
681
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react8.Flex, { justify: "space-between", align: "center", width: "100%", children: [
682
+ header && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Dialog.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Text, { fontWeight: "bold", fontSize: "lg", children: header }) }),
683
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Dialog.CloseTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.CloseButton, { size: "sm" }) })
684
+ ] }) }),
685
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Separator, {})
686
+ ] }),
687
+ children && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Dialog.Body, { py: 4, children }),
688
+ footer && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
689
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Separator, {}),
690
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Dialog.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Flex, { gap: 3, justify: "flex-end", w: "100%", children: footer }) })
691
+ ] })
692
+ ]
693
+ }
694
+ ) })
695
+ ] })
696
+ }
697
+ );
698
+ }
699
+ function AbpModalHeader({ children, className }) {
700
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Text, { fontWeight: "bold", fontSize: "lg", className, children });
701
+ }
702
+ function AbpModalBody({ children, className }) {
703
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Box, { color: "gray.600", className, children });
704
+ }
705
+ function AbpModalFooter({ children, className }) {
706
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react8.Flex, { gap: 3, justify: "flex-end", className, children });
707
+ }
708
+
709
+ // src/components/ui/Alert.tsx
710
+ var import_react9 = require("@chakra-ui/react");
711
+ var import_jsx_runtime6 = require("react/jsx-runtime");
712
+ function Alert({
713
+ status = "info",
714
+ children,
715
+ title,
716
+ description,
717
+ showIcon = true,
718
+ className,
719
+ mb,
720
+ borderRadius = "md"
721
+ }) {
722
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
723
+ import_react9.Alert.Root,
724
+ {
725
+ status,
726
+ className,
727
+ mb,
728
+ borderRadius,
729
+ children: [
730
+ showIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.Alert.Indicator, {}),
731
+ title ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
732
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.Alert.Title, { children: title }),
733
+ (description || children) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.Alert.Description, { children: description || children })
734
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.Alert.Title, { children })
735
+ ]
736
+ }
737
+ );
738
+ }
739
+
740
+ // src/components/ui/Button.tsx
741
+ var import_react10 = require("react");
742
+ var import_react11 = require("@chakra-ui/react");
743
+ var import_jsx_runtime7 = require("react/jsx-runtime");
744
+ var Button2 = (0, import_react10.forwardRef)(
745
+ function Button3({
746
+ children,
747
+ type = "button",
748
+ variant = "solid",
749
+ colorPalette = "gray",
750
+ size = "md",
751
+ disabled = false,
752
+ loading = false,
753
+ loadingText,
754
+ onClick,
755
+ className,
756
+ width,
757
+ mr,
758
+ ml
759
+ }, ref) {
760
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
761
+ import_react11.Button,
762
+ {
763
+ ref,
764
+ type,
765
+ variant,
766
+ colorPalette,
767
+ size,
768
+ disabled,
769
+ loading,
770
+ loadingText,
771
+ onClick,
772
+ className,
773
+ width,
774
+ mr,
775
+ ml,
776
+ children
777
+ }
778
+ );
779
+ }
780
+ );
781
+
782
+ // src/components/ui/Checkbox.tsx
783
+ var import_react12 = require("react");
784
+ var import_react13 = require("@chakra-ui/react");
785
+ var import_jsx_runtime8 = require("react/jsx-runtime");
786
+ var Checkbox = (0, import_react12.forwardRef)(
787
+ function Checkbox2({
788
+ children,
789
+ checked,
790
+ defaultChecked,
791
+ disabled = false,
792
+ invalid = false,
793
+ required = false,
794
+ readOnly = false,
795
+ colorPalette = "blue",
796
+ size = "md",
797
+ id,
798
+ name,
799
+ value,
800
+ onChange,
801
+ className
802
+ }, ref) {
803
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
804
+ import_react13.Checkbox.Root,
805
+ {
806
+ checked,
807
+ defaultChecked,
808
+ disabled,
809
+ invalid,
810
+ required,
811
+ readOnly,
812
+ colorPalette,
813
+ size,
814
+ className,
815
+ children: [
816
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
817
+ import_react13.Checkbox.HiddenInput,
818
+ {
819
+ ref,
820
+ id,
821
+ name,
822
+ value,
823
+ onChange
824
+ }
825
+ ),
826
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react13.Checkbox.Control, {}),
827
+ children && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react13.Checkbox.Label, { children })
828
+ ]
829
+ }
830
+ );
831
+ }
832
+ );
833
+
834
+ // src/components/ui/FormField.tsx
835
+ var import_react14 = require("@chakra-ui/react");
836
+ var import_jsx_runtime9 = require("react/jsx-runtime");
837
+ function FormField({
838
+ label,
839
+ invalid = false,
840
+ required = false,
841
+ disabled = false,
842
+ errorText,
843
+ helperText,
844
+ children,
845
+ htmlFor,
846
+ className
847
+ }) {
848
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react14.Field.Root, { invalid, disabled, className, children: [
849
+ label && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react14.Field.Label, { htmlFor, children: [
850
+ label,
851
+ required && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.Field.RequiredIndicator, {})
852
+ ] }),
853
+ children,
854
+ helperText && !invalid && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.Field.HelperText, { children: helperText }),
855
+ invalid && errorText && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.Field.ErrorText, { children: errorText })
856
+ ] });
857
+ }
858
+
859
+ // src/providers/ThemeSharedProvider.tsx
860
+ var import_react17 = require("@chakra-ui/react");
861
+
862
+ // src/theme/index.ts
863
+ var import_react15 = require("@chakra-ui/react");
864
+ var colors = {
865
+ brand: {
866
+ 50: { value: "#e3f2fd" },
867
+ 100: { value: "#bbdefb" },
868
+ 200: { value: "#90caf9" },
869
+ 300: { value: "#64b5f6" },
870
+ 400: { value: "#42a5f5" },
871
+ 500: { value: "#2196f3" },
872
+ 600: { value: "#1e88e5" },
873
+ 700: { value: "#1976d2" },
874
+ 800: { value: "#1565c0" },
875
+ 900: { value: "#0d47a1" },
876
+ 950: { value: "#082f5e" }
877
+ },
878
+ success: {
879
+ 50: { value: "#e8f5e9" },
880
+ 100: { value: "#c8e6c9" },
881
+ 200: { value: "#a5d6a7" },
882
+ 300: { value: "#81c784" },
883
+ 400: { value: "#66bb6a" },
884
+ 500: { value: "#4caf50" },
885
+ 600: { value: "#43a047" },
886
+ 700: { value: "#388e3c" },
887
+ 800: { value: "#2e7d32" },
888
+ 900: { value: "#1b5e20" },
889
+ 950: { value: "#0d3010" }
890
+ },
891
+ warning: {
892
+ 50: { value: "#fff8e1" },
893
+ 100: { value: "#ffecb3" },
894
+ 200: { value: "#ffe082" },
895
+ 300: { value: "#ffd54f" },
896
+ 400: { value: "#ffca28" },
897
+ 500: { value: "#ffc107" },
898
+ 600: { value: "#ffb300" },
899
+ 700: { value: "#ffa000" },
900
+ 800: { value: "#ff8f00" },
901
+ 900: { value: "#ff6f00" },
902
+ 950: { value: "#cc5900" }
903
+ },
904
+ error: {
905
+ 50: { value: "#ffebee" },
906
+ 100: { value: "#ffcdd2" },
907
+ 200: { value: "#ef9a9a" },
908
+ 300: { value: "#e57373" },
909
+ 400: { value: "#ef5350" },
910
+ 500: { value: "#f44336" },
911
+ 600: { value: "#e53935" },
912
+ 700: { value: "#d32f2f" },
913
+ 800: { value: "#c62828" },
914
+ 900: { value: "#b71c1c" },
915
+ 950: { value: "#7f1212" }
916
+ }
917
+ };
918
+ var semanticTokens = {
919
+ // colors: {
920
+ // // Background colors
921
+ // bg: {
922
+ // DEFAULT: {
923
+ // value: { _light: '{colors.white}', _dark: '#121212' },
924
+ // },
925
+ // subtle: {
926
+ // value: { _light: '{colors.gray.50}', _dark: '#1a1a1a' },
927
+ // },
928
+ // muted: {
929
+ // value: { _light: '{colors.gray.100}', _dark: '#2d2d2d' },
930
+ // },
931
+ // emphasized: {
932
+ // value: { _light: '{colors.gray.200}', _dark: '#3d3d3d' },
933
+ // },
934
+ // inverted: {
935
+ // value: { _light: '{colors.gray.900}', _dark: '{colors.white}' },
936
+ // },
937
+ // },
938
+ // // Foreground (text) colors
939
+ // fg: {
940
+ // DEFAULT: {
941
+ // value: { _light: '{colors.gray.900}', _dark: '#e5e5e5' },
942
+ // },
943
+ // muted: {
944
+ // value: { _light: '{colors.gray.600}', _dark: '#a1a1a1' },
945
+ // },
946
+ // subtle: {
947
+ // value: { _light: '{colors.gray.500}', _dark: '#737373' },
948
+ // },
949
+ // inverted: {
950
+ // value: { _light: '{colors.white}', _dark: '{colors.gray.900}' },
951
+ // },
952
+ // },
953
+ // // Border colors
954
+ // border: {
955
+ // DEFAULT: {
956
+ // value: { _light: '{colors.gray.200}', _dark: '#3d3d3d' },
957
+ // },
958
+ // muted: {
959
+ // value: { _light: '{colors.gray.100}', _dark: '#2d2d2d' },
960
+ // },
961
+ // subtle: {
962
+ // value: { _light: '{colors.gray.50}', _dark: '#1a1a1a' },
963
+ // },
964
+ // emphasized: {
965
+ // value: { _light: '{colors.gray.300}', _dark: '#525252' },
966
+ // },
967
+ // },
968
+ // // Brand colors with light/dark support
969
+ // brand: {
970
+ // solid: {
971
+ // value: { _light: '{colors.brand.500}', _dark: '{colors.brand.400}' },
972
+ // },
973
+ // contrast: {
974
+ // value: { _light: '{colors.white}', _dark: '{colors.white}' },
975
+ // },
976
+ // fg: {
977
+ // value: { _light: '{colors.brand.700}', _dark: '{colors.brand.300}' },
978
+ // },
979
+ // muted: {
980
+ // value: { _light: '{colors.brand.100}', _dark: '{colors.brand.900}' },
981
+ // },
982
+ // subtle: {
983
+ // value: { _light: '{colors.brand.50}', _dark: '{colors.brand.950}' },
984
+ // },
985
+ // emphasized: {
986
+ // value: { _light: '{colors.brand.300}', _dark: '{colors.brand.600}' },
987
+ // },
988
+ // focusRing: {
989
+ // value: { _light: '{colors.brand.500}', _dark: '{colors.brand.400}' },
990
+ // },
991
+ // },
992
+ // // Success colors with light/dark support
993
+ // success: {
994
+ // solid: {
995
+ // value: { _light: '{colors.success.500}', _dark: '{colors.success.400}' },
996
+ // },
997
+ // contrast: {
998
+ // value: { _light: '{colors.white}', _dark: '{colors.white}' },
999
+ // },
1000
+ // fg: {
1001
+ // value: { _light: '{colors.success.700}', _dark: '{colors.success.300}' },
1002
+ // },
1003
+ // muted: {
1004
+ // value: { _light: '{colors.success.100}', _dark: '{colors.success.900}' },
1005
+ // },
1006
+ // subtle: {
1007
+ // value: { _light: '{colors.success.50}', _dark: '{colors.success.950}' },
1008
+ // },
1009
+ // emphasized: {
1010
+ // value: { _light: '{colors.success.300}', _dark: '{colors.success.600}' },
1011
+ // },
1012
+ // focusRing: {
1013
+ // value: { _light: '{colors.success.500}', _dark: '{colors.success.400}' },
1014
+ // },
1015
+ // },
1016
+ // // Warning colors with light/dark support
1017
+ // warning: {
1018
+ // solid: {
1019
+ // value: { _light: '{colors.warning.500}', _dark: '{colors.warning.400}' },
1020
+ // },
1021
+ // contrast: {
1022
+ // value: { _light: '{colors.black}', _dark: '{colors.black}' },
1023
+ // },
1024
+ // fg: {
1025
+ // value: { _light: '{colors.warning.700}', _dark: '{colors.warning.300}' },
1026
+ // },
1027
+ // muted: {
1028
+ // value: { _light: '{colors.warning.100}', _dark: '{colors.warning.900}' },
1029
+ // },
1030
+ // subtle: {
1031
+ // value: { _light: '{colors.warning.50}', _dark: '{colors.warning.950}' },
1032
+ // },
1033
+ // emphasized: {
1034
+ // value: { _light: '{colors.warning.300}', _dark: '{colors.warning.600}' },
1035
+ // },
1036
+ // focusRing: {
1037
+ // value: { _light: '{colors.warning.500}', _dark: '{colors.warning.400}' },
1038
+ // },
1039
+ // },
1040
+ // // Error colors with light/dark support
1041
+ // error: {
1042
+ // solid: {
1043
+ // value: { _light: '{colors.error.500}', _dark: '{colors.error.400}' },
1044
+ // },
1045
+ // contrast: {
1046
+ // value: { _light: '{colors.white}', _dark: '{colors.white}' },
1047
+ // },
1048
+ // fg: {
1049
+ // value: { _light: '{colors.error.700}', _dark: '{colors.error.300}' },
1050
+ // },
1051
+ // muted: {
1052
+ // value: { _light: '{colors.error.100}', _dark: '{colors.error.900}' },
1053
+ // },
1054
+ // subtle: {
1055
+ // value: { _light: '{colors.error.50}', _dark: '{colors.error.950}' },
1056
+ // },
1057
+ // emphasized: {
1058
+ // value: { _light: '{colors.error.300}', _dark: '{colors.error.600}' },
1059
+ // },
1060
+ // focusRing: {
1061
+ // value: { _light: '{colors.error.500}', _dark: '{colors.error.400}' },
1062
+ // },
1063
+ // },
1064
+ // },
1065
+ };
1066
+ var defaultAbpConfig = (0, import_react15.defineConfig)({
1067
+ theme: {
1068
+ tokens: {
1069
+ colors,
1070
+ fonts: {
1071
+ heading: { value: "system-ui, sans-serif" },
1072
+ body: { value: "system-ui, sans-serif" }
1073
+ }
1074
+ },
1075
+ semanticTokens
1076
+ },
1077
+ // Global styles
1078
+ globalCss: {
1079
+ "html, body": {
1080
+ colorPalette: "brand",
1081
+ bg: "bg",
1082
+ color: "fg"
1083
+ }
1084
+ }
1085
+ });
1086
+ function createAbpSystem(overrides) {
1087
+ if (overrides) {
1088
+ return (0, import_react15.createSystem)(import_react15.defaultConfig, defaultAbpConfig, overrides);
1089
+ }
1090
+ return (0, import_react15.createSystem)(import_react15.defaultConfig, defaultAbpConfig);
1091
+ }
1092
+ var abpSystem = createAbpSystem();
1093
+
1094
+ // src/components/ui/color-mode.tsx
1095
+ var import_react16 = require("@chakra-ui/react");
1096
+ var import_next_themes = require("next-themes");
1097
+ var React7 = __toESM(require("react"));
1098
+ var import_lucide_react3 = require("lucide-react");
1099
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1100
+ function ColorModeProvider(props) {
1101
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_next_themes.ThemeProvider, { attribute: "class", disableTransitionOnChange: true, ...props });
1102
+ }
1103
+ function useColorMode() {
1104
+ const { resolvedTheme, setTheme, forcedTheme } = (0, import_next_themes.useTheme)();
1105
+ const colorMode = forcedTheme || resolvedTheme;
1106
+ const toggleColorMode = () => {
1107
+ setTheme(resolvedTheme === "dark" ? "light" : "dark");
1108
+ };
1109
+ return {
1110
+ colorMode,
1111
+ setColorMode: setTheme,
1112
+ toggleColorMode
1113
+ };
1114
+ }
1115
+ function ColorModeIcon() {
1116
+ const { colorMode } = useColorMode();
1117
+ return colorMode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Moon, {}) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Sun, {});
1118
+ }
1119
+ var ColorModeButton = React7.forwardRef(function ColorModeButton2(props, ref) {
1120
+ const { toggleColorMode } = useColorMode();
1121
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react16.ClientOnly, { fallback: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react16.Skeleton, { boxSize: "9" }), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1122
+ import_react16.IconButton,
1123
+ {
1124
+ onClick: toggleColorMode,
1125
+ variant: "ghost",
1126
+ "aria-label": "Toggle color mode",
1127
+ size: "sm",
1128
+ ref,
1129
+ ...props,
1130
+ css: {
1131
+ _icon: {
1132
+ width: "5",
1133
+ height: "5"
1134
+ }
1135
+ },
1136
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorModeIcon, {})
1137
+ }
1138
+ ) });
1139
+ });
1140
+ var LightMode = React7.forwardRef(
1141
+ function LightMode2(props, ref) {
1142
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1143
+ import_react16.Span,
1144
+ {
1145
+ color: "fg",
1146
+ display: "contents",
1147
+ className: "chakra-theme light",
1148
+ colorPalette: "gray",
1149
+ colorScheme: "light",
1150
+ ref,
1151
+ ...props
1152
+ }
1153
+ );
1154
+ }
1155
+ );
1156
+ var DarkMode = React7.forwardRef(
1157
+ function DarkMode2(props, ref) {
1158
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1159
+ import_react16.Span,
1160
+ {
1161
+ color: "fg",
1162
+ display: "contents",
1163
+ className: "chakra-theme dark",
1164
+ colorPalette: "gray",
1165
+ colorScheme: "dark",
1166
+ ref,
1167
+ ...props
1168
+ }
1169
+ );
1170
+ }
1171
+ );
1172
+
1173
+ // src/providers/ThemeSharedProvider.tsx
1174
+ var import_core3 = require("@abpjs/core");
1175
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1176
+ function ThemeSharedProvider({
1177
+ children,
1178
+ renderToasts = true,
1179
+ renderConfirmation = true,
1180
+ themeOverrides,
1181
+ toastPosition = "bottom-right",
1182
+ enableColorMode = false,
1183
+ defaultColorMode = "light",
1184
+ locale = "en-US"
1185
+ }) {
1186
+ const system = themeOverrides ? createAbpSystem(themeOverrides) : abpSystem;
1187
+ const { endSide } = (0, import_core3.useDirection)();
1188
+ toastPosition = `bottom-${endSide}`;
1189
+ const content = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ToasterProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(ConfirmationProvider, { children: [
1190
+ children,
1191
+ renderToasts && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ToastContainer, { position: toastPosition }),
1192
+ renderConfirmation && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ConfirmationDialog, {})
1193
+ ] }) });
1194
+ const colorModeProps = enableColorMode ? { defaultTheme: defaultColorMode } : { forcedTheme: "light" };
1195
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react17.ChakraProvider, { value: system, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react17.LocaleProvider, { locale, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ColorModeProvider, { ...colorModeProps, children: content }) }) });
1196
+ }
1197
+
1198
+ // src/utils/styles.ts
1199
+ var THEME_SHARED_STYLES = `
1200
+ /* Form validation styling */
1201
+ .is-invalid {
1202
+ border-color: var(--chakra-colors-red-500) !important;
1203
+ }
1204
+
1205
+ .invalid-feedback {
1206
+ display: block;
1207
+ width: 100%;
1208
+ margin-top: var(--chakra-space-1);
1209
+ font-size: var(--chakra-fontSizes-sm);
1210
+ color: var(--chakra-colors-red-500);
1211
+ }
1212
+
1213
+ /* Pointer cursor utility */
1214
+ .pointer {
1215
+ cursor: pointer;
1216
+ }
1217
+
1218
+ /* Fade animations */
1219
+ @keyframes fadeInTop {
1220
+ from {
1221
+ opacity: 0;
1222
+ transform: translateY(-20px);
1223
+ }
1224
+ to {
1225
+ opacity: 1;
1226
+ transform: translateY(0);
1227
+ }
1228
+ }
1229
+
1230
+ @keyframes fadeOutTop {
1231
+ from {
1232
+ opacity: 1;
1233
+ transform: translateY(0);
1234
+ }
1235
+ to {
1236
+ opacity: 0;
1237
+ transform: translateY(-20px);
1238
+ }
1239
+ }
1240
+
1241
+ .fade-in-top {
1242
+ animation: fadeInTop 0.3s ease-out forwards;
1243
+ }
1244
+
1245
+ .fade-out-top {
1246
+ animation: fadeOutTop 0.3s ease-out forwards;
1247
+ }
1248
+ `;
1249
+ function injectThemeSharedStyles() {
1250
+ if (typeof document === "undefined") {
1251
+ return void 0;
1252
+ }
1253
+ const styleId = "abp-theme-shared-styles";
1254
+ if (document.getElementById(styleId)) {
1255
+ return void 0;
1256
+ }
1257
+ const styleElement = document.createElement("style");
1258
+ styleElement.id = styleId;
1259
+ styleElement.textContent = THEME_SHARED_STYLES;
1260
+ document.head.appendChild(styleElement);
1261
+ return () => {
1262
+ const element = document.getElementById(styleId);
1263
+ if (element) {
1264
+ element.remove();
1265
+ }
1266
+ };
1267
+ }
1268
+ // Annotate the CommonJS export names for ESM import in node:
1269
+ 0 && (module.exports = {
1270
+ AbpModalBody,
1271
+ AbpModalFooter,
1272
+ AbpModalHeader,
1273
+ Alert,
1274
+ Button,
1275
+ ChakraDialog,
1276
+ Checkbox,
1277
+ ConfirmationDialog,
1278
+ ConfirmationProvider,
1279
+ FormField,
1280
+ Modal,
1281
+ ModalBody,
1282
+ ModalFooter,
1283
+ ModalHeader,
1284
+ THEME_SHARED_STYLES,
1285
+ ThemeSharedProvider,
1286
+ ToastContainer,
1287
+ Toaster,
1288
+ ToasterProvider,
1289
+ abpSystem,
1290
+ createAbpSystem,
1291
+ createErrorInterceptor,
1292
+ defaultAbpConfig,
1293
+ defineConfig,
1294
+ getSeverityBg,
1295
+ getSeverityBorderColor,
1296
+ getSeverityColorScheme,
1297
+ injectThemeSharedStyles,
1298
+ useConfirmation,
1299
+ useConfirmationContext,
1300
+ useConfirmationState,
1301
+ useErrorHandler,
1302
+ useToaster,
1303
+ useToasterContext,
1304
+ useToasts
1305
+ });