@expo/ui 55.0.1 → 55.0.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 (269) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/CONTRIBUTING.md +30 -0
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +130 -0
  5. package/android/src/main/java/expo/modules/ui/CardView.kt +138 -34
  6. package/android/src/main/java/expo/modules/ui/CheckboxView.kt +98 -0
  7. package/android/src/main/java/expo/modules/ui/ChipView.kt +267 -142
  8. package/android/src/main/java/expo/modules/ui/DatePickerView.kt +302 -31
  9. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +204 -57
  10. package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +21 -8
  11. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +149 -40
  12. package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
  13. package/android/src/main/java/expo/modules/ui/RNHostView.kt +204 -50
  14. package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
  15. package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
  16. package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
  17. package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
  18. package/android/src/main/java/expo/modules/ui/SwitchView.kt +62 -104
  19. package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
  20. package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
  21. package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
  22. package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -80
  23. package/android/src/main/java/expo/modules/ui/convertibles/AnimatableFloat.kt +26 -0
  24. package/android/src/main/java/expo/modules/ui/convertibles/AnimationSpecParams.kt +93 -0
  25. package/android/src/main/java/expo/modules/ui/convertibles/GraphicsLayerParams.kt +24 -0
  26. package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
  27. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
  28. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
  29. package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
  30. package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
  31. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
  32. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
  33. package/build/jetpack-compose/Button/index.d.ts +65 -51
  34. package/build/jetpack-compose/Button/index.d.ts.map +1 -1
  35. package/build/jetpack-compose/Card/index.d.ts +72 -14
  36. package/build/jetpack-compose/Card/index.d.ts.map +1 -1
  37. package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
  38. package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
  39. package/build/jetpack-compose/Chip/index.d.ts +247 -27
  40. package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
  41. package/build/jetpack-compose/DatePicker/index.d.ts +137 -3
  42. package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
  43. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
  44. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
  45. package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
  46. package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
  47. package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
  48. package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
  49. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
  50. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
  51. package/build/jetpack-compose/IconButton/index.d.ts +45 -29
  52. package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
  53. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
  54. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  55. package/build/jetpack-compose/Progress/index.d.ts +78 -35
  56. package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
  57. package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
  58. package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
  59. package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
  60. package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
  61. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
  62. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  63. package/build/jetpack-compose/Slider/index.d.ts +34 -10
  64. package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
  65. package/build/jetpack-compose/Spacer/index.d.ts +2 -2
  66. package/build/jetpack-compose/Switch/index.d.ts +25 -47
  67. package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
  68. package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
  69. package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
  70. package/build/jetpack-compose/index.d.ts +5 -4
  71. package/build/jetpack-compose/index.d.ts.map +1 -1
  72. package/build/jetpack-compose/modifiers/animation.d.ts +44 -0
  73. package/build/jetpack-compose/modifiers/animation.d.ts.map +1 -0
  74. package/build/jetpack-compose/modifiers/index.d.ts +68 -4
  75. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  76. package/build/swift-ui/AccessoryWidgetBackground/index.d.ts +4 -0
  77. package/build/swift-ui/AccessoryWidgetBackground/index.d.ts.map +1 -0
  78. package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -1
  79. package/build/swift-ui/ContextMenu/index.d.ts.map +1 -1
  80. package/build/swift-ui/ControlGroup/index.d.ts +29 -0
  81. package/build/swift-ui/ControlGroup/index.d.ts.map +1 -0
  82. package/build/swift-ui/Gauge/index.d.ts.map +1 -1
  83. package/build/swift-ui/Image/index.d.ts +7 -1
  84. package/build/swift-ui/Image/index.d.ts.map +1 -1
  85. package/build/swift-ui/Label/index.d.ts.map +1 -1
  86. package/build/swift-ui/LabeledContent/index.d.ts.map +1 -1
  87. package/build/swift-ui/Menu/index.d.ts.map +1 -1
  88. package/build/swift-ui/Picker/index.d.ts.map +1 -1
  89. package/build/swift-ui/Popover/index.d.ts.map +1 -1
  90. package/build/swift-ui/ProgressView/index.d.ts +1 -5
  91. package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
  92. package/build/swift-ui/Section/index.d.ts.map +1 -1
  93. package/build/swift-ui/Slider/index.d.ts.map +1 -1
  94. package/build/swift-ui/SlotView.d.ts +5 -0
  95. package/build/swift-ui/SlotView.d.ts.map +1 -0
  96. package/build/swift-ui/Stepper/index.d.ts +3 -3
  97. package/build/swift-ui/Stepper/index.d.ts.map +1 -1
  98. package/build/swift-ui/Text/index.d.ts +33 -1
  99. package/build/swift-ui/Text/index.d.ts.map +1 -1
  100. package/build/swift-ui/index.d.ts +2 -0
  101. package/build/swift-ui/index.d.ts.map +1 -1
  102. package/build/swift-ui/modifiers/index.d.ts +54 -1
  103. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  104. package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
  105. package/build/swift-ui/types.d.ts +7 -0
  106. package/build/swift-ui/types.d.ts.map +1 -1
  107. package/expo-module.config.json +1 -1
  108. package/ios/AccessoryWidgetBackgroundView.swift +27 -0
  109. package/ios/BottomSheetView.swift +1 -6
  110. package/ios/ClosedRangeDateRecord.swift +10 -0
  111. package/ios/ColorPickerView.swift +9 -8
  112. package/ios/ConfirmationDialog/ConfirmationDialog.swift +7 -15
  113. package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +0 -5
  114. package/ios/ContextMenu/ContextMenu.swift +27 -22
  115. package/ios/ContextMenu/ContextMenuRecords.swift +0 -6
  116. package/ios/ControlGroupView.swift +33 -0
  117. package/ios/DatePickerView.swift +7 -5
  118. package/ios/DisclosureGroupView.swift +5 -7
  119. package/ios/ExpoUIModule.swift +10 -32
  120. package/ios/GaugeView.swift +4 -26
  121. package/ios/HostView.swift +1 -2
  122. package/ios/ImageView.swift +22 -11
  123. package/ios/Label.swift +2 -17
  124. package/ios/LabeledContentView.swift +3 -27
  125. package/ios/ListView.swift +6 -14
  126. package/ios/Menu/MenuRecords.swift +0 -2
  127. package/ios/Menu/MenuView.swift +2 -5
  128. package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
  129. package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
  130. package/ios/Modifiers/ResizableModifier.swift +24 -0
  131. package/ios/Modifiers/Rotation3DEffectModifier.swift +20 -0
  132. package/ios/Modifiers/View+ModifierArray.swift +29 -0
  133. package/ios/Modifiers/ViewModifierRegistry.swift +37 -3
  134. package/ios/Modifiers/WidgetModifiers.swift +46 -0
  135. package/ios/Picker/PickerView.swift +8 -16
  136. package/ios/Popover/PopoverProps.swift +0 -4
  137. package/ios/Popover/PopoverView.swift +5 -11
  138. package/ios/ProgressView.swift +0 -5
  139. package/ios/RNHostView.swift +91 -10
  140. package/ios/SectionView.swift +9 -17
  141. package/ios/SecureFieldView.swift +0 -1
  142. package/ios/ShareLink/ShareLinkView.swift +1 -1
  143. package/ios/SliderView.swift +16 -31
  144. package/ios/SlotView.swift +38 -0
  145. package/ios/StepperView.swift +12 -16
  146. package/ios/TextFieldView.swift +0 -1
  147. package/ios/TextView.swift +37 -1
  148. package/ios/Toggle/ToggleView.swift +5 -7
  149. package/ios/UIBaseView.swift +34 -3
  150. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar +0 -0
  151. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.md5 +1 -0
  152. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha1 +1 -0
  153. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha256 +1 -0
  154. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha512 +1 -0
  155. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar +0 -0
  156. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.md5 +1 -0
  157. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1 +1 -0
  158. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256 +1 -0
  159. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512 +1 -0
  160. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.module → 55.0.3/expo.modules.ui-55.0.3.module} +22 -22
  161. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5 +1 -0
  162. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1 +1 -0
  163. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256 +1 -0
  164. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512 +1 -0
  165. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.pom → 55.0.3/expo.modules.ui-55.0.3.pom} +1 -1
  166. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5 +1 -0
  167. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1 +1 -0
  168. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256 +1 -0
  169. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha512 +1 -0
  170. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  171. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  172. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  173. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  174. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  175. package/package.json +5 -2
  176. package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
  177. package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
  178. package/src/jetpack-compose/Button/index.tsx +69 -92
  179. package/src/jetpack-compose/Card/index.tsx +105 -29
  180. package/src/jetpack-compose/Checkbox/index.tsx +126 -0
  181. package/src/jetpack-compose/Chip/index.tsx +391 -51
  182. package/src/jetpack-compose/DatePicker/index.tsx +215 -6
  183. package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
  184. package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
  185. package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
  186. package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
  187. package/src/jetpack-compose/IconButton/index.tsx +49 -56
  188. package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
  189. package/src/jetpack-compose/Progress/index.tsx +120 -62
  190. package/src/jetpack-compose/RadioButton/index.tsx +8 -9
  191. package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
  192. package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
  193. package/src/jetpack-compose/Slider/index.tsx +76 -29
  194. package/src/jetpack-compose/Spacer/index.tsx +2 -2
  195. package/src/jetpack-compose/Switch/index.tsx +32 -84
  196. package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
  197. package/src/jetpack-compose/index.ts +5 -4
  198. package/src/jetpack-compose/modifiers/animation.ts +37 -0
  199. package/src/jetpack-compose/modifiers/index.ts +86 -6
  200. package/src/swift-ui/AccessoryWidgetBackground/index.tsx +12 -0
  201. package/src/swift-ui/ConfirmationDialog/index.tsx +4 -12
  202. package/src/swift-ui/ContextMenu/index.tsx +6 -20
  203. package/src/swift-ui/ControlGroup/index.tsx +59 -0
  204. package/src/swift-ui/Gauge/index.tsx +5 -20
  205. package/src/swift-ui/Image/index.tsx +7 -1
  206. package/src/swift-ui/Label/index.tsx +2 -5
  207. package/src/swift-ui/LabeledContent/index.tsx +3 -12
  208. package/src/swift-ui/Menu/index.tsx +2 -6
  209. package/src/swift-ui/Picker/index.tsx +4 -11
  210. package/src/swift-ui/Popover/index.tsx +3 -12
  211. package/src/swift-ui/ProgressView/index.tsx +1 -3
  212. package/src/swift-ui/Section/index.tsx +4 -9
  213. package/src/swift-ui/Slider/index.tsx +4 -12
  214. package/src/swift-ui/SlotView.tsx +8 -0
  215. package/src/swift-ui/Stepper/index.tsx +7 -7
  216. package/src/swift-ui/Text/index.tsx +66 -2
  217. package/src/swift-ui/index.tsx +2 -0
  218. package/src/swift-ui/modifiers/index.ts +87 -1
  219. package/src/swift-ui/types.ts +5 -0
  220. package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
  221. package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
  222. package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
  223. package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
  224. package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
  225. package/build/jetpack-compose/Button/types.d.ts +0 -5
  226. package/build/jetpack-compose/Button/types.d.ts.map +0 -1
  227. package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
  228. package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
  229. package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
  230. package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
  231. package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
  232. package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
  233. package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
  234. package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
  235. package/build/jetpack-compose/Picker/index.d.ts +0 -62
  236. package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
  237. package/build/jetpack-compose/TextButton/index.d.ts +0 -29
  238. package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
  239. package/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +0 -26
  240. package/ios/ContextMenu/ContextMenuComponents.swift +0 -37
  241. package/ios/Menu/MenuComponents.swift +0 -12
  242. package/ios/Picker/PickerComponents.swift +0 -24
  243. package/ios/Popover/PopoverComponents.swift +0 -18
  244. package/ios/SectionComponents.swift +0 -34
  245. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar +0 -0
  246. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.md5 +0 -1
  247. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha1 +0 -1
  248. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha256 +0 -1
  249. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha512 +0 -1
  250. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar +0 -0
  251. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.md5 +0 -1
  252. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha1 +0 -1
  253. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha256 +0 -1
  254. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha512 +0 -1
  255. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.md5 +0 -1
  256. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha1 +0 -1
  257. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha256 +0 -1
  258. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha512 +0 -1
  259. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.md5 +0 -1
  260. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha1 +0 -1
  261. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha256 +0 -1
  262. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha512 +0 -1
  263. package/src/jetpack-compose/Button/types.ts +0 -57
  264. package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
  265. package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
  266. package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
  267. package/src/jetpack-compose/FilterChip/index.tsx +0 -89
  268. package/src/jetpack-compose/Picker/index.tsx +0 -90
  269. package/src/jetpack-compose/TextButton/index.tsx +0 -55
