@hero-design/rn 7.26.0 → 7.27.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 (34) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +77 -30
  3. package/lib/index.js +77 -30
  4. package/package.json +4 -4
  5. package/src/components/Accordion/index.tsx +1 -1
  6. package/src/components/Card/index.tsx +18 -7
  7. package/src/components/Select/MultiSelect/index.tsx +5 -2
  8. package/src/components/Select/SingleSelect/index.tsx +5 -2
  9. package/src/components/Select/types.ts +15 -6
  10. package/src/components/Tabs/ScrollableTabs.tsx +2 -0
  11. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
  12. package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
  13. package/src/components/Tabs/index.tsx +7 -0
  14. package/src/components/Tag/StyledTag.tsx +42 -11
  15. package/src/components/Tag/__tests__/Tag.spec.tsx +28 -0
  16. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +135 -0
  17. package/src/components/Tag/index.tsx +15 -3
  18. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -1
  19. package/src/theme/components/tag.ts +1 -0
  20. package/src/theme/components/toolbar.ts +1 -1
  21. package/src/utils/hooks.ts +18 -1
  22. package/types/components/Card/index.d.ts +1 -1
  23. package/types/components/Select/MultiSelect/index.d.ts +1 -1
  24. package/types/components/Select/SingleSelect/index.d.ts +1 -1
  25. package/types/components/Select/index.d.ts +1 -1
  26. package/types/components/Select/types.d.ts +15 -3
  27. package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
  28. package/types/components/Tabs/index.d.ts +7 -2
  29. package/types/components/Tag/StyledTag.d.ts +3 -0
  30. package/types/components/Tag/index.d.ts +7 -2
  31. package/types/theme/components/tag.d.ts +1 -0
  32. package/types/utils/hooks.d.ts +2 -0
  33. package/src/components/Accordion/utils.tsx +0 -11
  34. package/types/components/Accordion/utils.d.ts +0 -1
@@ -2,7 +2,7 @@ import MultiSelect from './MultiSelect';
2
2
  import type { MultiSelectProps } from './MultiSelect';
3
3
  import type { SingleSelectProps } from './SingleSelect';
4
4
  export type { MultiSelectProps, SingleSelectProps };
5
- declare const _default: (<V, T extends import("./types").OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
5
+ declare const _default: (<V, T extends import("./types").OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
6
6
  Multi: typeof MultiSelect;
7
7
  };
8
8
  export default _default;
@@ -20,7 +20,7 @@ export declare type SectionListRenderOptionInfo<V, T extends OptionType<V>> = Se
20
20
  selected: boolean;
21
21
  onPress: () => void;
22
22
  };
23
- export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputProps, 'editable' | 'disabled' | 'numberOfLines' | 'error'> {
23
+ export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputProps, 'editable' | 'disabled' | 'error' | 'required'> {
24
24
  /**
25
25
  * An array of options to be selected.
26
26
  */
@@ -43,9 +43,14 @@ export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputP
43
43
  */
44
44
  onQueryChange?: (value: string) => void;
45
45
  /**
46
- * Event handler when selection dismiss
46
+ * @deprecated due to typo.
47
+ * Please use onDismiss instead.
47
48
  */
48
49
  onDimiss?: () => void;
50
+ /**
51
+ * Event handler when selection dismiss
52
+ */
53
+ onDismiss?: () => void;
49
54
  /**
50
55
  * Event handler when end of the list reached
51
56
  */
@@ -56,8 +61,10 @@ export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputP
56
61
  loading?: boolean;
57
62
  /**
58
63
  * Props that are passed to TextInput.
64
+ * Required is deprecated and will be removed in the next major release.
65
+ * Please use the outer required instead.
59
66
  */
60
- inputProps?: Pick<TextInputProps, 'loading' | 'required'>;
67
+ inputProps?: Pick<TextInputProps, 'loading' | 'required' | 'numberOfLines'>;
61
68
  /**
62
69
  * Field label.
63
70
  */
@@ -70,4 +77,9 @@ export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputP
70
77
  * Testing id of the component.
71
78
  */
72
79
  testID?: string;
80
+ /**
81
+ * @deprecated
82
+ * Please use inputProps.numberOfLines instead.
83
+ */
84
+ numberOfLines?: number;
73
85
  }
@@ -1,3 +1,3 @@
1
1
  import type { TabsProps } from '.';
2
- declare const ScrollableTab: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, testID: componentTestID, }: TabsProps) => JSX.Element;
2
+ declare const ScrollableTab: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, swipeEnabled, testID: componentTestID, }: TabsProps) => JSX.Element;
3
3
  export default ScrollableTab;
