@ionic/react 7.5.3-dev.11698858201.14165f23 → 7.5.3-dev.11699994454.1cbf1283

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 (247) hide show
  1. package/dist/index.js +2443 -8
  2. package/dist/index.js.map +1 -7
  3. package/dist/types/components/CreateAnimation.d.ts +71 -0
  4. package/dist/types/components/IonActionSheet.d.ts +3 -0
  5. package/dist/types/components/IonAlert.d.ts +3 -0
  6. package/dist/types/components/IonApp.d.ts +41 -0
  7. package/dist/types/components/IonIcon.d.ts +16 -0
  8. package/dist/types/components/IonLoading.d.ts +3 -0
  9. package/dist/types/components/IonModal.d.ts +3 -0
  10. package/dist/types/components/IonOverlayManager.d.ts +15 -0
  11. package/dist/types/components/IonPage.d.ts +3 -0
  12. package/dist/types/components/IonPicker.d.ts +3 -0
  13. package/dist/types/components/IonPopover.d.ts +3 -0
  14. package/dist/types/components/IonRedirect.d.ts +16 -0
  15. package/dist/types/components/IonRoute.d.ts +17 -0
  16. package/dist/types/components/IonRouterContext.d.ts +42 -0
  17. package/dist/types/components/IonRouterOutlet.d.ts +8 -0
  18. package/dist/types/components/IonToast.d.ts +3 -0
  19. package/dist/types/components/IonicReactProps.d.ts +6 -0
  20. package/dist/types/components/__tests__/utils.spec.d.ts +1 -0
  21. package/dist/types/components/createControllerComponent.d.ts +19 -0
  22. package/dist/types/components/createInlineOverlayComponent.d.ts +2 -0
  23. package/dist/types/components/createOverlayComponent.d.ts +20 -0
  24. package/dist/types/components/createRoutingComponent.d.ts +2 -0
  25. package/dist/types/components/hrefprops.d.ts +9 -0
  26. package/dist/types/components/index.d.ts +35 -0
  27. package/dist/types/components/inner-proxies.d.ts +14 -0
  28. package/dist/types/components/navigation/IonBackButton.d.ts +68 -0
  29. package/dist/types/components/navigation/IonNav.d.ts +5 -0
  30. package/dist/types/components/navigation/IonTabBar.d.ts +15 -0
  31. package/dist/types/components/navigation/IonTabButton.d.ts +40 -0
  32. package/dist/types/components/navigation/IonTabs.d.ts +49 -0
  33. package/dist/types/components/navigation/IonTabsContext.d.ts +6 -0
  34. package/dist/types/components/proxies.d.ts +66 -0
  35. package/dist/types/components/react-component-lib/createComponent.d.ts +10 -0
  36. package/dist/types/components/react-component-lib/createOverlayComponent.d.ts +21 -0
  37. package/dist/types/components/react-component-lib/index.d.ts +2 -0
  38. package/dist/types/components/react-component-lib/interfaces.d.ts +29 -0
  39. package/dist/types/components/react-component-lib/utils/attachProps.d.ts +16 -0
  40. package/dist/types/components/react-component-lib/utils/case.d.ts +2 -0
  41. package/dist/types/components/react-component-lib/utils/dev.d.ts +2 -0
  42. package/dist/types/components/react-component-lib/utils/index.d.ts +10 -0
  43. package/dist/types/components/routing-proxies.d.ts +44 -0
  44. package/dist/types/components/utils/detachProps.d.ts +8 -0
  45. package/dist/types/components/utils/index.d.ts +8 -0
  46. package/dist/types/components/utils/ionRenderToString.d.ts +2 -0
  47. package/dist/types/contexts/IonContext.d.ts +7 -0
  48. package/dist/types/contexts/IonLifeCycleContext.d.ts +72 -0
  49. package/dist/types/contexts/NavContext.d.ts +17 -0
  50. package/dist/types/framework-delegate.d.ts +2 -0
  51. package/dist/types/hooks/HookOverlayOptions.d.ts +7 -0
  52. package/dist/types/hooks/__tests__/hooks.spec.d.ts +0 -0
  53. package/dist/types/hooks/useController.d.ts +12 -0
  54. package/dist/types/hooks/useIonActionSheet.d.ts +26 -0
  55. package/dist/types/hooks/useIonAlert.d.ts +26 -0
  56. package/dist/types/hooks/useIonLoading.d.ts +27 -0
  57. package/dist/types/hooks/useIonModal.d.ts +17 -0
  58. package/dist/types/hooks/useIonPicker.d.ts +26 -0
  59. package/dist/types/hooks/useIonPopover.d.ts +17 -0
  60. package/dist/types/hooks/useIonToast.d.ts +26 -0
  61. package/dist/types/hooks/useOverlay.d.ts +13 -0
  62. package/dist/types/index.d.ts +7 -0
  63. package/dist/types/lifecycle/IonLifeCycleHOC.d.ts +31 -0
  64. package/dist/types/lifecycle/hooks.d.ts +5 -0
  65. package/dist/types/lifecycle/index.d.ts +2 -0
  66. package/dist/types/models/ReactComponentOrElement.d.ts +2 -0
  67. package/dist/types/models/RouteAction.d.ts +1 -0
  68. package/dist/types/models/RouteInfo.d.ts +19 -0
  69. package/dist/types/models/RouterDirection.d.ts +1 -0
  70. package/dist/types/models/RouterOptions.d.ts +10 -0
  71. package/dist/types/models/index.d.ts +5 -0
  72. package/dist/types/routing/LocationHistory.d.ts +20 -0
  73. package/dist/types/routing/NavManager.d.ts +38 -0
  74. package/dist/types/routing/OutletPageManager.d.ts +26 -0
  75. package/dist/types/routing/PageManager.d.ts +25 -0
  76. package/dist/types/routing/RouteManagerContext.d.ts +16 -0
  77. package/dist/types/routing/StackContext.d.ts +7 -0
  78. package/dist/types/routing/ViewItem.d.ts +12 -0
  79. package/dist/types/routing/ViewLifeCycleManager.d.ts +42 -0
  80. package/dist/types/routing/ViewStacks.d.ts +19 -0
  81. package/dist/types/routing/__tests__/LocationHistory.spec.d.ts +1 -0
  82. package/dist/types/routing/index.d.ts +7 -0
  83. package/dist/types/utils/HTMLElementSSR.d.ts +4 -0
  84. package/dist/types/utils/generateId.d.ts +1 -0
  85. package/package.json +12 -5
  86. package/dist/components/CreateAnimation.js +0 -107
  87. package/dist/components/CreateAnimation.js.map +0 -7
  88. package/dist/components/IonActionSheet.js +0 -8
  89. package/dist/components/IonActionSheet.js.map +0 -7
  90. package/dist/components/IonAlert.js +0 -8
  91. package/dist/components/IonAlert.js.map +0 -7
  92. package/dist/components/IonApp.js +0 -42
  93. package/dist/components/IonApp.js.map +0 -7
  94. package/dist/components/IonIcon.js +0 -39
  95. package/dist/components/IonIcon.js.map +0 -7
  96. package/dist/components/IonLoading.js +0 -8
  97. package/dist/components/IonLoading.js.map +0 -7
  98. package/dist/components/IonModal.js +0 -9
  99. package/dist/components/IonModal.js.map +0 -7
  100. package/dist/components/IonOverlayManager.js +0 -29
  101. package/dist/components/IonOverlayManager.js.map +0 -7
  102. package/dist/components/IonPage.js +0 -31
  103. package/dist/components/IonPage.js.map +0 -7
  104. package/dist/components/IonPicker.js +0 -8
  105. package/dist/components/IonPicker.js.map +0 -7
  106. package/dist/components/IonPopover.js +0 -8
  107. package/dist/components/IonPopover.js.map +0 -7
  108. package/dist/components/IonRedirect.js +0 -19
  109. package/dist/components/IonRedirect.js.map +0 -7
  110. package/dist/components/IonRoute.js +0 -17
  111. package/dist/components/IonRoute.js.map +0 -7
  112. package/dist/components/IonRouterContext.js +0 -32
  113. package/dist/components/IonRouterContext.js.map +0 -7
  114. package/dist/components/IonRouterOutlet.js +0 -24
  115. package/dist/components/IonRouterOutlet.js.map +0 -7
  116. package/dist/components/IonToast.js +0 -8
  117. package/dist/components/IonToast.js.map +0 -7
  118. package/dist/components/IonicReactProps.js +0 -2
  119. package/dist/components/IonicReactProps.js.map +0 -7
  120. package/dist/components/__tests__/utils.spec.js +0 -50
  121. package/dist/components/__tests__/utils.spec.js.map +0 -7
  122. package/dist/components/createControllerComponent.js +0 -80
  123. package/dist/components/createControllerComponent.js.map +0 -7
  124. package/dist/components/createInlineOverlayComponent.js +0 -114
  125. package/dist/components/createInlineOverlayComponent.js.map +0 -7
  126. package/dist/components/createOverlayComponent.js +0 -88
  127. package/dist/components/createOverlayComponent.js.map +0 -7
  128. package/dist/components/createRoutingComponent.js +0 -79
  129. package/dist/components/createRoutingComponent.js.map +0 -7
  130. package/dist/components/hrefprops.js +0 -2
  131. package/dist/components/hrefprops.js.map +0 -7
  132. package/dist/components/index.js +0 -126
  133. package/dist/components/index.js.map +0 -7
  134. package/dist/components/inner-proxies.js +0 -30
  135. package/dist/components/inner-proxies.js.map +0 -7
  136. package/dist/components/navigation/IonBackButton.js +0 -31
  137. package/dist/components/navigation/IonBackButton.js.map +0 -7
  138. package/dist/components/navigation/IonNav.js +0 -21
  139. package/dist/components/navigation/IonNav.js.map +0 -7
  140. package/dist/components/navigation/IonTabBar.js +0 -173
  141. package/dist/components/navigation/IonTabBar.js.map +0 -7
  142. package/dist/components/navigation/IonTabButton.js +0 -30
  143. package/dist/components/navigation/IonTabButton.js.map +0 -7
  144. package/dist/components/navigation/IonTabs.js +0 -103
  145. package/dist/components/navigation/IonTabs.js.map +0 -7
  146. package/dist/components/navigation/IonTabsContext.js +0 -7
  147. package/dist/components/navigation/IonTabsContext.js.map +0 -7
  148. package/dist/components/proxies.js +0 -131
  149. package/dist/components/proxies.js.map +0 -7
  150. package/dist/components/react-component-lib/createComponent.js +0 -58
  151. package/dist/components/react-component-lib/createComponent.js.map +0 -7
  152. package/dist/components/react-component-lib/createOverlayComponent.js +0 -86
  153. package/dist/components/react-component-lib/createOverlayComponent.js.map +0 -7
  154. package/dist/components/react-component-lib/index.js +0 -4
  155. package/dist/components/react-component-lib/index.js.map +0 -7
  156. package/dist/components/react-component-lib/interfaces.js +0 -2
  157. package/dist/components/react-component-lib/interfaces.js.map +0 -7
  158. package/dist/components/react-component-lib/utils/attachProps.js +0 -92
  159. package/dist/components/react-component-lib/utils/attachProps.js.map +0 -7
  160. package/dist/components/react-component-lib/utils/case.js +0 -4
  161. package/dist/components/react-component-lib/utils/case.js.map +0 -7
  162. package/dist/components/react-component-lib/utils/dev.js +0 -14
  163. package/dist/components/react-component-lib/utils/dev.js.map +0 -7
  164. package/dist/components/react-component-lib/utils/index.js +0 -31
  165. package/dist/components/react-component-lib/utils/index.js.map +0 -7
  166. package/dist/components/routing-proxies.js +0 -29
  167. package/dist/components/routing-proxies.js.map +0 -7
  168. package/dist/components/utils/detachProps.js +0 -24
  169. package/dist/components/utils/detachProps.js.map +0 -7
  170. package/dist/components/utils/index.js +0 -26
  171. package/dist/components/utils/index.js.map +0 -7
  172. package/dist/components/utils/ionRenderToString.js +0 -36
  173. package/dist/components/utils/ionRenderToString.js.map +0 -7
  174. package/dist/contexts/IonContext.js +0 -11
  175. package/dist/contexts/IonContext.js.map +0 -7
  176. package/dist/contexts/IonLifeCycleContext.js +0 -185
  177. package/dist/contexts/IonLifeCycleContext.js.map +0 -7
  178. package/dist/contexts/NavContext.js +0 -36
  179. package/dist/contexts/NavContext.js.map +0 -7
  180. package/dist/framework-delegate.js +0 -30
  181. package/dist/framework-delegate.js.map +0 -7
  182. package/dist/hooks/HookOverlayOptions.js +0 -2
  183. package/dist/hooks/HookOverlayOptions.js.map +0 -7
  184. package/dist/hooks/__tests__/hooks.spec.js +0 -6
  185. package/dist/hooks/__tests__/hooks.spec.js.map +0 -7
  186. package/dist/hooks/useController.js +0 -45
  187. package/dist/hooks/useController.js.map +0 -7
  188. package/dist/hooks/useIonActionSheet.js +0 -27
  189. package/dist/hooks/useIonActionSheet.js.map +0 -7
  190. package/dist/hooks/useIonAlert.js +0 -23
  191. package/dist/hooks/useIonAlert.js.map +0 -7
  192. package/dist/hooks/useIonLoading.js +0 -28
  193. package/dist/hooks/useIonLoading.js.map +0 -7
  194. package/dist/hooks/useIonModal.js +0 -22
  195. package/dist/hooks/useIonModal.js.map +0 -7
  196. package/dist/hooks/useIonPicker.js +0 -27
  197. package/dist/hooks/useIonPicker.js.map +0 -7
  198. package/dist/hooks/useIonPopover.js +0 -22
  199. package/dist/hooks/useIonPopover.js.map +0 -7
  200. package/dist/hooks/useIonToast.js +0 -23
  201. package/dist/hooks/useIonToast.js.map +0 -7
  202. package/dist/hooks/useOverlay.js +0 -67
  203. package/dist/hooks/useOverlay.js.map +0 -7
  204. package/dist/lifecycle/IonLifeCycleHOC.js +0 -41
  205. package/dist/lifecycle/IonLifeCycleHOC.js.map +0 -7
  206. package/dist/lifecycle/hooks.js +0 -52
  207. package/dist/lifecycle/hooks.js.map +0 -7
  208. package/dist/lifecycle/index.js +0 -4
  209. package/dist/lifecycle/index.js.map +0 -7
  210. package/dist/models/ReactComponentOrElement.js +0 -2
  211. package/dist/models/ReactComponentOrElement.js.map +0 -7
  212. package/dist/models/RouteAction.js +0 -2
  213. package/dist/models/RouteAction.js.map +0 -7
  214. package/dist/models/RouteInfo.js +0 -2
  215. package/dist/models/RouteInfo.js.map +0 -7
  216. package/dist/models/RouterDirection.js +0 -2
  217. package/dist/models/RouterDirection.js.map +0 -7
  218. package/dist/models/RouterOptions.js +0 -2
  219. package/dist/models/RouterOptions.js.map +0 -7
  220. package/dist/models/index.js +0 -7
  221. package/dist/models/index.js.map +0 -7
  222. package/dist/routing/LocationHistory.js +0 -140
  223. package/dist/routing/LocationHistory.js.map +0 -7
  224. package/dist/routing/NavManager.js +0 -76
  225. package/dist/routing/NavManager.js.map +0 -7
  226. package/dist/routing/OutletPageManager.js +0 -69
  227. package/dist/routing/OutletPageManager.js.map +0 -7
  228. package/dist/routing/PageManager.js +0 -60
  229. package/dist/routing/PageManager.js.map +0 -7
  230. package/dist/routing/RouteManagerContext.js +0 -15
  231. package/dist/routing/RouteManagerContext.js.map +0 -7
  232. package/dist/routing/StackContext.js +0 -7
  233. package/dist/routing/StackContext.js.map +0 -7
  234. package/dist/routing/ViewItem.js +0 -2
  235. package/dist/routing/ViewItem.js.map +0 -7
  236. package/dist/routing/ViewLifeCycleManager.js +0 -36
  237. package/dist/routing/ViewLifeCycleManager.js.map +0 -7
  238. package/dist/routing/ViewStacks.js +0 -49
  239. package/dist/routing/ViewStacks.js.map +0 -7
  240. package/dist/routing/__tests__/LocationHistory.spec.js +0 -185
  241. package/dist/routing/__tests__/LocationHistory.spec.js.map +0 -7
  242. package/dist/routing/index.js +0 -9
  243. package/dist/routing/index.js.map +0 -7
  244. package/dist/utils/HTMLElementSSR.js +0 -4
  245. package/dist/utils/HTMLElementSSR.js.map +0 -7
  246. package/dist/utils/generateId.js +0 -8
  247. package/dist/utils/generateId.js.map +0 -7
