@sendbird/uikit-react-native-foundation 1.0.0-rc.4 → 1.0.2

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 (113) hide show
  1. package/lib/commonjs/components/Image/index.js.map +1 -1
  2. package/lib/commonjs/styles/HeaderStyleContext.js.map +1 -1
  3. package/lib/commonjs/theme/UIKitThemeProvider.js.map +1 -1
  4. package/lib/commonjs/ui/ActionMenu/index.js.map +1 -1
  5. package/lib/commonjs/ui/Alert/index.js.map +1 -1
  6. package/lib/commonjs/ui/Avatar/AvatarGroup.js.map +1 -1
  7. package/lib/commonjs/ui/Avatar/AvatarIcon.js.map +1 -1
  8. package/lib/commonjs/ui/Avatar/index.js.map +1 -1
  9. package/lib/commonjs/ui/Badge/index.js.map +1 -1
  10. package/lib/commonjs/ui/BottomSheet/index.js.map +1 -1
  11. package/lib/commonjs/ui/Button/index.js.map +1 -1
  12. package/lib/commonjs/ui/ChannelFrozenBanner/index.js.map +1 -1
  13. package/lib/commonjs/ui/Dialog/DialogBox.js.map +1 -1
  14. package/lib/commonjs/ui/Dialog/DialogSheet.js.map +1 -1
  15. package/lib/commonjs/ui/Dialog/index.js.map +1 -1
  16. package/lib/commonjs/ui/Divider/index.js.map +1 -1
  17. package/lib/commonjs/ui/GroupChannelPreview/index.js.map +1 -1
  18. package/lib/commonjs/ui/Header/index.js.map +1 -1
  19. package/lib/commonjs/ui/Icon/index.js.map +1 -1
  20. package/lib/commonjs/ui/LoadingSpinner/index.js.map +1 -1
  21. package/lib/commonjs/ui/MenuBar/index.js.map +1 -1
  22. package/lib/commonjs/ui/Modal/index.js.map +1 -1
  23. package/lib/commonjs/ui/Placeholder/index.js.map +1 -1
  24. package/lib/commonjs/ui/Prompt/index.js.map +1 -1
  25. package/lib/commonjs/ui/Switch/index.js.map +1 -1
  26. package/lib/commonjs/ui/Text/index.js.map +1 -1
  27. package/lib/commonjs/ui/Toast/index.js.map +1 -1
  28. package/lib/commonjs/ui/URLParsedText/index.js.map +1 -1
  29. package/lib/module/components/Image/index.js.map +1 -1
  30. package/lib/module/styles/HeaderStyleContext.js.map +1 -1
  31. package/lib/module/theme/UIKitThemeProvider.js.map +1 -1
  32. package/lib/module/ui/ActionMenu/index.js.map +1 -1
  33. package/lib/module/ui/Alert/index.js.map +1 -1
  34. package/lib/module/ui/Avatar/AvatarGroup.js.map +1 -1
  35. package/lib/module/ui/Avatar/AvatarIcon.js.map +1 -1
  36. package/lib/module/ui/Avatar/index.js.map +1 -1
  37. package/lib/module/ui/Badge/index.js.map +1 -1
  38. package/lib/module/ui/BottomSheet/index.js.map +1 -1
  39. package/lib/module/ui/Button/index.js.map +1 -1
  40. package/lib/module/ui/ChannelFrozenBanner/index.js.map +1 -1
  41. package/lib/module/ui/Dialog/DialogBox.js.map +1 -1
  42. package/lib/module/ui/Dialog/DialogSheet.js.map +1 -1
  43. package/lib/module/ui/Dialog/index.js.map +1 -1
  44. package/lib/module/ui/Divider/index.js.map +1 -1
  45. package/lib/module/ui/GroupChannelPreview/index.js.map +1 -1
  46. package/lib/module/ui/Header/index.js.map +1 -1
  47. package/lib/module/ui/Icon/index.js.map +1 -1
  48. package/lib/module/ui/LoadingSpinner/index.js.map +1 -1
  49. package/lib/module/ui/MenuBar/index.js.map +1 -1
  50. package/lib/module/ui/Modal/index.js.map +1 -1
  51. package/lib/module/ui/Placeholder/index.js.map +1 -1
  52. package/lib/module/ui/Prompt/index.js.map +1 -1
  53. package/lib/module/ui/Switch/index.js.map +1 -1
  54. package/lib/module/ui/Text/index.js.map +1 -1
  55. package/lib/module/ui/Toast/index.js.map +1 -1
  56. package/lib/module/ui/URLParsedText/index.js.map +1 -1
  57. package/lib/typescript/src/components/Image/index.d.ts +1 -2
  58. package/lib/typescript/src/styles/HeaderStyleContext.d.ts +1 -1
  59. package/lib/typescript/src/theme/UIKitThemeProvider.d.ts +3 -3
  60. package/lib/typescript/src/ui/ActionMenu/index.d.ts +1 -2
  61. package/lib/typescript/src/ui/Alert/index.d.ts +1 -2
  62. package/lib/typescript/src/ui/Avatar/AvatarGroup.d.ts +3 -3
  63. package/lib/typescript/src/ui/Avatar/AvatarIcon.d.ts +1 -2
  64. package/lib/typescript/src/ui/Avatar/index.d.ts +1 -2
  65. package/lib/typescript/src/ui/Badge/index.d.ts +1 -2
  66. package/lib/typescript/src/ui/BottomSheet/index.d.ts +1 -2
  67. package/lib/typescript/src/ui/Button/index.d.ts +3 -3
  68. package/lib/typescript/src/ui/ChannelFrozenBanner/index.d.ts +1 -2
  69. package/lib/typescript/src/ui/Dialog/DialogBox.d.ts +3 -3
  70. package/lib/typescript/src/ui/Dialog/DialogSheet.d.ts +4 -4
  71. package/lib/typescript/src/ui/Dialog/index.d.ts +3 -3
  72. package/lib/typescript/src/ui/Divider/index.d.ts +1 -2
  73. package/lib/typescript/src/ui/GroupChannelPreview/index.d.ts +1 -1
  74. package/lib/typescript/src/ui/Header/index.d.ts +6 -10
  75. package/lib/typescript/src/ui/Icon/index.d.ts +1 -2
  76. package/lib/typescript/src/ui/LoadingSpinner/index.d.ts +1 -2
  77. package/lib/typescript/src/ui/MenuBar/index.d.ts +1 -1
  78. package/lib/typescript/src/ui/Modal/index.d.ts +1 -2
  79. package/lib/typescript/src/ui/Placeholder/index.d.ts +1 -2
  80. package/lib/typescript/src/ui/Prompt/index.d.ts +1 -2
  81. package/lib/typescript/src/ui/Switch/index.d.ts +3 -3
  82. package/lib/typescript/src/ui/Text/index.d.ts +1 -2
  83. package/lib/typescript/src/ui/Toast/index.d.ts +5 -5
  84. package/lib/typescript/src/ui/URLParsedText/index.d.ts +1 -2
  85. package/package.json +5 -5
  86. package/src/components/Image/index.ts +1 -2
  87. package/src/styles/HeaderStyleContext.tsx +2 -2
  88. package/src/theme/UIKitThemeProvider.tsx +4 -2
  89. package/src/ui/ActionMenu/index.tsx +1 -1
  90. package/src/ui/Alert/index.tsx +1 -8
  91. package/src/ui/Avatar/AvatarGroup.tsx +5 -2
  92. package/src/ui/Avatar/AvatarIcon.tsx +1 -1
  93. package/src/ui/Avatar/index.tsx +12 -3
  94. package/src/ui/Badge/index.tsx +1 -1
  95. package/src/ui/BottomSheet/index.tsx +1 -1
  96. package/src/ui/Button/index.tsx +4 -4
  97. package/src/ui/ChannelFrozenBanner/index.tsx +1 -1
  98. package/src/ui/Dialog/DialogBox.tsx +3 -3
  99. package/src/ui/Dialog/DialogSheet.tsx +4 -4
  100. package/src/ui/Dialog/index.tsx +3 -3
  101. package/src/ui/Divider/index.tsx +1 -1
  102. package/src/ui/GroupChannelPreview/index.tsx +2 -2
  103. package/src/ui/Header/index.tsx +6 -12
  104. package/src/ui/Icon/index.tsx +7 -2
  105. package/src/ui/LoadingSpinner/index.tsx +2 -2
  106. package/src/ui/MenuBar/index.tsx +2 -2
  107. package/src/ui/Modal/index.tsx +2 -2
  108. package/src/ui/Placeholder/index.tsx +1 -1
  109. package/src/ui/Prompt/index.tsx +2 -2
  110. package/src/ui/Switch/index.tsx +4 -4
  111. package/src/ui/Text/index.tsx +1 -1
  112. package/src/ui/Toast/index.tsx +8 -4
  113. package/src/ui/URLParsedText/index.tsx +1 -1
