@hero-design/rn 8.105.4 → 8.106.0

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 (54) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +18 -0
  3. package/es/index.js +2797 -2453
  4. package/lib/index.js +2800 -2456
  5. package/package.json +2 -2
  6. package/src/components/Button/Button.tsx +70 -44
  7. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +12 -33
  8. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +4 -4
  9. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
  10. package/src/components/Button/LoadingIndicator/index.tsx +4 -1
  11. package/src/components/Button/StyledButton.tsx +461 -313
  12. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +102 -86
  13. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +19 -18
  14. package/src/components/Chart/Line/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  15. package/src/components/Checkbox/{index.tsx → DefaultCheckBox.tsx} +6 -31
  16. package/src/components/Checkbox/InlineCheckBox.tsx +97 -0
  17. package/src/components/Checkbox/{StyledCheckbox.tsx → StyledDefaultCheckBox.tsx} +1 -0
  18. package/src/components/Checkbox/StyledInlineCheckBox.tsx +49 -0
  19. package/src/components/Checkbox/__tests__/{index.spec.tsx → DefaultCheckBox.spec.tsx} +21 -20
  20. package/src/components/Checkbox/__tests__/InlineCheckBox.spec.tsx +93 -0
  21. package/src/components/Checkbox/__tests__/{StyledCheckbox.spec.tsx → StyledDefaultCheckbox.spec.tsx} +2 -2
  22. package/src/components/Checkbox/__tests__/__snapshots__/{index.spec.tsx.snap → DefaultCheckBox.spec.tsx.snap} +6 -0
  23. package/src/components/Checkbox/__tests__/__snapshots__/InlineCheckBox.spec.tsx.snap +988 -0
  24. package/src/components/Checkbox/__tests__/__snapshots__/{StyledCheckbox.spec.tsx.snap → StyledDefaultCheckbox.spec.tsx.snap} +4 -0
  25. package/src/components/Checkbox/__tests__/utils.spec.ts +20 -0
  26. package/src/components/Checkbox/index.ts +9 -0
  27. package/src/components/Checkbox/utils.ts +25 -0
  28. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +2 -2
  29. package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +11 -8
  30. package/src/components/Drawer/__tests__/index.spec.tsx +15 -1
  31. package/src/components/Drawer/index.tsx +5 -2
  32. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +5 -5
  33. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -1
  34. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +59 -19
  35. package/src/theme/components/button.ts +52 -19
  36. package/src/theme/components/checkbox.ts +7 -0
  37. package/src/theme/components/drawer.ts +1 -1
  38. package/src/utils/__tests__/helpers.spec.ts +37 -1
  39. package/src/utils/helpers.ts +14 -0
  40. package/stats/8.106.0/rn-stats.html +4844 -0
  41. package/types/components/Button/Button.d.ts +5 -4
  42. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +3 -4
  43. package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
  44. package/types/components/Button/StyledButton.d.ts +8 -4
  45. package/types/components/Checkbox/DefaultCheckBox.d.ts +40 -0
  46. package/types/components/Checkbox/InlineCheckBox.d.ts +38 -0
  47. package/types/components/Checkbox/StyledInlineCheckBox.d.ts +45 -0
  48. package/types/components/Checkbox/index.d.ts +5 -45
  49. package/types/components/Checkbox/utils.d.ts +6 -0
  50. package/types/theme/components/button.d.ts +49 -15
  51. package/types/theme/components/checkbox.d.ts +6 -0
  52. package/types/theme/components/drawer.d.ts +1 -1
  53. package/types/utils/helpers.d.ts +2 -0
  54. /package/types/components/Checkbox/{StyledCheckbox.d.ts → StyledDefaultCheckBox.d.ts} +0 -0
