@gitlab/ui 138.5.1 → 138.6.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.
@@ -189,7 +189,9 @@ var script = {
189
189
  // Wait for DOM update so all items get rendered and can be measured.
190
190
  await this.$nextTick();
191
191
  this.totalBreadcrumbsWidth = 0;
192
- if (!this.$refs.breadcrumbs) return;
192
+
193
+ // The component can unmount, or drop the dropdown, while waiting for the DOM update.
194
+ if (!this.$refs.breadcrumbs || !this.$refs.dropdown) return;
193
195
  this.$refs.breadcrumbs.forEach((b, index) => {
194
196
  const width = b.$el.clientWidth;
195
197
  this.totalBreadcrumbsWidth += width;
@@ -2,7 +2,7 @@ import GlLink from '../link/link';
2
2
  import { buttonCategoryOptions, buttonVariantOptions, buttonSizeOptions, linkVariantUnstyled } from '../../../utils/constants';
3
3
  import { logWarning, stopEvent } from '../../../utils/utils';
4
4
  import { isSlotEmpty } from '../../../utils/is_slot_empty';
5
- import { SafeLinkMixin } from '../../mixins/safe_link_mixin';
5
+ import { SafeLinkDirective } from '../../../directives/safe_link/safe_link';
6
6
  import { glButtonConfig } from '../../../config';
7
7
  import GlIcon from '../icon/icon';
8
8
  import GlLoadingIcon from '../loading_icon/loading_icon';
@@ -15,7 +15,9 @@ var script = {
15
15
  GlIcon,
16
16
  GlLoadingIcon
17
17
  },
18
- mixins: [SafeLinkMixin],
18
+ directives: {
19
+ SafeLink: SafeLinkDirective
20
+ },
19
21
  props: {
20
22
  /**
21
23
  * Set the category of the button.
@@ -234,6 +236,11 @@ var script = {
234
236
  }
235
237
  },
236
238
  computed: {
239
+ safeLinkConfig() {
240
+ return {
241
+ skipSanitization: this.isUnsafeLink
242
+ };
243
+ },
237
244
  hasIcon() {
238
245
  return this.icon !== '';
239
246
  },
@@ -272,18 +272,18 @@ var script = {
272
272
  const __vue_script__ = script;
273
273
 
274
274
  /* template */
275
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-legend",attrs:{"data-testid":"gl-chart-legend"}},[(_vm.layout === _vm.$options.legendLayoutTypes.LEGEND_LAYOUT_INLINE)?[_c('div',{ref:"inlineLegendEl",staticClass:"gl-legend-inline",class:{ 'gl-legend-b-fade': _vm.shouldApplyFadeClass }},_vm._l((_vm.seriesInfo),function(series,key){return _c('div',{key:key,staticClass:"gl-legend-inline-series",class:{
275
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-legend",attrs:{"data-testid":"gl-chart-legend"}},[(_vm.layout === _vm.$options.legendLayoutTypes.LEGEND_LAYOUT_INLINE)?[_c('div',{ref:"inlineLegendEl",staticClass:"gl-legend-inline",class:{ 'gl-legend-b-fade': _vm.shouldApplyFadeClass }},_vm._l((_vm.seriesInfo),function(series,key){return _c('button',{key:key,staticClass:"gl-legend-inline-series",class:{
276
276
  'gl-text-subtle': _vm.disabledSeries[key],
277
277
  'gl-text-strong': !_vm.disabledSeries[key],
278
278
  'gl-w-full': _vm.seriesNameIsLong(series.name),
279
279
  'hover:!gl-cursor-not-allowed':
280
280
  _vm.hasOneSeriesElement || _vm.isToggleDisabled(series.name, series.disabled),
281
- },style:(_vm.fontStyle),attrs:{"aria-disabled":_vm.hasOneSeriesElement || _vm.isToggleDisabled(series.name, series.disabled),"role":"button"},on:{"click":function($event){return _vm.handleClick(series, key)},"mouseenter":function($event){return _vm.handleMouseEnter(series.name)},"mouseleave":function($event){return _vm.handleMouseLeave(series.name)}}},[_c('gl-chart-series-label',{staticClass:"gl-legend-inline-series-label",class:{ 'gl-w-3/4': _vm.seriesNameIsLong(series.name) },attrs:{"color":_vm.getColor(series.color, key),"type":series.type}},[_c('gl-truncate',{staticClass:"gl-font-bold",attrs:{"text":series.name}})],1),_vm._v(" "),(series.data && series.data.length)?_c('span',{class:{ 'gl-whitespace-nowrap': _vm.seriesNameIsLong(series.name) }},[_vm._v("\n "+_vm._s(_vm.averageText)+": "+_vm._s(_vm.seriesAverage(series.data))+" · "+_vm._s(_vm.maxText)+":\n "+_vm._s(_vm.seriesMax(series.data))+"\n ")]):_vm._e()],1)}),0)]:_vm._e(),_vm._v(" "),(_vm.layout === _vm.$options.legendLayoutTypes.LEGEND_LAYOUT_TABLE)?[_c('div',{staticClass:"gl-legend-tabular gl-legend-b-fade",style:(_vm.fontStyle)},[_c('header',{staticClass:"gl-legend-tabular-header"},[_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.minText))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.maxText))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.averageText))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.currentText))])]),_vm._v(" "),_c('section',{staticClass:"gl-legend-tabular-body"},_vm._l((_vm.seriesInfo),function(series,key){return _c('div',{key:key,staticClass:"gl-legend-tabular-row",class:{
281
+ },style:(_vm.fontStyle),attrs:{"type":"button","aria-pressed":String(!_vm.disabledSeries[key]),"aria-disabled":_vm.hasOneSeriesElement || _vm.isToggleDisabled(series.name, series.disabled)},on:{"click":function($event){return _vm.handleClick(series, key)},"mouseenter":function($event){return _vm.handleMouseEnter(series.name)},"mouseleave":function($event){return _vm.handleMouseLeave(series.name)}}},[_c('gl-chart-series-label',{staticClass:"gl-legend-inline-series-label",class:{ 'gl-w-3/4': _vm.seriesNameIsLong(series.name) },attrs:{"color":_vm.getColor(series.color, key),"type":series.type}},[_c('gl-truncate',{staticClass:"gl-font-bold",attrs:{"text":series.name}})],1),_vm._v(" "),(series.data && series.data.length)?_c('span',{class:{ 'gl-whitespace-nowrap': _vm.seriesNameIsLong(series.name) }},[_vm._v("\n "+_vm._s(_vm.averageText)+": "+_vm._s(_vm.seriesAverage(series.data))+" · "+_vm._s(_vm.maxText)+":\n "+_vm._s(_vm.seriesMax(series.data))+"\n ")]):_vm._e()],1)}),0)]:_vm._e(),_vm._v(" "),(_vm.layout === _vm.$options.legendLayoutTypes.LEGEND_LAYOUT_TABLE)?[_c('div',{staticClass:"gl-legend-tabular gl-legend-b-fade",style:(_vm.fontStyle)},[_c('header',{staticClass:"gl-legend-tabular-header"},[_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.minText))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.maxText))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.averageText))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-header-cell"},[_vm._v(_vm._s(_vm.currentText))])]),_vm._v(" "),_c('section',{staticClass:"gl-legend-tabular-body"},_vm._l((_vm.seriesInfo),function(series,key){return _c('button',{key:key,staticClass:"gl-legend-tabular-row",class:{
282
282
  'gl-text-subtle': _vm.disabledSeries[key],
