@fountain-ui/core 3.0.0-alpha.5 → 3.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commonjs/Accordion/Accordion.js +4 -1
- package/build/commonjs/Accordion/Accordion.js.map +1 -1
- package/build/commonjs/Accordion/useVariantStyleMap.js +7 -4
- package/build/commonjs/Accordion/useVariantStyleMap.js.map +1 -1
- package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js +1 -0
- package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
- package/build/commonjs/Button/Button.js +4 -0
- package/build/commonjs/Button/Button.js.map +1 -1
- package/build/commonjs/Button/ButtonProps.js.map +1 -1
- package/build/commonjs/Checkbox/Checkbox.js +4 -1
- package/build/commonjs/Checkbox/Checkbox.js.map +1 -1
- package/build/commonjs/Checkbox/useVariantStyleMap.js +6 -2
- package/build/commonjs/Checkbox/useVariantStyleMap.js.map +1 -1
- package/build/commonjs/Empty/Empty.js +1 -1
- package/build/commonjs/Empty/Empty.js.map +1 -1
- package/build/commonjs/ListItem/ListItem.js +2 -2
- package/build/commonjs/ListItem/ListItem.js.map +1 -1
- package/build/commonjs/ListItemText/ListItemText.js +2 -2
- package/build/commonjs/ListItemText/ListItemText.js.map +1 -1
- package/build/commonjs/ListSubheader/ListSubheader.js +1 -1
- package/build/commonjs/ListSubheader/ListSubheader.js.map +1 -1
- package/build/commonjs/Pagination/NumberPagination.js +1 -1
- package/build/commonjs/Pagination/NumberPagination.js.map +1 -1
- package/build/commonjs/Radio/Radio.js +5 -1
- package/build/commonjs/Radio/Radio.js.map +1 -1
- package/build/commonjs/SnackbarContent/SnackbarContent.js +24 -7
- package/build/commonjs/SnackbarContent/SnackbarContent.js.map +1 -1
- package/build/commonjs/Tabs/Tabs.js +6 -1
- package/build/commonjs/Tabs/Tabs.js.map +1 -1
- package/build/commonjs/Tabs/useTabsStyle.js +39 -0
- package/build/commonjs/Tabs/useTabsStyle.js.map +1 -0
- package/build/commonjs/Tooltip/Tooltip.js +11 -18
- package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/build/commonjs/hooks/useContentContainerStyle.js +9 -8
- package/build/commonjs/hooks/useContentContainerStyle.js.map +1 -1
- package/build/module/Accordion/Accordion.js +4 -1
- package/build/module/Accordion/Accordion.js.map +1 -1
- package/build/module/Accordion/useVariantStyleMap.js +7 -4
- package/build/module/Accordion/useVariantStyleMap.js.map +1 -1
- package/build/module/BottomSheetTitle/BottomSheetTitle.js +1 -0
- package/build/module/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
- package/build/module/Button/Button.js +4 -0
- package/build/module/Button/Button.js.map +1 -1
- package/build/module/Button/ButtonProps.js.map +1 -1
- package/build/module/Checkbox/Checkbox.js +4 -1
- package/build/module/Checkbox/Checkbox.js.map +1 -1
- package/build/module/Checkbox/useVariantStyleMap.js +6 -2
- package/build/module/Checkbox/useVariantStyleMap.js.map +1 -1
- package/build/module/Empty/Empty.js +1 -1
- package/build/module/Empty/Empty.js.map +1 -1
- package/build/module/ListItem/ListItem.js +2 -2
- package/build/module/ListItem/ListItem.js.map +1 -1
- package/build/module/ListItemText/ListItemText.js +2 -2
- package/build/module/ListItemText/ListItemText.js.map +1 -1
- package/build/module/ListSubheader/ListSubheader.js +1 -1
- package/build/module/ListSubheader/ListSubheader.js.map +1 -1
- package/build/module/Pagination/NumberPagination.js +1 -1
- package/build/module/Pagination/NumberPagination.js.map +1 -1
- package/build/module/Radio/Radio.js +4 -1
- package/build/module/Radio/Radio.js.map +1 -1
- package/build/module/SnackbarContent/SnackbarContent.js +24 -7
- package/build/module/SnackbarContent/SnackbarContent.js.map +1 -1
- package/build/module/Tabs/Tabs.js +5 -1
- package/build/module/Tabs/Tabs.js.map +1 -1
- package/build/module/Tabs/useTabsStyle.js +30 -0
- package/build/module/Tabs/useTabsStyle.js.map +1 -0
- package/build/module/Tooltip/Tooltip.js +4 -10
- package/build/module/Tooltip/Tooltip.js.map +1 -1
- package/build/module/hooks/useContentContainerStyle.js +9 -8
- package/build/module/hooks/useContentContainerStyle.js.map +1 -1
- package/build/typescript/Accordion/useVariantStyleMap.d.ts +1 -0
- package/build/typescript/Button/ButtonProps.d.ts +5 -0
- package/build/typescript/Checkbox/useVariantStyleMap.d.ts +1 -0
- package/build/typescript/Tabs/useTabsStyle.d.ts +7 -0
- package/package.json +3 -3
- package/src/Accordion/Accordion.tsx +4 -1
- package/src/Accordion/useVariantStyleMap.ts +8 -4
- package/src/BottomSheetTitle/BottomSheetTitle.tsx +1 -0
- package/src/Button/Button.tsx +2 -0
- package/src/Button/ButtonProps.ts +6 -0
- package/src/Checkbox/Checkbox.tsx +11 -8
- package/src/Checkbox/useVariantStyleMap.ts +6 -1
- package/src/Empty/Empty.tsx +1 -1
- package/src/ListItem/ListItem.tsx +2 -2
- package/src/ListItemText/ListItemText.tsx +2 -2
- package/src/ListSubheader/ListSubheader.tsx +1 -1
- package/src/Pagination/NumberPagination.tsx +1 -1
- package/src/Radio/Radio.tsx +7 -1
- package/src/SnackbarContent/SnackbarContent.tsx +35 -14
- package/src/Tabs/Tabs.tsx +4 -0
- package/src/Tabs/useTabsStyle.ts +35 -0
- package/src/Tooltip/Tooltip.tsx +4 -9
- package/src/hooks/useContentContainerStyle.ts +12 -9
|
@@ -45,7 +45,7 @@ export default function NumberPagination(props: NumberPaginationProps) {
|
|
|
45
45
|
const typography = typographyOf({
|
|
46
46
|
fontSize: 9.5,
|
|
47
47
|
lineHeight: 11.4,
|
|
48
|
-
fontFamily: '
|
|
48
|
+
fontFamily: 'PretendardStd-SemiBold',
|
|
49
49
|
letterSpacing: -0.19,
|
|
50
50
|
});
|
|
51
51
|
|
package/src/Radio/Radio.tsx
CHANGED
|
@@ -9,6 +9,8 @@ import { cloneElementSafely } from '../utils';
|
|
|
9
9
|
import { RadioContext } from '../RadioGroup/RadioContextProvider';
|
|
10
10
|
import type RadioProps from './RadioProps';
|
|
11
11
|
|
|
12
|
+
const DEFAULT_START_ICON_SIZE = 21;
|
|
13
|
+
|
|
12
14
|
type RadioStyles = NamedStylesStringUnion<'root' | 'content'>;
|
|
13
15
|
|
|
14
16
|
const useStyles: UseStyles<RadioStyles> = function (): RadioStyles {
|
|
@@ -63,7 +65,11 @@ export default function Radio(props: RadioProps) {
|
|
|
63
65
|
const checkedIcon = checkIconProp ?? defaultCheckedIcon;
|
|
64
66
|
const icon = isChecked ? checkedIcon : null;
|
|
65
67
|
|
|
66
|
-
const startIcon = cloneElementSafely(startIconProp, {
|
|
68
|
+
const startIcon = cloneElementSafely(startIconProp, {
|
|
69
|
+
color: 'strong',
|
|
70
|
+
height: DEFAULT_START_ICON_SIZE,
|
|
71
|
+
width: DEFAULT_START_ICON_SIZE,
|
|
72
|
+
});
|
|
67
73
|
|
|
68
74
|
const rootStyle = css([
|
|
69
75
|
styles.root,
|
|
@@ -10,7 +10,7 @@ import Typography from '../Typography';
|
|
|
10
10
|
import type SnackbarContentProps from './SnackbarContentProps';
|
|
11
11
|
import StatusIcon from './StatusIcon';
|
|
12
12
|
|
|
13
|
-
type SnackBarContentStyles = NamedStylesStringUnion<'root' | 'actionButton'>;
|
|
13
|
+
type SnackBarContentStyles = NamedStylesStringUnion<'root' | 'actionButton' | 'actionLabel' | 'actionElement'>;
|
|
14
14
|
|
|
15
15
|
const useStyles: UseStyles<SnackBarContentStyles> = function (): SnackBarContentStyles {
|
|
16
16
|
const theme = useTheme();
|
|
@@ -30,6 +30,14 @@ const useStyles: UseStyles<SnackBarContentStyles> = function (): SnackBarContent
|
|
|
30
30
|
actionButton: {
|
|
31
31
|
marginLeft: theme.spacing(6),
|
|
32
32
|
},
|
|
33
|
+
actionLabel: {
|
|
34
|
+
paddingBottom: theme.spacing(1.5),
|
|
35
|
+
paddingTop: theme.spacing(1.25),
|
|
36
|
+
},
|
|
37
|
+
actionElement: {
|
|
38
|
+
paddingLeft: theme.spacing(2),
|
|
39
|
+
paddingVertical: theme.spacing(1.25),
|
|
40
|
+
},
|
|
33
41
|
};
|
|
34
42
|
};
|
|
35
43
|
|
|
@@ -51,8 +59,8 @@ export default function SnackbarContent(props: SnackbarContentProps) {
|
|
|
51
59
|
|
|
52
60
|
const titleFontStyle = createFontStyle(theme, {
|
|
53
61
|
selector: (_) => typographyOf({
|
|
54
|
-
fontSize:
|
|
55
|
-
lineHeight:
|
|
62
|
+
fontSize: 15,
|
|
63
|
+
lineHeight: 19.5,
|
|
56
64
|
fontFamily: 'PretendardStd-SemiBold',
|
|
57
65
|
letterSpacing: 0,
|
|
58
66
|
}),
|
|
@@ -60,12 +68,19 @@ export default function SnackbarContent(props: SnackbarContentProps) {
|
|
|
60
68
|
});
|
|
61
69
|
|
|
62
70
|
const messageFontStyle = createFontStyle(theme, {
|
|
63
|
-
selector: (_) =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
selector: (_) => title
|
|
72
|
+
? typographyOf({
|
|
73
|
+
fontSize: 12,
|
|
74
|
+
lineHeight: 15.6,
|
|
75
|
+
fontFamily: 'PretendardStd-Regular',
|
|
76
|
+
letterSpacing: 0,
|
|
77
|
+
})
|
|
78
|
+
: typographyOf({
|
|
79
|
+
fontSize: 14,
|
|
80
|
+
lineHeight: 18.2,
|
|
81
|
+
fontFamily: 'PretendardStd-Regular',
|
|
82
|
+
letterSpacing: 0,
|
|
83
|
+
}),
|
|
69
84
|
color: theme.palette.text.strongInverse,
|
|
70
85
|
});
|
|
71
86
|
|
|
@@ -129,11 +144,17 @@ export default function SnackbarContent(props: SnackbarContentProps) {
|
|
|
129
144
|
|
|
130
145
|
<View style={styles.actionButton}>
|
|
131
146
|
{typeof actionContent === 'string' ? (
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
147
|
+
<View style={styles.actionLabel}>
|
|
148
|
+
<Text
|
|
149
|
+
children={actionContent}
|
|
150
|
+
style={labelFontStyle}
|
|
151
|
+
/>
|
|
152
|
+
</View>
|
|
153
|
+
) : (
|
|
154
|
+
<View style={styles.actionElement}>
|
|
155
|
+
{actionContent}
|
|
156
|
+
</View>
|
|
157
|
+
)}
|
|
137
158
|
</View>
|
|
138
159
|
</React.Fragment>
|
|
139
160
|
) : null}
|
package/src/Tabs/Tabs.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import useTabInnerContentsWidth from './useTabInnerContentsWidth';
|
|
|
16
16
|
import useIndexStore from './useIndexStore';
|
|
17
17
|
import InternalContext from './InternalContext';
|
|
18
18
|
import { isEveryTabCoordinatesDefined } from './utils';
|
|
19
|
+
import useTabsStyle from './useTabsStyle';
|
|
19
20
|
|
|
20
21
|
type TabsStyleKeys =
|
|
21
22
|
| 'root'
|
|
@@ -72,6 +73,8 @@ const Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {
|
|
|
72
73
|
|
|
73
74
|
const currentIndexRef = useRef(initialIndex);
|
|
74
75
|
|
|
76
|
+
const { container: containerStyle } = useTabsStyle(variant);
|
|
77
|
+
|
|
75
78
|
const setTab = (newIndex: number) => {
|
|
76
79
|
const currentIndex = currentIndexRef.current;
|
|
77
80
|
onTabSelected?.(newIndex, currentIndex);
|
|
@@ -202,6 +205,7 @@ const Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {
|
|
|
202
205
|
<View
|
|
203
206
|
style={css([
|
|
204
207
|
styles.root,
|
|
208
|
+
containerStyle,
|
|
205
209
|
{ backgroundColor: backgroundColorMap[color] },
|
|
206
210
|
showDivider ? styles.bottomDivider : undefined,
|
|
207
211
|
scrollable ? undefined : styles.fixedRoot,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import type { FountainUiStyle } from '@fountain-ui/styles';
|
|
3
|
+
import { useTheme } from '../styles';
|
|
4
|
+
import type { TabVariant } from '../Tab';
|
|
5
|
+
|
|
6
|
+
interface TabsStyle {
|
|
7
|
+
container: FountainUiStyle;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function useTabsStyle(variant: TabVariant) {
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
|
|
13
|
+
return useMemo<TabsStyle>(() => {
|
|
14
|
+
switch (variant) {
|
|
15
|
+
case 'circular':
|
|
16
|
+
return {
|
|
17
|
+
container: {
|
|
18
|
+
paddingBottom: theme.spacing(2),
|
|
19
|
+
paddingHorizontal: theme.spacing(3),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
case 'bottom-navigation':
|
|
23
|
+
return {
|
|
24
|
+
container: {},
|
|
25
|
+
};
|
|
26
|
+
case 'default':
|
|
27
|
+
default:
|
|
28
|
+
return {
|
|
29
|
+
container: {
|
|
30
|
+
paddingHorizontal: theme.spacing(1.5),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}, [theme, variant]);
|
|
35
|
+
}
|
package/src/Tooltip/Tooltip.tsx
CHANGED
|
@@ -52,14 +52,14 @@ const useStyles: UseStyles<TooltipStyles> = function (): TooltipStyles {
|
|
|
52
52
|
},
|
|
53
53
|
small: {
|
|
54
54
|
borderRadius: theme.shape.radius.sm,
|
|
55
|
+
paddingBottom: theme.spacing(1.75),
|
|
55
56
|
paddingHorizontal: theme.spacing(2),
|
|
56
|
-
|
|
57
|
+
paddingTop: theme.spacing(1.5),
|
|
57
58
|
},
|
|
58
59
|
large: {
|
|
59
60
|
borderRadius: 5,
|
|
60
|
-
paddingBottom: theme.spacing(2.5),
|
|
61
61
|
paddingHorizontal: theme.spacing(4),
|
|
62
|
-
|
|
62
|
+
paddingVertical: theme.spacing(2),
|
|
63
63
|
},
|
|
64
64
|
};
|
|
65
65
|
};
|
|
@@ -140,12 +140,7 @@ export default function Tooltip(props: TooltipProps) {
|
|
|
140
140
|
|
|
141
141
|
const fontStyle = createFontStyle(theme, {
|
|
142
142
|
selector: (typo) => size === 'large'
|
|
143
|
-
?
|
|
144
|
-
fontSize: 13,
|
|
145
|
-
lineHeight: 19.5,
|
|
146
|
-
fontFamily: 'PretendardStd-Regular',
|
|
147
|
-
letterSpacing: 0,
|
|
148
|
-
})
|
|
143
|
+
? typo.body3.regular
|
|
149
144
|
: typo.caption2.regular,
|
|
150
145
|
color: theme.palette.text.strongInverse,
|
|
151
146
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ViewStyle } from 'react-native';
|
|
2
1
|
import type { FountainUiStyle } from '@fountain-ui/styles';
|
|
3
2
|
import { useBreakpointByWidth } from '@fountain-ui/styles';
|
|
4
3
|
import { css, useTheme } from '../styles';
|
|
@@ -11,18 +10,17 @@ export interface Config {
|
|
|
11
10
|
styleProvider?: (theme: Theme) => FountainUiStyle;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
function getMaxWidth(theme: Theme, breakpoint: Breakpoint):
|
|
13
|
+
function getMaxWidth(theme: Theme, breakpoint: Breakpoint, customMaxWidth?: number): number | undefined {
|
|
15
14
|
switch (breakpoint) {
|
|
16
15
|
case 'lg':
|
|
17
|
-
return theme.breakpoints.values['lg'];
|
|
18
16
|
case 'md':
|
|
19
|
-
return theme.breakpoints.values[
|
|
17
|
+
return customMaxWidth ?? theme.breakpoints.values[breakpoint];
|
|
20
18
|
default:
|
|
21
|
-
return
|
|
19
|
+
return undefined;
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint):
|
|
23
|
+
function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): number {
|
|
26
24
|
switch (breakpoint) {
|
|
27
25
|
case 'sm':
|
|
28
26
|
return theme.spacing(6);
|
|
@@ -33,7 +31,7 @@ function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): ViewStyle['
|
|
|
33
31
|
|
|
34
32
|
export default function useContentContainerStyle(config: Config): FountainUiStyle {
|
|
35
33
|
const {
|
|
36
|
-
maxWidth,
|
|
34
|
+
maxWidth: customMaxWidth,
|
|
37
35
|
styleProvider,
|
|
38
36
|
} = config;
|
|
39
37
|
|
|
@@ -43,11 +41,16 @@ export default function useContentContainerStyle(config: Config): FountainUiStyl
|
|
|
43
41
|
|
|
44
42
|
const additionalStyle = styleProvider?.(theme);
|
|
45
43
|
|
|
44
|
+
const maxWidth = getMaxWidth(theme, currentBreakpoint, customMaxWidth);
|
|
45
|
+
const paddingHorizontal = getPaddingHorizontal(theme, currentBreakpoint);
|
|
46
|
+
|
|
47
|
+
const resolvedMaxWidth = typeof maxWidth === 'number' ? maxWidth + paddingHorizontal * 2 : undefined;
|
|
48
|
+
|
|
46
49
|
return css([
|
|
47
50
|
{
|
|
48
51
|
alignSelf: 'center',
|
|
49
|
-
maxWidth:
|
|
50
|
-
paddingHorizontal
|
|
52
|
+
maxWidth: resolvedMaxWidth,
|
|
53
|
+
paddingHorizontal,
|
|
51
54
|
width: '100%',
|
|
52
55
|
},
|
|
53
56
|
additionalStyle,
|