magic-pill 8.0.3 → 8.1.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.
Files changed (121) hide show
  1. package/CHANGELOG.md +82 -31
  2. package/README.md +54 -36
  3. package/dist/MagicPill.d.mts +6 -0
  4. package/dist/MagicPill.d.ts +5 -6
  5. package/dist/MagicPill.js +2 -0
  6. package/dist/MagicPill.js.map +1 -0
  7. package/dist/MagicPill.mjs +2 -0
  8. package/dist/MagicPill.mjs.map +1 -0
  9. package/dist/Navbar/Navbar.js +2 -0
  10. package/dist/Navbar/Navbar.js.map +1 -0
  11. package/dist/Navbar/Navbar.mjs +2 -0
  12. package/dist/Navbar/Navbar.mjs.map +1 -0
  13. package/dist/Notification/Notification.js +2 -0
  14. package/dist/Notification/Notification.js.map +1 -0
  15. package/dist/Notification/Notification.mjs +2 -0
  16. package/dist/Notification/Notification.mjs.map +1 -0
  17. package/dist/defaultPillData.d.mts +2 -0
  18. package/dist/defaultPillData.d.ts +3 -2
  19. package/dist/defaultPillData.js +7 -0
  20. package/dist/defaultPillData.js.map +1 -0
  21. package/dist/defaultPillData.mjs +7 -0
  22. package/dist/defaultPillData.mjs.map +1 -0
  23. package/dist/icons/arrow_label.js +2 -0
  24. package/dist/icons/arrow_label.js.map +1 -0
  25. package/dist/icons/arrow_label.mjs +2 -0
  26. package/dist/icons/arrow_label.mjs.map +1 -0
  27. package/dist/icons/box_label.js +2 -0
  28. package/dist/icons/box_label.js.map +1 -0
  29. package/dist/icons/box_label.mjs +2 -0
  30. package/dist/icons/box_label.mjs.map +1 -0
  31. package/dist/icons/checkmark.js +2 -0
  32. package/dist/icons/checkmark.js.map +1 -0
  33. package/dist/icons/checkmark.mjs +2 -0
  34. package/dist/icons/checkmark.mjs.map +1 -0
  35. package/dist/icons/checkmark_label.js +2 -0
  36. package/dist/icons/checkmark_label.js.map +1 -0
  37. package/dist/icons/checkmark_label.mjs +2 -0
  38. package/dist/icons/checkmark_label.mjs.map +1 -0
  39. package/dist/icons/coupon.js +2 -0
  40. package/dist/icons/coupon.js.map +1 -0
  41. package/dist/icons/coupon.mjs +2 -0
  42. package/dist/icons/coupon.mjs.map +1 -0
  43. package/dist/icons/cross_label.js +2 -0
  44. package/dist/icons/cross_label.js.map +1 -0
  45. package/dist/icons/cross_label.mjs +2 -0
  46. package/dist/icons/cross_label.mjs.map +1 -0
  47. package/dist/icons/info.js +2 -0
  48. package/dist/icons/info.js.map +1 -0
  49. package/dist/icons/info.mjs +2 -0
  50. package/dist/icons/info.mjs.map +1 -0
  51. package/dist/icons/info_label.js +2 -0
  52. package/dist/icons/info_label.js.map +1 -0
  53. package/dist/icons/info_label.mjs +2 -0
  54. package/dist/icons/info_label.mjs.map +1 -0
  55. package/dist/icons/mail_label.js +2 -0
  56. package/dist/icons/mail_label.js.map +1 -0
  57. package/dist/icons/mail_label.mjs +2 -0
  58. package/dist/icons/mail_label.mjs.map +1 -0
  59. package/dist/icons/plus_label.js +2 -0
  60. package/dist/icons/plus_label.js.map +1 -0
  61. package/dist/icons/plus_label.mjs +2 -0
  62. package/dist/icons/plus_label.mjs.map +1 -0
  63. package/dist/icons/questionmark.js +2 -0
  64. package/dist/icons/questionmark.js.map +1 -0
  65. package/dist/icons/questionmark.mjs +2 -0
  66. package/dist/icons/questionmark.mjs.map +1 -0
  67. package/dist/icons/quotation_label.js +2 -0
  68. package/dist/icons/quotation_label.js.map +1 -0
  69. package/dist/icons/quotation_label.mjs +2 -0
  70. package/dist/icons/quotation_label.mjs.map +1 -0
  71. package/dist/icons/tel_label.js +2 -0
  72. package/dist/icons/tel_label.js.map +1 -0
  73. package/dist/icons/tel_label.mjs +2 -0
  74. package/dist/icons/tel_label.mjs.map +1 -0
  75. package/dist/icons/undo_label.js +2 -0
  76. package/dist/icons/undo_label.js.map +1 -0
  77. package/dist/icons/undo_label.mjs +2 -0
  78. package/dist/icons/undo_label.mjs.map +1 -0
  79. package/dist/index.d.mts +8 -0
  80. package/dist/index.d.ts +9 -5
  81. package/dist/index.js +1 -2
  82. package/dist/index.mjs +1 -0
  83. package/dist/magicpill.css +49 -1
  84. package/dist/types/index.d.ts +4 -3
  85. package/dist/types/magicPill.d.mts +50 -0
  86. package/dist/types/magicPill.d.ts +9 -9
  87. package/dist/types/navbar.d.mts +27 -0
  88. package/dist/types/navbar.d.ts +7 -6
  89. package/dist/types/notification.d.mts +140 -0
  90. package/dist/types/notification.d.ts +22 -21
  91. package/dist/utils/handlers.d.mts +20 -0
  92. package/dist/utils/handlers.d.ts +5 -3
  93. package/dist/utils/handlers.js +2 -0
  94. package/dist/utils/handlers.js.map +1 -0
  95. package/dist/utils/handlers.mjs +2 -0
  96. package/dist/utils/handlers.mjs.map +1 -0
  97. package/dist/utils/icons.d.mts +20 -0
  98. package/dist/utils/icons.d.ts +16 -14
  99. package/dist/utils/icons.js +2 -0
  100. package/dist/utils/icons.js.map +1 -0
  101. package/dist/utils/icons.mjs +2 -0
  102. package/dist/utils/icons.mjs.map +1 -0
  103. package/package.json +35 -24
  104. package/dist/Navbar/Navbar.d.ts +0 -9
  105. package/dist/Notification/Notification.d.ts +0 -9
  106. package/dist/icons/arrow_label.d.ts +0 -3
  107. package/dist/icons/box_label.d.ts +0 -3
  108. package/dist/icons/checkmark.d.ts +0 -3
  109. package/dist/icons/checkmark_label.d.ts +0 -3
  110. package/dist/icons/coupon.d.ts +0 -3
  111. package/dist/icons/cross_label.d.ts +0 -3
  112. package/dist/icons/info.d.ts +0 -3
  113. package/dist/icons/mail_label.d.ts +0 -3
  114. package/dist/icons/plus_label.d.ts +0 -3
  115. package/dist/icons/questionmark.d.ts +0 -3
  116. package/dist/icons/quotation_label.d.ts +0 -3
  117. package/dist/icons/tel_label.d.ts +0 -3
  118. package/dist/icons/undo_label.d.ts +0 -3
  119. package/dist/index.esm.js +0 -2
  120. package/dist/index.esm.js.map +0 -1
  121. package/dist/index.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ import { CTAIcon } from "./magicPill.mjs";
