@gitlab/ui 108.7.0 → 108.8.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,18 @@
1
+ ## [108.8.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v108.8.0...v108.8.1) (2025-02-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlTruncate:** Prevent total whitespace collapse ([2811b7e](https://gitlab.com/gitlab-org/gitlab-ui/commit/2811b7e7e9a7fc37bd17042063ee3e4504cb380d))
7
+
8
+ # [108.8.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v108.7.0...v108.8.0) (2025-02-27)
9
+
10
+
11
+ ### Features
12
+
13
+ * **GlDatepicker:** use variant prop on GlIcon for disabled control ([f64fe84](https://gitlab.com/gitlab-org/gitlab-ui/commit/f64fe843b018b4fe04ea8626c38d942b729bd279))
14
+ * **GlLabel:** update scoped label title text color to text.color.strong ([6df7597](https://gitlab.com/gitlab-org/gitlab-ui/commit/6df7597071f2e24800a784b164616a1a7a5b5f44))
15
+
1
16
  # [108.7.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v108.6.0...v108.7.0) (2025-02-26)
2
17
 
3
18
 
@@ -380,7 +380,7 @@ var script = {
380
380
  const __vue_script__ = script;
381
381
 
382
382
  /* template */
383
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.datepickerClasses},[(_vm.showDefaultField)?_c('div',{staticClass:"gl-flex gl-items-start gl-gap-3"},[_c('div',{staticClass:"gl-relative gl-flex gl-grow"},[_vm._t("default",function(){return [_c('gl-form-input',{class:_vm.renderClearButton ? '!gl-pr-9' : '!gl-pr-7',attrs:{"id":_vm.inputId,"name":_vm.inputName,"data-testid":"gl-datepicker-input","value":_vm.formattedDate,"placeholder":_vm.placeholder,"autocomplete":_vm.inputAutocomplete,"disabled":_vm.disabled,"aria-label":_vm.inputLabel,"state":_vm.state},on:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onKeydown.apply(null, arguments)}},model:{value:(_vm.textInput),callback:function ($$v) {_vm.textInput=$$v;},expression:"textInput"}})]},{"formattedDate":_vm.formattedDate}),_vm._v(" "),_c('div',{staticClass:"gl-datepicker-actions"},[(_vm.renderClearButton)?_c('gl-button',{staticClass:"gl-pointer-events-auto",attrs:{"data-testid":"clear-button","aria-label":"Clear date","category":"tertiary","size":"small","icon":"clear"},on:{"click":_vm.cleared}}):_vm._e(),_vm._v(" "),(_vm.triggerOnFocus || _vm.disabled)?_c('span',{staticClass:"gl-px-2",class:_vm.disabled ? 'gl-text-gray-400' : 'gl-text-gray-500',attrs:{"data-testid":"datepicker-calendar-icon"}},[_c('gl-icon',{staticClass:"gl-block",attrs:{"name":"calendar","size":16}})],1):_c('gl-button',{ref:"calendarTriggerBtn",staticClass:"gl-pointer-events-auto",attrs:{"aria-label":"Open datepicker","category":"tertiary","size":"small","icon":"calendar"}})],1)],2),_vm._v(" "),_vm._t("after")],2):_vm._t("default",null,{"formattedDate":_vm.formattedDate})],2)};
383
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.datepickerClasses},[(_vm.showDefaultField)?_c('div',{staticClass:"gl-flex gl-items-start gl-gap-3"},[_c('div',{staticClass:"gl-relative gl-flex gl-grow"},[_vm._t("default",function(){return [_c('gl-form-input',{class:_vm.renderClearButton ? '!gl-pr-9' : '!gl-pr-7',attrs:{"id":_vm.inputId,"name":_vm.inputName,"data-testid":"gl-datepicker-input","value":_vm.formattedDate,"placeholder":_vm.placeholder,"autocomplete":_vm.inputAutocomplete,"disabled":_vm.disabled,"aria-label":_vm.inputLabel,"state":_vm.state},on:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onKeydown.apply(null, arguments)}},model:{value:(_vm.textInput),callback:function ($$v) {_vm.textInput=$$v;},expression:"textInput"}})]},{"formattedDate":_vm.formattedDate}),_vm._v(" "),_c('div',{staticClass:"gl-datepicker-actions"},[(_vm.renderClearButton)?_c('gl-button',{staticClass:"gl-pointer-events-auto",attrs:{"data-testid":"clear-button","aria-label":"Clear date","category":"tertiary","size":"small","icon":"clear"},on:{"click":_vm.cleared}}):_vm._e(),_vm._v(" "),(_vm.triggerOnFocus || _vm.disabled)?_c('span',{staticClass:"gl-px-2"},[_c('gl-icon',{staticClass:"gl-block",attrs:{"data-testid":"datepicker-calendar-icon","name":"calendar","size":16,"variant":_vm.disabled ? 'disabled' : 'default'}})],1):_c('gl-button',{ref:"calendarTriggerBtn",staticClass:"gl-pointer-events-auto",attrs:{"aria-label":"Open datepicker","category":"tertiary","size":"small","icon":"calendar"}})],1)],2),_vm._v(" "),_vm._t("after")],2):_vm._t("default",null,{"formattedDate":_vm.formattedDate})],2)};
384
384
  var __vue_staticRenderFns__ = [];
