@hero-design/rn 7.21.0 → 7.22.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.
- package/.eslintrc.js +11 -0
- package/.turbo/turbo-build.log +9 -9
- package/babel.config.js +1 -1
- package/es/index.js +357 -247
- package/lib/index.js +361 -251
- package/package.json +7 -15
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +1 -1
- package/src/components/BottomNavigation/index.tsx +3 -3
- package/src/components/Box/helpers.ts +1 -1
- package/src/components/Calendar/index.tsx +9 -9
- package/src/components/Collapse/index.tsx +1 -1
- package/src/components/Drawer/DragableDrawer/helpers.ts +7 -3
- package/src/components/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/Icon/HeroIcon/selection.json +7029 -1
- package/src/components/PinInput/index.tsx +1 -1
- package/src/components/RichTextEditor/EditorToolbar.tsx +3 -3
- package/src/components/RichTextEditor/RichTextEditor.tsx +5 -5
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -2
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +1 -1
- package/src/components/Select/MultiSelect/OptionList.tsx +1 -1
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +1 -1
- package/src/components/Select/MultiSelect/index.tsx +3 -3
- package/src/components/Select/SingleSelect/index.tsx +3 -3
- package/src/components/Select/helpers.tsx +4 -4
- package/src/components/Slider/index.tsx +1 -1
- package/src/components/Switch/SelectorSwitch/Option.tsx +67 -0
- package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +25 -0
- package/src/components/Switch/SelectorSwitch/__tests__/Option.spec.tsx +61 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +195 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +121 -0
- package/src/components/Switch/SelectorSwitch/__tests__/index.spec.tsx +62 -0
- package/src/components/Switch/SelectorSwitch/index.tsx +60 -0
- package/src/components/Switch/index.tsx +4 -1
- package/src/components/Tabs/ScrollableTabs.tsx +12 -5
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
- package/src/components/Tabs/index.tsx +13 -6
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +3 -1
- package/src/components/TextInput/__tests__/index.spec.tsx +114 -112
- package/src/components/TextInput/index.tsx +29 -30
- package/src/components/Toast/ToastContainer.tsx +6 -6
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +14 -12
- package/src/theme/components/switch.ts +14 -18
- package/testUtils/setup.tsx +1 -1
- package/tsconfig.json +1 -1
- package/types/components/Slider/index.d.ts +1 -1
- package/types/components/Switch/SelectorSwitch/Option.d.ts +10 -0
- package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +19 -0
- package/types/components/Switch/SelectorSwitch/__tests__/Option.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/__tests__/index.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/index.d.ts +37 -0
- package/types/components/Switch/index.d.ts +5 -3
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +2 -2
- package/types/components/TextInput/index.d.ts +4 -4
- package/types/theme/components/switch.d.ts +14 -12
- package/.eslintrc.json +0 -62
- package/.prettierrc.json +0 -8
|
@@ -9,21 +9,10 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
9
9
|
'disabled-unchecked': theme.colors.archived,
|
|
10
10
|
},
|
|
11
11
|
thumb: theme.colors.platformBackground,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
medium: theme.space.medium * 1.3,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const widths = {
|
|
20
|
-
small: theme.space.xxxlarge,
|
|
21
|
-
medium: theme.space.xxxxlarge,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const heights = {
|
|
25
|
-
small: theme.space.large,
|
|
26
|
-
medium: theme.space.large * 1.2,
|
|
12
|
+
selector: {
|
|
13
|
+
background: theme.colors.__alpha__globalNeutral3,
|
|
14
|
+
textBackground: theme.colors.__alpha__primary1,
|
|
15
|
+
},
|
|
27
16
|
};
|
|
28
17
|
|
|
29
18
|
const sizes = {
|
|
@@ -39,23 +28,30 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
39
28
|
small: theme.sizes.large,
|
|
40
29
|
medium: theme.sizes.xlarge,
|
|
41
30
|
},
|
|
31
|
+
selector: {
|
|
32
|
+
height: theme.sizes.xxxxlarge,
|
|
33
|
+
},
|
|
42
34
|
};
|
|
43
35
|
|
|
44
36
|
const spaces = {
|
|
45
37
|
small: theme.space.xsmall,
|
|
46
38
|
medium: theme.space.xsmall,
|
|
39
|
+
selector: {
|
|
40
|
+
iconPadding: theme.space.medium,
|
|
41
|
+
wrapperPadding: theme.space.xsmall,
|
|
42
|
+
},
|
|
47
43
|
};
|
|
48
44
|
|
|
49
45
|
const radii = {
|
|
50
46
|
rounded: theme.radii.rounded,
|
|
47
|
+
selector: {
|
|
48
|
+
default: theme.radii.rounded,
|
|
49
|
+
},
|
|
51
50
|
};
|
|
52
51
|
|
|
53
52
|
return {
|
|
54
53
|
colors,
|
|
55
54
|
sizes,
|
|
56
|
-
thumbSizes,
|
|
57
|
-
widths,
|
|
58
|
-
heights,
|
|
59
55
|
spaces,
|
|
60
56
|
radii,
|
|
61
57
|
};
|
package/testUtils/setup.tsx
CHANGED
package/tsconfig.json
CHANGED
|
@@ -48,5 +48,5 @@ export interface SliderProps {
|
|
|
48
48
|
*/
|
|
49
49
|
testID?: string;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
declare const Slider: ({ minimumValue, maximumValue, step, value, onValueChange, onSlidingStart, onSlidingComplete, disabled, style, testID, }: SliderProps) => JSX.Element;
|
|
52
52
|
export default Slider;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { BadgeConfigType, OptionType } from '.';
|
|
3
|
+
export declare const OptionContent: ({ content, badge, }: {
|
|
4
|
+
content: ReactElement;
|
|
5
|
+
badge?: BadgeConfigType;
|
|
6
|
+
}) => JSX.Element;
|
|
7
|
+
declare const Option: <T>({ text, icon, badge, selected, }: Pick<OptionType<T>, "text" | "icon" | "badge"> & {
|
|
8
|
+
selected: boolean;
|
|
9
|
+
}) => ReactElement;
|
|
10
|
+
export default Option;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
export declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: import("react").ElementType<any>;
|
|
5
|
+
}, {}, {
|
|
6
|
+
ref?: import("react").Ref<View>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const StyledTextWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
as?: import("react").ElementType<any>;
|
|
11
|
+
}, {}, {
|
|
12
|
+
ref?: import("react").Ref<View>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const StyledIconWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
15
|
+
theme?: import("@emotion/react").Theme;
|
|
16
|
+
as?: import("react").ElementType<any>;
|
|
17
|
+
}, {}, {
|
|
18
|
+
ref?: import("react").Ref<View>;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { IconName } from '../../Icon';
|
|
4
|
+
declare type StatusBadgeType = {
|
|
5
|
+
type: 'status';
|
|
6
|
+
};
|
|
7
|
+
export declare type BadgeConfigType = StatusBadgeType;
|
|
8
|
+
export declare type OptionType<T> = {
|
|
9
|
+
value: T;
|
|
10
|
+
text: string;
|
|
11
|
+
icon: IconName;
|
|
12
|
+
badge?: BadgeConfigType;
|
|
13
|
+
};
|
|
14
|
+
export interface SelectorSwitchProps<T> {
|
|
15
|
+
/**
|
|
16
|
+
* Array of exactly TWO options to switch between.
|
|
17
|
+
*/
|
|
18
|
+
options: [OptionType<T>, OptionType<T>];
|
|
19
|
+
/**
|
|
20
|
+
* Current selected value.
|
|
21
|
+
*/
|
|
22
|
+
value: T;
|
|
23
|
+
/**
|
|
24
|
+
* Callback called when an option is pressed.
|
|
25
|
+
*/
|
|
26
|
+
onPress?: (value: T) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Additional style.
|
|
29
|
+
*/
|
|
30
|
+
style?: StyleProp<ViewStyle>;
|
|
31
|
+
/**
|
|
32
|
+
* Testing id of the component.
|
|
33
|
+
*/
|
|
34
|
+
testID?: string;
|
|
35
|
+
}
|
|
36
|
+
declare const SelectorSwitch: <T>({ options, value, onPress, style, testID, }: SelectorSwitchProps<T>) => ReactElement;
|
|
37
|
+
export default SelectorSwitch;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export interface SwitchProps {
|
|
4
4
|
/**
|
|
@@ -27,5 +27,7 @@ export interface SwitchProps {
|
|
|
27
27
|
*/
|
|
28
28
|
testID?: string;
|
|
29
29
|
}
|
|
30
|
-
declare const
|
|
31
|
-
|
|
30
|
+
declare const _default: (({ size, disabled, checked, onPress, style, testID, }: SwitchProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
31
|
+
Selector: <T>({ options, value, onPress, style, testID, }: import("./SelectorSwitch").SelectorSwitchProps<T>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
32
|
+
};
|
|
33
|
+
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TabsProps } from '.';
|
|
2
|
-
declare const ScrollableTab: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, }: TabsProps) => JSX.Element;
|
|
2
|
+
declare const ScrollableTab: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, testID: componentTestID, }: TabsProps) => JSX.Element;
|
|
3
3
|
export default ScrollableTab;
|
|
@@ -50,7 +50,7 @@ export interface TabsProps extends ViewProps {
|
|
|
50
50
|
*/
|
|
51
51
|
testID?: string;
|
|
52
52
|
}
|
|
53
|
-
declare const _default: (({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, }: TabsProps) => JSX.Element) & {
|
|
54
|
-
Scroll: ({ onTabPress, selectedTabKey, tabs, containerStyle, barStyle, lazy, lazyPreloadDistance, }: TabsProps) => JSX.Element;
|
|
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;
|
|
55
55
|
};
|
|
56
56
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import type { TextInputProps as NativeTextInputProps, StyleProp, ViewStyle, TextStyle } from
|
|
3
|
-
import type { Variant } from
|
|
4
|
-
import type { IconName } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { TextInputProps as NativeTextInputProps, StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
3
|
+
import type { Variant } from "./StyledTextInput";
|
|
4
|
+
import type { IconName } from "../Icon";
|
|
5
5
|
export interface TextInputProps extends NativeTextInputProps {
|
|
6
6
|
/**
|
|
7
7
|
* Field label.
|
|
@@ -8,6 +8,10 @@ declare const getSwitchTheme: (theme: GlobalTheme) => {
|
|
|
8
8
|
'disabled-unchecked': string;
|
|
9
9
|
};
|
|
10
10
|
thumb: string;
|
|
11
|
+
selector: {
|
|
12
|
+
background: string;
|
|
13
|
+
textBackground: string;
|
|
14
|
+
};
|
|
11
15
|
};
|
|
12
16
|
sizes: {
|
|
13
17
|
thumbs: {
|
|
@@ -22,25 +26,23 @@ declare const getSwitchTheme: (theme: GlobalTheme) => {
|
|
|
22
26
|
small: number;
|
|
23
27
|
medium: number;
|
|
24
28
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
medium: number;
|
|
29
|
-
};
|
|
30
|
-
widths: {
|
|
31
|
-
small: number;
|
|
32
|
-
medium: number;
|
|
33
|
-
};
|
|
34
|
-
heights: {
|
|
35
|
-
small: number;
|
|
36
|
-
medium: number;
|
|
29
|
+
selector: {
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
37
32
|
};
|
|
38
33
|
spaces: {
|
|
39
34
|
small: number;
|
|
40
35
|
medium: number;
|
|
36
|
+
selector: {
|
|
37
|
+
iconPadding: number;
|
|
38
|
+
wrapperPadding: number;
|
|
39
|
+
};
|
|
41
40
|
};
|
|
42
41
|
radii: {
|
|
43
42
|
rounded: number;
|
|
43
|
+
selector: {
|
|
44
|
+
default: number;
|
|
45
|
+
};
|
|
44
46
|
};
|
|
45
47
|
};
|
|
46
48
|
export default getSwitchTheme;
|
package/.eslintrc.json
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true,
|
|
5
|
-
"jest": true
|
|
6
|
-
},
|
|
7
|
-
"extends": [
|
|
8
|
-
"plugin:prettier/recommended",
|
|
9
|
-
"plugin:react/recommended",
|
|
10
|
-
"airbnb",
|
|
11
|
-
"prettier"
|
|
12
|
-
],
|
|
13
|
-
"parser": "@typescript-eslint/parser",
|
|
14
|
-
"parserOptions": {
|
|
15
|
-
"ecmaFeatures": {
|
|
16
|
-
"jsx": true
|
|
17
|
-
},
|
|
18
|
-
"ecmaVersion": "latest",
|
|
19
|
-
"sourceType": "module"
|
|
20
|
-
},
|
|
21
|
-
"plugins": ["react", "@typescript-eslint"],
|
|
22
|
-
"settings": {
|
|
23
|
-
"import/resolver": {
|
|
24
|
-
"node": {
|
|
25
|
-
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"rules": {
|
|
30
|
-
"react/jsx-props-no-spreading": 0,
|
|
31
|
-
"react/require-default-props": 0,
|
|
32
|
-
"react/function-component-definition": 0,
|
|
33
|
-
"react/jsx-filename-extension": [
|
|
34
|
-
1,
|
|
35
|
-
{ "extensions": [".js", ".jsx", ".tsx"] }
|
|
36
|
-
],
|
|
37
|
-
"import/prefer-default-export": 0,
|
|
38
|
-
"import/extensions": 0,
|
|
39
|
-
"no-use-before-define": 0,
|
|
40
|
-
"@typescript-eslint/no-use-before-define": 2,
|
|
41
|
-
"@typescript-eslint/no-unused-vars": [2, { "argsIgnorePattern": "^_" }],
|
|
42
|
-
"no-shadow": "off",
|
|
43
|
-
"no-unused-vars": [2, { "argsIgnorePattern": "^_" }],
|
|
44
|
-
"@typescript-eslint/no-shadow": "error"
|
|
45
|
-
},
|
|
46
|
-
"overrides": [
|
|
47
|
-
{
|
|
48
|
-
"files": ["*.ts", "*.tsx"],
|
|
49
|
-
"rules": {
|
|
50
|
-
"no-undef": 0,
|
|
51
|
-
"consistent-return": 0,
|
|
52
|
-
"default-case": 0,
|
|
53
|
-
"no-underscore-dangle": [
|
|
54
|
-
2,
|
|
55
|
-
{
|
|
56
|
-
"allow": ["__hd__"]
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|