@fountain-ui/core 2.0.0-beta.46 → 2.0.0-beta.48

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 (61) hide show
  1. package/build/commonjs/ButtonBase/ButtonBase.js +4 -1
  2. package/build/commonjs/ButtonBase/ButtonBase.js.map +1 -1
  3. package/build/commonjs/ButtonBase/ButtonBaseProps.js.map +1 -1
  4. package/build/commonjs/Chip/Chip.js +7 -7
  5. package/build/commonjs/Chip/Chip.js.map +1 -1
  6. package/build/commonjs/Tab/Tab.js +6 -3
  7. package/build/commonjs/Tab/Tab.js.map +1 -1
  8. package/build/commonjs/Tab/TabIndicator.js +8 -5
  9. package/build/commonjs/Tab/TabIndicator.js.map +1 -1
  10. package/build/commonjs/Tab/TabProps.js.map +1 -1
  11. package/build/commonjs/Tabs/TabIndicator.js +4 -3
  12. package/build/commonjs/Tabs/TabIndicator.js.map +1 -1
  13. package/build/commonjs/Tabs/TabIndicatorProps.js.map +1 -1
  14. package/build/commonjs/Tabs/Tabs.js +3 -0
  15. package/build/commonjs/Tabs/Tabs.js.map +1 -1
  16. package/build/commonjs/Tabs/TabsProps.js.map +1 -1
  17. package/build/commonjs/hooks/useCollapsibleAppBar.js +11 -34
  18. package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
  19. package/build/commonjs/hooks/useFadeInAppBar.js +8 -29
  20. package/build/commonjs/hooks/useFadeInAppBar.js.map +1 -1
  21. package/build/module/ButtonBase/ButtonBase.js +4 -1
  22. package/build/module/ButtonBase/ButtonBase.js.map +1 -1
  23. package/build/module/ButtonBase/ButtonBaseProps.js.map +1 -1
  24. package/build/module/Chip/Chip.js +7 -7
  25. package/build/module/Chip/Chip.js.map +1 -1
  26. package/build/module/Tab/Tab.js +6 -3
  27. package/build/module/Tab/Tab.js.map +1 -1
  28. package/build/module/Tab/TabIndicator.js +8 -5
  29. package/build/module/Tab/TabIndicator.js.map +1 -1
  30. package/build/module/Tab/TabProps.js.map +1 -1
  31. package/build/module/Tabs/TabIndicator.js +4 -3
  32. package/build/module/Tabs/TabIndicator.js.map +1 -1
  33. package/build/module/Tabs/TabIndicatorProps.js.map +1 -1
  34. package/build/module/Tabs/Tabs.js +3 -0
  35. package/build/module/Tabs/Tabs.js.map +1 -1
  36. package/build/module/Tabs/TabsProps.js.map +1 -1
  37. package/build/module/hooks/useCollapsibleAppBar.js +10 -33
  38. package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
  39. package/build/module/hooks/useFadeInAppBar.js +9 -30
  40. package/build/module/hooks/useFadeInAppBar.js.map +1 -1
  41. package/build/typescript/ButtonBase/ButtonBaseProps.d.ts +4 -0
  42. package/build/typescript/Tab/TabIndicator.d.ts +4 -1
  43. package/build/typescript/Tab/TabProps.d.ts +6 -0
  44. package/build/typescript/Tabs/TabIndicatorProps.d.ts +6 -0
  45. package/build/typescript/Tabs/Tabs.d.ts +1 -1
  46. package/build/typescript/Tabs/TabsProps.d.ts +6 -0
  47. package/build/typescript/hooks/useCollapsibleAppBar.d.ts +1 -0
  48. package/build/typescript/hooks/useFadeInAppBar.d.ts +1 -0
  49. package/package.json +4 -4
  50. package/src/ButtonBase/ButtonBase.tsx +5 -2
  51. package/src/ButtonBase/ButtonBaseProps.ts +5 -0
  52. package/src/Chip/Chip.tsx +9 -7
  53. package/src/Tab/Tab.tsx +4 -3
  54. package/src/Tab/TabIndicator.tsx +17 -15
  55. package/src/Tab/TabProps.ts +7 -0
  56. package/src/Tabs/TabIndicator.tsx +21 -18
  57. package/src/Tabs/TabIndicatorProps.ts +8 -0
  58. package/src/Tabs/Tabs.tsx +3 -0
  59. package/src/Tabs/TabsProps.ts +8 -1
  60. package/src/hooks/useCollapsibleAppBar.ts +13 -28
  61. package/src/hooks/useFadeInAppBar.ts +10 -22
@@ -29,10 +29,6 @@ const defaultOptions = {
29
29
  floating: true,
30
30
  keyboardDismissMode: 'none'
31
31
  };
32
- const shadowOffset = _reactNative.Platform.OS === 'ios' ? {
33
- width: 0,
34
- height: 1
35
- } : undefined;
36
32
 
37
33
  function useFadeInAppBar() {
38
34
  let userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultOptions;
@@ -53,6 +49,7 @@ function useFadeInAppBar() {
53
49
  const beginY = typeof fadeInBeginY === 'function' ? fadeInBeginY(endY, appBarHeight) : fadeInBeginY;
54
50
  return [beginY, endY];
55
51
  }, [fadeInBeginY, fadeInBeginY, appBarHeight]);
52
+ const scrollY = (0, _reactNativeReanimated.useSharedValue)(0);
56
53
  const dy = (0, _reactNativeReanimated.useSharedValue)(0);
57
54
  const lastOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
58
55
  const normalized = (0, _reactNativeReanimated.useSharedValue)(0);
@@ -61,31 +58,11 @@ function useFadeInAppBar() {
61
58
  const animatedAppBarStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
62
59
  const [r, g, b] = rgbValues;
63
60
  const backgroundColor = `rgba(${r}, ${g}, ${b}, ${normalized.value})`;
64
-
65
- if (_reactNative.Platform.OS === 'web') {
66
- return {
67
- backgroundColor
68
- };
69
- }
70
-
71
- if (_reactNative.Platform.OS === 'android') {
72
- return {
73
- backgroundColor,
74
- elevation: normalized.value >= 1 ? 6 : 0
75
- };
76
- }
77
-
78
- if (_reactNative.Platform.OS === 'ios') {
79
- return {
80
- backgroundColor,
81
- shadowColor: '#000',
82
- shadowOffset,
83
- shadowRadius: 1,
84
- shadowOpacity: normalized.value >= 1 ? 0.25 : 0
85
- };
86
- }
87
-
88
- return {};
61
+ return {
62
+ backgroundColor,
63
+ borderColor: theme.palette.divider,
64
+ borderBottomWidth: normalized.value >= 1 ? 1 : 0
65
+ };
89
66
  }, [rgbValues]);
90
67
  const animatedTitleStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
91
68
  opacity: normalized.value
@@ -98,6 +75,7 @@ function useFadeInAppBar() {
98
75
  },
