-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storybook] Add stories for more components (form components) - Part 1 (
- Loading branch information
Showing
34 changed files
with
527 additions
and
38 deletions.
There are no files selected for viewing
Binary file added
BIN
+7.76 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiCheckboxGroup_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.55 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiCheckbox_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+913 Bytes
packages/eui/.loki/reference/chrome_desktop_Forms_EuiFieldPassword_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.1 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiFieldSearch_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.58 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiRadioGroup_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.21 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiRadio_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.42 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiSwitch_Checked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.45 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiSwitch_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.82 KB
packages/eui/.loki/reference/chrome_desktop_Forms_EuiTextArea_Icon_Shape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+993 Bytes
packages/eui/.loki/reference/chrome_desktop_Forms_EuiTextArea_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.7 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiCheckboxGroup_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.51 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiCheckbox_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.88 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiFieldPassword_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.43 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiFieldSearch_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.5 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiRadioGroup_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.66 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiRadio_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.96 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiSwitch_Checked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiSwitch_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.48 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiTextArea_Icon_Shape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.4 KB
packages/eui/.loki/reference/chrome_mobile_Forms_EuiTextArea_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { addons } from '@storybook/manager-api'; | ||
|
||
// filter out stories based on tags that should not | ||
// be shown in the Storybook sidebar menu | ||
addons.setConfig({ | ||
sidebar: { | ||
filters: { | ||
patterns: (item) => { | ||
// Storybook only accepts string literals in the tags | ||
// handling this centrally via a map doesn't work :( | ||
return !item.tags?.includes('vrt-only'); | ||
}, | ||
}, | ||
}, | ||
}); |
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
47 changes: 47 additions & 0 deletions
47
packages/eui/src/components/form/checkbox/checkbox.stories.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { | ||
disableStorybookControls, | ||
enableFunctionToggleControls, | ||
} from '../../../../.storybook/utils'; | ||
import { EuiCheckbox, EuiCheckboxProps, TYPES } from './checkbox'; | ||
|
||
const meta: Meta<EuiCheckboxProps> = { | ||
title: 'Forms/EuiCheckbox', | ||
component: EuiCheckbox, | ||
argTypes: { | ||
label: { control: 'text' }, | ||
type: { | ||
control: 'radio', | ||
options: [undefined, ...TYPES], | ||
}, | ||
}, | ||
args: { | ||
checked: false, | ||
compressed: false, | ||
disabled: false, | ||
indeterminate: false, | ||
// set up for easier testing/QA | ||
id: '', | ||
}, | ||
}; | ||
enableFunctionToggleControls(meta, ['onChange']); | ||
disableStorybookControls(meta, ['inputRef']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiCheckboxProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
id: 'checkbox', | ||
label: 'Checkbox label', | ||
}, | ||
}; |
44 changes: 44 additions & 0 deletions
44
packages/eui/src/components/form/checkbox/checkbox_group.stories.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { enableFunctionToggleControls } from '../../../../.storybook/utils'; | ||
import { EuiCheckboxGroup, EuiCheckboxGroupProps } from './checkbox_group'; | ||
|
||
const meta: Meta<EuiCheckboxGroupProps> = { | ||
title: 'Forms/EuiCheckboxGroup', | ||
component: EuiCheckboxGroup, | ||
args: { | ||
disabled: false, | ||
compressed: false, | ||
}, | ||
}; | ||
enableFunctionToggleControls(meta, ['onChange']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiCheckboxGroupProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
options: [ | ||
{ id: 'checkbox-1', label: 'Checkbox 1' }, | ||
{ id: 'checkbox-2', label: 'Checkbox 2' }, | ||
{ id: 'checkbox-3', label: 'Checkbox 3', disabled: true }, | ||
], | ||
idToSelectedMap: { | ||
'checkbox-2': true, | ||
}, | ||
// set up for easier testing/QA | ||
legend: { | ||
children: 'Group label', | ||
compressed: false, | ||
display: 'visible', | ||
}, | ||
}, | ||
}; |
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
60 changes: 60 additions & 0 deletions
60
packages/eui/src/components/form/field_password/field_password.stories.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { | ||
disableStorybookControls, | ||
enableFunctionToggleControls, | ||
} from '../../../../.storybook/utils'; | ||
import { EuiIcon } from '../../icon'; | ||
import { EuiFieldPassword, EuiFieldPasswordProps } from './field_password'; | ||
|
||
const meta: Meta<EuiFieldPasswordProps> = { | ||
title: 'Forms/EuiFieldPassword', | ||
component: EuiFieldPassword, | ||
argTypes: { | ||
append: { | ||
control: 'radio', | ||
options: [undefined, 'icon', 'text'], | ||
mapping: { | ||
icon: <EuiIcon type="faceHappy" />, | ||
text: 'Appended', | ||
undefined: undefined, | ||
}, | ||
}, | ||
prepend: { | ||
control: 'radio', | ||
options: [undefined, 'icon', 'text'], | ||
mapping: { | ||
icon: <EuiIcon type="faceHappy" />, | ||
text: 'Prepended', | ||
undefined: undefined, | ||
}, | ||
}, | ||
}, | ||
args: { | ||
type: 'password', | ||
fullWidth: false, | ||
isLoading: false, | ||
compressed: false, | ||
// set up for easier testing/QA | ||
isInvalid: false, | ||
placeholder: '', | ||
id: '', | ||
name: '', | ||
}, | ||
}; | ||
enableFunctionToggleControls(meta, ['onChange']); | ||
disableStorybookControls(meta, ['inputRef']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiFieldPasswordProps>; | ||
|
||
export const Playground: Story = {}; |
64 changes: 64 additions & 0 deletions
64
packages/eui/src/components/form/field_search/field_search.stories.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { | ||
disableStorybookControls, | ||
enableFunctionToggleControls, | ||
} from '../../../../.storybook/utils'; | ||
import { EuiIcon } from '../../icon'; | ||
import { EuiFieldSearch, EuiFieldSearchProps } from './field_search'; | ||
|
||
const meta: Meta<EuiFieldSearchProps> = { | ||
title: 'Forms/EuiFieldSearch', | ||
component: EuiFieldSearch, | ||
argTypes: { | ||
append: { | ||
control: 'radio', | ||
options: [undefined, 'icon', 'text'], | ||
mapping: { | ||
icon: <EuiIcon type="faceHappy" />, | ||
text: 'Appended', | ||
undefined: undefined, | ||
}, | ||
}, | ||
prepend: { | ||
control: 'radio', | ||
options: [undefined, 'icon', 'text'], | ||
mapping: { | ||
icon: <EuiIcon type="faceHappy" />, | ||
text: 'Prepended', | ||
undefined: undefined, | ||
}, | ||
}, | ||
}, | ||
args: { | ||
isLoading: false, | ||
incremental: false, | ||
compressed: false, | ||
isClearable: true, | ||
// set up for easier testing/QA | ||
fullWidth: false, | ||
isInvalid: false, | ||
id: '', | ||
name: '', | ||
placeholder: '', | ||
}, | ||
}; | ||
// adding onChange for visibility | ||
enableFunctionToggleControls(meta, ['onSearch', 'onChange']); | ||
disableStorybookControls(meta, ['inputRef']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiFieldSearchProps>; | ||
|
||
export const Playground: Story = { | ||
args: {}, | ||
}; |
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,40 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { enableFunctionToggleControls } from '../../../../.storybook/utils'; | ||
import { EuiRadio, EuiRadioProps } from './radio'; | ||
|
||
const meta: Meta<EuiRadioProps> = { | ||
title: 'Forms/EuiRadio', | ||
component: EuiRadio, | ||
argTypes: { | ||
label: { control: 'text' }, | ||
}, | ||
args: { | ||
checked: false, | ||
compressed: false, | ||
disabled: false, | ||
// set up for easier testing/QA | ||
id: '', | ||
name: '', | ||
}, | ||
}; | ||
enableFunctionToggleControls(meta, ['onChange']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiRadioProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
id: 'radio', | ||
label: 'Radio label', | ||
value: 'radio-1', | ||
}, | ||
}; |
43 changes: 43 additions & 0 deletions
43
packages/eui/src/components/form/radio/radio_group.stories.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { enableFunctionToggleControls } from '../../../../.storybook/utils'; | ||
import { EuiRadioGroup, EuiRadioGroupProps } from './radio_group'; | ||
|
||
const meta: Meta<EuiRadioGroupProps> = { | ||
title: 'Forms/EuiRadioGroup', | ||
component: EuiRadioGroup, | ||
args: { | ||
compressed: false, | ||
disabled: false, | ||
}, | ||
}; | ||
enableFunctionToggleControls(meta, ['onChange']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiRadioGroupProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
options: [ | ||
{ id: 'radio-1', label: 'Radio 1', value: 'radio-1' }, | ||
{ id: 'radio-2', label: 'Radio 2', value: 'radio-2' }, | ||
{ id: 'radio-3', label: 'Radio 3', value: 'radio-3', disabled: true }, | ||
], | ||
idSelected: 'radio-2', | ||
name: 'radio-group', | ||
// set up for easier testing/QA | ||
legend: { | ||
children: 'Group label', | ||
compressed: false, | ||
display: 'visible', | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.