@gitlab/ui 85.11.0 → 85.12.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [85.12.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v85.12.0...v85.12.1) (2024-06-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlBadge:** Fix shrinking in flex layout ([161aaa8](https://gitlab.com/gitlab-org/gitlab-ui/commit/161aaa88196825a84485e4e59347a4838be9b477))
7
+
8
+ # [85.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v85.11.0...v85.12.0) (2024-06-28)
9
+
10
+
11
+ ### Features
12
+
13
+ * **i18n:** add support for parameterized/pluralized translations ([468e66d](https://gitlab.com/gitlab-org/gitlab-ui/commit/468e66d068913b392e0b4e5497650f57a8240f5c))
14
+
1
15
  # [85.11.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v85.10.0...v85.11.0) (2024-06-28)
2
16
 
3
17
 
@@ -68,7 +68,7 @@ var script = {
68
68
  const __vue_script__ = script;
69
69
 
70
70
  /* template */
71
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-badge',_vm._b({staticClass:"gl-badge",class:{ 'gl-px-2!': !_vm.$scopedSlots.default },attrs:{"variant":_vm.variant,"role":_vm.role,"aria-label":_vm.ariaLabel,"pill":""}},'b-badge',_vm.$attrs,false),[(_vm.icon)?_c('gl-icon',{staticClass:"gl-badge-icon",class:{ '-gl-ml-2 gl-ml-n2': _vm.isCircularIcon },attrs:{"size":_vm.iconSizeComputed,"name":_vm.icon}}):_vm._e(),_vm._v(" "),_vm._t("default")],2)};
71
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-badge',_vm._b({staticClass:"gl-badge",class:{ 'gl-px-2!': !_vm.$scopedSlots.default },attrs:{"variant":_vm.variant,"role":_vm.role,"aria-label":_vm.ariaLabel,"pill":""}},'b-badge',_vm.$attrs,false),[(_vm.icon)?_c('gl-icon',{staticClass:"gl-badge-icon",class:{ '-gl-ml-2 gl-ml-n2': _vm.isCircularIcon },attrs:{"size":_vm.iconSizeComputed,"name":_vm.icon}}):_vm._e(),_vm._v(" "),(_vm.$slots.default)?_c('span',{staticClass:"gl-badge-content"},[_vm._t("default")],2):_vm._e()],1)};
72
72
  var __vue_staticRenderFns__ = [];
73
73
 
74
74
  /* style */
@@ -9,7 +9,7 @@ import GlLoadingIcon from '../../loading_icon/loading_icon';
9
9
  import GlIntersectionObserver from '../../../utilities/intersection_observer/intersection_observer';
10
10
  import GlSearchBoxByType from '../../search_box_by_type/search_box_by_type';
11
11
  import GlBaseDropdown from '../base_dropdown/base_dropdown';
12
- import { translate } from '../../../../utils/i18n';
12
+ import { translatePlural } from '../../../../utils/i18n';
13
13
  import GlListboxItem from './listbox_item';
14
14
  import GlListboxSearchInput from './listbox_search_input';
15
15
  import GlListboxGroup from './listbox_group';
@@ -327,13 +327,7 @@ var script = {
327
327
  srOnlyResultsLabel: {
328
328
  type: Function,
329
329
  required: false,
330
- default: count => {
331
- const fn = translate('GlCollapsibleListbox.srOnlyResultsLabel', 'Results count');
332
- if (typeof fn === 'function') {
333
- return fn(count);
334
- }
335
- return `${count} result${count > 1 ? 's' : ''}`;
336
- }
330
+ default: translatePlural('GlCollapsibleListbox.srOnlyResultsLabel', '%d result', '%d results')
337
331
  }
338
332
  },
339
333
  data() {
@@ -3,6 +3,7 @@ import isFunction from 'lodash/isFunction';
3
3
  import range from 'lodash/range';
4
4
  import { breakpoints, GlBreakpointInstance } from '../../../utils/breakpoints';
5
5
  import { alignOptions, resizeDebounceTime } from '../../../utils/constants';
6
+ import { translate, sprintf } from '../../../utils/i18n';
6
7
  import GlIcon from '../icon/icon';
7
8
  import GlLink from '../link/link';
8
9
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -144,9 +145,10 @@ var script = {
144
145
  * aria-label getter for numbered page items, defaults to "Go to page <page_number>"
145
146
  */
146
147
  labelPage: {
147
- type: Function,
148
+ // note: `Function` support is for legacy reasons
149
+ type: [Function, String],
148
150
  required: false,
149
- default: page => `Go to page ${page}`
151
+ default: translate('GlPagination.labelPage', 'Go to page %{page}')
150
152
  },
151
153
  /**
152
154
  * Controls the component\'s horizontal alignment, value should be one of "left", "center", "right" or "fill"
@@ -244,10 +246,10 @@ var script = {
244
246
  return this.pageIsDisabled(this.value + 1);
245
247
  },
246
248
  prevPageAriaLabel() {
247
- return this.prevPageIsDisabled ? false : this.labelPrevPage || this.labelPage(this.value - 1);
249
+ return this.prevPageIsDisabled ? false : this.labelPrevPage || this.labelForPage(this.value - 1);
248
250
  },
249
251
  nextPageAriaLabel() {
250
- return this.nextPageIsDisabled ? false : this.labelNextPage || this.labelPage(this.value + 1);
252
+ return this.nextPageIsDisabled ? false : this.labelNextPage || this.labelForPage(this.value + 1);
251
253
  },
252
254
  prevPageHref() {
253
255
  if (this.prevPageIsDisabled) return false;
@@ -267,6 +269,14 @@ var script = {
267
269
  window.removeEventListener('resize', debounce(this.setBreakpoint, resizeDebounceTime));
268
270
  },
269
271
  methods: {
272
+ labelForPage(page) {
273
+ if (isFunction(this.labelPage)) {
274
+ return this.labelPage(page);
275
+ }
276
+ return sprintf(this.labelPage, {
277
+ page
278
+ });
279
+ },
270
280
  setBreakpoint() {
271
281
  this.breakpoint = GlBreakpointInstance.getBreakpointSize();
272
282
  },
@@ -276,7 +286,7 @@ var script = {
276
286
  getPageItem(page) {
277
287
  let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
278
288
  const commonAttrs = {
279
- 'aria-label': label || this.labelPage(page),
289
+ 'aria-label': label || this.labelForPage(page),
280
290
  href: '#',
281
291
  class: []
282
292
  };