@@ -1,185 +0,0 @@
1
- "use strict";
2
- import React from "react";
3
- export const IonLifeCycleContext = /* @__PURE__ */ React.createContext({
4
- onIonViewWillEnter: () => {
5
- return;
6
- },
7
- ionViewWillEnter: () => {
8
- return;
9
- },
10
- onIonViewDidEnter: () => {
11
- return;
12
- },
13
- ionViewDidEnter: () => {
14
- return;
15
- },
16
- onIonViewWillLeave: () => {
17
- return;
18
- },
19
- ionViewWillLeave: () => {
20
- return;
21
- },
22
- onIonViewDidLeave: () => {
23
- return;
24
- },
25
- ionViewDidLeave: () => {
26
- return;
27
- },
28
- cleanupIonViewWillEnter: () => {
29
- return;
30
- },
31
- cleanupIonViewDidEnter: () => {
32
- return;
33
- },
34
- cleanupIonViewWillLeave: () => {
35
- return;
36
- },
37
- cleanupIonViewDidLeave: () => {
38
- return;
39
- }
40
- });
41
- export const DefaultIonLifeCycleContext = class {
42
- constructor() {
43
- this.ionViewWillEnterCallbacks = [];
44
- this.ionViewDidEnterCallbacks = [];
45
- this.ionViewWillLeaveCallbacks = [];
46
- this.ionViewDidLeaveCallbacks = [];
47
- this.ionViewWillEnterDestructorCallbacks = [];
48
- this.ionViewDidEnterDestructorCallbacks = [];
49
- this.ionViewWillLeaveDestructorCallbacks = [];
50
- this.ionViewDidLeaveDestructorCallbacks = [];
51
- }
52
- onIonViewWillEnter(callback) {
53
- if (callback.id) {
54
- const index = this.ionViewWillEnterCallbacks.findIndex((x) => x.id === callback.id);
55
- if (index > -1) {
56
- this.ionViewWillEnterCallbacks[index] = callback;
57
- } else {
58
- this.ionViewWillEnterCallbacks.push(callback);
59
- }
60
- } else {
61
- this.ionViewWillEnterCallbacks.push(callback);
62
- }
63
- }
64
- teardownCallback(callback, callbacks) {
65
- const matches = callbacks.filter((x) => x.id === callback.id);
66
- if (matches.length !== 0) {
67
- matches.forEach((match) => {
68
- if (match && typeof match.destructor === "function") {
69
- match.destructor();
70
- }
71
- });
72
- callbacks = callbacks.filter((x) => x.id !== callback.id);
73
- }
74
- }
75
- /**
76
- * Tears down the user-provided ionViewWillEnter lifecycle callback.
77
- * This is the same behavior as React's useEffect hook. The callback
78
- * is invoked when the component is unmounted.
79
- */
80
- cleanupIonViewWillEnter(callback) {
81
- this.teardownCallback(callback, this.ionViewWillEnterDestructorCallbacks);
82
- }
83
- /**
84
- * Tears down the user-provided ionViewDidEnter lifecycle callback.
85
- * This is the same behavior as React's useEffect hook. The callback
86
- * is invoked when the component is unmounted.
87
- */
88
- cleanupIonViewDidEnter(callback) {
89
- this.teardownCallback(callback, this.ionViewDidEnterDestructorCallbacks);
90
- }
91
- /**
92
- * Tears down the user-provided ionViewWillLeave lifecycle callback.
93
- * This is the same behavior as React's useEffect hook. The callback
94
- * is invoked when the component is unmounted.
95
- */
96
- cleanupIonViewWillLeave(callback) {
97
- this.teardownCallback(callback, this.ionViewWillLeaveDestructorCallbacks);
98
- }
99
- /**
100
- * Tears down the user-provided ionViewDidLeave lifecycle callback.
101
- * This is the same behavior as React's useEffect hook. The callback
102
- * is invoked when the component is unmounted.
103
- */
104
- cleanupIonViewDidLeave(callback) {
105
- this.teardownCallback(callback, this.ionViewDidLeaveDestructorCallbacks);
106
- }
107
- ionViewWillEnter() {
108
- this.ionViewWillEnterCallbacks.forEach((cb) => {
109
- const destructor = cb();
110
- if (cb.id) {
111
- this.ionViewWillEnterDestructorCallbacks.push({ id: cb.id, destructor });
112
- }
113
- });
114
- }
115
- onIonViewDidEnter(callback) {
116
- if (callback.id) {
117
- const index = this.ionViewDidEnterCallbacks.findIndex((x) => x.id === callback.id);
118
- if (index > -1) {
119
- this.ionViewDidEnterCallbacks[index] = callback;
120
- } else {
121
- this.ionViewDidEnterCallbacks.push(callback);
122
- }
123
- } else {
124
- this.ionViewDidEnterCallbacks.push(callback);
125
- }
126
- }
127
- ionViewDidEnter() {
128
- this.ionViewDidEnterCallbacks.forEach((cb) => {
129
- const destructor = cb();
130
- if (cb.id) {
131
- this.ionViewDidEnterDestructorCallbacks.push({ id: cb.id, destructor });
132
- }
133
- });
134
- }
135
- onIonViewWillLeave(callback) {
136
- if (callback.id) {
137
- const index = this.ionViewWillLeaveCallbacks.findIndex((x) => x.id === callback.id);
138
- if (index > -1) {
139
- this.ionViewWillLeaveCallbacks[index] = callback;
140
- } else {
141
- this.ionViewWillLeaveCallbacks.push(callback);
142
- }
143
- } else {
144
- this.ionViewWillLeaveCallbacks.push(callback);
145
- }
146
- }
147
- ionViewWillLeave() {
148
- this.ionViewWillLeaveCallbacks.forEach((cb) => {
149
- const destructor = cb();
150
- if (cb.id) {
151
- this.ionViewWillLeaveDestructorCallbacks.push({ id: cb.id, destructor });
152
- }
153
- });
154
- }
155
- onIonViewDidLeave(callback) {
156
- if (callback.id) {
157
- const index = this.ionViewDidLeaveCallbacks.findIndex((x) => x.id === callback.id);
158
- if (index > -1) {
159
- this.ionViewDidLeaveCallbacks[index] = callback;
160
- } else {
161
- this.ionViewDidLeaveCallbacks.push(callback);
162
- }
163
- } else {
164
- this.ionViewDidLeaveCallbacks.push(callback);
165
- }
166
- }
167
- ionViewDidLeave() {
168
- this.ionViewDidLeaveCallbacks.forEach((cb) => {
169
- const destructor = cb();
170
- if (cb.id) {
171
- this.ionViewDidLeaveDestructorCallbacks.push({ id: cb.id, destructor });
172
- }
173
- });
174
- this.componentCanBeDestroyed();
175
- }
176
- onComponentCanBeDestroyed(callback) {
177
- this.componentCanBeDestroyedCallback = callback;
178
- }
179
- componentCanBeDestroyed() {
180
- if (this.componentCanBeDestroyedCallback) {
181
- this.componentCanBeDestroyedCallback();
182
- }
183
- }
184
- };
185
- //# sourceMappingURL=IonLifeCycleContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/contexts/IonLifeCycleContext.tsx"],
4
- "sourcesContent": ["import React from 'react';\n\nexport interface IonLifeCycleContextInterface {\n onIonViewWillEnter: (callback: () => void) => void;\n ionViewWillEnter: () => void;\n onIonViewDidEnter: (callback: () => void) => void;\n ionViewDidEnter: () => void;\n onIonViewWillLeave: (callback: () => void) => void;\n ionViewWillLeave: () => void;\n onIonViewDidLeave: (callback: () => void) => void;\n ionViewDidLeave: () => void;\n cleanupIonViewWillEnter: (callback: () => void) => void;\n cleanupIonViewDidEnter: (callback: () => void) => void;\n cleanupIonViewWillLeave: (callback: () => void) => void;\n cleanupIonViewDidLeave: (callback: () => void) => void;\n}\n\nexport const IonLifeCycleContext = /*@__PURE__*/ React.createContext<IonLifeCycleContextInterface>({\n onIonViewWillEnter: () => {\n return;\n },\n ionViewWillEnter: () => {\n return;\n },\n onIonViewDidEnter: () => {\n return;\n },\n ionViewDidEnter: () => {\n return;\n },\n onIonViewWillLeave: () => {\n return;\n },\n ionViewWillLeave: () => {\n return;\n },\n onIonViewDidLeave: () => {\n return;\n },\n ionViewDidLeave: () => {\n return;\n },\n cleanupIonViewWillEnter: () => {\n return;\n },\n cleanupIonViewDidEnter: () => {\n return;\n },\n cleanupIonViewWillLeave: () => {\n return;\n },\n cleanupIonViewDidLeave: () => {\n return;\n },\n});\n\nexport interface LifeCycleCallback {\n (): void | (() => void | undefined);\n id?: number;\n}\n\nexport interface LifeCycleDestructor {\n id: number;\n destructor: ReturnType<LifeCycleCallback>;\n}\n\nexport const DefaultIonLifeCycleContext = class implements IonLifeCycleContextInterface {\n ionViewWillEnterCallbacks: LifeCycleCallback[] = [];\n ionViewDidEnterCallbacks: LifeCycleCallback[] = [];\n ionViewWillLeaveCallbacks: LifeCycleCallback[] = [];\n ionViewDidLeaveCallbacks: LifeCycleCallback[] = [];\n componentCanBeDestroyedCallback?: () => void;\n ionViewWillEnterDestructorCallbacks: LifeCycleDestructor[] = [];\n ionViewDidEnterDestructorCallbacks: LifeCycleDestructor[] = [];\n ionViewWillLeaveDestructorCallbacks: LifeCycleDestructor[] = [];\n ionViewDidLeaveDestructorCallbacks: LifeCycleDestructor[] = [];\n\n onIonViewWillEnter(callback: LifeCycleCallback) {\n if (callback.id) {\n const index = this.ionViewWillEnterCallbacks.findIndex((x) => x.id === callback.id);\n if (index > -1) {\n this.ionViewWillEnterCallbacks[index] = callback;\n } else {\n this.ionViewWillEnterCallbacks.push(callback);\n }\n } else {\n this.ionViewWillEnterCallbacks.push(callback);\n }\n }\n\n teardownCallback(callback: LifeCycleCallback, callbacks: any[]) {\n // Find any destructors that have been registered for the callback\n const matches = callbacks.filter((x) => x.id === callback.id);\n if (matches.length !== 0) {\n // Execute the destructor for each matching item\n matches.forEach((match) => {\n if (match && typeof match.destructor === 'function') {\n match.destructor();\n }\n });\n // Remove all matching items from the array\n callbacks = callbacks.filter((x) => x.id !== callback.id);\n }\n }\n\n /**\n * Tears down the user-provided ionViewWillEnter lifecycle callback.\n * This is the same behavior as React's useEffect hook. The callback\n * is invoked when the component is unmounted.\n */\n cleanupIonViewWillEnter(callback: LifeCycleCallback) {\n this.teardownCallback(callback, this.ionViewWillEnterDestructorCallbacks);\n }\n\n /**\n * Tears down the user-provided ionViewDidEnter lifecycle callback.\n * This is the same behavior as React's useEffect hook. The callback\n * is invoked when the component is unmounted.\n */\n cleanupIonViewDidEnter(callback: LifeCycleCallback) {\n this.teardownCallback(callback, this.ionViewDidEnterDestructorCallbacks);\n }\n\n /**\n * Tears down the user-provided ionViewWillLeave lifecycle callback.\n * This is the same behavior as React's useEffect hook. The callback\n * is invoked when the component is unmounted.\n */\n cleanupIonViewWillLeave(callback: LifeCycleCallback) {\n this.teardownCallback(callback, this.ionViewWillLeaveDestructorCallbacks);\n }\n\n /**\n * Tears down the user-provided ionViewDidLeave lifecycle callback.\n * This is the same behavior as React's useEffect hook. The callback\n * is invoked when the component is unmounted.\n */\n cleanupIonViewDidLeave(callback: LifeCycleCallback) {\n this.teardownCallback(callback, this.ionViewDidLeaveDestructorCallbacks);\n }\n\n ionViewWillEnter() {\n this.ionViewWillEnterCallbacks.forEach((cb) => {\n const destructor = cb();\n if (cb.id) {\n this.ionViewWillEnterDestructorCallbacks.push({ id: cb.id, destructor });\n }\n });\n }\n\n onIonViewDidEnter(callback: LifeCycleCallback) {\n if (callback.id) {\n const index = this.ionViewDidEnterCallbacks.findIndex((x) => x.id === callback.id);\n if (index > -1) {\n this.ionViewDidEnterCallbacks[index] = callback;\n } else {\n this.ionViewDidEnterCallbacks.push(callback);\n }\n } else {\n this.ionViewDidEnterCallbacks.push(callback);\n }\n }\n\n ionViewDidEnter() {\n this.ionViewDidEnterCallbacks.forEach((cb) => {\n const destructor = cb();\n if (cb.id) {\n this.ionViewDidEnterDestructorCallbacks.push({ id: cb.id, destructor });\n }\n });\n }\n\n onIonViewWillLeave(callback: LifeCycleCallback) {\n if (callback.id) {\n const index = this.ionViewWillLeaveCallbacks.findIndex((x) => x.id === callback.id);\n if (index > -1) {\n this.ionViewWillLeaveCallbacks[index] = callback;\n } else {\n this.ionViewWillLeaveCallbacks.push(callback);\n }\n } else {\n this.ionViewWillLeaveCallbacks.push(callback);\n }\n }\n\n ionViewWillLeave() {\n this.ionViewWillLeaveCallbacks.forEach((cb) => {\n const destructor = cb();\n if (cb.id) {\n this.ionViewWillLeaveDestructorCallbacks.push({ id: cb.id, destructor });\n }\n });\n }\n\n onIonViewDidLeave(callback: LifeCycleCallback) {\n if (callback.id) {\n const index = this.ionViewDidLeaveCallbacks.findIndex((x) => x.id === callback.id);\n if (index > -1) {\n this.ionViewDidLeaveCallbacks[index] = callback;\n } else {\n this.ionViewDidLeaveCallbacks.push(callback);\n }\n } else {\n this.ionViewDidLeaveCallbacks.push(callback);\n }\n }\n\n ionViewDidLeave() {\n this.ionViewDidLeaveCallbacks.forEach((cb) => {\n const destructor = cb();\n if (cb.id) {\n this.ionViewDidLeaveDestructorCallbacks.push({ id: cb.id, destructor });\n }\n });\n this.componentCanBeDestroyed();\n }\n\n onComponentCanBeDestroyed(callback: () => void) {\n this.componentCanBeDestroyedCallback = callback;\n }\n\n componentCanBeDestroyed() {\n if (this.componentCanBeDestroyedCallback) {\n this.componentCanBeDestroyedCallback();\n }\n }\n};\n"],
5
- "mappings": ";AAAA,OAAO,WAAW;AAiBX,aAAM,sBAAoC,sBAAM,cAA4C;AAAA,EACjG,oBAAoB,MAAM;AACxB;AAAA,EACF;AAAA,EACA,kBAAkB,MAAM;AACtB;AAAA,EACF;AAAA,EACA,mBAAmB,MAAM;AACvB;AAAA,EACF;AAAA,EACA,iBAAiB,MAAM;AACrB;AAAA,EACF;AAAA,EACA,oBAAoB,MAAM;AACxB;AAAA,EACF;AAA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URE__ */ React.createContext({
4
- getIonRedirect: () => void 0,
5
- getIonRoute: () => void 0,
6
- getPageManager: () => void 0,
7
- getStackManager: () => void 0,
8
- goBack: (route) => {
9
- if (typeof window !== "undefined") {
10
- if (typeof route === "string") {
11
- window.location.pathname = route;
12
- } else {
13
- window.history.back();
14
- }
15
- }
16
- },
17
- navigate: (path) => {
18
- if (typeof window !== "undefined") {
19
- window.location.pathname = path;
20
- }
21
- },
22
- hasIonicRouter: () => false,
23
- routeInfo: void 0,
24
- setCurrentTab: () => void 0,
25
- changeTab: (_tab, path) => {
26
- if (typeof window !== "undefined") {
27
- window.location.pathname = path;
28
- }
29
- },
30
- resetTab: (_tab, path) => {
31
- if (typeof window !== "undefined") {
32
- window.location.pathname = path;
33
- }
34
- }
35
- });
36
- //# sourceMappingURL=NavContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/contexts/NavContext.ts"],
4
- "sourcesContent": ["import type { AnimationBuilder, RouterDirection } from '@ionic/core/components';\nimport React from 'react';\n\nimport type { RouteInfo } from '../models';\n\n// TODO(FW-2959): types\n\nexport interface NavContextState {\n getIonRoute: () => any;\n getIonRedirect: () => any;\n getPageManager: () => any;\n getStackManager: () => any;\n goBack: (route?: string | RouteInfo, animationBuilder?: AnimationBuilder) => void;\n navigate: (\n path: string,\n direction?: RouterDirection | 'none',\n ionRouteAction?: 'push' | 'replace' | 'pop',\n animationBuilder?: AnimationBuilder,\n options?: any,\n tab?: string\n ) => void;\n hasIonicRouter: () => boolean;\n routeInfo?: RouteInfo;\n setCurrentTab: (tab: string, routeInfo: RouteInfo) => void;\n changeTab: (tab: string, path: string, routeOptions?: any) => void;\n resetTab: (tab: string, originalHref: string, originalRouteOptions?: any) => void;\n}\n\nexport const NavContext = /*@__PURE__*/ React.createContext<NavContextState>({\n getIonRedirect: () => undefined,\n getIonRoute: () => undefined,\n getPageManager: () => undefined,\n getStackManager: () => undefined,\n goBack: (route?: string | RouteInfo) => {\n if (typeof window !== 'undefined') {\n if (typeof route === 'string') {\n window.location.pathname = route;\n } else {\n window.history.back();\n }\n }\n },\n navigate: (path: string) => {\n if (typeof window !== 'undefined') {\n window.location.pathname = path;\n }\n },\n hasIonicRouter: () => false,\n routeInfo: undefined,\n setCurrentTab: () => undefined,\n changeTab: (_tab: string, path: string) => {\n if (typeof window !== 'undefined') {\n window.location.pathname = path;\n }\n },\n resetTab: (_tab: string, path: string) => {\n if (typeof window !== 'undefined') {\n window.location.pathname = path;\n }\n },\n});\n"],
5
- "mappings": ";AACA,OAAO,WAAW;AA2BX,aAAM,aAA2B,sBAAM,cAA+B;AAAA,EAC3E,gBAAgB,MAAM;AAAA,EACtB,aAAa,MAAM;AAAA,EACnB,gBAAgB,MAAM;AAAA,EACtB,iBAAiB,MAAM;AAAA,EACvB,QAAQ,CAAC,UAA+B;AACtC,QAAI,OAAO,WAAW,aAAa;AACjC,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO,SAAS,WAAW;AAAA,MAC7B,OAAO;AACL,eAAO,QAAQ,KAAK;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAAA,EACA,UAAU,CAAC,SAAiB;AAC1B,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO,SAAS,WAAW;AAAA,IAC7B;AAAA,EACF;AAAA,EACA,gBAAgB,MAAM;AAAA,EACtB,WAAW;AAAA,EACX,eAAe,MAAM;AAAA,EACrB,WAAW,CAAC,MAAc,SAAiB;AACzC,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO,SAAS,WAAW;AAAA,IAC7B;AAAA,EACF;AAAA,EACA,UAAU,CAAC,MAAc,SAAiB;AACxC,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO,SAAS,WAAW;AAAA,IAC7B;AAAA,EACF;AACF,CAAC;",
6
- "names": []
7
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- import { createPortal } from "react-dom";
3
- import { generateId } from "./utils/generateId";
4
- export const ReactDelegate = (addView, removeView) => {
5
- const refMap = /* @__PURE__ */ new WeakMap();
6
- const reactDelegateId = `react-delegate-${generateId()}`;
7
- let id = 0;
8
- const attachViewToDom = async (parentElement, component, propsOrDataObj, cssClasses) => {
9
- const div = document.createElement("div");
10
- cssClasses && div.classList.add(...cssClasses);
11
- parentElement.appendChild(div);
12
- const componentWithProps = component(propsOrDataObj);
13
- const key = `${reactDelegateId}-${id++}`;
14
- const hostComponent = createPortal(componentWithProps, div, key);
15
- refMap.set(div, hostComponent);
16
- addView(hostComponent);
17
- return Promise.resolve(div);
18
- };
19
- const removeViewFromDom = (_container, component) => {
20
- const hostComponent = refMap.get(component);
21
- hostComponent && removeView(hostComponent);
22
- component.remove();
23
- return Promise.resolve();
24
- };
25
- return {
26
- attachViewToDom,
27
- removeViewFromDom
28
- };
29
- };
30
- //# sourceMappingURL=framework-delegate.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/framework-delegate.tsx"],
4
- "sourcesContent": ["import type { FrameworkDelegate } from '@ionic/core/components';\nimport { createPortal } from 'react-dom';\n\nimport { generateId } from './utils/generateId';\n\n// TODO(FW-2959): types\n\ntype ReactComponent = (props?: any) => JSX.Element;\n\nexport const ReactDelegate = (\n addView: (view: React.ReactElement) => void,\n removeView: (view: React.ReactElement) => void\n): FrameworkDelegate => {\n const refMap = new WeakMap<HTMLElement, React.ReactElement>();\n const reactDelegateId = `react-delegate-${generateId()}`;\n // Incrementing counter to generate unique keys for each view\n let id = 0;\n\n const attachViewToDom = async (\n parentElement: HTMLElement,\n component: ReactComponent,\n propsOrDataObj?: any,\n cssClasses?: string[]\n ): Promise<any> => {\n const div = document.createElement('div');\n cssClasses && div.classList.add(...cssClasses);\n parentElement.appendChild(div);\n\n const componentWithProps = component(propsOrDataObj);\n const key = `${reactDelegateId}-${id++}`;\n const hostComponent = createPortal(componentWithProps, div, key);\n\n refMap.set(div, hostComponent);\n\n addView(hostComponent);\n\n return Promise.resolve(div);\n };\n\n const removeViewFromDom = (_container: any, component: HTMLElement): Promise<void> => {\n const hostComponent = refMap.get(component);\n hostComponent && removeView(hostComponent);\n\n component.remove();\n\n return Promise.resolve();\n };\n\n return {\n attachViewToDom,\n removeViewFromDom,\n };\n};\n"],
5
- "mappings": ";AACA,SAAS,oBAAoB;AAE7B,SAAS,kBAAkB;AAMpB,aAAM,gBAAgB,CAC3B,SACA,eACsB;AACtB,QAAM,SAAS,oBAAI,QAAyC;AAC5D,QAAM,kBAAkB,kBAAkB,WAAW,CAAC;AAEtD,MAAI,KAAK;AAET,QAAM,kBAAkB,OACtB,eACA,WACA,gBACA,eACiB;AACjB,UAAM,MAAM,SAAS,cAAc,KAAK;AACxC,kBAAc,IAAI,UAAU,IAAI,GAAG,UAAU;AAC7C,kBAAc,YAAY,GAAG;AAE7B,UAAM,qBAAqB,UAAU,cAAc;AACnD,UAAM,MAAM,GAAG,eAAe,IAAI,IAAI;AACtC,UAAM,gBAAgB,aAAa,oBAAoB,KAAK,GAAG;AAE/D,WAAO,IAAI,KAAK,aAAa;AAE7B,YAAQ,aAAa;AAErB,WAAO,QAAQ,QAAQ,GAAG;AAAA,EAC5B;AAEA,QAAM,oBAAoB,CAAC,YAAiB,cAA0C;AACpF,UAAM,gBAAgB,OAAO,IAAI,SAAS;AAC1C,qBAAiB,WAAW,aAAa;AAEzC,cAAU,OAAO;AAEjB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=HookOverlayOptions.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- describe("test", () => {
3
- it("should pass", () => {
4
- });
5
- });
6
- //# sourceMappingURL=hooks.spec.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/__tests__/hooks.spec.tsx"],
4
- "sourcesContent": ["// TODO: Jest does not support ES Modules,\n// and Ionic custom elements are ES Modules only.\n\ndescribe('test', () => {\n it('should pass', () => {\n // This is to get CI to pass!\n // We need to figure out an ESM solution for tests\n });\n});\n\n/*import { alertController, modalController } from '@ionic/core';\n\nimport React from 'react';\n\nimport { useController } from '../useController';\nimport { useOverlay } from '../useOverlay';\n\nimport { useIonActionSheet } from '../useIonActionSheet';\nimport type { UseIonActionSheetResult } from '../useIonActionSheet';\nimport { useIonAlert } from '../useIonAlert';\nimport type { UseIonAlertResult } from '../useIonAlert';\nimport { useIonLoading } from '../useIonLoading';\nimport type { UseIonLoadingResult } from '../useIonLoading';\nimport { useIonModal } from '../useIonModal';\nimport type { UseIonModalResult } from '../useIonModal';\nimport { useIonPicker } from '../useIonPicker';\nimport type { UseIonPickerResult } from '../useIonPicker';\nimport { useIonPopover } from '../useIonPopover';\nimport type { UseIonPopoverResult } from '../useIonPopover';\nimport { useIonToast } from '../useIonToast';\nimport type { UseIonToastResult } from '../useIonToast';\n\nimport { renderHook } from '@testing-library/react-hooks';\n\ndescribe('useController', () => {\n it('should be memorised', () => {\n const { result, rerender } = renderHook(() =>\n useController('AlertController', alertController)\n );\n\n rerender();\n\n const [\n { present: firstPresent, dismiss: firstDismiss },\n { present: secondPresent, dismiss: secondDismiss },\n ] = result.all as ReturnType<typeof useController>[];\n\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useIonActionSheet', () => {\n it('should be memorised', () => {\n const { result, rerender } = renderHook(() => useIonActionSheet());\n\n rerender();\n\n const [[firstPresent, firstDismiss], [secondPresent, secondDismiss]] =\n result.all as UseIonActionSheetResult[];\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useIonAlert', () => {\n it('should be memorised', () => {\n const { result, rerender } = renderHook(() => useIonAlert());\n\n rerender();\n\n const [[firstPresent, firstDismiss], [secondPresent, secondDismiss]] =\n result.all as UseIonAlertResult[];\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useIonLoading', () => {\n it('should be memorised', () => {\n const { result, rerender } = renderHook(() => useIonLoading());\n\n rerender();\n\n const [[firstPresent, firstDismiss], [secondPresent, secondDismiss]] =\n result.all as UseIonLoadingResult[];\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useIonModal', () => {\n it('should be memorised', () => {\n const ModalComponent = () => <div />;\n const { result, rerender } = renderHook(() => useIonModal(ModalComponent, {}));\n\n rerender();\n\n const [[firstPresent, firstDismiss], [secondPresent, secondDismiss]] =\n result.all as UseIonModalResult[];\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useIonPicker', () => {\n it('should be memorised', () => {\n const { result, rerender } = renderHook(() => useIonPicker());\n\n rerender();\n\n const [[firstPresent, firstDismiss], [secondPresent, secondDismiss]] =\n result.all as UseIonPickerResult[];\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useIonPopover', () => {\n it('should be memorised', () => {\n const PopoverComponent = () => <div />;\n const { result, rerender } = renderHook(() => useIonPopover(PopoverComponent, {}));\n\n rerender();\n\n const [[firstPresent, firstDismiss], [secondPresent, secondDismiss]] =\n result.all as UseIonPopoverResult[];\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useIonToast', () => {\n it('should be memorised', () => {\n const { result, rerender } = renderHook(() => useIonToast());\n\n rerender();\n\n const [[firstPresent, firstDismiss], [secondPresent, secondDismiss]] =\n result.all as UseIonToastResult[];\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n\ndescribe('useOverlay', () => {\n it('should be memorised', () => {\n const OverlayComponent = () => <div />;\n const { result, rerender } = renderHook(() =>\n useOverlay('IonModal', modalController, OverlayComponent, {})\n );\n\n rerender();\n\n const [\n { present: firstPresent, dismiss: firstDismiss },\n { present: secondPresent, dismiss: secondDismiss },\n ] = result.all as ReturnType<typeof useOverlay>[];\n\n expect(firstPresent).toBe(secondPresent);\n expect(firstDismiss).toBe(secondDismiss);\n });\n});\n*/\n"],
5
- "mappings": ";AAGA,SAAS,QAAQ,MAAM;AACrB,KAAG,eAAe,MAAM;AAAA,EAGxB,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,45 +0,0 @@
1
- "use strict";
2
- import { useCallback, useMemo, useRef } from "react";
3
- import { attachProps } from "../components/react-component-lib/utils";
4
- export function useController(displayName, controller, defineCustomElement) {
5
- const overlayRef = useRef();
6
- const didDismissEventName = useMemo(() => `on${displayName}DidDismiss`, [displayName]);
7
- const didPresentEventName = useMemo(() => `on${displayName}DidPresent`, [displayName]);
8
- const willDismissEventName = useMemo(() => `on${displayName}WillDismiss`, [displayName]);
9
- const willPresentEventName = useMemo(() => `on${displayName}WillPresent`, [displayName]);
10
- defineCustomElement();
11
- const present = useCallback(
12
- async (options) => {
13
- if (overlayRef.current) {
14
- return;
15
- }
16
- const { onDidDismiss, onWillDismiss, onDidPresent, onWillPresent, ...rest } = options;
17
- const handleDismiss = (event) => {
18
- if (onDidDismiss) {
19
- onDidDismiss(event);
20
- }
21
- overlayRef.current = void 0;
22
- };
23
- overlayRef.current = await controller.create({
24
- ...rest
25
- });
26
- attachProps(overlayRef.current, {
27
- [didDismissEventName]: handleDismiss,
28
- [didPresentEventName]: (e) => onDidPresent && onDidPresent(e),
29
- [willDismissEventName]: (e) => onWillDismiss && onWillDismiss(e),
30
- [willPresentEventName]: (e) => onWillPresent && onWillPresent(e)
31
- });
32
- overlayRef.current.present();
33
- },
34
- [controller]
35
- );
36
- const dismiss = useCallback(async () => {
37
- overlayRef.current && await overlayRef.current.dismiss();
38
- overlayRef.current = void 0;
39
- }, []);
40
- return {
41
- present,
42
- dismiss
43
- };
44
- }
45
- //# sourceMappingURL=useController.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useController.ts"],
4
- "sourcesContent": ["import type { OverlayEventDetail } from '@ionic/core/components';\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport { attachProps } from '../components/react-component-lib/utils';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\n\ninterface OverlayBase extends HTMLElement {\n present: () => Promise<void>;\n dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;\n}\n\nexport function useController<OptionsType, OverlayType extends OverlayBase>(\n displayName: string,\n controller: { create: (options: OptionsType) => Promise<OverlayType> },\n defineCustomElement: () => void\n) {\n const overlayRef = useRef<OverlayType>();\n const didDismissEventName = useMemo(() => `on${displayName}DidDismiss`, [displayName]);\n const didPresentEventName = useMemo(() => `on${displayName}DidPresent`, [displayName]);\n const willDismissEventName = useMemo(() => `on${displayName}WillDismiss`, [displayName]);\n const willPresentEventName = useMemo(() => `on${displayName}WillPresent`, [displayName]);\n\n defineCustomElement();\n\n const present = useCallback(\n async (options: OptionsType & HookOverlayOptions) => {\n if (overlayRef.current) {\n return;\n }\n\n const { onDidDismiss, onWillDismiss, onDidPresent, onWillPresent, ...rest } = options;\n\n const handleDismiss = (event: CustomEvent<OverlayEventDetail<any>>) => {\n if (onDidDismiss) {\n onDidDismiss(event);\n }\n overlayRef.current = undefined;\n };\n\n overlayRef.current = await controller.create({\n ...(rest as any),\n });\n\n attachProps(overlayRef.current, {\n [didDismissEventName]: handleDismiss,\n [didPresentEventName]: (e: CustomEvent) => onDidPresent && onDidPresent(e),\n [willDismissEventName]: (e: CustomEvent) => onWillDismiss && onWillDismiss(e),\n [willPresentEventName]: (e: CustomEvent) => onWillPresent && onWillPresent(e),\n });\n\n overlayRef.current.present();\n },\n [controller]\n );\n\n const dismiss = useCallback(async () => {\n overlayRef.current && (await overlayRef.current.dismiss());\n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,eAAW,UAAU;AAAA,EACvB,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- import { actionSheetController } from "@ionic/core/components";
3
- import { defineCustomElement } from "@ionic/core/components/ion-action-sheet.js";
4
- import { useCallback } from "react";
5
- import { useController } from "./useController";
6
- export function useIonActionSheet() {
7
- const controller = useController(
8
- "IonActionSheet",
9
- actionSheetController,
10
- defineCustomElement
11
- );
12
- const present = useCallback(
13
- (buttonsOrOptions, header) => {
14
- if (Array.isArray(buttonsOrOptions)) {
15
- return controller.present({
16
- buttons: buttonsOrOptions,
17
- header
18
- });
19
- } else {
20
- return controller.present(buttonsOrOptions);
21
- }
22
- },
23
- [controller.present]
24
- );
25
- return [present, controller.dismiss];
26
- }
27
- //# sourceMappingURL=useIonActionSheet.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useIonActionSheet.ts"],
4
- "sourcesContent": ["import type { ActionSheetButton, ActionSheetOptions } from '@ionic/core/components';\nimport { actionSheetController } from '@ionic/core/components';\nimport { defineCustomElement } from '@ionic/core/components/ion-action-sheet.js';\nimport { useCallback } from 'react';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\nimport { useController } from './useController';\n\n/**\n * A hook for presenting/dismissing an IonActionSheet component\n * @returns Returns the present and dismiss methods in an array\n */\nexport function useIonActionSheet(): UseIonActionSheetResult {\n const controller = useController<ActionSheetOptions, HTMLIonActionSheetElement>(\n 'IonActionSheet',\n actionSheetController,\n defineCustomElement\n );\n\n const present = useCallback(\n (buttonsOrOptions: ActionSheetButton[] | (ActionSheetOptions & HookOverlayOptions), header?: string) => {\n if (Array.isArray(buttonsOrOptions)) {\n return controller.present({\n buttons: buttonsOrOptions,\n header,\n });\n } else {\n return controller.present(buttonsOrOptions);\n }\n },\n [controller.present]\n );\n\n return [present, controller.dismiss];\n}\n\nexport type UseIonActionSheetResult = [\n {\n /**\n * Presents the action sheet\n * @param buttons An array of buttons for the action sheet\n * @param header Optional - Title for the action sheet\n */\n (buttons: ActionSheetButton[], header?: string | undefined): Promise<void>;\n /**\n * Presents the action sheet\n * @param options The options to pass to the IonActionSheet\n */\n (options: ActionSheetOptions & HookOverlayOptions): Promise<void>;\n },\n /**\n * Dismisses the action sheet\n */\n () => Promise<void>\n];\n"],
5
- "mappings": ";AACA,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAG5B,SAAS,qBAAqB;AAMvB,gBAAS,oBAA6C;AAC3D,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,UAAU;AAAA,IACd,CAAC,kBAAmF,WAAoB;AACtG,UAAI,MAAM,QAAQ,gBAAgB,GAAG;AACnC,eAAO,WAAW,QAAQ;AAAA,UACxB,SAAS;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH,OAAO;AACL,eAAO,WAAW,QAAQ,gBAAgB;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,SAAO,CAAC,SAAS,WAAW,OAAO;AACrC;",
6
- "names": []
7
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- import { alertController } from "@ionic/core/components";
3
- import { defineCustomElement } from "@ionic/core/components/ion-alert.js";
4
- import { useCallback } from "react";
5
- import { useController } from "./useController";
6
- export function useIonAlert() {
7
- const controller = useController("IonAlert", alertController, defineCustomElement);
8
- const present = useCallback(
9
- (messageOrOptions, buttons) => {
10
- if (typeof messageOrOptions === "string") {
11
- return controller.present({
12
- message: messageOrOptions,
13
- buttons: buttons ?? [{ text: "Ok" }]
14
- });
15
- } else {
16
- return controller.present(messageOrOptions);
17
- }
18
- },
19
- [controller.present]
20
- );
21
- return [present, controller.dismiss];
22
- }
23
- //# sourceMappingURL=useIonAlert.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useIonAlert.ts"],
4
- "sourcesContent": ["import type { AlertButton, AlertOptions } from '@ionic/core/components';\nimport { alertController } from '@ionic/core/components';\nimport { defineCustomElement } from '@ionic/core/components/ion-alert.js';\nimport { useCallback } from 'react';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\nimport { useController } from './useController';\n\n/**\n * A hook for presenting/dismissing an IonAlert component\n * @returns Returns the present and dismiss methods in an array\n */\nexport function useIonAlert(): UseIonAlertResult {\n const controller = useController<AlertOptions, HTMLIonAlertElement>('IonAlert', alertController, defineCustomElement);\n\n const present = useCallback(\n (messageOrOptions: string | (AlertOptions & HookOverlayOptions), buttons?: AlertButton[]) => {\n if (typeof messageOrOptions === 'string') {\n return controller.present({\n message: messageOrOptions,\n buttons: buttons ?? [{ text: 'Ok' }],\n });\n } else {\n return controller.present(messageOrOptions);\n }\n },\n [controller.present]\n );\n\n return [present, controller.dismiss];\n}\n\nexport type UseIonAlertResult = [\n {\n /**\n * Presents the alert\n * @param message The main message to be displayed in the alert\n * @param buttons Optional - Array of buttons to be added to the alert\n */\n (message: string, buttons?: AlertButton[]): Promise<void>;\n /**\n * Presents the alert\n * @param options The options to pass to the IonAlert\n */\n (options: AlertOptions & HookOverlayOptions): Promise<void>;\n },\n /**\n * Dismisses the alert\n */\n () => Promise<void>\n];\n"],
5
- "mappings": ";AACA,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAG5B,SAAS,qBAAqB;AAMvB,gBAAS,cAAiC;AAC/C,QAAM,aAAa,cAAiD,YAAY,iBAAiB,mBAAmB;AAEpH,QAAM,UAAU;AAAA,IACd,CAAC,kBAAgE,YAA4B;AAC3F,UAAI,OAAO,qBAAqB,UAAU;AACxC,eAAO,WAAW,QAAQ;AAAA,UACxB,SAAS;AAAA,UACT,SAAS,WAAW,CAAC,EAAE,MAAM,KAAK,CAAC;AAAA,QACrC,CAAC;AAAA,MACH,OAAO;AACL,eAAO,WAAW,QAAQ,gBAAgB;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,SAAO,CAAC,SAAS,WAAW,OAAO;AACrC;",
6
- "names": []
7
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- import { loadingController } from "@ionic/core/components";
3
- import { defineCustomElement } from "@ionic/core/components/ion-loading.js";
4
- import { useCallback } from "react";
5
- import { useController } from "./useController";
6
- export function useIonLoading() {
7
- const controller = useController(
8
- "IonLoading",
9
- loadingController,
10
- defineCustomElement
11
- );
12
- const present = useCallback(
13
- (messageOrOptions = {}, duration, spinner) => {
14
- if (typeof messageOrOptions === "string") {
15
- return controller.present({
16
- message: messageOrOptions,
17
- duration,
18
- spinner
19
- });
20
- } else {
21
- return controller.present(messageOrOptions);
22
- }
23
- },
24
- [controller.present]
25
- );
26
- return [present, controller.dismiss];
27
- }
28
- //# sourceMappingURL=useIonLoading.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useIonLoading.tsx"],
4
- "sourcesContent": ["import type { LoadingOptions, SpinnerTypes } from '@ionic/core/components';\nimport { loadingController } from '@ionic/core/components';\nimport { defineCustomElement } from '@ionic/core/components/ion-loading.js';\nimport { useCallback } from 'react';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\nimport { useController } from './useController';\n\n/**\n * A hook for presenting/dismissing an IonLoading component\n * @returns Returns the present and dismiss methods in an array\n */\nexport function useIonLoading(): UseIonLoadingResult {\n const controller = useController<LoadingOptions, HTMLIonLoadingElement>(\n 'IonLoading',\n loadingController,\n defineCustomElement\n );\n\n const present = useCallback(\n (\n messageOrOptions: string | (LoadingOptions & HookOverlayOptions) = {},\n duration?: number,\n spinner?: SpinnerTypes\n ) => {\n if (typeof messageOrOptions === 'string') {\n return controller.present({\n message: messageOrOptions,\n duration,\n spinner,\n });\n } else {\n return controller.present(messageOrOptions);\n }\n },\n [controller.present]\n );\n\n return [present, controller.dismiss];\n}\n\nexport type UseIonLoadingResult = [\n {\n /**\n * Presents the loading indicator\n * @param message Optional - Text content to display in the loading indicator, defaults to blank string\n * @param duration Optional - Number of milliseconds to wait before dismissing the loading indicator\n * @param spinner Optional - The name of the spinner to display, defaults to \"lines\"\n */\n (message?: string, duration?: number, spinner?: SpinnerTypes): Promise<void>;\n /**\n * Presents the loading indicator\n * @param options The options to pass to the IonLoading\n */\n (options: LoadingOptions & HookOverlayOptions): Promise<void>;\n },\n /**\n * Dismisses the loading indicator\n */\n () => Promise<void>\n];\n"],
5
- "mappings": ";AACA,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAG5B,SAAS,qBAAqB;AAMvB,gBAAS,gBAAqC;AACnD,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,UAAU;AAAA,IACd,CACE,mBAAmE,CAAC,GACpE,UACA,YACG;AACH,UAAI,OAAO,qBAAqB,UAAU;AACxC,eAAO,WAAW,QAAQ;AAAA,UACxB,SAAS;AAAA,UACT;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH,OAAO;AACL,eAAO,WAAW,QAAQ,gBAAgB;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,SAAO,CAAC,SAAS,WAAW,OAAO;AACrC;",
6
- "names": []
7
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- import { modalController } from "@ionic/core/components";
3
- import { defineCustomElement } from "@ionic/core/components/ion-modal.js";
4
- import { useCallback } from "react";
5
- import { useOverlay } from "./useOverlay";
6
- export function useIonModal(component, componentProps) {
7
- const controller = useOverlay(
8
- "IonModal",
9
- modalController,
10
- defineCustomElement,
11
- component,
12
- componentProps
13
- );
14
- const present = useCallback(
15
- (options = {}) => {
16
- controller.present(options);
17
- },
18
- [controller.present]
19
- );
20
- return [present, controller.dismiss];
21
- }
22
- //# sourceMappingURL=useIonModal.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useIonModal.ts"],
4
- "sourcesContent": ["import type { ModalOptions } from '@ionic/core/components';\nimport { modalController } from '@ionic/core/components';\nimport { defineCustomElement } from '@ionic/core/components/ion-modal.js';\nimport { useCallback } from 'react';\n\nimport type { ReactComponentOrElement } from '../models/ReactComponentOrElement';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\nimport { useOverlay } from './useOverlay';\n\n// TODO(FW-2959): types\n\n/**\n * A hook for presenting/dismissing an IonModal component\n * @param component The component that the modal will show. Can be a React Component, a functional component, or a JSX Element\n * @param componentProps The props that will be passed to the component, if required\n * @returns Returns the present and dismiss methods in an array\n */\nexport function useIonModal(component: ReactComponentOrElement, componentProps?: any): UseIonModalResult {\n const controller = useOverlay<ModalOptions, HTMLIonModalElement>(\n 'IonModal',\n modalController,\n defineCustomElement,\n component,\n componentProps\n );\n\n const present = useCallback(\n (options: Omit<ModalOptions, 'component' | 'componentProps'> & HookOverlayOptions = {}) => {\n controller.present(options as any);\n },\n [controller.present]\n );\n\n return [present, controller.dismiss];\n}\n\nexport type UseIonModalResult = [\n (options?: Omit<ModalOptions, 'component' | 'componentProps'> & HookOverlayOptions) => void,\n /**\n * Dismisses the modal\n */\n (data?: any, role?: string) => void\n];\n"],
5
- "mappings": ";AACA,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAK5B,SAAS,kBAAkB;AAUpB,gBAAS,YAAY,WAAoC,gBAAyC;AACvG,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,UAAU;AAAA,IACd,CAAC,UAAmF,CAAC,MAAM;AACzF,iBAAW,QAAQ,OAAc;AAAA,IACnC;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,SAAO,CAAC,SAAS,WAAW,OAAO;AACrC;",
6
- "names": []
7
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- import { pickerController } from "@ionic/core/components";
3
- import { defineCustomElement } from "@ionic/core/components/ion-picker.js";
4
- import { useCallback } from "react";
5
- import { useController } from "./useController";
6
- export function useIonPicker() {
7
- const controller = useController(
8
- "IonPicker",
9
- pickerController,
10
- defineCustomElement
11
- );
12
- const present = useCallback(
13
- (columnsOrOptions, buttons) => {
14
- if (Array.isArray(columnsOrOptions)) {
15
- return controller.present({
16
- columns: columnsOrOptions,
17
- buttons: buttons ?? [{ text: "Ok" }]
18
- });
19
- } else {
20
- return controller.present(columnsOrOptions);
21
- }
22
- },
23
- [controller.present]
24
- );
25
- return [present, controller.dismiss];
26
- }
27
- //# sourceMappingURL=useIonPicker.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useIonPicker.tsx"],
4
- "sourcesContent": ["import type { PickerButton, PickerColumn, PickerOptions } from '@ionic/core/components';\nimport { pickerController } from '@ionic/core/components';\nimport { defineCustomElement } from '@ionic/core/components/ion-picker.js';\nimport { useCallback } from 'react';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\nimport { useController } from './useController';\n\n/**\n * A hook for presenting/dismissing an IonPicker component\n * @returns Returns the present and dismiss methods in an array\n */\nexport function useIonPicker(): UseIonPickerResult {\n const controller = useController<PickerOptions, HTMLIonPickerElement>(\n 'IonPicker',\n pickerController,\n defineCustomElement\n );\n\n const present = useCallback(\n (columnsOrOptions: PickerColumn[] | (PickerOptions & HookOverlayOptions), buttons?: PickerButton[]) => {\n if (Array.isArray(columnsOrOptions)) {\n return controller.present({\n columns: columnsOrOptions,\n buttons: buttons ?? [{ text: 'Ok' }],\n });\n } else {\n return controller.present(columnsOrOptions);\n }\n },\n [controller.present]\n );\n\n return [present, controller.dismiss];\n}\n\nexport type UseIonPickerResult = [\n {\n /**\n * Presents the picker\n * @param columns Array of columns to be displayed in the picker.\n * @param buttons Optional - Array of buttons to be displayed at the top of the picker.\n */\n (columns: PickerColumn[], buttons?: PickerButton[]): Promise<void>;\n /**\n * Presents the picker\n * @param options The options to pass to the IonPicker\n */\n (options: PickerOptions & HookOverlayOptions): Promise<void>;\n },\n /**\n * Dismisses the picker\n */\n () => Promise<void>\n];\n"],
5
- "mappings": ";AACA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAG5B,SAAS,qBAAqB;AAMvB,gBAAS,eAAmC;AACjD,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,UAAU;AAAA,IACd,CAAC,kBAAyE,YAA6B;AACrG,UAAI,MAAM,QAAQ,gBAAgB,GAAG;AACnC,eAAO,WAAW,QAAQ;AAAA,UACxB,SAAS;AAAA,UACT,SAAS,WAAW,CAAC,EAAE,MAAM,KAAK,CAAC;AAAA,QACrC,CAAC;AAAA,MACH,OAAO;AACL,eAAO,WAAW,QAAQ,gBAAgB;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,SAAO,CAAC,SAAS,WAAW,OAAO;AACrC;",
6
- "names": []
7
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- import { popoverController } from "@ionic/core/components";
3
- import { defineCustomElement } from "@ionic/core/components/ion-popover.js";
4
- import { useCallback } from "react";
5
- import { useOverlay } from "./useOverlay";
6
- export function useIonPopover(component, componentProps) {
7
- const controller = useOverlay(
8
- "IonPopover",
9
- popoverController,
10
- defineCustomElement,
11
- component,
12
- componentProps
13
- );
14
- const present = useCallback(
15
- (options = {}) => {
16
- controller.present(options);
17
- },
18
- [controller.present]
19
- );
20
- return [present, controller.dismiss];
21
- }
22
- //# sourceMappingURL=useIonPopover.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/useIonPopover.ts"],
4
- "sourcesContent": ["import type { PopoverOptions } from '@ionic/core/components';\nimport { popoverController } from '@ionic/core/components';\nimport { defineCustomElement } from '@ionic/core/components/ion-popover.js';\nimport { useCallback } from 'react';\n\nimport type { ReactComponentOrElement } from '../models/ReactComponentOrElement';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\nimport { useOverlay } from './useOverlay';\n\n// TODO(FW-2959): types\n\n/**\n * A hook for presenting/dismissing an IonPicker component\n * @param component The component that the popover will show. Can be a React Component, a functional component, or a JSX Element\n * @param componentProps The props that will be passed to the component, if required\n * @returns Returns the present and dismiss methods in an array\n */\nexport function useIonPopover(component: ReactComponentOrElement, componentProps?: any): UseIonPopoverResult {\n const controller = useOverlay<PopoverOptions, HTMLIonPopoverElement>(\n 'IonPopover',\n popoverController,\n defineCustomElement,\n component,\n componentProps\n );\n\n const present = useCallback(\n (options: Omit<PopoverOptions, 'component' | 'componentProps'> & HookOverlayOptions = {}) => {\n controller.present(options as any);\n },\n [controller.present]\n );\n\n return [present, controller.dismiss];\n}\n\nexport type UseIonPopoverResult = [\n (options?: Omit<PopoverOptions, 'component' | 'componentProps'> & HookOverlayOptions) => void,\n /**\n * Dismisses the popover\n */\n (data?: any, role?: string) => void\n];\n"],
5
- "mappings": ";AACA,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAK5B,SAAS,kBAAkB;AAUpB,gBAAS,cAAc,WAAoC,gBAA2C;AAC3G,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,UAAU;AAAA,IACd,CAAC,UAAqF,CAAC,MAAM;AAC3F,iBAAW,QAAQ,OAAc;AAAA,IACnC;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,SAAO,CAAC,SAAS,WAAW,OAAO;AACrC;",
6
- "names": []
7
- }