@abpjs/theme-shared 3.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -30,9 +30,15 @@ var NavItem = class {
30
30
  // src/constants/styles.ts
31
31
  var BOOTSTRAP = "bootstrap-{{dir}}.min.css";
32
32
  var DEFAULT_STYLES = `
33
+ /* Enhanced validation styles - @since 4.0.0 */
33
34
  .is-invalid .form-control {
34
35
  border-color: #dc3545;
35
36
  border-style: solid !important;
37
+ padding-right: calc(1.5em + .75rem);
38
+ background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e);
39
+ background-repeat: no-repeat;
40
+ background-position: right calc(.375em + .1875rem) center;
41
+ background-size: calc(.75em + .375rem) calc(.75em + .375rem);
36
42
  }
37
43
 
38
44
  .is-invalid .invalid-feedback,
@@ -64,6 +70,12 @@ var DEFAULT_STYLES = `
64
70
  min-width: 215px;
65
71
  }
66
72
 
73
+ /* ngx-datatable scroll fix - @since 3.2.0 */
74
+ .datatable-scroll {
75
+ margin-bottom: 5px !important;
76
+ width: unset !important;
77
+ }
78
+
67
79
  .ui-table-scrollable-body::-webkit-scrollbar {
68
80
  height: 5px !important;
69
81
  width: 5px !important;
@@ -169,6 +181,13 @@ var DEFAULT_STYLES = `
169
181
  .sorting_asc:after {
170
182
  opacity: .3;
171
183
  }
184
+ .ngx-datatable.material {
185
+ box-shadow: none;
186
+ }
187
+ /* Typeahead dropdown styles - @since 4.0.0 */
188
+ .abp-typeahead-window {
189
+ width: 100%;
190
+ }
172
191
 
173
192
  @keyframes fadeInTop {
174
193
  from {
@@ -239,10 +258,18 @@ function useLazyStyles() {
239
258
  }
240
259
  var LAZY_STYLES = DEFAULT_LAZY_STYLES;
241
260
 
261
+ // src/tokens/suppress-unsaved-changes-warning.token.ts
262
+ import { createContext as createContext4, useContext as useContext3 } from "react";
263
+ var SUPPRESS_UNSAVED_CHANGES_WARNING = "SUPPRESS_UNSAVED_CHANGES_WARNING";
264
+ var SuppressUnsavedChangesWarningContext = createContext4(false);
265
+ function useSuppressUnsavedChangesWarning() {
266
+ return useContext3(SuppressUnsavedChangesWarningContext);
267
+ }
268
+
242
269
  // src/contexts/toaster.context.tsx
243
270
  import {
244
- createContext as createContext4,
245
- useContext as useContext3,
271
+ createContext as createContext5,
272
+ useContext as useContext4,
246
273
  useCallback,
247
274
  useState,
248
275
  useRef,
@@ -250,7 +277,7 @@ import {
250
277
  useEffect
251
278
  } from "react";
252
279
  import { jsx } from "react/jsx-runtime";
253
- var ToasterContext = createContext4(null);
280
+ var ToasterContext = createContext5(null);
254
281
  var toastCounter = 0;
255
282
  function generateId() {
256
283
  toastCounter += 1;
@@ -308,10 +335,10 @@ function ToasterProvider({ children }) {
308
335
  (message, title, options) => show(message, title, "error", options),
309
336
  [show]
310
337
  );
311
- const clear = useCallback((key) => {
338
+ const clear = useCallback((containerKey) => {
312
339
  setToasts((prev) => {
313
- if (key) {
314
- return prev.filter((toast) => toast.options?.containerKey !== key);
340
+ if (containerKey) {
341
+ return prev.filter((toast) => toast.options?.containerKey !== containerKey);
315
342
  }
316
343
  return [];
317
344
  });
@@ -343,21 +370,21 @@ function ToasterProvider({ children }) {
343
370
  return /* @__PURE__ */ jsx(ToasterContext.Provider, { value, children });
344
371
  }
345
372
  function useToaster() {
346
- const context = useContext3(ToasterContext);
373
+ const context = useContext4(ToasterContext);
347
374
  if (!context) {
348
375
  throw new Error("useToaster must be used within a ToasterProvider");
349
376
  }
350
377
  return context.service;
351
378
  }
352
379
  function useToasts() {
353
- const context = useContext3(ToasterContext);
380
+ const context = useContext4(ToasterContext);
354
381
  if (!context) {
355
382
  throw new Error("useToasts must be used within a ToasterProvider");
356
383
  }
357
384
  return context.toasts;
358
385
  }
359
386
  function useToasterContext() {
360
- const context = useContext3(ToasterContext);
387
+ const context = useContext4(ToasterContext);
361
388
  if (!context) {
362
389
  throw new Error("useToasterContext must be used within a ToasterProvider");
363
390
  }
@@ -366,8 +393,8 @@ function useToasterContext() {
366
393
 
367
394
  // src/contexts/confirmation.context.tsx
368
395
  import {
369
- createContext as createContext5,
370
- useContext as useContext4,
396
+ createContext as createContext6,
397
+ useContext as useContext5,
371
398
  useCallback as useCallback2,
372
399
  useState as useState2,
373
400
  useRef as useRef2,
@@ -375,7 +402,7 @@ import {
375
402
  useEffect as useEffect2
376
403
  } from "react";
377
404
  import { jsx as jsx2 } from "react/jsx-runtime";
378
- var ConfirmationContext = createContext5(null);
405
+ var ConfirmationContext = createContext6(null);
379
406
  function generateId2() {
380
407
  return `confirmation-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
381
408
  }