@@ -1,96 +1,436 @@
1
1
  import { requireNativeView } from 'expo';
2
- import React from 'react';
2
+ import { type ColorValue } from 'react-native';
3
3
 
4
- import { ExpoModifier } from '../../types';
4
+ import { type ModifierConfig } from '../../types';
5
5
  import { createViewModifierEventListener } from '../modifiers/utils';
6
6
 
7
7
  /**
8
- * Available text style variants for chip labels.
8
+ * Colors for AssistChip.
9
9
  */
10
- export type ChipTextStyle =
11
- | 'labelSmall'
12
- | 'labelMedium'
13
- | 'labelLarge'
14
- | 'bodySmall'
15
- | 'bodyMedium'
16
- | 'bodyLarge';
10
+ export type AssistChipColors = {
11
+ containerColor?: ColorValue;
12
+ labelColor?: ColorValue;
13
+ leadingIconContentColor?: ColorValue;
14
+ trailingIconContentColor?: ColorValue;
15
+ };
17
16
 
18
- export interface ChipProps {
17
+ /**
18
+ * Colors for FilterChip.
19
+ */
20
+ export type FilterChipColors = {
21
+ containerColor?: ColorValue;
22
+ labelColor?: ColorValue;
23
+ iconColor?: ColorValue;
24
+ selectedContainerColor?: ColorValue;
25
+ selectedLabelColor?: ColorValue;
26
+ selectedLeadingIconColor?: ColorValue;
27
+ selectedTrailingIconColor?: ColorValue;
28
+ };
29
+
30
+ /**
31
+ * Colors for InputChip.
32
+ */
33
+ export type InputChipColors = {
34
+ containerColor?: ColorValue;
35
+ labelColor?: ColorValue;
36
+ leadingIconColor?: ColorValue;
37
+ trailingIconColor?: ColorValue;
38
+ selectedContainerColor?: ColorValue;
39
+ selectedLabelColor?: ColorValue;
40
+ selectedLeadingIconColor?: ColorValue;
41
+ selectedTrailingIconColor?: ColorValue;
42
+ };
43
+
44
+ /**
45
+ * Colors for SuggestionChip.
46
+ */
47
+ export type SuggestionChipColors = {
48
+ containerColor?: ColorValue;
49
+ labelColor?: ColorValue;
50
+ iconContentColor?: ColorValue;
51
+ };
52
+
53
+ /**
54
+ * Border configuration for chips.
55
+ */
56
+ export type ChipBorder = {
19
57
  /**
20
- * The variant of the chip.
58
+ * Border width in dp.
59
+ * @default 1
21
60
  */
22
- variant?: 'assist' | 'filter' | 'input' | 'suggestion';
23
-
61
+ width?: number;
24
62
  /**
25
- * The text label to display on the chip
63
+ * Border color.
26
64
  */
27
- label: string;
65
+ color?: ColorValue;
66
+ };
67
+
68
+ type SlotChildProps = {
69
+ children: React.ReactNode;
70
+ };
71
+
72
+ type NativeSlotViewProps = {
73
+ slotName: string;
74
+ children: React.ReactNode;
75
+ };
76
+
77
+ const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
78
+ 'ExpoUI',
79
+ 'SlotView'
80
+ );
81
+
82
+ // region AssistChip
28
83
 
