@gitlab/ui 66.25.0 → 66.25.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 05 Oct 2023 10:55:11 GMT
3
+ * Generated on Mon, 09 Oct 2023 19:55:25 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 05 Oct 2023 10:55:11 GMT
3
+ * Generated on Mon, 09 Oct 2023 19:55:26 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 05 Oct 2023 10:55:11 GMT
3
+ * Generated on Mon, 09 Oct 2023 19:55:26 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 05 Oct 2023 10:55:11 GMT
3
+ * Generated on Mon, 09 Oct 2023 19:55:25 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 05 Oct 2023 10:55:11 GMT
3
+ // Generated on Mon, 09 Oct 2023 19:55:26 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 Thu, 05 Oct 2023 10:55:11 GMT
3
+ // Generated on Mon, 09 Oct 2023 19:55:26 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
@@ -65,7 +65,7 @@ const CHART_TYPE_BAR = 'bar';
65
65
  const CHART_TYPE_LINE = 'line';
66
66
 
67
67
  // Constants for height "auto"
68
- const HEIGHT_AUTO_CLASSES = 'gl-display-flex gl-flex-direction-column gl-h-full';
68
+ const HEIGHT_AUTO_CLASSES = 'gl-chart-h-auto gl-display-flex gl-flex-direction-column gl-h-full';
69
69
  const HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES = 'gl-display-flex gl-h-full';
70
70
 
71
71
  export { ANNOTATIONS_COMPONENT_TYPE, ANNOTATIONS_SERIES_NAME, ANNOTATION_TOOLTIP_TOP_OFFSET, CHART_TYPE_BAR, CHART_TYPE_LINE, DATA_TOOLTIP_LEFT_OFFSET, HEIGHT_AUTO_CLASSES, HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES, LEGEND_AVERAGE_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, TOOLTIP_LEFT_OFFSET, arrowSymbol };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "66.25.0",
