@gitlab/ui 108.0.1 → 108.1.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/base/breadcrumb/breadcrumb.js +18 -2
- package/dist/components/base/breadcrumb/breadcrumb_item.js +8 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utils/constants.js +5 -1
- package/package.json +1 -1
- package/src/components/base/breadcrumb/breadcrumb.md +13 -1
- package/src/components/base/breadcrumb/breadcrumb.scss +8 -1
- package/src/components/base/breadcrumb/breadcrumb.vue +21 -4
- package/src/components/base/breadcrumb/breadcrumb_item.vue +8 -1
- package/src/utils/constants.js +5 -0
package/dist/utils/constants.js
CHANGED
|
@@ -71,6 +71,10 @@ const formStateOptions = {
|
|
|
71
71
|
valid: true,
|
|
72
72
|
invalid: false
|
|
73
73
|
};
|
|
74
|
+
const breadCrumbSizeOptions = {
|
|
75
|
+
sm: 'sm',
|
|
76
|
+
md: 'md'
|
|
77
|
+
};
|
|
74
78
|
const buttonCategoryOptions = {
|
|
75
79
|
primary: 'primary',
|
|
76
80
|
secondary: 'secondary',
|
|
@@ -295,4 +299,4 @@ const loadingIconVariants = {
|
|
|
295
299
|
dots: 'dots'
|
|
296
300
|
};
|
|
297
301
|
|
|
298
|
-
export { COMMA, CONTRAST_LEVELS, HEX_REGEX, LEFT_MOUSE_BUTTON, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeIconSizeOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonVariantOptions, colorThemes, columnOptions, datepickerWidthOptionsMap, defaultDateFormat, drawerVariants, dropdownAllowedAutoPlacements, dropdownItemVariantOptions, dropdownPlacements, dropdownVariantOptions, focusableTags, formInputWidths, formStateOptions, iconSizeOptions, iconVariantOptions, keyboard, labelColorOptions, loadingIconSizes, loadingIconVariants, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, progressBarVariantOptions, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, viewModeOptions };
|
|
302
|
+
export { COMMA, CONTRAST_LEVELS, HEX_REGEX, LEFT_MOUSE_BUTTON, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeIconSizeOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, breadCrumbSizeOptions, buttonCategoryOptions, buttonSizeOptions, buttonVariantOptions, colorThemes, columnOptions, datepickerWidthOptionsMap, defaultDateFormat, drawerVariants, dropdownAllowedAutoPlacements, dropdownItemVariantOptions, dropdownPlacements, dropdownVariantOptions, focusableTags, formInputWidths, formStateOptions, iconSizeOptions, iconVariantOptions, keyboard, labelColorOptions, loadingIconSizes, loadingIconVariants, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, progressBarVariantOptions, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, viewModeOptions };
|
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
## Usage
|
|
2
2
|
|
|
3
|
+
### `items` prop
|
|
4
|
+
|
|
3
5
|
This component also allows for optional avatars on each item.
|
|
4
6
|
|
|
5
7
|
`avatarPath` should passed along with `text` and `href` in `items`.
|
|
@@ -8,7 +10,7 @@ Here is an example of how an item with an avatar should look:
|
|
|
8
10
|
**note:** the component supports passing the property `to` in the list items to enable navigation
|
|
9
11
|
through `vue-router`
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
#### Example
|
|
12
14
|
|
|
13
15
|
```js
|
|
14
16
|
items = [
|
|
@@ -21,3 +23,13 @@ items = [
|
|
|
21
23
|
|
|
22
24
|
<gl-breadcrumb :items="items" />
|
|
23
25
|
```
|
|
26
|
+
|
|
27
|
+
### `size` prop
|
|
28
|
+
|
|
29
|
+
The size prop determines the size of the breadcrumb component. It accepts the following values:
|
|
30
|
+
|
|
31
|
+
"sm" (default): Small size
|
|
32
|
+
"md": Medium size
|
|
33
|
+
|
|
34
|
+
Using the default 'sm' size for all page breadcrumbs is considered a best practice
|
|
35
|
+
to ensure consistency across the application.
|
|
@@ -17,7 +17,6 @@ $breadcrumb-max-width: $grid-size * 16;
|
|
|
17
17
|
|
|
18
18
|
// bootstrap overrides
|
|
19
19
|
.gl-breadcrumb-item {
|
|
20
|
-
@apply gl-text-sm;
|
|
21
20
|
@apply gl-leading-normal;
|
|
22
21
|
@apply gl-shrink-0;
|
|
23
22
|
|
|
@@ -60,3 +59,11 @@ $breadcrumb-max-width: $grid-size * 16;
|
|
|
60
59
|
color: var(--gl-text-color-default);
|
|
61
60
|
@apply gl-font-bold;
|
|
62
61
|
}
|
|
62
|
+
|
|
63
|
+
.gl-breadcrumb-item-sm {
|
|
64
|
+
@apply gl-text-sm;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.gl-breadcrumb-item-md {
|
|
68
|
+
@apply gl-text-base;
|
|
69
|
+
}
|
|
@@ -5,6 +5,7 @@ import { translate } from '../../../utils/i18n';
|
|
|
5
5
|
import GlAvatar from '../avatar/avatar.vue';
|
|
6
6
|
import GlDisclosureDropdown from '../new_dropdowns/disclosure/disclosure_dropdown.vue';
|
|
7
7
|
import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
8
|
+
import { breadCrumbSizeOptions } from '../../../utils/constants';
|
|
8
9
|
import GlBreadcrumbItem from './breadcrumb_item.vue';
|
|
9
10
|
|
|
10
11
|
export default {
|
|
@@ -54,13 +55,22 @@ export default {
|
|
|
54
55
|
required: false,
|
|
55
56
|
default: true,
|
|
56
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* Size of the breadcrumb item. Use `sm` for page breadcrumbs.
|
|
60
|
+
*/
|
|
61
|
+
size: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: false,
|
|
64
|
+
default: breadCrumbSizeOptions.sm,
|
|
65
|
+
validator: (value) => Object.keys(breadCrumbSizeOptions).includes(value),
|
|
66
|
+
},
|
|
57
67
|
},
|
|
58
68
|
data() {
|
|
59
69
|
return {
|
|
60
70
|
fittingItems: [...this.items], // array of items that fit on the screen
|
|
61
71
|
overflowingItems: [], // array of items that didn't fit and were put in a dropdown instead
|
|
62
72
|
totalBreadcrumbsWidth: 0, // the total width of all breadcrumb items combined
|
|
63
|
-
widthPerItem: [], // array with the
|
|
73
|
+
widthPerItem: [], // array with the individual widths of each breadcrumb item
|
|
64
74
|
resizeDone: false, // to apply some CSS only during/after resizing
|
|
65
75
|
};
|
|
66
76
|
},
|
|
@@ -89,6 +99,12 @@ export default {
|
|
|
89
99
|
}
|
|
90
100
|
return {};
|
|
91
101
|
},
|
|
102
|
+
dropdownSize() {
|
|
103
|
+
return this.size === 'sm' ? 'small' : 'medium';
|
|
104
|
+
},
|
|
105
|
+
avatarSize() {
|
|
106
|
+
return this.size === 'sm' ? 16 : 24;
|
|
107
|
+
},
|
|
92
108
|
},
|
|
93
109
|
watch: {
|
|
94
110
|
items: {
|
|
@@ -191,7 +207,7 @@ export default {
|
|
|
191
207
|
<template>
|
|
192
208
|
<nav class="gl-breadcrumbs" :aria-label="ariaLabel" :style="breadcrumbStyle">
|
|
193
209
|
<ol class="gl-breadcrumb-list breadcrumb" v-bind="$attrs" v-on="$listeners">
|
|
194
|
-
<li v-if="hasCollapsible" class="gl-breadcrumb-item">
|
|
210
|
+
<li v-if="hasCollapsible" :class="`gl-breadcrumb-item gl-breadcrumb-item-${size}`">
|
|
195
211
|
<gl-disclosure-dropdown
|
|
196
212
|
:items="overflowingItems"
|
|
197
213
|
:toggle-text="showMoreLabel"
|
|
@@ -199,7 +215,7 @@ export default {
|
|
|
199
215
|
text-sr-only
|
|
200
216
|
no-caret
|
|
201
217
|
icon="ellipsis_h"
|
|
202
|
-
size="
|
|
218
|
+
:size="dropdownSize"
|
|
203
219
|
/>
|
|
204
220
|
</li>
|
|
205
221
|
|
|
@@ -211,11 +227,12 @@ export default {
|
|
|
211
227
|
:href="item.href"
|
|
212
228
|
:style="itemStyle"
|
|
213
229
|
:to="item.to"
|
|
230
|
+
:size="size"
|
|
214
231
|
:aria-current="getAriaCurrentAttr(index)"
|
|
215
232
|
><gl-avatar
|
|
216
233
|
v-if="item.avatarPath"
|
|
217
234
|
:src="item.avatarPath"
|
|
218
|
-
:size="
|
|
235
|
+
:size="avatarSize"
|
|
219
236
|
aria-hidden="true"
|
|
220
237
|
class="gl-breadcrumb-avatar-tile gl-border gl-mr-2 !gl-rounded-base"
|
|
221
238
|
shape="rect"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BLink } from '../../../vendor/bootstrap-vue/src/components/link/link';
|
|
3
|
+
import { breadCrumbSizeOptions } from '../../../utils/constants';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
name: 'GlBreadcrumbItem',
|
|
@@ -31,12 +32,18 @@ export default {
|
|
|
31
32
|
return [false, 'page'].indexOf(value) !== -1;
|
|
32
33
|
},
|
|
33
34
|
},
|
|
35
|
+
size: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
default: breadCrumbSizeOptions.sm,
|
|
39
|
+
validator: (value) => Object.keys(breadCrumbSizeOptions).includes(value),
|
|
40
|
+
},
|
|
34
41
|
},
|
|
35
42
|
};
|
|
36
43
|
</script>
|
|
37
44
|
|
|
38
45
|
<template>
|
|
39
|
-
<li class="gl-breadcrumb-item">
|
|
46
|
+
<li :class="`gl-breadcrumb-item gl-breadcrumb-item-${size}`">
|
|
40
47
|
<b-link :href="href" :to="to" :aria-current="ariaCurrent">
|
|
41
48
|
<slot>{{ text }}</slot>
|
|
42
49
|
</b-link>
|
package/src/utils/constants.js
CHANGED