cronofy-elements 1.48.1 → 1.49.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 (349) hide show
  1. package/dist/.gitkeep +0 -0
  2. package/dist/CronofyElements.js +2 -0
  3. package/{build/CronofyElements.v1.48.1.js.LICENSE.txt → dist/CronofyElements.js.LICENSE.txt} +0 -0
  4. package/package.json +10 -7
  5. package/.babelrc +0 -20
  6. package/.eslintrc.yaml +0 -43
  7. package/.prettierignore +0 -4
  8. package/.prettierrc +0 -7
  9. package/Makefile +0 -92
  10. package/brainstorm.md +0 -76
  11. package/build/CronofyElements.v1.48.1.js +0 -2
  12. package/build/npm/CronofyElements.js +0 -2
  13. package/compat.config.js +0 -25
  14. package/demo/agenda.ejs +0 -71
  15. package/demo/availability-viewer.ejs +0 -322
  16. package/demo/calendar-sync.ejs +0 -149
  17. package/demo/crossbrowser.ejs +0 -228
  18. package/demo/date-time-picker.ejs +0 -213
  19. package/demo/demo-styles.css +0 -134
  20. package/demo/index.ejs +0 -249
  21. package/demo/integration.ejs +0 -482
  22. package/demo/load-elements.ejs +0 -12
  23. package/demo/nav.ejs +0 -14
  24. package/demo/rules.ejs +0 -121
  25. package/demo/server.js +0 -425
  26. package/demo/slot-picker.ejs +0 -197
  27. package/git.README.md +0 -71
  28. package/notes.style.md +0 -197
  29. package/postcss.config.js +0 -3
  30. package/script/i18n-export +0 -11
  31. package/script/i18n-helpers/split_write.rb +0 -25
  32. package/script/i18n-import +0 -22
  33. package/script/i18n-reference-update +0 -241
  34. package/src/js/components/Agenda/Agenda.js +0 -243
  35. package/src/js/components/Agenda/AllDayEventsList.js +0 -37
  36. package/src/js/components/Agenda/Calendar.js +0 -100
  37. package/src/js/components/Agenda/CalendarHeader.js +0 -187
  38. package/src/js/components/Agenda/Event.js +0 -34
  39. package/src/js/components/Agenda/EventAllDay.js +0 -76
  40. package/src/js/components/Agenda/EventAttendees.js +0 -30
  41. package/src/js/components/Agenda/EventDetail.js +0 -111
  42. package/src/js/components/Agenda/EventMessages.js +0 -24
  43. package/src/js/components/Agenda/EventMeta.js +0 -48
  44. package/src/js/components/Agenda/EventTime.js +0 -34
  45. package/src/js/components/Agenda/EventWrapper.js +0 -271
  46. package/src/js/components/Agenda/Location.js +0 -29
  47. package/src/js/components/Agenda/Message.js +0 -22
  48. package/src/js/components/Agenda/TimedEventsList.js +0 -29
  49. package/src/js/components/AvailabilityRules/AddButton.js +0 -60
  50. package/src/js/components/AvailabilityRules/AvailabilityRules.js +0 -45
  51. package/src/js/components/AvailabilityRules/Calendar.js +0 -31
  52. package/src/js/components/AvailabilityRules/CalendarListItem.js +0 -53
  53. package/src/js/components/AvailabilityRules/CalendarProfiles.js +0 -67
  54. package/src/js/components/AvailabilityRules/CalendarSelector.js +0 -104
  55. package/src/js/components/AvailabilityRules/Calendars.js +0 -145
  56. package/src/js/components/AvailabilityRules/Checkmark.js +0 -51
  57. package/src/js/components/AvailabilityRules/DayLabels.js +0 -91
  58. package/src/js/components/AvailabilityRules/Footer.js +0 -109
  59. package/src/js/components/AvailabilityRules/Legend.js +0 -57
  60. package/src/js/components/AvailabilityRules/Loading.js +0 -53
  61. package/src/js/components/AvailabilityRules/RemoveButton.js +0 -57
  62. package/src/js/components/AvailabilityRules/Slot.js +0 -195
  63. package/src/js/components/AvailabilityRules/SlotDisplay.js +0 -27
  64. package/src/js/components/AvailabilityRules/Slots.js +0 -81
  65. package/src/js/components/AvailabilityRules/SlotsDisplay.js +0 -68
  66. package/src/js/components/AvailabilityRules/TimeExpander.js +0 -119
  67. package/src/js/components/AvailabilityRules/TimeLabels.js +0 -89
  68. package/src/js/components/AvailabilityRules/TimeZoneDisplay.js +0 -41
  69. package/src/js/components/AvailabilityRules/ToggleIcon.js +0 -41
  70. package/src/js/components/AvailabilityRules/Tooltip.js +0 -63
  71. package/src/js/components/AvailabilityRules/UnknownCalendar.js +0 -33
  72. package/src/js/components/AvailabilityRules/Week.js +0 -115
  73. package/src/js/components/AvailabilityRules/WeekGrid.js +0 -80
  74. package/src/js/components/AvailabilityRules/Wrapper.js +0 -414
  75. package/src/js/components/AvailabilityRules/contexts/drag-context.js +0 -15
  76. package/src/js/components/AvailabilityRules/scss/_base.buttons.scss +0 -58
  77. package/src/js/components/AvailabilityRules/scss/_base.theme.scss +0 -4
  78. package/src/js/components/AvailabilityRules/scss/_components.timezoneselector.scss +0 -74
  79. package/src/js/components/AvailabilityRules/scss/_generic.reset.scss +0 -13
  80. package/src/js/components/AvailabilityRules/scss/_settings.colours.scss +0 -12
  81. package/src/js/components/AvailabilityRules/scss/availabilityrules.scss +0 -5
  82. package/src/js/components/AvailabilityRules/utils/tz-utils.js +0 -44
  83. package/src/js/components/AvailabilityViewer/AvailabilityViewer.js +0 -524
  84. package/src/js/components/AvailabilityViewer/ColumnHeader.js +0 -35
  85. package/src/js/components/AvailabilityViewer/DayColumn.js +0 -36
  86. package/src/js/components/AvailabilityViewer/DayColumnDisplay.js +0 -33
  87. package/src/js/components/AvailabilityViewer/DayColumnWrapper.js +0 -29
  88. package/src/js/components/AvailabilityViewer/DayLabels.js +0 -41
  89. package/src/js/components/AvailabilityViewer/EmptyColumn.js +0 -29
  90. package/src/js/components/AvailabilityViewer/Footer.js +0 -36
  91. package/src/js/components/AvailabilityViewer/GridFreeSelect.js +0 -33
  92. package/src/js/components/AvailabilityViewer/HoverSlot.js +0 -35
  93. package/src/js/components/AvailabilityViewer/HoverTooltip.js +0 -34
  94. package/src/js/components/AvailabilityViewer/LabelColumn.js +0 -53
  95. package/src/js/components/AvailabilityViewer/LabelItem.js +0 -73
  96. package/src/js/components/AvailabilityViewer/Legend.js +0 -79
  97. package/src/js/components/AvailabilityViewer/Loading.js +0 -57
  98. package/src/js/components/AvailabilityViewer/MonthLabels.js +0 -43
  99. package/src/js/components/AvailabilityViewer/Navigation.js +0 -138
  100. package/src/js/components/AvailabilityViewer/Overlay.js +0 -60
  101. package/src/js/components/AvailabilityViewer/Preloading.js +0 -66
  102. package/src/js/components/AvailabilityViewer/SelectedSlot.js +0 -106
  103. package/src/js/components/AvailabilityViewer/SelectedSlots.js +0 -72
  104. package/src/js/components/AvailabilityViewer/SelectionMask.js +0 -44
  105. package/src/js/components/AvailabilityViewer/Slot.js +0 -237
  106. package/src/js/components/AvailabilityViewer/SlotFreeSelect.js +0 -115
  107. package/src/js/components/AvailabilityViewer/Slots.js +0 -57
  108. package/src/js/components/AvailabilityViewer/TimeExpander.js +0 -93
  109. package/src/js/components/AvailabilityViewer/TimeLines.js +0 -74
  110. package/src/js/components/AvailabilityViewer/TimeSelector.js +0 -243
  111. package/src/js/components/AvailabilityViewer/TimeSelectorTrigger.js +0 -42
  112. package/src/js/components/AvailabilityViewer/TimeZoneDisplay.js +0 -28
  113. package/src/js/components/AvailabilityViewer/ToggleIcon.js +0 -41
  114. package/src/js/components/AvailabilityViewer/Tooltip.js +0 -65
  115. package/src/js/components/AvailabilityViewer/Week.js +0 -255
  116. package/src/js/components/AvailabilityViewer/WeekWrapper.js +0 -132
  117. package/src/js/components/AvailabilityViewer/contexts/page-context.js +0 -17
  118. package/src/js/components/AvailabilityViewer/contexts/page-reducer.js +0 -28
  119. package/src/js/components/AvailabilityViewer/contexts/selection-context.js +0 -25
  120. package/src/js/components/AvailabilityViewer/contexts/selection-reducer.js +0 -18
  121. package/src/js/components/CalendarSync/Active.js +0 -57
  122. package/src/js/components/CalendarSync/AddToggle.js +0 -72
  123. package/src/js/components/CalendarSync/CalendarSync.js +0 -215
  124. package/src/js/components/CalendarSync/EditToggle.js +0 -71
  125. package/src/js/components/CalendarSync/Footer.js +0 -31
  126. package/src/js/components/CalendarSync/Inactive.js +0 -66
  127. package/src/js/components/CalendarSync/Loading.js +0 -52
  128. package/src/js/components/CalendarSync/Pending.js +0 -74
  129. package/src/js/components/CalendarSync/ProfileStatus.js +0 -33
  130. package/src/js/components/CalendarSync/Profiles.js +0 -109
  131. package/src/js/components/CalendarSync/ProviderLogo.js +0 -28
  132. package/src/js/components/CalendarSync/Providers.js +0 -80
  133. package/src/js/components/CalendarSync/RemoveLink.js +0 -96
  134. package/src/js/components/CalendarSync/SelectProvider.js +0 -25
  135. package/src/js/components/CalendarSync/contexts/status-reducer.js +0 -74
  136. package/src/js/components/DateTimePicker/Calendar.js +0 -127
  137. package/src/js/components/DateTimePicker/CalendarHeader.js +0 -80
  138. package/src/js/components/DateTimePicker/Confirm.js +0 -106
  139. package/src/js/components/DateTimePicker/DateTimePicker.js +0 -131
  140. package/src/js/components/DateTimePicker/DayButton.js +0 -38
  141. package/src/js/components/DateTimePicker/DayHeadings.js +0 -33
  142. package/src/js/components/DateTimePicker/Details.js +0 -33
  143. package/src/js/components/DateTimePicker/Error.js +0 -39
  144. package/src/js/components/DateTimePicker/Loading.js +0 -20
  145. package/src/js/components/DateTimePicker/LoadingCalendar.js +0 -21
  146. package/src/js/components/DateTimePicker/NoSlotsFound.js +0 -16
  147. package/src/js/components/DateTimePicker/SequencedSlotButton.js +0 -97
  148. package/src/js/components/DateTimePicker/SlotButton.js +0 -55
  149. package/src/js/components/DateTimePicker/SlotsList.js +0 -45
  150. package/src/js/components/DateTimePicker/Wrapper.js +0 -281
  151. package/src/js/components/DateTimePicker/contexts/status-context.js +0 -19
  152. package/src/js/components/DateTimePicker/contexts/status-reducer.js +0 -276
  153. package/src/js/components/DateTimePicker/contexts/theme-context.js +0 -33
  154. package/src/js/components/DateTimePicker/helpers/theming.js +0 -49
  155. package/src/js/components/DateTimePicker/scss/_base.buttons.scss +0 -58
  156. package/src/js/components/DateTimePicker/scss/_base.layout.scss +0 -28
  157. package/src/js/components/DateTimePicker/scss/_base.theme.scss +0 -17
  158. package/src/js/components/DateTimePicker/scss/_components.calendargrid.scss +0 -78
  159. package/src/js/components/DateTimePicker/scss/_components.calendarheader.scss +0 -71
  160. package/src/js/components/DateTimePicker/scss/_components.confirm.scss +0 -40
  161. package/src/js/components/DateTimePicker/scss/_components.details.scss +0 -20
  162. package/src/js/components/DateTimePicker/scss/_components.error.scss +0 -34
  163. package/src/js/components/DateTimePicker/scss/_components.loading.scss +0 -36
  164. package/src/js/components/DateTimePicker/scss/_components.slotslist.scss +0 -43
  165. package/src/js/components/DateTimePicker/scss/_components.timezoneselector.scss +0 -73
  166. package/src/js/components/DateTimePicker/scss/_generic.reset.scss +0 -18
  167. package/src/js/components/DateTimePicker/scss/_settings.colours.scss +0 -17
  168. package/src/js/components/DateTimePicker/scss/datetimepicker.scss +0 -5
  169. package/src/js/components/DateTimePicker/utils/calendar-keyboard.js +0 -109
  170. package/src/js/components/DateTimePicker/utils/calendar.js +0 -125
  171. package/src/js/components/DateTimePicker/utils/slots.js +0 -288
  172. package/src/js/components/SlotPicker/Confirm.js +0 -160
  173. package/src/js/components/SlotPicker/Days.js +0 -58
  174. package/src/js/components/SlotPicker/Slot.js +0 -72
  175. package/src/js/components/SlotPicker/SlotPicker.js +0 -292
  176. package/src/js/components/SlotPicker/Slots.js +0 -66
  177. package/src/js/components/SlotPicker/TimeSlots.js +0 -91
  178. package/src/js/components/generic/Button.js +0 -26
  179. package/src/js/components/generic/Container.js +0 -33
  180. package/src/js/components/generic/Error.js +0 -77
  181. package/src/js/components/generic/Loading.js +0 -51
  182. package/src/js/components/generic/LoadingSpinner.js +0 -30
  183. package/src/js/components/generic/ShadowScrollbars.js +0 -70
  184. package/src/js/components/generic/TimeZoneSelector.js +0 -158
  185. package/src/js/components/generic/TransitionSlide.js +0 -72
  186. package/src/js/contexts/i18n-context.js +0 -25
  187. package/src/js/contexts/log-context.js +0 -18
  188. package/src/js/contexts/tz-context.js +0 -18
  189. package/src/js/env.example.js +0 -8
  190. package/src/js/helpers/colors.js +0 -33
  191. package/src/js/helpers/comparators.AvailabilityViewer.js +0 -27
  192. package/src/js/helpers/connections.js +0 -370
  193. package/src/js/helpers/events.js +0 -166
  194. package/src/js/helpers/functional.js +0 -4
  195. package/src/js/helpers/generator.js +0 -107
  196. package/src/js/helpers/i18n.js +0 -153
  197. package/src/js/helpers/init.Agenda.js +0 -55
  198. package/src/js/helpers/init.AvailabilityRules.js +0 -195
  199. package/src/js/helpers/init.AvailabilityViewer.js +0 -215
  200. package/src/js/helpers/init.CalendarSync.js +0 -83
  201. package/src/js/helpers/init.DateTimePicker.js +0 -219
  202. package/src/js/helpers/init.SlotPicker.js +0 -89
  203. package/src/js/helpers/init.js +0 -308
  204. package/src/js/helpers/logging.js +0 -78
  205. package/src/js/helpers/mocks.js +0 -871
  206. package/src/js/helpers/slots.js +0 -340
  207. package/src/js/helpers/slots.rules.js +0 -220
  208. package/src/js/helpers/theming.js +0 -93
  209. package/src/js/helpers/translations.js +0 -42
  210. package/src/js/helpers/tz-list.js +0 -136
  211. package/src/js/helpers/utils.AvailabilityRules.js +0 -110
  212. package/src/js/helpers/utils.AvailabilityViewer.js +0 -789
  213. package/src/js/helpers/utils.CalendarSync.js +0 -199
  214. package/src/js/helpers/utils.js +0 -76
  215. package/src/js/hooks/useWindowSize.js +0 -20
  216. package/src/js/main.js +0 -133
  217. package/src/js/next.js +0 -37
  218. package/src/js/styles/_settings.utils.scss +0 -82
  219. package/src/js/styles/colors.js +0 -13
  220. package/src/js/styles/global.js +0 -49
  221. package/src/js/styles/utils.js +0 -81
  222. package/src/js/translations/de/agenda.json +0 -12
  223. package/src/js/translations/de/availability_rules.json +0 -18
  224. package/src/js/translations/de/availability_viewer.json +0 -14
  225. package/src/js/translations/de/calendar_sync.json +0 -14
  226. package/src/js/translations/de/core.json +0 -15
  227. package/src/js/translations/de/date_time_picker.json +0 -14
  228. package/src/js/translations/de/slot_picker.json +0 -9
  229. package/src/js/translations/de/time_zones.json +0 -135
  230. package/src/js/translations/en/agenda.json +0 -12
  231. package/src/js/translations/en/availability_rules.json +0 -18
  232. package/src/js/translations/en/availability_viewer.json +0 -14
  233. package/src/js/translations/en/calendar_sync.json +0 -14
  234. package/src/js/translations/en/core.json +0 -23
  235. package/src/js/translations/en/date_time_picker.json +0 -15
  236. package/src/js/translations/en/slot_picker.json +0 -9
  237. package/src/js/translations/en/time_zones.json +0 -17
  238. package/src/js/translations/es/agenda.json +0 -12
  239. package/src/js/translations/es/availability_rules.json +0 -18
  240. package/src/js/translations/es/availability_viewer.json +0 -14
  241. package/src/js/translations/es/calendar_sync.json +0 -14
  242. package/src/js/translations/es/core.json +0 -15
  243. package/src/js/translations/es/date_time_picker.json +0 -14
  244. package/src/js/translations/es/slot_picker.json +0 -9
  245. package/src/js/translations/es/time_zones.json +0 -203
  246. package/src/js/translations/fr/agenda.json +0 -12
  247. package/src/js/translations/fr/availability_rules.json +0 -18
  248. package/src/js/translations/fr/availability_viewer.json +0 -14
  249. package/src/js/translations/fr/calendar_sync.json +0 -14
  250. package/src/js/translations/fr/core.json +0 -15
  251. package/src/js/translations/fr/date_time_picker.json +0 -14
  252. package/src/js/translations/fr/slot_picker.json +0 -9
  253. package/src/js/translations/fr/time_zones.json +0 -161
  254. package/src/js/translations/fr-CA/agenda.json +0 -12
  255. package/src/js/translations/fr-CA/availability_rules.json +0 -18
  256. package/src/js/translations/fr-CA/availability_viewer.json +0 -14
  257. package/src/js/translations/fr-CA/calendar_sync.json +0 -14
  258. package/src/js/translations/fr-CA/core.json +0 -23
  259. package/src/js/translations/fr-CA/date_time_picker.json +0 -14
  260. package/src/js/translations/fr-CA/slot_picker.json +0 -9
  261. package/src/js/translations/fr-CA/time_zones.json +0 -163
  262. package/src/js/translations/it/agenda.json +0 -12
  263. package/src/js/translations/it/availability_rules.json +0 -18
  264. package/src/js/translations/it/availability_viewer.json +0 -14
  265. package/src/js/translations/it/calendar_sync.json +0 -14
  266. package/src/js/translations/it/core.json +0 -15
  267. package/src/js/translations/it/date_time_picker.json +0 -14
  268. package/src/js/translations/it/slot_picker.json +0 -9
  269. package/src/js/translations/it/time_zones.json +0 -126
  270. package/src/js/translations/ja/agenda.json +0 -12
  271. package/src/js/translations/ja/availability_rules.json +0 -18
  272. package/src/js/translations/ja/availability_viewer.json +0 -14
  273. package/src/js/translations/ja/calendar_sync.json +0 -14
  274. package/src/js/translations/ja/core.json +0 -15
  275. package/src/js/translations/ja/date_formats.json +0 -5
  276. package/src/js/translations/ja/date_time_picker.json +0 -14
  277. package/src/js/translations/ja/slot_picker.json +0 -9
  278. package/src/js/translations/ja/time_zones.json +0 -435
  279. package/src/js/translations/nl/agenda.json +0 -12
  280. package/src/js/translations/nl/availability_rules.json +0 -18
  281. package/src/js/translations/nl/availability_viewer.json +0 -14
  282. package/src/js/translations/nl/calendar_sync.json +0 -14
  283. package/src/js/translations/nl/core.json +0 -15
  284. package/src/js/translations/nl/date_time_picker.json +0 -14
  285. package/src/js/translations/nl/slot_picker.json +0 -9
  286. package/src/js/translations/nl/time_zones.json +0 -118
  287. package/src/js/translations/ru/agenda.json +0 -12
  288. package/src/js/translations/ru/availability_rules.json +0 -18
  289. package/src/js/translations/ru/availability_viewer.json +0 -14
  290. package/src/js/translations/ru/calendar_sync.json +0 -14
  291. package/src/js/translations/ru/core.json +0 -15
  292. package/src/js/translations/ru/date_time_picker.json +0 -14
  293. package/src/js/translations/ru/slot_picker.json +0 -9
  294. package/src/js/translations/ru/time_zones.json +0 -435
  295. package/src/js/translations/sv/agenda.json +0 -12
  296. package/src/js/translations/sv/availability_rules.json +0 -18
  297. package/src/js/translations/sv/availability_viewer.json +0 -14
  298. package/src/js/translations/sv/calendar_sync.json +0 -14
  299. package/src/js/translations/sv/core.json +0 -15
  300. package/src/js/translations/sv/date_time_picker.json +0 -14
  301. package/src/js/translations/sv/slot_picker.json +0 -9
  302. package/src/js/translations/sv/time_zones.json +0 -136
  303. package/tests/AvailabilityRules/AvailabilityRules.test.js +0 -39
  304. package/tests/AvailabilityRules/__snapshots__/AvailabilityRules.test.js.snap +0 -1045
  305. package/tests/AvailabilityViewer/Navigation.test.js +0 -130
  306. package/tests/AvailabilityViewer/contexts/page-reducer.test.js +0 -87
  307. package/tests/AvailabilityViewer/reducer.test.js +0 -73
  308. package/tests/CalendarSync/Active.test.js +0 -25
  309. package/tests/CalendarSync/AddToggle.test.js +0 -57
  310. package/tests/CalendarSync/EditToggle.test.js +0 -57
  311. package/tests/CalendarSync/Inactive.test.js +0 -26
  312. package/tests/CalendarSync/Pending.test.js +0 -25
  313. package/tests/CalendarSync/ProviderLogo.test.js +0 -95
  314. package/tests/CalendarSync/__snapshots__/Active.test.js.snap +0 -61
  315. package/tests/CalendarSync/__snapshots__/Inactive.test.js.snap +0 -78
  316. package/tests/CalendarSync/__snapshots__/Pending.test.js.snap +0 -90
  317. package/tests/CalendarSync/__snapshots__/ProviderLogo.test.js.snap +0 -267
  318. package/tests/CalendarSync/init.CalendarSync.test.js +0 -302
  319. package/tests/CalendarSync/mocks/theme.js +0 -14
  320. package/tests/CalendarSync/status-reducer.test.js +0 -435
  321. package/tests/DateTimePicker/SequencedSlotButton.test.js +0 -157
  322. package/tests/DateTimePicker/SlotButton.test.js +0 -118
  323. package/tests/DateTimePicker/contexts/status-reducer.test.js +0 -1036
  324. package/tests/DateTimePicker/dummy-data.js +0 -883
  325. package/tests/DateTimePicker/utils.test.js +0 -515
  326. package/tests/colors.test.js +0 -70
  327. package/tests/components/TimezoneSelector.test.js +0 -124
  328. package/tests/components/main.test.js +0 -203
  329. package/tests/components/rtl-utils.js +0 -32
  330. package/tests/connections.test.js +0 -684
  331. package/tests/events.test.js +0 -472
  332. package/tests/generator.test.js +0 -74
  333. package/tests/i18n.test.js +0 -255
  334. package/tests/init.Agenda.test.js +0 -122
  335. package/tests/init.AvailabilityRules.test.js +0 -279
  336. package/tests/init.AvailabilityViewer.test.js +0 -740
  337. package/tests/init.SlotPicker.test.js +0 -166
  338. package/tests/init.test.js +0 -231
  339. package/tests/logging.test.js +0 -235
  340. package/tests/mocks/i18n.js +0 -3
  341. package/tests/mocks/theme.js +0 -3
  342. package/tests/setupJest.js +0 -8
  343. package/tests/slots.rules.test.js +0 -195
  344. package/tests/slots.test.js +0 -278
  345. package/tests/utils.AvailabilityRules.test.js +0 -221
  346. package/tests/utils.AvailabilityViewer.test.js +0 -1800
  347. package/tests/utils.CalendarSync.test.js +0 -277
  348. package/tests/utils.test.js +0 -119
  349. package/webpack.config.js +0 -114
