@draftbit/core 46.4.4-c5d4b3.2 → 46.4.4-caab07.0

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 (372) hide show
  1. package/lib/commonjs/Provider.js.map +1 -1
  2. package/lib/commonjs/components/ActionSheet/ActionSheet.js.map +1 -1
  3. package/lib/commonjs/components/ActionSheet/ActionSheetCancel.js.map +1 -1
  4. package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
  5. package/lib/commonjs/components/AvatarEdit.js +15 -4
  6. package/lib/commonjs/components/AvatarEdit.js.map +1 -1
  7. package/lib/commonjs/components/Banner.js +23 -4
  8. package/lib/commonjs/components/Banner.js.map +1 -1
  9. package/lib/commonjs/components/CardBlock.js +13 -4
  10. package/lib/commonjs/components/CardContainer.js +14 -4
  11. package/lib/commonjs/components/CardContainer.js.map +1 -1
  12. package/lib/commonjs/components/Carousel.js +2 -2
  13. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +22 -5
  14. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
  15. package/lib/commonjs/components/Checkbox/CheckboxRow.js.map +1 -1
  16. package/lib/commonjs/components/Checkbox/index.js.map +1 -1
  17. package/lib/commonjs/components/CircleImage.js +16 -2
  18. package/lib/commonjs/components/Config.js.map +1 -1
  19. package/lib/commonjs/components/DatePicker/DatePicker.js +43 -21
  20. package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
  21. package/lib/commonjs/components/DatePicker/DatePickerComponent.js.map +1 -1
  22. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
  23. package/lib/commonjs/components/DeprecatedButton.js +19 -3
  24. package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
  25. package/lib/commonjs/components/Divider.js +12 -1
  26. package/lib/commonjs/components/Divider.js.map +1 -1
  27. package/lib/commonjs/components/FAB.js +19 -4
  28. package/lib/commonjs/components/FAB.js.map +1 -1
  29. package/lib/commonjs/components/FieldSearchBarFull.js.map +1 -1
  30. package/lib/commonjs/components/FormRow.js +17 -3
  31. package/lib/commonjs/components/FormRow.js.map +1 -1
  32. package/lib/commonjs/components/Header.js.map +1 -1
  33. package/lib/commonjs/components/HeaderLarge.js.map +1 -1
  34. package/lib/commonjs/components/Image.js +16 -2
  35. package/lib/commonjs/components/Picker/Picker.js +7 -7
  36. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  37. package/lib/commonjs/components/Picker/PickerComponent.android.js +19 -5
  38. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
  39. package/lib/commonjs/components/Picker/PickerComponent.ios.js +30 -11
  40. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -1
  41. package/lib/commonjs/components/Portal/PortalHost.js +45 -15
  42. package/lib/commonjs/components/Portal/PortalHost.js.map +1 -1
  43. package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
  44. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +10 -1
  45. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js.map +1 -1
  46. package/lib/commonjs/components/ResizeMode.js +2 -1
  47. package/lib/commonjs/components/RowBodyIcon.js.map +1 -1
  48. package/lib/commonjs/components/RowHeadlineImageCaption.js.map +1 -1
  49. package/lib/commonjs/components/ScreenContainer.js +20 -4
  50. package/lib/commonjs/components/ScreenContainer.js.map +1 -1
  51. package/lib/commonjs/components/Stepper.js +1 -0
  52. package/lib/commonjs/components/Stepper.js.map +1 -1
  53. package/lib/commonjs/components/Surface.js +13 -2
  54. package/lib/commonjs/components/Swiper/index.js.map +1 -1
  55. package/lib/commonjs/components/Text.js +50 -4
  56. package/lib/commonjs/components/TextField.js +76 -28
  57. package/lib/commonjs/components/ToggleButton.js +14 -2
  58. package/lib/commonjs/components/ToggleButton.js.map +1 -1
  59. package/lib/commonjs/components/Typography.js.map +1 -1
  60. package/lib/commonjs/index.js.map +1 -1
  61. package/lib/commonjs/interfaces/Icon.js.map +1 -1
  62. package/lib/commonjs/mappings/AccordionItem.js.map +1 -1
  63. package/lib/commonjs/mappings/ActionSheet.js.map +1 -1
  64. package/lib/commonjs/mappings/ActionSheetItem.js.map +1 -1
  65. package/lib/commonjs/mappings/AudioPlayer.js.map +1 -1
  66. package/lib/commonjs/mappings/AvatarEdit.js.map +1 -1
  67. package/lib/commonjs/mappings/BlurView.js.map +1 -1
  68. package/lib/commonjs/mappings/Card.js.map +1 -1
  69. package/lib/commonjs/mappings/CardInline.js.map +1 -1
  70. package/lib/commonjs/mappings/Carousel.js.map +1 -1
  71. package/lib/commonjs/mappings/CheckboxRow.js.map +1 -1
  72. package/lib/commonjs/mappings/DatePicker.js +13 -0
  73. package/lib/commonjs/mappings/DatePicker.js.map +1 -1
  74. package/lib/commonjs/mappings/Fetch.js.map +1 -1
  75. package/lib/commonjs/mappings/FieldSearchBarFull.js +1 -1
  76. package/lib/commonjs/mappings/FieldSearchBarFull.js.map +1 -1
  77. package/lib/commonjs/mappings/HeaderLarge.js.map +1 -1
  78. package/lib/commonjs/mappings/HeaderMedium.js.map +1 -1
  79. package/lib/commonjs/mappings/ProgressCircle.js.map +1 -1
  80. package/lib/commonjs/mappings/ProgressIndicator.js.map +1 -1
  81. package/lib/commonjs/mappings/RadioButton.js.map +1 -1
  82. package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
  83. package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
  84. package/lib/commonjs/mappings/RowHeadlineImageCaption.js.map +1 -1
  85. package/lib/commonjs/mappings/Stepper.js.map +1 -1
  86. package/lib/commonjs/mappings/Surface.js.map +1 -1
  87. package/lib/commonjs/mappings/Swiper.js.map +1 -1
  88. package/lib/commonjs/mappings/SwiperItem.js.map +1 -1
  89. package/lib/commonjs/mappings/Switch.js.map +1 -1
  90. package/lib/commonjs/mappings/TextArea.js.map +1 -1
  91. package/lib/commonjs/mappings/TextField.js.map +1 -1
  92. package/lib/commonjs/mappings/View.js.map +1 -1
  93. package/lib/commonjs/utilities.js +1 -2
  94. package/lib/commonjs/utilities.js.map +1 -1
  95. package/lib/module/components/Accordion/index.js.map +1 -1
  96. package/lib/module/components/ActionSheet/ActionSheet.js.map +1 -1
  97. package/lib/module/components/ActionSheet/ActionSheetItem.js.map +1 -1
  98. package/lib/module/components/Banner.js.map +1 -1
  99. package/lib/module/components/Button.js.map +1 -1
  100. package/lib/module/components/Card.js.map +1 -1
  101. package/lib/module/components/CardBlock.js +14 -4
  102. package/lib/module/components/CardBlock.js.map +1 -1
  103. package/lib/module/components/CardContainerShortImage.js +16 -4
  104. package/lib/module/components/CardContainerShortImage.js.map +1 -1
  105. package/lib/module/components/Carousel.js +27 -9
  106. package/lib/module/components/Carousel.js.map +1 -1
  107. package/lib/module/components/Checkbox/CheckboxGroup.js +17 -2
  108. package/lib/module/components/Checkbox/CheckboxGroup.js.map +1 -1
  109. package/lib/module/components/Checkbox/index.js.map +1 -1
  110. package/lib/module/components/Container.js +16 -4
  111. package/lib/module/components/Container.js.map +1 -1
  112. package/lib/module/components/DatePicker/DatePicker.js +44 -21
  113. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  114. package/lib/module/components/DatePicker/DatePickerComponent.js.map +1 -1
  115. package/lib/module/components/DatePicker/DatePickerComponentType.js.map +1 -1
  116. package/lib/module/components/DeprecatedFAB.js +21 -3
  117. package/lib/module/components/Elevation.js +15 -2
  118. package/lib/module/components/Elevation.js.map +1 -1
  119. package/lib/module/components/HeaderLarge.js.map +1 -1
  120. package/lib/module/components/HeaderMedium.js.map +1 -1
  121. package/lib/module/components/Justification.js +2 -2
  122. package/lib/module/components/Layout.js +41 -21
  123. package/lib/module/components/Layout.js.map +1 -1
  124. package/lib/module/components/NumberInput.js.map +1 -1
  125. package/lib/module/components/Picker/Picker.js +2 -2
  126. package/lib/module/components/Picker/Picker.js.map +1 -1
  127. package/lib/module/components/Picker/PickerComponent.android.js +19 -4
  128. package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
  129. package/lib/module/components/Picker/PickerComponent.ios.js +32 -11
  130. package/lib/module/components/Picker/PickerComponent.web.js +20 -4
  131. package/lib/module/components/Picker/PickerTypes.js.map +1 -1
  132. package/lib/module/components/Portal/PortalHost.js +45 -15
  133. package/lib/module/components/Portal/PortalHost.js.map +1 -1
  134. package/lib/module/components/Portal/PortalManager.js +34 -7
  135. package/lib/module/components/ProgressBar.js +38 -7
  136. package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +10 -1
  137. package/lib/module/components/RadioButton/RadioButtonFieldGroup.js.map +1 -1
  138. package/lib/module/components/RadioButton/RadioButtonRow.js +23 -6
  139. package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
  140. package/lib/module/components/Row.js.map +1 -1
  141. package/lib/module/components/RowBodyIcon.js.map +1 -1
  142. package/lib/module/components/SVG.js.map +1 -1
  143. package/lib/module/components/ScreenContainer.js +20 -4
  144. package/lib/module/components/ScreenContainer.js.map +1 -1
  145. package/lib/module/components/Stepper.js +2 -2
  146. package/lib/module/components/Stepper.js.map +1 -1
  147. package/lib/module/components/Surface.js +15 -1
  148. package/lib/module/components/Swiper/Swiper.js.map +1 -1
  149. package/lib/module/components/Swiper/SwiperItem.js.map +1 -1
  150. package/lib/module/components/Switch.js +20 -10
  151. package/lib/module/components/Switch.js.map +1 -1
  152. package/lib/module/components/Text.js +50 -4
  153. package/lib/module/components/TextField.js +78 -28
  154. package/lib/module/components/TextField.js.map +1 -1
  155. package/lib/module/components/ToggleButton.js +16 -2
  156. package/lib/module/components/ToggleButton.js.map +1 -1
  157. package/lib/module/constants.js +1 -1
  158. package/lib/module/hooks.js +1 -3
  159. package/lib/module/mappings/Accordion.js.map +1 -1
  160. package/lib/module/mappings/AccordionItem.js.map +1 -1
  161. package/lib/module/mappings/ActionSheetCancel.js.map +1 -1
  162. package/lib/module/mappings/AudioPlayer.js.map +1 -1
  163. package/lib/module/mappings/Banner.js.map +1 -1
  164. package/lib/module/mappings/Button.js.map +1 -1
  165. package/lib/module/mappings/Card.js.map +1 -1
  166. package/lib/module/mappings/CardContainer.js.map +1 -1
  167. package/lib/module/mappings/CardInline.js.map +1 -1
  168. package/lib/module/mappings/Carousel.js.map +1 -1
  169. package/lib/module/mappings/CustomCode.js.map +1 -1
  170. package/lib/module/mappings/DatePicker.js +14 -1
  171. package/lib/module/mappings/DatePicker.js.map +1 -1
  172. package/lib/module/mappings/Divider.js.map +1 -1
  173. package/lib/module/mappings/FAB.js.map +1 -1
  174. package/lib/module/mappings/KeyboardAwareScrollView.js.map +1 -1
  175. package/lib/module/mappings/MapCallout.js.map +1 -1
  176. package/lib/module/mappings/MapMarker.js.map +1 -1
  177. package/lib/module/mappings/Modal.js.map +1 -1
  178. package/lib/module/mappings/RadioButton.js.map +1 -1
  179. package/lib/module/mappings/RowHeadlineImageIcon.js.map +1 -1
  180. package/lib/module/mappings/SVG.js.map +1 -1
  181. package/lib/module/mappings/SafeAreaView.js.map +1 -1
  182. package/lib/module/mappings/ScrollView.js.map +1 -1
  183. package/lib/module/mappings/SwiperItem.js.map +1 -1
  184. package/lib/module/mappings/Text.js.map +1 -1
  185. package/lib/module/mappings/TextArea.js.map +1 -1
  186. package/lib/module/mappings/Video.js.map +1 -1
  187. package/lib/module/styles/DarkTheme.js.map +1 -1
  188. package/lib/module/styles/DefaultTheme.js.map +1 -1
  189. package/lib/module/styles/fonts.js.map +1 -1
  190. package/lib/module/theming.js.map +1 -1
  191. package/lib/module/utilities.js +1 -2
  192. package/lib/module/utilities.js.map +1 -1
  193. package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
  194. package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
  195. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  196. package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
  197. package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
  198. package/package.json +3 -3
  199. package/src/Provider.js +11 -4
  200. package/src/components/Accordion/AccordionGroup.js +80 -36
  201. package/src/components/Accordion/AccordionItem.js +51 -24
  202. package/src/components/ActionSheet/ActionSheet.js +60 -35
  203. package/src/components/ActionSheet/ActionSheetCancel.js +7 -2
  204. package/src/components/ActionSheet/ActionSheetItem.js +35 -24
  205. package/src/components/AnimatedCircularProgress.js +57 -38
  206. package/src/components/AspectRatio.js +21 -13
  207. package/src/components/AvatarEdit.js +46 -23
  208. package/src/components/Banner.js +151 -99
  209. package/src/components/Button.js +152 -97
  210. package/src/components/Card.js +126 -45
  211. package/src/components/CardBlock.js +109 -46
  212. package/src/components/CardContainer.js +140 -58
  213. package/src/components/CardContainerRating.js +152 -67
  214. package/src/components/CardContainerShortImage.js +80 -25
  215. package/src/components/CardInline.js +64 -25
  216. package/src/components/Carousel.js +99 -58
  217. package/src/components/Carousel.tsx +2 -2
  218. package/src/components/Checkbox/Checkbox.js +93 -55
  219. package/src/components/Checkbox/CheckboxGroup.js +28 -15
  220. package/src/components/Checkbox/CheckboxGroupRow.js +104 -59
  221. package/src/components/Checkbox/CheckboxRow.js +107 -61
  222. package/src/components/Checkbox/context.js +6 -6
  223. package/src/components/CircleImage.js +14 -4
  224. package/src/components/CircularProgress.js +146 -75
  225. package/src/components/Config.js +59 -52
  226. package/src/components/Container.js +80 -38
  227. package/src/components/DatePicker/DatePicker.js +480 -337
  228. package/src/components/DatePicker/DatePicker.tsx +23 -7
  229. package/src/components/DatePicker/DatePickerComponent.js +21 -7
  230. package/src/components/DatePicker/DatePickerComponent.web.js +48 -22
  231. package/src/components/DeprecatedButton.js +136 -82
  232. package/src/components/DeprecatedCardWrapper.js +19 -10
  233. package/src/components/DeprecatedFAB.js +146 -101
  234. package/src/components/Divider.js +10 -7
  235. package/src/components/Elevation.js +24 -13
  236. package/src/components/FAB.js +84 -38
  237. package/src/components/FieldSearchBarFull.js +83 -46
  238. package/src/components/FormRow.js +28 -12
  239. package/src/components/Header.js +79 -35
  240. package/src/components/HeaderLarge.js +19 -2
  241. package/src/components/HeaderMedium.js +19 -2
  242. package/src/components/HeaderOverline.js +20 -2
  243. package/src/components/IconButton.js +68 -29
  244. package/src/components/Image.js +52 -38
  245. package/src/components/Layout.js +99 -38
  246. package/src/components/NumberInput.js +46 -42
  247. package/src/components/Picker/Picker.js +411 -238
  248. package/src/components/Picker/Picker.tsx +2 -2
  249. package/src/components/Picker/PickerComponent.android.js +110 -57
  250. package/src/components/Picker/PickerComponent.ios.js +131 -63
  251. package/src/components/Picker/PickerComponent.web.js +111 -58
  252. package/src/components/Portal/Portal.js +10 -5
  253. package/src/components/Portal/PortalConsumer.js +25 -23
  254. package/src/components/Portal/PortalHost.js +83 -72
  255. package/src/components/Portal/PortalManager.js +38 -25
  256. package/src/components/ProgressBar.js +139 -111
  257. package/src/components/ProgressCircle.js +40 -7
  258. package/src/components/ProgressIndicator.js +43 -22
  259. package/src/components/RadioButton/RadioButton.js +37 -10
  260. package/src/components/RadioButton/RadioButtonFieldGroup.js +26 -10
  261. package/src/components/RadioButton/RadioButtonGroup.js +53 -35
  262. package/src/components/RadioButton/RadioButtonRow.js +105 -58
  263. package/src/components/RadioButton/context.js +6 -6
  264. package/src/components/Row.js +81 -41
  265. package/src/components/RowBodyIcon.js +24 -2
  266. package/src/components/RowHeadlineImageCaption.js +30 -6
  267. package/src/components/RowHeadlineImageIcon.js +34 -8
  268. package/src/components/SVG.js +27 -7
  269. package/src/components/ScreenContainer.js +56 -27
  270. package/src/components/Slider.js +95 -49
  271. package/src/components/StarRating.js +85 -44
  272. package/src/components/StepIndicator.js +416 -328
  273. package/src/components/Stepper.js +74 -32
  274. package/src/components/Stepper.tsx +1 -1
  275. package/src/components/Surface.js +40 -25
  276. package/src/components/Swiper/Swiper.js +49 -18
  277. package/src/components/Swiper/SwiperItem.js +5 -4
  278. package/src/components/Switch.js +102 -46
  279. package/src/components/Text.js +37 -23
  280. package/src/components/TextField.js +515 -398
  281. package/src/components/ToggleButton.js +56 -31
  282. package/src/components/Touchable.js +25 -9
  283. package/src/components/Typography.js +45 -27
  284. package/src/components/useAuthState.js +27 -27
  285. package/src/constants.js +7 -5
  286. package/src/hooks.js +9 -9
  287. package/src/index.js +19 -3
  288. package/src/interfaces/Icon.js +2 -1
  289. package/src/mappings/Accordion.js +47 -39
  290. package/src/mappings/AccordionItem.js +19 -14
  291. package/src/mappings/ActionSheet.js +10 -10
  292. package/src/mappings/ActionSheetCancel.js +24 -17
  293. package/src/mappings/ActionSheetItem.js +28 -21
  294. package/src/mappings/ActivityIndicator.js +64 -55
  295. package/src/mappings/AudioPlayer.js +23 -17
  296. package/src/mappings/AvatarEdit.js +40 -34
  297. package/src/mappings/Banner.js +37 -30
  298. package/src/mappings/BlurView.js +46 -38
  299. package/src/mappings/Button.js +86 -77
  300. package/src/mappings/Card.js +61 -50
  301. package/src/mappings/CardBlock.js +125 -114
  302. package/src/mappings/CardContainer.js +108 -98
  303. package/src/mappings/CardContainerRating.js +126 -117
  304. package/src/mappings/CardContainerShortImage.js +125 -116
  305. package/src/mappings/CardInline.js +57 -49
  306. package/src/mappings/Carousel.js +21 -16
  307. package/src/mappings/Checkbox.js +54 -44
  308. package/src/mappings/CheckboxGroup.js +34 -24
  309. package/src/mappings/CheckboxRow.js +71 -59
  310. package/src/mappings/CircleImage.js +29 -22
  311. package/src/mappings/Container.js +37 -27
  312. package/src/mappings/CustomCode.js +5 -5
  313. package/src/mappings/DatePicker.js +181 -149
  314. package/src/mappings/DatePicker.ts +23 -0
  315. package/src/mappings/Divider.js +30 -24
  316. package/src/mappings/FAB.js +45 -35
  317. package/src/mappings/Fetch.js +10 -9
  318. package/src/mappings/FieldSearchBarFull.js +55 -47
  319. package/src/mappings/FlashList.js +38 -31
  320. package/src/mappings/FlatList.js +27 -22
  321. package/src/mappings/HeaderLarge.js +34 -26
  322. package/src/mappings/HeaderMedium.js +59 -52
  323. package/src/mappings/HeaderOverline.js +59 -52
  324. package/src/mappings/Icon.js +36 -29
  325. package/src/mappings/IconButton.js +43 -33
  326. package/src/mappings/Image.js +40 -32
  327. package/src/mappings/ImageBackground.js +38 -27
  328. package/src/mappings/KeyboardAvoidingView.js +46 -38
  329. package/src/mappings/KeyboardAwareScrollView.js +60 -48
  330. package/src/mappings/Layout.js +198 -192
  331. package/src/mappings/LinearGradient.js +79 -74
  332. package/src/mappings/MapCallout.js +27 -19
  333. package/src/mappings/MapMarker.js +53 -45
  334. package/src/mappings/MapView.js +146 -135
  335. package/src/mappings/Modal.js +47 -39
  336. package/src/mappings/NumberInput.js +247 -229
  337. package/src/mappings/Picker.js +153 -140
  338. package/src/mappings/ProgressBar.js +106 -98
  339. package/src/mappings/ProgressCircle.js +112 -105
  340. package/src/mappings/ProgressIndicator.js +186 -178
  341. package/src/mappings/RadioButton.js +59 -49
  342. package/src/mappings/RadioButtonGroup.js +21 -15
  343. package/src/mappings/RadioButtonRow.js +48 -40
  344. package/src/mappings/RowBodyIcon.js +77 -71
  345. package/src/mappings/RowHeadlineImageCaption.js +171 -161
  346. package/src/mappings/RowHeadlineImageIcon.js +98 -84
  347. package/src/mappings/SVG.js +22 -18
  348. package/src/mappings/SafeAreaView.js +35 -30
  349. package/src/mappings/ScrollView.js +36 -29
  350. package/src/mappings/Slider.js +67 -58
  351. package/src/mappings/StarRating.js +49 -41
  352. package/src/mappings/Stepper.js +34 -26
  353. package/src/mappings/Surface.js +16 -12
  354. package/src/mappings/Swiper.js +65 -58
  355. package/src/mappings/SwiperItem.js +5 -5
  356. package/src/mappings/Switch.js +87 -76
  357. package/src/mappings/Text.js +265 -242
  358. package/src/mappings/TextArea.js +273 -259
  359. package/src/mappings/TextField.js +379 -358
  360. package/src/mappings/TextInput.js +388 -362
  361. package/src/mappings/ToggleButton.js +60 -48
  362. package/src/mappings/Touchable.js +20 -15
  363. package/src/mappings/Video.js +92 -79
  364. package/src/mappings/View.js +225 -204
  365. package/src/mappings/WebView.js +104 -86
  366. package/src/styles/DarkTheme.js +17 -17
  367. package/src/styles/DefaultTheme.js +103 -103
  368. package/src/styles/fonts.js +55 -55
  369. package/src/styles/overlay.js +50 -49
  370. package/src/styles/shadow.js +43 -44
  371. package/src/theming.js +2 -1
  372. package/src/utilities.js +97 -76
