@@ -33,117 +33,6 @@ emit('toggle-navigation', {
33
33
})
34
34
```
35
35
36
- #### With in-app search
37
-
38
- ```vue
39
- <template>
40
- <div class="styleguide-wrapper">
41
- <NcContent app-name="styleguide-app-navigation" class="content-styleguidist">
42
- <NcAppNavigation show-search :search.sync="searchQuery">
43
- <template #search-actions>
44
- <NcActions aria-label="Filters">
45
- <template #icon>
46
- <IconFilter :size="20" />
47
- </template>
48
- <NcActionButton>
49
- <template #icon>
50
- <IconAccount :size="20" />
51
- </template>
52
- Filter by name
53
- </NcActionButton>
54
- <NcActionButton>
55
- <template #icon>
56
- <IconCalendarAccount :size="20" />
57
- </template>
58
- Filter by year
59
- </NcActionButton>
60
- </NcActions>
61
- <NcButton aria-label="Search globally" type="tertiary">
62
- <template #icon>
63
- <IconSearchGlobal :size="20" />
64
- </template>
65
- </NcButton>
66
- </template>
67
- <template #list>
68
- <NcAppNavigationItem name="First navigation entry">
69
- <template #icon>
70
- <IconStar :size="20" />
71
- </template>
72
- </NcAppNavigationItem>
73
- <NcAppNavigationItem name="Second navigation entry">
74
- <template #icon>
75
- <IconStar :size="20" />
76
- </template>
77
- </NcAppNavigationItem>
78
- </template>
79
- </NcAppNavigation>
80
- <NcAppContent>
81
- <ul class="fake-content">
82
- <li>Search query: {{ searchQuery }}</li>
83
- <li v-for="(item, index) in items" :key="index">
84
- {{ item }}
85
- </li>
86
- </ul>
87
- </NcAppContent>
88
- </NcContent>
89
- </div>
90
- </template>
91
- <script>
92
- import IconAccount from 'vue-material-design-icons/Account.vue'
93
- import IconCalendarAccount from 'vue-material-design-icons/CalendarAccount.vue'
94
- import IconFilter from 'vue-material-design-icons/Filter.vue'
95
- import IconSearchGlobal from 'vue-material-design-icons/CloudSearch.vue'
96
- import IconStar from 'vue-material-design-icons/Star.vue'
97
-
98
- const exampleItem = ['Mary', 'Patricia', 'James', 'Michael']
99
-
100
- export default {
101
- components: {
102
- IconAccount,
103
- IconCalendarAccount,
104
- IconFilter,
105
- IconSearchGlobal,
106
- IconStar,
107
- },
108
-
109
- data() {
110
- return {
111
- searchQuery: '',
112
- }
113
- },
114
-
115
- computed: {
116
- items() {
117
- return exampleItem.filter((item) => item.toLocaleLowerCase().includes(this.searchQuery.toLocaleLowerCase()))
118
- },
119
- },
120
- }
121
- </script>
122
- <style scoped>
123
- /* This styles just mock NcContent and NcAppContent */
124
- .content-styleguidist {
125
- position: relative !important;
126
- margin: 0 !important;
127
- /* prevent jumping */
128
- min-height: 200px;
129
- }
130
-
131
- .content-styleguidist > * {
132
- height: auto;
133
- }
134
-
135
- .fake-content {
136
- padding: var(--app-navigation-padding);
137
- padding-top: calc(2 * var(--app-navigation-padding) + var(--default-clickable-area));
138
- }
139
-
140
- .styleguide-wrapper {
141
- background-color: var(--color-background-plain);
142
- padding: var(--body-container-margin);
143
- }
144
- </style>
145
- ```
146
-
147
36
</docs>
148
37
149
38
<template>
@@ -157,28 +46,21 @@ export default {
157
46
class="app-navigation__content"
158
47
:inert="!open || undefined"
159
48
@keydown.esc="handleEsc">
49
+ <div class="app-navigation__search">
50
+ <!-- @slot For in-app search you can pass a `NcAppNavigationSearch` component as the slot content. -->
51
+ <slot name="search" />
52
+ </div>
160
53
<div class="app-navigation__body" :class="{ 'app-navigation__body--no-list': !$scopedSlots.list }">
161
- <NcAppNavigationSearch v-if="showSearch"
162
- :label="searchLabel || undefined"
163
- :no-inline-actions="noSearchInlineActions"
164
- :value="search"
165
- @update:value="$emit('update:search', $event)">
166
- <template #actions>
167
- <!-- @slot Optional actions, like NcActions or icon only buttons, to show next to the search input -->
168
- <slot name="search-actions" />
169
- </template>
170
- </NcAppNavigationSearch>
171
-
172
- <!-- The main content of the navigation. If no list is passed to the #list slot, stretched vertically. -->
54
+ <!-- @slot The main content of the navigation. If no list is passed to the #list slot, stretched vertically. -->
173
55
<slot />
174
56
</div>
175
57
176
58
<NcAppNavigationList v-if="$scopedSlots.list" class="app-navigation__list">
177
- <!-- List for Navigation list items. Stretched between the main content and the footer -->
59
+ <!-- @slot List for Navigation list items. Stretched between the main content and the footer -->
178
60
<slot name="list" />
179
61
</NcAppNavigationList>
180
62
181
- <!-- Footer for e.g. NcAppNavigationSettings -->
63
+ <!-- @slot Footer for e.g. NcAppNavigationSettings -->
182
64
<slot name="footer" />
183
65
</nav>
184
66
<NcAppNavigationToggle :open="open" @update:open="toggleNavigation" />
@@ -192,7 +74,6 @@ import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
192
74
import { createFocusTrap } from 'focus-trap'
193
75
194
76
import NcAppNavigationList from '../NcAppNavigationList/index.js'
195
- import NcAppNavigationSearch from './NcAppNavigationSearch.vue'
196
77
import NcAppNavigationToggle from '../NcAppNavigationToggle/index.js'
197
78
import Vue from 'vue'
198
79
@@ -201,7 +82,6 @@ export default {
201
82
202
83
components: {
203
84
NcAppNavigationList,
204
- NcAppNavigationSearch,
205
85
NcAppNavigationToggle,
206
86
},
207
87
@@ -229,38 +109,6 @@ export default {
229
109
type: String,
230
110
default: '',
231
111
},
232
-
233
- /**
234
- * If set an in-app search is shown as the first entry
235
- */
236
- showSearch: {
237
- type: Boolean,
238
- default: false,
239
- },
240
-
241
- /**
242
- * The current search query
243
- */
244
- search: {
245
- type: String,
246
- default: '',
247
- },
248
-
249
- /**
250
- * Label of in-app search input
251
- */
252
- searchLabel: {
253
- type: String,
254
- default: null,
255
- },
256
-
257
- /**
258
- * Force a menu if there is more than one search action
259
- */
260
- noSearchInlineActions: {
261
- type: Boolean,
262
- default: false,
263
- },
264
112
},
265
113
266
114
setup() {
@@ -399,6 +247,14 @@ export default {
399
247
margin-left: calc(-1 * min($navigation-width, var(--app-navigation-max-width)));
400
248
}
401
249
250
+ &__search {
251
+ width: 100%;
252
+ }
253
+
254
+ &__body {
255
+ overflow-y: scroll;
256
+ }
257
+
402
258
// For legacy purposes support passing a bare list to the content in #default slot and including #footer slot
403
259
// Same styles as NcAppNavigationList
404
260
&__content > ul {
0 commit comments