@gitlab/ui 116.0.0 → 117.0.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.
- package/dist/components/index.js +0 -3
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +4 -5
- package/src/components/index.js +0 -3
- package/src/scss/components.scss +0 -1
- package/src/scss/typography.scss +4 -0
- package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -79
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -138
- package/dist/components/base/form/form_checkbox_tree/models/constants.js +0 -12
- package/dist/components/base/form/form_checkbox_tree/models/node.js +0 -51
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +0 -200
- package/dist/components/base/nav/nav.js +0 -132
- package/dist/components/base/nav/nav_item.js +0 -125
- package/src/components/base/form/form_checkbox_tree/checkbox_tree_node.vue +0 -58
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.md +0 -73
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.vue +0 -116
- package/src/components/base/form/form_checkbox_tree/models/constants.js +0 -12
- package/src/components/base/form/form_checkbox_tree/models/node.js +0 -48
- package/src/components/base/form/form_checkbox_tree/models/tree.js +0 -186
- package/src/components/base/nav/nav.md +0 -184
- package/src/components/base/nav/nav.scss +0 -7
- package/src/components/base/nav/nav.vue +0 -70
- package/src/components/base/nav/nav_item.vue +0 -109
- package/src/components/base/token_selector/token_selector.md +0 -78
- package/src/components/experimental/experiment_badge/experiment_badge.md +0 -10
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { CHECKED_STATE } from './constants';
|
|
2
|
-
import { Node } from './node';
|
|
3
|
-
|
|
4
|
-
export class Tree {
|
|
5
|
-
constructor(options, selected) {
|
|
6
|
-
this.treeDepth = 0;
|
|
7
|
-
this.nodes = {};
|
|
8
|
-
|
|
9
|
-
this.initNodes(options, selected);
|
|
10
|
-
this.initIndeterminateStates();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @returns {[Node]} The tree as an array of Node instances
|
|
15
|
-
*/
|
|
16
|
-
get nodesList() {
|
|
17
|
-
return Object.values(this.nodes);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @returns {array} The values currently selected
|
|
22
|
-
*/
|
|
23
|
-
get selected() {
|
|
24
|
-
return this.nodesList.filter((node) => node.isChecked).map((node) => node.value);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @returns {boolean} Whether all options are checked
|
|
29
|
-
*/
|
|
30
|
-
get allOptionsChecked() {
|
|
31
|
-
return this.selected.length === this.nodesList.length;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @returns {boolean} Whether some, but not all options are checked
|
|
36
|
-
*/
|
|
37
|
-
get someOptionsChecked() {
|
|
38
|
-
return this.selected.length > 0 && !this.allOptionsChecked;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Creates a flat tree of Node instances.
|
|
43
|
-
* @param {array} options The options list
|
|
44
|
-
* @param {array} selected Pre-selected option values
|
|
45
|
-
* @param {object} parent The options' parent
|
|
46
|
-
* @param {number} depth The current depth-level in the tree
|
|
47
|
-
*/
|
|
48
|
-
// eslint-disable-next-line max-params
|
|
49
|
-
initNodes(options = [], selected = [], parent = null, depth = 0) {
|
|
50
|
-
if (!options.length) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this.treeDepth = depth > this.treeDepth ? depth : this.treeDepth;
|
|
54
|
-
|
|
55
|
-
options.forEach((option) => {
|
|
56
|
-
const isChecked = selected.includes(option.value);
|
|
57
|
-
this.nodes[option.value] = new Node({ ...option, parent, isChecked, depth });
|
|
58
|
-
this.initNodes(option.children, selected, option, depth + 1);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Looks for UNCHECKED nodes and sets their checked state to INDETERMINATE if needed. We start
|
|
64
|
-
* with the deepest leaves and we go up level by level to propagate the correct INDETERMINATE
|
|
65
|
-
* states to each parent node.
|
|
66
|
-
*/
|
|
67
|
-
initIndeterminateStates() {
|
|
68
|
-
const nodes = [...this.nodesList];
|
|
69
|
-
for (let i = this.treeDepth; i >= 0; i -= 1) {
|
|
70
|
-
const removeIndices = [];
|
|
71
|
-
nodes.forEach((node, nodeIndex) => {
|
|
72
|
-
if (node.depth === i && node.isUnchecked) {
|
|
73
|
-
node.setCheckedState(
|
|
74
|
-
this.optionHasSomeChildrenChecked(node)
|
|
75
|
-
? CHECKED_STATE.INDETERMINATE
|
|
76
|
-
: node.checkedState,
|
|
77
|
-
);
|
|
78
|
-
removeIndices.push(nodeIndex);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
removeIndices.reverse().forEach((index) => {
|
|
82
|
-
nodes.splice(index, 1);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Returns true if all of the option's children are checked, false otherwise.
|
|
89
|
-
* @param {object} option
|
|
90
|
-
* @returns {boolean}
|
|
91
|
-
*/
|
|
92
|
-
optionHasAllChildrenChecked(option) {
|
|
93
|
-
return this.getOptionChildren(option).every((child) => child.isChecked);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Returns true if at least one of the option's children is in a checked or indeterminate state,
|
|
98
|
-
* returns false otherwise.
|
|
99
|
-
* We consider the INDETERMINATE state as a checked state so we can propagate INDETERMINATE states
|
|
100
|
-
* to the option's parents.
|
|
101
|
-
* @param {object} option
|
|
102
|
-
* @returns {boolean}
|
|
103
|
-
*/
|
|
104
|
-
optionHasSomeChildrenChecked(option) {
|
|
105
|
-
return this.getOptionChildren(option).some((child) => child.isCheckedOrIndeterminate);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Returns the Node instance for a given option's value.
|
|
110
|
-
* @param {number|string} value The option's value
|
|
111
|
-
* @returns {Node}
|
|
112
|
-
*/
|
|
113
|
-
getNode(value) {
|
|
114
|
-
return this.nodes[value];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Returns the option's children as Node instances.
|
|
119
|
-
* @param {object} option
|
|
120
|
-
* @returns {[Node]}
|
|
121
|
-
*/
|
|
122
|
-
getOptionChildren(option) {
|
|
123
|
-
return option.children.map(({ value }) => this.getNode(value));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Sets a node's state based on whether it got checked or unchecked
|
|
128
|
-
* @param {Node} node The node to be toggled
|
|
129
|
-
* @param {boolean} checked Whether the node should be checked
|
|
130
|
-
*/
|
|
131
|
-
static toggleNodeState(node, checked) {
|
|
132
|
-
node.setCheckedState(checked ? CHECKED_STATE.CHECKED : CHECKED_STATE.UNCHECKED);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Toggles all options.
|
|
137
|
-
* @param {boolean} checked Whether the options should be checked or unchecked
|
|
138
|
-
*/
|
|
139
|
-
toggleAllOptions(checked) {
|
|
140
|
-
this.nodesList.forEach((node) => {
|
|
141
|
-
Tree.toggleNodeState(node, checked);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Toggles an option's checked state and propagates the state change to the
|
|
147
|
-
* option's parents and children.
|
|
148
|
-
* @param {object} param0 The option to be toggled
|
|
149
|
-
* @param {boolean} checked Whether the option is checked
|
|
150
|
-
* @param {boolean} propagateToParent Whether the state should be propagated to the parents
|
|
151
|
-
*/
|
|
152
|
-
toggleOption({ value }, checked, propagateToParent = true) {
|
|
153
|
-
const node = this.getNode(value);
|
|
154
|
-
Tree.toggleNodeState(node, checked);
|
|
155
|
-
|
|
156
|
-
if (node.isChild && propagateToParent) {
|
|
157
|
-
this.toggleParentOption(node.parent);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (node.isParent) {
|
|
161
|
-
node.children.forEach((child) => this.toggleOption(child, checked, false));
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Toggles a parent option's checked state. This is called as a result of a child option being
|
|
167
|
-
* toggled by the user and the change being propagated to that option's parents. This method
|
|
168
|
-
* recursively propagates the state changes to all the ancestors chain until we have reached the
|
|
169
|
-
* tree's trunk.
|
|
170
|
-
* @param {object} param0 The option to be toggled
|
|
171
|
-
*/
|
|
172
|
-
toggleParentOption({ value }) {
|
|
173
|
-
const node = this.getNode(value);
|
|
174
|
-
if (this.optionHasAllChildrenChecked(node)) {
|
|
175
|
-
node.checkedState = CHECKED_STATE.CHECKED;
|
|
176
|
-
} else if (this.optionHasSomeChildrenChecked(node)) {
|
|
177
|
-
node.checkedState = CHECKED_STATE.INDETERMINATE;
|
|
178
|
-
} else {
|
|
179
|
-
node.checkedState = CHECKED_STATE.UNCHECKED;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (node.isChild) {
|
|
183
|
-
this.toggleParentOption(node.parent);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
## Overview
|
|
2
|
-
|
|
3
|
-
The base `<gl-nav>` component is built with flexbox and provides a strong foundation for building all
|
|
4
|
-
types of navigation components. It includes some style overrides (for working with lists), some link
|
|
5
|
-
padding for larger hit areas, and basic disabled styling. No active states are included in the base
|
|
6
|
-
nav.
|
|
7
|
-
|
|
8
|
-
`<gl-nav>` supports the `<gl-nav-item>` child component for actionable links (or router-links).
|
|
9
|
-
|
|
10
|
-
## Link appearance
|
|
11
|
-
|
|
12
|
-
Two style variations are supported: `tabs` and `pills`, which support `active` state styling. These
|
|
13
|
-
variants are mutually exclusive - use only one style or the other.
|
|
14
|
-
|
|
15
|
-
### Tab style
|
|
16
|
-
|
|
17
|
-
Make the nav look like tabs by setting the `tabs` prop.
|
|
18
|
-
|
|
19
|
-
```html
|
|
20
|
-
<div>
|
|
21
|
-
<gl-nav tabs>
|
|
22
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
23
|
-
<gl-nav-item>Link</gl-nav-item>
|
|
24
|
-
<gl-nav-item>Another Link</gl-nav-item>
|
|
25
|
-
<gl-nav-item disabled>Disabled</gl-nav-item>
|
|
26
|
-
</gl-nav>
|
|
27
|
-
</div>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Pill style
|
|
31
|
-
|
|
32
|
-
Use the pill style by setting the `pills` prop.
|
|
33
|
-
|
|
34
|
-
```html
|
|
35
|
-
<div>
|
|
36
|
-
<gl-nav pills>
|
|
37
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
38
|
-
<gl-nav-item>Link</gl-nav-item>
|
|
39
|
-
<gl-nav-item>Another Link</gl-nav-item>
|
|
40
|
-
<gl-nav-item disabled>Disabled</gl-nav-item>
|
|
41
|
-
</gl-nav>
|
|
42
|
-
</div>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Small
|
|
46
|
-
|
|
47
|
-
Make the nav smaller by setting the `small` prop.
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<div>
|
|
51
|
-
<gl-nav small>
|
|
52
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
53
|
-
<gl-nav-item>Link</gl-nav-item>
|
|
54
|
-
<gl-nav-item>Another Link</gl-nav-item>
|
|
55
|
-
<gl-nav-item disabled>Disabled</gl-nav-item>
|
|
56
|
-
</gl-nav>
|
|
57
|
-
</div>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Fill and justify
|
|
61
|
-
|
|
62
|
-
Force your `<gl-nav>` content to extend the full available width.
|
|
63
|
-
|
|
64
|
-
### Fill
|
|
65
|
-
|
|
66
|
-
To proportionately fill all available space with your `<gl-nav-item>` components, set the `fill`
|
|
67
|
-
prop. Notice that all horizontal space is occupied, but not every nav item has the same width.
|
|
68
|
-
|
|
69
|
-
```html
|
|
70
|
-
<div>
|
|
71
|
-
<gl-nav tabs fill>
|
|
72
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
73
|
-
<gl-nav-item>Link</gl-nav-item>
|
|
74
|
-
<gl-nav-item>Link with a long name </gl-nav-item>
|
|
75
|
-
<gl-nav-item disabled>Disabled</gl-nav-item>
|
|
76
|
-
</gl-nav>
|
|
77
|
-
</div>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Justified
|
|
81
|
-
|
|
82
|
-
For equal-width elements, set the `justified` prop instead. All horizontal space will be occupied by
|
|
83
|
-
nav links, but unlike `fill` above, every `<gl-nav-item>` will be the same width.
|
|
84
|
-
|
|
85
|
-
```html
|
|
86
|
-
<div>
|
|
87
|
-
<gl-nav tabs justified>
|
|
88
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
89
|
-
<gl-nav-item>Link</gl-nav-item>
|
|
90
|
-
<gl-nav-item>Link with a long name </gl-nav-item>
|
|
91
|
-
<gl-nav-item disabled>Disabled</gl-nav-item>
|
|
92
|
-
</gl-nav>
|
|
93
|
-
</div>
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Alignment
|
|
97
|
-
|
|
98
|
-
To align your `<gl-nav-item>` components, use the `align` prop. Available values are `left`, `center`
|
|
99
|
-
and `right`.
|
|
100
|
-
|
|
101
|
-
```html
|
|
102
|
-
<div>
|
|
103
|
-
<gl-nav tabs align="center">
|
|
104
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
105
|
-
<gl-nav-item>Link</gl-nav-item>
|
|
106
|
-
<gl-nav-item>Link with a long name </gl-nav-item>
|
|
107
|
-
<gl-nav-item disabled>Disabled</gl-nav-item>
|
|
108
|
-
</gl-nav>
|
|
109
|
-
</div>
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Tabbed local content support
|
|
113
|
-
|
|
114
|
-
See the [`<gl-tabs>`](?path=/docs/base-tabs--docs) component for creating tabbable panes of local
|
|
115
|
-
content (not suited for navigation).
|
|
116
|
-
|
|
117
|
-
## Card integration
|
|
118
|
-
|
|
119
|
-
Use a `<gl-nav>` in a [`<gl-card>`](?path=/docs/base-card--docs) header, by enabling the
|
|
120
|
-
`card-header` prop on `<gl-nav>` and setting either the `pills` or `tabs` props:
|
|
121
|
-
|
|
122
|
-
```html
|
|
123
|
-
<div>
|
|
124
|
-
<gl-card title="Card Title">
|
|
125
|
-
<template #header>
|
|
126
|
-
<gl-nav card-header tabs>
|
|
127
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
128
|
-
<gl-nav-item>Inactive</gl-nav-item>
|
|
129
|
-
</gl-nav>
|
|
130
|
-
</template>
|
|
131
|
-
|
|
132
|
-
<template #default>
|
|
133
|
-
<p>With supporting text below as a natural lead-in to additional content.</p>
|
|
134
|
-
<gl-button variant="primary">Go somewhere</gl-button>
|
|
135
|
-
</template>
|
|
136
|
-
</gl-card>
|
|
137
|
-
</div>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**Plain style:**
|
|
141
|
-
|
|
142
|
-
The `card-header` prop is only needed when you are applying `tabs` or `pills` style. Note that
|
|
143
|
-
we do not have special styling for `active` state plain style nav items.
|
|
144
|
-
|
|
145
|
-
```html
|
|
146
|
-
<div>
|
|
147
|
-
<gl-card title="Card Title">
|
|
148
|
-
<template #header>
|
|
149
|
-
<gl-nav>
|
|
150
|
-
<gl-nav-item active>Active</gl-nav-item>
|
|
151
|
-
<gl-nav-item>Inactive</gl-nav-item>
|
|
152
|
-
</gl-nav>
|
|
153
|
-
</template>
|
|
154
|
-
|
|
155
|
-
<template #default>
|
|
156
|
-
<p>pWith supporting text below as a natural lead-in to additional content.</p>
|
|
157
|
-
<gl-button variant="primary">Go somewhere</gl-button>
|
|
158
|
-
</template>
|
|
159
|
-
</gl-card>
|
|
160
|
-
</div>
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Accessibility
|
|
164
|
-
|
|
165
|
-
If you're using `<gl-nav>` to provide a navigation bar, be sure to add a `role="navigation"` to the
|
|
166
|
-
most logical parent container of `<gl-nav>`, or wrap a `<nav>` element around `<gl-nav>`. Do **not**
|
|
167
|
-
add the role to the `<gl-nav>` itself, as this would prevent it from being announced as an actual
|
|
168
|
-
list by assistive technologies.
|
|
169
|
-
|
|
170
|
-
### Tabbed interface accessibility
|
|
171
|
-
|
|
172
|
-
Note that navigation bars, even if visually styled as tabs, should **not** be given
|
|
173
|
-
`role="tablist"`, `role="tab"` or `role="tabpanel"` attributes. These are only appropriate for
|
|
174
|
-
[tabbed interfaces](?path=/docs/base-tabs--docs) that do not change the URL or `$route`, as
|
|
175
|
-
described in the [WAI ARIA Authoring Practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel).
|
|
176
|
-
See [`<gl-tabs>`](?path=/docs/base-tabs--docs) for dynamic tabbed interfaces that are compliant with
|
|
177
|
-
WAI ARIA.
|
|
178
|
-
|
|
179
|
-
## See also
|
|
180
|
-
|
|
181
|
-
- [tabs](?path=/docs/base-tabs--docs) to create tabbable panes of local content, even via dropdown
|
|
182
|
-
menus.
|
|
183
|
-
- [Router Link Support reference](?path=/docs/base-link--docs#router-link-support) for information
|
|
184
|
-
about router-link specific props available on `<gl-nav-item>`
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
name: 'GlNav',
|
|
4
|
-
props: {
|
|
5
|
-
/**
|
|
6
|
-
* Align the nav items in the nav: 'start' (or 'left'), 'center', 'end' (or 'right')
|
|
7
|
-
*/
|
|
8
|
-
align: { type: String, required: false, default: '' },
|
|
9
|
-
/**
|
|
10
|
-
* Set this prop when the nav is placed inside a card header
|
|
11
|
-
*/
|
|
12
|
-
cardHeader: { type: Boolean, required: false, default: false },
|
|
13
|
-
/**
|
|
14
|
-
* Proportionately fills all horizontal space with nav items.
|
|
15
|
-
* All horizontal space is occupied, but not every nav item has the same width
|
|
16
|
-
*/
|
|
17
|
-
fill: { type: Boolean, required: false, default: false },
|
|
18
|
-
/**
|
|
19
|
-
* Fills all horizontal space with nav items, but unlike 'fill', every nav item will be the same width
|
|
20
|
-
*/
|
|
21
|
-
justified: { type: Boolean, required: false, default: false },
|
|
22
|
-
/**
|
|
23
|
-
* Renders the nav items with the appearance of pill buttons
|
|
24
|
-
*/
|
|
25
|
-
pills: { type: Boolean, required: false, default: false },
|
|
26
|
-
/**
|
|
27
|
-
* Makes the nav smaller
|
|
28
|
-
*/
|
|
29
|
-
small: { type: Boolean, required: false, default: false },
|
|
30
|
-
/**
|
|
31
|
-
* Renders the nav items with the appearance of tabs
|
|
32
|
-
*/
|
|
33
|
-
tabs: { type: Boolean, required: false, default: false },
|
|
34
|
-
/**
|
|
35
|
-
* Specify the HTML tag to render instead of the default tag
|
|
36
|
-
*/
|
|
37
|
-
tag: { type: String, required: false, default: 'ul' },
|
|
38
|
-
},
|
|
39
|
-
computed: {
|
|
40
|
-
justifyContent() {
|
|
41
|
-
if (!this.align) return '';
|
|
42
|
-
|
|
43
|
-
const alignMapping = {
|
|
44
|
-
left: 'start',
|
|
45
|
-
right: 'end',
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return `justify-content-${alignMapping[this.align] || this.align}`;
|
|
49
|
-
},
|
|
50
|
-
classes() {
|
|
51
|
-
return {
|
|
52
|
-
'nav-tabs': this.tabs,
|
|
53
|
-
'nav-pills': this.pills && !this.tabs,
|
|
54
|
-
'card-header-tabs': this.cardHeader && this.tabs,
|
|
55
|
-
'card-header-pills': this.cardHeader && this.pills && !this.tabs,
|
|
56
|
-
'nav-fill': this.fill,
|
|
57
|
-
'nav-justified': this.justified,
|
|
58
|
-
[this.justifyContent]: this.align,
|
|
59
|
-
small: this.small,
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<template>
|
|
67
|
-
<component :is="tag" class="nav" :class="classes" v-on="$listeners">
|
|
68
|
-
<slot></slot>
|
|
69
|
-
</component>
|
|
70
|
-
</template>
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import GlLink from '../link/link.vue';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: 'GlNavItem',
|
|
6
|
-
components: {
|
|
7
|
-
GlLink,
|
|
8
|
-
},
|
|
9
|
-
props: {
|
|
10
|
-
/**
|
|
11
|
-
* When set to `true`, places the component in the active state with active styling
|
|
12
|
-
*/
|
|
13
|
-
active: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
required: false,
|
|
16
|
-
default: false,
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* When set to `true`, disables the component's functionality and places it in a disabled state.
|
|
20
|
-
*/
|
|
21
|
-
disabled: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
required: false,
|
|
24
|
-
default: false,
|
|
25
|
-
},
|
|
26
|
-
/**
|
|
27
|
-
* Denotes the target URL of the link for standard links.
|
|
28
|
-
*/
|
|
29
|
-
href: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: false,
|
|
32
|
-
default: undefined,
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* <router-link> prop: Denotes the target route of the link.
|
|
36
|
-
* When clicked, the value of the to prop will be passed to `router.push()` internally,
|
|
37
|
-
* so the value can be either a string or a Location descriptor object.
|
|
38
|
-
*/
|
|
39
|
-
to: {
|
|
40
|
-
type: [Object, String],
|
|
41
|
-
required: false,
|
|
42
|
-
default: undefined,
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* <router-link> prop: Configure the active CSS class applied when the link is active.
|
|
46
|
-
*/
|
|
47
|
-
activeClass: {
|
|
48
|
-
type: String,
|
|
49
|
-
required: false,
|
|
50
|
-
default: undefined,
|
|
51
|
-
},
|
|
52
|
-
/**
|
|
53
|
-
* <router-link> prop: Configure the active CSS class applied when the link is active with exact match.
|
|
54
|
-
*/
|
|
55
|
-
exactActiveClass: {
|
|
56
|
-
type: String,
|
|
57
|
-
required: false,
|
|
58
|
-
default: undefined,
|
|
59
|
-
},
|
|
60
|
-
/**
|
|
61
|
-
* Attributes for the link element
|
|
62
|
-
*/
|
|
63
|
-
linkAttrs: {
|
|
64
|
-
type: Object,
|
|
65
|
-
required: false,
|
|
66
|
-
default: null,
|
|
67
|
-
},
|
|
68
|
-
/**
|
|
69
|
-
* Classes for the link element
|
|
70
|
-
*/
|
|
71
|
-
linkClasses: {
|
|
72
|
-
type: Array,
|
|
73
|
-
required: false,
|
|
74
|
-
default: () => [],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
computed: {
|
|
78
|
-
computedLinkClasses() {
|
|
79
|
-
const classes = this.linkClasses;
|
|
80
|
-
|
|
81
|
-
// the `unstyled` link variant does not do this by itself
|
|
82
|
-
if (this.disabled) classes.push('disabled');
|
|
83
|
-
if (this.active) classes.push('active');
|
|
84
|
-
|
|
85
|
-
return classes;
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
</script>
|
|
90
|
-
|
|
91
|
-
<template>
|
|
92
|
-
<li class="nav-item">
|
|
93
|
-
<gl-link
|
|
94
|
-
class="nav-link"
|
|
95
|
-
variant="unstyled"
|
|
96
|
-
:active="active"
|
|
97
|
-
:class="computedLinkClasses"
|
|
98
|
-
:disabled="disabled"
|
|
99
|
-
:href="href"
|
|
100
|
-
:to="to"
|
|
101
|
-
:active-class="activeClass"
|
|
102
|
-
:exact-active-class="exactActiveClass"
|
|
103
|
-
v-bind="linkAttrs"
|
|
104
|
-
v-on="$listeners"
|
|
105
|
-
>
|
|
106
|
-
<slot></slot>
|
|
107
|
-
</gl-link>
|
|
108
|
-
</li>
|
|
109
|
-
</template>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
Choose from a provided list of tokens or add a user defined token.
|
|
2
|
-
|
|
3
|
-
```html
|
|
4
|
-
<script>
|
|
5
|
-
export default {
|
|
6
|
-
data() {
|
|
7
|
-
return {
|
|
8
|
-
selectedTokens: [
|
|
9
|
-
{
|
|
10
|
-
id: 1,
|
|
11
|
-
name: 'Vue.js',
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<template>
|
|
20
|
-
<div>
|
|
21
|
-
<gl-token-selector
|
|
22
|
-
v-model="selectedTokens"
|
|
23
|
-
:dropdown-items="[
|
|
24
|
-
{
|
|
25
|
-
id: 1,
|
|
26
|
-
name: 'Vue.js',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: 2,
|
|
30
|
-
name: 'Ruby On Rails',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: 3,
|
|
34
|
-
name: 'GraphQL',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 4,
|
|
38
|
-
name: 'Redis',
|
|
39
|
-
},
|
|
40
|
-
]"
|
|
41
|
-
/>
|
|
42
|
-
{{ selectedTokens }}
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## User created tokens
|
|
48
|
-
|
|
49
|
-
This component allows for users to create their own tokens when configured to do so.
|
|
50
|
-
There are two props that support this functionality: `allowUserDefinedTokens` and `showAddNewAlways`.
|
|
51
|
-
|
|
52
|
-
`allowUserDefinedTokens` is required to enable the functionality
|
|
53
|
-
|
|
54
|
-
When set to `true` and a user's search text returns nothing,
|
|
55
|
-
they will be presented with an additional dropdown item `Add ...`
|
|
56
|
-
that takes their current search input and emits `@input`.
|
|
57
|
-
The parent component can then handle the event accordingly.
|
|
58
|
-
|
|
59
|
-
Additionally, there are scenarios where the user may want the ability to add a new token
|
|
60
|
-
even if some search results are returned. This functionality can be enabled by additionally
|
|
61
|
-
setting `showAddNewAlways` to `true`.
|
|
62
|
-
This will allow for the `Add ...` dropdown item to appear at all times
|
|
63
|
-
whenever a user has inputted text, regardless if results are found.
|
|
64
|
-
|
|
65
|
-
```html
|
|
66
|
-
<template>
|
|
67
|
-
<div>
|
|
68
|
-
<gl-token-selector
|
|
69
|
-
v-model="selectedTokens"
|
|
70
|
-
:dropdown-items="dropdownItems"
|
|
71
|
-
allow-user-defined-items
|
|
72
|
-
show-ad-new-always
|
|
73
|
-
@input="onTokenUpdate"
|
|
74
|
-
/>
|
|
75
|
-
{{ selectedTokens }}
|
|
76
|
-
</div>
|
|
77
|
-
</template>
|
|
78
|
-
```
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
The component represents a badge to mark experiment and beta features.
|
|
2
|
-
It comes with a popover that explains what experiment or beta means, and links
|
|
3
|
-
to [Support for features in different stages of development](https://docs.gitlab.com/ee/policy/development_stages_support.html)
|
|
4
|
-
for more information.
|
|
5
|
-
|
|
6
|
-
## Usage
|
|
7
|
-
|
|
8
|
-
```html
|
|
9
|
-
<gl-experiment-badge popover-placement="bottom" type="beta" />
|
|
10
|
-
```
|