@@ -1,368 +1,511 @@
1
1
  import * as React from "react";
2
- import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, } from "react-native";
2
+ import {
3
+ View,
4
+ Animated,
5
+ Text,
6
+ StyleSheet,
7
+ I18nManager,
8
+ TextInput as NativeTextInput,
9
+ } from "react-native";
3
10
  import { useSafeAreaInsets } from "react-native-safe-area-context";
4
11
  import dateFormat from "dateformat";
5
12
  import { withTheme } from "../../theming";
6
13
  import Portal from "../Portal/Portal";
7
14
  import Touchable from "../Touchable";
8
15
  import DateTimePicker from "./DatePickerComponent";
16
+ import { extractStyles } from "../../utilities";
9
17
  const AnimatedText = Animated.createAnimatedComponent(Text);
10
18
  const FOCUS_ANIMATION_DURATION = 150;
11
19
  const BLUR_ANIMATION_DURATION = 180;
12
20
  const ICON_SIZE = 24;
13
21
  const MONTHS = [
14
- "January",
15
- "February",
16
- "March",
17
- "April",
18
- "May",
19
- "June",
20
- "July",
21
- "August",
22
- "September",
23
- "October",
24
- "November",
25
- "December",
22
+ "January",
23
+ "February",
24
+ "March",
25
+ "April",
26
+ "May",
27
+ "June",
28
+ "July",
29
+ "August",
30
+ "September",
31
+ "October",
32
+ "November",
33
+ "December",
26
34
  ];