@@ -21,8 +21,9 @@ export interface ButtonProps {
21
21
  icon?: IconName | ReactNode;
22
22
  /**
23
23
  * Visual intent color to apply to button. It is required for `filled`, `outlined` and `text` variants.
24
+ * intent['white'] - @deprecated
24
25
  */
25
- intent?: 'primary' | 'secondary' | 'danger' | 'white';
26
+ intent?: 'primary' | 'secondary' | 'danger' | 'white' | 'inverted';
26
27
  /**
27
28
  * Loading state of button.
28
29
  */
@@ -46,14 +47,14 @@ export interface ButtonProps {
46
47
  /**
47
48
  * Button label.
48
49
  */
49
- text: ReactChild;
50
+ text?: ReactChild;
50
51
  /**
51
52
  * Button type.
52
53
  *
53
54
  * variant['filled-secondary' | 'filled-danger' | 'outlined-secondary' | 'outlined-danger'] - @deprecated
54
55
  */
55
- variant?: 'filled' | 'outlined' | 'text' | 'inline-text' | 'filled-compact' | 'outlined-compact' | 'text-compact' | 'inline-text-compact';
56
+ variant?: 'filled' | 'outlined' | 'text' | 'inline-text' | 'filled-medium' | 'outlined-medium' | 'text-medium' | 'filled-compact' | 'outlined-compact' | 'text-compact' | 'inline-text-compact';
56
57
  }
57
- export declare const getThemeVariant: (variant: "filled" | "outlined" | "text" | "filled-compact" | "outlined-compact" | "text-compact", intent: Intent) => ThemeVariant;
58
+ export declare const getThemeVariant: (variant: "filled" | "outlined" | "text" | "filled-medium" | "outlined-medium" | "text-medium" | "filled-compact" | "outlined-compact" | "text-compact", intent: Intent) => ThemeVariant;
58
59
  declare const Button: ({ accessibilityHint, accessibilityLabel, disabled, icon, intent, loading, onPress, rightIcon, style, testID, text, variant, }: ButtonProps) => JSX.Element;
59
60
  export default Button;
@@ -1,15 +1,14 @@
1
- import type { Theme } from '@emotion/react';
2
1
  import type { ViewProps } from 'react-native';
3
2
  import { View } from 'react-native';
4
- type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'filled-white' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'outlined-white' | 'text-primary' | 'text-secondary' | 'text-danger' | 'text-white';
3
+ type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'filled-white' | 'filled-inverted' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'outlined-white' | 'outlined-inverted' | 'text-primary' | 'text-secondary' | 'text-danger' | 'text-white' | 'text-inverted';
5
4
  declare const StyledLoadingIndicatorWrapper: import("@emotion/native").StyledComponent<ViewProps & {
6
- theme?: Theme;
5
+ theme?: import("@emotion/react").Theme;
7
6
  as?: React.ElementType;
8
7
  }, {}, {
9
8
  ref?: import("react").Ref<View> | undefined;
10
9
  }>;
11
10
  declare const StyledLoadingDot: import("@emotion/native").StyledComponent<ViewProps & {
12
- theme?: Theme;
11
+ theme?: import("@emotion/react").Theme;
13
12
  as?: React.ElementType;
14
13
  } & {
15
14
  size?: number;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
3
- type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'filled-white' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'outlined-white' | 'text-primary' | 'text-secondary' | 'text-danger' | 'text-white';
3
+ type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'filled-white' | 'filled-inverted' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'outlined-white' | 'outlined-inverted' | 'text-primary' | 'text-secondary' | 'text-danger' | 'text-white' | 'text-inverted';
4
4
  interface LoadingIndicatorProps extends ViewProps {
5
5
  /**
6
6
  * Size of the loading dot.
@@ -1,7 +1,8 @@
1
1
  import type { Theme } from '@emotion/react';
2
2
  import { View } from 'react-native';
3
- type Intent = 'primary' | 'secondary' | 'danger' | 'white';
4
- type ThemeVariant = 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'filled-white' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'outlined-white' | 'text-primary' | 'text-secondary' | 'text-danger' | 'text-white';
3
+ import { type CamelCase } from '../../utils/helpers';
4
+ type Intent = 'primary' | 'secondary' | 'danger' | 'white' | 'inverted';
5
+ type ThemeVariant = 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'filled-white' | 'filled-inverted' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'outlined-white' | 'outlined-inverted' | 'text-primary' | 'text-secondary' | 'text-danger' | 'text-white' | 'text-inverted';
5
6
  declare const StyledButtonContainer: import("@emotion/native").StyledComponent<import("react-native").TouchableHighlightProps & import("react").RefAttributes<View> & {
6
7
  theme?: Theme;
7
8
  as?: React.ElementType;
@@ -11,6 +12,8 @@ declare const StyledButtonContainer: import("@emotion/native").StyledComponent<i
11
12
  loading?: boolean;
12
13
  themeInlineText?: boolean;
13
14
  themeIsCompact?: boolean;
15
+ themeIsMedium?: boolean;
16
+ themeIsIconOnly?: boolean;
14
17
  }, {}, {}>;
15
18
  declare const StyledButtonText: import("@emotion/native").StyledComponent<import("../..").TitleProps & {
16
19
  theme?: Theme;
@@ -31,7 +34,7 @@ declare const StyledButtonTitleOfVariantText: import("@emotion/native").StyledCo
31
34
  as?: React.ElementType;
32
35
  } & {
33
36
  disabled?: boolean;
34
- themeButtonVariant: "text-primary" | "text-secondary" | "text-danger" | "text-white";
37
+ themeButtonVariant: "text-primary" | "text-secondary" | "text-danger" | "text-white" | "text-inverted";
35
38
  themeIsPressed?: boolean;
36
39
  themeIsCompact: boolean;
37
40
  }, {}, {}>;
@@ -41,6 +44,7 @@ declare const StyledButtonIconWrapper: import("@emotion/native").StyledComponent
41
44
  } & {
42
45
  themePosition: "left" | "right";
43
46
  themeIsCompact?: boolean;
47
+ themeIsIconOnly?: boolean;
44
48
  }, {}, {
45
49
  ref?: import("react").Ref<View> | undefined;
46
50
  }>;
@@ -54,4 +58,4 @@ declare const StyledButtonIcon: import("@emotion/native").StyledComponent<import
54
58
  themeIsCompact?: boolean;
55
59
  }, {}, {}>;
56
60
  export { StyledButtonContainer, StyledButtonIcon, StyledButtonIconWrapper, StyledButtonText, StyledButtonTitleOfVariantText, StyledSmallButtonText, };
57
- export type { Intent, ThemeVariant };
61
+ export type { Intent, ThemeVariant, CamelCase };
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+ export interface DefaultCheckboxProps {
4
+ /**
5
+ * Control whether the switch is checked
6
+ */
7
+ checked?: boolean;
8
+ /**
9
+ * Checkbox's description.
10
+ */
11
+ description?: string;
12
+ /**
13
+ * @deprecated `withBorder` prop will be removed in the next major release, all checkboxes will have border by default. Please remove it.
14
+ *
15
+ * Whether the border is shown.
16
+ */
17
+ withBorder?: boolean;
18
+ /**
19
+ * Whether the switch is disabled
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * Event handler.
24
+ */
25
+ onPress?: () => void;
26
+ /**
27
+ * Additional style.
28
+ */
29
+ style?: StyleProp<ViewStyle>;
30
+ /**
31
+ * Testing id of the component.
32
+ */
33
+ testID?: string;
34
+ /**
35
+ * Readonly of the checkbox.
36
+ */
37
+ readonly?: boolean;
38
+ }
39
+ declare const DefaultCheckbox: ({ checked, description, withBorder, disabled, onPress, style, testID, readonly, }: DefaultCheckboxProps) => React.JSX.Element;
40
+ export default DefaultCheckbox;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
+ export interface InlineCheckboxProps {
4
+ /**
5
+ * Control whether the checkbox is checked
6
+ */
7
+ checked?: boolean;
8
+ /**
9
+ * Checkbox's description.
10
+ */
11
+ description?: string;
12
+ /**
13
+ * Whether the checkbox is disabled
14
+ */
15
+ disabled?: boolean;
16
+ /**
17
+ * Event handler.
18
+ */
19
+ onPress?: () => void;
20
+ /**
21
+ * Additional style.
22
+ */
23
+ style?: StyleProp<ViewStyle>;
24
+ /**
25
+ * Testing id of the component.
26
+ */
27
+ testID?: string;
28
+ /**
29
+ * Readonly of the checkbox.
30
+ */
31
+ readonly?: boolean;
32
+ /**
33
+ * Size of the checkbox. Can be 'medium' or 'large'.
34
+ */
35
+ size?: 'medium' | 'large';
36
+ }
37
+ declare const InlineCheckbox: ({ checked, description, disabled, onPress, style, testID, readonly, size, }: InlineCheckboxProps) => React.JSX.Element;
38
+ export default InlineCheckbox;
@@ -0,0 +1,45 @@
1
+ import { View } from 'react-native';
2
+ type CheckboxThemeState = 'default' | 'checked' | 'disabled' | 'readonly';
3
+ export declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").TouchableOpacityProps & import("react").RefAttributes<View> & {
4
+ theme?: import("@emotion/react").Theme;
5
+ as?: React.ElementType;
6
+ } & {
7
+ themeState: CheckboxThemeState;
8
+ }, {}, {}>;
9
+ export declare const StyledDescription: import("@emotion/native").StyledComponent<import("../..").BodyProps & {
10
+ theme?: import("@emotion/react").Theme;
11
+ as?: React.ElementType;
12
+ }, {}, {}>;
13
+ export declare const StyledCheckboxContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
14
+ theme?: import("@emotion/react").Theme;
15
+ as?: React.ElementType;
16
+ } & {
17
+ themeSize?: "medium" | "large";
18
+ }, {}, {
19
+ ref?: import("react").Ref<View> | undefined;
20
+ }>;
21
+ export declare const StyledCheckbox: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
22
+ theme?: import("@emotion/react").Theme;
23
+ as?: React.ElementType;
24
+ } & {
25
+ themeState: CheckboxThemeState;
26
+ themeSize?: "medium" | "large";
27
+ }, {}, {
28
+ ref?: import("react").Ref<View> | undefined;
29
+ }>;
30
+ export declare const StyledCheckMark: import("@emotion/native").StyledComponent<import("react-native-vector-icons/Icon").IconProps & {
31
+ theme?: import("@emotion/react").Theme;
32
+ as?: React.ElementType;
33
+ } & {
34
+ themeSize: "small" | "xsmall" | "medium" | "large" | "xlarge" | "xxxsmall";
35
+ themeIntent: "secondary" | "primary" | "text" | "warning" | "info" | "danger" | "success" | "disabled-text" | "text-inverted" | "muted" | "inactive";
36
+ } & {
37
+ ref?: import("react").Ref<import("react-native-vector-icons/Icon").Icon> | undefined;
38
+ } & {
39
+ theme?: import("@emotion/react").Theme;
40
+ as?: React.ElementType;
41
+ } & {
42
+ themeState: CheckboxThemeState;
43
+ themeSize?: "medium" | "large";
44
+ }, {}, {}>;
45
+ export {};
@@ -1,46 +1,6 @@
1
- import React from 'react';
2
- import type { StyleProp, ViewStyle } from 'react-native';
3
- export interface CheckboxProps {
4
- /**
5
- * Control whether the switch is checked
6
- */
7
- checked?: boolean;
8
- /**
9
- * Checkbox's description.
10
- */
11
- description?: string;
12
- /**
13
- * @deprecated `withBorder` prop will be removed in the next major release, all checkboxes will have border by default. Please remove it.
14
- *
15
- * Whether the border is shown.
16
- */
17
- withBorder?: boolean;
18
- /**
19
- * Whether the switch is disabled
20
- */
21
- disabled?: boolean;
22
- /**
23
- * Event handler.
24
- */
25
- onPress?: () => void;
26
- /**
27
- * Additional style.
28
- */
29
- style?: StyleProp<ViewStyle>;
30
- /**
31
- * Testing id of the component.
32
- */
33
- testID?: string;
34
- /**
35
- * Readonly of the checkbox.
36
- */
37
- readonly?: boolean;
38
- }
39
- type getStateType = {
40
- disabled: boolean;
41
- readonly: boolean;
42
- checked?: boolean;
1
+ import type { DefaultCheckboxProps } from './DefaultCheckBox';
2
+ export type { DefaultCheckboxProps as CheckboxProps };
3
+ declare const _default: (({ checked, description, withBorder, disabled, onPress, style, testID, readonly, }: DefaultCheckboxProps) => import("react").JSX.Element) & {
4
+ Inline: ({ checked, description, disabled, onPress, style, testID, readonly, size, }: import("./InlineCheckBox").InlineCheckboxProps) => import("react").JSX.Element;
43
5
  };
44
- export declare const getThemeState: ({ disabled, readonly, checked, }: getStateType) => "disabled" | "default" | "readonly" | "checked";
45
- declare const Checkbox: ({ checked, description, withBorder, disabled, onPress, style, testID, readonly, }: CheckboxProps) => React.JSX.Element;
46
- export default Checkbox;
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ export type getStateType = {
2
+ disabled: boolean;
3
+ readonly: boolean;
4
+ checked?: boolean;
5
+ };
6
+ export declare const getThemeState: ({ disabled, readonly, checked, }: getStateType) => "disabled" | "default" | "readonly" | "checked";
@@ -29,40 +29,67 @@ declare const getButtonTheme: (theme: GlobalTheme) => {
29
29
  };
30
30
  radii: {
31
31
  default: number;
32
+ rounded: number;
32
33
  utilityRadii: number;
33
34
  text: number;
34
35
  };
35
36
  colors: {
36
- primary: string;
37
- secondary: string;
38
- danger: string;
39
- white: string;
40
- defaultText: string;
41
- disabledText: string;
42
- disabledBorder: string;
43
- disabledBackground: string;
44
37
  invertedText: string;
45
38
  utilityBackground: string;
46
- textLoadingBackground: string;
39
+ background: {
40
+ filledPrimary: string;
41
+ filledSecondary: string;
42
+ filledDanger: string;
43
+ filledWhite: string;
44
+ filledInverted: string;
45
+ };
46
+ text: {
47
+ filledPrimary: string;
48
+ filledSecondary: string;
49
+ filledDanger: string | undefined;
50
+ filledWhite: string;
51
+ filledInverted: string;
52
+ outlinedPrimary: string;
53
+ outlinedSecondary: string;
54
+ outlinedDanger: string;
55
+ outlinedWhite: string;
56
+ outlinedInverted: string;
57
+ textPrimary: string;
58
+ textSecondary: string;
59
+ textDanger: string;
60
+ textWhite: string;
61
+ textInverted: string;
62
+ };
63
+ border: {
64
+ outlinedPrimary: string;
65
+ outlinedSecondary: string;
66
+ outlinedDanger: string;
67
+ outlinedWhite: string;
68
+ outlinedInverted: string;
69
+ };
47
70
  pressedBackground: {
48
71
  filledPrimary: string;
49
72
  filledSecondary: string;
50
73
  filledDanger: string;
51
74
  filledWhite: string;
75
+ filledInverted: string;
52
76
  outlinedPrimary: string;
53
77
  outlinedSecondary: string;
54
- outlineDanger: string;
55
- outlineWhite: string;
78
+ outlinedDanger: string;
79
+ outlinedWhite: string;
80
+ outlinedInverted: string;
56
81
  textPrimary: string;
57
82
  textSecondary: string;
58
83
  textDanger: string;
59
84
  textWhite: string;
85
+ textInverted: string;
60
86
  };
61
87
  pressedText: {
62
- primary: string;
63
- secondary: string;
64
- danger: string;
65
- white: string;
88
+ inlineTextPrimary: string;
89
+ inlineTextSecondary: string;
90
+ inlineTextDanger: string;
91
+ inlineTextWhite: string;
92
+ inlineTextInverted: string;
66
93
  };
67
94
  };
68
95
  space: {
@@ -76,6 +103,13 @@ declare const getButtonTheme: (theme: GlobalTheme) => {
76
103
  buttonPaddingHorizontal: number;
77
104
  iconPadding: number;
78
105
  };
106
+ medium: {
107
+ buttonPaddingVertical: number;
108
+ buttonPaddingHorizontal: number;
109
+ iconPadding: number;
110
+ buttonPadding: number;
111
+ textButtonPadding: number;
112
+ };
79
113
  utilityPadding: number;
80
114
  };
81
115
  };