385
385
 
386
386
  /* style */
@@ -3,5 +3,6 @@ const POSITION = {
3
3
  MIDDLE: 'middle',
4
4
  END: 'end'
5
5
  };
6
+ const ZERO_WIDTH_SPACE = '\u200b';
6
7
 
7
- export { POSITION };
8
+ export { POSITION, ZERO_WIDTH_SPACE };
@@ -1,6 +1,6 @@
1
1
  import { GlTooltipDirective } from '../../../directives/tooltip';
2
2
  import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
3
- import { POSITION } from './constants';
3
+ import { POSITION, ZERO_WIDTH_SPACE } from './constants';
4
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
5
 
6
6
  //
@@ -46,8 +46,49 @@ var script = {
46
46
  middleIndex() {
47
47
  return Math.floor(this.text.length / 2);
48
48
  },
49
+ preventWhitespaceCollapse() {
50
+ // We don't use `\s` here since it includes non-breaking spaces and other
51
+ // non-collapsible whitespace characters.
52
+ // See https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
53
+ // and https://infra.spec.whatwg.org/#ascii-whitespace.
54
+ const collapsibleWhitespaceChar = /^[ \n\t\r\f]$/;
55
+ const {
56
+ text,
57
+ middleIndex
58
+ } = this;
59
+ const lastCharOfFirstIsCollapsibleWhitespace = collapsibleWhitespaceChar.test(text.charAt(middleIndex - 1));
60
+ const firstCharOfLastIsCollapsibleWhitespace = collapsibleWhitespaceChar.test(text.charAt(middleIndex));
61
+ return lastCharOfFirstIsCollapsibleWhitespace && !firstCharOfLastIsCollapsibleWhitespace;
62
+ },
49
63
  first() {
50
- return this.text.slice(0, this.middleIndex);
64
+ const first = this.text.slice(0, this.middleIndex);
65
+ if (this.preventWhitespaceCollapse) {
66
+ // Because this component's root element has an internal flex layout,
67
+ // whitespace at the end of the first child span and at the beginning
68
+ // of the second child span would be ignored (i.e., totally collapsed).
69
+ //
70
+ // This means that strings with a space character in the middle would
71
+ // render as if there were no space, which would be incorrect (e.g.,
72
+ // "Gap here" would render as "Gaphere").
73
+ //
74
+ // So, in that case, we insert a zero-width space at the end of the
75
+ // first child span to prevent that whitespace from being totally
76
+ // collapsed. In other words:
77
+ // 'first-part-with-space ' → 'first-part-with-space ​'
78
+ //
79
+ // If there's a whitespace character at the begging of the second child
80
+ // span, we do *not* do this, since the left-to-right mark (‎) just
81
+ // before `{{ last }}` in the template prevents the collapse of any
82
+ // whitespace at the start of `last`. If we ignored this edge case,
83
+ // we'd render a double space, which wouldn't correspond to how the
84
+ // string would normally render.
85
+ //
86
+ // See
87
+ // https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace#whitespace_in_block_formatting_contexts
88
+ // for more information on how browsers treat whitespace.
89
+ return `${first}${ZERO_WIDTH_SPACE}`;
90
+ }
91
+ return first;
51
92
  },
52
93
  last() {
53
94
  return this.text.slice(this.middleIndex);