@gitlab/ui 122.4.0 → 122.6.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/components/charts/bar/bar.js +3 -58
- package/dist/components/charts/shared/tooltip/tooltip.js +26 -7
- package/dist/components/dashboards/dashboard_panel/dashboard_panel.js +12 -3
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +33 -1
- package/dist/tokens/build/js/tokens.js +33 -1
- package/dist/tokens/css/tokens.css +32 -0
- package/dist/tokens/css/tokens.dark.css +32 -0
- package/dist/tokens/docs/tokens-tailwind-docs.dark.json +802 -0
- package/dist/tokens/docs/tokens-tailwind-docs.json +802 -0
- package/dist/tokens/figma/constants.tokens.json +226 -0
- package/dist/tokens/js/tokens.dark.js +32 -0
- package/dist/tokens/js/tokens.js +32 -0
- package/dist/tokens/json/tokens.dark.json +770 -0
- package/dist/tokens/json/tokens.json +770 -0
- package/dist/tokens/scss/_tokens.dark.scss +32 -0
- package/dist/tokens/scss/_tokens.scss +32 -0
- package/dist/tokens/scss/_tokens_custom_properties.scss +32 -0
- package/dist/tokens/tailwind/tokens.cjs +2 -0
- package/dist/utils/charts/config.js +26 -7
- package/package.json +1 -1
- package/src/components/charts/bar/bar.vue +14 -55
- package/src/components/charts/shared/tooltip/tooltip.vue +29 -6
- package/src/components/dashboards/dashboard_panel/dashboard_panel.vue +33 -10
- package/src/scss/variables.scss +0 -29
- package/src/tokens/build/css/tokens.css +32 -0
- package/src/tokens/build/css/tokens.dark.css +32 -0
- package/src/tokens/build/docs/tokens-tailwind-docs.dark.json +802 -0
- package/src/tokens/build/docs/tokens-tailwind-docs.json +802 -0
- package/src/tokens/build/figma/constants.tokens.json +226 -0
- package/src/tokens/build/js/tokens.dark.js +32 -0
- package/src/tokens/build/js/tokens.js +32 -0
- package/src/tokens/build/json/tokens.dark.json +770 -0
- package/src/tokens/build/json/tokens.json +770 -0
- package/src/tokens/build/scss/_tokens.dark.scss +32 -0
- package/src/tokens/build/scss/_tokens.scss +32 -0
- package/src/tokens/build/scss/_tokens_custom_properties.scss +32 -0
- package/src/tokens/build/tailwind/tokens.cjs +35 -0
- package/src/tokens/constant/spacing_scale.tokens.json +228 -0
- package/src/utils/charts/config.js +22 -11
- package/tailwind.defaults.js +1 -38
|
@@ -5,7 +5,6 @@ import { CHART_DEFAULT_SERIES_STACK, HEIGHT_AUTO_CLASSES } from '../../../utils/
|
|
|
5
5
|
import { colorFromDefaultPalette } from '../../../utils/charts/theme';
|
|
6
6
|
import { engineeringNotation } from '../../../utils/number_utils';
|
|
7
7
|
import { hexToRgba } from '../../../utils/utils';
|
|
8
|
-
import TooltipDefaultFormat from '../shared/tooltip/tooltip_default_format/tooltip_default_format';
|
|
9
8
|
import Chart from '../chart/chart';
|
|
10
9
|
import ChartTooltip from '../shared/tooltip/tooltip';
|
|
11
10
|
import { stackedPresentationOptions } from '../../../utils/constants';
|
|
@@ -63,8 +62,7 @@ var script = {
|
|
|
63
62
|
name: 'GlBarChart',
|
|
64
63
|
components: {
|
|
65
64
|
Chart,
|
|
66
|
-
ChartTooltip
|
|
67
|
-
TooltipDefaultFormat
|
|
65
|
+
ChartTooltip
|
|
68
66
|
},
|
|
69
67
|
inheritAttrs: false,
|
|
70
68
|
props: {
|
|
@@ -112,9 +110,7 @@ var script = {
|
|
|
112
110
|
},
|
|
113
111
|
data() {
|
|
114
112
|
return {
|
|
115
|
-
chart: null
|
|
116
|
-
tooltipTitle: '',
|
|
117
|
-
tooltipContent: {}
|
|
113
|
+
chart: null
|
|
118
114
|
};
|
|
119
115
|
},
|
|
120
116
|
computed: {
|
|
@@ -154,13 +150,6 @@ var script = {
|
|
|
154
150
|
type: 'category',
|
|
155
151
|
axisTick: {
|
|
156
152
|
show: true
|
|
157
|
-
},
|
|
158
|
-
axisPointer: {
|
|
159
|
-
show: true,
|
|
160
|
-
type: 'none',
|
|
161
|
-
label: {
|
|
162
|
-
formatter: this.onLabelChange
|
|
163
|
-
}
|
|
164
153
|
}
|
|
165
154
|
}
|
|
166
155
|
}, this.option, dataZoomAdjustments(this.option.dataZoom));
|
|
@@ -176,50 +165,6 @@ var script = {
|
|
|
176
165
|
onCreated(chart) {
|
|
177
166
|
this.chart = chart;
|
|
178
167
|
this.$emit('created', chart);
|
|
179
|
-
},
|
|
180
|
-
onLabelChange(params) {
|
|
181
|
-
const {
|
|
182
|
-
yLabels,
|
|
183
|
-
tooltipContent
|
|
184
|
-
} = this.getTooltipContent(params, this.xAxisTitle);
|
|
185
|
-
this.$set(this, 'tooltipContent', tooltipContent);
|
|
186
|
-
this.tooltipTitle = yLabels.join(', ');
|
|
187
|
-
},
|
|
188
|
-
/**
|
|
189
|
-
* For bar charts, the tooltip should be against x-axis values.
|
|
190
|
-
* This method will be removed after https://gitlab.com/gitlab-org/gitlab-ui/-/issues/674
|
|
191
|
-
*
|
|
192
|
-
* @param {Object} params series data
|
|
193
|
-
* @param {String} xAxisTitle x-axis title
|
|
194
|
-
* @returns {Object} tooltip title and content
|
|
195
|
-
*/
|
|
196
|
-
getTooltipContent(params) {
|
|
197
|
-
let xAxisTitle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
198
|
-
const seriesDataLength = params.seriesData.length;
|
|
199
|
-
const {
|
|
200
|
-
yLabels,
|
|
201
|
-
tooltipContent
|
|
202
|
-
} = params.seriesData.reduce((acc, chartItem) => {
|
|
203
|
-
const [value, title] = chartItem.value || [];
|
|
204
|
-
// The x axis title is used instead of y axis
|
|
205
|
-
const seriesName = seriesDataLength === 1 && xAxisTitle ? xAxisTitle : chartItem.seriesName;
|
|
206
|
-
const color = seriesDataLength === 1 ? '' : chartItem.color;
|
|
207
|
-
acc.tooltipContent[seriesName] = {
|
|
208
|
-
value,
|
|
209
|
-
color
|
|
210
|
-
};
|
|
211
|
-
if (!acc.yLabels.includes(title)) {
|
|
212
|
-
acc.yLabels.push(title);
|
|
213
|
-
}
|
|
214
|
-
return acc;
|
|
215
|
-
}, {
|
|
216
|
-
yLabels: [],
|
|
217
|
-
tooltipContent: {}
|
|
218
|
-
});
|
|
219
|
-
return {
|
|
220
|
-
yLabels,
|
|
221
|
-
tooltipContent
|
|
222
|
-
};
|
|
223
168
|
}
|
|
224
169
|
},
|
|
225
170
|
HEIGHT_AUTO_CLASSES
|
|
@@ -231,7 +176,7 @@ const __vue_script__ = script;
|
|
|
231
176
|
/* template */
|
|
232
177
|
var __vue_render__ = function () {
|
|
233
178
|
var _obj;
|
|
234
|
-
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-grow': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"chart":_vm.chart},scopedSlots:_vm._u([{key:"title",fn:function(){return [
|
|
179
|
+
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-relative",class:( _obj = {}, _obj[_vm.$options.HEIGHT_AUTO_CLASSES] = _vm.autoHeight, _obj )},[_c('chart',_vm._g(_vm._b({class:{ 'gl-grow': _vm.autoHeight },attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"chart":_vm.chart,"use-default-tooltip-formatter":true,"dimension-axis":"yAxis"},scopedSlots:_vm._u([(_vm.$scopedSlots['tooltip-title'])?{key:"title",fn:function(scope){return [_vm._t("tooltip-title",null,null,scope)]}}:null,(_vm.$scopedSlots['tooltip-content'])?{key:"default",fn:function(scope){return [_vm._t("tooltip-content",null,null,scope)]}}:null,(_vm.$scopedSlots['tooltip-value'])?{key:"tooltip-value",fn:function(scope){return [_vm._t("tooltip-value",null,null,scope)]}}:null],null,true)}):_vm._e()],1)};
|
|
235
180
|
var __vue_staticRenderFns__ = [];
|
|
236
181
|
|
|
237
182
|
/* style */
|
|
@@ -3,7 +3,7 @@ import { uid, debounceByAnimationFrame } from '../../../../utils/utils';
|
|
|
3
3
|
import GlPopover from '../../../base/popover/popover';
|
|
4
4
|
import { popoverPlacements } from '../../../../utils/constants';
|
|
5
5
|
import { TOOLTIP_LEFT_OFFSET, TOOLTIP_TOP_OFFSET } from '../../../../utils/charts/constants';
|
|
6
|
-
import { getTooltipTitle, getTooltipContent } from '../../../../utils/charts/config';
|
|
6
|
+
import { getTooltipAxisConfig, getTooltipTitle, getTooltipContent } from '../../../../utils/charts/config';
|
|
7
7
|
import TooltipDefaultFormat from './tooltip_default_format/tooltip_default_format';
|
|
8
8
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
9
9
|
|
|
@@ -125,6 +125,20 @@ var script = {
|
|
|
125
125
|
type: Boolean,
|
|
126
126
|
required: false,
|
|
127
127
|
default: false
|
|
128
|
+
},
|
|
129
|
+
/**
|
|
130
|
+
* Specifies which axis contains the dimensional data used in the tooltip.
|
|
131
|
+
* When `xAxis`, x-axis value becomes the tooltip's title and
|
|
132
|
+
* y-axis values become the tooltip's values.
|
|
133
|
+
* When `yAxis`, roles are reversed.
|
|
134
|
+
*/
|
|
135
|
+
dimensionAxis: {
|
|
136
|
+
type: String,
|
|
137
|
+
required: false,
|
|
138
|
+
default: 'xAxis',
|
|
139
|
+
validator(value) {
|
|
140
|
+
return value === 'xAxis' || value === 'yAxis';
|
|
141
|
+
}
|
|
128
142
|
}
|
|
129
143
|
},
|
|
130
144
|
data() {
|
|
@@ -209,17 +223,22 @@ var script = {
|
|
|
209
223
|
}
|
|
210
224
|
if (this.useDefaultTooltipFormatter) {
|
|
211
225
|
this.chart.setOption({
|
|
212
|
-
|
|
226
|
+
[this.dimensionAxis]: {
|
|
213
227
|
axisPointer: {
|
|
214
228
|
show: true,
|
|
215
229
|
label: {
|
|
216
230
|
formatter: params => {
|
|
217
|
-
var _options$
|
|
231
|
+
var _options$this$dimensi, _options$this$dimensi2, _options$valueAxis, _options$valueAxis$;
|
|
218
232
|
const options = this.chart.getOption();
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
233
|
+
const {
|
|
234
|
+
dimensionIndex,
|
|
235
|
+
metricIndex,
|
|
236
|
+
valueAxis
|
|
237
|
+
} = getTooltipAxisConfig(this.dimensionAxis);
|
|
238
|
+
const titleAxisName = (_options$this$dimensi = options[this.dimensionAxis]) === null || _options$this$dimensi === void 0 ? void 0 : (_options$this$dimensi2 = _options$this$dimensi[0]) === null || _options$this$dimensi2 === void 0 ? void 0 : _options$this$dimensi2.name;
|
|
239
|
+
const valueAxisName = (_options$valueAxis = options[valueAxis]) === null || _options$valueAxis === void 0 ? void 0 : (_options$valueAxis$ = _options$valueAxis[0]) === null || _options$valueAxis$ === void 0 ? void 0 : _options$valueAxis$.name;
|
|
240
|
+
this.title = getTooltipTitle(params, titleAxisName, dimensionIndex);
|
|
241
|
+
this.content = getTooltipContent(params, valueAxisName, metricIndex);
|
|
223
242
|
this.params = params;
|
|
224
243
|
}
|
|
225
244
|
}
|
|
@@ -71,12 +71,15 @@ var script = {
|
|
|
71
71
|
},
|
|
72
72
|
/**
|
|
73
73
|
* Configuration object for the title popover. Expected structure:
|
|
74
|
+
* **Deprecated:** Use slots `#info-popover-content` and `#info-popover-title` instead.
|
|
74
75
|
*
|
|
75
76
|
* - `description`: The popover text content with interpolation placeholders.
|
|
76
77
|
* Uses `%{linkStart}` and `%{linkEnd}` as markers for where a link should be inserted.
|
|
77
78
|
*
|
|
78
79
|
* - `descriptionLink`: The optional URL that will be used for the link portion
|
|
79
80
|
* of the description text between the linkStart and linkEnd markers.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated Use slots `#info-popover-content` and `#info-popover-title` instead.
|
|
80
83
|
*/
|
|
81
84
|
titlePopover: {
|
|
82
85
|
type: Object,
|
|
@@ -151,9 +154,15 @@ var script = {
|
|
|
151
154
|
hasTitle() {
|
|
152
155
|
return Boolean(this.title);
|
|
153
156
|
},
|
|
157
|
+
hasInfoPopoverContentSlot() {
|
|
158
|
+
return Boolean(this.$scopedSlots['info-popover-content']);
|
|
159
|
+
},
|
|
160
|
+
hasInfoPopoverTitleSlot() {
|
|
161
|
+
return Boolean(this.$scopedSlots['info-popover-title']);
|
|
162
|
+
},
|
|
154
163
|
hasTitlePopover() {
|
|
155
164
|
var _this$titlePopover;
|
|
156
|
-
return Boolean((_this$titlePopover = this.titlePopover) === null || _this$titlePopover === void 0 ? void 0 : _this$titlePopover.description);
|
|
165
|
+
return Boolean((_this$titlePopover = this.titlePopover) === null || _this$titlePopover === void 0 ? void 0 : _this$titlePopover.description) || this.hasInfoPopoverContentSlot || this.hasInfoPopoverTitleSlot;
|
|
157
166
|
},
|
|
158
167
|
hasTitlePopoverLink() {
|
|
159
168
|
var _this$titlePopover2;
|
|
@@ -173,9 +182,9 @@ var script = {
|
|
|
173
182
|
const __vue_script__ = script;
|
|
174
183
|
|
|
175
184
|
/* template */
|
|
176
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-border gl-h-full !gl-overflow-visible gl-rounded-lg gl-bg-white gl-p-5",class:_vm.containerClasses,attrs:{"id":_vm.panelId}},[_c('div',{staticClass:"gl-flex gl-h-full gl-flex-col"},[_c('div',{staticClass:"gl-flex gl-items-start gl-justify-between",attrs:{"data-testid":"panel-title"}},[_c('div',{staticClass:"gl-flex gl-items-center gl-overflow-hidden gl-pb-3"},[(_vm.hasTitleIcon)?_c('gl-icon',{staticClass:"gl-mr-2",class:_vm.titleIconClass,attrs:{"name":_vm.titleIcon,"data-testid":"panel-title-icon"}}):_vm._e(),_vm._v(" "),(_vm.hasTitle)?_c('gl-truncate',{staticClass:"gl-font-bold gl-text-default",attrs:{"text":_vm.title,"with-tooltip":""}}):_vm._e(),_vm._v(" "),(_vm.hasTitlePopover)?[_c('gl-icon',{staticClass:"gl-ml-2",attrs:{"id":_vm.titlePopoverId,"data-testid":"panel-title-popover-icon","name":"information-o","variant":"info"}}),_vm._v(" "),_c('gl-popover',{attrs:{"data-testid":"panel-title-popover","boundary":"viewport","target":_vm.titlePopoverId}},[(_vm.hasTitlePopoverLink)?_c('gl-sprintf',{attrs:{"message":_vm.titlePopover.description},scopedSlots:_vm._u([{key:"link",fn:function(ref){
|
|
185
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-border gl-h-full !gl-overflow-visible gl-rounded-lg gl-bg-white gl-p-5",class:_vm.containerClasses,attrs:{"id":_vm.panelId}},[_c('div',{staticClass:"gl-flex gl-h-full gl-flex-col"},[_c('div',{staticClass:"gl-flex gl-items-start gl-justify-between",attrs:{"data-testid":"panel-title"}},[_c('div',{staticClass:"gl-flex gl-items-center gl-overflow-hidden gl-pb-3"},[(_vm.hasTitleIcon)?_c('gl-icon',{staticClass:"gl-mr-2",class:_vm.titleIconClass,attrs:{"name":_vm.titleIcon,"data-testid":"panel-title-icon"}}):_vm._e(),_vm._v(" "),(_vm.hasTitle)?_c('gl-truncate',{staticClass:"gl-font-bold gl-text-default",attrs:{"text":_vm.title,"with-tooltip":""}}):_vm._e(),_vm._v(" "),(_vm.hasTitlePopover)?[_c('gl-icon',{staticClass:"gl-ml-2",attrs:{"id":_vm.titlePopoverId,"data-testid":"panel-title-popover-icon","name":"information-o","variant":"info"}}),_vm._v(" "),_c('gl-popover',{attrs:{"data-testid":"panel-title-popover","boundary":"viewport","target":_vm.titlePopoverId},scopedSlots:_vm._u([(_vm.hasInfoPopoverTitleSlot)?{key:"title",fn:function(){return [_vm._t("info-popover-title")]},proxy:true}:null],null,true)},[_vm._v(" "),(_vm.hasInfoPopoverContentSlot)?[_vm._t("info-popover-content")]:_vm._e(),_vm._v(" "),(!_vm.hasInfoPopoverContentSlot)?[(_vm.hasTitlePopoverLink)?_c('gl-sprintf',{attrs:{"message":_vm.titlePopover.description},scopedSlots:_vm._u([{key:"link",fn:function(ref){
|
|
177
186
|
var content = ref.content;
|
|
178
|
-
return [_c('gl-link',{staticClass:"gl-text-sm",attrs:{"href":_vm.titlePopover.descriptionLink}},[_vm._v(_vm._s(content))])]}}],null,false,3051540671)}):[_vm._v("
|
|
187
|
+
return [_c('gl-link',{staticClass:"gl-text-sm",attrs:{"href":_vm.titlePopover.descriptionLink}},[_vm._v(_vm._s(content))])]}}],null,false,3051540671)}):[_vm._v(" "+_vm._s(_vm.titlePopover.description)+" ")]]:_vm._e()],2)]:_vm._e()],2),_vm._v(" "),(_vm.shouldShowActions || _vm.$scopedSlots.filters)?_c('div',{staticClass:"gl-flex gl-flex-col gl-items-end gl-gap-2",attrs:{"data-testid":"panel-actions-filters-container"}},[(_vm.shouldShowActions)?_c('gl-disclosure-dropdown',{attrs:{"items":_vm.actions,"icon":"ellipsis_v","toggle-text":_vm.actionsToggleText,"text-sr-only":"","no-caret":"","placement":"bottom-end","fluid-width":"","toggle-class":"gl-ml-1","category":"tertiary","positioning-strategy":"fixed","size":"small"},on:{"shown":function($event){return _vm.$emit('dropdownOpen')},"hidden":function($event){return _vm.$emit('dropdownClosed')}},scopedSlots:_vm._u([{key:"list-item",fn:function(ref){
|
|
179
188
|
var item = ref.item;
|
|
180
189
|
return [_c('span',[_vm._v(_vm._s(item.text))])]}}],null,false,3418607560)}):_vm._e(),_vm._v(" "),(_vm.$scopedSlots.filters)?_c('div',{staticClass:"gl-flex gl-items-center gl-justify-end gl-pb-2",attrs:{"data-testid":"panel-filters-container"}},[_vm._t("filters")],2):_vm._e()],1):_vm._e()]),_vm._v(" "),_c('div',{class:_vm.bodyClasses},[(_vm.loading)?[_c('gl-loading-icon',{staticClass:"gl-min-h-8 gl-w-full",attrs:{"size":"lg"}}),_vm._v(" "),(_vm.isLoadingDelayed)?_c('div',{staticClass:"gl-w-full gl-text-subtle",attrs:{"data-testId":"panel-loading-delayed-indicator"}},[_vm._v("\n "+_vm._s(_vm.loadingDelayedText)+"\n ")]):_vm._e()]:_vm._t("body")],2),_vm._v(" "),_vm._t("alert-message",null,{"panelId":_vm.panelId})],2)])};
|
|
181
190
|
var __vue_staticRenderFns__ = [];
|