@gitlab/ui 115.9.0 → 115.9.1

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.
Files changed (72) hide show
  1. package/dist/components/base/avatar_link/avatar_link.js +1 -1
  2. package/dist/components/base/avatars_inline/avatars_inline.js +1 -1
  3. package/dist/index.css +1 -1
  4. package/dist/index.css.map +1 -1
  5. package/dist/tailwind.css +1 -1
  6. package/dist/tailwind.css.map +1 -1
  7. package/package.json +10 -10
  8. package/src/components/base/avatar_link/avatar_link.vue +1 -1
  9. package/src/components/base/avatars_inline/avatars_inline.vue +1 -1
  10. package/src/components/base/markdown/markdown_typescale_demo.html +41 -71
  11. package/src/scss/variables.scss +1 -1
  12. package/src/components/base/accordion/accordion.md +0 -3
  13. package/src/components/base/accordion/accordion_item.md +0 -3
  14. package/src/components/base/alert/alert.md +0 -35
  15. package/src/components/base/animated_icon/animated_icon.md +0 -4
  16. package/src/components/base/avatar/avatar.md +0 -1
  17. package/src/components/base/avatar_labeled/avatar_labeled.md +0 -20
  18. package/src/components/base/avatar_link/avatar_link.md +0 -33
  19. package/src/components/base/avatars_inline/avatars_inline.md +0 -38
  20. package/src/components/base/badge/badge.md +0 -30
  21. package/src/components/base/banner/banner.md +0 -35
  22. package/src/components/base/breadcrumb/breadcrumb.md +0 -52
  23. package/src/components/base/broadcast_message/broadcast_message.md +0 -25
  24. package/src/components/base/button/button.md +0 -119
  25. package/src/components/base/button_group/button_group.md +0 -44
  26. package/src/components/base/card/card.md +0 -4
  27. package/src/components/base/collapse/collapse.md +0 -64
  28. package/src/components/base/datepicker/datepicker.md +0 -8
  29. package/src/components/base/daterange_picker/daterange_picker.md +0 -32
  30. package/src/components/base/drawer/drawer.md +0 -17
  31. package/src/components/base/dropdown/dropdown.md +0 -72
  32. package/src/components/base/dropdown/dropdown_item.md +0 -2
  33. package/src/components/base/dropdown/dropdown_section_header.md +0 -7
  34. package/src/components/base/dropdown/dropdown_text.md +0 -7
  35. package/src/components/base/filtered_search/filtered_search.md +0 -76
  36. package/src/components/base/filtered_search/filtered_search_suggestion.md +0 -15
  37. package/src/components/base/filtered_search/filtered_search_suggestion_list.md +0 -13
  38. package/src/components/base/filtered_search/filtered_search_term.md +0 -7
  39. package/src/components/base/filtered_search/filtered_search_token.md +0 -23
  40. package/src/components/base/filtered_search/filtered_search_token_segment.md +0 -14
  41. package/src/components/base/form/form_checkbox/form_checkbox.md +0 -6
  42. package/src/components/base/form/form_input/form_input.md +0 -306
  43. package/src/components/base/form/form_radio/form_radio.md +0 -23
  44. package/src/components/base/form/form_radio_group/form_radio_group.md +0 -63
  45. package/src/components/base/form/form_select/form_select.md +0 -1
  46. package/src/components/base/form/form_textarea/form_textarea.md +0 -3
  47. package/src/components/base/icon/icon.md +0 -27
  48. package/src/components/base/infinite_scroll/infinite_scroll.md +0 -104
  49. package/src/components/base/keyset_pagination/keyset_pagination.md +0 -49
  50. package/src/components/base/label/label.md +0 -15
  51. package/src/components/base/link/link.md +0 -187
  52. package/src/components/base/loading_icon/loading_icon.md +0 -3
  53. package/src/components/base/modal/modal.md +0 -30
  54. package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.md +0 -184
  55. package/src/components/base/new_dropdowns/listbox/listbox.md +0 -195
  56. package/src/components/base/pagination/pagination.md +0 -45
  57. package/src/components/base/path/path.md +0 -41
  58. package/src/components/base/progress_bar/progress_bar.md +0 -25
  59. package/src/components/base/search_box_by_click/search_box_by_click.md +0 -1
  60. package/src/components/base/search_box_by_type/search_box_by_type.md +0 -1
  61. package/src/components/base/segmented_control/segmented_control.md +0 -26
  62. package/src/components/base/skeleton_loader/skeleton_loader.md +0 -70
  63. package/src/components/base/sorting/sorting.md +0 -80
  64. package/src/components/base/table/table.md +0 -71
  65. package/src/components/base/table_lite/table_lite.md +0 -68
  66. package/src/components/base/tabs/tabs/tabs.md +0 -80
  67. package/src/components/base/toast/toast.md +0 -48
  68. package/src/components/base/toggle/toggle.md +0 -4
  69. package/src/components/base/token/token.md +0 -12
  70. package/src/components/base/tooltip/tooltip.md +0 -52
  71. package/src/scss/typescale/typeface_demo.html +0 -70
  72. package/src/scss/typescale/typescale.md +0 -81
@@ -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,3 +0,0 @@
1
- ## Under the hood
2
-
3
- Loading icon uses pure css to render a spinner or an ellipsis loader.
@@ -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).
@@ -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.