@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,195 +0,0 @@
|
|
|
1
|
-
A collapsible listbox is a button that toggles a panel containing a list of options.
|
|
2
|
-
It supports single and multi-selection.
|
|
3
|
-
|
|
4
|
-
**Single-select:** By default, selecting an option will update the toggle label with the choice.
|
|
5
|
-
But the custom toggle text can be provided.
|
|
6
|
-
When option is selected, the dropdown will be closed and focus set on the toggle button.
|
|
7
|
-
|
|
8
|
-
**Multi-select:** Selecting an option will not update the toggle, but it can be customized
|
|
9
|
-
providing `toggleText` property. Also, selecting or deselecting an item won't close the dropdown.
|
|
10
|
-
|
|
11
|
-
## Icon-only listbox
|
|
12
|
-
|
|
13
|
-
Icon-only listboxes must have an accessible name.
|
|
14
|
-
You can provide this with the combination of `toggleText` and `textSrOnly` props.
|
|
15
|
-
For single-select listboxes `toggleText` will be set to the selected item's `text` property value
|
|
16
|
-
by default.
|
|
17
|
-
|
|
18
|
-
Optionally, you can use `no-caret` to remove the caret and `category="tertiary"` to remove the border.
|
|
19
|
-
|
|
20
|
-
```html
|
|
21
|
-
<gl-collapsible-listbox
|
|
22
|
-
icon="ellipsis_v"
|
|
23
|
-
toggle-text="More options"
|
|
24
|
-
text-sr-only
|
|
25
|
-
category="tertiary"
|
|
26
|
-
no-caret
|
|
27
|
-
>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Labeling the listbox
|
|
31
|
-
|
|
32
|
-
The `toggleId` prop sets the `id` of the toggle element. This is useful for associating a label
|
|
33
|
-
element with the toggle.
|
|
34
|
-
|
|
35
|
-
```html
|
|
36
|
-
<gl-form-group label="Department" label-for="department-picker">
|
|
37
|
-
<gl-collapsible-listbox
|
|
38
|
-
toggle-id="department-picker"
|
|
39
|
-
:items="departments"
|
|
40
|
-
/>
|
|
41
|
-
</gl-form-group>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Prefer using `toggleId` over `toggleAriaLabelledBy`, as it is more similar to how
|
|
45
|
-
label elements are associated with other form components.
|
|
46
|
-
|
|
47
|
-
**Note:** Do not use the `toggleId` prop in conjunction with the `toggle` slot.
|
|
48
|
-
Instead, set the `id` directly on the custom toggle element, and pass the same
|
|
49
|
-
value to `GlFormGroup`'s `labelFor` prop.
|
|
50
|
-
|
|
51
|
-
## Opening the listbox
|
|
52
|
-
|
|
53
|
-
Listbox will open on toggle button click (if it was previously closed).
|
|
54
|
-
On open, `GlCollapsibleListbox` will emit the `shown` event.
|
|
55
|
-
|
|
56
|
-
## Closing the listbox
|
|
57
|
-
|
|
58
|
-
The listbox is closed by any of the following:
|
|
59
|
-
|
|
60
|
-
- pressing <kbd>Esc</kbd>
|
|
61
|
-
- clicking anywhere outside the component
|
|
62
|
-
- selecting an option in single-select mode
|
|
63
|
-
|
|
64
|
-
After closing, `GlCollapsibleListbox` emits a `hidden` event.
|
|
65
|
-
|
|
66
|
-
### Closing the listbox programmatically
|
|
67
|
-
|
|
68
|
-
It's possible to close the listbox programmatically by calling the `closeAndFocus` or `close` methods
|
|
69
|
-
on the listbox via a template ref. For example:
|
|
70
|
-
|
|
71
|
-
```js
|
|
72
|
-
this.$refs.listbox.closeAndFocus()
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
The `closeAndFocus` method is preferred in most cases, especially when triggering it from some action
|
|
76
|
-
within the listbox, because it will move focus back to the listbox trigger.
|
|
77
|
-
|
|
78
|
-
The `close` method should only be used when closing the listbox and moving the focus to some other element.
|
|
79
|
-
For example, closing the listbox to focus a newly revealed text input.
|
|
80
|
-
|
|
81
|
-
## Selecting items
|
|
82
|
-
|
|
83
|
-
Set the `v-model` on the listbox to have 2-way data binding for the selected items in the listbox.
|
|
84
|
-
Alternatively, you can set `selected` property to the array of selected items
|
|
85
|
-
`value` properties (for multi-select) or to the selected item `value` property for a single-select.
|
|
86
|
-
On selection the listbox will emit the `select` event with the selected values.
|
|
87
|
-
|
|
88
|
-
## Resetting the selection
|
|
89
|
-
|
|
90
|
-
`GlCollapsibleListbox` can render a reset button if the `headerText` and
|
|
91
|
-
`resetButtonLabel` props are provided.
|
|
92
|
-
When clicking on the reset button, a `reset` event is emitted. It is the consumer's responsibility
|
|
93
|
-
to listen to that event and to update the model as needed.
|
|
94
|
-
|
|
95
|
-
## Setting listbox options
|
|
96
|
-
|
|
97
|
-
Use the `items` prop to provide options to the listbox. Each item can be
|
|
98
|
-
either an option or a group. Below are the expected shapes of these
|
|
99
|
-
objects:
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
type Option = {
|
|
103
|
-
value: string | number | null
|
|
104
|
-
text?: string
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
type Group = {
|
|
108
|
-
text: string
|
|
109
|
-
options: Array<Option>
|
|
110
|
-
textSrOnly?: boolean
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
type ItemsProp = Array<Option> | Array<Group>
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Options
|
|
117
|
-
|
|
118
|
-
The `value` property of options must be unique across all options
|
|
119
|
-
provided to the listbox, as it's used as a primary key.
|
|
120
|
-
|
|
121
|
-
The optional `text` property is used to render the default listbox item
|
|
122
|
-
template. If you want to render a custom template for items, use the
|
|
123
|
-
`list-item` scoped slot:
|
|
124
|
-
|
|
125
|
-
```html
|
|
126
|
-
<gl-collapsible-listbox :items="items">
|
|
127
|
-
<template #list-item="{ item }">
|
|
128
|
-
<span class="gl-flex gl-items-center">
|
|
129
|
-
<gl-avatar :size="32" class-="gl-mr-3"/>
|
|
130
|
-
<span class="gl-flex gl-flex-col">
|
|
131
|
-
<span class="gl-font-bold gl-whitespace-nowrap">{{ item.text }}</span>
|
|
132
|
-
<span class="gl-text-subtle"> {{ item.secondaryText }}</span>
|
|
133
|
-
</span>
|
|
134
|
-
</span>
|
|
135
|
-
</template>
|
|
136
|
-
</gl-collapsible-listbox>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Groups
|
|
140
|
-
|
|
141
|
-
Options can be contained within groups. A group has a required `text`
|
|
142
|
-
property, which must be unique across all groups within the listbox, as
|
|
143
|
-
it's used as a primary key. It also has a required property `items` that
|
|
144
|
-
must be an array of options. Optionally, you can hide the group heading
|
|
145
|
-
by setting `textSrOnly` to `true`. In this case the `text` is only used
|
|
146
|
-
for accessibility purposes.
|
|
147
|
-
|
|
148
|
-
Groups can be at most one level deep: a group can only contain options.
|
|
149
|
-
Options and groups _cannot_ be siblings. Either all items are options,
|
|
150
|
-
or they are all groups.
|
|
151
|
-
|
|
152
|
-
To render custom group labels, use the `group-label` scoped slot:
|
|
153
|
-
|
|
154
|
-
```html
|
|
155
|
-
<gl-collapsible-listbox :items="groups">
|
|
156
|
-
<template #group-label="{ group }">
|
|
157
|
-
{{ group.text }} <gl-badge size="sm">{{ group.options.length }}</gl-badge>
|
|
158
|
-
</template>
|
|
159
|
-
</gl-collapsible-listbox>
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Dealing with long option texts
|
|
163
|
-
|
|
164
|
-
- Some options might have long non-wrapping text that would overflow the dropdown maximum width. In
|
|
165
|
-
such cases, it's recommended to override the `#list-item` slot and to truncate the option text using
|
|
166
|
-
`GlTruncate`.
|
|
167
|
-
- If the toggle text reflects the selected option text, it might be necessary to truncate
|
|
168
|
-
it too by overriding the `#toggle` slot.
|
|
169
|
-
|
|
170
|
-
## Search
|
|
171
|
-
|
|
172
|
-
To filter out items by search query set `searchable` property to `true`.
|
|
173
|
-
Listbox will render the search field and will emit `search` event with the `searchQuery` value.
|
|
174
|
-
Performing the search is the responsibility of the listbox's consumer component.
|
|
175
|
-
When performing search set `searching` prop to `true` - this will render the loader
|
|
176
|
-
while search is in progress instead of the list of items.
|
|
177
|
-
To update content of the listbox, toggle the `searching` property
|
|
178
|
-
and update the `items` property with a new array. Be sure to debounce (or
|
|
179
|
-
similar) the `search` event handler to avoid rendering stale results.
|
|
180
|
-
To improve the accessibility, provide the `search-summary-sr-only` scoped slot
|
|
181
|
-
with a number of found search results text, alternately, you can pass a plural translate function.
|
|
182
|
-
An example of the plural translate function can be found [the GitLab Docs internationalization section](https://docs.gitlab.com/ee/development/i18n/externalization.html#plurals)
|
|
183
|
-
Screen reader will announce this text when the list is updated.
|
|
184
|
-
|
|
185
|
-
```html
|
|
186
|
-
<gl-collapsible-listbox :items="items" searchable>
|
|
187
|
-
<template #search-summary-sr-only>
|
|
188
|
-
5 users found
|
|
189
|
-
</template>
|
|
190
|
-
</gl-collapsible-listbox>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Split dropdown
|
|
194
|
-
|
|
195
|
-
See [button group documentation](/docs/base-button-group--docs#split-dropdowns).
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
## Current page
|
|
2
|
-
|
|
3
|
-
The current page's value should be bound using `v-model`, e.g.:
|
|
4
|
-
|
|
5
|
-
```html
|
|
6
|
-
<script>
|
|
7
|
-
export default {
|
|
8
|
-
data: () => ({
|
|
9
|
-
page: 2,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<template>
|
|
15
|
-
<gl-pagination v-model="page" :per-page="10" :total-items="100" />
|
|
16
|
-
</template>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Limits
|
|
20
|
-
|
|
21
|
-
The `limits` prop is used to define pagination link limits based on Bootstrap's breakpoint sizes.
|
|
22
|
-
It is strongly recommended you provide a 'default' property, even if you have accounted for all
|
|
23
|
-
breakpoint sizes. While unlikely, it is possible breakpoints could change, thus, a default property
|
|
24
|
-
ensures a graceful fallback.
|
|
25
|
-
|
|
26
|
-
Here is `limits` default value:
|
|
27
|
-
|
|
28
|
-
```js
|
|
29
|
-
{
|
|
30
|
-
xs: 0,
|
|
31
|
-
sm: 3,
|
|
32
|
-
md: 9,
|
|
33
|
-
default: 9,
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
> Note: The component will not render any UI if the total items available for display is less than
|
|
38
|
-
> the max items per page.
|
|
39
|
-
|
|
40
|
-
## Internet Explorer 11
|
|
41
|
-
|
|
42
|
-
This component makes use of the
|
|
43
|
-
[`Number.isInteger` method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger),
|
|
44
|
-
which is not supported in IE11, make sure it's being polyfilled when using the component.
|
|
45
|
-
[`core-js`](https://github.com/zloirock/core-js) incudes the appropriate polyfill for this.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
## Usage
|
|
2
|
-
|
|
3
|
-
Paths are horizontal process flows composed of a series of "stages".
|
|
4
|
-
Like tabs, paths let users focus in on specific content at each stage
|
|
5
|
-
whilst still keeping all the other stages in view. Only one stage can
|
|
6
|
-
be active at a given time.
|
|
7
|
-
|
|
8
|
-
### Implemetation
|
|
9
|
-
|
|
10
|
-
The component should be initialized with an array of data objects. By
|
|
11
|
-
default, the first item in the array will be selected. This can be
|
|
12
|
-
overridden by passing in an object with the selected property set to
|
|
13
|
-
true.
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
items: [
|
|
17
|
-
{
|
|
18
|
-
title: 'First',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
title: 'Second',
|
|
22
|
-
selected: true
|
|
23
|
-
},
|
|
24
|
-
...
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Once an item has been selected the `selected` event will be emitted.
|
|
28
|
-
The emitted event will include the entire object at the selected index.
|
|
29
|
-
|
|
30
|
-
#### Customization
|
|
31
|
-
|
|
32
|
-
Additional attributes can be configured via the `items` object. Currently
|
|
33
|
-
support for `metric` and `icon` are provided. Please see the individual
|
|
34
|
-
examples for further information on these.
|
|
35
|
-
|
|
36
|
-
### Additional information
|
|
37
|
-
|
|
38
|
-
A `backgroundColor` property can be specified when using this component
|
|
39
|
-
on different colored backgrounds.
|
|
40
|
-
|
|
41
|
-
This component supports various themes and is mobile responsive.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
The progress bar component can be used to show an amount of progress.
|
|
2
|
-
It comes in 4 variants and supports setting a custom maximum and height.
|
|
3
|
-
|
|
4
|
-
## Value
|
|
5
|
-
|
|
6
|
-
The `value` prop can be a Number or String. If not given, it will default to `0`.
|
|
7
|
-
|
|
8
|
-
## Variants
|
|
9
|
-
|
|
10
|
-
The following variants are available:
|
|
11
|
-
|
|
12
|
-
1. 'primary' (default)
|
|
13
|
-
2. 'success'
|
|
14
|
-
3. 'warning'
|
|
15
|
-
4. 'danger'
|
|
16
|
-
|
|
17
|
-
## Maximum
|
|
18
|
-
|
|
19
|
-
A custom maximum can be set with the `max` prop. If not given, it will default to `100`.
|
|
20
|
-
|
|
21
|
-
## Width and Height
|
|
22
|
-
|
|
23
|
-
The `GlProgressBar` will always expand to the maximum width of its parent container.
|
|
24
|
-
The height can be controlled with the `height` prop. The value should be a standard
|
|
25
|
-
CSS dimension (`px`, `rem`, `em`, etc.) and given as a String, e.g. `'20px'`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Provides a clearable text input with loading state to be used for [search](https://design.gitlab.com/components/search).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Provides a clearable text input with loading state to be used for [search](https://design.gitlab.com/components/search).
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
A customizable button group that displays a set of equal options, where only one
|
|
2
|
-
option can be active at a time. This component includes the ability to disable
|
|
3
|
-
specific options and dynamically modify button content using slots.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Displays a group of selectable buttons.
|
|
8
|
-
- Allows only one active selection at a time.
|
|
9
|
-
- Supports content customization through the button-content slot.
|
|
10
|
-
- Options can be disabled individually.
|
|
11
|
-
|
|
12
|
-
## Props Validation
|
|
13
|
-
|
|
14
|
-
The `options` prop is validated against a specific structure to ensure consistent
|
|
15
|
-
data. Each option must include:
|
|
16
|
-
|
|
17
|
-
- `value`: A `string`, `number`, or `boolean` to identify the option.
|
|
18
|
-
- `disabled`: A `boolean` (or `undefined`) indicating whether the option is disabled.
|
|
19
|
-
|
|
20
|
-
Optionally it can include:
|
|
21
|
-
|
|
22
|
-
- `text`: A `string` which gets displayed in the slot content.
|
|
23
|
-
|
|
24
|
-
## Notes
|
|
25
|
-
|
|
26
|
-
- Ensure each value is unique within the options array for consistent behavior.
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
Skeleton loaders are to be used when pages or sections can be progressively populated with content,
|
|
2
|
-
such as text and images, as they become available. Generally speaking the first batch of content
|
|
3
|
-
will be the lightest to load and is followed by secondary and tertiary content batches. Each loading
|
|
4
|
-
step will add in more detail to the page until no skeleton loaders are present anymore. Content
|
|
5
|
-
should replace skeleton objects immediately when the data is available.
|
|
6
|
-
|
|
7
|
-
The skeleton loader component accepts shapes which in return will create a skeleton state with a
|
|
8
|
-
loading animation. Any skeleton state components should be created with
|
|
9
|
-
`<gl-skeleton-loader></gl-skeleton-loader>`. If no shape is passed via the slot the default skeleton
|
|
10
|
-
will be used. See "Default" and "Default With Custom Props" examples.
|
|
11
|
-
|
|
12
|
-
## The `.gl-animate-skeleton-loader` class
|
|
13
|
-
|
|
14
|
-
Skeleton loaders can also be composed with a `.gl-animate-skeleton-loader`
|
|
15
|
-
CSS class. This CSS-based approach is easier to make responsive and match mocked elements.
|
|
16
|
-
Feel free to use this approach if it suits your use case and please leave your
|
|
17
|
-
feedback in this [Feedback for css-based skeleton loading
|
|
18
|
-
indicator](https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2319) issue.
|
|
19
|
-
To improve developer experience and simplify matching Pajamas styles we're considering
|
|
20
|
-
several improvements in the future, including adding more CSS util classes for
|
|
21
|
-
this animation, or creating a dedicated component. Here is an example of how
|
|
22
|
-
you could replicate the default `<gl-skeleton-loader />` behavior with the
|
|
23
|
-
CSS-based approach:
|
|
24
|
-
|
|
25
|
-
```html
|
|
26
|
-
<div>
|
|
27
|
-
<div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-3 !gl-max-w-20"></div>
|
|
28
|
-
<div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-3 !gl-max-w-30"></div>
|
|
29
|
-
<div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-3 !gl-max-w-26"></div>
|
|
30
|
-
</div>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**USAGE NOTES:** if you're using `gl-max-w-xx` you'll need to add
|
|
34
|
-
important (e.g. `!gl-max-w-20`). This is because `.gl-animate-skeleton-loader` already
|
|
35
|
-
has a `max-width` statement, and we need to override it. You can override it
|
|
36
|
-
only with lower numbers. Width rules (`gl-w-xx`) don't need an override, you
|
|
37
|
-
can use them as-is. If you want to "synchronize" two elements next to each
|
|
38
|
-
other, try adding `animation-delay` to offset elements.
|
|
39
|
-
|
|
40
|
-
More complex example (with different shapes and an animation delay for offset elements):
|
|
41
|
-
|
|
42
|
-
```html
|
|
43
|
-
<div class="gl-display-flex gl-flex-direction-column gl-gap-2 gl-w-30">
|
|
44
|
-
<div class="gl-animate-skeleton-loader gl-h-8 gl-rounded-base gl-mb-4"></div>
|
|
45
|
-
<div class="gl-display-flex gl-flex-direction-row gl-gap-2">
|
|
46
|
-
<div class="gl-animate-skeleton-loader gl-h-8 gl-w-8 gl-rounded-full"></div>
|
|
47
|
-
<div class="gl-flex-grow-1" style="animation-delay: 100ms">
|
|
48
|
-
<div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-2"></div>
|
|
49
|
-
<div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-2"></div>
|
|
50
|
-
<div class="gl-animate-skeleton-loader gl-display-inline-block gl-h-4 gl-w-10 gl-rounded-base gl-my-2"></div>
|
|
51
|
-
<div
|
|
52
|
-
class="gl-animate-skeleton-loader gl-display-inline-block gl-h-4 gl-w-10 gl-rounded-base gl-my-2"
|
|
53
|
-
style="animation-delay: 250ms"></div>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Progressive Loading
|
|
60
|
-
|
|
61
|
-
Determine if progressive loading is available, if it is break apart the skeleton to load data as it
|
|
62
|
-
becomes readily available. If progessive loading is not available, replace the entire skeleton when
|
|
63
|
-
the data is available.
|
|
64
|
-
|
|
65
|
-
## Under the hood
|
|
66
|
-
|
|
67
|
-
Skeleton Loader is a port of [vue-content-loader](https://github.com/egoist/vue-content-loader).
|
|
68
|
-
Some changes have been made to the code to better suit our codebase, such as removing props and
|
|
69
|
-
refactoring into a SFC. Please take a look at their documentation and a useful [UI tool](http://danilowoz.com/create-vue-content-loader/)
|
|
70
|
-
for seeing the code output for `svg` shapes.
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
The sorting component allows the user to select the field on which they would like to sort a list
|
|
2
|
-
and whether to sort in ascending or descending order.
|
|
3
|
-
|
|
4
|
-
Provide a list of sort options via the `sortOptions` prop with this structure:
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
type sortOptionsProp = Array<{
|
|
8
|
-
value: string
|
|
9
|
-
text: string
|
|
10
|
-
}>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The `value` should be a unique primitive value, and `text` is the user-facing
|
|
14
|
-
string for that option.
|
|
15
|
-
|
|
16
|
-
Set the currently selected sort option by passing a value to the `sortBy` prop.
|
|
17
|
-
This should equal one of the `sortOptions` values. The selected sort option is
|
|
18
|
-
rendered with a check mark next to it in the dropdown menu.
|
|
19
|
-
|
|
20
|
-
When the user changes the selected sort option, a `sortByChange` event is
|
|
21
|
-
emitted, with the `value` of the option as the only payload.
|
|
22
|
-
|
|
23
|
-
The text of the dropdown trigger button is the `text` of the selected sort
|
|
24
|
-
option. Pass a string to the `text` prop to override this behavior.
|
|
25
|
-
|
|
26
|
-
When the user clicks on the sort direction button, a `sortDirectionChange`
|
|
27
|
-
event is emitted, with a boolean value as its only payload. If the payload is
|
|
28
|
-
`true`, the new order is ascending; otherwise it's descending.
|
|
29
|
-
|
|
30
|
-
A complete implementation example might look like:
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<template>
|
|
34
|
-
<gl-sorting
|
|
35
|
-
:sort-options="sortOptions"
|
|
36
|
-
:sort-by="sortBy"
|
|
37
|
-
:is-ascending="isAscending"
|
|
38
|
-
@sortByChange="onSortByChange"
|
|
39
|
-
@sortDirectionChange="onDirectionChange"
|
|
40
|
-
/>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<script>
|
|
44
|
-
import { GlSorting } from '@gitlab/ui';
|
|
45
|
-
|
|
46
|
-
export default {
|
|
47
|
-
components: {
|
|
48
|
-
GlSorting,
|
|
49
|
-
},
|
|
50
|
-
data() {
|
|
51
|
-
const sortOptions = [{
|
|
52
|
-
value: 'name',
|
|
53
|
-
text: 'Name',
|
|
54
|
-
}, {
|
|
55
|
-
value: 'date',
|
|
56
|
-
text: 'Date',
|
|
57
|
-
}];
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
isAscending: false,
|
|
61
|
-
sortBy: sortOptions[0].value,
|
|
62
|
-
sortOptions,
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
methods: {
|
|
66
|
-
onSortByChange(value) {
|
|
67
|
-
this.sortBy = value;
|
|
68
|
-
this.sortMyData(this.sortBy, this.isAscending);
|
|
69
|
-
},
|
|
70
|
-
onDirectionChange(isAscending) {
|
|
71
|
-
this.isAscending = isAscending;
|
|
72
|
-
this.sortMyData(this.sortBy, this.isAscending);
|
|
73
|
-
},
|
|
74
|
-
sortMyData(sortBy, isAscending) {
|
|
75
|
-
// Use sortBy and direction to sort your data
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
</script>
|
|
80
|
-
```
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
## Usage
|
|
2
|
-
|
|
3
|
-
The `gl-table` component wraps BootstrapVue `b-table` component. `b-table` provides a variety of
|
|
4
|
-
slots for custom data rendering. You can learn more about them in the
|
|
5
|
-
[component documentation](https://bootstrap-vue.org/docs/components/table).
|
|
6
|
-
When using the component, pass in the `fields` prop as part of the `$options`, and give each table
|
|
7
|
-
data and table head its own styles if necessary.
|
|
8
|
-
|
|
9
|
-
## Internationalization
|
|
10
|
-
|
|
11
|
-
To ensure we internationalize field labels, always pass an array of objects for the `fields` prop,
|
|
12
|
-
like mentioned in the implementation example.
|
|
13
|
-
|
|
14
|
-
[Learn more about the `field` prop](https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com/-/blob/2e88af62966265cb725ca3f65f4b175e2494734b/packages/gitlab-ui/src/vendor/bootstrap-vue/src/components/table/README.md#L137).
|
|
15
|
-
|
|
16
|
-
## Header text alignment
|
|
17
|
-
|
|
18
|
-
To align a given `TH` element's text to the right, set the `thAlignRight` property to `true` in
|
|
19
|
-
the fields definition. This will ensure that proper styling is applied, including when the column
|
|
20
|
-
is sortable.
|
|
21
|
-
|
|
22
|
-
```js
|
|
23
|
-
const fields = [
|
|
24
|
-
{
|
|
25
|
-
key: "column_one",
|
|
26
|
-
label: __("First column"),
|
|
27
|
-
sortable: true,
|
|
28
|
-
thAlignRight: true,
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Use `GlTableLite` when possible
|
|
34
|
-
|
|
35
|
-
If you don't need all the features of `GlTable`, like filtering, sorting, or
|
|
36
|
-
pagination, use `GlTableLite` which offers a subset of `GlTable` features.
|
|
37
|
-
|
|
38
|
-
## Implementation Example
|
|
39
|
-
|
|
40
|
-
```html
|
|
41
|
-
<script>
|
|
42
|
-
export default {
|
|
43
|
-
fields: [
|
|
44
|
-
{
|
|
45
|
-
key: 'column_one',
|
|
46
|
-
label: __('First column'),
|
|
47
|
-
thClass: 'w-60p',
|
|
48
|
-
tdClass: 'table-col d-flex'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: 'col_2',
|
|
52
|
-
label: __('Second column'),
|
|
53
|
-
thClass: 'w-15p',
|
|
54
|
-
tdClass: 'table-col d-flex'
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
</script>
|
|
59
|
-
<template>
|
|
60
|
-
<gl-table :items="items" :fields="$options.fields">
|
|
61
|
-
<template #head(column_one)>
|
|
62
|
-
<div>First column</div>
|
|
63
|
-
<!-- This is the column head for the first object in `fields` -->
|
|
64
|
-
</template>
|
|
65
|
-
|
|
66
|
-
<template #cell(column_one)>
|
|
67
|
-
This is the template for column data belonging to the first object
|
|
68
|
-
</template>
|
|
69
|
-
</gl-table>
|
|
70
|
-
</template>
|
|
71
|
-
```
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
## Usage
|
|
2
|
-
|
|
3
|
-
The `GlTableLite` component wraps BootstrapVue `BTableLite` component.
|
|
4
|
-
`BTableLite` provides a variety of slots for custom data rendering. You can learn
|
|
5
|
-
more about them in the
|
|
6
|
-
[component documentation](https://bootstrap-vue.org/docs/components/table#light-weight-tables).
|
|
7
|
-
|
|
8
|
-
## `GlTable` vs. `GlTableLite`
|
|
9
|
-
|
|
10
|
-
`GlTableLite` adds less payload to the pagebundle than `GlTable`.
|
|
11
|
-
When possible `GlTableLite` should be preferred over `GlTable`.
|
|
12
|
-
|
|
13
|
-
The `GlTableLite` component provides all of the styling and formatting features of
|
|
14
|
-
`GlTable` (including row details and stacked support), while excluding the following features:
|
|
15
|
-
|
|
16
|
-
- Filtering
|
|
17
|
-
- Sorting
|
|
18
|
-
- Pagination
|
|
19
|
-
- Items provider support
|
|
20
|
-
- Selectable rows
|
|
21
|
-
- Busy table state and styling
|
|
22
|
-
- Fixed top and bottom rows
|
|
23
|
-
- Empty row support
|
|
24
|
-
|
|
25
|
-
## Internationalization
|
|
26
|
-
|
|
27
|
-
To ensure we internationalize field labels, always pass an array of objects for the `fields` prop,
|
|
28
|
-
like mentioned in the implementation example.
|
|
29
|
-
|
|
30
|
-
[Learn more about the `field` prop](https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com/-/blob/2e88af62966265cb725ca3f65f4b175e2494734b/packages/gitlab-ui/src/vendor/bootstrap-vue/src/components/table/README.md#L137).
|
|
31
|
-
|
|
32
|
-
## Implementation example
|
|
33
|
-
|
|
34
|
-
```html
|
|
35
|
-
<script>
|
|
36
|
-
export default {
|
|
37
|
-
fields: [
|
|
38
|
-
{
|
|
39
|
-
key: 'column_one',
|
|
40
|
-
label: __('First column'),
|
|
41
|
-
thClass: 'w-60p',
|
|
42
|
-
tdClass: 'table-col d-flex'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
key: 'col_2',
|
|
46
|
-
label: __('Second column'),
|
|
47
|
-
thClass: 'w-15p',
|
|
48
|
-
tdClass: 'table-col d-flex'
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
</script>
|
|
53
|
-
<template>
|
|
54
|
-
<gl-table-lite
|
|
55
|
-
:items="items"
|
|
56
|
-
:fields="$options.fields"
|
|
57
|
-
>
|
|
58
|
-
<template #head(column_one)>
|
|
59
|
-
<div>First column</div><!-- This is the column head for the first object in `fields` -->
|
|
60
|
-
</template>
|
|
61
|
-
|
|
62
|
-
<template #cell(column_one)>
|
|
63
|
-
This is the template for column data belonging to the first object
|
|
64
|
-
</template>
|
|
65
|
-
|
|
66
|
-
</gl-table-lite>
|
|
67
|
-
</template>
|
|
68
|
-
```
|