84
+ export type AssistChipProps = {
29
85
  /**
30
- * Optional leading icon name (using Material Icons). Used for assist, filter, input (avatar icon), and suggestion chips.
86
+ * Whether the chip is enabled and can be clicked.
87
+ * @default true
31
88
  */
32
- leadingIcon?: string;
33
-
89
+ enabled?: boolean;
34
90
  /**
35
- * Optional trailing icon name (using Material Icons). Used for assist, filter, and input chips. For input chips, defaults to `filled.Close` if not specified.
91
+ * Colors for the chip's container, label, and icons.
36
92
  */
37
- trailingIcon?: string;
38
-
93
+ colors?: AssistChipColors;
39
94
  /**
40
- * Size of the icon in density-independent pixels (dp). Defaults to 18.
95
+ * Elevation in dp.
41
96
  */
42
- iconSize?: number;
43
-
97
+ elevation?: number;
98
+ /**
99
+ * Border configuration.
100
+ */
101
+ border?: ChipBorder;
102
+ /**
103
+ * Callback fired when the chip is clicked.
104
+ */
105
+ onClick?: () => void;
44
106
  /**
45
- * Text style variant for the chip label. Defaults to `labelSmall`.
107
+ * Modifiers for the component.
46
108
  */
47
- textStyle?: ChipTextStyle;
109
+ modifiers?: ModifierConfig[];
110
+ /**
111
+ * Children containing Label, LeadingIcon, and TrailingIcon slots.
112
+ */
113
+ children: React.ReactNode;
114
+ };
115
+
116
+ type NativeAssistChipProps = Omit<AssistChipProps, 'onClick'> & {
117
+ onNativeClick?: () => void;
118
+ };
48
119
 
