@pocketprep/ui-kit 2.0.40 → 3.0.1

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 (305) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +16 -17
  2. package/dist/@pocketprep/ui-kit.js +18856 -0
  3. package/dist/@pocketprep/ui-kit.js.map +1 -0
  4. package/dist/@pocketprep/ui-kit.umd.cjs +28 -0
  5. package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -0
  6. package/dist/style.css +1 -0
  7. package/index.d.ts +6 -62
  8. package/lib/SVGDefinitions.vue +85 -0
  9. package/lib/assets/emojis/tada.png +0 -0
  10. package/lib/assets/halftones/halftone-black.png +0 -0
  11. package/lib/assets/halftones/halftone-blue.png +0 -0
  12. package/lib/assets/halftones/halftone-green.png +0 -0
  13. package/lib/assets/halftones/halftone-purple.png +0 -0
  14. package/lib/assets/halftones/halftone-red.png +0 -0
  15. package/lib/assets/halftones/halftone-yellow.png +0 -0
  16. package/lib/assets/question/paywall-dark.png +0 -0
  17. package/lib/assets/question/paywall-light.png +0 -0
  18. package/lib/components/Banners/Banner.md +41 -0
  19. package/lib/components/Banners/Banner.vue +87 -0
  20. package/lib/components/BundleIcons/AMTA.vue +134 -0
  21. package/lib/components/BundleIcons/BundleIcon.md +60 -0
  22. package/lib/components/BundleIcons/BundleIcon.vue +111 -0
  23. package/lib/components/Bundles/BundleList.md +63 -0
  24. package/lib/components/Bundles/BundleList.vue +170 -0
  25. package/lib/components/Bundles/BundleSearch.md +195 -0
  26. package/lib/components/Bundles/BundleSearch.vue +573 -0
  27. package/lib/components/Bundles/PremiumPill.md +23 -0
  28. package/lib/components/Bundles/PremiumPill.vue +43 -0
  29. package/lib/components/Buttons/Button.md +99 -0
  30. package/lib/components/Buttons/Button.vue +496 -0
  31. package/lib/components/Buttons/Link.md +58 -0
  32. package/lib/components/Buttons/Link.vue +192 -0
  33. package/lib/components/Buttons/Tab.md +35 -0
  34. package/lib/components/Buttons/Tab.vue +103 -0
  35. package/lib/components/Calendar/Calendar.md +18 -0
  36. package/lib/components/Calendar/Calendar.vue +162 -0
  37. package/lib/components/Charts/Bar.md +123 -0
  38. package/lib/components/Charts/Bar.vue +364 -0
  39. package/lib/components/Charts/Pie.md +23 -0
  40. package/lib/components/Charts/Pie.vue +105 -0
  41. package/lib/components/Controls/SegmentControl.md +47 -0
  42. package/lib/components/Controls/SegmentControl.vue +117 -0
  43. package/lib/components/Controls/Slider.md +67 -0
  44. package/lib/components/Controls/Slider.vue +358 -0
  45. package/lib/components/Controls/ToggleSwitch.md +56 -0
  46. package/lib/components/Controls/ToggleSwitch.vue +160 -0
  47. package/lib/components/Exams/ExamCard.md +45 -0
  48. package/lib/components/Exams/ExamCard.vue +257 -0
  49. package/lib/components/Exams/ExamMenuCard.md +90 -0
  50. package/lib/components/Exams/ExamMenuCard.vue +218 -0
  51. package/lib/components/Filters/FilterDropdown.md +59 -0
  52. package/lib/components/Filters/FilterDropdown.vue +176 -0
  53. package/lib/components/Filters/FilterOptions.md +65 -0
  54. package/lib/components/Filters/FilterOptions.vue +265 -0
  55. package/lib/components/Filters/filterOptions.d.ts +10 -0
  56. package/lib/components/Forms/Checkbox.md +52 -0
  57. package/lib/components/Forms/Checkbox.vue +184 -0
  58. package/lib/components/Forms/CheckboxOption.md +37 -0
  59. package/lib/components/Forms/CheckboxOption.vue +173 -0
  60. package/lib/components/Forms/Errors.md +23 -0
  61. package/lib/components/Forms/Errors.vue +109 -0
  62. package/lib/components/Forms/Input.md +63 -0
  63. package/lib/components/Forms/Input.vue +310 -0
  64. package/lib/components/Forms/Radio.md +66 -0
  65. package/lib/components/Forms/Radio.vue +312 -0
  66. package/lib/components/Forms/Select.md +133 -0
  67. package/lib/components/Forms/Select.vue +670 -0
  68. package/lib/components/Forms/Textarea.md +57 -0
  69. package/lib/components/Forms/Textarea.vue +157 -0
  70. package/lib/components/Icons/Icon.md +146 -0
  71. package/lib/components/Icons/Icon.vue +192 -0
  72. package/lib/components/Icons/IconAccordionArrow.md +7 -0
  73. package/lib/components/Icons/IconAccordionArrow.vue +23 -0
  74. package/lib/components/Icons/IconActivity.md +7 -0
  75. package/lib/components/Icons/IconActivity.vue +21 -0
  76. package/lib/components/Icons/IconAdd.md +7 -0
  77. package/lib/components/Icons/IconAdd.vue +19 -0
  78. package/lib/components/Icons/IconAddCircle.md +7 -0
  79. package/lib/components/Icons/IconAddCircle.vue +22 -0
  80. package/lib/components/Icons/IconArrow.md +7 -0
  81. package/lib/components/Icons/IconArrow.vue +21 -0
  82. package/lib/components/Icons/IconBarChart.md +7 -0
  83. package/lib/components/Icons/IconBarChart.vue +23 -0
  84. package/lib/components/Icons/IconCalendar.md +7 -0
  85. package/lib/components/Icons/IconCalendar.vue +19 -0
  86. package/lib/components/Icons/IconCheck.md +7 -0
  87. package/lib/components/Icons/IconCheck.vue +21 -0
  88. package/lib/components/Icons/IconClose.md +7 -0
  89. package/lib/components/Icons/IconClose.vue +23 -0
  90. package/lib/components/Icons/IconCorrect.md +7 -0
  91. package/lib/components/Icons/IconCorrect.vue +19 -0
  92. package/lib/components/Icons/IconEdit.md +7 -0
  93. package/lib/components/Icons/IconEdit.vue +21 -0
  94. package/lib/components/Icons/IconExam.md +7 -0
  95. package/lib/components/Icons/IconExam.vue +34 -0
  96. package/lib/components/Icons/IconExternalLink.md +7 -0
  97. package/lib/components/Icons/IconExternalLink.vue +30 -0
  98. package/lib/components/Icons/IconEyeHide.md +7 -0
  99. package/lib/components/Icons/IconEyeHide.vue +21 -0
  100. package/lib/components/Icons/IconEyeShow.md +7 -0
  101. package/lib/components/Icons/IconEyeShow.vue +21 -0
  102. package/lib/components/Icons/IconFilter.md +7 -0
  103. package/lib/components/Icons/IconFilter.vue +19 -0
  104. package/lib/components/Icons/IconFilterActive.md +7 -0
  105. package/lib/components/Icons/IconFilterActive.vue +20 -0
  106. package/lib/components/Icons/IconFlag.md +7 -0
  107. package/lib/components/Icons/IconFlag.vue +25 -0
  108. package/lib/components/Icons/IconFlagFeedback.md +11 -0
  109. package/lib/components/Icons/IconFlagFeedback.vue +24 -0
  110. package/lib/components/Icons/IconFlagFilled.md +7 -0
  111. package/lib/components/Icons/IconFlagFilled.vue +22 -0
  112. package/lib/components/Icons/IconFullView.md +7 -0
  113. package/lib/components/Icons/IconFullView.vue +30 -0
  114. package/lib/components/Icons/IconFullViewActive.md +7 -0
  115. package/lib/components/Icons/IconFullViewActive.vue +28 -0
  116. package/lib/components/Icons/IconHandle.md +7 -0
  117. package/lib/components/Icons/IconHandle.vue +23 -0
  118. package/lib/components/Icons/IconHeart.md +7 -0
  119. package/lib/components/Icons/IconHeart.vue +19 -0
  120. package/lib/components/Icons/IconHelp.md +7 -0
  121. package/lib/components/Icons/IconHelp.vue +25 -0
  122. package/lib/components/Icons/IconHourglass.md +7 -0
  123. package/lib/components/Icons/IconHourglass.vue +22 -0
  124. package/lib/components/Icons/IconImage.md +7 -0
  125. package/lib/components/Icons/IconImage.vue +21 -0
  126. package/lib/components/Icons/IconIncorrect.md +7 -0
  127. package/lib/components/Icons/IconIncorrect.vue +21 -0
  128. package/lib/components/Icons/IconInfo.md +7 -0
  129. package/lib/components/Icons/IconInfo.vue +24 -0
  130. package/lib/components/Icons/IconKeyboard.md +7 -0
  131. package/lib/components/Icons/IconKeyboard.vue +25 -0
  132. package/lib/components/Icons/IconLaunch.md +7 -0
  133. package/lib/components/Icons/IconLaunch.vue +25 -0
  134. package/lib/components/Icons/IconLightning.md +7 -0
  135. package/lib/components/Icons/IconLightning.vue +21 -0
  136. package/lib/components/Icons/IconList.md +7 -0
  137. package/lib/components/Icons/IconList.vue +26 -0
  138. package/lib/components/Icons/IconLoading.md +7 -0
  139. package/lib/components/Icons/IconLoading.vue +65 -0
  140. package/lib/components/Icons/IconLoading2.md +7 -0
  141. package/lib/components/Icons/IconLoading2.vue +52 -0
  142. package/lib/components/Icons/IconLock.md +7 -0
  143. package/lib/components/Icons/IconLock.vue +23 -0
  144. package/lib/components/Icons/IconMissedQuestions.md +7 -0
  145. package/lib/components/Icons/IconMissedQuestions.vue +22 -0
  146. package/lib/components/Icons/IconMoon.md +7 -0
  147. package/lib/components/Icons/IconMoon.vue +25 -0
  148. package/lib/components/Icons/IconPaginationArrow.md +7 -0
  149. package/lib/components/Icons/IconPaginationArrow.vue +23 -0
  150. package/lib/components/Icons/IconPassage.md +7 -0
  151. package/lib/components/Icons/IconPassage.vue +22 -0
  152. package/lib/components/Icons/IconPencil.md +7 -0
  153. package/lib/components/Icons/IconPencil.vue +19 -0
  154. package/lib/components/Icons/IconPeople.md +7 -0
  155. package/lib/components/Icons/IconPeople.vue +25 -0
  156. package/lib/components/Icons/IconQuestions.md +7 -0
  157. package/lib/components/Icons/IconQuestions.vue +25 -0
  158. package/lib/components/Icons/IconQuick10.md +7 -0
  159. package/lib/components/Icons/IconQuick10.vue +23 -0
  160. package/lib/components/Icons/IconRemoveCircle.md +7 -0
  161. package/lib/components/Icons/IconRemoveCircle.vue +22 -0
  162. package/lib/components/Icons/IconReviewFlag.md +7 -0
  163. package/lib/components/Icons/IconReviewFlag.vue +32 -0
  164. package/lib/components/Icons/IconSearch.md +7 -0
  165. package/lib/components/Icons/IconSearch.vue +23 -0
  166. package/lib/components/Icons/IconShare.md +7 -0
  167. package/lib/components/Icons/IconShare.vue +31 -0
  168. package/lib/components/Icons/IconSideBar.md +7 -0
  169. package/lib/components/Icons/IconSideBar.vue +26 -0
  170. package/lib/components/Icons/IconSideBarActive.md +7 -0
  171. package/lib/components/Icons/IconSideBarActive.vue +28 -0
  172. package/lib/components/Icons/IconStopwatch.md +7 -0
  173. package/lib/components/Icons/IconStopwatch.vue +22 -0
  174. package/lib/components/Icons/IconStrike.md +60 -0
  175. package/lib/components/Icons/IconStrike.vue +23 -0
  176. package/lib/components/Icons/IconSubject.md +7 -0
  177. package/lib/components/Icons/IconSubject.vue +22 -0
  178. package/lib/components/Icons/IconText.md +7 -0
  179. package/lib/components/Icons/IconText.vue +22 -0
  180. package/lib/components/Icons/IconWarning.md +7 -0
  181. package/lib/components/Icons/IconWarning.vue +22 -0
  182. package/lib/components/Modal/Modal.md +31 -0
  183. package/lib/components/Modal/Modal.vue +133 -0
  184. package/lib/components/Modal/ModalContainer.md +96 -0
  185. package/lib/components/Modal/ModalContainer.vue +208 -0
  186. package/lib/components/Onboarding/EmailAuth.md +40 -0
  187. package/lib/components/Onboarding/EmailAuth.vue +218 -0
  188. package/lib/components/Onboarding/MagicCodeEntry.md +20 -0
  189. package/lib/components/Onboarding/MagicCodeEntry.vue +189 -0
  190. package/lib/components/PhonePerson/PhonePerson.md +36 -0
  191. package/lib/components/PhonePerson/PhonePerson.vue +48 -0
  192. package/lib/components/PhonePerson/phoneperson-IT@2x.png +0 -0
  193. package/lib/components/PhonePerson/phoneperson-auto@2x.png +0 -0
  194. package/lib/components/PhonePerson/phoneperson-behavioralhealth@2x.png +0 -0
  195. package/lib/components/PhonePerson/phoneperson-emt@2x.png +0 -0
  196. package/lib/components/PhonePerson/phoneperson-essentials@2x.png +0 -0
  197. package/lib/components/PhonePerson/phoneperson-finance@2x.png +0 -0
  198. package/lib/components/PhonePerson/phoneperson-fitness@2x.png +0 -0
  199. package/lib/components/PhonePerson/phoneperson-medical@2x.png +0 -0
  200. package/lib/components/PhonePerson/phoneperson-nursing@2x.png +0 -0
  201. package/lib/components/PhonePerson/phoneperson-nursingschool@2x.png +0 -0
  202. package/lib/components/PhonePerson/phoneperson-professional@2x.png +0 -0
  203. package/lib/components/PhonePerson/phoneperson-skilledtrades@2x.png +0 -0
  204. package/lib/components/Quiz/FlagToggle.md +37 -0
  205. package/lib/components/Quiz/FlagToggle.vue +124 -0
  206. package/lib/components/Quiz/GlobalMetricsToggle.md +46 -0
  207. package/lib/components/Quiz/GlobalMetricsToggle.vue +124 -0
  208. package/lib/components/Quiz/KeyboardShortcutsButton.md +18 -0
  209. package/lib/components/Quiz/KeyboardShortcutsButton.vue +102 -0
  210. package/lib/components/Quiz/KeyboardShortcutsModal.md +71 -0
  211. package/lib/components/Quiz/KeyboardShortcutsModal.vue +261 -0
  212. package/lib/components/Quiz/Question.md +579 -0
  213. package/lib/components/Quiz/Question.vue +3262 -0
  214. package/lib/components/Quiz/QuizContainer.md +91 -0
  215. package/lib/components/Quiz/QuizContainer.vue +207 -0
  216. package/lib/components/Quiz/QuizProgress.md +122 -0
  217. package/lib/components/Quiz/QuizProgress.vue +188 -0
  218. package/lib/components/Quiz/QuizProgressBar.md +131 -0
  219. package/lib/components/Quiz/QuizProgressBar.vue +96 -0
  220. package/lib/components/Search/Pill.md +37 -0
  221. package/lib/components/Search/Pill.vue +117 -0
  222. package/lib/components/Search/Search.md +44 -0
  223. package/lib/components/Search/Search.vue +341 -0
  224. package/lib/components/SidePanels/SidePanel.md +126 -0
  225. package/lib/components/SidePanels/SidePanel.vue +592 -0
  226. package/lib/components/Tables/StudyTable.md +136 -0
  227. package/lib/components/Tables/Table.vue +497 -0
  228. package/lib/components/Tables/TableActions.vue +199 -0
  229. package/lib/components/Tables/TablePagination.md +19 -0
  230. package/lib/components/Tables/TablePagination.vue +109 -0
  231. package/lib/components/Tables/TeachTable.md +696 -0
  232. package/lib/components/Toasts/Toast.md +35 -0
  233. package/lib/components/Toasts/Toast.vue +213 -0
  234. package/lib/components/Tooltips/OverflowTooltip.md +14 -0
  235. package/lib/components/Tooltips/OverflowTooltip.vue +68 -0
  236. package/lib/components/Tooltips/Tooltip.md +72 -0
  237. package/lib/components/Tooltips/Tooltip.vue +143 -0
  238. package/lib/directives.ts +213 -0
  239. package/lib/index.ts +108 -0
  240. package/{pocketprep-export.module.scss → lib/pocketprep-export.module.scss} +2 -2
  241. package/{pocketprep.scss → lib/pocketprep.scss} +16 -18
  242. package/{styles → lib/styles}/_colors.scss +1 -1
  243. package/lib/styles/fonts.css +149 -0
  244. package/lib/utils.ts +53 -0
  245. package/package.json +76 -56
  246. package/{stylelint.config.js → stylelint.config.cjs} +6 -3
  247. package/assets/Fonts.md +0 -114
  248. package/assets/Images.md +0 -2
  249. package/assets/Styleguidist.vue +0 -11
  250. package/dist/@pocketprep/ui-kit.common.js +0 -29726
  251. package/dist/@pocketprep/ui-kit.common.js.map +0 -1
  252. package/dist/@pocketprep/ui-kit.umd.js +0 -29745
  253. package/dist/@pocketprep/ui-kit.umd.js.map +0 -1
  254. package/dist/@pocketprep/ui-kit.umd.min.js +0 -33
  255. package/dist/@pocketprep/ui-kit.umd.min.js.map +0 -1
  256. package/dist/demo.html +0 -1
  257. package/src/directives.d.ts +0 -2
  258. package/src/shims.d.ts +0 -19
  259. package/src/utils.d.ts +0 -51
  260. package/styles/Colors.md +0 -53
  261. package/styles/Styles.md +0 -4
  262. package/styles/_fonts.scss +0 -149
  263. package/tests/shims-test.d.ts +0 -9
  264. /package/{assets → lib/assets}/fonts/muli/muli-400.eot +0 -0
  265. /package/{assets → lib/assets}/fonts/muli/muli-400.svg +0 -0
  266. /package/{assets → lib/assets}/fonts/muli/muli-400.ttf +0 -0
  267. /package/{assets → lib/assets}/fonts/muli/muli-400.woff +0 -0
  268. /package/{assets → lib/assets}/fonts/muli/muli-400.woff2 +0 -0
  269. /package/{assets → lib/assets}/fonts/muli/muli-400italic.eot +0 -0
  270. /package/{assets → lib/assets}/fonts/muli/muli-400italic.svg +0 -0
  271. /package/{assets → lib/assets}/fonts/muli/muli-400italic.ttf +0 -0
  272. /package/{assets → lib/assets}/fonts/muli/muli-400italic.woff +0 -0
  273. /package/{assets → lib/assets}/fonts/muli/muli-400italic.woff2 +0 -0
  274. /package/{assets → lib/assets}/fonts/muli/muli-600.eot +0 -0
  275. /package/{assets → lib/assets}/fonts/muli/muli-600.svg +0 -0
  276. /package/{assets → lib/assets}/fonts/muli/muli-600.ttf +0 -0
  277. /package/{assets → lib/assets}/fonts/muli/muli-600.woff +0 -0
  278. /package/{assets → lib/assets}/fonts/muli/muli-600.woff2 +0 -0
  279. /package/{assets → lib/assets}/fonts/muli/muli-600italic.eot +0 -0
  280. /package/{assets → lib/assets}/fonts/muli/muli-600italic.svg +0 -0
  281. /package/{assets → lib/assets}/fonts/muli/muli-600italic.ttf +0 -0
  282. /package/{assets → lib/assets}/fonts/muli/muli-600italic.woff +0 -0
  283. /package/{assets → lib/assets}/fonts/muli/muli-600italic.woff2 +0 -0
  284. /package/{assets → lib/assets}/fonts/muli/muli-700.eot +0 -0
  285. /package/{assets → lib/assets}/fonts/muli/muli-700.svg +0 -0
  286. /package/{assets → lib/assets}/fonts/muli/muli-700.ttf +0 -0
  287. /package/{assets → lib/assets}/fonts/muli/muli-700.woff +0 -0
  288. /package/{assets → lib/assets}/fonts/muli/muli-700.woff2 +0 -0
  289. /package/{assets → lib/assets}/fonts/muli/muli-700italic.eot +0 -0
  290. /package/{assets → lib/assets}/fonts/muli/muli-700italic.svg +0 -0
  291. /package/{assets → lib/assets}/fonts/muli/muli-700italic.ttf +0 -0
  292. /package/{assets → lib/assets}/fonts/muli/muli-700italic.woff +0 -0
  293. /package/{assets → lib/assets}/fonts/muli/muli-700italic.woff2 +0 -0
  294. /package/{assets → lib/assets}/images/amta.svg +0 -0
  295. /package/{assets → lib/assets}/images/favicon.ico +0 -0
  296. /package/{assets → lib/assets}/images/thumb-large-dark.svg +0 -0
  297. /package/{assets → lib/assets}/images/thumb-large.svg +0 -0
  298. /package/{assets → lib/assets}/images/thumb-small-dark.svg +0 -0
  299. /package/{assets → lib/assets}/images/thumb-small.svg +0 -0
  300. /package/{src → lib}/components/BundleIcons/bundleIcon.d.ts +0 -0
  301. /package/{src → lib}/components/Icons/icon.d.ts +0 -0
  302. /package/{src → lib}/components/PhonePerson/phonePerson.d.ts +0 -0
  303. /package/{src → lib}/components/Tables/table.d.ts +0 -0
  304. /package/{styles → lib/styles}/_breakpoints.scss +0 -0
  305. /package/{styles/_normalize.scss → lib/styles/normalize.css} +0 -0