3
+ "version": "66.25.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,8 +1,37 @@
1
+ // shorter height by half a line, so table body is cut off,
2
+ // suggesting there's more to scroll
3
+ $legend-body-h: $gl-spacing-scale-13 - $gl-spacing-scale-4;
4
+
5
+ .gl-legend {
6
+ @include gl-relative;
7
+ }
8
+
9
+ .gl-chart-h-auto {
10
+ .gl-legend-inline {
11
+ // match the height of gl-legend-tabular (header + body)
12
+ max-height: $gl-line-height-24 + $legend-body-h;
13
+ @include gl-overflow-auto;
14
+ }
15
+ }
16
+
17
+ .gl-legend-tabular,
18
+ .gl-chart-h-auto .gl-legend-inline {
19
+ &::after {
20
+ background-image: linear-gradient(to bottom, $transparent-rgba, $white);
21
+ @include gl-bottom-0;
22
+ @include gl-content-empty;
23
+ @include gl-display-block;
24
+ @include gl-h-4;
25
+ @include gl-absolute;
26
+ @include gl-w-full;
27
+ }
28
+ }
29
+
1
30
  .gl-legend-inline {
2
- @include gl-display-flex;
3
- @include gl-flex-wrap;
4
- @include gl-flex-shrink-0;
5
- @include gl-text-gray-900;
31
+ @include gl-display-flex;
32
+ @include gl-flex-wrap;
33
+ @include gl-flex-shrink-0;
34
+ @include gl-text-gray-900;
6
35
 
7
36
  .gl-legend-inline-series {
8
37
  @include gl-display-flex;
@@ -23,18 +52,6 @@
23
52
  }
24
53
 
25
54
  .gl-legend-tabular {
26
- @include gl-relative;
27
-
28
- &::after {
29
- background-image: linear-gradient(to bottom, $transparent-rgba, $white);
30
- @include gl-bottom-0;
31
- @include gl-content-empty;
32
- @include gl-display-block;
33
- @include gl-h-4;
34
- @include gl-absolute;
35
- @include gl-w-full;
36
- }
37
-
38
55
  .gl-legend-tabular-header {
39
56
  @include gl-display-flex;
40
57
  @include gl-justify-content-end;
@@ -56,9 +73,7 @@
56
73
  }
57
74
 
58
75
  .gl-legend-tabular-body {
59
- // shorter height by half a line, so table body is cut off,
60
- // suggesting there's more to scroll
61
- height: $gl-spacing-scale-13 - $gl-spacing-scale-4;
76
+ height: $legend-body-h;
62
77
  @include gl-overflow-y-auto;
63
78
 
64
79
  > *:nth-child(odd) {
@@ -1,5 +1,5 @@
1
1
  import { GlChart, GlChartLegend } from '../../../charts';
2
- import { LEGEND_LAYOUT_TABLE } from '../../../utils/charts/constants';
2
+ import { HEIGHT_AUTO_CLASSES, LEGEND_LAYOUT_TABLE } from '../../../utils/charts/constants';
3
3
  import { generateSeriesData } from '../../../utils/charts/story_config';
4
4
  import {
5
5
  SERIES_NAME_SHORT,
@@ -43,13 +43,14 @@ const generateSeriesInfo = (amount, nameType) => {
43
43
  }));
44
44
  };
45
45
 
46
- const generateTemplate = (type) => {
46
+ const generateTemplate = (type, wrapperAttrs = {}, chartAttrs = {}) => {
47
47
  const layoutTypeAttribute =
48
48
  type === LEGEND_LAYOUT_TABLE ? `:layout="'${LEGEND_LAYOUT_TABLE}'"` : '';
49
49
 
50
- return `<div>
50
+ return `<div v-bind='${JSON.stringify(wrapperAttrs)}'>
51
51
  <gl-chart
52
52
  :options="$options.options"
53
+ v-bind='${JSON.stringify(chartAttrs)}'
53
54
  @created="onCreated"
54
55
  />
55
56
  <gl-chart-legend
@@ -93,7 +94,7 @@ const getStoryOptions = (seriesLength, seriesNameType, legendLayoutType) => {
93
94
  ...baseStoryOptions,
94
95
  options: generateOptions(seriesLength, seriesNameType),
95
96
  seriesInfo: generateSeriesInfo(seriesLength, seriesNameType),
96
- template: legendLayoutType ? generateTemplate(legendLayoutType) : generateTemplate(),
97
+ template: generateTemplate(legendLayoutType),
97
98
  };
98
99
  };
99
100
 
@@ -110,6 +111,24 @@ export const DefaultWithLongSeriesNames = () => getStoryOptions(10, SERIES_NAME_
110
111
  export const DefaultWithLongSeriesNamesAndNoSpaces = () =>
111
112
  getStoryOptions(10, SERIES_NAME_LONG_WITHOUT_SPACES);
112
113
 
114
+ export const DefaultWithOverflowingFixedContainerHeight = () => {
115
+ const storyOptions = getStoryOptions(50, SERIES_NAME_LONG_WITHOUT_SPACES, null);
116
+
117
+ storyOptions.template = generateTemplate(
118
+ null,
119
+ {
120
+ class: HEIGHT_AUTO_CLASSES, // line, area, heatmap etc charts all have these classes on the wrapper element in auto height mode
121
+ style: 'height: 400px; overflow: hidden; outline: 1px solid red;', // Simulate being inside a dashboard panel with fixed height and no overflow
122
+ },
123
+ {
124
+ height: 'auto',
125
+ class: 'gl-flex-grow-1', // line, area, heatmap etc charts all have gl-flex-grow-1 on the <gl-chart> element in auto height mode
126
+ }
127
+ );
128
+
129
+ return storyOptions;
130
+ };
131
+
113
132
  export const WithTabularLayout = () => getStoryOptions(10, SERIES_NAME_SHORT, LEGEND_LAYOUT_TABLE);
114
133
  export const WithTabularLayoutAndDisabledLegendItem = () => {
115
134
  const storyOptions = getStoryOptions(10, SERIES_NAME_SHORT, LEGEND_LAYOUT_TABLE);
@@ -123,6 +142,24 @@ export const WithTabularLayoutAndLongSeriesNames = () =>
123
142
  export const WithTabularLayoutAndLongSeriesNamesWithNoSpaces = () =>
124
143
  getStoryOptions(10, SERIES_NAME_LONG_WITHOUT_SPACES, LEGEND_LAYOUT_TABLE);
125
144
 
145
+ export const WithTabularOverflowingFixedContainerHeight = () => {
146
+ const storyOptions = getStoryOptions(50, SERIES_NAME_LONG_WITHOUT_SPACES, LEGEND_LAYOUT_TABLE);
147
+
148
+ storyOptions.template = generateTemplate(
149
+ LEGEND_LAYOUT_TABLE,
150
+ {
151
+ class: HEIGHT_AUTO_CLASSES, // line, area, heatmap etc charts all have these classes on the wrapper element in auto height mode
152
+ style: 'height: 400px; overflow: hidden; outline: 1px solid red;', // Simulate being inside a dashboard panel with fixed height and no overflow
153
+ },
154
+ {
155
+ height: 'auto',
156
+ class: 'gl-flex-grow-1', // line, area, heatmap etc charts all have gl-flex-grow-1 on the <gl-chart> element in auto height mode
157
+ }
158
+ );
159
+
160
+ return storyOptions;
161
+ };
162
+
126
163
  export default {
127
164
  title: 'charts/chart-legend',
128
165
  component: GlChartLegend,
@@ -172,7 +172,7 @@ export default {
172
172
  </script>
173
173
 
174
174
  <template>
175
- <div data-testid="gl-chart-legend">
175
+ <div class="gl-legend" data-testid="gl-chart-legend">
176
176
  <template v-if="layout === $options.legendLayoutTypes.LEGEND_LAYOUT_INLINE">
177
177
  <div class="gl-legend-inline">
178
178
  <div
@@ -65,5 +65,6 @@ export const CHART_TYPE_BAR = 'bar';
65
65
  export const CHART_TYPE_LINE = 'line';
66
66
 
67
67
  // Constants for height "auto"
68
- export const HEIGHT_AUTO_CLASSES = 'gl-display-flex gl-flex-direction-column gl-h-full';
68
+ export const HEIGHT_AUTO_CLASSES =
69
+ 'gl-chart-h-auto gl-display-flex gl-flex-direction-column gl-h-full';
69
70
  export const HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES = 'gl-display-flex gl-h-full';