@miozu/jera 0.3.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +350 -59
- package/README.md +30 -22
- package/llms.txt +37 -4
- package/package.json +12 -2
- package/src/components/docs/CodeBlock.svelte +203 -0
- package/src/components/docs/DocSection.svelte +120 -0
- package/src/components/docs/PropsTable.svelte +136 -0
- package/src/components/docs/SplitPane.svelte +98 -0
- package/src/components/docs/index.js +14 -0
- package/src/components/feedback/Alert.svelte +234 -0
- package/src/components/feedback/EmptyState.svelte +6 -6
- package/src/components/feedback/ProgressBar.svelte +8 -8
- package/src/components/feedback/Skeleton.svelte +4 -4
- package/src/components/feedback/Spinner.svelte +1 -1
- package/src/components/feedback/Toast.svelte +137 -173
- package/src/components/forms/Checkbox.svelte +10 -10
- package/src/components/forms/Dropzone.svelte +14 -14
- package/src/components/forms/FileUpload.svelte +16 -16
- package/src/components/forms/IconInput.svelte +4 -4
- package/src/components/forms/Input.svelte +14 -14
- package/src/components/forms/NumberInput.svelte +13 -13
- package/src/components/forms/PinInput.svelte +8 -8
- package/src/components/forms/Radio.svelte +8 -8
- package/src/components/forms/RangeSlider.svelte +12 -12
- package/src/components/forms/SearchInput.svelte +10 -10
- package/src/components/forms/Select.svelte +156 -158
- package/src/components/forms/Switch.svelte +4 -4
- package/src/components/forms/Textarea.svelte +9 -9
- package/src/components/navigation/Accordion.svelte +1 -1
- package/src/components/navigation/AccordionItem.svelte +6 -6
- package/src/components/navigation/NavigationContainer.svelte +344 -0
- package/src/components/navigation/Sidebar.svelte +334 -0
- package/src/components/navigation/SidebarAccountGroup.svelte +495 -0
- package/src/components/navigation/SidebarAccountItem.svelte +492 -0
- package/src/components/navigation/SidebarGroup.svelte +230 -0
- package/src/components/navigation/SidebarGroupSwitcher.svelte +262 -0
- package/src/components/navigation/SidebarItem.svelte +210 -0
- package/src/components/navigation/SidebarNavigationItem.svelte +470 -0
- package/src/components/navigation/SidebarPopover.svelte +145 -0
- package/src/components/navigation/SidebarSearch.svelte +236 -0
- package/src/components/navigation/SidebarSection.svelte +158 -0
- package/src/components/navigation/SidebarToggle.svelte +86 -0
- package/src/components/navigation/Tabs.svelte +18 -18
- package/src/components/navigation/WorkspaceMenu.svelte +416 -0
- package/src/components/navigation/blocks/NavigationAccountGroup.svelte +396 -0
- package/src/components/navigation/blocks/NavigationCustomBlock.svelte +74 -0
- package/src/components/navigation/blocks/NavigationGroupSwitcher.svelte +277 -0
- package/src/components/navigation/blocks/NavigationSearch.svelte +300 -0
- package/src/components/navigation/blocks/NavigationSection.svelte +230 -0
- package/src/components/navigation/index.js +22 -0
- package/src/components/overlays/ConfirmDialog.svelte +18 -18
- package/src/components/overlays/Dropdown.svelte +2 -2
- package/src/components/overlays/DropdownDivider.svelte +1 -1
- package/src/components/overlays/DropdownItem.svelte +5 -5
- package/src/components/overlays/Modal.svelte +13 -13
- package/src/components/overlays/Popover.svelte +3 -3
- package/src/components/primitives/Avatar.svelte +12 -12
- package/src/components/primitives/Badge.svelte +7 -7
- package/src/components/primitives/Button.svelte +126 -174
- package/src/components/primitives/Card.svelte +15 -15
- package/src/components/primitives/Divider.svelte +3 -3
- package/src/components/primitives/LazyImage.svelte +1 -1
- package/src/components/primitives/Link.svelte +2 -2
- package/src/components/primitives/Stat.svelte +197 -0
- package/src/components/primitives/StatusBadge.svelte +24 -24
- package/src/index.js +62 -7
- package/src/tokens/colors.css +96 -128
- package/src/utils/highlighter.js +124 -0
- package/src/utils/index.js +7 -2
- package/src/utils/navigation.svelte.js +423 -0
- package/src/utils/reactive.svelte.js +126 -37
- package/src/utils/sidebar.svelte.js +211 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component NavigationGroupSwitcher
|
|
3
|
+
|
|
4
|
+
Enterprise group switcher block for investment groups or similar.
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
import { getContext } from 'svelte';
|
|
8
|
+
import { slide } from 'svelte/transition';
|
|
9
|
+
import { cubicOut } from 'svelte/easing';
|
|
10
|
+
import { SIDEBAR_CONTEXT_KEY } from '../../../utils/sidebar.svelte.js';
|
|
11
|
+
import { NAVIGATION_CONTEXT_KEY } from '../../../utils/navigation.svelte.js';
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
block,
|
|
15
|
+
navigationState = null,
|
|
16
|
+
onEvent = null
|
|
17
|
+
} = $props();
|
|
18
|
+
|
|
19
|
+
const sidebar = getContext(SIDEBAR_CONTEXT_KEY);
|
|
20
|
+
const navContext = getContext(NAVIGATION_CONTEXT_KEY);
|
|
21
|
+
const navState = navigationState || navContext;
|
|
22
|
+
|
|
23
|
+
const isCollapsed = $derived(sidebar?.collapsed ?? false);
|
|
24
|
+
|
|
25
|
+
const config = $derived({
|
|
26
|
+
title: block.title || 'Groups',
|
|
27
|
+
collapsible: block.collapsible ?? true,
|
|
28
|
+
defaultExpanded: block.defaultExpanded ?? false,
|
|
29
|
+
showCount: block.showCount ?? true,
|
|
30
|
+
showCreateButton: block.showCreateButton ?? true,
|
|
31
|
+
...block.config
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const groups = $derived(block.groups || []);
|
|
35
|
+
const currentGroup = $derived(block.currentGroup || null);
|
|
36
|
+
|
|
37
|
+
const filteredGroups = $derived.by(() => {
|
|
38
|
+
if (!navState?.searchQuery) return groups;
|
|
39
|
+
const query = navState.searchQuery.toLowerCase();
|
|
40
|
+
return groups.filter(group => group.name?.toLowerCase().includes(query));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const sectionId = block.id;
|
|
44
|
+
const isExpanded = $derived(
|
|
45
|
+
config.collapsible
|
|
46
|
+
? (navState?.isSectionExpanded(sectionId) ?? config.defaultExpanded)
|
|
47
|
+
: true
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
function toggleSection() {
|
|
51
|
+
if (navState) navState.toggleSection(sectionId);
|
|
52
|
+
if (onEvent) onEvent('section_toggled', { sectionId, expanded: !isExpanded });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleGroupClick(group) {
|
|
56
|
+
if (onEvent) onEvent('group_selected', { group });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleCreateGroup() {
|
|
60
|
+
if (onEvent) onEvent('create_group_clicked', {});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isGroupActive(group) {
|
|
64
|
+
return currentGroup?.id === group.id;
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
{#if groups.length > 0}
|
|
69
|
+
<div class="nav-group-switcher-block">
|
|
70
|
+
{#if config.title && !isCollapsed}
|
|
71
|
+
<button
|
|
72
|
+
class="section-header"
|
|
73
|
+
onclick={toggleSection}
|
|
74
|
+
aria-expanded={isExpanded}
|
|
75
|
+
>
|
|
76
|
+
<span class="section-title">{config.title}</span>
|
|
77
|
+
|
|
78
|
+
{#if config.showCount}
|
|
79
|
+
<span class="section-count">{groups.length}</span>
|
|
80
|
+
{/if}
|
|
81
|
+
|
|
82
|
+
<svg
|
|
83
|
+
class="section-chevron {isExpanded ? 'expanded' : 'collapsed'}"
|
|
84
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
85
|
+
width="14"
|
|
86
|
+
height="14"
|
|
87
|
+
viewBox="0 0 24 24"
|
|
88
|
+
fill="none"
|
|
89
|
+
stroke="currentColor"
|
|
90
|
+
stroke-width="2"
|
|
91
|
+
stroke-linecap="round"
|
|
92
|
+
stroke-linejoin="round"
|
|
93
|
+
>
|
|
94
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
95
|
+
</svg>
|
|
96
|
+
</button>
|
|
97
|
+
{:else if config.title && isCollapsed}
|
|
98
|
+
<div class="section-divider"></div>
|
|
99
|
+
{/if}
|
|
100
|
+
|
|
101
|
+
{#if isExpanded}
|
|
102
|
+
<div class="groups-list" transition:slide={{ duration: 200, easing: cubicOut }}>
|
|
103
|
+
{#each filteredGroups as group (group.id)}
|
|
104
|
+
<button
|
|
105
|
+
class="group-item {isGroupActive(group) ? 'active' : ''}"
|
|
106
|
+
onclick={() => handleGroupClick(group)}
|
|
107
|
+
title={group.name}
|
|
108
|
+
>
|
|
109
|
+
<svg
|
|
110
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
111
|
+
width="14"
|
|
112
|
+
height="14"
|
|
113
|
+
viewBox="0 0 24 24"
|
|
114
|
+
fill="none"
|
|
115
|
+
stroke="currentColor"
|
|
116
|
+
stroke-width="2"
|
|
117
|
+
stroke-linecap="round"
|
|
118
|
+
stroke-linejoin="round"
|
|
119
|
+
>
|
|
120
|
+
<path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path>
|
|
121
|
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
122
|
+
<path d="M16 10a4 4 0 0 1-8 0"></path>
|
|
123
|
+
</svg>
|
|
124
|
+
<span class="group-name">{group.name}</span>
|
|
125
|
+
</button>
|
|
126
|
+
{/each}
|
|
127
|
+
|
|
128
|
+
{#if config.showCreateButton}
|
|
129
|
+
<button class="add-group-btn" onclick={handleCreateGroup}>
|
|
130
|
+
<svg
|
|
131
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
132
|
+
width="14"
|
|
133
|
+
height="14"
|
|
134
|
+
viewBox="0 0 24 24"
|
|
135
|
+
fill="none"
|
|
136
|
+
stroke="currentColor"
|
|
137
|
+
stroke-width="2"
|
|
138
|
+
stroke-linecap="round"
|
|
139
|
+
stroke-linejoin="round"
|
|
140
|
+
>
|
|
141
|
+
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
142
|
+
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
143
|
+
</svg>
|
|
144
|
+
<span>Create Group</span>
|
|
145
|
+
</button>
|
|
146
|
+
{/if}
|
|
147
|
+
</div>
|
|
148
|
+
{/if}
|
|
149
|
+
</div>
|
|
150
|
+
{/if}
|
|
151
|
+
|
|
152
|
+
<style>
|
|
153
|
+
.nav-group-switcher-block {
|
|
154
|
+
margin-bottom: var(--nav-block-spacing, 0.5rem);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.section-header {
|
|
158
|
+
width: 100%;
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
gap: 0.5rem;
|
|
162
|
+
padding: 0.5rem 0.75rem;
|
|
163
|
+
font-size: 0.75rem;
|
|
164
|
+
font-weight: 600;
|
|
165
|
+
color: var(--color-text-muted, var(--color-base04, #737E99));
|
|
166
|
+
text-transform: uppercase;
|
|
167
|
+
letter-spacing: 0.05em;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
transition: all var(--nav-transition-duration) var(--nav-transition-easing);
|
|
170
|
+
border: none;
|
|
171
|
+
background: transparent;
|
|
172
|
+
font-family: inherit;
|
|
173
|
+
justify-content: flex-start;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.section-header:hover {
|
|
177
|
+
color: var(--color-text, var(--color-base05, #D0D2DB));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.section-title {
|
|
181
|
+
flex: 1;
|
|
182
|
+
text-align: left;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.section-count {
|
|
186
|
+
padding: 0.125rem 0.375rem;
|
|
187
|
+
font-size: 0.625rem;
|
|
188
|
+
background: var(--color-surface-alt, var(--color-base02, #3E4359));
|
|
189
|
+
color: var(--color-text-muted, var(--color-base05, #D0D2DB));
|
|
190
|
+
border-radius: 9999px;
|
|
191
|
+
flex-shrink: 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.section-chevron {
|
|
195
|
+
color: var(--color-text-muted, var(--color-base04, #737E99));
|
|
196
|
+
transition: all var(--nav-transition-duration) var(--nav-transition-easing);
|
|
197
|
+
flex-shrink: 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.section-chevron.expanded {
|
|
201
|
+
transform: rotate(180deg);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.section-divider {
|
|
205
|
+
margin: 0.5rem 0.75rem;
|
|
206
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-base03, #565E78) 30%, transparent);
|
|
207
|
+
height: 1px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.groups-list {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
gap: 0.125rem;
|
|
214
|
+
padding: 0 0.5rem;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.group-item {
|
|
218
|
+
width: 100%;
|
|
219
|
+
padding: 0.5rem 0.75rem;
|
|
220
|
+
display: flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: 0.75rem;
|
|
223
|
+
font-size: 0.875rem;
|
|
224
|
+
color: var(--nav-item-color);
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
border-radius: var(--nav-item-border-radius);
|
|
227
|
+
transition: all var(--nav-transition-duration) var(--nav-transition-easing);
|
|
228
|
+
border: none;
|
|
229
|
+
background: transparent;
|
|
230
|
+
font-family: inherit;
|
|
231
|
+
text-align: left;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.group-item:hover {
|
|
235
|
+
color: var(--nav-item-hover-color);
|
|
236
|
+
background: var(--nav-item-hover-background);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.group-item.active {
|
|
240
|
+
background: var(--nav-item-active-background);
|
|
241
|
+
color: var(--nav-item-active-color);
|
|
242
|
+
font-weight: var(--nav-item-active-weight);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.group-name {
|
|
246
|
+
flex: 1;
|
|
247
|
+
text-align: left;
|
|
248
|
+
white-space: nowrap;
|
|
249
|
+
overflow: hidden;
|
|
250
|
+
text-overflow: ellipsis;
|
|
251
|
+
font-weight: 500;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.add-group-btn {
|
|
255
|
+
width: 100%;
|
|
256
|
+
padding: 0.5rem 0.75rem;
|
|
257
|
+
margin-top: 0.25rem;
|
|
258
|
+
display: flex;
|
|
259
|
+
align-items: center;
|
|
260
|
+
gap: 0.5rem;
|
|
261
|
+
justify-content: center;
|
|
262
|
+
font-size: 0.875rem;
|
|
263
|
+
color: var(--color-text-muted, var(--color-base05, #D0D2DB));
|
|
264
|
+
cursor: pointer;
|
|
265
|
+
border-radius: var(--nav-item-border-radius);
|
|
266
|
+
transition: all var(--nav-transition-duration) var(--nav-transition-easing);
|
|
267
|
+
border: 1px solid color-mix(in srgb, var(--color-base03, #565E78) 30%, transparent);
|
|
268
|
+
background: transparent;
|
|
269
|
+
font-family: inherit;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.add-group-btn:hover {
|
|
273
|
+
color: var(--nav-item-hover-color);
|
|
274
|
+
background: color-mix(in srgb, var(--nav-item-hover-color) 5%, transparent);
|
|
275
|
+
border-color: var(--nav-item-hover-color);
|
|
276
|
+
}
|
|
277
|
+
</style>
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component NavigationSearch
|
|
3
|
+
|
|
4
|
+
Enterprise search block with advanced filtering and customization.
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
import { getContext } from 'svelte';
|
|
8
|
+
import { fade, fly } from 'svelte/transition';
|
|
9
|
+
import { SIDEBAR_CONTEXT_KEY } from '../../../utils/sidebar.svelte.js';
|
|
10
|
+
import { NAVIGATION_CONTEXT_KEY } from '../../../utils/navigation.svelte.js';
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
block,
|
|
14
|
+
navigationState = null,
|
|
15
|
+
onEvent = null
|
|
16
|
+
} = $props();
|
|
17
|
+
|
|
18
|
+
const sidebar = getContext(SIDEBAR_CONTEXT_KEY);
|
|
19
|
+
const navContext = getContext(NAVIGATION_CONTEXT_KEY);
|
|
20
|
+
const navState = navigationState || navContext;
|
|
21
|
+
|
|
22
|
+
const isCollapsed = $derived(sidebar?.collapsed ?? false);
|
|
23
|
+
|
|
24
|
+
// Block configuration with defaults
|
|
25
|
+
const config = $derived({
|
|
26
|
+
placeholder: 'Search navigation...',
|
|
27
|
+
expandable: true,
|
|
28
|
+
showClearButton: true,
|
|
29
|
+
debounceMs: 300,
|
|
30
|
+
caseSensitive: false,
|
|
31
|
+
...block.config
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
let searchInput;
|
|
35
|
+
let searchExpanded = $state(false);
|
|
36
|
+
let debounceTimer;
|
|
37
|
+
|
|
38
|
+
// Reactive search query from navigation state
|
|
39
|
+
const searchQuery = $derived(navState?.searchQuery ?? '');
|
|
40
|
+
|
|
41
|
+
function expandSearch() {
|
|
42
|
+
searchExpanded = true;
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
if (searchInput) searchInput.focus();
|
|
45
|
+
}, 50);
|
|
46
|
+
|
|
47
|
+
if (onEvent) onEvent('search_expanded', {});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function collapseSearch() {
|
|
51
|
+
searchExpanded = false;
|
|
52
|
+
if (navState) {
|
|
53
|
+
navState.clearSearch();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (onEvent) onEvent('search_collapsed', {});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleInput(event) {
|
|
60
|
+
const query = event.target.value;
|
|
61
|
+
|
|
62
|
+
// Clear previous debounce
|
|
63
|
+
if (debounceTimer) {
|
|
64
|
+
clearTimeout(debounceTimer);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Debounce search
|
|
68
|
+
debounceTimer = setTimeout(() => {
|
|
69
|
+
if (navState) {
|
|
70
|
+
navState.search(query);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (onEvent) {
|
|
74
|
+
onEvent('search_query_changed', { query });
|
|
75
|
+
}
|
|
76
|
+
}, config.debounceMs);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function handleKeydown(event) {
|
|
80
|
+
if (event.key === 'Escape') {
|
|
81
|
+
collapseSearch();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (onEvent) {
|
|
85
|
+
onEvent('search_keydown', { key: event.key, query: searchQuery });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function handleBlur() {
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
if (!searchQuery?.trim()) {
|
|
92
|
+
searchExpanded = false;
|
|
93
|
+
}
|
|
94
|
+
}, 200);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function clearSearch() {
|
|
98
|
+
if (navState) {
|
|
99
|
+
navState.clearSearch();
|
|
100
|
+
}
|
|
101
|
+
collapseSearch();
|
|
102
|
+
|
|
103
|
+
if (onEvent) onEvent('search_cleared', {});
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<div class="nav-search-block">
|
|
108
|
+
{#if searchExpanded || !config.expandable}
|
|
109
|
+
<div class="search-input-wrapper" transition:fly={{ x: -20, duration: 200 }}>
|
|
110
|
+
<svg
|
|
111
|
+
class="search-icon"
|
|
112
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
113
|
+
width="16"
|
|
114
|
+
height="16"
|
|
115
|
+
viewBox="0 0 24 24"
|
|
116
|
+
fill="none"
|
|
117
|
+
stroke="currentColor"
|
|
118
|
+
stroke-width="2"
|
|
119
|
+
stroke-linecap="round"
|
|
120
|
+
stroke-linejoin="round"
|
|
121
|
+
>
|
|
122
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
123
|
+
<path d="m21 21-4.35-4.35"></path>
|
|
124
|
+
</svg>
|
|
125
|
+
|
|
126
|
+
<input
|
|
127
|
+
bind:this={searchInput}
|
|
128
|
+
type="text"
|
|
129
|
+
value={searchQuery}
|
|
130
|
+
placeholder={config.placeholder}
|
|
131
|
+
class="search-input"
|
|
132
|
+
oninput={handleInput}
|
|
133
|
+
onblur={handleBlur}
|
|
134
|
+
onkeydown={handleKeydown}
|
|
135
|
+
/>
|
|
136
|
+
|
|
137
|
+
{#if config.showClearButton && searchQuery}
|
|
138
|
+
<button
|
|
139
|
+
class="search-clear"
|
|
140
|
+
onclick={clearSearch}
|
|
141
|
+
title="Clear search"
|
|
142
|
+
transition:fade={{ duration: 150 }}
|
|
143
|
+
>
|
|
144
|
+
<svg
|
|
145
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
146
|
+
width="14"
|
|
147
|
+
height="14"
|
|
148
|
+
viewBox="0 0 24 24"
|
|
149
|
+
fill="none"
|
|
150
|
+
stroke="currentColor"
|
|
151
|
+
stroke-width="2"
|
|
152
|
+
stroke-linecap="round"
|
|
153
|
+
stroke-linejoin="round"
|
|
154
|
+
>
|
|
155
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
156
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
157
|
+
</svg>
|
|
158
|
+
</button>
|
|
159
|
+
{/if}
|
|
160
|
+
</div>
|
|
161
|
+
{:else}
|
|
162
|
+
<button
|
|
163
|
+
class="search-toggle"
|
|
164
|
+
onclick={expandSearch}
|
|
165
|
+
title="Search navigation"
|
|
166
|
+
transition:fly={{ x: -20, duration: 200, delay: 50 }}
|
|
167
|
+
>
|
|
168
|
+
<svg
|
|
169
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
170
|
+
width="16"
|
|
171
|
+
height="16"
|
|
172
|
+
viewBox="0 0 24 24"
|
|
173
|
+
fill="none"
|
|
174
|
+
stroke="currentColor"
|
|
175
|
+
stroke-width="2"
|
|
176
|
+
stroke-linecap="round"
|
|
177
|
+
stroke-linejoin="round"
|
|
178
|
+
>
|
|
179
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
180
|
+
<path d="m21 21-4.35-4.35"></path>
|
|
181
|
+
</svg>
|
|
182
|
+
|
|
183
|
+
{#if !isCollapsed}
|
|
184
|
+
<span class="search-label" transition:fly={{ x: -15, duration: 200, delay: 75 }}>
|
|
185
|
+
Search
|
|
186
|
+
</span>
|
|
187
|
+
{/if}
|
|
188
|
+
</button>
|
|
189
|
+
{/if}
|
|
190
|
+
|
|
191
|
+
<!-- Search results summary -->
|
|
192
|
+
{#if searchQuery && navState?.visibleItemCount !== navState?.totalItemCount}
|
|
193
|
+
<div class="search-results-summary" transition:fade={{ duration: 200 }}>
|
|
194
|
+
<span class="results-text">
|
|
195
|
+
{navState.visibleItemCount} of {navState.totalItemCount} items
|
|
196
|
+
</span>
|
|
197
|
+
</div>
|
|
198
|
+
{/if}
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<style>
|
|
202
|
+
.nav-search-block {
|
|
203
|
+
padding: var(--nav-search-block-padding, 0.5rem);
|
|
204
|
+
border-bottom: var(--nav-search-border, 1px solid color-mix(in srgb, var(--color-base03, #565E78) 30%, transparent));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.search-toggle {
|
|
208
|
+
width: 100%;
|
|
209
|
+
display: flex;
|
|
210
|
+
align-items: center;
|
|
211
|
+
gap: 0.75rem;
|
|
212
|
+
padding: 0.5rem 0.75rem;
|
|
213
|
+
font-size: 0.875rem;
|
|
214
|
+
color: var(--nav-item-color);
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
border-radius: var(--nav-item-border-radius);
|
|
217
|
+
transition: all var(--nav-transition-duration) var(--nav-transition-easing);
|
|
218
|
+
border: none;
|
|
219
|
+
background: transparent;
|
|
220
|
+
font-family: inherit;
|
|
221
|
+
text-align: left;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.search-toggle:hover {
|
|
225
|
+
color: var(--nav-item-hover-color);
|
|
226
|
+
background: var(--nav-item-hover-background);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.search-label {
|
|
230
|
+
flex: 1;
|
|
231
|
+
text-align: left;
|
|
232
|
+
font-weight: 500;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.search-input-wrapper {
|
|
236
|
+
position: relative;
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
padding: 0 0.75rem;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.search-icon {
|
|
243
|
+
position: absolute;
|
|
244
|
+
left: 1.25rem;
|
|
245
|
+
color: var(--color-text-muted, var(--color-base04, #737E99));
|
|
246
|
+
pointer-events: none;
|
|
247
|
+
z-index: 10;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.search-input {
|
|
251
|
+
width: 100%;
|
|
252
|
+
padding: 0.5rem 2.25rem 0.5rem 2.25rem;
|
|
253
|
+
background: var(--color-surface-alt, var(--color-base02, #3E4359));
|
|
254
|
+
border: 1px solid color-mix(in srgb, var(--color-base03, #565E78) 40%, transparent);
|
|
255
|
+
border-radius: var(--nav-item-border-radius);
|
|
256
|
+
font-size: 0.875rem;
|
|
257
|
+
color: var(--nav-item-color);
|
|
258
|
+
transition: all var(--nav-transition-duration) var(--nav-transition-easing);
|
|
259
|
+
font-family: inherit;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.search-input::placeholder {
|
|
263
|
+
color: var(--color-text-muted, var(--color-base04, #737E99));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.search-input:focus {
|
|
267
|
+
outline: none;
|
|
268
|
+
border-color: var(--nav-item-active-color);
|
|
269
|
+
background: var(--nav-container-bg);
|
|
270
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--nav-item-active-color) 20%, transparent);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.search-clear {
|
|
274
|
+
position: absolute;
|
|
275
|
+
right: 1.25rem;
|
|
276
|
+
padding: 0.25rem;
|
|
277
|
+
border-radius: 0.25rem;
|
|
278
|
+
color: var(--color-text-muted, var(--color-base05, #D0D2DB));
|
|
279
|
+
cursor: pointer;
|
|
280
|
+
border: none;
|
|
281
|
+
background: transparent;
|
|
282
|
+
transition: all var(--nav-transition-duration) var(--nav-transition-easing);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.search-clear:hover {
|
|
286
|
+
background: color-mix(in srgb, var(--color-base03, #565E78) 50%, transparent);
|
|
287
|
+
color: var(--nav-item-color);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.search-results-summary {
|
|
291
|
+
padding: 0.25rem 0.75rem;
|
|
292
|
+
font-size: 0.75rem;
|
|
293
|
+
color: var(--color-text-muted, var(--color-base05, #D0D2DB));
|
|
294
|
+
text-align: center;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.results-text {
|
|
298
|
+
font-weight: 500;
|
|
299
|
+
}
|
|
300
|
+
</style>
|