@fountain-ui/lab 1.21.1 → 2.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/build/commonjs/AnimatedY/AnimatedY.js +10 -14
  2. package/build/commonjs/AnimatedY/AnimatedY.js.map +1 -1
  3. package/build/commonjs/AnimatedY/AnimatedYProps.js.map +1 -1
  4. package/build/commonjs/AnimatedY/index.js.map +1 -1
  5. package/build/commonjs/BottomSheet/BottomSheetNative.js +8 -2
  6. package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
  7. package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
  8. package/build/commonjs/BottomSheet/BottomSheetWeb.js +2 -6
  9. package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
  10. package/build/commonjs/BottomSheet/TransparentBackdrop.js +1 -1
  11. package/build/commonjs/BottomSheet/TransparentBackdrop.js.map +1 -1
  12. package/build/commonjs/BottomSheet/index.js.map +1 -1
  13. package/build/commonjs/BottomSheet/index.native.js.map +1 -1
  14. package/build/commonjs/Carousel/CarouselNative.js.map +1 -1
  15. package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
  16. package/build/commonjs/Carousel/CarouselWeb.js +1 -1
  17. package/build/commonjs/Carousel/CarouselWeb.js.map +1 -1
  18. package/build/commonjs/Carousel/index.js.map +1 -1
  19. package/build/commonjs/Carousel/index.native.js.map +1 -1
  20. package/build/commonjs/Carousel/utils.js +1 -1
  21. package/build/commonjs/Carousel/utils.js.map +1 -1
  22. package/build/commonjs/ComicViewer/ComicViewer.js +168 -0
  23. package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -0
  24. package/build/commonjs/ComicViewer/ComicViewerItemProps.js +6 -0
  25. package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +1 -0
  26. package/build/commonjs/ComicViewer/ComicViewerProps.js +2 -0
  27. package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -0
  28. package/build/commonjs/ComicViewer/ViewerItem.js +88 -0
  29. package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -0
  30. package/build/commonjs/ComicViewer/index.js +16 -0
  31. package/build/commonjs/ComicViewer/index.js.map +1 -0
  32. package/build/commonjs/DateTimePicker/DateTimePicker.js +7 -1
  33. package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
  34. package/build/commonjs/DateTimePicker/DateTimePickerProps.js.map +1 -1
  35. package/build/commonjs/DateTimePicker/DateTimePickerProvider.js.map +1 -1
  36. package/build/commonjs/DateTimePicker/YearPicker.js +22 -17
  37. package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
  38. package/build/commonjs/DateTimePicker/index.js +4 -4
  39. package/build/commonjs/DateTimePicker/index.js.map +1 -1
  40. package/build/commonjs/DateTimePicker/utils.js +2 -1
  41. package/build/commonjs/DateTimePicker/utils.js.map +1 -1
  42. package/build/commonjs/FlipCard/FlipCard.js +7 -13
  43. package/build/commonjs/FlipCard/FlipCard.js.map +1 -1
  44. package/build/commonjs/FlipCard/FlipCardProps.js.map +1 -1
  45. package/build/commonjs/FlipCard/index.js.map +1 -1
  46. package/build/commonjs/StatusBarProvider/Provider.js +1 -1
  47. package/build/commonjs/StatusBarProvider/Provider.js.map +1 -1
  48. package/build/commonjs/StatusBarProvider/StatusBarProvider.js.map +1 -1
  49. package/build/commonjs/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
  50. package/build/commonjs/StatusBarProvider/index.js.map +1 -1
  51. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +90 -22
  52. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  53. package/build/commonjs/ViewPager/ViewPagerNative.js +46 -36
  54. package/build/commonjs/ViewPager/ViewPagerNative.js.map +1 -1
  55. package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
  56. package/build/commonjs/ViewPager/ViewPagerWeb.js +32 -25
  57. package/build/commonjs/ViewPager/ViewPagerWeb.js.map +1 -1
  58. package/build/commonjs/ViewPager/index.js.map +1 -1
  59. package/build/commonjs/ViewPager/index.native.js.map +1 -1
  60. package/build/commonjs/ViewPager/utils.js +3 -39
  61. package/build/commonjs/ViewPager/utils.js.map +1 -1
  62. package/build/commonjs/hooks/index.js.map +1 -1
  63. package/build/commonjs/hooks/useAppbarStyles.js.map +1 -1
  64. package/build/commonjs/hooks/useElevationStyle.js.map +1 -1
  65. package/build/commonjs/hooks/useHeight.js +5 -4
  66. package/build/commonjs/hooks/useHeight.js.map +1 -1
  67. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +56 -57
  68. package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  69. package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js +9 -11
  70. package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
  71. package/build/commonjs/index.js +25 -4
  72. package/build/commonjs/index.js.map +1 -1
  73. package/build/module/AnimatedY/AnimatedY.js +11 -10
  74. package/build/module/AnimatedY/AnimatedY.js.map +1 -1
  75. package/build/module/AnimatedY/AnimatedYProps.js.map +1 -1
  76. package/build/module/AnimatedY/index.js.map +1 -1
  77. package/build/module/BottomSheet/BottomSheetNative.js +8 -2
  78. package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
  79. package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
  80. package/build/module/BottomSheet/BottomSheetWeb.js +2 -6
  81. package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
  82. package/build/module/BottomSheet/TransparentBackdrop.js +1 -1
  83. package/build/module/BottomSheet/TransparentBackdrop.js.map +1 -1
  84. package/build/module/BottomSheet/index.js.map +1 -1
  85. package/build/module/BottomSheet/index.native.js.map +1 -1
  86. package/build/module/Carousel/CarouselNative.js.map +1 -1
  87. package/build/module/Carousel/CarouselProps.js.map +1 -1
  88. package/build/module/Carousel/CarouselWeb.js +1 -1
  89. package/build/module/Carousel/CarouselWeb.js.map +1 -1
  90. package/build/module/Carousel/index.js.map +1 -1
  91. package/build/module/Carousel/index.native.js.map +1 -1
  92. package/build/module/Carousel/utils.js.map +1 -1
  93. package/build/module/ComicViewer/ComicViewer.js +151 -0
  94. package/build/module/ComicViewer/ComicViewer.js.map +1 -0
  95. package/build/module/ComicViewer/ComicViewerItemProps.js +2 -0
  96. package/build/module/ComicViewer/ComicViewerItemProps.js.map +1 -0
  97. package/build/module/ComicViewer/ComicViewerProps.js +2 -0
  98. package/build/module/ComicViewer/ComicViewerProps.js.map +1 -0
  99. package/build/module/ComicViewer/ViewerItem.js +72 -0
  100. package/build/module/ComicViewer/ViewerItem.js.map +1 -0
  101. package/build/module/ComicViewer/index.js +2 -0
  102. package/build/module/ComicViewer/index.js.map +1 -0
  103. package/build/module/DateTimePicker/DateTimePicker.js +7 -1
  104. package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
  105. package/build/module/DateTimePicker/DateTimePickerProps.js.map +1 -1
  106. package/build/module/DateTimePicker/DateTimePickerProvider.js.map +1 -1
  107. package/build/module/DateTimePicker/YearPicker.js +22 -17
  108. package/build/module/DateTimePicker/YearPicker.js.map +1 -1
  109. package/build/module/DateTimePicker/index.js.map +1 -1
  110. package/build/module/DateTimePicker/utils.js +2 -1
  111. package/build/module/DateTimePicker/utils.js.map +1 -1
  112. package/build/module/FlipCard/FlipCard.js +7 -7
  113. package/build/module/FlipCard/FlipCard.js.map +1 -1
  114. package/build/module/FlipCard/FlipCardProps.js.map +1 -1
  115. package/build/module/FlipCard/index.js.map +1 -1
  116. package/build/module/StatusBarProvider/Provider.js.map +1 -1
  117. package/build/module/StatusBarProvider/StatusBarProvider.js.map +1 -1
  118. package/build/module/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
  119. package/build/module/StatusBarProvider/index.js.map +1 -1
  120. package/build/module/ViewPager/ChildrenMemoizedPage.js +85 -23
  121. package/build/module/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  122. package/build/module/ViewPager/ViewPagerNative.js +43 -32
  123. package/build/module/ViewPager/ViewPagerNative.js.map +1 -1
  124. package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
  125. package/build/module/ViewPager/ViewPagerWeb.js +26 -23
  126. package/build/module/ViewPager/ViewPagerWeb.js.map +1 -1
  127. package/build/module/ViewPager/index.js.map +1 -1
  128. package/build/module/ViewPager/index.native.js.map +1 -1
  129. package/build/module/ViewPager/utils.js +1 -31
  130. package/build/module/ViewPager/utils.js.map +1 -1
  131. package/build/module/hooks/index.js.map +1 -1
  132. package/build/module/hooks/useAppbarStyles.js.map +1 -1
  133. package/build/module/hooks/useElevationStyle.js.map +1 -1
  134. package/build/module/hooks/useHeight.js +4 -3
  135. package/build/module/hooks/useHeight.js.map +1 -1
  136. package/build/module/hooks/useUnstableCollapsibleAppBar.js +58 -43
  137. package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
  138. package/build/module/hooks/useUnstableToggleDisplayStyle.js +9 -7
  139. package/build/module/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
  140. package/build/module/index.js +2 -0
  141. package/build/module/index.js.map +1 -1
  142. package/build/typescript/AnimatedY/AnimatedY.d.ts +0 -1
  143. package/build/typescript/BottomSheet/BottomSheetNative.d.ts +0 -1
  144. package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +0 -1
  145. package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +0 -1
  146. package/build/typescript/Carousel/CarouselNative.d.ts +0 -1
  147. package/build/typescript/ComicViewer/ComicViewer.d.ts +2 -0
  148. package/build/typescript/ComicViewer/ComicViewerItemProps.d.ts +12 -0
  149. package/build/typescript/ComicViewer/ComicViewerProps.d.ts +76 -0
  150. package/build/typescript/ComicViewer/ViewerItem.d.ts +7 -0
  151. package/build/typescript/ComicViewer/index.d.ts +3 -0
  152. package/build/typescript/DateTimePicker/DateTimePicker.d.ts +0 -1
  153. package/build/typescript/DateTimePicker/YearPicker.d.ts +0 -1
  154. package/build/typescript/FlipCard/FlipCard.d.ts +0 -1
  155. package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +0 -1
  156. package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +2 -1
  157. package/build/typescript/ViewPager/ViewPagerNative.d.ts +4 -2
  158. package/build/typescript/ViewPager/ViewPagerProps.d.ts +20 -19
  159. package/build/typescript/ViewPager/ViewPagerWeb.d.ts +4 -2
  160. package/build/typescript/ViewPager/index.d.ts +1 -1
  161. package/build/typescript/ViewPager/utils.d.ts +2 -19
  162. package/build/typescript/hooks/useUnstableCollapsibleAppBar.d.ts +2 -3
  163. package/build/typescript/hooks/useUnstableToggleDisplayStyle.d.ts +2 -2
  164. package/build/typescript/index.d.ts +2 -0
  165. package/package.json +13 -13
  166. package/src/AnimatedY/AnimatedY.tsx +13 -10
  167. package/src/BottomSheet/BottomSheetNative.tsx +6 -0
  168. package/src/ComicViewer/ComicViewer.tsx +162 -0
  169. package/src/ComicViewer/ComicViewerItemProps.ts +15 -0
  170. package/src/ComicViewer/ComicViewerProps.ts +90 -0
  171. package/src/ComicViewer/ViewerItem.tsx +76 -0
  172. package/src/ComicViewer/index.ts +3 -0
  173. package/src/DateTimePicker/DateTimePicker.tsx +6 -0
  174. package/src/DateTimePicker/YearPicker.tsx +2 -1
  175. package/src/FlipCard/FlipCard.tsx +8 -8
  176. package/src/ViewPager/ChildrenMemoizedPage.tsx +91 -22
  177. package/src/ViewPager/ViewPagerNative.tsx +47 -35
  178. package/src/ViewPager/ViewPagerProps.ts +20 -19
  179. package/src/ViewPager/ViewPagerWeb.tsx +34 -29
  180. package/src/ViewPager/index.ts +1 -1
  181. package/src/ViewPager/utils.tsx +2 -55
  182. package/src/hooks/useHeight.ts +2 -2
  183. package/src/hooks/useUnstableCollapsibleAppBar.ts +59 -42
  184. package/src/hooks/useUnstableToggleDisplayStyle.ts +8 -6
  185. package/src/index.ts +3 -0
  186. package/build/commonjs/hooks/useWidth.js +0 -29
  187. package/build/commonjs/hooks/useWidth.js.map +0 -1
  188. package/build/module/hooks/useWidth.js +0 -15
  189. package/build/module/hooks/useWidth.js.map +0 -1
  190. package/build/typescript/hooks/useWidth.d.ts +0 -2
  191. package/src/hooks/useWidth.ts +0 -17
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _core = require("@fountain-ui/core");
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ const styles = _core.StyleSheet.create({
19
+ placeholder: {
20
+ backgroundColor: '#abcabc'
21
+ }
22
+ });
23
+
24
+ function ViewerItem(_ref) {
25
+ let {
26
+ props
27
+ } = _ref;
28
+ const {
29
+ height,
30
+ id,
31
+ isViewable,
32
+ onError,
33
+ sourceUrl,
34
+ width
35
+ } = props;
36
+ const [isLoaded, setIsLoaded] = (0, _react.useState)(false);
37
+ const errorCount = (0, _react.useRef)(0);
38
+ const onLoad = (0, _react.useCallback)(() => {
39
+ errorCount.current = 0;
40
+ setIsLoaded(true);
41
+ }, []);
42
+ const handleError = (0, _react.useCallback)(() => {
43
+ errorCount.current = errorCount.current + 1;
44
+ onError && onError({
45
+ id,
46
+ count: errorCount.current
47
+ });
48
+ }, [id]);
49
+ const viewStyle = {
50
+ width,
51
+ height
52
+ };
53
+
54
+ const Placeholder = () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
55
+ style: [viewStyle, styles.placeholder]
56
+ });
57
+
58
+ if (!isViewable && !isLoaded) {
59
+ return /*#__PURE__*/_react.default.createElement(Placeholder, null);
60
+ }
61
+
62
+ return /*#__PURE__*/_react.default.createElement(_core.Image, {
63
+ disableOutline: true,
64
+ key: sourceUrl,
65
+ onLoad: onLoad,
66
+ onError: handleError,
67
+ source: {
68
+ uri: sourceUrl
69
+ },
70
+ style: viewStyle,
71
+ square: true
72
+ });
73
+ }
74
+
75
+ var _default = /*#__PURE__*/_react.default.memo(ViewerItem, (prevProps, nextProps) => {
76
+ if (prevProps.props.isViewable !== nextProps.props.isViewable) {
77
+ return false;
78
+ }
79
+
80
+ if (prevProps.props.sourceUrl !== nextProps.props.sourceUrl) {
81
+ return false;
82
+ }
83
+
84
+ return true;
85
+ });
86
+
87
+ exports.default = _default;
88
+ //# sourceMappingURL=ViewerItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["styles","StyleSheet","create","placeholder","backgroundColor","ViewerItem","props","height","id","isViewable","onError","sourceUrl","width","isLoaded","setIsLoaded","useState","errorCount","useRef","onLoad","useCallback","current","handleError","count","viewStyle","Placeholder","uri","React","memo","prevProps","nextProps"],"sources":["ViewerItem.tsx"],"sourcesContent":["import React, { useCallback, useRef, useState } from 'react';\nimport { View } from 'react-native';\nimport { Image, StyleSheet } from '@fountain-ui/core';\nimport ComicViewerItemProps from './ComicViewerItemProps';\n\nconst styles = StyleSheet.create({\n placeholder: {\n backgroundColor: '#abcabc',\n },\n});\n\nfunction ViewerItem<T>({ props }: { props: ComicViewerItemProps<T> }) {\n const {\n height,\n id,\n isViewable,\n onError,\n sourceUrl,\n width,\n } = props;\n\n const [isLoaded, setIsLoaded] = useState(false);\n\n const errorCount = useRef<number>(0);\n\n const onLoad = useCallback(() => {\n errorCount.current = 0;\n setIsLoaded(true);\n }, []);\n\n const handleError = useCallback(() => {\n errorCount.current = errorCount.current + 1;\n\n onError && onError({\n id,\n count: errorCount.current\n });\n }, [id]);\n\n const viewStyle = { width, height };\n\n const Placeholder = () => (\n <View style={[\n viewStyle,\n styles.placeholder,\n ]}/>\n );\n\n if (!isViewable && !isLoaded) {\n return <Placeholder/>;\n }\n\n return (\n <Image\n disableOutline={true}\n key={sourceUrl}\n onLoad={onLoad}\n onError={handleError}\n source={{ uri: sourceUrl }}\n style={viewStyle}\n square={true}\n />\n );\n}\n\nexport default React.memo(ViewerItem, (prevProps, nextProps) => {\n if (prevProps.props.isViewable !== nextProps.props.isViewable) {\n return false;\n }\n\n if (prevProps.props.sourceUrl !== nextProps.props.sourceUrl) {\n return false;\n }\n\n return true;\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAGA,MAAMA,MAAM,GAAGC,gBAAA,CAAWC,MAAX,CAAkB;EAC7BC,WAAW,EAAE;IACTC,eAAe,EAAE;EADR;AADgB,CAAlB,CAAf;;AAMA,SAASC,UAAT,OAAsE;EAAA,IAA/C;IAAEC;EAAF,CAA+C;EAClE,MAAM;IACFC,MADE;IAEFC,EAFE;IAGFC,UAHE;IAIFC,OAJE;IAKFC,SALE;IAMFC;EANE,IAOFN,KAPJ;EASA,MAAM,CAACO,QAAD,EAAWC,WAAX,IAA0B,IAAAC,eAAA,EAAS,KAAT,CAAhC;EAEA,MAAMC,UAAU,GAAG,IAAAC,aAAA,EAAe,CAAf,CAAnB;EAEA,MAAMC,MAAM,GAAG,IAAAC,kBAAA,EAAY,MAAM;IAC7BH,UAAU,CAACI,OAAX,GAAqB,CAArB;IACAN,WAAW,CAAC,IAAD,CAAX;EACH,CAHc,EAGZ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ty(exports, "default", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ComicViewer.default;
10
+ }
11
+ });
12
+
13
+ var _ComicViewer = _interopRequireDefault(require("./ComicViewer"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './ComicViewer';\nexport type { ComicViewerItemData, default as ComicViewerProps, ErrorInfo } from './ComicViewerProps';\nexport type { default as ComicViewerItemProps } from './ComicViewerItemProps';"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -98,7 +98,13 @@ function DateTimePicker(props) {
98
98
  variant: 'text',
99
99
  size: 'small',
100
100
  onPress: () => setYearPickerVisible(true)
101
- })
101
+ }),
102
+ theme: {
103
+ backgroundColor: theme.palette.paper.default,
104
+ calendarBackground: theme.palette.paper.default,
105
+ dayTextColor: theme.palette.text.primary,
106
+ textDisabledColor: theme.palette.text.hint
107
+ }
102
108
  });
