@fountain-ui/core 2.0.0-beta.30 → 2.0.0-beta.32

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.
@@ -23,7 +23,6 @@ const defaultPosition = {
23
23
  const useStyles = function () {
24
24
  const theme = (0, _styles.useTheme)();
25
25
  const dotSize = 4;
26
- const offset = 0;
27
26
  return {
28
27
  root: {},
29
28
  badge: {
@@ -32,18 +31,6 @@ const useStyles = function () {
32
31
  height: dotSize,
33
32
  position: 'absolute',
34
33
  width: dotSize
35
- },
36
- top: {
37
- top: offset
38
- },
39
- bottom: {
40
- bottom: offset
41
- },
42
- left: {
43
- left: offset
44
- },
45
- right: {
46
- right: offset
47
34
  }
48
35
  };
49
36
  };
@@ -54,11 +41,15 @@ function Badge(props) {
54
41
  invisible = false,
55
42
  position = defaultPosition,
56
43
  style,
44
+ offset = 0,
57
45
  ...otherProps
58
46
  } = props;
59
47
  const styles = useStyles();
60
48
  const rootStyle = (0, _styles.css)([styles.root, style]);
61
- const badgeStyle = (0, _styles.css)([styles.badge, styles[position.vertical], styles[position.horizontal]]);
49
+ const badgeStyle = (0, _styles.css)([styles.badge, {
50
+ [position.vertical]: offset,
51
+ [position.horizontal]: offset
52
+ }]);
62
53
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
63
54
  style: rootStyle
64
55
  }, otherProps), children, !invisible ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -1 +1 @@
