Skip to content

Commit 042386f

Browse files
authored
Merge pull request #4872 from GeekyAnts/fix/typing-composites-components
Fix/typing composites components
2 parents 2877e02 + e10ef05 commit 042386f

File tree

8 files changed

+42
-41
lines changed

8 files changed

+42
-41
lines changed

src/components/composites/AlertDialog/types.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import type { IBoxProps } from '../../primitives/Box';
22
import type { IIconButtonProps } from '../IconButton';
33
import type { MutableRefObject } from 'react';
44
import type { IFadeProps, ISlideProps } from '../Transitions';
5-
import type { CustomProps } from '../../../components/types/utils';
5+
import type {
6+
CustomProps,
7+
ThemeComponentSizeType,
8+
} from '../../../components/types/utils';
69

710
export interface InterfaceAlertDialogProps extends IBoxProps {
811
/**
@@ -20,7 +23,7 @@ export interface InterfaceAlertDialogProps extends IBoxProps {
2023
/**
2124
* The size of the AlertDialog
2225
*/
23-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | number | string;
26+
size?: ThemeComponentSizeType<'AlertDialog'>; //'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | number | string;
2427
/**
2528
* The ref of element that is least destructive child of the AlertDialog.
2629
*/
@@ -65,15 +68,15 @@ export interface InterfaceAlertDialogProps extends IBoxProps {
6568
/**
6669
* Props applied on Overlay Animation.
6770
*/
68-
_backdropFade?: IFadeProps;
71+
_backdropFade?: Partial<IFadeProps>;
6972
/**
7073
* Props applied on Child Fade Animation.
7174
*/
72-
_fade?: IFadeProps;
75+
_fade?: Partial<IFadeProps>;
7376
/**
7477
* Props applied on Child Slide Animation.
7578
*/
76-
_slide?: ISlideProps;
79+
_slide?: Partial<ISlideProps>;
7780
/**
7881
* Sets the animation type
7982
* @default "fade"

src/components/composites/Avatar/types.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import type { InterfaceBoxProps } from '../../primitives/Box';
22
import type { IImageProps } from '../../primitives/Image';
33
import type { ImageSourcePropType } from 'react-native';
44
import type { MutableRefObject } from 'react';
5-
import type { CustomProps, ResponsiveValue } from '../../../components/types';
6-
import type { ISizes } from '../../../theme/base/sizes';
7-
5+
import type { CustomProps } from '../../../components/types';
6+
import type { ThemeComponentSizeType } from '../../../components/types/utils';
87
export interface InterfaceAvatarProps extends InterfaceBoxProps<IAvatarProps> {
98
/**
109
* The image source of the avatar.
@@ -14,11 +13,11 @@ export interface InterfaceAvatarProps extends InterfaceBoxProps<IAvatarProps> {
1413
* The size of the avatar
1514
* @default md
1615
*/
17-
size?: ResponsiveValue<ISizes | (string & {}) | number>;
16+
size?: ThemeComponentSizeType<'Avatar'>;
1817
/**
1918
* For providing props to Image component inside Avatar
2019
*/
21-
_image?: IImageProps;
20+
_image?: Partial<IImageProps>;
2221
/**
2322
* ref to be attached to Avatar wrapper
2423
*/
@@ -50,11 +49,11 @@ export interface IAvatarGroupProps extends IAvatarProps {
5049
/**
5150
* For providing props to all Avatar in that Avatar.Group
5251
*/
53-
_avatar?: IAvatarProps;
52+
_avatar?: Partial<IAvatarProps>;
5453
/**
5554
* For providing props to the Avatar that shows the count of remaining Avatars that are not visible when max is applied.
5655
*/
57-
_hiddenAvatarPlaceholder?: IAvatarProps;
56+
_hiddenAvatarPlaceholder?: Partial<IAvatarProps>;
5857
}
5958

6059
export type IAvatarComponentType = ((

src/components/composites/FormControl/types.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,26 @@ export interface IFormControlLabelProps extends IFormControlProps {
3131
/**
3232
* Passed props will be applied on disabled state.
3333
*/
34-
_disabled?: IBoxProps<IFormControlLabelProps>;
34+
_disabled?: Partial<IBoxProps<IFormControlLabelProps>>;
3535
// _focus?: any;
3636
/**
3737
* Passed props will be applied on invalid state.
3838
*/
39-
_invalid?: IBoxProps<IFormControlLabelProps>;
39+
_invalid?: Partial<IBoxProps<IFormControlLabelProps>>;
4040
/**
4141
* Reflects the value of the 'for' content property.
4242
*/
4343
htmlFor?: string;
4444
/**
4545
* Props applied to astrick text
4646
*/
47-
_astrick?: ITextProps;
47+
_astrick?: Partial<ITextProps>;
4848
}
4949
export interface IFormControlErrorMessageProps extends IFormControlProps {
5050
/**
5151
* Passed props will be applied on disabled state.
5252
*/
53-
_disabled?: IBoxProps<IFormControlLabelProps>;
53+
_disabled?: Partial<IBoxProps<IFormControlLabelProps>>;
5454
/**
5555
* The right icon element to use in the FormControl.ErrorMessage.
5656
*/
@@ -70,18 +70,18 @@ export interface IFormControlErrorMessageProps extends IFormControlProps {
7070
/**
7171
* Props to be passed to the HStack used inside of FormControl.ErrorMessage.
7272
*/
73-
_stack?: IStackProps;
73+
_stack?: Partial<IStackProps>;
7474
}
7575
export interface IFormControlHelperTextProps extends IFormControlProps {
7676
/**
7777
* Passed props will be applied on disabled state.
7878
*/
79-
_disabled?: IBoxProps<IFormControlLabelProps>;
79+
_disabled?: Partial<IBoxProps<IFormControlLabelProps>>;
8080
// _focus?: any;
8181
/**
8282
* Passed props will be applied on invalid state.
8383
*/
84-
_invalid?: IBoxProps<IFormControlLabelProps>;
84+
_invalid?: Partial<IBoxProps<IFormControlLabelProps>>;
8585
}
8686

8787
export type FormControlComponentType = ((

src/components/composites/IconButton/types.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { InterfacePressableProps } from '../../primitives/Pressable/types';
22
import type { IIconProps } from '../../primitives/Icon';
3-
import type { CustomProps, ResponsiveValue, VariantType } from '../../types';
4-
import type { ISizes } from '../../../theme/base/sizes';
5-
3+
import type { CustomProps, VariantType } from '../../types';
4+
import type { ThemeComponentSizeType } from '../../../components/types/utils';
65
export interface InterfaceIconButtonProps
76
extends Omit<InterfacePressableProps, 'children' | 'color'>,
87
Omit<
@@ -35,7 +34,7 @@ export interface InterfaceIconButtonProps
3534
/**
3635
* The size of the button.
3736
*/
38-
size?: ResponsiveValue<ISizes | (string & {}) | number>;
37+
size?: ThemeComponentSizeType<'IconButton'>;
3938
/**
4039
* If true, the button will be disabled.
4140
*/
@@ -47,19 +46,19 @@ export interface InterfaceIconButtonProps
4746
/**
4847
* Props to be passed to the icon used inside of IconButton.
4948
*/
50-
_icon?: IIconProps;
49+
_icon?: Partial<IIconProps>;
5150
/**
5251
*
5352
*/
54-
_hover?: IIconButtonProps;
53+
_hover?: Omit<Partial<IIconButtonProps>, '_hover'>;
5554
/**
5655
*
5756
*/
58-
_pressed?: IIconButtonProps;
57+
_pressed?: Omit<Partial<IIconButtonProps>, '_pressed'>;
5958
/**
6059
*
6160
*/
62-
_focus?: IIconButtonProps;
61+
_focus?: Omit<Partial<IIconButtonProps>, '_focus'>;
6362
}
6463

6564
export type IIconButtonProps = InterfaceIconButtonProps & CustomProps<'Icon'>;

src/components/composites/Menu/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export interface IMenuItemProps extends IPressableProps {
9595
/**
9696
* Props to be passed to Text
9797
*/
98-
_text?: ITextProps;
98+
_text?: Partial<ITextProps>;
9999
/**
100100
* This value will be available for the typeahead menu feature
101101
*/

src/components/composites/Modal/types.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import type { InterfaceBoxProps } from '../../primitives/Box';
22
import type { IIconButtonProps } from '../../composites/IconButton';
33
import type { MutableRefObject } from 'react';
4-
5-
import type { CustomProps, ResponsiveValue } from '../../../components/types';
6-
import type { ISizes } from '../../../theme/base/sizes';
4+
import type { CustomProps } from '../../../components/types';
75
import type { IScrollViewProps } from '../../basic/ScrollView';
86
import type { IFadeProps, ISlideProps } from '../Transitions';
9-
7+
import type { ThemeComponentSizeType } from '../../../components/types/utils';
108
export interface InterfaceModalProps extends InterfaceBoxProps<IModalProps> {
119
/**
1210
* If true, the modal will open. Useful for controllable state behaviour
@@ -23,7 +21,7 @@ export interface InterfaceModalProps extends InterfaceBoxProps<IModalProps> {
2321
/**
2422
* The size of the modal
2523
*/
26-
size?: ResponsiveValue<ISizes | (string & {}) | number>;
24+
size?: ThemeComponentSizeType<'Modal'>;
2725
/**
2826
* The ref of element to receive focus when the modal opens.
2927
*/
@@ -69,15 +67,15 @@ export interface InterfaceModalProps extends InterfaceBoxProps<IModalProps> {
6967
/**
7068
* Props applied on Overlay Animation.
7169
*/
72-
_backdropFade?: IFadeProps;
70+
_backdropFade?: Partial<IFadeProps>;
7371
/**
7472
* Props applied on Child Fade Animation.
7573
*/
76-
_fade?: IFadeProps;
74+
_fade?: Partial<IFadeProps>;
7775
/**
7876
* Props applied on Child Slide Animation.
7977
*/
80-
_slide?: ISlideProps;
78+
_slide?: Partial<ISlideProps>;
8179
}
8280

8381
export type IModalComponentType = ((

src/components/composites/Progress/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { Box } from '../../primitives';
33
import type { InterfaceBoxProps } from '../../primitives/Box';
44
import { usePropsResolution } from '../../../hooks/useThemeProps';
55
import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';
6-
import type { CustomProps, ResponsiveValue } from '../../../components/types';
7-
import type { ISizes } from '../../../theme/base/sizes';
6+
import type {
7+
CustomProps,
8+
ThemeComponentSizeType,
9+
} from '../../../components/types';
810

911
export interface InterfaceProgressProps
1012
extends InterfaceBoxProps<IProgressProps> {
@@ -17,7 +19,7 @@ export interface InterfaceProgressProps
1719
* Defines height of Progress
1820
* @default sm
1921
*/
20-
size?: ResponsiveValue<ISizes | (string & {}) | number>;
22+
size?: ThemeComponentSizeType<'Progress'>;
2123

2224
/**
2325
* The color scheme of the progress. This should be one of the color keys in the theme (e.g."green", "red").

src/components/composites/Skeleton/types.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ export interface ISkeletonTextProps extends IStackProps {
6161
/**
6262
* Stying for each line
6363
*/
64-
_line?: ISkeletonProps;
64+
_line?: Partial<ISkeletonProps>;
6565

6666
/**
6767
* Props to be passed to the Stack used inside.
6868
*/
69-
_stack?: IStackProps;
69+
_stack?: Partial<IStackProps>;
7070
}
7171

7272
export type ISkeletonComponentType = ((

0 commit comments

Comments
 (0)