@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.
Files changed (135) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +12 -0
  3. package/es/index.js +1764 -1372
  4. package/jest.config.js +1 -1
  5. package/lib/index.js +1764 -1372
  6. package/package.json +2 -2
  7. package/src/components/Accordion/AccordionItem.tsx +1 -1
  8. package/src/components/AnimatedScroller/AnimatedScrollable.tsx +1 -1
  9. package/src/components/AnimatedScroller/SectionListWithFAB.tsx +1 -1
  10. package/src/components/Box/StyledBox.tsx +1 -1
  11. package/src/components/Button/UtilityButton/index.tsx +1 -1
  12. package/src/components/Calendar/CalendarRange.tsx +1 -1
  13. package/src/components/Calendar/CalendarRowItem.tsx +2 -2
  14. package/src/components/Calendar/index.tsx +1 -1
  15. package/src/components/Carousel/index.tsx +1 -1
  16. package/src/components/Chart/Line/Line.tsx +3 -4
  17. package/src/components/Chart/index.tsx +0 -2
  18. package/src/components/Chart/shared/ChartHeader.tsx +1 -1
  19. package/src/components/Chart/shared/hooks/useColorScale.ts +2 -2
  20. package/src/components/Chart/shared/hooks/useGenerateTicks.ts +2 -2
  21. package/src/components/Chart/shared/hooks/useScaleBandX.ts +3 -3
  22. package/src/components/Chart/shared/hooks/useScaleLinearY.ts +3 -4
  23. package/src/components/Chart/types.ts +0 -8
  24. package/src/components/Checkbox/utils.ts +1 -1
  25. package/src/components/Chip/index.tsx +1 -1
  26. package/src/components/DatePicker/hooks/__tests__/useFormatDate.spec.ts +7 -5
  27. package/src/components/DatePicker/hooks/useFormatDate.ts +1 -1
  28. package/src/components/DatePicker/types.ts +1 -1
  29. package/src/components/FloatingIsland/index.tsx +1 -1
  30. package/src/components/Illustration/index.tsx +1 -1
  31. package/src/components/List/BasicListItem.tsx +1 -1
  32. package/src/components/List/StyledListItem.tsx +2 -2
  33. package/src/components/LocaleProvider/__tests__/utils.specs.ts +1 -2
  34. package/src/components/LocaleProvider/index.tsx +1 -1
  35. package/src/components/LocaleProvider/utils.ts +2 -3
  36. package/src/components/Portal/index.tsx +1 -1
  37. package/src/components/Portal/types.tsx +2 -2
  38. package/src/components/Radio/Radio.tsx +1 -1
  39. package/src/components/Rate/index.tsx +2 -2
  40. package/src/components/RefreshControl/index.tsx +1 -1
  41. package/src/components/RichTextEditor/RichTextEditor.tsx +6 -6
  42. package/src/components/RichTextEditor/{BaseRichTextEditor.tsx → RichTextEditorInput.tsx} +4 -4
  43. package/src/components/RichTextEditor/StyledRichTextEditor.ts +0 -5
  44. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +19 -4
  45. package/src/components/RichTextEditor/index.tsx +3 -3
  46. package/src/components/RichTextEditor/utils/events.ts +1 -13
  47. package/src/components/Search/SearchOneLine.tsx +1 -1
  48. package/src/components/Search/StyledSearch.tsx +1 -1
  49. package/src/components/SectionHeading/index.tsx +1 -1
  50. package/src/components/Select/helpers.tsx +1 -18
  51. package/src/components/Skeleton/index.tsx +1 -1
  52. package/src/components/Slider/RangeSlider.tsx +1 -1
  53. package/src/components/StatusScreens/Success/index.tsx +1 -1
  54. package/src/components/Tabs/ScrollableTabsHeader/ScrollableTabsHeader.tsx +1 -1
  55. package/src/components/Tabs/StyledTabs.tsx +0 -5
  56. package/src/components/Tabs/TabWithBadge.tsx +2 -2
  57. package/src/components/TextInput/index.tsx +3 -3
  58. package/src/components/TimePicker/TimePickerAndroid.tsx +1 -1
  59. package/src/components/TimePicker/TimePickerIOS.tsx +1 -1
  60. package/src/components/TimePicker/types.ts +1 -1
  61. package/src/components/Toast/ToastContext.ts +1 -1
  62. package/src/components/Toolbar/index.tsx +1 -1
  63. package/src/components/Typography/Label/index.tsx +1 -1
  64. package/src/theme/global/colors/swagSystemPalette.ts +1 -1
  65. package/src/theme/global/colors/types.ts +1 -1
  66. package/src/theme/global/shadows/index.ts +0 -3
  67. package/src/theme/global/shadows/types.ts +1 -1
  68. package/src/theme/global/sizes.ts +1 -0
  69. package/src/theme/global/typography.ts +2 -1
  70. package/src/utils/scale.ts +2 -2
  71. package/types/components/Accordion/AccordionItem.d.ts +1 -1
  72. package/types/components/AnimatedScroller/AnimatedScrollable.d.ts +1 -1
  73. package/types/components/AnimatedScroller/SectionListWithFAB.d.ts +1 -1
  74. package/types/components/Box/StyledBox.d.ts +0 -5
  75. package/types/components/Button/UtilityButton/index.d.ts +1 -1
  76. package/types/components/Calendar/CalendarRowItem.d.ts +1 -2
  77. package/types/components/Carousel/index.d.ts +0 -1
  78. package/types/components/Chart/index.d.ts +0 -3
  79. package/types/components/Chart/shared/ChartHeader.d.ts +1 -1
  80. package/types/components/Chart/shared/hooks/useScaleBandX.d.ts +2 -3
  81. package/types/components/Chart/shared/hooks/useScaleLinearY.d.ts +2 -3
  82. package/types/components/Chart/types.d.ts +1 -7
  83. package/types/components/Checkbox/utils.d.ts +2 -1
  84. package/types/components/Chip/index.d.ts +1 -1
  85. package/types/components/DatePicker/types.d.ts +1 -1
  86. package/types/components/FloatingIsland/index.d.ts +1 -1
  87. package/types/components/Illustration/index.d.ts +1 -1
  88. package/types/components/List/BasicListItem.d.ts +1 -1
  89. package/types/components/List/StyledListItem.d.ts +2 -2
  90. package/types/components/LocaleProvider/utils.d.ts +1 -1
  91. package/types/components/Portal/index.d.ts +1 -1
  92. package/types/components/Portal/types.d.ts +3 -2
  93. package/types/components/Radio/Radio.d.ts +1 -1
  94. package/types/components/Rate/index.d.ts +2 -2
  95. package/types/components/RefreshControl/index.d.ts +1 -1
  96. package/types/components/RichTextEditor/RichTextEditor.d.ts +2 -6
  97. package/types/components/RichTextEditor/{BaseRichTextEditor.d.ts → RichTextEditorInput.d.ts} +3 -3
  98. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -7
  99. package/types/components/RichTextEditor/index.d.ts +2 -2
  100. package/types/components/RichTextEditor/utils/events.d.ts +2 -3
  101. package/types/components/Search/SearchOneLine.d.ts +1 -1
  102. package/types/components/Search/StyledSearch.d.ts +2 -1
  103. package/types/components/SectionHeading/index.d.ts +1 -1
  104. package/types/components/Select/helpers.d.ts +2 -2
  105. package/types/components/Skeleton/index.d.ts +1 -1
  106. package/types/components/Slider/RangeSlider.d.ts +1 -1
  107. package/types/components/StatusScreens/Success/index.d.ts +1 -1
  108. package/types/components/Tabs/ScrollableTabsHeader/ScrollableTabsHeader.d.ts +1 -1
  109. package/types/components/Tabs/StyledTabs.d.ts +1 -7
  110. package/types/components/Tabs/TabWithBadge.d.ts +2 -2
  111. package/types/components/TextInput/index.d.ts +2 -3
  112. package/types/components/TimePicker/types.d.ts +1 -1
  113. package/types/components/Toast/ToastContext.d.ts +2 -1
  114. package/types/components/Toolbar/index.d.ts +1 -1
  115. package/types/components/Typography/Label/index.d.ts +1 -1
  116. package/types/theme/components/alert.d.ts +10 -1
  117. package/types/theme/components/bottomNavigation.d.ts +10 -1
  118. package/types/theme/components/chip.d.ts +10 -1
  119. package/types/theme/components/fab.d.ts +10 -1
  120. package/types/theme/components/floatingIsland.d.ts +10 -1
  121. package/types/theme/components/list.d.ts +10 -1
  122. package/types/theme/components/search.d.ts +10 -1
  123. package/types/theme/components/segmentedControl.d.ts +10 -1
  124. package/types/theme/components/slider.d.ts +10 -1
  125. package/types/theme/components/toast.d.ts +10 -1
  126. package/types/theme/global/colors/swagSystemPalette.d.ts +1 -1
  127. package/types/theme/global/colors/types.d.ts +2 -1
  128. package/types/theme/global/index.d.ts +1 -1
  129. package/types/theme/global/shadows/index.d.ts +0 -2
  130. package/types/theme/global/shadows/types.d.ts +2 -1
  131. package/types/theme/global/typography.d.ts +1 -1
  132. package/types/utils/scale.d.ts +0 -2
  133. package/.cursor/rules/performance-optimization.mdc +0 -64
  134. package/.cursor/rules/rn-rules.mdc +0 -165
  135. 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