@@ -482,21 +509,21 @@ function ConfirmationProvider({ children }) {
482
509
  return /* @__PURE__ */ jsx2(ConfirmationContext.Provider, { value, children });
483
510
  }
484
511
  function useConfirmation() {
485
- const context = useContext4(ConfirmationContext);
512
+ const context = useContext5(ConfirmationContext);
486
513
  if (!context) {
487
514
  throw new Error("useConfirmation must be used within a ConfirmationProvider");
488
515
  }
489
516
  return context.service;
490
517
  }
491
518
  function useConfirmationState() {
492
- const context = useContext4(ConfirmationContext);
519
+ const context = useContext5(ConfirmationContext);
493
520
  if (!context) {
494
521
  throw new Error("useConfirmationState must be used within a ConfirmationProvider");
495
522
  }
496
523
  return { confirmation: context.confirmation, respond: context.respond };
497
524
  }
498
525
  function useConfirmationContext() {
499
- const context = useContext4(ConfirmationContext);
526
+ const context = useContext5(ConfirmationContext);
500
527
  if (!context) {
501
528
  throw new Error("useConfirmationContext must be used within a ConfirmationProvider");
502
529
  }
@@ -505,15 +532,15 @@ function useConfirmationContext() {
505
532
 
506
533
  // src/contexts/modal.context.tsx
507
534
  import {
508
- createContext as createContext6,
509
- useContext as useContext5,
535
+ createContext as createContext7,
536
+ useContext as useContext6,
510
537
  useCallback as useCallback3,
511
538
  useState as useState3,
512
539
  useRef as useRef3,
513
540
  useMemo as useMemo3
514
541
  } from "react";
515
542
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
516
- var ModalContext = createContext6(null);
543
+ var ModalContext = createContext7(null);
517
544
  function ModalProvider({ children }) {
518
545
  const [modalState, setModalState] = useState3(null);
519
546
  const [, setUpdateCounter] = useState3(0);
@@ -549,21 +576,21 @@ function ModalProvider({ children }) {
549
576
  ] });
550
577
  }
551
578
  function useModal() {
552
- const context = useContext5(ModalContext);
579
+ const context = useContext6(ModalContext);
553
580
  if (!context) {
554
581
  throw new Error("useModal must be used within a ModalProvider");
555
582
  }
556
583
  return context.service;
557
584
  }
558
585
  function useModalState() {
559
- const context = useContext5(ModalContext);
586
+ const context = useContext6(ModalContext);
560
587
  if (!context) {
561
588
  throw new Error("useModalState must be used within a ModalProvider");
562
589
  }
563
590
  return context.modalState;
564
591
  }
