@pocketprep/ui-kit 2.0.40 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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/lib/SVGDefinitions.vue +85 -0
  8. package/lib/assets/emojis/tada.png +0 -0
  9. package/lib/assets/halftones/halftone-black.png +0 -0
  10. package/lib/assets/halftones/halftone-blue.png +0 -0
  11. package/lib/assets/halftones/halftone-green.png +0 -0
  12. package/lib/assets/halftones/halftone-purple.png +0 -0
  13. package/lib/assets/halftones/halftone-red.png +0 -0
  14. package/lib/assets/halftones/halftone-yellow.png +0 -0
  15. package/lib/assets/question/paywall-dark.png +0 -0
  16. package/lib/assets/question/paywall-light.png +0 -0
  17. package/lib/components/Banners/Banner.md +41 -0
  18. package/lib/components/Banners/Banner.vue +87 -0
  19. package/lib/components/BundleIcons/AMTA.vue +134 -0
  20. package/lib/components/BundleIcons/BundleIcon.md +60 -0
  21. package/lib/components/BundleIcons/BundleIcon.vue +111 -0
  22. package/lib/components/Bundles/BundleList.md +63 -0
  23. package/lib/components/Bundles/BundleList.vue +170 -0
  24. package/lib/components/Bundles/BundleSearch.md +195 -0
  25. package/lib/components/Bundles/BundleSearch.vue +573 -0
  26. package/lib/components/Bundles/PremiumPill.md +23 -0
  27. package/lib/components/Bundles/PremiumPill.vue +43 -0
  28. package/lib/components/Buttons/Button.md +99 -0
  29. package/lib/components/Buttons/Button.vue +496 -0
  30. package/lib/components/Buttons/Link.md +58 -0
  31. package/lib/components/Buttons/Link.vue +192 -0
  32. package/lib/components/Buttons/Tab.md +35 -0
  33. package/lib/components/Buttons/Tab.vue +103 -0
  34. package/lib/components/Calendar/Calendar.md +18 -0
  35. package/lib/components/Calendar/Calendar.vue +162 -0
  36. package/lib/components/Charts/Bar.md +123 -0
  37. package/lib/components/Charts/Bar.vue +364 -0
  38. package/lib/components/Charts/Pie.md +23 -0
  39. package/lib/components/Charts/Pie.vue +105 -0
  40. package/lib/components/Controls/SegmentControl.md +47 -0
  41. package/lib/components/Controls/SegmentControl.vue +117 -0
  42. package/lib/components/Controls/Slider.md +67 -0
  43. package/lib/components/Controls/Slider.vue +358 -0
  44. package/lib/components/Controls/ToggleSwitch.md +56 -0
  45. package/lib/components/Controls/ToggleSwitch.vue +160 -0
  46. package/lib/components/Exams/ExamCard.md +45 -0
  47. package/lib/components/Exams/ExamCard.vue +257 -0
  48. package/lib/components/Exams/ExamMenuCard.md +90 -0
  49. package/lib/components/Exams/ExamMenuCard.vue +218 -0
  50. package/lib/components/Filters/FilterDropdown.md +59 -0
  51. package/lib/components/Filters/FilterDropdown.vue +176 -0
  52. package/lib/components/Filters/FilterOptions.md +65 -0
  53. package/lib/components/Filters/FilterOptions.vue +265 -0
  54. package/lib/components/Filters/filterOptions.d.ts +10 -0
  55. package/lib/components/Forms/Checkbox.md +52 -0
  56. package/lib/components/Forms/Checkbox.vue +184 -0
  57. package/lib/components/Forms/CheckboxOption.md +37 -0
  58. package/lib/components/Forms/CheckboxOption.vue +173 -0
  59. package/lib/components/Forms/Errors.md +23 -0
  60. package/lib/components/Forms/Errors.vue +109 -0
  61. package/lib/components/Forms/Input.md +63 -0
  62. package/lib/components/Forms/Input.vue +310 -0
  63. package/lib/components/Forms/Radio.md +66 -0
  64. package/lib/components/Forms/Radio.vue +312 -0
  65. package/lib/components/Forms/Select.md +133 -0
  66. package/lib/components/Forms/Select.vue +670 -0
  67. package/lib/components/Forms/Textarea.md +57 -0
  68. package/lib/components/Forms/Textarea.vue +157 -0
  69. package/lib/components/Icons/Icon.md +146 -0
  70. package/lib/components/Icons/Icon.vue +192 -0
  71. package/lib/components/Icons/IconAccordionArrow.md +7 -0
  72. package/lib/components/Icons/IconAccordionArrow.vue +23 -0
  73. package/lib/components/Icons/IconActivity.md +7 -0
  74. package/lib/components/Icons/IconActivity.vue +21 -0
  75. package/lib/components/Icons/IconAdd.md +7 -0
  76. package/lib/components/Icons/IconAdd.vue +19 -0
  77. package/lib/components/Icons/IconAddCircle.md +7 -0
  78. package/lib/components/Icons/IconAddCircle.vue +22 -0
  79. package/lib/components/Icons/IconArrow.md +7 -0
  80. package/lib/components/Icons/IconArrow.vue +21 -0
  81. package/lib/components/Icons/IconBarChart.md +7 -0
  82. package/lib/components/Icons/IconBarChart.vue +23 -0
  83. package/lib/components/Icons/IconCalendar.md +7 -0
  84. package/lib/components/Icons/IconCalendar.vue +19 -0
  85. package/lib/components/Icons/IconCheck.md +7 -0
  86. package/lib/components/Icons/IconCheck.vue +21 -0
  87. package/lib/components/Icons/IconClose.md +7 -0
  88. package/lib/components/Icons/IconClose.vue +23 -0
  89. package/lib/components/Icons/IconCorrect.md +7 -0
  90. package/lib/components/Icons/IconCorrect.vue +19 -0
  91. package/lib/components/Icons/IconEdit.md +7 -0
  92. package/lib/components/Icons/IconEdit.vue +21 -0
  93. package/lib/components/Icons/IconExam.md +7 -0
  94. package/lib/components/Icons/IconExam.vue +34 -0
  95. package/lib/components/Icons/IconExternalLink.md +7 -0
  96. package/lib/components/Icons/IconExternalLink.vue +30 -0
  97. package/lib/components/Icons/IconEyeHide.md +7 -0
  98. package/lib/components/Icons/IconEyeHide.vue +21 -0
  99. package/lib/components/Icons/IconEyeShow.md +7 -0
  100. package/lib/components/Icons/IconEyeShow.vue +21 -0
  101. package/lib/components/Icons/IconFilter.md +7 -0
  102. package/lib/components/Icons/IconFilter.vue +19 -0
  103. package/lib/components/Icons/IconFilterActive.md +7 -0
  104. package/lib/components/Icons/IconFilterActive.vue +20 -0
  105. package/lib/components/Icons/IconFlag.md +7 -0
  106. package/lib/components/Icons/IconFlag.vue +25 -0
  107. package/lib/components/Icons/IconFlagFeedback.md +11 -0
  108. package/lib/components/Icons/IconFlagFeedback.vue +24 -0
  109. package/lib/components/Icons/IconFlagFilled.md +7 -0
  110. package/lib/components/Icons/IconFlagFilled.vue +22 -0
  111. package/lib/components/Icons/IconFullView.md +7 -0
  112. package/lib/components/Icons/IconFullView.vue +30 -0
  113. package/lib/components/Icons/IconFullViewActive.md +7 -0
  114. package/lib/components/Icons/IconFullViewActive.vue +28 -0
  115. package/lib/components/Icons/IconHandle.md +7 -0
  116. package/lib/components/Icons/IconHandle.vue +23 -0
  117. package/lib/components/Icons/IconHeart.md +7 -0
  118. package/lib/components/Icons/IconHeart.vue +19 -0
  119. package/lib/components/Icons/IconHelp.md +7 -0
  120. package/lib/components/Icons/IconHelp.vue +25 -0
  121. package/lib/components/Icons/IconHourglass.md +7 -0
  122. package/lib/components/Icons/IconHourglass.vue +22 -0
  123. package/lib/components/Icons/IconImage.md +7 -0
  124. package/lib/components/Icons/IconImage.vue +21 -0
  125. package/lib/components/Icons/IconIncorrect.md +7 -0
  126. package/lib/components/Icons/IconIncorrect.vue +21 -0
  127. package/lib/components/Icons/IconInfo.md +7 -0
  128. package/lib/components/Icons/IconInfo.vue +24 -0
  129. package/lib/components/Icons/IconKeyboard.md +7 -0
  130. package/lib/components/Icons/IconKeyboard.vue +25 -0
  131. package/lib/components/Icons/IconLaunch.md +7 -0
  132. package/lib/components/Icons/IconLaunch.vue +25 -0
  133. package/lib/components/Icons/IconLightning.md +7 -0
  134. package/lib/components/Icons/IconLightning.vue +21 -0
  135. package/lib/components/Icons/IconList.md +7 -0
  136. package/lib/components/Icons/IconList.vue +26 -0
  137. package/lib/components/Icons/IconLoading.md +7 -0
  138. package/lib/components/Icons/IconLoading.vue +65 -0
  139. package/lib/components/Icons/IconLoading2.md +7 -0
  140. package/lib/components/Icons/IconLoading2.vue +52 -0
  141. package/lib/components/Icons/IconLock.md +7 -0
  142. package/lib/components/Icons/IconLock.vue +23 -0
  143. package/lib/components/Icons/IconMissedQuestions.md +7 -0
  144. package/lib/components/Icons/IconMissedQuestions.vue +22 -0
  145. package/lib/components/Icons/IconMoon.md +7 -0
  146. package/lib/components/Icons/IconMoon.vue +25 -0
  147. package/lib/components/Icons/IconPaginationArrow.md +7 -0
  148. package/lib/components/Icons/IconPaginationArrow.vue +23 -0
  149. package/lib/components/Icons/IconPassage.md +7 -0
  150. package/lib/components/Icons/IconPassage.vue +22 -0
  151. package/lib/components/Icons/IconPencil.md +7 -0
  152. package/lib/components/Icons/IconPencil.vue +19 -0
  153. package/lib/components/Icons/IconPeople.md +7 -0
  154. package/lib/components/Icons/IconPeople.vue +25 -0
  155. package/lib/components/Icons/IconQuestions.md +7 -0
  156. package/lib/components/Icons/IconQuestions.vue +25 -0
  157. package/lib/components/Icons/IconQuick10.md +7 -0
  158. package/lib/components/Icons/IconQuick10.vue +23 -0
  159. package/lib/components/Icons/IconRemoveCircle.md +7 -0
  160. package/lib/components/Icons/IconRemoveCircle.vue +22 -0
  161. package/lib/components/Icons/IconReviewFlag.md +7 -0
  162. package/lib/components/Icons/IconReviewFlag.vue +32 -0
  163. package/lib/components/Icons/IconSearch.md +7 -0
  164. package/lib/components/Icons/IconSearch.vue +23 -0
  165. package/lib/components/Icons/IconShare.md +7 -0
  166. package/lib/components/Icons/IconShare.vue +31 -0
  167. package/lib/components/Icons/IconSideBar.md +7 -0
  168. package/lib/components/Icons/IconSideBar.vue +26 -0
  169. package/lib/components/Icons/IconSideBarActive.md +7 -0
  170. package/lib/components/Icons/IconSideBarActive.vue +28 -0
  171. package/lib/components/Icons/IconStopwatch.md +7 -0
  172. package/lib/components/Icons/IconStopwatch.vue +22 -0
  173. package/lib/components/Icons/IconStrike.md +60 -0
  174. package/lib/components/Icons/IconStrike.vue +23 -0
  175. package/lib/components/Icons/IconSubject.md +7 -0
  176. package/lib/components/Icons/IconSubject.vue +22 -0
  177. package/lib/components/Icons/IconText.md +7 -0
  178. package/lib/components/Icons/IconText.vue +22 -0
  179. package/lib/components/Icons/IconWarning.md +7 -0
  180. package/lib/components/Icons/IconWarning.vue +22 -0
  181. package/lib/components/Modal/Modal.md +31 -0
  182. package/lib/components/Modal/Modal.vue +133 -0
  183. package/lib/components/Modal/ModalContainer.md +96 -0
  184. package/lib/components/Modal/ModalContainer.vue +208 -0
  185. package/lib/components/Onboarding/EmailAuth.md +40 -0
  186. package/lib/components/Onboarding/EmailAuth.vue +218 -0
  187. package/lib/components/Onboarding/MagicCodeEntry.md +20 -0
  188. package/lib/components/Onboarding/MagicCodeEntry.vue +189 -0
  189. package/lib/components/PhonePerson/PhonePerson.md +36 -0
  190. package/lib/components/PhonePerson/PhonePerson.vue +48 -0
  191. package/lib/components/PhonePerson/phoneperson-IT@2x.png +0 -0
  192. package/lib/components/PhonePerson/phoneperson-auto@2x.png +0 -0
  193. package/lib/components/PhonePerson/phoneperson-behavioralhealth@2x.png +0 -0
  194. package/lib/components/PhonePerson/phoneperson-emt@2x.png +0 -0
  195. package/lib/components/PhonePerson/phoneperson-essentials@2x.png +0 -0
  196. package/lib/components/PhonePerson/phoneperson-finance@2x.png +0 -0
  197. package/lib/components/PhonePerson/phoneperson-fitness@2x.png +0 -0
  198. package/lib/components/PhonePerson/phoneperson-medical@2x.png +0 -0
  199. package/lib/components/PhonePerson/phoneperson-nursing@2x.png +0 -0
  200. package/lib/components/PhonePerson/phoneperson-nursingschool@2x.png +0 -0
  201. package/lib/components/PhonePerson/phoneperson-professional@2x.png +0 -0
  202. package/lib/components/PhonePerson/phoneperson-skilledtrades@2x.png +0 -0
  203. package/lib/components/Quiz/FlagToggle.md +37 -0
  204. package/lib/components/Quiz/FlagToggle.vue +124 -0
  205. package/lib/components/Quiz/GlobalMetricsToggle.md +46 -0
  206. package/lib/components/Quiz/GlobalMetricsToggle.vue +124 -0
  207. package/lib/components/Quiz/KeyboardShortcutsButton.md +18 -0
  208. package/lib/components/Quiz/KeyboardShortcutsButton.vue +102 -0
  209. package/lib/components/Quiz/KeyboardShortcutsModal.md +71 -0
  210. package/lib/components/Quiz/KeyboardShortcutsModal.vue +261 -0
  211. package/lib/components/Quiz/Question.md +579 -0
  212. package/lib/components/Quiz/Question.vue +3262 -0
  213. package/lib/components/Quiz/QuizContainer.md +91 -0
  214. package/lib/components/Quiz/QuizContainer.vue +207 -0
  215. package/lib/components/Quiz/QuizProgress.md +122 -0
  216. package/lib/components/Quiz/QuizProgress.vue +188 -0
  217. package/lib/components/Quiz/QuizProgressBar.md +131 -0
  218. package/lib/components/Quiz/QuizProgressBar.vue +96 -0
  219. package/lib/components/Search/Pill.md +37 -0
  220. package/lib/components/Search/Pill.vue +117 -0
  221. package/lib/components/Search/Search.md +44 -0
  222. package/lib/components/Search/Search.vue +341 -0
  223. package/lib/components/SidePanels/SidePanel.md +126 -0
  224. package/lib/components/SidePanels/SidePanel.vue +592 -0
  225. package/lib/components/Tables/StudyTable.md +136 -0
  226. package/lib/components/Tables/Table.vue +497 -0
  227. package/lib/components/Tables/TableActions.vue +199 -0
  228. package/lib/components/Tables/TablePagination.md +19 -0
  229. package/lib/components/Tables/TablePagination.vue +109 -0
  230. package/lib/components/Tables/TeachTable.md +696 -0
  231. package/lib/components/Toasts/Toast.md +35 -0
  232. package/lib/components/Toasts/Toast.vue +213 -0
  233. package/lib/components/Tooltips/OverflowTooltip.md +14 -0
  234. package/lib/components/Tooltips/OverflowTooltip.vue +68 -0
  235. package/lib/components/Tooltips/Tooltip.md +72 -0
  236. package/lib/components/Tooltips/Tooltip.vue +143 -0
  237. package/lib/directives.ts +213 -0
  238. package/lib/index.ts +108 -0
  239. package/{pocketprep-export.module.scss → lib/pocketprep-export.module.scss} +2 -2
  240. package/{pocketprep.scss → lib/pocketprep.scss} +16 -18
  241. package/{styles → lib/styles}/_colors.scss +1 -1
  242. package/lib/styles/fonts.css +149 -0
  243. package/lib/utils.ts +53 -0
  244. package/package.json +75 -56
  245. package/{stylelint.config.js → stylelint.config.cjs} +6 -3
  246. package/assets/Fonts.md +0 -114
  247. package/assets/Images.md +0 -2
  248. package/assets/Styleguidist.vue +0 -11
  249. package/dist/@pocketprep/ui-kit.common.js +0 -29726
  250. package/dist/@pocketprep/ui-kit.common.js.map +0 -1
  251. package/dist/@pocketprep/ui-kit.umd.js +0 -29745
  252. package/dist/@pocketprep/ui-kit.umd.js.map +0 -1
  253. package/dist/@pocketprep/ui-kit.umd.min.js +0 -33
  254. package/dist/@pocketprep/ui-kit.umd.min.js.map +0 -1
  255. package/dist/demo.html +0 -1
  256. package/index.d.ts +0 -63
  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,136 @@