@@ -1,340 +0,0 @@
1
- import moment from "moment-timezone";
2
- import { uniqueItems } from "./utils";
3
-
4
- export const keyFormat = "YYYY-MM-DDTHH:mm:00Z";
5
- export const shortKeyFormat = "YYYY-MM-DDTHH:mm[:00Z]";
6
-
7
- export const getDaysFromAvailablePeriods = (periods, locale, tzid) => {
8
- return periods.reduce((slots, period) => {
9
- const startTime = moment(period.start).tz(tzid).locale(locale);
10
- const endTime = moment(period.end).tz(tzid).locale(locale);
11
- const formattedDay = startTime.format(`YYYY-MM-DD`);
12
-
13
- if (slots[formattedDay] === undefined) {
14
- slots[formattedDay] = {
15
- value: formattedDay,
16
- label: startTime.format(`dddd Do MMMM`),
17
- slots: [],
18
- };
19
- }
20
-
21
- const periodLabel = `${formatSlotTimeLabel(startTime)} - ${formatSlotTimeLabel(endTime)}`;
22
-
23
- slots[formattedDay].slots.push({
24
- label: periodLabel,
25
- value: period,
26
- });
27
-
28
- return slots;
29
- }, {});
30
- };
31
-
32
- const formatSlotTimeLabel = time => time.format("LT").replace(" ", "");
33
-
34
- export const slotsFromPeriod = (period, duration, acc = []) => {
35
- const start = moment.utc(period.start, keyFormat);
36
- const end = moment.utc(period.end, keyFormat);
37
- const slotEnd = start.add(duration, "minutes");
38
-
39
- if (slotEnd.diff(end, "minutes") > 0) {
40
- return acc;
41
- }
42
-
43
- if (slotEnd.diff(end, "minutes") === 0) {
44
- return [
45
- ...acc,
46
- {
47
- start: period.start,
48
- end: period.end,
49
- participants: period.participants || [],
50
- },
51
- ];
52
- }
53
-
54
- return slotsFromPeriod(
55
- {
56
- start: slotEnd.format(shortKeyFormat),
57
- end: period.end,
58
- participants: period.participants || [],
59
- },
60
- duration,
61
- [
62
- ...acc,
63
- {
64
- start: period.start,
65
- end: slotEnd.format(shortKeyFormat),
66
- participants: period.participants || [],
67
- },
68
- ]
69
- );
70
- };
71
-
72
- export const roundToNextHour = time =>
73
- time.minute() || time.second() || time.millisecond()
74
- ? time.add(1, "hour").startOf("hour")
75
- : time.startOf("hour");
76
-
77
- export const roundToNextHalfHour = time => {
78
- const remainder = 30 - (time.minute() % 30);
79
- return time.minute() % 30 !== 0 || time.second() || time.millisecond()
80
- ? time.add(remainder, "minutes")
81
- : time;
82
- };
83
-
84
- export const roundToNextQuarterHour = time => {
85
- const remainder = 15 - (time.minute() % 15);
86
- return time.minute() % 15 !== 0 || time.second() || time.millisecond()
87
- ? time.add(remainder, "minutes")
88
- : time;
89
- };
90
-
91
- export const roundPeriod = (
92
- period,
93
- duration,
94
- hour = roundToNextHour,
95
- half = roundToNextHalfHour,
96
- quarter = roundToNextQuarterHour
97
- ) => {
98
- let start = moment.utc(period.start, keyFormat);
99
- const startIsHalfHour =
100
- start.minute() === 30 && start.second() === 0 && start.millisecond() === 0;
101
- const startIsQuarter =
102
- start.minute() % 15 === 0 && start.second() === 0 && start.millisecond() === 0;
103
-
104
- if (duration > 30 && !startIsHalfHour && !startIsQuarter) {
105
- start = hour(start);
106
- } else if (duration > 15 && !startIsQuarter) {
107
- start = half(start);
108
- } else {
109
- start = quarter(start);
110
- }
111
-
112
- return { ...period, start: start.format(shortKeyFormat) };
113
- };
114
-
115
- export const parsePeriodsIntoSlots = (periods, duration = 30, getSlots = slotsFromPeriod) =>
116
- periods.reduce((acc, period) => {
117
- const roundedPeriod = roundPeriod(period, duration);
118
- const newSlots = getSlots(roundedPeriod, duration);
119
- return [...acc, ...newSlots];
120
- }, []);
121
-
122
- export const getWeekDays = startDate => {
123
- const start = moment.utc(startDate, keyFormat);
124
- const startOfWeek = start.startOf("isoWeek").subtract(1, "days");
125
- return [
126
- startOfWeek.format("YYYY-MM-DD"),
127
- startOfWeek.add(1, "days").format("YYYY-MM-DD"),
128
- startOfWeek.add(1, "days").format("YYYY-MM-DD"),
129
- startOfWeek.add(1, "days").format("YYYY-MM-DD"),
130
- startOfWeek.add(1, "days").format("YYYY-MM-DD"),
131
- startOfWeek.add(1, "days").format("YYYY-MM-DD"),
132
- startOfWeek.add(1, "days").format("YYYY-MM-DD"),
133
- ];
134
- };
135
-
136
- export const createEmptySlotsForPeriod = (period, duration, tzid = false, acc = []) => {
137
- // Work out the slot end (by adding the duration to the rounded period's start)
138
- const slotEnd = moment.utc(moment.utc(period.start, keyFormat).add(duration, "minutes"));
139
-
140
- let duringDSTChangeover = false;
141
- // If we have a timezone to work with, check if we're inside a DST changeover.
142
- if (tzid) {
143
- // Get the local time.
144
- const localStart = moment(period.start, keyFormat).clone().tz(tzid);
145
- // Get the time an hour after the local start time.
146
- const localStartPlusHour = localStart.clone().add(60, "minutes").tz(tzid);
147
-
148
- // If the two *local* times are the same, then we're in the middle of a DST change.
149
- duringDSTChangeover = localStart.format("HH:mm") === localStartPlusHour.format("HH:mm");
150
- }
151
-
152
- // Check the difference between the slot end and the period end
153
- const endDiff = slotEnd.diff(moment.utc(period.end, keyFormat), "minutes");
154
-
155
- // if the slot-end is *after* the period-end, then we should do
156
- // nothing (and return the accumulated array of slots)
157
- if (endDiff > 0) {
158
- return acc;
159
- }
160
-
161
- // ...otherwise, (i.e. the slot-end is *before* the period-end) we
162
- // need to reset the period-start, and add a new slot to the
163
- // accumulating array of slots.
164
- const updatedPeriod = {
165
- start: slotEnd.format(shortKeyFormat),
166
- end: period.end,
167
- };
168
-
169
- const accumulatedSlots = [
170
- ...acc,
171
- {
172
- start: period.start,
173
- end: slotEnd.format(shortKeyFormat),
174
- },
175
- ];
176
- // ...then we recursively pass these into this very function to
177
- // begin the process all over again (repeating until a slot would
178
- // finish *after* the period has ended).
179
- if (!duringDSTChangeover) {
180
- return createEmptySlotsForPeriod(updatedPeriod, duration, tzid, accumulatedSlots);
181
- }
182
-
183
- // But if we're inside a DST-changeover, then we recur *without* adding to the slots.
184
- return createEmptySlotsForPeriod(updatedPeriod, duration, tzid, acc);
185
- };
186
-
187
- export const generateDummySlots = () => {
188
- const startOfCurrentWeek = moment.utc().startOf("isoWeek").subtract(1, "days");
189
- return [
190
- {
191
- day: startOfCurrentWeek.format("YYYY-MM-DD"),
192
- slots: [],
193
- },
194
- {
195
- day: startOfCurrentWeek.add(1, "days").format("YYYY-MM-DD"),
196
- slots: [],
197
- },
198
- {
199
- day: startOfCurrentWeek.add(1, "days").format("YYYY-MM-DD"),
200
- slots: [],
201
- },
202
- {
203
- day: startOfCurrentWeek.add(1, "days").format("YYYY-MM-DD"),
204
- slots: [],
205
- },
206
- {
207
- day: startOfCurrentWeek.add(1, "days").format("YYYY-MM-DD"),
208
- slots: [],
209
- },
210
- {
211
- day: startOfCurrentWeek.add(1, "days").format("YYYY-MM-DD"),
212
- slots: [],
213
- },
214
- {
215
- day: startOfCurrentWeek.add(1, "days").format("YYYY-MM-DD"),
216
- slots: [],
217
- },
218
- ];
219
- };
220
-
221
- export const timeLabels = (limits, day, tzid) => {
222
- // If the endTime is an early hour than the startTime, that means
223
- // the period overflows a day boundary.
224
-
225
- const isEndBeforeStart = parseInt(limits.start, 10) >= parseInt(limits.end, 10);
226
-
227
- // If the end does overflow a day boundary, we need to increment the
228
- // end day to account for this.
229
- const endDay =
230
- isEndBeforeStart || limits.start === limits.end
231
- ? moment.tz(day, "YYYY-MM-DD", tzid).add(1, "days").format("YYYY-MM-DD")
232
- : day;
233
-
234
- const timeLabelPeriod = {
235
- start: moment
236
- .tz(`${day}T${limits.start}`, "YYYY-MM-DDTHH:mm", tzid)
237
- .utc()
238
- .format(shortKeyFormat),
239
- end: moment
240
- .tz(`${endDay}T${limits.end}`, "YYYY-MM-DDTHH:mm", tzid)
241
- .utc()
242
- .format(shortKeyFormat),
243
- };
244
- const slots = createEmptySlotsForPeriod(timeLabelPeriod, limits.interval);
245
- const timeSlots = labelTimeSlots(slots);
246
- return timeSlots;
247
- };
248
-
249
- const labelTimeSlots = slots =>
250
- slots.map(slot => {
251
- const start = moment.utc(slot.start, keyFormat);
252
- const onTheHour = start.minutes() === 0;
253
- return { ...slot, hour: onTheHour };
254
- });
255
-
256
- export const getSlotsForPage = (slots = [], page = 1) => {
257
- if (slots.length < 7 * page) {
258
- return slots;
259
- }
260
-
261
- const start = (page - 1) * 7;
262
- const end = start + 7;
263
-
264
- return slots.slice(start, end);
265
- };
266
-
267
- export const calculateSlotHeight = limits => ({
268
- overflow: limits.duration / limits.interval - 1,
269
- multiple: limits.duration / limits.interval,
270
- height: limits.interval,
271
- });
272
-
273
- export const filterOverflowingSlots = (slots, overflow) =>
274
- slots.filter((slot, i) => {
275
- // Always return true (a.k.a. keep the slot) if it's unavailable.
276
- if (!slot.available) return true;
277
-
278
- // If any of the next [N = overflow] slots are
279
- // unavailable, then this post should be removed because it
280
- // would overflow the available period.
281
- for (let j = 1; j <= overflow; j++) {
282
- if (!slots[i + j] || !slots[i + j].available) {
283
- return false;
284
- }
285
- }
286
-
287
- // ...otherwise, keep the slot.
288
- return true;
289
- });
290
-
291
- export const getMonthsDescription = (days, locale) => {
292
- const coverage = days
293
- .map(day => moment.utc(day, "YYYY-MM-DD"))
294
- .reduce(
295
- (acc, curr) => {
296
- acc.months.push(curr.locale(locale).format("MMM"));
297
- acc.years.push(curr.locale(locale).format("YYYY"));
298
- return acc;
299
- },
300
- { months: [], years: [], combi: [] }
301
- );
302
-
303
- const months = uniqueItems(coverage.months);
304
- const years = uniqueItems(coverage.years);
305
-
306
- let result = "";
307
-
308
- // Does the period span 2 months and 2 years? (spanning 2 years but only 1 month is impossible)
309
- if (years.length > 1 && months.length > 1) {
310
- // N.B. this code relies on there being a max of 2 months in a single view
311
- result = `${months[0]} ${years[0]} - ${months[1]} ${years[1]}`;
312
- } else {
313
- result = `${months.join(" - ")} ${years[0]}`;
314
- }
315
- return result;
316
- };
317
-
318
- export const convertLocalToUTC = (timeString, tzid) => {
319
- const utcOffset = moment.tz(tzid).utcOffset();
320
- const invertedOffset = Math.sign(utcOffset) === -1 ? Math.abs(utcOffset) : 0 - utcOffset;
321
- const offset = invertedOffset / 60;
322
-
323
- const time = `${moment().format("YYYY-MM-DD")}T${timeString}:00Z`;
324
- const adjusted = moment(time).add(offset, "hours");
325
- const formatted = adjusted.utc().format("HH:mm");
326
-
327
- return formatted;
328
- };
329
-
330
- export const convertUTCToLocal = (timeString, tzid) => {
331
- const utcOffset = moment.tz(tzid).utcOffset();
332
- const invertedOffset = Math.sign(utcOffset) === -1 ? Math.abs(utcOffset) : 0 - utcOffset;
333
- const offset = invertedOffset / 60;
334
-
335
- const time = `${moment().format("YYYY-MM-DD")}T${timeString}:00Z`;
336
- const adjusted = moment(time).subtract(offset, "hours");
337
- const formatted = adjusted.utc().format("HH:mm");
338
-
339
- return formatted;
340
- };
@@ -1,220 +0,0 @@
1
- import moment from "moment-timezone";
2
-
3
- import { buildSlotID } from "./utils.AvailabilityRules";
4
-
5
- export const getWeekDays = (startDay = "sunday") => {
6
- const dayOrders = {
7
- sunday: [0, 1, 2, 3, 4, 5, 6],
8
- monday: [1, 2, 3, 4, 5, 6, 0],
9
- tuesday: [2, 3, 4, 5, 6, 0, 1],
10
- wednesday: [3, 4, 5, 6, 0, 1, 2],
11
- thursday: [4, 5, 6, 0, 1, 2, 3],
12
- friday: [5, 6, 0, 1, 2, 3, 4],
13
- saturday: [6, 0, 1, 2, 3, 4, 5],
14
- };
15
- const dayNames = Object.keys(dayOrders);
16
- return dayOrders[startDay].map(day => dayNames[day]);
17
- };
18
-
19
- export const getStaticTimeSlots = (duration, i18n) => {
20
- const slots = [];
21
-
22
- for (let hour = 0; hour < 24; hour++) {
23
- const slotsPerHour = 60 / duration;
24
- for (let slot = 0; slot < slotsPerHour; slot++) {
25
- const startMintes = slot * duration;
26
-
27
- const endMintes = (startMintes + duration) % 60;
28
-
29
- const endHour = startMintes + duration >= 60 ? hour + 1 : hour;
30
- const hourString = hour.toString().padStart(2, "0");
31
- const timeString = startMintes.toString().padStart(2, "0");
32
- const hourStringEnd = endHour.toString().padStart(2, "0");
33
- const timeStringEnd = endMintes.toString().padStart(2, "0");
34
-
35
- const startString = `${hourString}:${timeString}`;
36
- const endString = `${hourStringEnd}:${timeStringEnd}`;
37
-
38
- const startTimeObject = moment(startString, "HH:mm");
39
- const startTimeString = i18n.f(startTimeObject, "LT");
40
-
41
- const endTimeObject = moment(endString, "HH:mm");
42
- const endTimeString = i18n.f(endTimeObject, "LT");
43
-
44
- slots.push({
45
- start: startString,
46
- end: endString,
47
- label: `${startTimeString} - ${endTimeString}`,
48
- });
49
- }
50
- }
51
- return slots;
52
- };
53
-
54
- export const generateEmptyRulesSlots = (duration, startDay = "sunday", i18n) => {
55
- const days = getWeekDays(startDay);
56
-
57
- const slotTimes = getStaticTimeSlots(duration, i18n);
58
- const slots = {};
59
-
60
- days.forEach((day, day_index) => {
61
- slotTimes.forEach((slot, slot_index) => {
62
- const slotID = buildSlotID(day_index, slot_index);
63
- slots[slotID] = {
64
- day: day,
65
- start: slot.start,
66
- label: slot.label,
67
- end: slot.end,
68
- available: false,
69
- id: slotID,
70
- dragged: false,
71
- };
72
- });
73
- });
74
- return slots;
75
- };
76
-
77
- export const isSlotWithinPeriod = (slot, periods) => {
78
- const availability = periods.map(period => {
79
- // If the day doesn't match, let's stop checking...
80
- if (period.day !== slot.day) {
81
- return false;
82
- }
83
-
84
- // Account for slots that end at midnight
85
- const twentyfourHourSlotEnd = slot.end === "00:00" ? "24:00" : slot.end;
86
-
87
- // If the end_time is before the slot's start, let's stop checking...
88
- const slotStart = moment(slot.start, "HH:mm");
89
- const periodEnd = moment(period.end_time, "HH:mm");
90
- const diff_1 = periodEnd.diff(slotStart, "minutes");
91
- if (diff_1 <= 0) {
92
- // console.log(`${period.end_time} is before ${slot.start}`);
93
- return false;
94
- }
95
- // If the start_time is after the slot's end, let's stop checking...
96
- const slotEnd = moment(twentyfourHourSlotEnd, "HH:mm");
97
- const periodStart = moment(period.start_time, "HH:mm");
98
- const diff_2 = slotEnd.diff(periodStart, "minutes");
99
- if (diff_2 <= 0) {
100
- // console.log(
101
- // `${period.start_time} is after (or equal to) ${twentyfourHourSlotEnd}`
102
- // );
103
- return false;
104
- }
105
- // If the start_time is after the slot's start, let's stop checking... (because
106
- // we only want slots that are *completely* within the available period)
107
- const diff_3 = slotStart.diff(periodStart, "minutes");
108
- if (diff_3 < 0) {
109
- // console.log(`${period.start_time} is after ${slot.start}`);
110
- return false;
111
- }
112
- // If we've got this far, then the slot must be within the period 👍👍👍
113
- return true;
114
- });
115
- // Are any of the periods "available"?
116
- const available = availability.some(item => item);
117
- return available;
118
- };
119
-
120
- export const checkSlotAvailability = (periods, emptySlots) => {
121
- const checkedSlots = {};
122
- Object.keys(emptySlots).map(key => {
123
- const slot = emptySlots[key];
124
- checkedSlots[key] = {
125
- ...slot,
126
- available: isSlotWithinPeriod(slot, periods),
127
- };
128
- });
129
- return checkedSlots;
130
- };
131
-
132
- export const findSlotsByDay = (slots, day) => slots.filter(slot => slot.day === day);
133
-
134
- export const parseSlotsIntoDays = (slots, slotsPerDay, slotsOffset = 0) => {
135
- const dayNumbers = [0, 1, 2, 3, 4, 5, 6];
136
- const dayNames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
137
-
138
- return dayNumbers.map(day => {
139
- const daySlots = [];
140
- for (let i = slotsOffset; i < slotsOffset + slotsPerDay; i++) {
141
- const slotID = buildSlotID(day, i);
142
- const slot = slots[slotID];
143
- daySlots.push(slot);
144
- }
145
- return { day: dayNames[day], slots: daySlots };
146
- });
147
- };
148
-
149
- export const buildNewRules = slots => {
150
- const rules = [];
151
- const mappableSlots = Object.keys(slots).map(key => slots[key]);
152
- const onlyAvailableSlots = mappableSlots.filter(slot => slot.available);
153
- for (let i = 0; i < onlyAvailableSlots.length; i++) {
154
- const slot = onlyAvailableSlots[i];
155
- if (slot) {
156
- const day = slot.day;
157
- const start_time = slot.start;
158
-
159
- const ending = getEndTime(onlyAvailableSlots, i, slot.end);
160
-
161
- const twentyfourHourEnd = ending.end === "00:00" ? "24:00" : ending.end;
162
-
163
- const rule = {
164
- day,
165
- start_time,
166
- end_time: twentyfourHourEnd,
167
- };
168
- rules.push(rule);
169
- for (let j = i; j <= ending.index; j++) {
170
- onlyAvailableSlots[j] = false;
171
- }
172
- }
173
- }
174
- return rules;
175
- };
176
-
177
- export const getEndTime = (slots, index, end) => {
178
- const currentSlot = slots[index];
179
- const nextSlot = slots[index + 1];
180
- const nextSlotOverlaps =
181
- nextSlot && nextSlot.day === currentSlot.day && nextSlot.start === currentSlot.end;
182
- if (nextSlotOverlaps) {
183
- return getEndTime(slots, index + 1, nextSlot.end);
184
- }
185
- return { end, index };
186
- };
187
-
188
- export const connectSlots = (start_id, current_id) => {
189
- const start_indexes = start_id.split("_");
190
- const end___indexes = current_id.split("_");
191
-
192
- const indexes = [
193
- {
194
- x: parseInt(start_indexes[0], 10),
195
- y: parseInt(start_indexes[1], 10),
196
- },
197
- {
198
- x: parseInt(end___indexes[0], 10),
199
- y: parseInt(end___indexes[1], 10),
200
- },
201
- ];
202
-
203
- indexes.sort((a, b) => {
204
- if (a.y < b.y) {
205
- return -1;
206
- }
207
- if (a.y > b.y) {
208
- return 1;
209
- }
210
- return 0;
211
- });
212
-
213
- let dragged = [];
214
-
215
- for (let i = indexes[0].y; i <= indexes[1].y; i++) {
216
- dragged.push(buildSlotID(start_indexes[0], i));
217
- }
218
-
219
- return dragged;
220
- };
@@ -1,93 +0,0 @@
1
- import { darken, lighten } from "polished";
2
- import { objectToArray } from "./utils";
3
-
4
- export const logColor = color =>
5
- console.log(`%c ${color.padEnd(25, " ")} `, `background: ${color};`);
6
-
7
- export const parseStyleOptions = (
8
- styleOptions = {},
9
- elementName = "CronofyElement",
10
- options = {}
11
- ) => {
12
- let customColors = {};
13
- if (typeof options.colors !== "undefined") {
14
- console.warn("`colors` option has been deprecated. Please use `styles.colors` instead.");
15
- customColors = options.colors;
16
- }
17
- const calendars = customColors.calendars || {};
18
- const colors = styleOptions.colors || {};
19
- const theme = {
20
- ...styleOptions,
21
- prefix: styleOptions.prefix || elementName,
22
- name: elementName,
23
- colors: {
24
- calendars: calendars,
25
- hairline: "#D8D8D8",
26
- primary: "#15B3D6",
27
- primaryLight: "#B8E8F2",
28
- secondary: "#CB359B",
29
- background: "#F2F2F2",
30
- booked: "#E3E3E3",
31
- bookedSelected: "#DBECC9",
32
- available: "#E2FAC8",
33
- availableHover: "#C0E992",
34
- availableActive: "#7ED321",
35
- unavailable: "#FFFFFF",
36
- unavailableHover: "#E6E6E6",
37
- unavailableActive: "#CCCCCC",
38
- black: "#4D4D4D",
39
- grey: "#6F6F6F",
40
- greyMid: "#999999",
41
- greyLight: "#E4EBF2",
42
- greyPale: "#F5F7F9",
43
- white: "#FFFFFF",
44
- red: "#DC3E15",
45
- redLight: "#EA8B73",
46
- redDark: "#C23712",
47
- yellow: "#F5A623",
48
- green: "#7ED321",
49
- greenLight: "#C0E992",
50
- ...colors,
51
- },
52
- };
53
- if (colors.unavailable && !colors.unavailableHover) {
54
- theme.colors.unavailableHover = darken(0.1, theme.colors.unavailable);
55
- }
56
-
57
- if (colors.available && !colors.availableHover) {
58
- theme.colors.availableHover = darken(0.1, colors.available);
59
- }
60
-
61
- if (colors.available && !colors.availableActive) {
62
- theme.colors.availableActive = darken(0.2, colors.available);
63
- }
64
- if (colors.unavailable && !colors.unavailableActive) {
65
- theme.colors.unavailableActive = darken(0.2, colors.unavailable);
66
- }
67
-
68
- theme.colors.whiteDark = darken(0.1, theme.colors.white);
69
- theme.colors.primaryDark = darken(0.1, theme.colors.primary);
70
- theme.colors.secondaryDark = darken(0.1, theme.colors.secondary);
71
- theme.colors.secondaryLight = lighten(0.1, theme.colors.secondary);
72
-
73
- // logColor(theme.colors.unavailable);
74
- // logColor(theme.colors.unavailableHover);
75
- // logColor(theme.colors.unavailableActive);
76
- // logColor(theme.colors.available);
77
- // logColor(theme.colors.availableHover);
78
- // logColor(theme.colors.availableActive);
79
- return theme;
80
- };
81
-
82
- export const parseCustomProperties = colors =>
83
- objectToArray(colors)
84
- .filter(color => typeof color.value === "string")
85
- .map(color => ({ [`--${color.key}`]: color.value }))
86
- .reduce((acc, color) => ({ ...acc, ...color }), {});
87
-
88
- export const classBuilder = (prefix, name) => slugs => {
89
- if (!slugs) return `${prefix} ${name}`;
90
- const slugsList = slugs.split(" ");
91
- const className = slugsList.map(slug => `${prefix}__${slug} ${name}__${slug}`).join(" ");
92
- return className;
93
- };
@@ -1,42 +0,0 @@
1
- const requireTranslationFile = (locale, context) => {
2
- try {
3
- return require(`../translations/${locale}/${context}.json`);
4
- } catch (e) {
5
- // We don't expect a file for every context - some things fallback
6
- return false;
7
- }
8
- };
9
-
10
- const getTranslationsFromJson = (locales, contexts) => {
11
- let translations = {};
12
-
13
- locales.forEach(locale => {
14
- contexts.forEach(context => {
15
- const loaded = requireTranslationFile(locale, context);
16
-
17
- if (loaded) {
18
- if (!translations[locale]) {
19
- translations[locale] = {};
20
- }
21
- translations[locale][context] = loaded[context];
22
- }
23
- });
24
- });
25
-
26
- return translations;
27
- };
28
-
29
- const locales = ["de", "en", "en-US", "es", "fr", "fr-CA", "it", "ja", "nl", "ru", "sv"];
30
-
31
- const contexts = [
32
- "core",
33
- "agenda",
34
- "availability_rules",
35
- "availability_viewer",
36
- "calendar_sync",
37
- "date_time_picker",
38
- "slot_picker",
39
- "time_zones",
40
- ];
41
-
42
- export const translations = getTranslationsFromJson(locales, contexts);