1
- {"version":3,"names":["defaultPosition","vertical","horizontal","useStyles","theme","useTheme","dotSize","offset","root","badge","backgroundColor","palette","secondary","main","borderRadius","height","position","width","top","bottom","left","right","Badge","props","children","invisible","style","otherProps","styles","rootStyle","css","badgeStyle"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport BadgeProps, { BadgePosition } from './BadgeProps';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\ntype BadgeStyles = NamedStylesStringUnion<'root' | 'badge' | 'top' | 'bottom' | 'left' | 'right'>;\n\nconst useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {\n const theme = useTheme();\n\n const dotSize = 4;\n const offset = 0;\n\n return {\n root: {},\n badge: {\n backgroundColor: theme.palette.secondary.main,\n borderRadius: dotSize * 0.5,\n height: dotSize,\n position: 'absolute',\n width: dotSize,\n },\n top: {\n top: offset,\n },\n bottom: {\n bottom: offset,\n },\n left: {\n left: offset,\n },\n right: {\n right: offset,\n },\n };\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n invisible = false,\n position = defaultPosition,\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const badgeStyle = css([\n styles.badge,\n styles[position.vertical],\n styles[position.horizontal],\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? <View style={badgeStyle}/> : null}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAGA,MAAMA,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFuB,CAAvC;;AAOA,MAAMC,SAAiC,GAAG,YAAyB;EAC/D,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,OAAO,GAAG,CAAhB;EACA,MAAMC,MAAM,GAAG,CAAf;EAEA,OAAO;IACHC,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;MACHC,eAAe,EAAEN,KAAK,CAACO,OAAN,CAAcC,SAAd,CAAwBC,IADtC;MAEHC,YAAY,EAAER,OAAO,GAAG,GAFrB;MAGHS,MAAM,EAAET,OAHL;MAIHU,QAAQ,EAAE,UAJP;MAKHC,KAAK,EAAEX;IALJ,CAFJ;IASHY,GAAG,EAAE;MACDA,GAAG,EAAEX;IADJ,CATF;IAYHY,MAAM,EAAE;MACJA,MAAM,EAAEZ;IADJ,CAZL;IAeHa,IAAI,EAAE;MACFA,IAAI,EAAEb;IADJ,CAfH;IAkBHc,KAAK,EAAE;MACHA,KAAK,EAAEd;IADJ;EAlBJ,CAAP;AAsBH,CA5BD;;AA8Be,SAASe,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,QADE;IAEFC,SAAS,GAAG,KAFV;IAGFT,QAAQ,GAAGhB,eAHT;IAIF0B,KAJE;IAKF,GAAGC;EALD,IAMFJ,KANJ;EAQA,MAAMK,MAAM,GAAGzB,SAAS,EAAxB;EAEA,MAAM0B,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBF,MAAM,CAACpB,IADW,EAElBkB,KAFkB,CAAJ,CAAlB;EAKA,MAAMK,UAAU,GAAG,IAAAD,WAAA,EAAI,CACnBF,MAAM,CAACnB,KADY,EAEnBmB,MAAM,CAACZ,QAAQ,CAACf,QAAV,CAFa,EAGnB2B,MAAM,CAACZ,QAAQ,CAACd,UAAV,CAHa,CAAJ,CAAnB;EAMA,oBACI,6BAAC,iBAAD;IACI,KAAK,EAAE2B;EADX,GAEQF,UAFR,GAIKH,QAJL,EAMK,CAACC,SAAD,gBAAa,6BAAC,iBAAD;IAAM,KAAK,EAAEM;EAAb,EAAb,GAA0C,IAN/C,CADJ;AAUH;;AAAA"}
1
+ {"version":3,"names":["defaultPosition","vertical","horizontal","useStyles","theme","useTheme","dotSize","root","badge","backgroundColor","palette","secondary","main","borderRadius","height","position","width","Badge","props","children","invisible","style","offset","otherProps","styles","rootStyle","css","badgeStyle"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport BadgeProps, { BadgePosition } from './BadgeProps';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\ntype BadgeStyles = NamedStylesStringUnion<'root' | 'badge'>;\n\nconst useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {\n const theme = useTheme();\n\n const dotSize = 4;\n\n return {\n root: {},\n badge: {\n backgroundColor: theme.palette.secondary.main,\n borderRadius: dotSize * 0.5,\n height: dotSize,\n position: 'absolute',\n width: dotSize,\n },\n };\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n invisible = false,\n position = defaultPosition,\n style,\n offset = 0,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const badgeStyle = css([\n styles.badge,\n {\n [position.vertical]: offset,\n [position.horizontal]: offset,\n },\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? <View style={badgeStyle}/> : null}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAGA,MAAMA,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFuB,CAAvC;;AAOA,MAAMC,SAAiC,GAAG,YAAyB;EAC/D,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,OAAO,GAAG,CAAhB;EAEA,OAAO;IACHC,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;MACHC,eAAe,EAAEL,KAAK,CAACM,OAAN,CAAcC,SAAd,CAAwBC,IADtC;MAEHC,YAAY,EAAEP,OAAO,GAAG,GAFrB;MAGHQ,MAAM,EAAER,OAHL;MAIHS,QAAQ,EAAE,UAJP;MAKHC,KAAK,EAAEV;IALJ;EAFJ,CAAP;AAUH,CAfD;;AAiBe,SAASW,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,QADE;IAEFC,SAAS,GAAG,KAFV;IAGFL,QAAQ,GAAGf,eAHT;IAIFqB,KAJE;IAKFC,MAAM,GAAG,CALP;IAMF,GAAGC;EAND,IAOFL,KAPJ;EASA,MAAMM,MAAM,GAAGrB,SAAS,EAAxB;EAEA,MAAMsB,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBF,MAAM,CAACjB,IADW,EAElBc,KAFkB,CAAJ,CAAlB;EAKA,MAAMM,UAAU,GAAG,IAAAD,WAAA,EAAI,CACnBF,MAAM,CAAChB,KADY,EAEnB;IACI,CAACO,QAAQ,CAACd,QAAV,GAAqBqB,MADzB;IAEI,CAACP,QAAQ,CAACb,UAAV,GAAuBoB;EAF3B,CAFmB,CAAJ,CAAnB;EAQA,oBACI,6BAAC,iBAAD;IACI,KAAK,EAAEG;EADX,GAEQF,UAFR,GAIKJ,QAJL,EAMK,CAACC,SAAD,gBAAa,6BAAC,iBAAD;IAAM,KAAK,EAAEO;EAAb,EAAb,GAA0C,IAN/C,CADJ;AAUH;;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n\n /**\n * The offset of the badge.\n * @default 0\n */\n offset?: number;\n}> {}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["CheckboxProps.ts"],"sourcesContent":["import React from 'react';\nimport type { CommonComponentColor, OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\ntype BaseProps = Omit<ButtonBaseProps, 'onPress'>;\n\nexport type CheckboxColor = CommonComponentColor;\n\nexport default interface CheckboxProps extends OverridableComponentProps<BaseProps, {\n /**\n * If `true`, the component is checked.\n * @default false\n */\n checked?: boolean;\n\n /**\n * The checked Icon which is replaced.\n */\n checkedIcon?: React.ReactElement;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: CheckboxColor;\n\n /**\n * If `true`, the checkbox is disabled.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * The unchecked Icon which is replaced.\n */\n icon?: React.ReactElement;\n\n /**\n * Callback fired when the state is changed.\n */\n onChange?: (newChecked: boolean) => void;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["CheckboxProps.ts"],"sourcesContent":["import React from 'react';\nimport type { CommonComponentColor, OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\ntype BaseProps = Omit<ButtonBaseProps, 'onPress' | 'children'>;\n\nexport type CheckboxColor = CommonComponentColor;\n\nexport default interface CheckboxProps extends OverridableComponentProps<BaseProps, {\n /**\n * If `true`, the component is checked.\n * @default false\n */\n checked?: boolean;\n\n /**\n * The checked Icon which is replaced.\n */\n checkedIcon?: React.ReactElement;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: CheckboxColor;\n\n /**\n * If `true`, the checkbox is disabled.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * The unchecked Icon which is replaced.\n */\n icon?: React.ReactElement;\n\n /**\n * Callback fired when the state is changed.\n */\n onChange?: (newChecked: boolean) => void;\n}> {}\n"],"mappings":""}
@@ -70,6 +70,7 @@ function Slide(props) {
70
70
  }
71
71
  }, [appear, onEnter, onEntered, onExit, onExited]);
72
72
  return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({
73
+ pointerEvents: 'box-none',
73
74
  style: [animatedStyle, style]
74
75
  }, otherProps));
75
76
  }
@@ -1 +1 @@
1
- {"version":3,"names":["defaultEnterDuration","defaultExitDuration","getDisappearingOffsetY","Dimensions","get","height","Slide","props","animatedY","animatedYProp","appear","enterDuration","exitDuration","onEnter","onEntered","onExit","onExited","style","otherProps","y","useSharedValue","animatedStyle","useAnimatedStyle","transform","translateY","value","useEffect","toValue","enterConfig","duration","easing","Easing","out","exp","withTiming","isFinished","runOnJS","exitConfig","in","ease"],"sources":["Slide.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type SlideProps from './SlideProps';\n\nconst defaultEnterDuration = 300;\nconst defaultExitDuration = 300;\n\nconst getDisappearingOffsetY = (): number => Dimensions.get('window').height;\n\nexport default function Slide(props: SlideProps) {\n const {\n animatedY: animatedYProp,\n appear,\n enterDuration = defaultEnterDuration,\n exitDuration = defaultExitDuration,\n onEnter,\n onEntered,\n onExit,\n onExited,\n style,\n ...otherProps\n } = props;\n\n const y = useSharedValue(getDisappearingOffsetY());\n const animatedY = animatedYProp || y;\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: animatedY.value }],\n }), []);\n\n useEffect(() => {\n if (appear) {\n onEnter?.();\n\n const toValue = 0;\n const enterConfig: Readonly<WithTimingConfig> = {\n duration: enterDuration,\n easing: Easing.out(Easing.exp),\n };\n\n animatedY.value = withTiming(toValue, enterConfig, isFinished => {\n if (isFinished && onEntered) {\n runOnJS(onEntered)();\n }\n });\n } else {\n onExit?.();\n\n const toValue = getDisappearingOffsetY();\n const exitConfig: Readonly<WithTimingConfig> = {\n duration: exitDuration,\n easing: Easing.in(Easing.ease),\n };\n\n animatedY.value = withTiming(toValue, exitConfig, isFinished => {\n if (isFinished && onExited) {\n runOnJS(onExited)();\n }\n });\n }\n }, [appear, onEnter, onEntered, onExit, onExited]);\n\n return (\n <Animated.View\n style={[\n animatedStyle,\n style,\n ]}\n {...otherProps}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAGA,MAAMA,oBAAoB,GAAG,GAA7B;AACA,MAAMC,mBAAmB,GAAG,GAA5B;;AAEA,MAAMC,sBAAsB,GAAG,MAAcC,uBAAA,CAAWC,GAAX,CAAe,QAAf,EAAyBC,MAAtE;;AAEe,SAASC,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,SAAS,EAAEC,aADT;IAEFC,MAFE;IAGFC,aAAa,GAAGX,oBAHd;IAIFY,YAAY,GAAGX,mBAJb;IAKFY,OALE;IAMFC,SANE;IAOFC,MAPE;IAQFC,QARE;IASFC,KATE;IAUF,GAAGC;EAVD,IAWFX,KAXJ;EAaA,MAAMY,CAAC,GAAG,IAAAC,qCAAA,EAAelB,sBAAsB,EAArC,CAAV;EACA,MAAMM,SAAS,GAAGC,aAAa,IAAIU,CAAnC;EAEA,MAAME,aAAa,GAAG,IAAAC,uCAAA,EAAiB,OAAO;IAC1CC,SAAS,EAAE,CAAC;MAAEC,UAAU,EAAEhB,SAAS,CAACiB;IAAxB,CAAD;EAD+B,CAAP,CAAjB,EAElB,EAFkB,CAAtB;EAIA,IAAAC,gBAAA,EAAU,MAAM;IACZ,IAAIhB,MAAJ,EAAY;MACRG,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO;MAEP,MAAMc,OAAO,GAAG,CAAhB;MACA,MAAMC,WAAuC,GAAG;QAC5CC,QAAQ,EAAElB,aADkC;QAE5CmB,MAAM,EAAEC,6BAAA,CAAOC,GAAP,CAAWD,6BAAA,CAAOE,GAAlB;MAFoC,CAAhD;MAKAzB,SAAS,CAACiB,KAAV,GAAkB,IAAAS,iCAAA,EAAWP,OAAX,EAAoBC,WAApB,EAAiCO,UAAU,IAAI;QAC7D,IAAIA,UAAU,IAAIrB,SAAlB,EAA6B;UACzB,IAAAsB,8BAAA,EAAQtB,SAAR;QACH;MACJ,CAJiB,CAAlB;IAKH,CAdD,MAcO;MACHC,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM;MAEN,MAAMY,OAAO,GAAGzB,sBAAsB,EAAtC;MACA,MAAMmC,UAAsC,GAAG;QAC3CR,QAAQ,EAAEjB,YADiC;QAE3CkB,MAAM,EAAEC,6BAAA,CAAOO,EAAP,CAAUP,6BAAA,CAAOQ,IAAjB;MAFmC,CAA/C;MAKA/B,SAAS,CAACiB,KAAV,GAAkB,IAAAS,iCAAA,EAAWP,OAAX,EAAoBU,UAApB,EAAgCF,UAAU,IAAI;QAC5D,IAAIA,UAAU,IAAInB,QAAlB,EAA4B;UACxB,IAAAoB,8BAAA,EAAQpB,QAAR;QACH;MACJ,CAJiB,CAAlB;IAKH;EACJ,CA9BD,EA8BG,CAACN,MAAD,EAASG,OAAT,EAAkBC,SAAlB,EAA6BC,MAA7B,EAAqCC,QAArC,CA9BH;EAgCA,oBACI,6BAAC,8BAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHK,aADG,EAEHJ,KAFG;EADX,GAKQC,UALR,EADJ;AASH;;AAAA"}
1
+ {"version":3,"names":["defaultEnterDuration","defaultExitDuration","getDisappearingOffsetY","Dimensions","get","height","Slide","props","animatedY","animatedYProp","appear","enterDuration","exitDuration","onEnter","onEntered","onExit","onExited","style","otherProps","y","useSharedValue","animatedStyle","useAnimatedStyle","transform","translateY","value","useEffect","toValue","enterConfig","duration","easing","Easing","out","exp","withTiming","isFinished","runOnJS","exitConfig","in","ease"],"sources":["Slide.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type SlideProps from './SlideProps';\n\nconst defaultEnterDuration = 300;\nconst defaultExitDuration = 300;\n\nconst getDisappearingOffsetY = (): number => Dimensions.get('window').height;\n\nexport default function Slide(props: SlideProps) {\n const {\n animatedY: animatedYProp,\n appear,\n enterDuration = defaultEnterDuration,\n exitDuration = defaultExitDuration,\n onEnter,\n onEntered,\n onExit,\n onExited,\n style,\n ...otherProps\n } = props;\n\n const y = useSharedValue(getDisappearingOffsetY());\n const animatedY = animatedYProp || y;\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: animatedY.value }],\n }), []);\n\n useEffect(() => {\n if (appear) {\n onEnter?.();\n\n const toValue = 0;\n const enterConfig: Readonly<WithTimingConfig> = {\n duration: enterDuration,\n easing: Easing.out(Easing.exp),\n };\n\n animatedY.value = withTiming(toValue, enterConfig, isFinished => {\n if (isFinished && onEntered) {\n runOnJS(onEntered)();\n }\n });\n } else {\n onExit?.();\n\n const toValue = getDisappearingOffsetY();\n const exitConfig: Readonly<WithTimingConfig> = {\n duration: exitDuration,\n easing: Easing.in(Easing.ease),\n };\n\n animatedY.value = withTiming(toValue, exitConfig, isFinished => {\n if (isFinished && onExited) {\n runOnJS(onExited)();\n }\n });\n }\n }, [appear, onEnter, onEntered, onExit, onExited]);\n\n return (\n <Animated.View\n pointerEvents={'box-none'}\n style={[\n animatedStyle,\n style,\n ]}\n {...otherProps}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAGA,MAAMA,oBAAoB,GAA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AAsB,EAAtC;MACA,MAAMmC,UAAsC,GAAG;QAC3CR,QAAQ,EAAEjB,YADiC;QAE3CkB,MAAM,EAAEC,6BAAA,CAAOO,EAAP,CAAUP,6BAAA,CAAOQ,IAAjB;MAFmC,CAA/C;MAKA/B,SAAS,CAACiB,KAAV,GAAkB,IAAAS,iCAAA,EAAWP,OAAX,EAAoBU,UAApB,EAAgCF,UAAU,IAAI;QAC5D,IAAIA,UAAU,IAAInB,QAAlB,EAA4B;UACxB,IAAAoB,8BAAA,EAAQpB,QAAR;QACH;MACJ,CAJiB,CAAlB;IAKH;EACJ,CA9BD,EA8BG,CAACN,MAAD,EAASG,OAAT,EAAkBC,SAAlB,EAA6BC,MAA7B,EAAqCC,QAArC,CA9BH;EAgCA,oBACI,6BAAC,8BAAD,CAAU,IAAV;IACI,aAAa,EAAE,UADnB;IAEI,KAAK,EAAE,CACHK,aADG,EAEHJ,KAFG;EAFX,GAMQC,UANR,EADJ;AAUH;;AAAA"}
@@ -40,11 +40,13 @@ const ANIMATION_CONFIG = {
40
40
 
41
41
  function Tooltip(props) {
42
42
  const {
43
+ arrowLayout,
43
44
  children,
44
45
  left,
45
46
  onClose,
46
47
  placement = 'top',
47
48
  right,
49
+ numberOfTitleLines = 1,
48
50
  style,
49
51
  title,
50
52
  tooltipStyle,
@@ -62,7 +64,7 @@ function Tooltip(props) {
62
64
  const [r, g, b] = (0, _utils.rgb)(theme.palette.primary.main);
63
65
  const totalVerticalOffset = -(layout.height + verticalOffset);
64
66
  const tooltipLayoutStyle = {
65
- alignItems: 'center',
67
+ alignItems: (arrowLayout === null || arrowLayout === void 0 ? void 0 : arrowLayout.placement) === 'left' ? 'flex-start' : (arrowLayout === null || arrowLayout === void 0 ? void 0 : arrowLayout.placement) === 'right' ? 'flex-end' : 'center',
66
68
  bottom: placement === 'bottom' ? totalVerticalOffset : undefined,
67
69
  left,
68
70
  position: 'absolute',
@@ -90,6 +92,10 @@ function Tooltip(props) {
90
92
  const textStyle = (0, _styles.css)([fontStyle, {
91
93
  marginRight: theme.spacing(2)
92
94
  }]);
95
+ const arrowStyle = (0, _styles.css)({ ...(arrowLayout && {
96
+ [arrowLayout.placement]: arrowLayout.offset
97
+ })
98
+ });
93
99
 
94
100
  const buttonElem = /*#__PURE__*/_react.default.createElement(_ButtonBase.default, {
95
101
  pressEffect: 'none',
@@ -99,7 +105,7 @@ function Tooltip(props) {
99
105
  }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
100
106
  children: title // TODO: Should we provide text prop customization?
101
107
  ,
102
- numberOfLines: 1,
108
+ numberOfLines: numberOfTitleLines,
103
109
  style: textStyle
104
110
  }), /*#__PURE__*/_react.default.createElement(_icons.Close, {
105
111
  fill: theme.palette.primary.contrastTextColor,
@@ -107,11 +113,13 @@ function Tooltip(props) {
107
113
  height: 20
108
114
  })));
109
115
 
110
- const arrowElem = /*#__PURE__*/_react.default.createElement(_UpArrow.default, {
116
+ const arrowElem = /*#__PURE__*/_react.default.createElement(_reactNative.View, {
117
+ style: arrowStyle
118
+ }, /*#__PURE__*/_react.default.createElement(_UpArrow.default, {
111
119
  upsideDown: placement === 'top',
112
120
  fill: theme.palette.primary.main,
113
121
  opacity: DEFAULT_OPACITY
114
- });
122
+ }));
115
123
 
116
124
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
117
125
  style: style
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_OPACITY","initialLayout","width","height","x","y","ANIMATION_CONFIG","duration","Tooltip","props","children","left","onClose","placement","right","style","title","tooltipStyle","verticalOffset","visible","theme","useTheme","layout","setLayout","useState","scale","useSharedValue","animatedStyle","useAnimatedStyle","transform","value","r","g","b","rgb","palette","primary","main","totalVerticalOffset","tooltipLayoutStyle","alignItems","bottom","undefined","position","top","zIndex","tooltip","overflow","useEffect","nextScaleValue","withTiming","touchableStyle","backgroundColor","borderRadius","shape","roundness","flexDirection","padding","spacing","fontStyle","createFontStyle","selector","typo","caption2","color","contrastTextColor","textStyle","css","marginRight","buttonElem","arrowElem","event","nativeEvent"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Text, View, ViewProps } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { rgb } from '@fountain-ui/utils';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { Close as CloseIcon } from '../internal/icons';\nimport type TooltipProps from './TooltipProps';\nimport UpArrow from './UpArrow';\n\nconst DEFAULT_OPACITY = 0.8;\nconst initialLayout = { width: 0, height: 0, x: 0, y: 0 };\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 150 };\n\nexport default function Tooltip(props: TooltipProps) {\n const {\n children,\n left,\n onClose,\n placement = 'top',\n right,\n style,\n title,\n tooltipStyle,\n verticalOffset = 4,\n visible = false,\n } = props;\n\n const theme = useTheme();\n\n const [layout, setLayout] = useState(initialLayout);\n\n const scale = useSharedValue(0);\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scale.value }],\n }), []);\n\n const [r, g, b] = rgb(theme.palette.primary.main);\n\n const totalVerticalOffset = -(layout.height + verticalOffset);\n const tooltipLayoutStyle: ViewProps['style'] = {\n alignItems: 'center',\n bottom: placement === 'bottom' ? totalVerticalOffset : undefined,\n left,\n position: 'absolute',\n right,\n top: placement === 'top' ? totalVerticalOffset : undefined,\n zIndex: theme.zIndex.tooltip,\n height: visible ? undefined : 0,\n overflow: visible ? undefined : 'hidden',\n };\n\n useEffect(() => {\n const nextScaleValue = visible ? 1 : 0;\n\n scale.value = withTiming(nextScaleValue, ANIMATION_CONFIG);\n }, [visible]);\n\n const touchableStyle: ViewProps['style'] = {\n alignItems: 'center',\n backgroundColor: `rgba(${r}, ${g}, ${b}, ${DEFAULT_OPACITY})`,\n borderRadius: theme.shape.roundness,\n flexDirection: 'row',\n padding: theme.spacing(2),\n };\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: theme.palette.primary.contrastTextColor,\n });\n\n const textStyle = css([\n fontStyle,\n { marginRight: theme.spacing(2) },\n ]);\n\n const buttonElem = (\n <ButtonBase\n pressEffect={'none'}\n onPress={onClose}\n >\n <View style={css(touchableStyle)}>\n <Text\n children={title}\n // TODO: Should we provide text prop customization?\n numberOfLines={1}\n style={textStyle}\n />\n <CloseIcon\n fill={theme.palette.primary.contrastTextColor}\n width={20}\n height={20}\n />\n </View>\n </ButtonBase>\n );\n\n const arrowElem = (\n <UpArrow\n upsideDown={placement === 'top'}\n fill={theme.palette.primary.main}\n opacity={DEFAULT_OPACITY}\n />\n );\n\n return (\n <View style={style}>\n {children}\n\n <Animated.View\n onLayout={(event) => setLayout(event.nativeEvent.layout)}\n style={[\n animatedStyle,\n tooltipLayoutStyle,\n tooltipStyle,\n ]}\n >\n {placement === 'top' ? (\n <React.Fragment>\n {buttonElem}\n {arrowElem}\n </React.Fragment>\n ) : (\n <React.Fragment>\n {arrowElem}\n {buttonElem}\n </React.Fragment>\n )}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA,MAAMA,eAAe,GAAG,GAAxB;AACA,MAAMC,aAAa,GAAG;EAAEC,KAAK,EAAE,CAAT;EAAYC,MAAM,EAAE,CAApB;EAAuBC,CAAC,EAAE,CAA1B;EAA6BC,CAAC,EAAE;AAAhC,CAAtB;AAEA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;;AAEe,SAASC,OAAT,CAAiBC,KAAjB,EAAsC;EACjD,MAAM;IACFC,QADE;IAEFC,IAFE;IAGFC,OAHE;IAIFC,SAAS,GAAG,KAJV;IAKFC,KALE;IAMFC,KANE;IAOFC,KAPE;IAQFC,YARE;IASFC,cAAc,GAAG,CATf;IAUFC,OAAO,GAAG;EAVR,IAWFV,KAXJ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,oBACI,6BAAC,iBAAD;IAAM,KAAK,EAAEe;EAAb,GACKL,QADL,eAGI,6BAAC,8BAAD,CAAU,IAAV;IACI,QAAQ,EAAG6D,KAAD,IAAWhD,SAAS,CAACgD,KAAK,CAACC,WAAN,CAAkBlD,MAAnB,CADlC;IAEI,KAAK,EAAE,CACHK,aADG,EAEHY,kBAFG,EAGHtB,YAHG;EAFX,GAQKJ,SAAS,KAAK,KAAd,gBACG,6BAAC,cAAD,CAAO,QAAP,QACKwD,UADL,EAEKC,SAFL,CADH,gBAMG,6BAAC,cAAD,CAAO,QAAP,QACKA,SADL,EAEKD,UAFL,CAdR,CAHJ,CADJ;AA0BH;;AAAA"}
1
+ {"version":3,"names":["DEFAULT_OPACITY","initialLayout","width","height","x","y","ANIMATION_CONFIG","duration","Tooltip","props","arrowLayout","children","left","onClose","placement","right","numberOfTitleLines","style","title","tooltipStyle","verticalOffset","visible","theme","useTheme","layout","setLayout","useState","scale","useSharedValue","animatedStyle","useAnimatedStyle","transform","value","r","g","b","rgb","palette","primary","main","totalVerticalOffset","tooltipLayoutStyle","alignItems","bottom","undefined","position","top","zIndex","tooltip","overflow","useEffect","nextScaleValue","withTiming","touchableStyle","backgroundColor","borderRadius","shape","roundness","flexDirection","padding","spacing","fontStyle","createFontStyle","selector","typo","caption2","color","contrastTextColor","textStyle","css","marginRight","arrowStyle","offset","buttonElem","arrowElem","event","nativeEvent"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Text, View, ViewProps } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { rgb } from '@fountain-ui/utils';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { Close as CloseIcon } from '../internal/icons';\nimport type TooltipProps from './TooltipProps';\nimport UpArrow from './UpArrow';\n\nconst DEFAULT_OPACITY = 0.8;\nconst initialLayout = { width: 0, height: 0, x: 0, y: 0 };\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 150 };\n\nexport default function Tooltip(props: TooltipProps) {\n const {\n arrowLayout,\n children,\n left,\n onClose,\n placement = 'top',\n right,\n numberOfTitleLines = 1,\n style,\n title,\n tooltipStyle,\n verticalOffset = 4,\n visible = false,\n } = props;\n\n const theme = useTheme();\n\n const [layout, setLayout] = useState(initialLayout);\n\n const scale = useSharedValue(0);\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scale.value }],\n }), []);\n\n const [r, g, b] = rgb(theme.palette.primary.main);\n\n const totalVerticalOffset = -(layout.height + verticalOffset);\n const tooltipLayoutStyle: ViewProps['style'] = {\n alignItems: arrowLayout?.placement === 'left'\n ? 'flex-start'\n : arrowLayout?.placement === 'right'\n ? 'flex-end'\n : 'center',\n bottom: placement === 'bottom' ? totalVerticalOffset : undefined,\n left,\n position: 'absolute',\n right,\n top: placement === 'top' ? totalVerticalOffset : undefined,\n zIndex: theme.zIndex.tooltip,\n height: visible ? undefined : 0,\n overflow: visible ? undefined : 'hidden',\n };\n\n useEffect(() => {\n const nextScaleValue = visible ? 1 : 0;\n\n scale.value = withTiming(nextScaleValue, ANIMATION_CONFIG);\n }, [visible]);\n\n const touchableStyle: ViewProps['style'] = {\n alignItems: 'center',\n backgroundColor: `rgba(${r}, ${g}, ${b}, ${DEFAULT_OPACITY})`,\n borderRadius: theme.shape.roundness,\n flexDirection: 'row',\n padding: theme.spacing(2),\n };\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: theme.palette.primary.contrastTextColor,\n });\n\n const textStyle = css([\n fontStyle,\n { marginRight: theme.spacing(2) },\n ]);\n\n const arrowStyle = css({\n ...(arrowLayout && {\n [arrowLayout.placement]: arrowLayout.offset,\n }),\n });\n\n const buttonElem = (\n <ButtonBase\n pressEffect={'none'}\n onPress={onClose}\n >\n <View style={css(touchableStyle)}>\n <Text\n children={title}\n // TODO: Should we provide text prop customization?\n numberOfLines={numberOfTitleLines}\n style={textStyle}\n />\n <CloseIcon\n fill={theme.palette.primary.contrastTextColor}\n width={20}\n height={20}\n />\n </View>\n </ButtonBase>\n );\n\n const arrowElem = (\n <View style={arrowStyle}>\n <UpArrow\n upsideDown={placement === 'top'}\n fill={theme.palette.primary.main}\n opacity={DEFAULT_OPACITY}\n />\n </View>\n );\n\n return (\n <View style={style}>\n {children}\n\n <Animated.View\n onLayout={(event) => setLayout(event.nativeEvent.layout)}\n style={[\n animatedStyle,\n tooltipLayoutStyle,\n tooltipStyle,\n ]}\n >\n {placement === 'top' ? (\n <React.Fragment>\n {buttonElem}\n {arrowElem}\n </React.Fragment>\n ) : (\n <React.Fragment>\n {arrowElem}\n {buttonElem}\n </React.Fragment>\n )}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA,MAAMA,eAAe,GAAG,GAAxB;AACA,MAAMC,aAAa,GAAG;EAAEC,KAAK,EAAE,CAAT;EAAYC,MAAM,EAAE,CAApB;EAAuBC,CAAC,EAAE,CAA1B;EAA6BC,CAAC,EAAE;AAAhC,CAAtB;AAEA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;;AAEe,SAASC,OAAT,CAAiBC,KAAjB,EAAsC;EACjD,MAAM;IACFC,WADE;IAEFC,QAFE;IAGFC,IAHE;IAIFC,OAJE;IAKFC,SAAS,GAAG,KALV;IAMFC,KANE;IAOFC,kBAAkB,GAAG,CAPnB;IAQFC,KARE;IASFC,KATE;IAUFC,YAVE;IAWFC,cAAc,GAAG,CAXf;IAYFC,OAAO,GAAG;EAZR,IAaFZ,KAbJ;EAeA,MAAMa,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsB,IAAAC,eAAA,EAASzB,aAAT,CAA5B;EAEA,MAAM0B,KA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EAAE;EAHZ,EAPJ,CAJJ,CADJ;;EAqBA,MAAMO,SAAS,gBACX,6BAAC,iBAAD;IAAM,KAAK,EAAEH;EAAb,gBACI,6BAAC,gBAAD;IACI,UAAU,EAAEzD,SAAS,KAAK,KAD9B;IAEI,IAAI,EAAEQ,KAAK,CAACe,OAAN,CAAcC,OAAd,CAAsBC,IAFhC;IAGI,OAAO,EAAEvC;EAHb,EADJ,CADJ;;EAUA,oBACI,6BAAC,iBAAD;IAAM,KAAK,EAAEiB;EAAb,GACKN,QADL,eAGI,6BAAC,8BAAD,CAAU,IAAV;IACI,QAAQ,EAAGgE,KAAD,IAAWlD,SAAS,CAACkD,KAAK,CAACC,WAAN,CAAkBpD,MAAnB,CADlC;IAEI,KAAK,EAAE,CACHK,aADG,EAEHY,kBAFG,EAGHtB,YAHG;EAFX,GAQKL,SAAS,KAAK,KAAd,gBACG,6BAAC,cAAD,CAAO,QAAP,QACK2D,UADL,EAEKC,SAFL,CADH,gBAMG,6BAAC,cAAD,CAAO,QAAP,QACKA,SADL,EAEKD,UAFL,CAdR,CAHJ,CADJ;AA0BH;;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TooltipProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps, ViewStyle } from 'react-native';\nimport type { ComponentProps } from '../types';\nimport type { ButtonProps } from '../Button';\n\nexport type TooltipPlacement = 'top' | 'bottom';\n\nexport default interface TooltipProps extends ComponentProps<{\n /**\n * Tooltip reference element.\n */\n children: React.ReactNode;\n\n /**\n * Left position relative to reference element.\n */\n left?: number;\n\n /**\n * Callback fired when the component requests to be closed.\n */\n onClose?: () => void;\n\n /**\n * Tooltip placement.\n * @default 'top'\n */\n placement?: TooltipPlacement;\n\n /**\n * Right position relative to reference element.\n */\n right?: number;\n\n /**\n * Tooltip title.\n */\n title: ButtonProps['children'];\n\n /**\n * Additional style for tooltip wrapper.\n */\n tooltipStyle?: ViewProps['style'];\n\n /**\n * The additional amount to vertically shift.\n * @default 4\n */\n verticalOffset?: number;\n\n /**\n * If `true`, the tooltip is shown.\n * @default false\n */\n visible?: boolean;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TooltipProps.ts"],"sourcesContent":["import React from 'react';\nimport type { TextProps, ViewProps } from 'react-native';\nimport type { ComponentProps } from '../types';\nimport type { ButtonProps } from '../Button';\n\nexport type TooltipPlacement = 'top' | 'bottom';\n\nexport type TooltipArrowPlacement = 'left' | 'right';\n\nexport default interface TooltipProps extends ComponentProps<{\n /**\n * Tooltip reference element.\n */\n children: React.ReactNode;\n\n /**\n * Left position relative to reference element.\n */\n left?: number;\n\n /**\n * Callback fired when the component requests to be closed.\n */\n onClose?: () => void;\n\n /**\n * Tooltip placement.\n * @default 'top'\n */\n placement?: TooltipPlacement;\n\n /**\n * Right position relative to reference element.\n */\n right?: number;\n\n /**\n * Tooltip title.\n */\n title: ButtonProps['children'];\n\n /**\n * Additional style for tooltip wrapper.\n */\n tooltipStyle?: ViewProps['style'];\n\n /**\n * The additional amount to vertically shift.\n * @default 4\n */\n verticalOffset?: number;\n\n /**\n * If `true`, the tooltip is shown.\n * @default false\n */\n visible?: boolean;\n\n /**\n * Tooltip arrow layout.\n * If 'undefined', the arrow will be centered on tooltip.\n */\n arrowLayout?: {\n placement: TooltipArrowPlacement;\n offset: number;\n }\n\n /**\n * number of tooltip's title lines\n * @default 1\n */\n numberOfTitleLines?: TextProps['numberOfLines'];\n}> {}\n"],"mappings":""}
@@ -11,7 +11,6 @@ const defaultPosition = {
11
11
  const useStyles = function () {
12
12
  const theme = useTheme();
13
13
  const dotSize = 4;
14
- const offset = 0;
15
14
  return {
16
15
  root: {},
17
16
  badge: {
@@ -20,18 +19,6 @@ const useStyles = function () {
20
19
  height: dotSize,
21
20
  position: 'absolute',
22
21
  width: dotSize
23
- },
24
- top: {
25
- top: offset
26
- },
27
- bottom: {
28
- bottom: offset
29
- },
30
- left: {
31
- left: offset
32
- },
33
- right: {
34
- right: offset
35
22
  }
36
23
  };
37
24
  };
@@ -42,11 +29,15 @@ export default function Badge(props) {
42
29
  invisible = false,
43
30
  position = defaultPosition,
44
31
  style,
32
+ offset = 0,
45
33
  ...otherProps
46
34
  } = props;
47
35
  const styles = useStyles();
48
36
  const rootStyle = css([styles.root, style]);
49
- const badgeStyle = css([styles.badge, styles[position.vertical], styles[position.horizontal]]);
37
+ const badgeStyle = css([styles.badge, {
38
+ [position.vertical]: offset,
39
+ [position.horizontal]: offset
40
+ }]);
50
41
  return /*#__PURE__*/React.createElement(View, _extends({
51
42
  style: rootStyle
52
43
  }, otherProps), children, !invisible ? /*#__PURE__*/React.createElement(View, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","css","useTheme","defaultPosition","vertical","horizontal","useStyles","theme","dotSize","offset","root","badge","backgroundColor","palette","secondary","main","borderRadius","height","position","width","top","bottom","left","right","Badge","props","children","invisible","style","otherProps","styles","rootStyle","badgeStyle"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport BadgeProps, { BadgePosition } from './BadgeProps';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\ntype BadgeStyles = NamedStylesStringUnion<'root' | 'badge' | 'top' | 'bottom' | 'left' | 'right'>;\n\nconst useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {\n const theme = useTheme();\n\n const dotSize = 4;\n const offset = 0;\n\n return {\n root: {},\n badge: {\n backgroundColor: theme.palette.secondary.main,\n borderRadius: dotSize * 0.5,\n height: dotSize,\n position: 'absolute',\n width: dotSize,\n },\n top: {\n top: offset,\n },\n bottom: {\n bottom: offset,\n },\n left: {\n left: offset,\n },\n right: {\n right: offset,\n },\n };\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n invisible = false,\n position = defaultPosition,\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const badgeStyle = css([\n styles.badge,\n styles[position.vertical],\n styles[position.horizontal],\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? <View style={badgeStyle}/> : null}\n </View>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;AAGA,MAAMC,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFuB,CAAvC;;AAOA,MAAMC,SAAiC,GAAG,YAAyB;EAC/D,MAAMC,KAAK,GAAGL,QAAQ,EAAtB;EAEA,MAAMM,OAAO,GAAG,CAAhB;EACA,MAAMC,MAAM,GAAG,CAAf;EAEA,OAAO;IACHC,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;MACHC,eAAe,EAAEL,KAAK,CAACM,OAAN,CAAcC,SAAd,CAAwBC,IADtC;MAEHC,YAAY,EAAER,OAAO,GAAG,GAFrB;MAGHS,MAAM,EAAET,OAHL;MAIHU,QAAQ,EAAE,UAJP;MAKHC,KAAK,EAAEX;IALJ,CAFJ;IASHY,GAAG,EAAE;MACDA,GAAG,EAAEX;IADJ,CATF;IAYHY,MAAM,EAAE;MACJA,MAAM,EAAEZ;IADJ,CAZL;IAeHa,IAAI,EAAE;MACFA,IAAI,EAAEb;IADJ,CAfH;IAkBHc,KAAK,EAAE;MACHA,KAAK,EAAEd;IADJ;EAlBJ,CAAP;AAsBH,CA5BD;;AA8BA,eAAe,SAASe,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,QADE;IAEFC,SAAS,GAAG,KAFV;IAGFT,QAAQ,GAAGf,eAHT;IAIFyB,KAJE;IAKF,GAAGC;EALD,IAMFJ,KANJ;EAQA,MAAMK,MAAM,GAAGxB,SAAS,EAAxB;EAEA,MAAMyB,SAAS,GAAG9B,GAAG,CAAC,CAClB6B,MAAM,CAACpB,IADW,EAElBkB,KAFkB,CAAD,CAArB;EAKA,MAAMI,UAAU,GAAG/B,GAAG,CAAC,CACnB6B,MAAM,CAACnB,KADY,EAEnBmB,MAAM,CAACZ,QAAQ,CAACd,QAAV,CAFa,EAGnB0B,MAAM,CAACZ,QAAQ,CAACb,UAAV,CAHa,CAAD,CAAtB;EAMA,oBACI,oBAAC,IAAD;IACI,KAAK,EAAE0B;EADX,GAEQF,UAFR,GAIKH,QAJL,EAMK,CAACC,SAAD,gBAAa,oBAAC,IAAD;IAAM,KAAK,EAAEK;EAAb,EAAb,GAA0C,IAN/C,CADJ;AAUH;AAAA"}
1
+ {"version":3,"names":["React","View","css","useTheme","defaultPosition","vertical","horizontal","useStyles","theme","dotSize","root","badge","backgroundColor","palette","secondary","main","borderRadius","height","position","width","Badge","props","children","invisible","style","offset","otherProps","styles","rootStyle","badgeStyle"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport BadgeProps, { BadgePosition } from './BadgeProps';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\ntype BadgeStyles = NamedStylesStringUnion<'root' | 'badge'>;\n\nconst useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {\n const theme = useTheme();\n\n const dotSize = 4;\n\n return {\n root: {},\n badge: {\n backgroundColor: theme.palette.secondary.main,\n borderRadius: dotSize * 0.5,\n height: dotSize,\n position: 'absolute',\n width: dotSize,\n },\n };\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n invisible = false,\n position = defaultPosition,\n style,\n offset = 0,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const badgeStyle = css([\n styles.badge,\n {\n [position.vertical]: offset,\n [position.horizontal]: offset,\n },\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? <View style={badgeStyle}/> : null}\n </View>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;AAGA,MAAMC,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFuB,CAAvC;;AAOA,MAAMC,SAAiC,GAAG,YAAyB;EAC/D,MAAMC,KAAK,GAAGL,QAAQ,EAAtB;EAEA,MAAMM,OAAO,GAAG,CAAhB;EAEA,OAAO;IACHC,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;MACHC,eAAe,EAAEJ,KAAK,CAACK,OAAN,CAAcC,SAAd,CAAwBC,IADtC;MAEHC,YAAY,EAAEP,OAAO,GAAG,GAFrB;MAGHQ,MAAM,EAAER,OAHL;MAIHS,QAAQ,EAAE,UAJP;MAKHC,KAAK,EAAEV;IALJ;EAFJ,CAAP;AAUH,CAfD;;AAiBA,eAAe,SAASW,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,QADE;IAEFC,SAAS,GAAG,KAFV;IAGFL,QAAQ,GAAGd,eAHT;IAIFoB,KAJE;IAKFC,MAAM,GAAG,CALP;IAMF,GAAGC;EAND,IAOFL,KAPJ;EASA,MAAMM,MAAM,GAAGpB,SAAS,EAAxB;EAEA,MAAMqB,SAAS,GAAG1B,GAAG,CAAC,CAClByB,MAAM,CAACjB,IADW,EAElBc,KAFkB,CAAD,CAArB;EAKA,MAAMK,UAAU,GAAG3B,GAAG,CAAC,CACnByB,MAAM,CAAChB,KADY,EAEnB;IACI,CAACO,QAAQ,CAACb,QAAV,GAAqBoB,MADzB;IAEI,CAACP,QAAQ,CAACZ,UAAV,GAAuBmB;EAF3B,CAFmB,CAAD,CAAtB;EAQA,oBACI,oBAAC,IAAD;IACI,KAAK,EAAEG;EADX,GAEQF,UAFR,GAIKJ,QAJL,EAMK,CAACC,SAAD,gBAAa,oBAAC,IAAD;IAAM,KAAK,EAAEM;EAAb,EAAb,GAA0C,IAN/C,CADJ;AAUH;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n\n /**\n * The offset of the badge.\n * @default 0\n */\n offset?: number;\n}> {}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["CheckboxProps.ts"],"sourcesContent":["import React from 'react';\nimport type { CommonComponentColor, OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\ntype BaseProps = Omit<ButtonBaseProps, 'onPress'>;\n\nexport type CheckboxColor = CommonComponentColor;\n\nexport default interface CheckboxProps extends OverridableComponentProps<BaseProps, {\n /**\n * If `true`, the component is checked.\n * @default false\n */\n checked?: boolean;\n\n /**\n * The checked Icon which is replaced.\n */\n checkedIcon?: React.ReactElement;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: CheckboxColor;\n\n /**\n * If `true`, the checkbox is disabled.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * The unchecked Icon which is replaced.\n */\n icon?: React.ReactElement;\n\n /**\n * Callback fired when the state is changed.\n */\n onChange?: (newChecked: boolean) => void;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["CheckboxProps.ts"],"sourcesContent":["import React from 'react';\nimport type { CommonComponentColor, OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\ntype BaseProps = Omit<ButtonBaseProps, 'onPress' | 'children'>;\n\nexport type CheckboxColor = CommonComponentColor;\n\nexport default interface CheckboxProps extends OverridableComponentProps<BaseProps, {\n /**\n * If `true`, the component is checked.\n * @default false\n */\n checked?: boolean;\n\n /**\n * The checked Icon which is replaced.\n */\n checkedIcon?: React.ReactElement;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: CheckboxColor;\n\n /**\n * If `true`, the checkbox is disabled.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * The unchecked Icon which is replaced.\n */\n icon?: React.ReactElement;\n\n /**\n * Callback fired when the state is changed.\n */\n onChange?: (newChecked: boolean) => void;\n}> {}\n"],"mappings":""}
@@ -56,6 +56,7 @@ export default function Slide(props) {
56
56
  }
57
57
  }, [appear, onEnter, onEntered, onExit, onExited]);
58
58
  return /*#__PURE__*/React.createElement(Animated.View, _extends({
59
+ pointerEvents: 'box-none',
59
60
  style: [animatedStyle, style]
60
61
  }, otherProps));
61
62
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","Dimensions","Animated","Easing","runOnJS","useAnimatedStyle","useSharedValue","withTiming","defaultEnterDuration","defaultExitDuration","getDisappearingOffsetY","get","height","Slide","props","animatedY","animatedYProp","appear","enterDuration","exitDuration","onEnter","onEntered","onExit","onExited","style","otherProps","y","animatedStyle","transform","translateY","value","toValue","enterConfig","duration","easing","out","exp","isFinished","exitConfig","in","ease"],"sources":["Slide.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type SlideProps from './SlideProps';\n\nconst defaultEnterDuration = 300;\nconst defaultExitDuration = 300;\n\nconst getDisappearingOffsetY = (): number => Dimensions.get('window').height;\n\nexport default function Slide(props: SlideProps) {\n const {\n animatedY: animatedYProp,\n appear,\n enterDuration = defaultEnterDuration,\n exitDuration = defaultExitDuration,\n onEnter,\n onEntered,\n onExit,\n onExited,\n style,\n ...otherProps\n } = props;\n\n const y = useSharedValue(getDisappearingOffsetY());\n const animatedY = animatedYProp || y;\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: animatedY.value }],\n }), []);\n\n useEffect(() => {\n if (appear) {\n onEnter?.();\n\n const toValue = 0;\n const enterConfig: Readonly<WithTimingConfig> = {\n duration: enterDuration,\n easing: Easing.out(Easing.exp),\n };\n\n animatedY.value = withTiming(toValue, enterConfig, isFinished => {\n if (isFinished && onEntered) {\n runOnJS(onEntered)();\n }\n });\n } else {\n onExit?.();\n\n const toValue = getDisappearingOffsetY();\n const exitConfig: Readonly<WithTimingConfig> = {\n duration: exitDuration,\n easing: Easing.in(Easing.ease),\n };\n\n animatedY.value = withTiming(toValue, exitConfig, isFinished => {\n if (isFinished && onExited) {\n runOnJS(onExited)();\n }\n });\n }\n }, [appear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,CAAhD;MAKArB,SAAS,CAACe,KAAV,GAAkBvB,UAAU,CAACwB,OAAD,EAAUC,WAAV,EAAuBK,UAAU,IAAI;QAC7D,IAAIA,UAAU,IAAIhB,SAAlB,EAA6B;UACzBjB,OAAO,CAACiB,SAAD,CAAP;QACH;MACJ,CAJ2B,CAA5B;IAKH,CAdD,MAcO;MACHC,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM;MAEN,MAAMS,OAAO,GAAGrB,sBAAsB,EAAtC;MACA,MAAM4B,UAAsC,GAAG;QAC3CL,QAAQ,EAAEd,YADiC;QAE3Ce,MAAM,EAAE/B,MAAM,CAACoC,EAAP,CAAUpC,MAAM,CAACqC,IAAjB;MAFmC,CAA/C;MAKAzB,SAAS,CAACe,KAAV,GAAkBvB,UAAU,CAACwB,OAAD,EAAUO,UAAV,EAAsBD,UAAU,IAAI;QAC5D,IAAIA,UAAU,IAAId,QAAlB,EAA4B;UACxBnB,OAAO,CAACmB,QAAD,CAAP;QACH;MACJ,CAJ2B,CAA5B;IAKH;EACJ,CA9BQ,EA8BN,CAACN,MAAD,EAASG,OAAT,EAAkBC,SAAlB,EAA6BC,MAA7B,EAAqCC,QAArC,CA9BM,CAAT;EAgCA,oBACI,oBAAC,QAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHI,aADG,EAEHH,KAFG;EADX,GAKQC,UALR,EADJ;AASH;AAAA"}
1
+ {"version":3,"names":["React","useEffect","Dimensions","Animated","Easing","runOnJS","useAnimatedStyle","useSharedValue","withTiming","defaultEnterDuration","defaultExitDuration","getDisappearingOffsetY","get","height","Slide","props","animatedY","animatedYProp","appear","enterDuration","exitDuration","onEnter","onEntered","onExit","onExited","style","otherProps","y","animatedStyle","transform","translateY","value","toValue","enterConfig","duration","easing","out","exp","isFinished","exitConfig","in","ease"],"sources":["Slide.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type SlideProps from './SlideProps';\n\nconst defaultEnterDuration = 300;\nconst defaultExitDuration = 300;\n\nconst getDisappearingOffsetY = (): number => Dimensions.get('window').height;\n\nexport default function Slide(props: SlideProps) {\n const {\n animatedY: animatedYProp,\n appear,\n enterDuration = defaultEnterDuration,\n exitDuration = defaultExitDuration,\n onEnter,\n onEntered,\n onExit,\n onExited,\n style,\n ...otherProps\n } = props;\n\n const y = useSharedValue(getDisappearingOffsetY());\n const animatedY = animatedYProp || y;\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: animatedY.value }],\n }), []);\n\n useEffect(() => {\n if (appear) {\n onEnter?.();\n\n const toValue = 0;\n const enterConfig: Readonly<WithTimingConfig> = {\n duration: enterDuration,\n easing: Easing.out(Easing.exp),\n };\n\n animatedY.value = withTiming(toValue, enterConfig, isFinished => {\n if (isFinished && onEntered) {\n runOnJS(onEntered)();\n }\n });\n } else {\n onExit?.();\n\n const toValue = getDisappearingOffsetY();\n const exitConfig: Readonly<WithTimingConfig> = {\n duration: exitDuration,\n easing: Easing.in(Easing.ease),\n };\n\n animatedY.value = withTiming(toValue, exitConfig, isFinished => {\n if (isFinished && onExited) {\n runOnJS(onExited)();\n }\n });\n }\n }, [appear, onEnter, onEntered, onExit, onExited]);\n\n return (\n <Animated.View\n pointerEvents={'box-none'}\n style={[\n animatedStyle,\n style,\n ]}\n {...otherProps}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,UAAT,QAA2B,cAA3B;AAEA,OAAOC,QAAP,IAAmBC,MAAnB,EAA2BC,OAA3B,EAAoCC,gBAApC,EAAsDC,cAAtD,EAAsEC,UAAtE,QAAwF,yBAAxF;AAGA,MAAMC,oBAAoB,GAAG,GAA7B;AACA,MAAMC,mBAAmB,GAAG,GAA5B;;AAEA,MAAMC,sBAAsB,GAAG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AM,CAACoC,EAAP,CAAUpC,MAAM,CAACqC,IAAjB;MAFmC,CAA/C;MAKAzB,SAAS,CAACe,KAAV,GAAkBvB,UAAU,CAACwB,OAAD,EAAUO,UAAV,EAAsBD,UAAU,IAAI;QAC5D,IAAIA,UAAU,IAAId,QAAlB,EAA4B;UACxBnB,OAAO,CAACmB,QAAD,CAAP;QACH;MACJ,CAJ2B,CAA5B;IAKH;EACJ,CA9BQ,EA8BN,CAACN,MAAD,EAASG,OAAT,EAAkBC,SAAlB,EAA6BC,MAA7B,EAAqCC,QAArC,CA9BM,CAAT;EAgCA,oBACI,oBAAC,QAAD,CAAU,IAAV;IACI,aAAa,EAAE,UADnB;IAEI,KAAK,EAAE,CACHI,aADG,EAEHH,KAFG;EAFX,GAMQC,UANR,EADJ;AAUH;AAAA"}
@@ -18,11 +18,13 @@ const ANIMATION_CONFIG = {
18
18
  };
19
19
  export default function Tooltip(props) {
20
20
  const {
21
+ arrowLayout,
21
22
  children,
22
23
  left,
23
24
  onClose,
24
25
  placement = 'top',
25
26
  right,
27
+ numberOfTitleLines = 1,
26
28
  style,
27
29
  title,
28
30
  tooltipStyle,
@@ -40,7 +42,7 @@ export default function Tooltip(props) {
40
42
  const [r, g, b] = rgb(theme.palette.primary.main);
41
43
  const totalVerticalOffset = -(layout.height + verticalOffset);
42
44
  const tooltipLayoutStyle = {
43
- alignItems: 'center',
45
+ alignItems: (arrowLayout === null || arrowLayout === void 0 ? void 0 : arrowLayout.placement) === 'left' ? 'flex-start' : (arrowLayout === null || arrowLayout === void 0 ? void 0 : arrowLayout.placement) === 'right' ? 'flex-end' : 'center',
44
46
  bottom: placement === 'bottom' ? totalVerticalOffset : undefined,
45
47
  left,
46
48
  position: 'absolute',
@@ -68,6 +70,10 @@ export default function Tooltip(props) {
68
70
  const textStyle = css([fontStyle, {
69
71
  marginRight: theme.spacing(2)
70
72
  }]);
73
+ const arrowStyle = css({ ...(arrowLayout && {
74
+ [arrowLayout.placement]: arrowLayout.offset
75
+ })
76
+ });
71
77
  const buttonElem = /*#__PURE__*/React.createElement(ButtonBase, {
72
78
  pressEffect: 'none',
73
79
  onPress: onClose
@@ -76,18 +82,20 @@ export default function Tooltip(props) {
76
82
  }, /*#__PURE__*/React.createElement(Text, {
77
83
  children: title // TODO: Should we provide text prop customization?
78
84
  ,
79
- numberOfLines: 1,
85
+ numberOfLines: numberOfTitleLines,
80
86
  style: textStyle
81
87
  }), /*#__PURE__*/React.createElement(CloseIcon, {
82
88
  fill: theme.palette.primary.contrastTextColor,
83
89
  width: 20,
84
90
  height: 20
85
91
  })));
86
- const arrowElem = /*#__PURE__*/React.createElement(UpArrow, {
92
+ const arrowElem = /*#__PURE__*/React.createElement(View, {
93
+ style: arrowStyle
94
+ }, /*#__PURE__*/React.createElement(UpArrow, {
87
95
  upsideDown: placement === 'top',
88
96
  fill: theme.palette.primary.main,
89
97
  opacity: DEFAULT_OPACITY
90
- });
98
+ }));
91
99
  return /*#__PURE__*/React.createElement(View, {
92
100
  style: style
93
101
  }, children, /*#__PURE__*/React.createElement(Animated.View, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","Text","View","Animated","useAnimatedStyle","useSharedValue","withTiming","rgb","ButtonBase","createFontStyle","css","useTheme","Close","CloseIcon","UpArrow","DEFAULT_OPACITY","initialLayout","width","height","x","y","ANIMATION_CONFIG","duration","Tooltip","props","children","left","onClose","placement","right","style","title","tooltipStyle","verticalOffset","visible","theme","layout","setLayout","scale","animatedStyle","transform","value","r","g","b","palette","primary","main","totalVerticalOffset","tooltipLayoutStyle","alignItems","bottom","undefined","position","top","zIndex","tooltip","overflow","nextScaleValue","touchableStyle","backgroundColor","borderRadius","shape","roundness","flexDirection","padding","spacing","fontStyle","selector","typo","caption2","color","contrastTextColor","textStyle","marginRight","buttonElem","arrowElem","event","nativeEvent"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Text, View, ViewProps } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { rgb } from '@fountain-ui/utils';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { Close as CloseIcon } from '../internal/icons';\nimport type TooltipProps from './TooltipProps';\nimport UpArrow from './UpArrow';\n\nconst DEFAULT_OPACITY = 0.8;\nconst initialLayout = { width: 0, height: 0, x: 0, y: 0 };\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 150 };\n\nexport default function Tooltip(props: TooltipProps) {\n const {\n children,\n left,\n onClose,\n placement = 'top',\n right,\n style,\n title,\n tooltipStyle,\n verticalOffset = 4,\n visible = false,\n } = props;\n\n const theme = useTheme();\n\n const [layout, setLayout] = useState(initialLayout);\n\n const scale = useSharedValue(0);\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scale.value }],\n }), []);\n\n const [r, g, b] = rgb(theme.palette.primary.main);\n\n const totalVerticalOffset = -(layout.height + verticalOffset);\n const tooltipLayoutStyle: ViewProps['style'] = {\n alignItems: 'center',\n bottom: placement === 'bottom' ? totalVerticalOffset : undefined,\n left,\n position: 'absolute',\n right,\n top: placement === 'top' ? totalVerticalOffset : undefined,\n zIndex: theme.zIndex.tooltip,\n height: visible ? undefined : 0,\n overflow: visible ? undefined : 'hidden',\n };\n\n useEffect(() => {\n const nextScaleValue = visible ? 1 : 0;\n\n scale.value = withTiming(nextScaleValue, ANIMATION_CONFIG);\n }, [visible]);\n\n const touchableStyle: ViewProps['style'] = {\n alignItems: 'center',\n backgroundColor: `rgba(${r}, ${g}, ${b}, ${DEFAULT_OPACITY})`,\n borderRadius: theme.shape.roundness,\n flexDirection: 'row',\n padding: theme.spacing(2),\n };\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: theme.palette.primary.contrastTextColor,\n });\n\n const textStyle = css([\n fontStyle,\n { marginRight: theme.spacing(2) },\n ]);\n\n const buttonElem = (\n <ButtonBase\n pressEffect={'none'}\n onPress={onClose}\n >\n <View style={css(touchableStyle)}>\n <Text\n children={title}\n // TODO: Should we provide text prop customization?\n numberOfLines={1}\n style={textStyle}\n />\n <CloseIcon\n fill={theme.palette.primary.contrastTextColor}\n width={20}\n height={20}\n />\n </View>\n </ButtonBase>\n );\n\n const arrowElem = (\n <UpArrow\n upsideDown={placement === 'top'}\n fill={theme.palette.primary.main}\n opacity={DEFAULT_OPACITY}\n />\n );\n\n return (\n <View style={style}>\n {children}\n\n <Animated.View\n onLayout={(event) => setLayout(event.nativeEvent.layout)}\n style={[\n animatedStyle,\n tooltipLayoutStyle,\n tooltipStyle,\n ]}\n >\n {placement === 'top' ? (\n <React.Fragment>\n {buttonElem}\n {arrowElem}\n </React.Fragment>\n ) : (\n <React.Fragment>\n {arrowElem}\n {buttonElem}\n </React.Fragment>\n )}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,IAAT,EAAeC,IAAf,QAAsC,cAAtC;AAEA,OAAOC,QAAP,IAAmBC,gBAAnB,EAAqCC,cAArC,EAAqDC,UAArD,QAAuE,yBAAvE;AACA,SAASC,GAAT,QAAoB,oBAApB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,mBAAnC;AAEA,OAAOC,OAAP,MAAoB,WAApB;AAEA,MAAMC,eAAe,GAAG,GAAxB;AACA,MAAMC,aAAa,GAAG;EAAEC,KAAK,EAAE,CAAT;EAAYC,MAAM,EAAE,CAApB;EAAuBC,CAAC,EAAE,CAA1B;EAA6BC,CAAC,EAAE;AAAhC,CAAtB;AAEA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;AAEA,eAAe,SAASC,OAAT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gBACX,oBAAC,OAAD;IACI,UAAU,EAAEhD,SAAS,KAAK,KAD9B;IAEI,IAAI,EAAEO,KAAK,CAACU,OAAN,CAAcC,OAAd,CAAsBC,IAFhC;IAGI,OAAO,EAAEhC;EAHb,EADJ;EAQA,oBACI,oBAAC,IAAD;IAAM,KAAK,EAAEe;EAAb,GACKL,QADL,eAGI,oBAAC,QAAD,CAAU,IAAV;IACI,QAAQ,EAAGoD,KAAD,IAAWxC,SAAS,CAACwC,KAAK,CAACC,WAAN,CAAkB1C,MAAnB,CADlC;IAEI,KAAK,EAAE,CACHG,aADG,EAEHU,kBAFG,EAGHjB,YAHG;EAFX,GAQKJ,SAAS,KAAK,KAAd,gBACG,oBAAC,KAAD,CAAO,QAAP,QACK+C,UADL,EAEKC,SAFL,CADH,gBAMG,oBAAC,KAAD,CAAO,QAAP,QACKA,SADL,EAEKD,UAFL,CAdR,CAHJ,CADJ;AA0BH;AAAA"}
1
+ {"version":3,"names":["React","useEffect","useState","Text","View","Animated","useAnimatedStyle","useSharedValue","withTiming","rgb","ButtonBase","createFontStyle","css","useTheme","Close","CloseIcon","UpArrow","DEFAULT_OPACITY","initialLayout","width","height","x","y","ANIMATION_CONFIG","duration","Tooltip","props","arrowLayout","children","left","onClose","placement","right","numberOfTitleLines","style","title","tooltipStyle","verticalOffset","visible","theme","layout","setLayout","scale","animatedStyle","transform","value","r","g","b","palette","primary","main","totalVerticalOffset","tooltipLayoutStyle","alignItems","bottom","undefined","position","top","zIndex","tooltip","overflow","nextScaleValue","touchableStyle","backgroundColor","borderRadius","shape","roundness","flexDirection","padding","spacing","fontStyle","selector","typo","caption2","color","contrastTextColor","textStyle","marginRight","arrowStyle","offset","buttonElem","arrowElem","event","nativeEvent"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Text, View, ViewProps } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { rgb } from '@fountain-ui/utils';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { Close as CloseIcon } from '../internal/icons';\nimport type TooltipProps from './TooltipProps';\nimport UpArrow from './UpArrow';\n\nconst DEFAULT_OPACITY = 0.8;\nconst initialLayout = { width: 0, height: 0, x: 0, y: 0 };\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 150 };\n\nexport default function Tooltip(props: TooltipProps) {\n const {\n arrowLayout,\n children,\n left,\n onClose,\n placement = 'top',\n right,\n numberOfTitleLines = 1,\n style,\n title,\n tooltipStyle,\n verticalOffset = 4,\n visible = false,\n } = props;\n\n const theme = useTheme();\n\n const [layout, setLayout] = useState(initialLayout);\n\n const scale = useSharedValue(0);\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scale.value }],\n }), []);\n\n const [r, g, b] = rgb(theme.palette.primary.main);\n\n const totalVerticalOffset = -(layout.height + verticalOffset);\n const tooltipLayoutStyle: ViewProps['style'] = {\n alignItems: arrowLayout?.placement === 'left'\n ? 'flex-start'\n : arrowLayout?.placement === 'right'\n ? 'flex-end'\n : 'center',\n bottom: placement === 'bottom' ? totalVerticalOffset : undefined,\n left,\n position: 'absolute',\n right,\n top: placement === 'top' ? totalVerticalOffset : undefined,\n zIndex: theme.zIndex.tooltip,\n height: visible ? undefined : 0,\n overflow: visible ? undefined : 'hidden',\n };\n\n useEffect(() => {\n const nextScaleValue = visible ? 1 : 0;\n\n scale.value = withTiming(nextScaleValue, ANIMATION_CONFIG);\n }, [visible]);\n\n const touchableStyle: ViewProps['style'] = {\n alignItems: 'center',\n backgroundColor: `rgba(${r}, ${g}, ${b}, ${DEFAULT_OPACITY})`,\n borderRadius: theme.shape.roundness,\n flexDirection: 'row',\n padding: theme.spacing(2),\n };\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: theme.palette.primary.contrastTextColor,\n });\n\n const textStyle = css([\n fontStyle,\n { marginRight: theme.spacing(2) },\n ]);\n\n const arrowStyle = css({\n ...(arrowLayout && {\n [arrowLayout.placement]: arrowLayout.offset,\n }),\n });\n\n const buttonElem = (\n <ButtonBase\n pressEffect={'none'}\n onPress={onClose}\n >\n <View style={css(touchableStyle)}>\n <Text\n children={title}\n // TODO: Should we provide text prop customization?\n numberOfLines={numberOfTitleLines}\n style={textStyle}\n />\n <CloseIcon\n fill={theme.palette.primary.contrastTextColor}\n width={20}\n height={20}\n />\n </View>\n </ButtonBase>\n );\n\n const arrowElem = (\n <View style={arrowStyle}>\n <UpArrow\n upsideDown={placement === 'top'}\n fill={theme.palette.primary.main}\n opacity={DEFAULT_OPACITY}\n />\n </View>\n );\n\n return (\n <View style={style}>\n {children}\n\n <Animated.View\n onLayout={(event) => setLayout(event.nativeEvent.layout)}\n style={[\n animatedStyle,\n tooltipLayoutStyle,\n tooltipStyle,\n ]}\n >\n {placement === 'top' ? (\n <React.Fragment>\n {buttonElem}\n {arrowElem}\n </React.Fragment>\n ) : (\n <React.Fragment>\n {arrowElem}\n {buttonElem}\n </React.Fragment>\n )}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,IAAT,EAAeC,IAAf,QAAsC,cAAtC;AAEA,OAAOC,QAAP,IAAmBC,gBAAnB,EAAqCC,cAArC,EAAqDC,UAArD,QAAuE,yBAAvE;AACA,SAASC,GAAT,QAAoB,oBAApB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,mBAAnC;AAEA,OAAOC,OAAP,MAAoB,WAApB;AAEA,MAAMC,eAAe,GAAG,GAAxB;AACA,MAAMC,aAAa,GAAG;EAAEC,KAAK,EAAE,CAAT;EAAYC,MAAM,EAAE,CAApB;EAAuBC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'react';\nimport type { ViewProps, ViewStyle } from 'react-native';\nimport type { ComponentProps } from '../types';\nimport type { ButtonProps } from '../Button';\n\nexport type TooltipPlacement = 'top' | 'bottom';\n\nexport default interface TooltipProps extends ComponentProps<{\n /**\n * Tooltip reference element.\n */\n children: React.ReactNode;\n\n /**\n * Left position relative to reference element.\n */\n left?: number;\n\n /**\n * Callback fired when the component requests to be closed.\n */\n onClose?: () => void;\n\n /**\n * Tooltip placement.\n * @default 'top'\n */\n placement?: TooltipPlacement;\n\n /**\n * Right position relative to reference element.\n */\n right?: number;\n\n /**\n * Tooltip title.\n */\n title: ButtonProps['children'];\n\n /**\n * Additional style for tooltip wrapper.\n */\n tooltipStyle?: ViewProps['style'];\n\n /**\n * The additional amount to vertically shift.\n * @default 4\n */\n verticalOffset?: number;\n\n /**\n * If `true`, the tooltip is shown.\n * @default false\n */\n visible?: boolean;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TooltipProps.ts"],"sourcesContent":["import React from 'react';\nimport type { TextProps, ViewProps } from 'react-native';\nimport type { ComponentProps } from '../types';\nimport type { ButtonProps } from '../Button';\n\nexport type TooltipPlacement = 'top' | 'bottom';\n\nexport type TooltipArrowPlacement = 'left' | 'right';\n\nexport default interface TooltipProps extends ComponentProps<{\n /**\n * Tooltip reference element.\n */\n children: React.ReactNode;\n\n /**\n * Left position relative to reference element.\n */\n left?: number;\n\n /**\n * Callback fired when the component requests to be closed.\n */\n onClose?: () => void;\n\n /**\n * Tooltip placement.\n * @default 'top'\n */\n placement?: TooltipPlacement;\n\n /**\n * Right position relative to reference element.\n */\n right?: number;\n\n /**\n * Tooltip title.\n */\n title: ButtonProps['children'];\n\n /**\n * Additional style for tooltip wrapper.\n */\n tooltipStyle?: ViewProps['style'];\n\n /**\n * The additional amount to vertically shift.\n * @default 4\n */\n verticalOffset?: number;\n\n /**\n * If `true`, the tooltip is shown.\n * @default false\n */\n visible?: boolean;\n\n /**\n * Tooltip arrow layout.\n * If 'undefined', the arrow will be centered on tooltip.\n */\n arrowLayout?: {\n placement: TooltipArrowPlacement;\n offset: number;\n }\n\n /**\n * number of tooltip's title lines\n * @default 1\n */\n numberOfTitleLines?: TextProps['numberOfLines'];\n}> {}\n"],"mappings":""}
@@ -25,5 +25,10 @@ export default interface BadgeProps extends OverridableComponentProps<ViewProps,
25
25
  * }
26
26
  */
27
27
  position?: BadgePosition;
28
+ /**
29
+ * The offset of the badge.
30
+ * @default 0
31
+ */
32
+ offset?: number;
28
33
  }> {
29
34
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { CommonComponentColor, OverridableComponentProps } from '../types';
3
3
  import type { ButtonBaseProps } from '../ButtonBase';
4
- declare type BaseProps = Omit<ButtonBaseProps, 'onPress'>;
4
+ declare type BaseProps = Omit<ButtonBaseProps, 'onPress' | 'children'>;
5
5
  export declare type CheckboxColor = CommonComponentColor;
6
6
  export default interface CheckboxProps extends OverridableComponentProps<BaseProps, {
7
7
  /**
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import type { ViewProps } from 'react-native';
2
+ import type { TextProps, ViewProps } from 'react-native';
3
3
  import type { ComponentProps } from '../types';
4
4
  import type { ButtonProps } from '../Button';
5
5
  export declare type TooltipPlacement = 'top' | 'bottom';
6
+ export declare type TooltipArrowPlacement = 'left' | 'right';
6
7
  export default interface TooltipProps extends ComponentProps<{
7
8
  /**
8
9
  * Tooltip reference element.
@@ -43,5 +44,18 @@ export default interface TooltipProps extends ComponentProps<{
43
44
  * @default false
44
45
  */
45
46
  visible?: boolean;
47
+ /**
48
+ * Tooltip arrow layout.
49
+ * If 'undefined', the arrow will be centered on tooltip.
50
+ */
51
+ arrowLayout?: {
52
+ placement: TooltipArrowPlacement;
53
+ offset: number;
54
+ };
55
+ /**
56
+ * number of tooltip's title lines
57
+ * @default 1
58
+ */
59
+ numberOfTitleLines?: TextProps['numberOfLines'];
46
60
  }> {
47
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fountain-ui/core",
3
- "version": "2.0.0-beta.30",
3
+ "version": "2.0.0-beta.32",
4
4
  "author": "Fountain-UI Team",
5
5
  "description": "React components that implement Tappytoon's Fountain Design.",
6
6
  "license": "MIT",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "fae21ec577db95700d6c21442f2249dc824eb3de"
70
+ "gitHead": "b95359524cf4e246be3dce3580f3d587502429e6"
71
71
  }
@@ -9,13 +9,12 @@ const defaultPosition: BadgePosition = {
9
9
  horizontal: 'right',
10
10
  };
11
11
 
12
- type BadgeStyles = NamedStylesStringUnion<'root' | 'badge' | 'top' | 'bottom' | 'left' | 'right'>;
12
+ type BadgeStyles = NamedStylesStringUnion<'root' | 'badge'>;
13
13
 
14
14
  const useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {
15
15
  const theme = useTheme();
16
16
 
17
17
  const dotSize = 4;
18
- const offset = 0;
19
18
 
20
19
  return {
21
20
  root: {},
@@ -26,18 +25,6 @@ const useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {
26
25
  position: 'absolute',
27
26
  width: dotSize,
28
27
  },
29
- top: {
30
- top: offset,
31
- },
32
- bottom: {
33
- bottom: offset,
34
- },
35
- left: {
36
- left: offset,
37
- },
38
- right: {
39
- right: offset,
40
- },
41
28
  };
42
29
  };
43
30
 
@@ -47,6 +34,7 @@ export default function Badge(props: BadgeProps) {
47
34
  invisible = false,
48
35
  position = defaultPosition,
49
36
  style,
37
+ offset = 0,
50
38
  ...otherProps
51
39
  } = props;
52
40
 
@@ -59,8 +47,10 @@ export default function Badge(props: BadgeProps) {
59
47
 
60
48
  const badgeStyle = css([
61
49
  styles.badge,
62
- styles[position.vertical],
63
- styles[position.horizontal],
50
+ {
51
+ [position.vertical]: offset,
52
+ [position.horizontal]: offset,
53
+ },
64
54
  ]);
65
55
 
66
56
  return (
@@ -31,4 +31,10 @@ export default interface BadgeProps extends OverridableComponentProps<ViewProps,
31
31
  * }
32
32
  */
33
33
  position?: BadgePosition;
34
+
35
+ /**
36
+ * The offset of the badge.
37
+ * @default 0
38
+ */
39
+ offset?: number;
34
40
  }> {}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { CommonComponentColor, OverridableComponentProps } from '../types';
3
3
  import type { ButtonBaseProps } from '../ButtonBase';
4
4
 
5
- type BaseProps = Omit<ButtonBaseProps, 'onPress'>;
5
+ type BaseProps = Omit<ButtonBaseProps, 'onPress' | 'children'>;
6
6
 
7
7
  export type CheckboxColor = CommonComponentColor;
8
8
 
@@ -64,6 +64,7 @@ export default function Slide(props: SlideProps) {
64
64
 
65
65
  return (
66
66
  <Animated.View
67
+ pointerEvents={'box-none'}
67
68
  style={[
68
69
  animatedStyle,
69
70
  style,
@@ -16,11 +16,13 @@ const ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 150 };
16
16
 
17
17
  export default function Tooltip(props: TooltipProps) {
18
18
  const {
19
+ arrowLayout,
19
20
  children,
20
21
  left,
21
22
  onClose,
22
23
  placement = 'top',
23
24
  right,
25
+ numberOfTitleLines = 1,
24
26
  style,
25
27
  title,
26
28
  tooltipStyle,
@@ -42,7 +44,11 @@ export default function Tooltip(props: TooltipProps) {
42
44
 
43
45
  const totalVerticalOffset = -(layout.height + verticalOffset);
44
46
  const tooltipLayoutStyle: ViewProps['style'] = {
45
- alignItems: 'center',
47
+ alignItems: arrowLayout?.placement === 'left'
48
+ ? 'flex-start'
49
+ : arrowLayout?.placement === 'right'
50
+ ? 'flex-end'
51
+ : 'center',
46
52
  bottom: placement === 'bottom' ? totalVerticalOffset : undefined,
47
53
  left,
48
54
  position: 'absolute',
@@ -77,6 +83,12 @@ export default function Tooltip(props: TooltipProps) {
77
83
  { marginRight: theme.spacing(2) },
78
84
  ]);
79
85
 
86
+ const arrowStyle = css({
87
+ ...(arrowLayout && {
88
+ [arrowLayout.placement]: arrowLayout.offset,
89
+ }),
90
+ });
91
+
80
92
  const buttonElem = (
81
93
  <ButtonBase
82
94
  pressEffect={'none'}
@@ -86,7 +98,7 @@ export default function Tooltip(props: TooltipProps) {
86
98
  <Text
87
99
  children={title}
88
100
  // TODO: Should we provide text prop customization?
89
- numberOfLines={1}
101
+ numberOfLines={numberOfTitleLines}
90
102
  style={textStyle}
91
103
  />
92
104
  <CloseIcon
@@ -99,11 +111,13 @@ export default function Tooltip(props: TooltipProps) {
99
111
  );
100
112
 
101
113
  const arrowElem = (
102
- <UpArrow
103
- upsideDown={placement === 'top'}
104
- fill={theme.palette.primary.main}
105
- opacity={DEFAULT_OPACITY}
106
- />
114
+ <View style={arrowStyle}>
115
+ <UpArrow
116
+ upsideDown={placement === 'top'}
117
+ fill={theme.palette.primary.main}
118
+ opacity={DEFAULT_OPACITY}
119
+ />
120
+ </View>
107
121
  );
108
122
 
109
123
  return (
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
- import type { ViewProps, ViewStyle } from 'react-native';
2
+ import type { TextProps, ViewProps } from 'react-native';
3
3
  import type { ComponentProps } from '../types';
4
4
  import type { ButtonProps } from '../Button';
5
5
 
6
6
  export type TooltipPlacement = 'top' | 'bottom';
7
7
 
8
+ export type TooltipArrowPlacement = 'left' | 'right';
9
+
8
10
  export default interface TooltipProps extends ComponentProps<{
9
11
  /**
10
12
  * Tooltip reference element.
@@ -53,4 +55,19 @@ export default interface TooltipProps extends ComponentProps<{
53
55
  * @default false
54
56
  */
55
57
  visible?: boolean;
58
+
59
+ /**
60
+ * Tooltip arrow layout.
61
+ * If 'undefined', the arrow will be centered on tooltip.
62
+ */
63
+ arrowLayout?: {
64
+ placement: TooltipArrowPlacement;
65
+ offset: number;
66
+ }
67
+
68
+ /**
69
+ * number of tooltip's title lines
70
+ * @default 1
71
+ */
72
+ numberOfTitleLines?: TextProps['numberOfLines'];
56
73
  }> {}