Skip to content

Commit 2877e02

Browse files
authored
Merge pull request #4870 from GeekyAnts/fix/typing-primitives-components
Fix/typing primitives components
2 parents 9b568a8 + c84e384 commit 2877e02

File tree

14 files changed

+45
-47
lines changed

14 files changed

+45
-47
lines changed

src/components/primitives/Box/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface InterfaceBoxProps<T = null>
3434
/**
3535
* For providing props to Text inside Box
3636
*/
37-
_text?: ITextProps;
37+
_text?: Partial<ITextProps>;
3838
bg?: ResponsiveValue<ColorType | (string & {}) | ILinearGradientProps>;
3939
background?: ResponsiveValue<
4040
ColorType | (string & {}) | ILinearGradientProps

src/components/primitives/Button/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,27 +104,27 @@ export interface InterfaceButtonProps
104104
/**
105105
* Props to be passed to the button when isLoading is true.
106106
*/
107-
_loading?: Omit<IButtonProps, '_loading'>;
107+
_loading?: Omit<Partial<IButtonProps>, '_loading'>;
108108
/**
109109
* Props to be passed to the button when button is disabled.
110110
*/
111-
_disabled?: Omit<IButtonProps, '_disable'>;
111+
_disabled?: Omit<Partial<IButtonProps>, '_disable'>;
112112
/**
113113
* Props to be passed to the spinner when isLoading is true.
114114
*/
115-
_spinner?: ISpinnerProps;
115+
_spinner?: Partial<ISpinnerProps>;
116116
/**
117117
* Props to be passed to the button when button is hovered.
118118
*/
119-
_hover?: Omit<IButtonProps, '_hover'>;
119+
_hover?: Omit<Partial<IButtonProps>, '_hover'>;
120120
/**
121121
* Props to be passed to the button when button is pressed.
122122
*/
123-
_pressed?: Omit<IButtonProps, '_pressed'>;
123+
_pressed?: Omit<Partial<IButtonProps>, '_pressed'>;
124124
/**
125125
* Props to be passed to the button when button is focused.
126126
*/
127-
_focus?: Omit<IButtonProps, '_focus'>;
127+
_focus?: Omit<Partial<IButtonProps>, '_focus'>;
128128
/**
129129
* The right icon element to use in the button.
130130
*/

