@hero-design/rn 7.20.0 → 7.21.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 (106) hide show
  1. package/.eslintrc.json +1 -0
  2. package/.turbo/turbo-build.log +2 -2
  3. package/es/index.js +410 -285
  4. package/lib/index.js +410 -282
  5. package/package.json +4 -2
  6. package/rollup.config.js +1 -0
  7. package/src/components/BottomSheet/index.tsx +6 -1
  8. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +4 -4
  9. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +13 -13
  10. package/src/components/Empty/StyledEmpty.tsx +1 -9
  11. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +58 -5
  12. package/src/components/Empty/__tests__/index.spec.tsx +13 -0
  13. package/src/components/Empty/index.tsx +38 -18
  14. package/src/components/Image/__tests__/__snapshots__/index.spec.tsx.snap +81 -0
  15. package/src/components/Image/__tests__/index.spec.tsx +29 -0
  16. package/src/components/Image/index.tsx +46 -0
  17. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +5 -5
  18. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +60 -60
  19. package/src/components/RichTextEditor/EditorToolbar.tsx +19 -18
  20. package/src/components/RichTextEditor/RichTextEditor.tsx +7 -2
  21. package/src/components/RichTextEditor/StyledRichTextEditor.ts +0 -2
  22. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +7 -4
  23. package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +2 -2
  24. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +4 -12
  25. package/src/components/RichTextEditor/constants.ts +0 -11
  26. package/src/components/RichTextEditor/index.tsx +0 -3
  27. package/src/components/RichTextEditor/types.ts +9 -0
  28. package/src/components/Select/MultiSelect/OptionList.tsx +4 -6
  29. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +21 -0
  30. package/src/components/Select/MultiSelect/index.tsx +33 -3
  31. package/src/components/Select/SingleSelect/OptionList.tsx +4 -5
  32. package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +16 -0
  33. package/src/components/Select/SingleSelect/index.tsx +34 -4
  34. package/src/components/Select/StyledOptionList.tsx +3 -9
  35. package/src/components/Slider/__tests__/__snapshots__/index.spec.tsx.snap +43 -0
  36. package/src/components/Slider/__tests__/index.spec.tsx +33 -0
  37. package/src/components/Slider/index.tsx +89 -0
  38. package/src/components/Switch/StyledSwitch.tsx +4 -4
  39. package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +10 -10
  40. package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
  41. package/src/components/Switch/index.tsx +5 -4
  42. package/src/components/TextInput/index.tsx +43 -37
  43. package/src/index.ts +4 -0
  44. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +56 -11
  45. package/src/theme/components/alert.ts +1 -2
  46. package/src/theme/components/avatar.ts +8 -8
  47. package/src/theme/components/badge.ts +4 -4
  48. package/src/theme/components/bottomNavigation.ts +1 -1
  49. package/src/theme/components/bottomSheet.ts +2 -3
  50. package/src/theme/components/calendar.ts +9 -7
  51. package/src/theme/components/card.ts +1 -1
  52. package/src/theme/components/checkbox.ts +2 -5
  53. package/src/theme/components/datePicker.ts +3 -3
  54. package/src/theme/components/drawer.ts +2 -3
  55. package/src/theme/components/empty.ts +3 -8
  56. package/src/theme/components/fab.ts +2 -2
  57. package/src/theme/components/image.ts +12 -0
  58. package/src/theme/components/pinInput.ts +3 -3
  59. package/src/theme/components/progress.ts +2 -3
  60. package/src/theme/components/radio.ts +7 -3
  61. package/src/theme/components/richTextEditor.ts +4 -4
  62. package/src/theme/components/slider.ts +13 -0
  63. package/src/theme/components/switch.ts +16 -1
  64. package/src/theme/components/tabs.ts +1 -1
  65. package/src/theme/components/timePicker.ts +3 -3
  66. package/src/theme/components/toast.ts +1 -2
  67. package/src/theme/getTheme.ts +9 -2
  68. package/src/theme/global/colors/swag.ts +2 -0
  69. package/src/theme/global/colors/types.ts +2 -0
  70. package/src/theme/global/index.ts +3 -0
  71. package/src/theme/global/scale.ts +3 -0
  72. package/src/theme/global/sizes.ts +29 -0
  73. package/src/types.ts +0 -2
  74. package/testUtils/setup.tsx +14 -0
  75. package/types/components/BottomSheet/index.d.ts +5 -1
  76. package/types/components/Empty/StyledEmpty.d.ts +1 -7
  77. package/types/components/Empty/index.d.ts +8 -2
  78. package/types/components/Image/__tests__/index.spec.d.ts +1 -0
  79. package/types/components/Image/index.d.ts +17 -0
  80. package/types/components/RichTextEditor/EditorToolbar.d.ts +1 -1
  81. package/types/components/RichTextEditor/RichTextEditor.d.ts +4 -0
  82. package/types/components/RichTextEditor/constants.d.ts +0 -10
  83. package/types/components/RichTextEditor/index.d.ts +0 -2
  84. package/types/components/RichTextEditor/types.d.ts +1 -0
  85. package/types/components/Select/MultiSelect/OptionList.d.ts +5 -2
  86. package/types/components/Select/MultiSelect/index.d.ts +7 -1
  87. package/types/components/Select/SingleSelect/OptionList.d.ts +5 -2
  88. package/types/components/Select/SingleSelect/index.d.ts +8 -2
  89. package/types/components/Select/StyledOptionList.d.ts +4 -3
  90. package/types/components/Select/index.d.ts +1 -1
  91. package/types/components/Slider/__tests__/index.spec.d.ts +1 -0
  92. package/types/components/Slider/index.d.ts +52 -0
  93. package/types/components/TextInput/index.d.ts +2 -1
  94. package/types/index.d.ts +3 -1
  95. package/types/theme/components/datePicker.d.ts +2 -1
  96. package/types/theme/components/empty.d.ts +2 -5
  97. package/types/theme/components/image.d.ts +8 -0
  98. package/types/theme/components/slider.d.ts +9 -0
  99. package/types/theme/components/switch.d.ts +14 -1
  100. package/types/theme/components/timePicker.d.ts +2 -1
  101. package/types/theme/getTheme.d.ts +4 -0
  102. package/types/theme/global/colors/types.d.ts +2 -0
  103. package/types/theme/global/index.d.ts +3 -0
  104. package/types/theme/global/scale.d.ts +1 -0
  105. package/types/theme/global/sizes.d.ts +14 -0
  106. package/types/types.d.ts +1 -2
