@gitlab/ui 123.2.0 → 123.3.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.
@@ -209,6 +209,22 @@ var script = {
209
209
  // Vue treats `undefined` as default of `false` for Boolean props,
210
210
  // so we must set it as `null` here to be a true tri-state prop
211
211
  default: null
212
+ },
213
+ /**
214
+ * Display a count badge next to the button text.
215
+ */
216
+ count: {
217
+ type: Number,
218
+ required: false,
219
+ default: null
220
+ },
221
+ /**
222
+ * Screen reader text to provide context for the count value.
223
+ */
224
+ countSrText: {
225
+ type: String,
226
+ required: false,
227
+ default: null
212
228
  }
213
229
  },
214
230
  computed: {
@@ -216,7 +232,7 @@ var script = {
216
232
  return this.icon !== '';
217
233
  },
218
234
  hasIconOnly() {
219
- return isSlotEmpty(this, 'default') && this.hasIcon;
235
+ return isSlotEmpty(this, 'default') && this.hasIcon && this.count == null;
220
236
  },
221
237
  isButtonDisabled() {
222
238
  return this.disabled || this.loading;
@@ -321,6 +337,9 @@ var script = {
321
337
  return GlLink;
322
338
  }
323
339
  return this.tag;
340
+ },
341
+ hasCount() {
342
+ return this.count != null && this.count >= 0;
324
343
  }
325
344
  },
326
345
  mounted() {
@@ -359,7 +378,7 @@ var script = {
359
378
  const __vue_script__ = script;
360
379
 
361
380
  /* template */
362
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.componentIs,_vm._g(_vm._b({directives:[{name:"safe-link",rawName:"v-safe-link:[safeLinkConfig]",arg:_vm.safeLinkConfig}],tag:"component",class:_vm.buttonClasses},'component',_vm.computedPropsAndAttributes,false),_vm.computedListeners),[(_vm.loading)?_c('gl-loading-icon',{staticClass:"gl-button-icon gl-button-loading-indicator",attrs:{"inline":""}}):_vm._e(),_vm._v(" "),(_vm.hasIcon && !(_vm.hasIconOnly && _vm.loading))?_c('gl-icon',{staticClass:"gl-button-icon",attrs:{"name":_vm.icon}}):_vm._e(),_vm._v(" "),_vm._t("emoji"),_vm._v(" "),(!_vm.hasIconOnly)?_c('span',{staticClass:"gl-button-text",class:_vm.buttonTextClasses},[_vm._t("default")],2):_vm._e()],2)};
381
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.componentIs,_vm._g(_vm._b({directives:[{name:"safe-link",rawName:"v-safe-link:[safeLinkConfig]",arg:_vm.safeLinkConfig}],tag:"component",class:_vm.buttonClasses},'component',_vm.computedPropsAndAttributes,false),_vm.computedListeners),[(_vm.loading)?_c('gl-loading-icon',{staticClass:"gl-button-icon gl-button-loading-indicator",attrs:{"inline":""}}):_vm._e(),_vm._v(" "),(_vm.hasIcon && !(_vm.hasIconOnly && _vm.loading))?_c('gl-icon',{staticClass:"gl-button-icon",attrs:{"name":_vm.icon}}):_vm._e(),_vm._v(" "),_vm._t("emoji"),_vm._v(" "),(!_vm.hasIconOnly)?_c('span',{staticClass:"gl-button-text",class:_vm.buttonTextClasses},[_vm._t("default"),_vm._v(" "),(_vm.hasCount)?_c('span',{staticClass:"gl-button-count"},[_vm._v("\n "+_vm._s(_vm.count)+"\n "),(_vm.countSrText)?_c('span',{staticClass:"gl-sr-only"},[_vm._v(_vm._s(_vm.countSrText))]):_vm._e()]):_vm._e()],2):_vm._e()],2)};
363
382
  var __vue_staticRenderFns__ = [];
364
383
 
365
384
  /* style */