src/components/primitives/Checkbox/types.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ export interface InterfaceCheckbox extends InterfaceBoxProps<ICheckboxProps> {
7575
* The size (width and height) of the checkbox.
7676
* @default 'md'
7777
*/
78-
size?:
79-
| ResponsiveValue<'sm' | 'md' | 'lg'>
80-
| ThemeComponentSizeType<'Checkbox'>;
78+
size?: ThemeComponentSizeType<'Checkbox'>;
8179
/**
8280
* If given, will use this icon instead of the default.
8381
*/
@@ -125,7 +123,7 @@ export interface InterfaceCheckbox extends InterfaceBoxProps<ICheckboxProps> {
125123
/**
126124
* Props to be passed to the Stack used inside.
127125
*/
128-
_stack?: IStackProps;
126+
_stack?: Partial<IStackProps>;
129127
/**
130128
* Function called when the state of the checkbox changes.
131129
*/
@@ -168,7 +166,7 @@ export interface ICheckboxGroupProps
168166
/**
169167
* Pass props will be passed to each checkbox.
170168
*/
171-
_checkbox?: ICheckboxProps;
169+
_checkbox?: Partial<ICheckboxProps>;
172170
}
173171
export interface ICheckboxContext extends IFormControlContext {
174172
colorScheme?: string;
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import type { ITextProps } from '../Text';
2-
import type { ResponsiveValue } from '../../../components/types';
3-
import type { ISizes } from '../../../theme/base/sizes';
42

53
import type { CustomProps, ThemeComponentSizeType } from '../../types/utils';
64

@@ -9,9 +7,7 @@ export interface IterfaceHeadingProps extends ITextProps {
97
* The size of the heading.
108
* @default xl
119
*/
12-
size?:
13-
| ResponsiveValue<ISizes | (string & {}) | number>
14-
| ThemeComponentSizeType<'Heading'>;
10+
size?: ThemeComponentSizeType<'Heading'>;
1511
}
1612

1713
export type IHeadingProps = IterfaceHeadingProps & CustomProps<'Heading'>;

src/components/primitives/Icon/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { PlatformProps } from '../../types';
22
import type { StyledProps } from '../../../theme/types';
33
import type { ResponsiveValue } from '../../types/responsiveValue';
4-
import type { ISizes } from '../../../theme/base/sizes';
54
import type { SvgProps } from 'react-native-svg';
65
import type { IColors } from '../../../theme/base/colors';
76

@@ -27,9 +26,7 @@ export interface InterfaceIconProps
2726
/**
2827
* The size of the icon.
2928
*/
30-
size?:
31-
| ResponsiveValue<ISizes | (string & {}) | number>
32-
| ThemeComponentSizeType<'Icon'>;
29+
size?: ThemeComponentSizeType<'Icon'>;
3330

3431
/**
3532
* The color of the icon.

src/components/primitives/Image/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface InterfaceImageProps
3636
/**
3737
* Text styling for alt.
3838
*/
39-
_alt?: ITextProps;
39+
_alt?: Partial<ITextProps>;
4040
/**
4141
* In event there was an error loading the src, specify a fallback JSX Element.
4242
*/

src/components/primitives/Link/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface InterfaceLinkProps extends InterfaceBoxProps<ILinkProps> {
3939
/**
4040
* Hover props. Accepts all styled system props.
4141
*/
42-
_hover?: Omit<ILinkProps, '_hover'>;
42+
_hover?: Omit<Partial<ILinkProps>, '_hover'>;
4343
/**
4444
* Ref to be attached to the Link wrapper
4545
*/

src/components/primitives/List/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ export interface IListProps extends IStackProps {
2828
/**
2929
* common _hover that is passed to all the children.
3030
*/
31-
_hover?: IStackProps;
31+
_hover?: Partial<IStackProps>;
3232
/**
3333
* common _focus that is passed to all the children.
3434
*/
35-
_focus?: IStackProps;
35+
_focus?: Partial<IStackProps>;
3636
/**
3737
* common _pressed that is passed to all the children.
3838
*/
39-
_pressed?: IStackProps;
39+
_pressed?: Partial<IStackProps>;
4040
/**
4141
* Ordered List index starting value.
4242
* @default 0
@@ -45,7 +45,7 @@ export interface IListProps extends IStackProps {
4545
/**
4646
* Props to style the commonly all the List.Item's text.
4747
*/
48-
_text?: ITextProps;
48+
_text?: Partial<ITextProps>;
4949
}
5050

5151
export interface IListItemProps extends IPressableProps {
@@ -73,7 +73,7 @@ export interface IListItemProps extends IPressableProps {
7373
/**
7474
* Props to style the child text.
7575
*/
76-
_text?: Omit<ITextProps, '_text'>;
76+
_text?: Partial<Omit<ITextProps, '_text'>>;
7777
}
7878
export type IListComponentType = ((
7979
props: IListProps & { ref?: any }

src/components/primitives/Pressable/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ export interface InterfacePressableProps<T = IPressableProps>
2424
/**
2525
* Style props to be applied when hovered
2626
*/
27-
_hover?: Omit<IPressableProps, '_hover'>;
27+
_hover?: Omit<Partial<IPressableProps>, '_hover'>;
2828
/**
2929
* Style props to be applied when pressed
3030
*/
31-
_pressed?: Omit<IPressableProps, '_pressed'>;
31+
_pressed?: Omit<Partial<IPressableProps>, '_pressed'>;
3232
/**
3333
* Style props to be applied when focus
3434
*/
35-
_focus?: Omit<IPressableProps, '_focus'>;
35+
_focus?: Omit<Partial<IPressableProps>, '_focus'>;
3636

3737
/**
3838
* Style props to be applied when disabled
3939
*/
40-
_disabled?: Omit<IPressableProps, '_disabled'>;
40+
_disabled?: Omit<Partial<IPressableProps>, '_disabled'>;
4141

4242
/**
4343
* If true, the p will be disabled.
@@ -62,7 +62,7 @@ export interface InterfacePressableProps<T = IPressableProps>
6262
/**
6363
* Style props to be applied when focus visible. These styles will be only applied when user is interacting the app using a keyboard. (Web only)
6464
*/
65-
_focusVisible?: Omit<IPressableProps, '_focusVisible'>;
65+
_focusVisible?: Omit<Partial<IPressableProps>, '_focusVisible'>;
6666

6767
children?:
6868
| React.ReactNode

src/components/primitives/Radio/types.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { MutableRefObject } from 'react';
77
import type { ResponsiveValue } from '../../../components/types';
88
import type { ISizes } from '../../../theme/base/sizes';
99
export type IRadioValue = string;
10-
import type { CustomProps } from '../../types';
10+
import type { CustomProps, ThemeComponentSizeType } from '../../types';
1111
import type { IIconProps } from '../Icon';
1212

1313
export type IRadioGroupOnChangeHandler = (value: IRadioValue) => any;
@@ -50,7 +50,7 @@ export interface InterfaceRadioProps extends InterfaceBoxProps<IRadioProps> {
5050
* The size (width and height) of the radio.
5151
*/
5252

53-
size?: ResponsiveValue<ISizes | (string & {}) | number>;
53+
size?: ThemeComponentSizeType<'Radio'>;
5454

5555
/**
5656
* If given, will use this icon instead of the default.

0 commit comments

Comments
 (0)