27
- const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, placeholder, ...props }) => {
28
- const [value, setValue] = React.useState(date || defaultValue);
29
- React.useEffect(() => {
30
- if (defaultValue != null) {
31
- setValue(defaultValue);
32
- }
33
- }, [defaultValue]);
34
- const [pickerVisible, setPickerVisible] = React.useState(false);
35
- const [labeled] = React.useState(new Animated.Value(date ? 0 : 1));
36
- const [placeholder1, setPlaceholder1] = React.useState("");
37
- const [focused, setFocused] = React.useState(false);
38
- const [labelLayout, setLabelLayout] = React.useState({ measured: false, width: 0 });
39
- const getValidDate = () => {
40
- if (!value) {
41
- return new Date();
42
- }
43
- return typeof (value === null || value === void 0 ? void 0 : value.getMonth) === "function" ? value : new Date();
44
- };
45
- const formatDate = () => {
46
- if (!value)
47
- return "";
48
- let newDate = getValidDate();
49
- if (format)
50
- return dateFormat(newDate, format);
51
- if (mode === "time") {
52
- return `${newDate.toLocaleTimeString()}`;
53
- }
54
- if (mode === "datetime") {
55
- return `${newDate.toLocaleString()}`;
56
- }
57
- return `${MONTHS[newDate.getMonth()]} ${newDate.getDate()}, ${newDate.getFullYear()}`;
58
- };
59
- const toggleVisibility = async () => {
60
- setPickerVisible(!pickerVisible);
61
- focused ? _handleBlur() : _handleFocus();
62
- };
63
- const insets = useSafeAreaInsets();
64
- // const _restoreLabel = () =>
65
- // Animated.timing(labeled, {
66
- // toValue: 1,
67
- // duration: FOCUS_ANIMATION_DURATION,
68
- // useNativeDriver: true,
69
- // }).start();
70
- // const _minmizeLabel = () =>
71
- // Animated.timing(labeled, {
72
- // toValue: 0,
73
- // duration: BLUR_ANIMATION_DURATION,
74
- // useNativeDriver: true,
75
- // }).start();
76
- // const _showPlaceholder = () =>
77
- // setTimeout(() => setPlaceholder1(placeholder || ""), 50);
78
- const _hidePlaceholder = () => {
79
- setPlaceholder1("");
80
- };
81
- React.useEffect(() => {
82
- setValue(date);
83
- }, [date]);
84
- React.useEffect(() => {
85
- if (value || focused || placeholder1) {
86
- // _minmizeLabel();
87
- Animated.timing(labeled, {
88
- toValue: 0,
89
- duration: BLUR_ANIMATION_DURATION,
90
- useNativeDriver: true,
91
- }).start();
92
- }
93
- else {
94
- // _restoreLabel();
95
- Animated.timing(labeled, {
96
- toValue: 1,
97
- duration: FOCUS_ANIMATION_DURATION,
98
- useNativeDriver: true,
99
- }).start();
100
- }
101
- }, [value, focused, placeholder1, labeled]);
102
- React.useEffect(() => {
103
- const _showPlaceholder = () => setTimeout(() => setPlaceholder1(placeholder || ""), 50);
104
- if (focused || !label) {
105
- _showPlaceholder();
106
- }
107
- else {
108
- _hidePlaceholder();
109
- }
110
- return () => {
111
- clearTimeout(_showPlaceholder());
112
- };
113
- }, [focused, label, placeholder]);
114
- const _handleFocus = () => {
115
- if (disabled) {
116
- return;
117
- }
118
- setFocused(true);
119
- };
120
- const _handleBlur = () => {
121
- if (disabled) {
122
- return;
123
- }
124
- setFocused(false);
125
- };
126
- const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
127
- const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
128
- const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
129
- const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
130
- const hasActiveOutline = focused;
131
- let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
132
- inputTextColor = colors.strong;
133
- if (disabled) {
134
- activeColor = colors.light;
135
- placeholderColor = colors.light;
136
- borderColor = "transparent";
137
- underlineColor = "transparent";
138
- backgroundColor = colors.divider;
35
+ const DatePicker = ({
36
+ Icon,
37
+ style,
38
+ theme: { colors, typography, roundness, disabledOpacity },
39
+ date,
40
+ onDateChange = () => {},
41
+ defaultValue,
42
+ disabled = false,
43
+ mode = "date",
44
+ format,
45
+ type = "underline",
46
+ leftIconName,
47
+ rightIconName,
48
+ leftIconMode = "inset",
49
+ label,
50
+ labelSize,
51
+ labelColor,
52
+ placeholder,
53
+ borderColor: inputBorderColor,
54
+ borderColorActive: inputBorderColorActive,
55
+ ...props
56
+ }) => {
57
+ const [value, setValue] = React.useState(date || defaultValue);
58
+ React.useEffect(() => {
59
+ if (defaultValue != null) {
60
+ setValue(defaultValue);
139
61
  }
140
- else {
141
- activeColor = colors.primary;
142
- placeholderColor = borderColor = colors.light;
143
- underlineColor = colors.light;
144
- backgroundColor = colors.background;
62
+ }, [defaultValue]);
63
+ const [pickerVisible, setPickerVisible] = React.useState(false);
64
+ const [labeled] = React.useState(new Animated.Value(date ? 0 : 1));
65
+ const [placeholder1, setPlaceholder1] = React.useState("");
66
+ const [focused, setFocused] = React.useState(false);
67
+ const [labelLayout, setLabelLayout] = React.useState({
68
+ measured: false,
69
+ width: 0,
70
+ });
71
+ const { textStyles } = extractStyles(style);
72
+ const getValidDate = () => {
73
+ if (!value) {
74
+ return new Date();
145
75
  }
146
- const { lineHeight, ...subtitle1 } = typography.subtitle1;
147
- inputStyle = {
148
- paddingVertical: 0,
149
- color: inputTextColor,
150
- paddingLeft: leftIconName && leftIconMode === "inset"
151
- ? ICON_SIZE + (type === "solid" ? 16 : 12)
152
- : 0,
153
- paddingRight: rightIconName ? ICON_SIZE + 16 + 4 : 12,
154
- ...subtitle1,
155
- height: lineHeight,
156
- };
157
- if (type === "underline") {
158
- containerStyle = {
159
- borderTopLeftRadius: roundness,
160
- borderTopRightRadius: roundness,
161
- paddingBottom: 12,
162
- marginTop: 16,
163
- };
76
+ return typeof (value === null || value === void 0
77
+ ? void 0
78
+ : value.getMonth) === "function"
79
+ ? value
80
+ : new Date();
81
+ };
82
+ const formatDate = () => {
83
+ if (!value) return "";
84
+ let newDate = getValidDate();
85
+ if (format) return dateFormat(newDate, format);
86
+ if (mode === "time") {
87
+ return `${newDate.toLocaleTimeString()}`;
164
88
  }
165
- else {
166
- containerStyle = {
167
- borderRadius: roundness,
168
- borderColor: hasActiveOutline ? activeColor : borderColor,
169
- borderWidth: 1,
170
- paddingTop: labeled ? 16 * 1.5 : 16,
171
- paddingBottom: labeled ? 16 * 0.5 : 16,
172
- opacity: disabled ? disabledOpacity : 1,
173
- backgroundColor,
174
- };
175
- inputStyle.paddingHorizontal = 12;
89
+ if (mode === "datetime") {
90
+ return `${newDate.toLocaleString()}`;
176
91
  }
177
- if (leftIconName && leftIconMode === "outset") {
178
- containerStyle.marginLeft = ICON_SIZE + 8;
92
+ return `${
93
+ MONTHS[newDate.getMonth()]
94
+ } ${newDate.getDate()}, ${newDate.getFullYear()}`;
95
+ };
96
+ const toggleVisibility = async () => {
97
+ setPickerVisible(!pickerVisible);
98
+ focused ? _handleBlur() : _handleFocus();
99
+ };
100
+ const insets = useSafeAreaInsets();
101
+ // const _restoreLabel = () =>
102
+ // Animated.timing(labeled, {
103
+ // toValue: 1,
104
+ // duration: FOCUS_ANIMATION_DURATION,
105
+ // useNativeDriver: true,
106
+ // }).start();
107
+ // const _minmizeLabel = () =>
108
+ // Animated.timing(labeled, {
109
+ // toValue: 0,
110
+ // duration: BLUR_ANIMATION_DURATION,
111
+ // useNativeDriver: true,
112
+ // }).start();
113
+ // const _showPlaceholder = () =>
114
+ // setTimeout(() => setPlaceholder1(placeholder || ""), 50);
115
+ const _hidePlaceholder = () => {
116
+ setPlaceholder1("");
117
+ };
118
+ React.useEffect(() => {
119
+ setValue(date);
120
+ }, [date]);
121
+ React.useEffect(() => {
122
+ if (value || focused || placeholder1) {
123
+ // _minmizeLabel();
124
+ Animated.timing(labeled, {
125
+ toValue: 0,
126
+ duration: BLUR_ANIMATION_DURATION,
127
+ useNativeDriver: true,
128
+ }).start();
129
+ } else {
130
+ // _restoreLabel();
131
+ Animated.timing(labeled, {
132
+ toValue: 1,
133
+ duration: FOCUS_ANIMATION_DURATION,
134
+ useNativeDriver: true,
135
+ }).start();
179
136
  }
180
- let leftIconColor;
181
- if (focused) {
182
- leftIconColor = colors.primary;
137
+ }, [value, focused, placeholder1, labeled]);
138
+ React.useEffect(() => {
139
+ const _showPlaceholder = () =>
140
+ setTimeout(() => setPlaceholder1(placeholder || ""), 50);
141
+ if (focused || !label) {
142
+ _showPlaceholder();
143
+ } else {
144
+ _hidePlaceholder();
183
145
  }
184
- else {
185
- leftIconColor = colors.light;
146
+ return () => {
147
+ clearTimeout(_showPlaceholder());
148
+ };
149
+ }, [focused, label, placeholder]);
150
+ const _handleFocus = () => {
151
+ if (disabled) {
152
+ return;
153
+ }
154
+ setFocused(true);
155
+ };
156
+ const _handleBlur = () => {
157
+ if (disabled) {
158
+ return;
186
159
  }
187
- const leftIconProps = {
188
- size: 24,
189
- color: leftIconColor,
190
- name: leftIconName || "",
160
+ setFocused(false);
161
+ };
162
+ const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
163
+ const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
164
+ const MAXIMIZED_LABEL_FONT_SIZE =
165
+ (textStyles === null || textStyles === void 0
166
+ ? void 0
167
+ : textStyles.fontSize) || typography.subtitle1.fontSize;
168
+ const MINIMIZED_LABEL_FONT_SIZE = labelSize
169
+ ? labelSize
170
+ : typography.caption.fontSize;
171
+ const hasActiveOutline = focused;
172
+ let inputTextColor,
173
+ activeColor,
174
+ underlineColor,
175
+ borderColor,
176
+ placeholderColor,
177
+ containerStyle,
178
+ backgroundColor,
179
+ inputStyle;
180
+ inputTextColor = colors.strong;
181
+ if (disabled) {
182
+ activeColor = colors.light;
183
+ placeholderColor = colors.light;
184
+ borderColor = "transparent";
185
+ underlineColor = "transparent";
186
+ backgroundColor = colors.divider;
187
+ } else {
188
+ activeColor = inputBorderColorActive || colors.primary;
189
+ placeholderColor = borderColor = inputBorderColor || colors.light;
190
+ underlineColor = inputBorderColor || colors.light;
191
+ backgroundColor = colors.background;
192
+ }
193
+ const { lineHeight, ...subtitle1 } = typography.subtitle1;
194
+ inputStyle = {
195
+ paddingVertical: 0,
196
+ color: inputTextColor,
197
+ paddingLeft:
198
+ leftIconName && leftIconMode === "inset"
199
+ ? ICON_SIZE + (type === "solid" ? 16 : 12)
200
+ : 0,
201
+ paddingRight: rightIconName ? ICON_SIZE + 16 + 4 : 12,
202
+ ...subtitle1,
203
+ height: lineHeight,
204
+ };
205
+ if (type === "underline") {
206
+ containerStyle = {
207
+ borderTopLeftRadius: roundness,
208
+ borderTopRightRadius: roundness,
209
+ paddingBottom: 12,
210
+ marginTop: 16,
191
211
  };
192
- const leftIconStyle = {
193
- position: "absolute",
194
- marginTop: type === "solid"
195
- ? leftIconMode === "inset"
196
- ? MINIMIZED_LABEL_FONT_SIZE + 4
197
- : 16
198
- : leftIconMode === "outset"
199
- ? 16
200
- : 0,
212
+ } else {
213
+ containerStyle = {
214
+ borderRadius: roundness,
215
+ borderColor: hasActiveOutline ? activeColor : borderColor,
216
+ borderWidth: 1,
217
+ paddingTop: labeled ? 16 * 1.5 : 16,
218
+ paddingBottom: labeled ? 16 * 0.5 : 16,
219
+ opacity: disabled ? disabledOpacity : 1,
220
+ backgroundColor,
201
221
  };
202
- const labelStyle = {
203
- ...typography.subtitle1,
204
- top: type === "solid" ? 16 : 0,
205
- left: leftIconName && leftIconMode === "inset"
206
- ? ICON_SIZE + (type === "solid" ? 16 : 12)
207
- : 0,
208
- transform: [
209
- {
210
- // Move label to top
211
- translateY: labeled.interpolate({
212
- inputRange: [0, 1],
213
- outputRange: [
214
- type === "solid"
215
- ? OUTLINE_MINIMIZED_LABEL_Y_OFFSET
216
- : MINIMIZED_LABEL_Y_OFFSET,
217
- 0,
218
- ],
219
- }),
220
- },
221
- {
222
- // Make label smaller
223
- scale: labeled.interpolate({
224
- inputRange: [0, 1],
225
- outputRange: [
226
- MINIMIZED_LABEL_FONT_SIZE / MAXIMIZED_LABEL_FONT_SIZE,
227
- 1,
228
- ],
229
- }),
230
- },
231
- {
232
- // Offset label scale since RN doesn't support transform origin
233
- translateX: labeled.interpolate({
234
- inputRange: [0, 1],
235
- outputRange: [
236
- -(1 - MINIMIZED_LABEL_FONT_SIZE / MAXIMIZED_LABEL_FONT_SIZE) *
237
- (labelLayout.width / 2),
238
- 0,
222
+ inputStyle.paddingHorizontal = 12;
223
+ }
224
+ if (leftIconName && leftIconMode === "outset") {
225
+ containerStyle.marginLeft = ICON_SIZE + 8;
226
+ }
227
+ let leftIconColor;
228
+ if (focused) {
229
+ leftIconColor = colors.primary;
230
+ } else {
231
+ leftIconColor = colors.light;
232
+ }
233
+ const leftIconProps = {
234
+ size: 24,
235
+ color: leftIconColor,
236
+ name: leftIconName || "",
237
+ };
238
+ const leftIconStyle = {
239
+ position: "absolute",
240
+ marginTop:
241
+ type === "solid"
242
+ ? leftIconMode === "inset"
243
+ ? MINIMIZED_LABEL_FONT_SIZE + 4
244
+ : 16
245
+ : leftIconMode === "outset"
246
+ ? 16
247
+ : 0,
248
+ };
249
+ const labelStyle = {
250
+ ...typography.subtitle1,
251
+ top: type === "solid" ? 16 : 0,
252
+ fontFamily:
253
+ textStyles === null || textStyles === void 0
254
+ ? void 0
255
+ : textStyles.fontFamily,
256
+ left:
257
+ leftIconName && leftIconMode === "inset"
258
+ ? ICON_SIZE + (type === "solid" ? 16 : 12)
259
+ : 0,
260
+ transform: [
261
+ {
262
+ // Move label to top
263
+ translateY: labeled.interpolate({
264
+ inputRange: [0, 1],
265
+ outputRange: [
266
+ type === "solid"
267
+ ? OUTLINE_MINIMIZED_LABEL_Y_OFFSET
268
+ : MINIMIZED_LABEL_Y_OFFSET,
269
+ 0,
270
+ ],
271
+ }),
272
+ },
273
+ {
274
+ // Make label smaller
275
+ scale: labeled.interpolate({
276
+ inputRange: [0, 1],
277
+ outputRange: [
278
+ MINIMIZED_LABEL_FONT_SIZE / MAXIMIZED_LABEL_FONT_SIZE,
279
+ 1,
280
+ ],
281
+ }),
282
+ },
283
+ {
284
+ // Offset label scale since RN doesn't support transform origin
285
+ translateX: labeled.interpolate({
286
+ inputRange: [0, 1],
287
+ outputRange: [
288
+ -(1 - MINIMIZED_LABEL_FONT_SIZE / MAXIMIZED_LABEL_FONT_SIZE) *
289
+ (labelLayout.width / 2),
290
+ 0,
291
+ ],
292
+ }),
293
+ },
294
+ ],
295
+ };
296
+ const inputStyles = [
297
+ styles.input,
298
+ inputStyle,
299
+ type === "solid" ? { marginHorizontal: 12 } : {},
300
+ textStyles,
301
+ ];
302
+ // const render = (props) => <NativeTextInput {...props} />;
303
+ return React.createElement(
304
+ View,
305
+ { style: [styles.container, style] },
306
+ React.createElement(
307
+ Touchable,
308
+ { disabled: disabled, onPress: toggleVisibility },
309
+ React.createElement(
310
+ View,
311
+ { pointerEvents: "none" },
312
+ React.createElement(
313
+ View,
314
+ { style: [styles.container, style] },
315
+ leftIconName && leftIconMode === "outset"
316
+ ? React.createElement(Icon, {
317
+ ...leftIconProps,
318
+ style: leftIconStyle,
319
+ })
320
+ : null,
321
+ React.createElement(
322
+ View,
323
+ { style: [containerStyle, style ? { height: style.height } : {}] },
324
+ type === "underline"
325
+ ? // When type === 'flat', render an underline
326
+ React.createElement(Animated.View, {
327
+ style: [
328
+ styles.underline,
329
+ {
330
+ backgroundColor: focused ? activeColor : underlineColor,
331
+ // Underlines is thinner when input is not focused
332
+ transform: [{ scaleY: focused ? 1 : 0.5 }],
333
+ },
334
+ ],
335
+ })
336
+ : null,
337
+ label
338
+ ? // Position colored placeholder and gray placeholder on top of each other and crossfade them
339
+ // This gives the effect of animating the color, but allows us to use native driver
340
+ React.createElement(
341
+ View,
342
+ {
343
+ pointerEvents: "none",
344
+ style: [
345
+ StyleSheet.absoluteFill,
346
+ {
347
+ opacity:
348
+ // Hide the label in minimized state until we measure its width
349
+ date || focused ? (labelLayout.measured ? 1 : 0) : 1,
350
+ },
239
351
  ],
240
- }),
241
- },
242
- ],
243
- };
244
- const inputStyles = [
245
- styles.input,
246
- inputStyle,
247
- type === "solid" ? { marginHorizontal: 12 } : {},
248
- ];
249
- // const render = (props) => <NativeTextInput {...props} />;
250
- return (React.createElement(View, { style: [styles.container, style] },
251
- React.createElement(Touchable, { disabled: disabled, onPress: toggleVisibility },
252
- React.createElement(View, { pointerEvents: "none" },
253
- React.createElement(View, { style: [styles.container, style] },
254
- leftIconName && leftIconMode === "outset" ? (React.createElement(Icon, { ...leftIconProps, style: leftIconStyle })) : null,
255
- React.createElement(View, { style: [containerStyle, style ? { height: style.height } : {}] },
256
- type === "underline" ? (
257
- // When type === 'flat', render an underline
258
- React.createElement(Animated.View, { style: [
259
- styles.underline,
260
- {
261
- backgroundColor: focused ? activeColor : underlineColor,
262
- // Underlines is thinner when input is not focused
263
- transform: [{ scaleY: focused ? 1 : 0.5 }],
264
- },
265
- ] })) : null,
266
- label ? (
267
- // Position colored placeholder and gray placeholder on top of each other and crossfade them
268
- // This gives the effect of animating the color, but allows us to use native driver
269
- React.createElement(View, { pointerEvents: "none", style: [
270
- StyleSheet.absoluteFill,
271
- {
272
- opacity:
273
- // Hide the label in minimized state until we measure its width
274
- date || focused ? (labelLayout.measured ? 1 : 0) : 1,
275
- },
276
- ] },
277
- React.createElement(AnimatedText, { onLayout: (e) => setLabelLayout({
278
- width: e.nativeEvent.layout.width,
279
- measured: true,
280
- }), style: [
281
- styles.placeholder,
282
- type === "solid" ? { paddingHorizontal: 12 } : {},
283
- labelStyle,
284
- {
285
- color: colors.light,
286
- opacity: labeled.interpolate({
287
- inputRange: [0, 1],
288
- outputRange: [hasActiveOutline ? 1 : 0, 0],
289
- }),
290
- },
291
- ], numberOfLines: 1 }, label),
292
- React.createElement(AnimatedText, { style: [
293
- styles.placeholder,
294
- type === "solid" ? { paddingHorizontal: 12 } : {},
295
- labelStyle,
296
- {
297
- color: placeholderColor,
298
- opacity: hasActiveOutline ? labeled : 1,
299
- },
300
- ], numberOfLines: 1 }, label))) : null,
301
- leftIconName && leftIconMode === "inset" ? (React.createElement(Icon, { ...leftIconProps, style: {
302
- ...leftIconStyle,
303
- marginLeft: type === "solid" ? 16 : 0,
304
- } })) : null,
305
- React.createElement(NativeTextInput, { value: formatDate(), placeholder: label ? placeholder1 : placeholder, editable: !disabled, placeholderTextColor: placeholderColor, selectionColor: activeColor, onFocus: _handleFocus, onBlur: _handleBlur, underlineColorAndroid: "transparent", style: inputStyles, ...props })),
306
- rightIconName ? (React.createElement(Icon, { name: rightIconName, size: ICON_SIZE, color: colors.light, style: {
307
- position: "absolute",
308
- right: 16,
309
- marginTop: type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16,
310
- } })) : null))),
311
- pickerVisible && (React.createElement(Portal, null,
312
- React.createElement(View, { style: [
313
- styles.picker,
352
+ },
353
+ React.createElement(
354
+ AnimatedText,
314
355
  {
315
- backgroundColor: colors.divider,
356
+ onLayout: (e) =>
357
+ setLabelLayout({
358
+ width: e.nativeEvent.layout.width,
359
+ measured: true,
360
+ }),
361
+ style: [
362
+ styles.placeholder,
363
+ type === "solid" ? { paddingHorizontal: 12 } : {},
364
+ labelStyle,
365
+ {
366
+ color: labelColor || colors.light,
367
+ opacity: labeled.interpolate({
368
+ inputRange: [0, 1],
369
+ outputRange: [hasActiveOutline ? 1 : 0, 0],
370
+ }),
371
+ },
372
+ ],
373
+ numberOfLines: 1,
316
374
  },
317
- ] },
318
- React.createElement(View, { style: [
319
- styles.pickerContainer,
375
+ label
376
+ ),
377
+ React.createElement(
378
+ AnimatedText,
379
+ {
380
+ style: [
381
+ styles.placeholder,
382
+ type === "solid" ? { paddingHorizontal: 12 } : {},
383
+ labelStyle,
320
384
  {
321
- paddingTop: insets.top,
322
- paddingBottom: insets.bottom,
323
- paddingLeft: insets.left,
324
- paddingRight: insets.right,
385
+ color: labelColor || placeholder,
386
+ opacity: hasActiveOutline ? labeled : 1,
325
387
  },
326
- ] },
327
- React.createElement(DateTimePicker, { value: getValidDate(), mode: mode, isVisible: pickerVisible, toggleVisibility: toggleVisibility, onChange: (_event, data) => {
328
- toggleVisibility();
329
- setValue(data);
330
- onDateChange(data);
331
- } })))))));
388
+ ],
389
+ numberOfLines: 1,
390
+ },
391
+ label
392
+ )
393
+ )
394
+ : null,
395
+ leftIconName && leftIconMode === "inset"
396
+ ? React.createElement(Icon, {
397
+ ...leftIconProps,
398
+ style: {
399
+ ...leftIconStyle,
400
+ marginLeft: type === "solid" ? 16 : 0,
401
+ },
402
+ })
403
+ : null,
404
+ React.createElement(NativeTextInput, {
405
+ value: formatDate(),
406
+ placeholder: label ? placeholder1 : placeholder,
407
+ editable: !disabled,
408
+ placeholderTextColor: placeholderColor,
409
+ selectionColor: activeColor,
410
+ onFocus: _handleFocus,
411
+ onBlur: _handleBlur,
412
+ underlineColorAndroid: "transparent",
413
+ style: inputStyles,
414
+ ...props,
415
+ })
416
+ ),
417
+ rightIconName
418
+ ? React.createElement(Icon, {
419
+ name: rightIconName,
420
+ size: ICON_SIZE,
421
+ color: colors.light,
422
+ style: {
423
+ position: "absolute",
424
+ right: 16,
425
+ marginTop:
426
+ type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16,
427
+ },
428
+ })
429
+ : null
430
+ )
431
+ )
432
+ ),
433
+ pickerVisible &&
434
+ React.createElement(
435
+ Portal,
436
+ null,
437
+ React.createElement(
438
+ View,
439
+ {
440
+ style: [
441
+ styles.picker,
442
+ {
443
+ backgroundColor: colors.divider,
444
+ },
445
+ ],
446
+ },
447
+ React.createElement(
448
+ View,
449
+ {
450
+ style: [
451
+ styles.pickerContainer,
452
+ {
453
+ paddingTop: insets.top,
454
+ paddingBottom: insets.bottom,
455
+ paddingLeft: insets.left,
456
+ paddingRight: insets.right,
457
+ },
458
+ ],
459
+ },
460
+ React.createElement(DateTimePicker, {
461
+ value: getValidDate(),
462
+ mode: mode,
463
+ isVisible: pickerVisible,
464
+ toggleVisibility: toggleVisibility,
465
+ onChange: (_event, data) => {
466
+ toggleVisibility();
467
+ setValue(data);
468
+ onDateChange(data);
469
+ },
470
+ })
471
+ )
472
+ )
473
+ )
474
+ );
332
475
  };
333
476
  const styles = StyleSheet.create({
334
- container: {
335
- alignSelf: "stretch",
336
- },
337
- picker: {
338
- position: "absolute",
339
- bottom: 0,
340
- left: 0,
341
- right: 0,
342
- flexDirection: "row",
343
- justifyContent: "center",
344
- },
345
- underline: {
346
- position: "absolute",
347
- left: 0,
348
- right: 0,
349
- bottom: 0,
350
- height: 2,
351
- },
352
- input: {
353
- flexGrow: 1,
354
- justifyContent: "center",
355
- textAlignVertical: "center",
356
- margin: 0,
357
- textAlign: I18nManager.isRTL ? "right" : "left",
358
- },
359
- placeholder: {
360
- position: "absolute",
361
- left: 0,
362
- },
363
- pickerContainer: { flexDirection: "column", width: "100%", zIndex: 100 },
364
- closeButton: {
365
- alignSelf: "flex-end",
366
- },
477
+ container: {
478
+ alignSelf: "stretch",
479
+ },
480
+ picker: {
481
+ position: "absolute",
482
+ bottom: 0,
483
+ left: 0,
484
+ right: 0,
485
+ flexDirection: "row",
486
+ justifyContent: "center",
487
+ },
488
+ underline: {
489
+ position: "absolute",
490
+ left: 0,
491
+ right: 0,
492
+ bottom: 0,
493
+ height: 2,
494
+ },
495
+ input: {
496
+ flexGrow: 1,
497
+ justifyContent: "center",
498
+ textAlignVertical: "center",
499
+ margin: 0,
500
+ textAlign: I18nManager.isRTL ? "right" : "left",
501
+ },
502
+ placeholder: {
503
+ position: "absolute",
504
+ left: 0,
505
+ },
506
+ pickerContainer: { flexDirection: "column", width: "100%", zIndex: 100 },
507
+ closeButton: {
508
+ alignSelf: "flex-end",
509
+ },
367
510
  });
368
511
  export default withTheme(DatePicker);