@fountain-ui/lab 2.0.0-beta.51 → 2.0.0-beta.52
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.
- package/build/commonjs/BottomSheet/BottomSheetNative.js +6 -4
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +6 -3
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/DateTimePicker/DateTimePicker.js +10 -1
- package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +6 -4
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +6 -3
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/DateTimePicker/DateTimePicker.js +11 -2
- package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/typescript/BottomSheet/BottomSheetProps.d.ts +10 -0
- package/package.json +2 -2
- package/src/BottomSheet/BottomSheetNative.tsx +5 -3
- package/src/BottomSheet/BottomSheetProps.ts +12 -0
- package/src/BottomSheet/BottomSheetWeb.tsx +4 -1
- package/src/DateTimePicker/DateTimePicker.tsx +9 -1
|
@@ -30,7 +30,9 @@ function BottomSheet(props) {
|
|
|
30
30
|
index,
|
|
31
31
|
maxHeightNormalizedRatio = 0.9,
|
|
32
32
|
onChange,
|
|
33
|
-
snapPoints = []
|
|
33
|
+
snapPoints = [],
|
|
34
|
+
disableDefaultBackgroundColor = false,
|
|
35
|
+
disableDefaultShadow = false
|
|
34
36
|
} = props;
|
|
35
37
|
|
|
36
38
|
const indexRef = _react.default.useRef(-1);
|
|
@@ -79,14 +81,14 @@ function BottomSheet(props) {
|
|
|
79
81
|
const shadow = theme.shadow[12];
|
|
80
82
|
const modalStyle = {
|
|
81
83
|
backgroundColor: '#ffffff00',
|
|
82
|
-
..._reactNative.Platform.select({
|
|
84
|
+
...(disableDefaultShadow ? {} : _reactNative.Platform.select({
|
|
83
85
|
android: shadow === null || shadow === void 0 ? void 0 : shadow.elevation,
|
|
84
86
|
ios: shadow === null || shadow === void 0 ? void 0 : shadow.shadow,
|
|
85
87
|
web: shadow === null || shadow === void 0 ? void 0 : shadow.boxShadow
|
|
86
|
-
})
|
|
88
|
+
}))
|
|
87
89
|
};
|
|
88
90
|
const backgroundStyle = {
|
|
89
|
-
backgroundColor: theme.palette.paper.default
|
|
91
|
+
backgroundColor: disableDefaultBackgroundColor ? '#ffffff00' : theme.palette.paper.default
|
|
90
92
|
};
|
|
91
93
|
const contentWrapperStyle = {
|
|
92
94
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NoHandle","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","indexRef","React","useRef","bottomSheetRef","height","windowHeight","useWindowDimensions","maxDynamicContentSize","Math","round","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","useTheme","shadow","modalStyle","backgroundColor","Platform","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","contentWrapperStyle","flex","borderTopLeftRadius","borderTopRightRadius","overflow","isBackdropTransparent","OpacityAwareBackdrop","TransparentBackdrop","Boolean","undefined"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, useWindowDimensions, View } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const { height: windowHeight } = useWindowDimensions();\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n const contentWrapperStyle = {\n flex: 1,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n overflow: 'hidden',\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n enableDynamicSizing={enableDynamicSizing}\n maxDynamicContentSize={maxDynamicContentSize}\n >\n {/* @ts-ignore */}\n <View style={contentWrapperStyle}>\n <BottomSheetScrollView\n bounces={false}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </BottomSheetScrollView>\n </View>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAQA;;;;;;AAEA,MAAMA,QAAQ,GAAG,MAAM,IAAvB;;AAEe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eAAe,GAAG,GADhB;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;
|
|
1
|
+
{"version":3,"names":["NoHandle","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","disableDefaultBackgroundColor","disableDefaultShadow","indexRef","React","useRef","bottomSheetRef","height","windowHeight","useWindowDimensions","maxDynamicContentSize","Math","round","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","useTheme","shadow","modalStyle","backgroundColor","Platform","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","contentWrapperStyle","flex","borderTopLeftRadius","borderTopRightRadius","overflow","isBackdropTransparent","OpacityAwareBackdrop","TransparentBackdrop","Boolean","undefined"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, useWindowDimensions, View } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n disableDefaultBackgroundColor = false,\n disableDefaultShadow = false,\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const { height: windowHeight } = useWindowDimensions();\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...(disableDefaultShadow ? {} : Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n })),\n };\n const backgroundStyle = {\n backgroundColor: disableDefaultBackgroundColor ? '#ffffff00' : theme.palette.paper.default,\n };\n const contentWrapperStyle = {\n flex: 1,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n overflow: 'hidden',\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n enableDynamicSizing={enableDynamicSizing}\n maxDynamicContentSize={maxDynamicContentSize}\n >\n {/* @ts-ignore */}\n <View style={contentWrapperStyle}>\n <BottomSheetScrollView\n bounces={false}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </BottomSheetScrollView>\n </View>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAQA;;;;;;AAEA,MAAMA,QAAQ,GAAG,MAAM,IAAvB;;AAEe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eAAe,GAAG,GADhB;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG,EARX;IASFC,6BAA6B,GAAG,KAT9B;IAUFC,oBAAoB,GAAG;EAVrB,IAWFV,KAXJ;;EAaA,MAAMW,QAAQ,GAAGC,cAAA,CAAMC,MAAN,CAAqB,CAAC,CAAtB,CAAjB;;EACA,MAAMC,cAAc,GAAGF,cAAA,CAAMC,MAAN,CAAsC,IAAtC,CAAvB;;EAEA,MAAM;IAAEE,MAAM,EAAEC;EAAV,IAA2B,IAAAC,gCAAA,GAAjC;EACA,MAAMC,qBAAqB,GAAGC,IAAI,CAACC,KAAL,CAAWJ,YAAY,GAAGV,wBAA1B,CAA9B;;EAEA,MAAMe,YAAY,GAAGT,cAAA,CAAMU,WAAN,CAAmBC,QAAD,IAAsB;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,CADJ;AA+BH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Enable dynamic sizing for content size.\n * @default true\n */\n enableDynamicSizing?: boolean;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Maximum height(normalized value) of dialog\n * ex. 30% => 0.3 / 90% => 0.9\n * @default 0.9\n */\n maxHeightNormalizedRatio?: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n * @default []\n */\n snapPoints?: Array<number | string>;\n}> {}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Enable dynamic sizing for content size.\n * @default true\n */\n enableDynamicSizing?: boolean;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Maximum height(normalized value) of dialog\n * ex. 30% => 0.3 / 90% => 0.9\n * @default 0.9\n */\n maxHeightNormalizedRatio?: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n * @default []\n */\n snapPoints?: Array<number | string>;\n\n /**\n * Disable default backgroundColor.\n * @default false\n */\n disableDefaultBackgroundColor?: boolean;\n\n /**\n * Disable default shadow.\n * @default false\n */\n disableDefaultShadow?: boolean;\n}> {}\n"],"mappings":""}
|
|
@@ -47,7 +47,9 @@ function BottomSheet(props) {
|
|
|
47
47
|
index,
|
|
48
48
|
maxHeightNormalizedRatio = 0.9,
|
|
49
49
|
onChange,
|
|
50
|
-
snapPoints = []
|
|
50
|
+
snapPoints = [],
|
|
51
|
+
disableDefaultBackgroundColor = false,
|
|
52
|
+
disableDefaultShadow = false
|
|
51
53
|
} = props;
|
|
52
54
|
const styles = useStyles();
|
|
53
55
|
|
|
@@ -79,8 +81,9 @@ function BottomSheet(props) {
|
|
|
79
81
|
style: styles.animated,
|
|
80
82
|
translateY: translateY
|
|
81
83
|
}, /*#__PURE__*/_react.default.createElement(_core.Paper, {
|
|
82
|
-
elevation: 12,
|
|
83
|
-
style: paperStyles
|
|
84
|
+
elevation: disableDefaultShadow ? 0 : 12,
|
|
85
|
+
style: paperStyles,
|
|
86
|
+
colorValue: disableDefaultBackgroundColor ? '#ffffff00' : undefined
|
|
84
87
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
|
|
85
88
|
onContentSizeChange: handleContentSizeChange,
|
|
86
89
|
stickyHeaderIndices: header ? [0] : undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","styles","handleClose","convertedSnapPoints","handleContentSizeChange","highestSnapPoint","useDynamicSnapPoints","translateY","paperStyles","height","css","StyleSheet","absoluteFill","undefined"],"sources":["BottomSheetWeb.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollView } from 'react-native';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\nimport useDynamicSnapPoints from './useDynamicSnapPoints';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog,\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n } = useDynamicSnapPoints({\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n });\n\n const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);\n\n const paperStyles = [\n styles.paper,\n { height: highestSnapPoint },\n ];\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={12}\n style={paperStyles}\n >\n <ScrollView\n onContentSizeChange={handleContentSizeChange}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </ScrollView>\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;;;AAIA,MAAMA,SAAuC,GAAG,YAA+B;EAC3E,MAAMC,KAAK,GAAG,IAAAC,cAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,cAAc,EAAE,UADd;MAEFC,MAAM,EAAEJ,KAAK,CAACI,MAAN,CAAaC;IAFnB,CADH;IAKHC,QAAQ,EAAE;MACNC,SAAS,EAAE,QADL;MAENC,QAAQ,EAAE,GAFJ;MAGNC,KAAK,EAAE;IAHD,CALP;IAUHC,KAAK,EAAE;MACHC,sBAAsB,EAAE,CADrB;MAEHC,uBAAuB,EAAE,CAFtB;MAGHC,QAAQ,EAAE,CAHP;MAIHC,QAAQ,EAAE;IAJP;EAVJ,CAAP;AAiBH,CApBD;;AAsBe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eADE;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","disableDefaultBackgroundColor","disableDefaultShadow","styles","handleClose","convertedSnapPoints","handleContentSizeChange","highestSnapPoint","useDynamicSnapPoints","translateY","paperStyles","height","css","StyleSheet","absoluteFill","undefined"],"sources":["BottomSheetWeb.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollView } from 'react-native';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\nimport useDynamicSnapPoints from './useDynamicSnapPoints';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog,\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n disableDefaultBackgroundColor = false,\n disableDefaultShadow = false,\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n } = useDynamicSnapPoints({\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n });\n\n const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);\n\n const paperStyles = [\n styles.paper,\n { height: highestSnapPoint },\n ];\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={disableDefaultShadow ? 0 : 12}\n style={paperStyles}\n colorValue={disableDefaultBackgroundColor ? '#ffffff00' : undefined}\n >\n <ScrollView\n onContentSizeChange={handleContentSizeChange}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </ScrollView>\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"],"mapp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,CAFgB,CAApB;EAKA,oBACI,6BAAC,WAAD;IACI,eAAe,EAAEd,eADrB;IAEI,OAAO,EAAEW,WAFb;IAGI,OAAO,EAAEP,KAAK,IAAI,CAHtB;IAII,KAAK,EAAE,IAAAe,SAAA,EAAI,CAACC,gBAAA,CAAWC,YAAZ,EAA0BX,MAAM,CAACzB,IAAjC,CAAJ;EAJX,gBAMI,6BAAC,kBAAD;IACI,KAAK,EAAEyB,MAAM,CAACrB,QADlB;IAEI,UAAU,EAAE2B;EAFhB,gBAII,6BAAC,WAAD;IACI,SAAS,EAAEP,oBAAoB,GAAG,CAAH,GAAO,EAD1C;IAEI,KAAK,EAAEQ,WAFX;IAGI,UAAU,EAAET,6BAA6B,GAAG,WAAH,GAAiBc;EAH9D,gBAKI,6BAAC,uBAAD;IACI,mBAAmB,EAAET,uBADzB;IAEI,mBAAmB,EAAEV,MAAM,GAAG,CAAC,CAAD,CAAH,GAASmB;EAFxC,GAIKnB,MAJL,EAMKF,QANL,CALJ,CAJJ,CANJ,CADJ;AA4BH;;AAAA"}
|
|
@@ -39,6 +39,9 @@ function DateTimePicker(props) {
|
|
|
39
39
|
onYearPress: onYearPressProp
|
|
40
40
|
} = props;
|
|
41
41
|
const theme = (0, _styles.useTheme)();
|
|
42
|
+
const textDayFontStyle = (0, _core.createFontStyle)(theme, {
|
|
43
|
+
selector: typo => typo.body2
|
|
44
|
+
});
|
|
42
45
|
|
|
43
46
|
const [yearPickerVisible, setYearPickerVisible] = _react.default.useState(false);
|
|
44
47
|
|
|
@@ -103,7 +106,13 @@ function DateTimePicker(props) {
|
|
|
103
106
|
backgroundColor: theme.palette.paper.default,
|
|
104
107
|
calendarBackground: theme.palette.paper.default,
|
|
105
108
|
dayTextColor: theme.palette.text.primary,
|
|
106
|
-
textDisabledColor: theme.palette.text.hint
|
|
109
|
+
textDisabledColor: theme.palette.text.hint,
|
|
110
|
+
textDayFontFamily: textDayFontStyle.fontFamily,
|
|
111
|
+
textDayFontSize: textDayFontStyle.fontSize,
|
|
112
|
+
textDayFontWeight: textDayFontStyle.fontWeight,
|
|
113
|
+
textDayHeaderFontFamily: textDayFontStyle.fontFamily,
|
|
114
|
+
textDayHeaderFontSize: textDayFontStyle.fontSize,
|
|
115
|
+
textDayHeaderFontWeight: textDayFontStyle.fontWeight
|
|
107
116
|
}
|
|
108
117
|
});
|
|
109
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDateTimePicker","React","useContext","DateTimePickerContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","useTheme","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","LocaleConfig","defaultLocale","format","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","formatDate","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'textPrimary'}/>;\n const RightArrow = <Typography children={'>'} color={'textPrimary'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n }}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAPA;AASA,MAAMA,iBAAiB,GAAG,MAAM;EAC5B,OAAOC,cAAA,CAAMC,UAAN,CAAiBC,6CAAjB,CAAP;AACH,CAFD;;AAIe,SAASC,cAAT,CAAwBC,KAAxB,EAAoD;EAC/D,MAAM;IACFC,YAAY,GAAG,IAAIC,IAAJ,EADb;IAEFC,MAFE;IAGFC,UAAU,EAAEC,cAHV;IAIFC,OAJE;IAKFC,OALE;IAMFC,UANE;IAOFC,WAAW,EAAEC;EAPX,IAQFV,KARJ;EAUA,MAAMW,KAAK,GAAG,IAAAC,gBAAA,GAAd;;EAEA,MAAM,CAACC,iBAAD,EAAoBC,oBAApB,
|
|
1
|
+
{"version":3,"names":["useDateTimePicker","React","useContext","DateTimePickerContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","useTheme","textDayFontStyle","createFontStyle","selector","typo","body2","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","LocaleConfig","defaultLocale","format","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","formatDate","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint","textDayFontFamily","fontFamily","textDayFontSize","fontSize","textDayFontWeight","fontWeight","textDayHeaderFontFamily","textDayHeaderFontSize","textDayHeaderFontWeight"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, createFontStyle, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2 });\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'textPrimary'}/>;\n const RightArrow = <Typography children={'>'} color={'textPrimary'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n textDayFontFamily: textDayFontStyle.fontFamily,\n textDayFontSize: textDayFontStyle.fontSize,\n textDayFontWeight: textDayFontStyle.fontWeight,\n textDayHeaderFontFamily: textDayFontStyle.fontFamily,\n textDayHeaderFontSize: textDayFontStyle.fontSize,\n textDayHeaderFontWeight: textDayFontStyle.fontWeight,\n }}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAPA;AASA,MAAMA,iBAAiB,GAAG,MAAM;EAC5B,OAAOC,cAAA,CAAMC,UAAN,CAAiBC,6CAAjB,CAAP;AACH,CAFD;;AAIe,SAASC,cAAT,CAAwBC,KAAxB,EAAoD;EAC/D,MAAM;IACFC,YAAY,GAAG,IAAIC,IAAJ,EADb;IAEFC,MAFE;IAGFC,UAAU,EAAEC,cAHV;IAIFC,OAJE;IAKFC,OALE;IAMFC,UANE;IAOFC,WAAW,EAAEC;EAPX,IAQFV,KARJ;EAUA,MAAMW,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC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-
snapPoints = []
|
|
20
|
+
snapPoints = [],
|
|
21
|
+
disableDefaultBackgroundColor = false,
|
|
22
|
+
disableDefaultShadow = false
|
|
21
23
|
} = props;
|
|
22
24
|
const indexRef = React.useRef(-1);
|
|
23
25
|
const bottomSheetRef = React.useRef(null);
|
|
@@ -59,14 +61,14 @@ export default function BottomSheet(props) {
|
|
|
59
61
|
const shadow = theme.shadow[12];
|
|
60
62
|
const modalStyle = {
|
|
61
63
|
backgroundColor: '#ffffff00',
|
|
62
|
-
...Platform.select({
|
|
64
|
+
...(disableDefaultShadow ? {} : Platform.select({
|
|
63
65
|
android: shadow === null || shadow === void 0 ? void 0 : shadow.elevation,
|
|
64
66
|
ios: shadow === null || shadow === void 0 ? void 0 : shadow.shadow,
|
|
65
67
|
web: shadow === null || shadow === void 0 ? void 0 : shadow.boxShadow
|
|
66
|
-
})
|
|
68
|
+
}))
|
|
67
69
|
};
|
|
68
70
|
const backgroundStyle = {
|
|
69
|
-
backgroundColor: theme.palette.paper.default
|
|
71
|
+
backgroundColor: disableDefaultBackgroundColor ? '#ffffff00' : theme.palette.paper.default
|
|
70
72
|
};
|
|
71
73
|
const contentWrapperStyle = {
|
|
72
74
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","useWindowDimensions","View","useTheme","BottomSheetBackdrop","BottomSheetModal","BottomSheetModalProvider","BottomSheetScrollView","TransparentBackdrop","NoHandle","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","indexRef","useRef","bottomSheetRef","height","windowHeight","maxDynamicContentSize","Math","round","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","shadow","modalStyle","backgroundColor","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","contentWrapperStyle","flex","borderTopLeftRadius","borderTopRightRadius","overflow","isBackdropTransparent","OpacityAwareBackdrop","Boolean","undefined"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, useWindowDimensions, View } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const { height: windowHeight } = useWindowDimensions();\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n const contentWrapperStyle = {\n flex: 1,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n overflow: 'hidden',\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n enableDynamicSizing={enableDynamicSizing}\n maxDynamicContentSize={maxDynamicContentSize}\n >\n {/* @ts-ignore */}\n <View style={contentWrapperStyle}>\n <BottomSheetScrollView\n bounces={false}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </BottomSheetScrollView>\n </View>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAmBC,mBAAnB,EAAwCC,IAAxC,QAAoD,cAApD;AACA,SAASC,QAAT,QAAyB,qBAAzB;AACA,SACIC,mBADJ,EAGIC,gBAHJ,EAIIC,wBAJJ,EAKIC,qBALJ,QAMO,sBANP;AAQA,OAAOC,mBAAP,MAAgC,uBAAhC;;AAEA,MAAMC,QAAQ,GAAG,MAAM,IAAvB;;AAEA,eAAe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eAAe,GAAG,GADhB;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;
|
|
1
|
+
{"version":3,"names":["React","Platform","useWindowDimensions","View","useTheme","BottomSheetBackdrop","BottomSheetModal","BottomSheetModalProvider","BottomSheetScrollView","TransparentBackdrop","NoHandle","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","disableDefaultBackgroundColor","disableDefaultShadow","indexRef","useRef","bottomSheetRef","height","windowHeight","maxDynamicContentSize","Math","round","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","shadow","modalStyle","backgroundColor","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","contentWrapperStyle","flex","borderTopLeftRadius","borderTopRightRadius","overflow","isBackdropTransparent","OpacityAwareBackdrop","Boolean","undefined"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, useWindowDimensions, View } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n disableDefaultBackgroundColor = false,\n disableDefaultShadow = false,\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const { height: windowHeight } = useWindowDimensions();\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...(disableDefaultShadow ? {} : Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n })),\n };\n const backgroundStyle = {\n backgroundColor: disableDefaultBackgroundColor ? '#ffffff00' : theme.palette.paper.default,\n };\n const contentWrapperStyle = {\n flex: 1,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n overflow: 'hidden',\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n enableDynamicSizing={enableDynamicSizing}\n maxDynamicContentSize={maxDynamicContentSize}\n >\n {/* @ts-ignore */}\n <View style={contentWrapperStyle}>\n <BottomSheetScrollView\n bounces={false}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </BottomSheetScrollView>\n </View>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAmBC,mBAAnB,EAAwCC,IAAxC,QAAoD,cAApD;AACA,SAASC,QAAT,QAAyB,qBAAzB;AACA,SACIC,mBADJ,EAGIC,gBAHJ,EAIIC,w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GI,iBAAiB,EAAE,CAAC,CAHxB;IAII,OAAO,EAAEC,eAJb;IAKI,aAAa,EAAEM,QAAQ,GAAG,OAAH,GAAa;EALxC,GADJ;;EAUA,oBACI,oBAAC,wBAAD,qBACI,oBAAC,gBAAD;IACI,iBAAiB,EAAEwC,qBAAqB,GAAGlD,mBAAH,GAAyBmD,oBADrE,CAEI;IAFJ;IAGI,eAAe,EAAEV,eAHrB;IAII,KAAK,EAAEjC,KAJX;IAKI,eAAe,EAAEP,QALrB;IAMI,QAAQ,EAAEqB,YANd;IAOI,SAAS,EAAEI,aAPf;IAQI,GAAG,EAAEV,cART;IASI,UAAU,EAAEL,UAThB;IAUI,KAAK,EAAEsB,UAVX;IAWI,oBAAoB,EAAEmB,OAAO,CAAC1C,QAAD,CAXjC;IAYI,mBAAmB,EAAEJ,mBAZzB;IAaI,qBAAqB,EAAEa;EAb3B,gBAgBI,oBAAC,IAAD;IAAM,KAAK,EAAE0B;EAAb,gBACI,oBAAC,qBAAD;IACI,OAAO,EAAE,KADb;IAEI,mBAAmB,EAAEtC,MAAM,GAAG,CAAC,CAAD,CAAH,GAAS8C;EAFxC,GAIK9C,MAJL,EAMKF,QANL,CADJ,CAhBJ,CADJ,CADJ;AA+BH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Enable dynamic sizing for content size.\n * @default true\n */\n enableDynamicSizing?: boolean;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Maximum height(normalized value) of dialog\n * ex. 30% => 0.3 / 90% => 0.9\n * @default 0.9\n */\n maxHeightNormalizedRatio?: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n * @default []\n */\n snapPoints?: Array<number | string>;\n}> {}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Enable dynamic sizing for content size.\n * @default true\n */\n enableDynamicSizing?: boolean;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Maximum height(normalized value) of dialog\n * ex. 30% => 0.3 / 90% => 0.9\n * @default 0.9\n */\n maxHeightNormalizedRatio?: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n * @default []\n */\n snapPoints?: Array<number | string>;\n\n /**\n * Disable default backgroundColor.\n * @default false\n */\n disableDefaultBackgroundColor?: boolean;\n\n /**\n * Disable default shadow.\n * @default false\n */\n disableDefaultShadow?: boolean;\n}> {}\n"],"mappings":""}
|
|
@@ -34,7 +34,9 @@ export default function BottomSheet(props) {
|
|
|
34
34
|
index,
|
|
35
35
|
maxHeightNormalizedRatio = 0.9,
|
|
36
36
|
onChange,
|
|
37
|
-
snapPoints = []
|
|
37
|
+
snapPoints = [],
|
|
38
|
+
disableDefaultBackgroundColor = false,
|
|
39
|
+
disableDefaultShadow = false
|
|
38
40
|
} = props;
|
|
39
41
|
const styles = useStyles();
|
|
40
42
|
|
|
@@ -66,8 +68,9 @@ export default function BottomSheet(props) {
|
|
|
66
68
|
style: styles.animated,
|
|
67
69
|
translateY: translateY
|
|
68
70
|
}, /*#__PURE__*/React.createElement(Paper, {
|
|
69
|
-
elevation: 12,
|
|
70
|
-
style: paperStyles
|
|
71
|
+
elevation: disableDefaultShadow ? 0 : 12,
|
|
72
|
+
style: paperStyles,
|
|
73
|
+
colorValue: disableDefaultBackgroundColor ? '#ffffff00' : undefined
|
|
71
74
|
}, /*#__PURE__*/React.createElement(ScrollView, {
|
|
72
75
|
onContentSizeChange: handleContentSizeChange,
|
|
73
76
|
stickyHeaderIndices: header ? [0] : undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ScrollView","Modal","Paper","StyleSheet","css","useTheme","AnimatedY","useDynamicSnapPoints","useStyles","theme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","styles","handleClose","convertedSnapPoints","handleContentSizeChange","highestSnapPoint","translateY","paperStyles","height","absoluteFill","undefined"],"sources":["BottomSheetWeb.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollView } from 'react-native';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\nimport useDynamicSnapPoints from './useDynamicSnapPoints';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog,\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n } = useDynamicSnapPoints({\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n });\n\n const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);\n\n const paperStyles = [\n styles.paper,\n { height: highestSnapPoint },\n ];\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={12}\n style={paperStyles}\n >\n <ScrollView\n onContentSizeChange={handleContentSizeChange}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </ScrollView>\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,EAAgBC,KAAhB,EAAuBC,UAAvB,EAAmCC,GAAnC,EAAwCC,QAAxC,QAAwD,mBAAxD;AAEA,OAAOC,SAAP,MAAsB,cAAtB;AAEA,OAAOC,oBAAP,MAAiC,wBAAjC;;AAIA,MAAMC,SAAuC,GAAG,YAA+B;EAC3E,MAAMC,KAAK,GAAGJ,QAAQ,EAAtB;EAEA,OAAO;IACHK,IAAI,EAAE;MACFC,cAAc,EAAE,UADd;MAEFC,MAAM,EAAEH,KAAK,CAACG,MAAN,CAAaC;IAFnB,CADH;IAKHC,QAAQ,EAAE;MACNC,SAAS,EAAE,QADL;MAENC,QAAQ,EAAE,GAFJ;MAGNC,KAAK,EAAE;IAHD,CALP;IAUHC,KAAK,EAAE;MACHC,sBAAsB,EAAE,CADrB;MAEHC,uBAAuB,EAAE,CAFtB;MAGHC,QAAQ,EAAE,CAHP;MAIHC,QAAQ,EAAE;IAJP;EAVJ,CAAP;AAiBH,CApBD;;AAsBA,eAAe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eADE;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;
|
|
1
|
+
{"version":3,"names":["React","ScrollView","Modal","Paper","StyleSheet","css","useTheme","AnimatedY","useDynamicSnapPoints","useStyles","theme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","disableDefaultBackgroundColor","disableDefaultShadow","styles","handleClose","convertedSnapPoints","handleContentSizeChange","highestSnapPoint","translateY","paperStyles","height","absoluteFill","undefined"],"sources":["BottomSheetWeb.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollView } from 'react-native';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\nimport useDynamicSnapPoints from './useDynamicSnapPoints';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog,\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n disableDefaultBackgroundColor = false,\n disableDefaultShadow = false,\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n } = useDynamicSnapPoints({\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n });\n\n const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);\n\n const paperStyles = [\n styles.paper,\n { height: highestSnapPoint },\n ];\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={disableDefaultShadow ? 0 : 12}\n style={paperStyles}\n colorValue={disableDefaultBackgroundColor ? '#ffffff00' : undefined}\n >\n <ScrollView\n onContentSizeChange={handleContentSizeChange}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </ScrollView>\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,EAAgBC,KAAhB,EAAuBC,UAAvB,EAAmCC,GAAnC,EAAwCC,QAAxC,QAAwD,mBAAxD;AAEA,OAAOC,SAAP,MAAsB,cAAtB;AAEA,OAAOC,oBAAP,MAAiC,wBAAjC;;AAIA,MAAMC,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B;IAEI,OAAO,EAAEW,WAFb;IAGI,OAAO,EAAEP,KAAK,IAAI,CAHtB;IAII,KAAK,EAAEzB,GAAG,CAAC,CAACD,UAAU,CAACwC,YAAZ,EAA0BR,MAAM,CAACzB,IAAjC,CAAD;EAJd,gBAMI,oBAAC,SAAD;IACI,KAAK,EAAEyB,MAAM,CAACrB,QADlB;IAEI,UAAU,EAAE0B;EAFhB,gBAII,oBAAC,KAAD;IACI,SAAS,EAAEN,oBAAoB,GAAG,CAAH,GAAO,EAD1C;IAEI,KAAK,EAAEO,WAFX;IAGI,UAAU,EAAER,6BAA6B,GAAG,WAAH,GAAiBW;EAH9D,gBAKI,oBAAC,UAAD;IACI,mBAAmB,EAAEN,uBADzB;IAEI,mBAAmB,EAAEV,MAAM,GAAG,CAAC,CAAD,CAAH,GAASgB;EAFxC,GAIKhB,MAJL,EAMKF,QANL,CALJ,CAJJ,CANJ,CADJ;AA4BH;AAAA"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { format } from 'date-fns'; //@ts-ignore
|
|
3
3
|
|
|
4
4
|
import { Calendar, LocaleConfig } from 'react-native-calendars';
|
|
5
|
-
import { Button, Typography } from '@fountain-ui/core';
|
|
5
|
+
import { Button, createFontStyle, Typography } from '@fountain-ui/core';
|
|
6
6
|
import { useTheme } from '@fountain-ui/styles';
|
|
7
7
|
import YearPicker from './YearPicker';
|
|
8
8
|
import { DateTimePickerContext } from './DateTimePickerProvider';
|
|
@@ -23,6 +23,9 @@ export default function DateTimePicker(props) {
|
|
|
23
23
|
onYearPress: onYearPressProp
|
|
24
24
|
} = props;
|
|
25
25
|
const theme = useTheme();
|
|
26
|
+
const textDayFontStyle = createFontStyle(theme, {
|
|
27
|
+
selector: typo => typo.body2
|
|
28
|
+
});
|
|
26
29
|
const [yearPickerVisible, setYearPickerVisible] = React.useState(false);
|
|
27
30
|
const {
|
|
28
31
|
locales
|
|
@@ -84,7 +87,13 @@ export default function DateTimePicker(props) {
|
|
|
84
87
|
backgroundColor: theme.palette.paper.default,
|
|
85
88
|
calendarBackground: theme.palette.paper.default,
|
|
86
89
|
dayTextColor: theme.palette.text.primary,
|
|
87
|
-
textDisabledColor: theme.palette.text.hint
|
|
90
|
+
textDisabledColor: theme.palette.text.hint,
|
|
91
|
+
textDayFontFamily: textDayFontStyle.fontFamily,
|
|
92
|
+
textDayFontSize: textDayFontStyle.fontSize,
|
|
93
|
+
textDayFontWeight: textDayFontStyle.fontWeight,
|
|
94
|
+
textDayHeaderFontFamily: textDayFontStyle.fontFamily,
|
|
95
|
+
textDayHeaderFontSize: textDayFontStyle.fontSize,
|
|
96
|
+
textDayHeaderFontWeight: textDayFontStyle.fontWeight
|
|
88
97
|
}
|
|
89
98
|
});
|
|
90
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","format","Calendar","LocaleConfig","Button","Typography","useTheme","YearPicker","DateTimePickerContext","formatDate","useDateTimePicker","useContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","defaultLocale","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'textPrimary'}/>;\n const RightArrow = <Typography children={'>'} color={'textPrimary'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n }}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,MAAT,QAAuB,UAAvB,C,CACA;;AACA,SAASC,QAAT,EAAmBC,YAAnB,QAAuC,wBAAvC;AACA,SAASC,MAAT,EAAiBC,
|
|
1
|
+
{"version":3,"names":["React","format","Calendar","LocaleConfig","Button","createFontStyle","Typography","useTheme","YearPicker","DateTimePickerContext","formatDate","useDateTimePicker","useContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","textDayFontStyle","selector","typo","body2","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","defaultLocale","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint","textDayFontFamily","fontFamily","textDayFontSize","fontSize","textDayFontWeight","fontWeight","textDayHeaderFontFamily","textDayHeaderFontSize","textDayHeaderFontWeight"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, createFontStyle, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2 });\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'textPrimary'}/>;\n const RightArrow = <Typography children={'>'} color={'textPrimary'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n textDayFontFamily: textDayFontStyle.fontFamily,\n textDayFontSize: textDayFontStyle.fontSize,\n textDayFontWeight: textDayFontStyle.fontWeight,\n textDayHeaderFontFamily: textDayFontStyle.fontFamily,\n textDayHeaderFontSize: textDayFontStyle.fontSize,\n textDayHeaderFontWeight: textDayFontStyle.fontWeight,\n }}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,MAAT,QAAuB,UAAvB,C,CACA;;AACA,SAASC,QAAT,EAAmBC,YAAnB,QAAuC,wBAAvC;AACA,SAASC,MAAT,EAAiBC,eAAjB,EAAkCC,UAAlC,QAAoD,mBAApD;AACA,SAASC,QAAT,QAAyB,qBAAzB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SAASC,qBAAT,QAAsC,0BAAtC;AAEA,SAASC,UAAT,QAA2B,SAA3B;;AAEA,MAAMC,iBAAiB,GAAG,MAAM;EAC5B,OAAOX,KAAK,CAACY,UAAN,CAAiBH,qBAAjB,CAAP;AACH,CAFD;;AAIA,eAAe,SAASI,cAAT,CAAwBC,KAAxB,EAAoD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AuB,EAAEtC,gBAAgB,CAACmC;IAVvC;EAvBX,EADJ;AAsCH;AAAA"}
|
|
@@ -41,5 +41,15 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
41
41
|
* @default []
|
|
42
42
|
*/
|
|
43
43
|
snapPoints?: Array<number | string>;
|
|
44
|
+
/**
|
|
45
|
+
* Disable default backgroundColor.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
disableDefaultBackgroundColor?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Disable default shadow.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
disableDefaultShadow?: boolean;
|
|
44
54
|
}> {
|
|
45
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fountain-ui/lab",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.52",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Fountain-UI Team",
|
|
6
6
|
"description": "Incubator for Fountain-UI React components.",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "ba0faed7f492a6b00b7614c06f23f2fab290e01e"
|
|
74
74
|
}
|
|
@@ -23,6 +23,8 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
23
23
|
maxHeightNormalizedRatio = 0.9,
|
|
24
24
|
onChange,
|
|
25
25
|
snapPoints = [],
|
|
26
|
+
disableDefaultBackgroundColor = false,
|
|
27
|
+
disableDefaultShadow = false,
|
|
26
28
|
} = props;
|
|
27
29
|
|
|
28
30
|
const indexRef = React.useRef<number>(-1);
|
|
@@ -62,14 +64,14 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
62
64
|
const shadow = theme.shadow[12];
|
|
63
65
|
const modalStyle = {
|
|
64
66
|
backgroundColor: '#ffffff00',
|
|
65
|
-
...Platform.select<object>({
|
|
67
|
+
...(disableDefaultShadow ? {} : Platform.select<object>({
|
|
66
68
|
android: shadow?.elevation,
|
|
67
69
|
ios: shadow?.shadow,
|
|
68
70
|
web: shadow?.boxShadow,
|
|
69
|
-
}),
|
|
71
|
+
})),
|
|
70
72
|
};
|
|
71
73
|
const backgroundStyle = {
|
|
72
|
-
backgroundColor: theme.palette.paper.default,
|
|
74
|
+
backgroundColor: disableDefaultBackgroundColor ? '#ffffff00' : theme.palette.paper.default,
|
|
73
75
|
};
|
|
74
76
|
const contentWrapperStyle = {
|
|
75
77
|
flex: 1,
|
|
@@ -49,4 +49,16 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
49
49
|
* @default []
|
|
50
50
|
*/
|
|
51
51
|
snapPoints?: Array<number | string>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Disable default backgroundColor.
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
disableDefaultBackgroundColor?: boolean;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Disable default shadow.
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
disableDefaultShadow?: boolean;
|
|
52
64
|
}> {}
|
|
@@ -40,6 +40,8 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
40
40
|
maxHeightNormalizedRatio = 0.9,
|
|
41
41
|
onChange,
|
|
42
42
|
snapPoints = [],
|
|
43
|
+
disableDefaultBackgroundColor = false,
|
|
44
|
+
disableDefaultShadow = false,
|
|
43
45
|
} = props;
|
|
44
46
|
|
|
45
47
|
const styles = useStyles();
|
|
@@ -79,8 +81,9 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
79
81
|
translateY={translateY}
|
|
80
82
|
>
|
|
81
83
|
<Paper
|
|
82
|
-
elevation={12}
|
|
84
|
+
elevation={disableDefaultShadow ? 0 : 12}
|
|
83
85
|
style={paperStyles}
|
|
86
|
+
colorValue={disableDefaultBackgroundColor ? '#ffffff00' : undefined}
|
|
84
87
|
>
|
|
85
88
|
<ScrollView
|
|
86
89
|
onContentSizeChange={handleContentSizeChange}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import { Calendar, LocaleConfig } from 'react-native-calendars';
|
|
5
|
-
import { Button, Typography } from '@fountain-ui/core';
|
|
5
|
+
import { Button, createFontStyle, Typography } from '@fountain-ui/core';
|
|
6
6
|
import { useTheme } from '@fountain-ui/styles';
|
|
7
7
|
import YearPicker from './YearPicker';
|
|
8
8
|
import { DateTimePickerContext } from './DateTimePickerProvider';
|
|
@@ -26,6 +26,8 @@ export default function DateTimePicker(props: DateTimePickerProps) {
|
|
|
26
26
|
|
|
27
27
|
const theme = useTheme();
|
|
28
28
|
|
|
29
|
+
const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2 });
|
|
30
|
+
|
|
29
31
|
const [yearPickerVisible, setYearPickerVisible] = React.useState(false);
|
|
30
32
|
const { locales } = useDateTimePicker();
|
|
31
33
|
|
|
@@ -86,6 +88,12 @@ export default function DateTimePicker(props: DateTimePickerProps) {
|
|
|
86
88
|
calendarBackground: theme.palette.paper.default,
|
|
87
89
|
dayTextColor: theme.palette.text.primary,
|
|
88
90
|
textDisabledColor: theme.palette.text.hint,
|
|
91
|
+
textDayFontFamily: textDayFontStyle.fontFamily,
|
|
92
|
+
textDayFontSize: textDayFontStyle.fontSize,
|
|
93
|
+
textDayFontWeight: textDayFontStyle.fontWeight,
|
|
94
|
+
textDayHeaderFontFamily: textDayFontStyle.fontFamily,
|
|
95
|
+
textDayHeaderFontSize: textDayFontStyle.fontSize,
|
|
96
|
+
textDayHeaderFontWeight: textDayFontStyle.fontWeight,
|
|
89
97
|
}}
|
|
90
98
|
/>
|
|
91
99
|
);
|