@fountain-ui/lab 2.0.0-beta.87 → 3.0.0-alpha.1
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 +30 -91
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +31 -82
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js +23 -9
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js.map +1 -1
- package/build/commonjs/DateTimePicker/DateTimePicker.js +2 -2
- package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/commonjs/DateTimePicker/YearPicker.js +2 -2
- package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +30 -84
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +34 -85
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/BottomSheet/useDynamicSnapPoints.js +22 -9
- package/build/module/BottomSheet/useDynamicSnapPoints.js.map +1 -1
- package/build/module/DateTimePicker/DateTimePicker.js +2 -2
- package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/module/DateTimePicker/YearPicker.js +2 -2
- package/build/module/DateTimePicker/YearPicker.js.map +1 -1
- package/build/typescript/BottomSheet/BottomSheetProps.d.ts +1 -14
- package/build/typescript/BottomSheet/useDynamicSnapPoints.d.ts +3 -2
- package/build/typescript/Carousel/Carousel.d.ts +1 -1
- package/build/typescript/ViewPager/ViewPager.d.ts +1 -1
- package/build/typescript/ViewPager/ViewPager.native.d.ts +1 -1
- package/package.json +5 -5
- package/src/BottomSheet/BottomSheetNative.tsx +26 -95
- package/src/BottomSheet/BottomSheetProps.ts +1 -17
- package/src/BottomSheet/BottomSheetWeb.tsx +34 -110
- package/src/BottomSheet/useDynamicSnapPoints.ts +24 -10
- package/src/DateTimePicker/DateTimePicker.tsx +2 -2
- package/src/DateTimePicker/YearPicker.tsx +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useRef","useState","useWindowDimensions","R","INITIAL_CONTAINER_HEIGHT","convertSnapPoint","snapPoint","windowHeight","maxDynamicContentSize","Math","min","percentageRegex","RegExp","test","percentage","parseFloat","isNaN","round","useDynamicSnapPoints","params","enableDynamicSizing","snapPoints","height","contentHeight","setContentHeight","hasMeasureRef","convertedSnapPoints","map","push","Array","from","Set","sort","a","b","highestSnapPoint","last","handleLayout","event","current","nativeEvent","layout"],"sources":["useDynamicSnapPoints.ts"],"sourcesContent":["import { useCallback, useMemo, useRef, useState } from 'react';\nimport { LayoutChangeEvent, useWindowDimensions } from 'react-native';\nimport * as R from 'ramda';\n\nconst INITIAL_CONTAINER_HEIGHT = -999;\n\ninterface UseDynamicSnapPointsParams {\n enableDynamicSizing: boolean;\n maxDynamicContentSize: number;\n snapPoints: (number | string)[];\n}\n\ninterface UseDynamicSnapPointsReturns {\n convertedSnapPoints: number[];\n handleLayout: (e: LayoutChangeEvent) => void;\n highestSnapPoint: number;\n}\n\nconst convertSnapPoint = (snapPoint: number | string, windowHeight: number, maxDynamicContentSize: number): number => {\n if (typeof snapPoint === 'number') {\n return Math.min(maxDynamicContentSize, snapPoint);\n }\n\n const percentageRegex = new RegExp(/^[0-9]+%$/);\n if (percentageRegex.test(snapPoint)) {\n const percentage = parseFloat(snapPoint) / 100;\n return isNaN(percentage) ? 0 : Math.min(maxDynamicContentSize, Math.round(windowHeight * percentage));\n }\n\n return 0;\n};\n\nexport default function useDynamicSnapPoints(params: UseDynamicSnapPointsParams): UseDynamicSnapPointsReturns {\n const {\n enableDynamicSizing,\n maxDynamicContentSize,\n snapPoints,\n } = params;\n\n const { height: windowHeight } = useWindowDimensions();\n\n const [contentHeight, setContentHeight] = useState<number>(INITIAL_CONTAINER_HEIGHT);\n\n const hasMeasureRef = useRef<boolean>(false);\n\n const convertedSnapPoints = useMemo(() => {\n if (contentHeight === INITIAL_CONTAINER_HEIGHT) {\n return [];\n }\n\n const convertedSnapPoints = snapPoints.map((snapPoint) => {\n return convertSnapPoint(snapPoint, windowHeight, maxDynamicContentSize);\n });\n\n if (enableDynamicSizing && contentHeight !== 0) {\n convertedSnapPoints.push(\n convertSnapPoint(contentHeight, windowHeight, maxDynamicContentSize),\n );\n }\n\n return Array.from(new Set(convertedSnapPoints)).sort((a, b) => a - b);\n }, [\n contentHeight,\n enableDynamicSizing,\n maxDynamicContentSize,\n snapPoints,\n windowHeight,\n ]);\n\n const highestSnapPoint = R.last(convertedSnapPoints) ?? maxDynamicContentSize;\n\n const handleLayout = useCallback((event: LayoutChangeEvent) => {\n if (hasMeasureRef.current) {\n return;\n }\n\n hasMeasureRef.current = true;\n const { height } = event.nativeEvent.layout;\n setContentHeight(height);\n }, []);\n\n return {\n convertedSnapPoints,\n handleLayout,\n highestSnapPoint,\n };\n}\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,EAAuCC,QAAvC,QAAuD,OAAvD;AACA,SAA4BC,mBAA5B,QAAuD,cAAvD;AACA,OAAO,KAAKC,CAAZ,MAAmB,OAAnB;AAEA,MAAMC,wBAAwB,GAAG,CAAC,GAAlC;;AAcA,MAAMC,gBAAgB,GAAG,CAACC,SAAD,EAA6BC,YAA7B,EAAmDC,qBAAnD,KAA6F;EAClH,IAAI,OAAOF,SAAP,KAAqB,QAAzB,EAAmC;IAC/B,OAAOG,IAAI,CAACC,GAAL,CAASF,qBAAT,EAAgCF,SAAhC,CAAP;EACH;;EAED,MAAMK,eAAe,GAAG,IAAIC,MAAJ,CAAW,WAAX,CAAxB;;EACA,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C,EAgBhC,CACCX,aADD,EAECH,mBAFD,EAGCZ,qBAHD,EAICa,UAJD,EAKCd,YALD,CAhBgC,CAAnC;EAwBA,MAAM4B,gBAAgB,GAAGhC,CAAC,CAACiC,IAAF,CAAOV,mBAAP,KAA+BlB,qBAAxD;EAEA,MAAM6B,YAAY,GAAGvC,WAAW,CAAEwC,KAAD,IAA8B;IAC3D,IAAIb,aAAa,CAACc,OAAlB,EAA2B;MACvB;IACH;;IAEDd,aAAa,CAACc,OAAd,GAAwB,IAAxB;IACA,MAAM;MAAEjB;IAAF,IAAagB,KAAK,CAACE,WAAN,CAAkBC,MAArC;IACAjB,gBAAgB,CAACF,MAAD,CAAhB;EACH,CAR+B,EAQ7B,EAR6B,CAAhC;EAUA,OAAO;IACHI,mBADG;IAEHW,YAFG;IAGHF;EAHG,CAAP;AAKH"}
|
|
@@ -33,11 +33,11 @@ export default function DateTimePicker(props) {
|
|
|
33
33
|
|
|
34
34
|
const LeftArrow = /*#__PURE__*/React.createElement(Typography, {
|
|
35
35
|
children: '<',
|
|
36
|
-
color: '
|
|
36
|
+
color: 'strong'
|
|
37
37
|
});
|
|
38
38
|
const RightArrow = /*#__PURE__*/React.createElement(Typography, {
|
|
39
39
|
children: '>',
|
|
40
|
-
color: '
|
|
40
|
+
color: 'strong'
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
const onYearPress = date => {
|
|
@@ -1 +1 @@
|
|
|
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={'
|
|
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={'strong'}/>;\n const RightArrow = <Typography children={'>'} color={'strong'}/>;\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;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,GAAGlB,QAAQ,EAAtB;EAEA,MAAMmB,gBAAgB,GAAGrB,eAAe,CAACoB,KAAD,EAAQ;IAAEE,QAAQ,EAAGC,IAAD,IAAUA,IAAI,CAACC;EAA3B,CAAR,CAAxC;EAEA,MAAM,CAACC,iBAAD,EAAoBC,oBAApB,IAA4C/B,KAAK,CAACgC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OAAN,CAAcC,OAAd,CAAsBG;MAJ/B;IADL,CANjB,CAcI;IAdJ;IAeI,YAAY,EAAGV,IAAD,iBACV,oBAAC,MAAD;MACI,QAAQ,EAAE1B,UAAU,CAAC0B,IAAI,CAACW,MAAL,EAAD,EAAgB9B,MAAhB,CADxB;MAEI,OAAO,EAAE,MAFb;MAGI,IAAI,EAAE,OAHV;MAII,OAAO,EAAE,MAAMc,oBAAoB,CAAC,IAAD;IAJvC,EAhBR;IAuBI,KAAK,EAAE;MACHiB,eAAe,EAAEvB,KAAK,CAACiB,OAAN,CAAcO,KAAd,CAAoBC,OADlC;MAEHC,kBAAkB,EAAE1B,KAAK,CAACiB,OAAN,CAAcO,KAAd,CAAoBC,OAFrC;MAGHE,YAAY,EAAE3B,KAAK,CAACiB,OAAN,CAAcW,IAAd,CAAmBV,OAH9B;MAIHW,iBAAiB,EAAE7B,KAAK,CAACiB,OAAN,CAAcW,IAAd,CAAmBE,IAJnC;MAKHC,iBAAiB,EAAE9B,gBAAgB,CAAC+B,UALjC;MAMHC,eAAe,EAAEhC,gBAAgB,CAACiC,QAN/B;MAOHC,iBAAiB,EAAElC,gBAAgB,CAACmC,UAPjC;MAQHC,uBAAuB,EAAEpC,gBAAgB,CAAC+B,UARvC;MASHM,qBAAqB,EAAErC,gBAAgB,CAACiC,QATrC;MAUHK,uBAAuB,EAAEtC,gBAAgB,CAACmC;IAVvC;EAvBX,EADJ;AAsCH;AAAA"}
|
|
@@ -46,8 +46,8 @@ const YearPicker = _ref => {
|
|
|
46
46
|
|
|
47
47
|
return /*#__PURE__*/React.createElement(Column, null, /*#__PURE__*/React.createElement(Typography, {
|
|
48
48
|
children: formatDate(date, locale),
|
|
49
|
-
color: '
|
|
50
|
-
variant: '
|
|
49
|
+
color: 'strong',
|
|
50
|
+
variant: 'body3'
|
|
51
51
|
}), /*#__PURE__*/React.createElement(FlatList, {
|
|
52
52
|
data: years,
|
|
53
53
|
keyExtractor: item => item.toString(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","FlatList","getYear","setYear","Button","Column","Typography","useTheme","formatDate","initYear","itemHeight","useStyles","theme","list","marginTop","spacing","maxHeight","YearPicker","date","locale","maxDate","minDate","onYearPress","styles","ref","useRef","minYear","maxYear","Date","years","Array","fill","map","v","i","useEffect","current","scrollToItem","animated","item","getItemLayout","data","index","length","offset","toString","newDate"],"sources":["YearPicker.tsx"],"sourcesContent":["import React from 'react';\nimport { FlatList } from 'react-native';\nimport { getYear, setYear } from 'date-fns';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { Button, Column, Typography, useTheme } from '@fountain-ui/core';\nimport { formatDate } from './utils';\n\nconst initYear = 1901;\nconst itemHeight = 40;\n\ninterface YearPickerProps {\n date: Date;\n locale?: string,\n maxDate?: Date;\n minDate?: Date;\n onYearPress: (date: Date) => void;\n}\n\ntype YearPickerStyles = NamedStylesStringUnion<'list'>;\n\nconst useStyles: UseStyles<YearPickerStyles> = function (): YearPickerStyles {\n const theme = useTheme();\n\n return {\n list: {\n marginTop: theme.spacing(1),\n maxHeight: 270,\n },\n };\n};\n\nconst YearPicker = ({\n date,\n locale,\n maxDate,\n minDate,\n onYearPress,\n}: YearPickerProps) => {\n const styles = useStyles();\n\n const ref = React.useRef<FlatList | null>(null);\n\n const minYear = minDate ? getYear(minDate) : initYear;\n const maxYear = maxDate ? getYear(maxDate) : getYear(new Date());\n const years = Array(maxYear - minYear + 1).fill(minYear).map((v, i) => v + i);\n\n React.useEffect(() => {\n ref.current?.scrollToItem({\n animated: false,\n item: getYear(date),\n });\n }, [date]);\n\n const getItemLayout = (data: Array<number> | null | undefined, index: number) => ({\n length: itemHeight,\n offset: itemHeight * index,\n index,\n });\n\n return (\n <Column>\n <Typography\n children={formatDate(date, locale)}\n color={'
|
|
1
|
+
{"version":3,"names":["React","FlatList","getYear","setYear","Button","Column","Typography","useTheme","formatDate","initYear","itemHeight","useStyles","theme","list","marginTop","spacing","maxHeight","YearPicker","date","locale","maxDate","minDate","onYearPress","styles","ref","useRef","minYear","maxYear","Date","years","Array","fill","map","v","i","useEffect","current","scrollToItem","animated","item","getItemLayout","data","index","length","offset","toString","newDate"],"sources":["YearPicker.tsx"],"sourcesContent":["import React from 'react';\nimport { FlatList } from 'react-native';\nimport { getYear, setYear } from 'date-fns';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { Button, Column, Typography, useTheme } from '@fountain-ui/core';\nimport { formatDate } from './utils';\n\nconst initYear = 1901;\nconst itemHeight = 40;\n\ninterface YearPickerProps {\n date: Date;\n locale?: string,\n maxDate?: Date;\n minDate?: Date;\n onYearPress: (date: Date) => void;\n}\n\ntype YearPickerStyles = NamedStylesStringUnion<'list'>;\n\nconst useStyles: UseStyles<YearPickerStyles> = function (): YearPickerStyles {\n const theme = useTheme();\n\n return {\n list: {\n marginTop: theme.spacing(1),\n maxHeight: 270,\n },\n };\n};\n\nconst YearPicker = ({\n date,\n locale,\n maxDate,\n minDate,\n onYearPress,\n}: YearPickerProps) => {\n const styles = useStyles();\n\n const ref = React.useRef<FlatList | null>(null);\n\n const minYear = minDate ? getYear(minDate) : initYear;\n const maxYear = maxDate ? getYear(maxDate) : getYear(new Date());\n const years = Array(maxYear - minYear + 1).fill(minYear).map((v, i) => v + i);\n\n React.useEffect(() => {\n ref.current?.scrollToItem({\n animated: false,\n item: getYear(date),\n });\n }, [date]);\n\n const getItemLayout = (data: Array<number> | null | undefined, index: number) => ({\n length: itemHeight,\n offset: itemHeight * index,\n index,\n });\n\n return (\n <Column>\n <Typography\n children={formatDate(date, locale)}\n color={'strong'}\n variant={'body3'}\n />\n <FlatList\n data={years}\n keyExtractor={item => item.toString()}\n renderItem={({ item }) => (\n <Button\n children={item.toString()}\n variant={'text'}\n onPress={() => {\n const newDate = setYear(date, item);\n onYearPress(newDate);\n }}\n />\n )}\n getItemLayout={getItemLayout}\n style={styles.list}\n ref={ref}\n />\n </Column>\n );\n};\n\nexport default YearPicker;\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tBC,QAAQ,EAAE,KADY;MAEtBC,IAAI,EAAErC,OAAO,CAACgB,IAAD;IAFS,CAA1B;EAIH,CALD,EAKG,CAACA,IAAD,CALH;;EAOA,MAAMsB,aAAa,GAAG,CAACC,IAAD,EAAyCC,KAAzC,MAA4D;IAC9EC,MAAM,EAAEjC,UADsE;IAE9EkC,MAAM,EAAElC,UAAU,GAAGgC,KAFyD;IAG9EA;EAH8E,CAA5D,CAAtB;;EAMA,oBACI,oBAAC,MAAD,qBACI,oBAAC,UAAD;IACI,QAAQ,EAAElC,UAAU,CAACU,IAAD,EAAOC,MAAP,CADxB;IAEI,KAAK,EAAE,QAFX;IAGI,OAAO,EAAE;EAHb,EADJ,eAMI,oBAAC,QAAD;IACI,IAAI,EAAEU,KADV;IAEI,YAAY,EAAEU,IAAI,IAAIA,IAAI,CAACM,QAAL,EAF1B;IAGI,UAAU,EAAE;MAAA,IAAC;QAAEN;MAAF,CAAD;MAAA,oBACR,oBAAC,MAAD;QACI,QAAQ,EAAEA,IAAI,CAACM,QAAL,EADd;QAEI,OAAO,EAAE,MAFb;QAGI,OAAO,EAAE,MAAM;UACX,MAAMC,OAAO,GAAG3C,OAAO,CAACe,IAAD,EAAOqB,IAAP,CAAvB;UACAjB,WAAW,CAACwB,OAAD,CAAX;QACH;MANL,EADQ;IAAA,CAHhB;IAaI,aAAa,EAAEN,aAbnB;IAcI,KAAK,EAAEjB,MAAM,CAACV,IAdlB;IAeI,GAAG,EAAEW;EAfT,EANJ,CADJ;AA0BH,CAtDD;;AAwDA,eAAeP,UAAf"}
|
|
@@ -19,19 +19,6 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
19
19
|
* @default true
|
|
20
20
|
*/
|
|
21
21
|
enableDynamicSizing?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Area to be fixed on the top of the bottom sheet.
|
|
24
|
-
*/
|
|
25
|
-
header?: React.ReactNode;
|
|
26
|
-
/**
|
|
27
|
-
* If set to true, a border will be applied to the header area when the bottom sheet content is scrollable.
|
|
28
|
-
* This visually separates the header from the scrollable content.
|
|
29
|
-
*/
|
|
30
|
-
enableScrollableHeaderBorder?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Area to be fixed on the bottom of the bottom sheet.
|
|
33
|
-
*/
|
|
34
|
-
stickyBottomElement?: React.ReactNode;
|
|
35
22
|
/**
|
|
36
23
|
* Top element for displaying additional information on the bottom sheet.
|
|
37
24
|
*/
|
|
@@ -43,7 +30,7 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
43
30
|
/**
|
|
44
31
|
* Maximum height(normalized value) of dialog
|
|
45
32
|
* ex. 30% => 0.3 / 90% => 0.9
|
|
46
|
-
* @default 0.
|
|
33
|
+
* @default 0.8
|
|
47
34
|
*/
|
|
48
35
|
maxHeightNormalizedRatio?: number;
|
|
49
36
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { LayoutChangeEvent } from 'react-native';
|
|
1
2
|
interface UseDynamicSnapPointsParams {
|
|
2
3
|
enableDynamicSizing: boolean;
|
|
3
|
-
|
|
4
|
+
maxDynamicContentSize: number;
|
|
4
5
|
snapPoints: (number | string)[];
|
|
5
6
|
}
|
|
6
7
|
interface UseDynamicSnapPointsReturns {
|
|
7
8
|
convertedSnapPoints: number[];
|
|
8
|
-
|
|
9
|
+
handleLayout: (e: LayoutChangeEvent) => void;
|
|
9
10
|
highestSnapPoint: number;
|
|
10
11
|
}
|
|
11
12
|
export default function useDynamicSnapPoints(params: UseDynamicSnapPointsParams): UseDynamicSnapPointsReturns;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type CarouselProps from './CarouselProps';
|
|
3
3
|
import type { CarouselInstance } from './types';
|
|
4
|
-
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<CarouselProps<any>, "style" | "data" | "
|
|
4
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<CarouselProps<any>, "style" | "data" | "autoplay" | "autoplayInterval" | "createItemStyle" | "createScrollAnimation" | "disableSmartAutoplay" | "initialIndex" | "itemHeight" | "itemWidth" | "loop" | "onIndexChange" | "renderItem" | "scrollEnabled" | "windowSize"> & React.RefAttributes<CarouselInstance>>>;
|
|
5
5
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type ViewPagerProps from './ViewPagerProps';
|
|
3
3
|
import type { ViewPagerInstance } from './types';
|
|
4
|
-
declare const ViewPager: React.ForwardRefExoticComponent<Pick<ViewPagerProps, "style" | "children" | "onChange" | "
|
|
4
|
+
declare const ViewPager: React.ForwardRefExoticComponent<Pick<ViewPagerProps, "style" | "children" | "onChange" | "scrollEnabled" | "keyboardDismissMode" | "initialPage" | "loading" | "offscreenPageRerenderLimit" | "onPageScrollStateChanged" | "pageForceRerenderKey" | "UNSTABLE_sharedPage"> & React.RefAttributes<ViewPagerInstance>>;
|
|
5
5
|
export default ViewPager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type ViewPagerProps from './ViewPagerProps';
|
|
3
3
|
import type { ViewPagerInstance } from './types';
|
|
4
|
-
declare const ViewPager: React.ForwardRefExoticComponent<Pick<ViewPagerProps, "style" | "children" | "onChange" | "
|
|
4
|
+
declare const ViewPager: React.ForwardRefExoticComponent<Pick<ViewPagerProps, "style" | "children" | "onChange" | "scrollEnabled" | "keyboardDismissMode" | "initialPage" | "loading" | "offscreenPageRerenderLimit" | "onPageScrollStateChanged" | "pageForceRerenderKey" | "UNSTABLE_sharedPage"> & React.RefAttributes<ViewPagerInstance>>;
|
|
5
5
|
export default ViewPager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fountain-ui/lab",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Fountain-UI Team",
|
|
6
6
|
"description": "Incubator for Fountain-UI React components.",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@emotion/react": "^11.10.0",
|
|
19
19
|
"@emotion/styled": "^11.10.0",
|
|
20
|
-
"@fountain-ui/icons": "
|
|
21
|
-
"@fountain-ui/utils": "^
|
|
20
|
+
"@fountain-ui/icons": "3.0.0-alpha.1",
|
|
21
|
+
"@fountain-ui/utils": "^3.0.0-alpha.1",
|
|
22
22
|
"react-native-calendars": "1.1267.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@fountain-ui/core": "^
|
|
25
|
+
"@fountain-ui/core": "^3.0.0-alpha.1",
|
|
26
26
|
"@gorhom/bottom-sheet": "^4.5.0",
|
|
27
27
|
"date-fns": "^2.0.0",
|
|
28
28
|
"react": "^16.8.0 || ^17.0.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "88b0532dcdf185877d95cd713f9d9076728abe12"
|
|
74
74
|
}
|
|
@@ -1,58 +1,46 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Animated, LayoutChangeEvent,
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, LayoutChangeEvent, useWindowDimensions, ViewStyle } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
BottomSheetBackdrop,
|
|
5
5
|
BottomSheetBackdropProps,
|
|
6
|
-
BottomSheetFooter,
|
|
7
|
-
BottomSheetFooterProps,
|
|
8
6
|
BottomSheetModal,
|
|
9
7
|
BottomSheetModalProvider,
|
|
10
|
-
|
|
8
|
+
BottomSheetView,
|
|
11
9
|
} from '@gorhom/bottom-sheet';
|
|
12
|
-
import { Column, ExtendedStyle, isNotAndroid12, useAnimatedValue
|
|
10
|
+
import { Column, ExtendedStyle, isNotAndroid12, useAnimatedValue } from '@fountain-ui/core';
|
|
13
11
|
import { useTheme } from '@fountain-ui/styles';
|
|
14
12
|
import type BottomSheetProps from './BottomSheetProps';
|
|
15
13
|
import TransparentBackdrop from './TransparentBackdrop';
|
|
16
14
|
|
|
17
15
|
const NoHandle = () => null;
|
|
18
16
|
|
|
19
|
-
const createHeightLayoutHandler = (setHeight: React.Dispatch<React.SetStateAction<number>>) => {
|
|
20
|
-
return (event: LayoutChangeEvent) => {
|
|
21
|
-
const { height } = event.nativeEvent.layout;
|
|
22
|
-
setHeight(height);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
17
|
export default function BottomSheet(props: BottomSheetProps) {
|
|
27
18
|
const {
|
|
28
19
|
backdropOpacity = 0.5,
|
|
29
20
|
borderRadius: borderRadiusProp,
|
|
30
21
|
children,
|
|
31
22
|
enableDynamicSizing = true,
|
|
32
|
-
header,
|
|
33
|
-
stickyBottomElement,
|
|
34
23
|
topElement,
|
|
35
24
|
index,
|
|
36
|
-
maxHeightNormalizedRatio = 0.
|
|
25
|
+
maxHeightNormalizedRatio = 0.8,
|
|
37
26
|
onChange,
|
|
38
27
|
snapPoints = [],
|
|
39
|
-
enableScrollableHeaderBorder = false,
|
|
40
28
|
} = props;
|
|
41
29
|
|
|
42
|
-
const indexRef =
|
|
43
|
-
const bottomSheetRef =
|
|
30
|
+
const indexRef = useRef<number>(-1);
|
|
31
|
+
const bottomSheetRef = useRef<BottomSheetModal | null>(null);
|
|
44
32
|
|
|
45
33
|
const { height: windowHeight } = useWindowDimensions();
|
|
46
|
-
const [
|
|
47
|
-
const [topElementHeight, setTopElementHeight] = React.useState(0);
|
|
48
|
-
const [stickyBottomElementHeight, setStickyBottomElementHeight] = React.useState(0);
|
|
34
|
+
const [topElementHeight, setTopElementHeight] = useState(0);
|
|
49
35
|
|
|
50
36
|
const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio) - topElementHeight;
|
|
51
37
|
|
|
52
|
-
const handleTopElementLayout =
|
|
53
|
-
|
|
38
|
+
const handleTopElementLayout = (event: LayoutChangeEvent) => {
|
|
39
|
+
const { height } = event.nativeEvent.layout;
|
|
40
|
+
setTopElementHeight(height);
|
|
41
|
+
};
|
|
54
42
|
|
|
55
|
-
const handleChange =
|
|
43
|
+
const handleChange = useCallback((newIndex: number) => {
|
|
56
44
|
indexRef.current = newIndex;
|
|
57
45
|
|
|
58
46
|
if (onChange) {
|
|
@@ -60,11 +48,11 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
60
48
|
}
|
|
61
49
|
}, [onChange]);
|
|
62
50
|
|
|
63
|
-
const handleDismiss =
|
|
51
|
+
const handleDismiss = useCallback(() => {
|
|
64
52
|
handleChange(-1);
|
|
65
53
|
}, [handleChange]);
|
|
66
54
|
|
|
67
|
-
|
|
55
|
+
useEffect(() => {
|
|
68
56
|
if (index === indexRef.current) {
|
|
69
57
|
return;
|
|
70
58
|
}
|
|
@@ -80,29 +68,21 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
80
68
|
}, [index]);
|
|
81
69
|
|
|
82
70
|
const theme = useTheme();
|
|
83
|
-
|
|
84
|
-
const borderRadius = borderRadiusProp ?? theme.shape.
|
|
85
|
-
const modalStyle = {
|
|
86
|
-
backgroundColor: '#ffffff00',
|
|
87
|
-
borderTopLeftRadius: borderRadius,
|
|
88
|
-
borderTopRightRadius: borderRadius,
|
|
89
|
-
...Platform.select<object>({
|
|
90
|
-
android: shadow?.elevation,
|
|
91
|
-
ios: shadow?.shadow,
|
|
92
|
-
web: shadow?.boxShadow,
|
|
93
|
-
}),
|
|
94
|
-
};
|
|
95
|
-
const backgroundColor = theme.palette.paper.default;
|
|
71
|
+
|
|
72
|
+
const borderRadius = borderRadiusProp ?? theme.shape.radius.xxl;
|
|
96
73
|
const backgroundStyle = {
|
|
97
|
-
backgroundColor,
|
|
74
|
+
backgroundColor: theme.palette.surface.base,
|
|
98
75
|
borderTopLeftRadius: borderRadius,
|
|
99
76
|
borderTopRightRadius: borderRadius,
|
|
100
77
|
};
|
|
78
|
+
|
|
101
79
|
const contentWrapperStyle: ViewStyle = {
|
|
102
80
|
flex: 1,
|
|
103
|
-
|
|
104
|
-
|
|
81
|
+
maxHeight: maxDynamicContentSize,
|
|
82
|
+
minHeight: 300,
|
|
105
83
|
overflow: 'hidden',
|
|
84
|
+
paddingBottom: theme.spacing(6),
|
|
85
|
+
paddingTop: theme.spacing(5.5),
|
|
106
86
|
};
|
|
107
87
|
|
|
108
88
|
const isBackdropTransparent = backdropOpacity <= 0;
|
|
@@ -134,41 +114,6 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
134
114
|
}).start();
|
|
135
115
|
};
|
|
136
116
|
|
|
137
|
-
const handleContentSizeChange = (_: number, contentHeight: number) => {
|
|
138
|
-
setIsScrollable(contentHeight > maxDynamicContentSize);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const headerStyle = {
|
|
142
|
-
backgroundColor,
|
|
143
|
-
...(isScrollable && enableScrollableHeaderBorder ? {
|
|
144
|
-
borderBottomWidth: 0.5,
|
|
145
|
-
borderBottomColor: theme.palette.divider,
|
|
146
|
-
}: {})
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const childrenStyle = {
|
|
150
|
-
backgroundColor,
|
|
151
|
-
paddingBottom: stickyBottomElementHeight,
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const stickyBottomElementShadow = useElevationStyle(8);
|
|
155
|
-
|
|
156
|
-
const stickyBottomElementStyle = {
|
|
157
|
-
backgroundColor: theme.palette.paper.default,
|
|
158
|
-
...(isScrollable ? stickyBottomElementShadow : {}),
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const renderFooter = (props: BottomSheetFooterProps) => (
|
|
162
|
-
<BottomSheetFooter {...props}>
|
|
163
|
-
<View
|
|
164
|
-
onLayout={handleStickyBottomElementLayout}
|
|
165
|
-
style={stickyBottomElementStyle}
|
|
166
|
-
>
|
|
167
|
-
{stickyBottomElement}
|
|
168
|
-
</View>
|
|
169
|
-
</BottomSheetFooter>
|
|
170
|
-
);
|
|
171
|
-
|
|
172
117
|
return (
|
|
173
118
|
<BottomSheetModalProvider>
|
|
174
119
|
<BottomSheetModal
|
|
@@ -181,13 +126,11 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
181
126
|
onDismiss={handleDismiss}
|
|
182
127
|
ref={bottomSheetRef}
|
|
183
128
|
snapPoints={snapPoints}
|
|
184
|
-
style={modalStyle}
|
|
185
129
|
enablePanDownToClose={Boolean(onChange)}
|
|
186
130
|
enableDynamicSizing={enableDynamicSizing}
|
|
187
131
|
maxDynamicContentSize={maxDynamicContentSize}
|
|
188
132
|
detached={Boolean(topElement)}
|
|
189
133
|
onAnimate={topElement ? onAnimate : undefined}
|
|
190
|
-
footerComponent={stickyBottomElement ? renderFooter : undefined}
|
|
191
134
|
>
|
|
192
135
|
{topElement ? (
|
|
193
136
|
<Animated.View style={topElementAnimationStyle}>
|
|
@@ -200,21 +143,9 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
200
143
|
</Animated.View>
|
|
201
144
|
) : null}
|
|
202
145
|
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
stickyHeaderIndices={header ? [0] : undefined}
|
|
207
|
-
onContentSizeChange={handleContentSizeChange}
|
|
208
|
-
>
|
|
209
|
-
<View style={headerStyle}>
|
|
210
|
-
{header}
|
|
211
|
-
</View>
|
|
212
|
-
|
|
213
|
-
<View style={childrenStyle}>
|
|
214
|
-
{children}
|
|
215
|
-
</View>
|
|
216
|
-
</BottomSheetScrollView>
|
|
217
|
-
</View>
|
|
146
|
+
<BottomSheetView style={contentWrapperStyle}>
|
|
147
|
+
{children}
|
|
148
|
+
</BottomSheetView>
|
|
218
149
|
</BottomSheetModal>
|
|
219
150
|
</BottomSheetModalProvider>
|
|
220
151
|
);
|
|
@@ -24,22 +24,6 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
24
24
|
*/
|
|
25
25
|
enableDynamicSizing?: boolean;
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Area to be fixed on the top of the bottom sheet.
|
|
29
|
-
*/
|
|
30
|
-
header?: React.ReactNode;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* If set to true, a border will be applied to the header area when the bottom sheet content is scrollable.
|
|
34
|
-
* This visually separates the header from the scrollable content.
|
|
35
|
-
*/
|
|
36
|
-
enableScrollableHeaderBorder?: boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Area to be fixed on the bottom of the bottom sheet.
|
|
40
|
-
*/
|
|
41
|
-
stickyBottomElement?: React.ReactNode;
|
|
42
|
-
|
|
43
27
|
/**
|
|
44
28
|
* Top element for displaying additional information on the bottom sheet.
|
|
45
29
|
*/
|
|
@@ -53,7 +37,7 @@ export default interface BottomSheetProps extends ComponentProps<{
|
|
|
53
37
|
/**
|
|
54
38
|
* Maximum height(normalized value) of dialog
|
|
55
39
|
* ex. 30% => 0.3 / 90% => 0.9
|
|
56
|
-
* @default 0.
|
|
40
|
+
* @default 0.8
|
|
57
41
|
*/
|
|
58
42
|
maxHeightNormalizedRatio?: number;
|
|
59
43
|
|