@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.
- package/{.eslintrc.js → .eslintrc.cjs} +16 -17
- package/dist/@pocketprep/ui-kit.js +18856 -0
- package/dist/@pocketprep/ui-kit.js.map +1 -0
- package/dist/@pocketprep/ui-kit.umd.cjs +28 -0
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -0
- package/dist/style.css +1 -0
- package/index.d.ts +6 -62
- package/lib/SVGDefinitions.vue +85 -0
- package/lib/assets/emojis/tada.png +0 -0
- package/lib/assets/halftones/halftone-black.png +0 -0
- package/lib/assets/halftones/halftone-blue.png +0 -0
- package/lib/assets/halftones/halftone-green.png +0 -0
- package/lib/assets/halftones/halftone-purple.png +0 -0
- package/lib/assets/halftones/halftone-red.png +0 -0
- package/lib/assets/halftones/halftone-yellow.png +0 -0
- package/lib/assets/question/paywall-dark.png +0 -0
- package/lib/assets/question/paywall-light.png +0 -0
- package/lib/components/Banners/Banner.md +41 -0
- package/lib/components/Banners/Banner.vue +87 -0
- package/lib/components/BundleIcons/AMTA.vue +134 -0
- package/lib/components/BundleIcons/BundleIcon.md +60 -0
- package/lib/components/BundleIcons/BundleIcon.vue +111 -0
- package/lib/components/Bundles/BundleList.md +63 -0
- package/lib/components/Bundles/BundleList.vue +170 -0
- package/lib/components/Bundles/BundleSearch.md +195 -0
- package/lib/components/Bundles/BundleSearch.vue +573 -0
- package/lib/components/Bundles/PremiumPill.md +23 -0
- package/lib/components/Bundles/PremiumPill.vue +43 -0
- package/lib/components/Buttons/Button.md +99 -0
- package/lib/components/Buttons/Button.vue +496 -0
- package/lib/components/Buttons/Link.md +58 -0
- package/lib/components/Buttons/Link.vue +192 -0
- package/lib/components/Buttons/Tab.md +35 -0
- package/lib/components/Buttons/Tab.vue +103 -0
- package/lib/components/Calendar/Calendar.md +18 -0
- package/lib/components/Calendar/Calendar.vue +162 -0
- package/lib/components/Charts/Bar.md +123 -0
- package/lib/components/Charts/Bar.vue +364 -0
- package/lib/components/Charts/Pie.md +23 -0
- package/lib/components/Charts/Pie.vue +105 -0
- package/lib/components/Controls/SegmentControl.md +47 -0
- package/lib/components/Controls/SegmentControl.vue +117 -0
- package/lib/components/Controls/Slider.md +67 -0
- package/lib/components/Controls/Slider.vue +358 -0
- package/lib/components/Controls/ToggleSwitch.md +56 -0
- package/lib/components/Controls/ToggleSwitch.vue +160 -0
- package/lib/components/Exams/ExamCard.md +45 -0
- package/lib/components/Exams/ExamCard.vue +257 -0
- package/lib/components/Exams/ExamMenuCard.md +90 -0
- package/lib/components/Exams/ExamMenuCard.vue +218 -0
- package/lib/components/Filters/FilterDropdown.md +59 -0
- package/lib/components/Filters/FilterDropdown.vue +176 -0
- package/lib/components/Filters/FilterOptions.md +65 -0
- package/lib/components/Filters/FilterOptions.vue +265 -0
- package/lib/components/Filters/filterOptions.d.ts +10 -0
- package/lib/components/Forms/Checkbox.md +52 -0
- package/lib/components/Forms/Checkbox.vue +184 -0
- package/lib/components/Forms/CheckboxOption.md +37 -0
- package/lib/components/Forms/CheckboxOption.vue +173 -0
- package/lib/components/Forms/Errors.md +23 -0
- package/lib/components/Forms/Errors.vue +109 -0
- package/lib/components/Forms/Input.md +63 -0
- package/lib/components/Forms/Input.vue +310 -0
- package/lib/components/Forms/Radio.md +66 -0
- package/lib/components/Forms/Radio.vue +312 -0
- package/lib/components/Forms/Select.md +133 -0
- package/lib/components/Forms/Select.vue +670 -0
- package/lib/components/Forms/Textarea.md +57 -0
- package/lib/components/Forms/Textarea.vue +157 -0
- package/lib/components/Icons/Icon.md +146 -0
- package/lib/components/Icons/Icon.vue +192 -0
- package/lib/components/Icons/IconAccordionArrow.md +7 -0
- package/lib/components/Icons/IconAccordionArrow.vue +23 -0
- package/lib/components/Icons/IconActivity.md +7 -0
- package/lib/components/Icons/IconActivity.vue +21 -0
- package/lib/components/Icons/IconAdd.md +7 -0
- package/lib/components/Icons/IconAdd.vue +19 -0
- package/lib/components/Icons/IconAddCircle.md +7 -0
- package/lib/components/Icons/IconAddCircle.vue +22 -0
- package/lib/components/Icons/IconArrow.md +7 -0
- package/lib/components/Icons/IconArrow.vue +21 -0
- package/lib/components/Icons/IconBarChart.md +7 -0
- package/lib/components/Icons/IconBarChart.vue +23 -0
- package/lib/components/Icons/IconCalendar.md +7 -0
- package/lib/components/Icons/IconCalendar.vue +19 -0
- package/lib/components/Icons/IconCheck.md +7 -0
- package/lib/components/Icons/IconCheck.vue +21 -0
- package/lib/components/Icons/IconClose.md +7 -0
- package/lib/components/Icons/IconClose.vue +23 -0
- package/lib/components/Icons/IconCorrect.md +7 -0
- package/lib/components/Icons/IconCorrect.vue +19 -0
- package/lib/components/Icons/IconEdit.md +7 -0
- package/lib/components/Icons/IconEdit.vue +21 -0
- package/lib/components/Icons/IconExam.md +7 -0
- package/lib/components/Icons/IconExam.vue +34 -0
- package/lib/components/Icons/IconExternalLink.md +7 -0
- package/lib/components/Icons/IconExternalLink.vue +30 -0
- package/lib/components/Icons/IconEyeHide.md +7 -0
- package/lib/components/Icons/IconEyeHide.vue +21 -0
- package/lib/components/Icons/IconEyeShow.md +7 -0
- package/lib/components/Icons/IconEyeShow.vue +21 -0
- package/lib/components/Icons/IconFilter.md +7 -0
- package/lib/components/Icons/IconFilter.vue +19 -0
- package/lib/components/Icons/IconFilterActive.md +7 -0
- package/lib/components/Icons/IconFilterActive.vue +20 -0
- package/lib/components/Icons/IconFlag.md +7 -0
- package/lib/components/Icons/IconFlag.vue +25 -0
- package/lib/components/Icons/IconFlagFeedback.md +11 -0
- package/lib/components/Icons/IconFlagFeedback.vue +24 -0
- package/lib/components/Icons/IconFlagFilled.md +7 -0
- package/lib/components/Icons/IconFlagFilled.vue +22 -0
- package/lib/components/Icons/IconFullView.md +7 -0
- package/lib/components/Icons/IconFullView.vue +30 -0
- package/lib/components/Icons/IconFullViewActive.md +7 -0
- package/lib/components/Icons/IconFullViewActive.vue +28 -0
- package/lib/components/Icons/IconHandle.md +7 -0
- package/lib/components/Icons/IconHandle.vue +23 -0
- package/lib/components/Icons/IconHeart.md +7 -0
- package/lib/components/Icons/IconHeart.vue +19 -0
- package/lib/components/Icons/IconHelp.md +7 -0
- package/lib/components/Icons/IconHelp.vue +25 -0
- package/lib/components/Icons/IconHourglass.md +7 -0
- package/lib/components/Icons/IconHourglass.vue +22 -0
- package/lib/components/Icons/IconImage.md +7 -0
- package/lib/components/Icons/IconImage.vue +21 -0
- package/lib/components/Icons/IconIncorrect.md +7 -0
- package/lib/components/Icons/IconIncorrect.vue +21 -0
- package/lib/components/Icons/IconInfo.md +7 -0
- package/lib/components/Icons/IconInfo.vue +24 -0
- package/lib/components/Icons/IconKeyboard.md +7 -0
- package/lib/components/Icons/IconKeyboard.vue +25 -0
- package/lib/components/Icons/IconLaunch.md +7 -0
- package/lib/components/Icons/IconLaunch.vue +25 -0
- package/lib/components/Icons/IconLightning.md +7 -0
- package/lib/components/Icons/IconLightning.vue +21 -0
- package/lib/components/Icons/IconList.md +7 -0
- package/lib/components/Icons/IconList.vue +26 -0
- package/lib/components/Icons/IconLoading.md +7 -0
- package/lib/components/Icons/IconLoading.vue +65 -0
- package/lib/components/Icons/IconLoading2.md +7 -0
- package/lib/components/Icons/IconLoading2.vue +52 -0
- package/lib/components/Icons/IconLock.md +7 -0
- package/lib/components/Icons/IconLock.vue +23 -0
- package/lib/components/Icons/IconMissedQuestions.md +7 -0
- package/lib/components/Icons/IconMissedQuestions.vue +22 -0
- package/lib/components/Icons/IconMoon.md +7 -0
- package/lib/components/Icons/IconMoon.vue +25 -0
- package/lib/components/Icons/IconPaginationArrow.md +7 -0
- package/lib/components/Icons/IconPaginationArrow.vue +23 -0
- package/lib/components/Icons/IconPassage.md +7 -0
- package/lib/components/Icons/IconPassage.vue +22 -0
- package/lib/components/Icons/IconPencil.md +7 -0
- package/lib/components/Icons/IconPencil.vue +19 -0
- package/lib/components/Icons/IconPeople.md +7 -0
- package/lib/components/Icons/IconPeople.vue +25 -0
- package/lib/components/Icons/IconQuestions.md +7 -0
- package/lib/components/Icons/IconQuestions.vue +25 -0
- package/lib/components/Icons/IconQuick10.md +7 -0
- package/lib/components/Icons/IconQuick10.vue +23 -0
- package/lib/components/Icons/IconRemoveCircle.md +7 -0
- package/lib/components/Icons/IconRemoveCircle.vue +22 -0
- package/lib/components/Icons/IconReviewFlag.md +7 -0
- package/lib/components/Icons/IconReviewFlag.vue +32 -0
- package/lib/components/Icons/IconSearch.md +7 -0
- package/lib/components/Icons/IconSearch.vue +23 -0
- package/lib/components/Icons/IconShare.md +7 -0
- package/lib/components/Icons/IconShare.vue +31 -0
- package/lib/components/Icons/IconSideBar.md +7 -0
- package/lib/components/Icons/IconSideBar.vue +26 -0
- package/lib/components/Icons/IconSideBarActive.md +7 -0
- package/lib/components/Icons/IconSideBarActive.vue +28 -0
- package/lib/components/Icons/IconStopwatch.md +7 -0
- package/lib/components/Icons/IconStopwatch.vue +22 -0
- package/lib/components/Icons/IconStrike.md +60 -0
- package/lib/components/Icons/IconStrike.vue +23 -0
- package/lib/components/Icons/IconSubject.md +7 -0
- package/lib/components/Icons/IconSubject.vue +22 -0
- package/lib/components/Icons/IconText.md +7 -0
- package/lib/components/Icons/IconText.vue +22 -0
- package/lib/components/Icons/IconWarning.md +7 -0
- package/lib/components/Icons/IconWarning.vue +22 -0
- package/lib/components/Modal/Modal.md +31 -0
- package/lib/components/Modal/Modal.vue +133 -0
- package/lib/components/Modal/ModalContainer.md +96 -0
- package/lib/components/Modal/ModalContainer.vue +208 -0
- package/lib/components/Onboarding/EmailAuth.md +40 -0
- package/lib/components/Onboarding/EmailAuth.vue +218 -0
- package/lib/components/Onboarding/MagicCodeEntry.md +20 -0
- package/lib/components/Onboarding/MagicCodeEntry.vue +189 -0
- package/lib/components/PhonePerson/PhonePerson.md +36 -0
- package/lib/components/PhonePerson/PhonePerson.vue +48 -0
- package/lib/components/PhonePerson/phoneperson-IT@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-auto@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-behavioralhealth@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-emt@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-essentials@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-finance@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-fitness@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-medical@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-nursing@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-nursingschool@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-professional@2x.png +0 -0
- package/lib/components/PhonePerson/phoneperson-skilledtrades@2x.png +0 -0
- package/lib/components/Quiz/FlagToggle.md +37 -0
- package/lib/components/Quiz/FlagToggle.vue +124 -0
- package/lib/components/Quiz/GlobalMetricsToggle.md +46 -0
- package/lib/components/Quiz/GlobalMetricsToggle.vue +124 -0
- package/lib/components/Quiz/KeyboardShortcutsButton.md +18 -0
- package/lib/components/Quiz/KeyboardShortcutsButton.vue +102 -0
- package/lib/components/Quiz/KeyboardShortcutsModal.md +71 -0
- package/lib/components/Quiz/KeyboardShortcutsModal.vue +261 -0
- package/lib/components/Quiz/Question.md +579 -0
- package/lib/components/Quiz/Question.vue +3262 -0
- package/lib/components/Quiz/QuizContainer.md +91 -0
- package/lib/components/Quiz/QuizContainer.vue +207 -0
- package/lib/components/Quiz/QuizProgress.md +122 -0
- package/lib/components/Quiz/QuizProgress.vue +188 -0
- package/lib/components/Quiz/QuizProgressBar.md +131 -0
- package/lib/components/Quiz/QuizProgressBar.vue +96 -0
- package/lib/components/Search/Pill.md +37 -0
- package/lib/components/Search/Pill.vue +117 -0
- package/lib/components/Search/Search.md +44 -0
- package/lib/components/Search/Search.vue +341 -0
- package/lib/components/SidePanels/SidePanel.md +126 -0
- package/lib/components/SidePanels/SidePanel.vue +592 -0
- package/lib/components/Tables/StudyTable.md +136 -0
- package/lib/components/Tables/Table.vue +497 -0
- package/lib/components/Tables/TableActions.vue +199 -0
- package/lib/components/Tables/TablePagination.md +19 -0
- package/lib/components/Tables/TablePagination.vue +109 -0
- package/lib/components/Tables/TeachTable.md +696 -0
- package/lib/components/Toasts/Toast.md +35 -0
- package/lib/components/Toasts/Toast.vue +213 -0
- package/lib/components/Tooltips/OverflowTooltip.md +14 -0
- package/lib/components/Tooltips/OverflowTooltip.vue +68 -0
- package/lib/components/Tooltips/Tooltip.md +72 -0
- package/lib/components/Tooltips/Tooltip.vue +143 -0
- package/lib/directives.ts +213 -0
- package/lib/index.ts +108 -0
- package/{pocketprep-export.module.scss → lib/pocketprep-export.module.scss} +2 -2
- package/{pocketprep.scss → lib/pocketprep.scss} +16 -18
- package/{styles → lib/styles}/_colors.scss +1 -1
- package/lib/styles/fonts.css +149 -0
- package/lib/utils.ts +53 -0
- package/package.json +76 -56
- package/{stylelint.config.js → stylelint.config.cjs} +6 -3
- package/assets/Fonts.md +0 -114
- package/assets/Images.md +0 -2
- package/assets/Styleguidist.vue +0 -11
- package/dist/@pocketprep/ui-kit.common.js +0 -29726
- package/dist/@pocketprep/ui-kit.common.js.map +0 -1
- package/dist/@pocketprep/ui-kit.umd.js +0 -29745
- package/dist/@pocketprep/ui-kit.umd.js.map +0 -1
- package/dist/@pocketprep/ui-kit.umd.min.js +0 -33
- package/dist/@pocketprep/ui-kit.umd.min.js.map +0 -1
- package/dist/demo.html +0 -1
- package/src/directives.d.ts +0 -2
- package/src/shims.d.ts +0 -19
- package/src/utils.d.ts +0 -51
- package/styles/Colors.md +0 -53
- package/styles/Styles.md +0 -4
- package/styles/_fonts.scss +0 -149
- package/tests/shims-test.d.ts +0 -9
- /package/{assets → lib/assets}/fonts/muli/muli-400.eot +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400.svg +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400.ttf +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400.woff +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400.woff2 +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400italic.eot +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400italic.svg +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400italic.ttf +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400italic.woff +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-400italic.woff2 +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600.eot +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600.svg +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600.ttf +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600.woff +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600.woff2 +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600italic.eot +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600italic.svg +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600italic.ttf +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600italic.woff +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-600italic.woff2 +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700.eot +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700.svg +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700.ttf +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700.woff +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700.woff2 +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700italic.eot +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700italic.svg +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700italic.ttf +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700italic.woff +0 -0
- /package/{assets → lib/assets}/fonts/muli/muli-700italic.woff2 +0 -0
- /package/{assets → lib/assets}/images/amta.svg +0 -0
- /package/{assets → lib/assets}/images/favicon.ico +0 -0
- /package/{assets → lib/assets}/images/thumb-large-dark.svg +0 -0
- /package/{assets → lib/assets}/images/thumb-large.svg +0 -0
- /package/{assets → lib/assets}/images/thumb-small-dark.svg +0 -0
- /package/{assets → lib/assets}/images/thumb-small.svg +0 -0
- /package/{src → lib}/components/BundleIcons/bundleIcon.d.ts +0 -0
- /package/{src → lib}/components/Icons/icon.d.ts +0 -0
- /package/{src → lib}/components/PhonePerson/phonePerson.d.ts +0 -0
- /package/{src → lib}/components/Tables/table.d.ts +0 -0
- /package/{styles → lib/styles}/_breakpoints.scss +0 -0
- /package/{styles/_normalize.scss → lib/styles/normalize.css} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="uikit-table-actions">
|
|
3
|
+
<div
|
|
4
|
+
v-for="action in actions"
|
|
5
|
+
:key="action.id"
|
|
6
|
+
:ref="`${name}Actions`"
|
|
7
|
+
class="uikit-table-actions__action"
|
|
8
|
+
:class="{
|
|
9
|
+
'uikit-table-actions__action--menu-open': action.id === visibleMenuActionId
|
|
10
|
+
}"
|
|
11
|
+
tabindex="0"
|
|
12
|
+
@click="actionClicked(action)"
|
|
13
|
+
@keyup.enter="actionClicked(action)"
|
|
14
|
+
@keydown="scrollActionMenu(action, $event)"
|
|
15
|
+
@blur="visibleMenuActionId = ''"
|
|
16
|
+
@mouseout="hoveringMenuActionId = null"
|
|
17
|
+
@mouseover="hoveringMenuActionId = action.id"
|
|
18
|
+
@focusout="hoveringMenuActionId = null"
|
|
19
|
+
@focusin="hoveringMenuActionId = action.id"
|
|
20
|
+
>
|
|
21
|
+
<Icon class="uikit-table-actions__action-icon" :type="action.icon" />
|
|
22
|
+
<Tooltip
|
|
23
|
+
v-if="hoveringMenuActionId === action.id"
|
|
24
|
+
class="uikit-table-actions__action-tooltip"
|
|
25
|
+
>
|
|
26
|
+
{{ action.text }}
|
|
27
|
+
</Tooltip>
|
|
28
|
+
<div
|
|
29
|
+
v-if="action.menu && action.id === visibleMenuActionId"
|
|
30
|
+
class="uikit-table-actions__action-menu"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
v-for="subAction in action.menu"
|
|
34
|
+
:key="subAction.id"
|
|
35
|
+
:ref="`${name}ActionMenu-${action.id}`"
|
|
36
|
+
class="uikit-table-actions__action-menu-option"
|
|
37
|
+
tabindex="0"
|
|
38
|
+
@mousedown.prevent.stop="actionClicked(subAction)"
|
|
39
|
+
@keyup.enter.prevent.stop="actionClicked(subAction)"
|
|
40
|
+
@keydown="scrollActionMenu(action, $event)"
|
|
41
|
+
>
|
|
42
|
+
{{ subAction.text }}
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script lang="ts">
|
|
50
|
+
import { Component, Vue, Prop, Emit } from 'vue-facing-decorator'
|
|
51
|
+
import type { ITableAction, ITableSubAction } from './table'
|
|
52
|
+
import Icon from '../Icons/Icon.vue'
|
|
53
|
+
import Tooltip from '../Tooltips/Tooltip.vue'
|
|
54
|
+
|
|
55
|
+
@Component({
|
|
56
|
+
components: {
|
|
57
|
+
Icon,
|
|
58
|
+
Tooltip,
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
export default class TableActions extends Vue {
|
|
62
|
+
@Prop() name!: string
|
|
63
|
+
@Prop({ default: () => [] }) actions!: ITableAction[]
|
|
64
|
+
|
|
65
|
+
visibleMenuActionId: string | number = ''
|
|
66
|
+
hoveringMenuActionId: number | string | null = null
|
|
67
|
+
focusedMenuOptionIndex: number | null = null
|
|
68
|
+
|
|
69
|
+
blurActions () {
|
|
70
|
+
this.visibleMenuActionId = ''
|
|
71
|
+
this.hoveringMenuActionId = null
|
|
72
|
+
this.focusedMenuOptionIndex = null
|
|
73
|
+
const actionElements = this.$refs[`${this.name}Actions`] as HTMLElement[]
|
|
74
|
+
actionElements?.forEach(actionElement => {
|
|
75
|
+
actionElement.blur()
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
actionClicked (action: ITableAction | ITableSubAction) {
|
|
80
|
+
if ('menu' in action && action.menu && action.menu.length) {
|
|
81
|
+
if (this.visibleMenuActionId !== action.id) {
|
|
82
|
+
this.focusedMenuOptionIndex = null
|
|
83
|
+
this.visibleMenuActionId = action.id
|
|
84
|
+
} else {
|
|
85
|
+
this.blurActions()
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
this.blurActions()
|
|
89
|
+
this.emitActionClicked(action)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
scrollActionMenu (action: ITableAction, event: KeyboardEvent) {
|
|
94
|
+
if (
|
|
95
|
+
![ 'ArrowUp', 'ArrowDown' ].includes(event.key) // ArrowUp, ArrowDown
|
|
96
|
+
|| !('menu' in action)
|
|
97
|
+
|| this.visibleMenuActionId !== action.id
|
|
98
|
+
) {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const currentIndex = this.focusedMenuOptionIndex
|
|
103
|
+
const menuElements = this.$refs[`${this.name}ActionMenu-${action.id}`] as HTMLElement[] | undefined
|
|
104
|
+
|
|
105
|
+
if (menuElements && event.key === 'ArrowUp') {
|
|
106
|
+
// Up arrow
|
|
107
|
+
if (currentIndex === 0) {
|
|
108
|
+
const parentActionElement = menuElements[currentIndex]?.parentElement?.parentElement
|
|
109
|
+
if (parentActionElement) {
|
|
110
|
+
parentActionElement.focus()
|
|
111
|
+
this.visibleMenuActionId = ''
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
const nextIndex = currentIndex === null
|
|
115
|
+
? menuElements.length - 1
|
|
116
|
+
: currentIndex - 1
|
|
117
|
+
menuElements[nextIndex]?.focus()
|
|
118
|
+
this.focusedMenuOptionIndex = nextIndex
|
|
119
|
+
this.visibleMenuActionId = action.id
|
|
120
|
+
}
|
|
121
|
+
} else if (menuElements && event.key === 'ArrowDown') {
|
|
122
|
+
// Down arrow
|
|
123
|
+
const nextIndex = currentIndex === null || currentIndex === menuElements.length - 1
|
|
124
|
+
? 0
|
|
125
|
+
: currentIndex + 1
|
|
126
|
+
menuElements[nextIndex]?.focus()
|
|
127
|
+
this.focusedMenuOptionIndex = nextIndex
|
|
128
|
+
this.visibleMenuActionId = action.id
|
|
129
|
+
}
|
|
130
|
+
event.preventDefault()
|
|
131
|
+
event.stopPropagation()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@Emit('actionClicked')
|
|
135
|
+
emitActionClicked (action: ITableAction | ITableSubAction) {
|
|
136
|
+
return action
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<style lang="scss">
|
|
142
|
+
@import '../../styles/colors';
|
|
143
|
+
@import '../../styles/breakpoints';
|
|
144
|
+
|
|
145
|
+
.uikit-table-actions {
|
|
146
|
+
display: flex;
|
|
147
|
+
color: $brand-blue;
|
|
148
|
+
|
|
149
|
+
&__action-tooltip {
|
|
150
|
+
position: absolute;
|
|
151
|
+
top: -30px;
|
|
152
|
+
left: 12px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&__action {
|
|
156
|
+
position: relative;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
margin-left: 10px;
|
|
159
|
+
outline: none;
|
|
160
|
+
user-select: none;
|
|
161
|
+
|
|
162
|
+
&:not(&--menu-open) {
|
|
163
|
+
&:hover,
|
|
164
|
+
&:focus {
|
|
165
|
+
color: $brand-black;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&--menu-open {
|
|
170
|
+
color: $brand-black;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&__action-menu {
|
|
175
|
+
position: absolute;
|
|
176
|
+
background-color: white;
|
|
177
|
+
color: $brand-black;
|
|
178
|
+
padding: 10px 0;
|
|
179
|
+
left: 50%;
|
|
180
|
+
transform: translateX(-50%);
|
|
181
|
+
border-radius: 6px;
|
|
182
|
+
box-shadow: 0 4px 12px 0 rgba($brand-black, 0.1);
|
|
183
|
+
cursor: default;
|
|
184
|
+
z-index: 1;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&__action-menu-option {
|
|
188
|
+
padding: 5px 42px 6px 16px;
|
|
189
|
+
white-space: nowrap;
|
|
190
|
+
outline: none;
|
|
191
|
+
cursor: pointer;
|
|
192
|
+
|
|
193
|
+
&:hover,
|
|
194
|
+
&:focus {
|
|
195
|
+
background-color: $gray-background;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
```vue
|
|
2
|
+
<template>
|
|
3
|
+
<TablePagination :perPage="10" unit="things" :currentPage="currentPage" :total="45" @changePage="val => currentPage = val" />
|
|
4
|
+
</template>
|
|
5
|
+
<script>
|
|
6
|
+
import TablePagination from '../Tables/TablePagination.vue'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
data () {
|
|
10
|
+
return {
|
|
11
|
+
currentPage: 0
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
components: {
|
|
15
|
+
TablePagination,
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="uikit-table-pagination">
|
|
3
|
+
<div class="uikit-table-pagination__info">
|
|
4
|
+
{{ (currentPage * perPage) + 1 }} -
|
|
5
|
+
{{ nextPageDisabled ? total : (currentPage * perPage) + perPage }}
|
|
6
|
+
of {{ total }} {{ unit }} <slot />
|
|
7
|
+
</div>
|
|
8
|
+
<div
|
|
9
|
+
class="uikit-table-pagination__previous"
|
|
10
|
+
:class="{ 'uikit-table-pagination__previous--disabled': currentPage === 0 }"
|
|
11
|
+
:tabindex="currentPage === 0 ? -1 : 0"
|
|
12
|
+
aria-label="Previous"
|
|
13
|
+
:aria-disabled="currentPage === 0"
|
|
14
|
+
@keydown.enter="changePage('previous')"
|
|
15
|
+
@click="changePage('previous')"
|
|
16
|
+
>
|
|
17
|
+
<Icon type="accordionArrow" class="uikit-table-pagination__previous-icon" />
|
|
18
|
+
</div>
|
|
19
|
+
<div
|
|
20
|
+
class="uikit-table-pagination__next"
|
|
21
|
+
:class="{ 'uikit-table-pagination__next--disabled': nextPageDisabled }"
|
|
22
|
+
:tabindex="nextPageDisabled ? -1 : 0"
|
|
23
|
+
aria-label="Next"
|
|
24
|
+
:aria-disabled="nextPageDisabled"
|
|
25
|
+
@keydown.enter="changePage('next')"
|
|
26
|
+
@click="changePage('next')"
|
|
27
|
+
>
|
|
28
|
+
<Icon type="accordionArrow" class="uikit-table-pagination__next-icon" />
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
import { Vue, Component, Prop, Emit } from 'vue-facing-decorator'
|
|
35
|
+
import Icon from '../Icons/Icon.vue'
|
|
36
|
+
|
|
37
|
+
@Component({
|
|
38
|
+
components: {
|
|
39
|
+
Icon,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
export default class TablePagination extends Vue {
|
|
43
|
+
@Prop({ default: 10 }) perPage!: number
|
|
44
|
+
@Prop({ default: 0 }) currentPage!: number
|
|
45
|
+
@Prop() total!: number
|
|
46
|
+
@Prop() unit!: string
|
|
47
|
+
|
|
48
|
+
get nextPageDisabled () {
|
|
49
|
+
return this.currentPage >= Math.floor((this.total - 1) / this.perPage)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Emit('changePage')
|
|
53
|
+
changePage (direction: 'next' | 'previous') {
|
|
54
|
+
if (direction === 'next') {
|
|
55
|
+
return this.nextPageDisabled ? this.currentPage : this.currentPage + 1
|
|
56
|
+
} else {
|
|
57
|
+
return Math.max(0, this.currentPage - 1)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<style lang="scss" scoped>
|
|
64
|
+
@import '../../styles/breakpoints';
|
|
65
|
+
@import '../../styles/colors';
|
|
66
|
+
|
|
67
|
+
.uikit-table-pagination {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
font-size: 13px;
|
|
71
|
+
line-height: 18px;
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
|
|
74
|
+
&__info {
|
|
75
|
+
margin-right: 12px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&__previous,
|
|
79
|
+
&__next {
|
|
80
|
+
color: $brand-blue;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
user-select: none;
|
|
83
|
+
width: 17px;
|
|
84
|
+
|
|
85
|
+
&--disabled {
|
|
86
|
+
opacity: 0.35;
|
|
87
|
+
cursor: default;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&__previous {
|
|
92
|
+
margin-right: 4px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&__previous-icon,
|
|
96
|
+
&__next-icon {
|
|
97
|
+
width: 16px;
|
|
98
|
+
height: 10px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__previous-icon {
|
|
102
|
+
transform: rotate(90deg);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&__next-icon {
|
|
106
|
+
transform: rotate(-90deg);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</style>
|