@idea-fragments/react-components-zendesk 0.1.1 → 0.1.2

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 (452) hide show
  1. package/dist/alert.js +2701 -3288
  2. package/dist/alert.js.map +1 -1
  3. package/dist/index.js +1002 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/types/components/forms/selectors/Dropdown/Item.d.ts +1 -1
  6. package/dist/types/components/tags/Chip.d.ts +1 -1
  7. package/dist/types/index.d.ts +5 -0
  8. package/dist/types/index.d.ts.map +1 -0
  9. package/package.json +14 -3
  10. package/.node-version +0 -1
  11. package/.storybook/ThemeProvider.tsx +0 -15
  12. package/.storybook/main.js +0 -13
  13. package/.storybook/preview.js +0 -20
  14. package/dist/forms.js +0 -101816
  15. package/dist/forms.js.map +0 -1
  16. package/entries/alert.ts +0 -1
  17. package/entries/forms.ts +0 -46
  18. package/entries/hooks.ts +0 -3
  19. package/entries/icon.ts +0 -1
  20. package/entries/layouts.ts +0 -15
  21. package/entries/loaders.ts +0 -3
  22. package/entries/mobx.ts +0 -6
  23. package/entries/modal.ts +0 -1
  24. package/entries/navigation.ts +0 -3
  25. package/entries/notifications.ts +0 -2
  26. package/entries/styles.ts +0 -16
  27. package/entries/tables.ts +0 -4
  28. package/entries/tags.ts +0 -2
  29. package/entries/text.ts +0 -7
  30. package/entries/tooltips.ts +0 -2
  31. package/entries/types.ts +0 -3
  32. package/entries/utils.ts +0 -4
  33. package/react_components_zendesk.iml +0 -9
  34. package/rollup.config.js +0 -40
  35. package/src/GlobalStyle.js +0 -43
  36. package/src/calendarCss.js +0 -2
  37. package/src/components/Alert.tsx +0 -175
  38. package/src/components/Drawer.tsx +0 -244
  39. package/src/components/Icon.tsx +0 -43
  40. package/src/components/Modal.tsx +0 -206
  41. package/src/components/StyledComponentProps.type.ts +0 -3
  42. package/src/components/StyledProps.type.ts +0 -4
  43. package/src/components/calendars/Legendable.type.tsx +0 -4
  44. package/src/components/calendars/TinyCalendar.tsx +0 -185
  45. package/src/components/calendars/TinyMonthYearCalendar.tsx +0 -57
  46. package/src/components/calendars/blocks/Legend.tsx +0 -44
  47. package/src/components/calendars/blocks/MonthPicker.tsx +0 -54
  48. package/src/components/calendars/blocks/MonthYearPicker.tsx +0 -101
  49. package/src/components/calendars/blocks/YearPicker.tsx +0 -44
  50. package/src/components/forms/Button.tsx +0 -214
  51. package/src/components/forms/Checkbox.tsx +0 -99
  52. package/src/components/forms/CycleButton.stories.tsx +0 -23
  53. package/src/components/forms/CycleButton.tsx +0 -52
  54. package/src/components/forms/Form.tsx +0 -43
  55. package/src/components/forms/Hint.tsx +0 -12
  56. package/src/components/forms/IconButton.tsx +0 -29
  57. package/src/components/forms/Label.tsx +0 -9
  58. package/src/components/forms/TaggedToggle.stories.tsx +0 -18
  59. package/src/components/forms/TaggedToggle.tsx +0 -19
  60. package/src/components/forms/Toggle.stories.tsx +0 -30
  61. package/src/components/forms/Toggle.tsx +0 -62
  62. package/src/components/forms/ValidatedFormProps.type.ts +0 -3
  63. package/src/components/forms/Validation.type.ts +0 -10
  64. package/src/components/forms/buttonMixins.ts +0 -74
  65. package/src/components/forms/formField.types.ts +0 -26
  66. package/src/components/forms/selectors/BooleanSelector.tsx +0 -71
  67. package/src/components/forms/selectors/DatePickerSelector.tsx +0 -88
  68. package/src/components/forms/selectors/Dropdown/Item.tsx +0 -34
  69. package/src/components/forms/selectors/Dropdown.tsx +0 -410
  70. package/src/components/forms/selectors/MonthYearSelector.tsx +0 -54
  71. package/src/components/forms/selectors/MultiSelector.tsx +0 -58
  72. package/src/components/forms/selectors/SearchableSelector.tsx +0 -120
  73. package/src/components/forms/selectors/Selector.tsx +0 -55
  74. package/src/components/forms/selectors/SelectorEmptyState.tsx +0 -5
  75. package/src/components/forms/selectors/types.ts +0 -43
  76. package/src/components/forms/textfields/EmailTextField.tsx +0 -7
  77. package/src/components/forms/textfields/NumberTextField.tsx +0 -17
  78. package/src/components/forms/textfields/PasswordTextField.tsx +0 -12
  79. package/src/components/forms/textfields/TextArea.tsx +0 -25
  80. package/src/components/forms/textfields/TextField.tsx +0 -45
  81. package/src/components/forms/textfields/TextFieldWrapper.tsx +0 -120
  82. package/src/components/forms/validationStates.ts +0 -6
  83. package/src/components/layout/AppBar.tsx +0 -137
  84. package/src/components/layout/AppBarLayout.tsx +0 -55
  85. package/src/components/layout/Carousel.tsx +0 -44
  86. package/src/components/layout/Container.tsx +0 -43
  87. package/src/components/layout/FlexBlock.tsx +0 -122
  88. package/src/components/layout/FlexBox.tsx +0 -69
  89. package/src/components/layout/Grid.tsx +0 -23
  90. package/src/components/layout/Line.tsx +0 -13
  91. package/src/components/layout/OpacityTransition.tsx +0 -6
  92. package/src/components/layout/OverflowMenu.tsx +0 -45
  93. package/src/components/layout/Section.tsx +0 -41
  94. package/src/components/layout/Sidebar.tsx +0 -107
  95. package/src/components/layout/SidebarLayout.tsx +0 -32
  96. package/src/components/layout/Tabs.tsx +0 -39
  97. package/src/components/loaders/AsyncLoadable.tsx +0 -57
  98. package/src/components/loaders/Dots.tsx +0 -16
  99. package/src/components/loaders/Loadable.tsx +0 -99
  100. package/src/components/loaders/Loader.tsx +0 -52
  101. package/src/components/loaders/TranslucentLoader.tsx +0 -49
  102. package/src/components/mobx/Alert.tsx +0 -33
  103. package/src/components/mobx/Drawer.tsx +0 -13
  104. package/src/components/mobx/ErrorBoundary.tsx +0 -56
  105. package/src/components/mobx/Modal.tsx +0 -44
  106. package/src/components/navigation/Breadcrumbs.tsx +0 -49
  107. package/src/components/navigation/ButtonLink.tsx +0 -55
  108. package/src/components/navigation/InlineButtonLink.tsx +0 -9
  109. package/src/components/notification/InfoPanel.tsx +0 -70
  110. package/src/components/notification/Notification.tsx +0 -51
  111. package/src/components/tables/MobileTable/Row.tsx +0 -147
  112. package/src/components/tables/MobileTable.tsx +0 -67
  113. package/src/components/tables/NiceTable.tsx +0 -81
  114. package/src/components/tables/Row.tsx +0 -84
  115. package/src/components/tables/SimpleTable.tsx +0 -99
  116. package/src/components/tables/Table.tsx +0 -153
  117. package/src/components/tables/blocks/Header.tsx +0 -119
  118. package/src/components/tables/blocks/HelpText.tsx +0 -9
  119. package/src/components/tables/blocks/Pagination.tsx +0 -85
  120. package/src/components/tables/blocks/TableFilter.tsx +0 -56
  121. package/src/components/tables/blocks/Title.tsx +0 -6
  122. package/src/components/tables/index.tsx +0 -106
  123. package/src/components/tables/utils.ts +0 -1
  124. package/src/components/tags/Chip.tsx +0 -44
  125. package/src/components/tags/Tag.tsx +0 -23
  126. package/src/components/text/Header.js +0 -55
  127. package/src/components/text/Hint.js +0 -25
  128. package/src/components/text/Label.js +0 -18
  129. package/src/components/text/Paragraph.js +0 -35
  130. package/src/components/text/Text.tsx +0 -33
  131. package/src/components/tooltips/IconTooltip.stories.tsx +0 -20
  132. package/src/components/tooltips/IconTooltip.tsx +0 -25
  133. package/src/components/tooltips/Tooltip.tsx +0 -30
  134. package/src/global.d.ts +0 -29
  135. package/src/hooks/useIsMounted.ts +0 -11
  136. package/src/hooks/useLoader.tsx +0 -73
  137. package/src/hooks/useLoaderV2.tsx +0 -51
  138. package/src/index.css +0 -34
  139. package/src/index.js +0 -4
  140. package/src/stores/useStores.tsx +0 -11
  141. package/src/stories/Introduction.stories.mdx +0 -211
  142. package/src/stories/assets/code-brackets.svg +0 -1
  143. package/src/stories/assets/colors.svg +0 -1
  144. package/src/stories/assets/comments.svg +0 -1
  145. package/src/stories/assets/direction.svg +0 -1
  146. package/src/stories/assets/flow.svg +0 -1
  147. package/src/stories/assets/plugin.svg +0 -1
  148. package/src/stories/assets/repo.svg +0 -1
  149. package/src/stories/assets/stackalt.svg +0 -1
  150. package/src/styles/DeviceSizeWatcher.ts +0 -113
  151. package/src/styles/alignments.ts +0 -9
  152. package/src/styles/colors.ts +0 -51
  153. package/src/styles/deviceSizes.ts +0 -28
  154. package/src/styles/mediaQueries.ts +0 -83
  155. package/src/styles/mixins.ts +0 -23
  156. package/src/styles/spacings.ts +0 -16
  157. package/src/styles/theme/Theme.type.ts +0 -76
  158. package/src/styles/theme/base.ts +0 -47
  159. package/src/styles/theme/dark.ts +0 -36
  160. package/src/styles/theme/light.ts +0 -44
  161. package/src/styles/theme/light2.ts +0 -22
  162. package/src/styles/theme/useTheme.ts +0 -5
  163. package/src/styles/types.ts +0 -18
  164. package/src/styles/typography.ts +0 -67
  165. package/src/utils/NavBarScrollWatcher.ts +0 -59
  166. package/src/utils/arrayHelpers.ts +0 -56
  167. package/src/utils/dateTime/DateRange.type.ts +0 -6
  168. package/src/utils/dateTime/calendar.ts +0 -23
  169. package/src/utils/dateTimeHelpers.ts +0 -105
  170. package/src/utils/function.types.ts +0 -1
  171. package/src/utils/functionHelpers.ts +0 -23
  172. package/src/utils/idGenerator.ts +0 -8
  173. package/src/utils/logging/Logger.ts +0 -34
  174. package/src/utils/logging/Logger.type.ts +0 -7
  175. package/src/utils/logging/loggable.tsx +0 -17
  176. package/src/utils/logging/with_module_logging.ts +0 -8
  177. package/src/utils/numberHelpers.ts +0 -4
  178. package/src/utils/typeCheckers.ts +0 -6
  179. package/src/utils/types.d.ts +0 -1
  180. package/src/utils/validateFields.ts +0 -14
  181. package/src/zendeskGardenCss.js +0 -15
  182. package/tsconfig.json +0 -30
  183. package/type_defs/GlobalStyle.d.ts +0 -2
  184. package/type_defs/GlobalStyle.d.ts.map +0 -1
  185. package/type_defs/calendarCss.d.ts +0 -2
  186. package/type_defs/calendarCss.d.ts.map +0 -1
  187. package/type_defs/components/Alert.d.ts +0 -24
  188. package/type_defs/components/Alert.d.ts.map +0 -1
  189. package/type_defs/components/Drawer.d.ts +0 -18
  190. package/type_defs/components/Drawer.d.ts.map +0 -1
  191. package/type_defs/components/Icon.d.ts +0 -15
  192. package/type_defs/components/Icon.d.ts.map +0 -1
  193. package/type_defs/components/Modal.d.ts +0 -31
  194. package/type_defs/components/Modal.d.ts.map +0 -1
  195. package/type_defs/components/StyledComponentProps.type.d.ts +0 -4
  196. package/type_defs/components/StyledComponentProps.type.d.ts.map +0 -1
  197. package/type_defs/components/StyledProps.type.d.ts +0 -4
  198. package/type_defs/components/StyledProps.type.d.ts.map +0 -1
  199. package/type_defs/components/calendars/Legendable.type.d.ts +0 -5
  200. package/type_defs/components/calendars/Legendable.type.d.ts.map +0 -1
  201. package/type_defs/components/calendars/TinyCalendar.d.ts +0 -25
  202. package/type_defs/components/calendars/TinyCalendar.d.ts.map +0 -1
  203. package/type_defs/components/calendars/TinyMonthYearCalendar.d.ts +0 -11
  204. package/type_defs/components/calendars/TinyMonthYearCalendar.d.ts.map +0 -1
  205. package/type_defs/components/calendars/blocks/Legend.d.ts +0 -12
  206. package/type_defs/components/calendars/blocks/Legend.d.ts.map +0 -1
  207. package/type_defs/components/calendars/blocks/MonthPicker.d.ts +0 -8
  208. package/type_defs/components/calendars/blocks/MonthPicker.d.ts.map +0 -1
  209. package/type_defs/components/calendars/blocks/MonthYearPicker.d.ts +0 -16
  210. package/type_defs/components/calendars/blocks/MonthYearPicker.d.ts.map +0 -1
  211. package/type_defs/components/calendars/blocks/YearPicker.d.ts +0 -10
  212. package/type_defs/components/calendars/blocks/YearPicker.d.ts.map +0 -1
  213. package/type_defs/components/forms/Button.d.ts +0 -41
  214. package/type_defs/components/forms/Button.d.ts.map +0 -1
  215. package/type_defs/components/forms/Checkbox.d.ts +0 -10
  216. package/type_defs/components/forms/Checkbox.d.ts.map +0 -1
  217. package/type_defs/components/forms/CycleButton.d.ts +0 -14
  218. package/type_defs/components/forms/CycleButton.d.ts.map +0 -1
  219. package/type_defs/components/forms/CycleButton.stories.d.ts +0 -16
  220. package/type_defs/components/forms/CycleButton.stories.d.ts.map +0 -1
  221. package/type_defs/components/forms/Form.d.ts +0 -9
  222. package/type_defs/components/forms/Form.d.ts.map +0 -1
  223. package/type_defs/components/forms/Hint.d.ts +0 -2
  224. package/type_defs/components/forms/Hint.d.ts.map +0 -1
  225. package/type_defs/components/forms/IconButton.d.ts +0 -6
  226. package/type_defs/components/forms/IconButton.d.ts.map +0 -1
  227. package/type_defs/components/forms/Label.d.ts +0 -2
  228. package/type_defs/components/forms/Label.d.ts.map +0 -1
  229. package/type_defs/components/forms/TaggedToggle.d.ts +0 -8
  230. package/type_defs/components/forms/TaggedToggle.d.ts.map +0 -1
  231. package/type_defs/components/forms/TaggedToggle.stories.d.ts +0 -12
  232. package/type_defs/components/forms/TaggedToggle.stories.d.ts.map +0 -1
  233. package/type_defs/components/forms/Toggle.d.ts +0 -12
  234. package/type_defs/components/forms/Toggle.d.ts.map +0 -1
  235. package/type_defs/components/forms/Toggle.stories.d.ts +0 -18
  236. package/type_defs/components/forms/Toggle.stories.d.ts.map +0 -1
  237. package/type_defs/components/forms/ValidatedFormProps.type.d.ts +0 -6
  238. package/type_defs/components/forms/ValidatedFormProps.type.d.ts.map +0 -1
  239. package/type_defs/components/forms/Validation.type.d.ts +0 -9
  240. package/type_defs/components/forms/Validation.type.d.ts.map +0 -1
  241. package/type_defs/components/forms/buttonMixins.d.ts +0 -23
  242. package/type_defs/components/forms/buttonMixins.d.ts.map +0 -1
  243. package/type_defs/components/forms/formField.types.d.ts +0 -23
  244. package/type_defs/components/forms/formField.types.d.ts.map +0 -1
  245. package/type_defs/components/forms/selectors/BooleanSelector.d.ts +0 -11
  246. package/type_defs/components/forms/selectors/BooleanSelector.d.ts.map +0 -1
  247. package/type_defs/components/forms/selectors/DatePickerSelector.d.ts +0 -19
  248. package/type_defs/components/forms/selectors/DatePickerSelector.d.ts.map +0 -1
  249. package/type_defs/components/forms/selectors/Dropdown/Item.d.ts +0 -19
  250. package/type_defs/components/forms/selectors/Dropdown/Item.d.ts.map +0 -1
  251. package/type_defs/components/forms/selectors/Dropdown.d.ts +0 -28
  252. package/type_defs/components/forms/selectors/Dropdown.d.ts.map +0 -1
  253. package/type_defs/components/forms/selectors/MonthYearSelector.d.ts +0 -9
  254. package/type_defs/components/forms/selectors/MonthYearSelector.d.ts.map +0 -1
  255. package/type_defs/components/forms/selectors/MultiSelector.d.ts +0 -9
  256. package/type_defs/components/forms/selectors/MultiSelector.d.ts.map +0 -1
  257. package/type_defs/components/forms/selectors/SearchableSelector.d.ts +0 -8
  258. package/type_defs/components/forms/selectors/SearchableSelector.d.ts.map +0 -1
  259. package/type_defs/components/forms/selectors/Selector.d.ts +0 -4
  260. package/type_defs/components/forms/selectors/Selector.d.ts.map +0 -1
  261. package/type_defs/components/forms/selectors/SelectorEmptyState.d.ts +0 -2
  262. package/type_defs/components/forms/selectors/SelectorEmptyState.d.ts.map +0 -1
  263. package/type_defs/components/forms/selectors/types.d.ts +0 -41
  264. package/type_defs/components/forms/selectors/types.d.ts.map +0 -1
  265. package/type_defs/components/forms/textfields/EmailTextField.d.ts +0 -4
  266. package/type_defs/components/forms/textfields/EmailTextField.d.ts.map +0 -1
  267. package/type_defs/components/forms/textfields/NumberTextField.d.ts +0 -4
  268. package/type_defs/components/forms/textfields/NumberTextField.d.ts.map +0 -1
  269. package/type_defs/components/forms/textfields/PasswordTextField.d.ts +0 -8
  270. package/type_defs/components/forms/textfields/PasswordTextField.d.ts.map +0 -1
  271. package/type_defs/components/forms/textfields/TextArea.d.ts +0 -9
  272. package/type_defs/components/forms/textfields/TextArea.d.ts.map +0 -1
  273. package/type_defs/components/forms/textfields/TextField.d.ts +0 -14
  274. package/type_defs/components/forms/textfields/TextField.d.ts.map +0 -1
  275. package/type_defs/components/forms/textfields/TextFieldWrapper.d.ts +0 -13
  276. package/type_defs/components/forms/textfields/TextFieldWrapper.d.ts.map +0 -1
  277. package/type_defs/components/forms/validationStates.d.ts +0 -7
  278. package/type_defs/components/forms/validationStates.d.ts.map +0 -1
  279. package/type_defs/components/layout/AppBar.d.ts +0 -14
  280. package/type_defs/components/layout/AppBar.d.ts.map +0 -1
  281. package/type_defs/components/layout/AppBarLayout.d.ts +0 -15
  282. package/type_defs/components/layout/AppBarLayout.d.ts.map +0 -1
  283. package/type_defs/components/layout/Carousel.d.ts +0 -13
  284. package/type_defs/components/layout/Carousel.d.ts.map +0 -1
  285. package/type_defs/components/layout/Container.d.ts +0 -4
  286. package/type_defs/components/layout/Container.d.ts.map +0 -1
  287. package/type_defs/components/layout/FlexBlock.d.ts +0 -19
  288. package/type_defs/components/layout/FlexBlock.d.ts.map +0 -1
  289. package/type_defs/components/layout/FlexBox.d.ts +0 -18
  290. package/type_defs/components/layout/FlexBox.d.ts.map +0 -1
  291. package/type_defs/components/layout/Grid.d.ts +0 -4
  292. package/type_defs/components/layout/Grid.d.ts.map +0 -1
  293. package/type_defs/components/layout/Line.d.ts +0 -6
  294. package/type_defs/components/layout/Line.d.ts.map +0 -1
  295. package/type_defs/components/layout/OpacityTransition.d.ts +0 -4
  296. package/type_defs/components/layout/OpacityTransition.d.ts.map +0 -1
  297. package/type_defs/components/layout/OverflowMenu.d.ts +0 -13
  298. package/type_defs/components/layout/OverflowMenu.d.ts.map +0 -1
  299. package/type_defs/components/layout/Section.d.ts +0 -6
  300. package/type_defs/components/layout/Section.d.ts.map +0 -1
  301. package/type_defs/components/layout/Sidebar.d.ts +0 -12
  302. package/type_defs/components/layout/Sidebar.d.ts.map +0 -1
  303. package/type_defs/components/layout/SidebarLayout.d.ts +0 -5
  304. package/type_defs/components/layout/SidebarLayout.d.ts.map +0 -1
  305. package/type_defs/components/layout/Tabs.d.ts +0 -3
  306. package/type_defs/components/layout/Tabs.d.ts.map +0 -1
  307. package/type_defs/components/loaders/AsyncLoadable.d.ts +0 -13
  308. package/type_defs/components/loaders/AsyncLoadable.d.ts.map +0 -1
  309. package/type_defs/components/loaders/Dots.d.ts +0 -9
  310. package/type_defs/components/loaders/Dots.d.ts.map +0 -1
  311. package/type_defs/components/loaders/Loadable.d.ts +0 -10
  312. package/type_defs/components/loaders/Loadable.d.ts.map +0 -1
  313. package/type_defs/components/loaders/Loader.d.ts +0 -15
  314. package/type_defs/components/loaders/Loader.d.ts.map +0 -1
  315. package/type_defs/components/loaders/TranslucentLoader.d.ts +0 -9
  316. package/type_defs/components/loaders/TranslucentLoader.d.ts.map +0 -1
  317. package/type_defs/components/mobx/Alert.d.ts +0 -4
  318. package/type_defs/components/mobx/Alert.d.ts.map +0 -1
  319. package/type_defs/components/mobx/Drawer.d.ts +0 -5
  320. package/type_defs/components/mobx/Drawer.d.ts.map +0 -1
  321. package/type_defs/components/mobx/ErrorBoundary.d.ts +0 -24
  322. package/type_defs/components/mobx/ErrorBoundary.d.ts.map +0 -1
  323. package/type_defs/components/mobx/Modal.d.ts +0 -4
  324. package/type_defs/components/mobx/Modal.d.ts.map +0 -1
  325. package/type_defs/components/navigation/Breadcrumbs.d.ts +0 -3
  326. package/type_defs/components/navigation/Breadcrumbs.d.ts.map +0 -1
  327. package/type_defs/components/navigation/ButtonLink.d.ts +0 -25
  328. package/type_defs/components/navigation/ButtonLink.d.ts.map +0 -1
  329. package/type_defs/components/navigation/InlineButtonLink.d.ts +0 -3
  330. package/type_defs/components/navigation/InlineButtonLink.d.ts.map +0 -1
  331. package/type_defs/components/notification/InfoPanel.d.ts +0 -18
  332. package/type_defs/components/notification/InfoPanel.d.ts.map +0 -1
  333. package/type_defs/components/notification/Notification.d.ts +0 -14
  334. package/type_defs/components/notification/Notification.d.ts.map +0 -1
  335. package/type_defs/components/tables/MobileTable/Row.d.ts +0 -14
  336. package/type_defs/components/tables/MobileTable/Row.d.ts.map +0 -1
  337. package/type_defs/components/tables/MobileTable.d.ts +0 -9
  338. package/type_defs/components/tables/MobileTable.d.ts.map +0 -1
  339. package/type_defs/components/tables/NiceTable.d.ts +0 -12
  340. package/type_defs/components/tables/NiceTable.d.ts.map +0 -1
  341. package/type_defs/components/tables/Row.d.ts +0 -19
  342. package/type_defs/components/tables/Row.d.ts.map +0 -1
  343. package/type_defs/components/tables/SimpleTable.d.ts +0 -9
  344. package/type_defs/components/tables/SimpleTable.d.ts.map +0 -1
  345. package/type_defs/components/tables/Table.d.ts +0 -73
  346. package/type_defs/components/tables/Table.d.ts.map +0 -1
  347. package/type_defs/components/tables/blocks/Header.d.ts +0 -17
  348. package/type_defs/components/tables/blocks/Header.d.ts.map +0 -1
  349. package/type_defs/components/tables/blocks/HelpText.d.ts +0 -5
  350. package/type_defs/components/tables/blocks/HelpText.d.ts.map +0 -1
  351. package/type_defs/components/tables/blocks/Pagination.d.ts +0 -8
  352. package/type_defs/components/tables/blocks/Pagination.d.ts.map +0 -1
  353. package/type_defs/components/tables/blocks/TableFilter.d.ts +0 -9
  354. package/type_defs/components/tables/blocks/TableFilter.d.ts.map +0 -1
  355. package/type_defs/components/tables/blocks/Title.d.ts +0 -7
  356. package/type_defs/components/tables/blocks/Title.d.ts.map +0 -1
  357. package/type_defs/components/tables/index.d.ts +0 -9
  358. package/type_defs/components/tables/index.d.ts.map +0 -1
  359. package/type_defs/components/tables/utils.d.ts +0 -2
  360. package/type_defs/components/tables/utils.d.ts.map +0 -1
  361. package/type_defs/components/tags/Chip.d.ts +0 -18
  362. package/type_defs/components/tags/Chip.d.ts.map +0 -1
  363. package/type_defs/components/tags/Tag.d.ts +0 -8
  364. package/type_defs/components/tags/Tag.d.ts.map +0 -1
  365. package/type_defs/components/text/Header.d.ts +0 -31
  366. package/type_defs/components/text/Header.d.ts.map +0 -1
  367. package/type_defs/components/text/Hint.d.ts +0 -10
  368. package/type_defs/components/text/Hint.d.ts.map +0 -1
  369. package/type_defs/components/text/Label.d.ts +0 -7
  370. package/type_defs/components/text/Label.d.ts.map +0 -1
  371. package/type_defs/components/text/Paragraph.d.ts +0 -37
  372. package/type_defs/components/text/Paragraph.d.ts.map +0 -1
  373. package/type_defs/components/text/Text.d.ts +0 -7
  374. package/type_defs/components/text/Text.d.ts.map +0 -1
  375. package/type_defs/components/tooltips/IconTooltip.d.ts +0 -10
  376. package/type_defs/components/tooltips/IconTooltip.d.ts.map +0 -1
  377. package/type_defs/components/tooltips/IconTooltip.stories.d.ts +0 -18
  378. package/type_defs/components/tooltips/IconTooltip.stories.d.ts.map +0 -1
  379. package/type_defs/components/tooltips/Tooltip.d.ts +0 -14
  380. package/type_defs/components/tooltips/Tooltip.d.ts.map +0 -1
  381. package/type_defs/hooks/useIsMounted.d.ts +0 -2
  382. package/type_defs/hooks/useIsMounted.d.ts.map +0 -1
  383. package/type_defs/hooks/useLoader.d.ts +0 -10
  384. package/type_defs/hooks/useLoader.d.ts.map +0 -1
  385. package/type_defs/hooks/useLoaderV2.d.ts +0 -15
  386. package/type_defs/hooks/useLoaderV2.d.ts.map +0 -1
  387. package/type_defs/index.d.ts +0 -2
  388. package/type_defs/index.d.ts.map +0 -1
  389. package/type_defs/stores/useStores.d.ts +0 -5
  390. package/type_defs/stores/useStores.d.ts.map +0 -1
  391. package/type_defs/styles/DeviceSizeWatcher.d.ts +0 -21
  392. package/type_defs/styles/DeviceSizeWatcher.d.ts.map +0 -1
  393. package/type_defs/styles/alignments.d.ts +0 -8
  394. package/type_defs/styles/alignments.d.ts.map +0 -1
  395. package/type_defs/styles/colors.d.ts +0 -35
  396. package/type_defs/styles/colors.d.ts.map +0 -1
  397. package/type_defs/styles/deviceSizes.d.ts +0 -9
  398. package/type_defs/styles/deviceSizes.d.ts.map +0 -1
  399. package/type_defs/styles/mediaQueries.d.ts +0 -21
  400. package/type_defs/styles/mediaQueries.d.ts.map +0 -1
  401. package/type_defs/styles/mixins.d.ts +0 -8
  402. package/type_defs/styles/mixins.d.ts.map +0 -1
  403. package/type_defs/styles/spacings.d.ts +0 -15
  404. package/type_defs/styles/spacings.d.ts.map +0 -1
  405. package/type_defs/styles/theme/Theme.type.d.ts +0 -79
  406. package/type_defs/styles/theme/Theme.type.d.ts.map +0 -1
  407. package/type_defs/styles/theme/base.d.ts +0 -3
  408. package/type_defs/styles/theme/base.d.ts.map +0 -1
  409. package/type_defs/styles/theme/dark.d.ts +0 -3
  410. package/type_defs/styles/theme/dark.d.ts.map +0 -1
  411. package/type_defs/styles/theme/light.d.ts +0 -3
  412. package/type_defs/styles/theme/light.d.ts.map +0 -1
  413. package/type_defs/styles/theme/light2.d.ts +0 -3
  414. package/type_defs/styles/theme/light2.d.ts.map +0 -1
  415. package/type_defs/styles/theme/useTheme.d.ts +0 -3
  416. package/type_defs/styles/theme/useTheme.d.ts.map +0 -1
  417. package/type_defs/styles/types.d.ts +0 -17
  418. package/type_defs/styles/types.d.ts.map +0 -1
  419. package/type_defs/styles/typography.d.ts +0 -56
  420. package/type_defs/styles/typography.d.ts.map +0 -1
  421. package/type_defs/utils/NavBarScrollWatcher.d.ts +0 -7
  422. package/type_defs/utils/NavBarScrollWatcher.d.ts.map +0 -1
  423. package/type_defs/utils/arrayHelpers.d.ts +0 -23
  424. package/type_defs/utils/arrayHelpers.d.ts.map +0 -1
  425. package/type_defs/utils/dateTime/DateRange.type.d.ts +0 -6
  426. package/type_defs/utils/dateTime/DateRange.type.d.ts.map +0 -1
  427. package/type_defs/utils/dateTime/calendar.d.ts +0 -18
  428. package/type_defs/utils/dateTime/calendar.d.ts.map +0 -1
  429. package/type_defs/utils/dateTimeHelpers.d.ts +0 -23
  430. package/type_defs/utils/dateTimeHelpers.d.ts.map +0 -1
  431. package/type_defs/utils/function.types.d.ts +0 -2
  432. package/type_defs/utils/function.types.d.ts.map +0 -1
  433. package/type_defs/utils/functionHelpers.d.ts +0 -7
  434. package/type_defs/utils/functionHelpers.d.ts.map +0 -1
  435. package/type_defs/utils/idGenerator.d.ts +0 -3
  436. package/type_defs/utils/idGenerator.d.ts.map +0 -1
  437. package/type_defs/utils/logging/Logger.d.ts +0 -10
  438. package/type_defs/utils/logging/Logger.d.ts.map +0 -1
  439. package/type_defs/utils/logging/Logger.type.d.ts +0 -7
  440. package/type_defs/utils/logging/Logger.type.d.ts.map +0 -1
  441. package/type_defs/utils/logging/loggable.d.ts +0 -7
  442. package/type_defs/utils/logging/loggable.d.ts.map +0 -1
  443. package/type_defs/utils/logging/with_module_logging.d.ts +0 -3
  444. package/type_defs/utils/logging/with_module_logging.d.ts.map +0 -1
  445. package/type_defs/utils/numberHelpers.d.ts +0 -3
  446. package/type_defs/utils/numberHelpers.d.ts.map +0 -1
  447. package/type_defs/utils/typeCheckers.d.ts +0 -5
  448. package/type_defs/utils/typeCheckers.d.ts.map +0 -1
  449. package/type_defs/utils/validateFields.d.ts +0 -13
  450. package/type_defs/utils/validateFields.d.ts.map +0 -1
  451. package/type_defs/zendeskGardenCss.d.ts +0 -2
  452. package/type_defs/zendeskGardenCss.d.ts.map +0 -1
