@terreno/ui 0.0.1

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 (446) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +160 -0
  3. package/dist/Accordion.d.ts +3 -0
  4. package/dist/Accordion.js +30 -0
  5. package/dist/Accordion.js.map +1 -0
  6. package/dist/ActionSheet.d.ts +169 -0
  7. package/dist/ActionSheet.js +637 -0
  8. package/dist/ActionSheet.js.map +1 -0
  9. package/dist/AddressField.d.ts +3 -0
  10. package/dist/AddressField.js +18 -0
  11. package/dist/AddressField.js.map +1 -0
  12. package/dist/Avatar.d.ts +3 -0
  13. package/dist/Avatar.js +189 -0
  14. package/dist/Avatar.js.map +1 -0
  15. package/dist/Badge.d.ts +3 -0
  16. package/dist/Badge.js +100 -0
  17. package/dist/Badge.js.map +1 -0
  18. package/dist/Banner.d.ts +4 -0
  19. package/dist/Banner.js +103 -0
  20. package/dist/Banner.js.map +1 -0
  21. package/dist/Body.d.ts +3 -0
  22. package/dist/Body.js +17 -0
  23. package/dist/Body.js.map +1 -0
  24. package/dist/BooleanField.d.ts +3 -0
  25. package/dist/BooleanField.js +89 -0
  26. package/dist/BooleanField.js.map +1 -0
  27. package/dist/Box.d.ts +3 -0
  28. package/dist/Box.js +289 -0
  29. package/dist/Box.js.map +1 -0
  30. package/dist/Button.d.ts +3 -0
  31. package/dist/Button.js +105 -0
  32. package/dist/Button.js.map +1 -0
  33. package/dist/Card.d.ts +2 -0
  34. package/dist/Card.js +18 -0
  35. package/dist/Card.js.map +1 -0
  36. package/dist/CheckBox.d.ts +3 -0
  37. package/dist/CheckBox.js +28 -0
  38. package/dist/CheckBox.js.map +1 -0
  39. package/dist/Common.d.ts +2325 -0
  40. package/dist/Common.js +47 -0
  41. package/dist/Common.js.map +1 -0
  42. package/dist/CommonIconTypes.d.ts +3 -0
  43. package/dist/CommonIconTypes.js +2 -0
  44. package/dist/CommonIconTypes.js.map +1 -0
  45. package/dist/Constants.d.ts +12685 -0
  46. package/dist/Constants.js +3310 -0
  47. package/dist/Constants.js.map +1 -0
  48. package/dist/CustomSelectField.d.ts +3 -0
  49. package/dist/CustomSelectField.js +59 -0
  50. package/dist/CustomSelectField.js.map +1 -0
  51. package/dist/DataTable.d.ts +3 -0
  52. package/dist/DataTable.js +190 -0
  53. package/dist/DataTable.js.map +1 -0
  54. package/dist/DateTimeActionSheet.d.ts +2 -0
  55. package/dist/DateTimeActionSheet.js +270 -0
  56. package/dist/DateTimeActionSheet.js.map +1 -0
  57. package/dist/DateTimeField.d.ts +3 -0
  58. package/dist/DateTimeField.js +514 -0
  59. package/dist/DateTimeField.js.map +1 -0
  60. package/dist/DateUtilities.d.ts +57 -0
  61. package/dist/DateUtilities.js +308 -0
  62. package/dist/DateUtilities.js.map +1 -0
  63. package/dist/DecimalRangeActionSheet.d.ts +6 -0
  64. package/dist/DecimalRangeActionSheet.js +45 -0
  65. package/dist/DecimalRangeActionSheet.js.map +1 -0
  66. package/dist/DismissButton.d.ts +3 -0
  67. package/dist/DismissButton.js +12 -0
  68. package/dist/DismissButton.js.map +1 -0
  69. package/dist/EmailField.d.ts +3 -0
  70. package/dist/EmailField.js +48 -0
  71. package/dist/EmailField.js.map +1 -0
  72. package/dist/EmojiSelector.d.ts +113 -0
  73. package/dist/EmojiSelector.js +322 -0
  74. package/dist/EmojiSelector.js.map +1 -0
  75. package/dist/ErrorBoundary.d.ts +19 -0
  76. package/dist/ErrorBoundary.js +30 -0
  77. package/dist/ErrorBoundary.js.map +1 -0
  78. package/dist/ErrorPage.d.ts +6 -0
  79. package/dist/ErrorPage.js +15 -0
  80. package/dist/ErrorPage.js.map +1 -0
  81. package/dist/Field.d.ts +3 -0
  82. package/dist/Field.js +80 -0
  83. package/dist/Field.js.map +1 -0
  84. package/dist/FlatList.d.ts +2 -0
  85. package/dist/FlatList.js +3 -0
  86. package/dist/FlatList.js.map +1 -0
  87. package/dist/Heading.d.ts +3 -0
  88. package/dist/Heading.js +43 -0
  89. package/dist/Heading.js.map +1 -0
  90. package/dist/HeightActionSheet.d.ts +11 -0
  91. package/dist/HeightActionSheet.js +46 -0
  92. package/dist/HeightActionSheet.js.map +1 -0
  93. package/dist/Hyperlink.d.ts +30 -0
  94. package/dist/Hyperlink.js +144 -0
  95. package/dist/Hyperlink.js.map +1 -0
  96. package/dist/Icon.d.ts +3 -0
  97. package/dist/Icon.js +15 -0
  98. package/dist/Icon.js.map +1 -0
  99. package/dist/IconButton.d.ts +3 -0
  100. package/dist/IconButton.js +111 -0
  101. package/dist/IconButton.js.map +1 -0
  102. package/dist/Image.d.ts +8 -0
  103. package/dist/Image.js +37 -0
  104. package/dist/Image.js.map +1 -0
  105. package/dist/ImageBackground.d.ts +10 -0
  106. package/dist/ImageBackground.js +9 -0
  107. package/dist/ImageBackground.js.map +1 -0
  108. package/dist/InfoModalIcon.d.ts +3 -0
  109. package/dist/InfoModalIcon.js +10 -0
  110. package/dist/InfoModalIcon.js.map +1 -0
  111. package/dist/InfoTooltipButton.d.ts +3 -0
  112. package/dist/InfoTooltipButton.js +6 -0
  113. package/dist/InfoTooltipButton.js.map +1 -0
  114. package/dist/Link.d.ts +3 -0
  115. package/dist/Link.js +10 -0
  116. package/dist/Link.js.map +1 -0
  117. package/dist/MarkdownView.d.ts +5 -0
  118. package/dist/MarkdownView.js +44 -0
  119. package/dist/MarkdownView.js.map +1 -0
  120. package/dist/MediaQuery.d.ts +4 -0
  121. package/dist/MediaQuery.js +52 -0
  122. package/dist/MediaQuery.js.map +1 -0
  123. package/dist/MobileAddressAutoComplete.d.ts +2 -0
  124. package/dist/MobileAddressAutoComplete.js +54 -0
  125. package/dist/MobileAddressAutoComplete.js.map +1 -0
  126. package/dist/Modal.d.ts +3 -0
  127. package/dist/Modal.js +127 -0
  128. package/dist/Modal.js.map +1 -0
  129. package/dist/ModalSheet.d.ts +6 -0
  130. package/dist/ModalSheet.js +42 -0
  131. package/dist/ModalSheet.js.map +1 -0
  132. package/dist/MultiselectField.d.ts +3 -0
  133. package/dist/MultiselectField.js +45 -0
  134. package/dist/MultiselectField.js.map +1 -0
  135. package/dist/NumberField.d.ts +3 -0
  136. package/dist/NumberField.js +60 -0
  137. package/dist/NumberField.js.map +1 -0
  138. package/dist/NumberPickerActionSheet.d.ts +7 -0
  139. package/dist/NumberPickerActionSheet.js +22 -0
  140. package/dist/NumberPickerActionSheet.js.map +1 -0
  141. package/dist/OpenAPIContext.d.ts +4 -0
  142. package/dist/OpenAPIContext.js +53 -0
  143. package/dist/OpenAPIContext.js.map +1 -0
  144. package/dist/Page.d.ts +7 -0
  145. package/dist/Page.js +24 -0
  146. package/dist/Page.js.map +1 -0
  147. package/dist/Pagination.d.ts +3 -0
  148. package/dist/Pagination.js +106 -0
  149. package/dist/Pagination.js.map +1 -0
  150. package/dist/PasswordField.d.ts +2 -0
  151. package/dist/PasswordField.js +6 -0
  152. package/dist/PasswordField.js.map +1 -0
  153. package/dist/Permissions.d.ts +2 -0
  154. package/dist/Permissions.js +35 -0
  155. package/dist/Permissions.js.map +1 -0
  156. package/dist/PhoneNumberField.d.ts +3 -0
  157. package/dist/PhoneNumberField.js +83 -0
  158. package/dist/PhoneNumberField.js.map +1 -0
  159. package/dist/PickerSelect.d.ts +46 -0
  160. package/dist/PickerSelect.js +306 -0
  161. package/dist/PickerSelect.js.map +1 -0
  162. package/dist/Radio.d.ts +3 -0
  163. package/dist/Radio.js +21 -0
  164. package/dist/Radio.js.map +1 -0
  165. package/dist/RadioField.d.ts +3 -0
  166. package/dist/RadioField.js +16 -0
  167. package/dist/RadioField.js.map +1 -0
  168. package/dist/ScrollView.d.ts +2 -0
  169. package/dist/ScrollView.js +3 -0
  170. package/dist/ScrollView.js.map +1 -0
  171. package/dist/SectionDivider.d.ts +2 -0
  172. package/dist/SectionDivider.js +12 -0
  173. package/dist/SectionDivider.js.map +1 -0
  174. package/dist/SegmentedControl.d.ts +3 -0
  175. package/dist/SegmentedControl.js +65 -0
  176. package/dist/SegmentedControl.js.map +1 -0
  177. package/dist/SelectBadge.d.ts +3 -0
  178. package/dist/SelectBadge.js +166 -0
  179. package/dist/SelectBadge.js.map +1 -0
  180. package/dist/SelectField.d.ts +3 -0
  181. package/dist/SelectField.js +16 -0
  182. package/dist/SelectField.js.map +1 -0
  183. package/dist/SideDrawer.d.ts +3 -0
  184. package/dist/SideDrawer.js +32 -0
  185. package/dist/SideDrawer.js.map +1 -0
  186. package/dist/Signature.d.ts +8 -0
  187. package/dist/Signature.js +21 -0
  188. package/dist/Signature.js.map +1 -0
  189. package/dist/Signature.native.d.ts +8 -0
  190. package/dist/Signature.native.js +26 -0
  191. package/dist/Signature.native.js.map +1 -0
  192. package/dist/SignatureField.d.ts +3 -0
  193. package/dist/SignatureField.js +42 -0
  194. package/dist/SignatureField.js.map +1 -0
  195. package/dist/Slider.d.ts +3 -0
  196. package/dist/Slider.js +78 -0
  197. package/dist/Slider.js.map +1 -0
  198. package/dist/Spinner.d.ts +3 -0
  199. package/dist/Spinner.js +33 -0
  200. package/dist/Spinner.js.map +1 -0
  201. package/dist/SplitPage.d.ts +2 -0
  202. package/dist/SplitPage.js +139 -0
  203. package/dist/SplitPage.js.map +1 -0
  204. package/dist/SplitPage.native.d.ts +2 -0
  205. package/dist/SplitPage.native.js +75 -0
  206. package/dist/SplitPage.native.js.map +1 -0
  207. package/dist/TapToEdit.d.ts +4 -0
  208. package/dist/TapToEdit.js +170 -0
  209. package/dist/TapToEdit.js.map +1 -0
  210. package/dist/TerrenoProvider.d.ts +6 -0
  211. package/dist/TerrenoProvider.js +10 -0
  212. package/dist/TerrenoProvider.js.map +1 -0
  213. package/dist/Text.d.ts +3 -0
  214. package/dist/Text.js +95 -0
  215. package/dist/Text.js.map +1 -0
  216. package/dist/TextArea.d.ts +3 -0
  217. package/dist/TextArea.js +6 -0
  218. package/dist/TextArea.js.map +1 -0
  219. package/dist/TextField.d.ts +3 -0
  220. package/dist/TextField.js +144 -0
  221. package/dist/TextField.js.map +1 -0
  222. package/dist/TextFieldNumberActionSheet.d.ts +7 -0
  223. package/dist/TextFieldNumberActionSheet.js +20 -0
  224. package/dist/TextFieldNumberActionSheet.js.map +1 -0
  225. package/dist/Theme.d.ts +96 -0
  226. package/dist/Theme.js +213 -0
  227. package/dist/Theme.js.map +1 -0
  228. package/dist/TimezonePicker.d.ts +11 -0
  229. package/dist/TimezonePicker.js +27 -0
  230. package/dist/TimezonePicker.js.map +1 -0
  231. package/dist/Toast.d.ts +23 -0
  232. package/dist/Toast.js +157 -0
  233. package/dist/Toast.js.map +1 -0
  234. package/dist/Tooltip.d.ts +3 -0
  235. package/dist/Tooltip.js +289 -0
  236. package/dist/Tooltip.js.map +1 -0
  237. package/dist/UnifiedAddressAutoComplete.d.ts +2 -0
  238. package/dist/UnifiedAddressAutoComplete.js +23 -0
  239. package/dist/UnifiedAddressAutoComplete.js.map +1 -0
  240. package/dist/Unifier.d.ts +43 -0
  241. package/dist/Unifier.js +154 -0
  242. package/dist/Unifier.js.map +1 -0
  243. package/dist/Utilities.d.ts +56 -0
  244. package/dist/Utilities.js +193 -0
  245. package/dist/Utilities.js.map +1 -0
  246. package/dist/WebAddressAutocomplete.d.ts +3 -0
  247. package/dist/WebAddressAutocomplete.js +61 -0
  248. package/dist/WebAddressAutocomplete.js.map +1 -0
  249. package/dist/fieldElements/FieldError.d.ts +6 -0
  250. package/dist/fieldElements/FieldError.js +9 -0
  251. package/dist/fieldElements/FieldError.js.map +1 -0
  252. package/dist/fieldElements/FieldHelperText.d.ts +6 -0
  253. package/dist/fieldElements/FieldHelperText.js +8 -0
  254. package/dist/fieldElements/FieldHelperText.js.map +1 -0
  255. package/dist/fieldElements/FieldTitle.d.ts +6 -0
  256. package/dist/fieldElements/FieldTitle.js +16 -0
  257. package/dist/fieldElements/FieldTitle.js.map +1 -0
  258. package/dist/fieldElements/index.d.ts +3 -0
  259. package/dist/fieldElements/index.js +4 -0
  260. package/dist/fieldElements/index.js.map +1 -0
  261. package/dist/icons/MobileIcon.d.ts +2 -0
  262. package/dist/icons/MobileIcon.js +18 -0
  263. package/dist/icons/MobileIcon.js.map +1 -0
  264. package/dist/icons/OfflineIcon.d.ts +2 -0
  265. package/dist/icons/OfflineIcon.js +18 -0
  266. package/dist/icons/OfflineIcon.js.map +1 -0
  267. package/dist/icons/OnlineIcon.d.ts +2 -0
  268. package/dist/icons/OnlineIcon.js +19 -0
  269. package/dist/icons/OnlineIcon.js.map +1 -0
  270. package/dist/icons/OutOfficeIcon.d.ts +2 -0
  271. package/dist/icons/OutOfficeIcon.js +18 -0
  272. package/dist/icons/OutOfficeIcon.js.map +1 -0
  273. package/dist/icons/index.d.ts +4 -0
  274. package/dist/icons/index.js +5 -0
  275. package/dist/icons/index.js.map +1 -0
  276. package/dist/index.d.ts +1328 -0
  277. package/dist/index.js +89 -0
  278. package/dist/index.js.map +1 -0
  279. package/dist/table/Table.d.ts +3 -0
  280. package/dist/table/Table.js +53 -0
  281. package/dist/table/Table.js.map +1 -0
  282. package/dist/table/TableBadge.d.ts +6 -0
  283. package/dist/table/TableBadge.js +23 -0
  284. package/dist/table/TableBadge.js.map +1 -0
  285. package/dist/table/TableBoolean.d.ts +6 -0
  286. package/dist/table/TableBoolean.js +37 -0
  287. package/dist/table/TableBoolean.js.map +1 -0
  288. package/dist/table/TableDate.d.ts +3 -0
  289. package/dist/table/TableDate.js +27 -0
  290. package/dist/table/TableDate.js.map +1 -0
  291. package/dist/table/TableHeader.d.ts +6 -0
  292. package/dist/table/TableHeader.js +10 -0
  293. package/dist/table/TableHeader.js.map +1 -0
  294. package/dist/table/TableHeaderCell.d.ts +6 -0
  295. package/dist/table/TableHeaderCell.js +54 -0
  296. package/dist/table/TableHeaderCell.js.map +1 -0
  297. package/dist/table/TableIconButton.d.ts +3 -0
  298. package/dist/table/TableIconButton.js +39 -0
  299. package/dist/table/TableIconButton.js.map +1 -0
  300. package/dist/table/TableNumber.d.ts +3 -0
  301. package/dist/table/TableNumber.js +18 -0
  302. package/dist/table/TableNumber.js.map +1 -0
  303. package/dist/table/TableRow.d.ts +6 -0
  304. package/dist/table/TableRow.js +22 -0
  305. package/dist/table/TableRow.js.map +1 -0
  306. package/dist/table/TableText.d.ts +3 -0
  307. package/dist/table/TableText.js +18 -0
  308. package/dist/table/TableText.js.map +1 -0
  309. package/dist/table/TableTitle.d.ts +3 -0
  310. package/dist/table/TableTitle.js +21 -0
  311. package/dist/table/TableTitle.js.map +1 -0
  312. package/dist/table/tableContext.d.ts +5 -0
  313. package/dist/table/tableContext.js +38 -0
  314. package/dist/table/tableContext.js.map +1 -0
  315. package/dist/useStoredState.d.ts +1 -0
  316. package/dist/useStoredState.js +49 -0
  317. package/dist/useStoredState.js.map +1 -0
  318. package/package.json +123 -0
  319. package/src/Accordion.test.tsx +104 -0
  320. package/src/Accordion.tsx +81 -0
  321. package/src/ActionSheet.tsx +881 -0
  322. package/src/AddressField.test.tsx +120 -0
  323. package/src/AddressField.tsx +122 -0
  324. package/src/Avatar.test.tsx +163 -0
  325. package/src/Avatar.tsx +298 -0
  326. package/src/Badge.test.tsx +116 -0
  327. package/src/Badge.tsx +136 -0
  328. package/src/Banner.tsx +200 -0
  329. package/src/Body.tsx +34 -0
  330. package/src/BooleanField.tsx +141 -0
  331. package/src/Box.test.tsx +662 -0
  332. package/src/Box.tsx +368 -0
  333. package/src/Button.tsx +196 -0
  334. package/src/Card.tsx +19 -0
  335. package/src/CheckBox.tsx +45 -0
  336. package/src/Common.ts +2787 -0
  337. package/src/CommonIconTypes.ts +2030 -0
  338. package/src/Constants.ts +3311 -0
  339. package/src/CustomSelectField.tsx +115 -0
  340. package/src/DataTable.tsx +674 -0
  341. package/src/DateTimeActionSheet.tsx +559 -0
  342. package/src/DateTimeField.test.tsx +393 -0
  343. package/src/DateTimeField.tsx +777 -0
  344. package/src/DateUtilities.test.ts +440 -0
  345. package/src/DateUtilities.tsx +370 -0
  346. package/src/DecimalRangeActionSheet.tsx +85 -0
  347. package/src/DismissButton.tsx +31 -0
  348. package/src/EmailField.tsx +66 -0
  349. package/src/EmojiSelector.test.tsx +61 -0
  350. package/src/EmojiSelector.tsx +510 -0
  351. package/src/ErrorBoundary.tsx +37 -0
  352. package/src/ErrorPage.tsx +41 -0
  353. package/src/Field.tsx +101 -0
  354. package/src/FlatList.tsx +2 -0
  355. package/src/Heading.tsx +66 -0
  356. package/src/HeightActionSheet.tsx +91 -0
  357. package/src/Hyperlink.tsx +179 -0
  358. package/src/Icon.tsx +36 -0
  359. package/src/IconButton.tsx +217 -0
  360. package/src/Image.tsx +51 -0
  361. package/src/ImageBackground.tsx +14 -0
  362. package/src/InfoModalIcon.tsx +42 -0
  363. package/src/InfoTooltipButton.tsx +16 -0
  364. package/src/Link.tsx +22 -0
  365. package/src/MarkdownView.tsx +67 -0
  366. package/src/MediaQuery.ts +46 -0
  367. package/src/MobileAddressAutoComplete.tsx +126 -0
  368. package/src/Modal.tsx +300 -0
  369. package/src/ModalSheet.tsx +58 -0
  370. package/src/MultiselectField.tsx +112 -0
  371. package/src/NumberField.tsx +67 -0
  372. package/src/NumberPickerActionSheet.tsx +51 -0
  373. package/src/OpenAPIContext.tsx +74 -0
  374. package/src/Page.tsx +105 -0
  375. package/src/Pagination.tsx +169 -0
  376. package/src/PasswordField.tsx +7 -0
  377. package/src/Permissions.ts +43 -0
  378. package/src/PhoneNumberField.tsx +109 -0
  379. package/src/PickerSelect.tsx +571 -0
  380. package/src/Radio.tsx +33 -0
  381. package/src/RadioField.tsx +43 -0
  382. package/src/ScrollView.tsx +2 -0
  383. package/src/SectionDivider.tsx +18 -0
  384. package/src/SegmentedControl.tsx +126 -0
  385. package/src/SelectBadge.tsx +280 -0
  386. package/src/SelectField.tsx +41 -0
  387. package/src/SideDrawer.tsx +56 -0
  388. package/src/Signature.native.tsx +57 -0
  389. package/src/Signature.tsx +44 -0
  390. package/src/SignatureField.tsx +92 -0
  391. package/src/Slider.tsx +199 -0
  392. package/src/Spinner.tsx +35 -0
  393. package/src/SplitPage.native.tsx +163 -0
  394. package/src/SplitPage.tsx +304 -0
  395. package/src/TapToEdit.tsx +292 -0
  396. package/src/TerrenoProvider.tsx +31 -0
  397. package/src/Text.tsx +123 -0
  398. package/src/TextArea.test.tsx +255 -0
  399. package/src/TextArea.tsx +8 -0
  400. package/src/TextField.test.tsx +487 -0
  401. package/src/TextField.tsx +260 -0
  402. package/src/TextFieldNumberActionSheet.tsx +46 -0
  403. package/src/Theme.tsx +248 -0
  404. package/src/TimezonePicker.tsx +45 -0
  405. package/src/Toast.tsx +234 -0
  406. package/src/Tooltip.tsx +407 -0
  407. package/src/UnifiedAddressAutoComplete.tsx +66 -0
  408. package/src/Unifier.ts +172 -0
  409. package/src/Utilities.tsx +329 -0
  410. package/src/WebAddressAutocomplete.tsx +84 -0
  411. package/src/__snapshots__/Accordion.test.tsx.snap +126 -0
  412. package/src/__snapshots__/AddressField.test.tsx.snap +1197 -0
  413. package/src/__snapshots__/Avatar.test.tsx.snap +57 -0
  414. package/src/__snapshots__/Badge.test.tsx.snap +55 -0
  415. package/src/__snapshots__/Box.test.tsx.snap +162 -0
  416. package/src/__snapshots__/EmojiSelector.test.tsx.snap +422 -0
  417. package/src/__snapshots__/TextArea.test.tsx.snap +521 -0
  418. package/src/__snapshots__/TextField.test.tsx.snap +569 -0
  419. package/src/bunSetup.ts +1235 -0
  420. package/src/fieldElements/FieldError.tsx +24 -0
  421. package/src/fieldElements/FieldHelperText.tsx +20 -0
  422. package/src/fieldElements/FieldTitle.tsx +31 -0
  423. package/src/fieldElements/index.tsx +3 -0
  424. package/src/icons/MobileIcon.tsx +40 -0
  425. package/src/icons/OfflineIcon.tsx +37 -0
  426. package/src/icons/OnlineIcon.tsx +39 -0
  427. package/src/icons/OutOfficeIcon.tsx +36 -0
  428. package/src/icons/index.ts +4 -0
  429. package/src/index.tsx +1375 -0
  430. package/src/polyfill.d.ts +11 -0
  431. package/src/table/Table.tsx +109 -0
  432. package/src/table/TableBadge.tsx +46 -0
  433. package/src/table/TableBoolean.tsx +70 -0
  434. package/src/table/TableDate.tsx +38 -0
  435. package/src/table/TableHeader.tsx +20 -0
  436. package/src/table/TableHeaderCell.tsx +94 -0
  437. package/src/table/TableIconButton.tsx +61 -0
  438. package/src/table/TableNumber.tsx +29 -0
  439. package/src/table/TableRow.tsx +67 -0
  440. package/src/table/TableText.tsx +29 -0
  441. package/src/table/TableTitle.tsx +31 -0
  442. package/src/table/tableContext.tsx +67 -0
  443. package/src/test-utils.tsx +27 -0
  444. package/src/types/react-native-swiper-flatlist.d.ts +56 -0
  445. package/src/useStoredState.test.tsx +143 -0
  446. package/src/useStoredState.ts +56 -0
