@hero-design/rn 8.112.3 → 8.112.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +12 -0
- package/es/index.js +1764 -1372
- package/jest.config.js +1 -1
- package/lib/index.js +1764 -1372
- package/package.json +2 -2
- package/src/components/Accordion/AccordionItem.tsx +1 -1
- package/src/components/AnimatedScroller/AnimatedScrollable.tsx +1 -1
- package/src/components/AnimatedScroller/SectionListWithFAB.tsx +1 -1
- package/src/components/Box/StyledBox.tsx +1 -1
- package/src/components/Button/UtilityButton/index.tsx +1 -1
- package/src/components/Calendar/CalendarRange.tsx +1 -1
- package/src/components/Calendar/CalendarRowItem.tsx +2 -2
- package/src/components/Calendar/index.tsx +1 -1
- package/src/components/Carousel/index.tsx +1 -1
- package/src/components/Chart/Line/Line.tsx +3 -4
- package/src/components/Chart/index.tsx +0 -2
- package/src/components/Chart/shared/ChartHeader.tsx +1 -1
- package/src/components/Chart/shared/hooks/useColorScale.ts +2 -2
- package/src/components/Chart/shared/hooks/useGenerateTicks.ts +2 -2
- package/src/components/Chart/shared/hooks/useScaleBandX.ts +3 -3
- package/src/components/Chart/shared/hooks/useScaleLinearY.ts +3 -4
- package/src/components/Chart/types.ts +0 -8
- package/src/components/Checkbox/utils.ts +1 -1
- package/src/components/Chip/index.tsx +1 -1
- package/src/components/DatePicker/hooks/__tests__/useFormatDate.spec.ts +7 -5
- package/src/components/DatePicker/hooks/useFormatDate.ts +1 -1
- package/src/components/DatePicker/types.ts +1 -1
- package/src/components/FloatingIsland/index.tsx +1 -1
- package/src/components/Illustration/index.tsx +1 -1
- package/src/components/List/BasicListItem.tsx +1 -1
- package/src/components/List/StyledListItem.tsx +2 -2
- package/src/components/LocaleProvider/__tests__/utils.specs.ts +1 -2
- package/src/components/LocaleProvider/index.tsx +1 -1
- package/src/components/LocaleProvider/utils.ts +2 -3
- package/src/components/Portal/index.tsx +1 -1
- package/src/components/Portal/types.tsx +2 -2
- package/src/components/Radio/Radio.tsx +1 -1
- package/src/components/Rate/index.tsx +2 -2
- package/src/components/RefreshControl/index.tsx +1 -1
- package/src/components/RichTextEditor/RichTextEditor.tsx +6 -6
- package/src/components/RichTextEditor/{BaseRichTextEditor.tsx → RichTextEditorInput.tsx} +4 -4
- package/src/components/RichTextEditor/StyledRichTextEditor.ts +0 -5
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +19 -4
- package/src/components/RichTextEditor/index.tsx +3 -3
- package/src/components/RichTextEditor/utils/events.ts +1 -13
- package/src/components/Search/SearchOneLine.tsx +1 -1
- package/src/components/Search/StyledSearch.tsx +1 -1
- package/src/components/SectionHeading/index.tsx +1 -1
- package/src/components/Select/helpers.tsx +1 -18
- package/src/components/Skeleton/index.tsx +1 -1
- package/src/components/Slider/RangeSlider.tsx +1 -1
- package/src/components/StatusScreens/Success/index.tsx +1 -1
- package/src/components/Tabs/ScrollableTabsHeader/ScrollableTabsHeader.tsx +1 -1
- package/src/components/Tabs/StyledTabs.tsx +0 -5
- package/src/components/Tabs/TabWithBadge.tsx +2 -2
- package/src/components/TextInput/index.tsx +3 -3
- package/src/components/TimePicker/TimePickerAndroid.tsx +1 -1
- package/src/components/TimePicker/TimePickerIOS.tsx +1 -1
- package/src/components/TimePicker/types.ts +1 -1
- package/src/components/Toast/ToastContext.ts +1 -1
- package/src/components/Toolbar/index.tsx +1 -1
- package/src/components/Typography/Label/index.tsx +1 -1
- package/src/theme/global/colors/swagSystemPalette.ts +1 -1
- package/src/theme/global/colors/types.ts +1 -1
- package/src/theme/global/shadows/index.ts +0 -3
- package/src/theme/global/shadows/types.ts +1 -1
- package/src/theme/global/sizes.ts +1 -0
- package/src/theme/global/typography.ts +2 -1
- package/src/utils/scale.ts +2 -2
- package/types/components/Accordion/AccordionItem.d.ts +1 -1
- package/types/components/AnimatedScroller/AnimatedScrollable.d.ts +1 -1
- package/types/components/AnimatedScroller/SectionListWithFAB.d.ts +1 -1
- package/types/components/Box/StyledBox.d.ts +0 -5
- package/types/components/Button/UtilityButton/index.d.ts +1 -1
- package/types/components/Calendar/CalendarRowItem.d.ts +1 -2
- package/types/components/Carousel/index.d.ts +0 -1
- package/types/components/Chart/index.d.ts +0 -3
- package/types/components/Chart/shared/ChartHeader.d.ts +1 -1
- package/types/components/Chart/shared/hooks/useScaleBandX.d.ts +2 -3
- package/types/components/Chart/shared/hooks/useScaleLinearY.d.ts +2 -3
- package/types/components/Chart/types.d.ts +1 -7
- package/types/components/Checkbox/utils.d.ts +2 -1
- package/types/components/Chip/index.d.ts +1 -1
- package/types/components/DatePicker/types.d.ts +1 -1
- package/types/components/FloatingIsland/index.d.ts +1 -1
- package/types/components/Illustration/index.d.ts +1 -1
- package/types/components/List/BasicListItem.d.ts +1 -1
- package/types/components/List/StyledListItem.d.ts +2 -2
- package/types/components/LocaleProvider/utils.d.ts +1 -1
- package/types/components/Portal/index.d.ts +1 -1
- package/types/components/Portal/types.d.ts +3 -2
- package/types/components/Radio/Radio.d.ts +1 -1
- package/types/components/Rate/index.d.ts +2 -2
- package/types/components/RefreshControl/index.d.ts +1 -1
- package/types/components/RichTextEditor/RichTextEditor.d.ts +2 -6
- package/types/components/RichTextEditor/{BaseRichTextEditor.d.ts → RichTextEditorInput.d.ts} +3 -3
- package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -7
- package/types/components/RichTextEditor/index.d.ts +2 -2
- package/types/components/RichTextEditor/utils/events.d.ts +2 -3
- package/types/components/Search/SearchOneLine.d.ts +1 -1
- package/types/components/Search/StyledSearch.d.ts +2 -1
- package/types/components/SectionHeading/index.d.ts +1 -1
- package/types/components/Select/helpers.d.ts +2 -2
- package/types/components/Skeleton/index.d.ts +1 -1
- package/types/components/Slider/RangeSlider.d.ts +1 -1
- package/types/components/StatusScreens/Success/index.d.ts +1 -1
- package/types/components/Tabs/ScrollableTabsHeader/ScrollableTabsHeader.d.ts +1 -1
- package/types/components/Tabs/StyledTabs.d.ts +1 -7
- package/types/components/Tabs/TabWithBadge.d.ts +2 -2
- package/types/components/TextInput/index.d.ts +2 -3
- package/types/components/TimePicker/types.d.ts +1 -1
- package/types/components/Toast/ToastContext.d.ts +2 -1
- package/types/components/Toolbar/index.d.ts +1 -1
- package/types/components/Typography/Label/index.d.ts +1 -1
- package/types/theme/components/alert.d.ts +10 -1
- package/types/theme/components/bottomNavigation.d.ts +10 -1
- package/types/theme/components/chip.d.ts +10 -1
- package/types/theme/components/fab.d.ts +10 -1
- package/types/theme/components/floatingIsland.d.ts +10 -1
- package/types/theme/components/list.d.ts +10 -1
- package/types/theme/components/search.d.ts +10 -1
- package/types/theme/components/segmentedControl.d.ts +10 -1
- package/types/theme/components/slider.d.ts +10 -1
- package/types/theme/components/toast.d.ts +10 -1
- package/types/theme/global/colors/swagSystemPalette.d.ts +1 -1
- package/types/theme/global/colors/types.d.ts +2 -1
- package/types/theme/global/index.d.ts +1 -1
- package/types/theme/global/shadows/index.d.ts +0 -2
- package/types/theme/global/shadows/types.d.ts +2 -1
- package/types/theme/global/typography.d.ts +1 -1
- package/types/utils/scale.d.ts +0 -2
- package/.cursor/rules/performance-optimization.mdc +0 -64
- package/.cursor/rules/rn-rules.mdc +0 -165
- package/.cursor/rules/testing-rules.mdc +0 -114
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import type { IconName, IconProps } from '../Icon';
|
|
4
|
-
|
|
4
|
+
interface SectionHeadingProps extends ViewProps {
|
|
5
5
|
/**
|
|
6
6
|
* Heading text.
|
|
7
7
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { SectionData, CombinedOptionsType, SelectOptionType } from './types';
|
|
2
|
-
export declare const getKey: <V, T extends SelectOptionType<V>>(option: T, index: number, keyExtractor?: (opt: T, i?: number) => string) => string | number;
|
|
3
2
|
export declare const isSections: <V, T extends SelectOptionType<V>>(options: CombinedOptionsType<V, T>) => options is SectionData<V, T>[];
|
|
4
3
|
export declare const toSections: <V, T extends SelectOptionType<V>>(options: CombinedOptionsType<V, T>) => SectionData<V, T>[];
|
|
5
4
|
export declare const toFlatOptions: <V, T extends SelectOptionType<V>>(options: CombinedOptionsType<V, T>) => SelectOptionType<V>[];
|
|
6
|
-
|
|
5
|
+
type ScrollParams = {
|
|
7
6
|
itemIndex: number;
|
|
8
7
|
sectionIndex: number;
|
|
9
8
|
};
|
|
10
9
|
export declare const getScrollParams: <V, T extends SelectOptionType<V>>(value: V, sections: SectionData<V, T>[]) => ScrollParams;
|
|
10
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { ViewProps, ImageSourcePropType, ImageProps as RNImageProps } from
|
|
|
3
3
|
import type { SuccessVariant } from './StyledSuccess';
|
|
4
4
|
import type { ImageProps } from '../../Image';
|
|
5
5
|
import type { IllustrationName } from '../../Illustration';
|
|
6
|
-
|
|
6
|
+
interface SuccessProps extends ViewProps {
|
|
7
7
|
/**
|
|
8
8
|
* Image to be displayed.
|
|
9
9
|
* @deprecated The `image` prop is deprecated and will be removed in the next major version. Use the `icon` prop instead.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import type { TabType } from '..';
|
|
4
|
-
|
|
4
|
+
interface ScrollableTabHeaderProps extends ViewProps {
|
|
5
5
|
/**
|
|
6
6
|
* Callback which is called on tab press, receiving key of upcoming active Tab.
|
|
7
7
|
*/
|
|
@@ -30,12 +30,6 @@ declare const HeaderTabItem: import("@emotion/native").StyledComponent<import("r
|
|
|
30
30
|
}, {}, {
|
|
31
31
|
ref?: import("react").Ref<View> | undefined;
|
|
32
32
|
}>;
|
|
33
|
-
declare const TabScreen: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
34
|
-
theme?: import("@emotion/react").Theme;
|
|
35
|
-
as?: React.ElementType;
|
|
36
|
-
}, {}, {
|
|
37
|
-
ref?: import("react").Ref<View> | undefined;
|
|
38
|
-
}>;
|
|
39
33
|
declare const StyledIndicator: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<View>> & {
|
|
40
34
|
theme?: import("@emotion/react").Theme;
|
|
41
35
|
as?: React.ElementType;
|
|
@@ -48,4 +42,4 @@ declare const StyledBadgeWrapper: import("@emotion/native").StyledComponent<impo
|
|
|
48
42
|
}, {}, {
|
|
49
43
|
ref?: import("react").Ref<View> | undefined;
|
|
50
44
|
}>;
|
|
51
|
-
export { TabContainer, HeaderTabWrapper, HeaderTab, HeaderTabItem,
|
|
45
|
+
export { TabContainer, HeaderTabWrapper, HeaderTab, HeaderTabItem, StyledIndicator, StyledBadgeWrapper, };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
type StatusBadgeType = {
|
|
4
4
|
type: 'status';
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type CounterBadgeType = {
|
|
7
7
|
type: 'counter';
|
|
8
8
|
value: number;
|
|
9
9
|
max?: number;
|
|
@@ -4,12 +4,12 @@ import type { Theme } from '../../theme';
|
|
|
4
4
|
import type { State } from './StyledTextInput';
|
|
5
5
|
import type { IconName } from '../Icon';
|
|
6
6
|
export type TextInputHandles = Pick<RNTextInput, 'focus' | 'clear' | 'blur' | 'isFocused' | 'setNativeProps'>;
|
|
7
|
-
|
|
7
|
+
type TextInputVariant = 'text' | 'textarea';
|
|
8
8
|
type NativeTextInputProps = Omit<RNTextInputProps, 'onFocus' | 'onBlur'> & {
|
|
9
9
|
onFocus?: (event?: NativeSyntheticEvent<TextInputFocusEventData>) => void | undefined;
|
|
10
10
|
onBlur?: (event?: NativeSyntheticEvent<TextInputFocusEventData>) => void | undefined;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
interface TextInputRef {
|
|
13
13
|
focus: () => void;
|
|
14
14
|
blur: () => void;
|
|
15
15
|
clear: () => void;
|
|
@@ -132,6 +132,5 @@ export declare const renderMaxLengthMessage: ({ maxLength, state, currentLength,
|
|
|
132
132
|
maxLength?: number;
|
|
133
133
|
hideCharacterCount: boolean;
|
|
134
134
|
}) => false | React.JSX.Element;
|
|
135
|
-
export declare const getDisplayText: (value?: string, defaultValue?: string) => string;
|
|
136
135
|
declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<TextInputHandles>>;
|
|
137
136
|
export default TextInput;
|
|
@@ -23,7 +23,7 @@ export interface TimePickerProps {
|
|
|
23
23
|
confirmLabel: string;
|
|
24
24
|
/**
|
|
25
25
|
* Time display format of current value presented on the input. Default format is: HH:mm aa.
|
|
26
|
-
* Following date-fns's format (https://date-fns.org/
|
|
26
|
+
* Following date-fns's format (https://date-fns.org/v4.1.0/docs/format).
|
|
27
27
|
* This also change how the time picker display between 24 hour and 12 hour mode.
|
|
28
28
|
*/
|
|
29
29
|
displayFormat?: string;
|
|
@@ -6,7 +6,8 @@ export type ToastControllerContextType = {
|
|
|
6
6
|
};
|
|
7
7
|
export declare const fallbackToastControlContext: ToastControllerContextType;
|
|
8
8
|
export declare const ToastContext: import("react").Context<ToastControllerContextType>;
|
|
9
|
-
|
|
9
|
+
type ToastConfigContextType = Pick<ToastContainerProps, 'position' | 'displayType'>;
|
|
10
10
|
export declare const ToastConfigContext: import("react").Context<ToastConfigContextType>;
|
|
11
11
|
export declare const useToastConfig: () => ToastConfigContextType;
|
|
12
12
|
export declare const useToast: () => ToastControllerContextType;
|
|
13
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { ViewProps } from 'react-native';
|
|
4
|
-
|
|
4
|
+
interface ToolbarProps extends Omit<ViewProps, 'style'> {
|
|
5
5
|
/**
|
|
6
6
|
* Toolbar's content.
|
|
7
7
|
*/
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { TextProps as NativeTextProps, StyleProp, TextStyle } from 'react-native';
|
|
4
4
|
import type { TypographyIntent } from '../types';
|
|
5
|
-
|
|
5
|
+
interface LabelProps extends NativeTextProps {
|
|
6
6
|
/**
|
|
7
7
|
* Text content.
|
|
8
8
|
*/
|
|
@@ -33,7 +33,16 @@ declare const getAlertTheme: (theme: GlobalTheme) => {
|
|
|
33
33
|
base: number;
|
|
34
34
|
};
|
|
35
35
|
shadows: {
|
|
36
|
-
wrapper:
|
|
36
|
+
wrapper: {
|
|
37
|
+
shadowOffset: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
};
|
|
41
|
+
shadowColor: string;
|
|
42
|
+
shadowOpacity: number;
|
|
43
|
+
shadowRadius: number;
|
|
44
|
+
elevation: number;
|
|
45
|
+
};
|
|
37
46
|
};
|
|
38
47
|
};
|
|
39
48
|
export default getAlertTheme;
|
|
@@ -9,7 +9,16 @@ declare const getBottomNavigationTheme: (theme: GlobalTheme) => {
|
|
|
9
9
|
borderTop: number;
|
|
10
10
|
};
|
|
11
11
|
shadows: {
|
|
12
|
-
wrapper:
|
|
12
|
+
wrapper: {
|
|
13
|
+
shadowOffset: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
shadowColor: string;
|
|
18
|
+
shadowOpacity: number;
|
|
19
|
+
shadowRadius: number;
|
|
20
|
+
elevation: number;
|
|
21
|
+
};
|
|
13
22
|
};
|
|
14
23
|
sizes: {
|
|
15
24
|
height: number;
|
|
@@ -25,7 +25,16 @@ declare const getChipTheme: (theme: GlobalTheme) => {
|
|
|
25
25
|
outlinedDefaultBorder: number;
|
|
26
26
|
};
|
|
27
27
|
shadows: {
|
|
28
|
-
filledWrapper:
|
|
28
|
+
filledWrapper: {
|
|
29
|
+
shadowOffset: {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
};
|
|
33
|
+
shadowColor: string;
|
|
34
|
+
shadowOpacity: number;
|
|
35
|
+
shadowRadius: number;
|
|
36
|
+
elevation: number;
|
|
37
|
+
};
|
|
29
38
|
};
|
|
30
39
|
fontSizes: {
|
|
31
40
|
icon: number;
|
|
@@ -36,7 +36,16 @@ declare const getFABTheme: (theme: GlobalTheme) => {
|
|
|
36
36
|
icon: number;
|
|
37
37
|
};
|
|
38
38
|
shadows: {
|
|
39
|
-
default:
|
|
39
|
+
default: {
|
|
40
|
+
shadowOffset: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
shadowColor: string;
|
|
45
|
+
shadowOpacity: number;
|
|
46
|
+
shadowRadius: number;
|
|
47
|
+
elevation: number;
|
|
48
|
+
};
|
|
40
49
|
};
|
|
41
50
|
space: {
|
|
42
51
|
actionItemPadding: number;
|
|
@@ -7,7 +7,16 @@ declare const getFloatingIslandTheme: (theme: GlobalTheme) => {
|
|
|
7
7
|
wrapper: number;
|
|
8
8
|
};
|
|
9
9
|
shadows: {
|
|
10
|
-
wrapper:
|
|
10
|
+
wrapper: {
|
|
11
|
+
shadowOffset: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
shadowColor: string;
|
|
16
|
+
shadowOpacity: number;
|
|
17
|
+
shadowRadius: number;
|
|
18
|
+
elevation: number;
|
|
19
|
+
};
|
|
11
20
|
};
|
|
12
21
|
space: {
|
|
13
22
|
wrapperPadding: number;
|
|
@@ -31,7 +31,16 @@ declare const getListTheme: (theme: GlobalTheme) => {
|
|
|
31
31
|
enabled: number;
|
|
32
32
|
};
|
|
33
33
|
shadows: {
|
|
34
|
-
card:
|
|
34
|
+
card: {
|
|
35
|
+
shadowOffset: {
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
};
|
|
39
|
+
shadowColor: string;
|
|
40
|
+
shadowOpacity: number;
|
|
41
|
+
shadowRadius: number;
|
|
42
|
+
elevation: number;
|
|
43
|
+
};
|
|
35
44
|
};
|
|
36
45
|
};
|
|
37
46
|
export default getListTheme;
|
|
@@ -43,7 +43,16 @@ declare const getSearchTheme: (theme: GlobalTheme) => {
|
|
|
43
43
|
surfixSize: number;
|
|
44
44
|
};
|
|
45
45
|
shadows: {
|
|
46
|
-
container:
|
|
46
|
+
container: {
|
|
47
|
+
shadowOffset: {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
};
|
|
51
|
+
shadowColor: string;
|
|
52
|
+
shadowOpacity: number;
|
|
53
|
+
shadowRadius: number;
|
|
54
|
+
elevation: number;
|
|
55
|
+
};
|
|
47
56
|
};
|
|
48
57
|
};
|
|
49
58
|
export default getSearchTheme;
|
|
@@ -20,7 +20,16 @@ declare const getSegmentedControlTheme: (theme: GlobalTheme) => {
|
|
|
20
20
|
shadows: {
|
|
21
21
|
item: {
|
|
22
22
|
inactive: undefined;
|
|
23
|
-
active:
|
|
23
|
+
active: {
|
|
24
|
+
shadowOffset: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
};
|
|
28
|
+
shadowColor: string;
|
|
29
|
+
shadowOpacity: number;
|
|
30
|
+
shadowRadius: number;
|
|
31
|
+
elevation: number;
|
|
32
|
+
};
|
|
24
33
|
};
|
|
25
34
|
};
|
|
26
35
|
radii: {
|
|
@@ -9,7 +9,16 @@ declare const getSliderTheme: (theme: GlobalTheme) => {
|
|
|
9
9
|
disabledThumb: string;
|
|
10
10
|
};
|
|
11
11
|
shadows: {
|
|
12
|
-
marker:
|
|
12
|
+
marker: {
|
|
13
|
+
shadowOffset: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
shadowColor: string;
|
|
18
|
+
shadowOpacity: number;
|
|
19
|
+
shadowRadius: number;
|
|
20
|
+
elevation: number;
|
|
21
|
+
};
|
|
13
22
|
};
|
|
14
23
|
sizes: {
|
|
15
24
|
trackHeight: number;
|
|
@@ -37,7 +37,16 @@ declare const getToastTheme: (theme: GlobalTheme) => {
|
|
|
37
37
|
base: number;
|
|
38
38
|
};
|
|
39
39
|
shadows: {
|
|
40
|
-
wrapper:
|
|
40
|
+
wrapper: {
|
|
41
|
+
shadowOffset: {
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
};
|
|
45
|
+
shadowColor: string;
|
|
46
|
+
shadowOpacity: number;
|
|
47
|
+
shadowRadius: number;
|
|
48
|
+
elevation: number;
|
|
49
|
+
};
|
|
41
50
|
};
|
|
42
51
|
};
|
|
43
52
|
export default getToastTheme;
|
|
@@ -50,8 +50,9 @@ export type BrandSystemPalette = {
|
|
|
50
50
|
decorativeSecondarySurface?: string;
|
|
51
51
|
};
|
|
52
52
|
export type ThemeMode = 'light' | 'dark';
|
|
53
|
-
|
|
53
|
+
type ThemeName = 'swagLight' | 'swagLightJobs' | 'ehWorkDark' | 'ehWork' | 'ehJobs';
|
|
54
54
|
export type SystemPalette = GlobalSystemPalette & BrandSystemPalette & {
|
|
55
55
|
themeMode?: ThemeMode;
|
|
56
56
|
name?: ThemeName;
|
|
57
57
|
};
|
|
58
|
+
export {};
|
|
@@ -62,7 +62,7 @@ declare const getGlobalTheme: (scale: Scale, systemPalette: SystemPalette) => {
|
|
|
62
62
|
decorativeSecondary?: string;
|
|
63
63
|
decorativeSecondarySurface?: string;
|
|
64
64
|
themeMode?: import("./colors/types").ThemeMode;
|
|
65
|
-
name?:
|
|
65
|
+
name?: "swagLight" | "swagLightJobs" | "ehWorkDark" | "ehWork" | "ehJobs";
|
|
66
66
|
};
|
|
67
67
|
fonts: import("./typography").Fonts;
|
|
68
68
|
fontSizes: import("./typography").FontSizes;
|
|
@@ -31,4 +31,4 @@ declare const getFonts: ({ neutral, playful, }: {
|
|
|
31
31
|
declare const getFontSizes: (baseFontSize: number) => FontSizes;
|
|
32
32
|
declare const getLineHeights: (fontSizes: FontSizes) => LineHeights;
|
|
33
33
|
export { getFonts, getFontSizes, getLineHeights };
|
|
34
|
-
export type { Fonts, FontSizes
|
|
34
|
+
export type { Fonts, FontSizes };
|
package/types/utils/scale.d.ts
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
pattern: "**/*.{ts,tsx}"
|
|
3
|
-
description: "Performance optimization rules for React Native components in rn package"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Performance Optimization Rules for RN Package
|
|
7
|
-
|
|
8
|
-
## React Native Performance Best Practices
|
|
9
|
-
|
|
10
|
-
### Component Optimization
|
|
11
|
-
- Use `React.memo()` for components that receive stable props
|
|
12
|
-
- Implement `useMemo()` for expensive calculations
|
|
13
|
-
- Use `useCallback()` for event handlers passed to child components
|
|
14
|
-
- Avoid creating objects/functions in render methods
|
|
15
|
-
- Prefer `useState` functional updates when state depends on previous state
|
|
16
|
-
|
|
17
|
-
### List Performance
|
|
18
|
-
- Use `FlatList` or `SectionList` instead of `ScrollView` with `map()`
|
|
19
|
-
- Implement `getItemLayout` for `FlatList` when item heights are known
|
|
20
|
-
- Use `keyExtractor` prop for consistent item identification
|
|
21
|
-
- Implement `removeClippedSubviews` for large lists
|
|
22
|
-
- Use `windowSize` and `initialNumToRender` for performance tuning
|
|
23
|
-
|
|
24
|
-
### Memory Management
|
|
25
|
-
- Clean up subscriptions in `useEffect` cleanup functions
|
|
26
|
-
- Use `InteractionManager.runAfterInteractions()` for non-critical operations
|
|
27
|
-
- Avoid memory leaks by properly unmounting components
|
|
28
|
-
- Use `React.useRef()` instead of `useState` for mutable values
|
|
29
|
-
- Implement proper error boundaries to prevent crashes
|
|
30
|
-
|
|
31
|
-
### Animation Performance
|
|
32
|
-
- Use `Animated` API for smooth 60fps animations
|
|
33
|
-
- Prefer `transform` and `opacity` animations over layout changes
|
|
34
|
-
- Use `useNativeDriver: true` when possible
|
|
35
|
-
- Avoid animating `width`, `height`, or `top` properties
|
|
36
|
-
- Use `LayoutAnimation` for list item changes
|
|
37
|
-
|
|
38
|
-
### Bundle Size Optimization
|
|
39
|
-
- Use dynamic imports for large components (`React.lazy()`)
|
|
40
|
-
- Implement code splitting for feature modules
|
|
41
|
-
- Remove unused dependencies and imports
|
|
42
|
-
- Use tree shaking compatible libraries
|
|
43
|
-
- Optimize asset sizes and formats
|
|
44
|
-
|
|
45
|
-
### React Native Specific Performance Considerations
|
|
46
|
-
- Test with mobile-typical data sizes (large datasets, complex forms)
|
|
47
|
-
- Optimize for mobile app's specific use cases
|
|
48
|
-
- Ensure smooth performance on older devices
|
|
49
|
-
- Test with base theme and custom styling
|
|
50
|
-
- Monitor performance metrics in mobile environment
|
|
51
|
-
|
|
52
|
-
### Performance Monitoring
|
|
53
|
-
- Use React DevTools Profiler for component analysis
|
|
54
|
-
- Implement performance logging for critical paths
|
|
55
|
-
- Monitor memory usage during development
|
|
56
|
-
- Test performance on various device types
|
|
57
|
-
- Use Flipper for React Native debugging
|
|
58
|
-
|
|
59
|
-
### Anti-Patterns to Avoid
|
|
60
|
-
- Don't use `console.log` in production builds
|
|
61
|
-
- Avoid inline object/function creation in render
|
|
62
|
-
- Don't use `setState` in render methods
|
|
63
|
-
- Avoid unnecessary re-renders with proper dependency arrays
|
|
64
|
-
- Don't ignore performance warnings from React Native
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
pattern: "**/*.{ts,tsx}"
|
|
3
|
-
description: "General development rules for React Native components in rn package"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# RN Package Development Rules
|
|
7
|
-
|
|
8
|
-
## Package Context
|
|
9
|
-
This is the base React Native component library that provides core components, themes, and utilities for React Native applications.
|
|
10
|
-
|
|
11
|
-
## Component Structure Guidelines
|
|
12
|
-
|
|
13
|
-
### File Organization
|
|
14
|
-
- **Component files**: `ComponentName/ComponentName.tsx` (main component)
|
|
15
|
-
- **Styled components**: `ComponentName/StyledComponentName.tsx` (e.g., `StyledButton.tsx`)
|
|
16
|
-
- **Types**: `ComponentName/types.ts` (if complex types are needed)
|
|
17
|
-
- **Tests**: `ComponentName/__tests__/ComponentName.spec.tsx`
|
|
18
|
-
|
|
19
|
-
### Component Structure Example
|
|
20
|
-
```tsx
|
|
21
|
-
// Button/Button.tsx
|
|
22
|
-
import React from 'react';
|
|
23
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
24
|
-
import { useTheme } from '../../theme';
|
|
25
|
-
import { StyledButtonContainer, StyledButtonText } from './StyledButton';
|
|
26
|
-
|
|
27
|
-
export interface ButtonProps {
|
|
28
|
-
/** Button label */
|
|
29
|
-
text?: ReactChild;
|
|
30
|
-
/** Visual intent color */
|
|
31
|
-
intent?: 'primary' | 'secondary' | 'danger';
|
|
32
|
-
/** Button type */
|
|
33
|
-
variant?: 'filled' | 'outlined' | 'text';
|
|
34
|
-
/** Loading state */
|
|
35
|
-
loading?: boolean;
|
|
36
|
-
/** Press handler */
|
|
37
|
-
onPress: () => void;
|
|
38
|
-
/** Additional style */
|
|
39
|
-
style?: StyleProp<ViewStyle>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const Button = ({ text, intent = 'primary', variant = 'filled', loading, onPress, style }: ButtonProps): JSX.Element => {
|
|
43
|
-
const theme = useTheme();
|
|
44
|
-
const themeVariant = getThemeVariant(variant, intent);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<StyledButtonContainer
|
|
48
|
-
disabled={loading}
|
|
49
|
-
onPress={onPress}
|
|
50
|
-
themeButtonVariant={themeVariant}
|
|
51
|
-
style={style}
|
|
52
|
-
>
|
|
53
|
-
{loading ? (
|
|
54
|
-
<LoadingIndicator themeVariant={themeVariant} />
|
|
55
|
-
) : (
|
|
56
|
-
<StyledButtonText themeButtonVariant={themeVariant}>
|
|
57
|
-
{text}
|
|
58
|
-
</StyledButtonText>
|
|
59
|
-
)}
|
|
60
|
-
</StyledButtonContainer>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Styled Component Conventions
|
|
66
|
-
- **Naming**: `const StyledComponentName = styled.View\`\``
|
|
67
|
-
- **Props naming**: Use descriptive names like `themeButtonVariant`, `themeIsPressed`, `themeIsCompact`
|
|
68
|
-
- **Theme access**: Use component-specific theme tokens via `theme.__hd__.componentName.*` instead of global theme tokens
|
|
69
|
-
|
|
70
|
-
```tsx
|
|
71
|
-
// StyledButton.tsx
|
|
72
|
-
import styled from '@emotion/native';
|
|
73
|
-
|
|
74
|
-
interface StyledButtonProps {
|
|
75
|
-
themeButtonVariant: ThemeVariant;
|
|
76
|
-
disabled?: boolean;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const StyledButtonContainer = styled.TouchableHighlight<StyledButtonProps>`
|
|
80
|
-
${({ theme, themeButtonVariant, disabled }) => `
|
|
81
|
-
background-color: ${theme.__hd__.button.colors.background[themeButtonVariant]};
|
|
82
|
-
border-radius: ${theme.__hd__.button.borderRadius};
|
|
83
|
-
padding: ${theme.__hd__.button.spacing.default};
|
|
84
|
-
opacity: ${disabled ? 0.5 : 1};
|
|
85
|
-
`}
|
|
86
|
-
`;
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Theme Token Usage
|
|
90
|
-
|
|
91
|
-
### Adding Theme Tokens
|
|
92
|
-
1. **Define in theme**: Add new tokens to `theme/global` files
|
|
93
|
-
2. **Use consistently**: Apply tokens across components
|
|
94
|
-
3. **Document usage**: Add JSDoc comments for token purposes
|
|
95
|
-
|
|
96
|
-
### Theme Token Examples
|
|
97
|
-
```tsx
|
|
98
|
-
// Using component-specific theme tokens
|
|
99
|
-
background-color: ${theme.__hd__.button.colors.background[themeVariant]};
|
|
100
|
-
color: ${theme.__hd__.button.colors.text[themeVariant]};
|
|
101
|
-
padding: ${theme.__hd__.button.spacing.default};
|
|
102
|
-
border-radius: ${theme.__hd__.button.borderRadius};
|
|
103
|
-
|
|
104
|
-
// Using global theme tokens when needed
|
|
105
|
-
margin: ${theme.spacing.md}; // Global spacing
|
|
106
|
-
font-family: ${theme.typography.fontFamily}; // Global typography
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Modifying Theme Tokens
|
|
110
|
-
- **Global changes**: Update `theme/global` files
|
|
111
|
-
- **Component-specific**: Use component theme overrides
|
|
112
|
-
- **Testing**: Verify changes across all components
|
|
113
|
-
|
|
114
|
-
## Component Development Rules
|
|
115
|
-
|
|
116
|
-
### Basic Rules
|
|
117
|
-
- **Prefer functional components with hooks over class components**
|
|
118
|
-
- Import `styled` from `@emotion/native` for styling consistency
|
|
119
|
-
- Use `useTheme()` hook instead of prop drilling theme
|
|
120
|
-
- Follow React Native design patterns and accessibility requirements
|
|
121
|
-
- Use TypeScript strictly - no `any` types without good reason
|
|
122
|
-
- Fix linting errors immediately
|
|
123
|
-
- Use proper React Native components (`Text`, `View`) instead of HTML elements
|
|
124
|
-
|
|
125
|
-
### Props Interface Guidelines
|
|
126
|
-
```tsx
|
|
127
|
-
// Good example from Button component
|
|
128
|
-
export interface ButtonProps {
|
|
129
|
-
/** Button label */
|
|
130
|
-
text?: ReactChild;
|
|
131
|
-
/** Visual intent color */
|
|
132
|
-
intent?: 'primary' | 'secondary' | 'danger';
|
|
133
|
-
/** Button type */
|
|
134
|
-
variant?: 'filled' | 'outlined' | 'text';
|
|
135
|
-
/** Loading state */
|
|
136
|
-
loading?: boolean;
|
|
137
|
-
/** Press handler */
|
|
138
|
-
onPress: () => void;
|
|
139
|
-
/** Additional style */
|
|
140
|
-
style?: StyleProp<ViewStyle>;
|
|
141
|
-
/** Testing id */
|
|
142
|
-
testID?: string;
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Documentation Rules
|
|
147
|
-
- Document Props interfaces with JSDoc comments directly on each property: `/** Description */`
|
|
148
|
-
- Use simplified @param comments: `@param props - The component props (see [ComponentName]Props interface for details)`
|
|
149
|
-
- Avoid mentioning implementation details like "memoized component" in JSDoc comments
|
|
150
|
-
- Focus JSDoc comments on what the component does, not how it's implemented
|
|
151
|
-
- Keep type information in the Props interface, not duplicated in @param comments
|
|
152
|
-
|
|
153
|
-
## React Native Specific Patterns
|
|
154
|
-
- Components should work with base theme system
|
|
155
|
-
- Test with standard React Native color palettes and spacing
|
|
156
|
-
- Ensure compatibility with React Native requirements
|
|
157
|
-
- Follow React Native accessibility guidelines
|
|
158
|
-
- Test performance with typical mobile data sizes
|
|
159
|
-
|
|
160
|
-
## Quality Gates
|
|
161
|
-
- All tests must pass with 100% coverage on main components
|
|
162
|
-
- No linting errors
|
|
163
|
-
- No TypeScript errors
|
|
164
|
-
- Components must work with base theme system
|
|
165
|
-
- Accessibility compliance for mobile environment
|