99
76
  onScroll: event => {
100
77
  const offsetY = event.contentOffset.y;
78
+ scrollY.value = offsetY;
101
79
  const distance = Math.max(toOffsetY - fromOffsetY, 1);
102
80
  const localOffsetY = offsetY - fromOffsetY;
103
81
  dy.value = offsetY - lastOffsetY.value;
@@ -118,6 +96,7 @@ function useFadeInAppBar() {
118
96
  titleStyle: [animatedTitleStyle],
119
97
  onAppBarLayout,
120
98
  onScroll: scrollHandler,
99
+ scrollY,
121
100
  dy,
122
101
  normalized
123
102
  };
@@ -1 +1 @@
1
- {"version":3,"names":["defaultOptions","fadeInBeginY","endY","appBarHeight","fadeInEndY","floating","keyboardDismissMode","shadowOffset","Platform","OS","width","height","undefined","useFadeInAppBar","userOptions","theme","useTheme","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","onAppBarLayout","useHeight","fromOffsetY","toOffsetY","useMemo","beginY","dy","useSharedValue","lastOffsetY","normalized","originalBackgroundColor","palette","background","default","rgbValues","rgb","animatedAppBarStyle","useAnimatedStyle","r","g","b","backgroundColor","value","elevation","shadowColor","shadowRadius","shadowOpacity","animatedTitleStyle","opacity","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","Keyboard","dismiss","onScroll","event","offsetY","contentOffset","y","distance","Math","max","localOffsetY","min","onEndDrag","onMomentumEnd","appBarStyle","paddingTop","top","titleStyle"],"sources":["useFadeInAppBar.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { Falsy, Keyboard, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport type { SharedValue } from 'react-native-reanimated';\nimport { runOnJS, useAnimatedScrollHandler, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { rgb } from '@fountain-ui/utils';\nimport { useHeight } from '../internal/hooks';\nimport { useTheme } from '../styles';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface Options {\n fadeInBeginY?: number | ((endY: number, appBarHeight: number) => number);\n fadeInEndY?: number | ((appBarHeight: number) => number);\n floating?: boolean;\n keyboardDismissMode?: 'none' | 'on-drag';\n}\n\nexport interface FadeInAppBar {\n appBarStyle: ViewStyleProp;\n titleStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n dy: SharedValue<number>;\n normalized: SharedValue<number>;\n}\n\nconst defaultOptions: Required<Options> = {\n fadeInBeginY: (endY, appBarHeight) => endY - appBarHeight,\n fadeInEndY: (appBarHeight) => appBarHeight,\n floating: true,\n keyboardDismissMode: 'none',\n};\n\nconst shadowOffset = Platform.OS === 'ios' ? { width: 0, height: 1 } : undefined;\n\nexport default function useFadeInAppBar(userOptions: Options = defaultOptions): FadeInAppBar {\n const {\n fadeInBeginY,\n fadeInEndY,\n floating,\n keyboardDismissMode,\n }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const theme = useTheme();\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n\n const [fromOffsetY, toOffsetY] = useMemo(() => {\n const endY = typeof fadeInEndY === 'function'\n ? fadeInEndY(appBarHeight)\n : fadeInEndY;\n\n const beginY = typeof fadeInBeginY === 'function'\n ? fadeInBeginY(endY, appBarHeight)\n : fadeInBeginY;\n\n return [beginY, endY];\n }, [fadeInBeginY, fadeInBeginY, appBarHeight]);\n\n const dy = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const normalized = useSharedValue<number>(0);\n\n const originalBackgroundColor = theme.palette.background.default;\n const rgbValues = useMemo(() => rgb(originalBackgroundColor), [originalBackgroundColor]);\n\n const animatedAppBarStyle = useAnimatedStyle(() => {\n const [r, g, b] = rgbValues;\n const backgroundColor = `rgba(${r}, ${g}, ${b}, ${normalized.value})`;\n\n if (Platform.OS === 'web') {\n return { backgroundColor };\n }\n if (Platform.OS === 'android') {\n return {\n backgroundColor,\n elevation: normalized.value >= 1 ? 6 : 0,\n };\n }\n if (Platform.OS === 'ios') {\n return {\n backgroundColor,\n shadowColor: '#000',\n shadowOffset,\n shadowRadius: 1,\n shadowOpacity: normalized.value >= 1 ? 0.25 : 0,\n };\n }\n return {};\n }, [rgbValues]);\n\n const animatedTitleStyle = useAnimatedStyle(() => ({\n opacity: normalized.value,\n }), []);\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n runOnJS(Keyboard.dismiss)();\n }\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n const distance = Math.max(toOffsetY - fromOffsetY, 1);\n const localOffsetY = offsetY - fromOffsetY;\n\n dy.value = offsetY - lastOffsetY.value;\n\n normalized.value = Math.min(Math.max(localOffsetY / distance, 0), 1);\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n }, [keyboardDismissMode]);\n\n const appBarStyle = [\n animatedAppBarStyle,\n { paddingTop: safeAreaInsets.top },\n floating ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n titleStyle: [animatedTitleStyle],\n onAppBarLayout,\n onScroll: scrollHandler,\n dy,\n normalized,\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAwBA,MAAMA,cAAiC,GAAG;EACtCC,YAAY,EAAE,CAACC,IAAD,EAAOC,YAAP,KAAwBD,IAAI,GAAGC,YADP;EAEtCC,UAAU,EAAGD,YAAD,IAAkBA,YAFQ;EAGtCE,QAAQ,EAAE,IAH4B;EAItCC,mBAAmB,EAAE;AAJiB,CAA1C;AAOA,MAAMC,YAAY,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB;EAAEC,KAAK,EAAE,CAAT;EAAYC,MAAM,EAAE;AAAp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AAlC,CAAjB;MACA,MAAMyC,YAAY,GAAGN,OAAO,GAAGnC,WAA/B;MAEAI,EAAE,CAACgB,KAAH,GAAWe,OAAO,GAAG7B,WAAW,CAACc,KAAjC;MAEAb,UAAU,CAACa,KAAX,GAAmBmB,IAAI,CAACG,GAAL,CAASH,IAAI,CAACC,GAAL,CAASC,YAAY,GAAGH,QAAxB,EAAkC,CAAlC,CAAT,EAA+C,CAA/C,CAAnB;IACH,CAf0C;IAgB3CK,SAAS,EAAGT,KAAD,IAAW;MAClB5B,WAAW,CAACc,KAAZ,GAAoBc,KAAK,CAACE,aAAN,CAAoBC,CAAxC;IACH,CAlB0C;IAmB3CO,aAAa,EAAGV,KAAD,IAAW;MACtB5B,WAAW,CAACc,KAAZ,GAAoBc,KAAK,CAACE,aAAN,CAAoBC,CAAxC;IACH;EArB0C,CAAzB,EAsBnB,CAACtD,mBAAD,CAtBmB,CAAtB;EAwBA,MAAM8D,WAAW,GAAG,CAChB/B,mBADgB,EAEhB;IAAEgC,UAAU,EAAElD,cAAc,CAACmD;EAA7B,CAFgB,EAGhBjE,QAAQ,GAAGY,MAAM,CAACZ,QAAV,GAAqBO,SAHb,CAApB;EAMA,OAAO;IACHwD,WADG;IAEHG,UAAU,EAAE,CAACvB,kBAAD,CAFT;IAGH3B,cAHG;IAIHmC,QAAQ,EAAEN,aAJP;IAKHvB,EALG;IAMHG;EANG,CAAP;AAQH;;AAAA"}
1
+ {"version":3,"names":["defaultOptions","fadeInBeginY","endY","appBarHeight","fadeInEndY","floating","keyboardDismissMode","useFadeInAppBar","userOptions","theme","useTheme","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","onAppBarLayout","useHeight","fromOffsetY","toOffsetY","useMemo","beginY","scrollY","useSharedValue","dy","lastOffsetY","normalized","originalBackgroundColor","palette","background","default","rgbValues","rgb","animatedAppBarStyle","useAnimatedStyle","r","g","b","backgroundColor","value","borderColor","divider","borderBottomWidth","animatedTitleStyle","opacity","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","Keyboard","dismiss","onScroll","event","offsetY","contentOffset","y","distance","Math","max","localOffsetY","min","onEndDrag","onMomentumEnd","appBarStyle","paddingTop","top","undefined","titleStyle"],"sources":["useFadeInAppBar.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { Falsy, Keyboard, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport type { SharedValue } from 'react-native-reanimated';\nimport { runOnJS, useAnimatedScrollHandler, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { rgb } from '@fountain-ui/utils';\nimport { useHeight } from '../internal/hooks';\nimport { useTheme } from '../styles';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface Options {\n fadeInBeginY?: number | ((endY: number, appBarHeight: number) => number);\n fadeInEndY?: number | ((appBarHeight: number) => number);\n floating?: boolean;\n keyboardDismissMode?: 'none' | 'on-drag';\n}\n\nexport interface FadeInAppBar {\n appBarStyle: ViewStyleProp;\n titleStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n scrollY: SharedValue<number>;\n dy: SharedValue<number>;\n normalized: SharedValue<number>;\n}\n\nconst defaultOptions: Required<Options> = {\n fadeInBeginY: (endY, appBarHeight) => endY - appBarHeight,\n fadeInEndY: (appBarHeight) => appBarHeight,\n floating: true,\n keyboardDismissMode: 'none',\n};\n\nexport default function useFadeInAppBar(userOptions: Options = defaultOptions): FadeInAppBar {\n const {\n fadeInBeginY,\n fadeInEndY,\n floating,\n keyboardDismissMode,\n }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const theme = useTheme();\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n\n const [fromOffsetY, toOffsetY] = useMemo(() => {\n const endY = typeof fadeInEndY === 'function'\n ? fadeInEndY(appBarHeight)\n : fadeInEndY;\n\n const beginY = typeof fadeInBeginY === 'function'\n ? fadeInBeginY(endY, appBarHeight)\n : fadeInBeginY;\n\n return [beginY, endY];\n }, [fadeInBeginY, fadeInBeginY, appBarHeight]);\n\n const scrollY = useSharedValue<number>(0);\n const dy = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const normalized = useSharedValue<number>(0);\n\n const originalBackgroundColor = theme.palette.background.default;\n const rgbValues = useMemo(() => rgb(originalBackgroundColor), [originalBackgroundColor]);\n\n const animatedAppBarStyle = useAnimatedStyle(() => {\n const [r, g, b] = rgbValues;\n const backgroundColor = `rgba(${r}, ${g}, ${b}, ${normalized.value})`;\n\n return {\n backgroundColor,\n borderColor: theme.palette.divider,\n borderBottomWidth: normalized.value >= 1 ? 1 : 0,\n };\n }, [rgbValues]);\n\n const animatedTitleStyle = useAnimatedStyle(() => ({\n opacity: normalized.value,\n }), []);\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n runOnJS(Keyboard.dismiss)();\n }\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n scrollY.value = offsetY;\n\n const distance = Math.max(toOffsetY - fromOffsetY, 1);\n const localOffsetY = offsetY - fromOffsetY;\n\n dy.value = offsetY - lastOffsetY.value;\n\n normalized.value = Math.min(Math.max(localOffsetY / distance, 0), 1);\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n }, [keyboardDismissMode]);\n\n const appBarStyle = [\n animatedAppBarStyle,\n { paddingTop: safeAreaInsets.top },\n floating ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n titleStyle: [animatedTitleStyle],\n onAppBarLayout,\n onScroll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,CAASvC,SAAS,GAAGD,WAArB,EAAkC,CAAlC,CAAjB;MACA,MAAMyC,YAAY,GAAGN,OAAO,GAAGnC,WAA/B;MAEAM,EAAE,CAACe,KAAH,GAAWc,OAAO,GAAG5B,WAAW,CAACc,KAAjC;MAEAb,UAAU,CAACa,KAAX,GAAmBkB,IAAI,CAACG,GAAL,CAASH,IAAI,CAACC,GAAL,CAASC,YAAY,GAAGH,QAAxB,EAAkC,CAAlC,CAAT,EAA+C,CAA/C,CAAnB;IACH,CAhB0C;IAiB3CK,SAAS,EAAGT,KAAD,IAAW;MAClB3B,WAAW,CAACc,KAAZ,GAAoBa,KAAK,CAACE,aAAN,CAAoBC,CAAxC;IACH,CAnB0C;IAoB3CO,aAAa,EAAGV,KAAD,IAAW;MACtB3B,WAAW,CAACc,KAAZ,GAAoBa,KAAK,CAACE,aAAN,CAAoBC,CAAxC;IACH;EAtB0C,CAAzB,EAuBnB,CAAChD,mBAAD,CAvBmB,CAAtB;EAyBA,MAAMwD,WAAW,GAAG,CAChB9B,mBADgB,EAEhB;IAAE+B,UAAU,EAAElD,cAAc,CAACmD;EAA7B,CAFgB,EAGhB3D,QAAQ,GAAGM,MAAM,CAACN,QAAV,GAAqB4D,SAHb,CAApB;EAMA,OAAO;IACHH,WADG;IAEHI,UAAU,EAAE,CAACxB,kBAAD,CAFT;IAGH3B,cAHG;IAIHmC,QAAQ,EAAEN,aAJP;IAKHvB,OALG;IAMHE,EANG;IAOHE;EAPG,CAAP;AASH;;AAAA"}
@@ -12,6 +12,7 @@ const MINIFIED_SCALE = .96; // at "node_modules/react-native/Libraries/Pressabil
12
12
  // const DEFAULT_MIN_PRESS_DURATION = 130;
13
13
 
14
14
  const SCALE_EFFECT_PRESS_IN_DELAY = 130;
15
+ const OPACITY_EFFECT_PRESS_IN_DELAY = 0;
15
16
 
16
17
  const startTimingAnimationWithDefaults = (value, toValue) => {
17
18
  Animated.timing(value, {
@@ -28,6 +29,7 @@ export default function ButtonBase(props) {
28
29
  disableThrottle = false,
29
30
  onPress,
30
31
  pressEffect = 'opacity',
32
+ pressDelay: pressDelayOrNil,
31
33
  style: styleProp,
32
34
  throttleMillis = 650,
33
35
  ...otherProps
@@ -74,7 +76,8 @@ export default function ButtonBase(props) {
74
76
  scale
75
77
  }]
76
78
  };
77
- const pressDelay = pressEffect === 'scale' ? SCALE_EFFECT_PRESS_IN_DELAY : 0;
79
+ const defaultPressDelay = pressEffect === 'scale' ? SCALE_EFFECT_PRESS_IN_DELAY : OPACITY_EFFECT_PRESS_IN_DELAY;
80
+ const pressDelay = pressDelayOrNil ?? defaultPressDelay;
78
81
  return /*#__PURE__*/React.createElement(AnimatedPressable, _extends({
79
82
  disabled: disabled,
80
83
  onPress: handlePress,
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","Animated","useAnimatedValue","useThrottle","AnimatedPressable","ORIGINAL_OPACITY","DISABLED_OPACITY","ACTIVE_OPACITY","ORIGINAL_SCALE","MINIFIED_SCALE","SCALE_EFFECT_PRESS_IN_DELAY","startTimingAnimationWithDefaults","value","toValue","timing","duration","useNativeDriver","start","ButtonBase","props","children","disabled","disableThrottle","onPress","pressEffect","style","styleProp","throttleMillis","otherProps","handlePress","periodMillis","callback","opacity","scale","setValue","startScaleAnimation","pressIn","isHover","startOpacityAnimation","startPressAnimation","handlePressIn","handlePressOut","animatedStyle","transform","pressDelay","hovered","undefined"],"sources":["ButtonBase.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport { Animated } from 'react-native';\nimport { useAnimatedValue, useThrottle } from '../hooks';\nimport { AnimatedPressable } from '../animated';\nimport type ButtonBaseProps from './ButtonBaseProps';\n\ninterface StartPressAnimation {\n (pressIn: boolean, isHover: boolean): void;\n}\n\nexport const ORIGINAL_OPACITY = 1;\nexport const DISABLED_OPACITY = .3;\nconst ACTIVE_OPACITY = .65;\n\nconst ORIGINAL_SCALE = 1;\nconst MINIFIED_SCALE = .96;\n\n// at \"node_modules/react-native/Libraries/Pressability.js\"\n// const DEFAULT_MIN_PRESS_DURATION = 130;\nconst SCALE_EFFECT_PRESS_IN_DELAY = 130;\n\ntype TimingAnimationValue = Animated.Value | Animated.ValueXY;\ntype TimingAnimationToValue = Animated.TimingAnimationConfig['toValue'];\n\nconst startTimingAnimationWithDefaults = (\n value: TimingAnimationValue,\n toValue: TimingAnimationToValue,\n) => {\n Animated.timing(value, {\n toValue,\n duration: 150,\n useNativeDriver: true,\n }).start();\n};\n\nexport default function ButtonBase(props: ButtonBaseProps) {\n const {\n children,\n disabled = false,\n disableThrottle = false,\n onPress,\n pressEffect = 'opacity',\n style: styleProp,\n throttleMillis = 650,\n ...otherProps\n } = props;\n\n const handlePress = useThrottle({\n periodMillis: disableThrottle ? 0 : throttleMillis,\n callback: onPress,\n });\n\n const opacity = useAnimatedValue(ORIGINAL_OPACITY);\n const scale = useAnimatedValue(ORIGINAL_SCALE);\n\n useEffect(() => {\n opacity.setValue(disabled ? DISABLED_OPACITY : ORIGINAL_OPACITY);\n }, [disabled, pressEffect]);\n\n const startScaleAnimation = useCallback<StartPressAnimation>((pressIn, isHover) => {\n if (!isHover) {\n startTimingAnimationWithDefaults(\n scale,\n pressIn ? MINIFIED_SCALE : ORIGINAL_SCALE,\n );\n }\n }, []);\n\n const startOpacityAnimation = useCallback<StartPressAnimation>((pressIn) => {\n if (pressIn) {\n opacity.setValue(ACTIVE_OPACITY);\n } else {\n startTimingAnimationWithDefaults(opacity, ORIGINAL_OPACITY);\n }\n }, []);\n\n const startPressAnimation = useCallback<StartPressAnimation>((pressIn, isHover = false) => {\n if (pressEffect === 'scale') {\n startScaleAnimation(pressIn, isHover);\n } else if (pressEffect === 'opacity') {\n startOpacityAnimation(pressIn, isHover);\n }\n }, [pressEffect]);\n\n const handlePressIn = useCallback(() => {\n startPressAnimation(true, false);\n }, [startPressAnimation]);\n\n const handlePressOut = useCallback(() => {\n startPressAnimation(false, false);\n }, [startPressAnimation]);\n\n const animatedStyle = {\n opacity,\n transform: [{ scale }],\n };\n\n const pressDelay = pressEffect === 'scale'\n ? SCALE_EFFECT_PRESS_IN_DELAY\n : 0;\n\n return (\n <AnimatedPressable\n disabled={disabled}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n style={[\n animatedStyle,\n styleProp,\n ]}\n unstable_pressDelay={pressDelay}\n {...otherProps}\n >\n {typeof children !== 'function' ? (\n ({ hovered }) => {\n if (hovered !== undefined && !disabled) {\n startPressAnimation(hovered, true);\n }\n\n return children;\n }\n ) : children}\n </AnimatedPressable>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,SAA7B,QAA8C,OAA9C;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,EAA2BC,WAA3B,QAA8C,UAA9C;AACA,SAASC,iBAAT,QAAkC,aAAlC;AAOA,OAAO,MAAMC,gBAAgB,GAAG,CAAzB;AACP,OAAO,MAAMC,gBAAgB,GAAG,EAAzB;AACP,MAAMC,cAAc,GAAG,GAAvB;AAEA,MAAMC,cAAc,GAAG,CAAvB;AACA,MAAMC,cAAc,GAAG,GAAvB,C,CAEA;AACA;;AACA,MAAMC,2BAA2B,GAAG,GAApC;;AAKA,MAAMC,gCAAgC,GAAG,CACrCC,KADqC,EAErCC,OAFqC,KAGpC;EACDZ,QAAQ,CAACa,MAAT,CAAgBF,KAAhB,EAAuB;IACnBC,OADmB;IAEnBE,QAAQ,EAAE,GAFS;IAGnBC,eAAe,EAAE;EAHE,CAAvB,EAIGC,KAJH;AAKH,CATD;;AAWA,eAAe,SAASC,UAAT,CAAoBC,KAApB,EAA4C;EACvD,MAAM;IACFC,QADE;IAEFC,QAAQ,GAAG,KAFT;IAGFC,eAAe,GAAG,KAHhB;IAIFC,OAJE;IAKFC,WAAW,GAAG,SALZ;IAMFC,KAAK,EAAEC,SANL;IAOFC,cAAc,GAAG,GAPf;IAQF,GAAGC;EARD,IASFT,KATJ;EAWA,MAAMU,WAAW,GA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AmB,CAAC,IAAD,EAAO,KAAP,CAAnB;EACH,CAFgC,EAE9B,CAACA,mBAAD,CAF8B,CAAjC;EAIA,MAAME,cAAc,GAAG1C,WAAW,CAAC,MAAM;IACrCwC,mBAAmB,CAAC,KAAD,EAAQ,KAAR,CAAnB;EACH,CAFiC,EAE/B,CAACA,mBAAD,CAF+B,CAAlC;EAIA,MAAMG,aAAa,GAAG;IAClBV,OADkB;IAElBW,SAAS,EAAE,CAAC;MAAEV;IAAF,CAAD;EAFO,CAAtB;EAKA,MAAMW,UAAU,GAAGpB,WAAW,KAAK,OAAhB,GACbd,2BADa,GAEb,CAFN;EAIA,oBACI,oBAAC,iBAAD;IACI,QAAQ,EAAEW,QADd;IAEI,OAAO,EAAEQ,WAFb;IAGI,SAAS,EAAEW,aAHf;IAII,UAAU,EAAEC,cAJhB;IAKI,KAAK,EAAE,CACHC,aADG,EAEHhB,SAFG,CALX;IASI,mBAAmB,EAAEkB;EATzB,GAUQhB,UAVR,GAYK,OAAOR,QAAP,KAAoB,UAApB,GACG,QAAiB;IAAA,IAAhB;MAAEyB;IAAF,CAAgB;;IACb,IAAIA,OAAO,KAAKC,SAAZ,IAAyB,CAACzB,QAA9B,EAAwC;MACpCkB,mBAAmB,CAACM,OAAD,EAAU,IAAV,CAAnB;IACH;;IAED,OAAOzB,QAAP;EACH,CAPJ,GAQGA,QApBR,CADJ;AAwBH;AAAA"}
1
+ {"version":3,"names":["React","useCallback","useEffect","Animated","useAnimatedValue","useThrottle","AnimatedPressable","ORIGINAL_OPACITY","DISABLED_OPACITY","ACTIVE_OPACITY","ORIGINAL_SCALE","MINIFIED_SCALE","SCALE_EFFECT_PRESS_IN_DELAY","OPACITY_EFFECT_PRESS_IN_DELAY","startTimingAnimationWithDefaults","value","toValue","timing","duration","useNativeDriver","start","ButtonBase","props","children","disabled","disableThrottle","onPress","pressEffect","pressDelay","pressDelayOrNil","style","styleProp","throttleMillis","otherProps","handlePress","periodMillis","callback","opacity","scale","setValue","startScaleAnimation","pressIn","isHover","startOpacityAnimation","startPressAnimation","handlePressIn","handlePressOut","animatedStyle","transform","defaultPressDelay","hovered","undefined"],"sources":["ButtonBase.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport { Animated } from 'react-native';\nimport { useAnimatedValue, useThrottle } from '../hooks';\nimport { AnimatedPressable } from '../animated';\nimport type ButtonBaseProps from './ButtonBaseProps';\n\ninterface StartPressAnimation {\n (pressIn: boolean, isHover: boolean): void;\n}\n\nexport const ORIGINAL_OPACITY = 1;\nexport const DISABLED_OPACITY = .3;\nconst ACTIVE_OPACITY = .65;\n\nconst ORIGINAL_SCALE = 1;\nconst MINIFIED_SCALE = .96;\n\n// at \"node_modules/react-native/Libraries/Pressability.js\"\n// const DEFAULT_MIN_PRESS_DURATION = 130;\nconst SCALE_EFFECT_PRESS_IN_DELAY = 130;\nconst OPACITY_EFFECT_PRESS_IN_DELAY = 0;\n\ntype TimingAnimationValue = Animated.Value | Animated.ValueXY;\ntype TimingAnimationToValue = Animated.TimingAnimationConfig['toValue'];\n\nconst startTimingAnimationWithDefaults = (\n value: TimingAnimationValue,\n toValue: TimingAnimationToValue,\n) => {\n Animated.timing(value, {\n toValue,\n duration: 150,\n useNativeDriver: true,\n }).start();\n};\n\nexport default function ButtonBase(props: ButtonBaseProps) {\n const {\n children,\n disabled = false,\n disableThrottle = false,\n onPress,\n pressEffect = 'opacity',\n pressDelay: pressDelayOrNil,\n style: styleProp,\n throttleMillis = 650,\n ...otherProps\n } = props;\n\n const handlePress = useThrottle({\n periodMillis: disableThrottle ? 0 : throttleMillis,\n callback: onPress,\n });\n\n const opacity = useAnimatedValue(ORIGINAL_OPACITY);\n const scale = useAnimatedValue(ORIGINAL_SCALE);\n\n useEffect(() => {\n opacity.setValue(disabled ? DISABLED_OPACITY : ORIGINAL_OPACITY);\n }, [disabled, pressEffect]);\n\n const startScaleAnimation = useCallback<StartPressAnimation>((pressIn, isHover) => {\n if (!isHover) {\n startTimingAnimationWithDefaults(\n scale,\n pressIn ? MINIFIED_SCALE : ORIGINAL_SCALE,\n );\n }\n }, []);\n\n const startOpacityAnimation = useCallback<StartPressAnimation>((pressIn) => {\n if (pressIn) {\n opacity.setValue(ACTIVE_OPACITY);\n } else {\n startTimingAnimationWithDefaults(opacity, ORIGINAL_OPACITY);\n }\n }, []);\n\n const startPressAnimation = useCallback<StartPressAnimation>((pressIn, isHover = false) => {\n if (pressEffect === 'scale') {\n startScaleAnimation(pressIn, isHover);\n } else if (pressEffect === 'opacity') {\n startOpacityAnimation(pressIn, isHover);\n }\n }, [pressEffect]);\n\n const handlePressIn = useCallback(() => {\n startPressAnimation(true, false);\n }, [startPressAnimation]);\n\n const handlePressOut = useCallback(() => {\n startPressAnimation(false, false);\n }, [startPressAnimation]);\n\n const animatedStyle = {\n opacity,\n transform: [{ scale }],\n };\n\n const defaultPressDelay = pressEffect === 'scale'\n ? SCALE_EFFECT_PRESS_IN_DELAY\n : OPACITY_EFFECT_PRESS_IN_DELAY;\n const pressDelay = pressDelayOrNil ?? defaultPressDelay;\n\n return (\n <AnimatedPressable\n disabled={disabled}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n style={[\n animatedStyle,\n styleProp,\n ]}\n unstable_pressDelay={pressDelay}\n {...otherProps}\n >\n {typeof children !== 'function' ? (\n ({ hovered }) => {\n if (hovered !== undefined && !disabled) {\n startPressAnimation(hovered, true);\n }\n\n return children;\n }\n ) : children}\n </AnimatedPressable>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,SAA7B,QAA8C,OAA9C;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,EAA2BC,WAA3B,QAA8C,UAA9C;AACA,SAASC,iBAAT,QAAkC,aAAlC;AAOA,OAAO,MAAMC,gBAAgB,GAAG,CAAzB;AACP,OAAO,MAAMC,gBAAgB,GAAG,EAAzB;AACP,MAAMC,cAAc,GAAG,GAAvB;AAEA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,EAAE,CACHC,aADG,EAEHhB,SAFG,CALX;IASI,mBAAmB,EAAEH;EATzB,GAUQK,UAVR,GAYK,OAAOV,QAAP,KAAoB,UAApB,GACG,QAAiB;IAAA,IAAhB;MAAE2B;IAAF,CAAgB;;IACb,IAAIA,OAAO,KAAKC,SAAZ,IAAyB,CAAC3B,QAA9B,EAAwC;MACpCoB,mBAAmB,CAACM,OAAD,EAAU,IAAV,CAAnB;IACH;;IAED,OAAO3B,QAAP;EACH,CAPJ,GAQGA,QApBR,CADJ;AAwBH;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["ButtonBaseProps.ts"],"sourcesContent":["import type { PressableProps } from '../Pressable';\nimport type { OverridableComponentProps } from '../types';\n\nexport type PressEffect = 'opacity' | 'scale' | 'none';\n\nexport default interface ButtonBaseProps extends OverridableComponentProps<PressableProps, {\n /**\n * Content of the ButtonBase.\n */\n children: PressableProps['children'];\n\n /**\n * Whether to prevent interaction with the ButtonBase.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether to debounce when button is pressed\n * @default false\n */\n disableThrottle?: boolean;\n\n /**\n * Function to execute on press. If not set, will cause the ButtonBase to be disabled.\n */\n onPress?: () => void;\n\n /**\n * Applied press effect.\n * @default 'opacity'\n */\n pressEffect?: PressEffect;\n\n /**\n * The millisecond for debouncing.\n * @default 650\n */\n throttleMillis?: number;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["ButtonBaseProps.ts"],"sourcesContent":["import type { PressableProps } from '../Pressable';\nimport type { OverridableComponentProps } from '../types';\n\nexport type PressEffect = 'opacity' | 'scale' | 'none';\n\nexport default interface ButtonBaseProps extends OverridableComponentProps<PressableProps, {\n /**\n * Content of the ButtonBase.\n */\n children: PressableProps['children'];\n\n /**\n * Whether to prevent interaction with the ButtonBase.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether to debounce when button is pressed\n * @default false\n */\n disableThrottle?: boolean;\n\n /**\n * Function to execute on press. If not set, will cause the ButtonBase to be disabled.\n */\n onPress?: () => void;\n\n /**\n * Applied press effect.\n * @default 'opacity'\n */\n pressEffect?: PressEffect;\n\n /**\n * The milliseconds to delay effect.\n */\n pressDelay?: number;\n\n /**\n * The millisecond for debouncing.\n * @default 650\n */\n throttleMillis?: number;\n}> {}\n"],"mappings":""}
@@ -14,10 +14,10 @@ const useStyles = function () {
14
14
  alignItems: 'center',
15
15
  borderRadius: 20,
16
16
  flexDirection: 'row',
17
- height: 36,
17
+ height: 32,
18
18
  justifyContent: 'center',
19
- paddingLeft: theme.spacing(4),
20
- paddingRight: theme.spacing(4)
19
+ paddingLeft: theme.spacing(3),
20
+ paddingRight: theme.spacing(3)
21
21
  }
22
22
  };
23
23
  };
@@ -40,20 +40,20 @@ export default function Chip(props) {
40
40
  outlined: {
41
41
  backgroundColor: theme.palette.paper.default,
42
42
  borderColor: theme.palette.border,
43
- borderWidth: 2
43
+ borderWidth: 1
44
44
  },
45
45
  filled: {
46
46
  backgroundColor: theme.palette.paper.grey
47
47
  },
48
48
  bold: {
49
- backgroundColor: theme.palette.paper.grey,
49
+ backgroundColor: theme.palette.paper.default,
50
50
  borderColor: theme.palette.primary.main,
51
- borderWidth: 2
51
+ borderWidth: 1.5
52
52
  }
53
53
  };
54
54
  const chipStyle = css([styles.root, variantStyleMap[variant], styleProp]);
55
55
  const fontStyle = createFontStyle(theme, {
56
- selector: typo => typo.subtitle2,
56
+ selector: typo => variant === 'bold' ? typo.subtitle2 : typo.body2,
57
57
  color: fontColor
58
58
  });
59
59
  const textMarginSize = theme.spacing(1);
@@ -1 +1 @@
1
- {"version":3,"names":["React","Text","createFontStyle","css","useTheme","cloneElementSafely","ButtonBase","ICON_SIZE","useStyles","theme","root","alignItems","borderRadius","flexDirection","height","justifyContent","paddingLeft","spacing","paddingRight","Chip","props","children","endIcon","endIconProp","numberOfLines","onPress","startIcon","startIconProp","style","styleProp","variant","otherProps","styles","fontColor","palette","tertiary","main","primary","variantStyleMap","outlined","backgroundColor","paper","default","borderColor","border","borderWidth","filled","grey","bold","chipStyle","fontStyle","selector","typo","subtitle2","color","textMarginSize","textMarginStyle","marginLeft","marginRight","undefined","textStyle","textAlign","iconProps","width","fill"],"sources":["Chip.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport ButtonBase from '../ButtonBase';\nimport type ChipProps from './ChipProps';\n\ntype ChipStyles = NamedStylesStringUnion<'root'>;\n\nconst ICON_SIZE = 20;\n\nconst useStyles: UseStyles<ChipStyles> = function (): ChipStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderRadius: 20,\n flexDirection: 'row',\n height: 36,\n justifyContent: 'center',\n paddingLeft: theme.spacing(4),\n paddingRight: theme.spacing(4),\n },\n };\n};\n\nexport default function Chip(props: ChipProps) {\n const {\n children,\n endIcon: endIconProp,\n numberOfLines,\n onPress,\n startIcon: startIconProp,\n style: styleProp,\n variant = 'outlined',\n ...otherProps\n } = props;\n\n const theme = useTheme();\n const styles = useStyles();\n\n const fontColor = variant === 'outlined'\n ? theme.palette.tertiary.main\n : theme.palette.primary.main;\n\n const variantStyleMap = {\n outlined: {\n backgroundColor: theme.palette.paper.default,\n borderColor: theme.palette.border,\n borderWidth: 2,\n },\n filled: {\n backgroundColor: theme.palette.paper.grey,\n },\n bold: {\n backgroundColor: theme.palette.paper.grey,\n borderColor: theme.palette.primary.main,\n borderWidth: 2,\n },\n };\n\n const chipStyle = css([\n styles.root,\n variantStyleMap[variant],\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => typo.subtitle2,\n color: fontColor,\n });\n\n const textMarginSize = theme.spacing(1);\n const textMarginStyle = startIconProp\n ? { marginLeft: textMarginSize }\n : endIconProp\n ? { marginRight: textMarginSize }\n : undefined;\n\n const textStyle = css([\n fontStyle,\n textMarginStyle,\n { textAlign: 'center' },\n ]);\n\n const iconProps = {\n width: ICON_SIZE,\n height: ICON_SIZE,\n fill: fontColor,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n return (\n <ButtonBase\n onPress={onPress}\n style={chipStyle}\n {...otherProps}\n >\n {startIcon}\n\n <Text\n children={children}\n numberOfLines={numberOfLines}\n style={textStyle}\n />\n\n {endIcon}\n </ButtonBase>\n );\n}\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,SAASC,kBAAT,QAAmC,UAAnC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAKA,MAAMC,SAAS,GAAG,EAAlB;;AAEA,MAAMC,SAAgC,GAAG,YAAwB;EAC7D,MAAMC,KAAK,GAAGL,QAAQ,EAAtB;EAEA,OAAO;IACHM,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,YAAY,EAAE,EAFZ;MAGFC,aAAa,EAAE,KAHb;MAIFC,MAAM,EAAE,EAJN;MAKFC,cAAc,EAAE,QALd;MAMFC,WAAW,EAAEP,KAAK,CAACQ,OAAN,CAAc,CAAd,CANX;MAOFC,YAAY,EAAET,KAAK,CAACQ,OAAN,CAAc,CAAd;IAPZ;EADH,CAAP;AAWH,CAdD;;AAgBA,eAAe,SAASE,IAAT,CAAcC,KAAd,EAAgC;EAC3C,MAAM;IACFC,QADE;IAEFC,OAAO,EAAEC,WAFP;IAGFC,aAHE;IAIFC,OAJE;IAKFC,SAAS,EAAEC,aALT;IAMFC,KAAK,EAAEC,SANL;IAOFC,OAAO,GAAG,UAPR;IAQF,GAAGC;EARD,IASFX,KATJ;EAWA,MAAMX,KAAK,GAAGL,QAAQ,EAAtB;EACA,MAAM4B,MAAM,GAAGxB,SAAS,EAAxB;EAEA,MAAMyB,S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MA,MAAMC,SAAS,GAAG;IACdC,KAAK,EAAExD,SADO;IAEdO,MAAM,EAAEP,SAFM;IAGdyD,IAAI,EAAE/B;EAHQ,CAAlB;EAMA,MAAMP,SAAS,GAAGrB,kBAAkB,CAACsB,aAAD,EAAgBmC,SAAhB,CAApC;EACA,MAAMxC,OAAO,GAAGjB,kBAAkB,CAACkB,WAAD,EAAcuC,SAAd,CAAlC;EAEA,oBACI,oBAAC,UAAD;IACI,OAAO,EAAErC,OADb;IAEI,KAAK,EAAEwB;EAFX,GAGQlB,UAHR,GAKKL,SALL,eAOI,oBAAC,IAAD;IACI,QAAQ,EAAEL,QADd;IAEI,aAAa,EAAEG,aAFnB;IAGI,KAAK,EAAEoC;EAHX,EAPJ,EAaKtC,OAbL,CADJ;AAiBH"}
1
+ {"version":3,"names":["React","Text","createFontStyle","css","useTheme","cloneElementSafely","ButtonBase","ICON_SIZE","useStyles","theme","root","alignItems","borderRadius","flexDirection","height","justifyContent","paddingLeft","spacing","paddingRight","Chip","props","children","endIcon","endIconProp","numberOfLines","onPress","startIcon","startIconProp","style","styleProp","variant","otherProps","styles","fontColor","palette","tertiary","main","primary","variantStyleMap","outlined","backgroundColor","paper","default","borderColor","border","borderWidth","filled","grey","bold","chipStyle","fontStyle","selector","typo","subtitle2","body2","color","textMarginSize","textMarginStyle","marginLeft","marginRight","undefined","textStyle","textAlign","iconProps","width","fill"],"sources":["Chip.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport ButtonBase from '../ButtonBase';\nimport type ChipProps from './ChipProps';\n\ntype ChipStyles = NamedStylesStringUnion<'root'>;\n\nconst ICON_SIZE = 20;\n\nconst useStyles: UseStyles<ChipStyles> = function (): ChipStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderRadius: 20,\n flexDirection: 'row',\n height: 32,\n justifyContent: 'center',\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n };\n};\n\nexport default function Chip(props: ChipProps) {\n const {\n children,\n endIcon: endIconProp,\n numberOfLines,\n onPress,\n startIcon: startIconProp,\n style: styleProp,\n variant = 'outlined',\n ...otherProps\n } = props;\n\n const theme = useTheme();\n const styles = useStyles();\n\n const fontColor = variant === 'outlined'\n ? theme.palette.tertiary.main\n : theme.palette.primary.main;\n\n const variantStyleMap = {\n outlined: {\n backgroundColor: theme.palette.paper.default,\n borderColor: theme.palette.border,\n borderWidth: 1,\n },\n filled: {\n backgroundColor: theme.palette.paper.grey,\n },\n bold: {\n backgroundColor: theme.palette.paper.default,\n borderColor: theme.palette.primary.main,\n borderWidth: 1.5,\n },\n };\n\n const chipStyle = css([\n styles.root,\n variantStyleMap[variant],\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => variant === 'bold'\n ? typo.subtitle2\n : typo.body2,\n color: fontColor,\n });\n\n const textMarginSize = theme.spacing(1);\n const textMarginStyle = startIconProp\n ? { marginLeft: textMarginSize }\n : endIconProp\n ? { marginRight: textMarginSize }\n : undefined;\n\n const textStyle = css([\n fontStyle,\n textMarginStyle,\n { textAlign: 'center' },\n ]);\n\n const iconProps = {\n width: ICON_SIZE,\n height: ICON_SIZE,\n fill: fontColor,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n return (\n <ButtonBase\n onPress={onPress}\n style={chipStyle}\n {...otherProps}\n >\n {startIcon}\n\n <Text\n children={children}\n numberOfLines={numberOfLines}\n style={textStyle}\n />\n\n {endIcon}\n </ButtonBase>\n );\n}\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,SAASC,kBAAT,QAAmC,UA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a,EAAEG,aAFnB;IAGI,KAAK,EAAEqC;EAHX,EAPJ,EAaKvC,OAbL,CADJ;AAiBH"}
@@ -13,10 +13,10 @@ const styles = StyleSheet.create({
13
13
  } : {})
14
14
  },
15
15
  primary: {
16
- minHeight: 48
16
+ minHeight: 40
17
17
  },
18
18
  secondary: {
19
- minHeight: 48
19
+ minHeight: 40
20
20
  },
21
21
  bottomNavigation: {
22
22
  minHeight: 56
@@ -28,6 +28,7 @@ export default function Tab(props) {
28
28
  children,
29
29
  enableIndicator = false,
30
30
  icon: defaultIcon,
31
+ indicatorColor = 'primary',
31
32
  selected = false,
32
33
  selectedIcon,
33
34
  variant = 'primary',
@@ -57,7 +58,9 @@ export default function Tab(props) {
57
58
  }), /*#__PURE__*/React.createElement(Text, {
58
59
  children: children,
59
60
  style: css(fontStyle)
60
- }), enableIndicator && selected ? /*#__PURE__*/React.createElement(TabIndicator, null) : null);
61
+ }), enableIndicator && selected ? /*#__PURE__*/React.createElement(TabIndicator, {
62
+ color: indicatorColor
63
+ }) : null);
61
64
  }
62
65
  ;
63
66
  //# sourceMappingURL=Tab.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","cloneElement","Platform","Text","Badge","TabBase","createFontStyle","css","StyleSheet","useTheme","TabIndicator","styles","create","root","OS","minWidth","primary","minHeight","secondary","bottomNavigation","Tab","props","badgeVisible","children","enableIndicator","icon","defaultIcon","selected","selectedIcon","variant","style","otherProps","theme","vertical","color","palette","text","hint","tabBaseStyle","fontStyle","selector","typo","h2","button2","flag","pressEffect","iconElement","fill"],"sources":["Tab.tsx"],"sourcesContent":["import React, { cloneElement } from 'react';\nimport { Platform, Text } from 'react-native';\nimport Badge from '../Badge';\nimport TabBase from '../TabBase';\nimport type TabProps from './TabProps';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TabIndicator from './TabIndicator';\n\nconst styles = StyleSheet.create({\n root: {\n // TODO: Remove redundant platform checking\n ...(Platform.OS === 'web' ? { minWidth: 'auto' } : {}),\n },\n primary: {\n minHeight: 48,\n },\n secondary: {\n minHeight: 48,\n },\n bottomNavigation: {\n minHeight: 56,\n },\n});\n\nexport default function Tab(props: TabProps) {\n const {\n badgeVisible = false,\n children,\n enableIndicator = false,\n icon: defaultIcon,\n selected = false,\n selectedIcon,\n variant = 'primary',\n style,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const vertical = variant === 'bottom-navigation';\n\n const color = selected ? theme.palette.text.primary : theme.palette.text.hint;\n\n const tabBaseStyle = css([\n styles.root,\n variant === 'primary'\n ? styles.primary\n : (variant === 'secondary' ? styles.secondary : styles.bottomNavigation),\n style,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => variant === 'primary'\n ? typo.h2\n : (variant === 'secondary' ? typo.button2 : typo.flag),\n color,\n });\n\n const pressEffect = selected ? 'none' : 'opacity';\n\n const icon = selected ? (selectedIcon || defaultIcon) : defaultIcon;\n const iconElement = icon ? cloneElement(icon, { fill: color }) : null;\n\n return (\n <TabBase\n pressEffect={pressEffect}\n style={tabBaseStyle}\n vertical={vertical}\n {...otherProps}\n >\n <Badge\n children={iconElement}\n invisible={!badgeVisible}\n />\n\n <Text\n children={children}\n style={css(fontStyle)}\n />\n\n {(enableIndicator && selected) ? <TabIndicator/> : null}\n </TabBase>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,YAAhB,QAAoC,OAApC;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,cAA/B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,OAAP,MAAoB,YAApB;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,UAA/B,EAA2CC,QAA3C,QAA2D,WAA3D;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,MAAMC,MAAM,GAAGH,UAAU,CAACI,MAAX,CAAkB;EAC7BC,IAAI,EAAE,EACF;IACA,IAAIX,QAAQ,CAACY,EAAT,KAAgB,KAAhB,GAAwB;MAAEC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H,GAAY,SAAxC;EAEA,MAAMF,IAAI,GAAGE,QAAQ,GAAIC,YAAY,IAAIF,WAApB,GAAmCA,WAAxD;EACA,MAAMoB,WAAW,GAAGrB,IAAI,gBAAGxB,YAAY,CAACwB,IAAD,EAAO;IAAEsB,IAAI,EAAEb;EAAR,CAAP,CAAf,GAAyC,IAAjE;EAEA,oBACI,oBAAC,OAAD;IACI,WAAW,EAAEW,WADjB;IAEI,KAAK,EAAEP,YAFX;IAGI,QAAQ,EAAEL;EAHd,GAIQF,UAJR,gBAMI,oBAAC,KAAD;IACI,QAAQ,EAAEe,WADd;IAEI,SAAS,EAAE,CAACxB;EAFhB,EANJ,eAWI,oBAAC,IAAD;IACI,QAAQ,EAAEC,QADd;IAEI,KAAK,EAAEhB,GAAG,CAACgC,SAAD;EAFd,EAXJ,EAgBMf,eAAe,IAAIG,QAApB,gBAAgC,oBAAC,YAAD,OAAhC,GAAkD,IAhBvD,CADJ;AAoBH;AAAA"}
1
+ {"version":3,"names":["React","cloneElement","Platform","Text","Badge","TabBase","createFontStyle","css","StyleSheet","useTheme","TabIndicator","styles","create","root","OS","minWidth","primary","minHeight","secondary","bottomNavigation","Tab","props","badgeVisible","children","enableIndicator","icon","defaultIcon","indicatorColor","selected","selectedIcon","variant","style","otherProps","theme","vertical","color","palette","text","hint","tabBaseStyle","fontStyle","selector","typo","h2","button2","flag","pressEffect","iconElement","fill"],"sources":["Tab.tsx"],"sourcesContent":["import React, { cloneElement } from 'react';\nimport { Platform, Text } from 'react-native';\nimport Badge from '../Badge';\nimport TabBase from '../TabBase';\nimport type TabProps from './TabProps';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TabIndicator from './TabIndicator';\n\nconst styles = StyleSheet.create({\n root: {\n // TODO: Remove redundant platform checking\n ...(Platform.OS === 'web' ? { minWidth: 'auto' } : {}),\n },\n primary: {\n minHeight: 40,\n },\n secondary: {\n minHeight: 40,\n },\n bottomNavigation: {\n minHeight: 56,\n },\n});\n\nexport default function Tab(props: TabProps) {\n const {\n badgeVisible = false,\n children,\n enableIndicator = false,\n icon: defaultIcon,\n indicatorColor = 'primary',\n selected = false,\n selectedIcon,\n variant = 'primary',\n style,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const vertical = variant === 'bottom-navigation';\n\n const color = selected ? theme.palette.text.primary : theme.palette.text.hint;\n\n const tabBaseStyle = css([\n styles.root,\n variant === 'primary'\n ? styles.primary\n : (variant === 'secondary' ? styles.secondary : styles.bottomNavigation),\n style,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => variant === 'primary'\n ? typo.h2\n : (variant === 'secondary' ? typo.button2 : typo.flag),\n color,\n });\n\n const pressEffect = selected ? 'none' : 'opacity';\n\n const icon = selected ? (selectedIcon || defaultIcon) : defaultIcon;\n const iconElement = icon ? cloneElement(icon, { fill: color }) : null;\n\n return (\n <TabBase\n pressEffect={pressEffect}\n style={tabBaseStyle}\n vertical={vertical}\n {...otherProps}\n >\n <Badge\n children={iconElement}\n invisible={!badgeVisible}\n />\n\n <Text\n children={children}\n style={css(fontStyle)}\n />\n\n {(enableIndicator && selected) ? <TabIndicator color={indicatorColor}/> : null}\n </TabBase>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,YAAhB,QAAoC,OAApC;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,cAA/B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,OAAP,MAAoB,YAApB;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,UAA/B,EAA2CC,QAA3C,QAA2D,WAA3D;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,MAAMC,MAAM,GAAGH,UAAU,CAACI,MAAX,CAAkB;EAC7BC,IAAI,EAAE,EACF;IACA,IAAIX,QAAQ,CAACY,EAAT,KAAgB,KAAhB,GAAwB;MAAEC,QAAQ,EAAE;IAAZ,CAAxB,GAA+C,EAAnD;EAFE,CADuB;EAK7BC,OA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,QAAQ,GAAIC,YAAY,IAAIH,WAApB,GAAmCA,WAAxD;EACA,MAAMqB,WAAW,GAAGtB,IAAI,gBAAGxB,YAAY,CAACwB,IAAD,EAAO;IAAEuB,IAAI,EAAEb;EAAR,CAAP,CAAf,GAAyC,IAAjE;EAEA,oBACI,oBAAC,OAAD;IACI,WAAW,EAAEW,WADjB;IAEI,KAAK,EAAEP,YAFX;IAGI,QAAQ,EAAEL;EAHd,GAIQF,UAJR,gBAMI,oBAAC,KAAD;IACI,QAAQ,EAAEe,WADd;IAEI,SAAS,EAAE,CAACzB;EAFhB,EANJ,eAWI,oBAAC,IAAD;IACI,QAAQ,EAAEC,QADd;IAEI,KAAK,EAAEhB,GAAG,CAACiC,SAAD;EAFd,EAXJ,EAgBMhB,eAAe,IAAII,QAApB,gBAAgC,oBAAC,YAAD;IAAc,KAAK,EAAED;EAArB,EAAhC,GAAyE,IAhB9E,CADJ;AAoBH;AAAA"}
@@ -2,13 +2,13 @@ import React from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { useTheme } from '../styles';
4
4
 
5
- const useStyles = function () {
5
+ const useStyles = function (color) {
6
6
  const theme = useTheme();
7
7
  return {
8
8
  root: {
9
- backgroundColor: theme.palette.secondary.main,
9
+ backgroundColor: theme.palette[color].main,
10
10
  bottom: 0,
11
- height: 4,
11
+ height: 2,
12
12
  left: 12,
13
13
  right: 12,
14
14
  position: 'absolute'
@@ -16,8 +16,11 @@ const useStyles = function () {
16
16
  };
17
17
  };
18
18
 
19
- const TabIndicator = function TabIndicator() {
20
- const styles = useStyles();
19
+ const TabIndicator = function TabIndicator(_ref) {
20
+ let {
21
+ color
22
+ } = _ref;
23
+ const styles = useStyles(color);
21
24
  return /*#__PURE__*/React.createElement(View, {
22
25
  style: styles.root
23
26
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","useTheme","useStyles","theme","root","backgroundColor","palette","secondary","main","bottom","height","left","right","position","TabIndicator","styles","memo"],"sources":["TabIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\n\ntype TabIndicatorStyles = NamedStylesStringUnion<'root'>;\n\nconst useStyles: UseStyles<TabIndicatorStyles> = function (): TabIndicatorStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: theme.palette.secondary.main,\n bottom: 0,\n height: 4,\n left: 12,\n right: 12,\n position: 'absolute',\n },\n };\n};\n\nconst TabIndicator = function TabIndicator() {\n const styles = useStyles();\n\n return (\n <View\n style={styles.root}\n />\n );\n};\n\nexport default React.memo(TabIndicator);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,QAAT,QAAyB,WAAzB;;AAIA,MAAMC,SAAwC,GAAG,YAAgC;EAC7E,MAAMC,KAAK,GAAGF,QAAQ,EAAtB;EAEA,OAAO;IACHG,IAAI,EAAE;MACFC,eAAe,EAAEF,KAAK,CAACG,OAAN,CAAcC,SAAd,CAAwBC,IADvC;MAEFC,MAAM,EAAE,CAFN;MAGFC,MAAM,EAAE,CAHN;MAIFC,IAAI,EAAE,EAJJ;MAKFC,KAAK,EAAE,EALL;MAMFC,QAAQ,EAAE;IANR;EADH,CAAP;AAUH,CAbD;;AAeA,MAAMC,YAAY,GAAG,SAASA,YAAT,GAAwB;EACzC,MAAMC,MAAM,GAAGb,SAAS,EAAxB;EAEA,oBACI,oBAAC,IAAD;IACI,KAAK,EAAEa,MAAM,CAACX;EADlB,EADJ;AAKH,CARD;;AAUA,4BAAeL,KAAK,CAACiB,IAAN,CAAWF,YAAX,CAAf"}
1
+ {"version":3,"names":["React","View","useTheme","useStyles","color","theme","root","backgroundColor","palette","main","bottom","height","left","right","position","TabIndicator","styles","memo"],"sources":["TabIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport type { TabIndicatorColor } from './TabProps';\n\ntype TabIndicatorStyles = NamedStylesStringUnion<'root'>;\n\nconst useStyles: (color: TabIndicatorColor) => TabIndicatorStyles =\n function (color: TabIndicatorColor): TabIndicatorStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: theme.palette[color].main,\n bottom: 0,\n height: 2,\n left: 12,\n right: 12,\n position: 'absolute',\n },\n };\n };\n\nconst TabIndicator = function TabIndicator({ color }: { color: TabIndicatorColor }) {\n const styles = useStyles(color);\n\n return (\n <View\n style={styles.root}\n />\n );\n};\n\nexport default React.memo(TabIndicator);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,QAAT,QAAyB,WAAzB;;AAKA,MAAMC,SAA2D,GAC7D,UAAUC,KAAV,EAAwD;EACpD,MAAMC,KAAK,GAAGH,QAAQ,EAAtB;EAEA,OAAO;IACHI,IAAI,EAAE;MACFC,eAAe,EAAEF,KAAK,CAACG,OAAN,CAAcJ,KAAd,EAAqBK,IADpC;MAEFC,MAAM,EAAE,CAFN;MAGFC,MAAM,EAAE,CAHN;MAIFC,IAAI,EAAE,EAJJ;MAKFC,KAAK,EAAE,EALL;MAMFC,QAAQ,EAAE;IANR;EADH,CAAP;AAUH,CAdL;;AAgBA,MAAMC,YAAY,GAAG,SAASA,YAAT,OAA+D;EAAA,IAAzC;IAAEX;EAAF,CAAyC;EAChF,MAAMY,MAAM,GAAGb,SAAS,CAACC,KAAD,CAAxB;EAEA,oBACI,oBAAC,IAAD;IACI,KAAK,EAAEY,MAAM,CAACV;EADlB,EADJ;AAKH,CARD;;AAUA,4BAAeN,KAAK,CAACiB,IAAN,CAAWF,YAAX,CAAf"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TabProps.ts"],"sourcesContent":["import React from 'react';\nimport type { TabBaseProps } from '../TabBase';\nimport type { OverridableComponentProps } from '../types';\n\nexport type TabVariant = 'primary' | 'secondary' | 'bottom-navigation';\n\nexport default interface TabProps extends OverridableComponentProps<TabBaseProps, {\n /**\n * If `true`, the badge is visible.\n * @default false\n */\n badgeVisible?: boolean;\n\n /**\n * The label of the Tab.\n */\n children: string;\n\n /**\n * If `true`, the indicator is enabled.\n * @default false\n */\n enableIndicator?: boolean;\n\n /**\n * If `true`, the component is selected.\n * @default false\n */\n selected?: boolean;\n\n /**\n * Element placed before the children.\n */\n icon?: React.ReactElement;\n\n /**\n * If supplied, use this icon on selected state.\n */\n selectedIcon?: React.ReactElement;\n\n /**\n * The variant to use.\n * @default 'primary'\n */\n variant?: TabVariant;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TabProps.ts"],"sourcesContent":["import React from 'react';\nimport type { TabBaseProps } from '../TabBase';\nimport type { OverridableComponentProps } from '../types';\n\nexport type TabVariant = 'primary' | 'secondary' | 'bottom-navigation';\nexport type TabIndicatorColor = 'primary' | 'secondary'\n\nexport default interface TabProps extends OverridableComponentProps<TabBaseProps, {\n /**\n * If `true`, the badge is visible.\n * @default false\n */\n badgeVisible?: boolean;\n\n /**\n * The label of the Tab.\n */\n children: string;\n\n /**\n * If `true`, the indicator is enabled.\n * @default false\n */\n enableIndicator?: boolean;\n\n /**\n * If `true`, the component is selected.\n * @default false\n */\n selected?: boolean;\n\n /**\n * Element placed before the children.\n */\n icon?: React.ReactElement;\n\n /**\n * Tab indicator color\n * @default 'primary'\n */\n indicatorColor?: TabIndicatorColor;\n\n /**\n * If supplied, use this icon on selected state.\n */\n selectedIcon?: React.ReactElement;\n\n /**\n * The variant to use.\n * @default 'primary'\n */\n variant?: TabVariant;\n}> {}\n"],"mappings":""}
@@ -10,11 +10,11 @@ const INDICATOR_WIDTH = 10;
10
10
  const INDICATOR_HEIGHT = 2;
11
11
  const SCROLLABLE_TABS_INSET = 12 * 2;
12
12
 
13
- const useStyles = function () {
13
+ const useStyles = function (color) {
14
14
  const theme = useTheme();
15
15
  return {
16
16
  root: {
17
- backgroundColor: theme.palette.secondary.main,
17
+ backgroundColor: theme.palette[color].main,
18
18
  left: 0,
19
19
  bottom: 0,
20
20
  width: INDICATOR_WIDTH,
@@ -38,6 +38,7 @@ const startAnimation = (value, toValue) => {
38
38
 
39
39
  export default function TabIndicator(props) {
40
40
  const {
41
+ color = 'primary',
41
42
  coordinates,
42
43
  disabled,
43
44
  initialIndex,
@@ -45,7 +46,7 @@ export default function TabIndicator(props) {
45
46
  style,
46
47
  ...otherProps
47
48
  } = props;
48
- const styles = useStyles();
49
+ const styles = useStyles(color);
49
50
  const computeAnimationValues = useCallback(currentIndex => {
50
51
  const {
51
52
  x1,
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useContext","useEffect","Animated","Easing","useTheme","useAnimatedValue","defaultCoordinate","InternalContext","INDICATOR_WIDTH","INDICATOR_HEIGHT","SCROLLABLE_TABS_INSET","useStyles","theme","root","backgroundColor","palette","secondary","main","left","bottom","width","height","position","disabled","startAnimation","value","toValue","timing","duration","easing","bezier","useNativeDriver","start","TabIndicator","props","coordinates","initialIndex","scrollable","style","otherProps","styles","computeAnimationValues","currentIndex","x1","x2","tabWidth","nextTranslateX","inset","nextScaleX","tx","sx","initialTx","initialSx","translateX","scaleX","indexStore","scrollToIndex","index","getState","subscribe","undefined","transform"],"sources":["TabIndicator.tsx"],"sourcesContent":["import React, { useCallback, useContext, useEffect } from 'react';\nimport { Animated, Easing } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport { useAnimatedValue } from '../hooks';\nimport type TabIndicatorProps from './TabIndicatorProps';\nimport { defaultCoordinate } from './TabCoordinate';\nimport InternalContext from './InternalContext';\n\ntype TabIndicatorStyles = NamedStylesStringUnion<'root' | 'disabled'>;\n\nconst INDICATOR_WIDTH = 10;\nconst INDICATOR_HEIGHT = 2;\n\nconst SCROLLABLE_TABS_INSET = 12 * 2;\n\nconst useStyles: UseStyles<TabIndicatorStyles> = function (): TabIndicatorStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: theme.palette.secondary.main,\n left: 0,\n bottom: 0,\n width: INDICATOR_WIDTH,\n height: INDICATOR_HEIGHT,\n position: 'absolute',\n },\n disabled: {\n height: 0,\n },\n };\n};\n\nconst startAnimation = (value: Animated.Value, toValue: number) => {\n Animated.timing(value, {\n toValue: toValue,\n duration: 300,\n easing: Easing.bezier(0.25, 1, 0.5, 1),\n useNativeDriver: true,\n }).start();\n};\n\nexport default function TabIndicator(props: TabIndicatorProps) {\n const {\n coordinates,\n disabled,\n initialIndex,\n scrollable,\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const computeAnimationValues = useCallback((currentIndex: number) => {\n const { x1, x2 } = coordinates[currentIndex] ?? defaultCoordinate;\n\n const tabWidth = x2 - x1;\n\n const nextTranslateX = x1 + (tabWidth - INDICATOR_WIDTH) / 2;\n\n const inset = scrollable ? SCROLLABLE_TABS_INSET : 0;\n const nextScaleX = (tabWidth - inset) / INDICATOR_WIDTH;\n\n return { tx: nextTranslateX, sx: nextScaleX };\n }, [coordinates, scrollable]);\n\n const {\n tx: initialTx,\n sx: initialSx,\n } = computeAnimationValues(initialIndex);\n\n const translateX = useAnimatedValue(initialTx);\n const scaleX = useAnimatedValue(initialSx);\n\n const { indexStore } = useContext(InternalContext);\n\n useEffect(() => {\n const scrollToIndex = (index: number) => {\n const { tx, sx } = computeAnimationValues(index);\n\n startAnimation(translateX, tx);\n startAnimation(scaleX, sx);\n };\n\n scrollToIndex(indexStore.getState());\n\n return indexStore.subscribe(scrollToIndex);\n }, [\n computeAnimationValues,\n coordinates,\n indexStore,\n ]);\n\n return (\n <Animated.View\n style={[\n styles.root,\n disabled ? styles.disabled : undefined,\n { transform: [{ translateX }, { scaleX }] },\n style,\n ]}\n {...otherProps}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,UAA7B,EAAyCC,SAAzC,QAA0D,OAA1D;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,KAAK,EAAE,CACHf,MAAM,CAAC3B,IADJ,EAEHU,QAAQ,GAAGiB,MAAM,CAACjB,QAAV,GAAqBqC,SAF1B,EAGH;MAAEC,SAAS,EAAE,CAAC;QAAER;MAAF,CAAD,EAAiB;QAAEC;MAAF,CAAjB;IAAb,CAHG,EAIHhB,KAJG;EADX,GAOQC,UAPR,EADJ;AAWH;AAAA"}
1
+ {"version":3,"names":["React","useCallback","useContext","useEffect","Animated","Easing","useTheme","useAnimatedValue","defaultCoordinate","InternalContext","INDICATOR_WIDTH","INDICATOR_HEIGHT","SCROLLABLE_TABS_INSET","useStyles","color","theme","root","backgroundColor","palette","main","left","bottom","width","height","position","disabled","startAnimation","value","toValue","timing","duration","easing","bezier","useNativeDriver","start","TabIndicator","props","coordinates","initialIndex","scrollable","style","otherProps","styles","computeAnimationValues","currentIndex","x1","x2","tabWidth","nextTranslateX","inset","nextScaleX","tx","sx","initialTx","initialSx","translateX","scaleX","indexStore","scrollToIndex","index","getState","subscribe","undefined","transform"],"sources":["TabIndicator.tsx"],"sourcesContent":["import React, { useCallback, useContext, useEffect } from 'react';\nimport { Animated, Easing } from 'react-native';\nimport { NamedStylesStringUnion } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport { useAnimatedValue } from '../hooks';\nimport type TabIndicatorProps from './TabIndicatorProps';\nimport type { TabIndicatorColor } from './TabIndicatorProps';\nimport { defaultCoordinate } from './TabCoordinate';\nimport InternalContext from './InternalContext';\n\ntype TabIndicatorStyles = NamedStylesStringUnion<'root' | 'disabled'>;\n\nconst INDICATOR_WIDTH = 10;\nconst INDICATOR_HEIGHT = 2;\n\nconst SCROLLABLE_TABS_INSET = 12 * 2;\n\nconst useStyles: (color: TabIndicatorColor) => TabIndicatorStyles =\n function (color: TabIndicatorColor): TabIndicatorStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: theme.palette[color].main,\n left: 0,\n bottom: 0,\n width: INDICATOR_WIDTH,\n height: INDICATOR_HEIGHT,\n position: 'absolute',\n },\n disabled: {\n height: 0,\n },\n };\n };\n\nconst startAnimation = (value: Animated.Value, toValue: number) => {\n Animated.timing(value, {\n toValue: toValue,\n duration: 300,\n easing: Easing.bezier(0.25, 1, 0.5, 1),\n useNativeDriver: true,\n }).start();\n};\n\nexport default function TabIndicator(props: TabIndicatorProps) {\n const {\n color = 'primary',\n coordinates,\n disabled,\n initialIndex,\n scrollable,\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles(color);\n\n const computeAnimationValues = useCallback((currentIndex: number) => {\n const { x1, x2 } = coordinates[currentIndex] ?? defaultCoordinate;\n\n const tabWidth = x2 - x1;\n\n const nextTranslateX = x1 + (tabWidth - INDICATOR_WIDTH) / 2;\n\n const inset = scrollable ? SCROLLABLE_TABS_INSET : 0;\n const nextScaleX = (tabWidth - inset) / INDICATOR_WIDTH;\n\n return { tx: nextTranslateX, sx: nextScaleX };\n }, [coordinates, scrollable]);\n\n const {\n tx: initialTx,\n sx: initialSx,\n } = computeAnimationValues(initialIndex);\n\n const translateX = useAnimatedValue(initialTx);\n const scaleX = useAnimatedValue(initialSx);\n\n const { indexStore } = useContext(InternalContext);\n\n useEffect(() => {\n const scrollToIndex = (index: number) => {\n const { tx, sx } = computeAnimationValues(index);\n\n startAnimation(translateX, tx);\n startAnimation(scaleX, sx);\n };\n\n scrollToIndex(indexStore.getState());\n\n return indexStore.subscribe(scrollToIndex);\n }, [\n computeAnimationValues,\n coordinates,\n indexStore,\n ]);\n\n return (\n <Animated.View\n style={[\n styles.root,\n disabled ? styles.disabled : undefined,\n { transform: [{ translateX }, { scaleX }] },\n style,\n ]}\n {...otherProps}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,UAA7B,EAAyCC,SAAzC,QAA0D,OAA1D;AACA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,cAAjC;AAEA,SAASC,QAAT,QAAyB,WAAzB;AACA,SAASC,gBAAT,QAAiC,UAAjC;AAG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,MAAM,CAACjB,QAAV,GAAqBqC,SAF1B,EAGH;MAAEC,SAAS,EAAE,CAAC;QAAER;MAAF,CAAD,EAAiB;QAAEC;MAAF,CAAjB;IAAb,CAHG,EAIHhB,KAJG;EADX,GAOQC,UAPR,EADJ;AAWH;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TabIndicatorProps.ts"],"sourcesContent":["import type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\nimport type TabCoordinate from './TabCoordinate';\n\nexport default interface TabIndicatorProps extends OverridableComponentProps<ViewProps, {\n /**\n * Tab item coordinates.\n */\n coordinates: TabCoordinate[];\n\n /**\n * If `true`, the indicator is disabled.\n */\n disabled: boolean;\n\n /**\n * Initial index.\n */\n initialIndex: number;\n\n /**\n * If `true`, the tab will be able to scroll.\n */\n scrollable: boolean;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TabIndicatorProps.ts"],"sourcesContent":["import type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\nimport type TabCoordinate from './TabCoordinate';\n\nexport type TabIndicatorColor = 'primary' | 'secondary';\n\nexport default interface TabIndicatorProps extends OverridableComponentProps<ViewProps, {\n /**\n * Tab item coordinates.\n */\n coordinates: TabCoordinate[];\n\n /**\n * Indicator color.\n * @default: 'primary'\n */\n color?: TabIndicatorColor;\n\n /**\n * If `true`, the indicator is disabled.\n */\n disabled: boolean;\n\n /**\n * Initial index.\n */\n initialIndex: number;\n\n /**\n * If `true`, the tab will be able to scroll.\n */\n scrollable: boolean;\n}> {}\n"],"mappings":""}
@@ -29,6 +29,7 @@ const useStyles = function () {
29
29
  const Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
30
30
  const {
31
31
  children,
32
+ indicatorColor = 'primary',
32
33
  initialIndex = 0,
33
34
  disableIndicator = false,
34
35
  keyboardDismissMode = 'none',
@@ -91,6 +92,7 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
91
92
 
92
93
  const tabElement = /*#__PURE__*/cloneElement(child, {
93
94
  enableIndicator: !disableIndicator && !canRenderIndicator,
95
+ indicatorColor,
94
96
  onLayout,
95
97
  onPress,
96
98
  onMouseDown,
@@ -104,6 +106,7 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
104
106
  });
105
107
  });
106
108
  const tabIndicator = canRenderIndicator ? /*#__PURE__*/React.createElement(TabIndicator, {
109
+ color: indicatorColor,
107
110
  coordinates: coordinates,
108
111
  disabled: disableIndicator,
109
112
  initialIndex: realInitialIndex,
@@ -1 +1 @@
1
- {"version":3,"names":["React","cloneElement","forwardRef","useEffect","useImperativeHandle","View","css","useTheme","useSyncAnimatedValue","TabIndicator","ScrollableTabsView","IndexAwareTab","useTabCoordinates","useIndexStore","InternalContext","isEveryTabCoordinatesDefined","useStyles","theme","root","fixedRoot","flexDirection","fixedTab","flex","scrollableContainer","paddingHorizontal","spacing","Tabs","props","ref","children","initialIndex","disableIndicator","keyboardDismissMode","keyboardShouldPersistTaps","onChange","scrollable","style","variant","UNSTABLE_sharedIndex","fallbackSharedIndex","initialValue","sharedIndex","realInitialIndex","setTab","newIndex","animatedValue","setValue","styles","coordinates","updateCoordinate","canRenderIndicator","indexStore","subscribe","tabElements","Children","map","child","index","onLayout","event","x","width","nativeEvent","layout","onMouseDown","e","preventDefault","onPress","tabElement","enableIndicator","undefined","tabIndicator"],"sources":["Tabs.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef, useEffect, useImperativeHandle } from 'react';\nimport type { GestureResponderEvent, LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport { useSyncAnimatedValue } from '../hooks';\nimport type TabsProps from './TabsProps';\nimport type { TabsInstance } from './types';\nimport TabIndicator from './TabIndicator';\nimport ScrollableTabsView from './ScrollableTabsView';\nimport IndexAwareTab from './IndexAwareTab';\nimport useTabCoordinates from './useTabCoordinates';\nimport useIndexStore from './useIndexStore';\nimport InternalContext from './InternalContext';\nimport { isEveryTabCoordinatesDefined } from './utils';\n\ntype TabsStyleKeys =\n | 'root'\n | 'fixedRoot'\n | 'fixedTab'\n | 'scrollableContainer';\n\ntype TabsStyles = NamedStylesStringUnion<TabsStyleKeys>;\n\nconst useStyles: UseStyles<TabsStyles> = function (): TabsStyles {\n const theme = useTheme();\n\n return {\n root: {},\n fixedRoot: {\n flexDirection: 'row',\n },\n fixedTab: {\n flex: 1,\n },\n scrollableContainer: {\n paddingHorizontal: theme.spacing(1),\n },\n };\n};\n\nconst Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {\n const {\n children,\n initialIndex = 0,\n disableIndicator = false,\n keyboardDismissMode = 'none',\n keyboardShouldPersistTaps = 'never',\n onChange,\n scrollable = false,\n style,\n variant = 'primary',\n UNSTABLE_sharedIndex,\n } = props;\n\n const fallbackSharedIndex = useSyncAnimatedValue({ initialValue: initialIndex });\n const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;\n const realInitialIndex = sharedIndex.initialValue;\n\n const setTab = (newIndex: number) => {\n sharedIndex.animatedValue.setValue(newIndex);\n };\n\n useImperativeHandle(\n ref,\n () => ({\n setTab,\n }),\n [sharedIndex],\n );\n\n const styles = useStyles();\n\n const [coordinates, updateCoordinate] = useTabCoordinates(children);\n\n const canRenderIndicator = isEveryTabCoordinatesDefined(coordinates, children);\n\n const indexStore = useIndexStore(sharedIndex);\n\n useEffect(() => {\n return indexStore.subscribe(newIndex => {\n onChange?.(newIndex);\n });\n }, [indexStore, onChange]);\n\n const tabElements = React.Children.map(children, (child, index) => {\n const onLayout = (event: LayoutChangeEvent) => {\n const { x, width } = event.nativeEvent.layout;\n\n updateCoordinate(index, x, width);\n\n // @ts-ignore\n child.props.onLayout?.(event);\n };\n\n const onMouseDown = (e: GestureResponderEvent) => {\n if (keyboardShouldPersistTaps === 'always') {\n e.preventDefault();\n }\n };\n\n const onPress = () => {\n setTab(index);\n\n // @ts-ignore\n child.props.onPress?.();\n };\n\n // @ts-ignore\n const tabElement = cloneElement(child, {\n enableIndicator: !disableIndicator && !canRenderIndicator,\n onLayout,\n onPress,\n onMouseDown,\n variant,\n style: scrollable ? undefined : styles.fixedTab,\n });\n\n return (\n <IndexAwareTab\n children={tabElement}\n index={index}\n initialIndex={realInitialIndex}\n />\n );\n });\n\n const tabIndicator = canRenderIndicator ? (\n <TabIndicator\n coordinates={coordinates}\n disabled={disableIndicator}\n initialIndex={realInitialIndex}\n scrollable={scrollable}\n />\n ) : null;\n\n return (\n <InternalContext.Provider value={{ indexStore }}>\n <View\n style={css([\n styles.root,\n scrollable ? undefined : styles.fixedRoot,\n style,\n ])}\n >\n {scrollable ? (\n <ScrollableTabsView\n automaticallyAdjustContentInsets={false}\n bounces={false}\n contentContainerStyle={styles.scrollableContainer}\n coordinates={coordinates}\n directionalLockEnabled={true}\n horizontal={true}\n initialIndex={realInitialIndex}\n scrollsToTop={false}\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n keyboardDismissMode={keyboardDismissMode}\n keyboardShouldPersistTaps={keyboardShouldPersistTaps}\n >\n {tabElements}\n {tabIndicator}\n </ScrollableTabsView>\n ) : (\n <React.Fragment>\n {tabElements}\n {tabIndicator}\n </React.Fragment>\n )}\n </View>\n </InternalContext.Provider>\n );\n});\n\nexport default Tabs;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,YAAhB,EAA8BC,UAA9B,EAA0CC,SAA1C,EAAqDC,mBAArD,QAAgF,OAAhF;AAEA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;AACA,SAASC,oBAAT,QAAqC,UAArC;AAGA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,kBAAP,MAA+B,sBAA/B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAO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nimatedValue","TabIndicator","ScrollableTabsView","IndexAwareTab","useTabCoordinates","useIndexStore","InternalContext","isEveryTabCoordinatesDefined","useStyles","theme","root","fixedRoot","flexDirection","fixedTab","flex","scrollableContainer","paddingHorizontal","spacing","Tabs","props","ref","children","indicatorColor","initialIndex","disableIndicator","keyboardDismissMode","keyboardShouldPersistTaps","onChange","scrollable","style","variant","UNSTABLE_sharedIndex","fallbackSharedIndex","initialValue","sharedIndex","realInitialIndex","setTab","newIndex","animatedValue","setValue","styles","coordinates","updateCoordinate","canRenderIndicator","indexStore","subscribe","tabElements","Children","map","child","index","onLayout","event","x","width","nativeEvent","layout","onMouseDown","e","preventDefault","onPress","tabElement","enableIndicator","undefined","tabIndicator"],"sources":["Tabs.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef, useEffect, useImperativeHandle } from 'react';\nimport type { GestureResponderEvent, LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport { useSyncAnimatedValue } from '../hooks';\nimport type TabsProps from './TabsProps';\nimport type { TabsInstance } from './types';\nimport TabIndicator from './TabIndicator';\nimport ScrollableTabsView from './ScrollableTabsView';\nimport IndexAwareTab from './IndexAwareTab';\nimport useTabCoordinates from './useTabCoordinates';\nimport useIndexStore from './useIndexStore';\nimport InternalContext from './InternalContext';\nimport { isEveryTabCoordinatesDefined } from './utils';\n\ntype TabsStyleKeys =\n | 'root'\n | 'fixedRoot'\n | 'fixedTab'\n | 'scrollableContainer';\n\ntype TabsStyles = NamedStylesStringUnion<TabsStyleKeys>;\n\nconst useStyles: UseStyles<TabsStyles> = function (): TabsStyles {\n const theme = useTheme();\n\n return {\n root: {},\n fixedRoot: {\n flexDirection: 'row',\n },\n fixedTab: {\n flex: 1,\n },\n scrollableContainer: {\n paddingHorizontal: theme.spacing(1),\n },\n };\n};\n\nconst Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {\n const {\n children,\n indicatorColor = 'primary',\n initialIndex = 0,\n disableIndicator = false,\n keyboardDismissMode = 'none',\n keyboardShouldPersistTaps = 'never',\n onChange,\n scrollable = false,\n style,\n variant = 'primary',\n UNSTABLE_sharedIndex,\n } = props;\n\n const fallbackSharedIndex = useSyncAnimatedValue({ initialValue: initialIndex });\n const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;\n const realInitialIndex = sharedIndex.initialValue;\n\n const setTab = (newIndex: number) => {\n sharedIndex.animatedValue.setValue(newIndex);\n };\n\n useImperativeHandle(\n ref,\n () => ({\n setTab,\n }),\n [sharedIndex],\n );\n\n const styles = useStyles();\n\n const [coordinates, updateCoordinate] = useTabCoordinates(children);\n\n const canRenderIndicator = isEveryTabCoordinatesDefined(coordinates, children);\n\n const indexStore = useIndexStore(sharedIndex);\n\n useEffect(() => {\n return indexStore.subscribe(newIndex => {\n onChange?.(newIndex);\n });\n }, [indexStore, onChange]);\n\n const tabElements = React.Children.map(children, (child, index) => {\n const onLayout = (event: LayoutChangeEvent) => {\n const { x, width } = event.nativeEvent.layout;\n\n updateCoordinate(index, x, width);\n\n // @ts-ignore\n child.props.onLayout?.(event);\n };\n\n const onMouseDown = (e: GestureResponderEvent) => {\n if (keyboardShouldPersistTaps === 'always') {\n e.preventDefault();\n }\n };\n\n const onPress = () => {\n setTab(index);\n\n // @ts-ignore\n child.props.onPress?.();\n };\n\n // @ts-ignore\n const tabElement = cloneElement(child, {\n enableIndicator: !disableIndicator && !canRenderIndicator,\n indicatorColor,\n onLayout,\n onPress,\n onMouseDown,\n variant,\n style: scrollable ? undefined : styles.fixedTab,\n });\n\n return (\n <IndexAwareTab\n children={tabElement}\n index={index}\n initialIndex={realInitialIndex}\n />\n );\n });\n\n const tabIndicator = canRenderIndicator ? (\n <TabIndicator\n color={indicatorColor}\n coordinates={coordinates}\n disabled={disableIndicator}\n initialIndex={realInitialIndex}\n scrollable={scrollable}\n />\n ) : null;\n\n return (\n <InternalContext.Provider value={{ indexStore }}>\n <View\n style={css([\n styles.root,\n scrollable ? undefined : styles.fixedRoot,\n style,\n ])}\n >\n {scrollable ? (\n <ScrollableTabsView\n automaticallyAdjustContentInsets={false}\n bounces={false}\n contentContainerStyle={styles.scrollableContainer}\n coordinates={coordinates}\n directionalLockEnabled={true}\n horizontal={true}\n initialIndex={realInitialIndex}\n scrollsToTop={false}\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n keyboardDismissMode={keyboardDismissMode}\n keyboardShouldPersistTaps={keyboardShouldPersistTaps}\n >\n {tabElements}\n {tabIndicator}\n </ScrollableTabsView>\n ) : (\n <React.Fragment>\n {tabElements}\n {tabIndicator}\n </React.Fragment>\n )}\n </View>\n </InternalContext.Provider>\n );\n});\n\nexport default Tabs;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,YAAhB,EAA8BC,UAA9B,EAA0CC,SAA1C,EAAqDC,mBAArD,QAAgF,OAAhF;AAEA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;AACA,SAASC,oBAAT,QAAqC,UAArC;AAGA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,kBAAP,MAA+B,sBAA/B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,SAASC,4BAAT,QAA6C,SAA7C;;AAUA,MAAMC,SAAgC,GAAG,YAAwB;EAC7D,MAAMC,KAAK,GAAGV,QAAQ,EAAtB;EAEA,OAAO;IACHW,IAAI,EAAE,EADH;IAEHC,SAAS,EAAE;MACPC,aAAa,EAAE;IADR,CAFR;IAKHC,QAAQ,EAAE;MACNC,IAAI,EAAE;IADA,CALP;IAQHC,mBAAmB,EAAE;MACjBC,iBAAiB,EAAEP,KAAK,CAACQ,OAAN,CAAc,CAAd;IADF;EAR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AEjB,gBAHd;IAII,YAAY,EAAEW,gBAJlB;IAKI,UAAU,EAAEP;EALhB,EADmC,GAQnC,IARJ;EAUA,oBACI,oBAAC,eAAD,CAAiB,QAAjB;IAA0B,KAAK,EAAE;MAAEgB;IAAF;EAAjC,gBACI,oBAAC,IAAD;IACI,KAAK,EAAE9C,GAAG,CAAC,CACP0C,MAAM,CAAC9B,IADA,EAEPkB,UAAU,GAAGmC,SAAH,GAAevB,MAAM,CAAC7B,SAFzB,EAGPkB,KAHO,CAAD;EADd,GAOKD,UAAU,gBACP,oBAAC,kBAAD;IACI,gCAAgC,EAAE,KADtC;IAEI,OAAO,EAAE,KAFb;IAGI,qBAAqB,EAAEY,MAAM,CAACzB,mBAHlC;IAII,WAAW,EAAE0B,WAJjB;IAKI,sBAAsB,EAAE,IAL5B;IAMI,UAAU,EAAE,IANhB;IAOI,YAAY,EAAEN,gBAPlB;IAQI,YAAY,EAAE,KARlB;IASI,8BAA8B,EAAE,KATpC;IAUI,4BAA4B,EAAE,KAVlC;IAWI,mBAAmB,EAAEV,mBAXzB;IAYI,yBAAyB,EAAEC;EAZ/B,GAcKoB,WAdL,EAeKkB,YAfL,CADO,gBAmBP,oBAAC,KAAD,CAAO,QAAP,QACKlB,WADL,EAEKkB,YAFL,CA1BR,CADJ,CADJ;AAoCH,CAtIsB,CAAvB;AAwIA,eAAe9C,IAAf"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TabsProps.ts"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { Animated, ViewProps } from 'react-native';\nimport type { TabVariant } from '../Tab';\nimport type { OverridableComponentProps, SyncAnimatedValue } from '../types';\nimport type { KeyboardDismissMode, KeyboardShouldPersistTaps, TabsInstance } from './types';\n\nexport default interface TabsProps extends OverridableComponentProps<ViewProps, {\n ref?: Ref<TabsInstance>;\n\n /**\n * Collection of Tab components.\n */\n children: ReactNode;\n\n /**\n * If `true`, the indicator is disabled.\n * @default false\n */\n disableIndicator?: boolean;\n\n /**\n * Index of initial tab that should be selected.\n * @default 0\n */\n initialIndex?: number;\n\n /**\n * keyboard dismissing condition of dragging.\n * @default 'none'\n */\n keyboardDismissMode?: KeyboardDismissMode,\n\n /**\n * keyboard persisting condition of tapping.\n * @default 'never'\n */\n keyboardShouldPersistTaps?: KeyboardShouldPersistTaps,\n\n /**\n * Callback fired when a tab is selected.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * If `true`, the component will be able to scroll.\n * @default false\n */\n scrollable?: boolean;\n\n /**\n * Unstable API.\n */\n UNSTABLE_sharedIndex?: SyncAnimatedValue;\n\n /**\n * The variant to use.\n * @default 'primary'\n */\n variant?: TabVariant;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TabsProps.ts"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { TabIndicatorColor } from './TabIndicatorProps';\nimport type { TabVariant } from '../Tab';\nimport type { OverridableComponentProps, SyncAnimatedValue } from '../types';\nimport type { KeyboardDismissMode, KeyboardShouldPersistTaps, TabsInstance } from './types';\n\nexport default interface TabsProps extends OverridableComponentProps<ViewProps, {\n ref?: Ref<TabsInstance>;\n\n /**\n * Collection of Tab components.\n */\n children: ReactNode;\n\n /**\n * If `true`, the indicator is disabled.\n * @default false\n */\n disableIndicator?: boolean;\n\n /**\n * The color of tab indicator\n * @default 'primary'\n */\n indicatorColor?: TabIndicatorColor;\n\n /**\n * Index of initial tab that should be selected.\n * @default 0\n */\n initialIndex?: number;\n\n /**\n * keyboard dismissing condition of dragging.\n * @default 'none'\n */\n keyboardDismissMode?: KeyboardDismissMode,\n\n /**\n * keyboard persisting condition of tapping.\n * @default 'never'\n */\n keyboardShouldPersistTaps?: KeyboardShouldPersistTaps,\n\n /**\n * Callback fired when a tab is selected.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * If `true`, the component will be able to scroll.\n * @default false\n */\n scrollable?: boolean;\n\n /**\n * Unstable API.\n */\n UNSTABLE_sharedIndex?: SyncAnimatedValue;\n\n /**\n * The variant to use.\n * @default 'primary'\n */\n variant?: TabVariant;\n}> {}\n"],"mappings":""}