@gitlab/ui 39.4.0 → 39.5.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 +12 -0
- package/dist/components/base/alert/alert.js +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +4 -4
- package/src/components/base/alert/alert.spec.js +3 -1
- package/src/components/base/alert/alert.vue +1 -1
- package/src/components/base/link/link.stories.js +9 -7
- package/src/components/utilities/friendly_wrap/friendly_wrap.stories.js +10 -11
- package/src/components/utilities/sprintf/sprintf.stories.js +11 -9
- package/src/scss/utilities.scss +10 -0
- package/src/scss/utility-mixins/composite.scss +20 -0
- package/src/scss/utility-mixins/index.scss +1 -0
- package/src/utils/data_utils.js +2 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "39.
|
|
3
|
+
"version": "39.5.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -123,10 +123,10 @@
|
|
|
123
123
|
"npm-run-all": "^4.1.5",
|
|
124
124
|
"pikaday": "^1.8.0",
|
|
125
125
|
"plop": "^2.5.4",
|
|
126
|
-
"postcss": "8.4.
|
|
126
|
+
"postcss": "8.4.12",
|
|
127
127
|
"postcss-loader": "^3.0.0",
|
|
128
|
-
"postcss-scss": "
|
|
129
|
-
"prettier": "2.2
|
|
128
|
+
"postcss-scss": "4.0.4",
|
|
129
|
+
"prettier": "2.6.2",
|
|
130
130
|
"puppeteer": "11.0.0",
|
|
131
131
|
"raw-loader": "^0.5.1",
|
|
132
132
|
"rollup": "^2.53.1",
|
|
@@ -71,13 +71,15 @@ describe('Alert component', () => {
|
|
|
71
71
|
expect(findDismissButton().exists()).toBe(false);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
it('renders the provided title', () => {
|
|
74
|
+
it('renders the provided title with heading level 2', () => {
|
|
75
75
|
const title = 'foo';
|
|
76
76
|
createComponent({ propsData: { title } });
|
|
77
77
|
|
|
78
78
|
const titleWrapper = findTitle();
|
|
79
79
|
expect(titleWrapper.exists()).toBe(true);
|
|
80
80
|
expect(titleWrapper.text()).toContain(title);
|
|
81
|
+
// the title needs to be in a level 2 heading for accessibility reasons
|
|
82
|
+
expect(titleWrapper.element.tagName).toEqual('H2');
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
describe('given primaryButtonText', () => {
|
|
@@ -184,7 +184,7 @@ export default {
|
|
|
184
184
|
/>
|
|
185
185
|
|
|
186
186
|
<div class="gl-alert-content" role="alert">
|
|
187
|
-
<
|
|
187
|
+
<h2 v-if="title" class="gl-alert-title">{{ title }}</h2>
|
|
188
188
|
|
|
189
189
|
<div class="gl-alert-body">
|
|
190
190
|
<!-- @slot The alert message to display. -->
|
|
@@ -7,13 +7,15 @@ const generateProps = ({ href = '#', target = null } = {}) => ({
|
|
|
7
7
|
target,
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
const makeStory =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const makeStory =
|
|
11
|
+
(options) =>
|
|
12
|
+
(args, { argTypes }) => ({
|
|
13
|
+
components: {
|
|
14
|
+
GlLink,
|
|
15
|
+
},
|
|
16
|
+
props: Object.keys(argTypes),
|
|
17
|
+
...options,
|
|
18
|
+
});
|
|
17
19
|
|
|
18
20
|
export const DefaultLink = makeStory({
|
|
19
21
|
components: { GlLink },
|
|
@@ -12,26 +12,26 @@ const generateProps = ({ text = '', symbols = defaultValue('symbols')() } = {})
|
|
|
12
12
|
symbols,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
const makeStory =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const makeStory =
|
|
16
|
+
(options = {}) =>
|
|
17
|
+
(args, { argTypes }) => ({
|
|
18
|
+
components,
|
|
19
|
+
props: Object.keys(argTypes),
|
|
20
|
+
...options,
|
|
21
|
+
});
|
|
20
22
|
|
|
21
23
|
export const Default = makeStory({
|
|
22
24
|
template: `<gl-friendly-wrap :text="text" :symbols="symbols" />`,
|
|
23
25
|
});
|
|
24
26
|
Default.args = generateProps({
|
|
25
|
-
text:
|
|
26
|
-
'/lorem/ipsum/dolor/sit/amet/consectetur/adipiscing/elit/Aenean/tincidunt/urna/ac/tellus/cursus/laoreet/aenean/blandit/erat/vel/est/maximus/porta/Sed/id/nunc/non/sapien/cursus/ullamcorper',
|
|
27
|
+
text: '/lorem/ipsum/dolor/sit/amet/consectetur/adipiscing/elit/Aenean/tincidunt/urna/ac/tellus/cursus/laoreet/aenean/blandit/erat/vel/est/maximus/porta/Sed/id/nunc/non/sapien/cursus/ullamcorper',
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
export const BreakWord = makeStory({
|
|
30
31
|
template: `<gl-friendly-wrap :text="text" :symbols="symbols" />`,
|
|
31
32
|
});
|
|
32
33
|
BreakWord.args = generateProps({
|
|
33
|
-
text:
|
|
34
|
-
'LoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitamet',
|
|
34
|
+
text: 'LoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitamet',
|
|
35
35
|
symbols: ['dolor'],
|
|
36
36
|
});
|
|
37
37
|
|
|
@@ -39,8 +39,7 @@ export const MultipleSymbols = makeStory({
|
|
|
39
39
|
template: `<gl-friendly-wrap :text="text" :symbols="symbols" />`,
|
|
40
40
|
});
|
|
41
41
|
MultipleSymbols.args = generateProps({
|
|
42
|
-
text:
|
|
43
|
-
'LoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitamet',
|
|
42
|
+
text: 'LoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitametLoremipsumdolorsitamet',
|
|
44
43
|
symbols: ['e', 'o'],
|
|
45
44
|
});
|
|
46
45
|
|
|
@@ -6,15 +6,17 @@ const generateProps = ({ message = 'Written by %{author}', placeholders } = {})
|
|
|
6
6
|
placeholders,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
const makeStory =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const makeStory =
|
|
10
|
+
(options) =>
|
|
11
|
+
(args, { argTypes }) => ({
|
|
12
|
+
components: {
|
|
13
|
+
GlSprintf,
|
|
14
|
+
GlButton,
|
|
15
|
+
GlLink,
|
|
16
|
+
},
|
|
17
|
+
props: Object.keys(argTypes),
|
|
18
|
+
...options,
|
|
19
|
+
});
|
|
18
20
|
|
|
19
21
|
export const SentenceWithLink = makeStory({
|
|
20
22
|
template: `
|
package/src/scss/utilities.scss
CHANGED
|
@@ -2484,6 +2484,16 @@
|
|
|
2484
2484
|
filter: invert(0.8) hue-rotate(180deg) !important;
|
|
2485
2485
|
}
|
|
2486
2486
|
}
|
|
2487
|
+
.gl--flex-center{
|
|
2488
|
+
@include gl-display-flex;
|
|
2489
|
+
@include gl-align-items-center;
|
|
2490
|
+
@include gl-justify-content-center
|
|
2491
|
+
}
|
|
2492
|
+
.gl--flex-center\!{
|
|
2493
|
+
@include gl-display-flex;
|
|
2494
|
+
@include gl-align-items-center;
|
|
2495
|
+
@include gl-justify-content-center
|
|
2496
|
+
}
|
|
2487
2497
|
.gl-content-empty {
|
|
2488
2498
|
content: ''
|
|
2489
2499
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Composite utilities
|
|
3
|
+
//
|
|
4
|
+
// naming convention: gl--{name}
|
|
5
|
+
// purpose: This is for composite classes that provide significant readability and maintainability profit.
|
|
6
|
+
//
|
|
7
|
+
// PLEASE NOTE: When considering to abstract a set of utility classes, please prefer, in order:
|
|
8
|
+
// 1. Not abstracting
|
|
9
|
+
// 2. Create a component
|
|
10
|
+
// 3. Create a constant scoped within a specific module
|
|
11
|
+
// 4. Create a composite class if there are many preexisting occurrences with a clear design responsibility
|
|
12
|
+
//
|
|
13
|
+
// notes:
|
|
14
|
+
// - Composite classes should be very short and not have any nested rules.
|
|
15
|
+
//
|
|
16
|
+
@mixin gl--flex-center {
|
|
17
|
+
@include gl-display-flex;
|
|
18
|
+
@include gl-align-items-center;
|
|
19
|
+
@include gl-justify-content-center;
|
|
20
|
+
}
|
package/src/utils/data_utils.js
CHANGED
|
@@ -2,27 +2,8 @@ import curry from 'lodash/fp/curry';
|
|
|
2
2
|
|
|
3
3
|
const getRepeatingValue = (index) => {
|
|
4
4
|
const values = [
|
|
5
|
-
100,
|
|
6
|
-
|
|
7
|
-
400,
|
|
8
|
-
200,
|
|
9
|
-
100,
|
|
10
|
-
800,
|
|
11
|
-
400,
|
|
12
|
-
500,
|
|
13
|
-
600,
|
|
14
|
-
300,
|
|
15
|
-
800,
|
|
16
|
-
900,
|
|
17
|
-
110,
|
|
18
|
-
700,
|
|
19
|
-
400,
|
|
20
|
-
300,
|
|
21
|
-
500,
|
|
22
|
-
300,
|
|
23
|
-
400,
|
|
24
|
-
600,
|
|
25
|
-
700,
|
|
5
|
+
100, 500, 400, 200, 100, 800, 400, 500, 600, 300, 800, 900, 110, 700, 400, 300, 500, 300, 400,
|
|
6
|
+
600, 700,
|
|
26
7
|
];
|
|
27
8
|
return index < values.length ? values[index] : values[index % values.length];
|
|
28
9
|
};
|