@gitlab/ui 86.13.0 → 86.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "86.13.0",
3
+ "version": "86.14.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -111,7 +111,7 @@
111
111
  "@babel/preset-env": "^7.24.8",
112
112
  "@babel/preset-react": "^7.24.7",
113
113
  "@cypress/grep": "^4.0.1",
114
- "@gitlab/eslint-plugin": "19.5.0",
114
+ "@gitlab/eslint-plugin": "19.6.0",
115
115
  "@gitlab/fonts": "^1.3.0",
116
116
  "@gitlab/stylelint-config": "6.1.0",
117
117
  "@gitlab/svgs": "3.105.0",
@@ -85,6 +85,14 @@ $badge-min-width: $gl-spacing-scale-3;
85
85
  width: 100%;
86
86
  // Mitigate the effect of width: 100%
87
87
  max-width: max-content;
88
+ transition: color $gl-transition-duration-medium $gl-easing-out-cubic,
89
+ background-color $gl-transition-duration-medium $gl-easing-out-cubic,
90
+ border-color $gl-transition-duration-medium $gl-easing-out-cubic,
91
+ box-shadow $gl-transition-duration-medium $gl-easing-out-cubic;
92
+
93
+ @media (prefers-reduced-motion) {
94
+ transition-duration: .01ms !important;
95
+ }
88
96
 
89
97
  @media (forced-colors: active) {
90
98
  border: 1px solid;
@@ -139,9 +139,12 @@ export default {
139
139
  const mergedOptions = merge({}, defaultChartOptions, sparkLineChartOptions);
140
140
  return mergeSeriesToOptions(mergedOptions, this.series);
141
141
  },
142
+ willShowLastYValue() {
143
+ return this.showLastYValue && this.data.length;
144
+ },
142
145
  series() {
143
- const { data, smooth, itemStyle, showLastYValue, connectNulls } = this;
144
- const markPoint = showLastYValue
146
+ const { data, smooth, itemStyle, willShowLastYValue, connectNulls } = this;
147
+ const markPoint = willShowLastYValue
145
148
  ? {
146
149
  symbol: 'circle',
147
150
  cursor: 'auto',
@@ -171,12 +174,29 @@ export default {
171
174
  };
172
175
  },
173
176
  itemStyle() {
174
- if (this.gradient.length) {
177
+ if (this.applyGradient) {
175
178
  return { color: generateGradient(this.gradient) };
176
179
  }
180
+ if (this.gradient.length) {
181
+ // If the gradient cannot be used, then apply
182
+ // the first colour to the entire line.
183
+ return { color: this.gradient[0] };
184
+ }
177
185
  return {};
178
186
  },
187
+ applyGradient() {
188
+ if (this.gradient.length && this.data.length) {
189
+ // Applying a gradient a constant line will cause it to not render,
190
+ // so skip the gradient if all values are equal.
191
+ const [, firstValue] = this.data[0];
192
+ return this.data.some(([, value]) => firstValue !== value);
193
+ }
194
+
195
+ return false;
196
+ },
179
197
  lastYValue() {
198
+ if (!this.willShowLastYValue) return undefined;
199
+
180
200
  const latestEntry = this.data.slice(-1)[0];
181
201
 
182
202
  return latestEntry[1];