103
109
  }
104
110
 
@@ -1 +1 @@
1
- {"version":3,"sources":["DateTimePicker.tsx"],"names":["useDateTimePicker","React","useContext","DateTimePickerContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","LocaleConfig","defaultLocale","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","toDate"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAPA;AASA,MAAMA,iBAAiB,GAAG,MAAM;AAC5B,SAAOC,eAAMC,UAAN,CAAiBC,6CAAjB,CAAP;AACH,CAFD;;AAIe,SAASC,cAAT,CAAwBC,KAAxB,EAAoD;AAC/D,QAAM;AACFC,IAAAA,YAAY,GAAG,IAAIC,IAAJ,EADb;AAEFC,IAAAA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AAEF,OAHb;AAII,IAAA,OAAO,EAAEC,OAJb;AAKI,IAAA,WAAW,EAAGc,SAAD,IAAuBA,SAAS,KAAK,MAAd,GAAuBL,SAAvB,GAAmCC,UAL3E;AAMI,IAAA,WAAW,EAAE;AACT,OAACb,UAAD,GAAc;AACVkB,QAAAA,QAAQ,EAAE,IADA;AAEVC,QAAAA,iBAAiB,EAAE,IAFT;AAGVC,QAAAA,aAAa,EAAEb,KAAK,CAACc,OAAN,CAAcC,OAAd,CAAsBC,IAH3B;AAIVC,QAAAA,iBAAiB,EAAEjB,KAAK,CAACc,OAAN,CAAcC,OAAd,CAAsBG;AAJ/B;AADL,KANjB,CAcI;AAdJ;AAeI,IAAA,YAAY,EAAGX,IAAD,iBACV,6BAAC,YAAD;AACI,MAAA,QAAQ,EAAE,uBAAWA,IAAI,CAACY,MAAL,EAAX,EAA0B3B,MAA1B,CADd;AAEI,MAAA,OAAO,EAAE,MAFb;AAGI,MAAA,IAAI,EAAE,OAHV;AAII,MAAA,OAAO,EAAE,MAAMU,oBAAoB,CAAC,IAAD;AAJvC;AAhBR,IADJ;AA0BH;;AAAA","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 />\n );\n};\n"]}
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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W,EAAEE;IALjB,EADJ;EASH;;EAED,oBACI,6BAAC,8BAAD;IACI,OAAO,EAAER,YADb;IAEI,UAAU,EAAEO,UAFhB;IAGI,OAAO,EAAEF,OAHb;IAII,OAAO,EAAEC,OAJb;IAKI,WAAW,EAAGgB,SAAD,IAAuBA,SAAS,KAAK,MAAd,GAAuBN,SAAvB,GAAmCC,UAL3E;IAMI,WAAW,EAAE;MACT,CAACd,UAAD,GAAc;QACVoB,QAAQ,EAAE,IADA;QAEVC,iBAAiB,EAAE,IAFT;QAGVC,aAAa,EAAEf,KAAK,CAACgB,OAAN,CAAcC,OAAd,CAAsBC,IAH3B;QAIVC,iBAAiB,EAAEnB,KAAK,CAACgB,OAAN,CAAcC,OAAd,CAAsBG;MAJ/B;IADL,CANjB,CAcI;IAdJ;IAeI,YAAY,EAAGZ,IAAD,iBACV,6BAAC,YAAD;MACI,QAAQ,EAAE,IAAAa,iBAAA,EAAWb,IAAI,CAACc,MAAL,EAAX,EAA0B9B,MAA1B,CADd;MAEI,OAAO,EAAE,MAFb;MAGI,IAAI,EAAE,OAHV;MAII,OAAO,EAAE,MAAMW,oBAAoB,CAAC,IAAD;IAJvC,EAhBR;IAuBI,KAAK,EAAE;MACHoB,eAAe,EAAEvB,KAAK,CAACgB,OAAN,CAAcQ,KAAd,CAAoBC,OADlC;MAEHC,kBAAkB,EAAE1B,KAAK,CAACgB,OAAN,CAAcQ,KAAd,CAAoBC,OAFrC;MAGHE,YAAY,EAAE3B,KAAK,CAACgB,OAAN,CAAcY,IAAd,CAAmBX,OAH9B;MAIHY,iBAAiB,EAAE7B,KAAK,CAACgB,OAAN,CAAcY,IAAd,CAAmBE;IAJnC;EAvBX,EADJ;AAgCH;;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sources":["DateTimePickerProps.ts"],"sourcesContent":["import type { ComponentProps } from '@fountain-ui/core';\n\nexport interface Day {\n dateString: string;\n day: number;\n month: number;\n timestamp: number;\n year: number;\n}\n\nexport default interface DateTimePickerProps extends ComponentProps<{\n /**\n * To select month on calendar.\n * @default Date()\n */\n currentMonth?: Date;\n\n /**\n * Locale for calendar.\n */\n locale?: string;\n\n /**\n * Marked date on calendar.\n * @default Date()\n */\n markedDate?: Date;\n\n /**\n * Maximum date that can be selected, dates after maxDate will be grayed out.\n */\n maxDate?: Date;\n\n /**\n * Minimum date that can be selected, dates before minDate will be grayed out.\n */\n minDate?: Date;\n\n /**\n * Handler which gets executed on day press.\n */\n onDayPress?: (day: Day) => void;\n\n /**\n * Handler which gets executed on year press.\n */\n onYearPress?: (year: Date) => void;\n}> {}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["DateTimePickerProvider.ts"],"names":["defaultValue","locales","DateTimePickerContext","React","createContext","Provider"],"mappings":";;;;;;;AAAA;;;;AAMA,MAAMA,YAAiC,GAAG;AACtCC,EAAAA,OAAO,EAAE;AAD6B,CAA1C;;AAIO,MAAMC,qBAAqB,gBAAGC,eAAMC,aAAN,CAAyCJ,YAAzC,CAA9B;;;eAEQE,qBAAqB,CAACG,Q","sourcesContent":["import React from 'react';\n\nexport interface DateTimePickerValue {\n locales: object;\n}\n\nconst defaultValue: DateTimePickerValue = {\n locales: {},\n};\n\nexport const DateTimePickerContext = React.createContext<DateTimePickerValue>(defaultValue);\n\nexport default DateTimePickerContext.Provider;"]}
1
+ {"version":3,"names":["defaultValue","locales","DateTimePickerContext","React","createContext","Provider"],"sources":["DateTimePickerProvider.ts"],"sourcesContent":["import React from 'react';\n\nexport interface DateTimePickerValue {\n locales: object;\n}\n\nconst defaultValue: DateTimePickerValue = {\n locales: {},\n};\n\nexport const DateTimePickerContext = React.createContext<DateTimePickerValue>(defaultValue);\n\nexport default DateTimePickerContext.Provider;"],"mappings":";;;;;;;AAAA;;;;AAMA,MAAMA,YAAiC,GAAG;EACtCC,OAAO,EAAE;AAD6B,CAA1C;;AAIO,MAAMC,qBAAqB,gBAAGC,cAAA,CAAMC,aAAN,CAAyCJ,YAAzC,CAA9B;;;eAEQE,qBAAqB,CAACG,Q"}
@@ -30,13 +30,14 @@ const useStyles = function () {
30
30
  };
