import type { Meta, StoryObj } from '@storybook/html'; import { NestedSelect, type NestedSelectOptions } from '@42/core/nested-select'; import '@42/styles/nested-select.css'; const GROUPS = [ { label: 'Fruits', options: [['apple', 'Apple'], ['banana', 'Banana'], ['cherry', 'Cherry']] }, { label: 'Veggies', options: [['carrot', 'Carrot'], ['potato', 'Potato']] }, ]; const meta: Meta = { title: 'Core/Inputs & Forms/NestedSelect', tags: ['autodocs'], argTypes: { filter: { control: 'boolean' }, placeholder: { control: 'text' }, }, args: { filter: true, placeholder: 'Select items' }, render: (args) => { const root = document.createElement('div'); root.dataset.c42NestedSelect = ''; const groups = GROUPS.map( (g) => `
  • `, ).join(''); root.innerHTML = `
    `; new NestedSelect(root, args); return root; }, }; export default meta; type Story = StoryObj; export const Default: Story = {}; export const WithSelection: Story = { args: { defaultValue: ['apple', 'carrot'] } };