@fountain-ui/core 3.0.0-alpha.10 → 3.0.0-alpha.12

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 (175) hide show
  1. package/build/commonjs/AppBar/AppBar.js +6 -1
  2. package/build/commonjs/AppBar/AppBar.js.map +1 -1
  3. package/build/commonjs/Badge/Badge.js +4 -3
  4. package/build/commonjs/Badge/Badge.js.map +1 -1
  5. package/build/commonjs/Badge/BadgeProps.js.map +1 -1
  6. package/build/commonjs/ButtonBase/index.js +2 -2
  7. package/build/commonjs/ButtonBase/index.js.map +1 -1
  8. package/build/commonjs/Chip/Chip.js +21 -14
  9. package/build/commonjs/Chip/Chip.js.map +1 -1
  10. package/build/commonjs/Chip/ChipProps.js +3 -1
  11. package/build/commonjs/Chip/ChipProps.js.map +1 -1
  12. package/build/commonjs/Chip/index.js +6 -0
  13. package/build/commonjs/Chip/index.js.map +1 -1
  14. package/build/commonjs/Chip/useChipStyle.js +29 -19
  15. package/build/commonjs/Chip/useChipStyle.js.map +1 -1
  16. package/build/commonjs/Dialog/Dialog.js +7 -8
  17. package/build/commonjs/Dialog/Dialog.js.map +1 -1
  18. package/build/commonjs/Dialog/DialogProps.js +1 -1
  19. package/build/commonjs/Dialog/DialogProps.js.map +1 -1
  20. package/build/commonjs/Dialog/useDialogSectionStyle.js +6 -4
  21. package/build/commonjs/Dialog/useDialogSectionStyle.js.map +1 -1
  22. package/build/commonjs/Dialog/useDialogStyle.js +9 -8
  23. package/build/commonjs/Dialog/useDialogStyle.js.map +1 -1
  24. package/build/commonjs/DialogTitle/DialogLargeTitle.js +80 -0
  25. package/build/commonjs/DialogTitle/DialogLargeTitle.js.map +1 -0
  26. package/build/commonjs/DialogTitle/DialogTitle.js +8 -4
  27. package/build/commonjs/DialogTitle/DialogTitle.js.map +1 -1
  28. package/build/commonjs/Divider/Divider.js +17 -9
  29. package/build/commonjs/Divider/Divider.js.map +1 -1
  30. package/build/commonjs/Divider/DividerProps.js +1 -1
  31. package/build/commonjs/Divider/DividerProps.js.map +1 -1
  32. package/build/commonjs/ListItem/ListItem.js +3 -13
  33. package/build/commonjs/ListItem/ListItem.js.map +1 -1
  34. package/build/commonjs/Pagination/Pagination.js +2 -0
  35. package/build/commonjs/Pagination/Pagination.js.map +1 -1
  36. package/build/commonjs/Pagination/PaginationProps.js +3 -1
  37. package/build/commonjs/Pagination/PaginationProps.js.map +1 -1
  38. package/build/commonjs/Pagination/index.js +6 -0
  39. package/build/commonjs/Pagination/index.js.map +1 -1
  40. package/build/commonjs/PaginationItem/PaginationItem.js +32 -22
  41. package/build/commonjs/PaginationItem/PaginationItem.js.map +1 -1
  42. package/build/commonjs/PaginationItem/PaginationItemProps.js.map +1 -1
  43. package/build/commonjs/Tab/Tab.js +11 -3
  44. package/build/commonjs/Tab/Tab.js.map +1 -1
  45. package/build/commonjs/Tabs/useTabsStyle.js +7 -4
  46. package/build/commonjs/Tabs/useTabsStyle.js.map +1 -1
  47. package/build/commonjs/Toolbar/BackButton/BackButton.js +47 -0
  48. package/build/commonjs/Toolbar/BackButton/BackButton.js.map +1 -0
  49. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js +2 -0
  50. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  51. package/build/commonjs/Toolbar/BackButton/index.js +16 -0
  52. package/build/commonjs/Toolbar/BackButton/index.js.map +1 -0
  53. package/build/commonjs/Toolbar/Toolbar.js +8 -4
  54. package/build/commonjs/Toolbar/Toolbar.js.map +1 -1
  55. package/build/commonjs/internal/icons/ChevronLeft.js +4 -2
  56. package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -1
  57. package/build/commonjs/internal/icons/ChevronRight.js +4 -2
  58. package/build/commonjs/internal/icons/ChevronRight.js.map +1 -1
  59. package/build/commonjs/internal/icons/Close.js +4 -2
  60. package/build/commonjs/internal/icons/Close.js.map +1 -1
  61. package/build/module/AppBar/AppBar.js +5 -1
  62. package/build/module/AppBar/AppBar.js.map +1 -1
  63. package/build/module/Badge/Badge.js +4 -3
  64. package/build/module/Badge/Badge.js.map +1 -1
  65. package/build/module/Badge/BadgeProps.js.map +1 -1
  66. package/build/module/ButtonBase/index.js +1 -1
  67. package/build/module/ButtonBase/index.js.map +1 -1
  68. package/build/module/Chip/Chip.js +17 -13
  69. package/build/module/Chip/Chip.js.map +1 -1
  70. package/build/module/Chip/ChipProps.js +1 -0
  71. package/build/module/Chip/ChipProps.js.map +1 -1
  72. package/build/module/Chip/index.js +1 -1
  73. package/build/module/Chip/index.js.map +1 -1
  74. package/build/module/Chip/useChipStyle.js +29 -19
  75. package/build/module/Chip/useChipStyle.js.map +1 -1
  76. package/build/module/Dialog/Dialog.js +7 -8
  77. package/build/module/Dialog/Dialog.js.map +1 -1
  78. package/build/module/Dialog/DialogProps.js +1 -1
  79. package/build/module/Dialog/DialogProps.js.map +1 -1
  80. package/build/module/Dialog/useDialogSectionStyle.js +6 -4
  81. package/build/module/Dialog/useDialogSectionStyle.js.map +1 -1
  82. package/build/module/Dialog/useDialogStyle.js +9 -8
  83. package/build/module/Dialog/useDialogStyle.js.map +1 -1
  84. package/build/module/DialogTitle/DialogLargeTitle.js +65 -0
  85. package/build/module/DialogTitle/DialogLargeTitle.js.map +1 -0
  86. package/build/module/DialogTitle/DialogTitle.js +6 -3
  87. package/build/module/DialogTitle/DialogTitle.js.map +1 -1
  88. package/build/module/Divider/Divider.js +7 -0
  89. package/build/module/Divider/Divider.js.map +1 -1
  90. package/build/module/Divider/DividerProps.js +1 -1
  91. package/build/module/Divider/DividerProps.js.map +1 -1
  92. package/build/module/ListItem/ListItem.js +3 -13
  93. package/build/module/ListItem/ListItem.js.map +1 -1
  94. package/build/module/Pagination/Pagination.js +2 -0
  95. package/build/module/Pagination/Pagination.js.map +1 -1
  96. package/build/module/Pagination/PaginationProps.js +1 -0
  97. package/build/module/Pagination/PaginationProps.js.map +1 -1
  98. package/build/module/Pagination/index.js +1 -1
  99. package/build/module/Pagination/index.js.map +1 -1
  100. package/build/module/PaginationItem/PaginationItem.js +28 -21
  101. package/build/module/PaginationItem/PaginationItem.js.map +1 -1
  102. package/build/module/PaginationItem/PaginationItemProps.js.map +1 -1
  103. package/build/module/Tab/Tab.js +11 -3
  104. package/build/module/Tab/Tab.js.map +1 -1
  105. package/build/module/Tabs/useTabsStyle.js +6 -4
  106. package/build/module/Tabs/useTabsStyle.js.map +1 -1
  107. package/build/module/Toolbar/BackButton/BackButton.js +32 -0
  108. package/build/module/Toolbar/BackButton/BackButton.js.map +1 -0
  109. package/build/module/Toolbar/BackButton/BackButtonProps.js +2 -0
  110. package/build/module/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  111. package/build/module/Toolbar/BackButton/index.js +2 -0
  112. package/build/module/Toolbar/BackButton/index.js.map +1 -0
  113. package/build/module/Toolbar/Toolbar.js +7 -3
  114. package/build/module/Toolbar/Toolbar.js.map +1 -1
  115. package/build/module/internal/icons/ChevronLeft.js +4 -2
  116. package/build/module/internal/icons/ChevronLeft.js.map +1 -1
  117. package/build/module/internal/icons/ChevronRight.js +4 -2
  118. package/build/module/internal/icons/ChevronRight.js.map +1 -1
  119. package/build/module/internal/icons/Close.js +4 -2
  120. package/build/module/internal/icons/Close.js.map +1 -1
  121. package/build/typescript/Badge/BadgeProps.d.ts +10 -5
  122. package/build/typescript/ButtonBase/index.d.ts +1 -1
  123. package/build/typescript/Chip/ChipProps.d.ts +11 -4
  124. package/build/typescript/Chip/index.d.ts +1 -1
  125. package/build/typescript/Chip/useChipStyle.d.ts +4 -3
  126. package/build/typescript/Dialog/DialogProps.d.ts +1 -6
  127. package/build/typescript/Dialog/useDialogStyle.d.ts +1 -1
  128. package/build/typescript/DialogTitle/DialogLargeTitle.d.ts +9 -0
  129. package/build/typescript/DialogTitle/DialogTitle.d.ts +6 -1
  130. package/build/typescript/Divider/DividerProps.d.ts +1 -1
  131. package/build/typescript/Pagination/PaginationProps.d.ts +12 -0
  132. package/build/typescript/Pagination/index.d.ts +2 -2
  133. package/build/typescript/PaginationItem/PaginationItemProps.d.ts +6 -0
  134. package/build/typescript/Toolbar/BackButton/BackButton.d.ts +3 -0
  135. package/build/typescript/Toolbar/BackButton/BackButtonProps.d.ts +4 -0
  136. package/build/typescript/Toolbar/BackButton/index.d.ts +2 -0
  137. package/build/typescript/Toolbar/Toolbar.d.ts +6 -1
  138. package/package.json +3 -3
  139. package/src/AppBar/AppBar.tsx +4 -0
  140. package/src/Badge/Badge.tsx +4 -3
  141. package/src/Badge/BadgeProps.ts +12 -6
  142. package/src/ButtonBase/index.ts +1 -1
  143. package/src/Chip/Chip.tsx +20 -13
  144. package/src/Chip/ChipProps.ts +13 -4
  145. package/src/Chip/index.ts +1 -1
  146. package/src/Chip/useChipStyle.ts +34 -17
  147. package/src/Dialog/Dialog.tsx +7 -8
  148. package/src/Dialog/DialogProps.ts +1 -7
  149. package/src/Dialog/useDialogSectionStyle.ts +6 -4
  150. package/src/Dialog/useDialogStyle.ts +9 -7
  151. package/src/DialogTitle/DialogLargeTitle.tsx +95 -0
  152. package/src/DialogTitle/DialogTitle.tsx +6 -1
  153. package/src/Divider/Divider.tsx +5 -0
  154. package/src/Divider/DividerProps.ts +1 -1
  155. package/src/ListItem/ListItem.tsx +3 -13
  156. package/src/Pagination/Pagination.tsx +3 -2
  157. package/src/Pagination/PaginationProps.ts +15 -0
  158. package/src/Pagination/index.ts +2 -2
  159. package/src/PaginationItem/PaginationItem.tsx +31 -24
  160. package/src/PaginationItem/PaginationItemProps.ts +7 -0
  161. package/src/Tab/Tab.tsx +20 -6
  162. package/src/Tabs/useTabsStyle.ts +7 -4
  163. package/src/Toolbar/BackButton/BackButton.tsx +42 -0
  164. package/src/Toolbar/BackButton/BackButtonProps.ts +4 -0
  165. package/src/Toolbar/BackButton/index.ts +2 -0
  166. package/src/Toolbar/Toolbar.tsx +6 -1
  167. package/src/internal/icons/ChevronLeft.tsx +4 -1
  168. package/src/internal/icons/ChevronRight.tsx +4 -1
  169. package/src/internal/icons/Close.tsx +4 -1
  170. package/build/commonjs/ButtonBase/LegacyButtonBase.js +0 -126
  171. package/build/commonjs/ButtonBase/LegacyButtonBase.js.map +0 -1
  172. package/build/module/ButtonBase/LegacyButtonBase.js +0 -106
  173. package/build/module/ButtonBase/LegacyButtonBase.js.map +0 -1
  174. package/build/typescript/ButtonBase/LegacyButtonBase.d.ts +0 -5
  175. package/src/ButtonBase/LegacyButtonBase.tsx +0 -135