283
283
  'gl-text-strong': !_vm.disabledSeries[key],
284
284
  'hover:!gl-cursor-not-allowed':
285
285
  _vm.hasOneSeriesElement || _vm.isToggleDisabled(series.name, series.disabled),
286
- },style:(_vm.fontStyle),attrs:{"aria-disabled":_vm.isToggleDisabled(series.name, series.disabled),"role":"button"},on:{"click":function($event){return _vm.handleClick(series, key)},"mouseenter":function($event){return _vm.handleMouseEnter(series.name)},"mouseleave":function($event){return _vm.handleMouseLeave(series.name)}}},[_c('div',{staticClass:"gl-legend-tabular-title-cell"},[_c('gl-chart-series-label',{style:(_vm.fontStyle),attrs:{"color":_vm.getColor(series.color, key),"type":series.type}},[_c('gl-truncate',{staticClass:"gl-font-bold",attrs:{"text":series.name}})],1)],1),_vm._v(" "),(_vm.sanitizeSeriesData(series.data).length)?[_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesMin(series.data)))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesMax(series.data)))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesAverage(series.data)))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesLast(series.data)))])]:[_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")])]],2)}),0)])]:_vm._e()],2)};
286
+ },style:(_vm.fontStyle),attrs:{"type":"button","aria-pressed":String(!_vm.disabledSeries[key]),"aria-disabled":_vm.hasOneSeriesElement || _vm.isToggleDisabled(series.name, series.disabled)},on:{"click":function($event){return _vm.handleClick(series, key)},"mouseenter":function($event){return _vm.handleMouseEnter(series.name)},"mouseleave":function($event){return _vm.handleMouseLeave(series.name)}}},[_c('div',{staticClass:"gl-legend-tabular-title-cell"},[_c('gl-chart-series-label',{style:(_vm.fontStyle),attrs:{"color":_vm.getColor(series.color, key),"type":series.type}},[_c('gl-truncate',{staticClass:"gl-font-bold",attrs:{"text":series.name}})],1)],1),_vm._v(" "),(_vm.sanitizeSeriesData(series.data).length)?[_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesMin(series.data)))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesMax(series.data)))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesAverage(series.data)))]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v(_vm._s(_vm.seriesLast(series.data)))])]:[_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")]),_vm._v(" "),_c('div',{staticClass:"gl-legend-tabular-details-cell"},[_vm._v("-")])]],2)}),0)])]:_vm._e()],2)};
287
287
  var __vue_staticRenderFns__ = [];
288
288
 
289
289
  /* style */
@@ -1,4 +1,5 @@
1
1
  import { isObject, uniqueId } from 'lodash-es';
2
+ import GlButton from '../../base/button/button';
2
3
  import GlDisclosureDropdown from '../../base/new_dropdowns/disclosure/disclosure_dropdown';
3
4
  import GlIcon from '../../base/icon/icon';
4
5
  import GlLoadingIcon from '../../base/loading_icon/loading_icon';
@@ -7,11 +8,13 @@ import GlSprintf from '../../utilities/sprintf/sprintf';
7
8
  import GlLink from '../../base/link/link';
8
9
  import GlTruncate from '../../utilities/truncate/truncate';
9
10
  import GlSkeletonLoader from '../../base/skeleton_loader/skeleton_loader';
11
+ import { sprintf, translate } from '../../../utils/i18n';
10
12
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
11
13
 
12
14
  var script = {
13
15
  name: 'GlDashboardPanel',
14
16
  components: {
17
+ GlButton,
15
18
  GlDisclosureDropdown,
16
19
  GlLoadingIcon,
17
20
  GlIcon,
@@ -54,6 +57,15 @@ var script = {
54
57
  required: false,
55
58
  default: ''
56
59
  },
60
+ /**
61
+ * HTML tag for the panel title. Set a heading level, such as `h3`, so screen reader users
62
+ * can move between panels by heading.
63
+ */
64
+ titleTag: {
65
+ type: String,
66
+ required: false,
67
+ default: 'div'
68
+ },
57
69
  /**
58
70
  * The name of the icon to render next to the panel title.
59
71
  */
@@ -181,6 +193,11 @@ var script = {
181
193
  var _this$titlePopover;
182
194
  return Boolean((_this$titlePopover = this.titlePopover) === null || _this$titlePopover === void 0 ? void 0 : _this$titlePopover.description) || this.hasInfoPopoverContentSlot || this.hasInfoPopoverTitleSlot;
183
195
  },
196
+ titlePopoverLabel() {
197
+ return this.hasTitle ? sprintf(translate('GlDashboardPanel.titlePopoverLabelWithTitle', 'More information about %{title}'), {
198
+ title: this.title
199
+ }, false) : translate('GlDashboardPanel.titlePopoverLabel', 'More information');
200
+ },
184
201
  hasTitlePopoverLink() {
185
202
  var _this$titlePopover2;
186
203
  return Boolean((_this$titlePopover2 = this.titlePopover) === null || _this$titlePopover2 === void 0 ? void 0 : _this$titlePopover2.descriptionLink);
@@ -199,7 +216,7 @@ var script = {
199
216
  const __vue_script__ = script;
200
217
 
201
218
  /* template */
202
- 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-rounded-lg gl-bg-default 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-mb-3 gl-flex gl-items-start gl-justify-between",attrs:{"data-testid":"panel-title"}},[(_vm.loading)?_c('gl-skeleton-loader',{attrs:{"lines":1}}):_c('div',{staticClass:"gl-flex gl-items-center gl-gap-2 gl-overflow-hidden"},[(_vm.hasTitleIcon)?_c('gl-icon',{class:_vm.titleIconClass,attrs:{"name":_vm.titleIcon,"data-testid":"panel-title-icon"}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-min-w-0"},[_c('div',{staticClass:"gl-flex gl-items-center gl-gap-2"},[(_vm.hasTitle)?_c('gl-truncate',{staticClass:"gl-min-w-0 gl-font-bold gl-text-default",attrs:{"text":_vm.title,"with-tooltip":""}}):_vm._e(),_vm._v(" "),(_vm.hasTitlePopover)?[_c('gl-icon',{staticClass:"gl-min-w-5",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,"css-classes":_vm.titlePopoverClasses},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){
219
+ 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-rounded-lg gl-bg-default 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-mb-3 gl-flex gl-items-start gl-justify-between",attrs:{"data-testid":"panel-title"}},[(_vm.loading)?_c('gl-skeleton-loader',{attrs:{"lines":1}}):_c('div',{staticClass:"gl-flex gl-items-center gl-gap-2 gl-overflow-hidden"},[(_vm.hasTitleIcon)?_c('gl-icon',{class:_vm.titleIconClass,attrs:{"name":_vm.titleIcon,"data-testid":"panel-title-icon"}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-min-w-0"},[_c('div',{staticClass:"gl-flex gl-items-center gl-gap-2"},[(_vm.hasTitle)?_c(_vm.titleTag,{tag:"component",staticClass:"gl-m-0 gl-min-w-0 gl-text-size-reset gl-font-bold gl-leading-reset gl-text-default",attrs:{"data-testid":"panel-title-text"}},[_c('gl-truncate',{attrs:{"text":_vm.title,"with-tooltip":""}})],1):_vm._e(),_vm._v(" "),(_vm.hasTitlePopover)?[_c('gl-button',{attrs:{"id":_vm.titlePopoverId,"variant":"link","aria-label":_vm.titlePopoverLabel,"data-testid":"panel-title-popover-icon"}},[_c('gl-icon',{staticClass:"gl-min-w-5",attrs:{"name":"information-o","variant":"info"}})],1),_vm._v(" "),_c('gl-popover',{attrs:{"data-testid":"panel-title-popover","boundary":"viewport","target":_vm.titlePopoverId,"css-classes":_vm.titlePopoverClasses},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){
203
220
  var content = ref.content;
204
221
  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.subtitle)?_c('p',{staticClass:"gl-mb-0 gl-mt-1 gl-text-sm gl-text-subtle",attrs:{"data-testid":"panel-subtitle"}},[_vm._v("\n "+_vm._s(_vm.subtitle)+"\n ")]):_vm._e()])],1),_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('dropdown-open')},"hidden":function($event){return _vm.$emit('dropdown-closed')}},scopedSlots:_vm._u([{key:"list-item",fn:function(ref){
205
222
  var item = ref.item;