@expo/ui 0.1.1-alpha.1 → 0.1.1-alpha.3

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 (212) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/android/build.gradle +2 -2
  3. package/build/jetpack-compose/Button/index.d.ts +70 -0
  4. package/build/jetpack-compose/Button/index.d.ts.map +1 -0
  5. package/build/jetpack-compose/Button/index.js +31 -0
  6. package/build/jetpack-compose/Button/index.js.map +1 -0
  7. package/build/jetpack-compose/Button/types.d.ts.map +1 -0
  8. package/build/jetpack-compose/Button/types.js +2 -0
  9. package/build/jetpack-compose/Button/types.js.map +1 -0
  10. package/build/jetpack-compose/ContextMenu/index.d.ts +86 -0
  11. package/build/jetpack-compose/ContextMenu/index.d.ts.map +1 -0
  12. package/build/jetpack-compose/ContextMenu/index.js +36 -0
  13. package/build/jetpack-compose/ContextMenu/index.js.map +1 -0
  14. package/build/jetpack-compose/ContextMenu/utils.d.ts.map +1 -0
  15. package/build/jetpack-compose/ContextMenu/utils.js +79 -0
  16. package/build/jetpack-compose/ContextMenu/utils.js.map +1 -0
  17. package/build/{DatePicker → jetpack-compose/DatePicker}/index.d.ts +4 -19
  18. package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -0
  19. package/build/jetpack-compose/DatePicker/index.js +31 -0
  20. package/build/jetpack-compose/DatePicker/index.js.map +1 -0
  21. package/build/{Picker → jetpack-compose/Picker}/index.d.ts +2 -9
  22. package/build/jetpack-compose/Picker/index.d.ts.map +1 -0
  23. package/build/jetpack-compose/Picker/index.js +26 -0
  24. package/build/jetpack-compose/Picker/index.js.map +1 -0
  25. package/build/jetpack-compose/Progress/index.d.ts.map +1 -0
  26. package/build/jetpack-compose/Progress/index.js +15 -0
  27. package/build/jetpack-compose/Progress/index.js.map +1 -0
  28. package/build/{Slider → jetpack-compose/Slider}/index.d.ts +1 -1
  29. package/build/jetpack-compose/Slider/index.d.ts.map +1 -0
  30. package/build/jetpack-compose/Slider/index.js +31 -0
  31. package/build/jetpack-compose/Slider/index.js.map +1 -0
  32. package/build/{Switch → jetpack-compose/Switch}/index.d.ts +0 -1
  33. package/build/jetpack-compose/Switch/index.d.ts.map +1 -0
  34. package/build/jetpack-compose/Switch/index.js +38 -0
  35. package/build/jetpack-compose/Switch/index.js.map +1 -0
  36. package/build/jetpack-compose/TextInput/index.d.ts +61 -0
  37. package/build/jetpack-compose/TextInput/index.d.ts.map +1 -0
  38. package/build/jetpack-compose/TextInput/index.js +21 -0
  39. package/build/jetpack-compose/TextInput/index.js.map +1 -0
  40. package/build/jetpack-compose/index.d.ts +9 -0
  41. package/build/jetpack-compose/index.d.ts.map +1 -0
  42. package/build/jetpack-compose/index.js +9 -0
  43. package/build/jetpack-compose/index.js.map +1 -0
  44. package/build/swift-ui/BottomSheet/index.d.ts +28 -0
  45. package/build/swift-ui/BottomSheet/index.d.ts.map +1 -0
  46. package/build/swift-ui/BottomSheet/index.js +18 -0
  47. package/build/swift-ui/BottomSheet/index.js.map +1 -0
  48. package/build/{Button → swift-ui/Button}/index.d.ts +4 -31
  49. package/build/swift-ui/Button/index.d.ts.map +1 -0
  50. package/build/swift-ui/Button/index.js +23 -0
  51. package/build/swift-ui/Button/index.js.map +1 -0
  52. package/build/swift-ui/ColorPicker/index.d.ts.map +1 -0
  53. package/build/swift-ui/ColorPicker/index.js +15 -0
  54. package/build/swift-ui/ColorPicker/index.js.map +1 -0
  55. package/build/{ContextMenu → swift-ui/ContextMenu}/index.d.ts +0 -8
  56. package/build/swift-ui/ContextMenu/index.d.ts.map +1 -0
  57. package/build/swift-ui/ContextMenu/index.js +59 -0
  58. package/build/swift-ui/ContextMenu/index.js.map +1 -0
  59. package/build/swift-ui/ContextMenu/utils.d.ts +24 -0
  60. package/build/swift-ui/ContextMenu/utils.d.ts.map +1 -0
  61. package/build/swift-ui/ContextMenu/utils.js +79 -0
  62. package/build/swift-ui/ContextMenu/utils.js.map +1 -0
  63. package/build/swift-ui/DatePicker/index.d.ts +53 -0
  64. package/build/swift-ui/DatePicker/index.d.ts.map +1 -0
  65. package/build/swift-ui/DatePicker/index.js +31 -0
  66. package/build/swift-ui/DatePicker/index.js.map +1 -0
  67. package/build/swift-ui/Gauge/index.d.ts.map +1 -0
  68. package/build/swift-ui/Gauge/index.js +17 -0
  69. package/build/swift-ui/Gauge/index.js.map +1 -0
  70. package/build/{Label → swift-ui/Label}/index.d.ts +1 -1
  71. package/build/swift-ui/Label/index.d.ts.map +1 -0
  72. package/{Label/index.ios.tsx → build/swift-ui/Label/index.js} +4 -7
  73. package/build/swift-ui/Label/index.js.map +1 -0
  74. package/build/{List → swift-ui/List}/index.d.ts +2 -2
  75. package/build/swift-ui/List/index.d.ts.map +1 -0
  76. package/build/swift-ui/List/index.js +26 -0
  77. package/build/swift-ui/List/index.js.map +1 -0
  78. package/build/{components/SwiftUI/index.d.ts → swift-ui/Next.d.ts} +1 -1
  79. package/build/swift-ui/Next.d.ts.map +1 -0
  80. package/build/swift-ui/Next.js +89 -0
  81. package/build/swift-ui/Next.js.map +1 -0
  82. package/build/swift-ui/Picker/index.d.ts +49 -0
  83. package/build/swift-ui/Picker/index.d.ts.map +1 -0
  84. package/build/swift-ui/Picker/index.js +19 -0
  85. package/build/swift-ui/Picker/index.js.map +1 -0
  86. package/build/swift-ui/Progress/index.d.ts +38 -0
  87. package/build/swift-ui/Progress/index.d.ts.map +1 -0
  88. package/build/swift-ui/Progress/index.js +15 -0
  89. package/build/swift-ui/Progress/index.js.map +1 -0
  90. package/build/{Section → swift-ui/Section}/index.d.ts +1 -1
  91. package/build/swift-ui/Section/index.d.ts.map +1 -0
  92. package/build/swift-ui/Section/index.js +11 -0
  93. package/build/swift-ui/Section/index.js.map +1 -0
  94. package/build/swift-ui/Slider/index.d.ts +46 -0
  95. package/build/swift-ui/Slider/index.d.ts.map +1 -0
  96. package/build/swift-ui/Slider/index.js +22 -0
  97. package/build/swift-ui/Slider/index.js.map +1 -0
  98. package/build/swift-ui/Switch/index.d.ts +50 -0
  99. package/build/swift-ui/Switch/index.d.ts.map +1 -0
  100. package/build/swift-ui/Switch/index.js +19 -0
  101. package/build/swift-ui/Switch/index.js.map +1 -0
  102. package/build/{TextInput → swift-ui/TextInput}/index.d.ts +2 -8
  103. package/build/swift-ui/TextInput/index.d.ts.map +1 -0
  104. package/build/swift-ui/TextInput/index.js +21 -0
  105. package/build/swift-ui/TextInput/index.js.map +1 -0
  106. package/build/swift-ui/index.d.ts +16 -0
  107. package/build/swift-ui/index.d.ts.map +1 -0
  108. package/build/swift-ui/index.js +16 -0
  109. package/build/swift-ui/index.js.map +1 -0
  110. package/build/types.d.ts +7 -0
  111. package/build/types.d.ts.map +1 -0
  112. package/build/types.js +2 -0
  113. package/build/types.js.map +1 -0
  114. package/expo-module.config.json +1 -1
  115. package/jetpack-compose.d.ts +1 -0
  116. package/jetpack-compose.js +1 -0
  117. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.module → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.module} +7 -7
  118. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.module.md5 +1 -0
  119. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.module.sha1 +1 -0
  120. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.module.sha256 +1 -0
  121. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.module.sha512 +1 -0
  122. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.pom → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.pom} +1 -1
  123. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.pom.md5 +1 -0
  124. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.pom.sha1 +1 -0
  125. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.pom.sha256 +1 -0
  126. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.pom.sha512 +1 -0
  127. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  128. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  129. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  130. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  131. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  132. package/package.json +3 -3
  133. package/src/jetpack-compose/Button/index.tsx +109 -0
  134. package/src/jetpack-compose/ContextMenu/index.tsx +171 -0
  135. package/{DatePicker → src/jetpack-compose/DatePicker}/index.tsx +18 -27
  136. package/{Picker → src/jetpack-compose/Picker}/index.tsx +2 -9
  137. package/{Slider → src/jetpack-compose/Slider}/index.tsx +1 -1
  138. package/{Switch → src/jetpack-compose/Switch}/index.tsx +0 -1
  139. package/src/jetpack-compose/TextInput/index.tsx +94 -0
  140. package/src/jetpack-compose/index.tsx +8 -0
  141. package/{BottomSheet/index.ios.tsx → src/swift-ui/BottomSheet/index.tsx} +19 -2
  142. package/{Button → src/swift-ui/Button}/index.tsx +7 -54
  143. package/{ContextMenu → src/swift-ui/ContextMenu}/index.tsx +0 -9
  144. package/src/swift-ui/ContextMenu/utils.ts +143 -0
  145. package/src/swift-ui/DatePicker/index.tsx +84 -0
  146. package/{Label → src/swift-ui/Label}/index.tsx +6 -3
  147. package/{List → src/swift-ui/List}/index.tsx +26 -3
  148. package/{components/SwiftUI/index.tsx → src/swift-ui/Next.tsx} +1 -1
  149. package/src/swift-ui/Picker/index.tsx +60 -0
  150. package/src/swift-ui/Progress/index.tsx +57 -0
  151. package/{Section → src/swift-ui/Section}/index.tsx +8 -2
  152. package/src/swift-ui/Slider/index.tsx +68 -0
  153. package/src/swift-ui/Switch/index.tsx +71 -0
  154. package/{TextInput → src/swift-ui/TextInput}/index.tsx +2 -8
  155. package/src/swift-ui/index.tsx +16 -0
  156. package/src/types.ts +0 -15
  157. package/swift-ui.d.ts +1 -0
  158. package/swift-ui.js +1 -0
  159. package/tsconfig.json +2 -2
  160. package/BottomSheet/index.tsx +0 -28
  161. package/ContextMenu/index.android.tsx +0 -72
  162. package/List/index.ios.tsx +0 -35
  163. package/Section/index.ios.tsx +0 -12
  164. package/build/BottomSheet/index.d.ts +0 -25
  165. package/build/BottomSheet/index.d.ts.map +0 -1
  166. package/build/Button/index.d.ts.map +0 -1
  167. package/build/Button/types.d.ts.map +0 -1
  168. package/build/ColorPicker/index.d.ts.map +0 -1
  169. package/build/ContextMenu/index.d.ts.map +0 -1
  170. package/build/ContextMenu/utils.d.ts.map +0 -1
  171. package/build/DatePicker/index.d.ts.map +0 -1
  172. package/build/Gauge/index.d.ts.map +0 -1
  173. package/build/Label/index.d.ts.map +0 -1
  174. package/build/List/index.d.ts.map +0 -1
  175. package/build/Picker/index.d.ts.map +0 -1
  176. package/build/Progress/index.d.ts.map +0 -1
  177. package/build/Section/index.d.ts.map +0 -1
  178. package/build/Slider/index.d.ts.map +0 -1
  179. package/build/Switch/index.d.ts.map +0 -1
  180. package/build/TextInput/index.d.ts.map +0 -1
  181. package/build/components/SwiftUI/index.d.ts.map +0 -1
  182. package/build/src/types.d.ts +0 -21
  183. package/build/src/types.d.ts.map +0 -1
  184. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.module.md5 +0 -1
  185. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.module.sha1 +0 -1
  186. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.module.sha256 +0 -1
  187. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.module.sha512 +0 -1
  188. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.pom.md5 +0 -1
  189. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.pom.sha1 +0 -1
  190. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.pom.sha256 +0 -1
  191. package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.pom.sha512 +0 -1
  192. package/swift-ui.ts +0 -1
  193. /package/build/{Button → jetpack-compose/Button}/types.d.ts +0 -0
  194. /package/build/{ContextMenu → jetpack-compose/ContextMenu}/utils.d.ts +0 -0
  195. /package/build/{Progress → jetpack-compose/Progress}/index.d.ts +0 -0
  196. /package/build/{ColorPicker → swift-ui/ColorPicker}/index.d.ts +0 -0
  197. /package/build/{Gauge → swift-ui/Gauge}/index.d.ts +0 -0
  198. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1-sources.jar → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3-sources.jar} +0 -0
  199. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1-sources.jar.md5 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3-sources.jar.md5} +0 -0
  200. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1-sources.jar.sha1 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3-sources.jar.sha1} +0 -0
  201. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1-sources.jar.sha256 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3-sources.jar.sha256} +0 -0
  202. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1-sources.jar.sha512 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3-sources.jar.sha512} +0 -0
  203. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.aar → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.aar} +0 -0
  204. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.aar.md5 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.aar.md5} +0 -0
  205. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.aar.sha1 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.aar.sha1} +0 -0
  206. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.aar.sha256 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.aar.sha256} +0 -0
  207. /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.1.1-alpha.1/expo.modules.ui-0.1.1-alpha.1.aar.sha512 → 0.1.1-alpha.3/expo.modules.ui-0.1.1-alpha.3.aar.sha512} +0 -0
  208. /package/{Button → src/jetpack-compose/Button}/types.ts +0 -0
  209. /package/{ContextMenu → src/jetpack-compose/ContextMenu}/utils.ts +0 -0
  210. /package/{Progress → src/jetpack-compose/Progress}/index.tsx +0 -0
  211. /package/{ColorPicker → src/swift-ui/ColorPicker}/index.tsx +0 -0
  212. /package/{Gauge → src/swift-ui/Gauge}/index.tsx +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.1.1-alpha.3 — 2025-04-21
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - [Android] Fixed `DatePicker` causing out of memory exception. ([#36227](https://github.com/expo/expo/pull/36227) by [@lukmccall](https://github.com/lukmccall))
18
+
19
+ ## 0.1.1-alpha.2 — 2025-04-14
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
13
23
  ## 0.1.1-alpha.1 — 2025-04-11
14
24
 
15
25
  _This version does not introduce any user-facing changes._
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
12
12
  apply plugin: 'org.jetbrains.kotlin.plugin.compose'
13
13
 
14
14
  group = 'expo.modules.ui'
15
- version = '0.1.1-alpha.1'
15
+ version = '0.1.1-alpha.3'
16
16
 
17
17
  android {
18
18
  namespace "expo.modules.ui"
19
19
  defaultConfig {
20
20
  versionCode 1
21
- versionName "0.1.1-alpha.1"
21
+ versionName "0.1.1-alpha.3"
22
22
  }
23
23
  buildFeatures {
24
24
  compose true
@@ -0,0 +1,70 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ import { MaterialIcon } from './types';
3
+ import { ViewEvent } from '../../types';
4
+ /**
5
+ * The built-in button styles available on Android.
6
+ * - `outlined` - A button with an outline.
7
+ * - `elevated` - A filled button with a shadow.
8
+ */
9
+ export type ButtonVariant = 'default' | 'bordered' | 'borderless' | 'outlined' | 'elevated';
10
+ /**
11
+ * Colors for button's core elements.
12
+ */
13
+ export type ButtonElementColors = {
14
+ containerColor?: string;
15
+ contentColor?: string;
16
+ disabledContainerColor?: string;
17
+ disabledContentColor?: string;
18
+ };
19
+ export type ButtonProps = {
20
+ /**
21
+ * A callback that is called when the button is pressed.
22
+ */
23
+ onPress?: () => void;
24
+ /**
25
+ * A string describing the system image to display in the button.
26
+ * Uses Material Icons on Android.
27
+ */
28
+ systemImage?: MaterialIcon;
29
+ /**
30
+ * The button variant.
31
+ */
32
+ variant?: ButtonVariant;
33
+ /**
34
+ * Additional styles to apply to the button.
35
+ */
36
+ style?: StyleProp<ViewStyle>;
37
+ /**
38
+ * The text to display inside the button.
39
+ */
40
+ children: string;
41
+ /**
42
+ * Colors for button's core elements.
43
+ * @platform android
44
+ */
45
+ elementColors?: ButtonElementColors;
46
+ /**
47
+ * Button color.
48
+ */
49
+ color?: string;
50
+ /**
51
+ * Disabled state of the button.
52
+ */
53
+ disabled?: boolean;
54
+ };
55
+ /**
56
+ * @hidden
57
+ */
58
+ export type NativeButtonProps = Omit<ButtonProps, 'role' | 'onPress' | 'children' | 'systemImage'> & {
59
+ text: string;
60
+ systemImage?: string;
61
+ } & ViewEvent<'onButtonPressed', void>;
62
+ /**
63
+ * @hidden
64
+ */
65
+ export declare function transformButtonProps(props: ButtonProps): NativeButtonProps;
66
+ /**
67
+ * Displays a native button component.
68
+ */
69
+ export declare function Button(props: ButtonProps): import("react").JSX.Element;
70
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/Button/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5F;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,WAAW,EACX,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAChD,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;AAQvC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAe1E;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAQxC"}
@@ -0,0 +1,31 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { StyleSheet } from 'react-native';
3
+ // We have to work around the `role` and `onPress` props being reserved by React Native.
4
+ const ButtonNativeView = requireNativeView('ExpoUI', 'Button');
5
+ /**
6
+ * @hidden
7
+ */
8
+ export function transformButtonProps(props) {
9
+ const { children, onPress, systemImage, ...restProps } = props;
10
+ return {
11
+ ...restProps,
12
+ text: children ?? '',
13
+ systemImage,
14
+ onButtonPressed: onPress,
15
+ elementColors: props.elementColors
16
+ ? props.elementColors
17
+ : props.color
18
+ ? {
19
+ containerColor: props.color,
20
+ }
21
+ : undefined,
22
+ };
23
+ }
24
+ /**
25
+ * Displays a native button component.
26
+ */
27
+ export function Button(props) {
28
+ // Min height from https://m3.material.io/components/buttons/specs, minWidth
29
+ return (<ButtonNativeView {...transformButtonProps(props)} style={StyleSheet.compose({ minWidth: 80, minHeight: 40 }, props.style)}/>);
30
+ }
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jetpack-compose/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAa,UAAU,EAAa,MAAM,cAAc,CAAC;AAsEhE,wFAAwF;AACxF,MAAM,gBAAgB,GAA2C,iBAAiB,CAChF,QAAQ,EACR,QAAQ,CACT,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAkB;IACrD,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAC/D,OAAO;QACL,GAAG,SAAS;QACZ,IAAI,EAAE,QAAQ,IAAI,EAAE;QACpB,WAAW;QACX,eAAe,EAAE,OAAO;QACxB,aAAa,EAAE,KAAK,CAAC,aAAa;YAChC,CAAC,CAAC,KAAK,CAAC,aAAa;YACrB,CAAC,CAAC,KAAK,CAAC,KAAK;gBACX,CAAC,CAAC;oBACE,cAAc,EAAE,KAAK,CAAC,KAAK;iBAC5B;gBACH,CAAC,CAAC,SAAS;KAChB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,4EAA4E;IAC5E,OAAO,CACL,CAAC,gBAAgB,CACf,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAChC,KAAK,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EACxE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport { StyleProp, StyleSheet, ViewStyle } from 'react-native';\n\nimport { MaterialIcon } from './types';\nimport { ViewEvent } from '../../types';\n\n/**\n * The built-in button styles available on Android.\n * - `outlined` - A button with an outline.\n * - `elevated` - A filled button with a shadow.\n */\nexport type ButtonVariant = 'default' | 'bordered' | 'borderless' | 'outlined' | 'elevated';\n\n/**\n * Colors for button's core elements.\n */\nexport type ButtonElementColors = {\n containerColor?: string;\n contentColor?: string;\n disabledContainerColor?: string;\n disabledContentColor?: string;\n};\n\nexport type ButtonProps = {\n /**\n * A callback that is called when the button is pressed.\n */\n onPress?: () => void;\n /**\n * A string describing the system image to display in the button.\n * Uses Material Icons on Android.\n */\n systemImage?: MaterialIcon;\n /**\n * The button variant.\n */\n variant?: ButtonVariant;\n /**\n * Additional styles to apply to the button.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * The text to display inside the button.\n */\n children: string;\n /**\n * Colors for button's core elements.\n * @platform android\n */\n elementColors?: ButtonElementColors;\n /**\n * Button color.\n */\n color?: string;\n /**\n * Disabled state of the button.\n */\n disabled?: boolean;\n};\n\n/**\n * @hidden\n */\nexport type NativeButtonProps = Omit<\n ButtonProps,\n 'role' | 'onPress' | 'children' | 'systemImage'\n> & {\n text: string;\n systemImage?: string;\n} & ViewEvent<'onButtonPressed', void>;\n\n// We have to work around the `role` and `onPress` props being reserved by React Native.\nconst ButtonNativeView: React.ComponentType<NativeButtonProps> = requireNativeView(\n 'ExpoUI',\n 'Button'\n);\n\n/**\n * @hidden\n */\nexport function transformButtonProps(props: ButtonProps): NativeButtonProps {\n const { children, onPress, systemImage, ...restProps } = props;\n return {\n ...restProps,\n text: children ?? '',\n systemImage,\n onButtonPressed: onPress,\n elementColors: props.elementColors\n ? props.elementColors\n : props.color\n ? {\n containerColor: props.color,\n }\n : undefined,\n };\n}\n\n/**\n * Displays a native button component.\n */\nexport function Button(props: ButtonProps) {\n // Min height from https://m3.material.io/components/buttons/specs, minWidth\n return (\n <ButtonNativeView\n {...transformButtonProps(props)}\n style={StyleSheet.compose({ minWidth: 80, minHeight: 40 }, props.style)}\n />\n );\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/Button/types.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvE,KAAK,IAAI,GACL,YAAY,GACZ,eAAe,GACf,KAAK,GACL,WAAW,GACX,WAAW,GACX,eAAe,GACf,cAAc,GACd,OAAO,GACP,MAAM,GACN,OAAO,GACP,aAAa,GACb,OAAO,GACP,OAAO,GACP,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,WAAW,GACX,MAAM,GACN,UAAU,GACV,gBAAgB,GAChB,MAAM,GACN,MAAM,GACN,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,iBAAiB,GACjB,MAAM,GACN,YAAY,GACZ,MAAM,GACN,aAAa,GACb,MAAM,GACN,UAAU,GACV,eAAe,GACf,QAAQ,GACR,OAAO,GACP,OAAO,GACP,WAAW,GACX,SAAS,GACT,QAAQ,GACR,MAAM,GACN,UAAU,GACV,OAAO,GACP,cAAc,GACd,MAAM,GACN,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,MAAM,YAAY,GAAG,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/jetpack-compose/Button/types.ts"],"names":[],"mappings":"","sourcesContent":["type Variant = 'rounded' | 'twotone' | 'outlined' | 'filled' | 'sharp';\n\ntype Icon =\n | 'AccountBox'\n | 'AccountCircle'\n | 'Add'\n | 'AddCircle'\n | 'ArrowBack'\n | 'ArrowDropDown'\n | 'ArrowForward'\n | 'Build'\n | 'Call'\n | 'Check'\n | 'CheckCircle'\n | 'Clear'\n | 'Close'\n | 'Create'\n | 'DateRange'\n | 'Delete'\n | 'Done'\n | 'Edit'\n | 'Email'\n | 'ExitToApp'\n | 'Face'\n | 'Favorite'\n | 'FavoriteBorder'\n | 'Home'\n | 'Info'\n | 'KeyboardArrowDown'\n | 'KeyboardArrowLeft'\n | 'KeyboardArrowRight'\n | 'KeyboardArrowUp'\n | 'List'\n | 'LocationOn'\n | 'Lock'\n | 'MailOutline'\n | 'Menu'\n | 'MoreVert'\n | 'Notifications'\n | 'Person'\n | 'Phone'\n | 'Place'\n | 'PlayArrow'\n | 'Refresh'\n | 'Search'\n | 'Send'\n | 'Settings'\n | 'Share'\n | 'ShoppingCart'\n | 'Star'\n | 'ThumbUp'\n | 'Warning';\n\nexport type MaterialIcon = `${Variant}.${Icon}`;\n"]}
@@ -0,0 +1,86 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';
3
+ import { ButtonProps } from '../Button';
4
+ import { PickerProps } from '../Picker';
5
+ import { SwitchProps } from '../Switch';
6
+ type SubmenuElement = ReactElement<ButtonProps> | ReactElement<SwitchProps> | ReactElement<PickerProps> | ReactElement<SubmenuProps>;
7
+ export type ContextMenuContentProps = {
8
+ children: SubmenuElement | SubmenuElement[];
9
+ };
10
+ /**
11
+ * @hidden
12
+ */
13
+ export type EventHandlers = Record<string, Record<string, (event: NativeSyntheticEvent<any>) => void>>;
14
+ /**
15
+ * @hidden
16
+ */
17
+ export type ContextMenuElementBase = {
18
+ contextMenuElementID: string;
19
+ };
20
+ /**
21
+ * Activation method of the context menu.
22
+ * - `singlePress`: The context menu is opened with a single tap. Does not isolate the content.
23
+ * - `longPress`: The context menu is opened with a long press. On iOS additionally Highlights the content by blurring the background.
24
+ */
25
+ export type ActivationMethod = 'singlePress' | 'longPress';
26
+ /**
27
+ * Props of the `ContextMenu` component.
28
+ */
29
+ export type ContextMenuProps = {
30
+ /**
31
+ * Determines how the context menu will be activated.
32
+ *
33
+ * @platform ios
34
+ */
35
+ activationMethod?: ActivationMethod;
36
+ /**
37
+ * The contents of the submenu are used as an anchor for the context menu.
38
+ * The children will be wrapped in a pressable element, which triggers opening of the context menu.
39
+ */
40
+ children: ReactNode;
41
+ /**
42
+ * The color of the container holding the context menu items.
43
+ *
44
+ * @platform android
45
+ */
46
+ color?: string;
47
+ /**
48
+ * Optional styles to apply to the `ContextMenu`.
49
+ */
50
+ style?: StyleProp<ViewStyle>;
51
+ };
52
+ /**
53
+ * Props of the `Submenu` component.
54
+ */
55
+ export type SubmenuProps = {
56
+ /**
57
+ * The button that will be used to expand the submenu. On Android the `text` prop of the `Button` will be used as a section title.
58
+ */
59
+ button: ReactElement<ButtonProps>;
60
+ /**
61
+ * Children of the submenu. Only `Button`, `Switch`, `Picker` and `Submenu` elements should be used.
62
+ */
63
+ children: ReactNode;
64
+ };
65
+ export declare function Submenu(): import("react").JSX.Element;
66
+ export declare function Items(): import("react").JSX.Element;
67
+ export declare namespace Items {
68
+ var tag: string;
69
+ }
70
+ export declare function Trigger(props: {
71
+ children: React.ReactNode;
72
+ }): import("react").JSX.Element;
73
+ export declare namespace Trigger {
74
+ var tag: string;
75
+ }
76
+ export declare function Preview(props: {
77
+ children: React.ReactNode;
78
+ }): import("react").JSX.Element;
79
+ declare function ContextMenu(props: ContextMenuProps): import("react").JSX.Element;
80
+ declare namespace ContextMenu {
81
+ var Trigger: typeof import(".").Trigger;
82
+ var Preview: typeof import(".").Preview;
83
+ var Items: typeof import(".").Items;
84
+ }
85
+ export { ContextMenu };
86
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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,GAAG;IACzB;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAClC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAyBF,wBAAgB,OAAO,gCAEtB;AAED,wBAAgB,KAAK,gCAEpB;yBAFe,KAAK;;;AAKrB,wBAAgB,OAAO,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,+BAE3D;yBAFe,OAAO;;;AAKvB,wBAAgB,OAAO,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,+BAE3D;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAmC3C;kBAnCQ,WAAW;;;;;AAyCpB,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { Children, useMemo } from 'react';
3
+ import { transformChildrenToElementArray } from './utils';
4
+ const MenuNativeView = requireNativeView('ExpoUI', 'ContextMenu');
5
+ export function Submenu() {
6
+ return <></>;
7
+ }
8
+ export function Items() {
9
+ return <></>;
10
+ }
11
+ Items.tag = 'Items';
12
+ export function Trigger(props) {
13
+ return <></>;
14
+ }
15
+ Trigger.tag = 'Trigger';
16
+ export function Preview(props) {
17
+ return <></>;
18
+ }
19
+ function ContextMenu(props) {
20
+ const eventHandlersMap = {};
21
+ const initialChildren = Children.map(props.children, (c) => c.type.tag === Items.tag ? c.props.children : null);
22
+ const processedElements = useMemo(() => transformChildrenToElementArray(initialChildren, eventHandlersMap), [initialChildren]);
23
+ const activationElement = Children.map(props.children, (c) => c.type.tag === Trigger.tag ? c.props.children : null);
24
+ const createEventHandler = (handlerType) => (e) => {
25
+ const handler = eventHandlersMap[e.nativeEvent.contextMenuElementID]?.[handlerType];
26
+ handler?.(e);
27
+ };
28
+ return (<MenuNativeView style={props.style} elements={processedElements} onContextMenuButtonPressed={createEventHandler('onPress')} onContextMenuSwitchValueChanged={createEventHandler('onValueChange')} onContextMenuPickerOptionSelected={createEventHandler('onOptionSelected')} {...props}>
29
+ {activationElement}
30
+ </MenuNativeView>);
31
+ }
32
+ ContextMenu.Trigger = Trigger;
33
+ ContextMenu.Preview = Preview;
34
+ ContextMenu.Items = Items;
35
+ export { ContextMenu };
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jetpack-compose/ContextMenu/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,QAAQ,EAA2B,OAAO,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,EAAe,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAKvE,MAAM,cAAc,GAAyC,iBAAiB,CAC5E,QAAQ,EACR,aAAa,CACd,CAAC;AAmGF,MAAM,UAAU,OAAO;IACrB,OAAO,EAAE,GAAG,CAAC;AACf,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,OAAO,EAAE,GAAG,CAAC;AACf,CAAC;AACD,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC;AAEpB,MAAM,UAAU,OAAO,CAAC,KAAoC;IAC1D,OAAO,EAAE,GAAG,CAAC;AACf,CAAC;AACD,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;AAExB,MAAM,UAAU,OAAO,CAAC,KAAoC;IAC1D,OAAO,EAAE,GAAG,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,KAAuB;IAC1C,MAAM,gBAAgB,GAAkB,EAAE,CAAC;IAC3C,MAAM,eAAe,GAAG,QAAQ,CAAC,GAAG,CAClC,KAAK,CAAC,QAAe,EACrB,CAAC,CAAkE,EAAE,EAAE,CACrE,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CA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":["import { requireNativeView } from 'expo';\nimport { Children, ReactElement, ReactNode, useMemo } from 'react';\nimport { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';\n\nimport { MenuElement, transformChildrenToElementArray } from './utils';\nimport { ButtonProps } from '../Button';\nimport { PickerProps } from '../Picker';\nimport { SwitchProps } from '../Switch';\n\nconst MenuNativeView: React.ComponentType<NativeMenuProps> = requireNativeView(\n 'ExpoUI',\n 'ContextMenu'\n);\n\ntype SubmenuElement =\n | ReactElement<ButtonProps>\n | ReactElement<SwitchProps>\n | ReactElement<PickerProps>\n | ReactElement<SubmenuProps>;\n\nexport type ContextMenuContentProps = {\n children: SubmenuElement | SubmenuElement[];\n};\n\n/**\n * @hidden\n */\nexport type EventHandlers = Record<\n string,\n Record<string, (event: NativeSyntheticEvent<any>) => void>\n>;\n\n/**\n * @hidden\n */\nexport type ContextMenuElementBase = { contextMenuElementID: string };\n\n/**\n * Activation method of the context menu.\n * - `singlePress`: The context menu is opened with a single tap. Does not isolate the content.\n * - `longPress`: The context menu is opened with a long press. On iOS additionally Highlights the content by blurring the background.\n */\nexport type ActivationMethod = 'singlePress' | 'longPress';\n\n/**\n * Props of the `ContextMenu` component.\n */\nexport type ContextMenuProps = {\n /**\n * Determines how the context menu will be activated.\n *\n * @platform ios\n */\n activationMethod?: ActivationMethod;\n\n /**\n * The contents of the submenu are used as an anchor for the context menu.\n * The children will be wrapped in a pressable element, which triggers opening of the context menu.\n */\n children: ReactNode;\n\n /**\n * The color of the container holding the context menu items.\n *\n * @platform android\n */\n color?: string;\n\n /**\n * Optional styles to apply to the `ContextMenu`.\n */\n style?: StyleProp<ViewStyle>;\n};\n\n/**\n * Props of the `Submenu` component.\n */\nexport type SubmenuProps = {\n /**\n * The button that will be used to expand the submenu. On Android the `text` prop of the `Button` will be used as a section title.\n */\n button: ReactElement<ButtonProps>;\n /**\n * Children of the submenu. Only `Button`, `Switch`, `Picker` and `Submenu` elements should be used.\n */\n children: ReactNode;\n};\n\n/**\n * @hidden\n */\ntype NativeMenuProps = ContextMenuProps & {\n elements: MenuElement[];\n onContextMenuButtonPressed: (\n event: NativeSyntheticEvent<{ contextMenuElementID: string }>\n ) => void;\n onContextMenuSwitchValueChanged: (\n event: NativeSyntheticEvent<{\n contextMenuElementID: string;\n value: boolean;\n }>\n ) => void;\n onContextMenuPickerOptionSelected: (\n event: NativeSyntheticEvent<{\n index: number;\n label: string;\n contextMenuElementID: string;\n }>\n ) => void;\n};\n\nexport function Submenu() {\n return <></>;\n}\n\nexport function Items() {\n return <></>;\n}\nItems.tag = 'Items';\n\nexport function Trigger(props: { children: React.ReactNode }) {\n return <></>;\n}\nTrigger.tag = 'Trigger';\n\nexport function Preview(props: { children: React.ReactNode }) {\n return <></>;\n}\n\nfunction ContextMenu(props: ContextMenuProps) {\n const eventHandlersMap: EventHandlers = {};\n const initialChildren = Children.map(\n props.children as any,\n (c: { type: { tag: string }; props: { children: React.ReactNode } }) =>\n c.type.tag === Items.tag ? c.props.children : null\n );\n const processedElements = useMemo(\n () => transformChildrenToElementArray(initialChildren, eventHandlersMap),\n [initialChildren]\n );\n\n const activationElement = Children.map(\n props.children as any,\n (c: { type: { tag: string }; props: { children: React.ReactNode } }) =>\n c.type.tag === Trigger.tag ? c.props.children : null\n );\n\n const createEventHandler =\n (handlerType: string) => (e: NativeSyntheticEvent<{ contextMenuElementID: string }>) => {\n const handler = eventHandlersMap[e.nativeEvent.contextMenuElementID]?.[handlerType];\n handler?.(e);\n };\n\n return (\n <MenuNativeView\n style={props.style}\n elements={processedElements}\n onContextMenuButtonPressed={createEventHandler('onPress')}\n onContextMenuSwitchValueChanged={createEventHandler('onValueChange')}\n onContextMenuPickerOptionSelected={createEventHandler('onOptionSelected')}\n {...props}>\n {activationElement}\n </MenuNativeView>\n );\n}\n\nContextMenu.Trigger = Trigger;\nContextMenu.Preview = Preview;\nContextMenu.Items = Items;\n\nexport { ContextMenu };\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/ContextMenu/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1E,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAyB,MAAM,SAAS,CAAC;AACvF,OAAO,EAAuB,iBAAiB,EAAwB,MAAM,WAAW,CAAC;AACzF,OAAO,EAAU,WAAW,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAU,WAAW,EAAE,MAAM,WAAW,CAAC;AAGhD,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,GAAG,sBAAsB,CAAC;AAE3B,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,sBAAsB,CAAC;AAE3B,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,sBAAsB,CAAC;AAE3B,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE;QACP,QAAQ,EAAE,WAAW,EAAE,CAAC;QACxB,MAAM,EAAE,iBAAiB,CAAC;KAC3B,CAAC;CACH,GAAG,sBAAsB,CAAC;AAE3B,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,CAAC;AAInB,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,SAAS,EACnB,gBAAgB,EAAE,aAAa,GAC9B,WAAW,EAAE,CAIf"}
@@ -0,0 +1,79 @@
1
+ import { Children, isValidElement } from 'react';
2
+ import { Submenu } from './index';
3
+ import { Button, transformButtonProps } from '../Button';
4
+ import { Picker } from '../Picker';
5
+ import { Switch } from '../Switch';
6
+ // Maps the react children to NativeMenuElement[] which is used to render out the native menu
7
+ // TODO: Ideally we want to pass the children directly to the native side without having to do this
8
+ export function transformChildrenToElementArray(children, eventHandlersMap) {
9
+ return Children.toArray(children)
10
+ .map((child) => processChildElement(child, eventHandlersMap))
11
+ .filter((el) => el !== null);
12
+ }
13
+ function processChildElement(child, eventHandlersMap) {
14
+ if (!isValidElement(child))
15
+ return null;
16
+ const uuid = expo.uuidv4();
17
+ if (child.type === Button) {
18
+ // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps
19
+ return createButtonElement(uuid, child.props, eventHandlersMap);
20
+ }
21
+ if (child.type === Switch) {
22
+ // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps
23
+ return createSwitchElement(uuid, child.props, eventHandlersMap);
24
+ }
25
+ if (child.type === Picker) {
26
+ // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps
27
+ return createPickerElement(uuid, child.props, eventHandlersMap);
28
+ }
29
+ if (isSubmenuComponent(child)) {
30
+ // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps
31
+ return createSubmenuElement(uuid, child.props, eventHandlersMap);
32
+ }
33
+ console.warn('Unsupported child type in Menu: ', child.type);
34
+ return null;
35
+ }
36
+ function createButtonElement(uuid, props, handlers) {
37
+ if (props.onPress) {
38
+ handlers[uuid] = { onPress: props.onPress };
39
+ }
40
+ return {
41
+ contextMenuElementID: uuid,
42
+ button: transformButtonProps(props),
43
+ };
44
+ }
45
+ function createSwitchElement(uuid, props, handlers) {
46
+ if (props.onValueChange) {
47
+ handlers[uuid] = {
48
+ onValueChange: ({ nativeEvent: { value } }) => {
49
+ props.onValueChange?.(value);
50
+ },
51
+ };
52
+ }
53
+ return {
54
+ contextMenuElementID: uuid,
55
+ switch: props,
56
+ };
57
+ }
58
+ function createPickerElement(uuid, props, handlers) {
59
+ if (props.onOptionSelected) {
60
+ handlers[uuid] = { onOptionSelected: props.onOptionSelected };
61
+ }
62
+ return {
63
+ contextMenuElementID: uuid,
64
+ picker: props,
65
+ };
66
+ }
67
+ function createSubmenuElement(uuid, props, handlers) {
68
+ return {
69
+ contextMenuElementID: uuid,
70
+ submenu: {
71
+ button: transformButtonProps(props.button.props),
72
+ elements: transformChildrenToElementArray(props.children, handlers),
73
+ },
74
+ };
75
+ }
76
+ function isSubmenuComponent(child) {
77
+ return child.type.toString() === Submenu.toString();
78
+ }
79
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/jetpack-compose/ContextMenu/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAA2B,MAAM,OAAO,CAAC;AAG1E,OAAO,EAAyC,OAAO,EAAgB,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,MAAM,EAAkC,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AA4BhD,6FAA6F;AAC7F,mGAAmG;AACnG,MAAM,UAAU,+BAA+B,CAC7C,QAAmB,EACnB,gBAA+B;IAE/B,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC9B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;SAC5D,MAAM,CAAC,CAAC,EAAE,EAAqB,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,mBAAmB,CAC1B,KAAgB,EAChB,gBAA+B;IAE/B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAE3B,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,6GAA6G;QAC7G,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EA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K;KACd,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,IAAY,EACZ,KAAkB,EAClB,QAAuB;IAEvB,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3B,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAChE,CAAC;IAED,OAAO;QACL,oBAAoB,EAAE,IAAI;QAC1B,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,IAAY,EACZ,KAAmB,EACnB,QAAuB;IAEvB,OAAO;QACL,oBAAoB,EAAE,IAAI;QAC1B,OAAO,EAAE;YACP,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YAChD,QAAQ,EAAE,+BAA+B,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC;SACpE;KACF,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAmB;IAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import { Children, isValidElement, ReactElement, ReactNode } from 'react';\nimport { NativeSyntheticEvent } from 'react-native';\n\nimport { ContextMenuElementBase, EventHandlers, Submenu, SubmenuProps } from './index';\nimport { Button, ButtonProps, NativeButtonProps, transformButtonProps } from '../Button';\nimport { Picker, PickerProps } from '../Picker';\nimport { Switch, SwitchProps } from '../Switch';\n\n// We use this slightly odd typing for the elements to make unpacking the elements easier on the native side\ntype ButtonMenuElement = {\n button: NativeButtonProps;\n} & ContextMenuElementBase;\n\ntype SwitchMenuElement = {\n switch: SwitchProps;\n} & ContextMenuElementBase;\n\ntype PickerMenuElement = {\n picker: PickerProps;\n} & ContextMenuElementBase;\n\ntype SubmenuElement = {\n submenu: {\n elements: MenuElement[];\n button: NativeButtonProps;\n };\n} & ContextMenuElementBase;\n\nexport type MenuElement =\n | ButtonMenuElement\n | SwitchMenuElement\n | PickerMenuElement\n | SubmenuElement;\n\n// Maps the react children to NativeMenuElement[] which is used to render out the native menu\n// TODO: Ideally we want to pass the children directly to the native side without having to do this\nexport function transformChildrenToElementArray(\n children: ReactNode,\n eventHandlersMap: EventHandlers\n): MenuElement[] {\n return Children.toArray(children)\n .map((child) => processChildElement(child, eventHandlersMap))\n .filter((el): el is MenuElement => el !== null);\n}\n\nfunction processChildElement(\n child: ReactNode,\n eventHandlersMap: EventHandlers\n): MenuElement | null {\n if (!isValidElement(child)) return null;\n\n const uuid = expo.uuidv4();\n\n if (child.type === Button) {\n // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps\n return createButtonElement(uuid, child.props, eventHandlersMap);\n }\n\n if (child.type === Switch) {\n // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps\n return createSwitchElement(uuid, child.props, eventHandlersMap);\n }\n\n if (child.type === Picker) {\n // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps\n return createPickerElement(uuid, child.props, eventHandlersMap);\n }\n\n if (isSubmenuComponent(child)) {\n // @ts-expect-error TODO TS2345: Argument of type unknown is not assignable to parameter of type SubmenuProps\n return createSubmenuElement(uuid, child.props, eventHandlersMap);\n }\n\n console.warn('Unsupported child type in Menu: ', child.type);\n return null;\n}\n\nfunction createButtonElement(\n uuid: string,\n props: ButtonProps,\n handlers: EventHandlers\n): MenuElement {\n if (props.onPress) {\n handlers[uuid] = { onPress: props.onPress };\n }\n\n return {\n contextMenuElementID: uuid,\n button: transformButtonProps(props),\n };\n}\n\nfunction createSwitchElement(\n uuid: string,\n props: SwitchProps,\n handlers: EventHandlers\n): MenuElement {\n if (props.onValueChange) {\n handlers[uuid] = {\n onValueChange: ({ nativeEvent: { value } }: NativeSyntheticEvent<{ value: boolean }>) => {\n props.onValueChange?.(value);\n },\n };\n }\n\n return {\n contextMenuElementID: uuid,\n switch: props,\n };\n}\n\nfunction createPickerElement(\n uuid: string,\n props: PickerProps,\n handlers: EventHandlers\n): MenuElement {\n if (props.onOptionSelected) {\n handlers[uuid] = { onOptionSelected: props.onOptionSelected };\n }\n\n return {\n contextMenuElementID: uuid,\n picker: props,\n };\n}\n\nfunction createSubmenuElement(\n uuid: string,\n props: SubmenuProps,\n handlers: EventHandlers\n): MenuElement {\n return {\n contextMenuElementID: uuid,\n submenu: {\n button: transformButtonProps(props.button.props),\n elements: transformChildrenToElementArray(props.children, handlers),\n },\n };\n}\n\nfunction isSubmenuComponent(child: ReactElement): boolean {\n return child.type.toString() === Submenu.toString();\n}\n"]}
@@ -1,37 +1,23 @@
1
1
  import { StyleProp, ViewStyle } from 'react-native';
2
- import { ViewEvent } from '../src/types';
2
+ import { ViewEvent } from '../../types';
3
3
  export type AndroidVariant = 'picker' | 'input';
4
- export type IOSVariant = 'wheel' | 'automatic' | 'graphical' | 'compact';
5
4
  export type DisplayedComponents = 'date' | 'hourAndMinute' | 'dateAndTime';
6
5
  export type DateTimePickerProps = {
7
6
  /**
8
7
  * The initial date to display on the picker.
9
8
  */
10
9
  initialDate?: string | null;
11
- /**
12
- * A title displayed on the picker on iOS.
13
- * @platform ios
14
- */
15
- title?: string;
16
10
  /**
17
11
  * Callback function that is called when a date is selected.
18
12
  */
19
13
  onDateSelected?: (date: Date) => void;
20
14
  /**
21
15
  * The variant of the picker, which determines its appearance and behavior.
22
- * @platform ios
23
- * @default 'automatic'
24
- */
25
- iosVariant?: IOSVariant;
26
- /**
27
- * The variant of the picker, which determines its appearance and behavior.
28
- * @platform android
29
16
  * @default 'picker'
30
17
  */
31
- androidVariant?: AndroidVariant;
18
+ variant?: AndroidVariant;
32
19
  /**
33
20
  * Show to button to toggle between variants on Android.
34
- * @platform android
35
21
  * @default true
36
22
  */
37
23
  showVariantToggle?: boolean;
@@ -53,13 +39,12 @@ export type DateTimePickerProps = {
53
39
  color?: string;
54
40
  /**
55
41
  * Determines what format the clock should be displayed in on Android.
56
- * @platform android
57
42
  * @default true
58
43
  */
59
44
  is24Hour?: boolean;
60
45
  };
61
- type NativeDatePickerProps = Omit<DateTimePickerProps, 'iosVariant' | 'androidVariant' | 'onDateSelected'> & {
62
- variant?: IOSVariant | AndroidVariant;
46
+ type NativeDatePickerProps = Omit<DateTimePickerProps, 'variant' | 'onDateSelected'> & {
47
+ variant?: AndroidVariant;
63
48
  } & ViewEvent<'onDateSelected', {
64
49
  date: Date;
65
50
  }>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/DatePicker/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAA0B,MAAM,cAAc,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,eAAe,GAAG,aAAa,CAAC;AAE3E,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,gBAAgB,CAAC,GAAG;IACrF,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,GAAG,SAAS,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAEhD;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,mBAAmB,GAAG,qBAAqB,CAoB9F;AAOD;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+BAExD"}
@@ -0,0 +1,31 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { StyleSheet, PixelRatio } from 'react-native';
3
+ /**
4
+ * @hidden
5
+ */
6
+ export function transformDateTimePickerProps(props) {
7
+ const { variant, ...rest } = props;
8
+ const { minWidth, minHeight, ...restStyle } = StyleSheet.flatten(rest.style) || {};
9
+ // On Android, the picker’s minWidth and minHeight must be 12dp.
10
+ // Otherwise, the picker will crash the app.
11
+ const minSize = PixelRatio.getPixelSizeForLayoutSize(12);
12
+ // However, when users pass the minWidth and minHeight props, we trust that they know what they are doing.
13
+ const parsedMinWidth = minWidth ? minSize : undefined;
14
+ const parsedMinHeight = minHeight ? minSize : undefined;
15
+ return {
16
+ ...rest,
17
+ onDateSelected: ({ nativeEvent: { date } }) => {
18
+ props?.onDateSelected?.(new Date(date));
19
+ },
20
+ variant,
21
+ style: [restStyle, { minWidth: parsedMinWidth, minHeight: parsedMinHeight }],
22
+ };
23
+ }
24
+ const DatePickerNativeView = requireNativeView('ExpoUI', 'DateTimePickerView');
25
+ /**
26
+ * Renders a `DateTimePicker` component.
27
+ */
28
+ export function DateTimePicker(props) {
29
+ return <DatePickerNativeView {...transformDateTimePickerProps(props)}/>;
30
+ }
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jetpack-compose/DatePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAwB,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsD5E;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAA0B;IACrE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACnC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAEnF,gEAAgE;IAChE,4CAA4C;IAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC;IAEzD,0GAA0G;IAC1G,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,MAAM,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAExD,OAAO;QACL,GAAG,IAAI;QACP,cAAc,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;YAC5C,KAAK,EAAE,cAAc,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO;QACP,KAAK,EAAE,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAA+C,iBAAiB,CACxF,QAAQ,EACR,oBAAoB,CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,OAAO,CAAC,oBAAoB,CAAC,IAAI,4BAA4B,CAAC,KAAK,CAAC,CAAC,EAAG,CAAC;AAC3E,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport { StyleProp, ViewStyle, StyleSheet, PixelRatio } from 'react-native';\n\nimport { ViewEvent } from '../../types';\n\nexport type AndroidVariant = 'picker' | 'input';\n\nexport type DisplayedComponents = 'date' | 'hourAndMinute' | 'dateAndTime';\n\nexport type DateTimePickerProps = {\n /**\n * The initial date to display on the picker.\n */\n initialDate?: string | null;\n /**\n * Callback function that is called when a date is selected.\n */\n onDateSelected?: (date: Date) => void;\n /**\n * The variant of the picker, which determines its appearance and behavior.\n * @default 'picker'\n */\n variant?: AndroidVariant;\n /**\n * Show to button to toggle between variants on Android.\n * @default true\n */\n showVariantToggle?: boolean;\n /**\n * The components that the picker should display.\n * On Android, you can have a picker that selects just the date or just the time.\n * `dateAndTime` is only available on iOS and will result in a date picker on Android.\n * On iOS, you can have a picker that selects both date and time.\n * @default 'date'\n */\n displayedComponents?: DisplayedComponents;\n /**\n * Optional style to apply to the component.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * The tint color to use on the picker elements.\n */\n color?: string;\n /**\n * Determines what format the clock should be displayed in on Android.\n * @default true\n */\n is24Hour?: boolean;\n};\n\ntype NativeDatePickerProps = Omit<DateTimePickerProps, 'variant' | 'onDateSelected'> & {\n variant?: AndroidVariant;\n} & ViewEvent<'onDateSelected', { date: Date }>;\n\n/**\n * @hidden\n */\nexport function transformDateTimePickerProps(props: DateTimePickerProps): NativeDatePickerProps {\n const { variant, ...rest } = props;\n const { minWidth, minHeight, ...restStyle } = StyleSheet.flatten(rest.style) || {};\n\n // On Android, the picker’s minWidth and minHeight must be 12dp.\n // Otherwise, the picker will crash the app.\n const minSize = PixelRatio.getPixelSizeForLayoutSize(12);\n\n // However, when users pass the minWidth and minHeight props, we trust that they know what they are doing.\n const parsedMinWidth = minWidth ? minSize : undefined;\n const parsedMinHeight = minHeight ? minSize : undefined;\n\n return {\n ...rest,\n onDateSelected: ({ nativeEvent: { date } }) => {\n props?.onDateSelected?.(new Date(date));\n },\n variant,\n style: [restStyle, { minWidth: parsedMinWidth, minHeight: parsedMinHeight }],\n };\n}\n\nconst DatePickerNativeView: React.ComponentType<NativeDatePickerProps> = requireNativeView(\n 'ExpoUI',\n 'DateTimePickerView'\n);\n\n/**\n * Renders a `DateTimePicker` component.\n */\nexport function DateTimePicker(props: DateTimePickerProps) {\n return <DatePickerNativeView {...transformDateTimePickerProps(props)} />;\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import { StyleProp, ViewStyle } from 'react-native';
2
2
  /**
3
3
  * Colors for picker's core elements.
4
- * @platform android
5
4
  */
6
5
  export type PickerElementColors = {
7
6
  activeBorderColor?: string;
@@ -26,11 +25,6 @@ export type PickerProps = {
26
25
  * The index of the currently selected option.
27
26
  */
28
27
  selectedIndex: number | null;
29
- /**
30
- * A label displayed on the picker when in `'menu'` variant inside a form section on iOS.
31
- * @platform ios
32
- */
33
- label?: string;
34
28
  /**
35
29
  * Callback function that is called when an option is selected.
36
30
  */
@@ -45,18 +39,17 @@ export type PickerProps = {
45
39
  * The `'wheel'`, `'inline'`, `'palette'` and `'menu'` variants are iOS only, the `'radio'` variant is Android only. The `'inline'` variant can only be used inside sections or lists. The `'palette'` variant displays differently inside menus.
46
40
  * @default 'segmented'
47
41
  */
48
- variant?: 'wheel' | 'segmented' | 'menu' | 'radio' | 'inline' | 'palette';
42
+ variant?: 'segmented' | 'radio';
49
43
  /**
50
44
  * Optional style to apply to the picker component.
51
45
  */
52
46
  style?: StyleProp<ViewStyle>;
53
47
  /**
54
48
  * Colors for picker's core elements.
55
- * @platform android
56
49
  */
57
50
  elementColors?: PickerElementColors;
58
51
  /**
59
- * Picker color. On iOS it only applies to the `'menu'` variant.
52
+ * Picker color.
60
53
  */
61
54
  color?: string;
62
55
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/Picker/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBA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UI', 'PickerView');
3
+ /**
4
+ * @hidden
5
+ */
6
+ export function transformPickerProps(props) {
7
+ return {
8
+ ...props,
9
+ variant: props.variant ?? 'segmented',
10
+ elementColors: props.elementColors
11
+ ? props.elementColors
12
+ : props.color
13
+ ? {
14
+ activeContainerColor: props.color,
15
+ }
16
+ : undefined,
17
+ color: props.color,
18
+ };
19
+ }
20
+ /**
21
+ * Displays a native picker component. Depending on the variant it can be a segmented button, an inline picker, a list of choices or a radio button.
22
+ */
23
+ export function Picker(props) {
24
+ return <PickerNativeView {...transformPickerProps(props)}/>;
25
+ }
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jetpack-compose/Picker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAuDzC,MAAM,gBAAgB,GAAqC,iBAAiB,CAC1E,QAAQ,EACR,YAAY,CACb,CAAC;AAIF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAkB;IACrD,OAAO;QACL,GAAG,KAAK;QACR,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,WAAW;QACrC,aAAa,EAAE,KAAK,CAAC,aAAa;YAChC,CAAC,CAAC,KAAK,CAAC,aAAa;YACrB,CAAC,CAAC,KAAK,CAAC,KAAK;gBACX,CAAC,CAAC;oBACE,oBAAoB,EAAE,KAAK,CAAC,KAAK;iBAClC;gBACH,CAAC,CAAC,SAAS;QACf,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,CAAC,gBAAgB,CAAC,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,EAAG,CAAC;AAC/D,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport { StyleProp, ViewStyle } from 'react-native';\n\n/**\n * Colors for picker's core elements.\n */\nexport type PickerElementColors = {\n activeBorderColor?: string;\n activeContentColor?: string;\n inactiveBorderColor?: string;\n inactiveContentColor?: string;\n disabledActiveBorderColor?: string;\n disabledActiveContentColor?: string;\n disabledInactiveBorderColor?: string;\n disabledInactiveContentColor?: string;\n activeContainerColor?: string;\n inactiveContainerColor?: string;\n disabledActiveContainerColor?: string;\n disabledInactiveContainerColor?: string;\n};\n\nexport type PickerProps = {\n /**\n * An array of options to be displayed in the picker.\n */\n options: string[];\n /**\n * The index of the currently selected option.\n */\n selectedIndex: number | null;\n /**\n * Callback function that is called when an option is selected.\n */\n onOptionSelected?: (event: { nativeEvent: { index: number; label: string } }) => void;\n /**\n * The variant of the picker, which determines its appearance and behavior.\n * The `'wheel'`, `'inline'`, `'palette'` and `'menu'` variants are iOS only, the `'radio'` variant is Android only. The `'inline'` variant can only be used inside sections or lists. The `'palette'` variant displays differently inside menus.\n * @default 'segmented'\n */\n variant?: 'segmented' | 'radio';\n /**\n * Optional style to apply to the picker component.\n */\n style?: StyleProp<ViewStyle>;\n\n /**\n * Colors for picker's core elements.\n */\n elementColors?: PickerElementColors;\n /**\n * Picker color.\n */\n color?: string;\n};\n\nconst PickerNativeView: React.ComponentType<PickerProps> = requireNativeView(\n 'ExpoUI',\n 'PickerView'\n);\n\ntype NativePickerProps = PickerProps;\n\n/**\n * @hidden\n */\nexport function transformPickerProps(props: PickerProps): NativePickerProps {\n return {\n ...props,\n variant: props.variant ?? 'segmented',\n elementColors: props.elementColors\n ? props.elementColors\n : props.color\n ? {\n activeContainerColor: props.color,\n }\n : undefined,\n color: props.color,\n };\n}\n\n/**\n * Displays a native picker component. Depending on the variant it can be a segmented button, an inline picker, a list of choices or a radio button.\n */\nexport function Picker(props: PickerProps) {\n return <PickerNativeView {...transformPickerProps(props)} />;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/Progress/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC,CAAC;AAaF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,+BAE5D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+BAExD"}
@@ -0,0 +1,15 @@
1
+ import { requireNativeView } from 'expo';
2
+ const NativeProgressView = requireNativeView('ExpoUI', 'ProgressView');
3
+ /**
4
+ * Renders a `CircularProgress` component.
5
+ */
6
+ export function CircularProgress(props) {
7
+ return <NativeProgressView {...props} variant="circular"/>;
8
+ }
9
+ /**
10
+ * Renders a `LinearProgress` component.
11
+ */
12
+ export function LinearProgress(props) {
13
+ return <NativeProgressView {...props} variant="linear"/>;
14
+ }
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/jetpack-compose/Progress/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AA0DzC,MAAM,kBAAkB,GAA6C,iBAAiB,CACpF,QAAQ,EACR,cAAc,CACf,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,OAAO,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,UAAU,EAAG,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,OAAO,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAG,CAAC;AAC5D,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport { ColorValue, StyleProp, ViewStyle } from 'react-native';\n\nexport type ProgressElementColors = {\n /**\n * Track color.\n *\n * @platform android\n */\n trackColor?: ColorValue;\n};\n\nexport type CircularProgressProps = {\n /**\n * Custom styles for the progress component.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * The current progress value of the slider. This is a number between `0` and `1`.\n */\n progress?: number | null;\n /**\n * Progress color.\n */\n color?: ColorValue;\n /**\n * Colors for switch's core elements.\n * @platform android\n */\n elementColors?: ProgressElementColors;\n};\n\nexport type LinearProgressProps = {\n /**\n * Custom styles for the progress component.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * The current progress value of the slider. This is a number between `0` and `1`.\n */\n progress?: number | null;\n /**\n * Progress color.\n */\n color?: ColorValue;\n /**\n * Colors for switch's core elements.\n * @platform android\n */\n elementColors?: ProgressElementColors;\n};\n\ntype NativeProgressProps =\n | CircularProgressProps\n | (LinearProgressProps & {\n variant: 'linear' | 'circular';\n });\n\nconst NativeProgressView: React.ComponentType<NativeProgressProps> = requireNativeView(\n 'ExpoUI',\n 'ProgressView'\n);\n\n/**\n * Renders a `CircularProgress` component.\n */\nexport function CircularProgress(props: CircularProgressProps) {\n return <NativeProgressView {...props} variant=\"circular\" />;\n}\n\n/**\n * Renders a `LinearProgress` component.\n */\nexport function LinearProgress(props: LinearProgressProps) {\n return <NativeProgressView {...props} variant=\"linear\" />;\n}\n"]}