react-achievements 1.3.7 → 2.0.5

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 (90) hide show
  1. package/README.md +282 -146
  2. package/coverage/clover.xml +1 -1
  3. package/coverage/lcov-report/src/context/AchievementContext.tsx.html +6 -6
  4. package/coverage/lcov-report/src/context/index.html +1 -1
  5. package/coverage/lcov-report/src/index.ts.html +1 -1
  6. package/coverage/lcov.info +1 -1
  7. package/dist/assets/defaultIcons.d.ts +81 -0
  8. package/dist/components/AchievementModal.d.ts +3 -2
  9. package/dist/components/BadgesButton.d.ts +6 -1
  10. package/dist/components/BadgesModal.d.ts +3 -2
  11. package/dist/hooks/useAchievement.d.ts +8 -0
  12. package/dist/index.cjs.js +2100 -103
  13. package/dist/index.d.ts +5 -3
  14. package/dist/index.esm.js +2097 -120
  15. package/dist/providers/AchievementProvider.d.ts +11 -0
  16. package/dist/redux/achievementSlice.d.ts +25 -0
  17. package/dist/redux/notificationSlice.d.ts +7 -0
  18. package/dist/redux/store.d.ts +15 -0
  19. package/dist/types.d.ts +22 -13
  20. package/package.json +26 -18
  21. package/src/assets/defaultIcons.ts +100 -0
  22. package/src/components/AchievementModal.tsx +37 -8
  23. package/src/components/BadgesButton.tsx +33 -7
  24. package/src/components/BadgesModal.tsx +23 -9
  25. package/src/hooks/useAchievement.ts +20 -0
  26. package/src/index.ts +11 -7
  27. package/src/providers/AchievementProvider.tsx +185 -0
  28. package/src/redux/achievementSlice.ts +71 -0
  29. package/src/redux/notificationSlice.ts +26 -0
  30. package/src/redux/store.ts +20 -0
  31. package/src/types.ts +24 -13
  32. package/demo/src/stories/Button.jsx +0 -50
  33. package/demo/src/stories/Button.stories.js +0 -48
  34. package/demo/src/stories/Configure.mdx +0 -364
  35. package/demo/src/stories/Header.jsx +0 -59
  36. package/demo/src/stories/Header.stories.js +0 -28
  37. package/demo/src/stories/Page.jsx +0 -69
  38. package/demo/src/stories/Page.stories.js +0 -28
  39. package/demo/src/stories/assets/accessibility.png +0 -0
  40. package/demo/src/stories/assets/accessibility.svg +0 -1
  41. package/demo/src/stories/assets/addon-library.png +0 -0
  42. package/demo/src/stories/assets/assets.png +0 -0
  43. package/demo/src/stories/assets/avif-test-image.avif +0 -0
  44. package/demo/src/stories/assets/context.png +0 -0
  45. package/demo/src/stories/assets/discord.svg +0 -1
  46. package/demo/src/stories/assets/docs.png +0 -0
  47. package/demo/src/stories/assets/figma-plugin.png +0 -0
  48. package/demo/src/stories/assets/github.svg +0 -1
  49. package/demo/src/stories/assets/share.png +0 -0
  50. package/demo/src/stories/assets/styling.png +0 -0
  51. package/demo/src/stories/assets/testing.png +0 -0
  52. package/demo/src/stories/assets/theming.png +0 -0
  53. package/demo/src/stories/assets/tutorials.svg +0 -1
  54. package/demo/src/stories/assets/youtube.svg +0 -1
  55. package/demo/src/stories/button.css +0 -30
  56. package/demo/src/stories/header.css +0 -32
  57. package/demo/src/stories/page.css +0 -69
  58. package/dist/stories/Button.d.ts +0 -28
  59. package/dist/stories/Button.stories.d.ts +0 -23
  60. package/dist/stories/Header.d.ts +0 -13
  61. package/dist/stories/Header.stories.d.ts +0 -18
  62. package/dist/stories/Page.d.ts +0 -3
  63. package/dist/stories/Page.stories.d.ts +0 -12
  64. package/src/context/AchievementContext.tsx +0 -185
  65. package/src/stories/Button.stories.ts +0 -52
  66. package/src/stories/Button.tsx +0 -48
  67. package/src/stories/Configure.mdx +0 -364
  68. package/src/stories/Header.stories.ts +0 -33
  69. package/src/stories/Header.tsx +0 -56
  70. package/src/stories/Page.stories.ts +0 -32
  71. package/src/stories/Page.tsx +0 -73
  72. package/src/stories/assets/accessibility.png +0 -0
  73. package/src/stories/assets/accessibility.svg +0 -1
  74. package/src/stories/assets/addon-library.png +0 -0
  75. package/src/stories/assets/assets.png +0 -0
  76. package/src/stories/assets/avif-test-image.avif +0 -0
  77. package/src/stories/assets/context.png +0 -0
  78. package/src/stories/assets/discord.svg +0 -1
  79. package/src/stories/assets/docs.png +0 -0
  80. package/src/stories/assets/figma-plugin.png +0 -0
  81. package/src/stories/assets/github.svg +0 -1
  82. package/src/stories/assets/share.png +0 -0
  83. package/src/stories/assets/styling.png +0 -0
  84. package/src/stories/assets/testing.png +0 -0
  85. package/src/stories/assets/theming.png +0 -0
  86. package/src/stories/assets/tutorials.svg +0 -1
  87. package/src/stories/assets/youtube.svg +0 -1
  88. package/src/stories/button.css +0 -30
  89. package/src/stories/header.css +0 -32
  90. package/src/stories/page.css +0 -69