120
+ const AssistChipNativeView: React.ComponentType<NativeAssistChipProps> = requireNativeView(
121
+ 'ExpoUI',
122
+ 'AssistChipView'
123
+ );
124
+
125
+ /**
126
+ * Label slot for AssistChip.
127
+ */
128
+ function AssistChipLabel(props: SlotChildProps) {
129
+ return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
130
+ }
131
+
132
+ /**
133
+ * Leading icon slot for AssistChip.
134
+ */
135
+ function AssistChipLeadingIcon(props: SlotChildProps) {
136
+ return <SlotNativeView slotName="leadingIcon">{props.children}</SlotNativeView>;
137
+ }
138
+
139
+ /**
140
+ * Trailing icon slot for AssistChip.
141
+ */
142
+ function AssistChipTrailingIcon(props: SlotChildProps) {
143
+ return <SlotNativeView slotName="trailingIcon">{props.children}</SlotNativeView>;
144
+ }
145
+
146
+ /**
147
+ * An assist chip that helps users complete actions and primary tasks.
148
+ */
149
+ function AssistChipComponent(props: AssistChipProps) {
150
+ const { children, modifiers, onClick, ...restProps } = props;
151
+
152
+ return (
153
+ <AssistChipNativeView
154
+ modifiers={modifiers}
155
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
156
+ {...restProps}
157
+ onNativeClick={onClick}>
158
+ {children}
159
+ </AssistChipNativeView>
160
+ );
161
+ }
162
+
163
+ AssistChipComponent.Label = AssistChipLabel;
164
+ AssistChipComponent.LeadingIcon = AssistChipLeadingIcon;
165
+ AssistChipComponent.TrailingIcon = AssistChipTrailingIcon;
166
+
167
+ export { AssistChipComponent as AssistChip };
168
+
169
+ // endregion
170
+
171
+ // region FilterChip
172
+
173
+ export type FilterChipProps = {
174
+ /**
175
+ * Whether the chip is currently selected.
176
+ */
177
+ selected: boolean;
49
178
  /**
50
- * Whether the chip is enabled and can be clicked. Used for assist, filter and input chips.
179
+ * Whether the chip is enabled and can be interacted with.
51
180
  */
52
181
  enabled?: boolean;
182
+ /**
183
+ * Colors for the chip's container, label, icon, and selected states.
184
+ */
185
+ colors?: FilterChipColors;
186
+ /**
187
+ * Elevation in dp.
188
+ */
189
+ elevation?: number;
190
+ /**
191
+ * Border configuration.
192
+ */
193
+ border?: ChipBorder;
194
+ /**
195
+ * Callback fired when the chip is clicked.
196
+ */
197
+ onClick?: () => void;
198
+ /**
199
+ * Modifiers for the component.
200
+ */
201
+ modifiers?: ModifierConfig[];
202
+ /**
203
+ * Children containing Label, LeadingIcon, and TrailingIcon slots.
204
+ */
205
+ children: React.ReactNode;
206
+ };
207
+
208
+ type NativeFilterChipProps = Omit<FilterChipProps, 'onClick'> & {
209
+ onNativeClick?: () => void;
210
+ };
211
+
212
+ const FilterChipNativeView: React.ComponentType<NativeFilterChipProps> = requireNativeView(
213
+ 'ExpoUI',
214
+ 'FilterChipView'
215
+ );
216
+
217
+ /**
218
+ * Label slot for FilterChip.
219
+ */
220
+ function FilterChipLabel(props: SlotChildProps) {
221
+ return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
222
+ }
223
+
224
+ /**
225
+ * Leading icon slot for FilterChip.
226
+ */
227
+ function FilterChipLeadingIcon(props: SlotChildProps) {
228
+ return <SlotNativeView slotName="leadingIcon">{props.children}</SlotNativeView>;
229
+ }
230
+
231
+ /**
232
+ * Trailing icon slot for FilterChip.
233
+ */
234
+ function FilterChipTrailingIcon(props: SlotChildProps) {
235
+ return <SlotNativeView slotName="trailingIcon">{props.children}</SlotNativeView>;
236
+ }
237
+
238
+ /**
239
+ * A filter chip component for refining content with selection/deselection.
240
+ */
241
+ function FilterChipComponent(props: FilterChipProps) {
242
+ const { children, modifiers, onClick, ...restProps } = props;
243
+
244
+ return (
245
+ <FilterChipNativeView
246
+ modifiers={modifiers}
247
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
248
+ {...restProps}
249
+ onNativeClick={onClick}>
250
+ {children}
251
+ </FilterChipNativeView>
252
+ );
253
+ }
254
+
255
+ FilterChipComponent.Label = FilterChipLabel;
256
+ FilterChipComponent.LeadingIcon = FilterChipLeadingIcon;
257
+ FilterChipComponent.TrailingIcon = FilterChipTrailingIcon;
258
+
259
+ export { FilterChipComponent as FilterChip };
260
+
261
+ // endregion
262
+
263
+ // region InputChip
53
264
 