2
+ /**
3
+ * Defines the structure of a navigation item in the Magic Pill navbar.
4
+ * Each item has an icon, an optional label, and a link.
5
+ * @example
6
+ * ```ts
7
+ * {
8
+ * icon: "home",
9
+ * label: "Home",
10
+ * link: "/home"
11
+ * }
12
+ * ```
13
+ * @see {@link MagicPillNavbar} for the structure of the navbar that contains these items.
14
+ */
15
+ export interface MagicPillNavbarItem {
16
+ icon: CTAIcon;
17
+ label?: string;
18
+ link: string;
19
+ }
20
+ /**
21
+ * Defines the structure of the navbar in the Magic Pill component.
22
+ * It contains an array of navigation items.
23
+ * @see {@link MagicPillNavbarItem} for the structure of each item in the navbar.
24
+ */
25
+ export interface MagicPillNavbar {
26
+ navItems: MagicPillNavbarItem[];
27
+ }
@@ -1,4 +1,5 @@
1
- import { CTAIcon } from "./index";
1
+ import { CTAIcon } from "./magicPill.js";
2
+ import "./index.js";
2
3
  /**
3
4
  * Defines the structure of a navigation item in the Magic Pill navbar.
4
5
  * Each item has an icon, an optional label, and a link.
@@ -13,9 +14,9 @@ import { CTAIcon } from "./index";
13
14
  * @see {@link MagicPillNavbar} for the structure of the navbar that contains these items.
14
15
  */
15
16
  export interface MagicPillNavbarItem {
16
- icon: CTAIcon;
17
- label?: string;
18
- link: string;
17
+ icon: CTAIcon;
18
+ label?: string;
19
+ link: string;
19
20
  }
20
21
  /**
21
22
  * Defines the structure of the navbar in the Magic Pill component.
@@ -23,5 +24,5 @@ export interface MagicPillNavbarItem {
23
24
  * @see {@link MagicPillNavbarItem} for the structure of each item in the navbar.
24
25
  */
25
26
  export interface MagicPillNavbar {
26
- navItems: MagicPillNavbarItem[];
27
- }
27
+ navItems: MagicPillNavbarItem[];
28
+ }
@@ -0,0 +1,140 @@
1
+ import { CTAIcon, NotificationIcon } from "./magicPill.mjs";
2
+ /**
3
+ * Defines the structure of a call to action (CTA) in the Magic Pill notification.
4
+ * Each CTA has an icon, an optional label, and an optional link.
5
+ * @example
6
+ * ```ts
7
+ * {
8
+ * icon: "action",
9
+ * label: "Take Action",
10
+ * link: "/action"
11
+ * }
12
+ * ```
13
+ * @see {@link MagicPillNotification} for the structure of the notification that contains this CTA.
14
+ */
15
+ export interface MagicPillNotificationCTA {
16
+ icon: CTAIcon;
17
+ label?: string;
18
+ link?: string;
19
+ }
20
+ /**
21
+ * Defines the structure of additional information in the Magic Pill notification.
22
+ * This can include a title, content (which can contain HTML), and a close label.
23
+ * @example
24
+ * ```ts
25
+ * {
26
+ * title: "Notification Title",
27
+ * content: "This is the content of the notification.",
28
+ * closeLabel: "Close"
29
+ * }
30
+ * ```
31
+ * @see {@link MagicPillNotification} for the structure of the notification that contains this information.
32
+ * @see {@link MagicPillNotificationCTA} for the structure of the call to action in the notification.
33
+ */
34
+ export interface MagicPillNotificationInfo {
35
+ title?: string;
36
+ content: string;
37
+ closeLabel: string;
38
+ }
39
+ /**
40
+ * Defines the structure of a Magic Pill notification CTA with a link.
41
+ * @example
42
+ * ```ts
43
+ * {
44
+ * icon: "info",
45
+ * label: "Learn More",
46
+ * link: "/learn-more"
47
+ * }
48
+ * ```
49
+ * @see {@link MagicPillNotificationWithLink} for the whole notification structure that incorporates this very type..
50
+ */
51
+ interface MagicPillNotificationCTAWithLink {
52
+ icon: CTAIcon;
53
+ label?: string;
54
+ link: string;
55
+ }
56
+ /**
57
+ * Defines the structure of a Magic Pill notification CTA without a link.
58
+ * @example
59
+ * ```ts
60
+ * {
61
+ * icon: "info",
62
+ * label: "No Link Available"
63
+ * }
64
+ * ```
65
+ * @see {@link MagicPillNotificationWithoutLink} for the whole notification structure that incorporates this very type.
66
+ */
67
+ interface MagicPillNotificationCTAWithoutLink {
68
+ icon: CTAIcon;
69
+ label?: string;
70
+ link?: undefined;
71
+ }
72
+ /**
73
+ * Defines the base structure of a Magic Pill notification.
74
+ * It includes an optional icon and a mandatory message.
75
+ * @example
76
+ * ```ts
77
+ * {
78
+ * icon: "info",
79
+ * message: "This is a notification message."
80
+ * }
81
+ * ```
82
+ * @see {@link MagicPillNotificationWithLink} for notifications that include a CTA with a link.
83
+ * @see {@link MagicPillNotificationWithoutLink} for notifications that include a CTA without a link.
84
+ * @see {@link MagicPillNotificationWithoutCTA} for notifications that do not include a CTA.
85
+ */
86
+ interface MagicPillNotificationBase {
87
+ icon?: NotificationIcon;
88
+ message: string;
89
+ cta?: MagicPillNotificationCTA;
90
+ info?: MagicPillNotificationInfo;
91
+ }
92
+ /**
93
+ * Defines the structure of a Magic Pill notification with a CTA that includes a link.
94
+ * This type extends the base notification structure and includes a CTA with a mandatory link.
95
+ * @example
96
+ * ```ts
97
+ * {
98
+ * icon: "info",
99
+ * message: "This is a notification with a link.",
100
+ * cta: {
101
+ * icon: "action",
102
+ * label: "Take Action",
103
+ * link: "/action"
104
+ * }
105
+ * }
106
+ * ````
107
+ * @see {@link MagicPillNotificationBase} for the base structure of the notification.
108
+ * @see {@link MagicPillNotificationCTAWithLink} for the structure of the CTA with a link.
109
+ */
110
+ type MagicPillNotificationWithLink = MagicPillNotificationBase & {
111
+ cta: MagicPillNotificationCTAWithLink;
112
+ };
113
+ /**
114
+ * Defines the structure of a Magic Pill notification without a link in the CTA.
115
+ * This type extends the base notification structure and includes a CTA without a mandatory link.
116
+ * @example
117
+ * ```ts
118
+ * {
119
+ * icon: "info",
120
+ * message: "This is a notification without a link.",
121
+ * cta: {
122
+ * icon: "action",
123
+ * label: "No Link Available"
124
+ * },
125
+ * info: {
126
+ * title: "Notification Title",
127
+ * content: "This is the content of the notification.",
128
+ * closeLabel: "Close"
129
+ * }
130
+ * }
131
+ * ```
132
+ * @see {@link MagicPillNotificationBase} for the base structure of the notification.
133
+ * @see {@link MagicPillNotificationCTAWithoutLink} for the structure of the CTA without a link.
134
+ */
135
+ type MagicPillNotificationWithoutLink = MagicPillNotificationBase & {
136
+ cta: MagicPillNotificationCTAWithoutLink;
137
+ info: MagicPillNotificationInfo;
138
+ };
139
+ export type MagicPillNotification = MagicPillNotificationWithLink | MagicPillNotificationWithoutLink | MagicPillNotificationBase;
140
+ export {};
@@ -1,4 +1,5 @@
1
- import { NotificationIcon, CTAIcon } from "./index";
1
+ import { CTAIcon, NotificationIcon } from "./magicPill.js";
2
+ import "./index.js";
2
3
  /**
3
4
  * Defines the structure of a call to action (CTA) in the Magic Pill notification.
4
5
  * Each CTA has an icon, an optional label, and an optional link.
@@ -13,9 +14,9 @@ import { NotificationIcon, CTAIcon } from "./index";
13
14
  * @see {@link MagicPillNotification} for the structure of the notification that contains this CTA.
14
15
  */
