@gitlab/ui 49.9.0 → 49.10.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 +19 -0
- package/dist/components/base/daterange_picker/daterange_picker.js +11 -1
- package/dist/components/base/form/form_checkbox/form_checkbox_group.js +1 -1
- package/dist/components/base/form/form_radio_group/form_radio_group.js +1 -1
- package/dist/components/base/pagination/pagination.js +3 -3
- package/dist/components/base/popover/popover.js +1 -6
- package/dist/components/charts/area/area.js +1 -1
- package/dist/components/charts/chart/chart.js +1 -1
- package/dist/components/charts/column/column.js +1 -1
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +1 -1
- package/dist/components/charts/line/line.js +1 -1
- package/dist/components/charts/sparkline/sparkline.js +1 -1
- package/dist/components/charts/stacked_column/stacked_column.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/breakpoints.js +2 -3
- package/dist/utils/charts/config.js +8 -9
- package/dist/utils/charts/theme.js +1 -2
- package/dist/utils.js +1 -1
- package/package.json +5 -4
- package/src/components/base/daterange_picker/daterange_picker.scss +0 -7
- package/src/components/base/daterange_picker/daterange_picker.spec.js +12 -2
- package/src/components/base/daterange_picker/daterange_picker.vue +23 -12
- package/src/components/base/form/form_checkbox/form_checkbox_group.vue +1 -1
- package/src/components/base/form/form_radio_group/form_radio_group.vue +1 -1
- package/src/components/base/pagination/pagination.vue +3 -3
- package/src/components/base/popover/popover.vue +0 -6
- package/src/components/base/tabs/tabs/tabs.spec.js +1 -2
- package/src/components/charts/area/area.vue +2 -1
- package/src/components/charts/chart/chart.spec.js +1 -1
- package/src/components/charts/chart/chart.vue +1 -1
- package/src/components/charts/column/column.vue +2 -1
- package/src/components/charts/discrete_scatter/discrete_scatter.vue +2 -1
- package/src/components/charts/line/line.vue +2 -1
- package/src/components/charts/sparkline/sparkline.vue +2 -1
- package/src/components/charts/stacked_column/stacked_column.vue +2 -1
- package/src/scss/utilities.scss +22 -0
- package/src/scss/utility-mixins/flex.scss +6 -0
- package/src/scss/utility-mixins/spacing.scss +6 -0
- package/src/utils/breakpoints.js +1 -3
- package/src/utils/breakpoints.spec.js +4 -4
- package/src/utils/charts/config.js +8 -8
- package/src/utils/charts/config.spec.js +2 -2
- package/src/utils/charts/theme.js +1 -3
- package/src/utils.js +1 -1
|
@@ -5,7 +5,7 @@ const breakpoints = {
|
|
|
5
5
|
sm: 576,
|
|
6
6
|
xs: 0
|
|
7
7
|
};
|
|
8
|
-
const
|
|
8
|
+
const GlBreakpointInstance = {
|
|
9
9
|
windowWidth: () => window.innerWidth,
|
|
10
10
|
getBreakpointSize() {
|
|
11
11
|
const windowWidth = this.windowWidth();
|
|
@@ -17,5 +17,4 @@ const BreakpointInstance = {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export
|
|
21
|
-
export { breakpoints };
|
|
20
|
+
export { GlBreakpointInstance, breakpoints };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import castArray from 'lodash/castArray';
|
|
2
2
|
import isArray from 'lodash/isArray';
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
|
-
import
|
|
4
|
+
import { GlBreakpointInstance } from '../breakpoints';
|
|
5
5
|
import { columnOptions } from '../constants';
|
|
6
6
|
import { areDatesEqual } from '../datetime_utility';
|
|
7
7
|
import { engineeringNotation } from '../number_utils';
|
|
@@ -38,6 +38,11 @@ const grid = {
|
|
|
38
38
|
left: 64,
|
|
39
39
|
right: 32
|
|
40
40
|
};
|
|
41
|
+
const defaultChartOptions = {
|
|
42
|
+
grid,
|
|
43
|
+
xAxis,
|
|
44
|
+
yAxis
|
|
45
|
+
};
|
|
41
46
|
const gridWithSecondaryYAxis = {
|
|
42
47
|
...grid,
|
|
43
48
|
right: 64
|
|
@@ -91,7 +96,7 @@ const getDataZoomConfig = function () {
|
|
|
91
96
|
filterMode = 'none'
|
|
92
97
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
93
98
|
const disabledBreakpoints = ['lg', 'xl'];
|
|
94
|
-
const disabled = disabledBreakpoints.includes(
|
|
99
|
+
const disabled = disabledBreakpoints.includes(GlBreakpointInstance.getBreakpointSize());
|
|
95
100
|
const minSpan = filterMode === 'none' ? 0.01 : null;
|
|
96
101
|
return {
|
|
97
102
|
grid: {
|
|
@@ -530,11 +535,5 @@ const getDefaultTooltipContent = function (params) {
|
|
|
530
535
|
tooltipContent
|
|
531
536
|
};
|
|
532
537
|
};
|
|
533
|
-
var config = {
|
|
534
|
-
grid,
|
|
535
|
-
xAxis,
|
|
536
|
-
yAxis
|
|
537
|
-
};
|
|
538
538
|
|
|
539
|
-
export
|
|
540
|
-
export { annotationsYAxisCoords, axes, dataZoomAdjustments, defaultAreaOpacity, defaultFontSize, defaultHeight, defaultWidth, generateAnnotationSeries, generateBarSeries, generateLineSeries, getAnnotationsConfig, getDataZoomConfig, getDefaultTooltipContent, getThresholdConfig, getToolboxConfig, grid, gridWithSecondaryYAxis, lineStyle, mergeAnnotationAxisToOptions, mergeSeriesToOptions, parseAnnotations, symbolSize, validRenderers, xAxis, yAxis };
|
|
539
|
+
export { annotationsYAxisCoords, axes, dataZoomAdjustments, defaultAreaOpacity, defaultChartOptions, defaultFontSize, defaultHeight, defaultWidth, generateAnnotationSeries, generateBarSeries, generateLineSeries, getAnnotationsConfig, getDataZoomConfig, getDefaultTooltipContent, getThresholdConfig, getToolboxConfig, grid, gridWithSecondaryYAxis, lineStyle, mergeAnnotationAxisToOptions, mergeSeriesToOptions, parseAnnotations, symbolSize, validRenderers, xAxis, yAxis };
|
|
@@ -225,5 +225,4 @@ const createTheme = function () {
|
|
|
225
225
|
};
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
-
export
|
|
229
|
-
export { colorFromDefaultPalette, colorPaletteDefault, gaugeNeutralHues, gaugeSafeHues, gaugeWarningHue, heatmapHues, themeName };
|
|
228
|
+
export { colorFromDefaultPalette, colorPaletteDefault, createTheme, gaugeNeutralHues, gaugeSafeHues, gaugeWarningHue, heatmapHues, themeName };
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { GlBreakpointInstance, breakpoints } from './utils/breakpoints';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "49.
|
|
3
|
+
"version": "49.10.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@popperjs/core": "^2.11.2",
|
|
63
|
-
"bootstrap-vue": "2.
|
|
64
|
-
"dompurify": "^2.4.
|
|
63
|
+
"bootstrap-vue": "2.20.1",
|
|
64
|
+
"dompurify": "^2.4.1",
|
|
65
65
|
"echarts": "^5.3.2",
|
|
66
66
|
"iframe-resizer": "^4.3.2",
|
|
67
67
|
"lodash": "^4.17.20",
|
|
@@ -109,7 +109,8 @@
|
|
|
109
109
|
"babel-plugin-lodash": "^3.3.4",
|
|
110
110
|
"babel-plugin-require-context-hook": "^1.0.0",
|
|
111
111
|
"babel-preset-vue": "^2.0.2",
|
|
112
|
-
"bootstrap": "4.
|
|
112
|
+
"bootstrap": "4.5.3",
|
|
113
|
+
"bootstrap-vue-vue3": "npm:bootstrap-vue@2.23.1",
|
|
113
114
|
"cypress": "^10.11.0",
|
|
114
115
|
"emoji-regex": "^10.0.0",
|
|
115
116
|
"eslint": "8.27.0",
|
|
@@ -5,16 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
label {
|
|
7
7
|
@include gl-font-weight-bold;
|
|
8
|
-
@include gl-mr-2;
|
|
9
|
-
@include gl-ml-2;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
> div:first-of-type label {
|
|
13
|
-
@include gl-ml-0;
|
|
14
8
|
}
|
|
15
9
|
|
|
16
10
|
.gl-datepicker-input {
|
|
17
|
-
@include gl-w-full;
|
|
18
11
|
@include gl-border-gray-100;
|
|
19
12
|
@include gl-text-gray-900;
|
|
20
13
|
}
|
|
@@ -248,7 +248,7 @@ describe('Daterange Picker', () => {
|
|
|
248
248
|
it('does not show default slot or tooltip icon by default', () => {
|
|
249
249
|
factory();
|
|
250
250
|
|
|
251
|
-
expect(findDateRangeIndicator().
|
|
251
|
+
expect(findDateRangeIndicator().exists()).toBe(false);
|
|
252
252
|
expect(findTooltipIcon().exists()).toBe(false);
|
|
253
253
|
});
|
|
254
254
|
|
|
@@ -271,9 +271,19 @@ describe('Daterange Picker', () => {
|
|
|
271
271
|
});
|
|
272
272
|
|
|
273
273
|
it('adds the indicator class when provided', () => {
|
|
274
|
-
factory({ dateRangeIndicatorClass });
|
|
274
|
+
factory({ dateRangeIndicatorClass }, slots);
|
|
275
275
|
|
|
276
276
|
expect(wrapper.find(`.${dateRangeIndicatorClass}`).exists()).toBe(true);
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
|
+
|
|
280
|
+
it.each`
|
|
281
|
+
prop | value | testid
|
|
282
|
+
${'startPickerClass'} | ${'gl-text-blue-500'} | ${'daterange-picker-start-container'}
|
|
283
|
+
${'endPickerClass'} | ${'gl-text-red-500'} | ${'daterange-picker-end-container'}
|
|
284
|
+
`('adds the provided $value class to $testid', ({ prop, value, testid }) => {
|
|
285
|
+
factory({ [prop]: value });
|
|
286
|
+
|
|
287
|
+
expect(wrapper.find(`[data-testid="${testid}"]`).classes()).toContain(value);
|
|
288
|
+
});
|
|
279
289
|
});
|
|
@@ -4,6 +4,14 @@ import { getDayDifference, getDateInPast, getDateInFuture } from '../../../utils
|
|
|
4
4
|
import GlDatepicker from '../datepicker/datepicker.vue';
|
|
5
5
|
import GlIcon from '../icon/icon.vue';
|
|
6
6
|
|
|
7
|
+
const CONTAINER_CLASSES = [
|
|
8
|
+
'gl-display-flex',
|
|
9
|
+
'gl-align-items-baseline',
|
|
10
|
+
'gl-flex-wrap',
|
|
11
|
+
'gl-sm-flex-wrap-nowrap',
|
|
12
|
+
'gl-sm-gap-3',
|
|
13
|
+
];
|
|
14
|
+
|
|
7
15
|
export default {
|
|
8
16
|
components: {
|
|
9
17
|
GlDatepicker,
|
|
@@ -165,6 +173,15 @@ export default {
|
|
|
165
173
|
const numberOfDays = getDayDifference(this.startDate, this.endDate);
|
|
166
174
|
return this.sameDaySelection ? numberOfDays + 1 : numberOfDays;
|
|
167
175
|
},
|
|
176
|
+
startContainerClasses() {
|
|
177
|
+
return [this.startPickerClass, ...CONTAINER_CLASSES];
|
|
178
|
+
},
|
|
179
|
+
endContainerClasses() {
|
|
180
|
+
return [this.endPickerClass, ...CONTAINER_CLASSES];
|
|
181
|
+
},
|
|
182
|
+
showIndicator() {
|
|
183
|
+
return Boolean(this.$scopedSlots.default || this.tooltip);
|
|
184
|
+
},
|
|
168
185
|
},
|
|
169
186
|
watch: {
|
|
170
187
|
value(val) {
|
|
@@ -229,8 +246,8 @@ export default {
|
|
|
229
246
|
</script>
|
|
230
247
|
|
|
231
248
|
<template>
|
|
232
|
-
<div class="gl-daterange-picker">
|
|
233
|
-
<div :class="
|
|
249
|
+
<div class="gl-daterange-picker gl-gap-5 gl-display-flex">
|
|
250
|
+
<div :class="startContainerClasses" data-testid="daterange-picker-start-container">
|
|
234
251
|
<label :class="labelClass">{{ fromLabel }}</label>
|
|
235
252
|
|
|
236
253
|
<gl-datepicker
|
|
@@ -248,7 +265,7 @@ export default {
|
|
|
248
265
|
@close="onStartPickerClose"
|
|
249
266
|
/>
|
|
250
267
|
</div>
|
|
251
|
-
<div :class="
|
|
268
|
+
<div :class="endContainerClasses" data-testid="daterange-picker-end-container">
|
|
252
269
|
<label :class="labelClass">{{ toLabel }}</label>
|
|
253
270
|
<gl-datepicker
|
|
254
271
|
:key="numericStartTime"
|
|
@@ -269,20 +286,14 @@ export default {
|
|
|
269
286
|
/>
|
|
270
287
|
</div>
|
|
271
288
|
<div
|
|
289
|
+
v-if="showIndicator"
|
|
272
290
|
:class="dateRangeIndicatorClass"
|
|
273
291
|
data-testid="daterange-picker-indicator"
|
|
274
|
-
class="gl-display-flex gl-flex-direction-row gl-align-items-center gl-text-gray-500 gl-
|
|
292
|
+
class="gl-display-flex gl-flex-direction-row gl-align-items-center gl-text-gray-500 gl-gap-3"
|
|
275
293
|
>
|
|
276
294
|
<!-- @slot Content to display for days selected. The value is -1 when no date range is selected.-->
|
|
277
295
|
<slot v-bind="{ daysSelected: numberOfDays }"></slot>
|
|
278
|
-
<gl-icon
|
|
279
|
-
v-if="tooltip"
|
|
280
|
-
v-gl-tooltip
|
|
281
|
-
name="information-o"
|
|
282
|
-
:title="tooltip"
|
|
283
|
-
:size="16"
|
|
284
|
-
class="gl-ml-2"
|
|
285
|
-
/>
|
|
296
|
+
<gl-icon v-if="tooltip" v-gl-tooltip name="information-o" :title="tooltip" :size="16" />
|
|
286
297
|
</div>
|
|
287
298
|
</div>
|
|
288
299
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BFormCheckboxGroup } from 'bootstrap-vue';
|
|
3
|
-
import
|
|
3
|
+
import formOptionsMixin from 'bootstrap-vue/src/mixins/form-options';
|
|
4
4
|
import { SafeHtmlDirective as SafeHtml } from '../../../../directives/safe_html/safe_html';
|
|
5
5
|
import GlFormCheckbox from './form_checkbox.vue';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BFormRadioGroup } from 'bootstrap-vue';
|
|
3
|
-
import
|
|
3
|
+
import formOptionsMixin from 'bootstrap-vue/src/mixins/form-options';
|
|
4
4
|
import { SafeHtmlDirective as SafeHtml } from '../../../../directives/safe_html/safe_html';
|
|
5
5
|
import GlFormRadio from '../form_radio/form_radio.vue';
|
|
6
6
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import debounce from 'lodash/debounce';
|
|
4
4
|
import isFunction from 'lodash/isFunction';
|
|
5
5
|
import range from 'lodash/range';
|
|
6
|
-
import
|
|
6
|
+
import { GlBreakpointInstance, breakpoints } from '../../../utils/breakpoints';
|
|
7
7
|
import { alignOptions, resizeDebounceTime } from '../../../utils/constants';
|
|
8
8
|
import GlIcon from '../icon/icon.vue';
|
|
9
9
|
import GlLink from '../link/link.vue';
|
|
@@ -166,7 +166,7 @@ export default {
|
|
|
166
166
|
},
|
|
167
167
|
data() {
|
|
168
168
|
return {
|
|
169
|
-
breakpoint:
|
|
169
|
+
breakpoint: GlBreakpointInstance.getBreakpointSize(),
|
|
170
170
|
// If total pages count is below or equal to minTotalPagesToCollapse, collapsing is disabled
|
|
171
171
|
minTotalPagesToCollapse: 4,
|
|
172
172
|
};
|
|
@@ -287,7 +287,7 @@ export default {
|
|
|
287
287
|
},
|
|
288
288
|
methods: {
|
|
289
289
|
setBreakpoint() {
|
|
290
|
-
this.breakpoint =
|
|
290
|
+
this.breakpoint = GlBreakpointInstance.getBreakpointSize();
|
|
291
291
|
},
|
|
292
292
|
pageIsDisabled(page) {
|
|
293
293
|
return (
|
|
@@ -45,11 +45,6 @@ export default {
|
|
|
45
45
|
required: false,
|
|
46
46
|
default: popoverPlacements.top,
|
|
47
47
|
},
|
|
48
|
-
boundaryPadding: {
|
|
49
|
-
type: [Number, String],
|
|
50
|
-
required: false,
|
|
51
|
-
default: 5,
|
|
52
|
-
},
|
|
53
48
|
},
|
|
54
49
|
computed: {
|
|
55
50
|
customClass() {
|
|
@@ -79,7 +74,6 @@ export default {
|
|
|
79
74
|
:triggers="triggers"
|
|
80
75
|
:title="title"
|
|
81
76
|
:placement="placement"
|
|
82
|
-
:boundary-padding="boundaryPadding"
|
|
83
77
|
v-bind="$attrs"
|
|
84
78
|
v-on="$listeners"
|
|
85
79
|
>
|
|
@@ -341,8 +341,7 @@ describe('tabs component', () => {
|
|
|
341
341
|
await nextTick();
|
|
342
342
|
await nextTick();
|
|
343
343
|
|
|
344
|
-
expect(wrapper.emitted().input
|
|
345
|
-
expect(wrapper.emitted().input[1]).toEqual([1]);
|
|
344
|
+
expect(wrapper.emitted().input.pop()).toEqual([1]);
|
|
346
345
|
});
|
|
347
346
|
});
|
|
348
347
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import * as echarts from 'echarts';
|
|
3
|
-
import createTheme from '~/utils/charts/theme';
|
|
3
|
+
import { createTheme } from '~/utils/charts/theme';
|
|
4
4
|
import { useMockResizeObserver } from '~helpers/mock_dom_observer';
|
|
5
5
|
import Chart from './chart.vue';
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<script>
|
|
3
3
|
import * as echarts from 'echarts';
|
|
4
4
|
import { defaultHeight, defaultWidth, validRenderers } from '../../../utils/charts/config';
|
|
5
|
-
import createTheme,
|
|
5
|
+
import { createTheme, themeName } from '../../../utils/charts/theme';
|
|
6
6
|
import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import merge from 'lodash/merge';
|
|
3
3
|
import { gray200 } from '../../../../scss_to_js/scss_variables'; // eslint-disable-line import/no-unresolved
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
defaultChartOptions,
|
|
5
6
|
dataZoomAdjustments,
|
|
6
7
|
mergeSeriesToOptions,
|
|
7
8
|
} from '../../../utils/charts/config';
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
import merge from 'lodash/merge';
|
|
22
22
|
import { gray200 } from '../../../../scss_to_js/scss_variables'; // eslint-disable-line import/no-unresolved
|
|
23
|
-
import
|
|
23
|
+
import {
|
|
24
|
+
defaultChartOptions,
|
|
24
25
|
grid,
|
|
25
26
|
getThresholdConfig,
|
|
26
27
|
generateAnnotationSeries,
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
<script>
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
4
|
import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
|
|
5
|
-
import
|
|
5
|
+
import {
|
|
6
|
+
defaultChartOptions,
|
|
6
7
|
mergeSeriesToOptions,
|
|
7
8
|
symbolSize,
|
|
8
9
|
} from '../../../utils/charts/config';
|
package/src/scss/utilities.scss
CHANGED
|
@@ -3256,6 +3256,18 @@
|
|
|
3256
3256
|
flex-wrap: nowrap !important;
|
|
3257
3257
|
}
|
|
3258
3258
|
|
|
3259
|
+
.gl-sm-flex-wrap-nowrap {
|
|
3260
|
+
@include gl-media-breakpoint-up(sm) {
|
|
3261
|
+
flex-wrap: nowrap;
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
.gl-sm-flex-wrap-nowrap\! {
|
|
3266
|
+
@include gl-media-breakpoint-up(sm) {
|
|
3267
|
+
flex-wrap: nowrap !important;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3259
3271
|
.gl-flex-nowrap {
|
|
3260
3272
|
flex-wrap: nowrap;
|
|
3261
3273
|
}
|
|
@@ -6312,6 +6324,16 @@
|
|
|
6312
6324
|
.gl-gap-3\! {
|
|
6313
6325
|
gap: $gl-spacing-scale-3 !important;
|
|
6314
6326
|
}
|
|
6327
|
+
.gl-sm-gap-3 {
|
|
6328
|
+
@include gl-media-breakpoint-up(sm) {
|
|
6329
|
+
gap: $gl-spacing-scale-3;
|
|
6330
|
+
}
|
|
6331
|
+
}
|
|
6332
|
+
.gl-sm-gap-3\! {
|
|
6333
|
+
@include gl-media-breakpoint-up(sm) {
|
|
6334
|
+
gap: $gl-spacing-scale-3 !important;
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6315
6337
|
.gl-gap-5 {
|
|
6316
6338
|
gap: $gl-spacing-scale-5;
|
|
6317
6339
|
}
|
|
@@ -122,6 +122,12 @@
|
|
|
122
122
|
flex-wrap: nowrap;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
@mixin gl-sm-flex-wrap-nowrap {
|
|
126
|
+
@include gl-media-breakpoint-up(sm) {
|
|
127
|
+
@include gl-flex-wrap-nowrap;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
125
131
|
/**
|
|
126
132
|
* `gl-flex-nowrap` is deprecated; use `gl-flex-wrap-nowrap` instead.
|
|
127
133
|
* TODO: delete `gl-flex-wrap-nowrap` utility class, see
|
package/src/utils/breakpoints.js
CHANGED
|
@@ -6,7 +6,7 @@ export const breakpoints = {
|
|
|
6
6
|
xs: 0,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
export const GlBreakpointInstance = {
|
|
10
10
|
windowWidth: () => window.innerWidth,
|
|
11
11
|
getBreakpointSize() {
|
|
12
12
|
const windowWidth = this.windowWidth();
|
|
@@ -19,5 +19,3 @@ const BreakpointInstance = {
|
|
|
19
19
|
return ['xl', 'lg'].includes(this.getBreakpointSize());
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
export default BreakpointInstance;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GlBreakpointInstance } from './breakpoints';
|
|
2
2
|
|
|
3
3
|
describe('breakpoints', () => {
|
|
4
4
|
describe.each`
|
|
@@ -10,16 +10,16 @@ describe('breakpoints', () => {
|
|
|
10
10
|
${'xs'} | ${0} | ${false}
|
|
11
11
|
`('$key', ({ size, key, expectedDesktop }) => {
|
|
12
12
|
beforeEach(() => {
|
|
13
|
-
jest.spyOn(
|
|
13
|
+
jest.spyOn(GlBreakpointInstance, 'windowWidth').mockImplementationOnce(() => size + 10);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
it(`returns ${key} when larger than ${size}`, () => {
|
|
17
|
-
expect(
|
|
17
|
+
expect(GlBreakpointInstance.getBreakpointSize()).toBe(key);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
describe('isDesktop', () => {
|
|
21
21
|
it(`returns ${expectedDesktop} when screen size is ${size}`, () => {
|
|
22
|
-
expect(
|
|
22
|
+
expect(GlBreakpointInstance.isDesktop()).toBe(expectedDesktop);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
});
|
|
@@ -2,7 +2,7 @@ import castArray from 'lodash/castArray';
|
|
|
2
2
|
import isArray from 'lodash/isArray';
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
4
|
import { blue500 } from '../../../scss_to_js/scss_variables'; // eslint-disable-line import/no-unresolved
|
|
5
|
-
import
|
|
5
|
+
import { GlBreakpointInstance } from '../breakpoints';
|
|
6
6
|
import { columnOptions } from '../constants';
|
|
7
7
|
import { areDatesEqual } from '../datetime_utility';
|
|
8
8
|
import { engineeringNotation } from '../number_utils';
|
|
@@ -42,6 +42,12 @@ export const grid = {
|
|
|
42
42
|
right: 32,
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
export const defaultChartOptions = {
|
|
46
|
+
grid,
|
|
47
|
+
xAxis,
|
|
48
|
+
yAxis,
|
|
49
|
+
};
|
|
50
|
+
|
|
45
51
|
export const gridWithSecondaryYAxis = {
|
|
46
52
|
...grid,
|
|
47
53
|
right: 64,
|
|
@@ -93,7 +99,7 @@ const LESS_THAN = ['<', '<'];
|
|
|
93
99
|
*/
|
|
94
100
|
export const getDataZoomConfig = ({ filterMode = 'none' } = {}) => {
|
|
95
101
|
const disabledBreakpoints = ['lg', 'xl'];
|
|
96
|
-
const disabled = disabledBreakpoints.includes(
|
|
102
|
+
const disabled = disabledBreakpoints.includes(GlBreakpointInstance.getBreakpointSize());
|
|
97
103
|
const minSpan = filterMode === 'none' ? 0.01 : null;
|
|
98
104
|
|
|
99
105
|
return {
|
|
@@ -499,9 +505,3 @@ export const getDefaultTooltipContent = (params, yAxisTitle = null) => {
|
|
|
499
505
|
|
|
500
506
|
return { xLabels, tooltipContent };
|
|
501
507
|
};
|
|
502
|
-
|
|
503
|
-
export default {
|
|
504
|
-
grid,
|
|
505
|
-
xAxis,
|
|
506
|
-
yAxis,
|
|
507
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import merge from 'lodash/merge';
|
|
2
|
-
import
|
|
2
|
+
import { GlBreakpointInstance } from '../breakpoints';
|
|
3
3
|
import { columnOptions } from '../constants';
|
|
4
4
|
import { hexToRgba } from '../utils';
|
|
5
5
|
import {
|
|
@@ -197,7 +197,7 @@ describe('chart config helpers', () => {
|
|
|
197
197
|
|
|
198
198
|
describe('on small viewports', () => {
|
|
199
199
|
it('creates a basic dataZoomConfig with inside scrolling being enabled', () => {
|
|
200
|
-
jest.spyOn(
|
|
200
|
+
jest.spyOn(GlBreakpointInstance, 'getBreakpointSize').mockImplementationOnce(() => 'sm');
|
|
201
201
|
const actual = getDataZoomConfig();
|
|
202
202
|
const dataZoomWithInsideEnabled = [
|
|
203
203
|
{
|
|
@@ -147,7 +147,7 @@ const isLineChartWithoutArea = (options) =>
|
|
|
147
147
|
Array.isArray(options?.series) &&
|
|
148
148
|
options.series.some((series) => series.type === 'line' && !series.areaStyle);
|
|
149
149
|
|
|
150
|
-
const createTheme = (options = {}) => ({
|
|
150
|
+
export const createTheme = (options = {}) => ({
|
|
151
151
|
color: colorPaletteDefault,
|
|
152
152
|
backgroundColor: 'transparent',
|
|
153
153
|
textStyle: {
|
|
@@ -268,5 +268,3 @@ const createTheme = (options = {}) => ({
|
|
|
268
268
|
logAxis: axes,
|
|
269
269
|
timeAxis: axes,
|
|
270
270
|
});
|
|
271
|
-
|
|
272
|
-
export default createTheme;
|
package/src/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { GlBreakpointInstance, breakpoints } from './utils/breakpoints';
|