@gitlab/ui 97.3.0 → 98.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.js +0 -1
- package/dist/vendor/bootstrap-vue/src/components/collapse/collapse.js +3 -36
- package/dist/vendor/bootstrap-vue/src/components/tabs/tabs.js +1 -1
- package/dist/vendor/bootstrap-vue/src/components/transition/bv-transition.js +12 -2
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -3
- package/dist/vendor/bootstrap-vue/src/constants/env.js +1 -2
- package/dist/vendor/bootstrap-vue/src/index.js +0 -2
- package/dist/vendor/bootstrap-vue/src/mixins/dropdown.js +12 -39
- package/package.json +2 -1
- package/src/index.js +0 -1
- package/src/scss/bootstrap_vue.scss +0 -1
- package/src/scss/components.scss +0 -1
- package/src/vendor/bootstrap-vue/package.json +3 -20
- package/src/vendor/bootstrap-vue/src/components/collapse/MODIFICATIONS.md +14 -0
- package/src/vendor/bootstrap-vue/src/components/collapse/collapse.js +3 -37
- package/src/vendor/bootstrap-vue/src/components/collapse/collapse.spec.js +0 -132
- package/src/vendor/bootstrap-vue/src/components/collapse/package.json +0 -4
- package/src/vendor/bootstrap-vue/src/components/dropdown/README.md +1 -1
- package/src/vendor/bootstrap-vue/src/components/form-input/form-input.spec.js +3 -0
- package/src/vendor/bootstrap-vue/src/components/index.d.ts +0 -1
- package/src/vendor/bootstrap-vue/src/components/index.scss +0 -1
- package/src/vendor/bootstrap-vue/src/components/modal/MODIFICATIONS.md +8 -5
- package/src/vendor/bootstrap-vue/src/components/nav/package.json +1 -1
- package/src/vendor/bootstrap-vue/src/components/popover/popover.spec.js +0 -1
- package/src/vendor/bootstrap-vue/src/components/table/table-filtering.spec.js +1 -1
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.js +1 -1
- package/src/vendor/bootstrap-vue/src/components/toast/toast.spec.js +6 -18
- package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.spec.js +67 -356
- package/src/vendor/bootstrap-vue/src/components/transition/bv-transition.js +15 -2
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -2
- package/src/vendor/bootstrap-vue/src/constants/env.js +0 -3
- package/src/vendor/bootstrap-vue/src/directives/tooltip/tooltip.spec.js +46 -79
- package/src/vendor/bootstrap-vue/src/index.js +0 -4
- package/src/vendor/bootstrap-vue/src/mixins/dropdown.js +12 -36
- package/src/vendor/bootstrap-vue/src/utils/config.spec.js +20 -2
- package/dist/components/base/navbar/navbar.js +0 -48
- package/dist/vendor/bootstrap-vue/src/components/navbar/index.js +0 -2
- package/dist/vendor/bootstrap-vue/src/components/navbar/navbar-brand.js +0 -40
- package/dist/vendor/bootstrap-vue/src/components/navbar/navbar.js +0 -72
- package/src/components/base/navbar/navbar.md +0 -4
- package/src/components/base/navbar/navbar.scss +0 -0
- package/src/components/base/navbar/navbar.vue +0 -17
- package/src/vendor/bootstrap-vue/src/components/navbar/README.md +0 -332
- package/src/vendor/bootstrap-vue/src/components/navbar/_navbar.scss +0 -1
- package/src/vendor/bootstrap-vue/src/components/navbar/index.d.ts +0 -10
- package/src/vendor/bootstrap-vue/src/components/navbar/index.js +0 -4
- package/src/vendor/bootstrap-vue/src/components/navbar/index.scss +0 -1
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar-brand.js +0 -42
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar-brand.spec.js +0 -50
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar.js +0 -78
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar.spec.js +0 -130
- package/src/vendor/bootstrap-vue/src/components/navbar/package.json +0 -54
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
# Navbar
|
|
2
|
-
|
|
3
|
-
> The component `<b-navbar>` is a wrapper that positions branding, navigation, and other elements
|
|
4
|
-
> into a concise header. It's easily extensible and thanks to the `<b-collapse>` component, it can
|
|
5
|
-
> easily integrate responsive behaviors.
|
|
6
|
-
|
|
7
|
-
**Example:**
|
|
8
|
-
|
|
9
|
-
```html
|
|
10
|
-
<div>
|
|
11
|
-
<b-navbar toggleable="lg" type="dark" variant="info">
|
|
12
|
-
<b-navbar-brand href="#">NavBar</b-navbar-brand>
|
|
13
|
-
|
|
14
|
-
<b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
|
|
15
|
-
|
|
16
|
-
<b-collapse id="nav-collapse" is-nav>
|
|
17
|
-
<b-navbar-nav>
|
|
18
|
-
<b-nav-item href="#">Link</b-nav-item>
|
|
19
|
-
<b-nav-item href="#" disabled>Disabled</b-nav-item>
|
|
20
|
-
</b-navbar-nav>
|
|
21
|
-
|
|
22
|
-
<!-- Right aligned nav items -->
|
|
23
|
-
<b-navbar-nav class="ml-auto">
|
|
24
|
-
<b-nav-form>
|
|
25
|
-
<b-form-input size="sm" class="mr-sm-2" placeholder="Search"></b-form-input>
|
|
26
|
-
<b-button size="sm" class="my-2 my-sm-0" type="submit">Search</b-button>
|
|
27
|
-
</b-nav-form>
|
|
28
|
-
|
|
29
|
-
<b-nav-item-dropdown text="Lang" right>
|
|
30
|
-
<b-dropdown-item href="#">EN</b-dropdown-item>
|
|
31
|
-
<b-dropdown-item href="#">ES</b-dropdown-item>
|
|
32
|
-
<b-dropdown-item href="#">RU</b-dropdown-item>
|
|
33
|
-
<b-dropdown-item href="#">FA</b-dropdown-item>
|
|
34
|
-
</b-nav-item-dropdown>
|
|
35
|
-
|
|
36
|
-
<b-nav-item-dropdown right>
|
|
37
|
-
<!-- Using 'button-content' slot -->
|
|
38
|
-
<template #button-content>
|
|
39
|
-
<em>User</em>
|
|
40
|
-
</template>
|
|
41
|
-
<b-dropdown-item href="#">Profile</b-dropdown-item>
|
|
42
|
-
<b-dropdown-item href="#">Sign Out</b-dropdown-item>
|
|
43
|
-
</b-nav-item-dropdown>
|
|
44
|
-
</b-navbar-nav>
|
|
45
|
-
</b-collapse>
|
|
46
|
-
</b-navbar>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<!-- b-navbar.vue -->
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Color schemes
|
|
53
|
-
|
|
54
|
-
`<b-navbar>` supports the standard Bootstrap v4 available background color variants. Set the
|
|
55
|
-
`variant` prop to one of the following values to change the background color: `primary`, `success`,
|
|
56
|
-
`info`, `warning`, `danger`, `dark`, or `light`.
|
|
57
|
-
|
|
58
|
-
Control the text color by setting `type` prop to `light` for use with light background color
|
|
59
|
-
variants, or `dark` for dark background color variants.
|
|
60
|
-
|
|
61
|
-
## Placement
|
|
62
|
-
|
|
63
|
-
Control the placement of the navbar by setting one of two props:
|
|
64
|
-
|
|
65
|
-
| prop | type | default | description |
|
|
66
|
-
| -------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
67
|
-
| `fixed` | String | `null` | Set to `top` for fixed to the top of the viewport, or `bottom` for fixed to the `bottom` of the viewport. |
|
|
68
|
-
| `sticky` | Boolean | `false` | Set to `true` to make the navbar stick to the top of the viewport (or parent container that has `position: relative` set) when scrolled. |
|
|
69
|
-
|
|
70
|
-
**Notes:**
|
|
71
|
-
|
|
72
|
-
- Fixed positioning uses CSS `position: fixed`. You may need to adjust your document top/bottom
|
|
73
|
-
padding or margin.
|
|
74
|
-
- CSS `position: sticky` (used for `sticky`) is not fully supported in every browser. For browsers
|
|
75
|
-
that do not support `position: sticky`, it will fallback natively to `position: relative`.
|
|
76
|
-
|
|
77
|
-
## Supported content
|
|
78
|
-
|
|
79
|
-
Navbars come with built-in support for a handful of sub-components. Choose from the following as
|
|
80
|
-
needed:
|
|
81
|
-
|
|
82
|
-
- `<b-navbar-brand>` for your company, product, or project name.
|
|
83
|
-
- `<b-navbar-toggle>` for use with the `<b-collapse is-nav>` component.
|
|
84
|
-
- `<b-collapse is-nav>` for grouping and hiding navbar contents by a parent breakpoint.
|
|
85
|
-
- `<b-navbar-nav>` for a full-height and lightweight navigation (including support for dropdowns).
|
|
86
|
-
The following sub-components inside `<b-navbar-nav>` are supported:
|
|
87
|
-
- `<b-nav-item>` for link (and router-link) action items
|
|
88
|
-
- `<b-nav-item-dropdown>` for nav dropdown menus
|
|
89
|
-
- `<b-nav-text>` for adding vertically centered strings of text.
|
|
90
|
-
- `<b-nav-form>` for any form controls and actions.
|
|
91
|
-
|
|
92
|
-
### `<b-navbar-brand>`
|
|
93
|
-
|
|
94
|
-
The `<b-navbar-brand>` generates a link if `href` is provided, or a `<router-link>` if `to` is
|
|
95
|
-
provided. If neither is given it renders as a `<div>` tag. You can override the tag type by setting
|
|
96
|
-
the `tag` prop to the element you would like rendered:
|
|
97
|
-
|
|
98
|
-
```html
|
|
99
|
-
<div>
|
|
100
|
-
<!-- As a link -->
|
|
101
|
-
<b-navbar variant="faded" type="light">
|
|
102
|
-
<b-navbar-brand href="#">BootstrapVue</b-navbar-brand>
|
|
103
|
-
</b-navbar>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<!-- b-navbar-brand-link.vue -->
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
```html
|
|
110
|
-
<div>
|
|
111
|
-
<!-- As a heading -->
|
|
112
|
-
<b-navbar variant="faded" type="light">
|
|
113
|
-
<b-navbar-brand tag="h1" class="mb-0">BootstrapVue</b-navbar-brand>
|
|
114
|
-
</b-navbar>
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
<!-- b-navbar-brand-heading.vue -->
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Adding images to the `<b-navbar-brand>` will likely always require custom styles or utilities to
|
|
121
|
-
properly size. Here are some examples to demonstrate:
|
|
122
|
-
|
|
123
|
-
```html
|
|
124
|
-
<div>
|
|
125
|
-
<!-- Just an image -->
|
|
126
|
-
<b-navbar variant="faded" type="light">
|
|
127
|
-
<b-navbar-brand href="#">
|
|
128
|
-
<img src="https://placekitten.com/g/30/30" alt="Kitten">
|
|
129
|
-
</b-navbar-brand>
|
|
130
|
-
</b-navbar>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
<!-- b-navbar-brand-image.vue -->
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
```html
|
|
137
|
-
<div>
|
|
138
|
-
<!-- Image and text -->
|
|
139
|
-
<b-navbar variant="faded" type="light">
|
|
140
|
-
<b-navbar-brand href="#">
|
|
141
|
-
<img src="https://placekitten.com/g/30/30" class="d-inline-block align-top" alt="Kitten">
|
|
142
|
-
BootstrapVue
|
|
143
|
-
</b-navbar-brand>
|
|
144
|
-
</b-navbar>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
<!-- b-navbar-brand-image-and-text.vue -->
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### `<b-navbar-nav>`
|
|
151
|
-
|
|
152
|
-
Navbar navigation links build on the `<b-navbar-nav>` parent component and requires the use of
|
|
153
|
-
`<b-collapse is-nav>` and `<b-nav-toggle>` toggler for proper responsive styling. Navigation in
|
|
154
|
-
navbars will also grow to occupy as much horizontal space as possible to keep your navbar contents
|
|
155
|
-
securely aligned.
|
|
156
|
-
|
|
157
|
-
`<b-navbar-nav>` supports the following child components:
|
|
158
|
-
|
|
159
|
-
- `<b-nav-item>` for link (and router-link) action items
|
|
160
|
-
- `<b-nav-text>` for adding vertically centered strings of text.
|
|
161
|
-
- `<b-nav-item-dropdown>` for navbar dropdown menus
|
|
162
|
-
- `<b-nav-form>` for adding simple forms to the navbar.
|
|
163
|
-
|
|
164
|
-
### `<b-nav-item>`
|
|
165
|
-
|
|
166
|
-
`<b-nav-item>` is the primary link (and `<router-link>`) component. Providing a `to` prop value will
|
|
167
|
-
generate a `<router-link>` while providing an `href` prop value will generate a standard link.
|
|
168
|
-
|
|
169
|
-
Set the `<b-nav-item>` `active` prop will highlight the item as being the active page, Disable a
|
|
170
|
-
`<b-nav-item>` by setting the prop `disabled` to true.
|
|
171
|
-
|
|
172
|
-
Handle click events by specifying a handler for the `@click` event on `<b-nav-item>`.
|
|
173
|
-
|
|
174
|
-
### `<b-nav-text>`
|
|
175
|
-
|
|
176
|
-
Navbars may contain bits of text with the help of `<b-nav-text>`. This component adjusts vertical
|
|
177
|
-
alignment and horizontal spacing for strings of text.
|
|
178
|
-
|
|
179
|
-
```html
|
|
180
|
-
<div>
|
|
181
|
-
<b-navbar toggleable="sm" type="light" variant="light">
|
|
182
|
-
<b-navbar-toggle target="nav-text-collapse"></b-navbar-toggle>
|
|
183
|
-
|
|
184
|
-
<b-navbar-brand>BootstrapVue</b-navbar-brand>
|
|
185
|
-
|
|
186
|
-
<b-collapse id="nav-text-collapse" is-nav>
|
|
187
|
-
<b-navbar-nav>
|
|
188
|
-
<b-nav-text>Navbar text</b-nav-text>
|
|
189
|
-
</b-navbar-nav>
|
|
190
|
-
</b-collapse>
|
|
191
|
-
</b-navbar>
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
<!-- b-navbar-text.vue -->
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### `<b-nav-item-dropdown>`
|
|
198
|
-
|
|
199
|
-
For `<b-nav-item-dropdown>` usage, see the [`<b-dropdown>`](/docs/components/dropdown) docs. Note
|
|
200
|
-
split dropdowns are not supported in `<b-navbar>` and `<b-navbar-nav>`.
|
|
201
|
-
|
|
202
|
-
```html
|
|
203
|
-
<div>
|
|
204
|
-
<b-navbar type="dark" variant="dark">
|
|
205
|
-
<b-navbar-nav>
|
|
206
|
-
<b-nav-item href="#">Home</b-nav-item>
|
|
207
|
-
|
|
208
|
-
<!-- Navbar dropdowns -->
|
|
209
|
-
<b-nav-item-dropdown text="Lang" right>
|
|
210
|
-
<b-dropdown-item href="#">EN</b-dropdown-item>
|
|
211
|
-
<b-dropdown-item href="#">ES</b-dropdown-item>
|
|
212
|
-
<b-dropdown-item href="#">RU</b-dropdown-item>
|
|
213
|
-
<b-dropdown-item href="#">FA</b-dropdown-item>
|
|
214
|
-
</b-nav-item-dropdown>
|
|
215
|
-
|
|
216
|
-
<b-nav-item-dropdown text="User" right>
|
|
217
|
-
<b-dropdown-item href="#">Account</b-dropdown-item>
|
|
218
|
-
<b-dropdown-item href="#">Settings</b-dropdown-item>
|
|
219
|
-
</b-nav-item-dropdown>
|
|
220
|
-
</b-navbar-nav>
|
|
221
|
-
</b-navbar>
|
|
222
|
-
</div>
|
|
223
|
-
|
|
224
|
-
<!-- b-navbar-dropdown.vue -->
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### `<b-nav-form>`
|
|
228
|
-
|
|
229
|
-
Use `<b-nav-form>` to place inline form controls into your navbar
|
|
230
|
-
|
|
231
|
-
```html
|
|
232
|
-
<div>
|
|
233
|
-
<b-navbar type="light" variant="light">
|
|
234
|
-
<b-nav-form>
|
|
235
|
-
<b-form-input class="mr-sm-2" placeholder="Search"></b-form-input>
|
|
236
|
-
<b-button variant="outline-success" class="my-2 my-sm-0" type="submit">Search</b-button>
|
|
237
|
-
</b-nav-form>
|
|
238
|
-
</b-navbar>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
<!-- b-navbar-form.vue -->
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
Input Groups work as well:
|
|
245
|
-
|
|
246
|
-
```html
|
|
247
|
-
<div>
|
|
248
|
-
<b-navbar type="light" variant="light">
|
|
249
|
-
<b-nav-form>
|
|
250
|
-
<b-input-group prepend="@">
|
|
251
|
-
<b-form-input placeholder="Username"></b-form-input>
|
|
252
|
-
</b-input-group>
|
|
253
|
-
</b-nav-form>
|
|
254
|
-
</b-navbar>
|
|
255
|
-
</div>
|
|
256
|
-
|
|
257
|
-
<!-- b-navbar-form-inputs.vue -->
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### `<b-navbar-toggle>` and `<b-collapse is-nav>`
|
|
261
|
-
|
|
262
|
-
Navbars are not responsive by default, but you can easily modify them to change that. Responsive
|
|
263
|
-
behavior depends on our `<b-collapse>` component.
|
|
264
|
-
|
|
265
|
-
Wrap `<b-navbar-nav>` components in a `<b-collapse is-nav>` (**remember to set the `is-nav` prop!**)
|
|
266
|
-
to specify content that will collapse based on a particular breakpoint. Assign a document unique
|
|
267
|
-
`id` value on the `<b-collapse>`.
|
|
268
|
-
|
|
269
|
-
Use the `<b-navbar-toggle>` component to control the collapse component, and set the `target` prop
|
|
270
|
-
of `<b-navbar-toggle>` to the `id` of `<b-collapse>`.
|
|
271
|
-
|
|
272
|
-
Set the `toggleable` prop on `<b-navbar>` to the desired breakpoint you would like content to
|
|
273
|
-
automatically expand at. Possible `toggleable` values are `sm`, `md`, `lg` and `xl`. Setting
|
|
274
|
-
`toggleable` to `true` (or an empty string) will set the navbar to be always collapsed, while
|
|
275
|
-
setting it to `false` (the default) will disable collapsing (always expanded).
|
|
276
|
-
|
|
277
|
-
`<b-navbar-toggle>` components are left-aligned by default, but should they follow a sibling element
|
|
278
|
-
like `<b-navbar-brand>`, they'll automatically be aligned to the far right. Reversing your markup
|
|
279
|
-
will reverse the placement of the toggler.
|
|
280
|
-
|
|
281
|
-
See the first example on this page for reference, and also refer to
|
|
282
|
-
[`<gl-collapse>`](?path=/docs/base-collapse--docs) for details on the collapse component.
|
|
283
|
-
|
|
284
|
-
Internally, `<b-navbar-toggle>` uses the [`v-b-toggle` directive](/docs/directives/toggle).
|
|
285
|
-
|
|
286
|
-
#### Custom navbar toggle
|
|
287
|
-
|
|
288
|
-
`<b-navbar-toggle>` renders the default Bootstrap v4 _hamburger_ (which is a background SVG image).
|
|
289
|
-
You can supply your own content (such as an icon) via the optionally scoped `default` slot. The
|
|
290
|
-
default slot scope contains the property `expanded`, which will be `true` when the collapse is
|
|
291
|
-
expanded, or `false` when the collapse is collapsed.
|
|
292
|
-
|
|
293
|
-
Note that the `expanded` scope property only works when supplying the `target` prop as a `string`,
|
|
294
|
-
and not an `array`.
|
|
295
|
-
|
|
296
|
-
```html
|
|
297
|
-
<template>
|
|
298
|
-
<b-navbar toggleable type="dark" variant="dark">
|
|
299
|
-
<b-navbar-brand href="#">NavBar</b-navbar-brand>
|
|
300
|
-
|
|
301
|
-
<b-navbar-toggle target="navbar-toggle-collapse">
|
|
302
|
-
<template #default="{ expanded }">
|
|
303
|
-
{{ expanded ? 'Close' : 'Open' }}
|
|
304
|
-
</template>
|
|
305
|
-
</b-navbar-toggle>
|
|
306
|
-
|
|
307
|
-
<b-collapse id="navbar-toggle-collapse" is-nav>
|
|
308
|
-
<b-navbar-nav class="ml-auto">
|
|
309
|
-
<b-nav-item href="#">Link 1</b-nav-item>
|
|
310
|
-
<b-nav-item href="#">Link 2</b-nav-item>
|
|
311
|
-
<b-nav-item href="#" disabled>Disabled</b-nav-item>
|
|
312
|
-
</b-navbar-nav>
|
|
313
|
-
</b-collapse>
|
|
314
|
-
</b-navbar>
|
|
315
|
-
</template>
|
|
316
|
-
<!-- b-navbar-toggle-slot.vue -->
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
## Printing
|
|
320
|
-
|
|
321
|
-
Navbars are hidden by default when printing. Force them to be printed by setting the `print` prop.
|
|
322
|
-
|
|
323
|
-
## See also
|
|
324
|
-
|
|
325
|
-
- [collapse](?path=/docs/base-collapse--docs)
|
|
326
|
-
- [`v-b-toggle` directive](/docs/directives/toggle)
|
|
327
|
-
- [nav](?path=/docs/base-nav--docs) for additional components and sub-component aliases
|
|
328
|
-
|
|
329
|
-
Refer to the [Router support](?path=/docs/base-link--docs#router-link-support) reference page for
|
|
330
|
-
router-link specific props.
|
|
331
|
-
|
|
332
|
-
<!-- Component reference added automatically from component package.json -->
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "../dropdown/index";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "navbar";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { extend, mergeData } from '../../vue'
|
|
2
|
-
import { NAME_NAVBAR_BRAND } from '../../constants/components'
|
|
3
|
-
import { PROP_TYPE_STRING } from '../../constants/props'
|
|
4
|
-
import { omit, sortKeys } from '../../utils/object'
|
|
5
|
-
import { makeProp, makePropsConfigurable, pluckProps } from '../../utils/props'
|
|
6
|
-
import { BLink, props as BLinkProps } from '../link/link'
|
|
7
|
-
|
|
8
|
-
// --- Props ---
|
|
9
|
-
|
|
10
|
-
const linkProps = omit(BLinkProps, ['event', 'routerTag'])
|
|
11
|
-
linkProps.href.default = undefined
|
|
12
|
-
linkProps.to.default = undefined
|
|
13
|
-
|
|
14
|
-
export const props = makePropsConfigurable(
|
|
15
|
-
sortKeys({
|
|
16
|
-
...linkProps,
|
|
17
|
-
tag: makeProp(PROP_TYPE_STRING, 'div')
|
|
18
|
-
}),
|
|
19
|
-
NAME_NAVBAR_BRAND
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
// --- Main component ---
|
|
23
|
-
|
|
24
|
-
// @vue/component
|
|
25
|
-
export const BNavbarBrand = /*#__PURE__*/ extend({
|
|
26
|
-
name: NAME_NAVBAR_BRAND,
|
|
27
|
-
functional: true,
|
|
28
|
-
props,
|
|
29
|
-
render(h, { props, data, children }) {
|
|
30
|
-
const isLink = props.to || props.href
|
|
31
|
-
const tag = isLink ? BLink : props.tag
|
|
32
|
-
|
|
33
|
-
return h(
|
|
34
|
-
tag,
|
|
35
|
-
mergeData(data, {
|
|
36
|
-
staticClass: 'navbar-brand',
|
|
37
|
-
props: isLink ? pluckProps(linkProps, props) : {}
|
|
38
|
-
}),
|
|
39
|
-
children
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
})
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import { BNavbarBrand } from './navbar-brand'
|
|
3
|
-
|
|
4
|
-
describe('navbar-brand', () => {
|
|
5
|
-
it('default has tag "div"', async () => {
|
|
6
|
-
const wrapper = mount(BNavbarBrand)
|
|
7
|
-
|
|
8
|
-
expect(wrapper.element.tagName).toBe('DIV')
|
|
9
|
-
|
|
10
|
-
wrapper.destroy()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('default has class "navbar-brand"', async () => {
|
|
14
|
-
const wrapper = mount(BNavbarBrand)
|
|
15
|
-
|
|
16
|
-
expect(wrapper.classes()).toContain('navbar-brand')
|
|
17
|
-
expect(wrapper.classes().length).toBe(1)
|
|
18
|
-
|
|
19
|
-
wrapper.destroy()
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('accepts custom tag', async () => {
|
|
23
|
-
const wrapper = mount(BNavbarBrand, {
|
|
24
|
-
context: {
|
|
25
|
-
props: { tag: 'span' }
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
expect(wrapper.element.tagName).toBe('SPAN')
|
|
30
|
-
expect(wrapper.classes()).toContain('navbar-brand')
|
|
31
|
-
expect(wrapper.classes().length).toBe(1)
|
|
32
|
-
|
|
33
|
-
wrapper.destroy()
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it('renders link when href set', async () => {
|
|
37
|
-
const wrapper = mount(BNavbarBrand, {
|
|
38
|
-
context: {
|
|
39
|
-
props: { href: '#foo' }
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
expect(wrapper.element.tagName).toBe('A')
|
|
44
|
-
expect(wrapper.attributes('href')).toBe('#foo')
|
|
45
|
-
expect(wrapper.classes()).toContain('navbar-brand')
|
|
46
|
-
expect(wrapper.classes().length).toBe(1)
|
|
47
|
-
|
|
48
|
-
wrapper.destroy()
|
|
49
|
-
})
|
|
50
|
-
})
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { extend } from '../../vue'
|
|
2
|
-
import { NAME_NAVBAR } from '../../constants/components'
|
|
3
|
-
import {
|
|
4
|
-
PROP_TYPE_BOOLEAN,
|
|
5
|
-
PROP_TYPE_BOOLEAN_STRING,
|
|
6
|
-
PROP_TYPE_STRING
|
|
7
|
-
} from '../../constants/props'
|
|
8
|
-
import { getBreakpoints } from '../../utils/config'
|
|
9
|
-
import { isTag } from '../../utils/dom'
|
|
10
|
-
import { isString } from '../../utils/inspect'
|
|
11
|
-
import { makeProp, makePropsConfigurable } from '../../utils/props'
|
|
12
|
-
import { normalizeSlotMixin } from '../../mixins/normalize-slot'
|
|
13
|
-
|
|
14
|
-
// --- Props ---
|
|
15
|
-
|
|
16
|
-
export const props = makePropsConfigurable(
|
|
17
|
-
{
|
|
18
|
-
fixed: makeProp(PROP_TYPE_STRING),
|
|
19
|
-
print: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
20
|
-
sticky: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
21
|
-
tag: makeProp(PROP_TYPE_STRING, 'nav'),
|
|
22
|
-
toggleable: makeProp(PROP_TYPE_BOOLEAN_STRING, false),
|
|
23
|
-
type: makeProp(PROP_TYPE_STRING, 'light'),
|
|
24
|
-
variant: makeProp(PROP_TYPE_STRING)
|
|
25
|
-
},
|
|
26
|
-
NAME_NAVBAR
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
// --- Main component ---
|
|
30
|
-
|
|
31
|
-
// @vue/component
|
|
32
|
-
export const BNavbar = /*#__PURE__*/ extend({
|
|
33
|
-
name: NAME_NAVBAR,
|
|
34
|
-
mixins: [normalizeSlotMixin],
|
|
35
|
-
provide() {
|
|
36
|
-
return { getBvNavbar: () => this }
|
|
37
|
-
},
|
|
38
|
-
props,
|
|
39
|
-
computed: {
|
|
40
|
-
breakpointClass() {
|
|
41
|
-
const { toggleable } = this
|
|
42
|
-
const xs = getBreakpoints()[0]
|
|
43
|
-
|
|
44
|
-
let breakpoint = null
|
|
45
|
-
if (toggleable && isString(toggleable) && toggleable !== xs) {
|
|
46
|
-
breakpoint = `navbar-expand-${toggleable}`
|
|
47
|
-
} else if (toggleable === false) {
|
|
48
|
-
breakpoint = 'navbar-expand'
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return breakpoint
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
render(h) {
|
|
55
|
-
const { tag, type, variant, fixed } = this
|
|
56
|
-
|
|
57
|
-
return h(
|
|
58
|
-
tag,
|
|
59
|
-
{
|
|
60
|
-
staticClass: 'navbar',
|
|
61
|
-
class: [
|
|
62
|
-
{
|
|
63
|
-
'd-print': this.print,
|
|
64
|
-
'sticky-top': this.sticky,
|
|
65
|
-
[`navbar-${type}`]: type,
|
|
66
|
-
[`bg-${variant}`]: variant,
|
|
67
|
-
[`fixed-${fixed}`]: fixed
|
|
68
|
-
},
|
|
69
|
-
this.breakpointClass
|
|
70
|
-
],
|
|
71
|
-
attrs: {
|
|
72
|
-
role: isTag(tag, 'nav') ? null : 'navigation'
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
[this.normalizeSlot()]
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
})
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import { BNavbar } from './navbar'
|
|
3
|
-
|
|
4
|
-
describe('navbar', () => {
|
|
5
|
-
it('default has tag "nav"', async () => {
|
|
6
|
-
const wrapper = mount(BNavbar)
|
|
7
|
-
|
|
8
|
-
expect(wrapper.element.tagName).toBe('NAV')
|
|
9
|
-
// No role added if default tag is used
|
|
10
|
-
expect(wrapper.attributes('role')).toBeUndefined()
|
|
11
|
-
|
|
12
|
-
wrapper.destroy()
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('default has class "navbar", "navbar-expand", "navbar-light"', async () => {
|
|
16
|
-
const wrapper = mount(BNavbar)
|
|
17
|
-
|
|
18
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
19
|
-
expect(wrapper.classes()).toContain('navbar-expand')
|
|
20
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
21
|
-
expect(wrapper.classes().length).toBe(3)
|
|
22
|
-
|
|
23
|
-
wrapper.destroy()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('accepts custom tag', async () => {
|
|
27
|
-
const wrapper = mount(BNavbar, {
|
|
28
|
-
propsData: { tag: 'div' }
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
expect(wrapper.element.tagName).toBe('DIV')
|
|
32
|
-
expect(wrapper.attributes('role')).toBeDefined()
|
|
33
|
-
expect(wrapper.attributes('role')).toBe('navigation')
|
|
34
|
-
|
|
35
|
-
wrapper.destroy()
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('accepts breakpoint via toggleable prop', async () => {
|
|
39
|
-
const wrapper = mount(BNavbar, {
|
|
40
|
-
propsData: { toggleable: 'lg' }
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
44
|
-
expect(wrapper.classes()).toContain('navbar-expand-lg')
|
|
45
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
46
|
-
expect(wrapper.classes().length).toBe(3)
|
|
47
|
-
|
|
48
|
-
wrapper.destroy()
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('toggleable=true has expected classes', async () => {
|
|
52
|
-
const wrapper = mount(BNavbar, {
|
|
53
|
-
propsData: { toggleable: true }
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
57
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
58
|
-
expect(wrapper.classes().length).toBe(2)
|
|
59
|
-
|
|
60
|
-
wrapper.destroy()
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('toggleable=xs has expected classes', async () => {
|
|
64
|
-
const wrapper = mount(BNavbar, {
|
|
65
|
-
propsData: { toggleable: 'xs' }
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
69
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
70
|
-
expect(wrapper.classes().length).toBe(2)
|
|
71
|
-
|
|
72
|
-
wrapper.destroy()
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('has class "fixed-top" when fixed="top"', async () => {
|
|
76
|
-
const wrapper = mount(BNavbar, {
|
|
77
|
-
propsData: { fixed: 'top' }
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
expect(wrapper.classes()).toContain('fixed-top')
|
|
81
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
82
|
-
expect(wrapper.classes()).toContain('navbar-expand')
|
|
83
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
84
|
-
expect(wrapper.classes().length).toBe(4)
|
|
85
|
-
|
|
86
|
-
wrapper.destroy()
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('has class "fixed-top" when fixed="top"', async () => {
|
|
90
|
-
const wrapper = mount(BNavbar, {
|
|
91
|
-
propsData: { fixed: 'top' }
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
expect(wrapper.classes()).toContain('fixed-top')
|
|
95
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
96
|
-
expect(wrapper.classes()).toContain('navbar-expand')
|
|
97
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
98
|
-
expect(wrapper.classes().length).toBe(4)
|
|
99
|
-
|
|
100
|
-
wrapper.destroy()
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it('has class "sticky-top" when sticky=true', async () => {
|
|
104
|
-
const wrapper = mount(BNavbar, {
|
|
105
|
-
propsData: { sticky: true }
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
expect(wrapper.classes()).toContain('sticky-top')
|
|
109
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
110
|
-
expect(wrapper.classes()).toContain('navbar-expand')
|
|
111
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
112
|
-
expect(wrapper.classes().length).toBe(4)
|
|
113
|
-
|
|
114
|
-
wrapper.destroy()
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
it('accepts variant prop', async () => {
|
|
118
|
-
const wrapper = mount(BNavbar, {
|
|
119
|
-
propsData: { variant: 'primary' }
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
expect(wrapper.classes()).toContain('bg-primary')
|
|
123
|
-
expect(wrapper.classes()).toContain('navbar')
|
|
124
|
-
expect(wrapper.classes()).toContain('navbar-expand')
|
|
125
|
-
expect(wrapper.classes()).toContain('navbar-light')
|
|
126
|
-
expect(wrapper.classes().length).toBe(4)
|
|
127
|
-
|
|
128
|
-
wrapper.destroy()
|
|
129
|
-
})
|
|
130
|
-
})
|