265
+ export type InputChipProps = {
54
266
  /**
55
- * Whether the chip is selected. Used only for filter chips.
267
+ * Whether the chip is enabled and can be interacted with.
268
+ * @default true
269
+ */
270
+ enabled?: boolean;
271
+ /**
272
+ * Whether the chip is selected.
273
+ * @default false
56
274
  */
57
275
  selected?: boolean;
58
-
276
+ /**
277
+ * Colors for the chip's container, label, icons, and selected states.
278
+ */
279
+ colors?: InputChipColors;
280
+ /**
281
+ * Elevation in dp.
282
+ */
283
+ elevation?: number;
284
+ /**
285
+ * Border configuration.
286
+ */
287
+ border?: ChipBorder;
288
+ /**
289
+ * Callback fired when the chip is clicked.
290
+ */
291
+ onClick?: () => void;
59
292
  /**
60
293
  * Modifiers for the component.
61
294
  */
62
- modifiers?: ExpoModifier[];
63
-
295
+ modifiers?: ModifierConfig[];
64
296
  /**
65
- * Callback fired when the chip is clicked. Used for assist and filter chips.
297
+ * Children containing Label, Avatar, and TrailingIcon slots.
66
298
  */
67
- onPress?: () => void;
299
+ children: React.ReactNode;
300
+ };
301
+
302
+ type NativeInputChipProps = Omit<InputChipProps, 'onClick'> & {
303
+ onNativeClick?: () => void;
304
+ };
305
+
306
+ const InputChipNativeView: React.ComponentType<NativeInputChipProps> = requireNativeView(
307
+ 'ExpoUI',
308
+ 'InputChipView'
309
+ );
310
+
311
+ /**
312
+ * Label slot for InputChip.
313
+ */
314
+ function InputChipLabel(props: SlotChildProps) {
315
+ return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
316
+ }
317
+
318
+ /**
319
+ * Avatar slot for InputChip.
320
+ */
321
+ function InputChipAvatar(props: SlotChildProps) {
322
+ return <SlotNativeView slotName="avatar">{props.children}</SlotNativeView>;
323
+ }
68
324
 
