REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.06 KB
Close
/home/byroehnu/.trash/node_modules11/@adminjs/design-system/src/molecules/select/select.stories.tsx
Text
Base64
import type { Meta, StoryFn } from '@storybook/react' import filter from 'lodash/filter.js' import React, { useState } from 'react' import { PublicBaseSelectProps } from 'react-select/base' import { Box, FormGroup } from '../../index.js' import StoryWrapper from '../../utils/story-wrapper.jsx' import { Select, SelectAsync } from './index.js' const options = [ { value: 'chocolate', label: 'Chocolate' }, { value: 'strawberry', label: 'Strawberry' }, { value: 'vanilla', label: 'Vanilla' }, ] export const Default: StoryFn<PublicBaseSelectProps<any, boolean, any>> = (props) => { const { isMulti } = props const [value, setValue] = useState() return ( <Box width={1}> <StoryWrapper label="Select example"> <FormGroup> <Select value={value} onChange={(selected) => setValue(selected)} options={options} isMulti={isMulti} /> </FormGroup> </StoryWrapper> </Box> ) } export const Async: StoryFn = () => { const [valueAsync, setValueAsync] = useState() const [isLoading, setIsLoading] = useState(false) const loadOptions = async (inputValue: string): Promise<any[]> => { setIsLoading(true) const found = filter(options, ({ value }) => value.includes(inputValue)) setIsLoading(false) return Promise.resolve(found) } return ( <Box width={1}> <StoryWrapper label="Select async example"> <FormGroup> <SelectAsync value={valueAsync} onChange={(selected) => setValueAsync(selected)} loadOptions={loadOptions} isLoading={isLoading} /> </FormGroup> </StoryWrapper> </Box> ) } const meta: Meta<typeof Select> = { title: 'DesignSystem/Molecules/Select', component: Select, parameters: { controls: { include: ['variant', 'isMulti'] } }, args: { variant: 'default', isMulti: false, }, argTypes: { variant: { options: ['default', 'filter'], control: { type: 'select' } }, isMulti: { control: { type: 'boolean' } }, }, } export default meta
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
index.ts
64 B
lrw-r--r--
2026-02-28 00:31:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
select-async.tsx
1.39 KB
lrw-r--r--
2026-02-28 00:31:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
select-theme.ts
1.14 KB
lrw-r--r--
2026-02-28 00:31:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
select.stories.tsx
2.06 KB
lrw-r--r--
2026-02-28 00:31:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
select.tsx
1.30 KB
lrw-r--r--
2026-02-28 00:31:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).