-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from Dias999/feature/Storybook-Select
feat: storybook / TSDocs - Select
- Loading branch information
Showing
6 changed files
with
150 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
export { default } from './Select'; | ||
export * from './Select'; | ||
// import Select, { SelectOptions } from './Select' | ||
// export type { SelectOptions } | ||
export { Select, SelectProps, SelectOptions } from './Select'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/react-material-ui/src/styles/CustomWidgets/CustomSelectWidget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Select } from '@concepta/react-material-ui'; | ||
|
||
const meta = { | ||
component: Select, | ||
tags: ['autodocs'], | ||
args: { | ||
options: [ | ||
{ value: 'option1', label: 'Option 1' }, | ||
{ value: 'option2', label: 'Option 2' }, | ||
{ value: 'option3', label: 'Option 3' }, | ||
], | ||
}, | ||
argTypes: { | ||
containerProps: { control: { type: 'object' } }, | ||
labelProps: { control: { type: 'object' } }, | ||
options: { control: { type: 'object' } }, | ||
size: { | ||
control: { type: 'select', options: ['small', 'medium', 'large'] }, | ||
}, | ||
disabled: { control: { type: 'boolean' } }, | ||
required: { control: { type: 'boolean' } }, | ||
error: { control: { type: 'boolean' } }, | ||
helperText: { control: { type: 'text' } }, | ||
}, | ||
} satisfies Meta<typeof Select>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
label: 'Select an option', | ||
}, | ||
}; | ||
|
||
export const WithPreselectedValue: Story = { | ||
args: { | ||
label: 'Select an option', | ||
value: 'option2', | ||
}, | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
label: 'Select an option', | ||
disabled: true, | ||
}, | ||
}; | ||
|
||
export const CustomSize: Story = { | ||
args: { | ||
label: 'Select an option', | ||
size: 'medium', | ||
}, | ||
}; | ||
|
||
export const Required: Story = { | ||
args: { | ||
label: 'Select an option', | ||
required: true, | ||
}, | ||
}; | ||
|
||
export const WithHelperText: Story = { | ||
args: { | ||
label: 'Select an option', | ||
helperText: 'Select your preferred option', | ||
}, | ||
}; | ||
|
||
export const ErrorState: Story = { | ||
args: { | ||
label: 'Select an option', | ||
error: true, | ||
helperText: 'This field is required', | ||
}, | ||
}; | ||
|
||
export const CustomLabelStyles: Story = { | ||
args: { | ||
label: 'Select an option', | ||
labelProps: { | ||
color: 'red', | ||
fontWeight: 'bold', | ||
}, | ||
}, | ||
}; | ||
|
||
export const CustomContainerStyling: Story = { | ||
args: { | ||
label: 'Select an option', | ||
containerProps: { | ||
sx: { | ||
border: '1px solid blue', | ||
background: '#eee', | ||
padding: 2, | ||
borderRadius: '8px', | ||
}, | ||
}, | ||
}, | ||
}; |