325
+ /**
326
+ * Trailing icon slot for InputChip.
327
+ */
328
+ function InputChipTrailingIcon(props: SlotChildProps) {
329
+ return <SlotNativeView slotName="trailingIcon">{props.children}</SlotNativeView>;
330
+ }
331
+
332
+ /**
333
+ * An input chip that represents user input and can be dismissed.
334
+ */
335
+ function InputChipComponent(props: InputChipProps) {
336
+ const { children, modifiers, onClick, ...restProps } = props;
337
+
338
+ return (
339
+ <InputChipNativeView
340
+ modifiers={modifiers}
341
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
342
+ {...restProps}
343
+ onNativeClick={onClick}>
344
+ {children}
345
+ </InputChipNativeView>
346
+ );
347
+ }
348
+
349
+ InputChipComponent.Label = InputChipLabel;
350
+ InputChipComponent.Avatar = InputChipAvatar;
351
+ InputChipComponent.TrailingIcon = InputChipTrailingIcon;
352
+
353
+ export { InputChipComponent as InputChip };
354
+
355
+ // endregion
356
+
357
+ // region SuggestionChip
358
+
359
+ export type SuggestionChipProps = {
69
360
  /**
70
- * Callback fired when the chip is dismissed. Only used for input chips.
361
+ * Whether the chip is enabled and can be clicked.
362
+ * @default true
71
363
  */
72
- onDismiss?: () => void;
73
- }
364
+ enabled?: boolean;
365
+ /**
366
+ * Colors for the chip's container, label, and icon.
367
+ */
368
+ colors?: SuggestionChipColors;
369
+ /**
370
+ * Elevation in dp.
371
+ */
372
+ elevation?: number;
373
+ /**
374
+ * Border configuration.
375
+ */
376
+ border?: ChipBorder;
377
+ /**
378
+ * Callback fired when the chip is clicked.
379
+ */
380
+ onClick?: () => void;
381
+ /**
382
+ * Modifiers for the component.
383
+ */
384
+ modifiers?: ModifierConfig[];
385
+ /**
386
+ * Children containing Label and Icon slots.
387
+ */
388
+ children: React.ReactNode;
389
+ };
74
390
 
