@gitlab/ui 123.2.0 → 123.3.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.
- package/dist/components/base/button/button.js +21 -2
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +9 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +2 -1
- package/dist/tokens/build/js/tokens.js +2 -1
- package/dist/tokens/css/tokens.css +1 -0
- package/dist/tokens/css/tokens.dark.css +1 -0
- package/dist/tokens/figma/contextual.tokens.json +18 -0
- package/dist/tokens/js/tokens.dark.js +1 -0
- package/dist/tokens/js/tokens.js +1 -0
- package/dist/tokens/json/tokens.dark.json +41 -0
- package/dist/tokens/json/tokens.json +41 -0
- package/dist/tokens/scss/_tokens.dark.scss +1 -0
- package/dist/tokens/scss/_tokens.scss +1 -0
- package/dist/tokens/scss/_tokens_custom_properties.scss +1 -0
- package/package.json +5 -5
- package/src/components/base/button/button.scss +23 -4
- package/src/components/base/button/button.vue +27 -2
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.vue +8 -1
- package/src/tokens/build/css/tokens.css +1 -0
- package/src/tokens/build/css/tokens.dark.css +1 -0
- package/src/tokens/build/figma/contextual.tokens.json +18 -0
- package/src/tokens/build/js/tokens.dark.js +1 -0
- package/src/tokens/build/js/tokens.js +1 -0
- package/src/tokens/build/json/tokens.dark.json +41 -0
- package/src/tokens/build/json/tokens.json +41 -0
- package/src/tokens/build/scss/_tokens.dark.scss +1 -0
- package/src/tokens/build/scss/_tokens.scss +1 -0
- package/src/tokens/build/scss/_tokens_custom_properties.scss +1 -0
- 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 */
|
|
@@ -324,7 +324,15 @@ var script = {
|
|
|
324
324
|
});
|
|
325
325
|
},
|
|
326
326
|
handleAutoClose(e) {
|
|
327
|
-
|
|
327
|
+
var _this$$refs$baseDropd, _this$$refs$baseDropd2;
|
|
328
|
+
if (this.autoClose && e.target.closest(ITEM_SELECTOR) && // The optional chaining here is to accommodate specs that use shallow mounting.
|
|
329
|
+
// Ideally, those specs would either:
|
|
330
|
+
// - stub out the `BaseDropdown` component to include a stub `containsElement` method, or
|
|
331
|
+
// - use a full mount.
|
|
332
|
+
//
|
|
333
|
+
// Unfortunately, GitLab has many specs which do neither of these. So the simpler thing to do
|
|
334
|
+
// is to optionally chain the method call here.
|
|
335
|
+
(_this$$refs$baseDropd = (_this$$refs$baseDropd2 = this.$refs.baseDropdown).containsElement) !== null && _this$$refs$baseDropd !== void 0 && _this$$refs$baseDropd.call(_this$$refs$baseDropd2, e.target)) {
|
|
328
336
|
this.closeAndFocus();
|
|
329
337
|
}
|
|
330
338
|
},
|