15
16
  export interface MagicPillNotificationCTA {
16
- icon: CTAIcon;
17
- label?: string;
18
- link?: string;
17
+ icon: CTAIcon;
18
+ label?: string;
19
+ link?: string;
19
20
  }
20
21
  /**
21
22
  * Defines the structure of additional information in the Magic Pill notification.
@@ -32,9 +33,9 @@ export interface MagicPillNotificationCTA {
32
33
  * @see {@link MagicPillNotificationCTA} for the structure of the call to action in the notification.
33
34
  */
34
35
  export interface MagicPillNotificationInfo {
35
- title?: string;
36
- content: string;
37
- closeLabel: string;
36
+ title?: string;
37
+ content: string;
38
+ closeLabel: string;
38
39
  }
39
40
  /**
40
41
  * Defines the structure of a Magic Pill notification CTA with a link.
@@ -49,9 +50,9 @@ export interface MagicPillNotificationInfo {
49
50
  * @see {@link MagicPillNotificationWithLink} for the whole notification structure that incorporates this very type..
50
51
  */
51
52
  interface MagicPillNotificationCTAWithLink {
52
- icon: CTAIcon;
53
- label?: string;
54
- link: string;
53
+ icon: CTAIcon;
54
+ label?: string;
55
+ link: string;
55
56
  }
56
57
  /**
57
58
  * Defines the structure of a Magic Pill notification CTA without a link.
@@ -65,9 +66,9 @@ interface MagicPillNotificationCTAWithLink {
65
66
  * @see {@link MagicPillNotificationWithoutLink} for the whole notification structure that incorporates this very type.
66
67
  */
67
68
  interface MagicPillNotificationCTAWithoutLink {
68
- icon: CTAIcon;
69
- label?: string;
70
- link?: undefined;
69
+ icon: CTAIcon;
70
+ label?: string;
71
+ link?: undefined;
71
72
  }
72
73
  /**
73
74
  * Defines the base structure of a Magic Pill notification.
@@ -84,10 +85,10 @@ interface MagicPillNotificationCTAWithoutLink {
84
85
  * @see {@link MagicPillNotificationWithoutCTA} for notifications that do not include a CTA.
85
86
  */
86
87
  interface MagicPillNotificationBase {
87
- icon?: NotificationIcon;
88
- message: string;
89
- cta?: MagicPillNotificationCTA;
90
- info?: MagicPillNotificationInfo;
88
+ icon?: NotificationIcon;
89
+ message: string;
90
+ cta?: MagicPillNotificationCTA;
91
+ info?: MagicPillNotificationInfo;
91
92
  }
92
93
  /**
93
94
  * Defines the structure of a Magic Pill notification with a CTA that includes a link.
@@ -108,7 +109,7 @@ interface MagicPillNotificationBase {
108
109
  * @see {@link MagicPillNotificationCTAWithLink} for the structure of the CTA with a link.
109
110
  */
110
111
  type MagicPillNotificationWithLink = MagicPillNotificationBase & {
111
- cta: MagicPillNotificationCTAWithLink;
112
+ cta: MagicPillNotificationCTAWithLink;
112
113
  };
113
114
  /**
114
115
  * Defines the structure of a Magic Pill notification without a link in the CTA.
@@ -133,8 +134,8 @@ type MagicPillNotificationWithLink = MagicPillNotificationBase & {
133
134
  * @see {@link MagicPillNotificationCTAWithoutLink} for the structure of the CTA without a link.
134
135
  */
135
136
  type MagicPillNotificationWithoutLink = MagicPillNotificationBase & {
136
- cta: MagicPillNotificationCTAWithoutLink;
137
- info: MagicPillNotificationInfo;
137
+ cta: MagicPillNotificationCTAWithoutLink;
138
+ info: MagicPillNotificationInfo;
138
139
  };
139
140
  export type MagicPillNotification = MagicPillNotificationWithLink | MagicPillNotificationWithoutLink | MagicPillNotificationBase;