@@ -17,6 +17,7 @@ import getDrawerTheme from './components/drawer';
17
17
  import getEmptyTheme from './components/empty';
18
18
  import getFABTheme from './components/fab';
19
19
  import getIconTheme from './components/icon';
20
+ import getImageTheme from './components/image';
20
21
  import getListTheme from './components/list';
21
22
  import getPinInputTheme from './components/pinInput';
22
23
  import getProgressTheme from './components/progress';
@@ -24,6 +25,7 @@ import getRadioTheme from './components/radio';
24
25
  import getRichTextEditorTheme from './components/richTextEditor';
25
26
  import getSectionHeadingTheme from './components/sectionHeading';
26
27
  import getSelectTheme from './components/select';
28
+ import getSliderTheme from './components/slider';
27
29
  import getSpinnerTheme from './components/spinner';
28
30
  import getSwitchTheme from './components/switch';
29
31
  import getTabsTheme from './components/tabs';
@@ -33,6 +35,7 @@ import getTimePickerTheme from './components/timePicker';
33
35
  import getToastTheme from './components/toast';
34
36
  import getToolbarTheme from './components/toolbar';
35
37
  import getTypographyTheme from './components/typography';
38
+
36
39
  import type { GlobalTheme, Scale, SystemPalette } from './global';
37
40
 
