@fountain-ui/core 3.0.0-alpha.43 → 3.0.0-alpha.45

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/Button/useVariantStyleMap.js +9 -0
  2. package/build/commonjs/Button/useVariantStyleMap.js.map +1 -1
  3. package/build/commonjs/Image/Image.js +11 -2
  4. package/build/commonjs/Image/Image.js.map +1 -1
  5. package/build/commonjs/Image/ImageProps.js.map +1 -1
  6. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButton.js +46 -0
  7. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButton.js.map +1 -0
  8. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButtonProps.js +2 -0
  9. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButtonProps.js.map +1 -0
  10. package/build/commonjs/Image/OverlayCloseButton/index.js +16 -0
  11. package/build/commonjs/Image/OverlayCloseButton/index.js.map +1 -0
  12. package/build/commonjs/Image/preload.js +10 -0
  13. package/build/commonjs/Image/preload.js.map +1 -0
  14. package/build/commonjs/Image/preload.native.js +22 -0
  15. package/build/commonjs/Image/preload.native.js.map +1 -0
  16. package/build/commonjs/ImageCore/ImageCoreNative.js +10 -7
  17. package/build/commonjs/ImageCore/ImageCoreNative.js.map +1 -1
  18. package/build/commonjs/ImageCore/ImageCoreProps.js.map +1 -1
  19. package/build/commonjs/Radio/Radio.js +15 -2
  20. package/build/commonjs/Radio/Radio.js.map +1 -1
  21. package/build/commonjs/Radio/RadioProps.js.map +1 -1
  22. package/build/commonjs/TextField/TextField.js +33 -3
  23. package/build/commonjs/TextField/TextField.js.map +1 -1
  24. package/build/commonjs/Tooltip/Tooltip.js +5 -1
  25. package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
  26. package/build/commonjs/internal/icons/CloseCircleFillPierced.js +23 -0
  27. package/build/commonjs/internal/icons/CloseCircleFillPierced.js.map +1 -0
  28. package/build/commonjs/internal/icons/index.js +8 -0
  29. package/build/commonjs/internal/icons/index.js.map +1 -1
  30. package/build/module/Button/useVariantStyleMap.js +9 -0
  31. package/build/module/Button/useVariantStyleMap.js.map +1 -1
  32. package/build/module/Image/Image.js +9 -2
  33. package/build/module/Image/Image.js.map +1 -1
  34. package/build/module/Image/ImageProps.js.map +1 -1
  35. package/build/module/Image/OverlayCloseButton/OverlayCloseButton.js +31 -0
  36. package/build/module/Image/OverlayCloseButton/OverlayCloseButton.js.map +1 -0
  37. package/build/module/Image/OverlayCloseButton/OverlayCloseButtonProps.js +2 -0
  38. package/build/module/Image/OverlayCloseButton/OverlayCloseButtonProps.js.map +1 -0
  39. package/build/module/Image/OverlayCloseButton/index.js +2 -0
  40. package/build/module/Image/OverlayCloseButton/index.js.map +1 -0
  41. package/build/module/Image/preload.js +3 -0
  42. package/build/module/Image/preload.js.map +1 -0
  43. package/build/module/Image/preload.native.js +12 -0
  44. package/build/module/Image/preload.native.js.map +1 -0
  45. package/build/module/ImageCore/ImageCoreNative.js +11 -7
  46. package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
  47. package/build/module/ImageCore/ImageCoreProps.js.map +1 -1
  48. package/build/module/Radio/Radio.js +13 -2
  49. package/build/module/Radio/Radio.js.map +1 -1
  50. package/build/module/Radio/RadioProps.js.map +1 -1
  51. package/build/module/TextField/TextField.js +33 -4
  52. package/build/module/TextField/TextField.js.map +1 -1
  53. package/build/module/Tooltip/Tooltip.js +6 -2
  54. package/build/module/Tooltip/Tooltip.js.map +1 -1
  55. package/build/module/internal/icons/CloseCircleFillPierced.js +9 -0
  56. package/build/module/internal/icons/CloseCircleFillPierced.js.map +1 -0
  57. package/build/module/internal/icons/index.js +1 -0
  58. package/build/module/internal/icons/index.js.map +1 -1
  59. package/build/typescript/Image/Image.d.ts +6 -1
  60. package/build/typescript/Image/ImageProps.d.ts +6 -0
  61. package/build/typescript/Image/OverlayCloseButton/OverlayCloseButton.d.ts +2 -0
  62. package/build/typescript/Image/OverlayCloseButton/OverlayCloseButtonProps.d.ts +3 -0
  63. package/build/typescript/Image/OverlayCloseButton/index.d.ts +2 -0
  64. package/build/typescript/Image/preload.d.ts +2 -0
  65. package/build/typescript/Image/preload.native.d.ts +2 -0
  66. package/build/typescript/ImageCore/ImageCoreProps.d.ts +1 -0
  67. package/build/typescript/Radio/RadioProps.d.ts +4 -0
  68. package/build/typescript/internal/icons/CloseCircleFillPierced.d.ts +358 -0
  69. package/build/typescript/internal/icons/index.d.ts +1 -0
  70. package/package.json +3 -3
  71. package/src/Button/useVariantStyleMap.ts +9 -0
  72. package/src/Image/Image.tsx +11 -2
  73. package/src/Image/ImageProps.ts +7 -0
  74. package/src/Image/OverlayCloseButton/OverlayCloseButton.tsx +41 -0
  75. package/src/Image/OverlayCloseButton/OverlayCloseButtonProps.ts +3 -0
  76. package/src/Image/OverlayCloseButton/index.ts +2 -0
  77. package/src/Image/preload.native.ts +6 -0
  78. package/src/Image/preload.ts +5 -0
  79. package/src/ImageCore/ImageCoreNative.tsx +10 -7
  80. package/src/ImageCore/ImageCoreProps.ts +1 -0
  81. package/src/Radio/Radio.tsx +27 -10
  82. package/src/Radio/RadioProps.ts +6 -0
  83. package/src/TextField/TextField.tsx +33 -3
  84. package/src/Tooltip/Tooltip.tsx +6 -1
  85. package/src/internal/icons/CloseCircleFillPierced.tsx +13 -0
  86. package/src/internal/icons/index.ts +1 -0
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
2
2
  import type { NativeSyntheticEvent, TextInputFocusEventData } from 'react-native';
