Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook: Add back subcomponents to props table #53751

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import type { AlignmentMatrixControlProps } from '../types';
const meta: ComponentMeta< typeof AlignmentMatrixControl > = {
title: 'Components (Experimental)/AlignmentMatrixControl',
component: AlignmentMatrixControl,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
'AlignmentMatrixControl.Icon': AlignmentMatrixControl.Icon,
},
argTypes: {
onChange: { action: 'onChange', control: { type: null } },
value: { control: { type: null } },
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/card/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import Button from '../../button';

const meta: ComponentMeta< typeof Card > = {
component: Card,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { CardHeader, CardBody, CardDivider, CardMedia, CardFooter },
title: 'Components/Card',
argTypes: {
as: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { useState, createContext, useContext } from '@wordpress/element';
/**
* Internal dependencies
*/
import { default as CircularOptionPicker } from '..';
import {
ButtonAction,
default as CircularOptionPicker,
DropdownLinkAction,
} from '..';

const CircularOptionPickerStoryContext = createContext< {
currentColor?: string;
Expand All @@ -19,6 +23,14 @@ const CircularOptionPickerStoryContext = createContext< {
const meta: ComponentMeta< typeof CircularOptionPicker > = {
title: 'Components/CircularOptionPicker',
component: CircularOptionPicker,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
'CircularOptionPicker.Option': Option,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
'CircularOptionPicker.ButtonAction': ButtonAction,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
'CircularOptionPicker.DropdownLinkAction': DropdownLinkAction,
},
argTypes: {
actions: { control: { type: null } },
options: { control: { type: null } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,26 @@ import { ContextSystemProvider } from '../../ui/context';
const meta: Meta< typeof DropdownMenu > = {
title: 'Components (Experimental)/DropdownMenu v2',
component: DropdownMenu,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownMenuItem,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownSubMenu,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownSubMenuTrigger,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownMenuSeparator,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownMenuCheckboxItem,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownMenuGroup,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownMenuLabel,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownMenuRadioGroup,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
DropdownMenuRadioItem,
},
argTypes: {
children: { control: { type: null } },
trigger: { control: { type: null } },
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/dropdown/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { DropdownContentWrapper } from '../dropdown-content-wrapper';
const meta: ComponentMeta< typeof Dropdown > = {
title: 'Components/Dropdown',
component: Dropdown,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { DropdownContentWrapper },
argTypes: {
focusOnMount: {
options: [ 'firstElement', true, false ],
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/flex/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { View } from '../../view';
const meta: ComponentMeta< typeof Flex > = {
component: Flex,
title: 'Components/Flex',
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { FlexBlock, FlexItem },
argTypes: {
align: { control: { type: 'text' } },
as: { control: { type: 'text' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { InputControlSuffixWrapper } from '../input-suffix-wrapper';
const meta: ComponentMeta< typeof InputControl > = {
title: 'Components (Experimental)/InputControl',
component: InputControl,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { InputControlPrefixWrapper, InputControlSuffixWrapper },
argTypes: {
__unstableInputWidth: { control: { type: 'text' } },
__unstableStateReducer: { control: { type: null } },
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/item-group/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type ItemProps = React.ComponentPropsWithoutRef< typeof Item >;

const meta: ComponentMeta< typeof ItemGroup > = {
component: ItemGroup,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { Item },
title: 'Components (Experimental)/ItemGroup',
argTypes: {
as: { control: { type: null } },
Expand Down
14 changes: 14 additions & 0 deletions packages/components/src/navigation/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import type { ComponentMeta } from '@storybook/react';
* Internal dependencies
*/
import { Navigation } from '..';
import { NavigationBackButton } from '../back-button';
import { NavigationGroup } from '../group';
import { NavigationItem } from '../item';
import { NavigationMenu } from '../menu';
import { DefaultStory } from './utils/default';
import { GroupStory } from './utils/group';
import { ControlledStateStory } from './utils/controlled-state';
Expand All @@ -18,6 +22,16 @@ import './style.css';
const meta: ComponentMeta< typeof Navigation > = {
title: 'Components (Experimental)/Navigation',
component: Navigation,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
NavigationBackButton,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
NavigationGroup,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
NavigationItem,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
NavigationMenu,
},
argTypes: {
activeItem: { control: { type: null } },
activeMenu: { control: { type: null } },
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/navigator/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {

const meta: ComponentMeta< typeof NavigatorProvider > = {
component: NavigatorProvider,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { NavigatorScreen, NavigatorButton, NavigatorBackButton },
title: 'Components (Experimental)/Navigator',
argTypes: {
as: { control: { type: null } },
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/notice/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import type { NoticeListProps } from '../types';
const meta: ComponentMeta< typeof Notice > = {
title: 'Components/Notice',
component: Notice,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { NoticeList },
parameters: {
actions: { argTypesRegex: '^on.*' },
controls: { expanded: true },
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/panel/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { wordpress } from '@wordpress/icons';
const meta: ComponentMeta< typeof Panel > = {
title: 'Components/Panel',
component: Panel,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { PanelRow, PanelBody },
argTypes: {
children: { control: { type: null } },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import RadioGroup from '../';
export default {
title: 'Components (Deprecated)/RadioGroup',
component: RadioGroup,
subcomponents: { Radio },
parameters: {
docs: {
description: {
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/slot-fill/stories/index.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Slot, Fill, Provider as SlotFillProvider } from '../';
export default {
title: 'Components/SlotFill',
component: Slot,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { Fill, SlotFillProvider },
parameters: {
controls: { expanded: true },
docs: { canvas: { sourceState: 'shown' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import type {

const meta: ComponentMeta< typeof ToggleGroupControl > = {
component: ToggleGroupControl,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { ToggleGroupControlOption, ToggleGroupControlOptionIcon },
title: 'Components (Experimental)/ToggleGroupControl',
argTypes: {
help: { control: { type: 'text' } },
Expand Down
10 changes: 10 additions & 0 deletions packages/components/src/toolbar/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ import DropdownMenu from '../../dropdown-menu';
const meta: ComponentMeta< typeof Toolbar > = {
title: 'Components/Toolbar',
component: Toolbar,
subcomponents: {
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
ToolbarButton,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
ToolbarGroup,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
ToolbarItem,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
ToolbarDropdownMenu,
},
argTypes: {
children: { control: { type: null } },
},
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/tools-panel/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { createSlotFill, Provider as SlotFillProvider } from '../../slot-fill';
const meta: ComponentMeta< typeof ToolsPanel > = {
title: 'Components (Experimental)/ToolsPanel',
component: ToolsPanel,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { ToolsPanelItem },
argTypes: {
as: { control: { type: null } },
children: { control: { type: null } },
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/tree-grid/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import InputControl from '../../input-control';
const meta: ComponentMeta< typeof TreeGrid > = {
title: 'Components (Experimental)/TreeGrid',
component: TreeGrid,
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
subcomponents: { TreeGridRow, TreeGridCell },
argTypes: {
children: { control: { type: null } },
},
Expand Down
5 changes: 3 additions & 2 deletions storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import {
Controls,
ArgsTable,
Description,
Primary,
Stories,
Expand Down Expand Up @@ -111,7 +111,8 @@ export const parameters = {
<Subtitle />
<Primary />
<Description />
<Controls />
{ /* `story="^"` enables Controls for the primary props table */ }
<ArgsTable story="^" />
<Stories includePrimary={ false } />
</>
),
Expand Down
Loading