38
41
  type Theme = GlobalTheme & {
@@ -54,6 +57,7 @@ type Theme = GlobalTheme & {
54
57
  empty: ReturnType<typeof getEmptyTheme>;
55
58
  fab: ReturnType<typeof getFABTheme>;
56
59
  icon: ReturnType<typeof getIconTheme>;
60
+ image: ReturnType<typeof getImageTheme>;
57
61
  list: ReturnType<typeof getListTheme>;
58
62
  pinInput: ReturnType<typeof getPinInputTheme>;
59
63
  progress: ReturnType<typeof getProgressTheme>;
@@ -61,6 +65,7 @@ type Theme = GlobalTheme & {
61
65
  richTextEditor: ReturnType<typeof getRichTextEditorTheme>;
62
66
  sectionHeading: ReturnType<typeof getSectionHeadingTheme>;
63
67
  select: ReturnType<typeof getSelectTheme>;
68
+ slider: ReturnType<typeof getSliderTheme>;
64
69
  spinner: ReturnType<typeof getSpinnerTheme>;
65
70
  switch: ReturnType<typeof getSwitchTheme>;
66
71
  tabs: ReturnType<typeof getTabsTheme>;
@@ -92,12 +97,13 @@ const getTheme = (
92
97
  card: getCardTheme(globalTheme),
93
98
  checkbox: getCheckboxTheme(globalTheme),
94
99
  contentNavigator: getContentNavigatorTheme(globalTheme),
95
- datePicker: getDatePickerTheme(),
100
+ datePicker: getDatePickerTheme(globalTheme),
96
101
  divider: getDividerTheme(globalTheme),
97
102
  drawer: getDrawerTheme(globalTheme),
98
103
  empty: getEmptyTheme(globalTheme),
99
104
  fab: getFABTheme(globalTheme),
100
105
  icon: getIconTheme(globalTheme),
106
+ image: getImageTheme(globalTheme),
101
107
  list: getListTheme(globalTheme),
102
108
  pinInput: getPinInputTheme(globalTheme),
103
109
  progress: getProgressTheme(globalTheme),
@@ -105,12 +111,13 @@ const getTheme = (
105
111
  richTextEditor: getRichTextEditorTheme(globalTheme),
106
112
  sectionHeading: getSectionHeadingTheme(globalTheme),
107
113
  select: getSelectTheme(globalTheme),
114
+ slider: getSliderTheme(globalTheme),
108
115
  spinner: getSpinnerTheme(globalTheme),
109
116
  switch: getSwitchTheme(globalTheme),
110
117
  tabs: getTabsTheme(globalTheme),
111
118
  tag: getTagTheme(globalTheme),
112
119
  textInput: getTextInputTheme(globalTheme),
113
- timePicker: getTimePickerTheme(),
120
+ timePicker: getTimePickerTheme(globalTheme),
114
121
  toast: getToastTheme(globalTheme),
115
122
  toolbar: getToolbarTheme(globalTheme),
116
123
  typography: getTypographyTheme(globalTheme),
@@ -52,6 +52,7 @@ const swagSystemPalette: SystemPalette = {
52
52
  __alpha__globalPrimary: palette.maasstrichtBlue,
53
53
 
54
54
  __alpha__globalSecondary1: palette.maasstrichtBlueLight30,
55
+ __alpha__globalSecondary4: palette.maasstrichtBlueLight90,
55
56
 
56
57
  __alpha__globalNeutral3: palette.greyLight90,
57
58
 
@@ -65,6 +66,7 @@ const swagSystemPalette: SystemPalette = {
65
66
  __alpha__globalLabel8: palette.honeydew,
66
67
  __alpha__globalLabel9: palette.aliceBlue,
67
68
 
69
+ __alpha__primary1: swagPalette.scarletGum,
68
70
  __alpha__primary2: swagPalette.mauve,
69
71
 
70
72
  __alpha__secondary1: swagPalette.scarletGumLight30,
@@ -46,6 +46,7 @@ export type SystemPalette = {
46
46
  __alpha__globalPrimary: string;
47
47
 
48
48
  __alpha__globalSecondary1: string;
49
+ __alpha__globalSecondary4: string;
49
50
 
50
51
  __alpha__globalNeutral3: string;
51
52
 
@@ -59,6 +60,7 @@ export type SystemPalette = {
59
60
  __alpha__globalLabel8: string;
60
61
  __alpha__globalLabel9: string;
61
62
 
63
+ __alpha__primary1: string;
62
64
  __alpha__primary2: string;
63
65
 
64
66
  __alpha__secondary1: string;
@@ -4,6 +4,7 @@ import workSystemPalette from './colors/work';
4
4
 
5
5
  import { getFonts, getFontSizes, getLineHeights } from './typography';
6
6
  import { getSpace } from './space';
7
+ import { getSizes } from './sizes';
7
8
  import { getBorderWidths, getRadii } from './borders';
8
9
  import type { Scale } from './scale';
9
10
  import type { SystemPalette } from './colors/types';
@@ -14,6 +15,7 @@ const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
14
15
  const lineHeights = getLineHeights(fontSizes);
15
16
  const borderWidths = getBorderWidths(scale.borderWidth);
16
17
  const space = getSpace(scale.space);
18
+ const sizes = getSizes(scale.size);
17
19
  const radii = getRadii(scale.radius);
18
20
 
19
21
  return {
@@ -25,6 +27,7 @@ const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
25
27
  lineHeights,
26
28
  borderWidths,
27
29
  space,
30
+ sizes,
28
31
  radii,
29
32
  };
30
33
  };
@@ -2,6 +2,8 @@ const BASE_BORDER_WIDTH = 1;
2
2
 
3
3
  const BASE_SPACE = 8;
4
4
 
5
+ const BASE_SIZE = 8;
6
+
5
7
  const BASE_FONT = 'BeVietnamPro';
6
8
 
7
9
  const BASE_FONT_SIZE = 10;
@@ -11,6 +13,7 @@ const BASE_RADIUS = 4;
11
13
  const scale = {
12
14
  borderWidth: BASE_BORDER_WIDTH,
13
15
  space: BASE_SPACE,
16
+ size: BASE_SIZE,
14
17
  font: BASE_FONT,
15
18
  fontSize: BASE_FONT_SIZE,
16
19
  radius: BASE_RADIUS,
@@ -0,0 +1,29 @@
1
+ import { getSpace } from './space';
2
+ import type { Space } from './space';
3
+ import { scale } from '../../utils/scale';
4
+
5
+ interface Sizes extends Space {
6
+ xxxxxlarge: number;
7
+ '6xlarge': number;
8
+ '7xlarge': number;
9
+ '9xlarge': number;
10
+ '14xlarge': number;
11
+ '15xlarge': number;
12
+ '18xlarge': number;
13
+ '19xlarge': number;
14
+ }
15
+
16
+ const getSizes = (baseSize: number): Sizes => ({
17
+ ...getSpace(baseSize),
18
+ xxxxxlarge: scale(baseSize * 8), // 64
19
+ '6xlarge': scale(baseSize * 9), // 72
20
+ '7xlarge': scale(baseSize * 10), // 80
21
+ '9xlarge': scale(baseSize * 12), // 96
22
+ '14xlarge': scale(baseSize * 17), // 136
23
+ '15xlarge': scale(baseSize * 18), // 144
24
+ '18xlarge': scale(baseSize * 21), // 168
25
+ '19xlarge': scale(baseSize * 22), // 176
26
+ });
27
+
28
+ export { getSizes };
29
+ export type { Sizes };
package/src/types.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ToolbarButtonName } from './components/RichTextEditor';
2
1
  import type { BottomNavigationTabType } from './components/BottomNavigation';
3
2
  import type { IconName } from './components/Icon';
4
3
  import type { SingleSelectProps, MultiSelectProps } from './components/Select';
@@ -26,5 +25,4 @@ export type {
26
25
  TabType,
27
26
  TextInputProps,
28
27
  Theme,
29
- ToolbarButtonName,
30
28
  };
@@ -1,3 +1,7 @@
1
+ /* eslint-disable react/prop-types */
2
+ /* eslint-disable react/destructuring-assignment */
3
+ /* eslint-disable react/prefer-stateless-function */
4
+ /* eslint-disable max-classes-per-file */
1
5
  jest.mock('react-native-vector-icons', () => ({
2
6
  createIconSetFromIcoMoon: jest.fn(() => 'HeroIcon'),
3
7
  }));
@@ -52,6 +56,16 @@ jest.mock('@react-native-community/datetimepicker', () => {
52
56
  };
53
57
  });
54
58
 
59
+ jest.mock('@react-native-community/slider', () => {
60
+ const React = jest.requireActual('react');
61
+
62
+ return class Slider extends React.Component {
63
+ render() {
64
+ return React.createElement('Slider', this.props, this.props.children);
65
+ }
66
+ };
67
+ });
68
+
55
69
  jest.mock('react-native-webview', () => {
56
70
  const React = jest.requireActual('react');
57
71
 
@@ -17,6 +17,10 @@ interface BottomSheetProps {
17
17
  * Bottom sheet's content.
18
18
  */
19
19
  children?: ReactNode;
20
+ /**
21
+ * Callback is called when the Bottom Sheet finishes running animation.
22
+ */
23
+ onAnimationEnd?: () => void;
20
24
  /**
21
25
  * Callback is called when the Bottom Sheet is opened.
22
26
  */
@@ -51,5 +55,5 @@ interface BottomSheetProps {
51
55
  */
52
56
  testID?: string;
53
57
  }
54
- declare const BottomSheet: ({ open, header, footer, children, onOpen, onRequestClose, onDismiss, showCloseButton, hasBackdrop, showDivider, style, testID, }: BottomSheetProps) => JSX.Element;
58
+ declare const BottomSheet: ({ open, header, footer, children, onAnimationEnd, onOpen, onRequestClose, onDismiss, showCloseButton, hasBackdrop, showDivider, style, testID, }: BottomSheetProps) => JSX.Element;
55
59
  export default BottomSheet;
@@ -6,12 +6,6 @@ declare const StyledWrapper: import("@emotion/native").StyledComponent<import("r
6
6
  }, {}, {
7
7
  ref?: import("react").Ref<View>;
8
8
  }>;
9
- declare const StyledIllustration: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
10
- theme?: import("@emotion/react").Theme;
11
- as?: import("react").ElementType<any>;
12
- }, {}, {
13
- ref?: import("react").Ref<View>;
14
- }>;
15
9
  declare const StyledTitle: import("@emotion/native").StyledComponent<import("react-native").TextProps & {
16
10
  theme?: import("@emotion/react").Theme;
17
11
  as?: import("react").ElementType<any>;
@@ -28,4 +22,4 @@ declare const StyledDescription: import("@emotion/native").StyledComponent<impor
28
22
  }, {}, {
29
23
  ref?: import("react").Ref<Text>;
30
24
  }>;
31
- export { StyledWrapper, StyledIllustration, StyledTitle, StyledDescription };
25
+ export { StyledWrapper, StyledTitle, StyledDescription };
@@ -1,5 +1,11 @@
1
- import type { StyleProp, ViewStyle } from 'react-native';
1
+ import type { ReactElement } from 'react';
2
+ import type { StyleProp, ViewStyle, ImageProps as RNImageProps } from 'react-native';
3
+ import { ImageProps } from '../Image';
2
4
  interface EmptyProps {
5
+ /**
6
+ * Image to be displayed.
7
+ */
8
+ image?: ReactElement<ImageProps | RNImageProps>;
3
9
  /**
4
10
  * Empty's title.
5
11
  */
@@ -22,5 +28,5 @@ interface EmptyProps {
22
28
  */
23
29
  testID?: string;
24
30
  }
25
- declare const Empty: ({ title, description, style, testID, variant, }: EmptyProps) => JSX.Element;
31
+ declare const Empty: ({ image, title, description, style, testID, variant, }: EmptyProps) => JSX.Element;
26
32
  export default Empty;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { ImageProps as RNImageProps } from 'react-native';
2
+ export interface ImageProps extends RNImageProps {
3
+ /**
4
+ * Whether the image is rounded.
5
+ */
6
+ rounded?: boolean;
7
+ /**
8
+ * Image sizes, following the same sizes as the `sizes` global theme.
9
+ */
10
+ size?: '6xlarge' | '15xlarge';
11
+ /**
12
+ * Testing id of the component.
13
+ */
14
+ testID?: string;
15
+ }
16
+ declare const Image: ({ rounded, size, testID, style, ...imageNativeProps }: ImageProps) => JSX.Element;
17
+ export default Image;
@@ -1,4 +1,4 @@
1
- import { ToolbarButtonName } from './constants';
1
+ import { ToolbarButtonName } from './types';
2
2
  export interface EditorToolbarProps {
3
3
  /**
4
4
  * List of buttons to display in toolbar
@@ -9,6 +9,10 @@ export declare type EditorValue = {
9
9
  children: any;
10
10
  }[];
11
11
  export interface RichTextEditorProps {
12
+ /**
13
+ * If true, the editor will be focused when the user enters the screen
14
+ */
15
+ autoFocus?: boolean;
12
16
  /**
13
17
  * Error message
14
18
  */
@@ -7,13 +7,3 @@ export declare enum ToolbarEvents {
7
7
  HeadingOne = "heading-one",
8
8
  HeadingTwo = "heading-two"
9
9
  }
10
- export declare enum ToolbarButtonName {
11
- Bold = "bold",
12
- Italic = "italic",
13
- Underline = "underline",
14
- BulletedList = "bulletedList",
15
- NumberedList = "numberedList",
16
- HeadingOne = "headingOne",
17
- HeadingTwo = "headingTwo",
18
- Seperator = "|"
19
- }
@@ -1,7 +1,5 @@
1
- import { ToolbarButtonName } from './constants';
2
1
  import type { RichTextEditorProps, RichTextEditorRef } from './RichTextEditor';
3
2
  export type { RichTextEditorProps, RichTextEditorRef };
4
- export { ToolbarButtonName };
5
3
  declare const _default: import("react").ForwardRefExoticComponent<Omit<RichTextEditorProps, "forwardedRef"> & import("react").RefAttributes<RichTextEditorRef>> & {
6
4
  MentionList: ({ name: eventPrefix, render }: import("./MentionList").MentionListProps) => JSX.Element;
7
5
  Toolbar: ({ name, buttons, testID, }: import("./EditorToolbar").EditorToolbarProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare type ToolbarButtonName = 'bold' | 'italic' | 'underline' | 'bulletedList' | 'numberedList' | 'headingOne' | 'headingTwo' | '|';
@@ -1,8 +1,11 @@
1
+ import React from 'react';
2
+ import type { SectionList } from 'react-native';
1
3
  import type { MultiSelectProps } from '.';
2
- import type { OptionType, SectionData } from '../types';
4
+ import type { OptionType, SectionData, SectionType } from '../types';
3
5
  declare type OptionListProps<V, T extends OptionType<V>> = Pick<MultiSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
4
6
  onPress: (value: V[]) => void;
5
7
  sections: SectionData<V, T>[];
8
+ sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
6
9
  };
7
- declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, }: OptionListProps<V, T>) => JSX.Element;
10
+ declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, sectionListRef, }: OptionListProps<V, T>) => JSX.Element;
8
11
  export default OptionList;
@@ -1,3 +1,5 @@
1
+ import React from 'react';
2
+ import type { TextInputProps as NativeTextInputProps } from 'react-native';
1
3
  import type { OptionType, SelectProps } from '../types';
2
4
  export interface MultiSelectProps<V, T extends OptionType<V> = OptionType<V>> extends SelectProps<V, T> {
3
5
  /**
@@ -12,6 +14,10 @@ export interface MultiSelectProps<V, T extends OptionType<V> = OptionType<V>> ex
12
14
  * Footer label.
13
15
  */
14
16
  footerLabel: string;
17
+ /**
18
+ * Customise the selected value rendering.
19
+ */
20
+ renderSelectedValue?: (selectedValue: V[], inputProps: NativeTextInputProps) => React.ReactNode;
15
21
  }
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;
22
+ declare function MultiSelect<V, T extends OptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: MultiSelectProps<V, T>): JSX.Element;
17
23
  export default MultiSelect;
@@ -1,8 +1,11 @@
1
+ import React from 'react';
2
+ import type { SectionList } from 'react-native';
1
3
  import type { SingleSelectProps } from '.';
2
- import type { OptionType, SectionData } from '../types';
4
+ import type { OptionType, SectionData, SectionType } from '../types';
3
5
  declare type OptionListProps<V, T extends OptionType<V>> = Pick<SingleSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
4
6
  onPress: (value: V | null) => void;
5
7
  sections: SectionData<V, T>[];
8
+ sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
6
9
  };
7
- declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, }: OptionListProps<V, T>) => JSX.Element;
10
+ declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, sectionListRef, }: OptionListProps<V, T>) => JSX.Element;
8
11
  export default OptionList;
@@ -1,3 +1,5 @@
1
+ import React from 'react';
2
+ import type { TextInputProps as NativeTextInputProps } from 'react-native';
1
3
  import type { OptionType, SelectProps } from '../types';
2
4
  export interface SingleSelectProps<V, T extends OptionType<V> = OptionType<V>> extends SelectProps<V, T> {
3
5
  /**
@@ -5,9 +7,13 @@ export interface SingleSelectProps<V, T extends OptionType<V> = OptionType<V>> e
5
7
  */
6
8
  value: V | null;
7
9
  /**
8
- * on select event handler
10
+ * On select event handler
9
11
  */
10
12
  onConfirm: (value: V | null) => void;
13
+ /**
14
+ * Customise the selected value rendering.
15
+ */
16
+ renderSelectedValue?: (selectedValue: V | null, inputProps: NativeTextInputProps) => React.ReactNode;
11
17
  }
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;
18
+ declare const SingleSelect: <V, T extends 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;
13
19
  export default SingleSelect;
@@ -1,11 +1,12 @@
1
+ import React from 'react';
2
+ import { SectionList } from 'react-native';
1
3
  import type { ReactElement } from 'react';
2
4
  import type { SectionListRenderItemInfo } from 'react-native';
3
- import type { ScrollParams } from './helpers';
4
5
  import type { SectionData, OptionType, SelectProps, SectionType } from './types';
5
6
  export declare type StyledOptionListProps<V, T extends OptionType<V>> = Pick<SelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange'> & {
6
- scrollParams: ScrollParams;
7
7
  sections: SectionData<V, T>[];
8
8
  renderItem: (info: SectionListRenderItemInfo<T, SectionType>) => ReactElement;
9
+ sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
9
10
  };
10
- declare const StyledOptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, scrollParams, }: StyledOptionListProps<V, T>) => JSX.Element;
11
+ declare const StyledOptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, sectionListRef, }: StyledOptionListProps<V, T>) => JSX.Element;
11
12
  export default StyledOptionList;
