ferns-ui 0.47.10 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/dist/Accordion.d.ts +3 -0
  2. package/dist/Accordion.js +31 -0
  3. package/dist/Accordion.js.map +1 -0
  4. package/dist/ActionSheet.d.ts +9 -10
  5. package/dist/ActionSheet.js +8 -6
  6. package/dist/ActionSheet.js.map +1 -1
  7. package/dist/AddressField.d.ts +3 -0
  8. package/dist/AddressField.js +33 -0
  9. package/dist/AddressField.js.map +1 -0
  10. package/dist/Avatar.d.ts +2 -2
  11. package/dist/Avatar.js +132 -96
  12. package/dist/Avatar.js.map +1 -1
  13. package/dist/Badge.d.ts +1 -1
  14. package/dist/Badge.js +90 -20
  15. package/dist/Badge.js.map +1 -1
  16. package/dist/Banner.d.ts +1 -1
  17. package/dist/Banner.js +89 -51
  18. package/dist/Banner.js.map +1 -1
  19. package/dist/Body.js +4 -4
  20. package/dist/Body.js.map +1 -1
  21. package/dist/BooleanField.d.ts +3 -0
  22. package/dist/BooleanField.js +90 -0
  23. package/dist/BooleanField.js.map +1 -0
  24. package/dist/Box.js +80 -80
  25. package/dist/Box.js.map +1 -1
  26. package/dist/Button.d.ts +2 -2
  27. package/dist/Button.js +87 -109
  28. package/dist/Button.js.map +1 -1
  29. package/dist/Card.js +2 -2
  30. package/dist/Card.js.map +1 -1
  31. package/dist/CheckBox.d.ts +2 -2
  32. package/dist/CheckBox.js +23 -35
  33. package/dist/CheckBox.js.map +1 -1
  34. package/dist/Common.d.ts +1071 -406
  35. package/dist/Common.js +39 -3
  36. package/dist/Common.js.map +1 -1
  37. package/dist/CommonIconTypes.d.ts +3 -0
  38. package/dist/CommonIconTypes.js +2 -0
  39. package/dist/CommonIconTypes.js.map +1 -0
  40. package/dist/CustomSelectField.d.ts +3 -0
  41. package/dist/CustomSelectField.js +64 -0
  42. package/dist/CustomSelectField.js.map +1 -0
  43. package/dist/DateTimeActionSheet.d.ts +1 -1
  44. package/dist/DateTimeActionSheet.js +170 -158
  45. package/dist/DateTimeActionSheet.js.map +1 -1
  46. package/dist/DateTimeField.d.ts +3 -3
  47. package/dist/DateTimeField.js +140 -30
  48. package/dist/DateTimeField.js.map +1 -1
  49. package/dist/DateUtilities.js.map +1 -1
  50. package/dist/DateUtilities.test.js +2 -1
  51. package/dist/DateUtilities.test.js.map +1 -1
  52. package/dist/DecimalRangeActionSheet.js +3 -15
  53. package/dist/DecimalRangeActionSheet.js.map +1 -1
  54. package/dist/DismissButton.d.ts +3 -0
  55. package/dist/DismissButton.js +14 -0
  56. package/dist/DismissButton.js.map +1 -0
  57. package/dist/EmailField.d.ts +3 -0
  58. package/dist/EmailField.js +52 -0
  59. package/dist/EmailField.js.map +1 -0
  60. package/dist/ErrorBoundary.d.ts +1 -1
  61. package/dist/ErrorPage.js +2 -2
  62. package/dist/ErrorPage.js.map +1 -1
  63. package/dist/FernsProvider.js +1 -1
  64. package/dist/FernsProvider.js.map +1 -1
  65. package/dist/Field.d.ts +2 -2
  66. package/dist/Field.js +67 -136
  67. package/dist/Field.js.map +1 -1
  68. package/dist/Heading.js +37 -16
  69. package/dist/Heading.js.map +1 -1
  70. package/dist/HeightActionSheet.js +3 -7
  71. package/dist/HeightActionSheet.js.map +1 -1
  72. package/dist/Hyperlink.js +7 -1
  73. package/dist/Hyperlink.js.map +1 -1
  74. package/dist/Icon.d.ts +1 -2
  75. package/dist/Icon.js +8 -10
  76. package/dist/Icon.js.map +1 -1
  77. package/dist/IconButton.d.ts +2 -2
  78. package/dist/IconButton.js +93 -92
  79. package/dist/IconButton.js.map +1 -1
  80. package/dist/InfoTooltipButton.d.ts +1 -1
  81. package/dist/InfoTooltipButton.js +2 -2
  82. package/dist/InfoTooltipButton.js.map +1 -1
  83. package/dist/Link.d.ts +1 -1
  84. package/dist/Link.js +7 -3
  85. package/dist/Link.js.map +1 -1
  86. package/dist/MobileAddressAutoComplete.js +8 -8
  87. package/dist/MobileAddressAutoComplete.js.map +1 -1
  88. package/dist/Modal.d.ts +2 -2
  89. package/dist/Modal.js +95 -80
  90. package/dist/Modal.js.map +1 -1
  91. package/dist/MultiselectField.d.ts +3 -0
  92. package/dist/MultiselectField.js +49 -0
  93. package/dist/MultiselectField.js.map +1 -0
  94. package/dist/NumberField.d.ts +3 -0
  95. package/dist/NumberField.js +49 -0
  96. package/dist/NumberField.js.map +1 -0
  97. package/dist/NumberPickerActionSheet.js +2 -2
  98. package/dist/NumberPickerActionSheet.js.map +1 -1
  99. package/dist/OpenAPIContext.js.map +1 -1
  100. package/dist/Page.js +6 -6
  101. package/dist/Page.js.map +1 -1
  102. package/dist/Pagination.d.ts +2 -8
  103. package/dist/Pagination.js +107 -13
  104. package/dist/Pagination.js.map +1 -1
  105. package/dist/PasswordField.d.ts +2 -0
  106. package/dist/PasswordField.js +6 -0
  107. package/dist/PasswordField.js.map +1 -0
  108. package/dist/PhoneNumberField.d.ts +3 -0
  109. package/dist/PhoneNumberField.js +79 -0
  110. package/dist/PhoneNumberField.js.map +1 -0
  111. package/dist/PickerSelect.d.ts +6 -67
  112. package/dist/PickerSelect.js +145 -115
  113. package/dist/PickerSelect.js.map +1 -1
  114. package/dist/Radio.d.ts +3 -0
  115. package/dist/Radio.js +21 -0
  116. package/dist/Radio.js.map +1 -0
  117. package/dist/RadioField.d.ts +3 -0
  118. package/dist/RadioField.js +22 -0
  119. package/dist/RadioField.js.map +1 -0
  120. package/dist/SegmentedControl.d.ts +1 -1
  121. package/dist/SegmentedControl.js +35 -67
  122. package/dist/SegmentedControl.js.map +1 -1
  123. package/dist/SelectField.d.ts +3 -0
  124. package/dist/SelectField.js +20 -0
  125. package/dist/SelectField.js.map +1 -0
  126. package/dist/SideDrawer.js +8 -2
  127. package/dist/SideDrawer.js.map +1 -1
  128. package/dist/Signature.d.ts +1 -0
  129. package/dist/Signature.js +8 -7
  130. package/dist/Signature.js.map +1 -1
  131. package/dist/Signature.native.js +8 -7
  132. package/dist/Signature.native.js.map +1 -1
  133. package/dist/SignatureField.d.ts +3 -0
  134. package/dist/SignatureField.js +54 -0
  135. package/dist/SignatureField.js.map +1 -0
  136. package/dist/Spinner.js +17 -2
  137. package/dist/Spinner.js.map +1 -1
  138. package/dist/SplitPage.d.ts +1 -1
  139. package/dist/SplitPage.js +10 -10
  140. package/dist/SplitPage.js.map +1 -1
  141. package/dist/SplitPage.native.js +7 -7
  142. package/dist/SplitPage.native.js.map +1 -1
  143. package/dist/TapToEdit.d.ts +3 -3
  144. package/dist/TapToEdit.js +31 -30
  145. package/dist/TapToEdit.js.map +1 -1
  146. package/dist/Text.d.ts +1 -1
  147. package/dist/Text.js +70 -64
  148. package/dist/Text.js.map +1 -1
  149. package/dist/TextArea.d.ts +1 -1
  150. package/dist/TextArea.js +2 -14
  151. package/dist/TextArea.js.map +1 -1
  152. package/dist/TextField.d.ts +2 -2
  153. package/dist/TextField.js +89 -206
  154. package/dist/TextField.js.map +1 -1
  155. package/dist/TextFieldNumberActionSheet.js +2 -2
  156. package/dist/TextFieldNumberActionSheet.js.map +1 -1
  157. package/dist/Theme.d.ts +87 -3
  158. package/dist/Theme.js +197 -98
  159. package/dist/Theme.js.map +1 -1
  160. package/dist/TimezonePicker.js +3 -5
  161. package/dist/TimezonePicker.js.map +1 -1
  162. package/dist/Toast.d.ts +18 -5
  163. package/dist/Toast.js +130 -31
  164. package/dist/Toast.js.map +1 -1
  165. package/dist/Tooltip.d.ts +2 -2
  166. package/dist/Tooltip.js +189 -89
  167. package/dist/Tooltip.js.map +1 -1
  168. package/dist/UnifiedAddressAutoComplete.js +2 -2
  169. package/dist/UnifiedAddressAutoComplete.js.map +1 -1
  170. package/dist/Unifier.js.map +1 -1
  171. package/dist/Utilities.js +5 -3
  172. package/dist/Utilities.js.map +1 -1
  173. package/dist/WebAddressAutocomplete.js +2 -2
  174. package/dist/WebAddressAutocomplete.js.map +1 -1
  175. package/dist/fieldElements/FieldError.d.ts +6 -0
  176. package/dist/fieldElements/FieldError.js +14 -0
  177. package/dist/fieldElements/FieldError.js.map +1 -0
  178. package/dist/fieldElements/FieldHelperText.d.ts +6 -0
  179. package/dist/fieldElements/FieldHelperText.js +11 -0
  180. package/dist/fieldElements/FieldHelperText.js.map +1 -0
  181. package/dist/fieldElements/FieldTitle.d.ts +6 -0
  182. package/dist/fieldElements/FieldTitle.js +19 -0
  183. package/dist/fieldElements/FieldTitle.js.map +1 -0
  184. package/dist/fieldElements/index.d.ts +3 -0
  185. package/dist/fieldElements/index.js +4 -0
  186. package/dist/fieldElements/index.js.map +1 -0
  187. package/dist/icons/MobileIcon.d.ts +3 -0
  188. package/dist/icons/MobileIcon.js +24 -0
  189. package/dist/icons/MobileIcon.js.map +1 -0
  190. package/dist/icons/OfflineIcon.d.ts +3 -0
  191. package/dist/icons/OfflineIcon.js +23 -0
  192. package/dist/icons/OfflineIcon.js.map +1 -0
  193. package/dist/icons/OnlineIcon.d.ts +3 -0
  194. package/dist/icons/OnlineIcon.js +24 -0
  195. package/dist/icons/OnlineIcon.js.map +1 -0
  196. package/dist/icons/OutOfficeIcon.d.ts +3 -0
  197. package/dist/icons/OutOfficeIcon.js +24 -0
  198. package/dist/icons/OutOfficeIcon.js.map +1 -0
  199. package/dist/icons/index.d.ts +4 -0
  200. package/dist/icons/index.js +5 -0
  201. package/dist/icons/index.js.map +1 -0
  202. package/dist/index.d.ts +28 -14
  203. package/dist/index.js +28 -14
  204. package/dist/index.js.map +1 -1
  205. package/dist/setupTests.d.ts +1 -0
  206. package/dist/setupTests.js +1 -1
  207. package/dist/setupTests.js.map +1 -1
  208. package/dist/{Table.d.ts → table/Table.d.ts} +2 -2
  209. package/dist/{Table.js → table/Table.js} +18 -10
  210. package/dist/table/Table.js.map +1 -0
  211. package/dist/table/TableBadge.d.ts +6 -0
  212. package/dist/table/TableBadge.js +22 -0
  213. package/dist/table/TableBadge.js.map +1 -0
  214. package/dist/table/TableBoolean.d.ts +6 -0
  215. package/dist/table/TableBoolean.js +39 -0
  216. package/dist/table/TableBoolean.js.map +1 -0
  217. package/dist/table/TableDate.d.ts +3 -0
  218. package/dist/table/TableDate.js +26 -0
  219. package/dist/table/TableDate.js.map +1 -0
  220. package/dist/{TableHeader.d.ts → table/TableHeader.d.ts} +1 -1
  221. package/dist/{TableHeader.js → table/TableHeader.js} +2 -2
  222. package/dist/table/TableHeader.js.map +1 -0
  223. package/dist/{TableHeaderCell.d.ts → table/TableHeaderCell.d.ts} +2 -2
  224. package/dist/table/TableHeaderCell.js +58 -0
  225. package/dist/table/TableHeaderCell.js.map +1 -0
  226. package/dist/table/TableIconButton.d.ts +3 -0
  227. package/dist/table/TableIconButton.js +42 -0
  228. package/dist/table/TableIconButton.js.map +1 -0
  229. package/dist/table/TableNumber.d.ts +3 -0
  230. package/dist/table/TableNumber.js +18 -0
  231. package/dist/table/TableNumber.js.map +1 -0
  232. package/dist/{TableRow.d.ts → table/TableRow.d.ts} +1 -1
  233. package/dist/table/TableRow.js +28 -0
  234. package/dist/table/TableRow.js.map +1 -0
  235. package/dist/table/TableText.d.ts +3 -0
  236. package/dist/table/TableText.js +18 -0
  237. package/dist/table/TableText.js.map +1 -0
  238. package/dist/table/TableTitle.d.ts +3 -0
  239. package/dist/table/TableTitle.js +22 -0
  240. package/dist/table/TableTitle.js.map +1 -0
  241. package/dist/{tableContext.d.ts → table/tableContext.d.ts} +1 -1
  242. package/dist/table/tableContext.js.map +1 -0
  243. package/package.json +10 -4
  244. package/src/Accordion.tsx +84 -0
  245. package/src/ActionSheet.tsx +8 -5
  246. package/src/AddressField.tsx +122 -0
  247. package/src/Avatar.tsx +193 -147
  248. package/src/Badge.tsx +107 -49
  249. package/src/Banner.tsx +158 -111
  250. package/src/Body.tsx +4 -4
  251. package/src/BooleanField.tsx +122 -0
  252. package/src/Box.tsx +92 -82
  253. package/src/Button.tsx +151 -167
  254. package/src/Card.tsx +2 -2
  255. package/src/CheckBox.tsx +30 -111
  256. package/src/Common.ts +1304 -2041
  257. package/src/CommonIconTypes.ts +2030 -0
  258. package/src/CustomSelectField.tsx +116 -0
  259. package/src/DateTimeActionSheet.tsx +341 -259
  260. package/src/DateTimeField.tsx +168 -61
  261. package/src/DateUtilities.test.ts +6 -2
  262. package/src/DateUtilities.tsx +1 -1
  263. package/src/DecimalRangeActionSheet.tsx +2 -17
  264. package/src/DismissButton.tsx +31 -0
  265. package/src/EmailField.tsx +70 -0
  266. package/src/ErrorPage.tsx +2 -2
  267. package/src/FernsProvider.tsx +1 -1
  268. package/src/Field.tsx +83 -345
  269. package/src/Heading.tsx +44 -16
  270. package/src/HeightActionSheet.tsx +2 -9
  271. package/src/Hyperlink.tsx +8 -1
  272. package/src/Icon.tsx +22 -14
  273. package/src/IconButton.tsx +188 -156
  274. package/src/InfoTooltipButton.tsx +4 -6
  275. package/src/Link.tsx +14 -5
  276. package/src/MobileAddressAutoComplete.tsx +17 -13
  277. package/src/Modal.tsx +214 -190
  278. package/src/MultiselectField.tsx +103 -0
  279. package/src/NumberField.tsx +55 -0
  280. package/src/NumberPickerActionSheet.tsx +1 -4
  281. package/src/OpenAPIContext.tsx +1 -1
  282. package/src/Page.tsx +9 -13
  283. package/src/Pagination.tsx +171 -36
  284. package/src/PasswordField.tsx +7 -0
  285. package/src/PhoneNumberField.tsx +103 -0
  286. package/src/PickerSelect.tsx +169 -151
  287. package/src/Radio.tsx +33 -0
  288. package/src/RadioField.tsx +43 -0
  289. package/src/SegmentedControl.tsx +44 -96
  290. package/src/SelectField.tsx +41 -0
  291. package/src/SideDrawer.tsx +8 -2
  292. package/src/Signature.native.tsx +16 -9
  293. package/src/Signature.tsx +19 -11
  294. package/src/SignatureField.tsx +92 -0
  295. package/src/Spinner.tsx +16 -2
  296. package/src/SplitPage.native.tsx +9 -7
  297. package/src/SplitPage.tsx +11 -12
  298. package/src/TapToEdit.tsx +58 -37
  299. package/src/Text.tsx +79 -69
  300. package/src/TextArea.tsx +2 -2
  301. package/src/TextField.tsx +133 -285
  302. package/src/TextFieldNumberActionSheet.tsx +1 -4
  303. package/src/Theme.tsx +223 -172
  304. package/src/TimezonePicker.tsx +3 -18
  305. package/src/Toast.tsx +193 -70
  306. package/src/Tooltip.tsx +258 -141
  307. package/src/UnifiedAddressAutoComplete.tsx +3 -3
  308. package/src/Unifier.ts +4 -4
  309. package/src/Utilities.tsx +11 -3
  310. package/src/WebAddressAutocomplete.tsx +2 -3
  311. package/src/fieldElements/FieldError.tsx +24 -0
  312. package/src/fieldElements/FieldHelperText.tsx +20 -0
  313. package/src/fieldElements/FieldTitle.tsx +31 -0
  314. package/src/fieldElements/index.tsx +3 -0
  315. package/src/icons/MobileIcon.tsx +41 -0
  316. package/src/icons/OfflineIcon.tsx +38 -0
  317. package/src/icons/OnlineIcon.tsx +40 -0
  318. package/src/icons/OutOfficeIcon.tsx +37 -0
  319. package/src/icons/index.ts +4 -0
  320. package/src/index.tsx +28 -14
  321. package/src/setupTests.ts +1 -0
  322. package/src/{Table.tsx → table/Table.tsx} +24 -14
  323. package/src/table/TableBadge.tsx +46 -0
  324. package/src/table/TableBoolean.tsx +70 -0
  325. package/src/table/TableDate.tsx +38 -0
  326. package/src/{TableHeader.tsx → table/TableHeader.tsx} +3 -3
  327. package/src/table/TableHeaderCell.tsx +93 -0
  328. package/src/table/TableIconButton.tsx +62 -0
  329. package/src/table/TableNumber.tsx +29 -0
  330. package/src/{TableRow.tsx → table/TableRow.tsx} +28 -25
  331. package/src/table/TableText.tsx +29 -0
  332. package/src/table/TableTitle.tsx +32 -0
  333. package/src/{tableContext.tsx → table/tableContext.tsx} +1 -1
  334. package/dist/BlurBox.d.ts +0 -5
  335. package/dist/BlurBox.js +0 -28
  336. package/dist/BlurBox.js.map +0 -1
  337. package/dist/BlurBox.native.d.ts +0 -6
  338. package/dist/BlurBox.native.js +0 -30
  339. package/dist/BlurBox.native.js.map +0 -1
  340. package/dist/CustomSelect.d.ts +0 -3
  341. package/dist/CustomSelect.js +0 -47
  342. package/dist/CustomSelect.js.map +0 -1
  343. package/dist/DateTimeField.android.d.ts +0 -3
  344. package/dist/DateTimeField.android.js +0 -67
  345. package/dist/DateTimeField.android.js.map +0 -1
  346. package/dist/DateTimeField.ios.d.ts +0 -3
  347. package/dist/DateTimeField.ios.js +0 -49
  348. package/dist/DateTimeField.ios.js.map +0 -1
  349. package/dist/FieldWithLabels.d.ts +0 -3
  350. package/dist/FieldWithLabels.js +0 -8
  351. package/dist/FieldWithLabels.js.map +0 -1
  352. package/dist/Form.d.ts +0 -16
  353. package/dist/Form.js +0 -89
  354. package/dist/Form.js.map +0 -1
  355. package/dist/HeaderButtons.d.ts +0 -31
  356. package/dist/HeaderButtons.js +0 -53
  357. package/dist/HeaderButtons.js.map +0 -1
  358. package/dist/Mask.d.ts +0 -2
  359. package/dist/Mask.js +0 -19
  360. package/dist/Mask.js.map +0 -1
  361. package/dist/Pill.d.ts +0 -3
  362. package/dist/Pill.js +0 -8
  363. package/dist/Pill.js.map +0 -1
  364. package/dist/Pog.d.ts +0 -3
  365. package/dist/Pog.js +0 -48
  366. package/dist/Pog.js.map +0 -1
  367. package/dist/ProgressBar.d.ts +0 -3
  368. package/dist/ProgressBar.js +0 -35
  369. package/dist/ProgressBar.js.map +0 -1
  370. package/dist/SelectList.d.ts +0 -27
  371. package/dist/SelectList.js +0 -56
  372. package/dist/SelectList.js.map +0 -1
  373. package/dist/Switch.d.ts +0 -3
  374. package/dist/Switch.js +0 -20
  375. package/dist/Switch.js.map +0 -1
  376. package/dist/Table.js.map +0 -1
  377. package/dist/TableHeader.js.map +0 -1
  378. package/dist/TableHeaderCell.js +0 -36
  379. package/dist/TableHeaderCell.js.map +0 -1
  380. package/dist/TableRow.js +0 -30
  381. package/dist/TableRow.js.map +0 -1
  382. package/dist/WithLabel.d.ts +0 -3
  383. package/dist/WithLabel.js +0 -15
  384. package/dist/WithLabel.js.map +0 -1
  385. package/dist/tableContext.js.map +0 -1
  386. package/src/BlurBox.native.tsx +0 -40
  387. package/src/BlurBox.tsx +0 -31
  388. package/src/CustomSelect.tsx +0 -80
  389. package/src/DateTimeField.android.tsx +0 -103
  390. package/src/DateTimeField.ios.tsx +0 -85
  391. package/src/FieldWithLabels.tsx +0 -36
  392. package/src/Form.tsx +0 -175
  393. package/src/HeaderButtons.tsx +0 -107
  394. package/src/Mask.tsx +0 -21
  395. package/src/Pill.tsx +0 -22
  396. package/src/Pog.tsx +0 -75
  397. package/src/ProgressBar.tsx +0 -47
  398. package/src/SelectList.tsx +0 -109
  399. package/src/Switch.tsx +0 -18
  400. package/src/TableHeaderCell.tsx +0 -72
  401. package/src/WithLabel.tsx +0 -45
  402. /package/dist/{tableContext.js → table/tableContext.js} +0 -0
