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

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 (47) 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/module/Accordion/Accordion.js +3 -3
  19. package/build/module/Accordion/Accordion.js.map +1 -1
  20. package/build/module/Accordion/useVariantStyleMap.js +6 -2
  21. package/build/module/Accordion/useVariantStyleMap.js.map +1 -1
  22. package/build/module/BottomSheetTitle/BottomSheetTitle.js +1 -0
  23. package/build/module/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  24. package/build/module/BottomSheetTitle/BottomSheetTitleProps.js.map +1 -1
  25. package/build/module/Button/Button.js +11 -9
  26. package/build/module/Button/Button.js.map +1 -1
  27. package/build/module/Dialog/Dialog.js +7 -3
  28. package/build/module/Dialog/Dialog.js.map +1 -1
  29. package/build/module/Dialog/FullDialogCloseButton.js +42 -0
  30. package/build/module/Dialog/FullDialogCloseButton.js.map +1 -0
  31. package/build/module/Dialog/useDialogStyle.js +12 -3
  32. package/build/module/Dialog/useDialogStyle.js.map +1 -1
  33. package/build/module/ImageCore/ImageCoreNative.js +1 -1
  34. package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
  35. package/build/typescript/BottomSheetTitle/BottomSheetTitleProps.d.ts +1 -0
  36. package/build/typescript/Dialog/Dialog.d.ts +6 -1
  37. package/build/typescript/Dialog/FullDialogCloseButton.d.ts +10 -0
  38. package/package.json +4 -4
  39. package/src/Accordion/Accordion.tsx +7 -7
  40. package/src/Accordion/useVariantStyleMap.ts +4 -0
  41. package/src/BottomSheetTitle/BottomSheetTitle.tsx +1 -0
  42. package/src/BottomSheetTitle/BottomSheetTitleProps.ts +1 -0
  43. package/src/Button/Button.tsx +9 -8
  44. package/src/Dialog/Dialog.tsx +6 -1
  45. package/src/Dialog/FullDialogCloseButton.tsx +63 -0
  46. package/src/Dialog/useDialogStyle.ts +12 -2
  47. package/src/ImageCore/ImageCoreNative.tsx +1 -1