- export interface SectionHeadingProps extends ViewProps {
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
- export type ScrollParams = {
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 {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { ViewProps } from 'react-native';
3
- export interface SkeletonProps extends ViewProps {
3
+ interface SkeletonProps extends ViewProps {
4
4
  /**
5
5
  * Intent of the component.
6
6
  */
@@ -4,7 +4,7 @@ export type SliderRangeValue = {
4
4
  start: number;
5
5
  end: number;
6
6
  };
7
- export interface RangeSliderProps {
7
+ interface RangeSliderProps {
8
8
  /**
9
9
  * Minimum value of the slider.
10
10
  */
@@ -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
- export interface SuccessProps extends ViewProps {
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
- export interface ScrollableTabHeaderProps extends ViewProps {
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, TabScreen, StyledIndicator, StyledBadgeWrapper, };
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
- export type StatusBadgeType = {
3
+ type StatusBadgeType = {
4
4
  type: 'status';
5
5
  };
6
- export type CounterBadgeType = {
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
- export type TextInputVariant = 'text' | 'textarea';
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
- export interface TextInputRef {
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/v2.16.1/docs/format).
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
- export type ToastConfigContextType = Pick<ToastContainerProps, 'position' | 'displayType'>;
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
- export interface ToolbarProps extends Omit<ViewProps, 'style'> {
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
- export interface LabelProps extends NativeTextProps {
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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: import("../global/shadows/types").ShadowStyles;
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;
@@ -1,3 +1,3 @@
1
1
  import type { SystemPalette } from './types';
2
- export declare const swagSystemPalette: SystemPalette;
2
+ declare const swagSystemPalette: SystemPalette;
3
3
  export default swagSystemPalette;
@@ -50,8 +50,9 @@ export type BrandSystemPalette = {
50
50
  decorativeSecondarySurface?: string;
51
51
  };
52
52
  export type ThemeMode = 'light' | 'dark';
53
- export type ThemeName = 'swagLight' | 'swagLightJobs' | 'ehWorkDark' | 'ehWork' | 'ehJobs';
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?: import("./colors/types").ThemeName;
65
+ name?: "swagLight" | "swagLightJobs" | "ehWorkDark" | "ehWork" | "ehJobs";
66
66
  };
67
67
  fonts: import("./typography").Fonts;
68
68
  fontSizes: import("./typography").FontSizes;
@@ -1,5 +1,3 @@
1
1
  import type { SystemPalette } from '../colors/types';
2
2
  declare const getShadows: (palette: SystemPalette) => import("./types").ShadowPalette;
3
- type Shadows = ReturnType<typeof getShadows>;
4
3
  export { getShadows };
5
- export type { Shadows };
@@ -1,4 +1,4 @@
1
- export type ShadowStyles = {
1
+ type ShadowStyles = {
2
2
  shadowOffset: {
3
3
  width: number;
4
4
  height: number;
@@ -13,3 +13,4 @@ export type ShadowPalette = {
13
13
  medium: ShadowStyles;
14
14
  deep: ShadowStyles;
15
15
  };
16
+ export {};
@@ -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, LineHeights };
34
+ export type { Fonts, FontSizes };
@@ -1,3 +1 @@
1
- export declare const BASE_WIDTH = 390;
2
- export declare const horizontalScale: (size: number) => number;
3
1
  export declare const scale: (size: number, factor?: number) => number;
@@ -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