@@ -25,14 +25,7 @@ import { WPDataRegistry } from '@wordpress/data/build-types/registry';
2525import { Tile , type TileProps } from './Tile' ;
2626import WithRegistrySetup from '../../../../../../../tests/js/WithRegistrySetup' ;
2727import { CORE_USER } from '@/js/googlesitekit/datastore/user/constants' ;
28-
29- // Type for Storybook story exports with custom properties
30- type Story = {
31- ( props : TileProps ) : JSX . Element ;
32- storyName ?: string ;
33- args ?: TileProps & { setupRegistry ?: ( registry : WPDataRegistry ) => void } ;
34- scenario ?: Record < string , unknown > ;
35- } ;
28+ import { Story } from '@/js/types/Story' ;
3629
3730function Template ( {
3831 setupRegistry = ( ) => { } ,
@@ -55,7 +48,7 @@ function Template( {
5548 ) ;
5649}
5750
58- export const DefaultTile = Template . bind ( { } ) as Story ;
51+ export const DefaultTile = Template . bind ( { } ) as Story < TileProps > ;
5952DefaultTile . storyName = 'Default Tile' ;
6053DefaultTile . args = {
6154 title : 'Form Submissions' ,
@@ -65,7 +58,7 @@ DefaultTile.args = {
6558 format : { style : 'decimal' } ,
6659} ;
6760
68- export const PrimaryPositiveTile = Template . bind ( { } ) as Story ;
61+ export const PrimaryPositiveTile = Template . bind ( { } ) as Story < TileProps > ;
6962PrimaryPositiveTile . storyName = 'Primary Tile - Positive' ;
7063PrimaryPositiveTile . args = {
7164 title : 'Revenue' ,
@@ -77,7 +70,7 @@ PrimaryPositiveTile.args = {
7770} ;
7871PrimaryPositiveTile . scenario = { } ;
7972
80- export const PrimaryNegativeTile = Template . bind ( { } ) as Story ;
73+ export const PrimaryNegativeTile = Template . bind ( { } ) as Story < TileProps > ;
8174PrimaryNegativeTile . storyName = 'Primary Tile - Negative' ;
8275PrimaryNegativeTile . args = {
8376 title : 'Revenue' ,
@@ -89,7 +82,7 @@ PrimaryNegativeTile.args = {
8982} ;
9083PrimaryNegativeTile . scenario = { } ;
9184
92- export const PrimaryNeutralTile = Template . bind ( { } ) as Story ;
85+ export const PrimaryNeutralTile = Template . bind ( { } ) as Story < TileProps > ;
9386PrimaryNeutralTile . storyName = 'Primary Tile - Neutral' ;
9487PrimaryNeutralTile . args = {
9588 title : 'Revenue' ,
@@ -101,7 +94,7 @@ PrimaryNeutralTile.args = {
10194} ;
10295PrimaryNeutralTile . scenario = { } ;
10396
104- export const PercentFormat = Template . bind ( { } ) as Story ;
97+ export const PercentFormat = Template . bind ( { } ) as Story < TileProps > ;
10598PercentFormat . storyName = 'Percent Format' ;
10699PercentFormat . args = {
107100 title : 'Conversion Rate' ,
@@ -111,7 +104,7 @@ PercentFormat.args = {
111104 format : { style : 'percent' , maximumFractionDigits : 1 } ,
112105} ;
113106
114- export const WithInfoTooltip = Template . bind ( { } ) as Story ;
107+ export const WithInfoTooltip = Template . bind ( { } ) as Story < TileProps > ;
115108WithInfoTooltip . storyName = 'With Info Tooltip' ;
116109WithInfoTooltip . args = {
117110 title : 'Add to Cart' ,
@@ -123,7 +116,7 @@ WithInfoTooltip.args = {
123116} ;
124117WithInfoTooltip . scenario = { } ;
125118
126- export const NegativeChange = Template . bind ( { } ) as Story ;
119+ export const NegativeChange = Template . bind ( { } ) as Story < TileProps > ;
127120NegativeChange . storyName = 'Negative Change' ;
128121NegativeChange . args = {
129122 title : 'Form Submissions' ,
@@ -133,7 +126,7 @@ NegativeChange.args = {
133126 format : { style : 'decimal' } ,
134127} ;
135128
136- export const ZeroDataPreviousRange = Template . bind ( { } ) as Story ;
129+ export const ZeroDataPreviousRange = Template . bind ( { } ) as Story < TileProps > ;
137130ZeroDataPreviousRange . storyName = 'Zero Data (Previous Range)' ;
138131ZeroDataPreviousRange . args = {
139132 title : 'Form Submissions' ,
@@ -143,7 +136,7 @@ ZeroDataPreviousRange.args = {
143136 format : { style : 'decimal' } ,
144137} ;
145138
146- export const CustomDateRange = Template . bind ( { } ) as Story ;
139+ export const CustomDateRange = Template . bind ( { } ) as Story < TileProps > ;
147140CustomDateRange . storyName = 'Custom Date Range (90 days)' ;
148141CustomDateRange . args = {
149142 title : 'Form Submissions' ,
0 commit comments