@gitlab/ui 56.1.2 → 56.2.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 +7 -0
- package/dist/components/charts/single_stat/single_stat.js +9 -1
- package/package.json +1 -1
- package/src/components/charts/single_stat/single_stat.spec.js +22 -0
- package/src/components/charts/single_stat/single_stat.stories.js +3 -0
- package/src/components/charts/single_stat/single_stat.vue +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [56.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v56.1.2...v56.2.0) (2023-02-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlSingleStat:** add titleIconClass prop ([df18efb](https://gitlab.com/gitlab-org/gitlab-ui/commit/df18efb2e22bb2bcb03edd1e8442e3eb1fcdca76))
|
|
7
|
+
|
|
1
8
|
## [56.1.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v56.1.1...v56.1.2) (2023-02-23)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -35,6 +35,14 @@ var script = {
|
|
|
35
35
|
required: false,
|
|
36
36
|
default: null
|
|
37
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Additional CSS class(es) to be applied to the title icon.
|
|
40
|
+
*/
|
|
41
|
+
titleIconClass: {
|
|
42
|
+
type: [Array, Object, String],
|
|
43
|
+
required: false,
|
|
44
|
+
default: ''
|
|
45
|
+
},
|
|
38
46
|
metaIcon: {
|
|
39
47
|
type: String,
|
|
40
48
|
required: false,
|
|
@@ -89,7 +97,7 @@ var script = {
|
|
|
89
97
|
const __vue_script__ = script;
|
|
90
98
|
|
|
91
99
|
/* template */
|
|
92
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._g(_vm._b({staticClass:"gl-single-stat gl-display-flex gl-flex-direction-column gl-p-2"},'div',_vm.$attrs,false),_vm.$listeners),[_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-text-gray-700 gl-mb-2"},[(_vm.showTitleIcon)?_c('gl-icon',{
|
|
100
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._g(_vm._b({staticClass:"gl-single-stat gl-display-flex gl-flex-direction-column gl-p-2"},'div',_vm.$attrs,false),_vm.$listeners),[_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-text-gray-700 gl-mb-2"},[(_vm.showTitleIcon)?_c('gl-icon',{class:['gl-mr-2', _vm.titleIconClass],attrs:{"name":_vm.titleIcon,"data-testid":"title-icon"}}):_vm._e(),_vm._v(" "),_c('span',{staticClass:"gl-font-base gl-font-weight-normal",attrs:{"data-testid":"title-text"}},[_vm._v(_vm._s(_vm.title))])],1),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-baseline gl-font-weight-bold gl-text-gray-900"},[_c('span',{staticClass:"gl-font-size-h-display",class:{ 'gl-mr-2': !_vm.unit },attrs:{"data-testid":"displayValue"}},[(_vm.canAnimate)?_c('gl-animated-number',{attrs:{"number":Number(_vm.value),"decimal-places":_vm.animationDecimalPlaces},on:{"animating":function($event){return _vm.setHideUnits(true)},"animated":function($event){return _vm.setHideUnits(false)}}}):_c('span',{attrs:{"data-testid":"non-animated-value"}},[_vm._v(_vm._s(_vm.value))])],1),_vm._v(" "),(_vm.unit)?_c('span',{staticClass:"gl-font-sm gl-mx-2 gl-transition-medium gl-opacity-10",class:{ 'gl-opacity-0!': _vm.hideUnits },attrs:{"data-testid":"unit"}},[_vm._v(_vm._s(_vm.unit))]):_vm._e(),_vm._v(" "),(_vm.showMetaIcon)?_c('gl-icon',{class:_vm.textColor,attrs:{"name":_vm.metaIcon,"data-testid":"meta-icon"}}):_vm._e(),_vm._v(" "),(_vm.showBadge)?_c('gl-badge',{attrs:{"variant":_vm.variant,"icon":_vm.metaIcon,"data-testid":"meta-badge"}},[_vm._v(_vm._s(_vm.metaText))]):_vm._e()],1)])};
|
|
93
101
|
var __vue_staticRenderFns__ = [];
|
|
94
102
|
|
|
95
103
|
/* style */
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ const title = 'Singe stat title';
|
|
|
7
7
|
const value = '100';
|
|
8
8
|
const unit = '%';
|
|
9
9
|
const titleIcon = 'hourglass';
|
|
10
|
+
const titleIconClass = 'title-icon-class';
|
|
10
11
|
const metaIcon = 'heart';
|
|
11
12
|
const metaText = 'Success';
|
|
12
13
|
const variant = 'info';
|
|
@@ -145,5 +146,26 @@ describe('GlSingleStat', () => {
|
|
|
145
146
|
expect(el.exists()).toBe(true);
|
|
146
147
|
});
|
|
147
148
|
});
|
|
149
|
+
|
|
150
|
+
describe('`titleIconClass` Prop', () => {
|
|
151
|
+
it.each`
|
|
152
|
+
classes
|
|
153
|
+
${titleIconClass}
|
|
154
|
+
${[titleIconClass]}
|
|
155
|
+
${{ [titleIconClass]: true }}
|
|
156
|
+
`(
|
|
157
|
+
'correctly adds classes to title icon when `titleIconClass` prop is $classes',
|
|
158
|
+
({ classes }) => {
|
|
159
|
+
createWrapper({
|
|
160
|
+
titleIcon,
|
|
161
|
+
titleIconClass: classes,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
expect(findIemByTestId('title-icon').classes()).toEqual(
|
|
165
|
+
expect.arrayContaining(['title-icon-class'])
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
});
|
|
148
170
|
});
|
|
149
171
|
});
|
|
@@ -13,6 +13,7 @@ const generateProps = ({
|
|
|
13
13
|
titleIcon = null,
|
|
14
14
|
shouldAnimate = false,
|
|
15
15
|
animationDecimalPlaces = 0,
|
|
16
|
+
titleIconClass = '',
|
|
16
17
|
} = {}) => ({
|
|
17
18
|
variant,
|
|
18
19
|
title,
|
|
@@ -23,6 +24,7 @@ const generateProps = ({
|
|
|
23
24
|
titleIcon,
|
|
24
25
|
shouldAnimate,
|
|
25
26
|
animationDecimalPlaces,
|
|
27
|
+
titleIconClass,
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
const metaText = 'Super fast';
|
|
@@ -45,6 +47,7 @@ const Template = (args, { argTypes }) => ({
|
|
|
45
47
|
:title-icon="titleIcon"
|
|
46
48
|
:should-animate="shouldAnimate"
|
|
47
49
|
:animation-decimal-places="animationDecimalPlaces"
|
|
50
|
+
:title-icon-class="titleIconClass"
|
|
48
51
|
/>`,
|
|
49
52
|
});
|
|
50
53
|
|
|
@@ -35,6 +35,14 @@ export default {
|
|
|
35
35
|
required: false,
|
|
36
36
|
default: null,
|
|
37
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Additional CSS class(es) to be applied to the title icon.
|
|
40
|
+
*/
|
|
41
|
+
titleIconClass: {
|
|
42
|
+
type: [Array, Object, String],
|
|
43
|
+
required: false,
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
38
46
|
metaIcon: {
|
|
39
47
|
type: String,
|
|
40
48
|
required: false,
|
|
@@ -93,7 +101,12 @@ export default {
|
|
|
93
101
|
v-on="$listeners"
|
|
94
102
|
>
|
|
95
103
|
<div class="gl-display-flex gl-align-items-center gl-text-gray-700 gl-mb-2">
|
|
96
|
-
<gl-icon
|
|
104
|
+
<gl-icon
|
|
105
|
+
v-if="showTitleIcon"
|
|
106
|
+
:name="titleIcon"
|
|
107
|
+
:class="['gl-mr-2', titleIconClass]"
|
|
108
|
+
data-testid="title-icon"
|
|
109
|
+
/>
|
|
97
110
|
<span class="gl-font-base gl-font-weight-normal" data-testid="title-text">{{ title }}</span>
|
|
98
111
|
</div>
|
|
99
112
|
<div class="gl-display-flex gl-align-items-baseline gl-font-weight-bold gl-text-gray-900">
|