@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
@@ -0,0 +1,370 @@
1
+ import {DateTime} from "luxon";
2
+
3
+ function getDate(date: string, {timezone}: {timezone?: string} = {}): DateTime {
4
+ if (!date) {
5
+ throw new Error("Passed undefined");
6
+ }
7
+ if (typeof date !== "string") {
8
+ throw new Error(`Invalid date type: ${typeof date}`);
9
+ }
10
+ const clonedDate = timezone ? DateTime.fromISO(date).setZone(timezone) : DateTime.fromISO(date);
11
+ if (!clonedDate.isValid) {
12
+ throw new Error(`Invalid date: ${date}`);
13
+ }
14
+ return clonedDate;
15
+ }
16
+
17
+ export function isTomorrow(date: string, {timezone}: {timezone?: string} = {}): boolean {
18
+ const clonedDate = getDate(date, {timezone});
19
+ const now = timezone ? DateTime.now().setZone(timezone) : DateTime.now();
20
+ const diff = now.startOf("day").diff(clonedDate.startOf("day"), "days");
21
+ return diff.days <= -1 && diff.days > -2;
22
+ }
23
+
24
+ export function isYesterday(date: string, {timezone}: {timezone?: string} = {}): boolean {
25
+ const clonedDate = getDate(date, {timezone});
26
+ const now = timezone ? DateTime.now().setZone(timezone) : DateTime.now();
27
+ const diff = now.startOf("day").diff(clonedDate.startOf("day"), "days");
28
+ return diff.days <= 1 && diff.days > -1;
29
+ }
30
+
31
+ export function isToday(date: string, {timezone}: {timezone?: string} = {}): boolean {
32
+ const clonedDate = getDate(date, {timezone});
33
+ const now = timezone ? DateTime.now().setZone(timezone) : DateTime.now();
34
+ const diff = now.startOf("day").diff(clonedDate.startOf("day"), "days");
35
+ return diff.days === 0;
36
+ }
37
+
38
+ export function isThisYear(date: string, {timezone}: {timezone?: string} = {}): boolean {
39
+ const clonedDate = getDate(date, {timezone});
40
+ const now = timezone ? DateTime.now().setZone(timezone) : DateTime.now();
41
+ return clonedDate.year === now.year;
42
+ }
43
+
44
+ export function isWithinWeek(date: string, {timezone}: {timezone?: string} = {}): boolean {
45
+ const clonedDate = getDate(date, {timezone});
46
+ const now = timezone ? DateTime.now().setZone(timezone) : DateTime.now();
47
+ const diff = now.startOf("day").diff(clonedDate.startOf("day"), "days");
48
+ return diff.days > -7 && diff.days < 7;
49
+ }
50
+
51
+ // Prints a human friendly date, e.g. "Tomorrow", "Yesterday", "Monday", "June 19", "December 25,
52
+ // 2022".
53
+ export function humanDate(
54
+ date: string,
55
+ {timezone, dontShowTime}: {timezone?: string; dontShowTime?: boolean} = {}
56
+ ): string {
57
+ let clonedDate;
58
+ try {
59
+ clonedDate = getDate(date, {timezone});
60
+ } catch (error: any) {
61
+ throw new Error(`humanDate: ${error.message}`);
62
+ }
63
+ if (isTomorrow(date, {timezone})) {
64
+ return "Tomorrow";
65
+ } else if (isToday(date, {timezone})) {
66
+ if (dontShowTime) {
67
+ return "Today";
68
+ } else {
69
+ return clonedDate.toFormat("h:mm a");
70
+ }
71
+ } else if (isYesterday(date, {timezone})) {
72
+ return "Yesterday";
73
+ } else if (isWithinWeek(date, {timezone})) {
74
+ // E.g. Monday
75
+ return clonedDate.toFormat("EEEE");
76
+ } else if (isThisYear(date, {timezone})) {
77
+ // E.g. June 19
78
+ return clonedDate.toFormat("MMM d");
79
+ } else {
80
+ // December 25, 2022
81
+ return clonedDate.toFormat("MMM d, iiii");
82
+ }
83
+ }
84
+
85
+ // Prints a human friendly date and time, e.g. "Tomorrow 9:00 AM", "Yesterday 9:00 AM", "Monday
86
+ // 9:00 AM", "June 19 9:00 AM", "December 25, 2022 9:00 AM".
87
+ export function humanDateAndTime(
88
+ date: string,
89
+ {timezone, showTimezone = true}: {timezone?: string; showTimezone?: boolean} = {}
90
+ ): string {
91
+ let clonedDate;
92
+ try {
93
+ clonedDate = getDate(date, {timezone});
94
+ } catch (error: any) {
95
+ throw new Error(`humanDateAndTime: ${error.message}`);
96
+ }
97
+ // This should maybe use printTime()
98
+ let time: string = "";
99
+ if (showTimezone) {
100
+ time = clonedDate.toLocaleString({
101
+ hour: "numeric",
102
+ minute: "2-digit",
103
+ timeZoneName: "short",
104
+ });
105
+ } else {
106
+ time = clonedDate.toFormat("h:mm a");
107
+ }
108
+ if (isTomorrow(date, {timezone})) {
109
+ return `Tomorrow ${time}`;
110
+ } else if (isToday(date, {timezone})) {
111
+ return time;
112
+ } else if (isYesterday(date, {timezone})) {
113
+ return `Yesterday ${time}`;
114
+ } else if (isWithinWeek(date, {timezone})) {
115
+ // E.g. Monday 9:00 AM
116
+ return `${clonedDate.toFormat("EEEE")} ${time}`;
117
+ } else if (isThisYear(date, {timezone})) {
118
+ // E.g. June 19
119
+ return `${clonedDate.toFormat("MMM d")} ${time}`;
120
+ } else {
121
+ // December 25, 2022
122
+ return `${clonedDate.toFormat("MMM d, iiii")} ${time}`;
123
+ }
124
+ }
125
+
126
+ // Print date in the format of M/D/YY, taking timezones into account.
127
+ export const printDate = (
128
+ date?: string,
129
+ {
130
+ timezone,
131
+ showTimezone,
132
+ ignoreTime,
133
+ defaultValue,
134
+ }: {
135
+ timezone?: string;
136
+ showTimezone?: boolean;
137
+ ignoreTime?: boolean;
138
+ defaultValue?: string;
139
+ } = {}
140
+ ): string => {
141
+ if (!date) {
142
+ return defaultValue ?? "Invalid Date";
143
+ }
144
+ if (showTimezone) {
145
+ console.warn("showTimezone is not supported for printDate");
146
+ }
147
+
148
+ if (ignoreTime) {
149
+ // Parse the date in the specified timezone (or local if not provided)
150
+ // then force to UTC midnight to ignore time component
151
+ const justDate = timezone
152
+ ? DateTime.fromISO(date).setZone(timezone)
153
+ : DateTime.fromISO(date).setZone("UTC");
154
+ // Using startOf('day') to normalize the time component
155
+ return justDate.startOf("day").toFormat("M/d/yyyy");
156
+ }
157
+
158
+ let clonedDate;
159
+ try {
160
+ clonedDate = getDate(date, {timezone});
161
+ } catch (error: any) {
162
+ throw new Error(`printDate: ${error.message}`);
163
+ }
164
+
165
+ return clonedDate.toLocaleString(DateTime.DATE_SHORT);
166
+ };
167
+
168
+ // For printing dates from date times, ignoring the time. These should end in T00:00:00.000Z.
169
+ // For example, the dates returned by Field type="date".
170
+ export const printOnlyDate = (
171
+ date?: string,
172
+ {
173
+ defaultValue,
174
+ }: {
175
+ defaultValue?: string;
176
+ } = {}
177
+ ): string => {
178
+ if (!date) {
179
+ return defaultValue ?? "Invalid Date";
180
+ }
181
+
182
+ if (!date?.endsWith("T00:00:00.000Z")) {
183
+ console.warn(
184
+ "printOnlyDate, but the time is not set to midnight UTC. " +
185
+ "This may cause unexpected behavior."
186
+ );
187
+ }
188
+ // Use only the date component, ignore the time.
189
+ const justDate = DateTime.fromISO(date, {zone: "UTC"});
190
+ // We force it into UTC so we can get the correct date.
191
+ return justDate.toFormat("M/d/yyyy");
192
+ };
193
+
194
+ // Print time in the format of HH:mm A, taking timezones into account.
195
+ export function printTime(
196
+ date?: string,
197
+ {
198
+ timezone,
199
+ showTimezone,
200
+ defaultValue,
201
+ }: {
202
+ timezone: string;
203
+ showTimezone?: boolean;
204
+ defaultValue?: string;
205
+ } = {defaultValue: "Invalid Date", timezone: "America/New_York"}
206
+ ): string {
207
+ if (!date) {
208
+ return defaultValue ?? "Invalid Date";
209
+ }
210
+ let clonedDate;
211
+ if (!timezone) {
212
+ throw new Error("printTime: timezone is required");
213
+ }
214
+ try {
215
+ clonedDate = getDate(date, {timezone});
216
+ } catch (error: any) {
217
+ throw new Error(`printTime: ${error.message}`);
218
+ }
219
+ if (showTimezone) {
220
+ return clonedDate.toLocaleString({
221
+ hour: "numeric",
222
+ minute: "2-digit",
223
+ timeZoneName: "short",
224
+ });
225
+ } else {
226
+ return clonedDate.toLocaleString(DateTime.TIME_SIMPLE);
227
+ }
228
+ }
229
+
230
+ // Print date in the format of M/D/YY HH:mm A, taking timezones into account.
231
+ export function printDateAndTime(
232
+ date?: string,
233
+ {
234
+ timezone,
235
+ showTimezone,
236
+ defaultValue,
237
+ }: {
238
+ timezone?: string;
239
+ showTimezone?: boolean;
240
+ defaultValue?: string;
241
+ } = {}
242
+ ): string {
243
+ if (!date) {
244
+ return defaultValue ?? "Invalid Datetime";
245
+ }
246
+ let clonedDate;
247
+ try {
248
+ clonedDate = getDate(date, {timezone});
249
+ } catch (error: any) {
250
+ throw new Error(`printDateAndTime: ${error.message}`);
251
+ }
252
+ if (showTimezone) {
253
+ return clonedDate.toLocaleString({
254
+ day: "numeric",
255
+ hour: "numeric",
256
+ minute: "2-digit",
257
+ month: "numeric",
258
+ timeZoneName: "short",
259
+ year: "numeric",
260
+ });
261
+ } else {
262
+ return clonedDate.toLocaleString(DateTime.DATETIME_SHORT);
263
+ }
264
+ }
265
+
266
+ // Prints a date range in the format of M/D/YY HH:mm A - M/D/YY HH:mm A EST, taking timezones into
267
+ // account. If the dates are the same, it will print the date only once, e.g. M/D/YY HH:mm A - HH:mm
268
+ // A EST.
269
+ export function printDateRange(
270
+ start: string,
271
+ end: string,
272
+ {
273
+ timezone,
274
+ showTimezone = true,
275
+ timeOnly,
276
+ }: {timezone: string; showTimezone?: boolean; timeOnly?: boolean}
277
+ ): string {
278
+ const startDate = printDate(start, {showTimezone: false, timezone});
279
+ const endDate = printDate(end, {showTimezone: false, timezone});
280
+
281
+ const startTime = printTime(start, {showTimezone: false, timezone});
282
+ const endTime = printTime(end, {showTimezone, timezone});
283
+ if (timeOnly) {
284
+ if (startDate !== endDate) {
285
+ console.warn(
286
+ `printDateRange: printing only time but start and end dates are different: ${start} - ${end}`
287
+ );
288
+ }
289
+ return `${startTime} - ${endTime}`;
290
+ } else if (startDate === endDate) {
291
+ return `${startDate} ${startTime} - ${endTime}`;
292
+ } else {
293
+ return `${startDate} ${startTime} - ${endDate} ${endTime}`;
294
+ }
295
+ }
296
+
297
+ // Print since nicely. If less than 2 months, print days, otherwise print months. If over 1 year,
298
+ // print years.
299
+ export function printSince(
300
+ date: string,
301
+ {timezone, showAgo = true}: {timezone?: string; showAgo?: boolean} = {}
302
+ ): string {
303
+ let clonedDate;
304
+ const ago = showAgo ? " ago" : "";
305
+ try {
306
+ clonedDate = getDate(date, {timezone});
307
+ } catch (error: any) {
308
+ throw new Error(`printSince: ${error.message}`);
309
+ }
310
+ const now = timezone ? DateTime.now().setZone(timezone) : DateTime.now();
311
+ const diff = now.diff(clonedDate, "months");
312
+ if (diff.months < 2) {
313
+ const days = Math.floor(now.diff(clonedDate, "days").days);
314
+ return `${days} ${days === 1 ? "day" : "days"}${ago}`;
315
+ } else if (diff.months < 12) {
316
+ const months = Math.floor(diff.months);
317
+ return `${months} ${months === 1 ? "month" : "months"}${ago}`;
318
+ } else {
319
+ const years = Math.floor(now.diff(clonedDate, "years").years);
320
+ return `${years} ${years === 1 ? "year" : "years"}${ago}`;
321
+ }
322
+ }
323
+
324
+ export function convertNullToUndefined(value: string | null): string | undefined {
325
+ return value ?? undefined;
326
+ }
327
+
328
+ // Get the ISO date string from a date string. If the date string is undefined,
329
+ // return undefined instead of null so MongoDB can handle it.
330
+ export function getIsoDate(date: string | undefined): string | undefined {
331
+ if (!date) {
332
+ return undefined;
333
+ }
334
+ return convertNullToUndefined(DateTime.fromISO(date).toUTC().toISO());
335
+ }
336
+
337
+ const usTimezoneOptions = [
338
+ {label: "Eastern", value: "America/New_York"},
339
+ {label: "Central", value: "America/Chicago"},
340
+ {label: "Mountain", value: "America/Denver"},
341
+ {label: "Pacific", value: "America/Los_Angeles"},
342
+ {label: "Alaska", value: "America/Anchorage"},
343
+ {label: "Hawaii", value: "Pacific/Honolulu"},
344
+ {label: "Arizona", value: "America/Phoenix"},
345
+ ];
346
+
347
+ export function getTimezoneOptions(location: "USA" | "Worldwide", shortTimezone = false) {
348
+ let timezones: [string, string][];
349
+ if (location === "USA") {
350
+ timezones = usTimezoneOptions.map((tz) => [tz.label, tz.value]);
351
+ } else {
352
+ timezones = (Intl as any).supportedValuesOf("timeZone").map((tz: any) => {
353
+ return [tz, tz];
354
+ });
355
+ }
356
+ return timezones.map(([name, tz]) => {
357
+ const dateTime = DateTime.now().setZone(tz);
358
+ let tzAbbr = dateTime.toFormat("ZZZZ"); // Gets timezone abbreviation like "EST", "CST", etc.
359
+
360
+ // Special case for Arizona which returns MST during standard time
361
+ if (tz === "America/Phoenix") {
362
+ tzAbbr = "AZ";
363
+ }
364
+
365
+ return {
366
+ label: shortTimezone ? tzAbbr : name,
367
+ value: tz,
368
+ };
369
+ });
370
+ }
@@ -0,0 +1,85 @@
1
+ import {Picker} from "@react-native-picker/picker";
2
+ import range from "lodash/range";
3
+ import React from "react";
4
+
5
+ import {ActionSheet} from "./ActionSheet";
6
+ import {Box} from "./Box";
7
+ import {Button} from "./Button";
8
+ import type {DecimalRangeActionSheetProps, DecimalRangeActionSheetState} from "./Common";
9
+
10
+ const PICKER_HEIGHT = 104;
11
+
12
+ export class DecimalRangeActionSheet extends React.Component<
13
+ DecimalRangeActionSheetProps,
14
+ DecimalRangeActionSheetState
15
+ > {
16
+ constructor(props: DecimalRangeActionSheetProps) {
17
+ super(props);
18
+ this.state = {
19
+ decimal: String((Number(props.value) * 10) % 10),
20
+ whole: String(Math.floor(Number(props.value))),
21
+ };
22
+ }
23
+
24
+ render() {
25
+ return (
26
+ <ActionSheet bounceOnOpen gestureEnabled ref={this.props.actionSheetRef}>
27
+ <Box marginBottom={8} paddingX={4} width="100%">
28
+ <Box alignItems="end" display="flex" width="100%">
29
+ <Box width="33%">
30
+ <Button
31
+ onClick={() => {
32
+ this.props.actionSheetRef?.current?.setModalVisible(false);
33
+ }}
34
+ text="Close"
35
+ />
36
+ </Box>
37
+ </Box>
38
+ <Box direction="row" width="100%">
39
+ <Box width="50%">
40
+ <Picker
41
+ itemStyle={{
42
+ height: PICKER_HEIGHT,
43
+ }}
44
+ onValueChange={(whole) => {
45
+ this.setState({whole: String(whole)});
46
+ this.props.onChange(String(Number(whole) + Number(this.state.decimal) * 0.1));
47
+ }}
48
+ selectedValue={this.state.whole}
49
+ style={{
50
+ backgroundColor: "#FFFFFF",
51
+ height: PICKER_HEIGHT,
52
+ }}
53
+ >
54
+ {range(this.props.min, this.props.max + 1).map((n) => {
55
+ return <Picker.Item key={String(n)} label={String(n)} value={String(n)} />;
56
+ })}
57
+ </Picker>
58
+ </Box>
59
+ <Box width="50%">
60
+ <Picker
61
+ itemStyle={{
62
+ height: PICKER_HEIGHT,
63
+ }}
64
+ onValueChange={(decimal) => {
65
+ this.setState({decimal: String(decimal)});
66
+ this.props.onChange(String(Number(this.state.whole) + Number(decimal) * 0.1));
67
+ }}
68
+ selectedValue={this.state.decimal}
69
+ style={{
70
+ backgroundColor: "#FFFFFF",
71
+ height: PICKER_HEIGHT,
72
+ }}
73
+ >
74
+ {range(0, 10).map((n) => {
75
+ // console.log("N", n);
76
+ return <Picker.Item key={String(n)} label={`.${String(n)}`} value={String(n)} />;
77
+ })}
78
+ </Picker>
79
+ </Box>
80
+ </Box>
81
+ </Box>
82
+ </ActionSheet>
83
+ );
84
+ }
85
+ }
@@ -0,0 +1,31 @@
1
+ import type React from "react";
2
+ import {Pressable, View} from "react-native";
3
+
4
+ import type {DismissButtonProps} from "./Common";
5
+ import {Icon} from "./Icon";
6
+
7
+ export const DismissButton = ({
8
+ accessibilityLabel,
9
+ accessibilityHint,
10
+ onClick,
11
+ color = "primary",
12
+ }: DismissButtonProps): React.ReactElement | null => {
13
+ return (
14
+ <Pressable
15
+ accessibilityHint={accessibilityHint}
16
+ aria-label={accessibilityLabel}
17
+ aria-role="button"
18
+ onPress={onClick}
19
+ style={{
20
+ alignItems: "center",
21
+ height: 24.5,
22
+ justifyContent: "center",
23
+ width: 24.5,
24
+ }}
25
+ >
26
+ <View>
27
+ <Icon color={color} iconName="x" type="solid" />
28
+ </View>
29
+ </Pressable>
30
+ );
31
+ };
@@ -0,0 +1,66 @@
1
+ import {type FC, useCallback, useEffect, useState} from "react";
2
+
3
+ import type {EmailFieldProps} from "./Common";
4
+ import {TextField} from "./TextField";
5
+
6
+ export const EmailField: FC<EmailFieldProps> = ({
7
+ errorText,
8
+ iconName,
9
+ placeholder,
10
+ value,
11
+ onChange,
12
+ onBlur,
13
+ ...rest
14
+ }) => {
15
+ const [localValue, setLocalValue] = useState<string>(value || "");
16
+
17
+ // Sync local state with incoming prop values
18
+ useEffect(() => {
19
+ setLocalValue(value || "");
20
+ }, [value]);
21
+
22
+ const validateEmail = useCallback((email: string): string | undefined => {
23
+ if (email.trim() === "") {
24
+ return undefined;
25
+ }
26
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
27
+ if (!emailRegex.test(email)) {
28
+ return "Invalid email address format";
29
+ }
30
+ return undefined;
31
+ }, []);
32
+
33
+ const localOnChange = useCallback(
34
+ (e: string) => {
35
+ setLocalValue(e);
36
+ const err = validateEmail(e);
37
+ if (!err && onChange) {
38
+ onChange(e);
39
+ }
40
+ },
41
+ [onChange, validateEmail]
42
+ );
43
+
44
+ const localOnBlur = useCallback(
45
+ (e: string) => {
46
+ setLocalValue(e);
47
+ const err = validateEmail(e);
48
+ if (!err && onBlur) {
49
+ onBlur(e);
50
+ }
51
+ },
52
+ [onBlur, validateEmail]
53
+ );
54
+ return (
55
+ <TextField
56
+ errorText={errorText || validateEmail(localValue)}
57
+ iconName={iconName}
58
+ onBlur={localOnBlur}
59
+ onChange={localOnChange}
60
+ placeholder={placeholder}
61
+ type="email"
62
+ value={localValue}
63
+ {...rest}
64
+ />
65
+ );
66
+ };
@@ -0,0 +1,61 @@
1
+ import {describe, expect, it, mock} from "bun:test";
2
+
3
+ import EmojiSelector, {Categories} from "./EmojiSelector";
4
+ import {renderWithTheme} from "./test-utils";
5
+
6
+ describe("EmojiSelector", () => {
7
+ it("renders search bar when showSearchBar is true", () => {
8
+ const {getByPlaceholderText} = renderWithTheme(
9
+ <EmojiSelector
10
+ category={Categories.all}
11
+ columns={6}
12
+ onEmojiSelected={mock(() => {})}
13
+ placeholder="Search emojis"
14
+ showHistory={false}
15
+ showSearchBar
16
+ showSectionTitles
17
+ showTabs
18
+ theme="#007AFF"
19
+ />
20
+ );
21
+
22
+ expect(getByPlaceholderText("Search emojis")).toBeTruthy();
23
+ });
24
+
25
+ it("renders tab bar when showTabs is true", () => {
26
+ const {getByText} = renderWithTheme(
27
+ <EmojiSelector
28
+ category={Categories.people}
29
+ columns={6}
30
+ onEmojiSelected={mock(() => {})}
31
+ placeholder="Search emojis"
32
+ showHistory={false}
33
+ showSearchBar
34
+ showSectionTitles
35
+ showTabs
36
+ theme="#007AFF"
37
+ />
38
+ );
39
+
40
+ // One of the known category symbols
41
+ expect(getByText("😀")).toBeTruthy();
42
+ });
43
+
44
+ it("matches snapshot", () => {
45
+ const tree = renderWithTheme(
46
+ <EmojiSelector
47
+ category={Categories.people}
48
+ columns={6}
49
+ onEmojiSelected={mock(() => {})}
50
+ placeholder="Search emojis"
51
+ showHistory={false}
52
+ showSearchBar
53
+ showSectionTitles
54
+ showTabs
55
+ theme="#007AFF"
56
+ />
57
+ );
58
+
59
+ expect(tree.toJSON()).toMatchSnapshot();
60
+ });
61
+ });