@@ -14,7 +14,6 @@ export default function Dialog(props: DialogProps) {
14
14
  const {
15
15
  animationType = ANIMATION_TYPE.SLIDE,
16
16
  children,
17
- fullScreen = false,
18
17
  hideBackdrop,
19
18
  onClose,
20
19
  style: styleProp,
@@ -24,7 +23,7 @@ export default function Dialog(props: DialogProps) {
24
23
  ...otherProps
25
24
  } = props;
26
25
 
27
- const styles = useDialogStyle(size, fullScreen);
26
+ const styles = useDialogStyle(size);
28
27
 
29
28
  const { height: screenHeight } = useWindowDimensions();
30
29
 
@@ -51,7 +50,7 @@ export default function Dialog(props: DialogProps) {
51
50
  toValue: 0,
52
51
  type: ANIMATION_TYPE.FADE,
53
52
  }];
54
- } else if (animationType === ANIMATION_TYPE.SLIDE && !fullScreen) {
53
+ } else if (animationType === ANIMATION_TYPE.SLIDE) {
55
54
  return [
56
55
  {
57
56
  toValue: screenHeight,
@@ -70,7 +69,7 @@ export default function Dialog(props: DialogProps) {
70
69
  toValue: screenHeight,
71
70
  type: ANIMATION_TYPE.SLIDE,
72
71
  }];
73
- }, [animationType, fullScreen, screenHeight]);
72
+ }, [animationType, screenHeight]);
74
73
 
