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