Skip to content

Commit

Permalink
Feat: Storybook: Improve component organisation - Selection & Input C…
Browse files Browse the repository at this point in the history
…ategory - Issue WordPress#66275  (WordPress#66635)

* Update the storybook components for selection and input category

* Add treeselect under selection&input category and revert experimental component change

* Fix experimental id and sort folders alphabetically

* Fix the experimental id for toggleGroupControl

* Revert changes that are not needed in PR

* Revert the missing change on conflict resolve

* Fix formatting

* Fixup (Sort experimental Actions)

* Remove unnecessary experimental Common grouping

* Remove excessive Search & Filtering grouping

---------

Co-authored-by: hbhalodia <[email protected]>
Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
4 people authored Nov 13, 2024
1 parent 6465b2d commit ee5aee9
Show file tree
Hide file tree
Showing 28 changed files with 64 additions and 28 deletions.
3 changes: 2 additions & 1 deletion packages/components/src/base-control/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import BaseControl, { useBaseControlProps } from '..';
import Button from '../../button';

const meta: Meta< typeof BaseControl > = {
title: 'Components/BaseControl',
title: 'Components/Selection & Input/Common/BaseControl',
id: 'components-basecontrol',
component: BaseControl,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { HStack } from '../../h-stack';

const meta: Meta< typeof CheckboxControl > = {
component: CheckboxControl,
title: 'Components/CheckboxControl',
title: 'Components/Selection & Input/Common/CheckboxControl',
id: 'components-checkboxcontrol',
argTypes: {
onChange: {
action: 'onChange',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const CircularOptionPickerStoryContext = createContext< {
} >( {} );

const meta: Meta< typeof CircularOptionPicker > = {
title: 'Components/CircularOptionPicker',
title: 'Components/Selection & Input/Color/CircularOptionPicker',
id: 'components-circularoptionpicker',
component: CircularOptionPicker,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import ColorIndicator from '..';

const meta: Meta< typeof ColorIndicator > = {
component: ColorIndicator,
title: 'Components/ColorIndicator',
title: 'Components/Selection & Input/Color/ColorIndicator',
id: 'components-colorindicator',
argTypes: {
colorValue: {
control: { type: 'color' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { useState } from '@wordpress/element';
import ColorPalette from '..';

const meta: Meta< typeof ColorPalette > = {
title: 'Components/ColorPalette',
title: 'Components/Selection & Input/Color/ColorPalette',
id: 'components-colorpalette',
component: ColorPalette,
argTypes: {
as: { control: { type: null } },
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/color-picker/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { ColorPicker } from '../component';

const meta: Meta< typeof ColorPicker > = {
component: ColorPicker,
title: 'Components/ColorPicker',
title: 'Components/Selection & Input/Color/ColorPicker',
id: 'components-colorpicker',
argTypes: {
as: { control: { type: null } },
color: { control: { type: null } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const countries = [
];

const meta: Meta< typeof ComboboxControl > = {
title: 'Components/ComboboxControl',
title: 'Components/Selection & Input/Common/ComboboxControl',
id: 'components-comboboxcontrol',
component: ComboboxControl,
argTypes: {
value: { control: { type: null } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { useState } from '@wordpress/element';
import CustomGradientPicker from '../';

const meta: Meta< typeof CustomGradientPicker > = {
title: 'Components/CustomGradientPicker',
title: 'Components/Selection & Input/Color/CustomGradientPicker',
id: 'components-customgradientpicker',
component: CustomGradientPicker,
parameters: {
actions: { argTypesRegex: '^on.*' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { useState } from '@wordpress/element';
import CustomSelectControlV2 from '..';

const meta: Meta< typeof CustomSelectControlV2 > = {
title: 'Components/CustomSelectControl v2',
title: 'Components/Selection & Input/Common/CustomSelectControl v2',
id: 'components-customselectcontrol-v2',
component: CustomSelectControlV2,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import DateTimePicker from '../date-time';
import { daysFromNow, isWeekend } from './utils';

const meta: Meta< typeof DateTimePicker > = {
title: 'Components/DateTimePicker',
title: 'Components/Selection & Input/Time & Date/DateTimePicker',
id: 'components-datetimepicker',
component: DateTimePicker,
argTypes: {
currentDate: { control: 'date' },
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/date-time/stories/date.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import DatePicker from '../date';
import { daysFromNow, isWeekend } from './utils';

const meta: Meta< typeof DatePicker > = {
title: 'Components/DatePicker',
title: 'Components/Selection & Input/Time & Date/DatePicker',
id: 'components-datepicker',
component: DatePicker,
argTypes: {
currentDate: { control: 'date' },
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/date-time/stories/time.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { useState, useEffect } from '@wordpress/element';
import TimePicker from '../time';

const meta: Meta< typeof TimePicker > = {
title: 'Components/TimePicker',
title: 'Components/Selection & Input/Time & Date/TimePicker',
id: 'components-timepicker',
component: TimePicker,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { 'TimePicker.TimeInput': TimePicker.TimeInput },
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/drop-zone/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import DropZone from '..';

const meta: Meta< typeof DropZone > = {
component: DropZone,
title: 'Components/DropZone',
id: 'components-dropzone',
title: 'Components/Selection & Input/File Upload/DropZone',
parameters: {
actions: { argTypesRegex: '^on.*' },
controls: { expanded: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { upload as uploadIcon } from '@wordpress/icons';
import FormFileUpload from '..';

const meta: Meta< typeof FormFileUpload > = {
title: 'Components/FormFileUpload',
title: 'Components/Selection & Input/File Upload/FormFileUpload',
id: 'components-formfileupload',
component: FormFileUpload,
argTypes: {
icon: { control: { type: null } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import FormTokenField from '../';

const meta: Meta< typeof FormTokenField > = {
component: FormTokenField,
title: 'Components/FormTokenField',
title: 'Components/Selection & Input/Common/FormTokenField',
id: 'components-formtokenfield',
argTypes: {
value: {
control: { type: null },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { useState } from '@wordpress/element';
import GradientPicker from '..';

const meta: Meta< typeof GradientPicker > = {
title: 'Components/GradientPicker',
title: 'Components/Selection & Input/Color/GradientPicker',
id: 'components-gradientpicker',
component: GradientPicker,
parameters: {
controls: { expanded: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { InputControlSuffixWrapper } from '../input-suffix-wrapper';
import Button from '../../button';

const meta: Meta< typeof InputControl > = {
title: 'Components (Experimental)/InputControl',
title: 'Components (Experimental)/Selection & Input/InputControl',
id: 'components-experimental-inputcontrol',
component: InputControl,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { InputControlPrefixWrapper, InputControlSuffixWrapper },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { useState } from '@wordpress/element';
import NumberControl from '..';

const meta: Meta< typeof NumberControl > = {
title: 'Components (Experimental)/NumberControl',
title: 'Components (Experimental)/Selection & Input/NumberControl',
id: 'components-experimental-numbercontrol',
component: NumberControl,
argTypes: {
onChange: { action: 'onChange' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import RadioControl from '..';

const meta: Meta< typeof RadioControl > = {
component: RadioControl,
title: 'Components/RadioControl',
title: 'Components/Selection & Input/Common/RadioControl',
id: 'components-radiocontrol',
argTypes: {
onChange: {
action: 'onChange',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const ICONS = { starEmpty, starFilled, styles, wordpress };

const meta: Meta< typeof RangeControl > = {
component: RangeControl,
title: 'Components/RangeControl',
title: 'Components/Selection & Input/Common/RangeControl',
id: 'components-rangecontrol',
argTypes: {
afterIcon: {
control: { type: 'select' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { useState } from '@wordpress/element';
import SearchControl from '..';

const meta: Meta< typeof SearchControl > = {
title: 'Components/SearchControl',
title: 'Components/Selection & Input/Common/SearchControl',
id: 'components-searchcontrol',
component: SearchControl,
argTypes: {
onChange: { action: 'onChange' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import SelectControl from '../';
import { InputControlPrefixWrapper } from '../../input-control/input-prefix-wrapper';

const meta: Meta< typeof SelectControl > = {
title: 'Components/SelectControl',
title: 'Components/Selection & Input/Common/SelectControl',
id: 'components-selectcontrol',
component: SelectControl,
argTypes: {
help: { control: { type: 'text' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import TextareaControl from '..';

const meta: Meta< typeof TextareaControl > = {
component: TextareaControl,
title: 'Components/TextareaControl',
title: 'Components/Selection & Input/Common/TextareaControl',
id: 'components-textareacontrol',
argTypes: {
onChange: { action: 'onChange' },
label: { control: { type: 'text' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { useState } from '@wordpress/element';
import ToggleControl from '..';

const meta: Meta< typeof ToggleControl > = {
title: 'Components/ToggleControl',
title: 'Components/Selection & Input/Common/ToggleControl',
id: 'components-togglecontrol',
component: ToggleControl,
argTypes: {
checked: { control: { type: null } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const meta: Meta< typeof ToggleGroupControl > = {
component: ToggleGroupControl,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { ToggleGroupControlOption, ToggleGroupControlOptionIcon },
title: 'Components (Experimental)/ToggleGroupControl',
title: 'Components (Experimental)/Selection & Input/ToggleGroupControl',
id: 'components-experimental-togglegroupcontrol',
argTypes: {
help: { control: { type: 'text' } },
onChange: { action: 'onChange' },
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/tree-select/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { useState } from '@wordpress/element';
import TreeSelect from '../';

const meta: Meta< typeof TreeSelect > = {
title: 'Components/TreeSelect',
title: 'Components/Selection & Input/Common/TreeSelect',
id: 'components-treeselect',
component: TreeSelect,
argTypes: {
help: { control: { type: 'text' } },
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/unit-control/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { CSS_UNITS } from '../utils';

const meta: Meta< typeof UnitControl > = {
component: UnitControl,
title: 'Components (Experimental)/UnitControl',
title: 'Components (Experimental)/Selection & Input/UnitControl',
id: 'components-experimental-unitcontrol',
argTypes: {
__unstableInputWidth: { control: { type: 'text' } },
__unstableStateReducer: { control: { type: null } },
Expand Down
11 changes: 10 additions & 1 deletion storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,20 @@ export const parameters = {
'Layout',
'Navigation',
'Overlays',
'Selection & Input',
[ 'Color', 'Common', 'File Upload', 'Time & Date' ],
'Typography',
'Utilities',
],
'Components (Experimental)',
[ 'Layout', 'Navigation', 'Overlays', 'Typography' ],
[
'Actions',
'Layout',
'Navigation',
'Overlays',
'Selection & Input',
'Typography',
],
'Icons',
],
},
Expand Down

0 comments on commit ee5aee9

Please sign in to comment.