565
592
  function useModalContext() {
566
- const context = useContext5(ModalContext);
593
+ const context = useContext6(ModalContext);
567
594
  if (!context) {
568
595
  throw new Error("useModalContext must be used within a ModalProvider");
569
596
  }
@@ -2569,6 +2596,8 @@ export {
2569
2596
  NavItemsService,
2570
2597
  PASSWORD_SETTING_KEYS,
2571
2598
  Profile,
2599
+ SUPPRESS_UNSAVED_CHANGES_WARNING,
2600
+ SuppressUnsavedChangesWarningContext,
2572
2601
  THEME_SHARED_APPEND_CONTENT,
2573
2602
  THEME_SHARED_ROUTE_PROVIDERS,
2574
2603
  THEME_SHARED_STYLES,
@@ -2607,6 +2636,7 @@ export {
2607
2636
  useModalContext,
2608
2637
  useModalState,
2609
2638
  useNavItems,
2639
+ useSuppressUnsavedChangesWarning,
2610
2640
  useToaster,
2611
2641
  useToasterContext,
2612
2642
  useToasts
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Confirmation namespace containing types for confirmation dialogs.
3
- * Translated from @abp/ng.theme.shared/lib/models/confirmation.ts v3.0.0
3
+ * Translated from @abp/ng.theme.shared/lib/models/confirmation.ts v4.0.0
4
4
  *
5
5
  * @since 2.0.0 - Major changes:
6
6
  * - Options no longer extends Toaster.Options
@@ -11,8 +11,9 @@
11
11
  * @since 2.1.0 - Added Status enum (confirmation-specific, replaces Toaster.Status usage)
12
12
  * @since 2.9.0 - Added dismissible property, deprecated closable
13
13
  * @since 3.0.0 - Removed closable property (use dismissible instead)
14
+ * @since 4.0.0 - Changed cancelText/yesText from Config.LocalizationParam to LocalizationParam
14
15
  */
15
- import type { Config } from '@abpjs/core';
16
+ import type { Config, LocalizationParam } from '@abpjs/core';
16
17
  export declare namespace Confirmation {
17
18
  /**
18
19
  * Options for configuring a confirmation dialog.
@@ -35,10 +36,16 @@ export declare namespace Confirmation {
35
36
  hideCancelBtn?: boolean;
36
37
  /** Hide the yes/confirm button */
37
38
  hideYesBtn?: boolean;
38
- /** Custom text for the cancel button */
39
- cancelText?: Config.LocalizationParam;
40
- /** Custom text for the yes button */
41
- yesText?: Config.LocalizationParam;
39
+ /**
40
+ * Custom text for the cancel button
41
+ * @since 4.0.0 - Changed from Config.LocalizationParam to LocalizationParam
42
+ */
43
+ cancelText?: LocalizationParam;
44
+ /**
45
+ * Custom text for the yes button
46
+ * @since 4.0.0 - Changed from Config.LocalizationParam to LocalizationParam
47
+ */
48
+ yesText?: LocalizationParam;
42
49
  }
43
50
  /**
44
51
  * Dialog data structure for confirmation dialogs.
@@ -1,7 +1,7 @@
1
- import type { Config } from '@abpjs/core';
1
+ import type { Config, LocalizationParam } from '@abpjs/core';
2
2
  /**
3
3
  * Toaster namespace containing types and interfaces for toast notifications.
4
- * Translated from @abp/ng.theme.shared/lib/models/toaster.ts v3.0.0
4
+ * Translated from @abp/ng.theme.shared/lib/models/toaster.ts v4.0.0
5
5
  *
6
6
  * @since 2.0.0 - Major changes:
7
7
  * - `Options` renamed to `ToastOptions`
@@ -10,6 +10,9 @@ import type { Config } from '@abpjs/core';
10
10
  * - ToasterService methods now return number (toast ID) instead of Observable
11
11
  *
12
12
  * @since 3.0.0 - Status enum removed, use Confirmation.Status instead
13
+ * @since 4.0.0 - Added ToasterId type, Service interface
14
+ * - Changed Toast.message/title from Config.LocalizationParam to LocalizationParam
15
+ * - Service methods return ToasterId instead of number
13
16
  */
14
17
  export declare namespace Toaster {
15
18
  /**
@@ -37,12 +40,13 @@ export declare namespace Toaster {
37
40
  /**
38
41
  * Complete toast structure.
39
42
  * @since 2.0.0
43
+ * @since 4.0.0 - Changed message/title from Config.LocalizationParam to LocalizationParam
40
44
  */
41
45
  interface Toast {
42
46
  /** The message content (can be a localization key) */
43
- message: Config.LocalizationParam;
47
+ message: LocalizationParam;
44
48
  /** The title (can be a localization key) */
45
- title?: Config.LocalizationParam;
49
+ title?: LocalizationParam;
46
50
  /** Severity level of the toast */
47
51
  severity?: string;
48
52
  /** Options for the toast */
@@ -53,4 +57,23 @@ export declare namespace Toaster {
53
57
  * @since 2.0.0 - Changed 'warn' to 'warning', added 'neutral'
54
58
  */
55
59
  type Severity = 'neutral' | 'success' | 'info' | 'warning' | 'error';
60
+ /**
61
+ * Toast identifier type.
62
+ * @since 4.0.0
63
+ */
64
+ type ToasterId = string | number;
65
+ /**
66
+ * ToasterService contract interface.
67
+ * Defines the public API that any toaster service implementation must satisfy.
68
+ * @since 4.0.0
69
+ */
70
+ interface Service {
71
+ show: (message: LocalizationParam, title: LocalizationParam, severity: Toaster.Severity, options: Partial<Toaster.ToastOptions>) => ToasterId;
72
+ remove: (id: number) => void;
73
+ clear: (containerKey?: string) => void;
74
+ info: (message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>) => ToasterId;
75
+ success: (message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>) => ToasterId;
76
+ warn: (message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>) => ToasterId;
77
+ error: (message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>) => ToasterId;
78
+ }
56
79
  }
@@ -4,7 +4,9 @@
4
4
  *
5
5
  * @since 2.7.0
6
6
  * @since 2.9.0 - Added LAZY_STYLES token
7
+ * @since 4.0.0 - Added SUPPRESS_UNSAVED_CHANGES_WARNING token
7
8
  */
8
9
  export * from './append-content.token';
9
10
  export * from './http-error.token';
10
11
  export * from './lazy-styles.token';
12
+ export * from './suppress-unsaved-changes-warning.token';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Token name for suppress unsaved changes warning.
3
+ * @since 4.0.0
4
+ */
5
+ export declare const SUPPRESS_UNSAVED_CHANGES_WARNING = "SUPPRESS_UNSAVED_CHANGES_WARNING";
6
+ /**
7
+ * Context for the suppress unsaved changes warning flag.
8
+ * Default is false (unsaved changes warning is shown).
9
+ * @since 4.0.0
10
+ */
11
+ export declare const SuppressUnsavedChangesWarningContext: import("react").Context<boolean>;
12
+ /**
13
+ * Hook to get the current suppress unsaved changes warning value.
14
+ * @returns Whether unsaved changes warnings should be suppressed
15
+ * @since 4.0.0
16
+ */
17
+ export declare function useSuppressUnsavedChangesWarning(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/theme-shared",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "ABP Framework Theme Shared components for React - translated from @abp/ng.theme.shared",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,10 +27,10 @@
27
27
  "next-themes": "^0.4.6",
28
28
  "react-hook-form": "^7.48.0",
29
29
  "react-icons": "^5.5.0",
30
- "@abpjs/core": "3.1.0"
30
+ "@abpjs/core": "4.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@abp/ng.theme.shared": "3.1.0",
33
+ "@abp/ng.theme.shared": "4.0.0",
34
34
  "@vitest/coverage-v8": "^1.6.0",
35
35
  "vitest": "^1.6.0"
36
36
  },