@@ -45,12 +45,17 @@ export interface TabsProps extends ViewProps {
45
45
  * Defaults value is `1`.
46
46
  */
47
47
  lazyPreloadDistance?: number;
48
+ /**
49
+ * Boolean indicating whether to enable swipe gestures. Passing `false` will disable swipe gestures, but the user can still switch tabs by pressing the tab bar.
50
+ * Defaults value is `true`.
51
+ */
52
+ swipeEnabled?: boolean;
48
53
  /**
49
54
  * Testing id of the component.
50
55
  */
51
56
  testID?: string;
52
57
  }
53
- declare const _default: (({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, testID: componentTestID, }: TabsProps) => JSX.Element) & {
54
- Scroll: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, testID: componentTestID, }: TabsProps) => JSX.Element;
58
+ declare const _default: (({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, swipeEnabled, testID: componentTestID, }: TabsProps) => JSX.Element) & {
59
+ Scroll: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, swipeEnabled, testID: componentTestID, }: TabsProps) => JSX.Element;
55
60
  };
56
61
  export default _default;
@@ -1,10 +1,12 @@
1
1
  import { View, Text } from 'react-native';
2
2
  declare type ThemeIntent = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
3
+ declare type ThemeVariant = 'filled' | 'outlined';
3
4
  declare const StyledView: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
4
5
  theme?: import("@emotion/react").Theme | undefined;
5
6
  as?: import("react").ElementType<any> | undefined;
6
7
  } & {
7
8
  themeIntent: ThemeIntent;
9
+ themeVariant: ThemeVariant;
8
10
  }, {}, {
9
11
  ref?: import("react").Ref<View> | undefined;
10
12
  }>;
@@ -13,6 +15,7 @@ declare const StyledText: import("@emotion/native").StyledComponent<import("reac
13
15
  as?: import("react").ElementType<any> | undefined;
14
16
  } & {
15
17
  themeIntent: ThemeIntent;
18
+ themeVariant: ThemeVariant;
16
19
  }, {}, {
17
20
  ref?: import("react").Ref<Text> | undefined;
18
21
  }>;
@@ -1,13 +1,18 @@
1
+ import { ReactElement } from 'react';
1
2
  import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
3
  interface TagProps extends ViewProps {
3
4
  /**
4
5
  * Content of the Tag.
5
6
  */
6
- content: string;
7
+ content: string | ReactElement;
7
8
  /**
8
9
  * Visual intent color to apply to Tag.
9
10
  */
10
11
  intent?: 'primary' | 'default' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
12
+ /**
13
+ * Tag variant.
14
+ */
15
+ variant?: 'filled' | 'outlined';
11
16
  /**
12
17
  * Additional style.
13
18
  */
@@ -17,5 +22,5 @@ interface TagProps extends ViewProps {
17
22
  */
18
23
  testID?: string;
19
24
  }
20
- declare const Tag: ({ content, intent, style, testID, ...nativeProps }: TagProps) => JSX.Element;
25
+ declare const Tag: ({ content, variant, intent, style, testID, ...nativeProps }: TagProps) => JSX.Element;
21
26
  export default Tag;
@@ -18,6 +18,7 @@ declare const getTagTheme: (theme: GlobalTheme) => {
18
18
  dangerBackground: string;
19
19
  archived: string;
20
20
  archivedBackground: string;
21
+ text: string;
21
22
  };
22
23
  fonts: {
23
24
  default: string;
@@ -1 +1,3 @@
1
1
  export declare const usePrevious: <T>(value: T) => T | undefined;
2
+ export declare function usePropsOrInternalState<T>(initialState: T, state: T | undefined, setState: ((val: T) => void) | undefined): [T, (val: T) => void];
3
+ export declare const useDeprecation: (message: string, cond?: boolean) => void;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
-
3
- export function usePropsOrInternalState<T>(
4
- initialState: T,
5
- state: T | undefined,
6
- setState: ((val: T) => void) | undefined
7
- ): [T, (val: T) => void] {
8
- const [internalState, setInternalState] = React.useState<T>(initialState);
9
-
10
- return [state || internalState, setState || setInternalState];
11
- }
@@ -1 +0,0 @@
1
- export declare function usePropsOrInternalState<T>(initialState: T, state: T | undefined, setState: ((val: T) => void) | undefined): [T, (val: T) => void];