@sparkle-learning/core 0.0.36 → 0.0.39

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 (248) hide show
  1. package/dist/cjs/PrivateRoute-4abc9d29.js +35 -0
  2. package/dist/cjs/{PrivateRoute-074c584e.js → auth.service-4b584cd7.js} +0 -30
  3. package/dist/cjs/dom-utils-b8befdd5.js +63 -0
  4. package/dist/cjs/header-mobile-collapse.cjs.entry.js +90 -0
  5. package/dist/cjs/index-70e63f5b.js +3071 -0
  6. package/dist/cjs/index.cjs.js +6 -5
  7. package/dist/cjs/injectHistory-7206bbb9.js +9 -0
  8. package/dist/cjs/ion-avatar.cjs.entry.js +25 -0
  9. package/dist/cjs/ion-button.cjs.entry.js +129 -0
  10. package/dist/cjs/ion-card_2.cjs.entry.js +91 -0
  11. package/dist/cjs/ion-checkbox_4.cjs.entry.js +360 -0
  12. package/dist/cjs/ion-col_3.cjs.entry.js +159 -0
  13. package/dist/cjs/ion-icon_13.cjs.entry.js +1505 -0
  14. package/dist/cjs/ion-input_2.cjs.entry.js +313 -0
  15. package/dist/cjs/ion-label_2.cjs.entry.js +126 -0
  16. package/dist/cjs/ion-spinner.cjs.entry.js +64 -0
  17. package/dist/cjs/loader.cjs.js +1 -1
  18. package/dist/cjs/match-path-84c9f7ca.js +511 -0
  19. package/dist/cjs/sparkle-card_3.cjs.entry.js +91 -0
  20. package/dist/cjs/sparkle-core.cjs.js +1 -1
  21. package/dist/cjs/sparkle-course-root.cjs.entry.js +146 -0
  22. package/dist/cjs/sparkle-dropdown.cjs.entry.js +61 -0
  23. package/dist/cjs/{header-mobile-collapse_61.cjs.entry.js → sparkle-export-lessons_6.cjs.entry.js} +8864 -17750
  24. package/dist/cjs/sparkle-facilitator-header_19.cjs.entry.js +2130 -0
  25. package/dist/cjs/sparkle-feed-post.cjs.entry.js +1 -1
  26. package/dist/cjs/sparkle-feedback.cjs.entry.js +2 -1
  27. package/dist/cjs/sparkle-goal-progress.cjs.entry.js +19 -0
  28. package/dist/cjs/sparkle-gww-item.cjs.entry.js +74 -0
  29. package/dist/cjs/sparkle-menu-toggle_3.cjs.entry.js +236 -0
  30. package/dist/cjs/sparkle-validation-error.cjs.entry.js +21 -0
  31. package/dist/cjs/stencil-router-redirect.cjs.entry.js +32 -0
  32. package/dist/cjs/student.service-d48f1c99.js +61 -0
  33. package/dist/cjs/user.store-8a049c4e.js +21 -0
  34. package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +30 -28
  35. package/dist/collection/components/sparkle-quiz/sparkle-quiz/sparkle-quiz.js +2 -1
  36. package/dist/esm/PrivateRoute-7b526801.js +33 -0
  37. package/dist/esm/{animation-12377cb3.js → animation-e0716b39.js} +1 -1
  38. package/dist/esm/{PrivateRoute-c5441f35.js → auth.service-9fb86455.js} +4 -33
  39. package/dist/esm/{auth.store-dba2c2da.js → auth.store-633e8414.js} +1 -1
  40. package/dist/esm/dom-utils-109a7d75.js +55 -0
  41. package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-8fd435bf.js} +2 -2
  42. package/dist/esm/{feed.service-8fbe4ce3.js → feed.service-ace049e5.js} +3 -3
  43. package/dist/esm/{framework-delegate-3e634a5c.js → framework-delegate-e4f8013b.js} +1 -1
  44. package/dist/esm/header-mobile-collapse.entry.js +86 -0
  45. package/dist/esm/{helpers-bf0e23d6.js → helpers-03073fe4.js} +1 -1
  46. package/dist/esm/{httpService-7b75b095.js → httpService-61864992.js} +2 -2
  47. package/dist/esm/{icons-9b62a1ec.js → icons-90b957ab.js} +1 -1
  48. package/dist/esm/{index-5e8971ae.js → index-37004831.js} +1 -1
  49. package/dist/esm/{index-45fec1e7.js → index-a2d2941d.js} +1 -1
  50. package/dist/esm/{index-2b84cad2.js → index-b4b4e503.js} +3 -3
  51. package/dist/esm/{index-cded2d87.js → index-dedabca0.js} +2 -2
  52. package/dist/esm/index-f9b9ba5d.js +3067 -0
  53. package/dist/esm/{index.es-e0c0f891.js → index.es-283fbd2e.js} +1 -1
  54. package/dist/esm/index.js +6 -5
  55. package/dist/esm/injectHistory-968f626d.js +7 -0
  56. package/dist/esm/{input-shims-671d8d9f.js → input-shims-cc3720a0.js} +2 -2
  57. package/dist/esm/ion-accordion.entry.js +1 -1
  58. package/dist/esm/ion-action-sheet_4.entry.js +5 -5
  59. package/dist/esm/ion-app.entry.js +3 -3
  60. package/dist/esm/ion-avatar.entry.js +21 -0
  61. package/dist/esm/ion-back-button.entry.js +1 -1
  62. package/dist/esm/ion-breadcrumb.entry.js +1 -1
  63. package/dist/esm/ion-button.entry.js +125 -0
  64. package/dist/esm/ion-card_2.entry.js +86 -0
  65. package/dist/esm/ion-checkbox_4.entry.js +353 -0
  66. package/dist/esm/ion-col_3.entry.js +153 -0
  67. package/dist/esm/ion-content_2.entry.js +2 -2
  68. package/dist/esm/ion-datetime-button.entry.js +1 -1
  69. package/dist/esm/ion-datetime.entry.js +1 -1
  70. package/dist/esm/ion-fab-button.entry.js +1 -1
  71. package/dist/esm/ion-footer.entry.js +2 -2
  72. package/dist/esm/ion-icon_13.entry.js +1489 -0
  73. package/dist/esm/ion-img.entry.js +1 -1
  74. package/dist/esm/ion-infinite-scroll.entry.js +2 -2
  75. package/dist/esm/ion-input_2.entry.js +308 -0
  76. package/dist/esm/ion-item-options.entry.js +1 -1
  77. package/dist/esm/ion-item-sliding.entry.js +2 -2
  78. package/dist/esm/ion-label_2.entry.js +121 -0
  79. package/dist/esm/ion-loading.entry.js +3 -3
  80. package/dist/esm/ion-menu-button.entry.js +4 -4
  81. package/dist/esm/ion-menu-toggle.entry.js +4 -4
  82. package/dist/esm/ion-menu.entry.js +4 -4
  83. package/dist/esm/ion-modal.entry.js +6 -6
  84. package/dist/esm/ion-nav.entry.js +4 -4
  85. package/dist/esm/ion-picker-column-internal_2.entry.js +1 -1
  86. package/dist/esm/ion-picker-column.entry.js +1 -1
  87. package/dist/esm/ion-picker.entry.js +3 -3
  88. package/dist/esm/ion-progress-bar.entry.js +1 -1
  89. package/dist/esm/ion-refresher.entry.js +3 -3
  90. package/dist/esm/ion-reorder-group.entry.js +2 -2
  91. package/dist/esm/ion-router-outlet.entry.js +4 -4
  92. package/dist/esm/ion-router.entry.js +1 -1
  93. package/dist/esm/ion-searchbar.entry.js +1 -1
  94. package/dist/esm/ion-segment-button.entry.js +1 -1
  95. package/dist/esm/ion-segment.entry.js +1 -1
  96. package/dist/esm/ion-select_2.entry.js +2 -2
  97. package/dist/esm/ion-slides.entry.js +1 -1
  98. package/dist/esm/ion-spinner.entry.js +60 -0
  99. package/dist/esm/ion-tab.entry.js +2 -2
  100. package/dist/esm/ion-textarea.entry.js +1 -1
  101. package/dist/esm/ion-toast.entry.js +3 -3
  102. package/dist/esm/ion-toggle.entry.js +1 -1
  103. package/dist/esm/ion-virtual-scroll.entry.js +1 -1
  104. package/dist/esm/{ios.transition-131d64fe.js → ios.transition-3a6179bb.js} +3 -3
  105. package/dist/esm/loader.js +1 -1
  106. package/dist/esm/match-path-36fdf5c7.js +499 -0
  107. package/dist/esm/{md.transition-f6126011.js → md.transition-cff16bf3.js} +3 -3
  108. package/dist/esm/{menu-toggle-util-bace8ae6.js → menu-toggle-util-59241733.js} +1 -1
  109. package/dist/esm/{overlays-3b4dca92.js → overlays-bdd9344a.js} +2 -2
  110. package/dist/esm/{purify-85bfcc69.js → purify-7085b248.js} +1 -1
  111. package/dist/esm/sparkle-animation-player.entry.js +1 -1
  112. package/dist/esm/sparkle-card_3.entry.js +85 -0
  113. package/dist/esm/sparkle-code.entry.js +1 -1
  114. package/dist/esm/sparkle-core.js +1 -1
  115. package/dist/esm/sparkle-course-root.entry.js +142 -0
  116. package/dist/esm/sparkle-dropdown.entry.js +57 -0
  117. package/dist/esm/{header-mobile-collapse_61.entry.js → sparkle-export-lessons_6.entry.js} +8859 -17690
  118. package/dist/esm/sparkle-facilitator-header_19.entry.js +2108 -0
  119. package/dist/esm/sparkle-facilitator-notes-form.entry.js +5 -5
  120. package/dist/esm/sparkle-feed-post.entry.js +3 -3
  121. package/dist/esm/sparkle-feedback.entry.js +6 -5
  122. package/dist/esm/sparkle-goal-form.entry.js +6 -6
  123. package/dist/esm/sparkle-goal-progress.entry.js +15 -0
  124. package/dist/esm/sparkle-gww-item.entry.js +70 -0
  125. package/dist/esm/sparkle-menu-collapsible.entry.js +1 -1
  126. package/dist/esm/sparkle-menu-toggle_3.entry.js +230 -0
  127. package/dist/esm/sparkle-validation-error.entry.js +17 -0
  128. package/dist/esm/{status-tap-dde52787.js → status-tap-463d0f87.js} +2 -2
  129. package/dist/esm/stencil-router-redirect.entry.js +28 -0
  130. package/dist/esm/{student.service-0746418b.js → student.service-e6eb1f99.js} +3 -19
  131. package/dist/esm/{swipe-back-7847a0c1.js → swipe-back-f8765ac9.js} +1 -1
  132. package/dist/esm/user.store-b8645067.js +19 -0
  133. package/dist/esm/{util-6ef753e9.js → util-a831d09d.js} +1 -1
  134. package/dist/sparkle-core/index.esm.js +1 -1
  135. package/dist/sparkle-core/{p-2c1ca854.entry.js → p-014b5707.entry.js} +1 -1
  136. package/dist/sparkle-core/p-03585916.js +1 -0
  137. package/dist/sparkle-core/p-08d97c59.entry.js +1 -0
  138. package/dist/sparkle-core/{p-cabfbf22.entry.js → p-0bb0cf41.entry.js} +1 -1
  139. package/dist/sparkle-core/{p-30b810d1.entry.js → p-0c0f8acd.entry.js} +1 -1
  140. package/dist/sparkle-core/{p-de4deb61.entry.js → p-0ea2518d.entry.js} +1 -1
  141. package/dist/sparkle-core/p-1019ebc3.js +1 -0
  142. package/dist/sparkle-core/p-1728ead7.js +1 -0
  143. package/dist/sparkle-core/{p-d68092b7.js → p-17eb4633.js} +1 -1
  144. package/dist/sparkle-core/{p-e686d8b5.entry.js → p-1f0b3ff9.entry.js} +1 -1
  145. package/dist/sparkle-core/{p-a102341e.entry.js → p-25e556cc.entry.js} +1 -1
  146. package/dist/sparkle-core/{p-0c3f3ea6.entry.js → p-285ab4ed.entry.js} +1 -1
  147. package/dist/sparkle-core/{p-c60b29bd.entry.js → p-2d4a5ddf.entry.js} +2 -2
  148. package/dist/sparkle-core/{p-641bfc92.entry.js → p-2e035338.entry.js} +1 -1
  149. package/dist/sparkle-core/{p-2ff67662.js → p-2e2b813c.js} +2 -2
  150. package/dist/sparkle-core/{p-6ffd2420.entry.js → p-2f10208d.entry.js} +1 -1
  151. package/dist/sparkle-core/{p-b5f3e1bf.entry.js → p-2fba9a3a.entry.js} +1 -1
  152. package/dist/sparkle-core/{p-b3f375fb.entry.js → p-317037de.entry.js} +1 -1
  153. package/dist/sparkle-core/p-32762a44.entry.js +1 -0
  154. package/dist/sparkle-core/{p-2f569553.js → p-340754ed.js} +1 -1
  155. package/dist/sparkle-core/p-3bc68dd0.js +1 -0
  156. package/dist/sparkle-core/p-3c133235.entry.js +1 -0
  157. package/dist/sparkle-core/{p-48f72e63.js → p-3f85e1ca.js} +2 -2
  158. package/dist/sparkle-core/{p-2033cd86.js → p-405f7c58.js} +2 -2
  159. package/dist/sparkle-core/{p-9ebf0537.entry.js → p-4320dac0.entry.js} +1 -1
  160. package/dist/sparkle-core/{p-e863bf1d.entry.js → p-44f813b7.entry.js} +1 -1
  161. package/dist/sparkle-core/p-46869031.entry.js +1 -0
  162. package/dist/sparkle-core/p-4a5f2b2b.js +1 -0
  163. package/dist/sparkle-core/{p-894ff7e6.entry.js → p-4ae75caa.entry.js} +1 -1
  164. package/dist/sparkle-core/{p-935e7cfc.js → p-4bd4dab2.js} +1 -1
  165. package/dist/sparkle-core/{p-00d10dc9.js → p-539bf742.js} +2 -2
  166. package/dist/sparkle-core/p-53bcbd1d.js +1 -0
  167. package/dist/sparkle-core/p-54ada5e3.entry.js +1 -0
  168. package/dist/sparkle-core/{p-9289cdbc.entry.js → p-5519d283.entry.js} +1 -1
  169. package/dist/sparkle-core/p-554da5b8.entry.js +1 -0
  170. package/dist/sparkle-core/{p-e8073714.js → p-56a2e8a2.js} +1 -1
  171. package/dist/sparkle-core/p-5da2d95a.entry.js +1 -0
  172. package/dist/sparkle-core/{p-b0603d19.js → p-5fc26938.js} +1 -1
  173. package/dist/sparkle-core/{p-ebd4354b.entry.js → p-63f69cdc.entry.js} +1 -1
  174. package/dist/sparkle-core/{p-11356b03.entry.js → p-64e814b9.entry.js} +1 -1
  175. package/dist/sparkle-core/{p-ce4b22f7.entry.js → p-66a85393.entry.js} +1 -1
  176. package/dist/sparkle-core/p-6b05a1d3.entry.js +1 -0
  177. package/dist/sparkle-core/p-6ea246fe.js +4 -0
  178. package/dist/sparkle-core/p-6ed0236e.entry.js +1 -0
  179. package/dist/sparkle-core/{p-54dd894f.entry.js → p-6f0545b3.entry.js} +1 -1
  180. package/dist/sparkle-core/{p-0f1c5899.entry.js → p-727e1c28.entry.js} +1 -1
  181. package/dist/sparkle-core/p-7f25366a.entry.js +1 -0
  182. package/dist/sparkle-core/{p-b96f3c84.entry.js → p-82ad4e7c.entry.js} +2 -2
  183. package/dist/sparkle-core/p-91accfc1.js +1 -0
  184. package/dist/sparkle-core/{p-af3cc111.entry.js → p-93e74f1b.entry.js} +1 -1
  185. package/dist/sparkle-core/{p-86ed13f0.js → p-a019ad0c.js} +1 -1
  186. package/dist/sparkle-core/p-a5c5da9a.entry.js +1 -0
  187. package/dist/sparkle-core/{p-1d4c7c11.js → p-a85598ad.js} +1 -1
  188. package/dist/sparkle-core/p-a8a77bec.entry.js +1 -0
  189. package/dist/sparkle-core/{p-bd80ff43.js → p-ad102371.js} +1 -1
  190. package/dist/sparkle-core/{p-377b04c2.entry.js → p-b236d258.entry.js} +1 -1
  191. package/dist/sparkle-core/{p-9abbd715.entry.js → p-b4b01fa2.entry.js} +1 -1
  192. package/dist/sparkle-core/{p-6faa194c.entry.js → p-b4bc8b02.entry.js} +1 -1
  193. package/dist/sparkle-core/{p-0fa3fd63.entry.js → p-b5ec8fb0.entry.js} +1 -1
  194. package/dist/sparkle-core/{p-fb757951.entry.js → p-b83444c7.entry.js} +1 -1
  195. package/dist/sparkle-core/{p-05c032dd.js → p-b9933822.js} +1 -1
  196. package/dist/sparkle-core/{p-0afa3a4d.entry.js → p-b9b1d4da.entry.js} +1 -1
  197. package/dist/sparkle-core/{p-3de0e00c.js → p-be28346b.js} +1 -1
  198. package/dist/sparkle-core/{p-0ad5c123.entry.js → p-c278db5f.entry.js} +1 -1
  199. package/dist/sparkle-core/{p-fb0ca75e.entry.js → p-c2bbaf55.entry.js} +1 -1
  200. package/dist/sparkle-core/p-c4af184b.entry.js +1 -0
  201. package/dist/sparkle-core/p-c71cbbf7.entry.js +1 -0
  202. package/dist/sparkle-core/p-c8c73fa7.js +4 -0
  203. package/dist/sparkle-core/{p-1e125ca5.entry.js → p-c8fe45df.entry.js} +1 -1
  204. package/dist/sparkle-core/{p-600cf6a3.js → p-c9cd4ff1.js} +1 -1
  205. package/dist/sparkle-core/{p-5cad23f1.js → p-ca4c8a10.js} +1 -1
  206. package/dist/sparkle-core/{p-1e4f65ee.entry.js → p-cab3da3c.entry.js} +1 -1
  207. package/dist/sparkle-core/p-cd832fbf.entry.js +1 -0
  208. package/dist/sparkle-core/{p-564e64fc.entry.js → p-ce94efdb.entry.js} +1 -1
  209. package/dist/sparkle-core/p-d0ac5f17.js +1 -0
  210. package/dist/sparkle-core/p-d1fcbfc2.js +4 -0
  211. package/dist/sparkle-core/p-d432d3ac.entry.js +1 -0
  212. package/dist/sparkle-core/{p-fbccd30c.js → p-d81a0680.js} +1 -1
  213. package/dist/sparkle-core/p-d969f7d0.entry.js +348 -0
  214. package/dist/sparkle-core/{p-0664370b.entry.js → p-dabc80c4.entry.js} +1 -1
  215. package/dist/sparkle-core/{p-58e4bbe5.entry.js → p-db8387eb.entry.js} +1 -1
  216. package/dist/sparkle-core/p-dca90a55.entry.js +4 -0
  217. package/dist/sparkle-core/p-dd2e7f84.js +4 -0
  218. package/dist/sparkle-core/p-e0429a19.entry.js +1 -0
  219. package/dist/sparkle-core/{p-24cb9a33.entry.js → p-e65c72cc.entry.js} +1 -1
  220. package/dist/sparkle-core/p-e7066c64.entry.js +1 -0
  221. package/dist/sparkle-core/{p-9d894ed4.js → p-e7568d4b.js} +1 -1
  222. package/dist/sparkle-core/p-eb40a191.entry.js +1 -0
  223. package/dist/sparkle-core/p-ecdea569.entry.js +1 -0
  224. package/dist/sparkle-core/{p-74864276.entry.js → p-ed9f48c4.entry.js} +1 -1
  225. package/dist/sparkle-core/p-ef6c2352.entry.js +1 -0
  226. package/dist/sparkle-core/{p-be64105c.entry.js → p-f0cf4a8f.entry.js} +1 -1
  227. package/dist/sparkle-core/{p-c0533c23.entry.js → p-f4b0b6a4.entry.js} +1 -1
  228. package/dist/sparkle-core/{p-ef4edc48.entry.js → p-fc965b88.entry.js} +1 -1
  229. package/dist/sparkle-core/{p-39712c56.entry.js → p-fde382f0.entry.js} +1 -1
  230. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  231. package/package.json +2 -2
  232. package/dist/cjs/sparkle-quiz-feedback_5.cjs.entry.js +0 -117
  233. package/dist/cjs/sparkle-quiz.cjs.entry.js +0 -119
  234. package/dist/cjs/student.service-2e58f237.js +0 -78
  235. package/dist/esm/sparkle-quiz-feedback_5.entry.js +0 -109
  236. package/dist/esm/sparkle-quiz.entry.js +0 -115
  237. package/dist/sparkle-core/p-077c732b.js +0 -4
  238. package/dist/sparkle-core/p-12dd96d7.js +0 -4
  239. package/dist/sparkle-core/p-23aca7ca.js +0 -4
  240. package/dist/sparkle-core/p-3a965828.entry.js +0 -1
  241. package/dist/sparkle-core/p-462bffba.js +0 -1
  242. package/dist/sparkle-core/p-590266d6.entry.js +0 -1
  243. package/dist/sparkle-core/p-5efc6566.js +0 -1
  244. package/dist/sparkle-core/p-73721c84.js +0 -4
  245. package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
  246. package/dist/sparkle-core/p-8492a765.entry.js +0 -1
  247. package/dist/sparkle-core/p-c3cadfc6.entry.js +0 -1
  248. package/dist/sparkle-core/p-eaf76d1d.entry.js +0 -352
