@gitlab/ui 124.3.0 → 124.4.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.
@@ -107,6 +107,8 @@ var script = {
107
107
  // array with the individual widths of each breadcrumb item
108
108
  dropdownWidth: 0,
109
109
  // the width of the breadcrumb item containing the dropdown toggle
110
+ clipboardButtonWidth: 0,
111
+ // the width of the clipboard button at the end of breadcrumbs
110
112
  resizeDone: false // to apply some CSS only during/after resizing
111
113
  };
112
114
  },
@@ -155,6 +157,7 @@ var script = {
155
157
  } else {
156
158
  this.resizeDone = true;
157
159
  }
160
+ this.clipboardButtonWidth = this.showClipboardButton ? this.$refs.clipboardButton.$el.clientWidth : 0;
158
161
  },
159
162
  beforeDestroy() {
160
163
  this.disableAutoResize();
@@ -178,8 +181,9 @@ var script = {
178
181
  this.totalBreadcrumbsWidth += width;
179
182
  this.widthPerItem[index] = width;
180
183
  });
184
+ this.totalBreadcrumbsWidth += this.clipboardButtonWidth;
181
185
 
182
- // The dropdown gets rendered during `!resizeDone` so we can mesuare its real width here.
186
+ // The dropdown gets rendered during `!resizeDone` so we can measure its real width here.
183
187
  this.dropdownWidth = this.$refs.dropdown.clientWidth;
184
188
  this.makeBreadcrumbsFit();
185
189
  },
@@ -237,7 +241,7 @@ var script = {
237
241
  const __vue_script__ = script;
238
242
 
239
243
  /* template */
240
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{staticClass:"gl-breadcrumbs",style:(_vm.breadcrumbStyle),attrs:{"aria-label":_vm.ariaLabel}},[_c('ol',_vm._g(_vm._b({staticClass:"gl-breadcrumb-list breadcrumb"},'ol',_vm.$attrs,false),_vm.$listeners),[(_vm.hasCollapsible || !_vm.resizeDone)?_c('li',{ref:"dropdown",class:("gl-breadcrumb-item gl-breadcrumb-item-" + _vm.size)},[_c('gl-disclosure-dropdown',{attrs:{"items":_vm.overflowingItems,"toggle-text":_vm.showMoreLabel,"fluid-width":"","text-sr-only":"","no-caret":"","icon":"ellipsis_h","size":_vm.dropdownSize}})],1):_vm._e(),_vm._v(" "),_vm._l((_vm.fittingItems),function(item,index){return _c('gl-breadcrumb-item',{key:index,ref:"breadcrumbs",refInFor:true,class:[_vm.hideItemClass(item), _vm.itemClass],attrs:{"text":item.text,"href":item.href,"to":item.to,"size":_vm.size,"aria-current":_vm.getAriaCurrentAttr(index)},scopedSlots:_vm._u([{key:"default",fn:function(){return [(item.avatarPath)?_c('gl-avatar',{staticClass:"gl-breadcrumb-avatar-tile gl-border gl-mr-2 !gl-rounded-default",attrs:{"src":item.avatarPath,"size":_vm.avatarSize,"aria-hidden":"true","shape":"rect","data-testid":"avatar"}}):_vm._e(),_c('span',{staticClass:"gl-align-middle"},[_vm._v(_vm._s(item.text))])]},proxy:true}],null,true)})}),_vm._v(" "),(_vm.showClipboardButton)?_c('li',{staticClass:"gl-breadcrumb-clipboard-button"},[_c('clipboard-button',_vm._b({staticClass:"gl-ml-2",attrs:{"data-testid":"copy-to-clipboard-button","text":_vm.clipboardButtonText,"size":_vm.dropdownSize}},'clipboard-button',_vm.clipboardTooltipText ? { title: _vm.clipboardTooltipText } : {},false))],1):_vm._e()],2)])};
244
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{staticClass:"gl-breadcrumbs",style:(_vm.breadcrumbStyle),attrs:{"aria-label":_vm.ariaLabel}},[_c('ol',_vm._g(_vm._b({staticClass:"gl-breadcrumb-list breadcrumb"},'ol',_vm.$attrs,false),_vm.$listeners),[(_vm.hasCollapsible || !_vm.resizeDone)?_c('li',{ref:"dropdown",class:("gl-breadcrumb-item gl-breadcrumb-item-" + _vm.size)},[_c('gl-disclosure-dropdown',{attrs:{"items":_vm.overflowingItems,"toggle-text":_vm.showMoreLabel,"fluid-width":"","text-sr-only":"","no-caret":"","icon":"ellipsis_h","size":_vm.dropdownSize}})],1):_vm._e(),_vm._v(" "),_vm._l((_vm.fittingItems),function(item,index){return _c('gl-breadcrumb-item',{key:index,ref:"breadcrumbs",refInFor:true,class:[_vm.hideItemClass(item), _vm.itemClass],attrs:{"text":item.text,"href":item.href,"to":item.to,"size":_vm.size,"aria-current":_vm.getAriaCurrentAttr(index)},scopedSlots:_vm._u([{key:"default",fn:function(){return [(item.avatarPath)?_c('gl-avatar',{staticClass:"gl-breadcrumb-avatar-tile gl-border gl-mr-2 !gl-rounded-default",attrs:{"src":item.avatarPath,"size":_vm.avatarSize,"aria-hidden":"true","shape":"rect","data-testid":"avatar"}}):_vm._e(),_c('span',{staticClass:"gl-align-middle"},[_vm._v(_vm._s(item.text))])]},proxy:true}],null,true)})}),_vm._v(" "),(_vm.showClipboardButton)?_c('li',{staticClass:"gl-breadcrumb-clipboard-button"},[_c('clipboard-button',_vm._b({ref:"clipboardButton",staticClass:"gl-ml-2",attrs:{"data-testid":"copy-to-clipboard-button","text":_vm.clipboardButtonText,"size":_vm.dropdownSize}},'clipboard-button',_vm.clipboardTooltipText ? { title: _vm.clipboardTooltipText } : {},false))],1):_vm._e()],2)])};
241
245
  var __vue_staticRenderFns__ = [];