31
31
  };
32
32
 
33
- const YearPicker = ({
34
- date,
35
- locale,
36
- maxDate,
37
- minDate,
38
- onYearPress
39
- }) => {
33
+ const YearPicker = _ref => {
34
+ let {
35
+ date,
36
+ locale,
37
+ maxDate,
38
+ minDate,
39
+ onYearPress
40
+ } = _ref;
40
41
  const styles = useStyles();
41
42
 
42
43
  const ref = _react.default.useRef(null);
@@ -62,20 +63,24 @@ const YearPicker = ({
62
63
 
63
64
  return /*#__PURE__*/_react.default.createElement(_core.Column, null, /*#__PURE__*/_react.default.createElement(_core.Typography, {
64
65
  children: (0, _utils.formatDate)(date, locale),
66
+ color: 'textPrimary',
65
67
  variant: 'subtitle2'
66
68
  }), /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
67
69
  data: years,
68
70
  keyExtractor: item => item.toString(),
69
- renderItem: ({
70
- item
71
- }) => /*#__PURE__*/_react.default.createElement(_core.Button, {
72
- children: item.toString(),
73
- variant: 'text',
74
- onPress: () => {
75
- const newDate = (0, _dateFns.setYear)(date, item);
76
- onYearPress(newDate);
77
- }
78
- }),
71
+ renderItem: _ref2 => {
72
+ let {
73
+ item
74
+ } = _ref2;
75
+ return /*#__PURE__*/_react.default.createElement(_core.Button, {
76
+ children: item.toString(),
77
+ variant: 'text',
78
+ onPress: () => {
79
+ const newDate = (0, _dateFns.setYear)(date, item);
80
+ onYearPress(newDate);
81
+ }
82
+ });
83
+ },
79
84
  getItemLayout: getItemLayout,
80
85
  style: styles.list,
81
86
  ref: ref
@@ -1 +1 @@
1
- {"version":3,"sources":["YearPicker.tsx"],"names":["initYear","itemHeight","useStyles","theme","list","marginTop","spacing","maxHeight","YearPicker","date","locale","maxDate","minDate","onYearPress","styles","ref","React","useRef","minYear","maxYear","Date","years","Array","fill","map","v","i","useEffect","current","scrollToItem","animated","item","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AAa,GAAG,CAACC,IAAD,EAAyCC,KAAzC,MAA4D;AAC9EC,IAAAA,MAAM,EAAElC,UADsE;AAE9EmC,IAAAA,MAAM,EAAEnC,UAAU,GAAGiC,KAFyD;AAG9EA,IAAAA;AAH8E,GAA5D,CAAtB;;AAMA,sBACI,6BAAC,YAAD,qBACI,6BAAC,gBAAD;AACI,IAAA,QAAQ,EAAE,uBAAWzB,IAAX,EAAiBC,MAAjB,CADd;AAEI,IAAA,OAAO,EAAE;AAFb,IADJ,eAKI,6BAAC,qBAAD;AACI,IAAA,IAAI,EAAEW,KADV;AAEI,IAAA,YAAY,EAAEU,IAAI,IAAIA,IAAI,CAACM,QAAL,EAF1B;AAGI,IAAA,UAAU,EAAE,CAAC;AAAEN,MAAAA;AAAF,KAAD,kBACR,6BAAC,YAAD;AACI,MAAA,QAAQ,EAAEA,IAAI,CAACM,QAAL,EADd;AAEI,MAAA,OAAO,EAAE,MAFb;AAGI,MAAA,OAAO,EAAE,MAAM;AACX,cAAMC,OAAO,GAAG,sBAAQ7B,IAAR,EAAcsB,IAAd,CAAhB;AACAlB,QAAAA,WAAW,CAACyB,OAAD,CAAX;AACH;AANL,MAJR;AAaI,IAAA,aAAa,EAAEN,aAbnB;AAcI,IAAA,KAAK,EAAElB,MAAM,CAACV,IAdlB;AAeI,IAAA,GAAG,EAAEW;AAfT,IALJ,CADJ;AAyBH,CArDD;;eAuDeP,U","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 variant={'subtitle2'}\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;"]}
1
+ {"version":3,"names":["initYear","itemHeight","useStyles","theme","useTheme","list","marginTop","spacing","maxHeight","YearPicker","date","locale","maxDate","minDate","onYearPress","styles","ref","React","useRef","minYear","getYear","maxYear","Date","years","Array","fill","map","v","i","useEffect","current","scrollToItem","animated","item","getItemLayout","data","index","length","offset","formatDate","toString","newDate","setYear"],"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={'textPrimary'}\n variant={'subtitle2'}\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;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;;;AAEA,MAAMA,QAAQ,GAAG,IAAjB;AACA,MAAMC,UAAU,GAAG,EAAnB;;AAYA,MAAMC,SAAsC,GAAG,YAA8B;EACzE,MAAMC,KAAK,GAAG,IAAAC,cAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,SAAS,EAAEH,KAAK,CAACI,OAAN,CAAc,CAAd,CADT;MAEFC,SAAS,EAAE;IAFT;EADH,CAAP;AAMH,CATD;;AAWA,MAAMC,UAAU,GAAG,QAMI;EAAA,IANH;IAChBC,IADgB;IAEhBC,MAFgB;IAGhBC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AU,EAAE;MAAA,IAAC;QAAEP;MAAF,CAAD;MAAA,oBACR,6BAAC,YAAD;QACI,QAAQ,EAAEA,IAAI,CAACO,QAAL,EADd;QAEI,OAAO,EAAE,MAFb;QAGI,OAAO,EAAE,MAAM;UACX,MAAMC,OAAO,GAAG,IAAAC,gBAAA,EAAQhC,IAAR,EAAcuB,IAAd,CAAhB;UACAnB,WAAW,CAAC2B,OAAD,CAAX;QACH;MANL,EADQ;IAAA,CAHhB;IAaI,aAAa,EAAEP,aAbnB;IAcI,KAAK,EAAEnB,MAAM,CAACV,IAdlB;IAeI,GAAG,EAAEW;EAfT,EANJ,CADJ;AA0BH,CAtDD;;eAwDeP,U"}
@@ -3,16 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "default", {
6
+ Object.defineProperty(exports, "DateTimePickerProvider", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _DateTimePicker.default;
9
+ return _DateTimePickerProvider.default;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "DateTimePickerProvider", {
12
+ Object.defineProperty(exports, "default", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _DateTimePickerProvider.default;
15
+ return _DateTimePicker.default;
16
16
  }
17
17
  });
18
18
 
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { default } from './DateTimePicker';\nexport { default as DateTimePickerProvider } from './DateTimePickerProvider';\nexport type { default as DateTimePickerProps } from './DateTimePickerProps';"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './DateTimePicker';\nexport { default as DateTimePickerProvider } from './DateTimePickerProvider';\nexport type { default as DateTimePickerProps } from './DateTimePickerProps';"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
@@ -21,7 +21,8 @@ const localeMap = {
21
21
  fr: _fr.default
22
22
  };
23
23
 
24
- const formatDate = (date, locale = 'en') => {
24
+ const formatDate = function (date) {
25
+ let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
25
26
  //@ts-ignore
26
27
  return (0, _dateFns.format)(date, 'MMMM uuuu', {
27
28
  locale: localeMap[locale]
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["localeMap","en","enLocale","de","deLocale","fr","frLocale","formatDate","date","locale"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,SAAS,GAAG;AACdC,EAAAA,EAAE,EAAEC,aADU;AAEdC,EAAAA,EAAE,EAAEC,WAFU;AAGdC,EAAAA,EAAE,EAAEC;AAHU,CAAlB;;AAMO,MAAMC,UAAU,GAAG,CAACC,IAAD,EAAaC,MAAc,GAAG,IAA9B,KAA+C;AACrE;AACA,SAAO,qBAAOD,IAAP,EAAa,WAAb,EAA0B;AAAEC,IAAAA,MAAM,EAAET,SAAS,CAACS,MAAD;AAAnB,GAA1B,CAAP;AACH,CAHM","sourcesContent":["import { format } from 'date-fns';\nimport enLocale from 'date-fns/locale/en-US';\nimport deLocale from 'date-fns/locale/de';\nimport frLocale from 'date-fns/locale/fr';\n\nconst localeMap = {\n en: enLocale,\n de: deLocale,\n fr: frLocale,\n};\n\nexport const formatDate = (date: Date, locale: string = 'en'): string => {\n //@ts-ignore\n return format(date, 'MMMM uuuu', { locale: localeMap[locale] });\n};"]}
1
+ {"version":3,"names":["localeMap","en","enLocale","de","deLocale","fr","frLocale","formatDate","date","locale","format"],"sources":["utils.ts"],"sourcesContent":["import { format } from 'date-fns';\nimport enLocale from 'date-fns/locale/en-US';\nimport deLocale from 'date-fns/locale/de';\nimport frLocale from 'date-fns/locale/fr';\n\nconst localeMap = {\n en: enLocale,\n de: deLocale,\n fr: frLocale,\n};\n\nexport const formatDate = (date: Date, locale: string = 'en'): string => {\n //@ts-ignore\n return format(date, 'MMMM uuuu', { locale: localeMap[locale] });\n};"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,SAAS,GAAG;EACdC,EAAE,EAAEC,aADU;EAEdC,EAAE,EAAEC,WAFU;EAGdC,EAAE,EAAEC;AAHU,CAAlB;;AAMO,MAAMC,UAAU,GAAG,UAACC,IAAD,EAA+C;EAAA,IAAlCC,MAAkC,uEAAjB,IAAiB;EACrE;EACA,OAAO,IAAAC,eAAA,EAAOF,IAAP,EAAa,WAAb,EAA0B;IAAEC,MAAM,EAAET,SAAS,CAACS,MAAD;EAAnB,CAA1B,CAAP;AACH,CAHM"}
@@ -9,9 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
- var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
15
13
 
16
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
15
 
@@ -40,10 +38,8 @@ function FlipCard(props) {
40
38
  reanimationKey,
41
39
  style
42
40
  } = props;
43
-
44
- const sharedAngle = _reactNativeReanimated.default.useSharedValue(0);
45
-
46
- const animatedFrontCardStyle = _reactNativeReanimated.default.useAnimatedStyle(() => {
41
+ const sharedAngle = (0, _reactNativeReanimated.useSharedValue)(0);
42
+ const animatedFrontCardStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
47
43
  return {
48
44
  zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,
49
45
  transform: [{
@@ -52,9 +48,8 @@ function FlipCard(props) {
52
48
  rotateX: `${sharedAngle.value}deg`
53
49
  }]
54
50
  };
55
- });
56
-
57
- const animatedBackCardStyle = _reactNativeReanimated.default.useAnimatedStyle(() => {
51
+ }, []);
52
+ const animatedBackCardStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
58
53
  return {
59
54
  zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,
60
55
  transform: [{
@@ -63,11 +58,10 @@ function FlipCard(props) {
63
58
  rotateX: `${sharedAngle.value + 180}deg`
64
59
  }]
65
60
  };
66
- });
67
-
61
+ }, []);
68
62
  (0, _react.useEffect)(() => {
69
63
  sharedAngle.value = 0;
70
- sharedAngle.value = _reactNativeReanimated.default.withTiming(180, {
64
+ sharedAngle.value = (0, _reactNativeReanimated.withTiming)(180, {
71
65
  duration: 500
72
66
  });
73
67
  }, [reanimationKey]);
@@ -1 +1 @@
1
- {"version":3,"sources":["FlipCard.tsx"],"names":["styles","StyleSheet","create","container","height","width","animatedCard","alignItems","backfaceVisibility","justifyContent","position","PERSPECTIVE","Z_INDEX_CHANGE_ANGLE","FlipCard","props","backCard","frontCard","reanimationKey","style","sharedAngle","Animated","useSharedValue","animatedFrontCardStyle","useAnimatedStyle","zIndex","value","transform","perspective","rotateX","animatedBackCardStyle","withTiming","duration"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC7BC,EAAAA,SAAS,EAAE;AACPC,IAAAA,MAAM,EAAE,EADD;AAEPC,IAAAA,KAAK,EAAE;AAFA,GADkB;AAK7BC,EAAAA,YAAY,EAAE;AACVC,IAAAA,UAAU,EAAE,QADF;AAEVC,IAAAA,kBAAkB,EAAE,QAFV;AAGVC,IAAAA,cAAc,EAAE,QAHN;AAIVC,IAAAA,QAAQ,EAAE;AAJA;AALe,CAAlB,CAAf;;AAaA,MAAMC,WAAW,GAAG,GAApB;AACA,MAAMC,oBAAoB,GAAG,EAA7B;;AAEe,SAASC,QAAT,CAAkBC,KAAlB,EAAwC;AACnD,QAAM;AACFC,IAAAA,QADE;AAEFC,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tB;AAAtB,KACKN,SADL,CADJ,eAKI,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,CAAChB,MAAM,CAACM,YAAR,EAAsBuB,qBAAtB;AAAtB,KACKd,QADL,CALJ,CADJ;AAWH;;AAAA","sourcesContent":["import React, { useEffect } from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport type FlipCardProps from './FlipCardProps';\n\nconst styles = StyleSheet.create({\n container: {\n height: 32,\n width: 24,\n },\n animatedCard: {\n alignItems: 'center',\n backfaceVisibility: 'hidden',\n justifyContent: 'center',\n position: 'absolute',\n },\n});\n\nconst PERSPECTIVE = 100;\nconst Z_INDEX_CHANGE_ANGLE = 90;\n\nexport default function FlipCard(props: FlipCardProps) {\n const {\n backCard,\n frontCard,\n reanimationKey,\n style,\n } = props;\n\n const sharedAngle = Animated.useSharedValue(0);\n\n const animatedFrontCardStyle = Animated.useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${sharedAngle.value}deg` },\n ],\n };\n });\n\n const animatedBackCardStyle = Animated.useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${(sharedAngle.value + 180)}deg` },\n ],\n };\n });\n\n useEffect(() => {\n sharedAngle.value = 0;\n sharedAngle.value = Animated.withTiming(180, { duration: 500 });\n }, [reanimationKey]);\n\n return (\n <View style={[styles.container, style]}>\n <Animated.View style={[styles.animatedCard, animatedFrontCardStyle]}>\n {frontCard}\n </Animated.View>\n\n <Animated.View style={[styles.animatedCard, animatedBackCardStyle]}>\n {backCard}\n </Animated.View>\n </View>\n );\n};"]}
1
+ {"version":3,"names":["styles","StyleSheet","create","container","height","width","animatedCard","alignItems","backfaceVisibility","justifyContent","position","PERSPECTIVE","Z_INDEX_CHANGE_ANGLE","FlipCard","props","backCard","frontCard","reanimationKey","style","sharedAngle","useSharedValue","animatedFrontCardStyle","useAnimatedStyle","zIndex","value","transform","perspective","rotateX","animatedBackCardStyle","useEffect","withTiming","duration"],"sources":["FlipCard.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type FlipCardProps from './FlipCardProps';\n\nconst styles = StyleSheet.create({\n container: {\n height: 32,\n width: 24,\n },\n animatedCard: {\n alignItems: 'center',\n backfaceVisibility: 'hidden',\n justifyContent: 'center',\n position: 'absolute',\n },\n});\n\nconst PERSPECTIVE = 100;\nconst Z_INDEX_CHANGE_ANGLE = 90;\n\nexport default function FlipCard(props: FlipCardProps) {\n const {\n backCard,\n frontCard,\n reanimationKey,\n style,\n } = props;\n\n const sharedAngle = useSharedValue(0);\n\n const animatedFrontCardStyle = useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${sharedAngle.value}deg` },\n ],\n };\n }, []);\n\n const animatedBackCardStyle = useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${(sharedAngle.value + 180)}deg` },\n ],\n };\n }, []);\n\n useEffect(() => {\n sharedAngle.value = 0;\n sharedAngle.value = withTiming(180, { duration: 500 });\n }, [reanimationKey]);\n\n return (\n <View style={[styles.container, style]}>\n <Animated.View style={[styles.animatedCard, animatedFrontCardStyle]}>\n {frontCard}\n </Animated.View>\n\n <Animated.View style={[styles.animatedCard, animatedBackCardStyle]}>\n {backCard}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAGA,MAAMA,MAAM,GAAGC,uBAAA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AoB,IAAAM,iCAAA,EAAW,GAAX,EAAgB;MAAEC,QAAQ,EAAE;IAAZ,CAAhB,CAApB;EACH,CAHD,EAGG,CAACd,cAAD,CAHH;EAKA,oBACI,6BAAC,iBAAD;IAAM,KAAK,EAAE,CAACjB,MAAM,CAACG,SAAR,EAAmBe,KAAnB;EAAb,gBACI,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAAClB,MAAM,CAACM,YAAR,EAAsBe,sBAAtB;EAAtB,GACKL,SADL,CADJ,eAKI,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAAChB,MAAM,CAACM,YAAR,EAAsBsB,qBAAtB;EAAtB,GACKb,QADL,CALJ,CADJ;AAWH;;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sources":["FlipCardProps.ts"],"sourcesContent":["import React from 'react';\nimport { ComponentProps } from '@fountain-ui/core';\n\nexport default interface FlipCardProps extends ComponentProps<{\n /**\n * Element placed on backSide\n */\n backCard: React.ReactElement;\n\n /**\n * Element placed on frontSide\n */\n frontCard: React.ReactElement;\n\n /**\n * The key to reanimate Component, usually includes card content\n */\n reanimationKey?: string;\n}> {}"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './FlipCard';\nexport type { default as FlipCardProps } from './FlipCardProps';"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './FlipCard';\nexport type { default as FlipCardProps } from './FlipCardProps';"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.useStatusBarContext = exports.StatusBarContext = void 0;
6
+ exports.useStatusBarContext = exports.default = exports.StatusBarContext = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Provider.ts"],"names":["StatusBarContext","React","createContext","useStatusBarContext","useContext","Provider"],"mappings":";;;;;;;AAAA;;;;AAUO,MAAMA,gBAAgB,gBAAGC,eAAMC,aAAN,CAAmD,IAAnD,CAAzB;;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AACrC,SAAOF,eAAMG,UAAN,CAAiBJ,gBAAjB,CAAP;AACH,CAFM;;;eAIQA,gBAAgB,CAACK,Q","sourcesContent":["import React from 'react';\nimport type { StatusBarStyle } from 'react-native';\n\nexport interface StatusBarProviderValue {\n setTranslucent: (value: boolean) => void;\n setBackgroundColor: (value: string) => void;\n setHidden: (value: boolean) => void;\n setBarStyle: (value: StatusBarStyle, animated?: boolean) => void;\n}\n\nexport const StatusBarContext = React.createContext<StatusBarProviderValue | null>(null);\n\nexport const useStatusBarContext = () => {\n return React.useContext(StatusBarContext);\n};\n\nexport default StatusBarContext.Provider;"]}
1
+ {"version":3,"names":["StatusBarContext","React","createContext","useStatusBarContext","useContext","Provider"],"sources":["Provider.ts"],"sourcesContent":["import React from 'react';\nimport type { StatusBarStyle } from 'react-native';\n\nexport interface StatusBarProviderValue {\n setTranslucent: (value: boolean) => void;\n setBackgroundColor: (value: string) => void;\n setHidden: (value: boolean) => void;\n setBarStyle: (value: StatusBarStyle, animated?: boolean) => void;\n}\n\nexport const StatusBarContext = React.createContext<StatusBarProviderValue | null>(null);\n\nexport const useStatusBarContext = () => {\n return React.useContext(StatusBarContext);\n};\n\nexport default StatusBarContext.Provider;"],"mappings":";;;;;;;AAAA;;;;AAUO,MAAMA,gBAAgB,gBAAGC,cAAA,CAAMC,aAAN,CAAmD,IAAnD,CAAzB;;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;EACrC,OAAOF,cAAA,CAAMG,UAAN,CAAiBJ,gBAAjB,CAAP;AACH,CAFM;;;eAIQA,gBAAgB,CAACK,Q"}
@@ -1 +1 @@
1
- {"version":3,"sources":["StatusBarProvider.tsx"],"names":["initialVisible","Platform","select","ios","android","StatusBarProvider","props","children","theme","defaultColor","palette","background","default","visible","setVisible","React","useState","backgroundViewColor","setBackgroundViewColor","setBackgroundColor","value","OS","RNStatusBar","setBarStyle","animated","setHidden","setTranslucent","shouldRenderBackgroundView","inset","backgroundViewStyle","backgroundColor","height","top","left","position","right","zIndex","statusBar"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;AAGA,MAAMA,cAAc,GAAGC,sBAASC,MAAT,CAAgB;AACnCC,EAAAA,GAAG,EAAE,IAD8B;AAEnCC,EAAAA,OAAO,EAAE;AAF0B,CAAhB,CAAvB;;AAKe,SAASC,iBAAT,CAA2BC,KAA3B,EAA0D;AACrE,QAAM;AAAEC,IAAAA;AAAF,MAAeD,KAArB;AAEA,QAAME,KAAK,GAAG,qBAAd;AACA,QAAMC,YAAY,GAAGD,KAAK,CAACE,OAAN,CAAcC,UAAd,CAAyBC,OAA9C;;AAEA,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBC,eAAMC,QAAN,CAAehB,cAAf,CAA9B;;AACA,QAAM,CAACiB,mBAAD,EAAsBC,sBAAtB,IAAgDH,eAAMC,QAAN,CAAeP,YAAf,CAAtD;;AAEA,QAAMU,kBAAkB,GAAIC,KAAD,IAAmB;AAC1C,QAAInB,sBAASoB,EAAT,KAAgB,SAApB,EAA+B;AAC3BC,6BAAYH,kBAAZ,CAA+BC,KAA/B;AACH;;AAED,QAAInB,sBAASoB,EAAT,KAAgB,KAApB,EAA2B;AACvBH,MAAAA,sBAAsB,CAACE,KAAD,CAAtB;AACH;AACJ,GARD;;AAUA,QAAMG,WAAW,GAAG,CAACH,KAAD,EAAwBI,QAAxB,KAA+C;AAC/DF,2BAAYC,WAAZ,CAAwBH,KAAxB,EAA+BI,QAA/B;AACH,GAFD;;AAIA,QAAMC,SAAS,GAAIL,KAAD,IAAoB;AAClC,QAAInB,sBAASoB,EAAT,KAAgB,KAApB,EAA2B;AACvBP,MAAAA,UAAU,CAAC,CAACM,KAAF,CAAV;AACH;;AAEDE,2BAAYG,SAAZ,CAAsBL,KAAtB;AACH,GAND;;AAQA,QAAMM,cAAc,GAAIN,KAAD,IAAoB;AACvC,QAAInB,sBAASoB,EAAT,KAAgB,SAApB,EAA+B;AAC3BC,6BAAYI,cAAZ,CAA2BN,KAA3B;AACH;AACJ,GAJD;;AAMA,QAAMO,0BAA0B,GAAG1B,sBAASoB,EAAT,KAAgB,KAAhB,IAAyBR,OAA5D;AAEA,QAAMe,KAAK,GAAG,oDAAd;AACA,QAAMC,mBAAmB,GAAG,iBAAI,CAC5B;AACIC,IAAAA,eAAe,EAAEb,mBADrB;AAEIc,IAAAA,MAAM,EAAEH,KAAK,CAACI,GAFlB;AAGIC,IAAAA,IAAI,EAAE,CAHV;AAIIC,IAAAA,QAAQ,EAAE,UAJd;AAKIC,IAAAA,KAAK,EAAE,CALX;AAMIH,IAAAA,GAAG,EAAE,CANT;AAOII,IAAAA,MAAM,EAAE5B,KAAK,CAAC4B,MAAN,CAAaC;AAPzB,GAD4B,CAAJ,CAA5B;AAYA,sBACI,6BAAC,iBAAD;AAAU,IAAA,KAAK,EAAE;AACblB,MAAAA,kBADa;AAEbI,MAAAA,WAFa;AAGbE,MAAAA,SAHa;AAIbC,MAAAA;AAJa;AAAjB,KAMKC,0BAA0B,gBACvB,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEE;AAAb,IADuB,GAEvB,IARR,EASKtB,QATL,CADJ;AAaH","sourcesContent":["import React from 'react';\nimport type { StatusBarStyle } from 'react-native';\nimport { Platform, StatusBar as RNStatusBar, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useTheme } from '@fountain-ui/core';\nimport { css } from '@fountain-ui/styles';\nimport Provider from './Provider';\nimport type StatusBarProviderProps from './StatusBarProviderProps';\n\nconst initialVisible = Platform.select({\n ios: true,\n android: false,\n});\n\nexport default function StatusBarProvider(props: StatusBarProviderProps) {\n const { children } = props;\n\n const theme = useTheme();\n const defaultColor = theme.palette.background.default;\n\n const [visible, setVisible] = React.useState(initialVisible);\n const [backgroundViewColor, setBackgroundViewColor] = React.useState(defaultColor);\n\n const setBackgroundColor = (value: string) => {\n if (Platform.OS === 'android') {\n RNStatusBar.setBackgroundColor(value);\n }\n\n if (Platform.OS === 'ios') {\n setBackgroundViewColor(value);\n }\n };\n\n const setBarStyle = (value: StatusBarStyle, animated?: boolean) => {\n RNStatusBar.setBarStyle(value, animated);\n };\n\n const setHidden = (value: boolean) => {\n if (Platform.OS === 'ios') {\n setVisible(!value);\n }\n\n RNStatusBar.setHidden(value);\n };\n\n const setTranslucent = (value: boolean) => {\n if (Platform.OS === 'android') {\n RNStatusBar.setTranslucent(value);\n }\n };\n\n const shouldRenderBackgroundView = Platform.OS === 'ios' && visible;\n\n const inset = useSafeAreaInsets();\n const backgroundViewStyle = css([\n {\n backgroundColor: backgroundViewColor,\n height: inset.top,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n zIndex: theme.zIndex.statusBar,\n },\n ]);\n\n return (\n <Provider value={{\n setBackgroundColor,\n setBarStyle,\n setHidden,\n setTranslucent,\n }}>\n {shouldRenderBackgroundView ? (\n <View style={backgroundViewStyle}/>\n ) : null}\n {children}\n </Provider>\n );\n}"]}
1
+ {"version":3,"names":["initialVisible","Platform","select","ios","android","StatusBarProvider","props","children","theme","useTheme","defaultColor","palette","background","default","visible","setVisible","React","useState","backgroundViewColor","setBackgroundViewColor","setBackgroundColor","value","OS","RNStatusBar","setBarStyle","animated","setHidden","setTranslucent","shouldRenderBackgroundView","inset","useSafeAreaInsets","backgroundViewStyle","css","backgroundColor","height","top","left","position","right","zIndex","statusBar"],"sources":["StatusBarProvider.tsx"],"sourcesContent":["import React from 'react';\nimport type { StatusBarStyle } from 'react-native';\nimport { Platform, StatusBar as RNStatusBar, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useTheme } from '@fountain-ui/core';\nimport { css } from '@fountain-ui/styles';\nimport Provider from './Provider';\nimport type StatusBarProviderProps from './StatusBarProviderProps';\n\nconst initialVisible = Platform.select({\n ios: true,\n android: false,\n});\n\nexport default function StatusBarProvider(props: StatusBarProviderProps) {\n const { children } = props;\n\n const theme = useTheme();\n const defaultColor = theme.palette.background.default;\n\n const [visible, setVisible] = React.useState(initialVisible);\n const [backgroundViewColor, setBackgroundViewColor] = React.useState(defaultColor);\n\n const setBackgroundColor = (value: string) => {\n if (Platform.OS === 'android') {\n RNStatusBar.setBackgroundColor(value);\n }\n\n if (Platform.OS === 'ios') {\n setBackgroundViewColor(value);\n }\n };\n\n const setBarStyle = (value: StatusBarStyle, animated?: boolean) => {\n RNStatusBar.setBarStyle(value, animated);\n };\n\n const setHidden = (value: boolean) => {\n if (Platform.OS === 'ios') {\n setVisible(!value);\n }\n\n RNStatusBar.setHidden(value);\n };\n\n const setTranslucent = (value: boolean) => {\n if (Platform.OS === 'android') {\n RNStatusBar.setTranslucent(value);\n }\n };\n\n const shouldRenderBackgroundView = Platform.OS === 'ios' && visible;\n\n const inset = useSafeAreaInsets();\n const backgroundViewStyle = css([\n {\n backgroundColor: backgroundViewColor,\n height: inset.top,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n zIndex: theme.zIndex.statusBar,\n },\n ]);\n\n return (\n <Provider value={{\n setBackgroundColor,\n setBarStyle,\n setHidden,\n setTranslucent,\n }}>\n {shouldRenderBackgroundView ? (\n <View style={backgroundViewStyle}/>\n ) : null}\n {children}\n </Provider>\n );\n}"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;AAGA,MAAMA,cAAc,GAAGC,qBAAA,CAASC,MAAT,CAAgB;EACnCC,GAAG,EAAE,IAD8B;EAEnCC,OAAO,EAAE;AAF0B,CAAhB,CAAvB;;AAKe,SAASC,iBAAT,CAA2BC,KAA3B,EAA0D;EACrE,MAAM;IAAEC;EAAF,IAAeD,KAArB;EAEA,MA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rB;IAEIgB,MAAM,EAAEL,KAAK,CAACM,GAFlB;IAGIC,IAAI,EAAE,CAHV;IAIIC,QAAQ,EAAE,UAJd;IAKIC,KAAK,EAAE,CALX;IAMIH,GAAG,EAAE,CANT;IAOII,MAAM,EAAE/B,KAAK,CAAC+B,MAAN,CAAaC;EAPzB,CAD4B,CAAJ,CAA5B;EAYA,oBACI,6BAAC,iBAAD;IAAU,KAAK,EAAE;MACbpB,kBADa;MAEbI,WAFa;MAGbE,SAHa;MAIbC;IAJa;EAAjB,GAMKC,0BAA0B,gBACvB,6BAAC,iBAAD;IAAM,KAAK,EAAEG;EAAb,EADuB,GAEvB,IARR,EASKxB,QATL,CADJ;AAaH"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sources":["StatusBarProviderProps.ts"],"sourcesContent":["import React from 'react';\n\nexport default interface StatusBarProviderProp {\n /**\n * The screens where the statusbar will be visible.\n */\n children: React.ReactNode;\n}"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { default } from './StatusBarProvider';\nexport { useStatusBarContext } from './Provider';\nexport type { default as StatusBarProviderProps } from './StatusBarProviderProps';"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './StatusBarProvider';\nexport { useStatusBarContext } from './Provider';\nexport type { default as StatusBarProviderProps } from './StatusBarProviderProps';"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
@@ -5,44 +5,112 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var _reactNativeReanimated = require("react-native-reanimated");
13
13
 
14
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
14
+ var _core = require("@fountain-ui/core");
15
15
 
16
- const Page = function Page(props) {
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
20
+ const OFFSCREEN_RERENDER_LIMIT = 1;
21
+
22
+ const styles = _core.StyleSheet.create({
23
+ none: {
24
+ display: 'none'
25
+ }
26
+ });
27
+
28
+ function Page(props) {
17
29
  const {
18
- isVisible,
19
- ...otherProps
30
+ index,
31
+ children,
32
+ loading,
33
+ sharedIndex
20
34
  } = props;
21
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
22
- collapsable: false
23
- }, otherProps));
24
- };
25
35
 
26
- var _default = /*#__PURE__*/_react.default.memo(Page, (prevProps, nextProps) => {
27
- if (prevProps.children === null && nextProps.children === null) {
28
- return true;
29
- } // isVisible is an important condition for determining memos on the web.
30
- // Reference ViewPagerWeb's return.
36
+ const assumeInitialPageState = () => {
37
+ const activeIndex = sharedIndex.value;
38
+ const active = index === activeIndex;
31
39
 
40
+ if (_reactNative.Platform.OS === 'web') {
41
+ return {
42
+ active,
43
+ visited: active
44
+ };
45
+ }
32
46
 
33
- if (prevProps.isVisible !== nextProps.isVisible) {
34
- return false;
35
- }
47
+ if (loading === 'eager') {
48
+ return {
49
+ active,
50
+ visited: true
51
+ };
52
+ }
36
53
 
37
- if (nextProps.isVisible || nextProps.isNeighbor) {
38
- return false;
39
- }
54
+ const visited = index >= activeIndex - OFFSCREEN_RERENDER_LIMIT && index <= activeIndex + OFFSCREEN_RERENDER_LIMIT;
55
+ return {
56
+ active,
57
+ visited
58
+ };
59
+ };
60
+
61
+ const [pageState, setPageState] = (0, _react.useState)(assumeInitialPageState);
62
+ const content = pageState.visited ? children : null;
63
+
64
+ const updatePageState = (active, neighbor) => {
65
+ setPageState(prevState => {
66
+ if (prevState.active !== active) {
67
+ return {
68
+ active,
69
+ visited: active || prevState.visited
70
+ };
71
+ }
72
+
73
+ if (neighbor && !prevState.visited) {
74
+ return { ...prevState,
75
+ visited: true
76
+ };
77
+ }
78
+
79
+ return prevState;
80
+ });
81
+ };
82
+
83
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => {
84
+ const activeIndex = sharedIndex.value;
85
+ const willVisible = index >= activeIndex - OFFSCREEN_RERENDER_LIMIT && index <= activeIndex + OFFSCREEN_RERENDER_LIMIT;
86
+ const willActive = index === activeIndex;
87
+ const willNeighbor = _reactNative.Platform.OS === 'web' ? false : willVisible && !willActive;
88
+ return {
89
+ willActive,
90
+ willNeighbor
91
+ };
92
+ }, (nextState, prevState) => {
93
+ const activeStateChanged = nextState.willActive !== (prevState === null || prevState === void 0 ? void 0 : prevState.willActive);
94
+ const willNewNeighbor = nextState.willNeighbor && !(prevState !== null && prevState !== void 0 && prevState.willNeighbor);
95
+
96
+ if (activeStateChanged || willNewNeighbor) {
97
+ (0, _reactNativeReanimated.runOnJS)(updatePageState)(nextState.willActive, nextState.willNeighbor);
98
+ }
99
+ }, [index]);
100
+ const style = _reactNative.Platform.OS === 'web' ? pageState.active ? _core.StyleSheet.absoluteFill : styles.none : undefined;
101
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
102
+ children: content,
103
+ collapsable: false,
104
+ style: style
105
+ });
106
+ }
40
107
 
108
+ var _default = /*#__PURE__*/(0, _react.memo)(Page, (prevProps, nextProps) => {
41
109
  if (prevProps.rerenderKey !== nextProps.rerenderKey) {
42
110
  return false;
43
111
  }
44
112
 
45
- return prevProps.children !== null && nextProps.children !== null;
113
+ return prevProps.index !== nextProps.index;
46
114
  });
47
115
 
48
116
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["ChildrenMemoizedPage.tsx"],"names":["Page","props","isVisible","otherProps","React","memo","prevProps","nextProps","children","isNeighbor","rerenderKey"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAGA,MAAMA,IAAI,GAAG,SAASA,IAAT,CAAcC,KAAd,EAAgC;AACzC,QAAM;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,MAA+BF,KAArC;AAEA,sBACI,6BAAC,iBAAD;AACI,IAAA,WAAW,EAAE;AADjB,KAEQE,UAFR,EADJ;AAMH,CATD;;4BAWeC,eAAMC,IAAN,CAAWL,IAAX,EAAiB,CAACM,SAAD,EAAYC,SAAZ,KAA0B;AACtD,MAAID,SAAS,CAACE,QAAV,KAAuB,IAAvB,IAA+BD,SAAS,CAACC,QAAV,KAAuB,IAA1D,EAAgE;AAC5D,WAAO,IAAP;AACH,GAHqD,CAKtD;AACA;;;AACA,MAAIF,SAAS,CAACJ,SAAV,KAAwBK,SAAS,CAACL,SAAtC,EAAiD;AAC7C,WAAO,KAAP;AACH;;AAED,MAAIK,SAAS,CAACL,SAAV,IAAuBK,SAAS,CAACE,UAArC,EAAiD;AAC7C,WAAO,KAAP;AACH;;AAED,MAAIH,SAAS,CAACI,WAAV,KAA0BH,SAAS,CAACG,WAAxC,EAAqD;AACjD,WAAO,KAAP;AACH;;AAED,SAAOJ,SAAS,CAACE,QAAV,KAAuB,IAAvB,IAA+BD,SAAS,CAACC,QAAV,KAAuB,IAA7D;AACH,CApBc,C","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport type { PageProps } from './ViewPagerProps';\n\nconst Page = function Page(props: PageProps) {\n const { isVisible, ...otherProps } = props;\n\n return (\n <View\n collapsable={false}\n {...otherProps}\n />\n );\n};\n\nexport default React.memo(Page, (prevProps, nextProps) => {\n if (prevProps.children === null && nextProps.children === null) {\n return true;\n }\n\n // isVisible is an important condition for determining memos on the web.\n // Reference ViewPagerWeb's return.\n if (prevProps.isVisible !== nextProps.isVisible) {\n return false;\n }\n\n if (nextProps.isVisible || nextProps.isNeighbor) {\n return false;\n }\n\n if (prevProps.rerenderKey !== nextProps.rerenderKey) {\n return false;\n }\n\n return prevProps.children !== null && nextProps.children !== null;\n});\n"]}
1
+ {"version":3,"names":["OFFSCREEN_RERENDER_LIMIT","styles","StyleSheet","create","none","display","Page","props","index","children","loading","sharedIndex","assumeInitialPageState","activeIndex","value","active","Platform","OS","visited","pageState","setPageState","useState","content","updatePageState","neighbor","prevState","useAnimatedReaction","willVisible","willActive","willNeighbor","nextState","activeStateChanged","willNewNeighbor","runOnJS","style","absoluteFill","undefined","memo","prevProps","nextProps","rerenderKey"],"sources":["ChildrenMemoizedPage.tsx"],"sourcesContent":["import React, { memo, useState } from 'react';\nimport { Platform, View } from 'react-native';\nimport { runOnJS, useAnimatedReaction } from 'react-native-reanimated';\nimport { StyleSheet } from '@fountain-ui/core';\nimport type { PageProps } from './ViewPagerProps';\n\nconst OFFSCREEN_RERENDER_LIMIT = 1;\n\nconst styles = StyleSheet.create({\n none: { display: 'none' },\n});\n\ninterface PageState {\n active: boolean;\n visited: boolean;\n}\n\nfunction Page(props: PageProps) {\n const {\n index,\n children,\n loading,\n sharedIndex,\n } = props;\n\n const assumeInitialPageState = (): PageState => {\n const activeIndex = sharedIndex.value;\n\n const active = index === activeIndex;\n\n if (Platform.OS === 'web') {\n return { active, visited: active };\n }\n\n if (loading === 'eager') {\n return { active, visited: true };\n }\n\n const visited = index >= activeIndex - OFFSCREEN_RERENDER_LIMIT\n && index <= activeIndex + OFFSCREEN_RERENDER_LIMIT;\n\n return { active, visited };\n };\n\n const [pageState, setPageState] = useState<PageState>(assumeInitialPageState);\n\n const content = pageState.visited ? children : null;\n\n const updatePageState = (active: boolean, neighbor: boolean) => {\n setPageState(prevState => {\n if (prevState.active !== active) {\n return { active, visited: active || prevState.visited };\n }\n\n if (neighbor && !prevState.visited) {\n return { ...prevState, visited: true };\n }\n\n return prevState;\n });\n };\n\n useAnimatedReaction(\n () => {\n const activeIndex = sharedIndex.value;\n\n const willVisible = index >= activeIndex - OFFSCREEN_RERENDER_LIMIT\n && index <= activeIndex + OFFSCREEN_RERENDER_LIMIT;\n\n const willActive = index === activeIndex;\n const willNeighbor = Platform.OS === 'web' ? false : (willVisible && !willActive);\n\n return { willActive, willNeighbor };\n },\n (nextState, prevState) => {\n const activeStateChanged = nextState.willActive !== prevState?.willActive;\n const willNewNeighbor = nextState.willNeighbor && !prevState?.willNeighbor;\n\n if (activeStateChanged || willNewNeighbor) {\n runOnJS(updatePageState)(nextState.willActive, nextState.willNeighbor);\n }\n },\n [index],\n );\n\n const style = Platform.OS === 'web'\n ? (pageState.active ? StyleSheet.absoluteFill : styles.none)\n : undefined;\n\n return (\n <View\n children={content}\n collapsable={false}\n style={style}\n />\n );\n}\n\nexport default memo(Page, (prevProps, nextProps) => {\n if (prevProps.rerenderKey !== nextProps.rerenderKey) {\n return false;\n }\n\n return prevProps.index !== nextProps.index;\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMA,wBAAwB,GAAG,CAAjC;;AAEA,MAAMC,MAAM,GAAGC,gBAAA,CAAWC,MAAX,CAAkB;EAC7BC,IAAI,EAAE;I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