140
- export {};
141
+ export {};
@@ -0,0 +1,20 @@
1
+ import { CTAIcon, MagicPillType, Mode, NotificationIcon } from "../types/magicPill.mjs";
2
+ import { MagicPillNavbarItem } from "../types/navbar.mjs";
3
+ import { Dispatch, SetStateAction } from "react";
4
+ type SetPillData = Dispatch<SetStateAction<MagicPillType>>;
5
+ export declare const updateMode: (mode: Mode, setPillData: SetPillData) => void;
6
+ export declare const updateNotificationIcon: (icon: NotificationIcon, setPillData: SetPillData) => void;
7
+ export declare const updateNotificationMessage: (message: string, setPillData: SetPillData) => void;
8
+ export declare const updateCTAIcon: (icon: CTAIcon, setPillData: SetPillData) => void;
9
+ export declare const updateCTALabel: (label: string, setPillData: SetPillData) => void;
10
+ export declare const updateCTALink: (link: string, setPillData: SetPillData) => void;
11
+ export declare const updateInfoTitle: (title: string, setPillData: SetPillData) => void;
12
+ export declare const updateInfoContent: (content: string, setPillData: SetPillData) => void;
13
+ export declare const updateInfoCloseLabel: (closeLabel: string, setPillData: SetPillData) => void;
14
+ export declare const updateNavItemLabel: (label: string, index: number, setPillData: SetPillData) => void;
15
+ export declare const updateNavItemLink: (link: string, index: number, setPillData: SetPillData) => void;
16
+ export declare const updateNavItemIcon: (icon: CTAIcon, index: number, setPillData: SetPillData) => void;
17
+ export declare const handleActiveNavItem: (path: string, navItems: MagicPillNavbarItem[]) => string;
18
+ export declare const addNavItem: (navItem: MagicPillNavbarItem, setPillData: SetPillData) => void;
19
+ export declare const deleteNavItem: (index: number, setPillData: SetPillData) => void;
20
+ export {};
@@ -1,5 +1,7 @@
1
- import { CTAIcon, MagicPillNavbarItem, MagicPillType, Mode, NotificationIcon } from '../types';
2
- import { SetStateAction, Dispatch } from 'react';
1
+ import { MagicPillNavbarItem } from "../types/navbar.js";
2
+ import { CTAIcon, MagicPillType, Mode, NotificationIcon } from "../types/magicPill.js";
3
+ import "../types/index.js";
4
+ import { Dispatch, SetStateAction } from "react";
3
5
  type SetPillData = Dispatch<SetStateAction<MagicPillType>>;
4
6
  export declare const updateMode: (mode: Mode, setPillData: SetPillData) => void;
5
7
  export declare const updateNotificationIcon: (icon: NotificationIcon, setPillData: SetPillData) => void;
