import type { Meta, StoryObj } from '@storybook/vue3-vite' import { Download, Filter, Folder, Info, PanelLeft, PanelLeftClose, PanelRight, PanelRightClose, Puzzle, Scroll, Settings, Upload, X } from 'lucide-vue-next' import { provide, ref } from 'vue' import IconButton from '@/components/button/IconButton.vue' import IconTextButton from '@/components/button/IconTextButton.vue' import MoreButton from '@/components/button/MoreButton.vue' import CardBottom from '@/components/card/CardBottom.vue' import CardContainer from '@/components/card/CardContainer.vue' import CardTop from '@/components/card/CardTop.vue' import SquareChip from '@/components/chip/SquareChip.vue' import MultiSelect from '@/components/input/MultiSelect.vue' import SearchBox from '@/components/input/SearchBox.vue' import SingleSelect from '@/components/input/SingleSelect.vue' import type { NavGroupData, NavItemData } from '@/types/navTypes' import { OnCloseKey } from '@/types/widgetTypes' import LeftSidePanel from '../panel/LeftSidePanel.vue' import RightSidePanel from '../panel/RightSidePanel.vue' import BaseWidgetLayout from './BaseWidgetLayout.vue' interface StoryArgs { contentTitle: string hasLeftPanel: boolean hasRightPanel: boolean hasHeader: boolean hasContentFilter: boolean hasHeaderRightArea: boolean cardCount: number } const meta: Meta = { title: 'Components/Widget/Layout/BaseWidgetLayout', argTypes: { contentTitle: { control: 'text', description: 'Title shown when no left panel is present' }, hasLeftPanel: { control: 'boolean', description: 'Toggle left panel visibility' }, hasRightPanel: { control: 'boolean', description: 'Toggle right panel visibility' }, hasHeader: { control: 'boolean', description: 'Toggle header visibility' }, hasContentFilter: { control: 'boolean', description: 'Toggle content filter visibility' }, hasHeaderRightArea: { control: 'boolean', description: 'Toggle header right area visibility' }, cardCount: { control: { type: 'range', min: 0, max: 50, step: 1 }, description: 'Number of cards to display in content' } } } export default meta type Story = StoryObj const createStoryTemplate = (args: StoryArgs) => ({ components: { BaseWidgetLayout, LeftSidePanel, RightSidePanel, SearchBox, MultiSelect, SingleSelect, IconButton, IconTextButton, MoreButton, CardContainer, CardTop, CardBottom, SquareChip, Settings, Upload, Download, Scroll, Info, Filter, Folder, Puzzle, PanelLeft, PanelLeftClose, PanelRight, PanelRightClose, X }, setup() { const t = (k: string) => k const onClose = () => { console.log('OnClose invoked') } provide(OnCloseKey, onClose) const tempNavigation = ref<(NavItemData | NavGroupData)[]>([ { id: 'installed', label: 'Installed' }, { title: 'TAGS', items: [ { id: 'tag-sd15', label: 'SD 1.5' }, { id: 'tag-sdxl', label: 'SDXL' }, { id: 'tag-utility', label: 'Utility' } ] }, { title: 'CATEGORIES', items: [ { id: 'cat-models', label: 'Models' }, { id: 'cat-nodes', label: 'Nodes' } ] } ]) const selectedNavItem = ref('installed') const searchQuery = ref('') const frameworkOptions = ref([ { name: 'Vue', value: 'vue' }, { name: 'React', value: 'react' }, { name: 'Angular', value: 'angular' }, { name: 'Svelte', value: 'svelte' } ]) const projectOptions = ref([ { name: 'Project A', value: 'proj-a' }, { name: 'Project B', value: 'proj-b' }, { name: 'Project C', value: 'proj-c' } ]) const sortOptions = ref([ { name: 'Popular', value: 'popular' }, { name: 'Latest', value: 'latest' }, { name: 'A → Z', value: 'az' } ]) const selectedFrameworks = ref([]) const selectedProjects = ref([]) const selectedSort = ref('popular') return { args, t, tempNavigation, selectedNavItem, searchQuery, frameworkOptions, projectOptions, sortOptions, selectedFrameworks, selectedProjects, selectedSort } }, template: `
` }) export const Default: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Content Title', hasLeftPanel: true, hasRightPanel: true, hasHeader: true, hasContentFilter: true, hasHeaderRightArea: true, cardCount: 12 } } export const BothPanels: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Content Title', hasLeftPanel: true, hasRightPanel: true, hasHeader: true, hasContentFilter: true, hasHeaderRightArea: true, cardCount: 12 } } export const LeftPanelOnly: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Content Title', hasLeftPanel: true, hasRightPanel: false, hasHeader: true, hasContentFilter: true, hasHeaderRightArea: true, cardCount: 12 } } export const RightPanelOnly: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Content Title', hasLeftPanel: false, hasRightPanel: true, hasHeader: true, hasContentFilter: true, hasHeaderRightArea: true, cardCount: 12 } } export const NoPanels: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Content Title', hasLeftPanel: false, hasRightPanel: false, hasHeader: true, hasContentFilter: true, hasHeaderRightArea: true, cardCount: 12 } } export const MinimalLayout: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Simple Content', hasLeftPanel: false, hasRightPanel: false, hasHeader: false, hasContentFilter: false, hasHeaderRightArea: false, cardCount: 6 } } export const NoContent: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Empty State', hasLeftPanel: true, hasRightPanel: true, hasHeader: true, hasContentFilter: true, hasHeaderRightArea: true, cardCount: 0 } } export const HeaderOnly: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Header Layout', hasLeftPanel: false, hasRightPanel: false, hasHeader: true, hasContentFilter: false, hasHeaderRightArea: true, cardCount: 8 } } export const FilterOnly: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Filter Layout', hasLeftPanel: false, hasRightPanel: false, hasHeader: false, hasContentFilter: true, hasHeaderRightArea: false, cardCount: 8 } } export const MaxContent: Story = { render: (args: StoryArgs) => createStoryTemplate(args), args: { contentTitle: 'Full Content', hasLeftPanel: true, hasRightPanel: true, hasHeader: true, hasContentFilter: true, hasHeaderRightArea: true, cardCount: 50 } }