1
+ ```vue
2
+ <template>
3
+ <div>
4
+ <Button class="btn-dm" @click="isDarkMode = !isDarkMode">{{ isDarkMode ? 'Disable' : 'Enable' }} Dark Mode</Button>
5
+ <div class="tables" :class="{ dark: isDarkMode }">
6
+ <div class="table-examples__summary" :class="{ 'table-examples__summary--dark': isDarkMode }">
7
+ Open Table with sort, row button, no header label, and custom field
8
+ <ul class="table-examples__list">
9
+ <li>Study Settings - Exams</li>
10
+ </ul>
11
+ </div>
12
+ <Table
13
+ class="table-examples__1"
14
+ theme="open"
15
+ :rows="table1.rows"
16
+ :columns="table1.columns"
17
+ :show-header="false"
18
+ @rowButtonClicked="table1.rowButtonClicked"
19
+ @sort="table1.updateSortSettings"
20
+ :isDarkMode="isDarkMode"
21
+ >
22
+ <template #tableCellValue="{ row, column }">
23
+ <template v-if="column.propName === 'progress'">
24
+ <div class="progress">
25
+ <div class="progress__numbers" style="display: inline-block;">
26
+ 6 / 60
27
+ </div>
28
+ <div class="progress__bar" style=" margin-left: 5px; width: 94px; height: 14px; background: #edeef3; display: inline-block;"></div>
29
+ </div>
30
+ </template>
31
+ <template v-else-if="column.propName === 'action'">
32
+ <Button :isDarkMode="isDarkMode" type="tertiary-small">Edit Exam</Button>
33
+ </template>
34
+ <template v-else>
35
+ {{ row[column.propName] }}
36
+ </template>
37
+ </template>
38
+ </Table>
39
+ </div>
40
+ </div>
41
+ </template>
42
+
43
+ <script>
44
+ import Table from '../Tables/Table.vue'
45
+ import Button from '../Buttons/Button.vue'
46
+
47
+ // const grid = {
48
+ // 'display': 'inline-grid',
49
+ // 'grid-template-columns': 'repeat(2, minmax(150px, 1fr))',
50
+ // }
51
+ const grid = undefined
52
+
53
+ const rows1 = [{
54
+ id: 1,
55
+ exam: 'ASWB LCSW',
56
+ access: 'Basic',
57
+ }, {
58
+ id: 2,
59
+ exam: 'ASWB MSW',
60
+ access: 'Premium License Code',
61
+ }]
62
+ const columns1 = [{
63
+ name: 'Exam',
64
+ propName: 'exam',
65
+ }, {
66
+ name: 'Access',
67
+ propName: 'access',
68
+ }, {
69
+ name: 'Progress',
70
+ propName: 'progress',
71
+ }, {
72
+ name: 'Action',
73
+ propName: 'action',
74
+ isLabelHidden: true,
75
+ isSortDisabled: true,
76
+ }]
77
+ const table1 = {
78
+ rows: rows1,
79
+ columns: columns1,
80
+ updateSortSettings: (sortSettings) => {
81
+ // noop
82
+ },
83
+ rowButtonClicked: (row) => {
84
+ // noop
85
+ },
86
+ }
87
+
88
+ export default {
89
+ components: {
90
+ Table,
91
+ Button,
92
+ },
93
+ data () {
94
+ return {
95
+ grid,
96
+ table1,
97
+ isDarkMode: false,
98
+ }
99
+ },
100
+ }
101
+ </script>
102
+
103
+ <style>
104
+ .btn-dm {
105
+ margin-bottom: 30px;
106
+ }
107
+
108
+ .tables {
109
+ padding: 30px;
110
+ }
111
+
112
+ .dark {
113
+ background-color: #1f3545;
114
+ }
115
+
116
+ .table-examples__1 {
117
+ margin-bottom: 72px;
118
+ }
119
+
120
+ .table-examples__summary {
121
+ background-color: #f4f5f9;
122
+ padding: 10px;
123
+ margin-bottom: 12px;
124
+ border-radius: 6px;
125
+ }
126
+
127
+ .table-examples__summary--dark {
128
+ background: #0f1d28;
129
+ color: white;
130
+ }
131
+
132
+ .table-examples__list {
133
+ margin: 0;
134
+ }
135
+ </style>
136
+ ```
@@ -0,0 +1,497 @@
1
+ <template>
2
+ <div
3
+ v-dark="isDarkMode"
4
+ class="uikit-table__container"
5
+ :style="tableContainerStyles"
6
+ >
7
+ <slot name="table">
8
+ <div class="uikit-table" :style="tableStyles">
9
+ <slot
10
+ v-if="showHeader"
11
+ name="tableHeader"
12
+ >
13
+ <div class="uikit-table__header" :style="tableHeaderStyles">
14
+ <slot name="tableName">
15
+ <div class="uikit-table__name" :style="tableNameStyles">
16
+ {{ name }}
17
+ </div>
18
+ </slot>
19
+ <slot v-if="count !== undefined" name="tableCount">
20
+ <div class="uikit-table__count" :style="tableCountStyles">
21
+ {{ count }}
22
+ </div>
23
+ </slot>
24
+ </div>
25
+ </slot>
26
+ <slot name="tableContent">
27
+ <table
28
+ class="uikit-table__content"
29
+ role="grid"
30
+ :style="tableContentStyles"
31
+ >
32
+ <slot name="tableColumnLabels">
33
+ <thead role="rowgroup" class="uikit-table__rows">
34
+ <tr
35
+ v-dark="isDarkMode"
36
+ class="uikit-table__column-labels"
37
+ :style="{
38
+ ...gridStyles,
39
+ ...tableColumnLabelsStyles
40
+ }"
41
+ role="row"
42
+ >
43
+ <template v-for="column in columns">
44
+ <slot name="tableColumnLabel" :column="column">
45
+ <th
46
+ :key="`column-label--${column.propName}`"
47
+ class="uikit-table__column-label"
48
+ :style="{
49
+ ...tableColumnLabelStyles,
50
+ ...column.styles,
51
+ ...column.labelStyles,
52
+ }"
53
+ scope="col"
54
+ role="columnheader"
55
+ :aria-sort="
56
+ (!currentSort.column
57
+ || currentSort.column.propName !== column.propName
58
+ || currentSort.direction === 0)
59
+ ? 'none'
60
+ : currentSort.direction === -1
61
+ ? 'ascending'
62
+ : 'descending'"
63
+ >
64
+ <slot name="tableColumnLabelContent" :column="column">
65
+ <!-- eslint-disable max-len -->
66
+ <div
67
+ v-dark="isDarkMode"
68
+ class="uikit-table__column-label-content"
69
+ :class="{
70
+ 'uikit-table__column-label-content--sort-disabled': column.isSortDisabled
71
+ }"
72
+ :role="column.isSortDisabled ? 'presentation' : 'button'"
73
+ :aria-label="
74
+ (!currentSort.column
75
+ || currentSort.column.propName !== column.propName
76
+ || currentSort.direction === 0)
77
+ ? `${column.name || column.propName} (sortable)`
78
+ : currentSort.direction === -1
79
+ ? `${column.name || column.propName} (sorted ascending)`
80
+ : `${column.name || column.propName} (sorted descending)`"
81
+ :tabindex="column.isSortDisabled ? -1 : 0"
82
+ @click="columnLabelClicked(column)"
83
+ @keydown.enter="columnLabelClicked(column)"
84
+ @mousedown.prevent
85
+ >
86
+ <!-- eslint-enable max-len -->
87
+ <template v-if="!column.isLabelHidden">
88
+ <slot name="tableColumnLabelText" :column="column">
89
+ {{ column.name || column.propName }}
90
+ </slot>
91
+ <slot name="tableSortIcon" :column="column">
92
+ <Icon
93
+ v-if="!column.isSortDisabled"
94
+ v-dark="isDarkMode"
95
+ class="uikit-table__sort-icon"
96
+ :class="{
97
+ 'uikit-table__sort-icon--visible':
98
+ currentSort.column
99
+ && currentSort.column.propName
100
+ === column.propName
101
+ && currentSort.direction !== 0,
102
+ 'uikit-table__sort-icon--up': currentSort
103
+ && currentSort.direction === -1,
104
+ }"
105
+ :style="tableSortIconStyles"
106
+ type="accordionArrow"
107
+ />
108
+ </slot>
109
+ </template>
110
+ </div>
111
+ </slot>
112
+ </th>
113
+ </slot>
114
+ </template>
115
+ </tr>
116
+ </thead>
117
+ </slot>
118
+ <slot name="tableRows">
119
+ <tbody
120
+ :key="rows.map(row => row.id).join('-')"
121
+ class="uikit-table__rows"
122
+ role="rowgroup"
123
+ :style="tableRowsStyles"
124
+ >
125
+ <template v-for="row in rows">
126
+ <slot name="tableRow" :row="row">
127
+ <tr
128
+ :key="`row--${row.id}`"
129
+ v-dark="isDarkMode"
130
+ class="uikit-table__row"
131
+ role="row"
132
+ :tabIndex="row.tabIndex === 0 ? 0 : -1"
133
+ :class="{
134
+ 'uikit-table__row--hover-focus': row.tabIndex === 0
135
+ }"
136
+ :style="{
137
+ ...gridStyles,
138
+ ...tableRowStyles,
139
+ ...row.styles,
140
+ }"
141
+ @click="emitRowClicked(row)"
142
+ @keydown.enter="emitRowClicked(row)"
143
+ @mouseenter="emitRowEnter(row)"
144
+ @mouseleave="emitRowLeave(row)"
145
+ >
146
+ <template v-for="column in columns">
147
+ <slot
148
+ name="tableCell"
149
+ :row="row"
150
+ :column="column"
151
+ :table-cell-styles="tableCellStyles"
152
+ >
153
+ <td
154
+ :key="`row-${row.id}--column-${column.propName}`"
155
+ role="cell"
156
+ class="uikit-table__cell"
157
+ :style="{
158
+ ...tableCellStyles,
159
+ ...column.styles,
160
+ }"
161
+ @click="emitCellClicked(row, column)"
162
+ >
163
+ <slot
164
+ name="tableCellValue"
165
+ :row="row"
166
+ :column="column"
167
+ >
168
+ <OverflowTooltip>
169
+ {{ row[column.propName] }}
170
+ </OverflowTooltip>
171
+ </slot>
172
+ </td>
173
+ </slot>
174
+ </template>
175
+ </tr>
176
+ </slot>
177
+ </template>
178
+ </tbody>
179
+ </slot>
180
+ </table>
181
+ </slot>
182
+ </div>
183
+ </slot>
184
+ </div>
185
+ </template>
186
+
187
+ <script lang="ts">
188
+ import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
189
+ import Icon from '../Icons/Icon.vue'
190
+ import OverflowTooltip from '../Tooltips/OverflowTooltip.vue'
191
+ import { dark } from '../../directives'
192
+ import type { ITableColumn, TTableRow, TSortDirection, ITableSortSettings } from './table'
193
+
194
+ @Component({
195
+ directives: {
196
+ dark,
197
+ },
198
+ components: {
199
+ Icon,
200
+ OverflowTooltip,
201
+ },
202
+ })
203
+ export default class Table extends Vue {
204
+ @Prop() columns!: ITableColumn[]
205
+ @Prop() rows!: TTableRow[]
206
+ @Prop({ default: true }) showHeader!: boolean
207
+ @Prop({ default: 'Results' }) name!: string // Used in the header by default
208
+ @Prop() count?: string
209
+ @Prop() grid?: Record<string, string>
210
+ @Prop({ default: () => [ 1, -1, 0 ] }) sortToggleOrder!: TSortDirection[]
211
+ @Prop() defaultSort?: ITableSortSettings
212
+ @Prop({ default: false }) isDarkMode!: boolean
213
+
214
+ /******* Element-specific style props *******/
215
+ // .table__container
216
+ @Prop() tableContainerStyles!: Record<string, string>
217
+ // .table
218
+ @Prop() tableStyles!: Record<string, string>
219
+ // .table__header
220
+ @Prop() tableHeaderStyles!: Record<string, string>
221
+ // .table__name
222
+ @Prop() tableNameStyles!: Record<string, string>
223
+ // .table__count
224
+ @Prop() tableCountStyles!: Record<string, string>
225
+ // .table__content
226
+ @Prop() tableContentStyles!: Record<string, string>
227
+ // .table__column-labels
228
+ @Prop() tableColumnLabelsStyles!: Record<string, string>
229
+ // .table__column-label
230
+ @Prop() tableColumnLabelStyles!: Record<string, string>
231
+ // .table__sort-icon
232
+ @Prop() tableSortIconStyles!: Record<string, string>
233
+ // .table__rows
234
+ @Prop() tableRowsStyles!: Record<string, string>
235
+ // .table__row
236
+ @Prop() tableRowStyles!: Record<string, string>
237
+ // .table__cell
238
+ @Prop() tableCellStyles!: Record<string, string>
239
+
240
+ gridStyles: Record<string, string> = {}
241
+ currentSort: ITableSortSettings = { column: null, direction: this.sortToggleOrder?.[0] || -1 }
242
+
243
+ created () {
244
+ // Use default sort, if provided
245
+ if (this.defaultSort) {
246
+ this.currentSort = JSON.parse(JSON.stringify(this.defaultSort))
247
+ }
248
+
249
+ // Allow custom grid styles, otherwise use default based on number of columns
250
+ if (this.grid) {
251
+ this.gridStyles = this.grid
252
+ } else {
253
+ const numColumns = this.columns.length
254
+ this.gridStyles = {
255
+ 'display': 'inline-grid',
256
+ 'grid-template-columns': `repeat(${numColumns}, 1fr)`,
257
+ }
258
+ }
259
+ }
260
+
261
+ columnLabelClicked (column: ITableColumn) {
262
+ // Do nothing if the column has disabled sort
263
+ if (column.isSortDisabled) {
264
+ return
265
+ }
266
+
267
+ // Sort by the current column, or change directions if already sorting by current column
268
+ if (!this.currentSort.column || this.currentSort.column.propName !== column.propName) {
269
+ this.currentSort.column = column
270
+ } else {
271
+ const currentSortDirIndex = this.sortToggleOrder.indexOf(this.currentSort.direction)
272
+ this.currentSort.direction = this.sortToggleOrder[
273
+ (currentSortDirIndex + 1) % this.sortToggleOrder.length
274
+ ] || -1
275
+ }
276
+ this.emitSort()
277
+ }
278
+
279
+ @Emit('sort')
280
+ emitSort (): ITableSortSettings {
281
+ return this.currentSort
282
+ }
283
+
284
+ @Emit('rowClicked')
285
+ emitRowClicked (row: TTableRow) {
286
+ return row
287
+ }
288
+
289
+ @Emit('rowEnter')
290
+ emitRowEnter (row: TTableRow) {
291
+ return row
292
+ }
293
+
294
+ @Emit('rowLeave')
295
+ emitRowLeave (row: TTableRow) {
296
+ return row
297
+ }
298
+
299
+ @Emit('cellClicked')
300
+ emitCellClicked (row: TTableRow, column: ITableColumn) {
301
+ return {
302
+ row,
303
+ column,
304
+ }
305
+ }
306
+ }
307
+ </script>
308
+
309
+ <style lang="scss">
310
+ @import '../../styles/colors';
311
+ @import '../../styles/breakpoints';
312
+
313
+ .uikit-table {
314
+ &__container {
315
+ background-color: white;
316
+
317
+ &--dark {
318
+ background-color: transparent;
319
+ color: $white;
320
+ }
321
+
322
+ * {
323
+ box-sizing: border-box;
324
+ }
325
+ }
326
+
327
+ &__content {
328
+ display: block;
329
+ border-spacing: 0;
330
+ border-collapse: initial;
331
+ border-color: transparent;
332
+ }
333
+
334
+ &__header {
335
+ display: flex;
336
+ align-items: center;
337
+ padding: 4px 16px;
338
+ }
339
+
340
+ &__name {
341
+ font-weight: 600;
342
+ font-size: 14px;
343
+ line-height: 19px;
344
+ margin-right: 6px;
345
+ }
346
+
347
+ &__count {
348
+ font-weight: 600;
349
+ font-size: 14px;
350
+ line-height: 19px;
351
+ color: $slate-01;
352
+ }
353
+
354
+ &__column-labels {
355
+ min-width: 100%;
356
+ padding: 5px 22px 5px 11px;
357
+ font-size: 11px;
358
+ line-height: 15px;
359
+ letter-spacing: 0.17px;
360
+ color: $slate-03;
361
+ max-width: 100%;
362
+ border-bottom: 1px solid $gray-divider;
363
+
364
+ &--dark {
365
+ color: $fog;
366
+ border-bottom-color: $slate;
367
+ }
368
+ }
369
+
370
+ &__column-label {
371
+ display: block;
372
+ text-align: left;
373
+ font-weight: 500;
374
+
375
+ &:not(:last-child) {
376
+ margin-right: 11px;
377
+ }
378
+ }
379
+
380
+ &__column-label-content {
381
+ position: relative;
382
+ display: inline-block;
383
+ cursor: pointer;
384
+ outline: none;
385
+ user-select: none;
386
+
387
+ &--sort-disabled {
388
+ cursor: default;
389
+ color: inherit !important;
390
+ }
391
+
392
+ &:hover:not(.table__column-label-content--sort-disabled) {
393
+ color: $brand-blue;
394
+
395
+ .table__sort-icon:not(.table__sort-icon--visible) {
396
+ visibility: visible;
397
+ }
398
+ }
399
+
400
+ &:focus:not(.table__column-label-content--sort-disabled) {
401
+ &::before {
402
+ content: '';
403
+ position: absolute;
404
+ top: -3px;
405
+ bottom: -3px;
406
+ left: -5px;
407
+ border: 1px solid $brand-blue;
408
+ border-radius: 3px;
409
+ width: calc(100% + 10px);
410
+ }
411
+ }
412
+
413
+ &--dark {
414
+ &:hover:not(.table__column-label-content--sort-disabled) {
415
+ color: $banana-bread;
416
+ }
417
+
418
+ &:focus:not(.table__column-label-content--sort-disabled) {
419
+ &::before {
420
+ border-color: $banana-bread;
421
+ }
422
+ }
423
+ }
424
+ }
425
+
426
+ &__sort-icon {
427
+ display: inline-block;
428
+ margin-left: 2px;
429
+ color: $brand-blue;
430
+ visibility: hidden;
431
+ transform: scale(0.75);
432
+
433
+ &--dark {
434
+ color: $banana-bread;
435
+ }
436
+
437
+ &--visible {
438
+ visibility: visible;
439
+ }
440
+
441
+ &--up {
442
+ transform: scale(0.75) rotate(180deg);
443
+ }
444
+ }
445
+
446
+ &__rows {
447
+ min-width: 100%;
448
+ overflow-y: auto;
449
+ display: block;
450
+ }
451
+
452
+ &__row {
453
+ position: relative;
454
+ max-width: 100%;
455
+ min-width: 100%;
456
+ padding: 10px 22px 10px 11px;
457
+ font-size: 15px;
458
+ line-height: 20px;
459
+ border-bottom: 1px solid $gray-divider;
460
+ outline: none;
461
+
462
+ &--dark {
463
+ border-bottom-color: $ash;
464
+ }
465
+
466
+ &--hover-focus {
467
+ &:hover {
468
+ background-color: mix($barely-background, $brand-black, 96%);
469
+ }
470
+
471
+ &:focus {
472
+ &::before {
473
+ content: '';
474
+ position: absolute;
475
+ top: 0;
476
+ bottom: 0;
477
+ left: 0;
478
+ right: 0;
479
+ border: 1px solid $brand-blue;
480
+ border-radius: 6px;
481
+ }
482
+ }
483
+ }
484
+ }
485
+
486
+ &__cell {
487
+ white-space: nowrap;
488
+ text-overflow: ellipsis;
489
+ overflow: hidden;
490
+ display: block;
491
+
492
+ &:not(:last-child) {
493
+ margin-right: 11px;
494
+ }
495
+ }
496
+ }
497
+ </style>