@gitlab/ui 58.8.0 → 59.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "58.8.0",
3
+ "version": "59.1.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -4,7 +4,9 @@ indicate an issue’s status, a member’s role, or if a branch is protected.
4
4
 
5
5
  ## Usage
6
6
 
7
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
7
8
  ```html
9
+
8
10
  <gl-badge>Hello, world!</gl-badge>
9
11
  ```
10
12
 
@@ -1,17 +1,12 @@
1
1
  ## Usage
2
2
 
3
- This component provides two `<slot>` elements for customization. The first is a `<slot #avatar>`
4
- so an avatar can appear before the first breadcrumb. The second is a `<slot #separator>` to
5
- customize the icon that appears between each breadcrumb.
3
+ This component provides a `<slot #avatar>` so an avatar can appear before the first breadcrumb.
6
4
 
7
5
  **note:** the component supports passing the property `to` in the list items to enable navigation
8
6
  through `vue-router`
9
7
 
10
8
  ### Example
11
9
 
12
- You can use any kind of separator you want in the slot, like below, which uses `<svg>`
13
- to draw a `/`
14
-
15
10
  ```html
16
11
  <gl-breadcrumb :items="items">
17
12
  <template #avatar>
@@ -23,10 +18,5 @@ to draw a `/`
23
18
  height="16"
24
19
  />
25
20
  </template>
26
- <template #separator>
27
- <svg height="16">
28
- <line x1="100%" y1="0" x2="0" y2="100%" stroke="gray" />
29
- </svg>
30
- </template>
31
21
  </gl-breadcrumb>
32
22
  ```
@@ -3,9 +3,6 @@ $breadcrumb-max-width: $grid-size * 16;
3
3
 
4
4
  .gl-breadcrumbs {
5
5
  @include gl-display-flex;
6
- @include gl-border-0;
7
- @include gl-inset-border-b-1-gray-200;
8
- @include gl-py-5;
9
6
  }
10
7
 
11
8
  .gl-breadcrumb-list {
@@ -19,25 +16,11 @@ $breadcrumb-max-width: $grid-size * 16;
19
16
  }
20
17
  }
21
18
 
22
- .gl-breadcrumb-separator {
23
- @include gl-display-inline-flex;
24
- @include gl-absolute;
25
- right: 0;
26
-
27
- > svg {
28
- @include gl-my-auto;
29
- @include gl-mx-2;
30
- @include gl-w-3;
31
- @include gl-text-gray-500;
32
- @include gl-fill-current-color;
33
- }
34
- }
35
-
36
19
  .gl-breadcrumb-avatar-tile {
37
- @include gl-mr-3;
20
+ @include gl-mr-2;
38
21
  @include gl-border-1;
39
22
  @include gl-border-solid;
40
- @include gl-border-gray-200;
23
+ @include gl-border-gray-a-08;
41
24
  @include gl-rounded-base;
42
25
  }
43
26
 