package/src/Box.tsx ADDED
@@ -0,0 +1,368 @@
1
+ import React, {useImperativeHandle} from "react";
2
+ import {
3
+ type AccessibilityProps,
4
+ KeyboardAvoidingView,
5
+ Platform,
6
+ Pressable,
7
+ SafeAreaView,
8
+ ScrollView,
9
+ View,
10
+ } from "react-native";
11
+
12
+ import {getRounding, getSpacing, useTheme} from ".";
13
+ import type {
14
+ AlignContent,
15
+ AlignItems,
16
+ AlignSelf,
17
+ BorderTheme,
18
+ BoxProps,
19
+ JustifyContent,
20
+ SurfaceTheme,
21
+ } from "./Common";
22
+ import {mediaQueryLargerThan} from "./MediaQuery";
23
+ import {Unifier} from "./Unifier";
24
+
25
+ const ALIGN_CONTENT = {
26
+ around: "space-around",
27
+ between: "space-between",
28
+ center: "center",
29
+ end: "flex-end",
30
+ start: "flex-start",
31
+ stretch: "stretch",
32
+ };
33
+
34
+ const ALIGN_ITEMS = {
35
+ baseline: "baseline",
36
+ center: "center",
37
+ end: "flex-end",
38
+ start: "flex-start",
39
+ stretch: "stretch",
40
+ };
41
+
42
+ const ALIGN_SELF = {
43
+ around: "space-around",
44
+ auto: "auto",
45
+ baseline: "baseline",
46
+ between: "space-between",
47
+ center: "center",
48
+ end: "flex-end",
49
+ start: "flex-start",
50
+ stretch: "stretch",
51
+ };
52
+
53
+ const BORDER_WIDTH = 1;
54
+
55
+ const isValidPercentage = (value: string): boolean => {
56
+ return /^\d+(\.\d+)?%$/.test(value);
57
+ };
58
+
59
+ const isValidWidthHeight = (value: number | string): boolean => {
60
+ return typeof value === "number" || !Number.isNaN(Number(value)) || isValidPercentage(value);
61
+ };
62
+
63
+ export const Box = React.forwardRef((props: BoxProps, ref) => {
64
+ const {theme} = useTheme();
65
+
66
+ useImperativeHandle(ref, () => ({
67
+ scrollTo: (y: number) => {
68
+ if (scrollRef?.current) {
69
+ // HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout
70
+ // to avoid this, but it works well enough.
71
+ setTimeout(() => {
72
+ scrollRef?.current?.scrollTo({y});
73
+ }, 50);
74
+ }
75
+ },
76
+ scrollToEnd: () => {
77
+ if (scrollRef?.current) {
78
+ // HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout
79
+ // to avoid this, but it works well enough.
80
+ setTimeout(() => {
81
+ scrollRef?.current?.scrollToEnd();
82
+ }, 50);
83
+ }
84
+ },
85
+ }));
86
+
87
+ const BOX_STYLE_MAP: {
88
+ [prop: string]: (
89
+ value: any,
90
+ all: {[prop: string]: any}
91
+ ) => {[style: string]: string | number} | {};
92
+ } = {
93
+ alignContent: (value: AlignContent) => ({alignContent: ALIGN_CONTENT[value]}),
94
+ alignItems: (value: AlignItems) => ({alignItems: ALIGN_ITEMS[value]}),
95
+ alignSelf: (value: AlignSelf) => ({alignSelf: ALIGN_SELF[value]}),
96
+ border: (value: keyof BorderTheme) => {
97
+ if (!value) {
98
+ return {};
99
+ }
100
+ return {borderColor: theme.border[value], borderWidth: BORDER_WIDTH};
101
+ },
102
+ borderBottom: (value: keyof BorderTheme) => {
103
+ if (!value) {
104
+ return {};
105
+ }
106
+ return {borderBottomColor: theme.border[value], borderBottomWidth: BORDER_WIDTH};
107
+ },
108
+ borderLeft: (value: keyof BorderTheme) => {
109
+ if (!value) {
110
+ return {};
111
+ }
112
+ return {borderLeftColor: theme.border[value], borderLeftWidth: BORDER_WIDTH};
113
+ },
114
+ borderRight: (value: keyof BorderTheme) => {
115
+ if (!value) {
116
+ return {};
117
+ }
118
+ return {borderRightColor: theme.border[value], borderRightWidth: BORDER_WIDTH};
119
+ },
120
+ borderTop: (value: keyof BorderTheme) => {
121
+ if (!value) {
122
+ return {};
123
+ }
124
+ return {borderTopColor: theme.border[value], borderTopWidth: BORDER_WIDTH};
125
+ },
126
+ bottom: (bottom) => ({bottom: bottom ? 0 : undefined}),
127
+ color: (value: keyof SurfaceTheme) => ({backgroundColor: theme.surface[value]}),
128
+ direction: (value: any) => ({display: "flex", flexDirection: value}),
129
+ display: (value: any) => {
130
+ if (value === "none") {
131
+ return {display: "none"};
132
+ }
133
+ return value === "flex" ? {flex: undefined} : {flex: 0, flexDirection: "row"};
134
+ },
135
+ flex: (value: string) => {
136
+ if (value === "grow") {
137
+ return {display: "flex", flexGrow: 1, flexShrink: 1};
138
+ } else if (value === "shrink") {
139
+ return {display: "flex", flexShrink: 1};
140
+ } else {
141
+ return {display: "flex", flex: 0};
142
+ }
143
+ },
144
+ gap: (value) => ({gap: getSpacing(value)}),
145
+ height: (value) => {
146
+ if (!isValidWidthHeight(value)) {
147
+ console.warn(
148
+ `Box: height prop must be a number or percentage string (e.g., "50%"), received: ${value}`
149
+ );
150
+ return {};
151
+ }
152
+ if (props.border && !Number.isNaN(Number(value))) {
153
+ return {height: Number(value) + 2 * 2};
154
+ } else {
155
+ return {height: value};
156
+ }
157
+ },
158
+ justifyContent: (value: JustifyContent) => ({justifyContent: ALIGN_CONTENT[value]}),
159
+ left: (left) => ({left: left ? 0 : undefined}),
160
+ lgDirection: (value: any) =>
161
+ mediaQueryLargerThan("lg") ? {display: "flex", flexDirection: value} : {},
162
+ margin: (value) => ({margin: getSpacing(value)}),
163
+ marginBottom: (value) => ({marginBottom: getSpacing(value)}),
164
+ marginLeft: (value) => ({marginLeft: getSpacing(value)}),
165
+ marginRight: (value) => ({marginRight: getSpacing(value)}),
166
+ marginTop: (value) => ({marginTop: getSpacing(value)}),
167
+ maxHeight: (value) => {
168
+ if (!isValidWidthHeight(value)) {
169
+ console.warn(
170
+ `Box: maxHeight prop must be a number or percentage string (e.g., "50%"), received: ${value}`
171
+ );
172
+ return {};
173
+ }
174
+ return {maxHeight: value};
175
+ },
176
+ maxWidth: (value) => {
177
+ if (!isValidWidthHeight(value)) {
178
+ console.warn(
179
+ `Box: maxWidth prop must be a number or percentage string (e.g., "50%"), received: ${value}`
180
+ );
181
+ return {};
182
+ }
183
+ return {maxWidth: value};
184
+ },
185
+ mdDirection: (value: any) =>
186
+ mediaQueryLargerThan("md") ? {display: "flex", flexDirection: value} : {},
187
+ minHeight: (value) => {
188
+ if (!isValidWidthHeight(value)) {
189
+ console.warn(
190
+ `Box: minHeight prop must be a number or percentage string (e.g., "50%"), received: ${value}`
191
+ );
192
+ return {};
193
+ }
194
+ return {minHeight: value};
195
+ },
196
+ minWidth: (value) => {
197
+ if (!isValidWidthHeight(value)) {
198
+ console.warn(
199
+ `Box: minWidth prop must be a number or percentage string (e.g., "50%"), received: ${value}`
200
+ );
201
+ return {};
202
+ }
203
+ return {minWidth: value};
204
+ },
205
+ overflow: (value) => {
206
+ if (value === "scrollY" || value === "scroll") {
207
+ return {overflow: "scroll"};
208
+ }
209
+ return {overflow: value};
210
+ },
211
+ padding: (value) => ({padding: getSpacing(value)}),
212
+ paddingX: (value) => ({paddingLeft: getSpacing(value), paddingRight: getSpacing(value)}),
213
+ paddingY: (value) => ({paddingBottom: getSpacing(value), paddingTop: getSpacing(value)}),
214
+ position: (value) => ({position: value}),
215
+ right: (right) => ({right: right ? 0 : undefined}),
216
+ rounding: (rounding, allProps) => {
217
+ if (rounding === "circle") {
218
+ if (!allProps.height && !allProps.width) {
219
+ console.warn("Cannot use Box rounding='circle' without height or width.");
220
+ return {borderRadius: undefined};
221
+ }
222
+ return {borderRadius: allProps.height || allProps.width};
223
+ }
224
+
225
+ if (rounding) {
226
+ return {borderRadius: getRounding(rounding)};
227
+ }
228
+
229
+ return {borderRadius: undefined};
230
+ },
231
+ shadow: (value) => {
232
+ if (!value) {
233
+ return {};
234
+ }
235
+ if (Platform.OS === "ios" || Platform.OS === "web") {
236
+ return {
237
+ boxShadow: "2px 2px 2px rgba(153, 153, 153, 1.0)",
238
+ };
239
+ } else {
240
+ return {elevation: 4};
241
+ }
242
+ },
243
+ smDirection: (value: any) =>
244
+ mediaQueryLargerThan("sm") ? {display: "flex", flexDirection: value} : {},
245
+ top: (top) => ({top: top ? 0 : undefined}),
246
+ width: (value) => {
247
+ if (!isValidWidthHeight(value)) {
248
+ console.warn(
249
+ `Box: width prop must be a number or percentage string (e.g., "50%"), received: ${value}`
250
+ );
251
+ return {};
252
+ }
253
+ if (props.border && !Number.isNaN(Number(value))) {
254
+ return {width: Number(value) + 2 * 2};
255
+ } else {
256
+ return {width: value};
257
+ }
258
+ },
259
+ wrap: (value) => ({alignItems: "flex-start", flexWrap: value ? "wrap" : "nowrap"}),
260
+ zIndex: (value) => ({zIndex: value ? value : undefined}),
261
+ };
262
+
263
+ const scrollRef = props.scrollRef ?? React.createRef();
264
+
265
+ const propsToStyle = (): any => {
266
+ let style: any = {};
267
+ for (const prop of Object.keys(props) as Array<keyof typeof props>) {
268
+ const value = props[prop];
269
+ if (BOX_STYLE_MAP[prop]) {
270
+ Object.assign(style, BOX_STYLE_MAP[prop](value, props));
271
+ } else if (prop !== "children" && prop !== "onClick") {
272
+ style[prop] = value;
273
+ // console.warn(`Box: unknown property ${prop}`);
274
+ }
275
+ }
276
+
277
+ if (props.wrap && props.alignItems && Platform.OS !== "web") {
278
+ console.warn("React Native doesn't support wrap and alignItems together.");
279
+ }
280
+
281
+ // Finally, dangerously set overrides.
282
+ if (props.dangerouslySetInlineStyle) {
283
+ style = {...style, ...props.dangerouslySetInlineStyle.__style};
284
+ }
285
+
286
+ return style;
287
+ };
288
+
289
+ const onHoverIn = async () => {
290
+ await props.onHoverStart?.();
291
+ };
292
+
293
+ const onHoverOut = async () => {
294
+ await props.onHoverEnd?.();
295
+ };
296
+
297
+ let box;
298
+
299
+ // Adding the accessibilityRole of button throws a warning in React Native since we nest buttons
300
+ // within Box and RN does not support nested buttons
301
+ if (props.onClick) {
302
+ box = (
303
+ <Pressable
304
+ accessibilityHint={(props as AccessibilityProps).accessibilityHint}
305
+ aria-label={(props as AccessibilityProps).accessibilityLabel}
306
+ aria-role="button"
307
+ onLayout={props.onLayout}
308
+ onPointerEnter={onHoverIn}
309
+ onPointerLeave={onHoverOut}
310
+ onPress={async () => {
311
+ await Unifier.utils.haptic();
312
+ await props.onClick?.();
313
+ }}
314
+ style={propsToStyle()}
315
+ testID={props.testID ? `${props.testID}-clickable` : undefined}
316
+ >
317
+ {props.children}
318
+ </Pressable>
319
+ );
320
+ } else {
321
+ box = (
322
+ <View
323
+ onPointerEnter={onHoverIn}
324
+ onPointerLeave={onHoverOut}
325
+ style={propsToStyle()}
326
+ testID={props.testID}
327
+ >
328
+ {props.children}
329
+ </View>
330
+ );
331
+ }
332
+
333
+ if (props.scroll) {
334
+ const {justifyContent, alignContent, alignItems, ...scrollStyle} = propsToStyle();
335
+
336
+ box = (
337
+ <ScrollView
338
+ contentContainerStyle={{alignContent, alignItems, justifyContent}}
339
+ horizontal={props.overflow === "scrollX"}
340
+ keyboardShouldPersistTaps="handled"
341
+ nestedScrollEnabled
342
+ onScroll={(event) => {
343
+ if (props.onScroll && event) {
344
+ props.onScroll(event.nativeEvent.contentOffset.y);
345
+ }
346
+ }}
347
+ ref={props.scrollRef || scrollRef}
348
+ scrollEventThrottle={50}
349
+ style={scrollStyle}
350
+ >
351
+ {box}
352
+ </ScrollView>
353
+ );
354
+ }
355
+
356
+ if (props.avoidKeyboard) {
357
+ box = (
358
+ <KeyboardAvoidingView
359
+ behavior={Platform.OS === "ios" ? "padding" : "height"}
360
+ keyboardVerticalOffset={props.keyboardOffset}
361
+ style={{display: "flex", flex: 1}}
362
+ >
363
+ <SafeAreaView style={{display: "flex", flex: 1}}>{box}</SafeAreaView>
364
+ </KeyboardAvoidingView>
365
+ );
366
+ }
367
+ return box;
368
+ });
package/src/Button.tsx ADDED
@@ -0,0 +1,196 @@
1
+ import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
2
+ import debounce from "lodash/debounce";
3
+ import {type FC, useMemo, useState} from "react";
4
+ import {ActivityIndicator, Pressable, Text, View} from "react-native";
5
+
6
+ import {Box} from "./Box";
7
+ import type {ButtonProps} from "./Common";
8
+ import {isMobileDevice} from "./MediaQuery";
9
+ import {Modal} from "./Modal";
10
+ import {useTheme} from "./Theme";
11
+ import {Tooltip} from "./Tooltip";
12
+ import {Unifier} from "./Unifier";
13
+ import {isNative} from "./Utilities";
14
+
15
+ const ConfirmationModal: FC<{
16
+ visible: boolean;
17
+ title: string;
18
+ subtitle?: string;
19
+ text: string;
20
+ onConfirm: () => void;
21
+ onCancel: () => void;
22
+ }> = ({visible, title, subtitle, text, onConfirm, onCancel}) => {
23
+ return (
24
+ <Modal
25
+ onDismiss={onCancel}
26
+ primaryButtonOnClick={onConfirm}
27
+ primaryButtonText="Confirm"
28
+ secondaryButtonOnClick={onCancel}
29
+ secondaryButtonText="Cancel"
30
+ subtitle={subtitle}
31
+ title={title}
32
+ visible={visible}
33
+ >
34
+ <Text>{text}</Text>
35
+ </Modal>
36
+ );
37
+ };
38
+
39
+ const ButtonComponent: FC<ButtonProps> = ({
40
+ confirmationText = "Are you sure you want to continue?",
41
+ disabled = false,
42
+ fullWidth = false,
43
+ iconName,
44
+ iconPosition = "left",
45
+ loading: propsLoading,
46
+ modalTitle = "Confirm",
47
+ modalSubTitle,
48
+ testID,
49
+ text,
50
+ variant = "primary",
51
+ withConfirmation = false,
52
+ onClick,
53
+ }) => {
54
+ const [loading, setLoading] = useState(propsLoading);
55
+ const [showConfirmation, setShowConfirmation] = useState(false);
56
+ const {theme} = useTheme();
57
+
58
+ const {backgroundColor, borderColor, borderWidth, color} = useMemo(() => {
59
+ if (!theme) {
60
+ return {};
61
+ }
62
+ let bgColor = theme.surface.primary;
63
+ let bColor: string | undefined;
64
+ let bWidth: number | undefined;
65
+ let textColor = theme.text.inverted;
66
+
67
+ if (disabled) {
68
+ bgColor = theme.surface.disabled;
69
+ } else if (variant === "secondary") {
70
+ bgColor = theme.surface.secondaryDark;
71
+ } else if (variant === "muted") {
72
+ bgColor = theme.surface.secondaryLight;
73
+ textColor = theme.surface.neutralDark;
74
+ } else if (variant === "outline") {
75
+ bgColor = theme.surface.base;
76
+ bColor = theme.text.secondaryDark;
77
+ bWidth = 2;
78
+ textColor = theme.text.secondaryDark;
79
+ } else if (variant === "destructive") {
80
+ bgColor = theme.surface.error;
81
+ }
82
+
83
+ return {
84
+ backgroundColor: bgColor,
85
+ borderColor: bColor,
86
+ borderWidth: bWidth,
87
+ color: textColor,
88
+ };
89
+ }, [disabled, variant, theme]);
90
+
91
+ if (!theme) {
92
+ return null;
93
+ }
94
+
95
+ return (
96
+ <Pressable
97
+ accessibilityHint={
98
+ withConfirmation ? "Opens a confirmation dialog" : "Press to perform action"
99
+ }
100
+ aria-label={text}
101
+ aria-role="button"
102
+ disabled={disabled || loading}
103
+ onPress={debounce(
104
+ async () => {
105
+ await Unifier.utils.haptic();
106
+ setLoading(true);
107
+
108
+ try {
109
+ // If a confirmation is required, and the confirmation modal is not currently open,
110
+ // open it
111
+ if (withConfirmation && !showConfirmation) {
112
+ setShowConfirmation(true);
113
+ } else if (!withConfirmation && onClick) {
114
+ // If a confirmation is not required, perform the action.
115
+ await onClick();
116
+ }
117
+ } catch (error) {
118
+ setLoading(false);
119
+ throw error;
120
+ }
121
+ setLoading(false);
122
+ },
123
+ 500,
124
+ {leading: true}
125
+ )}
126
+ style={{
127
+ alignItems: "center",
128
+ alignSelf: fullWidth ? "stretch" : undefined,
129
+ backgroundColor,
130
+ borderColor,
131
+ borderRadius: theme.radius.rounded,
132
+ borderWidth,
133
+ flexDirection: "column",
134
+ justifyContent: "center",
135
+ paddingHorizontal: 20,
136
+ paddingVertical: 8,
137
+ width: fullWidth ? "100%" : "auto",
138
+ }}
139
+ testID={testID}
140
+ >
141
+ <View style={{flexDirection: "row"}}>
142
+ <View style={{flexDirection: iconPosition === "left" ? "row" : "row-reverse"}}>
143
+ {Boolean(iconName) && (
144
+ <View
145
+ style={{
146
+ alignSelf: "center",
147
+ marginLeft: iconPosition === "right" ? 8 : 0,
148
+ marginRight: iconPosition === "left" ? 8 : 0,
149
+ }}
150
+ >
151
+ <FontAwesome6 color={color} name={iconName} size={16} solid />
152
+ </View>
153
+ )}
154
+ <Text style={{color, fontSize: 16, fontWeight: "700"}}>{text}</Text>
155
+ </View>
156
+ {Boolean(loading) && (
157
+ <Box marginLeft={2}>
158
+ <ActivityIndicator color={color} size="small" />
159
+ </Box>
160
+ )}
161
+ </View>
162
+ {withConfirmation && (
163
+ <ConfirmationModal
164
+ onCancel={() => setShowConfirmation(false)}
165
+ onConfirm={async () => {
166
+ await onClick();
167
+ setShowConfirmation(false);
168
+ }}
169
+ subtitle={modalSubTitle}
170
+ text={confirmationText}
171
+ title={modalTitle}
172
+ visible={showConfirmation}
173
+ />
174
+ )}
175
+ </Pressable>
176
+ );
177
+ };
178
+
179
+ export const Button: FC<ButtonProps> = (props) => {
180
+ const {tooltipText, tooltipIdealPosition, tooltipIncludeArrow = false} = props;
181
+ const isMobileOrNative = isMobileDevice() || isNative();
182
+
183
+ if (tooltipText && !isMobileOrNative) {
184
+ return (
185
+ <Tooltip
186
+ idealPosition={tooltipIdealPosition}
187
+ includeArrow={tooltipIncludeArrow}
188
+ text={tooltipText}
189
+ >
190
+ <ButtonComponent {...props} />
191
+ </Tooltip>
192
+ );
193
+ }
194
+
195
+ return <ButtonComponent {...props} />;
196
+ };
package/src/Card.tsx ADDED
@@ -0,0 +1,19 @@
1
+ import {Box} from "./Box";
2
+ import type {BoxProps} from "./Common";
3
+
4
+ export const Card = ({children, color = "base", padding = 4, width, ...rest}: BoxProps) => {
5
+ return (
6
+ <Box
7
+ color={color}
8
+ direction="column"
9
+ display="flex"
10
+ padding={padding}
11
+ rounding="md"
12
+ shadow
13
+ width={width}
14
+ {...rest}
15
+ >
16
+ {children}
17
+ </Box>
18
+ );
19
+ };
@@ -0,0 +1,45 @@
1
+ import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
2
+ import type {FC} from "react";
3
+ import {View} from "react-native";
4
+
5
+ import type {CheckBoxProps} from "./Common";
6
+ import {useTheme} from "./Theme";
7
+
8
+ export const CheckBox: FC<CheckBoxProps> = ({selected, size = "md", bgColor = "default"}) => {
9
+ const {theme} = useTheme();
10
+ const px = {
11
+ lg: {container: 24, icon: 16},
12
+ md: {container: 16, icon: 13},
13
+ sm: {container: 10, icon: 8},
14
+ };
15
+
16
+ const backgroundColor = {
17
+ accent: theme.text.accent,
18
+ black: theme.text.primary,
19
+ default: theme.text.link,
20
+ };
21
+ return (
22
+ <View
23
+ style={{
24
+ alignItems: "center",
25
+ backgroundColor: selected ? backgroundColor[bgColor] : "transparent",
26
+ borderColor: backgroundColor[bgColor],
27
+ borderRadius: 3,
28
+ borderWidth: 1,
29
+ height: px[size].container,
30
+ justifyContent: "center",
31
+ width: px[size].container,
32
+ }}
33
+ >
34
+ {selected ? (
35
+ <FontAwesome6
36
+ color={theme.surface.base}
37
+ name="check"
38
+ selectable={undefined}
39
+ size={px[size].icon}
40
+ solid
41
+ />
42
+ ) : null}
43
+ </View>
44
+ );
45
+ };