@fountain-ui/core 3.0.0-alpha.22 → 3.0.0-alpha.24

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 (45) hide show
  1. package/build/commonjs/Chip/Chip.js +8 -4
  2. package/build/commonjs/Chip/Chip.js.map +1 -1
  3. package/build/commonjs/Chip/useChipStyle.js +25 -15
  4. package/build/commonjs/Chip/useChipStyle.js.map +1 -1
  5. package/build/commonjs/Dialog/useDialogStyle.js +1 -1
  6. package/build/commonjs/Dialog/useDialogStyle.js.map +1 -1
  7. package/build/commonjs/Image/Image.js +1 -1
  8. package/build/commonjs/Image/Image.js.map +1 -1
  9. package/build/commonjs/TextField/useVariantStyleMap.js +7 -5
  10. package/build/commonjs/TextField/useVariantStyleMap.js.map +1 -1
  11. package/build/commonjs/hooks/useContentContainerStyle.js +24 -3
  12. package/build/commonjs/hooks/useContentContainerStyle.js.map +1 -1
  13. package/build/commonjs/internal/icons/ChipClose.js +23 -0
  14. package/build/commonjs/internal/icons/ChipClose.js.map +1 -0
  15. package/build/commonjs/internal/icons/index.js +8 -0
  16. package/build/commonjs/internal/icons/index.js.map +1 -1
  17. package/build/module/Chip/Chip.js +9 -5
  18. package/build/module/Chip/Chip.js.map +1 -1
  19. package/build/module/Chip/useChipStyle.js +25 -15
  20. package/build/module/Chip/useChipStyle.js.map +1 -1
  21. package/build/module/Dialog/useDialogStyle.js +1 -1
  22. package/build/module/Dialog/useDialogStyle.js.map +1 -1
  23. package/build/module/Image/Image.js +1 -1
  24. package/build/module/Image/Image.js.map +1 -1
  25. package/build/module/TextField/useVariantStyleMap.js +7 -5
  26. package/build/module/TextField/useVariantStyleMap.js.map +1 -1
  27. package/build/module/hooks/useContentContainerStyle.js +24 -3
  28. package/build/module/hooks/useContentContainerStyle.js.map +1 -1
  29. package/build/module/internal/icons/ChipClose.js +9 -0
  30. package/build/module/internal/icons/ChipClose.js.map +1 -0
  31. package/build/module/internal/icons/index.js +1 -0
  32. package/build/module/internal/icons/index.js.map +1 -1
  33. package/build/typescript/Chip/useChipStyle.d.ts +3 -1
  34. package/build/typescript/hooks/useContentContainerStyle.d.ts +1 -0
  35. package/build/typescript/internal/icons/ChipClose.d.ts +131 -0
  36. package/build/typescript/internal/icons/index.d.ts +1 -0
  37. package/package.json +2 -2
  38. package/src/Chip/Chip.tsx +10 -6
  39. package/src/Chip/useChipStyle.ts +29 -16
  40. package/src/Dialog/useDialogStyle.ts +1 -1
  41. package/src/Image/Image.tsx +2 -2
  42. package/src/TextField/useVariantStyleMap.ts +4 -3
  43. package/src/hooks/useContentContainerStyle.ts +22 -2
  44. package/src/internal/icons/ChipClose.tsx +13 -0
  45. package/src/internal/icons/index.ts +1 -0
@@ -1,12 +1,14 @@
1
1
  import { useMemo } from 'react';
2
2
  import type { TextStyle } from 'react-native';
3
3
  import type { FountainUiStyle } from '@fountain-ui/styles';
4
+ import type { SvgIconProps } from '../SvgIcon';
4
5
  import { createFontStyle, useTheme } from '../styles';
5
6
  import type { ChipColor, ChipSize, ChipStartElementVariant } from './ChipProps';
6
7
 