@@ -16,4 +18,4 @@ export declare const updateNavItemIcon: (icon: CTAIcon, index: number, setPillDa
16
18
  export declare const handleActiveNavItem: (path: string, navItems: MagicPillNavbarItem[]) => string;
17
19
  export declare const addNavItem: (navItem: MagicPillNavbarItem, setPillData: SetPillData) => void;
18
20
  export declare const deleteNavItem: (index: number, setPillData: SetPillData) => void;
19
- export {};
21
+ export {};
@@ -0,0 +1,2 @@
1
+ const e=require("../defaultPillData.js"),t=(e,t)=>{t(()=>e===`navbar`?{mode:`navbar`,navbar:{navItems:[]}}:{mode:`notification`,notification:{icon:``,message:``}})},n=(e,t)=>{t(t=>t.mode===`notification`?{...t,notification:{...t.notification,icon:e}}:t)},r=(e,t)=>{t(t=>t.mode===`notification`?{...t,notification:{...t.notification,message:e}}:t)},i=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:t||e.defaultPillData.notification?.cta?.icon||`arrow`}}}:n)},a=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.defaultPillData.notification?.cta?.icon||`arrow`,label:t}}}:n)},o=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.defaultPillData.notification?.cta?.icon||`arrow`,link:t},info:void 0}}:n)},s=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.defaultPillData.notification?.cta?.icon||`arrow`,link:void 0},info:{...n.notification?.info,title:t,content:n.notification?.info?.content||``,closeLabel:n.notification?.info?.closeLabel||``}}}:n)},c=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.defaultPillData.notification?.cta?.icon||`arrow`,link:void 0},info:{...n.notification?.info,title:n.notification?.info?.title||``,content:t,closeLabel:n.notification?.info?.closeLabel||``}}}:n)},l=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.defaultPillData.notification?.cta?.icon||`arrow`,link:void 0},info:{...n.notification?.info,title:n.notification?.info?.title||``,content:n.notification?.info?.content||``,closeLabel:t}}}:n)},u=(e,t,n)=>{n(n=>{if(n.mode!==`navbar`)return n;let r=[...n.navbar.navItems];return r[t]={...r[t],label:e},{...n,navbar:{...n.navbar,navItems:r}}})},d=(e,t,n)=>{n(n=>{if(n.mode!==`navbar`)return n;let r=[...n.navbar.navItems];return r[t]={...r[t],link:e},{...n,navbar:{...n.navbar,navItems:r}}})},f=(e,t,n)=>{n(n=>{if(n.mode!==`navbar`)return n;let r=[...n.navbar.navItems];return r[t]={...r[t],icon:e},{...n,navbar:{...n.navbar,navItems:r}}})},p=(e,t)=>t&&[...t].sort((e,t)=>(t.link?.length||0)-(e.link?.length||0)).find(t=>t.link&&e.includes(t.link))?.label||``,m=(e,t)=>{t(t=>t.mode===`navbar`?{...t,navbar:{...t.navbar,navItems:[...t.navbar.navItems,e]}}:t)},h=(e,t)=>{t(t=>{if(t.mode!==`navbar`)return t;let n=[...t.navbar.navItems];return n.splice(e,1),{...t,navbar:{...t.navbar,navItems:n}}})};exports.addNavItem=m,exports.deleteNavItem=h,exports.handleActiveNavItem=p,exports.updateCTAIcon=i,exports.updateCTALabel=a,exports.updateCTALink=o,exports.updateInfoCloseLabel=l,exports.updateInfoContent=c,exports.updateInfoTitle=s,exports.updateMode=t,exports.updateNavItemIcon=f,exports.updateNavItemLabel=u,exports.updateNavItemLink=d,exports.updateNotificationIcon=n,exports.updateNotificationMessage=r;
2
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","names":["defaultPillData","require_defaultPillData","updateMode","mode","setPillData","updateNotificationIcon","icon","prevData","updateNotificationMessage","message","updateCTAIcon","updateCTALabel","label","updateCTALink","link","updateInfoTitle","title","updateInfoContent","content","updateInfoCloseLabel","closeLabel","updateNavItemLabel","index","newNavItems","updateNavItemLink","updateNavItemIcon","handleActiveNavItem","path","navItems","a","b","item","addNavItem","navItem","deleteNavItem"],"sources":["../../src/utils/handlers.ts"],"sourcesContent":["import { defaultPillData } from '../defaultPillData';\nimport { CTAIcon, MagicPillNavbarItem, MagicPillType, Mode, NotificationIcon } from '../types';\nimport { SetStateAction, Dispatch } from 'react';\n\ntype SetPillData = Dispatch<SetStateAction<MagicPillType>>;\n\nexport const updateMode = (mode: Mode, setPillData: SetPillData) => {\n setPillData((): MagicPillType => {\n if (mode === \"navbar\") {\n return {\n mode: \"navbar\",\n navbar: { navItems: [] }\n };\n }\n return {\n mode: \"notification\",\n notification: {\n icon: \"\",\n message: \"\",\n }\n };\n });\n};\n\nexport const updateNotificationIcon = (icon: NotificationIcon, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n icon,\n },\n };\n });\n};\n\nexport const updateNotificationMessage = (message: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n message,\n },\n };\n });\n};\n\nexport const updateCTAIcon = (icon: CTAIcon, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n },\n },\n };\n });\n};\n\nexport const updateCTALabel = (label: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n label,\n },\n },\n };\n });\n};\n\nexport const updateCTALink = (link: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link,\n },\n info: undefined,\n },\n };\n });\n};\n\nexport const updateInfoTitle = (title: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link: undefined,\n },\n info: {\n ...prevData.notification?.info,\n title,\n content: prevData.notification?.info?.content || \"\",\n closeLabel: prevData.notification?.info?.closeLabel || \"\"\n },\n },\n };\n });\n};\n\nexport const updateInfoContent = (content: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link: undefined,\n },\n info: {\n ...prevData.notification?.info,\n title: prevData.notification?.info?.title || \"\",\n content,\n closeLabel: prevData.notification?.info?.closeLabel || \"\"\n },\n },\n };\n });\n};\n\nexport const updateInfoCloseLabel = (closeLabel: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link: undefined,\n },\n info: {\n ...prevData.notification?.info,\n title: prevData.notification?.info?.title || \"\",\n content: prevData.notification?.info?.content || \"\",\n closeLabel\n },\n },\n };\n });\n};\n\nexport const updateNavItemLabel = (label: string, index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems[index] = { ...newNavItems[index], label };\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n};\n\nexport const updateNavItemLink = (link: string, index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems[index] = { ...newNavItems[index], link };\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n};\n\nexport const updateNavItemIcon = (icon: CTAIcon, index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems[index] = { ...newNavItems[index], icon };\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n};\n\nexport const handleActiveNavItem = (path: string, navItems: MagicPillNavbarItem[]): string => {\n if (!navItems) return \"\";\n \n const sortedItems = [...navItems].sort((a, b) => \n (b.link?.length || 0) - (a.link?.length || 0)\n );\n\n const matchingItem = sortedItems.find(item => \n item.link && path.includes(item.link)\n );\n\n return matchingItem?.label || \"\";\n};\nexport const addNavItem = (navItem: MagicPillNavbarItem, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n return {\n ...prevData,\n navbar: {\n ...prevData.navbar,\n navItems: [...prevData.navbar.navItems, navItem],\n },\n };\n });\n};\n\nexport const deleteNavItem = (index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems.splice(index, 1);\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n}; "],"mappings":"A,yCAMaE,GAAcC,EAAYC,IAA6B,CAClEA,MACMD,IAAS,SACJ,CACL,KAAM,SACN,OAAQ,CAAE,SAAU,CAAC,CAAE,CACzB,EAEK,CACL,KAAM,eACN,aAAc,CACZ,KAAM,GACN,QAAS,EACX,CACF,CACD,CACH,EAEa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,GAAIA,EAAS,OAAS,SAAU,OAAOA,EACvC,IAAMgB,EAAc,CAAC,GAAGhB,EAAS,OAAO,QAAQ,EAEhD,OADAgB,EAAY,OAAOD,EAAO,CAAC,EACpB,CACL,GAAGf,EACH,OAAQ,CAAE,GAAGA,EAAS,OAAQ,SAAUgB,CAAY,CACtD,CACF,CAAC,CACH,E"}
@@ -0,0 +1,2 @@
1
+ import{defaultPillData as e}from"../defaultPillData.mjs";const t=(e,t)=>{t(()=>e===`navbar`?{mode:`navbar`,navbar:{navItems:[]}}:{mode:`notification`,notification:{icon:``,message:``}})},n=(e,t)=>{t(t=>t.mode===`notification`?{...t,notification:{...t.notification,icon:e}}:t)},r=(e,t)=>{t(t=>t.mode===`notification`?{...t,notification:{...t.notification,message:e}}:t)},i=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:t||e.notification?.cta?.icon||`arrow`}}}:n)},a=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.notification?.cta?.icon||`arrow`,label:t}}}:n)},o=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.notification?.cta?.icon||`arrow`,link:t},info:void 0}}:n)},s=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.notification?.cta?.icon||`arrow`,link:void 0},info:{...n.notification?.info,title:t,content:n.notification?.info?.content||``,closeLabel:n.notification?.info?.closeLabel||``}}}:n)},c=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.notification?.cta?.icon||`arrow`,link:void 0},info:{...n.notification?.info,title:n.notification?.info?.title||``,content:t,closeLabel:n.notification?.info?.closeLabel||``}}}:n)},l=(t,n)=>{n(n=>n.mode===`notification`?{...n,notification:{...n.notification,cta:{...n.notification?.cta,icon:n.notification?.cta?.icon||e.notification?.cta?.icon||`arrow`,link:void 0},info:{...n.notification?.info,title:n.notification?.info?.title||``,content:n.notification?.info?.content||``,closeLabel:t}}}:n)},u=(e,t,n)=>{n(n=>{if(n.mode!==`navbar`)return n;let r=[...n.navbar.navItems];return r[t]={...r[t],label:e},{...n,navbar:{...n.navbar,navItems:r}}})},d=(e,t,n)=>{n(n=>{if(n.mode!==`navbar`)return n;let r=[...n.navbar.navItems];return r[t]={...r[t],link:e},{...n,navbar:{...n.navbar,navItems:r}}})},f=(e,t,n)=>{n(n=>{if(n.mode!==`navbar`)return n;let r=[...n.navbar.navItems];return r[t]={...r[t],icon:e},{...n,navbar:{...n.navbar,navItems:r}}})},p=(e,t)=>t&&[...t].sort((e,t)=>(t.link?.length||0)-(e.link?.length||0)).find(t=>t.link&&e.includes(t.link))?.label||``,m=(e,t)=>{t(t=>t.mode===`navbar`?{...t,navbar:{...t.navbar,navItems:[...t.navbar.navItems,e]}}:t)},h=(e,t)=>{t(t=>{if(t.mode!==`navbar`)return t;let n=[...t.navbar.navItems];return n.splice(e,1),{...t,navbar:{...t.navbar,navItems:n}}})};export{m as addNavItem,h as deleteNavItem,p as handleActiveNavItem,i as updateCTAIcon,a as updateCTALabel,o as updateCTALink,l as updateInfoCloseLabel,c as updateInfoContent,s as updateInfoTitle,t as updateMode,f as updateNavItemIcon,u as updateNavItemLabel,d as updateNavItemLink,n as updateNotificationIcon,r as updateNotificationMessage};
2
+ //# sourceMappingURL=handlers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.mjs","names":["defaultPillData","updateMode","mode","setPillData","updateNotificationIcon","icon","prevData","updateNotificationMessage","message","updateCTAIcon","updateCTALabel","label","updateCTALink","link","updateInfoTitle","title","updateInfoContent","content","updateInfoCloseLabel","closeLabel","updateNavItemLabel","index","newNavItems","updateNavItemLink","updateNavItemIcon","handleActiveNavItem","path","navItems","a","b","item","addNavItem","navItem","deleteNavItem"],"sources":["../../src/utils/handlers.ts"],"sourcesContent":["import { defaultPillData } from '../defaultPillData';\nimport { CTAIcon, MagicPillNavbarItem, MagicPillType, Mode, NotificationIcon } from '../types';\nimport { SetStateAction, Dispatch } from 'react';\n\ntype SetPillData = Dispatch<SetStateAction<MagicPillType>>;\n\nexport const updateMode = (mode: Mode, setPillData: SetPillData) => {\n setPillData((): MagicPillType => {\n if (mode === \"navbar\") {\n return {\n mode: \"navbar\",\n navbar: { navItems: [] }\n };\n }\n return {\n mode: \"notification\",\n notification: {\n icon: \"\",\n message: \"\",\n }\n };\n });\n};\n\nexport const updateNotificationIcon = (icon: NotificationIcon, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n icon,\n },\n };\n });\n};\n\nexport const updateNotificationMessage = (message: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n message,\n },\n };\n });\n};\n\nexport const updateCTAIcon = (icon: CTAIcon, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n },\n },\n };\n });\n};\n\nexport const updateCTALabel = (label: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n label,\n },\n },\n };\n });\n};\n\nexport const updateCTALink = (link: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link,\n },\n info: undefined,\n },\n };\n });\n};\n\nexport const updateInfoTitle = (title: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link: undefined,\n },\n info: {\n ...prevData.notification?.info,\n title,\n content: prevData.notification?.info?.content || \"\",\n closeLabel: prevData.notification?.info?.closeLabel || \"\"\n },\n },\n };\n });\n};\n\nexport const updateInfoContent = (content: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link: undefined,\n },\n info: {\n ...prevData.notification?.info,\n title: prevData.notification?.info?.title || \"\",\n content,\n closeLabel: prevData.notification?.info?.closeLabel || \"\"\n },\n },\n };\n });\n};\n\nexport const updateInfoCloseLabel = (closeLabel: string, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"notification\") return prevData;\n return {\n ...prevData,\n notification: {\n ...prevData.notification,\n cta: {\n ...prevData.notification?.cta,\n icon: prevData.notification?.cta?.icon || defaultPillData.notification?.cta?.icon || \"arrow\",\n link: undefined,\n },\n info: {\n ...prevData.notification?.info,\n title: prevData.notification?.info?.title || \"\",\n content: prevData.notification?.info?.content || \"\",\n closeLabel\n },\n },\n };\n });\n};\n\nexport const updateNavItemLabel = (label: string, index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems[index] = { ...newNavItems[index], label };\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n};\n\nexport const updateNavItemLink = (link: string, index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems[index] = { ...newNavItems[index], link };\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n};\n\nexport const updateNavItemIcon = (icon: CTAIcon, index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems[index] = { ...newNavItems[index], icon };\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n};\n\nexport const handleActiveNavItem = (path: string, navItems: MagicPillNavbarItem[]): string => {\n if (!navItems) return \"\";\n \n const sortedItems = [...navItems].sort((a, b) => \n (b.link?.length || 0) - (a.link?.length || 0)\n );\n\n const matchingItem = sortedItems.find(item => \n item.link && path.includes(item.link)\n );\n\n return matchingItem?.label || \"\";\n};\nexport const addNavItem = (navItem: MagicPillNavbarItem, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n return {\n ...prevData,\n navbar: {\n ...prevData.navbar,\n navItems: [...prevData.navbar.navItems, navItem],\n },\n };\n });\n};\n\nexport const deleteNavItem = (index: number, setPillData: SetPillData) => {\n setPillData((prevData: MagicPillType) => {\n if (prevData.mode !== \"navbar\") return prevData;\n const newNavItems = [...prevData.navbar.navItems];\n newNavItems.splice(index, 1);\n return {\n ...prevData,\n navbar: { ...prevData.navbar, navItems: newNavItems },\n };\n });\n}; "],"mappings":"A,yDAMA,MAAaC,GAAcC,EAAYC,IAA6B,CAClEA,MACMD,IAAS,SACJ,CACL,KAAM,SACN,OAAQ,CAAE,SAAU,CAAC,CA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IAA6B,CACxEA,EAAaG,GAA4B,CACvC,GAAIA,EAAS,OAAS,SAAU,OAAOA,EACvC,IAAMgB,EAAc,CAAC,GAAGhB,EAAS,OAAO,QAAQ,EAEhD,OADAgB,EAAY,OAAOD,EAAO,CAAC,EACpB,CACL,GAAGf,EACH,OAAQ,CAAE,GAAGA,EAAS,OAAQ,SAAUgB,CAAY,CACtD,CACF,CAAC,CACH,E"}
@@ -0,0 +1,20 @@
1
+ import { ComponentType, SVGProps } from "react";
2
+ export declare const Icons: {
3
+ checkmark: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
4
+ coupon: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
5
+ info: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
6
+ questionmark: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
7
+ };
8
+ export declare const CTAIcons: {
9
+ arrow: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
10
+ box: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
11
+ checkmark: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
12
+ cross: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
13
+ info: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
14
+ mail: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
15
+ plus: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
16
+ quotation: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
17
+ tel: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
18
+ undo: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
19
+ };
20
+ export declare function getIconComponent(iconName: string, iconsMap: Record<string, ComponentType<SVGProps<SVGSVGElement>>>): ComponentType<SVGProps<SVGSVGElement>> | null;
@@ -1,18 +1,20 @@
1
+ import { ComponentType, SVGProps } from "react";
1
2
  export declare const Icons: {
2
- checkmark: () => import("react").JSX.Element;
3
- coupon: () => import("react").JSX.Element;
4
- info: () => import("react").JSX.Element;
5
- questionmark: () => import("react").JSX.Element;
3
+ checkmark: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
4
+ coupon: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
5
+ info: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
6
+ questionmark: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
6
7
  };