75
- type NativeChipProps = ChipProps;
76
- // Native component declaration using the same pattern as Button
77
- const ChipNativeView: React.ComponentType<NativeChipProps> = requireNativeView(
391
+ type NativeSuggestionChipProps = Omit<SuggestionChipProps, 'onClick'> & {
392
+ onNativeClick?: () => void;
393
+ };
394
+
395
+ const SuggestionChipNativeView: React.ComponentType<NativeSuggestionChipProps> = requireNativeView(
78
396
  'ExpoUI',
79
- 'ChipView'
397
+ 'SuggestionChipView'
80
398
  );
81
399
 
82
- function transformChipProps(props: ChipProps): NativeChipProps {
83
- const { modifiers, ...restProps } = props;
84
- return {
85
- modifiers,
86
- ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
87
- ...restProps,
88
- };
400
+ /**
401
+ * Label slot for SuggestionChip.
402
+ */
403
+ function SuggestionChipLabel(props: SlotChildProps) {
404
+ return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
89
405
  }
90
406
 
91
407
  /**
92
- * Displays a native chip component.
408
+ * Icon slot for SuggestionChip.
93
409
  */
94
- export function Chip(props: ChipProps): React.JSX.Element {
95
- return <ChipNativeView {...transformChipProps(props)} />;
410
+ function SuggestionChipIcon(props: SlotChildProps) {
411
+ return <SlotNativeView slotName="icon">{props.children}</SlotNativeView>;
96
412
  }
413
+
414
+ /**
415
+ * A suggestion chip that offers contextual suggestions and recommendations.
416
+ */
417
+ function SuggestionChipComponent(props: SuggestionChipProps) {
418
+ const { children, modifiers, onClick, ...restProps } = props;
419
+
420
+ return (
421
+ <SuggestionChipNativeView
422
+ modifiers={modifiers}
423
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
424
+ {...restProps}
425
+ onNativeClick={onClick}>
426
+ {children}
427
+ </SuggestionChipNativeView>
428
+ );
429
+ }
430
+
431
+ SuggestionChipComponent.Label = SuggestionChipLabel;
432
+ SuggestionChipComponent.Icon = SuggestionChipIcon;
433
+
434
+ export { SuggestionChipComponent as SuggestionChip };
435
+
436
+ // endregion