@gitlab/ui 71.3.0 → 71.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [71.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v71.3.0...v71.4.0) (2023-12-04)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlTruncateText:** add `toggleButtonProps` prop ([25a6577](https://gitlab.com/gitlab-org/gitlab-ui/commit/25a6577ba7061ce82d040ad5cda6977477e04f41))
7
+
1
8
  # [71.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v71.2.0...v71.3.0) (2023-12-04)
2
9
 
3
10
 
@@ -311,7 +311,6 @@ var script = {
311
311
  // Do nothing if there was no active token, or if idx > this.activeTokenIdx,
312
312
  // to preserve the active state of the remaining tokens.
313
313
  },
314
-
315
314
  replaceToken(idx, token) {
316
315
  this.$set(this.tokens, idx, ensureTokenId({
317
316
  ...token,
@@ -8,7 +8,6 @@ const sizes = ['sm',
8
8
  // -> 32px
9
9
  'xl' // -> 64px
10
10
  ];
11
-
12
11
  const colors = {
13
12
  dark: 'dark',
14
13
  light: 'light'
@@ -207,7 +207,6 @@ var script = {
207
207
  created() {
208
208
  this.handleScrollingTrottled = throttle(this.handleScrolling, 200); // Assume a 200ms throttle for example
209
209
  },
210
-
211
210
  mounted() {
212
211
  this.scrollToBottom();
213
212
  },
@@ -43,6 +43,16 @@ var script = {
43
43
  type: Number,
44
44
  required: false,
45
45
  default: 10
46
+ },
47
+ /**
48
+ * Props that are passed to the toggle button
49
+ */
50
+ toggleButtonProps: {
51
+ type: Object,
52
+ required: false,
53
+ default() {
54
+ return {};
55
+ }
46
56
  }
47
57
  },
48
58
  data() {
@@ -101,7 +111,7 @@ var script = {
101
111
  const __vue_script__ = script;
102
112
 
103
113
  /* template */
104
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',[_c('article',{directives:[{name:"gl-resize-observer",rawName:"v-gl-resize-observer",value:(_vm.onResize),expression:"onResize"}],class:_vm.truncationClasses,style:(_vm.cssVariables),attrs:{"aria-expanded":_vm.ariaExpanded}},[_vm._t("default")],2),_vm._v(" "),(_vm.showTruncationToggle)?_c('gl-button',{attrs:{"variant":"link"},on:{"click":_vm.toggleTruncation}},[_vm._v(_vm._s(_vm.truncationToggleText))]):_vm._e()],1)};
114
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',[_c('article',{directives:[{name:"gl-resize-observer",rawName:"v-gl-resize-observer",value:(_vm.onResize),expression:"onResize"}],class:_vm.truncationClasses,style:(_vm.cssVariables),attrs:{"aria-expanded":_vm.ariaExpanded}},[_vm._t("default")],2),_vm._v(" "),(_vm.showTruncationToggle)?_c('gl-button',_vm._b({attrs:{"variant":"link"},on:{"click":_vm.toggleTruncation}},'gl-button',_vm.toggleButtonProps,false),[_vm._v(_vm._s(_vm.truncationToggleText))]):_vm._e()],1)};
105
115
  var __vue_staticRenderFns__ = [];
106
116
 
107
117
  /* style */
package/dist/config.js CHANGED
@@ -78,7 +78,6 @@ const setConfigs = function () {
78
78
  /* eslint-enable no-console */
79
79
  }
80
80
  }
81
-
82
81
  Object.assign(i18n, translations);
83
82
  }
84
83
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 04 Dec 2023 02:31:35 GMT
3
+ * Generated on Mon, 04 Dec 2023 16:16:35 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 04 Dec 2023 02:31:35 GMT
3
+ * Generated on Mon, 04 Dec 2023 16:16:35 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 04 Dec 2023 02:31:35 GMT
3
+ * Generated on Mon, 04 Dec 2023 16:16:35 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#133a03";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 04 Dec 2023 02:31:35 GMT
3
+ * Generated on Mon, 04 Dec 2023 16:16:35 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#ddfab7";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 04 Dec 2023 02:31:35 GMT
3
+ // Generated on Mon, 04 Dec 2023 16:16:35 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 04 Dec 2023 02:31:35 GMT
3
+ // Generated on Mon, 04 Dec 2023 16:16:35 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "71.3.0",
3
+ "version": "71.4.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -87,8 +87,8 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@arkweid/lefthook": "0.7.7",
90
- "@babel/core": "^7.23.3",
91
- "@babel/preset-env": "^7.23.3",
90
+ "@babel/core": "^7.23.5",
91
+ "@babel/preset-env": "^7.23.5",
92
92
  "@babel/preset-react": "^7.23.3",
93
93
  "@cypress/grep": "^4.0.1",
94
94
  "@gitlab/eslint-plugin": "19.2.0",
@@ -1,3 +1,4 @@
1
+ import { nextTick } from 'vue';
1
2
  import { mount } from '@vue/test-utils';
2
3
  import { createMockDirective, getBinding } from '~helpers/vue_mock_directive';
3
4
  import GlButton from '../../base/button/button.vue';
@@ -133,4 +134,17 @@ describe('GlTruncateText', () => {
133
134
  });
134
135
  });
135
136
  });
137
+
138
+ it('passes `toggleButtonProps` to toggle button', async () => {
139
+ const buttonTextClasses = 'foo-bar';
140
+
141
+ createComponent({ toggleButtonProps: { buttonTextClasses } });
142
+
143
+ getBinding(findContentEl(), 'gl-resize-observer').value({
144
+ target: { scrollHeight: 20, offsetHeight: 10 },
145
+ });
146
+ await nextTick();
147
+
148
+ expect(findButton().props('buttonTextClasses')).toBe(buttonTextClasses);
149
+ });
136
150
  });
@@ -6,11 +6,13 @@ const generateProps = ({
6
6
  showLessText = 'Show less',
7
7
  lines = 3,
8
8
  mobileLines = 10,
9
+ toggleButtonProps = {},
9
10
  } = {}) => ({
10
11
  showMoreText,
11
12
  showLessText,
12
13
  lines,
13
14
  mobileLines,
15
+ toggleButtonProps,
14
16
  });
15
17
 
16
18
  const content = () => [...Array(15)].map((_, i) => `line ${i + 1}`).join('\n');
@@ -44,6 +44,16 @@ export default {
44
44
  required: false,
45
45
  default: 10,
46
46
  },
47
+ /**
48
+ * Props that are passed to the toggle button
49
+ */
50
+ toggleButtonProps: {
51
+ type: Object,
52
+ required: false,
53
+ default() {
54
+ return {};
55
+ },
56
+ },
47
57
  },
48
58
  data() {
49
59
  return {
@@ -103,8 +113,12 @@ export default {
103
113
  <!-- @slot Text content -->
104
114
  <slot></slot>
105
115
  </article>
106
- <gl-button v-if="showTruncationToggle" variant="link" @click="toggleTruncation">{{
107
- truncationToggleText
108
- }}</gl-button>
116
+ <gl-button
117
+ v-if="showTruncationToggle"
118
+ v-bind="toggleButtonProps"
119
+ variant="link"
120
+ @click="toggleTruncation"
121
+ >{{ truncationToggleText }}</gl-button
122
+ >
109
123
  </section>
110
124
  </template>