@@ -0,0 +1,1505 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-51e8292e.js');
6
+ const index$1 = require('./index-975586fd.js');
7
+ const ionicGlobal = require('./ionic-global-2cde9d3a.js');
8
+ const helpers = require('./helpers-c2496722.js');
9
+ const index$2 = require('./index-e56e09b8.js');
10
+ const theme = require('./theme-b0b295c1.js');
11
+ const index$3 = require('./index-9c7b27e4.js');
12
+ const dir = require('./dir-5af5259a.js');
13
+ const matchPath = require('./match-path-84c9f7ca.js');
14
+ const domUtils = require('./dom-utils-b8befdd5.js');
15
+ const activeRouter = require('./active-router-f9e18bd8.js');
16
+
17
+ let CACHED_MAP;
18
+ const getIconMap = () => {
19
+ if (typeof window === 'undefined') {
20
+ return new Map();
21
+ }
22
+ else {
23
+ if (!CACHED_MAP) {
24
+ const win = window;
25
+ win.Ionicons = win.Ionicons || {};
26
+ CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
27
+ }
28
+ return CACHED_MAP;
29
+ }
30
+ };
31
+ const getUrl$1 = (i) => {
32
+ let url = getSrc(i.src);
33
+ if (url) {
34
+ return url;
35
+ }
36
+ url = getName(i.name, i.icon, i.mode, i.ios, i.md);
37
+ if (url) {
38
+ return getNamedUrl(url);
39
+ }
40
+ if (i.icon) {
41
+ url = getSrc(i.icon);
42
+ if (url) {
43
+ return url;
44
+ }
45
+ url = getSrc(i.icon[i.mode]);
46
+ if (url) {
47
+ return url;
48
+ }
49
+ }
50
+ return null;
51
+ };
52
+ const getNamedUrl = (iconName) => {
53
+ const url = getIconMap().get(iconName);
54
+ if (url) {
55
+ return url;
56
+ }
57
+ return index.getAssetPath(`svg/${iconName}.svg`);
58
+ };
59
+ const getName = (iconName, icon, mode, ios, md) => {
60
+ // default to "md" if somehow the mode wasn't set
61
+ mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
62
+ // if an icon was passed in using the ios or md attributes
63
+ // set the iconName to whatever was passed in
64
+ if (ios && mode === 'ios') {
65
+ iconName = toLower(ios);
66
+ }
67
+ else if (md && mode === 'md') {
68
+ iconName = toLower(md);
69
+ }
70
+ else {
71
+ if (!iconName && icon && !isSrc(icon)) {
72
+ iconName = icon;
73
+ }
74
+ if (isStr(iconName)) {
75
+ iconName = toLower(iconName);
76
+ }
77
+ }
78
+ if (!isStr(iconName) || iconName.trim() === '') {
79
+ return null;
80
+ }
81
+ // only allow alpha characters and dash
82
+ const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
83
+ if (invalidChars !== '') {
84
+ return null;
85
+ }
86
+ return iconName;
87
+ };
88
+ const getSrc = (src) => {
89
+ if (isStr(src)) {
90
+ src = src.trim();
91
+ if (isSrc(src)) {
92
+ return src;
93
+ }
94
+ }
95
+ return null;
96
+ };
97
+ const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
98
+ const isStr = (val) => typeof val === 'string';
99
+ const toLower = (val) => val.toLowerCase();
100
+ /**
101
+ * Elements inside of web components sometimes need to inherit global attributes
102
+ * set on the host. For example, the inner input in `ion-input` should inherit
103
+ * the `title` attribute that developers set directly on `ion-input`. This
104
+ * helper function should be called in componentWillLoad and assigned to a variable
105
+ * that is later used in the render function.
106
+ *
107
+ * This does not need to be reactive as changing attributes on the host element
108
+ * does not trigger a re-render.
109
+ */
110
+ const inheritAttributes = (el, attributes = []) => {
111
+ const attributeObject = {};
112
+ attributes.forEach(attr => {
113
+ if (el.hasAttribute(attr)) {
114
+ const value = el.getAttribute(attr);
115
+ if (value !== null) {
116
+ attributeObject[attr] = el.getAttribute(attr);
117
+ }
118
+ el.removeAttribute(attr);
119
+ }
120
+ });
121
+ return attributeObject;
122
+ };
123
+
124
+ const validateContent = (svgContent) => {
125
+ const div = document.createElement('div');
126
+ div.innerHTML = svgContent;
127
+ // setup this way to ensure it works on our buddy IE
128
+ for (let i = div.childNodes.length - 1; i >= 0; i--) {
129
+ if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
130
+ div.removeChild(div.childNodes[i]);
131
+ }
132
+ }
133
+ // must only have 1 root element
134
+ const svgElm = div.firstElementChild;
135
+ if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
136
+ const svgClass = svgElm.getAttribute('class') || '';
137
+ svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
138
+ // root element must be an svg
139
+ // lets double check we've got valid elements
140
+ // do not allow scripts
141
+ if (isValid(svgElm)) {
142
+ return div.innerHTML;
143
+ }
144
+ }
145
+ return '';
146
+ };
147
+ const isValid = (elm) => {
148
+ if (elm.nodeType === 1) {
149
+ if (elm.nodeName.toLowerCase() === 'script') {
150
+ return false;
151
+ }
152
+ for (let i = 0; i < elm.attributes.length; i++) {
153
+ const val = elm.attributes[i].value;
154
+ if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {
155
+ return false;
156
+ }
157
+ }
158
+ for (let i = 0; i < elm.childNodes.length; i++) {
159
+ if (!isValid(elm.childNodes[i])) {
160
+ return false;
161
+ }
162
+ }
163
+ }
164
+ return true;
165
+ };
166
+
167
+ const ioniconContent = new Map();
168
+ const requests = new Map();
169
+ const getSvgContent = (url, sanitize) => {
170
+ // see if we already have a request for this url
171
+ let req = requests.get(url);
172
+ if (!req) {
173
+ if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {
174
+ // we don't already have a request
175
+ req = fetch(url).then((rsp) => {
176
+ if (rsp.ok) {
177
+ return rsp.text().then((svgContent) => {
178
+ if (svgContent && sanitize !== false) {
179
+ svgContent = validateContent(svgContent);
180
+ }
181
+ ioniconContent.set(url, svgContent || '');
182
+ });
183
+ }
184
+ ioniconContent.set(url, '');
185
+ });
186
+ // cache for the same requests
187
+ requests.set(url, req);
188
+ }
189
+ else {
190
+ // set to empty for ssr scenarios and resolve promise
191
+ ioniconContent.set(url, '');
192
+ return Promise.resolve();
193
+ }
194
+ }
195
+ return req;
196
+ };
197
+
198
+ const iconCss = ":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";
199
+
200
+ const Icon = class {
201
+ constructor(hostRef) {
202
+ index.registerInstance(this, hostRef);
203
+ this.iconName = null;
204
+ this.inheritedAttributes = {};
205
+ this.isVisible = false;
206
+ /**
207
+ * The mode determines which platform styles to use.
208
+ */
209
+ this.mode = getIonMode();
210
+ /**
211
+ * If enabled, ion-icon will be loaded lazily when it's visible in the viewport.
212
+ * Default, `false`.
213
+ */
214
+ this.lazy = false;
215
+ /**
216
+ * When set to `false`, SVG content that is HTTP fetched will not be checked
217
+ * if the response SVG content has any `<script>` elements, or any attributes
218
+ * that start with `on`, such as `onclick`.
219
+ * @default true
220
+ */
221
+ this.sanitize = true;
222
+ this.hasAriaHidden = () => {
223
+ const { el } = this;
224
+ return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';
225
+ };
226
+ }
227
+ componentWillLoad() {
228
+ this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
229
+ }
230
+ connectedCallback() {
231
+ // purposely do not return the promise here because loading
232
+ // the svg file should not hold up loading the app
233
+ // only load the svg if it's visible
234
+ this.waitUntilVisible(this.el, '50px', () => {
235
+ this.isVisible = true;
236
+ this.loadIcon();
237
+ });
238
+ }
239
+ disconnectedCallback() {
240
+ if (this.io) {
241
+ this.io.disconnect();
242
+ this.io = undefined;
243
+ }
244
+ }
245
+ waitUntilVisible(el, rootMargin, cb) {
246
+ if (this.lazy && typeof window !== 'undefined' && window.IntersectionObserver) {
247
+ const io = (this.io = new window.IntersectionObserver((data) => {
248
+ if (data[0].isIntersecting) {
249
+ io.disconnect();
250
+ this.io = undefined;
251
+ cb();
252
+ }
253
+ }, { rootMargin }));
254
+ io.observe(el);
255
+ }
256
+ else {
257
+ // browser doesn't support IntersectionObserver
258
+ // so just fallback to always show it
259
+ cb();
260
+ }
261
+ }
262
+ loadIcon() {
263
+ if (this.isVisible) {
264
+ const url = getUrl$1(this);
265
+ if (url) {
266
+ if (ioniconContent.has(url)) {
267
+ // sync if it's already loaded
268
+ this.svgContent = ioniconContent.get(url);
269
+ }
270
+ else {
271
+ // async if it hasn't been loaded
272
+ getSvgContent(url, this.sanitize).then(() => (this.svgContent = ioniconContent.get(url)));
273
+ }
274
+ }
275
+ }
276
+ const label = this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
277
+ /**
278
+ * Come up with a default label
279
+ * in case user does not provide their own.
280
+ */
281
+ if (label) {
282
+ this.ariaLabel = label.replace(/\-/g, ' ');
283
+ }
284
+ }
285
+ render() {
286
+ const { iconName, ariaLabel, inheritedAttributes } = this;
287
+ const mode = this.mode || 'md';
288
+ const flipRtl = this.flipRtl ||
289
+ (iconName &&
290
+ (iconName.indexOf('arrow') > -1 || iconName.indexOf('chevron') > -1) &&
291
+ this.flipRtl !== false);
292
+ /**
293
+ * Only set the aria-label if a) we have generated
294
+ * one for the icon and if aria-hidden is not set to "true".
295
+ * If developer wants to set their own aria-label, then
296
+ * inheritedAttributes down below will override whatever
297
+ * default label we have set.
298
+ */
299
+ return (index.h(index.Host, Object.assign({ "aria-label": ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null, role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': !!flipRtl && this.el.ownerDocument.dir === 'rtl' }) }, inheritedAttributes), this.svgContent ? (index.h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (index.h("div", { class: "icon-inner" }))));
300
+ }
301
+ static get assetsDirs() { return ["svg"]; }
302
+ get el() { return index.getElement(this); }
303
+ static get watchers() { return {
304
+ "name": ["loadIcon"],
305
+ "src": ["loadIcon"],
306
+ "icon": ["loadIcon"]
307
+ }; }
308
+ };
309
+ const getIonMode = () => (typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
310
+ const createColorClasses = (color) => {
311
+ return color
312
+ ? {
313
+ 'ion-color': true,
314
+ [`ion-color-${color}`]: true,
315
+ }
316
+ : null;
317
+ };
318
+ Icon.style = iconCss;
319
+
320
+ const itemIosCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native,:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-bottom{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--inner-padding-end);padding-top:0;padding-bottom:0;display:flex;justify-content:space-between}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-bottom{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--inner-padding-end);padding-inline-end:var(--inner-padding-end)}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;top:0;bottom:0;border-radius:inherit;position:absolute;width:100%;height:100%;transform:scaleX(0);transition:transform 200ms, border-bottom-width 200ms;z-index:2;box-sizing:border-box;pointer-events:none}:host(.item-interactive.item-has-focus) .item-native{caret-color:var(--highlight-background)}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=helper]){display:none}::slotted([slot=error]){display:none;color:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=error]){display:block}:host(:not(.item-label)) ::slotted(ion-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted([slot=helper]),::slotted([slot=error]),.item-counter{padding-top:5px;font-size:12px;z-index:1}.item-counter{margin-left:auto;color:var(--ion-color-step-550, #737373);white-space:nowrap;padding-inline-start:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-counter{margin-left:unset;-webkit-margin-start:auto;margin-inline-start:auto}}@media (prefers-reduced-motion: reduce){.item-highlight,.item-inner-highlight{transition:none}}:host{--min-height:44px;--transition:background-color 200ms linear, opacity 200ms linear;--padding-start:20px;--inner-padding-end:10px;--inner-border-width:0px 0px 0.55px 0px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:#000;--background-focused:#000;--background-hover:currentColor;--background-activated-opacity:.12;--background-focused-opacity:.15;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, #c8c7cc)));--color:var(--ion-item-color, var(--ion-text-color, #000));--highlight-height:0px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);--bottom-padding-start:0px;font-size:17px}:host(.ion-activated){--transition:none}:host(.ion-color.ion-focused) .item-native::after{background:#000;opacity:0.15}:host(.ion-color.ion-activated) .item-native::after{background:#000;opacity:0.12}:host(.item-interactive){--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-full){--border-width:0px 0px 0.55px 0px;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0px 0px 0.55px 0px;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0px;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0px;--show-inset-highlight:0}.item-highlight,.item-inner-highlight{transition:none}:host(.item-has-focus) .item-inner-highlight,:host(.item-has-focus) .item-highlight{border-top:none;border-right:none;border-left:none}::slotted([slot=start]){margin-left:0;margin-right:20px;margin-top:2px;margin-bottom:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:20px;margin-inline-end:20px}}::slotted([slot=end]){margin-left:10px;margin-right:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}::slotted(.button-small){--padding-top:0px;--padding-bottom:0px;--padding-start:.5em;--padding-end:.5em;height:24px;font-size:13px}::slotted(ion-avatar){width:36px;height:36px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:10px;margin-right:10px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:0px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0px;margin-inline-start:0px}}::slotted(ion-label){margin-left:0;margin-right:8px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-label){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px}}:host(.item-label-floating),:host(.item-label-stacked){--min-height:68px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0px}:host(.item-label-fixed) ::slotted(ion-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:0}";
321
+
322
+ const itemMdCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native,:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-bottom{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--inner-padding-end);padding-top:0;padding-bottom:0;display:flex;justify-content:space-between}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-bottom{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--inner-padding-end);padding-inline-end:var(--inner-padding-end)}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;top:0;bottom:0;border-radius:inherit;position:absolute;width:100%;height:100%;transform:scaleX(0);transition:transform 200ms, border-bottom-width 200ms;z-index:2;box-sizing:border-box;pointer-events:none}:host(.item-interactive.item-has-focus) .item-native{caret-color:var(--highlight-background)}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=helper]){display:none}::slotted([slot=error]){display:none;color:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=error]){display:block}:host(:not(.item-label)) ::slotted(ion-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted([slot=helper]),::slotted([slot=error]),.item-counter{padding-top:5px;font-size:12px;z-index:1}.item-counter{margin-left:auto;color:var(--ion-color-step-550, #737373);white-space:nowrap;padding-inline-start:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-counter{margin-left:unset;-webkit-margin-start:auto;margin-inline-start:auto}}@media (prefers-reduced-motion: reduce){.item-highlight,.item-inner-highlight{transition:none}}:host{--min-height:48px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--color:var(--ion-item-color, var(--ion-text-color, #000));--transition:opacity 15ms linear, background-color 15ms linear;--padding-start:16px;--inner-padding-end:16px;--inner-border-width:0 0 1px 0;--highlight-height:1px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);font-size:16px;font-weight:normal;text-transform:none}:host(.item-fill-outline){--highlight-height:2px}:host(.item-fill-none.item-interactive.ion-focus) .item-highlight,:host(.item-fill-none.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-highlight{transform:scaleX(1);border-width:0 0 var(--full-highlight-height) 0;border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-none.item-interactive.ion-focus) .item-native,:host(.item-fill-none.item-interactive.item-has-focus) .item-native,:host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-native{border-bottom-color:var(--highlight-background)}:host(.item-fill-outline.item-interactive.ion-focus) .item-highlight,:host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight{transform:scaleX(1)}:host(.item-fill-outline.item-interactive.ion-focus) .item-highlight,:host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-highlight{border-width:var(--full-highlight-height);border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-native{border-color:var(--highlight-background)}:host(.item-fill-solid.item-interactive.ion-focus) .item-highlight,:host(.item-fill-solid.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-highlight{transform:scaleX(1);border-width:0 0 var(--full-highlight-height) 0;border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-solid.item-interactive.ion-focus) .item-native,:host(.item-fill-solid.item-interactive.item-has-focus) .item-native,:host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-native{border-bottom-color:var(--highlight-background)}:host(.ion-color.ion-activated) .item-native::after{background:transparent}:host(.item-has-focus) .item-native{caret-color:var(--highlight-color-focused)}:host(.item-interactive){--border-width:0 0 1px 0;--inner-border-width:0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-full){--border-width:0 0 1px 0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0 0 1px 0;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0;--show-inset-highlight:0}:host(.item-fill-outline) .item-highlight{--position-offset:calc(-1 * var(--border-width));left:var(--position-offset);top:var(--position-offset);width:calc(100% + 2 * var(--border-width));height:calc(100% + 2 * var(--border-width));transition:none}:host-context([dir=rtl]):host(.item-fill-outline) .item-highlight,:host-context([dir=rtl]).item-fill-outline .item-highlight{left:unset;right:unset;right:var(--position-offset)}:host(.item-fill-outline.ion-focused) .item-native,:host(.item-fill-outline.item-has-focus) .item-native{border-color:transparent}:host(.item-multi-line) ::slotted([slot=start]),:host(.item-multi-line) ::slotted([slot=end]){margin-top:16px;margin-bottom:16px;align-self:flex-start}::slotted([slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}:host(.item-fill-solid) ::slotted(ion-icon[slot=start]),:host(.item-fill-outline) ::slotted(ion-icon[slot=start]){margin-right:8px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-fill-solid) ::slotted(ion-icon[slot=start]),:host(.item-fill-outline) ::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:8px;margin-inline-end:8px}}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]:not([slot=helper]):not([slot=error])){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:10px;margin-bottom:10px}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}:host(.item-label-fixed) ::slotted(ion-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:8px}:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}::slotted(.button-small){--padding-top:0;--padding-bottom:0;--padding-start:.6em;--padding-end:.6em;height:25px;font-size:12px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:55px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0}:host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked),:host(.ion-focused:not(.ion-color)) ::slotted(.label-floating),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating){color:var(--ion-color-primary, #3880ff)}:host(.ion-color){--highlight-color-focused:var(--ion-color-contrast)}:host(.item-label-color){--highlight-color-focused:var(--ion-color-base)}:host(.item-fill-solid.ion-color),:host(.item-fill-outline.ion-color){--highlight-color-focused:var(--ion-color-base)}:host(.item-fill-solid){--background:var(--ion-color-step-50, #f2f2f2);--background-hover:var(--ion-color-step-100, #e6e6e6);--background-focused:var(--ion-color-step-150, #d9d9d9);--border-width:0 0 1px 0;--inner-border-width:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.item-fill-solid),:host-context([dir=rtl]).item-fill-solid{border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host(.item-fill-solid) .item-native{--border-color:var(--ion-color-step-500, gray)}:host(.item-fill-solid.ion-focused) .item-native,:host(.item-fill-solid.item-has-focus) .item-native{--background:var(--background-focused)}:host(.item-fill-solid.item-shape-round){border-top-left-radius:16px;border-top-right-radius:16px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.item-fill-solid.item-shape-round),:host-context([dir=rtl]).item-fill-solid.item-shape-round{border-top-left-radius:16px;border-top-right-radius:16px;border-bottom-right-radius:0;border-bottom-left-radius:0}@media (any-hover: hover){:host(.item-fill-solid:hover) .item-native{--background:var(--background-hover);--border-color:var(--ion-color-step-750, #404040)}}:host(.item-fill-outline){--ripple-color:transparent;--background-focused:transparent;--background-hover:transparent;--border-color:var(--ion-color-step-500, gray);--border-width:1px;border:none;overflow:visible}:host(.item-fill-outline) .item-native{--native-padding-left:16px;border-radius:4px}:host(.item-fill-outline.item-shape-round) .item-native{--inner-padding-start:16px;border-radius:28px}:host(.item-fill-outline.item-shape-round) .item-bottom{padding-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-fill-outline.item-shape-round) .item-bottom{padding-left:unset;-webkit-padding-start:32px;padding-inline-start:32px}}:host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-textarea:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-textarea:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-textarea:not(:first-child)){transform:translateY(-14px)}@media (any-hover: hover){:host(.item-fill-outline:hover) .item-native{--border-color:var(--ion-color-step-750, #404040)}}.item-counter{letter-spacing:0.0333333333em}";
323
+
324
+ const Item = class {
325
+ constructor(hostRef) {
326
+ index.registerInstance(this, hostRef);
327
+ this.labelColorStyles = {};
328
+ this.itemStyles = new Map();
329
+ this.multipleInputs = false;
330
+ this.focusable = true;
331
+ /**
332
+ * If `true`, a button tag will be rendered and the item will be tappable.
333
+ */
334
+ this.button = false;
335
+ /**
336
+ * The icon to use when `detail` is set to `true`.
337
+ */
338
+ this.detailIcon = index$1.chevronForward;
339
+ /**
340
+ * If `true`, the user cannot interact with the item.
341
+ */
342
+ this.disabled = false;
343
+ /**
344
+ * If `true`, a character counter will display the ratio of characters used and the total character limit. Only applies when the `maxlength` property is set on the inner `ion-input` or `ion-textarea`.
345
+ */
346
+ this.counter = false;
347
+ /**
348
+ * When using a router, it specifies the transition direction when navigating to
349
+ * another page using `href`.
350
+ */
351
+ this.routerDirection = 'forward';
352
+ /**
353
+ * The type of the button. Only used when an `onclick` or `button` property is present.
354
+ */
355
+ this.type = 'button';
356
+ }
357
+ counterFormatterChanged() {
358
+ this.updateCounterOutput(this.getFirstInput());
359
+ }
360
+ handleIonChange(ev) {
361
+ if (this.counter && ev.target === this.getFirstInput()) {
362
+ this.updateCounterOutput(ev.target);
363
+ }
364
+ }
365
+ labelColorChanged(ev) {
366
+ const { color } = this;
367
+ // There will be a conflict with item color if
368
+ // we apply the label color to item, so we ignore
369
+ // the label color if the user sets a color on item
370
+ if (color === undefined) {
371
+ this.labelColorStyles = ev.detail;
372
+ }
373
+ }
374
+ itemStyle(ev) {
375
+ ev.stopPropagation();
376
+ const tagName = ev.target.tagName;
377
+ const updatedStyles = ev.detail;
378
+ const newStyles = {};
379
+ const childStyles = this.itemStyles.get(tagName) || {};
380
+ let hasStyleChange = false;
381
+ Object.keys(updatedStyles).forEach((key) => {
382
+ if (updatedStyles[key]) {
383
+ const itemKey = `item-${key}`;
384
+ if (!childStyles[itemKey]) {
385
+ hasStyleChange = true;
386
+ }
387
+ newStyles[itemKey] = true;
388
+ }
389
+ });
390
+ if (!hasStyleChange && Object.keys(newStyles).length !== Object.keys(childStyles).length) {
391
+ hasStyleChange = true;
392
+ }
393
+ if (hasStyleChange) {
394
+ this.itemStyles.set(tagName, newStyles);
395
+ index.forceUpdate(this);
396
+ }
397
+ }
398
+ connectedCallback() {
399
+ if (this.counter) {
400
+ this.updateCounterOutput(this.getFirstInput());
401
+ }
402
+ this.hasStartEl();
403
+ }
404
+ componentDidUpdate() {
405
+ // Do not use @Listen here to avoid making all items
406
+ // appear as clickable to screen readers
407
+ // https://github.com/ionic-team/ionic-framework/issues/22011
408
+ const input = this.getFirstInput();
409
+ if (input && !this.clickListener) {
410
+ this.clickListener = (ev) => this.delegateFocus(ev, input);
411
+ this.el.addEventListener('click', this.clickListener);
412
+ }
413
+ }
414
+ disconnectedCallback() {
415
+ const input = this.getFirstInput();
416
+ if (input && this.clickListener) {
417
+ this.el.removeEventListener('click', this.clickListener);
418
+ this.clickListener = undefined;
419
+ }
420
+ }
421
+ componentDidLoad() {
422
+ helpers.raf(() => {
423
+ this.setMultipleInputs();
424
+ this.focusable = this.isFocusable();
425
+ });
426
+ }
427
+ // If the item contains multiple clickable elements and/or inputs, then the item
428
+ // should not have a clickable input cover over the entire item to prevent
429
+ // interfering with their individual click events
430
+ setMultipleInputs() {
431
+ // The following elements have a clickable cover that is relative to the entire item
432
+ const covers = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
433
+ // The following elements can accept focus alongside the previous elements
434
+ // therefore if these elements are also a child of item, we don't want the
435
+ // input cover on top of those interfering with their clicks
436
+ const inputs = this.el.querySelectorAll('ion-input, ion-range, ion-searchbar, ion-segment, ion-textarea, ion-toggle');
437
+ // The following elements should also stay clickable when an input with cover is present
438
+ const clickables = this.el.querySelectorAll('ion-anchor, ion-button, a, button');
439
+ // Check for multiple inputs to change the position of the input cover to relative
440
+ // for all of the covered inputs above
441
+ this.multipleInputs =
442
+ covers.length + inputs.length > 1 ||
443
+ covers.length + clickables.length > 1 ||
444
+ (covers.length > 0 && this.isClickable());
445
+ }
446
+ // If the item contains an input including a checkbox, datetime, select, or radio
447
+ // then the item will have a clickable input cover that covers the item
448
+ // that should get the hover, focused and activated states UNLESS it has multiple
449
+ // inputs, then those need to individually get each click
450
+ hasCover() {
451
+ const inputs = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
452
+ return inputs.length === 1 && !this.multipleInputs;
453
+ }
454
+ // If the item has an href or button property it will render a native
455
+ // anchor or button that is clickable
456
+ isClickable() {
457
+ return this.href !== undefined || this.button;
458
+ }
459
+ canActivate() {
460
+ return this.isClickable() || this.hasCover();
461
+ }
462
+ isFocusable() {
463
+ const focusableChild = this.el.querySelector('.ion-focusable');
464
+ return this.canActivate() || focusableChild !== null;
465
+ }
466
+ getFirstInput() {
467
+ const inputs = this.el.querySelectorAll('ion-input, ion-textarea');
468
+ return inputs[0];
469
+ }
470
+ // This is needed for WebKit due to a delegatesFocus bug where
471
+ // clicking on the left padding of an item is not focusing the input
472
+ // but is opening the keyboard. It will no longer be needed with
473
+ // iOS 14.
474
+ delegateFocus(ev, input) {
475
+ const clickedItem = ev.target.tagName === 'ION-ITEM';
476
+ let firstActive = false;
477
+ // If the first input is the same as the active element we need
478
+ // to focus the first input again, but if the active element
479
+ // is another input inside of the item we shouldn't switch focus
480
+ if (document.activeElement) {
481
+ firstActive = input.querySelector('input, textarea') === document.activeElement;
482
+ }
483
+ // Only focus the first input if we clicked on an ion-item
484
+ // and the first input exists
485
+ if (clickedItem && (firstActive || !this.multipleInputs)) {
486
+ input.fireFocusEvents = false;
487
+ input.setBlur();
488
+ input.setFocus();
489
+ helpers.raf(() => {
490
+ input.fireFocusEvents = true;
491
+ });
492
+ }
493
+ }
494
+ updateCounterOutput(inputEl) {
495
+ var _a, _b;
496
+ const { counter, counterFormatter, defaultCounterFormatter } = this;
497
+ if (counter && !this.multipleInputs && (inputEl === null || inputEl === void 0 ? void 0 : inputEl.maxlength) !== undefined) {
498
+ const length = (_b = (_a = inputEl === null || inputEl === void 0 ? void 0 : inputEl.value) === null || _a === void 0 ? void 0 : _a.toString().length) !== null && _b !== void 0 ? _b : 0;
499
+ if (counterFormatter === undefined) {
500
+ this.counterString = defaultCounterFormatter(length, inputEl.maxlength);
501
+ }
502
+ else {
503
+ try {
504
+ this.counterString = counterFormatter(length, inputEl.maxlength);
505
+ }
506
+ catch (e) {
507
+ index$2.printIonError('Exception in provided `counterFormatter`.', e);
508
+ // Fallback to the default counter formatter when an exception happens
509
+ this.counterString = defaultCounterFormatter(length, inputEl.maxlength);
510
+ }
511
+ }
512
+ }
513
+ }
514
+ defaultCounterFormatter(length, maxlength) {
515
+ return `${length} / ${maxlength}`;
516
+ }
517
+ hasStartEl() {
518
+ const startEl = this.el.querySelector('[slot="start"]');
519
+ if (startEl !== null) {
520
+ this.el.classList.add('item-has-start-slot');
521
+ }
522
+ }
523
+ render() {
524
+ const { counterString, detail, detailIcon, download, fill, labelColorStyles, lines, disabled, href, rel, shape, target, routerAnimation, routerDirection, } = this;
525
+ const childStyles = {};
526
+ const mode = ionicGlobal.getIonMode(this);
527
+ const clickable = this.isClickable();
528
+ const canActivate = this.canActivate();
529
+ const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
530
+ const attrs = TagType === 'button'
531
+ ? { type: this.type }
532
+ : {
533
+ download,
534
+ href,
535
+ rel,
536
+ target,
537
+ };
538
+ // Only set onClick if the item is clickable to prevent screen
539
+ // readers from reading all items as clickable
540
+ const clickFn = clickable
541
+ ? {
542
+ onClick: (ev) => {
543
+ theme.openURL(href, ev, routerDirection, routerAnimation);
544
+ },
545
+ }
546
+ : {};
547
+ const showDetail = detail !== undefined ? detail : mode === 'ios' && clickable;
548
+ this.itemStyles.forEach((value) => {
549
+ Object.assign(childStyles, value);
550
+ });
551
+ const ariaDisabled = disabled || childStyles['item-interactive-disabled'] ? 'true' : null;
552
+ const fillValue = fill || 'none';
553
+ const inList = theme.hostContext('ion-list', this.el);
554
+ return (index.h(index.Host, { "aria-disabled": ariaDisabled, class: Object.assign(Object.assign(Object.assign({}, childStyles), labelColorStyles), theme.createColorClasses(this.color, {
555
+ item: true,
556
+ [mode]: true,
557
+ [`item-lines-${lines}`]: lines !== undefined,
558
+ [`item-fill-${fillValue}`]: true,
559
+ [`item-shape-${shape}`]: shape !== undefined,
560
+ 'item-disabled': disabled,
561
+ 'in-list': inList,
562
+ 'item-multiple-inputs': this.multipleInputs,
563
+ 'ion-activatable': canActivate,
564
+ 'ion-focusable': this.focusable,
565
+ 'item-rtl': document.dir === 'rtl',
566
+ })), role: inList ? 'listitem' : null }, index.h(TagType, Object.assign({}, attrs, { class: "item-native", part: "native", disabled: disabled }, clickFn), index.h("slot", { name: "start" }), index.h("div", { class: "item-inner" }, index.h("div", { class: "input-wrapper" }, index.h("slot", null)), index.h("slot", { name: "end" }), showDetail && (index.h("ion-icon", { icon: detailIcon, lazy: false, class: "item-detail-icon", part: "detail-icon", "aria-hidden": "true", "flip-rtl": detailIcon === index$1.chevronForward })), index.h("div", { class: "item-inner-highlight" })), canActivate && mode === 'md' && index.h("ion-ripple-effect", null), index.h("div", { class: "item-highlight" })), index.h("div", { class: "item-bottom" }, index.h("slot", { name: "error" }), index.h("slot", { name: "helper" }), counterString && index.h("ion-note", { class: "item-counter" }, counterString))));
567
+ }
568
+ static get delegatesFocus() { return true; }
569
+ get el() { return index.getElement(this); }
570
+ static get watchers() { return {
571
+ "counterFormatter": ["counterFormatterChanged"]
572
+ }; }
573
+ };
574
+ Item.style = {
575
+ ios: itemIosCss,
576
+ md: itemMdCss
577
+ };
578
+
579
+ const noteIosCss = ":host{color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-350, #a6a6a6)}";
580
+
581
+ const noteMdCss = ":host{color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-600, #666666);font-size:14px}";
582
+
583
+ const Note = class {
584
+ constructor(hostRef) {
585
+ index.registerInstance(this, hostRef);
586
+ }
587
+ render() {
588
+ const mode = ionicGlobal.getIonMode(this);
589
+ return (index.h(index.Host, { class: theme.createColorClasses(this.color, {
590
+ [mode]: true,
591
+ }) }, index.h("slot", null)));
592
+ }
593
+ };
594
+ Note.style = {
595
+ ios: noteIosCss,
596
+ md: noteMdCss
597
+ };
598
+
599
+ const rangeIosCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:flex;position:relative;flex:3;align-items:center;font-family:var(--ion-font-family, inherit);user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:grab;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);text-align:center;box-sizing:border-box}.range-knob-handle{left:0;top:calc((var(--height) - var(--knob-handle-size)) / 2);margin-left:calc(0px - var(--knob-handle-size) / 2);position:absolute;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}[dir=rtl] .range-knob-handle,:host-context([dir=rtl]) .range-knob-handle{left:unset;right:unset;right:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.range-knob-handle{margin-left:unset;-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2)}}[dir=rtl] .range-knob-handle,:host-context([dir=rtl]) .range-knob-handle{left:unset}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar{border-radius:var(--bar-border-radius);left:0;top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}[dir=rtl] .range-bar,:host-context([dir=rtl]) .range-bar{left:unset;right:unset;right:0}[dir=rtl] .range-bar,:host-context([dir=rtl]) .range-bar{left:unset}.range-knob{border-radius:var(--knob-border-radius);left:calc(50% - var(--knob-size) / 2);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);box-shadow:var(--knob-box-shadow);z-index:2;pointer-events:none}[dir=rtl] .range-knob,:host-context([dir=rtl]) .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}[dir=rtl] .range-knob,:host-context([dir=rtl]) .range-knob{left:unset}:host(.range-pressed) .range-bar-active{will-change:left, right}:host(.in-item){width:100%}:host(.in-item) ::slotted(ion-label){align-self:center}:host{--knob-border-radius:50%;--knob-background:#ffffff;--knob-box-shadow:0 3px 1px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.13), 0 0 0 1px rgba(0, 0, 0, 0.02);--knob-size:28px;--bar-height:2px;--bar-background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.1);--bar-background-active:var(--ion-color-primary, #3880ff);--bar-border-radius:0;--height:42px;padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-tick-active{background:var(--ion-color-base)}::slotted([slot=start]){margin-left:0;margin-right:16px;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted([slot=end]){margin-left:16px;margin-right:0;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}}:host(.range-has-pin){padding-top:20px}.range-bar-active{bottom:0;width:auto;background:var(--bar-background-active)}.range-tick{margin-left:-1px;border-radius:0;position:absolute;top:18px;width:2px;height:8px;background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.1);pointer-events:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.range-tick{margin-left:unset;-webkit-margin-start:-1px;margin-inline-start:-1px}}.range-tick-active{background:var(--bar-background-active)}.range-pin{transform:translate3d(0, 28px, 0) scale(0.01);padding-left:8px;padding-right:8px;padding-top:8px;padding-bottom:8px;display:inline-block;position:relative;top:-20px;min-width:28px;transition:transform 120ms ease;background:transparent;color:var(--ion-text-color, #000);font-size:12px;text-align:center}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.range-pin{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}.range-knob-pressed .range-pin{transform:translate3d(0, 0, 0) scale(1)}:host(.range-disabled){opacity:0.5}";
600
+
601
+ const rangeMdCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:flex;position:relative;flex:3;align-items:center;font-family:var(--ion-font-family, inherit);user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:grab;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);text-align:center;box-sizing:border-box}.range-knob-handle{left:0;top:calc((var(--height) - var(--knob-handle-size)) / 2);margin-left:calc(0px - var(--knob-handle-size) / 2);position:absolute;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}[dir=rtl] .range-knob-handle,:host-context([dir=rtl]) .range-knob-handle{left:unset;right:unset;right:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.range-knob-handle{margin-left:unset;-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2)}}[dir=rtl] .range-knob-handle,:host-context([dir=rtl]) .range-knob-handle{left:unset}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar{border-radius:var(--bar-border-radius);left:0;top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}[dir=rtl] .range-bar,:host-context([dir=rtl]) .range-bar{left:unset;right:unset;right:0}[dir=rtl] .range-bar,:host-context([dir=rtl]) .range-bar{left:unset}.range-knob{border-radius:var(--knob-border-radius);left:calc(50% - var(--knob-size) / 2);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);box-shadow:var(--knob-box-shadow);z-index:2;pointer-events:none}[dir=rtl] .range-knob,:host-context([dir=rtl]) .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}[dir=rtl] .range-knob,:host-context([dir=rtl]) .range-knob{left:unset}:host(.range-pressed) .range-bar-active{will-change:left, right}:host(.in-item){width:100%}:host(.in-item) ::slotted(ion-label){align-self:center}:host{--knob-border-radius:50%;--knob-background:var(--bar-background-active);--knob-box-shadow:none;--knob-size:18px;--bar-height:2px;--bar-background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.26);--bar-background-active:var(--ion-color-primary, #3880ff);--bar-border-radius:0;--height:42px;--pin-background:var(--ion-color-primary, #3880ff);--pin-color:var(--ion-color-primary-contrast, #fff);padding-left:14px;padding-right:14px;padding-top:8px;padding-bottom:8px;font-size:12px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:14px;padding-inline-start:14px;-webkit-padding-end:14px;padding-inline-end:14px}}:host(.ion-color) .range-bar{background:rgba(var(--ion-color-base-rgb), 0.26)}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-knob,:host(.ion-color) .range-pin,:host(.ion-color) .range-pin::before,:host(.ion-color) .range-tick{background:var(--ion-color-base);color:var(--ion-color-contrast)}::slotted([slot=start]){margin-left:0;margin-right:14px;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:14px;margin-inline-end:14px}}::slotted([slot=end]){margin-left:14px;margin-right:0;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:14px;margin-inline-start:14px;-webkit-margin-end:0;margin-inline-end:0}}:host(.range-has-pin){padding-top:28px}.range-bar-active{bottom:0;width:auto;background:var(--bar-background-active)}.range-knob{transform:scale(0.67);transition-duration:120ms;transition-property:transform, background-color, border;transition-timing-function:ease;z-index:2}.range-tick{position:absolute;top:calc((var(--height) - var(--bar-height)) / 2);width:var(--bar-height);height:var(--bar-height);background:var(--bar-background-active);z-index:1;pointer-events:none}.range-tick-active{background:transparent}.range-pin{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;border-radius:50%;transform:translate3d(0, 0, 0) scale(0.01);display:inline-block;position:relative;min-width:28px;height:28px;transition:transform 120ms ease, background 120ms ease;background:var(--pin-background);color:var(--pin-color);text-align:center}.range-pin::before{left:50%;top:3px;margin-left:-13px;border-radius:50% 50% 50% 0;position:absolute;width:26px;height:26px;transform:rotate(-45deg);transition:background 120ms ease;background:var(--pin-background);content:\"\";z-index:-1}[dir=rtl] .range-pin::before,:host-context([dir=rtl]) .range-pin::before{left:unset;right:unset;right:50%}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.range-pin::before{margin-left:unset;-webkit-margin-start:-13px;margin-inline-start:-13px}}[dir=rtl] .range-pin::before,:host-context([dir=rtl]) .range-pin::before{left:unset}.range-knob-pressed .range-pin{transform:translate3d(0, -24px, 0) scale(1)}:host(:not(.range-has-pin)) .range-knob-pressed .range-knob{transform:scale(1)}:host(.range-disabled) .range-bar-active,:host(.range-disabled) .range-bar,:host(.range-disabled) .range-tick{background-color:var(--ion-color-step-250, #bfbfbf)}:host(.range-disabled) .range-knob{transform:scale(0.55);outline:5px solid #fff;background-color:var(--ion-color-step-250, #bfbfbf)}";
602
+
603
+ const Range = class {
604
+ constructor(hostRef) {
605
+ index.registerInstance(this, hostRef);
606
+ this.ionChange = index.createEvent(this, "ionChange", 7);
607
+ this.ionStyle = index.createEvent(this, "ionStyle", 7);
608
+ this.ionFocus = index.createEvent(this, "ionFocus", 7);
609
+ this.ionBlur = index.createEvent(this, "ionBlur", 7);
610
+ this.ionKnobMoveStart = index.createEvent(this, "ionKnobMoveStart", 7);
611
+ this.ionKnobMoveEnd = index.createEvent(this, "ionKnobMoveEnd", 7);
612
+ this.didLoad = false;
613
+ this.noUpdate = false;
614
+ this.hasFocus = false;
615
+ this.inheritedAttributes = {};
616
+ this.contentEl = null;
617
+ this.initialContentScrollY = true;
618
+ this.ratioA = 0;
619
+ this.ratioB = 0;
620
+ /**
621
+ * How long, in milliseconds, to wait to trigger the
622
+ * `ionChange` event after each change in the range value.
623
+ * This also impacts form bindings such as `ngModel` or `v-model`.
624
+ */
625
+ this.debounce = 0;
626
+ // TODO: In Ionic Framework v6 this should initialize to this.rangeId like the other form components do.
627
+ /**
628
+ * The name of the control, which is submitted with the form data.
629
+ */
630
+ this.name = '';
631
+ /**
632
+ * Show two knobs.
633
+ */
634
+ this.dualKnobs = false;
635
+ /**
636
+ * Minimum integer value of the range.
637
+ */
638
+ this.min = 0;
639
+ /**
640
+ * Maximum integer value of the range.
641
+ */
642
+ this.max = 100;
643
+ /**
644
+ * If `true`, a pin with integer value is shown when the knob
645
+ * is pressed.
646
+ */
647
+ this.pin = false;
648
+ /**
649
+ * A callback used to format the pin text.
650
+ * By default the pin text is set to `Math.round(value)`.
651
+ */
652
+ this.pinFormatter = (value) => Math.round(value);
653
+ /**
654
+ * If `true`, the knob snaps to tick marks evenly spaced based
655
+ * on the step property value.
656
+ */
657
+ this.snaps = false;
658
+ /**
659
+ * Specifies the value granularity.
660
+ */
661
+ this.step = 1;
662
+ /**
663
+ * If `true`, tick marks are displayed based on the step value.
664
+ * Only applies when `snaps` is `true`.
665
+ */
666
+ this.ticks = true;
667
+ /**
668
+ * If `true`, the user cannot interact with the range.
669
+ */
670
+ this.disabled = false;
671
+ /**
672
+ * the value of the range.
673
+ */
674
+ this.value = 0;
675
+ this.clampBounds = (value) => {
676
+ return helpers.clamp(this.min, value, this.max);
677
+ };
678
+ this.ensureValueInBounds = (value) => {
679
+ if (this.dualKnobs) {
680
+ return {
681
+ lower: this.clampBounds(value.lower),
682
+ upper: this.clampBounds(value.upper),
683
+ };
684
+ }
685
+ else {
686
+ return this.clampBounds(value);
687
+ }
688
+ };
689
+ this.setupGesture = async () => {
690
+ const rangeSlider = this.rangeSlider;
691
+ if (rangeSlider) {
692
+ this.gesture = (await Promise.resolve().then(function () { return require('./index-12082cba.js'); })).createGesture({
693
+ el: rangeSlider,
694
+ gestureName: 'range',
695
+ gesturePriority: 100,
696
+ threshold: 0,
697
+ onStart: (ev) => this.onStart(ev),
698
+ onMove: (ev) => this.onMove(ev),
699
+ onEnd: (ev) => this.onEnd(ev),
700
+ });
701
+ this.gesture.enable(!this.disabled);
702
+ }
703
+ };
704
+ this.handleKeyboard = (knob, isIncrease) => {
705
+ const { ensureValueInBounds } = this;
706
+ let step = this.step;
707
+ step = step > 0 ? step : 1;
708
+ step = step / (this.max - this.min);
709
+ if (!isIncrease) {
710
+ step *= -1;
711
+ }
712
+ if (knob === 'A') {
713
+ this.ratioA = helpers.clamp(0, this.ratioA + step, 1);
714
+ }
715
+ else {
716
+ this.ratioB = helpers.clamp(0, this.ratioB + step, 1);
717
+ }
718
+ this.ionKnobMoveStart.emit({ value: ensureValueInBounds(this.value) });
719
+ this.updateValue();
720
+ this.ionKnobMoveEnd.emit({ value: ensureValueInBounds(this.value) });
721
+ };
722
+ this.onBlur = () => {
723
+ if (this.hasFocus) {
724
+ this.hasFocus = false;
725
+ this.ionBlur.emit();
726
+ this.emitStyle();
727
+ }
728
+ };
729
+ this.onFocus = () => {
730
+ if (!this.hasFocus) {
731
+ this.hasFocus = true;
732
+ this.ionFocus.emit();
733
+ this.emitStyle();
734
+ }
735
+ };
736
+ }
737
+ debounceChanged() {
738
+ this.ionChange = helpers.debounceEvent(this.ionChange, this.debounce);
739
+ }
740
+ minChanged() {
741
+ if (!this.noUpdate) {
742
+ this.updateRatio();
743
+ }
744
+ }
745
+ maxChanged() {
746
+ if (!this.noUpdate) {
747
+ this.updateRatio();
748
+ }
749
+ }
750
+ activeBarStartChanged() {
751
+ const { activeBarStart } = this;
752
+ if (activeBarStart !== undefined) {
753
+ if (activeBarStart > this.max) {
754
+ index$2.printIonWarning(`Range: The value of activeBarStart (${activeBarStart}) is greater than the max (${this.max}). Valid values are greater than or equal to the min value and less than or equal to the max value.`, this.el);
755
+ this.activeBarStart = this.max;
756
+ }
757
+ else if (activeBarStart < this.min) {
758
+ index$2.printIonWarning(`Range: The value of activeBarStart (${activeBarStart}) is less than the min (${this.min}). Valid values are greater than or equal to the min value and less than or equal to the max value.`, this.el);
759
+ this.activeBarStart = this.min;
760
+ }
761
+ }
762
+ }
763
+ disabledChanged() {
764
+ if (this.gesture) {
765
+ this.gesture.enable(!this.disabled);
766
+ }
767
+ this.emitStyle();
768
+ }
769
+ valueChanged(value) {
770
+ if (!this.noUpdate) {
771
+ this.updateRatio();
772
+ }
773
+ value = this.ensureValueInBounds(value);
774
+ this.ionChange.emit({ value });
775
+ }
776
+ componentWillLoad() {
777
+ /**
778
+ * If user has custom ID set then we should
779
+ * not assign the default incrementing ID.
780
+ */
781
+ this.rangeId = this.el.hasAttribute('id') ? this.el.getAttribute('id') : `ion-r-${rangeIds++}`;
782
+ this.inheritedAttributes = helpers.inheritAriaAttributes(this.el);
783
+ }
784
+ componentDidLoad() {
785
+ this.setupGesture();
786
+ this.didLoad = true;
787
+ }
788
+ connectedCallback() {
789
+ this.updateRatio();
790
+ this.debounceChanged();
791
+ this.disabledChanged();
792
+ this.activeBarStartChanged();
793
+ /**
794
+ * If we have not yet rendered
795
+ * ion-range, then rangeSlider is not defined.
796
+ * But if we are moving ion-range via appendChild,
797
+ * then rangeSlider will be defined.
798
+ */
799
+ if (this.didLoad) {
800
+ this.setupGesture();
801
+ }
802
+ this.contentEl = index$3.findClosestIonContent(this.el);
803
+ }
804
+ disconnectedCallback() {
805
+ if (this.gesture) {
806
+ this.gesture.destroy();
807
+ this.gesture = undefined;
808
+ }
809
+ }
810
+ getValue() {
811
+ const value = this.value || 0;
812
+ if (this.dualKnobs) {
813
+ if (typeof value === 'object') {
814
+ return value;
815
+ }
816
+ return {
817
+ lower: 0,
818
+ upper: value,
819
+ };
820
+ }
821
+ else {
822
+ if (typeof value === 'object') {
823
+ return value.upper;
824
+ }
825
+ return value;
826
+ }
827
+ }
828
+ emitStyle() {
829
+ this.ionStyle.emit({
830
+ interactive: true,
831
+ 'interactive-disabled': this.disabled,
832
+ });
833
+ }
834
+ onStart(detail) {
835
+ const { contentEl } = this;
836
+ if (contentEl) {
837
+ this.initialContentScrollY = index$3.disableContentScrollY(contentEl);
838
+ }
839
+ const rect = (this.rect = this.rangeSlider.getBoundingClientRect());
840
+ const currentX = detail.currentX;
841
+ // figure out which knob they started closer to
842
+ let ratio = helpers.clamp(0, (currentX - rect.left) / rect.width, 1);
843
+ if (dir.isRTL(this.el)) {
844
+ ratio = 1 - ratio;
845
+ }
846
+ this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
847
+ this.setFocus(this.pressedKnob);
848
+ // update the active knob's position
849
+ this.update(currentX);
850
+ this.ionKnobMoveStart.emit({ value: this.ensureValueInBounds(this.value) });
851
+ }
852
+ onMove(detail) {
853
+ this.update(detail.currentX);
854
+ }
855
+ onEnd(detail) {
856
+ const { contentEl, initialContentScrollY } = this;
857
+ if (contentEl) {
858
+ index$3.resetContentScrollY(contentEl, initialContentScrollY);
859
+ }
860
+ this.update(detail.currentX);
861
+ this.pressedKnob = undefined;
862
+ this.ionKnobMoveEnd.emit({ value: this.ensureValueInBounds(this.value) });
863
+ }
864
+ update(currentX) {
865
+ // figure out where the pointer is currently at
866
+ // update the knob being interacted with
867
+ const rect = this.rect;
868
+ let ratio = helpers.clamp(0, (currentX - rect.left) / rect.width, 1);
869
+ if (dir.isRTL(this.el)) {
870
+ ratio = 1 - ratio;
871
+ }
872
+ if (this.snaps) {
873
+ // snaps the ratio to the current value
874
+ ratio = valueToRatio(ratioToValue(ratio, this.min, this.max, this.step), this.min, this.max);
875
+ }
876
+ // update which knob is pressed
877
+ if (this.pressedKnob === 'A') {
878
+ this.ratioA = ratio;
879
+ }
880
+ else {
881
+ this.ratioB = ratio;
882
+ }
883
+ // Update input value
884
+ this.updateValue();
885
+ }
886
+ get valA() {
887
+ return ratioToValue(this.ratioA, this.min, this.max, this.step);
888
+ }
889
+ get valB() {
890
+ return ratioToValue(this.ratioB, this.min, this.max, this.step);
891
+ }
892
+ get ratioLower() {
893
+ if (this.dualKnobs) {
894
+ return Math.min(this.ratioA, this.ratioB);
895
+ }
896
+ const { activeBarStart } = this;
897
+ if (activeBarStart == null) {
898
+ return 0;
899
+ }
900
+ return valueToRatio(activeBarStart, this.min, this.max);
901
+ }
902
+ get ratioUpper() {
903
+ if (this.dualKnobs) {
904
+ return Math.max(this.ratioA, this.ratioB);
905
+ }
906
+ return this.ratioA;
907
+ }
908
+ updateRatio() {
909
+ const value = this.getValue();
910
+ const { min, max } = this;
911
+ if (this.dualKnobs) {
912
+ this.ratioA = valueToRatio(value.lower, min, max);
913
+ this.ratioB = valueToRatio(value.upper, min, max);
914
+ }
915
+ else {
916
+ this.ratioA = valueToRatio(value, min, max);
917
+ }
918
+ }
919
+ updateValue() {
920
+ this.noUpdate = true;
921
+ const { valA, valB } = this;
922
+ this.value = !this.dualKnobs
923
+ ? valA
924
+ : {
925
+ lower: Math.min(valA, valB),
926
+ upper: Math.max(valA, valB),
927
+ };
928
+ this.noUpdate = false;
929
+ }
930
+ setFocus(knob) {
931
+ if (this.el.shadowRoot) {
932
+ const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
933
+ if (knobEl) {
934
+ knobEl.focus();
935
+ }
936
+ }
937
+ }
938
+ render() {
939
+ var _a;
940
+ const { min, max, step, el, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, inheritedAttributes, rangeId, pinFormatter, } = this;
941
+ /**
942
+ * Look for external label, ion-label, or aria-labelledby.
943
+ * If none, see if user placed an aria-label on the host
944
+ * and use that instead.
945
+ */
946
+ let { labelText } = helpers.getAriaLabel(el, rangeId);
947
+ if (labelText === undefined || labelText === null) {
948
+ labelText = inheritedAttributes['aria-label'];
949
+ }
950
+ const mode = ionicGlobal.getIonMode(this);
951
+ let barStart = `${ratioLower * 100}%`;
952
+ let barEnd = `${100 - ratioUpper * 100}%`;
953
+ const rtl = dir.isRTL(this.el);
954
+ const start = rtl ? 'right' : 'left';
955
+ const end = rtl ? 'left' : 'right';
956
+ const tickStyle = (tick) => {
957
+ return {
958
+ [start]: tick[start],
959
+ };
960
+ };
961
+ if (this.dualKnobs === false) {
962
+ /**
963
+ * When the value is less than the activeBarStart or the min value,
964
+ * the knob will display at the start of the active bar.
965
+ */
966
+ if (this.valA < ((_a = this.activeBarStart) !== null && _a !== void 0 ? _a : this.min)) {
967
+ /**
968
+ * Sets the bar positions relative to the upper and lower limits.
969
+ * Converts the ratio values into percentages, used as offsets for left/right styles.
970
+ *
971
+ * The ratioUpper refers to the knob position on the bar.
972
+ * The ratioLower refers to the end position of the active bar (the value).
973
+ */
974
+ barStart = `${ratioUpper * 100}%`;
975
+ barEnd = `${100 - ratioLower * 100}%`;
976
+ }
977
+ else {
978
+ /**
979
+ * Otherwise, the knob will display at the end of the active bar.
980
+ *
981
+ * The ratioLower refers to the start position of the active bar (the value).
982
+ * The ratioUpper refers to the knob position on the bar.
983
+ */
984
+ barStart = `${ratioLower * 100}%`;
985
+ barEnd = `${100 - ratioUpper * 100}%`;
986
+ }
987
+ }
988
+ const barStyle = {
989
+ [start]: barStart,
990
+ [end]: barEnd,
991
+ };
992
+ const ticks = [];
993
+ if (this.snaps && this.ticks) {
994
+ for (let value = min; value <= max; value += step) {
995
+ const ratio = valueToRatio(value, min, max);
996
+ const ratioMin = Math.min(ratioLower, ratioUpper);
997
+ const ratioMax = Math.max(ratioLower, ratioUpper);
998
+ const tick = {
999
+ ratio,
1000
+ /**
1001
+ * Sets the tick mark as active when the tick is between the min bounds and the knob.
1002
+ * When using activeBarStart, the tick mark will be active between the knob and activeBarStart.
1003
+ */
1004
+ active: ratio >= ratioMin && ratio <= ratioMax,
1005
+ };
1006
+ tick[start] = `${ratio * 100}%`;
1007
+ ticks.push(tick);
1008
+ }
1009
+ }
1010
+ helpers.renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
1011
+ return (index.h(index.Host, { onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: theme.createColorClasses(this.color, {
1012
+ [mode]: true,
1013
+ 'in-item': theme.hostContext('ion-item', el),
1014
+ 'range-disabled': disabled,
1015
+ 'range-pressed': pressedKnob !== undefined,
1016
+ 'range-has-pin': pin,
1017
+ }) }, index.h("slot", { name: "start" }), index.h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl) }, ticks.map((tick) => (index.h("div", { style: tickStyle(tick), role: "presentation", class: {
1018
+ 'range-tick': true,
1019
+ 'range-tick-active': tick.active,
1020
+ }, part: tick.active ? 'tick-active' : 'tick' }))), index.h("div", { class: "range-bar", role: "presentation", part: "bar" }), index.h("div", { class: "range-bar range-bar-active", role: "presentation", style: barStyle, part: "bar-active" }), renderKnob(rtl, {
1021
+ knob: 'A',
1022
+ pressed: pressedKnob === 'A',
1023
+ value: this.valA,
1024
+ ratio: this.ratioA,
1025
+ pin,
1026
+ pinFormatter,
1027
+ disabled,
1028
+ handleKeyboard,
1029
+ min,
1030
+ max,
1031
+ labelText,
1032
+ }), this.dualKnobs &&
1033
+ renderKnob(rtl, {
1034
+ knob: 'B',
1035
+ pressed: pressedKnob === 'B',
1036
+ value: this.valB,
1037
+ ratio: this.ratioB,
1038
+ pin,
1039
+ pinFormatter,
1040
+ disabled,
1041
+ handleKeyboard,
1042
+ min,
1043
+ max,
1044
+ labelText,
1045
+ })), index.h("slot", { name: "end" })));
1046
+ }
1047
+ get el() { return index.getElement(this); }
1048
+ static get watchers() { return {
1049
+ "debounce": ["debounceChanged"],
1050
+ "min": ["minChanged"],
1051
+ "max": ["maxChanged"],
1052
+ "activeBarStart": ["activeBarStartChanged"],
1053
+ "disabled": ["disabledChanged"],
1054
+ "value": ["valueChanged"]
1055
+ }; }
1056
+ };
1057
+ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, labelText, pinFormatter }) => {
1058
+ const start = rtl ? 'right' : 'left';
1059
+ const knobStyle = () => {
1060
+ const style = {};
1061
+ style[start] = `${ratio * 100}%`;
1062
+ return style;
1063
+ };
1064
+ return (index.h("div", { onKeyDown: (ev) => {
1065
+ const key = ev.key;
1066
+ if (key === 'ArrowLeft' || key === 'ArrowDown') {
1067
+ handleKeyboard(knob, false);
1068
+ ev.preventDefault();
1069
+ ev.stopPropagation();
1070
+ }
1071
+ else if (key === 'ArrowRight' || key === 'ArrowUp') {
1072
+ handleKeyboard(knob, true);
1073
+ ev.preventDefault();
1074
+ ev.stopPropagation();
1075
+ }
1076
+ }, class: {
1077
+ 'range-knob-handle': true,
1078
+ 'range-knob-a': knob === 'A',
1079
+ 'range-knob-b': knob === 'B',
1080
+ 'range-knob-pressed': pressed,
1081
+ 'range-knob-min': value === min,
1082
+ 'range-knob-max': value === max,
1083
+ }, style: knobStyle(), role: "slider", tabindex: disabled ? -1 : 0, "aria-label": labelText, "aria-valuemin": min, "aria-valuemax": max, "aria-disabled": disabled ? 'true' : null, "aria-valuenow": value }, pin && (index.h("div", { class: "range-pin", role: "presentation", part: "pin" }, pinFormatter(value))), index.h("div", { class: "range-knob", role: "presentation", part: "knob" })));
1084
+ };
1085
+ const ratioToValue = (ratio, min, max, step) => {
1086
+ let value = (max - min) * ratio;
1087
+ if (step > 0) {
1088
+ value = Math.round(value / step) * step + min;
1089
+ }
1090
+ return helpers.clamp(min, value, max);
1091
+ };
1092
+ const valueToRatio = (value, min, max) => {
1093
+ return helpers.clamp(0, (value - min) / (max - min), 1);
1094
+ };
1095
+ let rangeIds = 0;
1096
+ Range.style = {
1097
+ ios: rangeIosCss,
1098
+ md: rangeMdCss
1099
+ };
1100
+
1101
+ const rippleEffectCss = ":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;will-change:transform, opacity;pointer-events:none}.fade-out{transform:translate(var(--translate-end)) scale(var(--final-scale, 1));animation:150ms fadeOutAnimation forwards}@keyframes rippleAnimation{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(1)}to{transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@keyframes fadeInAnimation{from{animation-timing-function:linear;opacity:0}to{opacity:0.16}}@keyframes fadeOutAnimation{from{animation-timing-function:linear;opacity:0.16}to{opacity:0}}";
1102
+
1103
+ const RippleEffect = class {
1104
+ constructor(hostRef) {
1105
+ index.registerInstance(this, hostRef);
1106
+ /**
1107
+ * Sets the type of ripple-effect:
1108
+ *
1109
+ * - `bounded`: the ripple effect expands from the user's click position
1110
+ * - `unbounded`: the ripple effect expands from the center of the button and overflows the container.
1111
+ *
1112
+ * NOTE: Surfaces for bounded ripples should have the overflow property set to hidden,
1113
+ * while surfaces for unbounded ripples should have it set to visible.
1114
+ */
1115
+ this.type = 'bounded';
1116
+ }
1117
+ /**
1118
+ * Adds the ripple effect to the parent element.
1119
+ *
1120
+ * @param x The horizontal coordinate of where the ripple should start.
1121
+ * @param y The vertical coordinate of where the ripple should start.
1122
+ */
1123
+ async addRipple(x, y) {
1124
+ return new Promise((resolve) => {
1125
+ index.readTask(() => {
1126
+ const rect = this.el.getBoundingClientRect();
1127
+ const width = rect.width;
1128
+ const height = rect.height;
1129
+ const hypotenuse = Math.sqrt(width * width + height * height);
1130
+ const maxDim = Math.max(height, width);
1131
+ const maxRadius = this.unbounded ? maxDim : hypotenuse + PADDING;
1132
+ const initialSize = Math.floor(maxDim * INITIAL_ORIGIN_SCALE);
1133
+ const finalScale = maxRadius / initialSize;
1134
+ let posX = x - rect.left;
1135
+ let posY = y - rect.top;
1136
+ if (this.unbounded) {
1137
+ posX = width * 0.5;
1138
+ posY = height * 0.5;
1139
+ }
1140
+ const styleX = posX - initialSize * 0.5;
1141
+ const styleY = posY - initialSize * 0.5;
1142
+ const moveX = width * 0.5 - posX;
1143
+ const moveY = height * 0.5 - posY;
1144
+ index.writeTask(() => {
1145
+ const div = document.createElement('div');
1146
+ div.classList.add('ripple-effect');
1147
+ const style = div.style;
1148
+ style.top = styleY + 'px';
1149
+ style.left = styleX + 'px';
1150
+ style.width = style.height = initialSize + 'px';
1151
+ style.setProperty('--final-scale', `${finalScale}`);
1152
+ style.setProperty('--translate-end', `${moveX}px, ${moveY}px`);
1153
+ const container = this.el.shadowRoot || this.el;
1154
+ container.appendChild(div);
1155
+ setTimeout(() => {
1156
+ resolve(() => {
1157
+ removeRipple(div);
1158
+ });
1159
+ }, 225 + 100);
1160
+ });
1161
+ });
1162
+ });
1163
+ }
1164
+ get unbounded() {
1165
+ return this.type === 'unbounded';
1166
+ }
1167
+ render() {
1168
+ const mode = ionicGlobal.getIonMode(this);
1169
+ return (index.h(index.Host, { role: "presentation", class: {
1170
+ [mode]: true,
1171
+ unbounded: this.unbounded,
1172
+ } }));
1173
+ }
1174
+ get el() { return index.getElement(this); }
1175
+ };
1176
+ const removeRipple = (ripple) => {
1177
+ ripple.classList.add('fade-out');
1178
+ setTimeout(() => {
1179
+ ripple.remove();
1180
+ }, 200);
1181
+ };
1182
+ const PADDING = 10;
1183
+ const INITIAL_ORIGIN_SCALE = 0.5;
1184
+ RippleEffect.style = rippleEffectCss;
1185
+
1186
+ const buttonCss = "sparkle-button{background-color:rgba(var(--ion-color-sparkle-rgb), var(--bg-alpha, 0.06));border-radius:6px;color:var(--accent-color);display:inline-block;font-weight:600;white-space:nowrap;box-shadow:0 1px 3px rgba(0,0,0,.1)}sparkle-button a,sparkle-button button{color:inherit;display:inline-block;font-size:inherit;font-weight:inherit;padding:0.75em 1.5em}sparkle-button button{appearance:none;background:none;border:none;line-height:inherit}sparkle-button svg{fill:currentColor;height:1em;margin-bottom:-0.125em;width:1em}sparkle-button[round]{border-radius:2em}sparkle-button[primary]{background-color:rgba(var(--ion-color-sparkle-rgb));color:var(--ion-color-sparkle-contrast)}@media (hover: hover){sparkle-button:hover{--bg-alpha:0.08}sparkle-button:active{--bg-alpha:0.1}}";
1187
+
1188
+ const SparkleButton = class {
1189
+ constructor(hostRef) {
1190
+ index.registerInstance(this, hostRef);
1191
+ this.round = false;
1192
+ this.primary = false;
1193
+ }
1194
+ render() {
1195
+ if (this.href !== undefined) {
1196
+ const isInternal = /^\/course/.test(this.href);
1197
+ if (isInternal) {
1198
+ return (index.h("stencil-route-link", { url: this.href }, index.h("slot", null)));
1199
+ }
1200
+ return (index.h("a", { href: this.href }, index.h("slot", null)));
1201
+ }
1202
+ return (index.h("button", null, index.h("slot", null)));
1203
+ }
1204
+ };
1205
+ SparkleButton.style = buttonCss;
1206
+
1207
+ const sparkleQuizCss = "sparkle-quiz{display:block;font-family:var(--font-family);--sparkle-quiz-question-container-padding:10px 0px;--sparkle-quiz-question-container-margin:0px;--sparkle-quiz-question-text-padding:10px 0px;--sparkle-quiz-option-border:2px solid var(--line-rule-color);--sparkle-quiz-selected-option-border:2px solid var(--text-color--dark);--sparkle-quiz-option-border-radius:4px;--sparkle-quiz-option-padding:5px 10px;--sparkle-quiz-option-width:100%;--sparkle-quiz-error-bg-color:#fbaeae;--sparkle-quiz-success-bg-color:#fbaeae;padding:var(--sparkle-quiz-question-container-padding);margin:var(--sparkle-quiz-question-container-margin)}.question-text{padding:var(--sparkle-quiz-question-text-padding)}.option{padding:5px 0px}.number{padding:0px 14px;border:1px solid #ebebeb;border-radius:4px;margin-right:10px;font-size:14px;width:14px;display:inline-flex;justify-content:center}.feedback-container{padding:10px;border-radius:4px}.incorrect .feedback-container{background-color:var(--sparkle-quiz-error-bg-color, #fbaeae)}.correct .feedback-container{background-color:var(--sparkle-quiz-success-bg-color, #fbaeae)}";
1208
+
1209
+ const SparkleQuiz = class {
1210
+ constructor(hostRef) {
1211
+ index.registerInstance(this, hostRef);
1212
+ this.quizAnswerChanged = index.createEvent(this, "quizAnswerChanged", 7);
1213
+ this.type = 'TEXT';
1214
+ this.scale = 'FIVE-POINTS';
1215
+ this.options = [];
1216
+ }
1217
+ // private pageInfo: any;
1218
+ // @Watch('questionId')
1219
+ // async loadQuestion() {
1220
+ // if (this.quizData) {
1221
+ // this.question = this.quizData[+this.questionId];
1222
+ // }
1223
+ // }
1224
+ //@State() question: SparkleQuizQuestion;
1225
+ //@State() quizData: { [key: string]: SparkleQuizQuestion };
1226
+ async componentWillLoad() { }
1227
+ async componentDidLoad() {
1228
+ this.options = [];
1229
+ if (this.el.querySelector("[slot='options']")) {
1230
+ Array.from(this.el.querySelector("[slot='options']").querySelectorAll('option')).forEach(el => {
1231
+ this.options = [...this.options, { option: el.innerText }];
1232
+ });
1233
+ console.log(this.questionText, this.options);
1234
+ }
1235
+ this.quizAnswerChanged.emit({
1236
+ question: null,
1237
+ answer: '1',
1238
+ });
1239
+ }
1240
+ quizInputChangeHandler(event) {
1241
+ this.quizAnswerChanged.emit({
1242
+ question: event.detail.question,
1243
+ answer: event.detail.value,
1244
+ });
1245
+ }
1246
+ quizFeedbackChangeHandler(event) {
1247
+ this.quizAnswerChanged.emit({
1248
+ question: event.detail.question,
1249
+ answer: event.detail.value,
1250
+ });
1251
+ }
1252
+ quizSelectChangeHandler(event) {
1253
+ this.quizAnswerChanged.emit({
1254
+ question: event.detail.question,
1255
+ answer: event.detail.value,
1256
+ });
1257
+ }
1258
+ quizOpinionChangeHandler(event) {
1259
+ this.quizAnswerChanged.emit({
1260
+ question: event.detail.question,
1261
+ answer: event.detail.value,
1262
+ });
1263
+ }
1264
+ getQuestionFeedback() {
1265
+ if (this.type == 'MULTIPLE-CHOICE') {
1266
+ // const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
1267
+ // return feedbacks.length > 0 && feedbacks.map(feedback => <small>{feedback}</small>);
1268
+ return index.h("small", null);
1269
+ }
1270
+ else if (this.type == 'FEEDBACK' || this.type == 'TEXT') {
1271
+ return this.feedback && index.h("small", null, " ", this.feedback);
1272
+ }
1273
+ }
1274
+ showAnswerStatus() {
1275
+ return index.h("div", null, this.correct ? index.h("strong", null, "Good job!") : index.h("strong", null, "Incorrect answer, please try again."));
1276
+ }
1277
+ renderQuestion() {
1278
+ var question = {
1279
+ questionId: this.questionId,
1280
+ questionText: this.questionText,
1281
+ questionType: this.type,
1282
+ scale: this.scale,
1283
+ showOptionNumber: this.showOptionNumber,
1284
+ options: this.options,
1285
+ //options: Array<SparkleQuizQuestionOption>;
1286
+ feedback: this.feedback,
1287
+ };
1288
+ if (this.type == 'MULTIPLE-CHOICE') {
1289
+ return index.h("sparkle-quiz-select", { question: question, allowMultiple: true });
1290
+ }
1291
+ else if (this.type == 'FEEDBACK') {
1292
+ return index.h("sparkle-quiz-feedback", { question: question });
1293
+ }
1294
+ else if (this.type == 'TEXT') {
1295
+ return index.h("sparkle-quiz-input", { question: question });
1296
+ }
1297
+ else if (this.type == 'OPINION') {
1298
+ return index.h("sparkle-quiz-opinion", { question: question });
1299
+ }
1300
+ else if (this.type == 'POLL') {
1301
+ return index.h("sparkle-quiz-poll", { question: question });
1302
+ }
1303
+ }
1304
+ render() {
1305
+ if (this.questionText) {
1306
+ let classes = {
1307
+ correct: this.submitted && this.correct,
1308
+ incorrect: this.submitted && !this.correct,
1309
+ };
1310
+ return (index.h("div", { class: classes, ref: el => (this.containerRef = el) }, index.h("div", { hidden: true }, index.h("slot", null)), this.renderQuestion(), this.submitted && this.showInstantResult && index.h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
1311
+ }
1312
+ else {
1313
+ return index.h("p", null, "No question found.");
1314
+ }
1315
+ }
1316
+ get el() { return index.getElement(this); }
1317
+ };
1318
+ SparkleQuiz.style = sparkleQuizCss;
1319
+
1320
+ function GetSelectOptionId(questionId, index) {
1321
+ return "question-" + questionId + "-option-" + index;
1322
+ }
1323
+
1324
+ const sparkleQuizFeedbackCss = ":host{display:block}";
1325
+
1326
+ const SparkleQuizFeedback = class {
1327
+ constructor(hostRef) {
1328
+ index.registerInstance(this, hostRef);
1329
+ this.quizFeedbackChange = index.createEvent(this, "quizFeedbackChange", 7);
1330
+ this.displayOptions = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
1331
+ }
1332
+ render() {
1333
+ return (index.h(index.Host, { class: "quiz__feedback" }, index.h("div", { class: "question-container" }, index.h("div", { class: "question-text" }, this.question.questionText), index.h("div", null, this.displayOptions.map((option, index$1) => index.h("div", { class: "option" }, index.h("input", { type: "radio", id: GetSelectOptionId(this.question.questionId, index$1), name: "question-" + this.question.questionId, value: option, onChange: (e) => this.quizFeedbackChange.emit({ value: e.target.value, question: this.question }) }), index.h("label", { htmlFor: GetSelectOptionId(this.question.questionId, index$1) }, index.h("span", { class: "number" }, this.displayOptions[index$1]), " ", option), index.h("br", null)))))));
1334
+ }
1335
+ };
1336
+ SparkleQuizFeedback.style = sparkleQuizFeedbackCss;
1337
+
1338
+ const sparkleQuizInputCss = ":host{display:block}";
1339
+
1340
+ const SparkleQuizInput = class {
1341
+ constructor(hostRef) {
1342
+ index.registerInstance(this, hostRef);
1343
+ this.quizInputChange = index.createEvent(this, "quizInputChange", 7);
1344
+ }
1345
+ render() {
1346
+ return (index.h(index.Host, { class: "quiz__input" }, index.h("div", { class: "question-container" }, index.h("label", { htmlFor: "question-" + this.question.questionId, class: "form-label" }, this.question.questionText), index.h("input", { type: "text", class: "form-control", id: "question-" + this.question.questionId, name: "question-" + this.question.questionId, onInput: (e) => this.quizInputChange.emit({ value: e.target.value, question: this.question }) }))));
1347
+ }
1348
+ };
1349
+ SparkleQuizInput.style = sparkleQuizInputCss;
1350
+
1351
+ const sparkleQuizOpinionCss = "sparkle-quiz-opinion .scale{display:flex;justify-content:space-between}sparkle-quiz-opinion .scale>p{margin:0}sparkle-quiz-opinion .scale>p.selected{color:var(--ion-color-primary)}sparkle-quiz-opinion ion-icon{font-size:30px}sparkle-quiz-opinion .icon-group{min-width:70px;text-align:right;padding-right:10px}";
1352
+
1353
+ const SparkleQuizOpinion = class {
1354
+ constructor(hostRef) {
1355
+ index.registerInstance(this, hostRef);
1356
+ this.quizOpinionChange = index.createEvent(this, "quizOpinionChange", 7);
1357
+ this.fivePointsDisplayOptions = ['Strongly agree', 'Agree', 'Not sure', 'Disagree', 'Strongly disagree'];
1358
+ this.tenPointsDisplayOptions = ["Never",
1359
+ "Never",
1360
+ "Sometimes",
1361
+ "Sometimes",
1362
+ "Half of the time",
1363
+ "Half of the time",
1364
+ "Most of the time",
1365
+ "Most of the time",
1366
+ "Always",
1367
+ "Always",
1368
+ "Always"];
1369
+ this.tenPointsDefaultValue = 5;
1370
+ }
1371
+ optionChanged(index, answer) {
1372
+ this.selectedIndex = index;
1373
+ this.quizOpinionChange.emit({ value: answer, question: this.question });
1374
+ }
1375
+ renderFivePointScale() {
1376
+ return (this.fivePointsDisplayOptions.map((option, index$1) => index.h("div", { class: "option" }, index.h("input", { id: GetSelectOptionId(this.question.questionId, index$1), type: "radio", name: "question-" + this.question.questionId, value: option, onChange: (e) => this.optionChanged(index$1, this.fivePointsDisplayOptions[index$1]) }), index.h("label", { htmlFor: GetSelectOptionId(this.question.questionId, index$1) }, index.h("span", { class: "number" }, index$1 + 1), option), index.h("br", null))));
1377
+ }
1378
+ renderTenPointScale() {
1379
+ return (index.h("div", null, index.h("ion-item", null, index.h("ion-range", { class: "opinion-range", onIonChange: (e) => this.optionChanged(+e.detail.value, this.tenPointsDisplayOptions[+e.detail.value]), min: 0, max: 10, value: this.tenPointsDefaultValue, step: 1, pin: true, snaps: true }, index.h("ion-icon", { size: "small", slot: "start", name: "star-outline" }), index.h("ion-icon", { slot: "end", name: "star" }))), index.h("div", { class: "scale" }, index.h("p", null, "Never"), index.h("p", { class: "selected" }, this.tenPointsDisplayOptions[this.selectedIndex] || this.tenPointsDisplayOptions[this.tenPointsDefaultValue]), index.h("p", null, "Always")), index.h("br", null), index.h("hr", null)));
1380
+ }
1381
+ render() {
1382
+ return (index.h(index.Host, { class: "quiz__opinion" }, index.h("div", { class: "opinion-container" }, index.h("div", { class: "question-text" }, this.question.questionText), index.h("div", null, this.question.scale == "FIVE-POINTS" && this.renderFivePointScale(), this.question.scale == "TEN-POINTS" && this.renderTenPointScale()))));
1383
+ }
1384
+ get el() { return index.getElement(this); }
1385
+ };
1386
+ SparkleQuizOpinion.style = sparkleQuizOpinionCss;
1387
+
1388
+ const sparkleQuizPollCss = ":host{display:block}";
1389
+
1390
+ const SparkleQuizPoll = class {
1391
+ constructor(hostRef) {
1392
+ index.registerInstance(this, hostRef);
1393
+ this.quizInputChange = index.createEvent(this, "quizInputChange", 7);
1394
+ }
1395
+ render() {
1396
+ return (index.h(index.Host, { class: "quiz__input" }, index.h("div", { class: "question-container" }, index.h("label", { htmlFor: "question-" + this.question.questionId, class: "form-label" }, this.question.questionText), index.h("input", { type: "text", class: "form-control", id: "question-" + this.question.questionId, name: "question-" + this.question.questionId, onInput: (e) => this.quizInputChange.emit({ value: e.target.value, question: this.question }) }))));
1397
+ }
1398
+ };
1399
+ SparkleQuizPoll.style = sparkleQuizPollCss;
1400
+
1401
+ const sparkleQuizSelectCss = ":host{display:block}";
1402
+
1403
+ const SparkleQuizSelect = class {
1404
+ constructor(hostRef) {
1405
+ index.registerInstance(this, hostRef);
1406
+ this.quizSelectChange = index.createEvent(this, "quizSelectChange", 7);
1407
+ this.allowMultiple = false;
1408
+ this.values = [];
1409
+ this.displayOptions = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
1410
+ }
1411
+ optionChanged(e) {
1412
+ if (e.target.checked) {
1413
+ this.values = [...this.values, e.target.value];
1414
+ }
1415
+ else {
1416
+ this.values = this.values.filter(x => x !== e.target.value);
1417
+ }
1418
+ this.quizSelectChange.emit({ value: this.values, question: this.question });
1419
+ }
1420
+ render() {
1421
+ return (index.h(index.Host, { class: "quiz__select" }, index.h("div", { class: "question-container" }, index.h("div", { class: "question-text" }, this.question.questionText), index.h("div", null, this.question.options.map((option, index$1) => index.h("div", { class: "option" }, index.h("input", { type: this.allowMultiple ? "checkbox" : "radio", id: GetSelectOptionId(this.question.questionId, index$1), name: "question-" + this.question.questionId, value: option.option, onChange: (e) => this.optionChanged(e) }), index.h("label", { htmlFor: GetSelectOptionId(this.question.questionId, index$1) }, index.h("span", { class: "number" }, this.displayOptions[index$1]), option.option), index.h("br", null)))))));
1422
+ }
1423
+ };
1424
+ SparkleQuizSelect.style = sparkleQuizSelectCss;
1425
+
1426
+ const getUrl = (url, root) => {
1427
+ // Don't allow double slashes
1428
+ if (url.charAt(0) == '/' && root.charAt(root.length - 1) == '/') {
1429
+ return root.slice(0, root.length - 1) + url;
1430
+ }
1431
+ return root + url;
1432
+ };
1433
+ const RouteLink = class {
1434
+ constructor(hostRef) {
1435
+ index.registerInstance(this, hostRef);
1436
+ this.unsubscribe = () => { return; };
1437
+ this.activeClass = 'link-active';
1438
+ this.exact = false;
1439
+ this.strict = true;
1440
+ /**
1441
+ * Custom tag to use instead of an anchor
1442
+ */
1443
+ this.custom = 'a';
1444
+ this.match = null;
1445
+ }
1446
+ componentWillLoad() {
1447
+ this.computeMatch();
1448
+ }
1449
+ // Identify if the current route is a match.
1450
+ computeMatch() {
1451
+ if (this.location) {
1452
+ this.match = matchPath.matchPath(this.location.pathname, {
1453
+ path: this.urlMatch || this.url,
1454
+ exact: this.exact,
1455
+ strict: this.strict
1456
+ });
1457
+ }
1458
+ }
1459
+ handleClick(e) {
1460
+ if (domUtils.isModifiedEvent(e) || !this.history || !this.url || !this.root) {
1461
+ return;
1462
+ }
1463
+ e.preventDefault();
1464
+ return this.history.push(getUrl(this.url, this.root));
1465
+ }
1466
+ // Get the URL for this route link without the root from the router
1467
+ render() {
1468
+ let anchorAttributes = {
1469
+ class: {
1470
+ [this.activeClass]: this.match !== null,
1471
+ },
1472
+ onClick: this.handleClick.bind(this)
1473
+ };
1474
+ if (this.anchorClass) {
1475
+ anchorAttributes.class[this.anchorClass] = true;
1476
+ }
1477
+ if (this.custom === 'a') {
1478
+ anchorAttributes = Object.assign({}, anchorAttributes, { href: this.url, title: this.anchorTitle, role: this.anchorRole, tabindex: this.anchorTabIndex, 'aria-haspopup': this.ariaHaspopup, id: this.anchorId, 'aria-posinset': this.ariaPosinset, 'aria-setsize': this.ariaSetsize, 'aria-label': this.ariaLabel });
1479
+ }
1480
+ return (index.h(this.custom, Object.assign({}, anchorAttributes), index.h("slot", null)));
1481
+ }
1482
+ get el() { return index.getElement(this); }
1483
+ static get watchers() { return {
1484
+ "location": ["computeMatch"]
1485
+ }; }
1486
+ };
1487
+ activeRouter.ActiveRouter.injectProps(RouteLink, [
1488
+ 'history',
1489
+ 'location',
1490
+ 'root'
1491
+ ]);
1492
+
1493
+ exports.ion_icon = Icon;
1494
+ exports.ion_item = Item;
1495
+ exports.ion_note = Note;
1496
+ exports.ion_range = Range;
1497
+ exports.ion_ripple_effect = RippleEffect;
1498
+ exports.sparkle_button = SparkleButton;
1499
+ exports.sparkle_quiz = SparkleQuiz;
1500
+ exports.sparkle_quiz_feedback = SparkleQuizFeedback;
1501
+ exports.sparkle_quiz_input = SparkleQuizInput;
1502
+ exports.sparkle_quiz_opinion = SparkleQuizOpinion;
1503
+ exports.sparkle_quiz_poll = SparkleQuizPoll;
1504
+ exports.sparkle_quiz_select = SparkleQuizSelect;
1505
+ exports.stencil_route_link = RouteLink;