7
8
  export declare const CTAIcons: {
8
- arrow: () => import("react").JSX.Element;
9
- box: () => import("react").JSX.Element;
10
- checkmark: () => import("react").JSX.Element;
11
- cross: () => import("react").JSX.Element;
12
- mail: () => import("react").JSX.Element;
13
- plus: () => import("react").JSX.Element;
14
- quotation: () => import("react").JSX.Element;
15
- tel: () => import("react").JSX.Element;
16
- undo: () => import("react").JSX.Element;
9
+ arrow: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
10
+ box: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
11
+ checkmark: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
12
+ cross: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
13
+ info: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
14
+ mail: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
15
+ plus: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
16
+ quotation: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
17
+ tel: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
18
+ undo: (props?: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
17
19
  };
18
- export declare function getIconComponent(iconName: string, iconsMap: Record<string, React.ComponentType<React.SVGProps<SVGSVGElement>>>): import("react").ComponentType<import("react").SVGProps<SVGSVGElement>> | null;
20
+ export declare function getIconComponent(iconName: string, iconsMap: Record<string, ComponentType<SVGProps<SVGSVGElement>>>): ComponentType<SVGProps<SVGSVGElement>> | null;
@@ -0,0 +1,2 @@
1
+ const e=require("../icons/arrow_label.js"),t=require("../icons/box_label.js"),n=require("../icons/checkmark_label.js"),r=require("../icons/cross_label.js"),i=require("../icons/info_label.js"),a=require("../icons/mail_label.js"),o=require("../icons/plus_label.js"),s=require("../icons/quotation_label.js"),c=require("../icons/tel_label.js"),l=require("../icons/undo_label.js"),u={checkmark:require("../icons/checkmark.js"),coupon:require("../icons/coupon.js"),info:require("../icons/info.js"),questionmark:require("../icons/questionmark.js")},d={arrow:e,box:t,checkmark:n,cross:r,info:i,mail:a,plus:o,quotation:s,tel:c,undo:l};exports.CTAIcons=d,exports.Icons=u,exports.getIconComponent=function(e,t){return t[e]||null};
2
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","names":["CheckmarkIcon","CouponIcon","InfoIcon","QuestionmarkIcon","ArrowLabel","BoxLabel","CheckmarkLabel","CrossLabel","InfoLabel","MailLabel","PlusLabel","QuotationLabel","TelLabel","UndoLabel","require_arrow_label","require_box_label","require_checkmark_label","require_cross_label","require_info_label","require_mail_label","require_plus_label","require_quotation_label","require_tel_label","require_undo_label","Icons","CTAIcons","iconName","iconsMap"],"sources":["../../src/utils/icons.ts"],"sourcesContent":["import type { ComponentType, SVGProps } from \"react\";\n\nimport ArrowLabel from \"../icons/arrow_label\";\nimport BoxLabel from \"../icons/box_label\";\nimport CheckmarkLabel from \"../icons/checkmark_label\";\nimport CrossLabel from \"../icons/cross_label\";\nimport InfoLabel from \"../icons/info_label\";\nimport MailLabel from \"../icons/mail_label\";\nimport PlusLabel from \"../icons/plus_label\";\nimport QuotationLabel from \"../icons/quotation_label\";\nimport TelLabel from \"../icons/tel_label\";\nimport UndoLabel from \"../icons/undo_label\";\n\nimport CheckmarkIcon from \"../icons/checkmark\";\nimport CouponIcon from \"../icons/coupon\";\nimport InfoIcon from \"../icons/info\";\nimport QuestionmarkIcon from \"../icons/questionmark\";\n\nexport const Icons = {\n checkmark: CheckmarkIcon,\n coupon: CouponIcon,\n info: InfoIcon,\n questionmark: QuestionmarkIcon,\n};\n\nexport const CTAIcons = {\n arrow: ArrowLabel,\n box: BoxLabel,\n checkmark: CheckmarkLabel,\n cross: CrossLabel,\n info: InfoLabel,\n mail: MailLabel,\n plus: PlusLabel,\n quotation: QuotationLabel,\n tel: TelLabel,\n undo: UndoLabel,\n};\n\nexport function getIconComponent(\n iconName: string,\n iconsMap: Record<string, ComponentType<SVGProps<SVGSVGElement>>>,\n): ComponentType<SVGProps<SVGSVGElement>> | null {\n return iconsMap[iconName] || null;\n}"],"mappings":"A,wXAkBawB,EAAQ,CACnB,U,+BAAWxB,EACX,O,4BAAQC,EACR,K,0BAAMC,EACN,a,kCAAcC,CAChB,EAEasB,EAAW,CACtB,MAAOrB,EACP,IAAKC,EACL,UAAWC,EACX,MAAOC,EACP,KAAMC,EACN,KAAMC,EACN,KAAMC,EACN,UAAWC,EACX,IAAKC,EACL,KAAMC,CACR,E,4DAEA,SACEa,EACAC,EAC+C,CAC/C,OAAOA,EAASD,IAAa,IAC/B"}
@@ -0,0 +1,2 @@
1
+ import e from"../icons/arrow_label.mjs";import t from"../icons/box_label.mjs";import n from"../icons/checkmark_label.mjs";import r from"../icons/cross_label.mjs";import i from"../icons/info_label.mjs";import a from"../icons/mail_label.mjs";import o from"../icons/plus_label.mjs";import s from"../icons/quotation_label.mjs";import c from"../icons/tel_label.mjs";import l from"../icons/undo_label.mjs";import u from"../icons/checkmark.mjs";import d from"../icons/coupon.mjs";import f from"../icons/info.mjs";import p from"../icons/questionmark.mjs";const m={checkmark:u,coupon:d,info:f,questionmark:p},h={arrow:e,box:t,checkmark:n,cross:r,info:i,mail:a,plus:o,quotation:s,tel:c,undo:l};function g(e,t){return t[e]||null}export{h as CTAIcons,m as Icons,g as getIconComponent};
2
+ //# sourceMappingURL=icons.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.mjs","names":["ArrowLabel","BoxLabel","CheckmarkLabel","CrossLabel","InfoLabel","MailLabel","PlusLabel","QuotationLabel","TelLabel","UndoLabel","CheckmarkIcon","CouponIcon","InfoIcon","QuestionmarkIcon","Icons","CTAIcons","getIconComponent","iconName","iconsMap"],"sources":["../../src/utils/icons.ts"],"sourcesContent":["import type { ComponentType, SVGProps } from \"react\";\n\nimport ArrowLabel from \"../icons/arrow_label\";\nimport BoxLabel from \"../icons/box_label\";\nimport CheckmarkLabel from \"../icons/checkmark_label\";\nimport CrossLabel from \"../icons/cross_label\";\nimport InfoLabel from \"../icons/info_label\";\nimport MailLabel from \"../icons/mail_label\";\nimport PlusLabel from \"../icons/plus_label\";\nimport QuotationLabel from \"../icons/quotation_label\";\nimport TelLabel from \"../icons/tel_label\";\nimport UndoLabel from \"../icons/undo_label\";\n\nimport CheckmarkIcon from \"../icons/checkmark\";\nimport CouponIcon from \"../icons/coupon\";\nimport InfoIcon from \"../icons/info\";\nimport QuestionmarkIcon from \"../icons/questionmark\";\n\nexport const Icons = {\n checkmark: CheckmarkIcon,\n coupon: CouponIcon,\n info: InfoIcon,\n questionmark: QuestionmarkIcon,\n};\n\nexport const CTAIcons = {\n arrow: ArrowLabel,\n box: BoxLabel,\n checkmark: CheckmarkLabel,\n cross: CrossLabel,\n info: InfoLabel,\n mail: MailLabel,\n plus: PlusLabel,\n quotation: QuotationLabel,\n tel: TelLabel,\n undo: UndoLabel,\n};\n\nexport function getIconComponent(\n iconName: string,\n iconsMap: Record<string, ComponentType<SVGProps<SVGSVGElement>>>,\n): ComponentType<SVGProps<SVGSVGElement>> | null {\n return iconsMap[iconName] || null;\n}"],"mappings":"A,miBAkBA,MAAac,EAAQ,CACnB,UAAWJ,EACX,OAAQC,EACR,KAAMC,EACN,aAAcC,CAChB,EAEaE,EAAW,CACtB,MAAOf,EACP,IAAKC,EACL,UAAWC,EACX,MAAOC,EACP,KAAMC,EACN,KAAMC,EACN,KAAMC,EACN,UAAWC,EACX,IAAKC,EACL,KAAMC,CACR,EAEA,SAAgBO,EACdC,EACAC,EAC+C,CAC/C,OAAOA,EAASD,IAAa,IAC/B,C"}
package/package.json CHANGED
@@ -1,24 +1,42 @@
1
1
  {
2
2
  "name": "magic-pill",
3
- "version": "8.0.3",
3
+ "version": "8.1.0",
4
+ "type": "commonjs",
4
5
  "main": "dist/index.js",
5
- "module": "dist/index.esm.js",
6
+ "module": "dist/index.mjs",
6
7
  "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "./magicpill.css": "./dist/magicpill.css",
20
+ "./dist/magicpill.css": "./dist/magicpill.css",
21
+ "./package.json": "./package.json"
22
+ },
23
+ "sideEffects": [
24
+ "*.css"
25
+ ],
7
26
  "description": "A new way to guide your audience and bring them contextual information through your app",