7
8
  interface ChipStyle {
8
9
  container: FountainUiStyle;
9
- closeButton?: FountainUiStyle;
10
+ closeButtonContainer?: FountainUiStyle;
11
+ closeIconSize?: Pick<SvgIconProps, 'height' | 'width'>;
10
12
  label: TextStyle;
11
13
  startElement?: FountainUiStyle;
12
14
  startElementContainer?: FountainUiStyle;
@@ -14,6 +16,28 @@ interface ChipStyle {
14
16
 
15
17
  type VariantStyleMap = Record<ChipStartElementVariant, Partial<ChipStyle>>;
16
18
 
19
+ const closeButtonContainerStyleMap: Record<ChipSize, FountainUiStyle> = {
20
+ small: {
21
+ marginLeft: 8,
22
+ paddingTop: 1,
23
+ },
24
+ large: {
25
+ marginLeft: 10,
26
+ paddingTop: 1,
27
+ },
28
+ };
29
+
30
+ const closeIconSize: Record<ChipSize, ChipStyle['closeIconSize']> = {
31
+ small: {
32
+ height: 14,
33
+ width: 8.17,
34
+ },
35
+ large: {
36
+ height: 16,
37
+ width: 9,
38
+ },
39
+ };
40
+
17
41
  // TODO: need to refactoring...
18
42
  export default function useChipStyle(
19
43
  size: ChipSize,
@@ -35,19 +59,6 @@ export default function useChipStyle(
35
59
  }),
36
60
  };
37
61
 
38
- const closeButtonStyleMap: Record<ChipSize, FountainUiStyle> = {
39
- small: {
40
- height: 14,
41
- marginLeft: theme.spacing(2),
42
- width: 8.17,
43
- },
44
- large: {
45
- height: 17,
46
- marginLeft: theme.spacing(2.5),
47
- width: 9,
48
- },
49
- };
50
-
51
62
  const baseContainerStyle: FountainUiStyle = {
52
63
  alignItems: 'center',
53
64
  backgroundColor: selected ? theme.palette.fill.base
@@ -115,7 +126,8 @@ export default function useChipStyle(
115
126
  default: {
116
127
  container: {
117
128
  paddingBottom: theme.spacing(1.75),
118
- paddingHorizontal: theme.spacing(isLarge ? 3.5 : 3),
129
+ paddingLeft: theme.spacing(isLarge ? 3.5 : 3),
130
+ paddingRight: theme.spacing(isLarge ? 3.5 : 3),
119
131
  paddingTop: theme.spacing(1.5),
120
132
  },
121
133
  },
@@ -127,7 +139,8 @@ export default function useChipStyle(
127
139
  ...variantStyleMap[startElementVariant]?.container,
128
140
  ...(selected ? { paddingRight: theme.spacing(isLarge ? 2.5 : 2.25) } : {}),
129
141
  },
130
- closeButton: closeButtonStyleMap[size],
142
+ closeButtonContainer: closeButtonContainerStyleMap[size],
143
+ closeIconSize: closeIconSize[size],
131
144
  label: fontStyleMap[size],
132
145
  startElement: variantStyleMap[startElementVariant]?.startElement,
133
146
  startElementContainer: variantStyleMap[startElementVariant]?.startElementContainer,
@@ -42,7 +42,7 @@ export default function useDialogStyle(size: DialogSize): DialogStyles {
42
42
  },
43
43
  full: {
44
44
  paddingBottom: bottomSafeAreaInset,
45
- paddingTop: topSafeAreaInset,
45
+ paddingTop: Math.max(0, topSafeAreaInset - 3),
46
46
  },
47
47
  };
48
48
 
@@ -34,7 +34,7 @@ const useStyles: UseStyles<ImageStyles> = function (): ImageStyles {
34
34
  backgroundColor: theme.palette.paper.grey,
35
35
  },
36
36
  outlined: {
37
- borderWidth: StyleSheet.hairlineWidth,
37
+ borderWidth: 0.5,
38
38
  borderStyle: 'solid',
39
39
  borderColor: theme.palette.border.weak,
40
40
  },
@@ -156,4 +156,4 @@ export default function Image(props: ImageProps) {
156
156
  ) : null}
157
157
  </View>
158
158
  );
159
- };
159
+ };
@@ -48,11 +48,11 @@ export default function useVariantStyleMap(variant: TextFieldVariant, status: Te
48
48
  borderBottomColor: status === 'default' && isFocused ? theme.palette.border.strong : borderColor,
49
49
  borderBottomWidth: 1,
50
50
  minHeight: 60,
51
+ paddingVertical: 16,
51
52
  },