@@ -18,9 +18,15 @@ declare const getCheckboxTheme: (theme: GlobalTheme) => {
18
18
  iconTop: number;
19
19
  wrapperPadding: number;
20
20
  iconDescriptionPadding: number;
21
+ inlineCheckboxGap: number;
22
+ inlineCheckboxMargin: number;
21
23
  };
22
24
  sizes: {
23
25
  icon: number;
26
+ inlineCheckbox: {
27
+ medium: number;
28
+ large: number;
29
+ };
24
30
  };
25
31
  radii: {
26
32
  wrapper: number;
@@ -3,7 +3,7 @@ declare const getDrawerTheme: (theme: GlobalTheme) => {
3
3
  colors: {
4
4
  shadow: string;
5
5
  background: string;
6
- backdrop: string;
6
+ backdrop: string | undefined;
7
7
  handler: string;
8
8
  };
9
9
  radii: {
@@ -8,3 +8,5 @@ export declare const useKeyboard: () => {
8
8
  isKeyboardVisible: boolean;
9
9
  keyboardHeight: number;
10
10
  };
11
+ export type CamelCase<S extends string> = S extends `${infer F}-${infer R}` ? R extends `${string}-${string}` ? `${F}${Capitalize<CamelCase<R>>}` : `${F}${Capitalize<R>}` : never;
12
+ export declare const transformKebabCaseToCamelCase: <T extends string>(string: T) => CamelCase<T>;