8
27
  "repository": {
9
28
  "type": "git",
10
29
  "url": "git+https://github.com/CedricTheveneau/Magic-Pill.git"
11
30
  },
12
31
  "scripts": {
13
- "build": "rollup -c && cp src/magicpill.css dist/magicpill.css",
32
+ "build": "tsdown",
14
33
  "prepare": "npm run build",
15
- "typecheck": "tsc --noEmit"
34
+ "typecheck": "tsc --noEmit",
35
+ "test": "vitest run"
16
36
  },
17
37
  "peerDependencies": {
18
- "next": ">=14.0.0",
19
38
  "react": ">=18.0.0",
20
- "react-dom": ">=18.0.0",
21
- "typescript": ">=5.0.0"
39
+ "react-dom": ">=18.0.0"
22
40
  },
23
41
  "keywords": [
24
42
  "notifications",
@@ -40,24 +58,17 @@
40
58
  "bugs": {
41
59
  "url": "https://github.com/CedricTheveneau/Magic-Pill/issues"
42
60
  },
43
- "cdn": {
44
- "url": "https://cdn.jsdelivr.net/npm/magic-pill@latest/dist/index.js",
45
- "style": "https://cdn.jsdelivr.net/npm/magic-pill@latest/dist/magicpill.css"
46
- },
47
61
  "devDependencies": {
48
- "@babel/core": "^7.26.0",
49
- "@babel/preset-env": "^7.26.0",
50
- "@babel/preset-react": "^7.25.9",
51
- "@babel/preset-typescript": "^7.26.0",
52
- "@rollup/plugin-babel": "^6.0.4",
53
- "@rollup/plugin-typescript": "^11.1.6",
54
- "@types/react": "^18.2.64",
55
- "@types/react-dom": "^18.2.21",
56
- "rollup": "^2.79.2",
57
- "rollup-plugin-postcss": "^4.0.2",
58
- "rollup-plugin-terser": "^7.0.2",
59
- "tslib": "^2.6.2",
60
- "typescript": "^5.4.2"
62
+ "@testing-library/dom": "^10.4.2",
63
+ "@testing-library/react": "^16.3.3",
64
+ "@types/react": "^19.3.0",
65
+ "@types/react-dom": "^19.3.0",
66
+ "jsdom": "^31.0.0",
67
+ "react": "^19.3.1",
68
+ "react-dom": "^19.3.1",
69
+ "tsdown": "0.23.7",
70
+ "typescript": "^6.0.3",
71
+ "vitest": "^5.1.0"
61
72
  },
62
73
  "files": [
63
74
  "dist",
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import "../magicpill.css";
3
- import { MagicPillNavbar } from "../types";
4
- interface NavItemsProps {
5
- mode: "navbar";
6
- navbar: MagicPillNavbar;
7
- }
8
- declare const Navbar: ({ navbar }: NavItemsProps) => React.JSX.Element;
9
- export default Navbar;
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import "../magicpill.css";
3
- import { MagicPillNotification } from "../types";
4
- interface NotificationProps {
5
- mode: "notification";
6
- notification: MagicPillNotification;
7
- }
8
- declare const Notification: ({ notification }: NotificationProps) => React.JSX.Element;
9
- export default Notification;
@@ -1,3 +0,0 @@
1
- export default ArrowLabel;
2
- declare function ArrowLabel(): React.JSX.Element;
3
- import React from 'react';
@@ -1,3 +0,0 @@
1
- export default BoxLabel;
2
- declare function BoxLabel(): React.JSX.Element;
3
- import React from 'react';
@@ -1,3 +0,0 @@
1
- export default CheckmarkIcon;
2
- declare function CheckmarkIcon(): React.JSX.Element;
3
- import React from 'react';
@@ -1,3 +0,0 @@
1
- export default CheckmarkLabel;
2
- declare function CheckmarkLabel(): React.JSX.Element;
3
- import React from 'react';
@@ -1,3 +0,0 @@
1
- export default CouponIcon;
2
- declare function CouponIcon(): React.JSX.Element;
3
- import React from 'react';
@@ -1,3 +0,0 @@
1
- export default CrossLabel;
2
- declare function CrossLabel(): React.JSX.Element;
3
- import React from 'react';