@@ -140,20 +140,20 @@ export default function Accordion(props: AccordionProps) {
140
140
  />
141
141
  </Row>
142
142
 
143
- {subTitle && variant === 'solid' ?
144
- typeof subTitle === 'string' ? (
145
- <React.Fragment>
146
- <Spacer size={1.5}/>
143
+ {subTitle && variant === 'solid' ? (
144
+ <React.Fragment>
145
+ <Spacer size={1.5}/>
147
146
 
147
+ {typeof subTitle === 'string' ? (
148
148
  <Text
149
149
  allowFontScaling={false}
150
150
  children={subTitle}
151
151
  numberOfLines={1}
152
152
  style={subTitleFontStyle}
153
153
  />
154
- </React.Fragment>
155
- ) : (subTitle)
156
- : null}
154
+ ) : (subTitle)}
155
+ </React.Fragment>
156
+ ) : null}
157
157
  </Column>
158
158
 
159
159
  <Spacer flex={1}/>
@@ -30,10 +30,12 @@ export default function useVariantStyleMap(variant: AccordionVariant): VariantSt
30
30
  content: {
31
31
  borderTopColor: theme.palette.border.weak,
32
32
  borderTopWidth: 0.5,
33
+ left: 0,
33
34
  marginHorizontal: theme.spacing(4),
34
35
  paddingBottom: theme.spacing(5),
35
36
  paddingTop: theme.spacing(4),
36
37
  position: 'absolute',
38
+ right: 0,
37
39
  },
38
40
  contentFont: createFontStyle(theme, {
39
41
  selector: (typography) => typography.body3.regular,
@@ -69,10 +71,12 @@ export default function useVariantStyleMap(variant: AccordionVariant): VariantSt
69
71
  content: {
70
72
  borderTopColor: theme.palette.border.weak,
71
73
  borderTopWidth: 0.5,
74
+ left: 0,
72
75
  marginHorizontal: theme.spacing(4),
73
76
  paddingBottom: theme.spacing(4),
74
77
  paddingTop: theme.spacing(3),
75
78
  position: 'absolute',
79
+ right: 0,
76
80
  },
77
81
  contentFont: createFontStyle(theme, {
78
82
  selector: (typography) => typography.caption2.regular,
@@ -72,6 +72,7 @@ export default function BottomSheetTitle(props: BottomSheetTitleProps) {
72
72
  <Button
73
73
  children={actionButtonProps.title}
74
74
  color={'accent'}
75
+ disabled={actionButtonProps.disabled ?? false}
75
76
  disableMinWidth={true}
76
77
  onPress={actionButtonProps.onPress}
77
78
  size={'large'}
@@ -2,6 +2,7 @@ import type { OverridableComponentProps } from '../types';
2
2
  import type { RowProps } from '../Row';
3
3
 
4
4
  type ActionButtonProps = {
5
+ disabled?: boolean | undefined;
5
6
  title: string;
6
7
  onPress: () => void;
7
8
  };
@@ -27,21 +27,21 @@ const useStyles: UseStyles<ButtonStyles> = function (): ButtonStyles {
27
27
  width: '100%',
28
28
  },
29
29
  large: {
30
- gap: theme.spacing(2),
30
+ gap: 8,
31
31
  minWidth: 104,
32
- paddingHorizontal: theme.spacing(6),
33
- paddingVertical: theme.spacing(3.5),
32
+ paddingHorizontal: 24,
33
+ paddingVertical: 14,
34
34
  },
35
35
  medium: {
36
- gap: theme.spacing(1.5),
36
+ gap: 6,
37
37
  minWidth: 88,
38
- paddingHorizontal: theme.spacing(6),
39
- paddingVertical: theme.spacing(2.75),
38
+ paddingHorizontal: 16,
39
+ paddingVertical: 11,
40
40
  },
41
41
  small: {
42
42
  minWidth: 64,
43
- paddingHorizontal: theme.spacing(6),
44
- paddingVertical: theme.spacing(2),
43
+ paddingHorizontal: 10,
44
+ paddingVertical: 8,
45
45
  },
46
46
  loadingSpinner: {
47
47
  position: 'absolute',
@@ -134,6 +134,7 @@ export default function Button(props: ButtonProps) {
134
134
  styles.root,
135
135
  containerStyle,
136
136
  styles[size],
137
+ (variant === 'capsuleSolid' || variant === 'capsuleOutlined') && size === 'small' ? { paddingHorizontal: 12 } : undefined,
137
138
  fullWidth ? styles.fullWidth : undefined,
138
139
  disableMinWidth ? { minWidth: 0 } : undefined,
139
140
  disablePadding ? { paddingHorizontal: 0, paddingVertical: 0 } : undefined,
@@ -6,11 +6,12 @@ import Modal, { ANIMATION_TYPE, AnimationUnit } from '../Modal';
6
6
  import ShadowView from '../ShadowView';
7
7
  import type DialogProps from './DialogProps';
8
8
  import { DialogProvider } from './DialogContext';
9
+ import FullDialogCloseButton from './FullDialogCloseButton';
9
10
  import useDialogStyle from './useDialogStyle';
10
11
 
11
12
  const TOP_ELEMENT_OFFSET = 20;
12
13
 
13
- export default function Dialog(props: DialogProps) {
14
+ const Dialog = (props: DialogProps) => {
14
15
  const {
15
16
  animationType = ANIMATION_TYPE.SLIDE,
16
17
  children,
@@ -143,3 +144,7 @@ export default function Dialog(props: DialogProps) {
143
144
  </Modal>
144
145
  );
145
146
  };
147
+
148
+ Dialog.FullDialogCloseButton = FullDialogCloseButton;
149
+
150
+ export default Dialog;
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import type { ViewProps } from 'react-native';
3
+ import { View } from 'react-native';
4
+ import type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
5
+ import type { IconButtonProps } from '../IconButton';
6
+ import { css, useTheme } from '../styles';
7
+ import type { OverridableComponentProps } from '../types';
8
+ import IconButton from '../IconButton';
9
+ import { Close } from '../internal';
10
+
11
+ type TabsStyles = NamedStylesStringUnion<'root' | 'button'>;
12
+
13
+ const useStyles: UseStyles<TabsStyles> = function (): TabsStyles {
14
+ const theme = useTheme();
15
+
16
+ return {
17
+ root: {
18
+ paddingBottom: 40,
19
+ paddingTop: 16,
20
+ },
21
+ button: {
22
+ alignSelf: 'center',
23
+ backgroundColor: theme.palette.fill.baseAlt,
24
+ borderRadius: theme.shape.radius.full,
25
+ height: 48,
26
+ width: 48,
27
+ },
28
+ };
29
+ };
30
+
31
+ interface FullDialogCloseButtonProps extends OverridableComponentProps<ViewProps, {
32
+ onPress: IconButtonProps['onPress'];
33
+ }> {}
34
+
35
+ export default function FullDialogCloseButton(props: FullDialogCloseButtonProps) {
36
+ const {
37
+ onPress,
38
+ style: styleProp,
39
+ ...otherProps
40
+ } = props;
41
+
42
+ const styles = useStyles();
43
+
44
+ const rootStyle = css([
45
+ styles.root,
46
+ styleProp,
47
+ ]);
48
+
49
+ return (
50
+ <View
51
+ style={rootStyle}
52
+ {...otherProps}
53
+ >
54
+ <IconButton
55
+ iconSize={'large'}
56
+ onPress={onPress}
57
+ style={styles.button}
58
+ >
59
+ <Close/>
60
+ </IconButton>
61
+ </View>
62
+ );
63
+ }
@@ -1,5 +1,6 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useWindowDimensions } from 'react-native';
3
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
4
  import type { FountainUiStyle, NamedStylesStringUnion } from '@fountain-ui/styles';
4
5
  import { useTheme } from '../styles';
5
6
  import type { DialogSize } from './DialogProps';
@@ -21,6 +22,11 @@ export default function useDialogStyle(size: DialogSize): DialogStyles {
21
22
  width: windowWidth,
22
23
  } = useWindowDimensions();
23
24
 
25
+ const {
26
+ bottom: bottomSafeAreaInset,
27
+ top: topSafeAreaInset,
28
+ } = useSafeAreaInsets();
29
+
24
30
  return useMemo(() => {
25
31
  const sizeStyleMap: Record<DialogSize, FountainUiStyle> = {
26
32
  small: {
@@ -34,7 +40,10 @@ export default function useDialogStyle(size: DialogSize): DialogStyles {
34
40
  minHeight: 360,
35
41
  width: 512,
36
42
  },
37
- full: {},
43
+ full: {
44
+ paddingBottom: bottomSafeAreaInset,
45
+ paddingTop: topSafeAreaInset,
46
+ },
38
47
  };
39
48
 
40
49
  const containerPaddingVertical = 24;
@@ -62,6 +71,7 @@ export default function useDialogStyle(size: DialogSize): DialogStyles {
62
71
  backgroundColor: theme.palette.surface.base,
63
72
  height: '100%',
64
73
  width: '100%',
74
+ ...sizeStyleMap[size],
65
75
  } : {
66
76
  backgroundColor: theme.palette.surface.base,
67
77
  borderRadius: theme.shape.radius.xl,
@@ -80,5 +90,5 @@ export default function useDialogStyle(size: DialogSize): DialogStyles {
80
90
  width: '100%',
81
91
  },
82
92
  };
83
- }, [theme, windowHeight, windowWidth, size]);
93
+ }, [theme, windowHeight, windowWidth, size, bottomSafeAreaInset, topSafeAreaInset]);
84
94
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useContext } from 'react';
2
2
  import { Animated } from 'react-native';
3
- import FastImage from 'react-native-fast-image';
3
+ import FastImage from '@d11/react-native-fast-image';
4
4
  import { useAnimatedValue } from '../hooks';
5
5
  import { isNotAndroid12 } from '../utils';
6
6
  import type ImageCoreProps from './ImageCoreProps';