Add comprehensive UI component expansion
- Add new components: enhanced-table, fab-menu, icon-button, snackbar, select, tag-input, bottom-navigation, stepper, command-palette, floating-toolbar, transfer-list - Refactor table-actions and select components - Update component styles and exports - Add corresponding demo components 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
@use '../../../../../shared-ui/src/styles/semantic' as *;
|
||||
|
||||
.demo-container {
|
||||
padding: $semantic-spacing-layout-section-lg;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
|
||||
h2 {
|
||||
font-family: map-get($semantic-typography-heading-h2, font-family);
|
||||
font-size: map-get($semantic-typography-heading-h2, font-size);
|
||||
font-weight: map-get($semantic-typography-heading-h2, font-weight);
|
||||
line-height: map-get($semantic-typography-heading-h2, line-height);
|
||||
color: $semantic-color-text-primary;
|
||||
margin-bottom: $semantic-spacing-content-heading;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: map-get($semantic-typography-body-medium, font-family);
|
||||
font-size: map-get($semantic-typography-body-medium, font-size);
|
||||
font-weight: map-get($semantic-typography-body-medium, font-weight);
|
||||
line-height: map-get($semantic-typography-body-medium, line-height);
|
||||
color: $semantic-color-text-secondary;
|
||||
margin-bottom: $semantic-spacing-content-paragraph;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-section {
|
||||
margin-bottom: $semantic-spacing-layout-section-lg;
|
||||
padding: $semantic-spacing-component-lg;
|
||||
background: $semantic-color-surface-primary;
|
||||
border: $semantic-border-width-1 solid $semantic-color-border-subtle;
|
||||
border-radius: $semantic-border-card-radius;
|
||||
box-shadow: $semantic-shadow-elevation-1;
|
||||
|
||||
h3 {
|
||||
font-family: map-get($semantic-typography-heading-h3, font-family);
|
||||
font-size: map-get($semantic-typography-heading-h3, font-size);
|
||||
font-weight: map-get($semantic-typography-heading-h3, font-weight);
|
||||
line-height: map-get($semantic-typography-heading-h3, line-height);
|
||||
color: $semantic-color-text-primary;
|
||||
margin-bottom: $semantic-spacing-content-heading;
|
||||
border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
|
||||
padding-bottom: $semantic-spacing-component-sm;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: $semantic-spacing-grid-gap-lg;
|
||||
align-items: flex-start;
|
||||
|
||||
&--spaced {
|
||||
justify-content: space-around;
|
||||
|
||||
.demo-example {
|
||||
min-width: 200px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.demo-example {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: $semantic-spacing-component-md;
|
||||
padding: $semantic-spacing-component-lg;
|
||||
background: $semantic-color-surface-secondary;
|
||||
border: $semantic-border-width-1 solid $semantic-color-border-primary;
|
||||
border-radius: $semantic-border-input-radius;
|
||||
min-height: 120px;
|
||||
position: relative;
|
||||
|
||||
h4 {
|
||||
font-family: map-get($semantic-typography-heading-h4, font-family);
|
||||
font-size: map-get($semantic-typography-heading-h4, font-size);
|
||||
font-weight: map-get($semantic-typography-heading-h4, font-weight);
|
||||
line-height: map-get($semantic-typography-heading-h4, line-height);
|
||||
color: $semantic-color-text-primary;
|
||||
margin: 0 0 $semantic-spacing-component-sm 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-button {
|
||||
padding: $semantic-spacing-interactive-button-padding-y $semantic-spacing-interactive-button-padding-x;
|
||||
border: $semantic-border-width-1 solid $semantic-color-primary;
|
||||
border-radius: $semantic-border-button-radius;
|
||||
background: $semantic-color-primary;
|
||||
color: $semantic-color-on-primary;
|
||||
font-family: map-get($semantic-typography-button-medium, font-family);
|
||||
font-size: map-get($semantic-typography-button-medium, font-size);
|
||||
font-weight: map-get($semantic-typography-button-medium, font-weight);
|
||||
line-height: map-get($semantic-typography-button-medium, line-height);
|
||||
cursor: pointer;
|
||||
transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
box-shadow: $semantic-shadow-button-hover;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid $semantic-color-focus;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
&:active:not(:disabled) {
|
||||
transform: translateY(1px);
|
||||
box-shadow: $semantic-shadow-button-rest;
|
||||
}
|
||||
|
||||
&--secondary {
|
||||
background: $semantic-color-surface-primary;
|
||||
color: $semantic-color-text-primary;
|
||||
border-color: $semantic-color-border-primary;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: $semantic-color-surface-secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.demo-log {
|
||||
background: $semantic-color-surface-elevated;
|
||||
border: $semantic-border-width-1 solid $semantic-color-border-secondary;
|
||||
border-radius: $semantic-border-input-radius;
|
||||
padding: $semantic-spacing-component-md;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
margin-bottom: $semantic-spacing-component-md;
|
||||
|
||||
&__empty {
|
||||
font-family: map-get($semantic-typography-body-medium, font-family);
|
||||
font-size: map-get($semantic-typography-body-medium, font-size);
|
||||
font-weight: map-get($semantic-typography-body-medium, font-weight);
|
||||
line-height: map-get($semantic-typography-body-medium, line-height);
|
||||
color: $semantic-color-text-tertiary;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&__entry {
|
||||
display: flex;
|
||||
gap: $semantic-spacing-component-sm;
|
||||
padding: $semantic-spacing-component-xs;
|
||||
border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
&__time {
|
||||
font-family: $semantic-typography-font-family-mono;
|
||||
font-size: map-get($semantic-typography-caption, font-size);
|
||||
color: $semantic-color-text-tertiary;
|
||||
flex-shrink: 0;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
&__message {
|
||||
font-family: map-get($semantic-typography-body-small, font-family);
|
||||
font-size: map-get($semantic-typography-body-small, font-size);
|
||||
font-weight: map-get($semantic-typography-body-small, font-weight);
|
||||
line-height: map-get($semantic-typography-body-small, line-height);
|
||||
color: $semantic-color-text-primary;
|
||||
}
|
||||
}
|
||||
|
||||
// Responsive design
|
||||
@media (max-width: 768px) {
|
||||
.demo-container {
|
||||
padding: $semantic-spacing-component-md;
|
||||
}
|
||||
|
||||
.demo-row {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
||||
&--spaced {
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.demo-example {
|
||||
min-height: auto;
|
||||
padding: $semantic-spacing-component-md;
|
||||
}
|
||||
|
||||
.demo-section {
|
||||
padding: $semantic-spacing-component-md;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure positioned FAB menus are visible above demo content
|
||||
:host {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FabMenuComponent, FabMenuDirection, FabMenuItem, FabMenuPosition, FabMenuSize, FabMenuVariant } from '../../../../../ui-essentials/src/lib/components/buttons/fab-menu';
|
||||
|
||||
@Component({
|
||||
selector: 'ui-fab-menu-demo',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FabMenuComponent],
|
||||
template: `
|
||||
<div class="demo-container">
|
||||
<h2>Floating Action Button Menu Demo</h2>
|
||||
<p>An interactive floating action button menu that expands to reveal multiple action items.</p>
|
||||
|
||||
<!-- Size Variants -->
|
||||
<section class="demo-section">
|
||||
<h3>Sizes</h3>
|
||||
<div class="demo-row">
|
||||
@for (size of sizes; track size) {
|
||||
<div class="demo-example">
|
||||
<h4>{{ size | titlecase }}</h4>
|
||||
<ui-fab-menu
|
||||
[size]="size"
|
||||
[menuItems]="basicMenuItems"
|
||||
[triggerIcon]="plusIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
triggerLabel="Open {{ size }} menu"
|
||||
(itemClicked)="handleItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Color Variants -->
|
||||
<section class="demo-section">
|
||||
<h3>Color Variants</h3>
|
||||
<div class="demo-row">
|
||||
@for (variant of variants; track variant) {
|
||||
<div class="demo-example">
|
||||
<h4>{{ variant | titlecase }}</h4>
|
||||
<ui-fab-menu
|
||||
[variant]="variant"
|
||||
[menuItems]="getVariantMenuItems(variant)"
|
||||
[triggerIcon]="plusIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
[triggerLabel]="variant + ' menu'"
|
||||
(itemClicked)="handleItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Direction Variants -->
|
||||
<section class="demo-section">
|
||||
<h3>Direction Variants</h3>
|
||||
<div class="demo-row demo-row--spaced">
|
||||
@for (direction of directions; track direction) {
|
||||
<div class="demo-example">
|
||||
<h4>{{ direction | titlecase }}</h4>
|
||||
<ui-fab-menu
|
||||
[direction]="direction"
|
||||
[menuItems]="basicMenuItems"
|
||||
[triggerIcon]="plusIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
[triggerLabel]="direction + ' direction menu'"
|
||||
(itemClicked)="handleItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Position Variants (Fixed Positioning) -->
|
||||
<section class="demo-section">
|
||||
<h3>Fixed Positions</h3>
|
||||
<p>These examples show fixed positioning variants (click to activate):</p>
|
||||
<div class="demo-row">
|
||||
@for (position of positions; track position) {
|
||||
<button
|
||||
class="demo-button"
|
||||
(click)="togglePositionDemo(position)">
|
||||
Show {{ position | titlecase }} FAB Menu
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (activePositionDemo) {
|
||||
<ui-fab-menu
|
||||
[position]="activePositionDemo"
|
||||
[menuItems]="positionMenuItems"
|
||||
[triggerIcon]="menuIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
[triggerLabel]="activePositionDemo + ' positioned menu'"
|
||||
(opened)="onMenuOpened()"
|
||||
(closed)="onMenuClosed()"
|
||||
(itemClicked)="handlePositionItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
}
|
||||
</section>
|
||||
|
||||
<!-- States -->
|
||||
<section class="demo-section">
|
||||
<h3>States</h3>
|
||||
<div class="demo-row">
|
||||
<div class="demo-example">
|
||||
<h4>Disabled</h4>
|
||||
<ui-fab-menu
|
||||
[disabled]="true"
|
||||
[menuItems]="basicMenuItems"
|
||||
[triggerIcon]="plusIcon"
|
||||
triggerLabel="Disabled menu">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
|
||||
<div class="demo-example">
|
||||
<h4>No Backdrop</h4>
|
||||
<ui-fab-menu
|
||||
[backdrop]="false"
|
||||
[menuItems]="basicMenuItems"
|
||||
[triggerIcon]="plusIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
triggerLabel="Menu without backdrop"
|
||||
(itemClicked)="handleItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
|
||||
<div class="demo-example">
|
||||
<h4>Stay Open</h4>
|
||||
<ui-fab-menu
|
||||
[closeOnItemClick]="false"
|
||||
[menuItems]="basicMenuItems"
|
||||
[triggerIcon]="plusIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
triggerLabel="Menu stays open"
|
||||
(itemClicked)="handleItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Advanced Examples -->
|
||||
<section class="demo-section">
|
||||
<h3>Advanced Examples</h3>
|
||||
|
||||
<div class="demo-example">
|
||||
<h4>Mixed Item Variants</h4>
|
||||
<ui-fab-menu
|
||||
[menuItems]="mixedMenuItems"
|
||||
[triggerIcon]="settingsIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
triggerLabel="Settings menu"
|
||||
(itemClicked)="handleItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
|
||||
<div class="demo-example">
|
||||
<h4>Large Menu with Icons</h4>
|
||||
<ui-fab-menu
|
||||
size="lg"
|
||||
[menuItems]="iconMenuItems"
|
||||
[triggerIcon]="appsIcon"
|
||||
[closeIcon]="closeIcon"
|
||||
triggerLabel="App launcher"
|
||||
(itemClicked)="handleItemClick($event)">
|
||||
</ui-fab-menu>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Interactive Feedback -->
|
||||
<section class="demo-section">
|
||||
<h3>Event Log</h3>
|
||||
<div class="demo-log">
|
||||
@if (eventLog.length === 0) {
|
||||
<p class="demo-log__empty">No events yet. Interact with the FAB menus above.</p>
|
||||
} @else {
|
||||
@for (event of eventLog.slice(-10); track $index) {
|
||||
<div class="demo-log__entry">
|
||||
<span class="demo-log__time">{{ event.timestamp | date:'HH:mm:ss' }}</span>
|
||||
<span class="demo-log__message">{{ event.message }}</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<button class="demo-button demo-button--secondary" (click)="clearLog()">Clear Log</button>
|
||||
</section>
|
||||
</div>
|
||||
`,
|
||||
styleUrl: './fab-menu-demo.component.scss'
|
||||
})
|
||||
export class FabMenuDemoComponent {
|
||||
sizes: FabMenuSize[] = ['sm', 'md', 'lg'];
|
||||
variants: FabMenuVariant[] = ['primary', 'secondary', 'success', 'danger'];
|
||||
directions: FabMenuDirection[] = ['up', 'down', 'left', 'right'];
|
||||
positions: FabMenuPosition[] = ['bottom-right', 'bottom-left', 'top-right', 'top-left'];
|
||||
|
||||
activePositionDemo: FabMenuPosition | null = null;
|
||||
eventLog: Array<{timestamp: Date, message: string}> = [];
|
||||
|
||||
// Icons (using simple text for demo - could be replaced with FontAwesome or other icon library)
|
||||
plusIcon = '<span>+</span>';
|
||||
closeIcon = '<span>×</span>';
|
||||
menuIcon = '<span>☰</span>';
|
||||
settingsIcon = '<span>⚙</span>';
|
||||
appsIcon = '<span>⊞</span>';
|
||||
|
||||
basicMenuItems: FabMenuItem[] = [
|
||||
{ id: 'action1', label: 'Action 1', icon: '<span>📝</span>' },
|
||||
{ id: 'action2', label: 'Action 2', icon: '<span>📁</span>' },
|
||||
{ id: 'action3', label: 'Action 3', icon: '<span>📊</span>' }
|
||||
];
|
||||
|
||||
positionMenuItems: FabMenuItem[] = [
|
||||
{ id: 'close', label: 'Close Menu', icon: '<span>×</span>' },
|
||||
{ id: 'home', label: 'Go Home', icon: '<span>🏠</span>' },
|
||||
{ id: 'profile', label: 'Profile', icon: '<span>👤</span>' },
|
||||
{ id: 'settings', label: 'Settings', icon: '<span>⚙</span>' }
|
||||
];
|
||||
|
||||
mixedMenuItems: FabMenuItem[] = [
|
||||
{ id: 'save', label: 'Save', variant: 'success', icon: '<span>💾</span>' },
|
||||
{ id: 'edit', label: 'Edit', variant: 'primary', icon: '<span>✏️</span>' },
|
||||
{ id: 'delete', label: 'Delete', variant: 'danger', icon: '<span>🗑️</span>' },
|
||||
{ id: 'disabled', label: 'Disabled', disabled: true, icon: '<span>🚫</span>' }
|
||||
];
|
||||
|
||||
iconMenuItems: FabMenuItem[] = [
|
||||
{ id: 'email', label: 'Email', icon: '<span>📧</span>' },
|
||||
{ id: 'calendar', label: 'Calendar', icon: '<span>📅</span>' },
|
||||
{ id: 'documents', label: 'Documents', icon: '<span>📄</span>' },
|
||||
{ id: 'photos', label: 'Photos', icon: '<span>📸</span>' },
|
||||
{ id: 'music', label: 'Music', icon: '<span>🎵</span>' },
|
||||
{ id: 'videos', label: 'Videos', icon: '<span>🎬</span>' }
|
||||
];
|
||||
|
||||
getVariantMenuItems(variant: FabMenuVariant): FabMenuItem[] {
|
||||
return [
|
||||
{ id: `${variant}1`, label: `${variant} Item 1`, variant },
|
||||
{ id: `${variant}2`, label: `${variant} Item 2`, variant },
|
||||
{ id: `${variant}3`, label: `${variant} Item 3`, variant }
|
||||
];
|
||||
}
|
||||
|
||||
handleItemClick(event: {item: FabMenuItem, event: Event}): void {
|
||||
this.logEvent(`Item clicked: ${event.item.label} (${event.item.id})`);
|
||||
}
|
||||
|
||||
togglePositionDemo(position: FabMenuPosition): void {
|
||||
if (this.activePositionDemo === position) {
|
||||
this.activePositionDemo = null;
|
||||
this.logEvent(`Closed ${position} positioned menu`);
|
||||
} else {
|
||||
this.activePositionDemo = position;
|
||||
this.logEvent(`Opened ${position} positioned menu`);
|
||||
}
|
||||
}
|
||||
|
||||
handlePositionItemClick(event: {item: FabMenuItem, event: Event}): void {
|
||||
if (event.item.id === 'close') {
|
||||
this.activePositionDemo = null;
|
||||
this.logEvent('Closed positioned menu via menu item');
|
||||
} else {
|
||||
this.logEvent(`Position menu item clicked: ${event.item.label}`);
|
||||
}
|
||||
}
|
||||
|
||||
onMenuOpened(): void {
|
||||
this.logEvent('Menu opened');
|
||||
}
|
||||
|
||||
onMenuClosed(): void {
|
||||
this.logEvent('Menu closed');
|
||||
}
|
||||
|
||||
logEvent(message: string): void {
|
||||
this.eventLog.push({
|
||||
timestamp: new Date(),
|
||||
message
|
||||
});
|
||||
}
|
||||
|
||||
clearLog(): void {
|
||||
this.eventLog = [];
|
||||
this.logEvent('Event log cleared');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user