@@ -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, 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, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
6
6
  Multi: typeof MultiSelect;
7
7
  };
8
8
  export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ export interface SliderProps {
3
+ /**
4
+ * Minimum value of the slider.
5
+ * Defaults to 0.
6
+ */
7
+ minimumValue?: number;
8
+ /**
9
+ * Maximum value of the slider.
10
+ * Defaults to 1.
11
+ */
12
+ maximumValue?: number;
13
+ /**
14
+ * Step value of the slider.
15
+ * The value should be between 0 and (maximumValue - minimumValue).
16
+ * Defaults to 0.
17
+ */
18
+ step?: number;
19
+ /**
20
+ * Value of the slider.
21
+ * Defaults to 0.
22
+ */
23
+ value?: number;
24
+ /**
25
+ * Callback continuously called while the user is dragging the slider.
26
+ */
27
+ onValueChange?: (value: number) => void;
28
+ /**
29
+ * Callback that is called when the user picks up the slider.
30
+ * The initial value is passed as an argument to the callback handler.
31
+ */
32
+ onSlidingStart?: (value: number) => void;
33
+ /**
34
+ * Callback that is called when the user releases the slider, regardless if the value has changed.
35
+ * The current value is passed as an argument to the callback handler.
36
+ */
37
+ onSlidingComplete?: (value: number) => void;
38
+ /**
39
+ * Whether the slider is disabled.
40
+ */
41
+ disabled?: boolean;
42
+ /**
43
+ * Additional style.
44
+ */
45
+ style?: StyleProp<ViewStyle>;
46
+ /**
47
+ * Testing id of the component.
48
+ */
49
+ testID?: string;
50
+ }
51
+ export declare const Slider: ({ minimumValue, maximumValue, step, value, onValueChange, onSlidingStart, onSlidingComplete, disabled, style, testID, }: SliderProps) => JSX.Element;
52
+ export default Slider;
@@ -51,6 +51,7 @@ export interface TextInputProps extends NativeTextInputProps {
51
51
  loading?: boolean;
52
52
  maxLength?: number;
53
53
  helpText?: string;
54
+ renderInputValue?: (inputProps: NativeTextInputProps) => React.ReactNode;
54
55
  }