@@ -0,0 +1,81 @@
1
+ export declare const defaultAchievementIcons: {
2
+ levelUp: string;
3
+ questComplete: string;
4
+ monsterDefeated: string;
5
+ itemCollected: string;
6
+ challengeCompleted: string;
7
+ milestoneReached: string;
8
+ firstStep: string;
9
+ newBeginnings: string;
10
+ breakthrough: string;
11
+ growth: string;
12
+ shared: string;
13
+ liked: string;
14
+ commented: string;
15
+ followed: string;
16
+ invited: string;
17
+ communityMember: string;
18
+ supporter: string;
19
+ connected: string;
20
+ participant: string;
21
+ influencer: string;
22
+ activeDay: string;
23
+ activeWeek: string;
24
+ activeMonth: string;
25
+ earlyBird: string;
26
+ nightOwl: string;
27
+ streak: string;
28
+ dedicated: string;
29
+ punctual: string;
30
+ consistent: string;
31
+ marathon: string;
32
+ artist: string;
33
+ writer: string;
34
+ innovator: string;
35
+ creator: string;
36
+ expert: string;
37
+ master: string;
38
+ pioneer: string;
39
+ performer: string;
40
+ thinker: string;
41
+ explorer: string;
42
+ bronze: string;
43
+ silver: string;
44
+ gold: string;
45
+ diamond: string;
46
+ legendary: string;
47
+ epic: string;
48
+ rare: string;
49
+ common: string;
50
+ special: string;
51
+ hidden: string;
52
+ one: string;
53
+ ten: string;
54
+ hundred: string;
55
+ thousand: string;
56
+ clicked: string;
57
+ used: string;
58
+ found: string;
59
+ built: string;
60
+ solved: string;
61
+ discovered: string;
62
+ unlocked: string;
63
+ upgraded: string;
64
+ repaired: string;
65
+ defended: string;
66
+ default: string;
67
+ loading: string;
68
+ error: string;
69
+ success: string;
70
+ failure: string;
71
+ trophy: string;
72
+ star: string;
73
+ flag: string;
74
+ puzzle: string;
75
+ gem: string;
76
+ crown: string;
77
+ medal: string;
78
+ ribbon: string;
79
+ badge: string;
80
+ shield: string;
81
+ };
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { AchievementData } from '../types';
2
+ import { AchievementDetails } from '../types';
3
3
  import { Styles } from '../defaultStyles';
4
4
  interface AchievementModalProps {
5
5
  isOpen: boolean;
6
- achievement: AchievementData | null;
6
+ achievement: AchievementDetails | null;
7
7
  onClose: () => void;
8
8
  styles: Styles['achievementModal'];
9
+ icons?: Record<string, string>;
9
10
  }
10
11
  declare const _default: React.NamedExoticComponent<AchievementModalProps>;
11
12
  export default _default;
@@ -1,9 +1,14 @@
1
1
  import React from 'react';
2
2
  import { Styles } from '../defaultStyles';
3
+ import { AchievementDetails } from '../types';
3
4
  interface BadgesButtonProps {
4
5
  onClick: () => void;
5
- position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
6
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
6
7
  styles: Styles['badgesButton'];
8
+ unlockedAchievements: AchievementDetails[];
9
+ icon?: React.ReactNode;
10
+ drawer?: boolean;
11
+ customStyles?: React.CSSProperties;
7
12
  }
8
13
  declare const _default: React.NamedExoticComponent<BadgesButtonProps>;
9
14
  export default _default;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { AchievementData } from '../types';
2
+ import { AchievementDetails } from '../types';
3
3
  import { Styles } from '../defaultStyles';
4
4
  interface BadgesModalProps {
5
5
  isOpen: boolean;
6
- achievements: AchievementData[];
6
+ achievements: AchievementDetails[];
7
7
  onClose: () => void;
8
8
  styles: Styles['badgesModal'];
9
+ icons?: Record<string, string>;
9
10
  }
10
11
  declare const _default: React.NamedExoticComponent<BadgesModalProps>;
11
12
  export default _default;
@@ -0,0 +1,8 @@
1
+ export declare const useAchievement: () => {
2
+ metrics: import("..").AchievementMetrics;
3
+ unlockedAchievements: string[];
4
+ notifications: import("..").AchievementDetails[];
5
+ config: import("..").AchievementConfiguration;
6
+ updateMetrics: (newMetrics: import("..").AchievementMetrics | ((prevMetrics: import("..").AchievementMetrics) => import("..").AchievementMetrics)) => void;
7
+ resetStorage: () => void;
8
+ };