@pocketprep/ui-kit 3.8.5 → 3.9.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.
- package/dist/@pocketprep/ui-kit.css +1 -1
- package/dist/@pocketprep/ui-kit.js +14466 -17728
- package/dist/@pocketprep/ui-kit.js.map +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs +19 -29
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
- package/eslint.config.ts +38 -11
- package/lib/SVGDefinitions.vue +32 -35
- package/lib/components/Banners/Banner.vue +10 -14
- package/lib/components/Blobs/Blob.vue +6 -14
- package/lib/components/Blobs/BlobEmptyState.vue +9 -8
- package/lib/components/Blobs/blob.d.ts +1 -1
- package/lib/components/BundleIcons/BundleIcon.vue +36 -63
- package/lib/components/BundleIcons/bundleIcon.d.ts +1 -1
- package/lib/components/Bundles/BundleList.vue +71 -59
- package/lib/components/Bundles/BundleSearch.vue +93 -117
- package/lib/components/Bundles/PremiumPill.vue +6 -12
- package/lib/components/Buttons/Button.vue +32 -35
- package/lib/components/Buttons/Link.vue +32 -31
- package/lib/components/Buttons/Tab.vue +14 -17
- package/lib/components/Calendar/Calendar.vue +87 -85
- package/lib/components/Charts/Bar.vue +192 -263
- package/lib/components/Charts/Pie.vue +55 -61
- package/lib/components/Charts/highcharts-wrap.ts +81 -0
- package/lib/components/Controls/SegmentControl.vue +26 -24
- package/lib/components/Controls/Slider.vue +51 -47
- package/lib/components/Controls/ToggleSwitch.vue +33 -31
- package/lib/components/EmptyStates/EmptyState.vue +69 -73
- package/lib/components/Exams/ExamCard.vue +59 -47
- package/lib/components/Exams/ExamMenuCard.vue +30 -28
- package/lib/components/Filters/FilterDropdown.vue +83 -86
- package/lib/components/Filters/FilterOptions.vue +83 -88
- package/lib/components/Forms/Checkbox.vue +27 -27
- package/lib/components/Forms/CheckboxOption.vue +30 -30
- package/lib/components/Forms/Errors.vue +21 -24
- package/lib/components/Forms/Input.vue +71 -59
- package/lib/components/Forms/Radio.vue +2 -2
- package/lib/components/Forms/RadioButton.vue +8 -8
- package/lib/components/Forms/Select.vue +265 -257
- package/lib/components/Forms/Textarea.vue +49 -35
- package/lib/components/Icons/IconAccordionArrow.vue +7 -9
- package/lib/components/Icons/IconActivity.vue +7 -9
- package/lib/components/Icons/IconAdd.vue +7 -11
- package/lib/components/Icons/IconAddCircle.vue +7 -9
- package/lib/components/Icons/IconArrow.vue +7 -9
- package/lib/components/Icons/IconBarChart.vue +7 -9
- package/lib/components/Icons/IconCalendar.vue +7 -9
- package/lib/components/Icons/IconCalendarPicker.vue +7 -9
- package/lib/components/Icons/IconChat.vue +7 -9
- package/lib/components/Icons/IconCheck.vue +7 -9
- package/lib/components/Icons/IconClose.vue +7 -9
- package/lib/components/Icons/IconConcept.vue +1 -1
- package/lib/components/Icons/IconCorrect.vue +7 -9
- package/lib/components/Icons/IconEdit.vue +7 -11
- package/lib/components/Icons/IconExam.vue +7 -9
- package/lib/components/Icons/IconExternalLink.vue +7 -9
- package/lib/components/Icons/IconEyeHide.vue +7 -9
- package/lib/components/Icons/IconEyeShow.vue +7 -9
- package/lib/components/Icons/IconFilter.vue +7 -9
- package/lib/components/Icons/IconFilterActive.vue +7 -9
- package/lib/components/Icons/IconFlag.vue +7 -9
- package/lib/components/Icons/IconFlagContent.vue +8 -9
- package/lib/components/Icons/IconFlagFeedback.vue +8 -10
- package/lib/components/Icons/IconFlagFilled.vue +7 -9
- package/lib/components/Icons/IconFullView.vue +7 -9
- package/lib/components/Icons/IconFullViewActive.vue +7 -9
- package/lib/components/Icons/IconGridDrag.vue +2 -2
- package/lib/components/Icons/IconHandle.vue +7 -9
- package/lib/components/Icons/IconHeart.vue +7 -9
- package/lib/components/Icons/IconHelp.vue +7 -9
- package/lib/components/Icons/IconHighlight.vue +2 -2
- package/lib/components/Icons/IconHourglass.vue +7 -9
- package/lib/components/Icons/IconImage.vue +7 -9
- package/lib/components/Icons/IconIncorrect.vue +7 -9
- package/lib/components/Icons/IconInfo.vue +7 -9
- package/lib/components/Icons/IconKeyboard.vue +7 -9
- package/lib/components/Icons/IconLaunch.vue +7 -9
- package/lib/components/Icons/IconLevelUp.vue +7 -9
- package/lib/components/Icons/IconLightbulb.vue +7 -9
- package/lib/components/Icons/IconLightning.vue +7 -9
- package/lib/components/Icons/IconLink.vue +7 -9
- package/lib/components/Icons/IconList.vue +7 -9
- package/lib/components/Icons/IconLoading.vue +7 -9
- package/lib/components/Icons/IconLoading2.vue +11 -11
- package/lib/components/Icons/IconLock.vue +7 -9
- package/lib/components/Icons/IconMissedQuestions.vue +7 -9
- package/lib/components/Icons/IconMoon.vue +7 -9
- package/lib/components/Icons/IconPaginationArrow.vue +7 -9
- package/lib/components/Icons/IconPaginationArrowDouble.vue +7 -9
- package/lib/components/Icons/IconPassage.vue +7 -9
- package/lib/components/Icons/IconPencil.vue +7 -9
- package/lib/components/Icons/IconPeople.vue +7 -9
- package/lib/components/Icons/IconPercent.vue +7 -9
- package/lib/components/Icons/IconPerson.vue +8 -9
- package/lib/components/Icons/IconPresent.vue +7 -9
- package/lib/components/Icons/IconPreview.vue +7 -9
- package/lib/components/Icons/IconQuestions.vue +7 -9
- package/lib/components/Icons/IconQuick10.vue +7 -9
- package/lib/components/Icons/IconQuickActions.vue +2 -2
- package/lib/components/Icons/IconRecommendedFilter.vue +1 -1
- package/lib/components/Icons/IconRemoveCircle.vue +7 -9
- package/lib/components/Icons/IconReviewFlag.vue +7 -9
- package/lib/components/Icons/IconSearch.vue +7 -9
- package/lib/components/Icons/IconShare.vue +7 -9
- package/lib/components/Icons/IconSideBar.vue +7 -9
- package/lib/components/Icons/IconSideBarActive.vue +7 -9
- package/lib/components/Icons/IconStar.vue +1 -1
- package/lib/components/Icons/IconStopwatch.vue +7 -9
- package/lib/components/Icons/IconStrike.vue +7 -9
- package/lib/components/Icons/IconSubject.vue +7 -9
- package/lib/components/Icons/IconText.vue +7 -9
- package/lib/components/Icons/IconTimer.vue +8 -9
- package/lib/components/Icons/IconWarning.vue +7 -9
- package/lib/components/Icons/icon.d.ts +1 -1
- package/lib/components/Loaders/SkeletonLoader.vue +1 -5
- package/lib/components/Modal/Modal.vue +23 -29
- package/lib/components/Modal/ModalContainer.vue +135 -135
- package/lib/components/Onboarding/EmailAuth.vue +66 -70
- package/lib/components/Onboarding/MagicCodeEntry.vue +88 -83
- package/lib/components/Pagination/QuestionReviewPagination.vue +3 -3
- package/lib/components/Pagination/TablePagination.vue +47 -44
- package/lib/components/PhonePerson/PhonePerson.vue +18 -18
- package/lib/components/PhonePerson/phonePerson.d.ts +1 -1
- package/lib/components/Quiz/FlagToggle.vue +45 -44
- package/lib/components/Quiz/GlobalMetricsToggle.vue +29 -28
- package/lib/components/Quiz/KeyboardShortcutsButton.vue +16 -23
- package/lib/components/Quiz/KeyboardShortcutsModal.vue +36 -37
- package/lib/components/Quiz/Question/BuildListChoicesContainer.vue +65 -65
- package/lib/components/Quiz/Question/ChoicesContainer.vue +5 -5
- package/lib/components/Quiz/Question/DropdownExplanation.vue +5 -5
- package/lib/components/Quiz/Question/Explanation.vue +6 -6
- package/lib/components/Quiz/Question/MPMCChoicesContainer.vue +17 -17
- package/lib/components/Quiz/Question/MPMCRadioGroup.vue +2 -2
- package/lib/components/Quiz/Question/MatrixChoicesContainer.vue +39 -39
- package/lib/components/Quiz/Question/MatrixRadioGroup.vue +6 -6
- package/lib/components/Quiz/Question/MobileMatrixChoicesContainer.vue +27 -28
- package/lib/components/Quiz/Question/MobileMatrixRadioGroup.vue +2 -2
- package/lib/components/Quiz/Question/PassageAndImage.vue +3 -3
- package/lib/components/Quiz/Question/PassageAndImageDropdown.vue +7 -7
- package/lib/components/Quiz/Question/Paywall.vue +2 -2
- package/lib/components/Quiz/Question/QuestionContext.vue +1 -1
- package/lib/components/Quiz/Question/StatsSummary.vue +2 -2
- package/lib/components/Quiz/Question/Summary.vue +11 -11
- package/lib/components/Quiz/Question.vue +90 -82
- package/lib/components/Quiz/QuizContainer.vue +1 -1
- package/lib/components/Quiz/QuizProgressBar.vue +23 -23
- package/lib/components/Quiz/question.d.ts +3 -3
- package/lib/components/Search/Pill.vue +16 -19
- package/lib/components/Search/Search.vue +52 -47
- package/lib/components/SidePanels/SidePanel.vue +168 -174
- package/lib/components/Tables/Table.vue +135 -122
- package/lib/components/Tables/TableActions.vue +81 -76
- package/lib/components/Tables/table.d.ts +1 -1
- package/lib/components/Tags/Tag.vue +49 -39
- package/lib/components/Toasts/Toast.vue +44 -42
- package/lib/components/Tooltips/OverflowTooltip.vue +39 -45
- package/lib/components/Tooltips/Tooltip.vue +69 -70
- package/lib/directives.ts +4 -4
- package/lib/utils.ts +13 -12
- package/package.json +27 -28
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
<div :id="chartId" class="uikit-bar" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import './highcharts-wrap.ts'
|
|
7
7
|
import Highcharts, { chart } from 'highcharts'
|
|
8
|
-
import Accessibility from 'highcharts/modules/accessibility'
|
|
9
8
|
import BrandColors from '../../pocketprep-export.module.scss'
|
|
9
|
+
import { nextTick, onMounted } from 'vue'
|
|
10
10
|
|
|
11
|
-
type TCustomChartOptions = Highcharts.Options & {
|
|
12
|
-
plotOptions: {
|
|
13
|
-
series: {
|
|
11
|
+
type TCustomChartOptions = Highcharts.Options & {
|
|
12
|
+
plotOptions: {
|
|
13
|
+
series: {
|
|
14
14
|
groupPadding: number
|
|
15
15
|
pointPadding: number
|
|
16
16
|
}
|
|
@@ -21,290 +21,219 @@ type TCustomChartOptions = Highcharts.Options & {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
proceed.call(this);
|
|
61
|
-
|
|
62
|
-
(this.points as TCustomPoint[]).forEach(function (point) {
|
|
63
|
-
if (options.borderRadiusTopLeft || options.borderRadiusTopRight) {
|
|
64
|
-
const w = Number(point.shapeArgs.width)
|
|
65
|
-
const h = Number(point.shapeArgs.height)
|
|
66
|
-
const x = Number(point.shapeArgs.x)
|
|
67
|
-
const y = Number(point.shapeArgs.y)
|
|
68
|
-
const maxR = Math.min(w, h) / 2
|
|
69
|
-
|
|
70
|
-
let radiusTopLeft = H.relativeLength(options.borderRadiusTopLeft || 0, w)
|
|
71
|
-
let radiusTopRight = H.relativeLength(options.borderRadiusTopRight || 0, w)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
radiusTopLeft = radiusTopLeft > maxR ? maxR : radiusTopLeft
|
|
75
|
-
radiusTopRight = radiusTopRight > maxR ? maxR : radiusTopRight
|
|
76
|
-
|
|
77
|
-
point.dlBox = point.shapeArgs
|
|
78
|
-
|
|
79
|
-
point.shapeType = 'path'
|
|
80
|
-
const d = [
|
|
81
|
-
'M', x + radiusTopLeft, y,
|
|
82
|
-
'L', x + w - radiusTopRight, y,
|
|
83
|
-
'C', x + w - (radiusTopRight / 2), y, x + w, y + (radiusTopRight / 2), x + w, y + radiusTopRight,
|
|
84
|
-
'L', x + w, y + h,
|
|
85
|
-
'C', x + w, y + h, x + w, y + h, x + w, y + h,
|
|
86
|
-
'L', x, y + h,
|
|
87
|
-
'C', x, y + h, x, y + h, x, y + h,
|
|
88
|
-
'L', x, y + radiusTopLeft,
|
|
89
|
-
'C', x, y + (radiusTopLeft / 2), x + (radiusTopLeft / 2), y, x + radiusTopLeft, y,
|
|
90
|
-
'Z',
|
|
91
|
-
] as unknown as Highcharts.SVGPathArray
|
|
92
|
-
point.shapeArgs = {
|
|
93
|
-
d,
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
}(Highcharts as TCustomHighcharts))
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @see [Designs for Content - Student](https://marvelapp.com/adf8ab3/screen/68221510)
|
|
103
|
-
*/
|
|
104
|
-
@Component
|
|
105
|
-
export default class Bar extends Vue {
|
|
106
|
-
@Prop({ default: '' }) title!: string
|
|
107
|
-
@Prop() data!: Highcharts.PointOptionsObject[]
|
|
108
|
-
@Prop() formatterFunc!:
|
|
109
|
-
Highcharts.FormatterCallbackFunction<Highcharts.AxisLabelsFormatterContextObject>
|
|
110
|
-
@Prop() type!: 'percent' | 'distribution'
|
|
111
|
-
@Prop({ default: null }) yAxisTitle!: string
|
|
112
|
-
@Prop({ default: null }) max!: number
|
|
113
|
-
@Prop({ default: false }) hideAverageLine!: boolean
|
|
114
|
-
@Prop({ default: 'normal' }) size!: 'normal' | 'small'
|
|
115
|
-
@Prop() barColor?: string
|
|
116
|
-
@Prop({ default: '' }) description!: string
|
|
117
|
-
@Prop({ default: false }) isDarkMode!: boolean
|
|
118
|
-
|
|
119
|
-
chartId = `chart${Math.round(Math.random() * 10000)}`
|
|
120
|
-
|
|
121
|
-
mounted () {
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
123
|
-
const self = this
|
|
124
|
-
|
|
125
|
-
const chartOptions: TCustomChartOptions = {
|
|
126
|
-
accessibility: {
|
|
127
|
-
description: this.description,
|
|
24
|
+
const {
|
|
25
|
+
title = '',
|
|
26
|
+
data,
|
|
27
|
+
formatterFunc = null,
|
|
28
|
+
type,
|
|
29
|
+
yAxisTitle = null,
|
|
30
|
+
max = null,
|
|
31
|
+
hideAverageLine,
|
|
32
|
+
size = 'normal',
|
|
33
|
+
barColor = null,
|
|
34
|
+
description = '',
|
|
35
|
+
isDarkMode,
|
|
36
|
+
} = defineProps<{
|
|
37
|
+
title?: string
|
|
38
|
+
data: Highcharts.PointOptionsObject[]
|
|
39
|
+
formatterFunc?: Highcharts.FormatterCallbackFunction<Highcharts.AxisLabelsFormatterContextObject> | null
|
|
40
|
+
type: 'percent' | 'distribution'
|
|
41
|
+
yAxisTitle?: string | null
|
|
42
|
+
max?: number | null
|
|
43
|
+
hideAverageLine?: boolean
|
|
44
|
+
size?: 'normal' | 'small'
|
|
45
|
+
barColor?: string | null
|
|
46
|
+
description?: string
|
|
47
|
+
isDarkMode?: boolean
|
|
48
|
+
}>()
|
|
49
|
+
|
|
50
|
+
const chartId = `chart${Math.round(Math.random() * 10000)}`
|
|
51
|
+
|
|
52
|
+
onMounted(() => {
|
|
53
|
+
const chartOptions: TCustomChartOptions = {
|
|
54
|
+
accessibility: {
|
|
55
|
+
description: description,
|
|
56
|
+
},
|
|
57
|
+
tooltip: {
|
|
58
|
+
formatter: function () {
|
|
59
|
+
return String(this.y)
|
|
128
60
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
61
|
+
},
|
|
62
|
+
legend: {
|
|
63
|
+
enabled: false,
|
|
64
|
+
},
|
|
65
|
+
credits: {
|
|
66
|
+
enabled: false,
|
|
67
|
+
},
|
|
68
|
+
chart: {
|
|
69
|
+
type: 'column',
|
|
70
|
+
spacingLeft: 0,
|
|
71
|
+
spacingRight: 0,
|
|
72
|
+
spacingBottom: 6,
|
|
73
|
+
backgroundColor: 'transparent',
|
|
74
|
+
},
|
|
75
|
+
title: {
|
|
76
|
+
text: title,
|
|
77
|
+
align: 'left',
|
|
78
|
+
style: {
|
|
79
|
+
color: !isDarkMode ? BrandColors.brandBlack : BrandColors.fog,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
xAxis: {
|
|
83
|
+
tickLength: 0,
|
|
84
|
+
type: 'category',
|
|
85
|
+
},
|
|
86
|
+
yAxis: {
|
|
87
|
+
min: 0,
|
|
88
|
+
max: max,
|
|
89
|
+
opposite: true,
|
|
90
|
+
labels: {
|
|
91
|
+
formatter: formatterFunc || function () {
|
|
92
|
+
return String(this.value)
|
|
132
93
|
},
|
|
133
94
|
},
|
|
134
|
-
|
|
135
|
-
|
|
95
|
+
title: {
|
|
96
|
+
text: yAxisTitle,
|
|
136
97
|
},
|
|
137
|
-
|
|
138
|
-
|
|
98
|
+
},
|
|
99
|
+
colors: [
|
|
100
|
+
barColor
|
|
101
|
+
? barColor || ''
|
|
102
|
+
: isDarkMode
|
|
103
|
+
? BrandColors.grayBackground || ''
|
|
104
|
+
: BrandColors.brandBlack || '',
|
|
105
|
+
],
|
|
106
|
+
plotOptions: {
|
|
107
|
+
series: {
|
|
108
|
+
groupPadding: 0.1,
|
|
109
|
+
pointPadding: 0,
|
|
139
110
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
111
|
+
column: {
|
|
112
|
+
minPointLength: 3,
|
|
113
|
+
maxPointWidth: 100,
|
|
114
|
+
borderWidth: 0,
|
|
115
|
+
borderRadiusTopLeft: 3,
|
|
116
|
+
borderRadiusTopRight: 3,
|
|
146
117
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
118
|
+
},
|
|
119
|
+
series: [
|
|
120
|
+
{
|
|
121
|
+
type: 'column',
|
|
122
|
+
data: data,
|
|
123
|
+
borderColor: barColor
|
|
124
|
+
? barColor
|
|
125
|
+
: isDarkMode
|
|
126
|
+
? BrandColors.grayBackground
|
|
127
|
+
: BrandColors.brandBlack,
|
|
128
|
+
states: {
|
|
129
|
+
hover: {
|
|
130
|
+
borderColor: BrandColors.bananaBread,
|
|
131
|
+
color: BrandColors.bananaBread,
|
|
132
|
+
},
|
|
152
133
|
},
|
|
153
134
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
135
|
+
],
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (type === 'percent') {
|
|
139
|
+
chartOptions.tooltip = {
|
|
140
|
+
useHTML: true,
|
|
141
|
+
borderWidth: 0,
|
|
142
|
+
padding: 0,
|
|
143
|
+
borderRadius: 12,
|
|
144
|
+
backgroundColor: 'rgba(28, 47, 60, 0.95)',
|
|
145
|
+
shadow: false,
|
|
146
|
+
style: {
|
|
147
|
+
fontFamily: '\'Avenir Next\', \'Muli\', sans-serif',
|
|
157
148
|
},
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
title: {
|
|
168
|
-
text: this.yAxisTitle,
|
|
169
|
-
},
|
|
149
|
+
formatter: function () {
|
|
150
|
+
const customInfo = (this.point as unknown as { info: string }).info
|
|
151
|
+
return `
|
|
152
|
+
<div class="uikit-bar__tooltip">
|
|
153
|
+
<div class="uikit-bar__tooltip-percent">${this.y}%</div>
|
|
154
|
+
${customInfo ? `<div class="uikit-bar__tooltip-date">${customInfo}</div>` : ''}
|
|
155
|
+
</div>
|
|
156
|
+
`
|
|
170
157
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
],
|
|
178
|
-
plotOptions: {
|
|
179
|
-
series: {
|
|
180
|
-
groupPadding: 0.1,
|
|
181
|
-
pointPadding: 0,
|
|
182
|
-
},
|
|
183
|
-
column: {
|
|
184
|
-
minPointLength: 3,
|
|
185
|
-
maxPointWidth: 100,
|
|
186
|
-
borderWidth: 0,
|
|
187
|
-
borderRadiusTopLeft: 3,
|
|
188
|
-
borderRadiusTopRight: 3,
|
|
189
|
-
},
|
|
158
|
+
}
|
|
159
|
+
chartOptions.xAxis = {
|
|
160
|
+
tickLength: 0,
|
|
161
|
+
lineColor: !isDarkMode ? BrandColors.fog : BrandColors.ash,
|
|
162
|
+
labels: {
|
|
163
|
+
enabled: false,
|
|
190
164
|
},
|
|
191
|
-
series: [
|
|
192
|
-
{
|
|
193
|
-
type: 'column',
|
|
194
|
-
data: this.data,
|
|
195
|
-
borderColor: this.barColor
|
|
196
|
-
? this.barColor
|
|
197
|
-
: this.isDarkMode
|
|
198
|
-
? BrandColors.grayBackground
|
|
199
|
-
: BrandColors.brandBlack,
|
|
200
|
-
states: {
|
|
201
|
-
hover: {
|
|
202
|
-
borderColor: BrandColors.bananaBread,
|
|
203
|
-
color: BrandColors.bananaBread,
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
165
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
backgroundColor: 'rgba(28, 47, 60, 0.95)',
|
|
217
|
-
shadow: false,
|
|
218
|
-
style: {
|
|
219
|
-
fontFamily: '\'Avenir Next\', \'Muli\', sans-serif',
|
|
220
|
-
},
|
|
221
|
-
formatter: function () {
|
|
222
|
-
const customInfo = (this.point as unknown as { info: string }).info
|
|
223
|
-
return `
|
|
224
|
-
<div class="uikit-bar__tooltip">
|
|
225
|
-
<div class="uikit-bar__tooltip-percent">${this.y}%</div>
|
|
226
|
-
${customInfo ? `<div class="uikit-bar__tooltip-date">${customInfo}</div>` : ''}
|
|
227
|
-
</div>
|
|
228
|
-
`
|
|
229
|
-
},
|
|
230
|
-
}
|
|
231
|
-
chartOptions.xAxis = {
|
|
232
|
-
tickLength: 0,
|
|
233
|
-
lineColor: !this.isDarkMode ? BrandColors.fog : BrandColors.ash,
|
|
234
|
-
labels: {
|
|
235
|
-
enabled: false,
|
|
236
|
-
},
|
|
237
|
-
}
|
|
238
|
-
chartOptions.yAxis = {
|
|
239
|
-
min: 0,
|
|
240
|
-
max: 100,
|
|
241
|
-
opposite: true,
|
|
242
|
-
gridLineColor: !this.isDarkMode ? BrandColors.fog : BrandColors.ash,
|
|
243
|
-
plotLines: (this.data.length > 1 && !this.hideAverageLine) ? [
|
|
166
|
+
chartOptions.yAxis = {
|
|
167
|
+
min: 0,
|
|
168
|
+
max: 100,
|
|
169
|
+
opposite: true,
|
|
170
|
+
gridLineColor: !isDarkMode ? BrandColors.fog : BrandColors.ash,
|
|
171
|
+
plotLines: (data.length > 1 && !hideAverageLine)
|
|
172
|
+
? [
|
|
244
173
|
{
|
|
245
174
|
dashStyle: 'Dash',
|
|
246
175
|
value: Math.round(
|
|
247
|
-
(
|
|
176
|
+
(data.reduce((accum, d) => accum + Number(d.y), 0) / data.length)
|
|
248
177
|
),
|
|
249
178
|
width: 2,
|
|
250
179
|
zIndex: 5,
|
|
251
180
|
color: BrandColors.electricViolet,
|
|
252
181
|
},
|
|
253
|
-
]
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
formatter: this.formatterFunc || function () {
|
|
262
|
-
if (this.value === 0) {
|
|
263
|
-
return `${String(this.value)}%`
|
|
264
|
-
}
|
|
265
|
-
return `
|
|
266
|
-
<div>${String(this.value)}%</div>
|
|
267
|
-
<div class="
|
|
268
|
-
uikit-bar__label-circle
|
|
269
|
-
${self.getScoreColor(Number(this.value))}
|
|
270
|
-
" />
|
|
271
|
-
`
|
|
272
|
-
},
|
|
182
|
+
]
|
|
183
|
+
: [],
|
|
184
|
+
labels: {
|
|
185
|
+
useHTML: true,
|
|
186
|
+
y: 4,
|
|
187
|
+
style: {
|
|
188
|
+
textAlign: 'right',
|
|
189
|
+
color: isDarkMode ? 'rgba(255, 255, 255, 0.85)' : BrandColors.ash,
|
|
273
190
|
},
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
191
|
+
formatter: formatterFunc || function () {
|
|
192
|
+
if (this.value === 0) {
|
|
193
|
+
return `${String(this.value)}%`
|
|
194
|
+
}
|
|
195
|
+
return `
|
|
196
|
+
<div>${String(this.value)}%</div>
|
|
197
|
+
<div class="
|
|
198
|
+
uikit-bar__label-circle
|
|
199
|
+
${getScoreColor(Number(this.value))}
|
|
200
|
+
" />
|
|
201
|
+
`
|
|
277
202
|
},
|
|
278
|
-
}
|
|
203
|
+
},
|
|
204
|
+
tickPositions: [ 0, 50, 75, 100 ],
|
|
205
|
+
title: {
|
|
206
|
+
text: null,
|
|
207
|
+
},
|
|
279
208
|
}
|
|
209
|
+
}
|
|
280
210
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
},
|
|
211
|
+
if (size === 'small') {
|
|
212
|
+
chartOptions.plotOptions.column = {
|
|
213
|
+
minPointLength: 3,
|
|
214
|
+
maxPointWidth: 100,
|
|
215
|
+
borderRadiusTopLeft: 8,
|
|
216
|
+
borderRadiusTopRight: 8,
|
|
217
|
+
}
|
|
218
|
+
chartOptions.yAxis = {
|
|
219
|
+
...(chartOptions.yAxis as Highcharts.YAxisOptions || {}),
|
|
220
|
+
labels: {
|
|
221
|
+
...((chartOptions.yAxis as Highcharts.YAxisOptions)?.labels),
|
|
222
|
+
formatter: function () {
|
|
223
|
+
return `${String(this.value)}%`
|
|
295
224
|
},
|
|
296
|
-
}
|
|
225
|
+
},
|
|
297
226
|
}
|
|
298
|
-
|
|
299
|
-
const renderedChart = chart(this.chartId, chartOptions)
|
|
300
|
-
this.$nextTick(() => {
|
|
301
|
-
renderedChart.reflow()
|
|
302
|
-
})
|
|
303
227
|
}
|
|
304
228
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
229
|
+
const renderedChart = chart(chartId, chartOptions)
|
|
230
|
+
nextTick(() => {
|
|
231
|
+
renderedChart.reflow()
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
const getScoreColor = (score: number) => {
|
|
236
|
+
return score <= 50 ? 'red' : score < 75 ? 'yellow' : 'green'
|
|
308
237
|
}
|
|
309
238
|
</script>
|
|
310
239
|
|
|
@@ -361,4 +290,4 @@ export default class Bar extends Vue {
|
|
|
361
290
|
}
|
|
362
291
|
}
|
|
363
292
|
}
|
|
364
|
-
</style>
|
|
293
|
+
</style>
|
|
@@ -2,77 +2,71 @@
|
|
|
2
2
|
<div :id="chartId" class="uikit-pie" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import {
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { nextTick, onMounted } from 'vue'
|
|
7
7
|
import Highcharts, { chart } from 'highcharts'
|
|
8
8
|
import BrandColors from '../../pocketprep-export.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Highcharts.FormatterCallbackFunction<Highcharts.AxisLabelsFormatterContextObject>
|
|
16
|
-
@Prop() type!: 'percent' | 'distribution'
|
|
17
|
-
@Prop({ default: null }) yAxisTitle!: string
|
|
18
|
-
@Prop({ default: null }) max!: number
|
|
19
|
-
@Prop({ default: 'normal' }) size!: 'normal' | 'small'
|
|
10
|
+
const {
|
|
11
|
+
data,
|
|
12
|
+
} = defineProps<{
|
|
13
|
+
data: Highcharts.PointOptionsObject[]
|
|
14
|
+
}>()
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
const chartId = `chart${Math.round(Math.random() * 10000)}`
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
const chartOptions: Highcharts.Options = {
|
|
20
|
+
chart: {
|
|
21
|
+
plotShadow: false,
|
|
22
|
+
type: 'pie',
|
|
23
|
+
margin: [ 0, 0, 0, 0 ],
|
|
24
|
+
spacing: [ 0, 0, 0, 0 ],
|
|
25
|
+
},
|
|
26
|
+
title: undefined,
|
|
27
|
+
tooltip: {
|
|
28
|
+
enabled: false,
|
|
29
|
+
},
|
|
30
|
+
plotOptions: {
|
|
31
|
+
pie: {
|
|
32
|
+
slicedOffset: 0,
|
|
33
|
+
allowPointSelect: false,
|
|
34
|
+
size: '100%',
|
|
35
|
+
dataLabels: {
|
|
36
|
+
enabled: false,
|
|
37
|
+
},
|
|
38
|
+
states: {
|
|
39
|
+
inactive: {
|
|
40
|
+
opacity: 1,
|
|
42
41
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
opacity: 1,
|
|
46
|
-
},
|
|
47
|
-
hover: {
|
|
48
|
-
enabled: false,
|
|
49
|
-
},
|
|
42
|
+
hover: {
|
|
43
|
+
enabled: false,
|
|
50
44
|
},
|
|
51
45
|
},
|
|
52
|
-
series: {
|
|
53
|
-
color: BrandColors.brandBlue,
|
|
54
|
-
borderWidth: 3,
|
|
55
|
-
},
|
|
56
46
|
},
|
|
57
|
-
series:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
47
|
+
series: {
|
|
48
|
+
color: BrandColors.brandBlue,
|
|
49
|
+
borderWidth: 3,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
series: [{
|
|
53
|
+
colors: [
|
|
54
|
+
BrandColors.green || '',
|
|
55
|
+
BrandColors.butterscotch || '',
|
|
56
|
+
BrandColors.electricViolet || '',
|
|
57
|
+
BrandColors.brandBlue || '',
|
|
58
|
+
],
|
|
59
|
+
type: 'pie',
|
|
60
|
+
data: data,
|
|
61
|
+
}],
|
|
62
|
+
}
|
|
68
63
|
|
|
69
|
-
|
|
64
|
+
const pieChart = chart(chartId, chartOptions)
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
66
|
+
nextTick(() => {
|
|
67
|
+
pieChart.reflow()
|
|
68
|
+
})
|
|
69
|
+
})
|
|
76
70
|
</script>
|
|
77
71
|
|
|
78
72
|
<style lang="scss">
|
|
@@ -102,4 +96,4 @@ export default class Pie extends Vue {
|
|
|
102
96
|
display: none;
|
|
103
97
|
}
|
|
104
98
|
}
|
|
105
|
-
</style>
|
|
99
|
+
</style>
|