@@ -38,31 +38,21 @@ import {
38
38
  View,
39
39
  } from "react-native";
40
40
 
41
+ import {Icon} from "./Icon";
42
+ import {useTheme} from "./Theme";
43
+
41
44
  export const defaultStyles = StyleSheet.create({
42
45
  viewContainer: {
43
46
  alignSelf: "stretch",
44
- },
45
- iconContainer: {
46
- position: "absolute",
47
- right: 0,
48
- },
49
- modalViewTop: {
50
- flex: 1,
51
- },
52
- modalViewMiddle: {
53
- height: 45,
54
47
  flexDirection: "row",
55
- justifyContent: "space-between",
48
+ justifyContent: "center",
56
49
  alignItems: "center",
57
- paddingHorizontal: 10,
58
- backgroundColor: "#f8f8f8",
59
- borderTopWidth: 1,
60
- borderTopColor: "#dedede",
61
- zIndex: 2,
62
- },
63
- chevronContainer: {
64
- flexDirection: "row",
50
+ minHeight: 40,
51
+ width: "100%",
52
+ borderWidth: 1,
53
+ borderRadius: 4,
65
54
  },
55
+
66
56
  chevron: {
67
57
  width: 15,
68
58
  height: 15,
@@ -71,41 +61,10 @@ export const defaultStyles = StyleSheet.create({
71
61
  borderTopWidth: 1.5,
72
62
  borderRightWidth: 1.5,
73
63
  },
74
- chevronUp: {
75
- marginLeft: 11,
76
- transform: [{translateY: 4}, {rotate: "-45deg"}],
77
- },
78
- chevronDown: {
79
- marginLeft: 22,
80
- transform: [{translateY: -5}, {rotate: "135deg"}],
81
- },
64
+
82
65
  chevronActive: {
83
66
  borderColor: "#007aff",
84
67
  },
85
- done: {
86
- color: "#007aff",
87
- fontWeight: "600",
88
- fontSize: 17,
89
- paddingTop: 1,
90
- paddingRight: 11,
91
- },
92
- doneDepressed: {
93
- fontSize: 19,
94
- },
95
- modalViewBottom: {
96
- justifyContent: "center",
97
- backgroundColor: "#d0d4da",
98
- },
99
- placeholder: {
100
- color: "#c7c7cd",
101
- },
102
- headlessAndroidPicker: {
103
- position: "absolute",
104
- width: "100%",
105
- height: "100%",
106
- color: "transparent",
107
- opacity: 0,
108
- },
109
68
  });
110
69
 
111
70
  export interface RNPickerSelectProps {
@@ -115,7 +74,6 @@ export interface RNPickerSelectProps {
115
74
  placeholder?: any;
116
75
  disabled?: boolean;
117
76
  itemKey?: string | number;
118
- style?: any;
119
77
  children?: any;
120
78
  onOpen?: () => void;
121
79
  useNativeAndroidPickerStyle?: boolean;
@@ -134,17 +92,12 @@ export interface RNPickerSelectProps {
134
92
  // TextInput props
135
93
  textInputProps?: any;
136
94
 
137
- // Picker props
138
- pickerProps?: any;
139
-
140
95
  // Touchable Done props (iOS only)
141
96
  touchableDoneProps?: any;
142
97
 
143
98
  // Touchable wrapper props
144
99
  touchableWrapperProps?: any;
145
100
 
146
- // Custom Icon
147
- Icon?: any;
148
101
  InputAccessoryView?: any;
149
102
  }
150
103
 
@@ -152,14 +105,9 @@ export function RNPickerSelect({
152
105
  onValueChange,
153
106
  value,
154
107
  items,
155
- placeholder = {
156
- label: "Select an item...",
157
- value: null,
158
- color: "#9EA0A4",
159
- },
108
+ placeholder,
160
109
  disabled = false,
161
110
  itemKey,
162
- style = defaultStyles,
163
111
  children,
164
112
  useNativeAndroidPickerStyle = true,
165
113
  fixAndroidTouchableBug = false,
@@ -171,10 +119,9 @@ export function RNPickerSelect({
171
119
  onClose,
172
120
  modalProps,
173
121
  textInputProps,
174
- pickerProps,
175
122
  touchableDoneProps,
176
123
  touchableWrapperProps,
177
- Icon,
124
+
178
125
  InputAccessoryView,
179
126
  }: RNPickerSelectProps) {
180
127
  const [selectedItem, setSelectedItem] = useState<any>();
@@ -182,6 +129,7 @@ export function RNPickerSelect({
182
129
  const [animationType, setAnimationType] = useState(undefined);
183
130
  const [orientation, setOrientation] = useState<"portrait" | "landscape">("portrait");
184
131
  const [doneDepressed, setDoneDepressed] = useState<boolean>(false);
132
+ const {theme} = useTheme();
185
133
 
186
134
  const options = useMemo(() => {
187
135
  if (isEqual(placeholder, {})) {
@@ -234,16 +182,6 @@ export function RNPickerSelect({
234
182
  setOrientation(nativeEvent.orientation);
235
183
  };
236
184
 
237
- const getPlaceholderStyle = () => {
238
- if (!isEqual(placeholder, {}) && selectedItem?.label === placeholder?.label) {
239
- return {
240
- ...defaultStyles.placeholder,
241
- ...style?.placeholder,
242
- };
243
- }
244
- return {};
245
- };
246
-
247
185
  const triggerOpenCloseCallbacks = () => {
248
186
  if (!showPicker && onOpen) {
249
187
  onOpen();
@@ -295,38 +233,62 @@ export function RNPickerSelect({
295
233
 
296
234
  return (
297
235
  <View
298
- style={[defaultStyles.modalViewMiddle, style.modalViewMiddle]}
236
+ style={{
237
+ height: 45,
238
+ flexDirection: "row",
239
+ justifyContent: "space-between",
240
+ alignItems: "center",
241
+ paddingHorizontal: 10,
242
+ backgroundColor: "#f8f8f8",
243
+ borderTopWidth: 1,
244
+ borderTopColor: "#dedede",
245
+ zIndex: 2,
246
+ }}
299
247
  testID="input_accessory_view"
300
248
  >
301
- <View style={[defaultStyles.chevronContainer, style.chevronContainer]}>
302
- <TouchableOpacity
303
- activeOpacity={onUpArrow ? 0.5 : 1}
304
- onPress={onUpArrow ? onUpArrowEvent : undefined}
305
- >
306
- <View
307
- style={[
308
- defaultStyles.chevron,
309
- style.chevron,
310
- defaultStyles.chevronUp,
311
- style.chevronUp,
312
- onUpArrow ? [defaultStyles.chevronActive, style.chevronActive] : {},
313
- ]}
314
- />
315
- </TouchableOpacity>
316
- <TouchableOpacity
317
- activeOpacity={onDownArrow ? 0.5 : 1}
318
- onPress={onDownArrow ? onDownArrowEvent : undefined}
319
- >
320
- <View
321
- style={[
322
- defaultStyles.chevron,
323
- style.chevron,
324
- defaultStyles.chevronDown,
325
- style.chevronDown,
326
- onDownArrow ? [defaultStyles.chevronActive, style.chevronActive] : {},
327
- ]}
328
- />
329
- </TouchableOpacity>
249
+ <View
250
+ style={{
251
+ flexDirection: "row",
252
+ }}
253
+ >
254
+ {Boolean(onUpArrow) && (
255
+ <TouchableOpacity
256
+ accessibilityRole="button"
257
+ activeOpacity={onUpArrow ? 0.5 : 1}
258
+ onPress={onUpArrow ? onUpArrowEvent : undefined}
259
+ >
260
+ <View
261
+ // chevron up
262
+ style={[
263
+ defaultStyles.chevron,
264
+ {
265
+ marginLeft: 11,
266
+ transform: [{translateY: 4}, {rotate: "-45deg"}],
267
+ },
268
+ onUpArrow ? [defaultStyles.chevronActive] : {},
269
+ ]}
270
+ />
271
+ </TouchableOpacity>
272
+ )}
273
+ {Boolean(onDownArrow) && (
274
+ <TouchableOpacity
275
+ accessibilityRole="button"
276
+ activeOpacity={onDownArrow ? 0.5 : 1}
277
+ onPress={onDownArrow ? onDownArrowEvent : undefined}
278
+ >
279
+ <View
280
+ // chevron down
281
+ style={[
282
+ defaultStyles.chevron,
283
+ {
284
+ marginLeft: 22,
285
+ transform: [{translateY: -5}, {rotate: "135deg"}],
286
+ },
287
+ onDownArrow ? [defaultStyles.chevronActive] : {},
288
+ ]}
289
+ />
290
+ </TouchableOpacity>
291
+ )}
330
292
  </View>
331
293
  <Pressable
332
294
  hitSlop={{top: 4, right: 4, bottom: 4, left: 4}}
@@ -346,9 +308,18 @@ export function RNPickerSelect({
346
308
  <Text
347
309
  allowFontScaling={false}
348
310
  style={[
349
- defaultStyles.done,
350
- style.done,
351
- doneDepressed ? [defaultStyles.doneDepressed, style.doneDepressed] : {},
311
+ {
312
+ color: "#007aff",
313
+ fontWeight: "600",
314
+ fontSize: 17,
315
+ paddingTop: 1,
316
+ paddingRight: 11,
317
+ },
318
+ doneDepressed
319
+ ? {
320
+ fontSize: 19,
321
+ }
322
+ : {},
352
323
  ]}
353
324
  testID="done_text"
354
325
  >
@@ -361,41 +332,35 @@ export function RNPickerSelect({
361
332
  };
362
333
 
363
334
  const renderIcon = () => {
364
- if (!Icon) {
335
+ // Icon only needed for iOS, web and android use default icons
336
+ if (Platform.OS !== "ios") {
365
337
  return null;
366
338
  }
367
339
 
368
340
  return (
369
- <View
370
- pointerEvents="none"
371
- style={[defaultStyles.iconContainer, style.iconContainer]}
372
- testID="icon_container"
373
- >
374
- <Icon testID="icon" />
341
+ <View style={{pointerEvents: "none"}} testID="icon_container">
342
+ <Icon color={disabled ? "secondaryLight" : "primary"} iconName="angle-down" size="sm" />
375
343
  </View>
376
344
  );
377
345
  };
378
346
 
379
347
  const renderTextInputOrChildren = () => {
380
- const containerStyle =
381
- Platform.OS === "ios" ? style.inputIOSContainer : style.inputAndroidContainer;
382
-
383
348
  if (children) {
384
- return (
385
- <View pointerEvents="box-only" style={containerStyle}>
386
- {children}
387
- </View>
388
- );
349
+ return <View style={{pointerEvents: "box-only"}}>{children}</View>;
389
350
  }
390
351
 
391
352
  return (
392
- <View pointerEvents="box-only" style={containerStyle}>
353
+ <View
354
+ style={{
355
+ flexDirection: "row",
356
+ justifyContent: "space-between",
357
+ pointerEvents: "box-only",
358
+ width: "100%",
359
+ }}
360
+ >
393
361
  <TextInput
394
362
  editable={false}
395
- style={[
396
- Platform.OS === "ios" ? style.inputIOS : style.inputAndroid,
397
- getPlaceholderStyle(),
398
- ]}
363
+ style={{color: disabled ? theme.text.secondaryLight : theme.text.primary}}
399
364
  testID="text_input"
400
365
  value={selectedItem?.inputLabel ? selectedItem?.inputLabel : selectedItem?.label}
401
366
  {...textInputProps}
@@ -407,15 +372,26 @@ export function RNPickerSelect({
407
372
 
408
373
  const renderIOS = () => {
409
374
  return (
410
- <View style={[defaultStyles.viewContainer, style.viewContainer]}>
375
+ <View
376
+ style={[
377
+ defaultStyles.viewContainer,
378
+ {
379
+ borderColor: theme.border.dark,
380
+ backgroundColor: theme.surface.base,
381
+ },
382
+ disabled && {
383
+ backgroundColor: theme.surface.neutralLight,
384
+ },
385
+ ]}
386
+ >
411
387
  <Pressable
412
388
  activeOpacity={1}
413
389
  style={{
414
390
  flexDirection: "row",
415
391
  justifyContent: "center",
416
392
  alignItems: "center",
417
- minHeight: style?.minHeight || 50,
418
- width: "100%",
393
+ minHeight: 40,
394
+ width: "95%",
419
395
  }}
420
396
  testID="ios_touchable_wrapper"
421
397
  onPress={() => {
@@ -435,7 +411,10 @@ export function RNPickerSelect({
435
411
  {...modalProps}
436
412
  >
437
413
  <Pressable
438
- style={[defaultStyles.modalViewTop, style.modalViewTop]}
414
+ accessibilityRole="button"
415
+ style={{
416
+ flex: 1,
417
+ }}
439
418
  testID="ios_modal_top"
440
419
  onPress={() => {
441
420
  togglePicker(true);
@@ -444,16 +423,17 @@ export function RNPickerSelect({
444
423
  {renderInputAccessoryView()}
445
424
  <View
446
425
  style={[
447
- defaultStyles.modalViewBottom,
426
+ {
427
+ justifyContent: "center",
428
+ backgroundColor: "#d0d4da",
429
+ },
448
430
  {height: orientation === "portrait" ? 215 : 162},
449
- style.modalViewBottom,
450
431
  ]}
451
432
  >
452
433
  <Picker
453
434
  selectedValue={selectedItem?.value}
454
435
  testID="ios_picker"
455
436
  onValueChange={onValueChangeEvent}
456
- {...pickerProps}
457
437
  >
458
438
  {renderPickerItems()}
459
439
  </Picker>
@@ -472,19 +452,23 @@ export function RNPickerSelect({
472
452
  onPress={onOpen}
473
453
  {...touchableWrapperProps}
474
454
  >
475
- <View style={style.headlessAndroidContainer}>
455
+ <View>
476
456
  {renderTextInputOrChildren()}
477
457
  <Picker
478
458
  enabled={!disabled}
479
459
  selectedValue={selectedItem?.value}
480
460
  style={[
481
- Icon ? {backgroundColor: "transparent"} : {}, // to hide native icon
482
- defaultStyles.headlessAndroidPicker,
483
- style.headlessAndroidPicker,
461
+ Platform.OS !== "web" ? {backgroundColor: "transparent"} : {}, // to hide native icon
462
+ {
463
+ position: "absolute",
464
+ width: "100%",
465
+ height: "100%",
466
+ color: "transparent",
467
+ opacity: 0,
468
+ },
484
469
  ]}
485
470
  testID="android_picker_headless"
486
471
  onValueChange={onValueChangeEvent}
487
- {...pickerProps}
488
472
  >
489
473
  {renderPickerItems()}
490
474
  </Picker>
@@ -495,41 +479,75 @@ export function RNPickerSelect({
495
479
 
496
480
  const renderAndroidNativePickerStyle = () => {
497
481
  return (
498
- <View style={[defaultStyles.viewContainer, style.viewContainer]}>
482
+ <View
483
+ style={[
484
+ defaultStyles.viewContainer,
485
+ {
486
+ height: 40,
487
+ borderColor: theme.border.dark,
488
+ backgroundColor: theme.surface.base,
489
+ },
490
+ disabled && {
491
+ backgroundColor: theme.surface.neutralLight,
492
+ },
493
+ ]}
494
+ >
499
495
  <Picker
500
496
  enabled={!disabled}
501
497
  selectedValue={selectedItem?.value}
502
498
  style={[
503
- Icon ? {backgroundColor: "transparent"} : {}, // to hide native icon
504
- style.inputAndroid,
505
- {width: "100%"},
506
- getPlaceholderStyle(),
499
+ Platform.OS !== "web" ? {backgroundColor: "transparent"} : {}, // to hide native icon
500
+ {width: "100%", color: theme.text.primary},
507
501
  ]}
508
502
  testID="android_picker"
509
503
  onValueChange={onValueChangeEvent}
510
- {...pickerProps}
511
504
  >
512
505
  {renderPickerItems()}
513
506
  </Picker>
514
- {renderIcon()}
515
507
  </View>
516
508
  );
517
509
  };
518
510
 
511
+ // TODO: Create custom React component for web in order to apply library style rules
519
512
  const renderWeb = () => {
520
513
  return (
521
- <View style={[defaultStyles.viewContainer, style.viewContainer]}>
514
+ <View
515
+ style={[
516
+ defaultStyles.viewContainer,
517
+ {
518
+ borderColor: theme.border.dark,
519
+ backgroundColor: theme.surface.base,
520
+ },
521
+ disabled && {
522
+ backgroundColor: theme.surface.neutralLight,
523
+ },
524
+ ]}
525
+ >
522
526
  <Picker
523
527
  enabled={!disabled}
524
528
  selectedValue={selectedItem?.value}
525
- style={[{width: "100%", height: "100%", border: "none"}, style.inputWeb]}
529
+ style={[
530
+ {
531
+ width: "100%",
532
+ height: "100%",
533
+ borderWidth: 0,
534
+ paddingHorizontal: 8,
535
+ paddingVertical: 8,
536
+ borderRadius: 4,
537
+ backgroundColor: theme.surface.base,
538
+ borderColor: "black",
539
+ },
540
+ disabled && {
541
+ color: theme.text.secondaryLight,
542
+ backgroundColor: theme.surface.neutralLight,
543
+ opacity: 1,
544
+ },
545
+ ]}
526
546
  testID="web_picker"
527
547
  onValueChange={onValueChangeEvent}
528
- {...pickerProps}
529
548
  >
530
549
  {renderPickerItems()}
531
550
  </Picker>
532
- {renderIcon()}
533
551
  </View>
534
552
  );
535
553
  };
package/src/Radio.tsx ADDED
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import {View} from "react-native";
3
+
4
+ import {RadioProps} from "./Common";
5
+ import {useTheme} from "./Theme";
6
+
7
+ export const Radio = ({selected}: RadioProps): React.ReactElement => {
8
+ const {theme} = useTheme();
9
+ return (
10
+ <View
11
+ style={{
12
+ height: 16,
13
+ width: 16,
14
+ borderRadius: 12,
15
+ borderWidth: 1,
16
+ borderColor: theme.text.secondaryDark,
17
+ alignItems: "center",
18
+ justifyContent: "center",
19
+ }}
20
+ >
21
+ {selected ? (
22
+ <View
23
+ style={{
24
+ height: 10,
25
+ width: 10,
26
+ borderRadius: 6,
27
+ backgroundColor: theme.text.secondaryDark,
28
+ }}
29
+ />
30
+ ) : null}
31
+ </View>
32
+ );
33
+ };
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import {TouchableOpacity, View} from "react-native";
3
+
4
+ import {RadioFieldProps} from "./Common";
5
+ import {Heading} from "./Heading";
6
+ import {isMobileDevice} from "./MediaQuery";
7
+ import {Radio} from "./Radio";
8
+ import {Text} from "./Text";
9
+
10
+ export const RadioField = ({
11
+ title,
12
+ options,
13
+ value,
14
+ onChange,
15
+ variant = "rightText",
16
+ }: RadioFieldProps): React.ReactElement => {
17
+ return (
18
+ <View style={{gap: isMobileDevice() ? 16 : 8}}>
19
+ <Heading size="sm">{title}</Heading>
20
+ {options.map((option) => (
21
+ <TouchableOpacity
22
+ key={option.key ?? option.value}
23
+ accessibilityHint={`Select ${option} from list of options`}
24
+ accessibilityLabel={option.label ?? option.value}
25
+ accessibilityRole="button"
26
+ style={{
27
+ flexDirection: "row",
28
+ justifyContent: "space-between",
29
+ }}
30
+ onPress={() => onChange(option.value)}
31
+ >
32
+ {variant === "leftText" && <Text>{option.label ?? option.value}</Text>}
33
+ <Radio key={option.key ?? option.value} selected={option.value === value} />
34
+ {variant === "rightText" && (
35
+ <View style={{marginRight: 0}}>
36
+ <Text>{option.label ?? option.value}</Text>
37
+ </View>
38
+ )}
39
+ </TouchableOpacity>
40
+ ))}
41
+ </View>
42
+ );
43
+ };