3
3
  import { Platform, StyleSheet, Text, TextInput, View } from 'react-native';
4
4
  import type { FountainUiStyle } from '@fountain-ui/styles';
@@ -11,6 +11,8 @@ import type TextFieldProps from './TextFieldProps';
11
11
  import type { TextFieldStatus, TextFieldVariant } from './TextFieldProps';
12
12
  import useVariantStyleMap from './useVariantStyleMap';
13
13
 
14
+ const isWeb = Platform.OS === 'web';
15
+
14
16
  const styles = StyleSheet.create({
15
17
  root: {
16
18
  alignItems: 'center',
@@ -57,6 +59,7 @@ const TextField = React.forwardRef<TextInput, TextFieldProps>(function TextField
57
59
  const {
58
60
  autoFocus,
59
61
  containerStyle: containerStyleProp,
62
+ multiline,
60
63
  editable = true,
61
64
  hint,
62
65
  isLoading,
@@ -84,6 +87,17 @@ const TextField = React.forwardRef<TextInput, TextFieldProps>(function TextField
84
87
  const [isFocused, setIsFocused] = useState<boolean>(autoFocus ?? false);
85
88
  const [secureTextEntry, setSecureTextEntry] = useState<boolean>(secureTextEntryProp ?? false);
86
89
 
90
+ const internalRef = useRef<TextInput>(null);
91
+
92
+ const mergedRef = useCallback((node: TextInput | null) => {
93
+ (internalRef as React.MutableRefObject<TextInput | null>).current = node;
94
+ if (typeof ref === 'function') {
95
+ ref(node);
96
+ } else if (ref) {
97
+ (ref as React.MutableRefObject<TextInput | null>).current = node;
98
+ }
99
+ }, [ref]);
100
+
87
101
  const variantStyles = useVariantStyleMap(variant, status, isFocused);
88
102
 
89
103
  const handleBlur = (event: NativeSyntheticEvent<TextInputFocusEventData>) => {
@@ -100,6 +114,21 @@ const TextField = React.forwardRef<TextInput, TextFieldProps>(function TextField
100
114
  setSecureTextEntry((current) => !current);
101
115
  };
102
116
 
117
+ const resizeHeight = useCallback(() => {
118
+ const el = internalRef.current as unknown as HTMLTextAreaElement | null;
119
+ if (el) {
120
+ el.style.height = 'auto';
121
+ el.style.height = `${el.scrollHeight}px`;
122
+ }
123
+ }, []);
124
+
125
+ useLayoutEffect(() => {
126
+ const shouldResizeHeight = multiline && isWeb;
127
+ if (shouldResizeHeight) {
128
+ resizeHeight();
129
+ }
130
+ }, [resizeHeight, multiline, value]);
131
+
103
132
  const handleChangeText = (text: string) => {
104
133
  onChangeTextProp?.(text);
105
134
  };
@@ -119,7 +148,7 @@ const TextField = React.forwardRef<TextInput, TextFieldProps>(function TextField
119
148
  styles.input,
120
149
  variantStyles.inputStyle,
121
150
  variantStyles.inputFontStyle,
122
- Platform.OS === 'web' ? { outlineWidth: 0 } as FountainUiStyle : {},
151
+ isWeb ? { outlineWidth: 0 } as FountainUiStyle : {},
123
152
  styleProp,
124
153
  ]);
125
154
 
@@ -180,10 +209,11 @@ const TextField = React.forwardRef<TextInput, TextFieldProps>(function TextField
180
209
  onBlur={handleBlur}
181
210
  onChangeText={handleChangeText}
182
211
  onFocus={handleFocus}
183
- ref={ref}
212
+ ref={mergedRef}
184
213
  secureTextEntry={secureTextEntry}
185
214
  style={inputStyle}
186
215
  value={value}
216
+ multiline={multiline}
187
217
  {...otherProps}
188
218
  />
189
219
  </View>
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Platform, Text, View, ViewProps } from 'react-native';
2
+ import { Platform, StyleSheet, Text, View, ViewProps } from 'react-native';
3
3
  import type { WithTimingConfig } from 'react-native-reanimated';
4
4
  import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
5
5
  import type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
@@ -150,8 +150,13 @@ export default function Tooltip(props: TooltipProps) {
150
150
  { flexShrink: 1 },
151
151
  ]);
152
152
 
153
+ const beakOverlapStyle = {
154
+ [placement === 'top' ? 'marginTop' : placement === 'bottom' ? 'marginBottom' : placement === 'left' ? 'marginLeft' : 'marginRight']: -StyleSheet.hairlineWidth,
155
+ };
156
+
153
157
  const beakStyle = css({
154
158
  transform: [isVerticalPlacement ? { translateX: beakOffset } : { translateY: beakOffset }],
159
+ ...beakOverlapStyle,
155
160
  });
156
161
 
157
162
  const buttonElem = (
@@ -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="M11 1C4.92487 1 0 5.92487 0 12C0 18.0751 4.92487 23 11 23C17.0751 23 22 18.0751 22 12C22 5.92487 17.0751 1 11 1ZM8.70711 8.29289C8.31658 7.90237 7.68342 7.90237 7.29289 8.29289C6.90237 8.68342 6.90237 9.31658 7.29289 9.70711L9.58579 12L7.29289 14.2929C6.90237 14.6834 6.90237 15.3166 7.29289 15.7071C7.68342 16.0976 8.31658 16.0976 8.70711 15.7071L11 13.4142L13.2929 15.7071C13.6834 16.0976 14.3166 16.0976 14.7071 15.7071C15.0976 15.3166 15.0976 14.6834 14.7071 14.2929L12.4142 12L14.7071 9.70711C15.0976 9.31658 15.0976 8.68342 14.7071 8.29289C14.3166 7.90237 13.6834 7.90237 13.2929 8.29289L11 10.5858L8.70711 8.29289Z"
10
+ />,
11
+ 'CloseCircleFillPierced',
12
+ '0 0 22 24',
13
+ );
@@ -11,6 +11,7 @@ export { default as ChipClose } from './ChipClose';
11
11
  export { default as CircularProgress } from './CircularProgress';
12
12
  export { default as Clear } from './Clear';
13
13
  export { default as Close } from './Close';
14
+ export { default as CloseCircleFillPierced } from './CloseCircleFillPierced';
14
15
  export { default as EyeOff } from './EyeOff';
15
16
  export { default as EyeOn } from './EyeOn';
16
17
  export { default as InfoCircle } from './InfoCircle';