@@ -1,76 +0,0 @@
1
- import { StyledProps } from "components/StyledProps.type"
2
- import { Nullable } from "global"
3
-
4
- export type ContainerStyles = {
5
- background?: string,
6
- borderRadius?: string,
7
- height?: string,
8
- margin?: string,
9
- padding?: string,
10
- shadow?: string,
11
- zIndex?: number,
12
- }
13
-
14
- export type Styles = {
15
- appBar: ContainerStyles,
16
- border: {
17
- color: string,
18
- },
19
- buttons: {
20
- textTransform: Nullable<string>,
21
- },
22
- colorAccent: string,
23
- colorSecondary: string,
24
- colorPrimary: string,
25
- colorPrimaryDark: string,
26
- colorWarning: string,
27
- colorDanger: string,
28
- colorSuccess: string,
29
- container: { horizontalPadding: string },
30
- footer: {
31
- background: string
32
- },
33
- infoPanel: {
34
- background: string,
35
- },
36
- modal: {
37
- backdrop: {
38
- background: string,
39
- }
40
- },
41
- nav: {
42
- linkColor: string,
43
- },
44
- notifications: {
45
- zIndex: number,
46
- },
47
- overlayBackground: string,
48
- pageBackground: string,
49
- scrollbar: {
50
- thumbColor: string,
51
- trackColor: string,
52
- },
53
- scrollbarColor: string,
54
- section: ContainerStyles,
55
- sidebar: {
56
- background: string,
57
- boxShadow: string,
58
- zIndex: number
59
- },
60
- table: { borderSize: string, },
61
- textColorDark: string,
62
- textColorLight: string,
63
- textColorOverPrimaryBg: string,
64
- textColorPrimary: string,
65
- textColorSecondary: string,
66
- tooltip: {
67
- darkBackground: string,
68
- },
69
-
70
- getTextColorForBackground: (p: StyledProps<{ color: string }>) => string
71
- }
72
-
73
- export type Theme = {
74
- isDark: boolean,
75
- styles: Styles,
76
- }
@@ -1,47 +0,0 @@
1
- import { COLORS, hasGoodContrast } from "styles/colors"
2
- import { SPACINGS } from "styles/spacings"
3
- import { Styles } from "styles/theme/Theme.type"
4
-
5
- export const base: Partial<Styles> = {
6
- appBar: {
7
- height: "80px",
8
- shadow: "unset",
9
- zIndex: 399,
10
- }, // modal backdrop zindex is 400
11
- border: {
12
- color: "rgb(233, 235, 237)",
13
- },
14
- buttons: { textTransform: null },
15
- colorAccent: COLORS.BLUE,
16
- colorPrimary: COLORS.HUB_SPOT_ORANGE,
17
- colorDanger: COLORS.RED,
18
- colorWarning: COLORS.YELLOW,
19
- colorSuccess: COLORS.GREEN,
20
- container: { horizontalPadding: "1rem" },
21
- modal: {
22
- backdrop: {
23
- background: "rgba(47, 57, 65, 0.85)",
24
- }
25
- },
26
- notifications: {
27
- zIndex: 401,
28
- },
29
- section: {
30
- background: "transparent",
31
- padding: `${SPACINGS.XXXL} 0`,
32
- },
33
- sidebar: {
34
- background: "unset",
35
- zIndex: 10000,
36
- boxShadow: "rgb(47 57 65 / 35%)",
37
- },
38
- table: { borderSize: "1rem" },
39
- tooltip: { darkBackground: "#747183" },
40
-
41
- getTextColorForBackground: ({ color, theme }) => {
42
- if (hasGoodContrast(color, theme.styles.textColorLight)) {
43
- return theme.styles.textColorLight
44
- }
45
- return theme.styles.textColorDark
46
- },
47
- }
@@ -1,36 +0,0 @@
1
- import { COLORS, fade, light, lighter } from "styles/colors"
2
- import { base } from "styles/theme/base"
3
- import { Theme } from "styles/theme/Theme.type"
4
-
5
- const textColorPrimary = COLORS.LIGHT_GREY
6
-
7
- export const dark: Theme = {
8
- isDark: true,
9
- styles: {
10
- ...base,
11
- // deprecated
12
- // @ts-ignore
13
- navBackground: "#1d1e21",
14
- nav: {
15
- linkColor: light(COLORS.GREY),
16
- },
17
- footer: {
18
- background: lighter(COLORS.MIDNIGHT_BLUE),
19
- },
20
- overlayBackground: fade(COLORS.LIGHT_GREY, .9),
21
- pageBackground: COLORS.MIDNIGHT_BLUE,
22
- scrollbar: {
23
- thumbColor: "#ffffff55",
24
- trackColor: "#ffffff33",
25
- },
26
- sidebar: {
27
- ...base.sidebar!!,
28
- background: COLORS.MIDNIGHT_BLUE,
29
- },
30
- textColorDark: COLORS.MIDNIGHT_PURPLE,
31
- textColorLight: textColorPrimary,
32
- textColorOverPrimaryBg: COLORS.WHITE,
33
- textColorPrimary,
34
- textColorSecondary: COLORS.GREY_NOT_QUITE_BLUE,
35
- },
36
- }
@@ -1,44 +0,0 @@
1
- import { COLORS, fade } from "styles/colors"
2
- import { base } from "styles/theme/base"
3
- import { Theme } from "styles/theme/Theme.type"
4
-
5
- const textColorPrimary = COLORS.JAZZ_MAN_BLUE
6
-
7
-
8
- export const light: Theme = {
9
- isDark: false,
10
- styles: {
11
- ...base,
12
- appBar: {
13
- ...base.appBar,
14
- background: "transparent",
15
- },
16
- // deprecated
17
- // @ts-ignore
18
- navBackground: COLORS.GREY_NOT_QUITE_BLUE,
19
- nav: {
20
- linkColor: COLORS.MIDNIGHT_PURPLE,
21
- },
22
- footer: {
23
- background: COLORS.MIDNIGHT_BLUE,
24
- },
25
- infoPanel: {
26
- background: COLORS.VERY_LIGHT_GREY,
27
- },
28
- pageBackground: COLORS.WHITE,
29
- overlayBackground: fade(COLORS.LIGHT_GREY),
30
- scrollbar: {
31
- thumbColor: "#00000033",
32
- trackColor: "#00000022",
33
- },
34
- sidebar: {
35
- ...base.sidebar!!,
36
- background: COLORS.WHITE,
37
- },
38
- textColorDark: textColorPrimary,
39
- textColorLight: COLORS.WHITE,
40
- textColorOverPrimaryBg: COLORS.WHITE,
41
- textColorPrimary,
42
- textColorSecondary: COLORS.GREY_NOT_QUITE_BLUE,
43
- },
44
- }
@@ -1,22 +0,0 @@
1
- import clone from "lodash/cloneDeep"
2
- import { Theme } from "styles/theme/Theme.type"
3
- import { light } from "styles/theme/light"
4
- import { SPACINGS } from "styles/spacings"
5
-
6
- export const light2: Theme = clone<Theme>(light)
7
- light2.styles = {
8
- ...light2.styles,
9
- appBar: {
10
- ...light2.styles.appBar,
11
- shadow: "#0000000d 0 0 15px 0",
12
- },
13
- pageBackground: "#f7f7f7",
14
- section: {
15
- ...light2.styles.section,
16
- background: "#fff",
17
- borderRadius: "3px",
18
- margin: `${SPACINGS.XXXL} 0`,
19
- padding: "2rem",
20
- shadow: "#00000014 0 6px 14px 0",
21
- },
22
- }
@@ -1,5 +0,0 @@
1
- import { useContext } from "react"
2
- import { ThemeContext } from "styled-components"
3
- import { Theme } from "styles/theme/Theme.type"
4
-
5
- export const useTheme = (): Theme => useContext<Theme>(ThemeContext)
@@ -1,18 +0,0 @@
1
- export type ColorProps = {
2
- accent? :boolean,
3
- color? :string,
4
- danger? :boolean,
5
- neutral? :boolean,
6
- primary? :boolean,
7
- // deprecated
8
- secondary? :boolean,
9
- success? :boolean,
10
- warning? :boolean,
11
- }
12
-
13
- export type ContainerProps = {
14
- color? :string,
15
- compact? :boolean,
16
- fluid? :boolean,
17
- className? :any,
18
- }
@@ -1,67 +0,0 @@
1
- import { ValueOf } from "utils/types"
2
-
3
- const XXS = ".8rem"
4
- const XS = ".9rem"
5
- const SM = "1rem"
6
- const MD = "1.3rem"
7
- const LG = "1.7rem"
8
- const XL = "2.3rem"
9
- const XXL = "3.3rem" // h1
10
- const XXXL = "4rem"
11
- const XXXXL = "5rem"
12
- const XXXXXL = "6rem"
13
-
14
- const THIN = "100"
15
- const LIGHT = "300"
16
- const REGULAR = "400"
17
- const MEDIUM = "500"
18
- const BOLD = "700"
19
- const BLACK = "800"
20
-
21
- const H1 = "h1"
22
- const H2 = "h2"
23
- const H3 = "h3"
24
- const H4 = "h4"
25
- const H5 = "h5"
26
- const H6 = "h6"
27
- const P = "p"
28
- const SPAN = "span"
29
- const DIV = "div"
30
-
31
- export const FONT_TAGS = {
32
- H1, H2, H3, H4, H5, H6, P, SPAN, DIV,
33
- } as const
34
-
35
- export const FONT_SIZES = {
36
- XXS, XS, SM, MD, LG, XL, XXL, XXXL, XXXXL, XXXXXL,
37
- } as const
38
-
39
- export const FONT_SIZES_EM = Object.freeze({
40
- XXS: XXS.replace("r", ""),
41
- XS: XS.replace("r", ""),
42
- SM: SM.replace("r", ""),
43
- MD: MD.replace("r", ""),
44
- LG: LG.replace("r", ""),
45
- XL: XL.replace("r", ""),
46
- XXL: XXL.replace("r", ""),
47
- XXXL: XXXL.replace("r", ""),
48
- XXXXL: XXXXL.replace("r", ""),
49
- XXXXXL: XXXXXL.replace("r", ""),
50
- })
51
-
52
- export const FONT_WEIGHTS = {
53
- THIN, LIGHT, REGULAR, MEDIUM, BOLD, BLACK,
54
- } as const
55
-
56
- export type FontSize = ValueOf<typeof FONT_SIZES>
57
- export type FontWeight = ValueOf<typeof FONT_WEIGHTS>
58
- export type FontTag = ValueOf<typeof FONT_TAGS>
59
- export type TextAlignment = "center" | "left" | "right"
60
-
61
- export type TextProps = {
62
- align?: TextAlignment,
63
- as?: FontTag,
64
- hasSubText?: boolean,
65
- size?: FontSize,
66
- weight?: FontWeight,
67
- }
@@ -1,59 +0,0 @@
1
- // @flow
2
-
3
-
4
- import { Logger } from "utils/logging/Logger"
5
-
6
- export type ScrollPassedNavBarListener = (b :boolean) => void
7
-
8
- const listeners = new Set<ScrollPassedNavBarListener>()
9
- let navBar :HTMLDivElement
10
- let scrolledPassedNavBar :boolean
11
- const logger = new Logger("NavBarScrollWatcher")
12
-
13
- const checkNavPosition = () => {
14
- if (!navBar) return
15
-
16
- const { height: bottomPixel } = navBar.getBoundingClientRect()
17
- const isCurrentlyPassedBar = window.scrollY > bottomPixel
18
-
19
- logger.writeInfo(
20
- "window.scrollY",
21
- window.scrollY,
22
- "bottomPixel",
23
- bottomPixel,
24
- "scrolledPassedNavBar",
25
- scrolledPassedNavBar,
26
- )
27
-
28
- if ((scrolledPassedNavBar == null) ||
29
- (!scrolledPassedNavBar && isCurrentlyPassedBar) ||
30
- (scrolledPassedNavBar && !isCurrentlyPassedBar)) {
31
- notifyListeners(isCurrentlyPassedBar)
32
- }
33
-
34
- scrolledPassedNavBar = isCurrentlyPassedBar
35
- }
36
-
37
- const notifyListeners = (b :boolean) => {
38
- listeners.forEach((f :ScrollPassedNavBarListener) => { f(b) })
39
- }
40
-
41
- export class NavBarScrollWatcher {
42
- static onScrollPassedNavBar = (f :ScrollPassedNavBarListener) => {
43
- listeners.add(f)
44
- if (listeners.size === 1) {
45
- window.addEventListener("scroll", checkNavPosition)
46
- }
47
-
48
- return () => {
49
- listeners.delete(f)
50
- if (listeners.size === 0) {
51
- window.removeEventListener("scroll", checkNavPosition)
52
- }
53
- }
54
- }
55
-
56
- static setNavBar = (n :HTMLDivElement) => { navBar = n }
57
-
58
- static setInitialState = () => { checkNavPosition() }
59
- }
@@ -1,56 +0,0 @@
1
- import { flatten as ldFlatten } from "lodash"
2
-
3
- type IndexedMap<T> = ({ [key in string | number]: T })
4
- export type Matrix<T> = Array<Array<T>>
5
- export type NullableArray<T = any> = ArrayLike<T> | null | undefined
6
- type ObjectWithProperty<Prop extends string> = { [key in Prop]: any }
7
-
8
- export const arrayOfSizeN = (n: number): Array<any> => {
9
- // return Array.from({length: n})
10
- const arr: 0[] = []
11
- for (let i = 0; i < n; i++) {
12
- arr.push(0)
13
- }
14
- return arr
15
- }
16
-
17
- export const excludeBlanks = <T = any>(a: T[]): NonNullable<T>[] => (
18
- a.filter((o: T) => o != null) as NonNullable<T>[]
19
- )
20
-
21
- export const flatten = <T>(m: Matrix<T>): Array<T> => ldFlatten(m)
22
-
23
- export const indexBy = <FieldName extends string, T extends ObjectWithProperty<FieldName>>(
24
- a: T[],
25
- fieldName: FieldName
26
- ): IndexedMap<T> => {
27
- const index: IndexedMap<T> = {}
28
-
29
- a.forEach((item) => {
30
- const key = item[fieldName]
31
- index[key] = item
32
- })
33
-
34
- return index
35
- }
36
-
37
- export const isEmpty = (a: NullableArray): boolean => (!a?.length)
38
- export const isLastIndex = (a: any[], i: number) => i === a.length - 1
39
- export const isLastItem = <E>(a: ArrayLike<E>, item: E): boolean =>
40
- (lastItem(a) === item)
41
- export const isNotEmpty = (a: NullableArray): boolean => !isEmpty(a)
42
- export const isNotLastIndex = (a: any[], i: number) => !isLastIndex(a, i)
43
- export const isNotLastItem = <E>(a: ArrayLike<E>, item: E): boolean =>
44
- (!isLastItem(a, item))
45
- export const lastItem = <E>(a: ArrayLike<E>): E => a[a.length - 1]
46
-
47
- export const splitArray = (arr: any[], index: number,): any[][] => {
48
- const preSplit = [...arr]
49
- const postSplit = preSplit.splice(index)
50
- return [preSplit, postSplit]
51
- }
52
-
53
- export const takeOutItem = <T>(arr: Array<T>, index: number): Array<T> => {
54
- const [preSplit, [, ...postSplit]] = splitArray(arr, index)
55
- return [...preSplit, ...postSplit]
56
- }
@@ -1,6 +0,0 @@
1
- import { Moment } from "moment"
2
-
3
- export type DateRange = {
4
- startDate :Moment,
5
- endDate :Moment
6
- }
@@ -1,23 +0,0 @@
1
- export const MONTH_MAP = {
2
- JANUARY : 0,
3
- FEBRUARY : 1,
4
- MARCH : 2,
5
- APRIL : 3,
6
- MAY : 4,
7
- JUNE : 5,
8
- JULY : 6,
9
- AUGUST : 7,
10
- SEPTEMBER: 8,
11
- OCTOBER : 9,
12
- NOVEMBER : 10,
13
- DECEMBER : 11,
14
- } as const
15
-
16
- export type Month = keyof typeof MONTH_MAP
17
-
18
- export const getNextMonth = (currMon :number) :number => (
19
- currMon === MONTH_MAP.DECEMBER ? MONTH_MAP.JANUARY : currMon + 1
20
- )
21
- export const getPrevMonth = (currMon :number) :number => (
22
- currMon === MONTH_MAP.JANUARY ? MONTH_MAP.DECEMBER : currMon - 1
23
- )
@@ -1,105 +0,0 @@
1
- import moment, { Moment } from "moment"
2
- import { PromiseFunc } from "utils/function.types"
3
-
4
- let defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale
5
-
6
- export const formatMonthDate = (m: Moment): string => m.format("MMM D")
7
- export const formatDayDate = (m: Moment): string => m.format("ddd, ll")
8
- export const formatMonthDateYear = (m: Moment): string => m.format("MMM DD YYYY")
9
- export const setDefaultLocale = (locale: string) => {
10
- defaultLocale =
11
- locale
12
- }
13
-
14
- type FormatOptions = {
15
- locale?: string,
16
- iso8601Format?: boolean,
17
- timeZone?: string,
18
- }
19
- export const formatDate = (
20
- d: Date,
21
- {
22
- locale = defaultLocale,
23
- iso8601Format = false,
24
- ...options
25
- }: FormatOptions = {},
26
- ): string => {
27
- const formatter = new Intl.DateTimeFormat(locale, options)
28
-
29
- try {
30
- if (iso8601Format) {
31
- const parts = formatter.formatToParts(d)
32
- return ["year", "month", "day"].map((part: string) => {
33
- return parts?.find((p) => p.type === part)?.value
34
- }).join("-")
35
- }
36
- } catch (e) {}
37
-
38
- const formatted = formatter.format(d)
39
- return locale.includes("en") ? formatted.replace(/\//g, "-") : formatted
40
- }
41
-
42
- export const formatDateTime = (
43
- d: Date,
44
- {
45
- locale = defaultLocale,
46
- ...options
47
- }: FormatOptions = {},
48
- ): string => {
49
- const formattedDate = formatDate(
50
- d,
51
- { locale, iso8601Format: true, ...options }
52
- )
53
-
54
- return `${formattedDate} ${moment(d).format("LTS")}`
55
- }
56
-
57
- export const returnAfterMinimum = async (
58
- millisecs: number,
59
- f: PromiseFunc,
60
- ...fArgs: any
61
- ) => {
62
- const start: Moment = moment()
63
- const val = await f(...fArgs)
64
- const end: Moment = moment()
65
- const diff = end.diff(start, "milliseconds")
66
-
67
- if (diff < millisecs) {
68
- await new Promise((resolve) => {
69
- setTimeout(resolve, millisecs - diff)
70
- })
71
- }
72
-
73
- return val
74
- }
75
-
76
- export const momentListToDateList = (l: Moment[]): Date[] => (
77
- l.map((m: Moment) => m.toDate())
78
- )
79
-
80
- export const minDateBetween = (a: Moment, b: Moment): Moment => (
81
- a.isBefore(b) ? a : b
82
- )
83
- export const maxDateBetween = (a: Moment, b: Moment): Moment => (
84
- a.isAfter(b) ? a : b
85
- )
86
-
87
- export const addNDaysFromDate = (n: number, d = new Date()): Date =>
88
- momentArithmetic(d, "add", n, "days")
89
- export const addNWeeksFromDate = (n: number, d = new Date()): Date =>
90
- momentArithmetic(d, "add", n, "weeks")
91
- export const subtractNDaysFromDate = (n: number, d = new Date()): Date =>
92
- momentArithmetic(d, "subtract", n, "days")
93
- export const subtractNWeeksFromDate = (n: number, d = new Date()): Date =>
94
- momentArithmetic(d, "subtract", n, "weeks")
95
-
96
- const momentArithmetic = (
97
- d: Date,
98
- func: string,
99
- n: number,
100
- unit: string
101
- ): Date => {
102
- // @ts-ignore
103
- const newDate = (moment(d)[func] as Function)(n, unit) as Moment
104
- return newDate.toDate()
105
- }
@@ -1 +0,0 @@
1
- export type PromiseFunc<T = any, Rtn = any> = ((...o: T[]) => Promise<Rtn>)
@@ -1,23 +0,0 @@
1
- import { isNotLastIndex } from "utils/arrayHelpers"
2
- import { PromiseFunc } from "utils/function.types"
3
-
4
- type MaybePromiseFunc = PromiseFunc | ((...o: any) => any)
5
-
6
- export const DO_NOTHING = function(...args :any) {}
7
-
8
- export const flowInOrderAsync = (...funcs: MaybePromiseFunc[]): PromiseFunc => {
9
- const wrappedFuncs = funcs.map((func, i: number) => {
10
- return async (promises: PromiseFunc[], ...args: any) => {
11
- const nextFunc = isNotLastIndex(funcs, i) ? promises[i + 1] : null
12
-
13
- const val = await func(...args)
14
- return !!nextFunc ? nextFunc(promises, val) : val
15
- }
16
- })
17
-
18
- return async (...args) => wrappedFuncs[0](wrappedFuncs, ...args)
19
- }
20
-
21
- export const parseNumberAndCall = (action :(n :number) => void) => (s :string) => {
22
- action(Number(s))
23
- }
@@ -1,8 +0,0 @@
1
- // @flow
2
-
3
- export function* newIdGenerator() {
4
- let id = 0
5
- while (true) { yield id++ }
6
- }
7
-
8
- export const nextId = (generator :Generator) :number => generator.next().value
@@ -1,34 +0,0 @@
1
- import { LoggerI } from "utils/logging/Logger.type"
2
-
3
- const LEVEL_STYLES = {
4
- info: "background: #499cc8; color: white;",
5
- error: "background: #c14a4f; color: white;",
6
- warn: "background: #e0a270; color: black;",
7
- } as const
8
-
9
- export class Logger implements LoggerI {
10
- moduleName: string
11
-
12
- constructor(moduleName: string) {
13
- this.moduleName = moduleName
14
- }
15
-
16
- log = (level: keyof typeof LEVEL_STYLES) => (...args: any) => {
17
- if (typeof window === "undefined" ||
18
- !window.DEBUG_MODULES.has(this.moduleName)) return
19
-
20
- console[level](
21
- `%c${this.moduleName}`,
22
- `${LEVEL_STYLES[level]} padding: 2px 6px;`,
23
- ...args,
24
- )
25
- }
26
-
27
- writeInfo = this.log("info")
28
- writeError = this.log("error")
29
- writeWarning = this.log("warn")
30
- }
31
-
32
- if (typeof window !== `undefined`) {
33
- window.DEBUG_MODULES = new Set()
34
- }
@@ -1,7 +0,0 @@
1
- export interface LoggerI {
2
- writeInfo :(...args :any) => void,
3
- writeError :(...args :any) => void,
4
- writeWarning :(...args :any) => void
5
- }
6
-
7
- export type LoggableFunc = (logger :LoggerI) => any
@@ -1,17 +0,0 @@
1
- import React, { ComponentType as RComponentType } from "react"
2
- import { LoggerI } from "utils/logging/Logger.type"
3
- import { withModuleLogging } from "utils/logging/with_module_logging"
4
-
5
- type ComponentType<T> = RComponentType<T> & {
6
- COMPONENT_NAME: string
7
- }
8
-
9
- export const loggable = <T, >(C: ComponentType<T>): ComponentType<T> => (
10
- withModuleLogging(C.COMPONENT_NAME, (logger: LoggerI) => (
11
- class Loggable extends React.Component<T> {
12
- render() {
13
- return <C {...this.props} logger={logger} />
14
- }
15
- }
16
- ))
17
- )
@@ -1,8 +0,0 @@
1
- // @flow
2
-
3
- import { Logger } from "utils/logging/Logger"
4
- import { LoggableFunc } from "utils/logging/Logger.type"
5
-
6
- export const withModuleLogging = (moduleName :string, f :LoggableFunc) => {
7
- return f(Object.freeze(new Logger(moduleName)))
8
- }
@@ -1,4 +0,0 @@
1
- // @flow
2
-
3
- export const minNumberBetween = (a :number, b :number) :number => a < b ? a : b
4
- export const maxNumberBetween = (a :number, b :number) :number => a > b ? a : b