mirror of
https://github.com/unraid/api.git
synced 2026-01-24 17:38:37 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced comprehensive, customizable Accordion, Dialog, DropdownMenu, and Select UI components with enhanced prop-driven and slot-based APIs. * Added grouped exports for UI primitives, simplifying imports and usage. * Added new Storybook stories demonstrating varied usage scenarios for Accordion, Dialog, DropdownMenu, and Select components. * **Refactor** * Replaced external UI dependencies with locally defined, typed components for Accordion, Dialog, DropdownMenu, and Select. * Streamlined component APIs by consolidating exports to main components and type exports, removing subcomponent exports. * Simplified dialog and dropdown menu implementations with explicit props, events, and slots. * Updated component styles and class bindings for improved appearance and interaction. * Refined select component into a fully featured, typed implementation supporting grouping and multiple selection. * Replaced custom dropdown menu implementation in user profile with the new DropdownMenu component. * Simplified internal prop forwarding using reactive utilities for dropdown menu and select subcomponents. * Improved dropdown menu stories with declarative props and slots, removing manual subcomponent composition. * Simplified notification filter UI by replacing nested select subcomponents with a declarative items prop. * **Bug Fixes** * Improved dropdown and select item handling, including disabled states, separators, and grouped options. * **Style** * Enhanced visual consistency and spacing in documentation and UI components. * Updated component classes for better appearance and usability. * **Chores** * Upgraded `@jsonforms` dependencies across all packages to version `^3.6.0`. * Improved test and mock setups for new component structures. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mdatelle <mike@datelle.net> Co-authored-by: Eli Bosley <ekbosley@gmail.com>
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { vi } from 'vitest';
|
|
|
|
// Mock @unraid/ui components and functions
|
|
const mockCn = (...args: unknown[]) => args.filter(Boolean).join(' ');
|
|
|
|
const MockBrandButton = {
|
|
name: 'BrandButton',
|
|
props: [
|
|
'class',
|
|
'disabled',
|
|
'external',
|
|
'href',
|
|
'icon',
|
|
'iconRight',
|
|
'iconRightHoverDisplay',
|
|
'text',
|
|
'title',
|
|
'download',
|
|
],
|
|
template: `
|
|
<component :is="props.href ? 'a' : 'button'"
|
|
:class="props.class"
|
|
:disabled="props.disabled"
|
|
:href="props.href"
|
|
:target="props.external ? '_blank' : undefined"
|
|
:rel="props.external ? 'noopener noreferrer' : undefined"
|
|
:title="props.title"
|
|
:download="props.download"
|
|
>
|
|
<span v-if="props.icon" class="icon">{{ props.icon }}</span>
|
|
{{ props.text || '' }} <slot />
|
|
<span v-if="props.iconRight" class="icon-right" :class="{ 'hover-only': props.iconRightHoverDisplay }">{{ props.iconRight }}</span>
|
|
</component>
|
|
`,
|
|
setup(props: Record<string, unknown>) {
|
|
return { props };
|
|
},
|
|
};
|
|
|
|
vi.mock('@unraid/ui', () => ({
|
|
cn: mockCn,
|
|
BrandButton: MockBrandButton,
|
|
DropdownMenu: {
|
|
name: 'DropdownMenu',
|
|
template: '<div><slot name="trigger" /><slot /></div>',
|
|
},
|
|
// Add other UI components as needed
|
|
}));
|