@fountain-ui/core 3.0.0-alpha.14 → 3.0.0-alpha.16

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 (86) hide show
  1. package/build/commonjs/Accordion/Accordion.js +3 -3
  2. package/build/commonjs/Accordion/Accordion.js.map +1 -1
  3. package/build/commonjs/Accordion/useVariantStyleMap.js +6 -2
  4. package/build/commonjs/Accordion/useVariantStyleMap.js.map +1 -1
  5. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js +1 -0
  6. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  7. package/build/commonjs/BottomSheetTitle/BottomSheetTitleProps.js.map +1 -1
  8. package/build/commonjs/Button/Button.js +11 -9
  9. package/build/commonjs/Button/Button.js.map +1 -1
  10. package/build/commonjs/Dialog/Dialog.js +8 -4
  11. package/build/commonjs/Dialog/Dialog.js.map +1 -1
  12. package/build/commonjs/Dialog/FullDialogCloseButton.js +55 -0
  13. package/build/commonjs/Dialog/FullDialogCloseButton.js.map +1 -0
  14. package/build/commonjs/Dialog/useDialogStyle.js +13 -3
  15. package/build/commonjs/Dialog/useDialogStyle.js.map +1 -1
  16. package/build/commonjs/ImageCore/ImageCoreNative.js +1 -1
  17. package/build/commonjs/ImageCore/ImageCoreNative.js.map +1 -1
  18. package/build/commonjs/Tab/Tab.js +2 -1
  19. package/build/commonjs/Tab/Tab.js.map +1 -1
  20. package/build/commonjs/Tab/TabProps.js +3 -1
  21. package/build/commonjs/Tab/TabProps.js.map +1 -1
  22. package/build/commonjs/Tab/index.js +14 -0
  23. package/build/commonjs/Tab/index.js.map +1 -1
  24. package/build/commonjs/Tab/useVariantStyleMap.js +18 -12
  25. package/build/commonjs/Tab/useVariantStyleMap.js.map +1 -1
  26. package/build/commonjs/Tabs/Tabs.js +4 -5
  27. package/build/commonjs/Tabs/Tabs.js.map +1 -1
  28. package/build/commonjs/Tabs/TabsProps.js.map +1 -1
  29. package/build/commonjs/Tabs/useTabsStyle.js +15 -6
  30. package/build/commonjs/Tabs/useTabsStyle.js.map +1 -1
  31. package/build/module/Accordion/Accordion.js +3 -3
  32. package/build/module/Accordion/Accordion.js.map +1 -1
  33. package/build/module/Accordion/useVariantStyleMap.js +6 -2
  34. package/build/module/Accordion/useVariantStyleMap.js.map +1 -1
  35. package/build/module/BottomSheetTitle/BottomSheetTitle.js +1 -0
  36. package/build/module/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  37. package/build/module/BottomSheetTitle/BottomSheetTitleProps.js.map +1 -1
  38. package/build/module/Button/Button.js +11 -9
  39. package/build/module/Button/Button.js.map +1 -1
  40. package/build/module/Dialog/Dialog.js +7 -3
  41. package/build/module/Dialog/Dialog.js.map +1 -1
  42. package/build/module/Dialog/FullDialogCloseButton.js +42 -0
  43. package/build/module/Dialog/FullDialogCloseButton.js.map +1 -0
  44. package/build/module/Dialog/useDialogStyle.js +12 -3
  45. package/build/module/Dialog/useDialogStyle.js.map +1 -1
  46. package/build/module/ImageCore/ImageCoreNative.js +1 -1
  47. package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
  48. package/build/module/Tab/Tab.js +2 -1
  49. package/build/module/Tab/Tab.js.map +1 -1
  50. package/build/module/Tab/TabProps.js +1 -0
  51. package/build/module/Tab/TabProps.js.map +1 -1
  52. package/build/module/Tab/index.js +1 -0
  53. package/build/module/Tab/index.js.map +1 -1
  54. package/build/module/Tab/useVariantStyleMap.js +18 -12
  55. package/build/module/Tab/useVariantStyleMap.js.map +1 -1
  56. package/build/module/Tabs/Tabs.js +4 -5
  57. package/build/module/Tabs/Tabs.js.map +1 -1
  58. package/build/module/Tabs/TabsProps.js.map +1 -1
  59. package/build/module/Tabs/useTabsStyle.js +15 -6
  60. package/build/module/Tabs/useTabsStyle.js.map +1 -1
  61. package/build/typescript/BottomSheetTitle/BottomSheetTitleProps.d.ts +1 -0
  62. package/build/typescript/Dialog/Dialog.d.ts +6 -1
  63. package/build/typescript/Dialog/FullDialogCloseButton.d.ts +10 -0
  64. package/build/typescript/Tab/TabProps.d.ts +7 -0
  65. package/build/typescript/Tab/index.d.ts +2 -1
  66. package/build/typescript/Tab/useVariantStyleMap.d.ts +2 -2
  67. package/build/typescript/Tabs/Tabs.d.ts +1 -1
  68. package/build/typescript/Tabs/TabsProps.d.ts +6 -1
  69. package/build/typescript/Tabs/useTabsStyle.d.ts +2 -2
  70. package/package.json +4 -4
  71. package/src/Accordion/Accordion.tsx +7 -7
  72. package/src/Accordion/useVariantStyleMap.ts +4 -0
  73. package/src/BottomSheetTitle/BottomSheetTitle.tsx +1 -0
  74. package/src/BottomSheetTitle/BottomSheetTitleProps.ts +1 -0
  75. package/src/Button/Button.tsx +9 -8
  76. package/src/Dialog/Dialog.tsx +6 -1
  77. package/src/Dialog/FullDialogCloseButton.tsx +63 -0
  78. package/src/Dialog/useDialogStyle.ts +12 -2
  79. package/src/ImageCore/ImageCoreNative.tsx +1 -1
  80. package/src/Tab/Tab.tsx +3 -2
  81. package/src/Tab/TabProps.ts +9 -0
  82. package/src/Tab/index.ts +2 -1
  83. package/src/Tab/useVariantStyleMap.ts +18 -12
  84. package/src/Tabs/Tabs.tsx +4 -7
  85. package/src/Tabs/TabsProps.ts +7 -1
  86. package/src/Tabs/useTabsStyle.ts +14 -6