@@ -0,0 +1,592 @@
1
+ <template>
2
+ <div
3
+ ref="sidepanelContainer"
4
+ v-dark="isDarkMode"
5
+ class="uikit-page-overlay"
6
+ :class="{
7
+ 'uikit-page-overlay--open': openSidePanel,
8
+ 'uikit-page-overlay--disable-transition': disableTransition
9
+ }"
10
+ role="dialog"
11
+ aria-modal="true"
12
+ tabindex="-1"
13
+ @keydown="keydownListener"
14
+ >
15
+ <div class="uikit-page-overlay__clickable" @click.self="emitClose" />
16
+ <div
17
+ ref="uikit-side-panel"
18
+ v-dark="isDarkMode"
19
+ class="uikit-side-panel"
20
+ :style="{ width: `${sidePanelWidth}px`, right: `-${sidePanelWidth}px` }"
21
+ >
22
+ <div
23
+ v-dark="isDarkMode"
24
+ class="uikit-side-panel__head"
25
+ :class="{
26
+ 'uikit-side-panel__head--has-tabs': tabs && tabs.length,
27
+ 'uikit-side-panel__head--has-stepped-tabs': tabs && tabs.length && steppedTabs,
28
+ }"
29
+ >
30
+ <div
31
+ v-dark="isDarkMode"
32
+ class="uikit-side-panel__close"
33
+ :class="{ 'uikit-side-panel__close--has-tabs': tabs && tabs.length }"
34
+ tabindex="0"
35
+ aria-label="Close"
36
+ @click="emitClose"
37
+ @keypress="closeKeyPress($event)"
38
+ @mousedown.prevent
39
+ >
40
+ <Icon type="close" />
41
+ </div>
42
+ <div
43
+ ref="uikit-side-panel__title"
44
+ class="uikit-side-panel__title"
45
+ :class="{ 'uikit-side-panel__title--has-tabs': tabs && tabs.length }"
46
+ tabindex="-1"
47
+ >
48
+ <h1 class="uikit-side-panel__title-inner">
49
+ {{ name }}
50
+ </h1>
51
+ </div>
52
+ <div
53
+ v-if="tabs && tabs.length"
54
+ class="uikit-side-panel__tabs"
55
+ role="tablist"
56
+ >
57
+ <div
58
+ v-for="(tab, index) in tabs"
59
+ :key="tab"
60
+ v-dark="isDarkMode"
61
+ class="uikit-side-panel__tab"
62
+ :class="{
63
+ 'uikit-side-panel__tab--active': activeTabName === tab,
64
+ 'uikit-side-panel__tab--stepper': steppedTabs,
65
+ }"
66
+ tabindex="0"
67
+ role="tab"
68
+ :aria-selected="activeTabName === tab ? 'true' : 'false'"
69
+ @click="selectTab($event, tab)"
70
+ @keypress="selectTab($event, tab)"
71
+ @mousedown.prevent
72
+ >
73
+ {{ tab }}
74
+ <div v-if="steppedTabs && index < tabs.length - 1" class="uikit-side-panel__tab-arrow">
75
+ <Icon type="accordionArrow" />
76
+ </div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ <div
81
+ v-dark="isDarkMode"
82
+ class="uikit-side-panel__content"
83
+ :class="{ 'uikit-side-panel__content--has-tabs': tabs && tabs.length }"
84
+ :style="{ ...customContentStyles }"
85
+ >
86
+ <slot />
87
+ </div>
88
+ <div class="uikit-side-panel__foot" :class="{ 'uikit-side-panel__foot--dark': isDarkMode }">
89
+ <div class="uikit-side-panel__foot-left">
90
+ <slot name="details" />
91
+ </div>
92
+ <div class="uikit-side-panel__foot-right">
93
+ <PocketButton
94
+ class="uikit-side-panel__foot-cancel"
95
+ type="secondary"
96
+ :is-dark-mode="isDarkMode"
97
+ @click="customCancelButtonAction ? emitCloseButton() : emitClose()"
98
+ >
99
+ {{ cancelButtonText }}
100
+ </PocketButton>
101
+ <slot name="action" />
102
+ </div>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ </template>
107
+
108
+ <script lang="ts">
109
+ import { Component, Vue, Prop, Emit } from 'vue-facing-decorator'
110
+ import Button from '../Buttons/Button.vue'
111
+ import Icon from '../Icons/Icon.vue'
112
+ import { dark } from '../../directives'
113
+
114
+ @Component({
115
+ components: {
116
+ Icon,
117
+ PocketButton: Button,
118
+ },
119
+ directives: {
120
+ dark,
121
+ },
122
+ })
123
+ export default class SidePanel extends Vue {
124
+ @Prop() name!: string
125
+ @Prop({ default: () => [] }) tabs!: string[]
126
+ @Prop({ default: undefined }) activeTabName!: string
127
+ @Prop({ default: false }) steppedTabs!: boolean
128
+ @Prop({ default: 'Cancel' }) cancelButtonText!: string
129
+ @Prop({ default: false }) customCancelButtonAction!: boolean
130
+ @Prop({ default: () => ({}) }) customContentStyles!: { [key: string]: string }
131
+ @Prop({ default: 'large' }) width!: 'large' | 'medium' | number
132
+ @Prop({ default: false }) disableTransition!: boolean
133
+ @Prop({ default: false }) isDarkMode!: boolean
134
+
135
+ openSidePanel = false
136
+ notContentHeight = this.tabs && this.tabs.length ? 262 : 218
137
+ focusListener: Parameters<typeof addEventListener>[1] | null = null
138
+ savedYPosition = 0
139
+
140
+ get sidePanelWidth () {
141
+ return this.width === 'large'
142
+ ? 572
143
+ : this.width === 'medium'
144
+ ? 460
145
+ : this.width
146
+ }
147
+
148
+ mounted () {
149
+ // Focus title after opening transition
150
+ const sidePanelEl = this.$refs['uikit-side-panel'] as HTMLElement | undefined
151
+ sidePanelEl?.addEventListener('transitionend', () => {
152
+ const titleEl = this.$refs['uikit-side-panel__title'] as HTMLElement | undefined
153
+ titleEl?.focus()
154
+ })
155
+
156
+ // delay opening to show animation
157
+ setTimeout(() => {
158
+ this.openSidePanel = true
159
+ }, 1)
160
+
161
+ // Trap the user's focus within the side panel - don't allow focusing elements behind the overlay
162
+ this.focusListener = event => {
163
+ const target = (event as FocusEvent).target as HTMLElement // The element receiving focus
164
+ const sidePanelContainerEl = this.$refs['sidepanelContainer'] as HTMLElement
165
+ const isFocusOutside = target && sidePanelContainerEl && !sidePanelContainerEl.contains(target)
166
+ const hasCalendarClass = target
167
+ && Array.from(target.classList).find(
168
+ c => c === 'button-next-month' || c === 'button-previous-month' || c === 'day-item'
169
+ )
170
+ if (isFocusOutside && !hasCalendarClass) {
171
+ const focusableSidePanelChildren = Array.from<HTMLElement>(sidePanelContainerEl.querySelectorAll(
172
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
173
+ ))
174
+ const firstFocusableSidePanelChild = focusableSidePanelChildren.find(
175
+ el => !!el.getBoundingClientRect().width
176
+ )
177
+ const reversedSidePanelChildren = [ ...focusableSidePanelChildren ].reverse()
178
+ const lastFocusableSidePanelChild = reversedSidePanelChildren.find(
179
+ el => !!el.getBoundingClientRect().width
180
+ )
181
+ if (firstFocusableSidePanelChild) {
182
+ const relatedTarget = (event as FocusEvent).relatedTarget // The element last focused
183
+ if (relatedTarget === firstFocusableSidePanelChild && lastFocusableSidePanelChild) {
184
+ // If focus moves from first element -> outside side panel, focus the last element instead
185
+ lastFocusableSidePanelChild.focus()
186
+ } else {
187
+ // If focus goes outside the side panel in any other way, focus the first element
188
+ firstFocusableSidePanelChild.focus()
189
+ }
190
+ } else {
191
+ // If the side panel doesn't have any focusable children, focus the container instead
192
+ if (sidePanelContainerEl.tabIndex === -1) {
193
+ sidePanelContainerEl.tabIndex = 0
194
+ }
195
+ sidePanelContainerEl.focus()
196
+ }
197
+ }
198
+ }
199
+ document.addEventListener('focusin', this.focusListener)
200
+
201
+ // prevent scrolling outside of modal
202
+ const openSidePanelCount = Number(document.body.getAttribute('data-openSidePanelCount'))
203
+ document.body.setAttribute('data-openSidePanelCount', String(openSidePanelCount + 1))
204
+ document.body.classList.add('uikit-sidepanel-open')
205
+ }
206
+
207
+ beforeUnmount () {
208
+ if (this.focusListener) {
209
+ document.removeEventListener('focusin', this.focusListener)
210
+ }
211
+
212
+ const openSidePanelCount = Number(document.body.getAttribute('data-openSidePanelCount'))
213
+ document.body.setAttribute('data-openSidePanelCount', String(openSidePanelCount - 1))
214
+ if (openSidePanelCount <= 1) {
215
+ document.body.classList.remove('uikit-sidepanel-open')
216
+ document.body.scrollTo(0, 0)
217
+ }
218
+ }
219
+
220
+ selectTab (e: MouseEvent | KeyboardEvent, tabName: string) {
221
+ e.preventDefault()
222
+ this.emitSelectTab(tabName)
223
+ }
224
+
225
+ keydownListener (e: Event | KeyboardEvent) {
226
+ if (!('key' in e)) {
227
+ return
228
+ }
229
+
230
+ if (e.key.match(/^[A-Za-z0-9\s\-_@]$/)) {
231
+ e.stopPropagation()
232
+ }
233
+
234
+ if (e.key === 'Escape') {
235
+ this.emitClose()
236
+ }
237
+ }
238
+
239
+ closeKeyPress (e: KeyboardEvent) {
240
+ if (e.key === 'Enter' || e.key === ' ') {
241
+ e.preventDefault()
242
+ this.emitClose()
243
+ }
244
+ }
245
+
246
+ @Emit('close')
247
+ emitClose () {
248
+ return true
249
+ }
250
+
251
+ @Emit('close-button')
252
+ emitCloseButton () {
253
+ return true
254
+ }
255
+
256
+ @Emit('selectTab')
257
+ emitSelectTab (tabName: string) {
258
+ return tabName
259
+ }
260
+ }
261
+ </script>
262
+
263
+ <style lang="scss">
264
+ @import '../../styles/colors';
265
+ @import '../../styles/breakpoints';
266
+
267
+ .uikit-page-overlay {
268
+ background: rgba($brand-black, 0);
269
+ position: absolute;
270
+ left: 0;
271
+ top: 54px;
272
+ width: 100%;
273
+ height: calc(100% - 54px);
274
+ z-index: 1000;
275
+ outline: none;
276
+
277
+ @include breakpoint(black-bear) {
278
+ height: calc(100% - 10px);
279
+ top: 0;
280
+ background: transparent !important;
281
+ }
282
+
283
+ &--open {
284
+ background: rgba($brand-black, 0.15);
285
+ transition: 0.3s all;
286
+
287
+ & > .uikit-side-panel {
288
+ right: 0 !important;
289
+ transition: 0.3s all;
290
+ }
291
+
292
+ &--dark {
293
+ background: rgba($jet, 0.8);
294
+ }
295
+ }
296
+
297
+ &--disable-transition {
298
+ transition: 0s all !important;
299
+
300
+ & > .uikit-side-panel {
301
+ transition: 0s all !important;
302
+ }
303
+ }
304
+
305
+ &__clickable {
306
+ z-index: -1;
307
+ position: absolute;
308
+ left: 0;
309
+ top: 0;
310
+ width: 100%;
311
+ height: 100%;
312
+ }
313
+ }
314
+
315
+ .uikit-side-panel {
316
+ height: 100%;
317
+ position: absolute;
318
+ top: 0;
319
+ background: $gray-background;
320
+ box-shadow: 0 1px 40px 0 rgba($pewter, 0.5);
321
+ display: flex;
322
+ flex-direction: column;
323
+ z-index: 1;
324
+
325
+ @include breakpoint(black-bear) {
326
+ top: 10px;
327
+ left: 0;
328
+ right: auto !important;
329
+ width: 100% !important;
330
+ border-radius: 8px 8px 0 0;
331
+ }
332
+
333
+ &--dark {
334
+ background: $charcoal;
335
+ box-shadow: 0 1px 40px 0 $jet;
336
+ }
337
+
338
+ &__head {
339
+ background: $white;
340
+ padding: 30px 44px 26px;
341
+ position: relative;
342
+ box-sizing: border-box;
343
+ border-bottom: 1px solid rgba($gray-divider, 0.5);
344
+ user-select: none;
345
+
346
+ @include breakpoint(black-bear) {
347
+ padding: 13px 29px 11px;
348
+ border-radius: 8px 8px 0 0;
349
+ }
350
+
351
+ &--has-tabs {
352
+ padding: 32px 64px 40px 43px;
353
+
354
+ @include breakpoint(black-bear) {
355
+ padding: 13px 50px 46px 29px;
356
+ }
357
+ }
358
+
359
+ &--has-stepped-tabs {
360
+ padding-bottom: 69px;
361
+ }
362
+
363
+ &--dark {
364
+ background: $brand-black;
365
+ color: $white;
366
+ border-bottom-color: $charcoal;
367
+ }
368
+ }
369
+
370
+ &__close {
371
+ position: absolute;
372
+ right: 26px;
373
+ top: 30px;
374
+ height: 30px;
375
+ width: 30px;
376
+ cursor: pointer;
377
+ font-size: 30px;
378
+ color: $brand-blue;
379
+ outline: none;
380
+
381
+ @include breakpoint(black-bear) {
382
+ right: 13px;
383
+ top: 11px;
384
+ }
385
+
386
+ &--has-tabs {
387
+ @include breakpoint(black-bear) {
388
+ right: 13px;
389
+ top: 13px;
390
+ }
391
+ }
392
+
393
+ &:hover {
394
+ color: $brand-black;
395
+ }
396
+
397
+ &:focus::before {
398
+ content: '';
399
+ left: -1px;
400
+ top: -1px;
401
+ width: 100%;
402
+ height: 100%;
403
+ position: absolute;
404
+ border: 1px solid $brand-blue;
405
+ border-radius: 5px;
406
+ }
407
+
408
+ &--dark {
409
+ color: $banana-bread;
410
+
411
+ &:hover {
412
+ color: $butterscotch;
413
+ }
414
+
415
+ &:focus::before {
416
+ border-color: $banana-bread;
417
+ }
418
+ }
419
+
420
+ svg {
421
+ width: 100%;
422
+ height: 100%;
423
+ }
424
+ }
425
+
426
+ &__title {
427
+ width: calc(100% - 38px);
428
+ display: flex;
429
+ align-items: center;
430
+ outline: none;
431
+ }
432
+
433
+ &__title-inner {
434
+ font-size: 26px;
435
+ line-height: 32px;
436
+ width: calc(100% - 38px);
437
+ font-weight: 500;
438
+ margin: 0;
439
+
440
+ @include breakpoint(black-bear) {
441
+ font-size: 22px;
442
+ line-height: 26px;
443
+ }
444
+ }
445
+
446
+ &__tabs {
447
+ position: absolute;
448
+ bottom: -1px;
449
+ left: 28px;
450
+ display: flex;
451
+
452
+ @include breakpoint(black-bear) {
453
+ left: 14px;
454
+ }
455
+ }
456
+
457
+ &__tab {
458
+ font-size: 16px;
459
+ color: $slate-01;
460
+ line-height: 19px;
461
+ position: relative;
462
+ padding: 6px 8px;
463
+ margin: 0 8px;
464
+ cursor: pointer;
465
+ user-select: none;
466
+
467
+ &:hover {
468
+ color: $brand-blue;
469
+ }
470
+
471
+ &:focus {
472
+ border-radius: 2px;
473
+ box-shadow: 0 0 0 1px $brand-blue;
474
+ outline: 0;
475
+ }
476
+
477
+ &--dark {
478
+ color: $pewter;
479
+
480
+ &:hover {
481
+ color: $butterscotch;
482
+ }
483
+
484
+ &:focus {
485
+ box-shadow: 0 0 0 1px $butterscotch;
486
+ }
487
+ }
488
+
489
+ &--active {
490
+ color: $brand-black;
491
+
492
+ &::after {
493
+ content: '';
494
+ position: absolute;
495
+ bottom: -1px;
496
+ left: 0;
497
+ width: 100%;
498
+ height: 1.5px;
499
+ background: $brand-blue;
500
+ }
501
+
502
+ &--dark {
503
+ color: $banana-bread;
504
+
505
+ &::after {
506
+ background: $banana-bread;
507
+ }
508
+ }
509
+ }
510
+
511
+ &--stepper {
512
+ font-size: 15px;
513
+ line-height: 18px;
514
+ padding: 8px 9px 7px;
515
+ margin-bottom: 11px;
516
+
517
+ &::after {
518
+ bottom: 4px;
519
+ left: 9px;
520
+ width: calc(100% - 18px);
521
+ }
522
+ }
523
+ }
524
+
525
+ &__tab-arrow {
526
+ position: absolute;
527
+ right: -10px;
528
+ top: 8px;
529
+ transform: rotate(-90deg);
530
+ color: #708a9d;
531
+
532
+ svg {
533
+ width: 8px;
534
+ height: 5px;
535
+ }
536
+ }
537
+
538
+ &__content {
539
+ overflow: auto;
540
+ padding: 36px 44px;
541
+ position: relative;
542
+ flex: 1;
543
+ -webkit-overflow-scrolling: touch;
544
+
545
+ @include breakpoint(black-bear) {
546
+ padding: 30px;
547
+ }
548
+
549
+ & > p {
550
+ color: $slate-03;
551
+ font-size: 15px;
552
+ line-height: 20px;
553
+ margin: 5px 0 40px;
554
+ }
555
+
556
+ &--dark {
557
+ color: $fog;
558
+ }
559
+ }
560
+
561
+ &__foot {
562
+ justify-content: space-between;
563
+ background: $barely-background;
564
+ height: 56px;
565
+ width: 100%;
566
+ padding: 10px 32px;
567
+ display: flex;
568
+ box-sizing: border-box;
569
+ border-top: 1px solid rgba($gray-divider, 0.5);
570
+ align-items: center;
571
+
572
+ @include breakpoint(black-bear) {
573
+ padding: 10px 18px;
574
+ }
575
+
576
+ &--dark {
577
+ background: $brand-black;
578
+ border-top-color: $charcoal;
579
+ }
580
+ }
581
+
582
+ &__foot-right {
583
+ display: flex;
584
+ align-items: center;
585
+ justify-content: flex-end;
586
+ }
587
+
588
+ &__foot-cancel {
589
+ margin-right: 8px;
590
+ }
591
+ }
592
+ </style>