@gitlab/ui 115.9.0 → 115.9.2
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/dist/components/base/avatar_link/avatar_link.js +1 -1
- package/dist/components/base/avatars_inline/avatars_inline.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +1 -1
- package/dist/tokens/build/js/tokens.js +1 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/figma/contextual.tokens.json +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/json/tokens.dark.json +2 -2
- package/dist/tokens/json/tokens.json +2 -2
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +10 -10
- package/src/components/base/avatar_link/avatar_link.vue +1 -1
- package/src/components/base/avatars_inline/avatars_inline.vue +1 -1
- package/src/components/base/markdown/markdown_typescale_demo.html +41 -71
- package/src/scss/variables.scss +1 -1
- package/src/tokens/build/css/tokens.css +1 -1
- package/src/tokens/build/css/tokens.dark.css +1 -1
- package/src/tokens/build/figma/contextual.tokens.json +1 -1
- package/src/tokens/build/js/tokens.dark.js +1 -1
- package/src/tokens/build/js/tokens.js +1 -1
- package/src/tokens/build/json/tokens.dark.json +2 -2
- package/src/tokens/build/json/tokens.json +2 -2
- package/src/tokens/build/scss/_tokens.dark.scss +1 -1
- package/src/tokens/build/scss/_tokens.scss +1 -1
- package/src/tokens/contextual/table.tokens.json +1 -1
- package/src/components/base/accordion/accordion.md +0 -3
- package/src/components/base/accordion/accordion_item.md +0 -3
- package/src/components/base/alert/alert.md +0 -35
- package/src/components/base/animated_icon/animated_icon.md +0 -4
- package/src/components/base/avatar/avatar.md +0 -1
- package/src/components/base/avatar_labeled/avatar_labeled.md +0 -20
- package/src/components/base/avatar_link/avatar_link.md +0 -33
- package/src/components/base/avatars_inline/avatars_inline.md +0 -38
- package/src/components/base/badge/badge.md +0 -30
- package/src/components/base/banner/banner.md +0 -35
- package/src/components/base/breadcrumb/breadcrumb.md +0 -52
- package/src/components/base/broadcast_message/broadcast_message.md +0 -25
- package/src/components/base/button/button.md +0 -119
- package/src/components/base/button_group/button_group.md +0 -44
- package/src/components/base/card/card.md +0 -4
- package/src/components/base/collapse/collapse.md +0 -64
- package/src/components/base/datepicker/datepicker.md +0 -8
- package/src/components/base/daterange_picker/daterange_picker.md +0 -32
- package/src/components/base/drawer/drawer.md +0 -17
- package/src/components/base/dropdown/dropdown.md +0 -72
- package/src/components/base/dropdown/dropdown_item.md +0 -2
- package/src/components/base/dropdown/dropdown_section_header.md +0 -7
- package/src/components/base/dropdown/dropdown_text.md +0 -7
- package/src/components/base/filtered_search/filtered_search.md +0 -76
- package/src/components/base/filtered_search/filtered_search_suggestion.md +0 -15
- package/src/components/base/filtered_search/filtered_search_suggestion_list.md +0 -13
- package/src/components/base/filtered_search/filtered_search_term.md +0 -7
- package/src/components/base/filtered_search/filtered_search_token.md +0 -23
- package/src/components/base/filtered_search/filtered_search_token_segment.md +0 -14
- package/src/components/base/form/form_checkbox/form_checkbox.md +0 -6
- package/src/components/base/form/form_input/form_input.md +0 -306
- package/src/components/base/form/form_radio/form_radio.md +0 -23
- package/src/components/base/form/form_radio_group/form_radio_group.md +0 -63
- package/src/components/base/form/form_select/form_select.md +0 -1
- package/src/components/base/form/form_textarea/form_textarea.md +0 -3
- package/src/components/base/icon/icon.md +0 -27
- package/src/components/base/infinite_scroll/infinite_scroll.md +0 -104
- package/src/components/base/keyset_pagination/keyset_pagination.md +0 -49
- package/src/components/base/label/label.md +0 -15
- package/src/components/base/link/link.md +0 -187
- package/src/components/base/loading_icon/loading_icon.md +0 -3
- package/src/components/base/modal/modal.md +0 -30
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.md +0 -184
- package/src/components/base/new_dropdowns/listbox/listbox.md +0 -195
- package/src/components/base/pagination/pagination.md +0 -45
- package/src/components/base/path/path.md +0 -41
- package/src/components/base/progress_bar/progress_bar.md +0 -25
- package/src/components/base/search_box_by_click/search_box_by_click.md +0 -1
- package/src/components/base/search_box_by_type/search_box_by_type.md +0 -1
- package/src/components/base/segmented_control/segmented_control.md +0 -26
- package/src/components/base/skeleton_loader/skeleton_loader.md +0 -70
- package/src/components/base/sorting/sorting.md +0 -80
- package/src/components/base/table/table.md +0 -71
- package/src/components/base/table_lite/table_lite.md +0 -68
- package/src/components/base/tabs/tabs/tabs.md +0 -80
- package/src/components/base/toast/toast.md +0 -48
- package/src/components/base/toggle/toggle.md +0 -4
- package/src/components/base/token/token.md +0 -12
- package/src/components/base/tooltip/tooltip.md +0 -52
- package/src/scss/typescale/typeface_demo.html +0 -70
- package/src/scss/typescale/typescale.md +0 -81
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
## Usage
|
|
2
|
-
|
|
3
|
-
The Icon component can be used to render any svg within the @gitlab/svgs icon sprites.
|
|
4
|
-
|
|
5
|
-
### Accessibility
|
|
6
|
-
|
|
7
|
-
`gl-icon` icons are hidden from screen readers by default, as usages of icons are commonly decorative.
|
|
8
|
-
|
|
9
|
-
If the icon is not decorative, add an `aria-label` attribute to `gl-icon` to give it an accessible name.
|
|
10
|
-
This label is read out by screen readers.
|
|
11
|
-
|
|
12
|
-
If the icon is clickable, use `gl-button` instead of `gl-icon` because a clickable element should
|
|
13
|
-
semantically be a button.
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<!-- icon, which is hidden from screen readers by default -->
|
|
17
|
-
<gl-icon name="rocket" />
|
|
18
|
-
|
|
19
|
-
<!-- icon, which has an accessible name "Confidential issue" that is read out by screen readers -->
|
|
20
|
-
<gl-icon name="eye-slash" :aria-label="__('Confidential issue')" />
|
|
21
|
-
|
|
22
|
-
<!-- clickable icon, which is borderless and padding-less -->
|
|
23
|
-
<gl-button icon="close" category="tertiary" class="!gl-p-0" aria-label="Close" />
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
For more information about icons within GitLab, visit the
|
|
27
|
-
[GitLab accessibility guidelines](https://docs.gitlab.com/ee/development/fe_guide/accessibility#icons).
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
## Usage
|
|
2
|
-
|
|
3
|
-
The infinite scroll component wraps around a results list and emits a message
|
|
4
|
-
(`bottomReached`) when the bottom of the viewport is reached, which should trigger
|
|
5
|
-
a re-fetching. The `gl-infinite-scroll` component expects its parent component to
|
|
6
|
-
manage the re-fetching.
|
|
7
|
-
|
|
8
|
-
Additionally it emits a `topReached` message when the top of the viewport is reached, which
|
|
9
|
-
can be useful to load items on top of the available data. If only `topReached` is present, the
|
|
10
|
-
viewport will be scrolled to the bottom the first time this component is mounted.
|
|
11
|
-
|
|
12
|
-
## Public methods
|
|
13
|
-
|
|
14
|
-
Useful public methods you can call via `$refs`:
|
|
15
|
-
|
|
16
|
-
- `.scrollUp()`: Scrolls to the top of the container.
|
|
17
|
-
- `.scrollDown()`: Scrolls to the bottom of the container.
|
|
18
|
-
- `.scrollTo({ top, behavior })`: Scrolls to a number of pixels
|
|
19
|
-
along the Y axis of the container. The scrolling behavior can also be specified,
|
|
20
|
-
as per MDN spec (<https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo>)
|
|
21
|
-
|
|
22
|
-
## Implementation Example
|
|
23
|
-
|
|
24
|
-
This is how a full implementation would look like with paginated results from GitLab's
|
|
25
|
-
`projects` API.
|
|
26
|
-
|
|
27
|
-
In the component's state, initialize a `pageInfo` object:
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
pageInfo: {
|
|
31
|
-
currentPage: 0,
|
|
32
|
-
nextPage: 0,
|
|
33
|
-
totalPages: 0,
|
|
34
|
-
totalResults: 0,
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
When fetching for the first time, set the state with the header
|
|
39
|
-
information in the mutations:
|
|
40
|
-
|
|
41
|
-
```html
|
|
42
|
-
Vue.set(state.pageInfo, 'currentPage', parseInt(headers['X-Page'], 10));
|
|
43
|
-
Vue.set(state.pageInfo, 'nextPage', parseInt(headers['X-Next-Page'], 10));
|
|
44
|
-
Vue.set(state.pageInfo, 'totalPages', parseInt(headers['X-Total-Pages'], 10));
|
|
45
|
-
Vue.set(state.pageInfo, 'totalResults', parseInt(headers['X-Total'], 10));
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
_Note: There is a function you can use for parsing integers in headers in
|
|
49
|
-
GitLab called `parseIntPagination` in `common/utils.js`_
|
|
50
|
-
|
|
51
|
-
Every time `bottomReached` happens, update the state in your mutations:
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
state.searchResults = state.searchResults.concat(results.data);
|
|
55
|
-
Vue.set(state.pageInfo, 'nextPage', parseInt(headers['X-Next-Page'],10));
|
|
56
|
-
Vue.set(state.pageInfo, 'totalPages', parseInt(headers['X-Total-Pages'],10));
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Use the state to fetch the next page in the actions. In this case, the `Projects`
|
|
60
|
-
API allows us to send in a `page` parameter to fetch a certain page from the
|
|
61
|
-
list of results.
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
export const fetchNextPage = ({ state, dispatch }) => {
|
|
65
|
-
if(state.pageInfo.currentPage < state.pageInfo.totalPages) {
|
|
66
|
-
Api.projects(searchQuery, { page: state.pageInfo.nextPage })
|
|
67
|
-
...
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```html
|
|
73
|
-
<script>
|
|
74
|
-
exportDefault {
|
|
75
|
-
components: {
|
|
76
|
-
GlInfiniteScroll,
|
|
77
|
-
},
|
|
78
|
-
computed: {
|
|
79
|
-
...mapState([
|
|
80
|
-
'pageInfo',
|
|
81
|
-
'searchResults',
|
|
82
|
-
]),
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
...mapActions([
|
|
86
|
-
'fetchNextPage',
|
|
87
|
-
]),
|
|
88
|
-
bottomReached() {
|
|
89
|
-
this.fetchNextPage();
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
}
|
|
93
|
-
</script>
|
|
94
|
-
<template>
|
|
95
|
-
<gl-infinite-scroll
|
|
96
|
-
@bottomReached="bottomReached"
|
|
97
|
-
:max-list-height="400"
|
|
98
|
-
:fetched-items="searchResults.length"
|
|
99
|
-
:total-items="totalResults"
|
|
100
|
-
>
|
|
101
|
-
...Results in a list, another component, etc ....
|
|
102
|
-
</gl-infinite-scroll>
|
|
103
|
-
</template>
|
|
104
|
-
```
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Pagination is used to help users parse a large number of items on a page,
|
|
2
|
-
whenever there are too many results to show at once. Pagination breaks up
|
|
3
|
-
results into several pages with controls for navigating forward and backward, or
|
|
4
|
-
to a specific page.
|
|
5
|
-
|
|
6
|
-
## Usage
|
|
7
|
-
|
|
8
|
-
The simplest way to use `GlKeysetPagination` with a paginated GraphQL response
|
|
9
|
-
is to `v-bind` to the
|
|
10
|
-
[`PageInfo`](https://docs.gitlab.com/ee/api/graphql/reference/#pageinfo) type
|
|
11
|
-
returned by the endpoint:
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<gl-keyset-pagination v-bind="pageInfo" />
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
This is possible because the default field names of the `PageInfo` type align
|
|
18
|
-
with the `props` of this component.
|
|
19
|
-
|
|
20
|
-
## Dos and don'ts
|
|
21
|
-
|
|
22
|
-
**✅ Do** provide the `prevText` and `nextText` props with translatable strings.
|
|
23
|
-
The default strings ("Prev" and "Next") are hardcoded in this component and
|
|
24
|
-
can't be translated.
|
|
25
|
-
|
|
26
|
-
Example:
|
|
27
|
-
|
|
28
|
-
```html
|
|
29
|
-
<gl-keyset-pagination v-bind="pageInfo" :prev-text="__('Prev')" :next-text="__('Next')" />
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**✅ Do** use this component for paginating GraphQL requests[^1] (or any
|
|
33
|
-
endpoint that uses keyset pagination).
|
|
34
|
-
|
|
35
|
-
**❌ Don't** use this component for paginating REST requests[^1] (or any
|
|
36
|
-
endpoint that uses offset pagination).
|
|
37
|
-
|
|
38
|
-
For offset pagination, use the [`GlPagination`
|
|
39
|
-
component](/?path=/story/base-pagination--default) instead.
|
|
40
|
-
|
|
41
|
-
For more information on the difference between offset and keyset pagination see
|
|
42
|
-
[our documentation on GraphQL
|
|
43
|
-
pagination](https://docs.gitlab.com/ee/development/graphql_guide/pagination.html).
|
|
44
|
-
|
|
45
|
-
[^1]: There's no intrinsic reason why GraphQL endpoints can't support offset pagination (in fact, [the official documentation](https://graphql.org/learn/pagination/#pagination-and-edges) shows an example offset pagination implementation) or why REST endpoints can't support keyset pagination. This is simply how we've chosen to implement our REST and GraphQL endpoints at GitLab.
|
|
46
|
-
|
|
47
|
-
## Pajamas reference
|
|
48
|
-
|
|
49
|
-
<https://design.gitlab.com/components/pagination>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Labels are editable objects that allow users to manually categorize other objects, like issues,
|
|
2
|
-
merge requests, and epics. They have a name, description, and a customizable background color.
|
|
3
|
-
They provide a quick way to recognize which categories the labeled object belongs to.
|
|
4
|
-
|
|
5
|
-
## Using the component
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
<gl-label
|
|
9
|
-
background-color="#D9C2EE"
|
|
10
|
-
title="Label content"
|
|
11
|
-
description="Some content"
|
|
12
|
-
tooltipPlacement="top"
|
|
13
|
-
target="http://some.url"
|
|
14
|
-
/>
|
|
15
|
-
```
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
## Variants
|
|
2
|
-
|
|
3
|
-
- **Inline**: Link that appears within body text, like a paragraph or sentence. In order to
|
|
4
|
-
distinguish a linked reference from surrounding content, a link within body copy must be
|
|
5
|
-
underlined. Inline text links can be user-generated, for example, referencing an issue with
|
|
6
|
-
"#3126" in the markdown editor of a merge request description where the link's primary function
|
|
7
|
-
is linking to the referred issue. They can also be in text generated from a source file, for
|
|
8
|
-
example, a "learn more about pipelines" link in the paragraph of an empty state template.
|
|
9
|
-
- **User interface (UI)**: Standalone link in the UI. User interface links are not user-generated.
|
|
10
|
-
For example, a link in the system notes that compares the changes in a new commit to a previous
|
|
11
|
-
one. The placement, color, and actionable text all provide link affordance. A link button has a
|
|
12
|
-
similar style, but is used for an action and not a link.
|
|
13
|
-
- **Meta**: Standalone text or text within a short string of system-generated content may contain
|
|
14
|
-
multiple meta links. Meta links share a meaningful datapoint or reference, and are only links
|
|
15
|
-
secondarily. For example, the primary function of including "%15.8" in a string is to
|
|
16
|
-
communicate the milestone, though it can also link to more information about it. Meta links represent
|
|
17
|
-
a wide variety of content and should be styled specifically for the contexts in which they appear.
|
|
18
|
-
- **Mention**: Indicates when a user is "@" mentioned in the content. The username links to the
|
|
19
|
-
user's profile. A mention link can be within body or meta content.
|
|
20
|
-
|
|
21
|
-
Use `<gl-link>` to render links. It can render standard `<a>` elements,
|
|
22
|
-
and also Vue Router and Nuxt links.
|
|
23
|
-
|
|
24
|
-
```html
|
|
25
|
-
<gl-link href="#foo">Link</gl-link>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## External link indicator
|
|
29
|
-
|
|
30
|
-
The `show-external-icon` prop displays a "↗" character after the link text to indicate external links.
|
|
31
|
-
This feature is available for **inline**, **UI (default)**, and **meta** variants only.
|
|
32
|
-
|
|
33
|
-
```html
|
|
34
|
-
<!-- External link with indicator -->
|
|
35
|
-
<gl-link href="https://kubernetes.io/docs" target="_blank" show-external-icon>
|
|
36
|
-
Kubernetes documentation
|
|
37
|
-
</gl-link>
|
|
38
|
-
<!-- Renders as: Kubernetes documentation ↗ -->
|
|
39
|
-
|
|
40
|
-
<!-- Different variants with external indicator -->
|
|
41
|
-
<gl-link variant="inline" href="https://prometheus.io" target="_blank" show-external-icon>
|
|
42
|
-
Learn more about Prometheus monitoring
|
|
43
|
-
</gl-link>
|
|
44
|
-
|
|
45
|
-
<gl-link variant="meta" href="https://docker.com" target="_blank" show-external-icon>
|
|
46
|
-
Docker Hub
|
|
47
|
-
</gl-link>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Requirements for the external icon to appear:**
|
|
51
|
-
|
|
52
|
-
- `show-external-icon` prop must be `true`.
|
|
53
|
-
- `href` prop must be provided.
|
|
54
|
-
- `target="_blank"` must be set.
|
|
55
|
-
- Destination domain must be [determined as external](https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com/-/blob/b5e4b0b4241455ed0fa45e0f6f5b83a3b76755ff/packages/gitlab-ui/src/directives/safe_link/safe_link.js#L12).
|
|
56
|
-
- Link variant must be `inline`, `meta`, or default (UI).
|
|
57
|
-
|
|
58
|
-
**Note:** The external icon is not available for `mention` or `unstyled` variants as these have
|
|
59
|
-
specific design purposes that don't align with external link indication.
|
|
60
|
-
|
|
61
|
-
## Link type
|
|
62
|
-
|
|
63
|
-
By specifying a value in the `href` prop, a standard link (`<a>`) element will be rendered. To
|
|
64
|
-
generate a `<router-link>` instead, specify the route location via the `to` prop.
|
|
65
|
-
|
|
66
|
-
### Router links
|
|
67
|
-
|
|
68
|
-
Router links support various additional props.
|
|
69
|
-
|
|
70
|
-
If your app is running under [Nuxt.js](https://nuxtjs.org), the
|
|
71
|
-
[`<nuxt-link>`](https://nuxtjs.org/api/components-nuxt-link) component will be used instead of
|
|
72
|
-
`<router-link>`. The `<nuxt-link>` component supports all the same features as `<router-link>` (as
|
|
73
|
-
it is a wrapper component for `<router-link>`) and more.
|
|
74
|
-
|
|
75
|
-
#### `to`
|
|
76
|
-
|
|
77
|
-
- type: `string | Location`
|
|
78
|
-
- required to generate a `<router-link>`
|
|
79
|
-
|
|
80
|
-
Denotes the target route of the link. When clicked, the value of the `to` prop will be passed to
|
|
81
|
-
`router.push()` internally, so the value can be either a string or a location descriptor object.
|
|
82
|
-
|
|
83
|
-
```html
|
|
84
|
-
<!-- Literal string -->
|
|
85
|
-
<gl-link to="home">Home</gl-link>
|
|
86
|
-
<!-- Renders to -->
|
|
87
|
-
<a href="home">Home</a>
|
|
88
|
-
|
|
89
|
-
<!-- Omitting `v-bind` is fine, just as binding any other prop -->
|
|
90
|
-
<gl-link :to="'home'">Home</gl-link>
|
|
91
|
-
|
|
92
|
-
<!-- Same as above -->
|
|
93
|
-
<gl-link :to="{ path: 'home' }">Home</gl-link>
|
|
94
|
-
|
|
95
|
-
<!-- Named route -->
|
|
96
|
-
<gl-link :to="{ name: 'user', params: { userId: 123 } }">User</gl-link>
|
|
97
|
-
|
|
98
|
-
<!-- With query, resulting in `/register?plan=private` -->
|
|
99
|
-
<gl-link :to="{ path: 'register', query: { plan: 'private' } }">Register</gl-link>
|
|
100
|
-
|
|
101
|
-
<!-- Render a non-router link by omitting `to` and specifying an `href` -->
|
|
102
|
-
<gl-link href="/home">Home</gl-link>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
#### `replace`
|
|
106
|
-
|
|
107
|
-
- type: `boolean`
|
|
108
|
-
- default: `false`
|
|
109
|
-
|
|
110
|
-
Setting `replace` prop will call `router.replace()` instead of `router.push()` when clicked, so the
|
|
111
|
-
navigation will not leave a history record.
|
|
112
|
-
|
|
113
|
-
```html
|
|
114
|
-
<gl-link :to="{ path: '/abc'}" replace></gl-link>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### `active-class`
|
|
118
|
-
|
|
119
|
-
- type: `string`
|
|
120
|
-
- default: `'router-link-active'` (`'nuxt-link-active'` when using Nuxt.js)
|
|
121
|
-
|
|
122
|
-
Configure the active CSS class applied when the link is active. Note the default value can also be
|
|
123
|
-
configured globally via the `linkActiveClass`
|
|
124
|
-
[router constructor option](https://router.vuejs.org/api/#linkactiveclass).
|
|
125
|
-
|
|
126
|
-
With components that support router links (have a `to` prop), you will want to set this to the class
|
|
127
|
-
`'active'` (or a space separated string that includes `'active'`) to apply Bootstrap's active
|
|
128
|
-
styling on the component when the current route matches the `to` prop.
|
|
129
|
-
|
|
130
|
-
#### `exact-active-class`
|
|
131
|
-
|
|
132
|
-
- type: `string`
|
|
133
|
-
- default: `'router-link-exact-active'` (`'nuxt-link-exact-active'` when using Nuxt.js)
|
|
134
|
-
- availability: Vue Router 2.5.0+
|
|
135
|
-
|
|
136
|
-
Configure the active CSS class applied when the link is active with exact match. Note the default
|
|
137
|
-
value can also be configured globally via the `linkExactActiveClass`
|
|
138
|
-
[router constructor option](https://router.vuejs.org/api/#linkexactactiveclass).
|
|
139
|
-
|
|
140
|
-
With components that support router links (have a `to` prop), you will want to set this to the class
|
|
141
|
-
`'active'` (or a space separated string that includes `'active'`) to apply Bootstrap's active
|
|
142
|
-
styling on the component when the current route matches the `to` prop.
|
|
143
|
-
|
|
144
|
-
## Links with `href="#"`
|
|
145
|
-
|
|
146
|
-
Typically `<a href="#">` will cause the document to scroll to the top of page when clicked.
|
|
147
|
-
`<gl-link>` addresses this by preventing the default action (scroll to top) when `href` is set to
|
|
148
|
-
`#`.
|
|
149
|
-
|
|
150
|
-
If you need scroll to top behaviour, use a standard `<a href="#">...</a>` tag.
|
|
151
|
-
|
|
152
|
-
## Link disabled state
|
|
153
|
-
|
|
154
|
-
Disable link functionality by setting the `disabled` prop to true.
|
|
155
|
-
|
|
156
|
-
```html
|
|
157
|
-
<gl-link href="#foo" disabled>Disabled Link</gl-link>
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
Disabling a link handles stopping event propagation, preventing the default action from occurring,
|
|
161
|
-
and removing the link from the document tab sequence (`tabindex="-1"`).
|
|
162
|
-
|
|
163
|
-
## Security
|
|
164
|
-
|
|
165
|
-
This component implements a few security measures to make it as safe as possible by default.
|
|
166
|
-
See [SafeLinkDirective docs] for more details.
|
|
167
|
-
|
|
168
|
-
### Linking to an unsafe URL
|
|
169
|
-
|
|
170
|
-
If you're trying to link to a location considered unsafe by the `SafeLink` directive (when rendering
|
|
171
|
-
a download link with a [Data URL] for example), you'll need to bypass the `href` attribute's
|
|
172
|
-
sanitization. This component exposes the `is-unsafe-link` prop for that purpose.
|
|
173
|
-
|
|
174
|
-
> **Warning:** Only disable URL sanitization when absolutely necessary.
|
|
175
|
-
|
|
176
|
-
```html
|
|
177
|
-
<gl-link
|
|
178
|
-
is-unsafe-link
|
|
179
|
-
download="file.txt"
|
|
180
|
-
href="data:text/plain;charset=utf-8,GitLab%20is%20awesome"
|
|
181
|
-
>
|
|
182
|
-
Download
|
|
183
|
-
</gl-link>
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
[SafeLinkDirective docs]: https://design.gitlab.com/storybook?path=/docs/directives-safe-link-directive--default
|
|
187
|
-
[Data URL]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
Modals are used to reveal critical information, show information without losing context, or when the
|
|
2
|
-
system requires a user response. Modals can also fragment a complex workflow into simpler steps and
|
|
3
|
-
should serve a single purpose dedicated to completing the user’s task.
|
|
4
|
-
|
|
5
|
-
## VModel
|
|
6
|
-
|
|
7
|
-
You can use the `v-model` directive to control the modal’s visibility. The `v-model`
|
|
8
|
-
directive interfaces with the `visible` property and the `@change` event.
|
|
9
|
-
|
|
10
|
-
## Deprecation Warning
|
|
11
|
-
|
|
12
|
-
We are deprecating the `modal-ok` and `modal-cancel` slots. We are also changing the way the
|
|
13
|
-
`modal-footer` slot content is populated. This is in order to align this component with the design
|
|
14
|
-
system.
|
|
15
|
-
|
|
16
|
-
The `modal-footer` slot should only be populated via props: `action-primary`, `action-secondary` and
|
|
17
|
-
`action-cancel`. These props allow you to handle how a primary, secondary and cancel button will
|
|
18
|
-
behave in the modals footer. The props receive an object as such:
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
{
|
|
22
|
-
text: 'Save Changes',
|
|
23
|
-
attributes: {
|
|
24
|
-
variant: 'confirm',
|
|
25
|
-
disabled: this.someState,
|
|
26
|
-
class: 'some-class',
|
|
27
|
-
...
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
A disclosure dropdown is a button that toggles a panel containing a list of actions and/or links. Use
|
|
2
|
-
[this decision tree](https://design.gitlab.com/components/dropdown-overview#which-component-should-you-use)
|
|
3
|
-
to make sure this is the right dropdown component for you.
|
|
4
|
-
|
|
5
|
-
## Basic usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<gl-disclosure-dropdown toggle-text="Actions" :items="items" />
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Icon-only disclosure dropdown
|
|
12
|
-
|
|
13
|
-
Icon-only disclosure dropdowns must have an accessible name.
|
|
14
|
-
You can provide this with the combination of `toggleText` and `textSrOnly` props.
|
|
15
|
-
|
|
16
|
-
Optionally, you can use `no-caret` to remove the caret and `category="tertiary"` to remove the border.
|
|
17
|
-
|
|
18
|
-
```html
|
|
19
|
-
<gl-disclosure-dropdown
|
|
20
|
-
icon="ellipsis_v"
|
|
21
|
-
toggle-text="Actions"
|
|
22
|
-
text-sr-only
|
|
23
|
-
category="tertiary"
|
|
24
|
-
no-caret
|
|
25
|
-
/>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Opening the disclosure dropdown
|
|
29
|
-
|
|
30
|
-
Disclosure dropdown will open on toggle button click (if it was previously closed).
|
|
31
|
-
On open, `GlDisclosureDropdown` will emit the `shown` event.
|
|
32
|
-
|
|
33
|
-
## Closing the disclosure dropdown
|
|
34
|
-
|
|
35
|
-
The disclosure dropdown is closed by any of the following:
|
|
36
|
-
|
|
37
|
-
- pressing <kbd>Esc</kbd>
|
|
38
|
-
- clicking anywhere outside the component
|
|
39
|
-
- clicking the action or link inside the dropdown
|
|
40
|
-
|
|
41
|
-
Before closing, `GlDisclosureDropdown` emits a `beforeClose` event with these properties:
|
|
42
|
-
|
|
43
|
-
1. `originalEvent` – the event that triggered closing of the dropdown
|
|
44
|
-
2. `preventDefault` – a method which will prevent closing of the dropdown
|
|
45
|
-
|
|
46
|
-
An example of using this event to prevent the dropdown from closing:
|
|
47
|
-
|
|
48
|
-
```html
|
|
49
|
-
<gl-disclosure-dropdown @beforeClose="$event.preventDefault()" />
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Note that this method will also prevent the dropdown from closing even if the trigger button is clicked.
|
|
53
|
-
|
|
54
|
-
You can use the `preventDefault` to filter out events that are causing undesired dropdown closing:
|
|
55
|
-
|
|
56
|
-
```html
|
|
57
|
-
<gl-disclosure-dropdown
|
|
58
|
-
@beforeClose="(e) => { ignoreElement.contains(e.originalEvent.target) && e.preventDefault() }"
|
|
59
|
-
/>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
After closing, `GlDisclosureDropdown` emits a `hidden` event.
|
|
63
|
-
|
|
64
|
-
### Closing the disclosure dropdown programmatically
|
|
65
|
-
|
|
66
|
-
It's possible to close the disclosure dropdown programmatically by calling the `closeAndFocus` or
|
|
67
|
-
`close` methods on the disclosure dropdown via a template ref. For example:
|
|
68
|
-
|
|
69
|
-
```js
|
|
70
|
-
this.$refs.disclosureDropdown.closeAndFocus();
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
The `closeAndFocus` method is preferred in most cases, especially when triggering it from some action
|
|
74
|
-
within the disclosure dropdown, because it will move focus back to the disclosure dropdown trigger.
|
|
75
|
-
|
|
76
|
-
The `close` method should only be used when closing the disclosure dropdown and moving the focus to
|
|
77
|
-
some other element. For example, closing the disclosure dropdown to focus a newly revealed text input.
|
|
78
|
-
|
|
79
|
-
## Setting disclosure dropdown items
|
|
80
|
-
|
|
81
|
-
Use the `items` prop to provide actions/links to the disclosure dropdown. Each
|
|
82
|
-
item can be either an item or a group. For `Item`s, provide an `href` or `to` string or
|
|
83
|
-
[`to` location descriptor object](https://v3.router.vuejs.org/api/#to) to
|
|
84
|
-
make them render as links. Otherwise, they will be buttons. Provide an `action`
|
|
85
|
-
function to items to be called when they are pressed, or, listen for the
|
|
86
|
-
`action` event on the top-level component. Both will receive the given item as
|
|
87
|
-
an argument.
|
|
88
|
-
A [validation error](https://gitlab.com/gitlab-org/gitlab-ui/-/blob/6cbff4f908b429cc01f17a4cc2868e881db1aa31/src/components/base/new_dropdowns/disclosure/utils.js#L1)
|
|
89
|
-
will be triggered if neither field is set.
|
|
90
|
-
|
|
91
|
-
Below are the expected shapes of these objects:
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
type Item = {
|
|
95
|
-
// The item text
|
|
96
|
-
text: string;
|
|
97
|
-
// href link
|
|
98
|
-
href?: string;
|
|
99
|
-
// or, a Vue router link with `to`
|
|
100
|
-
// See https://github.com/vuejs/vue-router/blob/v3.6.5/types/router.d.ts#L400-L408 for Location definition
|
|
101
|
-
to?: string | Location;
|
|
102
|
-
// Item action
|
|
103
|
-
action?: (item: Item) => void;
|
|
104
|
-
// Set of extra attributes applied directly to the element
|
|
105
|
-
extraAttrs?: Object;
|
|
106
|
-
// Additional class/classes applied to the item wrapper
|
|
107
|
-
wrapperClass?: string;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
type Group = {
|
|
111
|
-
// Name of the group, used as a header
|
|
112
|
-
name?: string;
|
|
113
|
-
// Items of the group
|
|
114
|
-
items: Array<Item>;
|
|
115
|
-
// Set of extra attributes applied directly to the element
|
|
116
|
-
extraAttrs?: Object;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
type ItemsProp = Array<Item> | Array<Group>;
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Actions/links
|
|
123
|
-
|
|
124
|
-
The `text` property is used to render the default disclosure dropdown item
|
|
125
|
-
template. If you want to render a custom template for items, use the
|
|
126
|
-
`list-item` scoped slot:
|
|
127
|
-
|
|
128
|
-
```html
|
|
129
|
-
<gl-disclosure-dropdown :items="items">
|
|
130
|
-
<template #list-item="{ item }">
|
|
131
|
-
<span class="gl-flex gl-items-center gl-justify-between">
|
|
132
|
-
{{item.text}}
|
|
133
|
-
<gl-icon v-if="item.icon" :name="item.icon" />
|
|
134
|
-
</span>
|
|
135
|
-
</template>
|
|
136
|
-
</gl-disclosure-dropdown>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Groups
|
|
140
|
-
|
|
141
|
-
Actions/links can be contained within groups. A group can have a `name`
|
|
142
|
-
property, which will be used as the group header if present.
|
|
143
|
-
It also has a required property `items` that must be an array of links/actions.
|
|
144
|
-
|
|
145
|
-
Groups can be at most one level deep: a group can only contain actions/links.
|
|
146
|
-
Items and groups _cannot_ be siblings. Either all items are actions/links,
|
|
147
|
-
or they are all groups.
|
|
148
|
-
|
|
149
|
-
To render custom group labels, use the `group-label` scoped slot:
|
|
150
|
-
|
|
151
|
-
```html
|
|
152
|
-
<gl-disclosure-dropdown :items="groups">
|
|
153
|
-
<template #group-label="{ group }">
|
|
154
|
-
{{ group.name }} <gl-badge size="sm">{{ group.items.length }}</gl-badge>
|
|
155
|
-
</template>
|
|
156
|
-
</gl-disclosure-dropdown>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
To draw a horizontal line that separates two groups, set the `bordered` property.
|
|
160
|
-
By default, the border appears above the group. You can change the border position
|
|
161
|
-
using the `border-position` property:
|
|
162
|
-
|
|
163
|
-
```html
|
|
164
|
-
<gl-disclosure-dropdown>
|
|
165
|
-
<gl-disclosure-dropdown-group bordered border-position="bottom" :group="group" />
|
|
166
|
-
</gl-disclosure-dropdown>
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Miscellaneous content
|
|
170
|
-
|
|
171
|
-
Besides default components, disclosure dropdown can render miscellaneous content inside it.
|
|
172
|
-
In this case the user is responsible for handling all events and navigation inside the disclosure.
|
|
173
|
-
|
|
174
|
-
### Dealing with long option texts
|
|
175
|
-
|
|
176
|
-
- Some options might have long non-wrapping text that would overflow the dropdown maximum width. In
|
|
177
|
-
such cases, it's recommended to override the `#list-item` slot and to truncate the option text using
|
|
178
|
-
`GlTruncate`.
|
|
179
|
-
- If the toggle text reflects the selected option text, it might be necessary to truncate
|
|
180
|
-
it too by overriding the `#toggle` slot.
|
|
181
|
-
|
|
182
|
-
## Split dropdown
|
|
183
|
-
|
|
184
|
-
See [button group documentation](/docs/base-button-group--docs#split-dropdowns).
|