package/src/Tab/Tab.tsx CHANGED
@@ -5,7 +5,7 @@ import TabBase from '../TabBase';
5
5
  import { css, StyleSheet } from '../styles';
6
6
  import { cloneElementSafely } from '../utils';
7
7
  import type TabProps from './TabProps';
8
- import type { TabVariant } from './TabProps';
8
+ import type { TabSize, TabVariant } from './TabProps';
9
9
  import useVariantStyleMap from './useVariantStyleMap';
10
10
 
11
11
  const styles = StyleSheet.create({
@@ -27,6 +27,7 @@ export default function Tab(props: TabProps) {
27
27
  icon: defaultIcon,
28
28
  selected = false,
29
29
  selectedIcon,
30
+ size = 'medium' as TabSize,
30
31
  variant = 'default' as TabVariant,
31
32
  style: styleProp,
32
33
  onTabInnerLayout,
@@ -37,7 +38,7 @@ export default function Tab(props: TabProps) {
37
38
  container: containerStyle,
38
39
  inner: innerStyle,
39
40
  label: labelStyle,
40
- } = useVariantStyleMap(variant, selected);
41
+ } = useVariantStyleMap(variant, selected, size);
41
42
 
42
43
  const tabBaseStyle = css([
43
44
  styles.root,
@@ -3,6 +3,9 @@ import type { LayoutChangeEvent } from 'react-native';
3
3
  import type { TabBaseProps } from '../TabBase';
4
4
  import type { OverridableComponentProps } from '../types';
5
5
 
6
+ export const tabSizes = ['small', 'medium'] as const;
7
+ export type TabSize = typeof tabSizes[number];
8
+
6
9
  export const tabVariants = ['default', 'circular', 'circular-home', 'bottom-navigation'] as const;
7
10
  export type TabVariant = typeof tabVariants[number];
8
11
 
@@ -40,6 +43,12 @@ export default interface TabProps extends OverridableComponentProps<TabBaseProps
40
43
  */
41
44
  selectedIcon?: React.ReactElement;
42
45
 
46
+ /**
47
+ * The size of the Tab.
48
+ * @default 'medium'
49
+ */
50
+ size?: TabSize;
51
+
43
52
  /**
44
53
  * The variant to use.
45
54
  * @default 'default'
package/src/Tab/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default } from './Tab';
2
- export type { default as TabProps, TabVariant } from './TabProps';
2
+ export type { default as TabProps, TabSize, TabVariant } from './TabProps';
3
+ export { tabSizes, tabVariants } from './TabProps';
@@ -3,7 +3,7 @@ import { TextStyle } from 'react-native';
3
3
  import type { FountainUiStyle } from '@fountain-ui/styles';
4
4
  import { typographyOf } from '@fountain-ui/styles';
5
5
  import { createFontStyle, useTheme } from '../styles';
6
- import type { TabVariant } from './TabProps';
6
+ import type { TabSize, TabVariant } from './TabProps';
7
7
 
8
8
  interface VariantStyle {
9
9
  container: FountainUiStyle;
@@ -11,7 +11,7 @@ interface VariantStyle {
11
11
  label: TextStyle;
12
12
  }
13
13
 
14
- export default function useVariantStyleMap(variant: TabVariant, selected: boolean): VariantStyle {
14
+ export default function useVariantStyleMap(variant: TabVariant, selected: boolean, size: TabSize): VariantStyle {
15
15
  const theme = useTheme();
16
16
 
17
17
  return useMemo<VariantStyle>(() => {
@@ -29,13 +29,14 @@ export default function useVariantStyleMap(variant: TabVariant, selected: boolea
29
29
  borderRadius: theme.shape.radius.full,
30
30
  flexDirection: 'row',
31
31
  gap: 5,
32
- paddingHorizontal: theme.spacing(3.5),
33
- paddingVertical: theme.spacing(1.75),
32
+ paddingBottom: 7.5,
33
+ paddingHorizontal: 14,
34
+ paddingTop: 6.5,
34
35
  },
35
36
  label: createFontStyle(theme, {
36
37
  selector: (_) => typographyOf({
37
- fontSize: 14,
38
- lineHeight: 18.2,
38
+ fontSize: size === 'small' ? 14 : 15,
39
+ lineHeight: size === 'small' ? 18.2 : 19.5,
39
40
  fontFamily: 'PretendardStd-SemiBold',
40
41
  letterSpacing: 0,
41
42
  }),
@@ -55,10 +56,13 @@ export default function useVariantStyleMap(variant: TabVariant, selected: boolea
55
56
  ? theme.palette.fill.base
56
57
  : theme.palette.surface.base,
57
58
  borderRadius: theme.shape.radius.full,
59
+ borderWidth: selected ? undefined : 0.5,
60
+ borderColor: selected ? undefined : theme.palette.border.weak,
58
61
  flexDirection: 'row',
59
62
  gap: 5,
63
+ paddingBottom: 6.5,
60
64
  paddingHorizontal: 14,
61
- paddingVertical: 8.5,
65
+ paddingVertical: 7.5,
62
66
  },
63
67
  label: createFontStyle(theme, {
64
68
  selector: (_) => typographyOf({
@@ -78,7 +82,7 @@ export default function useVariantStyleMap(variant: TabVariant, selected: boolea
78
82
  alignItems: 'center',
79
83
  height: 49,
80
84
  justifyContent: 'flex-start',
81
- paddingTop: theme.spacing(2.625),
85
+ paddingTop: 10.5,
82
86
  width: 48,
83
87
  },
84
88
  inner: {
@@ -101,16 +105,18 @@ export default function useVariantStyleMap(variant: TabVariant, selected: boolea
101
105
  default:
102
106
  return {
103
107
  container: {
104
- padding: theme.spacing(2.5),
108
+ paddingHorizontal: 10,
105
109
  },
106
110
  inner: {
107
111
  flexDirection: 'row',
108
112
  gap: 5,
113
+ paddingHorizontal: 1,
114
+ paddingVertical: 10,
109
115
  },
110
116
  label: createFontStyle(theme, {
111
117
  selector: (_) => typographyOf({
112
- fontSize: 15,
113
- lineHeight: 18.75,
118
+ fontSize: size === 'small' ? 15 : 16,
119
+ lineHeight: size === 'small' ? 18.75 : 20,
114
120
  fontFamily: selected ? 'PretendardStd-SemiBold' : 'PretendardStd-Medium',
115
121
  letterSpacing: 0,
116
122
  }),
@@ -120,5 +126,5 @@ export default function useVariantStyleMap(variant: TabVariant, selected: boolea
120
126
  }),
121
127
  };
122
128
  }
123
- }, [theme, variant, selected]);
129
+ }, [theme, variant, selected, size]);
124
130
  }
package/src/Tabs/Tabs.tsx CHANGED
@@ -4,7 +4,7 @@ import { View } from 'react-native';
4
4
  import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
5
5
  import { css, useTheme } from '../styles';
6
6
  import { useSyncAnimatedValue } from '../hooks';
7
- import type { TabVariant } from '../Tab';
7
+ import type { TabSize, TabVariant } from '../Tab';
8
8
  import type TabsProps from './TabsProps';
9
9
  import type { TabsColor } from './TabsProps';
10
10
  import type { TabsInstance } from './types';
@@ -22,7 +22,6 @@ type TabsStyleKeys =
22
22
  | 'root'
23
23
  | 'fixedRoot'
24
24
  | 'fixedTab'
25
- | 'scrollableContainer'
26
25
  | 'bottomDivider';
27
26
 
28
27
  type TabsStyles = NamedStylesStringUnion<TabsStyleKeys>;
@@ -38,9 +37,6 @@ const useStyles: UseStyles<TabsStyles> = function (): TabsStyles {
38
37
  fixedTab: {
39
38
  flex: 1,
40
39
  },
41
- scrollableContainer: {
42
- paddingHorizontal: theme.spacing(1),
43
- },
44
40
  bottomDivider: {
45
41
  borderBottomColor: theme.palette.border.base,
46
42
  borderBottomWidth: 0.5,
@@ -61,6 +57,7 @@ const Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {
61
57
  scrollable = false,
62
58
  scrollViewContentContainerStyle,
63
59
  showDivider = false,
60
+ size = 'medium' as TabSize,
64
61
  style,
65
62
  variant = 'default' as TabVariant,
66
63
  UNSTABLE_sharedIndex,
@@ -73,7 +70,7 @@ const Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {
73
70
 
74
71
  const currentIndexRef = useRef(initialIndex);
75
72
 
76
- const { container: containerStyle } = useTabsStyle(variant);
73
+ const { container: containerStyle } = useTabsStyle(variant, size);
77
74
 
78
75
  const setTab = (newIndex: number) => {
79
76
  const currentIndex = currentIndexRef.current;
@@ -173,6 +170,7 @@ const Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {
173
170
  onLayout,
174
171
  onPress,
175
172
  onMouseDown,
173
+ size,
176
174
  variant,
177
175
  indicatorSize,
178
176
  style: scrollable ? undefined : styles.fixedTab,
@@ -217,7 +215,6 @@ const Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {
217
215
  automaticallyAdjustContentInsets={false}
218
216
  bounces={false}
219
217
  contentContainerStyle={css([
220
- styles.scrollableContainer,
221
218
  scrollViewContentContainerStyle,
222
219
  ])}
223
220
  coordinates={coordinates}
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode, Ref } from 'react';
2
2
  import type { ViewProps } from 'react-native';
3
- import type { TabVariant } from '../Tab';
3
+ import type { TabSize, TabVariant } from '../Tab';
4
4
  import type { ExtendedStyle, OverridableComponentProps, SyncAnimatedValue } from '../types';
5
5
  import type { KeyboardDismissMode, KeyboardShouldPersistTaps, TabsInstance } from './types';
6
6
 
@@ -78,6 +78,12 @@ export default interface TabsProps extends OverridableComponentProps<ViewProps,
78
78
  */
79
79
  showDivider?: boolean;
80
80
 
81
+ /**
82
+ * The size of the Tab.
83
+ * @default 'medium'
84
+ */
85
+ size?: TabSize;
86
+
81
87
  /**
82
88
  * Unstable API.
83
89
  */
@@ -2,16 +2,16 @@ import { useMemo } from 'react';
2
2
  import type { FountainUiStyle } from '@fountain-ui/styles';
3
3
  import { useBreakpointUp } from '../hooks';
4
4
  import { useTheme } from '../styles';
5
- import type { TabVariant } from '../Tab';
5
+ import type { TabSize, TabVariant } from '../Tab';
6
6
 
7
7
  interface TabsStyle {
8
8
  container: FountainUiStyle;
9
9
  }
10
10
 
11
- export default function useTabsStyle(variant: TabVariant) {
11
+ export default function useTabsStyle(variant: TabVariant, size: TabSize) {
12
12
  const theme = useTheme();
13
13
 
14
- const isDesktop = useBreakpointUp('md', true, false);
14
+ const isTablet = useBreakpointUp('md', true, false);
15
15
 
16
16
  return useMemo<TabsStyle>(() => {
17
17
  switch (variant) {
@@ -19,7 +19,14 @@ export default function useTabsStyle(variant: TabVariant) {
19
19
  return {
20
20
  container: {
21
21
  paddingBottom: 8,
22
- paddingHorizontal: isDesktop ? 20 : 12,
22
+ paddingHorizontal: isTablet ? 20 : (size === 'small' ? 8 : 12),
23
+ },
24
+ };
25
+ case 'circular-home':
26
+ return {
27
+ container: {
28
+ paddingBottom: 8,
29
+ paddingHorizontal: isTablet ? 20 : 8,
23
30
  },
24
31
  };
25
32
  case 'bottom-navigation':
@@ -27,15 +34,16 @@ export default function useTabsStyle(variant: TabVariant) {
27
34
  container: {
28
35
  borderTopColor: theme.palette.border.base,
29
36
  borderTopWidth: 0.5,
37
+ paddingHorizontal: 20,
30
38
  },
31
39
  };
32
40
  case 'default':
33
41
  default:
34
42
  return {
35
43
  container: {
36
- paddingHorizontal: isDesktop ? 14 : 6,
44
+ paddingHorizontal: isTablet ? 14 : 6,
37
45
  },
38
46
  };
39
47
  }
40
- }, [theme, variant, isDesktop]);
48
+ }, [theme, variant, isTablet, size]);
41
49
  }