52
53
  inputStyle: {
53
- paddingLeft: 0,
54
- paddingRight: theme.spacing(4),
55
- paddingVertical: theme.spacing(4),
54
+ padding: 0,
55
+ paddingRight: 16,
56
56
  ...createFontStyle(theme, {
57
57
  selector: (_) => typographyOf({
58
58
  fontSize: 18,
@@ -83,6 +83,7 @@ export default function useVariantStyleMap(variant: TextFieldVariant, status: Te
83
83
  paddingTop: 11,
84
84
  },
85
85
  inputStyle: {
86
+ padding: 0,
86
87
  ...createFontStyle(theme, {
87
88
  selector: (_) => typographyOf({
88
89
  fontSize: 16,
@@ -7,6 +7,7 @@ type Breakpoint = keyof Theme['breakpoints']['values'];
7
7
  export interface Config {
8
8
  maxWidth?: number;
9
9
  styleProvider?: (theme: Theme) => FountainUiStyle;
10
+ isHomeScreen?: boolean;
10
11
  }
11
12
 
12
13
  function getMaxWidth(theme: Theme, breakpoint: Breakpoint, customMaxWidth?: number): number | undefined {
@@ -19,7 +20,25 @@ function getMaxWidth(theme: Theme, breakpoint: Breakpoint, customMaxWidth?: numb
19
20
  }
20
21
  }
21
22
 
22
- function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): number {
23
+ function getHomeScreenPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): number {
24
+ switch (breakpoint) {
25
+ case 'xxs':
26
+ case 'xs':
27
+ return theme.spacing(3);
28
+ case 'sm':
29
+ return theme.spacing(6);
30
+ case 'md':
31
+ case 'lg':
32
+ default:
33
+ return theme.spacing(4);
34
+ }
35
+ }
36
+
37
+ function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint, isHomeScreen?: boolean): number {
38
+ if (isHomeScreen) {
39
+ return getHomeScreenPaddingHorizontal(theme, breakpoint);
40
+ }
41
+
23
42
  switch (breakpoint) {
24
43
  case 'sm':
25
44
  return theme.spacing(6);
@@ -32,6 +51,7 @@ export default function useContentContainerStyle(config: Config = {}): FountainU
32
51
  const {
33
52
  maxWidth: customMaxWidth,
34
53
  styleProvider,
54
+ isHomeScreen = false,
35
55
  } = config;
36
56
 
37
57
  const theme = useTheme();
@@ -44,7 +64,7 @@ export default function useContentContainerStyle(config: Config = {}): FountainU
44
64
  {
45
65
  alignSelf: 'center',
46
66
  maxWidth: getMaxWidth(theme, currentBreakpoint, customMaxWidth),
47
- paddingHorizontal: getPaddingHorizontal(theme, currentBreakpoint),
67
+ paddingHorizontal: getPaddingHorizontal(theme, currentBreakpoint, isHomeScreen),
48
68
  width: '100%',
49
69
  },
50
70
  additionalStyle,
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { Path } from 'react-native-svg';
3
+ import { createSvgIcon } from '../../utils';
4
+
5
+ export default createSvgIcon(
6
+ <Path
7
+ fillRule="evenodd"
8
+ clipRule="evenodd"
9
+ d="M0.170854 3.58753C0.39866 3.35972 0.768006 3.35972 0.995812 3.58753L4.08333 6.67505L7.17085 3.58753C7.39866 3.35972 7.76801 3.35972 7.99581 3.58753C8.22362 3.81533 8.22362 4.18468 7.99581 4.41248L4.90829 7.5L7.99581 10.5875C8.22362 10.8153 8.22362 11.1847 7.99581 11.4125C7.76801 11.6403 7.39866 11.6403 7.17085 11.4125L4.08333 8.32496L0.995812 11.4125C0.768006 11.6403 0.39866 11.6403 0.170854 11.4125C-0.0569515 11.1847 -0.0569515 10.8153 0.170854 10.5875L3.25838 7.5L0.170854 4.41248C-0.0569515 4.18468 -0.0569515 3.81533 0.170854 3.58753Z"
10
+ />,
11
+ 'ChipClose',
12
+ '0 0 9 15',
13
+ );
@@ -7,6 +7,7 @@ export { default as CheckCircle } from './CheckCircle';
7
7
  export { default as ChevronDown } from './ChevronDown';
8
8
  export { default as ChevronLeft } from './ChevronLeft';
9
9
  export { default as ChevronRight } from './ChevronRight';
10
+ export { default as ChipClose } from './ChipClose';
10
11
  export { default as CircularProgress } from './CircularProgress';
11
12
  export { default as Clear } from './Clear';
12
13
  export { default as Close } from './Close';