@abpjs/theme-shared 3.2.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,
@@ -175,6 +181,13 @@ var DEFAULT_STYLES = `
175
181
  .sorting_asc:after {
176
182
  opacity: .3;
177
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
+ }
178
191
 
179
192
  @keyframes fadeInTop {
180
193
  from {
@@ -245,10 +258,18 @@ function useLazyStyles() {
245
258
  }
246
259
  var LAZY_STYLES = DEFAULT_LAZY_STYLES;
247
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
+
248
269
  // src/contexts/toaster.context.tsx
249
270
  import {
250
- createContext as createContext4,
251
- useContext as useContext3,
271
+ createContext as createContext5,
272
+ useContext as useContext4,
252
273
  useCallback,
253
274
  useState,
254
275
  useRef,
@@ -256,7 +277,7 @@ import {
256
277
  useEffect
257
278
  } from "react";
258
279
  import { jsx } from "react/jsx-runtime";
259
- var ToasterContext = createContext4(null);
280
+ var ToasterContext = createContext5(null);
260
281
  var toastCounter = 0;
261
282
  function generateId() {
262
283
  toastCounter += 1;
@@ -314,10 +335,10 @@ function ToasterProvider({ children }) {
314
335
  (message, title, options) => show(message, title, "error", options),
315
336
  [show]
316
337
  );
317
- const clear = useCallback((key) => {
338
+ const clear = useCallback((containerKey) => {
318
339
  setToasts((prev) => {
319
- if (key) {
320
- return prev.filter((toast) => toast.options?.containerKey !== key);
340
+ if (containerKey) {
341
+ return prev.filter((toast) => toast.options?.containerKey !== containerKey);
321
342
  }
322
343
  return [];
323
344
  });
@@ -349,21 +370,21 @@ function ToasterProvider({ children }) {
349
370
  return /* @__PURE__ */ jsx(ToasterContext.Provider, { value, children });
350
371
  }
351
372
  function useToaster() {
352
- const context = useContext3(ToasterContext);
373
+ const context = useContext4(ToasterContext);
353
374
  if (!context) {
354
375
  throw new Error("useToaster must be used within a ToasterProvider");
355
376
  }
356
377
  return context.service;
357
378
  }
358
379
  function useToasts() {
359
- const context = useContext3(ToasterContext);
380
+ const context = useContext4(ToasterContext);
360
381
  if (!context) {
361
382
  throw new Error("useToasts must be used within a ToasterProvider");
362
383
  }
363
384
  return context.toasts;
364
385
  }
365
386
  function useToasterContext() {
366
- const context = useContext3(ToasterContext);
387
+ const context = useContext4(ToasterContext);
367
388
  if (!context) {
368
389
  throw new Error("useToasterContext must be used within a ToasterProvider");
369
390
  }
@@ -372,8 +393,8 @@ function useToasterContext() {
372
393
 
373
394
  // src/contexts/confirmation.context.tsx
374
395
  import {
375
- createContext as createContext5,
376
- useContext as useContext4,
396
+ createContext as createContext6,
397
+ useContext as useContext5,
377
398
  useCallback as useCallback2,
378
399
  useState as useState2,
379
400
  useRef as useRef2,
@@ -381,7 +402,7 @@ import {
381
402
  useEffect as useEffect2
382
403
  } from "react";
383
404
  import { jsx as jsx2 } from "react/jsx-runtime";
384
- var ConfirmationContext = createContext5(null);
405
+ var ConfirmationContext = createContext6(null);
385
406
  function generateId2() {
386
407
  return `confirmation-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
387
408
  }
@@ -488,21 +509,21 @@ function ConfirmationProvider({ children }) {
488
509
  return /* @__PURE__ */ jsx2(ConfirmationContext.Provider, { value, children });
489
510
  }
490
511
  function useConfirmation() {
491
- const context = useContext4(ConfirmationContext);
512
+ const context = useContext5(ConfirmationContext);
492
513
  if (!context) {
493
514
  throw new Error("useConfirmation must be used within a ConfirmationProvider");
494
515
  }
495
516
  return context.service;
496
517
  }
497
518
  function useConfirmationState() {
498
- const context = useContext4(ConfirmationContext);
519
+ const context = useContext5(ConfirmationContext);
499
520
  if (!context) {
500
521
  throw new Error("useConfirmationState must be used within a ConfirmationProvider");
501
522
  }
502
523
  return { confirmation: context.confirmation, respond: context.respond };
503
524
  }
504
525
  function useConfirmationContext() {
505
- const context = useContext4(ConfirmationContext);
526
+ const context = useContext5(ConfirmationContext);
506
527
  if (!context) {
507
528
  throw new Error("useConfirmationContext must be used within a ConfirmationProvider");
508
529
  }
@@ -511,15 +532,15 @@ function useConfirmationContext() {
511
532
 
512
533
  // src/contexts/modal.context.tsx
513
534
  import {
514
- createContext as createContext6,
515
- useContext as useContext5,
535
+ createContext as createContext7,
536
+ useContext as useContext6,
516
537
  useCallback as useCallback3,
517
538
  useState as useState3,
518
539
  useRef as useRef3,
519
540
  useMemo as useMemo3
520
541
  } from "react";
521
542
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
522
- var ModalContext = createContext6(null);
543
+ var ModalContext = createContext7(null);
523
544
  function ModalProvider({ children }) {
524
545
  const [modalState, setModalState] = useState3(null);
525
546
  const [, setUpdateCounter] = useState3(0);
@@ -555,21 +576,21 @@ function ModalProvider({ children }) {
555
576
  ] });
556
577
  }
557
578
  function useModal() {
558
- const context = useContext5(ModalContext);
579
+ const context = useContext6(ModalContext);
559
580
  if (!context) {
560
581
  throw new Error("useModal must be used within a ModalProvider");
561
582
  }
562
583
  return context.service;
563
584
  }
564
585
  function useModalState() {
565
- const context = useContext5(ModalContext);
586
+ const context = useContext6(ModalContext);
566
587
  if (!context) {
567
588
  throw new Error("useModalState must be used within a ModalProvider");
568
589
  }
569
590
  return context.modalState;
570
591
  }
571
592
  function useModalContext() {
572
- const context = useContext5(ModalContext);
593
+ const context = useContext6(ModalContext);
573
594
  if (!context) {
574
595
  throw new Error("useModalContext must be used within a ModalProvider");
575
596
  }
@@ -2575,6 +2596,8 @@ export {
2575
2596
  NavItemsService,
2576
2597
  PASSWORD_SETTING_KEYS,
2577
2598
  Profile,
2599
+ SUPPRESS_UNSAVED_CHANGES_WARNING,
2600
+ SuppressUnsavedChangesWarningContext,
2578
2601
  THEME_SHARED_APPEND_CONTENT,
2579
2602
  THEME_SHARED_ROUTE_PROVIDERS,
2580
2603
  THEME_SHARED_STYLES,
@@ -2613,6 +2636,7 @@ export {
2613
2636
  useModalContext,
2614
2637
  useModalState,
2615
2638
  useNavItems,
2639
+ useSuppressUnsavedChangesWarning,
2616
2640
  useToaster,
2617
2641
  useToasterContext,
2618
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.2.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.2.0"
30
+ "@abpjs/core": "4.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@abp/ng.theme.shared": "3.2.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
  },