75
74
  const openAnimation = useMemo<AnimationUnit[]>(() => {
76
75
  if (animationType === ANIMATION_TYPE.FADE) {
@@ -78,7 +77,7 @@ export default function Dialog(props: DialogProps) {
78
77
  toValue: 1,
79
78
  type: ANIMATION_TYPE.FADE,
80
79
  }];
81
- } else if (animationType === ANIMATION_TYPE.SLIDE && !fullScreen) {
80
+ } else if (animationType === ANIMATION_TYPE.SLIDE) {
82
81
  return [
83
82
  {
84
83
  toValue: 0,
@@ -97,9 +96,9 @@ export default function Dialog(props: DialogProps) {
97
96
  toValue: 0,
98
97
  type: ANIMATION_TYPE.SLIDE,
99
98
  }];
100
- }, [animationType, fullScreen]);
99
+ }, [animationType]);
101
100
 
102
- const initialOpacity = animationType === ANIMATION_TYPE.SLIDE && fullScreen ? 1 : undefined;
101
+ const initialOpacity = animationType === ANIMATION_TYPE.SLIDE ? 1 : undefined;
103
102
 
104
103
  const initialTranslateY = animationType === ANIMATION_TYPE.FADE ? 0 : undefined;
105
104
 
@@ -124,7 +123,7 @@ export default function Dialog(props: DialogProps) {
124
123
  >
125
124
  <DialogProvider value={{ size }}>
126
125
  {topElement ? (
127
- <Column style={fullScreen ? undefined : styles.topElementContainer}>
126
+ <Column style={styles.topElementContainer}>
128
127
  <Column
129
128
  style={styles.topElementContent}
130
129
  onLayout={handleTopElementLayout}
@@ -3,7 +3,7 @@ import type { ModalProps } from '../Modal';
3
3
  import type { OverridableComponentProps } from '../types';
4
4
  import { ANIMATION_TYPE } from '../Modal';
5
5
 
6
- export const dialogSizes = ['small', 'medium', 'large'] as const;
6
+ export const dialogSizes = ['small', 'medium', 'large', 'full'] as const;
7
7
  export type DialogSize = typeof dialogSizes[number];
8
8
 
9
9
  export default interface DialogProps extends OverridableComponentProps<ModalProps, {
@@ -18,12 +18,6 @@ export default interface DialogProps extends OverridableComponentProps<ModalProp
18
18
  */
19
19
  children?: React.ReactNode;
20
20
 
21
- /**
22
- * If `true`, the dialog is full-screen.
23
- * @default false
24
- */
25
- fullScreen?: boolean;
26
-
27
21
  /**
28
22
  * Determines the minWidth of the Dialog.
29
23
  * @default 'medium'
@@ -15,14 +15,16 @@ export default function useDialogSectionStyle() {
15
15
  return useMemo<FountainUiStyle>(() => {
16
16
  const sizePaddingHorizontalMap: Record<DialogSize, FountainUiStyle> = {
17
17
  small: {
18
- paddingHorizontal: theme.spacing(6),
18
+ paddingHorizontal: 24,
19
19
  },
20
20
  medium: {
21
- // TODO: need to refactor breakpoints.
22
- paddingHorizontal: theme.spacing(windowWidth >= 448 ? 8 : 6),
21
+ paddingHorizontal: windowWidth >= 448 ? 32 : 24,
23
22
  },
24
23
  large: {
25
- paddingHorizontal: theme.spacing(8),
24
+ paddingHorizontal: 32,
25
+ },
26
+ full: {
27
+ paddingHorizontal: windowWidth >= 448 ? 32 : 24,
26
28
  },
27
29
  };
28
30
 
@@ -13,7 +13,7 @@ type DialogStyleKeys =
13
13
 
14
14
  type DialogStyles = NamedStylesStringUnion<DialogStyleKeys>;
15
15
 
16
- export default function useDialogStyle(size: DialogSize, fullScreen: boolean): DialogStyles {
16
+ export default function useDialogStyle(size: DialogSize): DialogStyles {
17
17
  const theme = useTheme();
18
18
 
19
19
  const {
@@ -34,29 +34,31 @@ export default function useDialogStyle(size: DialogSize, fullScreen: boolean): D
34
34
  minHeight: 360,
35
35
  width: 512,
36
36
  },
37
+ full: {},
37
38
  };
38
39
 
39
- const containerPaddingVertical = theme.spacing(6);
40
+ const containerPaddingVertical = 24;
40
41
  const dialogMaxHeight = windowHeight - containerPaddingVertical * 2;
41
42
  const dialogMaxWidth = sizeStyleMap[size]?.maxWidth;
42
43
 
44
+ const isFullScreen = size === 'full';
45
+
43
46
  return {
44
47
  root: {
45
48
  alignItems: 'center',
46
49
  justifyContent: 'center',
47
50
  zIndex: theme.zIndex.dialog,
48
51
  },
49
- container: fullScreen ? {
52
+ container: isFullScreen ? {
50
53
  height: '100%',
51
54
  width: '100%',
52
55
  } : {
53
56
  alignItems: 'center',
54
- // TODO: need to refactor breakpoints.
55
- paddingHorizontal: theme.spacing(windowWidth > 320 ? 6 : 4),
57
+ paddingHorizontal: windowWidth > theme.breakpoints.values.xs ? 24 : 16,
56
58
  paddingVertical: containerPaddingVertical,
57
59
  width: '100%',
58
60
  },
59
- paper: fullScreen ? {
61
+ paper: isFullScreen ? {
60
62
  backgroundColor: theme.palette.surface.base,
61
63
  height: '100%',
62
64
  width: '100%',
@@ -78,5 +80,5 @@ export default function useDialogStyle(size: DialogSize, fullScreen: boolean): D
78
80
  width: '100%',
79
81
  },
80
82
  };
81
- }, [theme, windowHeight, windowWidth, size, fullScreen]);
83
+ }, [theme, windowHeight, windowWidth, size]);
82
84
  }
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { StyleSheet, Text, View } from 'react-native';
3
+ import type { DialogProps } from '../Dialog';
4
+ import type DialogTitleProps from './DialogTitleProps';
5
+ import { createFontStyle, css, useTheme } from '../styles';
6
+ import IconButton from '../IconButton';
7
+ import { ChevronLeft, Close } from '../internal';
8
+
9
+ const styles = StyleSheet.create({
10
+ root: {
11
+ alignItems: 'center',
12
+ height: 64,
13
+ justifyContent: 'center',
14
+ paddingHorizontal: 80,
15
+ width: '100%',
16
+ },
17
+ backButton: {
18
+ height: 40,
19
+ left: 20,
20
+ paddingLeft: 5,
21
+ paddingRight: 11,
22
+ paddingVertical: 8,
23
+ position: 'absolute',
24
+ width: 40,
25
+ },
26
+ closeButton: {
27
+ height: 40,
28
+ left: 20,
29
+ padding: 8,
30
+ position: 'absolute',
31
+ width: 40,
32
+ },
33
+ });
34
+
35
+ interface DialogLargeTitleProps extends DialogTitleProps {
36
+ closeButtonType?: 'back' | 'close';
37
+ onClose: DialogProps['onClose'];
38
+ }
39
+
40
+ export default function DialogLargeTitle(props: DialogLargeTitleProps) {
41
+ const {
42
+ children,
43
+ closeButtonType = 'close',
44
+ onClose,
45
+ style: styleProp,
46
+ ...otherProps
47
+ } = props;
48
+
49
+ const theme = useTheme();
50
+
51
+ const fontStyle = createFontStyle(theme, {
52
+ selector: (typo) => typo.header4.semiBold,
53
+ color: theme.palette.text.strong,
54
+ });
55
+
56
+ const rootStyle = css([
57
+ styles.root,
58
+ styleProp,
59
+ ]);
60
+
61
+ return (
62
+ <View
63
+ style={rootStyle}
64
+ {...otherProps}
65
+ >
66
+ {typeof onClose === 'function' ? (
67
+ closeButtonType === 'back' ? (
68
+ <IconButton
69
+ style={styles.backButton}
70
+ onPress={onClose}
71
+ >
72
+ <ChevronLeft
73
+ color={'strong'}
74
+ size={'large'}
75
+ />
76
+ </IconButton>
77
+ ) : (
78
+ <IconButton
79
+ style={styles.closeButton}
80
+ onPress={onClose}
81
+ >
82
+ <Close
83
+ color={'strong'}
84
+ size={'large'}
85
+ />
86
+ </IconButton>
87
+ )
88
+ ) : null}
89
+
90
+ <Text style={fontStyle}>
91
+ {children}
92
+ </Text>
93
+ </View>
94
+ );
95
+ }
@@ -3,6 +3,7 @@ import { Text, View } from 'react-native';
3
3
  import type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
4
4
  import { useDialogSectionStyle } from '../Dialog';
5
5
  import { createFontStyle, css, useTheme } from '../styles';
6
+ import DialogLargeTitle from './DialogLargeTitle';
6
7
  import type DialogTitleProps from './DialogTitleProps';
7
8
 
8
9
  type DialogTitleStyles = NamedStylesStringUnion<'root' | 'title'>;
@@ -20,7 +21,7 @@ const useStyles: UseStyles<DialogTitleStyles> = function (): DialogTitleStyles {
20
21
  };
21
22
  };
22
23
 
23
- export default function DialogTitle(props: DialogTitleProps) {
24
+ const DialogTitle = (props: DialogTitleProps) => {
24
25
  const {
25
26
  children,
26
27
  style: styleProp,
@@ -62,3 +63,7 @@ export default function DialogTitle(props: DialogTitleProps) {
62
63
  </View>
63
64
  );
64
65
  };
66
+
67
+ DialogTitle.Large = DialogLargeTitle;
68
+
69
+ export default DialogTitle;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Text, View } from 'react-native';
3
3
  import type { Theme } from '@fountain-ui/styles';
4
+ import { commonColors } from '@fountain-ui/styles';
4
5
  import { createFontStyle, css, StyleSheet, useTheme } from '../styles';
5
6
  import { ExtendedStyle } from '../types';
6
7
  import type DividerProps from './DividerProps';
@@ -29,6 +30,10 @@ function selectBorderColor(theme: Theme, variant: DividerVariant, vertical: bool
29
30
  return vertical ? theme.palette.border.weaker : theme.palette.border.weak;
30
31
  case 'strong':
31
32
  return vertical ? theme.palette.border.weak : theme.palette.border.base;
33
+ case 'strongStatic':
34
+ return commonColors.opacity.white['13'];
35
+ case 'baseStatic':
36
+ return commonColors.opacity.white['10'];
32
37
  }
33
38
  }
34
39
 
@@ -5,7 +5,7 @@ import type { OverridableComponentProps } from '../types';
5
5
  export const dividerElementAligns = ['start', 'center', 'end'] as const;
6
6
  export type DividerElementAlign = typeof dividerElementAligns[number];
7
7
 
8
- export const dividerVariants = ['base', 'strong'] as const;
8
+ export const dividerVariants = ['base', 'strong', 'baseStatic', 'strongStatic'] as const;
9
9
  export type DividerVariant = typeof dividerVariants[number];
10
10
 
11
11
  export default interface DividerProps extends OverridableComponentProps<ViewProps, {
@@ -8,28 +8,22 @@ import Row from '../Row';
8
8
  import { createFontStyle, css, useTheme } from '../styles';
9
9
  import type ListItemProps from './ListItemProps';
10
10
 
11
- type ListItemStyles = NamedStylesStringUnion<'content' | 'description' | 'divider' | 'dividerWrapper'>;
11
+ type ListItemStyles = NamedStylesStringUnion<'content' | 'description'>;
12
12
 
13
13
  const useStyles: UseStyles<ListItemStyles> = function (): ListItemStyles {
14
14
  const theme = useTheme();
15
15
 
16
16
  return {
17
17
  content: {
18
+ borderBottomColor: theme.palette.border.weak,
19
+ borderBottomWidth: 0.5,
18
20
  gap: theme.spacing(2),
19
21
  paddingVertical: theme.spacing(3.75),
20
- paddingHorizontal: theme.spacing(4),
21
22
  width: '100%',
22
23
  },
23
24
  description: {
24
25
  paddingRight: theme.spacing(20),
25
26
  },
26
- divider: {
27
- borderBottomColor: theme.palette.border.weak,
28
- borderBottomWidth: 0.5,
29
- },
30
- dividerWrapper: {
31
- paddingHorizontal: theme.spacing(4),
32
- },
33
27
  };
34
28
  };
35
29
 
@@ -102,10 +96,6 @@ export default function ListItem(props: ListItemProps) {
102
96
  {content}
103
97
  </View>
104
98
  )}
105
-
106
- <View style={styles.dividerWrapper}>
107
- <View style={styles.divider}/>
108
- </View>
109
99
  </View>
110
100
  );
111
101
  };
@@ -8,7 +8,7 @@ import IconButton from '../IconButton';
8
8
  import PaginationItem from '../PaginationItem';
9
9
  import NumberPagination from './NumberPagination';
10
10
  import type PaginationProps from './PaginationProps';
11
- import type { PaginationVariant } from './PaginationProps';
11
+ import type { PaginationColor, PaginationVariant } from './PaginationProps';
12
12
 
13
13
  type PaginationStyleKeys =
14
14
  | 'root'
@@ -65,6 +65,7 @@ export default function Pagination(props: PaginationProps) {
65
65
  const {
66
66
  bundleSize = 1,
67
67
  children,
68
+ color = 'base' as PaginationColor,
68
69
  count,
69
70
  disabled = false,
70
71
  hideIndicator = false,
@@ -134,7 +135,7 @@ export default function Pagination(props: PaginationProps) {
134
135
  currentPage={page}
135
136
  maxPage={count}
136
137
  />
137
- ) : times(i => renderItem({ index: i, disabled, selected: i === page }), count)
138
+ ) : times(i => renderItem({ color, index: i, disabled, selected: i === page }), count)
138
139
  ) : null;
139
140
 
140
141
  const containerProps = {
@@ -2,10 +2,19 @@ import React from 'react';
2
2
  import type { ViewProps } from 'react-native';
3
3
  import type { OverridableComponentProps } from '../types';
4
4
 
5
+ export const paginationColors = ['base', 'static'] as const;
6
+ export type PaginationColor = typeof paginationColors[number];
7
+
5
8
  export const paginationVariants = ['dot', 'number'] as const;
6
9
  export type PaginationVariant = typeof paginationVariants[number];
7
10
 
8
11
  export interface PaginationRenderItemParams {
12
+ /**
13
+ * Set color of dot.
14
+ * @default 'base'
15
+ */
16
+ color?: PaginationColor;
17
+
9
18
  /**
10
19
  * Index of the pagination item.
11
20
  */
@@ -34,6 +43,12 @@ export default interface PaginationProps extends OverridableComponentProps<ViewP
34
43
  */
35
44
  children?: React.ReactNode;
36
45
 
46
+ /**
47
+ * Set color of dot.
48
+ * @default 'base'
49
+ */
50
+ color?: PaginationColor;
51
+
37
52
  /**
38
53
  * The total number of pages.
39
54
  */
@@ -1,3 +1,3 @@
1
1
  export { default } from './Pagination';
2
- export type { default as PaginationProps } from './PaginationProps';
3
- export { paginationVariants } from './PaginationProps';
2
+ export type { default as PaginationProps, PaginationColor, PaginationVariant } from './PaginationProps';
3
+ export { paginationColors, paginationVariants } from './PaginationProps';
@@ -1,47 +1,54 @@
1
1
  import React from 'react';
2
- import { View } from 'react-native';
3
- import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
2
+ import { StyleSheet, View, ViewStyle } from 'react-native';
3
+ import { commonColors, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
4
+ import { PaginationColor } from '../Pagination';
4
5
  import { css, useTheme } from '../styles';
5
6
  import type PaginationItemProps from './PaginationItemProps';
6
7
 
7
- type PaginationItemStyles = NamedStylesStringUnion<'root' | 'selected' | 'unselected'>;
8
+ const DEFAULT_SIZE = 6;
8
9
 
9
- const useStyles: UseStyles<PaginationItemStyles> = function (): PaginationItemStyles {
10
+ const styles = StyleSheet.create({
11
+ root: {
12
+ width: DEFAULT_SIZE,
13
+ height: DEFAULT_SIZE,
14
+ borderRadius: DEFAULT_SIZE * 0.5,
15
+ marginHorizontal: 4,
16
+ },
17
+ });
18
+
19
+ function getBackgroundColor(color: PaginationColor, selected: boolean): ViewStyle['backgroundColor'] {
10
20
  const theme = useTheme();
11
21
 
12
- const size = 6;
13
-
14
- return {
15
- root: {
16
- width: size,
17
- height: size,
18
- borderRadius: size * 0.5,
19
- marginHorizontal: theme.spacing(1),
20
- },
21
- selected: {
22
- backgroundColor: theme.palette.fill.base,
23
- },
24
- unselected: {
25
- backgroundColor: theme.palette.status.disabled,
26
- },
27
- };
28
- };
22
+ switch (color) {
23
+ case 'static':
24
+ return selected
25
+ ? commonColors.static.strongInverse
26
+ : commonColors.static.weakOpacityInverse;
27
+ case 'base':
28
+ default:
29
+ return selected
30
+ ? theme.palette.fill.base
31
+ : theme.palette.status.disabled;
32
+
33
+ }
34
+ }
29
35
 
30
36
  function PaginationItem(props: PaginationItemProps) {
31
37
  const {
38
+ color = 'base' as PaginationColor,
32
39
  disabled,
33
- selected,
40
+ selected = false,
34
41
  style,
35
42
  ...otherProps
36
43
  } = props;
37
44
 
38
- const styles = useStyles();
45
+ const backgroundColor = getBackgroundColor(color, selected);
39
46
 
40
47
  return (
41
48
  <View
42
49
  style={css([
43
50
  styles.root,
44
- selected ? styles.selected : styles.unselected,
51
+ { backgroundColor },
45
52
  style,
46
53
  ])}
47
54
  {...otherProps}
@@ -1,7 +1,14 @@
1
1
  import type { ViewProps } from 'react-native';
2
2
  import type { OverridableComponentProps } from '../types';
3
+ import { PaginationColor } from '../Pagination';
3
4
 
4
5
  export default interface PaginationItemProps extends OverridableComponentProps<ViewProps, {
6
+ /**
7
+ * Set color of dot.
8
+ * @default 'base'
9
+ */
10
+ color?: PaginationColor;
11
+
5
12
  /**
6
13
  * If `true`, the pagination item is disabled.
7
14
  * @default false
package/src/Tab/Tab.tsx CHANGED
@@ -69,17 +69,31 @@ export default function Tab(props: TabProps) {
69
69
  <React.Fragment>
70
70
  {iconElement ? (
71
71
  <React.Fragment>
72
- <Badge invisible={!badgeVisible}>
72
+ <Badge
73
+ horizontalOffset={-6}
74
+ invisible={!badgeVisible}
75
+ verticalOffset={-4.5}
76
+ >
73
77
  {iconElement}
74
78
  </Badge>
75
79
 
76
80
  <Spacer size={1.25}/>
77
- </React.Fragment>
78
- ) : null}
79
81
 
80
- <Text style={css(labelStyle)}>
81
- {children}
82
- </Text>
82
+ <Text style={css(labelStyle)}>
83
+ {children}
84
+ </Text>
85
+ </React.Fragment>
86
+ ) : (
87
+ <Badge
88
+ horizontalOffset={-7}
89
+ invisible={!badgeVisible}
90
+ verticalOffset={3}
91
+ >
92
+ <Text style={css(labelStyle)}>
93
+ {children}
94
+ </Text>
95
+ </Badge>
96
+ )}
83
97
  </React.Fragment>
84
98
  );
85
99
 
@@ -1,5 +1,6 @@
1
1
  import { useMemo } from 'react';
2
2
  import type { FountainUiStyle } from '@fountain-ui/styles';
3
+ import { useBreakpointUp } from '../hooks';
3
4
  import { useTheme } from '../styles';
4
5
  import type { TabVariant } from '../Tab';
5
6
 
@@ -10,13 +11,15 @@ interface TabsStyle {
10
11
  export default function useTabsStyle(variant: TabVariant) {
11
12
  const theme = useTheme();
12
13
 
14
+ const isDesktop = useBreakpointUp('md', true, false);
15
+
13
16
  return useMemo<TabsStyle>(() => {
14
17
  switch (variant) {
15
18
  case 'circular':
16
19
  return {
17
20
  container: {
18
- paddingBottom: theme.spacing(2),
19
- paddingHorizontal: theme.spacing(3),
21
+ paddingBottom: 8,
22
+ paddingHorizontal: isDesktop ? 20 : 12,
20
23
  },
21
24
  };
22
25
  case 'bottom-navigation':
@@ -27,9 +30,9 @@ export default function useTabsStyle(variant: TabVariant) {
27
30
  default:
28
31
  return {
29
32
  container: {
30
- paddingHorizontal: theme.spacing(1.5),
33
+ paddingHorizontal: isDesktop ? 14 : 6,
31
34
  },
32
35
  };
33
36
  }
34
- }, [theme, variant]);
37
+ }, [theme, variant, isDesktop]);
35
38
  }
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import IconButton from '../../IconButton';
4
+ import { ChevronLeft } from '../../internal';
5
+ import type BackButtonProps from './BackButtonProps';
6
+ import { css } from '@fountain-ui/styles';
7
+
8
+ const styles = StyleSheet.create({
9
+ root: {
10
+ height: 40,
11
+ left: 4,
12
+ paddingLeft: 5,
13
+ paddingRight: 11,
14
+ paddingVertical: 8,
15
+ position: 'absolute',
16
+ width: 40,
17
+ },
18
+ });
19
+
20
+ export default function BackButton(props: BackButtonProps) {
21
+ const {
22
+ style: styleProp,
23
+ ...otherProps
24
+ } = props;
25
+
26
+ const rootStyle = css([
27
+ styles.root,
28
+ styleProp,
29
+ ]);
30
+
31
+ return (
32
+ <IconButton
33
+ style={rootStyle}
34
+ {...otherProps}
35
+ >
36
+ <ChevronLeft
37
+ color={'strong'}
38
+ size={'large'}
39
+ />
40
+ </IconButton>
41
+ );
42
+ }
@@ -0,0 +1,4 @@
1
+ import type { IconButtonProps } from '../../IconButton';
2
+ import type { OverridableComponentProps } from '../../types';
3
+
4
+ export default interface BackButtonProps extends OverridableComponentProps<Omit<IconButtonProps, 'children'>, {}> {}
@@ -0,0 +1,2 @@
1
+ export { default } from './BackButton';
2
+ export type { default as BackButtonProps } from './BackButtonProps';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import type { FountainUiStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
3
3
  import Row from '../Row';
4
4
  import { css, useTheme } from '../styles';
5
+ import BackButton from './BackButton';
5
6
  import type ToolbarProps from './ToolbarProps';
6
7
  import type { ToolbarSize } from './ToolbarProps';
7
8
 
@@ -27,7 +28,7 @@ const sizeMap: Record<ToolbarSize, FountainUiStyle> = {
27
28
  large: { height: 56 },
28
29
  };
29
30
 
30
- export default function Toolbar(props: ToolbarProps) {
31
+ const Toolbar = (props: ToolbarProps) => {
31
32
  const {
32
33
  disableGutters = false,
33
34
  size = 'medium',
@@ -49,3 +50,7 @@ export default function Toolbar(props: ToolbarProps) {
49
50
  />
50
51
  );
51
52
  };
53
+
54
+ Toolbar.BackButton = BackButton;
55
+
56
+ export default Toolbar;