@gitlab/ui 65.4.0 → 66.0.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.
- package/CHANGELOG.md +20 -0
- package/dist/components/base/toggle/toggle.js +17 -38
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +0 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/constants.js +0 -1
- package/package.json +21 -22
- package/src/components/base/toggle/toggle.scss +6 -35
- package/src/components/base/toggle/toggle.spec.js +26 -38
- package/src/components/base/toggle/toggle.stories.js +0 -6
- package/src/components/base/toggle/toggle.vue +55 -76
- package/src/index.js +0 -1
- package/src/scss/components.scss +0 -1
- package/src/scss/utilities.scss +0 -8
- package/src/scss/utility-mixins/flex.scss +0 -4
- package/src/utils/constants.js +0 -1
- package/dist/components/base/skeleton_loading/skeleton_loading.js +0 -61
- package/src/components/base/skeleton_loading/skeleton_loading.md +0 -10
- package/src/components/base/skeleton_loading/skeleton_loading.scss +0 -66
- package/src/components/base/skeleton_loading/skeleton_loading.spec.js +0 -58
- package/src/components/base/skeleton_loading/skeleton_loading.stories.js +0 -41
- package/src/components/base/skeleton_loading/skeleton_loading.vue +0 -29
package/dist/utils/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "66.0.1",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -81,7 +81,8 @@
|
|
|
81
81
|
},
|
|
82
82
|
"resolutions": {
|
|
83
83
|
"chokidar": "^3.5.2",
|
|
84
|
-
"sane": "^5.0.1"
|
|
84
|
+
"sane": "^5.0.1",
|
|
85
|
+
"jackspeak": "2.1.1"
|
|
85
86
|
},
|
|
86
87
|
"devDependencies": {
|
|
87
88
|
"@arkweid/lefthook": "0.7.7",
|
|
@@ -90,23 +91,23 @@
|
|
|
90
91
|
"@babel/preset-react": "^7.22.5",
|
|
91
92
|
"@gitlab/eslint-plugin": "19.0.0",
|
|
92
93
|
"@gitlab/fonts": "^1.2.0",
|
|
93
|
-
"@gitlab/stylelint-config": "
|
|
94
|
+
"@gitlab/stylelint-config": "5.0.0",
|
|
94
95
|
"@gitlab/svgs": "3.59.0",
|
|
95
96
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
96
97
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
97
98
|
"@rollup/plugin-replace": "^2.3.2",
|
|
98
|
-
"@storybook/addon-a11y": "7.
|
|
99
|
-
"@storybook/addon-docs": "7.
|
|
100
|
-
"@storybook/addon-essentials": "7.
|
|
101
|
-
"@storybook/addon-storyshots": "7.
|
|
102
|
-
"@storybook/addon-storyshots-puppeteer": "7.
|
|
103
|
-
"@storybook/addon-viewport": "7.
|
|
104
|
-
"@storybook/builder-webpack5": "7.
|
|
105
|
-
"@storybook/theming": "7.
|
|
106
|
-
"@storybook/vue": "7.
|
|
107
|
-
"@storybook/vue-webpack5": "7.
|
|
108
|
-
"@storybook/vue3": "7.
|
|
109
|
-
"@storybook/vue3-webpack5": "7.
|
|
99
|
+
"@storybook/addon-a11y": "7.3.2",
|
|
100
|
+
"@storybook/addon-docs": "7.3.2",
|
|
101
|
+
"@storybook/addon-essentials": "7.3.2",
|
|
102
|
+
"@storybook/addon-storyshots": "7.3.2",
|
|
103
|
+
"@storybook/addon-storyshots-puppeteer": "7.3.2",
|
|
104
|
+
"@storybook/addon-viewport": "7.3.2",
|
|
105
|
+
"@storybook/builder-webpack5": "7.3.2",
|
|
106
|
+
"@storybook/theming": "7.3.2",
|
|
107
|
+
"@storybook/vue": "7.3.2",
|
|
108
|
+
"@storybook/vue-webpack5": "7.3.2",
|
|
109
|
+
"@storybook/vue3": "7.3.2",
|
|
110
|
+
"@storybook/vue3-webpack5": "7.3.2",
|
|
110
111
|
"@vue/compat": "^3.2.40",
|
|
111
112
|
"@vue/compiler-sfc": "^3.2.40",
|
|
112
113
|
"@vue/test-utils": "1.3.0",
|
|
@@ -124,7 +125,7 @@
|
|
|
124
125
|
"eslint": "8.47.0",
|
|
125
126
|
"eslint-import-resolver-jest": "3.0.2",
|
|
126
127
|
"eslint-plugin-cypress": "2.14.0",
|
|
127
|
-
"eslint-plugin-storybook": "0.6.
|
|
128
|
+
"eslint-plugin-storybook": "0.6.13",
|
|
128
129
|
"glob": "^7.2.0",
|
|
129
130
|
"identity-obj-proxy": "^3.0.0",
|
|
130
131
|
"inquirer-select-directory": "^1.2.0",
|
|
@@ -137,7 +138,7 @@
|
|
|
137
138
|
"npm-run-all": "^4.1.5",
|
|
138
139
|
"pikaday": "^1.8.0",
|
|
139
140
|
"plop": "^2.5.4",
|
|
140
|
-
"postcss": "8.4.
|
|
141
|
+
"postcss": "8.4.28",
|
|
141
142
|
"postcss-loader": "^7.0.2",
|
|
142
143
|
"postcss-scss": "4.0.4",
|
|
143
144
|
"prettier": "2.6.2",
|
|
@@ -155,12 +156,10 @@
|
|
|
155
156
|
"sass-loader": "^10.2.0",
|
|
156
157
|
"sass-true": "^6.1.0",
|
|
157
158
|
"start-server-and-test": "^1.10.6",
|
|
158
|
-
"storybook": "7.
|
|
159
|
-
"storybook-dark-mode": "3.0.
|
|
159
|
+
"storybook": "7.3.2",
|
|
160
|
+
"storybook-dark-mode": "3.0.1",
|
|
160
161
|
"style-dictionary": "^3.8.0",
|
|
161
|
-
"stylelint": "
|
|
162
|
-
"stylelint-config-prettier": "^9.0.5",
|
|
163
|
-
"stylelint-prettier": "3.0.0",
|
|
162
|
+
"stylelint": "15.10.2",
|
|
164
163
|
"vue": "2.7.14",
|
|
165
164
|
"vue-loader": "^15.8.3",
|
|
166
165
|
"vue-loader-vue3": "npm:vue-loader@17",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
.gl-toggle {
|
|
30
30
|
@include gl-cursor-not-allowed;
|
|
31
31
|
@include gl-bg-gray-200;
|
|
32
|
-
}
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
.toggle-icon > svg {
|
|
34
|
+
@include gl-fill-gray-200;
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.gl-toggle.is-checked {
|
|
39
39
|
@include gl-bg-blue-200;
|
|
40
|
-
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
.toggle-icon > svg {
|
|
42
|
+
@include gl-fill-blue-200;
|
|
43
|
+
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.gl-toggle-label,
|
|
@@ -50,35 +50,6 @@
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.gl-toggle-label-container {
|
|
54
|
-
@include gl-flex-shrink-0;
|
|
55
|
-
@include gl-display-flex;
|
|
56
|
-
@include gl-flex-direction-column;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.gl-toggle-switch-container {
|
|
60
|
-
@include gl-display-flex;
|
|
61
|
-
@include gl-flex-direction-column;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.gl-toggle-label-position-block {
|
|
65
|
-
@include gl-justify-content-space-between;
|
|
66
|
-
@include gl-align-items-center;
|
|
67
|
-
@include gl-w-full;
|
|
68
|
-
@include gl-gap-3;
|
|
69
|
-
|
|
70
|
-
.gl-toggle-label-container {
|
|
71
|
-
@include gl-gap-2;
|
|
72
|
-
@include gl-flex-shrink-1;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.gl-toggle-switch-container {
|
|
76
|
-
@include gl-align-items-flex-end;
|
|
77
|
-
@include gl-gap-2;
|
|
78
|
-
@include gl-flex-shrink-1;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
53
|
.gl-help-label {
|
|
83
54
|
@include gl-mt-3;
|
|
84
55
|
@include gl-text-gray-500;
|
|
@@ -138,43 +138,31 @@ describe('toggle', () => {
|
|
|
138
138
|
|
|
139
139
|
describe('label position', () => {
|
|
140
140
|
describe.each`
|
|
141
|
-
state | labelPosition | hasGlSrOnlyClass | flexDirection
|
|
142
|
-
${'top'} | ${toggleLabelPosition.top} | ${false} | ${'gl-flex-direction-column'}
|
|
143
|
-
${'left'} | ${toggleLabelPosition.left} | ${false} | ${'gl-toggle-label-inline'}
|
|
144
|
-
${'hidden'} | ${toggleLabelPosition.hidden} | ${true} | ${'gl-flex-direction-column'}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
expect(findButton().attributes('aria-labelledby')).toBeDefined();
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it(`${showsHelpText ? 'shows' : 'does not show'} the help text`, () => {
|
|
171
|
-
expect(findHelpElement().exists()).toBe(showsHelpText);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it(`${showsDescription ? 'shows' : 'does not show'} the description`, () => {
|
|
175
|
-
expect(findDescriptionElement().exists()).toBe(showsDescription);
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
);
|
|
141
|
+
state | labelPosition | hasGlSrOnlyClass | flexDirection
|
|
142
|
+
${'top'} | ${toggleLabelPosition.top} | ${false} | ${'gl-flex-direction-column'}
|
|
143
|
+
${'left'} | ${toggleLabelPosition.left} | ${false} | ${'gl-toggle-label-inline'}
|
|
144
|
+
${'hidden'} | ${toggleLabelPosition.hidden} | ${true} | ${'gl-flex-direction-column'}
|
|
145
|
+
`('when $state', ({ labelPosition, hasGlSrOnlyClass, flexDirection }) => {
|
|
146
|
+
beforeEach(() => {
|
|
147
|
+
createWrapper({ labelPosition });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it(`${flexDirection} class is added to the label`, () => {
|
|
151
|
+
const cssClasses = wrapper.find('[data-testid="toggle-wrapper"]').classes();
|
|
152
|
+
|
|
153
|
+
return expect(cssClasses).toContain(flexDirection);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it(`${hasGlSrOnlyClass ? 'adds' : 'does not add'} 'gl-sr-only' class to the label`, () => {
|
|
157
|
+
const cssClasses = wrapper.find('[data-testid="toggle-label"]').classes();
|
|
158
|
+
return hasGlSrOnlyClass
|
|
159
|
+
? expect(cssClasses).toContain('gl-sr-only')
|
|
160
|
+
: expect(cssClasses).not.toContain('gl-sr-only');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('has accessible name for the button', () => {
|
|
164
|
+
expect(findButton().attributes('aria-labelledby')).toBeDefined();
|
|
165
|
+
});
|
|
166
|
+
});
|
|
179
167
|
});
|
|
180
168
|
});
|
|
@@ -67,12 +67,6 @@ LabelPositionLeft.args = generateProps({
|
|
|
67
67
|
labelPosition: 'left',
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
export const LabelPositionBlock = Template.bind({});
|
|
71
|
-
LabelPositionBlock.args = generateProps({
|
|
72
|
-
labelPosition: 'block',
|
|
73
|
-
description: withDescription,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
70
|
export default {
|
|
77
71
|
title: 'base/toggle',
|
|
78
72
|
component: GlToggle,
|
|
@@ -90,42 +90,19 @@ export default {
|
|
|
90
90
|
};
|
|
91
91
|
},
|
|
92
92
|
computed: {
|
|
93
|
-
layoutAllowsDescription() {
|
|
94
|
-
return this.isVerticalLayout || this.isBlockLayout;
|
|
95
|
-
},
|
|
96
93
|
shouldRenderDescription() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
-
},
|
|
101
|
-
labelIsSrOnly() {
|
|
102
|
-
return this.labelPosition === 'hidden';
|
|
103
|
-
},
|
|
104
|
-
layoutAllowsHelp() {
|
|
105
|
-
return this.isVerticalLayout || this.isBlockLayout;
|
|
94
|
+
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
95
|
+
return Boolean(this.$scopedSlots.description || this.description) && this.isVerticalLayout;
|
|
106
96
|
},
|
|
107
97
|
shouldRenderHelp() {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (this.labelIsSrOnly) return 'gl-sr-only';
|
|
117
|
-
return {
|
|
118
|
-
'gl-mb-2': this.shouldRenderDescription,
|
|
119
|
-
'gl-mb-3': !this.shouldRenderDescription && !this.isVerticalLayout,
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
wrapperClasses() {
|
|
123
|
-
return {
|
|
124
|
-
'gl-flex-direction-column': this.isVerticalLayout,
|
|
125
|
-
'gl-toggle-label-inline': !this.isVerticalLayout,
|
|
126
|
-
'is-disabled': this.disabled,
|
|
127
|
-
'gl-toggle-label-position-block': this.isBlockLayout,
|
|
128
|
-
};
|
|
98
|
+
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
99
|
+
return Boolean(this.$slots.help || this.help) && this.isVerticalLayout;
|
|
100
|
+
},
|
|
101
|
+
toggleClasses() {
|
|
102
|
+
return [
|
|
103
|
+
{ 'gl-sr-only': this.labelPosition === 'hidden' },
|
|
104
|
+
this.shouldRenderDescription ? 'gl-mb-2' : 'gl-mb-3',
|
|
105
|
+
];
|
|
129
106
|
},
|
|
130
107
|
icon() {
|
|
131
108
|
return this.value ? 'mobile-issue-close' : 'close';
|
|
@@ -139,9 +116,6 @@ export default {
|
|
|
139
116
|
isVerticalLayout() {
|
|
140
117
|
return this.labelPosition === 'top' || this.labelPosition === 'hidden';
|
|
141
118
|
},
|
|
142
|
-
isBlockLayout() {
|
|
143
|
-
return this.labelPosition === 'block';
|
|
144
|
-
},
|
|
145
119
|
},
|
|
146
120
|
|
|
147
121
|
beforeCreate() {
|
|
@@ -167,50 +141,55 @@ export default {
|
|
|
167
141
|
|
|
168
142
|
<template>
|
|
169
143
|
<div
|
|
170
|
-
class="gl-toggle-wrapper gl-display-flex gl-mb-0
|
|
171
|
-
:class="
|
|
144
|
+
class="gl-toggle-wrapper gl-display-flex gl-mb-0"
|
|
145
|
+
:class="{
|
|
146
|
+
'gl-flex-direction-column': isVerticalLayout,
|
|
147
|
+
'gl-toggle-label-inline': !isVerticalLayout,
|
|
148
|
+
'is-disabled': disabled,
|
|
149
|
+
}"
|
|
172
150
|
data-testid="toggle-wrapper"
|
|
173
151
|
>
|
|
174
|
-
<span
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
152
|
+
<span
|
|
153
|
+
:id="labelId"
|
|
154
|
+
:class="toggleClasses"
|
|
155
|
+
class="gl-toggle-label gl-flex-shrink-0"
|
|
156
|
+
data-testid="toggle-label"
|
|
157
|
+
>
|
|
158
|
+
<!-- @slot The toggle's label. -->
|
|
159
|
+
<slot name="label">{{ label }}</slot>
|
|
160
|
+
</span>
|
|
161
|
+
<span
|
|
162
|
+
v-if="shouldRenderDescription"
|
|
163
|
+
class="gl-description-label gl-mb-3"
|
|
164
|
+
data-testid="toggle-description"
|
|
165
|
+
>
|
|
166
|
+
<!-- @slot A description text to be shown below the label. -->
|
|
167
|
+
<slot name="description">{{ description }}</slot>
|
|
187
168
|
</span>
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
<
|
|
207
|
-
<gl-icon :name="icon" :size="16" />
|
|
208
|
-
</span>
|
|
209
|
-
</button>
|
|
210
|
-
<span v-if="shouldRenderHelp" :id="helpId" class="gl-help-label" data-testid="toggle-help">
|
|
211
|
-
<!-- @slot A help text to be shown below the toggle. -->
|
|
212
|
-
<slot name="help">{{ help }}</slot>
|
|
169
|
+
<input v-if="name" :name="name" :value="value" type="hidden" />
|
|
170
|
+
<button
|
|
171
|
+
role="switch"
|
|
172
|
+
:aria-checked="isChecked"
|
|
173
|
+
:aria-labelledby="labelId"
|
|
174
|
+
:aria-describedby="helpId"
|
|
175
|
+
:aria-disabled="disabled"
|
|
176
|
+
:class="{
|
|
177
|
+
'gl-toggle': true,
|
|
178
|
+
'is-checked': value,
|
|
179
|
+
'is-disabled': disabled,
|
|
180
|
+
}"
|
|
181
|
+
class="gl-flex-shrink-0"
|
|
182
|
+
type="button"
|
|
183
|
+
@click.prevent="toggleFeature"
|
|
184
|
+
>
|
|
185
|
+
<gl-loading-icon v-if="isLoading" color="light" class="toggle-loading" />
|
|
186
|
+
<span v-else :class="{ 'toggle-icon': true, disabled: disabled }">
|
|
187
|
+
<gl-icon :name="icon" :size="16" />
|
|
213
188
|
</span>
|
|
189
|
+
</button>
|
|
190
|
+
<span v-if="shouldRenderHelp" :id="helpId" class="gl-help-label" data-testid="toggle-help">
|
|
191
|
+
<!-- @slot A help text to be shown below the toggle. -->
|
|
192
|
+
<slot name="help">{{ help }}</slot>
|
|
214
193
|
</span>
|
|
215
194
|
</div>
|
|
216
195
|
</template>
|
package/src/index.js
CHANGED
|
@@ -28,7 +28,6 @@ export { default as GlPaginatedList } from './components/base/paginated_list/pag
|
|
|
28
28
|
export { default as GlPopover } from './components/base/popover/popover.vue';
|
|
29
29
|
export { default as GlProgressBar } from './components/base/progress_bar/progress_bar.vue';
|
|
30
30
|
export { default as GlToken } from './components/base/token/token.vue';
|
|
31
|
-
export { default as GlDeprecatedSkeletonLoading } from './components/base/skeleton_loading/skeleton_loading.vue';
|
|
32
31
|
export { default as GlBadge } from './components/base/badge/badge.vue';
|
|
33
32
|
export { default as GlBanner } from './components/base/banner/banner.vue';
|
|
34
33
|
export { default as GlButton } from './components/base/button/button.vue';
|
package/src/scss/components.scss
CHANGED
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
@import '../components/base/search_box_by_click/search_box_by_click';
|
|
62
62
|
@import '../components/base/segmented_control/segmented_control';
|
|
63
63
|
@import '../components/base/skeleton_loader/skeleton_loader';
|
|
64
|
-
@import '../components/base/skeleton_loading/skeleton_loading';
|
|
65
64
|
@import '../components/base/tabs/tabs/tabs';
|
|
66
65
|
@import '../components/base/toast/toast';
|
|
67
66
|
@import '../components/base/table/table';
|
package/src/scss/utilities.scss
CHANGED
package/src/utils/constants.js
CHANGED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
2
|
-
|
|
3
|
-
var script = {
|
|
4
|
-
name: 'GlSkeletonLoading',
|
|
5
|
-
props: {
|
|
6
|
-
/**
|
|
7
|
-
* Controls the number of lines.
|
|
8
|
-
*/
|
|
9
|
-
lines: {
|
|
10
|
-
type: Number,
|
|
11
|
-
required: false,
|
|
12
|
-
default: 3,
|
|
13
|
-
validator(value) {
|
|
14
|
-
return value > 0 && value < 4;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
computed: {
|
|
19
|
-
lineClasses() {
|
|
20
|
-
return new Array(this.lines).fill().map((_, i) => `skeleton-line-${i + 1}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/* script */
|
|
26
|
-
const __vue_script__ = script;
|
|
27
|
-
|
|
28
|
-
/* template */
|
|
29
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"animation-container"},_vm._l((_vm.lineClasses),function(css,index){return _c('div',{key:index,class:css})}),0)};
|
|
30
|
-
var __vue_staticRenderFns__ = [];
|
|
31
|
-
|
|
32
|
-
/* style */
|
|
33
|
-
const __vue_inject_styles__ = undefined;
|
|
34
|
-
/* scoped */
|
|
35
|
-
const __vue_scope_id__ = undefined;
|
|
36
|
-
/* module identifier */
|
|
37
|
-
const __vue_module_identifier__ = undefined;
|
|
38
|
-
/* functional template */
|
|
39
|
-
const __vue_is_functional_template__ = false;
|
|
40
|
-
/* style inject */
|
|
41
|
-
|
|
42
|
-
/* style inject SSR */
|
|
43
|
-
|
|
44
|
-
/* style inject shadow dom */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const __vue_component__ = __vue_normalize__(
|
|
49
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
50
|
-
__vue_inject_styles__,
|
|
51
|
-
__vue_script__,
|
|
52
|
-
__vue_scope_id__,
|
|
53
|
-
__vue_is_functional_template__,
|
|
54
|
-
__vue_module_identifier__,
|
|
55
|
-
false,
|
|
56
|
-
undefined,
|
|
57
|
-
undefined,
|
|
58
|
-
undefined
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
export default __vue_component__;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
The Skeleton Loading component has been deprecated, please use [Skeleton Loader](https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-skeleton-loader--default).
|
|
2
|
-
|
|
3
|
-
How to replace this component with [Skeleton Loader](https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-skeleton-loader--default):
|
|
4
|
-
|
|
5
|
-
1. Update imports
|
|
6
|
-
- `import { GlSkeletonLoading } from '@gitlab/ui'` -> `import { GlSkeletonLoader } from '@gitlab/ui'`
|
|
7
|
-
2. Update component definitions
|
|
8
|
-
- `components: { GlSkeletonLoading }` -> `components: { GlSkeletonLoader }`
|
|
9
|
-
3. Update template
|
|
10
|
-
- `<gl-skeleton-loading />` -> `<gl-skeleton-loader />`
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// variables
|
|
2
|
-
$skeleton-line-height: 10px;
|
|
3
|
-
|
|
4
|
-
$skeleton-line-widths: (156px, 235px, 200px);
|
|
5
|
-
|
|
6
|
-
// animation
|
|
7
|
-
@keyframes blockTextShine {
|
|
8
|
-
0% {
|
|
9
|
-
transform: translateX(-468px);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
100% {
|
|
13
|
-
transform: translateX(468px);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// mixins
|
|
18
|
-
@mixin gl-tmp-skeleton-loading-shine-background {
|
|
19
|
-
background-image: linear-gradient(
|
|
20
|
-
to right,
|
|
21
|
-
$gray-100 0%,
|
|
22
|
-
$gray-50 20%,
|
|
23
|
-
$gray-100 40%,
|
|
24
|
-
$gray-100 100%
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@mixin gl-tmp-skeleton-loading-shine-animation {
|
|
29
|
-
animation: blockTextShine 1s linear infinite forwards;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.animation-container {
|
|
33
|
-
@include gl-h-8;
|
|
34
|
-
@include gl-overflow-hidden;
|
|
35
|
-
|
|
36
|
-
&.animation-container-small {
|
|
37
|
-
@include gl-h-4;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[class^='skeleton-line-'] {
|
|
41
|
-
height: $skeleton-line-height;
|
|
42
|
-
@include gl-relative;
|
|
43
|
-
@include gl-bg-gray-50;
|
|
44
|
-
@include gl-overflow-hidden;
|
|
45
|
-
|
|
46
|
-
&:not(:last-of-type) {
|
|
47
|
-
@include gl-mb-2;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&::after {
|
|
51
|
-
height: $skeleton-line-height;
|
|
52
|
-
@include gl-content-empty;
|
|
53
|
-
@include gl-display-block;
|
|
54
|
-
@include gl-bg-no-repeat;
|
|
55
|
-
@include gl-bg-size-cover;
|
|
56
|
-
@include gl-tmp-skeleton-loading-shine-background;
|
|
57
|
-
@include gl-tmp-skeleton-loading-shine-animation;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@for $count from 1 through length($skeleton-line-widths) {
|
|
63
|
-
.skeleton-line-#{$count} {
|
|
64
|
-
width: nth($skeleton-line-widths, $count);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import SkeletonLoading from './skeleton_loading.vue';
|
|
3
|
-
|
|
4
|
-
describe('skeleton loading component', () => {
|
|
5
|
-
const mountWithOptions = shallowMount.bind(null, SkeletonLoading);
|
|
6
|
-
|
|
7
|
-
it('should render 1 line', () => {
|
|
8
|
-
const component = mountWithOptions({
|
|
9
|
-
propsData: {
|
|
10
|
-
lines: 1,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const lines = component.vm.$el.querySelectorAll('.animation-container div');
|
|
15
|
-
expect(lines).toHaveLength(1);
|
|
16
|
-
expect(lines[0].classList.contains('skeleton-line-1')).toEqual(true);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('should render 2 lines', () => {
|
|
20
|
-
const component = mountWithOptions({
|
|
21
|
-
propsData: {
|
|
22
|
-
lines: 2,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const lines = component.vm.$el.querySelectorAll('.animation-container div');
|
|
27
|
-
|
|
28
|
-
expect(lines).toHaveLength(2);
|
|
29
|
-
expect(lines[0].classList.contains('skeleton-line-1')).toEqual(true);
|
|
30
|
-
expect(lines[1].classList.contains('skeleton-line-2')).toEqual(true);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe('3 lines', () => {
|
|
34
|
-
function expectThreeLines(component) {
|
|
35
|
-
const lines = component.vm.$el.querySelectorAll('.animation-container div');
|
|
36
|
-
expect(lines).toHaveLength(3);
|
|
37
|
-
expect(lines[0].classList.contains('skeleton-line-1')).toEqual(true);
|
|
38
|
-
expect(lines[1].classList.contains('skeleton-line-2')).toEqual(true);
|
|
39
|
-
expect(lines[2].classList.contains('skeleton-line-3')).toEqual(true);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
it('should render by default', () => {
|
|
43
|
-
const component = mountWithOptions({});
|
|
44
|
-
|
|
45
|
-
expectThreeLines(component);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should render when 3 lines are passed', () => {
|
|
49
|
-
const component = mountWithOptions({
|
|
50
|
-
propsData: {
|
|
51
|
-
lines: 3,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
expectThreeLines(component);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|