@hero-design/rn 7.16.2 → 7.17.1
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 +2 -2
- package/es/index.js +331 -259
- package/lib/index.js +330 -258
- package/package.json +2 -2
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +12 -12
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +18 -18
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +26 -26
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -3
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +1 -1
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +2 -2
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +2 -2
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/Button/__tests__/__snapshots__/IconButton.spec.tsx.snap +1 -1
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +67 -67
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +12 -12
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +1 -1
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +1 -1
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +5 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +12 -12
- package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +12 -12
- package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +28 -28
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +2 -2
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +3 -3
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/List/BasicListItem.tsx +8 -4
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +3 -3
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +20 -20
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +6 -6
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +12 -12
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +4 -4
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +22 -22
- package/src/components/Progress/ProgressCircle.tsx +25 -22
- package/src/components/Progress/StyledProgressCircle.tsx +33 -28
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +102 -92
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +5 -5
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +6 -6
- package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +3 -3
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +11 -11
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +6 -6
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Select/MultiSelect/Option.tsx +20 -11
- package/src/components/Select/MultiSelect/OptionList.tsx +47 -41
- package/src/components/Select/MultiSelect/__tests__/OptionList.spec.tsx +25 -14
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +6 -4
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1638 -134
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +5312 -366
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +122 -1
- package/src/components/Select/MultiSelect/index.tsx +26 -36
- package/src/components/Select/SingleSelect/Option.tsx +19 -3
- package/src/components/Select/SingleSelect/OptionList.tsx +47 -39
- package/src/components/Select/SingleSelect/__tests__/OptionList.spec.tsx +23 -12
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +5 -3
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1632 -128
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +4932 -302
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +117 -1
- package/src/components/Select/SingleSelect/index.tsx +26 -37
- package/src/components/Select/StyledOptionList.tsx +43 -44
- package/src/components/Select/StyledSelect.tsx +7 -3
- package/src/components/Select/__tests__/StyledSelect.spec.tsx +1 -9
- package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +2 -15
- package/src/components/Select/__tests__/helpers.spec.tsx +74 -0
- package/src/components/Select/helpers.tsx +87 -4
- package/src/components/Select/types.ts +99 -0
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +4 -4
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +8 -8
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
- package/src/components/Switch/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +6 -6
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +8 -8
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +50 -50
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +241 -85
- package/src/components/TextInput/__tests__/index.spec.tsx +29 -8
- package/src/components/TextInput/index.tsx +18 -7
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +5 -5
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +12 -12
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +22 -22
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +12 -12
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +8 -8
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +13 -13
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +145 -146
- package/src/theme/components/alert.ts +3 -3
- package/src/theme/components/badge.ts +1 -1
- package/src/theme/components/card.ts +4 -4
- package/src/theme/components/list.ts +4 -4
- package/src/theme/components/pinInput.ts +2 -2
- package/src/theme/components/progress.ts +5 -5
- package/src/theme/components/select.ts +3 -3
- package/src/theme/components/toast.ts +3 -3
- package/src/theme/global/colors.ts +40 -39
- package/src/types.ts +7 -1
- package/types/components/List/BasicListItem.d.ts +1 -1
- package/types/components/Progress/StyledProgressCircle.d.ts +12 -6
- package/types/components/Select/MultiSelect/Option.d.ts +4 -2
- package/types/components/Select/MultiSelect/OptionList.d.ts +6 -7
- package/types/components/Select/MultiSelect/index.d.ts +5 -5
- package/types/components/Select/SingleSelect/Option.d.ts +4 -2
- package/types/components/Select/SingleSelect/OptionList.d.ts +6 -7
- package/types/components/Select/SingleSelect/index.d.ts +5 -5
- package/types/components/Select/StyledOptionList.d.ts +10 -16
- package/types/components/Select/StyledSelect.d.ts +8 -2
- package/types/components/Select/__tests__/helpers.spec.d.ts +1 -0
- package/types/components/Select/helpers.d.ts +14 -2
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Select/types.d.ts +32 -7
- package/types/components/TextInput/index.d.ts +4 -2
- package/types/theme/components/progress.d.ts +1 -2
- package/types/theme/components/select.d.ts +3 -3
- package/types/types.d.ts +2 -1
- package/src/components/Select/types.tsx +0 -52
|
@@ -7,9 +7,9 @@ const getSelectTheme = (theme: GlobalTheme) => {
|
|
|
7
7
|
|
|
8
8
|
const space = {
|
|
9
9
|
minimumOptionListHeight: theme.space.xxxxlarge * 5,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
sectionSpacing: theme.space.smallMedium,
|
|
11
|
+
optionSpacing: theme.space.xsmall,
|
|
12
|
+
optionHorizontalMargin: theme.space.smallMedium,
|
|
13
13
|
searchBarMarginTopSpacing: theme.space.small,
|
|
14
14
|
searchBarHorizontalSpacing: theme.space.medium,
|
|
15
15
|
searchBarBottomSpacing: theme.space.small,
|
|
@@ -5,9 +5,9 @@ const getToastTheme = (theme: GlobalTheme) => {
|
|
|
5
5
|
const colors = {
|
|
6
6
|
success: theme.colors.success,
|
|
7
7
|
warning: theme.colors.warning,
|
|
8
|
-
error: theme.colors.
|
|
9
|
-
info: theme.colors.
|
|
10
|
-
divider: theme.colors.
|
|
8
|
+
error: theme.colors.dangerLight,
|
|
9
|
+
info: theme.colors.infoLight,
|
|
10
|
+
divider: theme.colors.outline,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const sizes = {
|
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
defaultMobilePalette as
|
|
1
|
+
import {
|
|
2
|
+
defaultMobilePalette as palette,
|
|
3
|
+
swagPalette,
|
|
3
4
|
} from '@hero-design/colors';
|
|
4
5
|
|
|
5
6
|
const systemPalette = {
|
|
6
|
-
primary:
|
|
7
|
-
primaryLight:
|
|
8
|
-
primaryDark:
|
|
9
|
-
primaryBackground:
|
|
10
|
-
primaryBackgroundDark:
|
|
11
|
-
secondary:
|
|
12
|
-
secondaryLight:
|
|
13
|
-
secondaryBackground:
|
|
14
|
-
info: palette.
|
|
15
|
-
infoMediumLight:
|
|
16
|
-
infoLight: palette.
|
|
17
|
-
infoBackground: palette.
|
|
18
|
-
success: palette.
|
|
19
|
-
successLight:
|
|
20
|
-
successDark: palette.
|
|
21
|
-
successBackground: palette.
|
|
22
|
-
danger: palette.
|
|
23
|
-
dangerMediumLight:
|
|
24
|
-
dangerLight: palette.
|
|
25
|
-
dangerBackground: palette.
|
|
26
|
-
warning: palette.
|
|
27
|
-
warningLight:
|
|
28
|
-
warningDark: palette.
|
|
29
|
-
warningBackground: palette.
|
|
7
|
+
primary: swagPalette.violet,
|
|
8
|
+
primaryLight: swagPalette.violetLight50, // no longer needed after revising Button
|
|
9
|
+
primaryDark: swagPalette.scarletGumLight30, // DEPRECATED
|
|
10
|
+
primaryBackground: swagPalette.violetLight90,
|
|
11
|
+
primaryBackgroundDark: palette.maasstrichtBlueLight30,
|
|
12
|
+
secondary: swagPalette.ultramarineBlue, // no longer needed after revising Button
|
|
13
|
+
secondaryLight: swagPalette.vodka, // no longer needed after revising Button
|
|
14
|
+
secondaryBackground: swagPalette.aliceBlue, // no longer needed after revising Button
|
|
15
|
+
info: palette.ultramarineBlue,
|
|
16
|
+
infoMediumLight: palette.vodka, // DEPRECATED, use infoLight instead
|
|
17
|
+
infoLight: palette.vodka,
|
|
18
|
+
infoBackground: palette.aliceBlue,
|
|
19
|
+
success: palette.emerald,
|
|
20
|
+
successLight: palette.emerald, // DEPRECATED, use success instead
|
|
21
|
+
successDark: palette.pineGreen,
|
|
22
|
+
successBackground: palette.honeydew,
|
|
23
|
+
danger: palette.vermilion,
|
|
24
|
+
dangerMediumLight: palette.apple, // should be dangerDark?
|
|
25
|
+
dangerLight: palette.pastelRed,
|
|
26
|
+
dangerBackground: palette.linen,
|
|
27
|
+
warning: palette.mellowApricot,
|
|
28
|
+
warningLight: palette.mellowApricot, // DEPRECATED, use warning instead
|
|
29
|
+
warningDark: palette.deepSaffron,
|
|
30
|
+
warningBackground: palette.seashell,
|
|
30
31
|
platformBackground: palette.white,
|
|
31
|
-
backgroundLight: palette.
|
|
32
|
-
backgroundDark: palette.
|
|
33
|
-
text: palette.
|
|
34
|
-
subduedText: palette.
|
|
35
|
-
disabledText: palette.
|
|
36
|
-
disabledLightText: palette.
|
|
32
|
+
backgroundLight: palette.greyLight90,
|
|
33
|
+
backgroundDark: palette.maasstrichtBlue,
|
|
34
|
+
text: palette.maasstrichtBlue,
|
|
35
|
+
subduedText: palette.maasstrichtBlueLight30, // secondary
|
|
36
|
+
disabledText: palette.maasstrichtBlueLight50, // readonly
|
|
37
|
+
disabledLightText: palette.greyLight30, // disabled
|
|
37
38
|
invertedText: palette.white,
|
|
38
|
-
outline: palette.
|
|
39
|
-
archived: palette.greyLight45,
|
|
40
|
-
archivedLight:
|
|
41
|
-
archivedDark:
|
|
42
|
-
archivedBackground:
|
|
39
|
+
outline: palette.greyLight75, // divider
|
|
40
|
+
archived: palette.greyLight45, // no usage
|
|
41
|
+
archivedLight: palette.greyLight30,
|
|
42
|
+
archivedDark: palette.sonicSilver, // should replace archived as archived has no usage?
|
|
43
|
+
archivedBackground: palette.antiFlashWhite,
|
|
43
44
|
black: palette.black,
|
|
44
|
-
inactiveBackground: palette.
|
|
45
|
-
shadow: palette.
|
|
45
|
+
inactiveBackground: palette.maasstrichtBlueLight50,
|
|
46
|
+
shadow: palette.greyLight45, // waiting for new color
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
type SystemPalette = typeof systemPalette;
|
package/src/types.ts
CHANGED
|
@@ -10,14 +10,20 @@ import {
|
|
|
10
10
|
} from './components/RichTextEditor';
|
|
11
11
|
|
|
12
12
|
import { Theme } from './theme';
|
|
13
|
+
import {
|
|
14
|
+
ListRenderOptionInfo,
|
|
15
|
+
SectionListRenderOptionInfo,
|
|
16
|
+
} from './components/Select/types';
|
|
13
17
|
|
|
14
18
|
export type {
|
|
15
19
|
BottomNavigationTabType,
|
|
16
20
|
IconName,
|
|
21
|
+
SingleSelectProps,
|
|
17
22
|
MultiSelectProps,
|
|
23
|
+
ListRenderOptionInfo,
|
|
24
|
+
SectionListRenderOptionInfo,
|
|
18
25
|
RichTextEditorProps,
|
|
19
26
|
RichTextEditorRef,
|
|
20
|
-
SingleSelectProps,
|
|
21
27
|
TabType,
|
|
22
28
|
TextInputProps,
|
|
23
29
|
Theme,
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { View, ViewProps } from 'react-native';
|
|
2
2
|
import { ThemeIntent } from './types';
|
|
3
|
-
declare const
|
|
3
|
+
declare const StyledContainer: import("@emotion/native").StyledComponent<ViewProps & {
|
|
4
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
5
|
as?: import("react").ElementType<any> | undefined;
|
|
6
6
|
}, {}, {
|
|
7
7
|
ref?: import("react").Ref<View> | undefined;
|
|
8
8
|
}>;
|
|
9
|
-
declare const
|
|
9
|
+
declare const StyledHalfCircleWrapper: import("@emotion/native").StyledComponent<ViewProps & {
|
|
10
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
11
|
+
as?: import("react").ElementType<any> | undefined;
|
|
12
|
+
}, {}, {
|
|
13
|
+
ref?: import("react").Ref<View> | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
declare const StyledHalfCircleInnerFG: import("@emotion/native").StyledComponent<ViewProps & {
|
|
10
16
|
theme?: import("@emotion/react").Theme | undefined;
|
|
11
17
|
as?: import("react").ElementType<any> | undefined;
|
|
12
18
|
} & {
|
|
@@ -14,19 +20,19 @@ declare const HalfCircleInnerFG: import("@emotion/native").StyledComponent<ViewP
|
|
|
14
20
|
}, {}, {
|
|
15
21
|
ref?: import("react").Ref<View> | undefined;
|
|
16
22
|
}>;
|
|
17
|
-
declare const
|
|
23
|
+
declare const StyledHalfCircleInnerBG: import("@emotion/native").StyledComponent<ViewProps & {
|
|
18
24
|
theme?: import("@emotion/react").Theme | undefined;
|
|
19
25
|
as?: import("react").ElementType<any> | undefined;
|
|
20
26
|
}, {}, {
|
|
21
27
|
ref?: import("react").Ref<View> | undefined;
|
|
22
28
|
}>;
|
|
23
|
-
declare const
|
|
29
|
+
declare const StyledDonutCircle: import("@emotion/native").StyledComponent<ViewProps & {
|
|
24
30
|
theme?: import("@emotion/react").Theme | undefined;
|
|
25
31
|
as?: import("react").ElementType<any> | undefined;
|
|
26
32
|
}, {}, {
|
|
27
33
|
ref?: import("react").Ref<View> | undefined;
|
|
28
34
|
}>;
|
|
29
|
-
declare const
|
|
35
|
+
declare const StyledStrokeEnd: import("@emotion/native").StyledComponent<ViewProps & {
|
|
30
36
|
theme?: import("@emotion/react").Theme | undefined;
|
|
31
37
|
as?: import("react").ElementType<any> | undefined;
|
|
32
38
|
} & {
|
|
@@ -34,4 +40,4 @@ declare const StrokeEnd: import("@emotion/native").StyledComponent<ViewProps & {
|
|
|
34
40
|
}, {}, {
|
|
35
41
|
ref?: import("react").Ref<View> | undefined;
|
|
36
42
|
}>;
|
|
37
|
-
export {
|
|
43
|
+
export { StyledContainer, StyledDonutCircle, StyledHalfCircleWrapper, StyledHalfCircleInnerFG, StyledHalfCircleInnerBG, StyledStrokeEnd, };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
declare const Option: ({ text, disabled, selected, onPress, }: {
|
|
3
|
+
text: string | ReactElement;
|
|
4
|
+
disabled?: boolean | undefined;
|
|
3
5
|
selected: boolean;
|
|
4
6
|
onPress: () => void;
|
|
5
7
|
}) => JSX.Element;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { MultiSelectProps } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
declare const OptionList: <T>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, options, value, }: Pick<OptionListProps<T>, "value" | "onPress" | "loading" | "options" | "keyExtractor" | "onQueryChange" | "onEndReached">) => JSX.Element;
|
|
2
|
+
import { OptionType, SectionData } from '../types';
|
|
3
|
+
declare type OptionListProps<V, T extends OptionType<V>> = Pick<MultiSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
|
|
4
|
+
onPress: (value: V[]) => void;
|
|
5
|
+
sections: SectionData<V, T>[];
|
|
6
|
+
};
|
|
7
|
+
declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, }: OptionListProps<V, T>) => JSX.Element;
|
|
9
8
|
export default OptionList;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SelectProps } from '../types';
|
|
2
|
-
export interface MultiSelectProps<T> extends SelectProps<T> {
|
|
1
|
+
import { OptionType, SelectProps } from '../types';
|
|
2
|
+
export interface MultiSelectProps<V, T extends OptionType<V> = OptionType<V>> extends SelectProps<V, T> {
|
|
3
3
|
/**
|
|
4
4
|
* Current selected value.
|
|
5
5
|
*/
|
|
6
|
-
value:
|
|
6
|
+
value: V[];
|
|
7
7
|
/**
|
|
8
8
|
* event handler for footer button.
|
|
9
9
|
*/
|
|
10
|
-
onConfirm: (value:
|
|
10
|
+
onConfirm: (value: V[]) => void;
|
|
11
11
|
/**
|
|
12
12
|
* Footer label.
|
|
13
13
|
*/
|
|
14
14
|
footerLabel: string;
|
|
15
15
|
}
|
|
16
|
-
declare function MultiSelect<T
|
|
16
|
+
declare function MultiSelect<V, T extends OptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, query, error, editable, disabled, numberOfLines, style, testID, value, }: MultiSelectProps<V, T>): JSX.Element;
|
|
17
17
|
export default MultiSelect;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
declare const Option: ({ text, disabled, selected, onPress, }: {
|
|
3
|
+
text: string | ReactElement;
|
|
4
|
+
disabled?: boolean | undefined;
|
|
3
5
|
selected: boolean;
|
|
4
6
|
onPress: () => void;
|
|
5
7
|
}) => JSX.Element;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SingleSelectProps } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
declare const OptionList: <T>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, options, value, }: Pick<OptionListProps<T>, "value" | "onPress" | "loading" | "options" | "keyExtractor" | "onQueryChange" | "onEndReached">) => JSX.Element;
|
|
2
|
+
import { OptionType, SectionData } from '../types';
|
|
3
|
+
declare type OptionListProps<V, T extends OptionType<V>> = Pick<SingleSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
|
|
4
|
+
onPress: (value: V | null) => void;
|
|
5
|
+
sections: SectionData<V, T>[];
|
|
6
|
+
};
|
|
7
|
+
declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, }: OptionListProps<V, T>) => JSX.Element;
|
|
9
8
|
export default OptionList;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { SelectProps } from '../types';
|
|
2
|
-
export interface SingleSelectProps<T> extends SelectProps<T> {
|
|
1
|
+
import { OptionType, SelectProps } from '../types';
|
|
2
|
+
export interface SingleSelectProps<V, T extends OptionType<V> = OptionType<V>> extends SelectProps<V, T> {
|
|
3
3
|
/**
|
|
4
4
|
* Current selected value.
|
|
5
5
|
*/
|
|
6
|
-
value:
|
|
6
|
+
value: V | null;
|
|
7
7
|
/**
|
|
8
8
|
* on select event handler
|
|
9
9
|
*/
|
|
10
|
-
onConfirm: (value:
|
|
10
|
+
onConfirm: (value: V | null) => void;
|
|
11
11
|
}
|
|
12
|
-
declare const SingleSelect: <T
|
|
12
|
+
declare const SingleSelect: <V, T extends OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element;
|
|
13
13
|
export default SingleSelect;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Selected scroll index
|
|
13
|
-
*/
|
|
14
|
-
scrollIndex?: number;
|
|
15
|
-
}
|
|
16
|
-
declare const StyledOptionList: <T>({ keyExtractor, loading, onEndReached, onQueryChange, options, RenderItem, scrollIndex, }: Pick<OptionListProps<T>, "loading" | "options" | "keyExtractor" | "onQueryChange" | "onEndReached" | "scrollIndex" | "RenderItem">) => JSX.Element;
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { SectionListRenderItemInfo } from 'react-native';
|
|
3
|
+
import { ScrollParams } from './helpers';
|
|
4
|
+
import { SectionData, OptionType, SelectProps, SectionType } from './types';
|
|
5
|
+
export declare type StyledOptionListProps<V, T extends OptionType<V>> = Pick<SelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange'> & {
|
|
6
|
+
scrollParams: ScrollParams;
|
|
7
|
+
sections: SectionData<V, T>[];
|
|
8
|
+
renderItem: (info: SectionListRenderItemInfo<T, SectionType>) => ReactElement;
|
|
9
|
+
};
|
|
10
|
+
declare const StyledOptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, scrollParams, }: StyledOptionListProps<V, T>) => JSX.Element;
|
|
17
11
|
export default StyledOptionList;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
|
-
declare const
|
|
2
|
+
declare const SectionSpacer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, {}, {
|
|
6
|
+
ref?: import("react").Ref<View> | undefined;
|
|
7
|
+
}>;
|
|
8
|
+
declare const OptionSpacer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
3
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
10
|
as?: import("react").ElementType<any> | undefined;
|
|
5
11
|
}, {}, {
|
|
@@ -15,4 +21,4 @@ declare const StyledSearchBar: import("@emotion/native").StyledComponent<import(
|
|
|
15
21
|
}, {}, {
|
|
16
22
|
ref?: import("react").Ref<View> | undefined;
|
|
17
23
|
}>;
|
|
18
|
-
export {
|
|
24
|
+
export { SectionSpacer, OptionSpacer, FooterText, StyledSearchBar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import { OptionType } from './types';
|
|
2
|
-
export declare const getKey: <T
|
|
1
|
+
import { SectionData, CombinedOptionsType, OptionType } from './types';
|
|
2
|
+
export declare const getKey: <V, T extends OptionType<V>>(option: T, index: number, keyExtractor?: ((opt: T, i?: number | undefined) => string) | undefined) => import("react").Key;
|
|
3
|
+
export declare const isSections: <V, T extends OptionType<V>>(options: CombinedOptionsType<V, T>) => options is SectionData<V, T>[];
|
|
4
|
+
export declare const toSections: <V, T extends OptionType<V>>(options: CombinedOptionsType<V, T>) => SectionData<V, T>[];
|
|
5
|
+
export declare const toFlatOptions: <V, T extends OptionType<V>>(options: CombinedOptionsType<V, T>) => OptionType<V>[];
|
|
6
|
+
export declare type ScrollParams = {
|
|
7
|
+
itemIndex: number;
|
|
8
|
+
sectionIndex: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const getScrollParams: <V, T extends OptionType<V>>(value: V, sections: SectionData<V, T>[]) => ScrollParams;
|
|
11
|
+
export declare const useKeyboard: () => {
|
|
12
|
+
isKeyboardVisible: boolean;
|
|
13
|
+
keyboardHeight: number;
|
|
14
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MultiSelect, { MultiSelectProps } from './MultiSelect';
|
|
2
2
|
import { SingleSelectProps } from './SingleSelect';
|
|
3
|
-
declare const _default: (<T
|
|
3
|
+
declare const _default: (<V, T extends import("./types").OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
|
|
4
4
|
Multi: typeof MultiSelect;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ListRenderItemInfo, SectionListData, SectionListRenderItemInfo, StyleProp, ViewStyle } from 'react-native';
|
|
2
3
|
import { TextInputProps } from '../TextInput';
|
|
3
|
-
export declare type OptionType<
|
|
4
|
-
value:
|
|
4
|
+
export declare type OptionType<V> = {
|
|
5
|
+
value: V;
|
|
5
6
|
text: string;
|
|
6
7
|
key?: string;
|
|
8
|
+
disabled?: boolean;
|
|
7
9
|
};
|
|
8
|
-
export
|
|
10
|
+
export declare type SectionType = {
|
|
11
|
+
category: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type SectionData<V, T extends OptionType<V>> = SectionListData<T, SectionType>;
|
|
14
|
+
export declare type CombinedOptionsType<V, T extends OptionType<V>> = T[] | SectionData<V, T>[];
|
|
15
|
+
export declare type ListRenderOptionInfo<V, T extends OptionType<V>> = ListRenderItemInfo<T> & {
|
|
16
|
+
selected: boolean;
|
|
17
|
+
onPress: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare type SectionListRenderOptionInfo<V, T extends OptionType<V>> = SectionListRenderItemInfo<T, SectionType> & {
|
|
20
|
+
selected: boolean;
|
|
21
|
+
onPress: () => void;
|
|
22
|
+
};
|
|
23
|
+
export interface SelectProps<V, T extends OptionType<V>> extends Pick<TextInputProps, 'editable' | 'disabled' | 'numberOfLines' | 'error'> {
|
|
9
24
|
/**
|
|
10
25
|
* An array of options to be selected.
|
|
11
26
|
*/
|
|
12
|
-
options:
|
|
27
|
+
options: CombinedOptionsType<V, T>;
|
|
28
|
+
/**
|
|
29
|
+
* Customize option renderer.
|
|
30
|
+
*/
|
|
31
|
+
renderOption?: ((info: ListRenderOptionInfo<V, T>) => ReactElement) | ((info: SectionListRenderOptionInfo<V, T>) => ReactElement);
|
|
13
32
|
/**
|
|
14
33
|
* Used to extract a unique key for a given option at the specified index. Key is used for caching and as the react key to track item re-ordering.
|
|
15
34
|
* The default extractor checks option.key, and then falls back to using the index, like React does.
|
|
16
35
|
*/
|
|
17
|
-
keyExtractor?: (option:
|
|
36
|
+
keyExtractor?: (option: T, index?: number) => string;
|
|
18
37
|
/**
|
|
19
38
|
* Current search value.
|
|
20
39
|
*/
|
|
@@ -32,9 +51,15 @@ export interface SelectProps<T> extends Pick<TextInputProps, 'editable' | 'disab
|
|
|
32
51
|
*/
|
|
33
52
|
onEndReached?: () => void;
|
|
34
53
|
/**
|
|
35
|
-
* Show indicator at bottom of option list
|
|
54
|
+
* Show loading indicator at bottom of option list
|
|
36
55
|
*/
|
|
37
56
|
loading?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Props that are passed to TextInput.
|
|
59
|
+
*/
|
|
60
|
+
inputProps?: {
|
|
61
|
+
loading?: boolean;
|
|
62
|
+
};
|
|
38
63
|
/**
|
|
39
64
|
* Field label.
|
|
40
65
|
*/
|
|
@@ -48,15 +48,17 @@ export interface TextInputProps extends NativeTextInputProps {
|
|
|
48
48
|
* */
|
|
49
49
|
editable?: boolean;
|
|
50
50
|
disabled?: boolean;
|
|
51
|
+
loading?: boolean;
|
|
51
52
|
maxLength?: number;
|
|
52
53
|
helpText?: string;
|
|
53
54
|
}
|
|
54
|
-
export declare const getVariant: ({ disabled, error, editable, isFocused, isEmptyValue, }: {
|
|
55
|
+
export declare const getVariant: ({ disabled, error, editable, loading, isFocused, isEmptyValue, }: {
|
|
55
56
|
disabled?: boolean | undefined;
|
|
56
57
|
error?: string | undefined;
|
|
57
58
|
editable?: boolean | undefined;
|
|
59
|
+
loading: boolean;
|
|
58
60
|
isFocused?: boolean | undefined;
|
|
59
61
|
isEmptyValue?: boolean | undefined;
|
|
60
62
|
}) => Variant;
|
|
61
|
-
declare const TextInput: ({ label, prefix, suffix, style, textStyle, testID, accessibilityLabelledBy, error, required, editable, disabled, maxLength, helpText, value, defaultValue, ...nativeProps }: TextInputProps) => JSX.Element;
|
|
63
|
+
declare const TextInput: ({ label, prefix, suffix, style, textStyle, testID, accessibilityLabelledBy, error, required, editable, disabled, loading, maxLength, helpText, value, defaultValue, ...nativeProps }: TextInputProps) => JSX.Element;
|
|
62
64
|
export default TextInput;
|
|
@@ -2,9 +2,9 @@ import { GlobalTheme } from '../global';
|
|
|
2
2
|
declare const getSelectTheme: (theme: GlobalTheme) => {
|
|
3
3
|
space: {
|
|
4
4
|
minimumOptionListHeight: number;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
sectionSpacing: number;
|
|
6
|
+
optionSpacing: number;
|
|
7
|
+
optionHorizontalMargin: number;
|
|
8
8
|
searchBarMarginTopSpacing: number;
|
|
9
9
|
searchBarHorizontalSpacing: number;
|
|
10
10
|
searchBarBottomSpacing: number;
|
package/types/types.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ import { TabType } from './components/Tabs';
|
|
|
5
5
|
import { TextInputProps } from './components/TextInput';
|
|
6
6
|
import { RichTextEditorRef, RichTextEditorProps, ToolbarButtonName } from './components/RichTextEditor';
|
|
7
7
|
import { Theme } from './theme';
|
|
8
|
-
|
|
8
|
+
import { ListRenderOptionInfo, SectionListRenderOptionInfo } from './components/Select/types';
|
|
9
|
+
export type { BottomNavigationTabType, IconName, SingleSelectProps, MultiSelectProps, ListRenderOptionInfo, SectionListRenderOptionInfo, RichTextEditorProps, RichTextEditorRef, TabType, TextInputProps, Theme, ToolbarButtonName, };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
-
import { TextInputProps } from '../TextInput';
|
|
3
|
-
|
|
4
|
-
export type OptionType<T> = { value: T; text: string; key?: string };
|
|
5
|
-
|
|
6
|
-
export interface SelectProps<T>
|
|
7
|
-
extends Pick<
|
|
8
|
-
TextInputProps,
|
|
9
|
-
'editable' | 'disabled' | 'numberOfLines' | 'error'
|
|
10
|
-
> {
|
|
11
|
-
/**
|
|
12
|
-
* An array of options to be selected.
|
|
13
|
-
*/
|
|
14
|
-
options: OptionType<T>[];
|
|
15
|
-
/**
|
|
16
|
-
* Used to extract a unique key for a given option at the specified index. Key is used for caching and as the react key to track item re-ordering.
|
|
17
|
-
* The default extractor checks option.key, and then falls back to using the index, like React does.
|
|
18
|
-
*/
|
|
19
|
-
keyExtractor?: (option: OptionType<T>, index?: number) => string;
|
|
20
|
-
/**
|
|
21
|
-
* Current search value.
|
|
22
|
-
*/
|
|
23
|
-
query?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Search bar onChangeText event handler
|
|
26
|
-
*/
|
|
27
|
-
onQueryChange?: (value: string) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Event handler when selection dismiss
|
|
30
|
-
*/
|
|
31
|
-
onDimiss?: () => void;
|
|
32
|
-
/**
|
|
33
|
-
* Event handler when end of the list reached
|
|
34
|
-
*/
|
|
35
|
-
onEndReached?: () => void;
|
|
36
|
-
/**
|
|
37
|
-
* Show indicator at bottom of option list
|
|
38
|
-
*/
|
|
39
|
-
loading?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Field label.
|
|
42
|
-
*/
|
|
43
|
-
label: string;
|
|
44
|
-
/**
|
|
45
|
-
* Additional style.
|
|
46
|
-
*/
|
|
47
|
-
style?: StyleProp<ViewStyle>;
|
|
48
|
-
/**
|
|
49
|
-
* Testing id of the component.
|
|
50
|
-
*/
|
|
51
|
-
testID?: string;
|
|
52
|
-
}
|