@@ -6,10 +6,10 @@ import useUIKitTheme from '../../theme/useUIKitTheme';
6
6
  import Icon from '../Icon';
7
7
  import Text from '../Text';
8
8
 
9
- type Props = {
9
+ type Props = React.PropsWithChildren<{
10
10
  style?: StyleProp<ViewStyle>;
11
- };
12
- const DialogSheet: React.FC<Props> & { Item: typeof SheetItem } = ({ style, children }) => {
11
+ }>;
12
+ const DialogSheet: ((props: Props) => JSX.Element) & { Item: typeof SheetItem } = ({ style, children }) => {
13
13
  const { colors } = useUIKitTheme();
14
14
  return (
15
15
  <View style={[styles.container, { backgroundColor: colors.ui.dialog.default.none.background }, style]}>
@@ -24,7 +24,7 @@ export type SheetItemProps = {
24
24
  title: string;
25
25
  titleColor?: string;
26
26
  };
27
- const SheetItem: React.FC<SheetItemProps> = ({ icon, title, iconColor, titleColor }) => {
27
+ const SheetItem = ({ icon, title, iconColor, titleColor }: SheetItemProps) => {
28
28
  const { colors } = useUIKitTheme();
29
29
  return (
30
30
  <View style={[styles.sheetItemContainer, { backgroundColor: colors.ui.dialog.default.none.background }]}>
@@ -45,14 +45,14 @@ const ActionMenuContext = React.createContext<Pick<DialogContextType, 'openMenu'
45
45
  const PromptContext = React.createContext<Pick<DialogContextType, 'openPrompt'> | null>(null);
46
46
  const BottomSheetContext = React.createContext<Pick<DialogContextType, 'openSheet'> | null>(null);
47
47
 
48
- type Props = {
48
+ type Props = React.PropsWithChildren<{
49
49
  defaultLabels?: {
50
50
  alert?: { ok?: string };
51
51
  prompt?: { placeholder?: string; ok?: string; cancel?: string };
52
52
  };
53
- };
53
+ }>;
54
54
  const DISMISS_TIMEOUT = 3000;
55
- export const DialogProvider: React.FC<Props> = ({ defaultLabels, children }) => {
55
+ export const DialogProvider = ({ defaultLabels, children }: Props) => {
56
56
  const waitDismissTimeout = useRef<NodeJS.Timeout>();
57
57
  const waitDismissPromise = useRef<() => void>();
58
58
  const waitDismiss = useCallback((resolver: () => void) => {
@@ -9,7 +9,7 @@ type Props = {
9
9
  space?: number;
10
10
  };
11
11
 
12
- const Divider: React.FC<Props> = ({ style, space }) => {
12
+ const Divider = ({ style, space }: Props) => {
13
13
  const { colors } = useUIKitTheme();
14
14
  return (
15
15
  <View style={[style, styles.divider, { paddingHorizontal: space }]}>
@@ -27,7 +27,7 @@ type Props = {
27
27
  notificationOff?: boolean;
28
28
  };
29
29
 
30
- const GroupChannelPreview: React.FC<Props> = ({
30
+ const GroupChannelPreview = ({
31
31
  customCover,
32
32
  coverUrl,
33
33
  memberCount,
@@ -39,7 +39,7 @@ const GroupChannelPreview: React.FC<Props> = ({
39
39
  titleCaption,
40
40
  frozen,
41
41
  notificationOff,
42
- }) => {
42
+ }: Props) => {
43
43
  const { colors } = useUIKitTheme();
44
44
  const color = colors.ui.groupChannelPreview;
45
45
 
@@ -24,7 +24,7 @@ type HeaderProps = BaseHeaderProps<
24
24
  >;
25
25
 
26
26
  const AlignMapper = { left: 'flex-start', center: 'center', right: 'flex-end' } as const;
27
- const Header: React.FC<HeaderProps> & {
27
+ const Header: ((props: HeaderProps) => JSX.Element) & {
28
28
  Button: typeof HeaderButton;
29
29
  Title: typeof HeaderTitle;
30
30
  Subtitle: typeof HeaderSubtitle;
@@ -82,7 +82,7 @@ const Header: React.FC<HeaderProps> & {
82
82
  );
83
83
  };
84
84
 
85
- const LeftSide: React.FC<HeaderProps> = ({ titleAlign, onPressLeft, left }) => {
85
+ const LeftSide = ({ titleAlign, onPressLeft, left }: HeaderProps) => {
86
86
  if (titleAlign === 'center') {
87
87
  return <View style={styles.left}>{left && <HeaderButton onPress={onPressLeft}>{left}</HeaderButton>}</View>;
88
88
  }
@@ -94,7 +94,7 @@ const LeftSide: React.FC<HeaderProps> = ({ titleAlign, onPressLeft, left }) => {
94
94
  );
95
95
  };
96
96
 
97
- const RightSide: React.FC<HeaderProps> = ({ titleAlign, onPressRight, right }) => {
97
+ const RightSide = ({ titleAlign, onPressRight, right }: HeaderProps) => {
98
98
  if (titleAlign === 'center') {
99
99
  return <View style={styles.right}>{right && <HeaderButton onPress={onPressRight}>{right}</HeaderButton>}</View>;
100
100
  }
@@ -106,14 +106,14 @@ const RightSide: React.FC<HeaderProps> = ({ titleAlign, onPressRight, right }) =
106
106
  );
107
107
  };
108
108
 
109
- const HeaderTitle: React.FC<{ children: string } & TextProps> = ({ children, style, ...props }) => {
109
+ const HeaderTitle = ({ children, style, ...props }: TextProps) => {
110
110
  return (
111
111
  <Text {...props} h1 numberOfLines={1} style={style}>
112
112
  {children}
113
113
  </Text>
114
114
  );
115
115
  };
116
- const HeaderSubtitle: React.FC<{ children: string } & TextProps> = ({ children, style, ...props }) => {
116
+ const HeaderSubtitle = ({ children, style, ...props }: TextProps) => {
117
117
  const { colors } = useUIKitTheme();
118
118
  return (
119
119
  <Text color={colors.onBackground03} {...props} caption2 numberOfLines={1} style={style}>
@@ -121,13 +121,7 @@ const HeaderSubtitle: React.FC<{ children: string } & TextProps> = ({ children,
121
121
  </Text>
122
122
  );
123
123
  };
124
- const HeaderButton: React.FC<TouchableOpacityProps & { color?: string }> = ({
125
- children,
126
- disabled,
127
- onPress,
128
- color,
129
- ...props
130
- }) => {
124
+ const HeaderButton = ({ children, disabled, onPress, color, ...props }: TouchableOpacityProps & { color?: string }) => {
131
125
  return (
132
126
  <TouchableOpacity
133
127
  style={styles.button}
@@ -15,8 +15,13 @@ type Props = {
15
15
  style?: StyleProp<ImageStyle>;
16
16
  containerStyle?: StyleProp<ViewStyle>;
17
17
  };
18
-
19
- const Icon: React.FC<Props> & { Assets: typeof IconAssets } = ({ icon, color, size = 24, containerStyle, style }) => {
18
+ const Icon: ((props: Props) => JSX.Element) & { Assets: typeof IconAssets } = ({
19
+ icon,
20
+ color,
21
+ size = 24,
22
+ containerStyle,
23
+ style,
24
+ }) => {
20
25
  const sizeStyle = sizeStyles[size as SizeFactor] ?? { width: size, height: size };
21
26
  const { colors } = useUIKitTheme();
22
27
  return (
@@ -10,7 +10,7 @@ type Props = {
10
10
  style?: StyleProp<ViewStyle>;
11
11
  };
12
12
 
13
- const LoadingSpinner: React.FC<Props> = ({ size = 24, color, style }) => {
13
+ const LoadingSpinner = ({ size = 24, color, style }: Props) => {
14
14
  const { colors } = useUIKitTheme();
15
15
  return (
16
16
  <Rotate style={style}>
@@ -37,7 +37,7 @@ const useLoopAnimated = (duration: number, useNativeDriver = true) => {
37
37
  return animated;
38
38
  };
39
39
 
40
- const Rotate: React.FC<{ style: StyleProp<ViewStyle> }> = ({ children, style }) => {
40
+ const Rotate = ({ children, style }: React.PropsWithChildren<{ style: StyleProp<ViewStyle> }>) => {
41
41
  const loop = useLoopAnimated(1000);
42
42
  const rotate = loop.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '360deg'] });
43
43
  return <Animated.View style={[style, { transform: [{ rotate }] }]}>{children}</Animated.View>;
@@ -23,7 +23,7 @@ export type MenuBarProps = {
23
23
  actionLabel?: string;
24
24
  actionItem?: React.ReactNode;
25
25
  };
26
- const MenuBar: React.FC<MenuBarProps> = ({
26
+ const MenuBar = ({
27
27
  variant = 'default',
28
28
  disabled,
29
29
  onPress,
@@ -33,7 +33,7 @@ const MenuBar: React.FC<MenuBarProps> = ({
33
33
  iconBackgroundColor,
34
34
  actionLabel,
35
35
  actionItem = null,
36
- }) => {
36
+ }: MenuBarProps) => {
37
37
  const { palette, colors } = useUIKitTheme();
38
38
 
39
39
  return (
@@ -34,7 +34,7 @@ type Props = {
34
34
  * Modal Close: Triggered by Modal.props.onClose() call
35
35
  * - Modal.props.onClose() -> visible false -> animation start -> modalVisible false
36
36
  * */
37
- const Modal: React.FC<Props> = ({
37
+ const Modal = ({
38
38
  children,
39
39
  onClose,
40
40
  backgroundStyle,
@@ -45,7 +45,7 @@ const Modal: React.FC<Props> = ({
45
45
  enableKeyboardAvoid = false,
46
46
  statusBarTranslucent,
47
47
  ...props
48
- }) => {
48
+ }: Props) => {
49
49
  const { palette } = useUIKitTheme();
50
50
  const { content, backdrop, showTransition, hideTransition } = useModalAnimation(type);
51
51
  const panResponder = useModalPanResponder(type, content.translateY, showTransition, onClose);
@@ -19,7 +19,7 @@ type Props = {
19
19
  onPressRetry?: () => void;
20
20
  };
21
21
 
22
- const Placeholder: React.FC<Props> = ({ icon, loading = false, message = '', errorRetryLabel, onPressRetry }) => {
22
+ const Placeholder = ({ icon, loading = false, message = '', errorRetryLabel, onPressRetry }: Props) => {
23
23
  const { colors } = useUIKitTheme();
24
24
 
25
25
  // loading ? styles.containerLoading : errorRetryLabel ? styles.containerError : styles.container
@@ -28,7 +28,7 @@ type Props = {
28
28
  onDismiss?: () => void;
29
29
  autoFocus?: boolean;
30
30
  } & PromptItem;
31
- const Prompt: React.FC<Props> = ({
31
+ const Prompt = ({
32
32
  onDismiss,
33
33
  visible,
34
34
  onHide,
@@ -40,7 +40,7 @@ const Prompt: React.FC<Props> = ({
40
40
  onCancel = NOOP,
41
41
  submitLabel = 'Submit',
42
42
  cancelLabel = 'Cancel',
43
- }) => {
43
+ }: Props) => {
44
44
  const { statusBarTranslucent } = useHeaderStyle();
45
45
  const { colors } = useUIKitTheme();
46
46
  const inputRef = useRef<RNTextInput>(null);
@@ -4,7 +4,7 @@ import { Animated, Platform, Pressable } from 'react-native';
4
4
  import createStyleSheet from '../../styles/createStyleSheet';
5
5
  import useUIKitTheme from '../../theme/useUIKitTheme';
6
6
 
7
- interface SwitchProps {
7
+ type SwitchProps = React.PropsWithChildren<{
8
8
  trackColor?: string;
9
9
  thumbColor?: string;
10
10
  inactiveThumbColor?: string;
@@ -12,15 +12,15 @@ interface SwitchProps {
12
12
 
13
13
  value: boolean;
14
14
  onChangeValue: (val: boolean) => void;
15
- }
16
- const Switch: React.FC<SwitchProps> = ({
15
+ }>;
16
+ const Switch = ({
17
17
  value,
18
18
  onChangeValue,
19
19
  inactiveThumbColor,
20
20
  inactiveTrackColor,
21
21
  trackColor,
22
22
  thumbColor,
23
- }) => {
23
+ }: SwitchProps) => {
24
24
  const { select, palette, colors } = useUIKitTheme();
25
25
  const position = useRef(new Animated.Value(0)).current;
26
26
 
@@ -6,7 +6,7 @@ import type { TypoName, UIKitTheme } from '../../types';
6
6
 
7
7
  type TypographyProps = Partial<Record<TypoName, boolean>>;
8
8
  export type TextProps = RNTextProps & TypographyProps & { color?: ((colors: UIKitTheme['colors']) => string) | string };
9
- const Text: React.FC<TextProps> = ({ children, color, style, ...props }) => {
9
+ const Text = ({ children, color, style, ...props }: TextProps) => {
10
10
  const { colors } = useUIKitTheme();
11
11
  const typoStyle = useTypographyFilter(props);
12
12
  return (
@@ -12,13 +12,13 @@ type Context = { show(text: string, type?: ToastType): void };
12
12
 
13
13
  const ToastContext = createContext<Context | null>(null);
14
14
 
15
- type Props = {
15
+ type Props = React.PropsWithChildren<{
16
16
  top?: number;
17
17
  bottom?: number;
18
18
  visible: boolean;
19
19
  type: ToastType;
20
20
  children: string;
21
- };
21
+ }>;
22
22
 
23
23
  const useOpacity = () => {
24
24
  const opacity = useRef(new Animated.Value(0)).current;
@@ -32,7 +32,8 @@ const useOpacity = () => {
32
32
  hide: () => transition(0),
33
33
  };
34
34
  };
35
- const Toast: React.FC<Props> = ({ visible, type, children, top, bottom }) => {
35
+
36
+ const Toast = ({ visible, type, children, top, bottom }: Props) => {
36
37
  const { colors, select, palette } = useUIKitTheme();
37
38
  const { opacity, show, hide } = useOpacity();
38
39
 
@@ -67,7 +68,10 @@ const Toast: React.FC<Props> = ({ visible, type, children, top, bottom }) => {
67
68
  };
68
69
 
69
70
  const VISIBLE_MS = 3000;
70
- export const ToastProvider: React.FC<{ dismissTimeout?: number }> = ({ children, dismissTimeout = VISIBLE_MS }) => {
71
+ export const ToastProvider = ({
72
+ children,
73
+ dismissTimeout = VISIBLE_MS,
74
+ }: React.PropsWithChildren<{ dismissTimeout?: number }>) => {
71
75
  const [state, setState] = useState({ visible: false, type: 'error' as ToastType, text: '' });
72
76
  const { bottom } = useSafeAreaInsets();
73
77
 
@@ -18,7 +18,7 @@ type Props = TextProps & {
18
18
  onPressUrl?: OnPressUrl;
19
19
  strict?: boolean;
20
20
  };
21
- const URLParsedText: React.FC<Props> = ({ children, onPressUrl = openUrl, strict, ...props }) => {
21
+ const URLParsedText = ({ children, onPressUrl = openUrl, strict, ...props }: Props) => {
22
22
  const parsedChildren = useMemo((): React.ReactNode => {
23
23
  return React.Children.map(React.Children.toArray(children), (child) => {
24
24
  if (typeof child === 'string') {