Fixes types

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2025-12-17 20:40:02 +00:00
parent 523f320133
commit a32ce3af57
16 changed files with 25 additions and 70 deletions
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2024 The Backstage Authors
*
@@ -15,7 +14,8 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryFn, StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import type { StoryFn } from '@storybook/react-vite';
import { ButtonLink } from './ButtonLink';
import { Flex } from '../Flex';
import { MemoryRouter } from 'react-router-dom';
@@ -43,8 +43,6 @@ const meta = preview.meta({
},
});
type Story = StoryObj<typeof meta>;
export const Default = meta.story({
args: {
children: 'Button',
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import preview from '../../../../../.storybook/preview';
import {
Dialog,
@@ -61,12 +62,10 @@ export const Default = meta.story({
},
});
export const Open = meta.story({
export const Open = Default.extend({
args: {
...Default.input.args,
defaultOpen: true,
},
render: Default.input.render,
});
export const NoTrigger = meta.story({
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -15,7 +14,8 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryObj, StoryFn } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import type { StoryFn } from '@storybook/react-vite';
import { Header } from './Header';
import type { HeaderTab } from './types';
import {
@@ -45,8 +45,6 @@ const meta = preview.meta({
},
});
type Story = StoryObj<typeof meta>;
const withRouter = (Story: StoryFn) => (
<MemoryRouter>
<Story />
@@ -15,7 +15,7 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryObj, StoryFn } from '@storybook/react-vite';
import type { StoryFn } from '@storybook/react-vite';
import { HeaderPage } from './HeaderPage';
import type { HeaderTab } from '../Header/types';
import { MemoryRouter } from 'react-router-dom';
@@ -38,8 +38,6 @@ const meta = preview.meta({
},
});
type Story = StoryObj<typeof meta>;
const tabs: HeaderTab[] = [
{
id: 'overview',
@@ -207,12 +205,8 @@ export const WithEverything = meta.story({
),
});
export const WithLayout = meta.story({
args: {
...WithEverything.input.args,
},
export const WithLayout = WithEverything.extend({
decorators: [withRouter, ...layoutDecorator],
render: WithEverything.input.render,
});
export const WithTabsMatchingStrategies = meta.story({
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2024 The Backstage Authors
*
@@ -15,7 +14,8 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryFn, StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import type { StoryFn } from '@storybook/react-vite';
import { Link } from './Link';
import { Flex } from '../Flex';
import { Text } from '../Text';
@@ -36,8 +36,6 @@ const meta = preview.meta({
],
});
type Story = StoryObj<typeof meta>;
export const Default = meta.story({
args: {
href: '/',
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -15,7 +14,7 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import {
MenuTrigger,
SubmenuTrigger,
@@ -51,8 +50,6 @@ const meta = preview.meta({
],
});
type Story = StoryObj<typeof meta>;
const options = [
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -15,7 +14,7 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import {
MenuTrigger,
SubmenuTrigger,
@@ -39,8 +38,6 @@ const meta = preview.meta({
],
});
type Story = StoryObj<typeof meta>;
const options = [
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -15,7 +14,7 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import {
MenuTrigger,
MenuAutocompleteListbox,
@@ -41,8 +40,6 @@ const meta = preview.meta({
],
});
type Story = StoryObj<typeof meta>;
const options = [
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -15,7 +14,7 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import { MenuTrigger, MenuListBox, MenuListBoxItem } from './index';
import { Button, Flex, Text } from '../..';
import { useEffect, useState } from 'react';
@@ -34,8 +33,6 @@ const meta = preview.meta({
],
});
type Story = StoryObj<typeof meta>;
export const Default = meta.story({
args: {
children: null,
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2024 The Backstage Authors
*
@@ -15,8 +14,8 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import preview from '../../../../../.storybook/preview';
import { useState } from 'react';
import type { StoryObj } from '@storybook/react-vite';
import { SearchField } from './SearchField';
import { Form } from 'react-aria-components';
import { Flex } from '../Flex';
@@ -43,8 +42,6 @@ const meta = preview.meta({
},
});
type Story = StoryObj<typeof meta>;
export const Default = meta.story({
args: {
name: 'url',
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -14,7 +13,8 @@ import preview from '../../../../../.storybook/preview';
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import { Select } from './Select';
import { Flex } from '../Flex';
import { Form } from 'react-aria-components';
@@ -28,8 +28,6 @@ const meta = preview.meta({
},
});
type Story = StoryObj<typeof meta>;
const fontOptions = [
{ value: 'sans', label: 'Sans-serif' },
{ value: 'serif', label: 'Serif' },
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -15,8 +14,9 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import preview from '../../../../../.storybook/preview';
import { useState } from 'react';
import type { StoryFn, StoryObj } from '@storybook/react-vite';
import type { StoryFn } from '@storybook/react-vite';
import { type Selection } from 'react-aria-components';
import {
Table,
@@ -55,8 +55,6 @@ const meta = preview.meta({
// Work in progress to fix it here - https://github.com/backstage/backstage/pull/30687
const data1 = data1Raw.slice(0, 10);
type Story = StoryObj<typeof meta>;
export const TableOnly = meta.story({
render: () => {
return (
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2024 The Backstage Authors
*
@@ -15,7 +14,8 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryFn, StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import type { StoryFn } from '@storybook/react-vite';
import { Tabs, TabList, Tab, TabPanel } from './Tabs';
import { MemoryRouter } from 'react-router-dom';
import { Box } from '../Box';
@@ -26,8 +26,6 @@ const meta = preview.meta({
component: Tabs,
});
type Story = StoryObj<typeof meta>;
const withRouter = (Story: StoryFn) => (
<MemoryRouter>
<Story />
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2025 The Backstage Authors
*
@@ -15,8 +14,8 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import preview from '../../../../../.storybook/preview';
import { useState } from 'react';
import type { StoryObj } from '@storybook/react-vite';
import { TagGroup, Tag } from '.';
import type { Selection } from 'react-aria-components';
import { Flex } from '../../';
@@ -57,8 +56,6 @@ const meta = preview.meta({
],
});
type Story = StoryObj<typeof meta>;
const initialList: ListItem[] = [
{ id: 'banana', name: 'Banana', icon: <RiBugLine /> },
{
@@ -1,4 +1,3 @@
import preview from '../../../../../.storybook/preview';
/*
* Copyright 2024 The Backstage Authors
*
@@ -15,7 +14,7 @@ import preview from '../../../../../.storybook/preview';
* limitations under the License.
*/
import type { StoryObj } from '@storybook/react-vite';
import preview from '../../../../../.storybook/preview';
import { Text } from './Text';
import { Flex } from '../Flex';
@@ -27,8 +26,6 @@ const meta = preview.meta({
},
});
type Story = StoryObj<typeof meta>;
export const Default = meta.story({
args: {
children:
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import preview from '../../../../../.storybook/preview';
import { Placement } from '@react-types/overlays';
import { TooltipTrigger, Tooltip } from './Tooltip';
import { Button } from '../Button/Button';
@@ -29,10 +28,6 @@ const meta = preview.meta({
isDisabled: {
control: { type: 'boolean' },
},
placement: {
options: ['top', 'right', 'bottom', 'left'],
control: { type: 'inline-radio' },
},
delay: {
control: { type: 'number' },
},
@@ -40,7 +35,7 @@ const meta = preview.meta({
control: { type: 'number' },
},
},
render: ({ children, isOpen, isDisabled, placement, delay, closeDelay }) => (
render: ({ children, isOpen, isDisabled, delay, closeDelay }) => (
<TooltipTrigger
isOpen={isOpen}
isDisabled={isDisabled}
@@ -48,7 +43,7 @@ const meta = preview.meta({
closeDelay={closeDelay}
>
<Button>Button</Button>
<Tooltip placement={placement}>{children ?? 'I am a tooltip'}</Tooltip>
<Tooltip>{children ?? 'I am a tooltip'}</Tooltip>
</TooltipTrigger>
),
});