@@ -45,22 +28,15 @@ $breadcrumb-max-width: $grid-size * 16;
45
28
  .gl-breadcrumb-item {
46
29
  @include gl-font-sm;
47
30
  @include gl-line-height-normal;
48
- @include gl-relative;
49
- @include gl-pr-6;
50
-
51
- + .gl-breadcrumb-item {
52
- @include gl-pl-0;
53
31
 
54
- &::before {
55
- content: '';
56
- @include gl-display-none;
57
- }
32
+ &:not(:last-child)::after {
33
+ @include gl-text-gray-200;
34
+ @include gl-px-3;
35
+ content: '/';
58
36
  }
59
37
 
60
38
  > a {
61
- @include gl-display-flex;
62
- @include gl-align-items-center;
63
- @include gl-text-gray-500;
39
+ @include gl-text-gray-700;
64
40
  @include media-breakpoint-down(xs) {
65
41
  @include str-truncated($breadcrumb-max-width);
66
42
  }
@@ -74,6 +50,6 @@ $breadcrumb-max-width: $grid-size * 16;
74
50
  }
75
51
 
76
52
  .gl-breadcrumb-item:last-child > a {
77
- @include gl-text-gray-950;
53
+ @include gl-text-gray-900;
78
54
  @include gl-font-weight-bold;
79
55
  }
@@ -24,22 +24,19 @@ describe('Breadcrumb component', () => {
24
24
  ];
25
25
 
26
26
  const findAvatarSlot = () => wrapper.find('[data-testid="avatar-slot"]');
27
- const findSeparatorSlot = () => wrapper.find('[data-testid="separator-slot"]');
28
27
  const findBreadcrumbItems = () => wrapper.findAllComponents(GlBreadcrumbItem);
29
- const findAllSeparators = () => wrapper.findAll('[data-testid="separator"]');
30
28
  const findCollapsedListExpander = () => wrapper.find('[data-testid="collapsed-expander"]');
31
- const findExpanderSeparator = () => wrapper.find('[data-testid="expander-separator"]');
32
29
 
33
30
  const findVisibleBreadcrumbItems = () =>
34
- wrapper.findAll('.gl-breadcrumb-item:not(.gl-display-none)');
35
- const findHiddenBreadcrumbItems = () => wrapper.findAll('.gl-breadcrumb-item.gl-display-none');
31
+ findBreadcrumbItems().wrappers.filter((item) => item.isVisible());
32
+ const findHiddenBreadcrumbItems = () =>
33
+ findBreadcrumbItems().wrappers.filter((item) => !item.isVisible());
36
34
 
37
35
  const createComponent = (propsData = { items }) => {
38
36
  wrapper = shallowMount(Breadcrumb, {
39
37
  propsData,
40
38
  slots: {
41
39
  avatar: '<div data-testid="avatar-slot"></div>',
42
- separator: '<div data-testid="separator-slot"></div>',
43
40
  },
44
41
  stubs: {
45
42
  GlBreadcrumbItem,
@@ -59,18 +56,6 @@ describe('Breadcrumb component', () => {
59
56
 
60
57
  expect(findAvatarSlot().exists()).toBe(true);
61
58
  });
62
-
63
- it('has a separator slot', () => {
64
- createComponent();
65
-
66
- expect(findSeparatorSlot().exists()).toBe(true);
67
- });
68
-
69
- it('separator slot is shown only with more than one item', () => {
70
- createComponent({ items: [items[0]] });
71
-
72
- expect(findSeparatorSlot().exists()).toBe(false);
73
- });
74
59
  });
75
60
 
76
61
  describe('items', () => {
@@ -79,12 +64,6 @@ describe('Breadcrumb component', () => {
79
64
 
80
65
  expect(findBreadcrumbItems()).toHaveLength(items.length);
81
66
  });
82
-
83
- it(`with ${items.length} items has ${items.length - 1} separators`, () => {
84
- createComponent();
85
-
86
- expect(findAllSeparators()).toHaveLength(items.length - 1);
87
- });
88
67
  });
89
68
 
90
69
  describe('bindings', () => {
@@ -122,9 +101,8 @@ describe('Breadcrumb component', () => {
122
101
  beforeEach(() => {
123
102
  createComponent();
124
103
  });
125
- it('should not display collapsed list expander && separator', () => {
104
+ it('should not display collapsed list expander', () => {
126
105
  expect(findCollapsedListExpander().exists()).toBe(false);
127
- expect(findExpanderSeparator().exists()).toBe(false);
128
106
  });
129
107
 
130
108
  it('should display all items visible', () => {
@@ -136,9 +114,8 @@ describe('Breadcrumb component', () => {
136
114
  beforeEach(() => {
137
115
  createComponent({ items: [...items, ...extraItems] });
138
116
  });
139
- it('should display collapsed list expander && separator', () => {
117
+ it('should display collapsed list expander', () => {
140
118
  expect(findCollapsedListExpander().exists()).toBe(true);
141
- expect(findExpanderSeparator().exists()).toBe(true);
142
119
  });
143
120
 
144
121
  it('should display only first && 2 last items and the rest as hidden', () => {
@@ -1,7 +1,6 @@
1
1
  <!-- eslint-disable vue/multi-word-component-names -->
2
2
  <script>
3
3
  import { BBreadcrumb } from 'bootstrap-vue';
4
- import GlIcon from '../icon/icon.vue';
5
4
  import GlButton from '../button/button.vue';
6
5
  import { GlTooltipDirective } from '../../../directives/tooltip';
7
6
  import GlBreadcrumbItem from './breadcrumb_item.vue';
@@ -11,7 +10,6 @@ export const COLLAPSE_AT_SIZE = 4;
11
10
  export default {
12
11
  components: {
13
12
  BBreadcrumb,
14
- GlIcon,
15
13
  GlButton,
16
14
  GlBreadcrumbItem,
17
15
  },
@@ -88,49 +86,29 @@ export default {
88
86
  <slot name="avatar"></slot>
89
87
  <b-breadcrumb class="gl-breadcrumb-list" v-bind="$attrs" v-on="$listeners">
90
88
  <template v-for="(item, index) in items">
91
- <!-- eslint-disable-next-line vue/valid-v-for -->
89
+ <!-- eslint-disable-next-line vue/valid-v-for (for @vue/compat) -->
92
90
  <gl-breadcrumb-item
91
+ v-show="!isItemCollapsed(index)"
93
92
  :ref="isFirstItem(index) ? 'firstItem' : null"
94
93
  :text="item.text"
95
94
  :href="item.href"
96
95
  :to="item.to"
97
- :class="{ 'gl-display-none': isItemCollapsed(index) }"
98
96
  :aria-current="getAriaCurrentAttr(index)"
97
+ >{{ item.text }}</gl-breadcrumb-item
99
98
  >
100
- <span>{{ item.text }}</span>
101
- <span
102
- v-if="!isLastItem(index)"
103
- :key="`${index} ${item.text}`"
104
- class="gl-breadcrumb-separator"
105
- data-testid="separator"
106
- >
107
- <!-- @slot The separator to display. -->
108
- <slot name="separator">
109
- <gl-icon name="chevron-right" />
110
- </slot>
111
- </span>
112
- </gl-breadcrumb-item>
113
99
 
114
100
  <template v-if="showCollapsedBreadcrumbsExpander(index)">
115
- <!-- eslint-disable-next-line vue/valid-v-for -->
116
- <gl-button
117
- v-gl-tooltip.hover="'Show all breadcrumbs'"
118
- aria-label="Show all breadcrumbs"
119
- data-testid="collapsed-expander"
120
- icon="ellipsis_h"
121
- category="primary"
122
- @click="expandBreadcrumbs"
123
- />
124
- <!-- eslint-disable-next-line vue/require-v-for-key -->
125
- <span
126
- key="expander"
127
- class="gl-display-inline-flex gl-text-gray-500"
128
- data-testid="expander-separator"
129
- >
130
- <slot name="separator">
131
- <gl-icon name="chevron-right" />
132
- </slot>
133
- </span>
101
+ <!-- eslint-disable-next-line vue/require-v-for-key (for @vue/compat) -->
102
+ <li class="gl-breadcrumb-item">
103
+ <gl-button
104
+ v-gl-tooltip.hover="'Show all breadcrumbs'"
105
+ aria-label="Show all breadcrumbs"
106
+ data-testid="collapsed-expander"
107
+ icon="ellipsis_h"
108
+ category="primary"
109
+ @click="expandBreadcrumbs"
110
+ />
111
+ </li>
134
112
  </template>
135
113
  </template>
136
114
  </b-breadcrumb>
@@ -19,7 +19,9 @@ with the necessary classes added to make it look like a button, it shares the sa
19
19
  Icon-only buttons must have an accessible name.
20
20
  You can provide one with the `aria-label` attribute, which is read out by screen readers.
21
21
 
22
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
22
23
  ```html
24
+
23
25
  <gl-button icon="close" aria-label="Close" />
24
26
  ```
25
27
 
@@ -59,6 +59,8 @@ const availableTokens = [
59
59
  Pass the list of tokens to the search component. Optionally, you can use `v-model` to receive
60
60
  realtime updates:
61
61
 
62
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
62
63
  ```html
64
+
63
65
  <gl-filtered-search :available-tokens="tokens" v-model="value" />
64
66
  ```
@@ -10,7 +10,9 @@ is to `v-bind` to the
10
10
  [`PageInfo`](https://docs.gitlab.com/ee/api/graphql/reference/#pageinfo) type
11
11
  returned by the endpoint:
12
12
 
13
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
13
14
  ```html
15
+
14
16
  <gl-keyset-pagination v-bind="pageInfo" />
15
17
  ```
16
18
 
@@ -25,7 +27,9 @@ can't be translated.
25
27
 
26
28
  Example:
27
29
 
30
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
28
31
  ```html
32
+
29
33
  <gl-keyset-pagination v-bind="pageInfo" :prev-text="__('Prev')" :next-text="__('Next')" />
30
34
  ```
31
35
 
@@ -40,7 +40,9 @@ selector to the root element that contains the markdown-generated HTML.
40
40
 
41
41
  Set the `compact` property to true in `GlMarkdown` to apply the compact markdown styles.
42
42
 
43
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
43
44
  ```html
45
+
44
46
  <gl-markdown compact></gl-compact>
45
47
  ```
46
48
 
@@ -4,7 +4,9 @@ to make sure this is the right dropdown component for you.
4
4
 
5
5
  ### Basic usage
6
6
 
7
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
7
8
  ```html
9
+
8
10
  <gl-disclosure-dropdown-dropdown toggle-text="Actions" :items="items" />
9
11
  ```
10
12
 
@@ -21,13 +21,17 @@ wbr {
21
21
  By default, `GlFriendlyWrap` wraps text with slashes (`/`) as the break-symbol, which is especially
22
22
  useful when displaying paths or URLs:
23
23
 
24
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
24
25
  ```html
26
+
25
27
  <gl-friendly-wrap text="/some/file/path" />
26
28
  ```
27
29
 
28
30
  The code above renders to the following HTML:
29
31
 
32
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
30
33
  ```html
34
+
31
35
  <span class="text-break">/<wbr>some/<wbr>file/<wbr>path</span>
32
36
  ```
33
37
 
@@ -44,7 +48,9 @@ Multiple custom break-symbols can be defined via the `GlFriendlyWrap` prop:
44
48
 
45
49
  Which renders to:
46
50
 
51
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
47
52
  ```html
53
+
48
54
  <span class="text-break">some;<wbr>text-<wbr>that.<wbr>needs;<wbr>to-<wbr>be.<wbr>wrapped</span>
49
55
  ```
50
56
 
@@ -61,6 +67,8 @@ Symbols can be words too:
61
67
 
62
68
  Which renders to:
63
69
 
70
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
64
71
  ```html
72
+
65
73
  <span class="text-break">it goes on and<wbr> on and<wbr> on and<wbr> on</span>
66
74
  ```
@@ -34,7 +34,9 @@ consistent formatting.
34
34
 
35
35
  This renders to the following HTML:
36
36
 
37
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
37
38
  ```html
39
+
38
40
  <span><span>Item 1</span>, <span>Item 2</span>, <span>Item 3</span></span>
39
41
  ```
40
42
 
@@ -52,7 +54,9 @@ A custom separator can be defined via the `separator` prop:
52
54
 
53
55
  This renders to the following HTML:
54
56
 
57
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
55
58
  ```html
59
+
56
60
  <span><span>Item 1</span>/<span>Item 2</span>/<span>Item 3</span></span>
57
61
  ```
58
62
 
@@ -70,7 +74,9 @@ A custom last separator can be defined via the `lastSeparator` prop:
70
74
 
71
75
  This renders to the following HTML:
72
76
 
77
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
73
78
  ```html
79
+
74
80
  <span><span>Item 1</span>, <span>Item 2</span>, and <span>Item 3</span></span>
75
81
  ```
76
82
 
@@ -85,6 +91,8 @@ A custom last separator used on two items will only place `lastSeparator` betwee
85
91
 
86
92
  This renders to the following HTML:
87
93
 
94
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
88
95
  ```html
96
+
89
97
  <span><span>Item 1</span> and <span>Item 2</span></span>
90
98
  ```
@@ -130,7 +130,9 @@ export default {
130
130
 
131
131
  The example above renders to this HTML:
132
132
 
133
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
133
134
  ```html
135
+
134
136
  <div>Written by <span>Some author</span></div>
135
137
  ```
136
138
 
@@ -4,7 +4,9 @@ The `GlTruncate` component lets you truncate the long texts with ellipsis.
4
4
 
5
5
  ## Usage
6
6
 
7
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
7
8
  ```html
9
+
8
10
  <gl-truncate :text="text" :position="position" />
9
11
  ```
10
12
 
@@ -46,7 +46,9 @@ const config = { ALLOWED_TAGS: ['b'] };
46
46
  const config = { ALLOWED_TAGS: [] };
47
47
  ```
48
48
 
49
+ <!-- Empty initial line is a workaround for https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2102 -->
49
50
  ```html
51
+
50
52
  <div v-safe-html:[config]="rawHtml"></div>
51
53
  ```
52
54
 
@@ -482,6 +482,10 @@
482
482
  background-color: $t-gray-a-08
483
483
  }
484
484
 
485
+ .gl-focus-bg-t-gray-a-08:focus {
486
+ background-color: $t-gray-a-08
487
+ }
488
+
485
489
  .gl-bg-t-gray-a-08\! {
486
490
  background-color: $t-gray-a-08 !important
487
491
  }
@@ -490,6 +494,10 @@
490
494
  background-color: $t-gray-a-08 !important
491
495
  }
492
496
 
497
+ .gl-focus-bg-t-gray-a-08\!:focus {
498
+ background-color: $t-gray-a-08 !important
499
+ }
500
+
493
501
  .gl-bg-theme-indigo-50 {
494
502
  background-color: $theme-indigo-50
495
503
  }
@@ -174,7 +174,7 @@
174
174
  background-color: $red-700;
175
175
  }
176
176
 
177
- @mixin gl-bg-t-gray-a-08($hover: true) {
177
+ @mixin gl-bg-t-gray-a-08($hover: true, $focus: true) {
178
178
  background-color: $t-gray-a-08;
179
179
  }
180
180