242
246
 
243
247
  /* style */
@@ -63,6 +63,14 @@ var script = {
63
63
  default() {
64
64
  return {};
65
65
  }
66
+ },
67
+ /**
68
+ * Whether to validate fields on blur. When set to false, validation will only occur on form submission.
69
+ */
70
+ validateOnBlur: {
71
+ type: Boolean,
72
+ required: false,
73
+ default: true
66
74
  }
67
75
  },
68
76
  data() {
@@ -180,7 +188,9 @@ var script = {
180
188
  });
181
189
  },
182
190
  onFieldBlur(fieldName) {
183
- this.setFieldDirty(fieldName);
191
+ if (this.validateOnBlur) {
192
+ this.setFieldDirty(fieldName);
193
+ }
184
194
  },
185
195
  onFieldInput(fieldName, inputValue) {
186
196
  const val = this.getMappedValue(fieldName, inputValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "124.3.0",
3
+ "version": "124.4.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -98,6 +98,7 @@ export default {
98
98
  totalBreadcrumbsWidth: 0, // the total width of all breadcrumb items combined
99
99
  widthPerItem: [], // array with the individual widths of each breadcrumb item
100
100
  dropdownWidth: 0, // the width of the breadcrumb item containing the dropdown toggle
101
+ clipboardButtonWidth: 0, // the width of the clipboard button at the end of breadcrumbs
101
102
  resizeDone: false, // to apply some CSS only during/after resizing
102
103
  };
103
104
  },
@@ -146,6 +147,9 @@ export default {
146
147
  } else {
147
148
  this.resizeDone = true;
148
149
  }
150
+ this.clipboardButtonWidth = this.showClipboardButton
151
+ ? this.$refs.clipboardButton.$el.clientWidth
152
+ : 0;
149
153
  },
150
154
  beforeDestroy() {
151
155
  this.disableAutoResize();
@@ -173,7 +177,9 @@ export default {
173
177
  this.widthPerItem[index] = width;
174
178
  });
175
179
 
176
- // The dropdown gets rendered during `!resizeDone` so we can mesuare its real width here.
180
+ this.totalBreadcrumbsWidth += this.clipboardButtonWidth;
181
+
182
+ // The dropdown gets rendered during `!resizeDone` so we can measure its real width here.
177
183
  this.dropdownWidth = this.$refs.dropdown.clientWidth;
178
184
 
179
185
  this.makeBreadcrumbsFit();
@@ -277,6 +283,7 @@ export default {
277
283
 
278
284
  <li v-if="showClipboardButton" class="gl-breadcrumb-clipboard-button">
279
285
  <clipboard-button
286
+ ref="clipboardButton"
280
287
  data-testid="copy-to-clipboard-button"
281
288
  class="gl-ml-2"
282
289
  :text="clipboardButtonText"
@@ -64,6 +64,14 @@ export default {
64
64
  return {};
65
65
  },
66
66
  },
67
+ /**
68
+ * Whether to validate fields on blur. When set to false, validation will only occur on form submission.
69
+ */
70
+ validateOnBlur: {
71
+ type: Boolean,
72
+ required: false,
73
+ default: true,
74
+ },
67
75
  },
68
76
  data() {
69
77
  return {
@@ -197,7 +205,9 @@ export default {
197
205
  });
198
206
  },
199
207
  onFieldBlur(fieldName) {
200
- this.setFieldDirty(fieldName);
208
+ if (this.validateOnBlur) {
209
+ this.setFieldDirty(fieldName);
210
+ }
201
211
  },
202
212
  onFieldInput(fieldName, inputValue) {
203
213
  const val = this.getMappedValue(fieldName, inputValue);