feat(sidebar): restructure sidebar layout, add search clear button, and improve scrolling behavior
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-01-04 - 3.6.0 - feat(sidebar)
|
||||||
|
restructure sidebar layout, add search clear button, and improve scrolling behavior
|
||||||
|
|
||||||
|
- Change sidebar root to a flex column layout and add a .sidebar-header to separate header content from the scrollable menu
|
||||||
|
- Move pinned section into the header and make .menu flex: 1 with min-height: 0 so the menu becomes the scrollable area
|
||||||
|
- Replace overflow-y on the root with overflow:hidden to avoid double scrolling and constrain scrolling to .menu
|
||||||
|
- Add a clear button for the search input (.search-clear) with positioning, hover styles, and a clearSearch() method to reset the query and emit searchChanged
|
||||||
|
- Adjust search input padding and make .search-container position: relative to correctly position the clear button
|
||||||
|
|
||||||
## 2026-01-04 - 3.5.3 - fix(deps)
|
## 2026-01-04 - 3.5.3 - fix(deps)
|
||||||
bump dependency versions: @design.estate/dees-domtools to ^2.3.7, @design.estate/dees-element to ^2.1.5, lit to ^3.3.2; update devDependencies @api.global/typedserver to ^8.1.0 and @git.zone/tstest to ^3.1.4
|
bump dependency versions: @design.estate/dees-domtools to ^2.3.7, @design.estate/dees-element to ^2.1.5, lit to ^3.3.2; update devDependencies @api.global/typedserver to ^8.1.0 and @git.zone/tstest to ^3.1.4
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-wcctools',
|
name: '@design.estate/dees-wcctools',
|
||||||
version: '3.5.3',
|
version: '3.6.0',
|
||||||
description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.'
|
description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ export class WccSidebar extends DeesElement {
|
|||||||
--ring: #3b82f6;
|
--ring: #3b82f6;
|
||||||
--radius: 4px;
|
--radius: 4px;
|
||||||
|
|
||||||
display: ${this.isHidden ? 'none' : 'block'};
|
display: ${this.isHidden ? 'none' : 'flex'};
|
||||||
|
flex-direction: column;
|
||||||
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@@ -81,13 +82,20 @@ export class WccSidebar extends DeesElement {
|
|||||||
width: ${this.sidebarWidth}px;
|
width: ${this.sidebarWidth}px;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
overflow-y: auto;
|
overflow: hidden;
|
||||||
overflow-x: hidden;
|
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-header {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.menu {
|
.menu {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
padding: 0.5rem 0;
|
padding: 0.5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,6 +289,7 @@ export class WccSidebar extends DeesElement {
|
|||||||
.search-container {
|
.search-container {
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
@@ -289,7 +298,7 @@ export class WccSidebar extends DeesElement {
|
|||||||
background: var(--input);
|
background: var(--input);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 1.75rem 0.5rem 0.75rem;
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
@@ -305,6 +314,33 @@ export class WccSidebar extends DeesElement {
|
|||||||
color: var(--muted-foreground);
|
color: var(--muted-foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-clear {
|
||||||
|
position: absolute;
|
||||||
|
right: 0.75rem;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0.25rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--muted-foreground);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 2px;
|
||||||
|
transition: color 0.15s ease, background 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-clear:hover {
|
||||||
|
color: var(--foreground);
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-clear .material-symbols-outlined {
|
||||||
|
font-size: 14px;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.highlight {
|
.highlight {
|
||||||
background: rgba(59, 130, 246, 0.3);
|
background: rgba(59, 130, 246, 0.3);
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
@@ -394,17 +430,24 @@ export class WccSidebar extends DeesElement {
|
|||||||
background: var(--primary);
|
background: var(--primary);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="search-container">
|
<div class="sidebar-header">
|
||||||
<input
|
<div class="search-container">
|
||||||
type="text"
|
<input
|
||||||
class="search-input"
|
type="text"
|
||||||
placeholder="Search..."
|
class="search-input"
|
||||||
.value=${this.searchQuery}
|
placeholder="Search..."
|
||||||
@input=${this.handleSearchInput}
|
.value=${this.searchQuery}
|
||||||
/>
|
@input=${this.handleSearchInput}
|
||||||
|
/>
|
||||||
|
${this.searchQuery ? html`
|
||||||
|
<button class="search-clear" @click=${this.clearSearch}>
|
||||||
|
<i class="material-symbols-outlined">close</i>
|
||||||
|
</button>
|
||||||
|
` : null}
|
||||||
|
</div>
|
||||||
|
${this.renderPinnedSection()}
|
||||||
</div>
|
</div>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
${this.renderPinnedSection()}
|
|
||||||
${this.renderSections()}
|
${this.renderSections()}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -716,6 +759,11 @@ export class WccSidebar extends DeesElement {
|
|||||||
this.dispatchEvent(new CustomEvent('searchChanged', { detail: this.searchQuery }));
|
this.dispatchEvent(new CustomEvent('searchChanged', { detail: this.searchQuery }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private clearSearch() {
|
||||||
|
this.searchQuery = '';
|
||||||
|
this.dispatchEvent(new CustomEvent('searchChanged', { detail: this.searchQuery }));
|
||||||
|
}
|
||||||
|
|
||||||
private matchesSearch(name: string): boolean {
|
private matchesSearch(name: string): boolean {
|
||||||
if (!this.searchQuery) return true;
|
if (!this.searchQuery) return true;
|
||||||
return name.toLowerCase().includes(this.searchQuery.toLowerCase());
|
return name.toLowerCase().includes(this.searchQuery.toLowerCase());
|
||||||
|
|||||||
Reference in New Issue
Block a user