@gitlab/ui 123.1.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.
Files changed (35) hide show
  1. package/dist/components/base/button/button.js +21 -2
  2. package/dist/components/base/popover/popover.js +18 -3
  3. package/dist/components/dashboards/dashboard_panel/dashboard_panel.js +2 -2
  4. package/dist/components/experimental/experiment_badge/experiment_badge.js +1 -1
  5. package/dist/index.css +2 -2
  6. package/dist/index.css.map +1 -1
  7. package/dist/tokens/build/js/tokens.dark.js +2 -1
  8. package/dist/tokens/build/js/tokens.js +2 -1
  9. package/dist/tokens/css/tokens.css +1 -0
  10. package/dist/tokens/css/tokens.dark.css +1 -0
  11. package/dist/tokens/figma/contextual.tokens.json +18 -0
  12. package/dist/tokens/js/tokens.dark.js +1 -0
  13. package/dist/tokens/js/tokens.js +1 -0
  14. package/dist/tokens/json/tokens.dark.json +41 -0
  15. package/dist/tokens/json/tokens.json +41 -0
  16. package/dist/tokens/scss/_tokens.dark.scss +1 -0
  17. package/dist/tokens/scss/_tokens.scss +1 -0
  18. package/dist/tokens/scss/_tokens_custom_properties.scss +1 -0
  19. package/package.json +4 -4
  20. package/src/components/base/button/button.scss +23 -4
  21. package/src/components/base/button/button.vue +27 -2
  22. package/src/components/base/popover/popover.vue +21 -3
  23. package/src/components/dashboards/dashboard_panel/dashboard_panel.vue +2 -2
  24. package/src/components/experimental/experiment_badge/experiment_badge.vue +1 -1
  25. package/src/tokens/build/css/tokens.css +1 -0
  26. package/src/tokens/build/css/tokens.dark.css +1 -0
  27. package/src/tokens/build/figma/contextual.tokens.json +18 -0
  28. package/src/tokens/build/js/tokens.dark.js +1 -0
  29. package/src/tokens/build/js/tokens.js +1 -0
  30. package/src/tokens/build/json/tokens.dark.json +41 -0
  31. package/src/tokens/build/json/tokens.json +41 -0
  32. package/src/tokens/build/scss/_tokens.dark.scss +1 -0
  33. package/src/tokens/build/scss/_tokens.scss +1 -0
  34. package/src/tokens/build/scss/_tokens_custom_properties.scss +1 -0
  35. package/src/tokens/contextual/button.tokens.json +18 -0
@@ -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 */
@@ -17,9 +17,9 @@ var script = {
17
17
  inheritAttrs: false,
18
18
  props: {
19
19
  cssClasses: {
20
- type: Array,
20
+ type: [Array, String, Object],
21
21
  required: false,
22
- default: () => []
22
+ default: ''
23
23
  },
24
24
  /**
25
25
  * Space-separated triggers for the popover.
@@ -57,13 +57,28 @@ var script = {
57
57
  return this.$scopedSlots.title || this.title;
58
58
  },
59
59
  customClass() {
60
- return ['gl-popover', this.hasTitle && 'has-title', this.showCloseButton && 'has-close-button', ...this.cssClasses].filter(Boolean).join(' ');
60
+ return ['gl-popover', this.hasTitle && 'has-title', this.showCloseButton && 'has-close-button', ...this.normalizedCssClasses(this.cssClasses)].filter(Boolean).join(' ');
61
61
  },
62
62
  shouldShowTitle() {
63
63
  return this.hasTitle || this.showCloseButton;
64
64
  }
65
65
  },
66
66
  methods: {
67
+ /**
68
+ * `cssClasses can be a string, an array, or an object. This method normalizes it to an array
69
+ */
70
+ normalizedCssClasses(cssClasses) {
71
+ if (Array.isArray(cssClasses)) {
72
+ return cssClasses;
73
+ }
74
+ if (typeof cssClasses === 'string') {
75
+ return cssClasses.trim() ? cssClasses.trim().split(/\s+/) : [];
76
+ }
77
+ if (cssClasses && typeof cssClasses === 'object') {
78
+ return Object.keys(cssClasses).filter(key => cssClasses[key]);
79
+ }
80
+ return [];
81
+ },
67
82
  close(e) {
68
83
  this.$refs[popoverRefName].doClose();
69
84
  /**
@@ -90,9 +90,9 @@ var script = {
90
90
  * CSS classes to apply to the title popover (gets passed to the `css-classes` prop of the `GlPopover` component).
91
91
  */
92
92
  titlePopoverClasses: {
93
- type: Array,
93
+ type: [Array, String, Object],
94
94
  required: false,
95
- default: () => []
95
+ default: ''
96
96
  },
97
97
  /**
98
98
  * Set to `true` to show the loading state.
@@ -63,7 +63,7 @@ var script = {
63
63
  const __vue_script__ = script;
64
64
 
65
65
  /* template */
66
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-badge',{ref:"badge",staticClass:"gl-mx-4 hover:gl-cursor-pointer",attrs:{"id":_vm.triggerId,"href":"#","variant":"neutral"}},[_c('span',[_vm._v(_vm._s(_vm.activeType.BADGE))]),_vm._v(" "),_c('gl-popover',{attrs:{"triggers":"hover focus click","show-close-button":"","placement":_vm.popoverPlacement,"target":_vm.triggerId,"css-classes":['!gl-z-9999'],"title":_vm.activeType.POPOVER_TITLE}},[_c('gl-sprintf',{attrs:{"message":_vm.activeType.POPOVER_CONTENT},scopedSlots:_vm._u([{key:"link",fn:function(ref){
66
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-badge',{ref:"badge",staticClass:"gl-mx-4 hover:gl-cursor-pointer",attrs:{"id":_vm.triggerId,"href":"#","variant":"neutral"}},[_c('span',[_vm._v(_vm._s(_vm.activeType.BADGE))]),_vm._v(" "),_c('gl-popover',{attrs:{"triggers":"hover focus click","show-close-button":"","placement":_vm.popoverPlacement,"target":_vm.triggerId,"css-classes":"!gl-z-9999","title":_vm.activeType.POPOVER_TITLE}},[_c('gl-sprintf',{attrs:{"message":_vm.activeType.POPOVER_CONTENT},scopedSlots:_vm._u([{key:"link",fn:function(ref){
67
67
  var content = ref.content;
68
68
  return [_c('gl-link',{staticClass:"!gl-text-sm",attrs:{"href":_vm.activeType.HELP_PAGE_URL,"target":"_blank"}},[_vm._v("\n "+_vm._s(content))])]}},{key:"bullets",fn:function(){return [_c('ul',{staticClass:"gl-mb-0 gl-pl-5"},_vm._l((_vm.activeType.POPOVER_BULLETS),function(item,i){return _c('li',{key:("li-" + i)},[_vm._v("\n "+_vm._s(item)+"\n ")])}),0)]},proxy:true},{key:"line-break",fn:function(ref){
69
69
  var content = ref.content;