55
56
  export declare const getVariant: ({ disabled, error, editable, loading, isFocused, isEmptyValue, }: {
56
57
  disabled?: boolean;
@@ -60,5 +61,5 @@ export declare const getVariant: ({ disabled, error, editable, loading, isFocuse
60
61
  isFocused?: boolean;
61
62
  isEmptyValue?: boolean;
62
63
  }) => Variant;
63
- declare const TextInput: ({ label, prefix, suffix, style, textStyle, testID, accessibilityLabelledBy, error, required, editable, disabled, loading, maxLength, helpText, value, defaultValue, ...nativeProps }: TextInputProps) => JSX.Element;
64
+ declare const TextInput: ({ label, prefix, suffix, style, textStyle, testID, accessibilityLabelledBy, error, required, editable, disabled, loading, maxLength, helpText, value, defaultValue, renderInputValue, ...nativeProps }: TextInputProps) => JSX.Element;
64
65
  export default TextInput;
package/types/index.d.ts CHANGED
@@ -19,9 +19,11 @@ import Drawer from './components/Drawer';
19
19
  import Empty from './components/Empty';
20
20
  import FAB from './components/FAB';
21
21
  import Icon from './components/Icon';
22
+ import Image from './components/Image';
22
23
  import List from './components/List';
23
24
  import PinInput from './components/PinInput';
24
25
  import Progress from './components/Progress';
26
+ import Slider from './components/Slider';
25
27
  import Spinner from './components/Spinner';
26
28
  import Radio from './components/Radio';
27
29
  import SectionHeading from './components/SectionHeading';
@@ -35,5 +37,5 @@ import Toast from './components/Toast';
35
37
  import Toolbar from './components/Toolbar';
36
38
  import Typography from './components/Typography';
37
39
  import RichTextEditor from './components/RichTextEditor';
38
- export { theme, getTheme, useTheme, scale, ThemeProvider, swagSystemPalette, workSystemPalette, Accordion, Alert, Avatar, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, FAB, Icon, List, PinInput, Progress, Spinner, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RichTextEditor, };
40
+ export { theme, getTheme, useTheme, scale, ThemeProvider, swagSystemPalette, workSystemPalette, Accordion, Alert, Avatar, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, FAB, Icon, Image, List, PinInput, Progress, Slider, Spinner, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RichTextEditor, };
39
41
  export * from './types';
@@ -1,4 +1,5 @@
1
- declare const getDatePickerTheme: () => {
1
+ import { GlobalTheme } from '../global';
2
+ declare const getDatePickerTheme: (theme: GlobalTheme) => {
2
3
  sizes: {
3
4
  height: number;
4
5
  };
@@ -11,19 +11,16 @@ declare const getEmptyTheme: (theme: GlobalTheme) => {
11
11
  illustrationBackground: string;
12
12
  };
13
13
  sizes: {
14
- illustration: number;
14
+ image: number;
15
15
  };
16
16
  space: {
17
17
  titleMargin: number;
18
- illustrationMargin: number;
18
+ imageMargin: number;
19
19
  wrapperPadding: number;
20
20
  };
21
21
  fonts: {
22
22
  title: string;
23
23
  description: string;
24
24
  };
25
- radii: {
26
- illustration: number;
27
- };
28
25
  };
29
26
  export default getEmptyTheme;
@@ -0,0 +1,8 @@
1
+ import type { GlobalTheme } from '../global';
2
+ declare const getImageTheme: (theme: GlobalTheme) => {
3
+ sizes: {
4
+ '6xlarge': number;
5
+ '15xlarge': number;
6
+ };
7
+ };
8
+ export default getImageTheme;
@@ -0,0 +1,9 @@
1
+ import type { GlobalTheme } from '../global';
2
+ declare const getSliderTheme: (theme: GlobalTheme) => {
3
+ colors: {
4
+ minimumTrackTint: string;
5
+ thumbTint: string;
6
+ maximumTrackTint: string;
7
+ };
8
+ };
9
+ export default getSliderTheme;
@@ -9,6 +9,20 @@ declare const getSwitchTheme: (theme: GlobalTheme) => {
9
9
  };
10
10
  thumb: string;
11
11
  };
12
+ sizes: {
13
+ thumbs: {
14
+ small: number;
15
+ medium: number;
16
+ };
17
+ widths: {
18
+ small: number;
19
+ medium: number;
20
+ };
21
+ heights: {
22
+ small: number;
23
+ medium: number;
24
+ };
25
+ };
12
26
  thumbSizes: {
13
27
  small: number;
14
28
  medium: number;
@@ -24,7 +38,6 @@ declare const getSwitchTheme: (theme: GlobalTheme) => {
24
38
  spaces: {
25
39
  small: number;
26
40
  medium: number;
27
- inactive: number;
28
41
  };
29
42
  radii: {
30
43
  rounded: number;
@@ -1,4 +1,5 @@
1
- declare const getTimePickerTheme: () => {
1
+ import { GlobalTheme } from '../global';
2
+ declare const getTimePickerTheme: (theme: GlobalTheme) => {
2
3
  sizes: {
3
4
  height: number;
4
5
  };