@koine/react 1.0.11 → 1.0.14

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 (323) hide show
  1. package/Alert/Alert.js +7 -13
  2. package/Animations/Reveal.js +12 -10
  3. package/Animations/Underline.js +3 -13
  4. package/Animations/useReveal.js +18 -17
  5. package/Autocomplete/AutocompleteDownshift.js +1 -1
  6. package/Autocomplete/AutocompleteDownshiftMultiselect.js +1 -1
  7. package/Autocomplete/AutocompleteMui.js +61 -56
  8. package/Autocomplete/AutocompleteReach.js +1 -1
  9. package/Autocomplete/components.js +17 -72
  10. package/Autocomplete/helpers.js +1 -1
  11. package/Bg/BgColor.js +14 -24
  12. package/Bg/BgPhoto.js +11 -54
  13. package/Bg/BgSvg.js +6 -9
  14. package/Breadcrumbs/Breadcrumbs.js +14 -54
  15. package/Buttons/Button.js +8 -73
  16. package/Buttons/ButtonComposite.js +20 -41
  17. package/Buttons/ButtonFab.js +4 -6
  18. package/Buttons/ButtonLink.js +7 -6
  19. package/Buttons/IconButton.js +5 -17
  20. package/Calendar/CalendarDaygridCell.js +20 -14
  21. package/Calendar/CalendarDaygridNav.js +10 -9
  22. package/Calendar/CalendarDaygridTable.js +32 -30
  23. package/Calendar/CalendarLegend.js +7 -2
  24. package/Calendar/calendar-api-google.js +101 -68
  25. package/Calendar/useCalendar.js +114 -113
  26. package/Calendar/utils.js +73 -74
  27. package/Carousel/Carousel.js +1 -1
  28. package/Carousel/CarouselCss.js +12 -26
  29. package/Collapsable/Collapsable.js +1 -1
  30. package/Debug/Debug.js +5 -17
  31. package/Details/Details.js +30 -27
  32. package/Dialog/DialogMui.js +22 -20
  33. package/Dialog/css/bare.js +17 -15
  34. package/Dialog/m/bare.js +17 -13
  35. package/Dialog/m/basic.js +2 -2
  36. package/Dialog/m/index.js +4 -4
  37. package/Dialog/sc/bare.js +25 -43
  38. package/Dialog/sc/framer.js +6 -6
  39. package/Dialog/sc/framerMaterial.js +6 -6
  40. package/Dialog/sc/material.js +17 -37
  41. package/Dialog/tw/bare.js +25 -19
  42. package/Dialog/tw/elegant.js +17 -15
  43. package/Dialog/tw/framer.js +6 -6
  44. package/Dialog/tw/framerMaterial.js +6 -6
  45. package/Dialog/tw/material.js +17 -15
  46. package/Editor/Editor--tiptap.js +14 -11
  47. package/Editor/components.js +6 -24
  48. package/Favicon/FaviconTags.js +2 -1
  49. package/Form/Form.js +30 -28
  50. package/Form/sc/bare.js +9 -18
  51. package/Forms/Checkbox/Checkbox.js +9 -15
  52. package/Forms/Feedback/Feedback.js +6 -7
  53. package/Forms/Field/Field.js +15 -26
  54. package/Forms/Field/FieldControl.js +19 -15
  55. package/Forms/Field/FieldHint.js +3 -5
  56. package/Forms/Input/Input.js +10 -16
  57. package/Forms/InputGroup/InputGroup.js +9 -36
  58. package/Forms/Label/Label.js +5 -23
  59. package/Forms/Password/Password.js +10 -23
  60. package/Forms/Radio/Radio.js +15 -18
  61. package/Forms/Switch/Switch.js +9 -39
  62. package/Forms/Textarea/Textarea.js +6 -7
  63. package/Forms/Textarea/TextareaRich.js +10 -24
  64. package/Forms/Toggle/Toggle.js +19 -67
  65. package/Forms/Toggle/useToggle.d.ts +1 -1
  66. package/Forms/Toggle/useToggle.js +30 -30
  67. package/Forms/antispam.js +12 -12
  68. package/Forms/helpers.js +7 -6
  69. package/Forms/styles.js +12 -43
  70. package/Gauge/Gauge.js +1 -1
  71. package/Grid/Grid.js +25 -51
  72. package/Hamburger/Hamburger.js +35 -47
  73. package/Header/useHeader.js +12 -12
  74. package/Hidden/Hidden.js +9 -13
  75. package/Img/sc/bare.js +3 -1
  76. package/Link/Link.js +3 -1
  77. package/Link/LinkBlank.js +8 -17
  78. package/Menu/Menu.js +3 -10
  79. package/MenuItem/MenuItem.js +3 -19
  80. package/Meta/Meta.js +3 -2
  81. package/NoJs/NoJs.js +2 -2
  82. package/Pagination/PaginationNav.js +26 -48
  83. package/Pagination/PaginationResults.js +7 -6
  84. package/Pill/Pill.js +6 -36
  85. package/Progress/ProgressCircular.js +9 -30
  86. package/Progress/ProgressLinear.js +8 -16
  87. package/Progress/ProgressOverlay.js +11 -27
  88. package/Rating/Rating.js +24 -44
  89. package/Rating/index.js +19 -15
  90. package/Select/SelectDownshift.js +1 -1
  91. package/Select/components.js +6 -12
  92. package/Sidebar/Sidebar.js +13 -38
  93. package/Spacing/Spacing.js +12 -12
  94. package/Sticky/Sticky.js +1 -1
  95. package/Sticky/StickyCss.js +4 -2
  96. package/Tabs/TabsMui.js +19 -16
  97. package/Tabs/tw/bare.js +13 -11
  98. package/Tabs/tw/material.js +15 -11
  99. package/Tabs/useTabs.js +16 -16
  100. package/Typography/CopyPasteVisible.js +3 -5
  101. package/Typography/Native.js +12 -45
  102. package/Typography/ReadMore.js +25 -51
  103. package/Typography/TextLoop.js +19 -22
  104. package/Typography/TypeStairs.js +20 -16
  105. package/helpers/classed.js +21 -18
  106. package/helpers/extend-component.js +6 -6
  107. package/hooks/useAsyncFn.js +18 -11
  108. package/hooks/useDateLocale.js +22 -13
  109. package/hooks/useEffectOnce.js +1 -1
  110. package/hooks/useFirstMountState.js +1 -1
  111. package/hooks/useFocus.js +3 -3
  112. package/hooks/useId.js +3 -2
  113. package/hooks/useIsomorphicLayoutEffect.js +1 -1
  114. package/hooks/useMount.js +2 -2
  115. package/hooks/useMountedState.js +4 -4
  116. package/hooks/usePrevious.js +2 -2
  117. package/hooks/useScrollPosition.js +20 -15
  118. package/hooks/useScrollTo.js +7 -5
  119. package/hooks/useTraceUpdate.js +4 -3
  120. package/hooks/useUpdateEffect.js +3 -3
  121. package/hooks/useWindowSize.js +3 -3
  122. package/m/MotionProvider.js +4 -2
  123. package/package.json +8 -7
  124. package/styles/Body.js +4 -8
  125. package/styles/Global.js +4 -36
  126. package/styles/media.js +41 -36
  127. package/styles/spacing.js +15 -16
  128. package/styles/styled.js +7 -21
  129. package/styles/theme--vanilla.js +20 -18
  130. package/styles/theme.js +11 -11
  131. package/node/Alert/Alert.js +0 -21
  132. package/node/Alert/index.js +0 -4
  133. package/node/Animations/Reveal.js +0 -19
  134. package/node/Animations/Underline.js +0 -19
  135. package/node/Animations/index.js +0 -6
  136. package/node/Animations/useReveal.js +0 -74
  137. package/node/Autocomplete/AutocompleteDownshift.js +0 -161
  138. package/node/Autocomplete/AutocompleteDownshiftMultiselect.js +0 -356
  139. package/node/Autocomplete/AutocompleteMui.js +0 -175
  140. package/node/Autocomplete/AutocompleteReach.js +0 -115
  141. package/node/Autocomplete/components.js +0 -93
  142. package/node/Autocomplete/helpers.js +0 -32
  143. package/node/Autocomplete/index.js +0 -7
  144. package/node/Bg/BgColor.js +0 -36
  145. package/node/Bg/BgPhoto.js +0 -64
  146. package/node/Bg/BgSvg.js +0 -20
  147. package/node/Bg/index.js +0 -6
  148. package/node/Breadcrumbs/Breadcrumbs.js +0 -72
  149. package/node/Breadcrumbs/index.js +0 -4
  150. package/node/Buttons/Button.js +0 -83
  151. package/node/Buttons/ButtonComposite.js +0 -54
  152. package/node/Buttons/ButtonFab.js +0 -12
  153. package/node/Buttons/ButtonLink.js +0 -15
  154. package/node/Buttons/IconButton.js +0 -23
  155. package/node/Buttons/index.js +0 -8
  156. package/node/Calendar/CalendarDaygridCell.js +0 -55
  157. package/node/Calendar/CalendarDaygridNav.js +0 -27
  158. package/node/Calendar/CalendarDaygridTable.js +0 -60
  159. package/node/Calendar/CalendarLegend.js +0 -15
  160. package/node/Calendar/calendar-api-google.js +0 -99
  161. package/node/Calendar/index.js +0 -9
  162. package/node/Calendar/types.js +0 -2
  163. package/node/Calendar/useCalendar.js +0 -186
  164. package/node/Calendar/utils.js +0 -217
  165. package/node/Carousel/Carousel.js +0 -381
  166. package/node/Carousel/CarouselCss.js +0 -42
  167. package/node/Carousel/index.js +0 -4
  168. package/node/Collapsable/Collapsable.js +0 -4
  169. package/node/Collapsable/CollapsableReach.js +0 -253
  170. package/node/Collapsable/index.js +0 -5
  171. package/node/Debug/Debug.js +0 -26
  172. package/node/Debug/index.js +0 -4
  173. package/node/Details/Details.js +0 -65
  174. package/node/Details/index.js +0 -4
  175. package/node/Dialog/DialogMui.js +0 -82
  176. package/node/Dialog/css/bare.js +0 -23
  177. package/node/Dialog/index.js +0 -5
  178. package/node/Dialog/m/bare.js +0 -51
  179. package/node/Dialog/m/basic.js +0 -35
  180. package/node/Dialog/m/index.js +0 -8
  181. package/node/Dialog/sc/bare.js +0 -65
  182. package/node/Dialog/sc/framer.js +0 -19
  183. package/node/Dialog/sc/framerMaterial.js +0 -19
  184. package/node/Dialog/sc/material.js +0 -45
  185. package/node/Dialog/tw/bare.js +0 -40
  186. package/node/Dialog/tw/elegant.js +0 -21
  187. package/node/Dialog/tw/framer.js +0 -19
  188. package/node/Dialog/tw/framerMaterial.js +0 -19
  189. package/node/Dialog/tw/material.js +0 -21
  190. package/node/Editor/Editor--tiptap.js +0 -29
  191. package/node/Editor/components.js +0 -34
  192. package/node/Editor/index.js +0 -4
  193. package/node/Favicon/FaviconTags.js +0 -18
  194. package/node/Favicon/index.js +0 -4
  195. package/node/Form/Form.js +0 -63
  196. package/node/Form/index.js +0 -4
  197. package/node/Form/sc/bare.js +0 -33
  198. package/node/Forms/Checkbox/Checkbox.js +0 -28
  199. package/node/Forms/Checkbox/index.js +0 -4
  200. package/node/Forms/Feedback/Feedback.js +0 -15
  201. package/node/Forms/Feedback/index.js +0 -4
  202. package/node/Forms/Field/Field.js +0 -64
  203. package/node/Forms/Field/FieldControl.js +0 -47
  204. package/node/Forms/Field/FieldHint.js +0 -10
  205. package/node/Forms/Field/index.js +0 -5
  206. package/node/Forms/Input/Input.js +0 -27
  207. package/node/Forms/Input/index.js +0 -4
  208. package/node/Forms/InputGroup/InputGroup.js +0 -47
  209. package/node/Forms/InputGroup/index.js +0 -4
  210. package/node/Forms/Label/Label.js +0 -28
  211. package/node/Forms/Label/index.js +0 -4
  212. package/node/Forms/Password/Password.js +0 -34
  213. package/node/Forms/Password/index.js +0 -4
  214. package/node/Forms/Radio/Radio.js +0 -32
  215. package/node/Forms/Radio/index.js +0 -4
  216. package/node/Forms/Switch/Switch.js +0 -54
  217. package/node/Forms/Switch/index.js +0 -4
  218. package/node/Forms/Textarea/Textarea.js +0 -17
  219. package/node/Forms/Textarea/TextareaRich.js +0 -46
  220. package/node/Forms/Textarea/index.js +0 -5
  221. package/node/Forms/Toggle/Toggle.js +0 -86
  222. package/node/Forms/Toggle/index.js +0 -4
  223. package/node/Forms/Toggle/useToggle.js +0 -149
  224. package/node/Forms/antispam.js +0 -61
  225. package/node/Forms/helpers.js +0 -51
  226. package/node/Forms/index.js +0 -19
  227. package/node/Forms/styles.js +0 -64
  228. package/node/Gauge/Gauge.js +0 -106
  229. package/node/Grid/Grid.js +0 -83
  230. package/node/Grid/index.js +0 -4
  231. package/node/Hamburger/Hamburger.js +0 -69
  232. package/node/Hamburger/index.js +0 -4
  233. package/node/Header/index.js +0 -4
  234. package/node/Header/useHeader.js +0 -34
  235. package/node/Hidden/Hidden.js +0 -18
  236. package/node/Hidden/index.js +0 -4
  237. package/node/Img/index.js +0 -4
  238. package/node/Img/sc/bare.js +0 -41
  239. package/node/Img/types.js +0 -2
  240. package/node/Link/Link.js +0 -6
  241. package/node/Link/LinkBlank.js +0 -31
  242. package/node/Link/index.js +0 -5
  243. package/node/Menu/Menu.js +0 -15
  244. package/node/Menu/index.js +0 -4
  245. package/node/MenuItem/MenuItem.js +0 -24
  246. package/node/MenuItem/index.js +0 -4
  247. package/node/Meta/Meta.js +0 -8
  248. package/node/Meta/index.js +0 -4
  249. package/node/NoJs/NoJs.js +0 -10
  250. package/node/NoJs/index.js +0 -4
  251. package/node/Pagination/PaginationNav.js +0 -88
  252. package/node/Pagination/PaginationResults.js +0 -15
  253. package/node/Pagination/index.js +0 -5
  254. package/node/Pill/Pill.js +0 -41
  255. package/node/Pill/index.js +0 -4
  256. package/node/Progress/ProgressCircular.js +0 -41
  257. package/node/Progress/ProgressLinear.js +0 -37
  258. package/node/Progress/ProgressOverlay.js +0 -45
  259. package/node/Progress/index.js +0 -6
  260. package/node/Rating/Rating.js +0 -97
  261. package/node/Rating/index.js +0 -53
  262. package/node/Select/SelectDownshift.js +0 -41
  263. package/node/Select/components.js +0 -22
  264. package/node/Select/index.js +0 -7
  265. package/node/Sidebar/Sidebar.js +0 -53
  266. package/node/Sidebar/index.js +0 -4
  267. package/node/Spacing/Spacing.js +0 -50
  268. package/node/Spacing/index.js +0 -4
  269. package/node/Sticky/Sticky.js +0 -222
  270. package/node/Sticky/StickyCss.js +0 -8
  271. package/node/Sticky/index.js +0 -4
  272. package/node/Tabs/TabsMui.js +0 -47
  273. package/node/Tabs/index.js +0 -4
  274. package/node/Tabs/sc/bare.js +0 -87
  275. package/node/Tabs/tw/bare.js +0 -19
  276. package/node/Tabs/tw/material.js +0 -17
  277. package/node/Tabs/useTabs.js +0 -48
  278. package/node/Typography/CopyPasteVisible.js +0 -10
  279. package/node/Typography/Native.js +0 -51
  280. package/node/Typography/ReadMore.js +0 -74
  281. package/node/Typography/TextLoop.js +0 -54
  282. package/node/Typography/TypeStairs.js +0 -49
  283. package/node/Typography/index.js +0 -8
  284. package/node/css/index.js +0 -36
  285. package/node/helpers/classed.js +0 -69
  286. package/node/helpers/extend-component.js +0 -16
  287. package/node/helpers/index.js +0 -5
  288. package/node/hooks/index.js +0 -18
  289. package/node/hooks/types.js +0 -2
  290. package/node/hooks/useAsyncFn.js +0 -33
  291. package/node/hooks/useDateLocale.js +0 -56
  292. package/node/hooks/useEffectOnce.js +0 -12
  293. package/node/hooks/useFirstMountState.js +0 -16
  294. package/node/hooks/useFocus.js +0 -15
  295. package/node/hooks/useId.js +0 -11
  296. package/node/hooks/useIsomorphicLayoutEffect.js +0 -11
  297. package/node/hooks/useMount.js +0 -13
  298. package/node/hooks/useMountedState.js +0 -19
  299. package/node/hooks/usePrevious.js +0 -12
  300. package/node/hooks/useScrollPosition.js +0 -79
  301. package/node/hooks/useScrollTo.js +0 -23
  302. package/node/hooks/useTraceUpdate.js +0 -24
  303. package/node/hooks/useUpdateEffect.js +0 -18
  304. package/node/hooks/useWindowSize.js +0 -17
  305. package/node/index.js +0 -8
  306. package/node/m/MotionProvider.js +0 -41
  307. package/node/m/index.js +0 -9
  308. package/node/m/lite.js +0 -4
  309. package/node/m/max.js +0 -4
  310. package/node/sc/index.js +0 -37
  311. package/node/scm/index.js +0 -36
  312. package/node/shared/index.js +0 -11
  313. package/node/styles/Body.js +0 -21
  314. package/node/styles/Global.js +0 -53
  315. package/node/styles/index.js +0 -10
  316. package/node/styles/media.js +0 -156
  317. package/node/styles/spacing.js +0 -53
  318. package/node/styles/styled.js +0 -31
  319. package/node/styles/theme--vanilla.js +0 -59
  320. package/node/styles/theme.js +0 -45
  321. package/node/tw/index.js +0 -36
  322. package/node/twm/index.js +0 -36
  323. package/node/types.js +0 -2
@@ -1,67 +1,27 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import styled, { css } from "styled-components";
3
4
  import { m } from "framer-motion";
4
5
  import { MdKeyboardArrowRight as IconDelimiter } from "react-icons/md";
5
6
  import { titleCase } from "@koine/utils";
6
7
  import { max, min } from "../styles/media";
7
- const LINK_GUTTER_X = 10;
8
- const Root = styled.nav `
9
- display: flex;
10
- position: relative;
11
- `;
12
- const Inner = styled.div `
13
- display: flex;
14
- font-size: 11px;
15
- color: var(--grey100);
16
- ${min.sm} {
17
- font-size: 12px;
18
- }
19
- ${max.lg} {
20
- max-width: 100%;
21
- overflow: hidden;
22
- white-space: nowrap;
23
- }
24
- `;
25
- const Item = styled(m.div) `
26
- display: flex;
27
- align-items: center;
28
- /* margin: 0 10px 0 0; */
29
-
30
- &:first-child {
31
- margin-left: -${LINK_GUTTER_X / 2}px;
32
- }
33
- ${min.sm} {
34
- &:first-child {
35
- margin-left: -${LINK_GUTTER_X}px;
36
- }
37
- }
38
- `;
39
- const itemChild = css `
40
- display: block;
41
- padding: 10px ${LINK_GUTTER_X / 2}px;
42
-
43
- ${min.sm} {
44
- padding: 10px ${LINK_GUTTER_X}px;
45
- }
46
- `;
47
- const ItemLink = styled.a `
48
- ${itemChild}
49
- text-decoration: none;
50
- &:hover {
51
- text-decoration: underline;
52
- }
53
- `;
54
- const ItemCurrent = styled.span `
55
- ${itemChild}
56
- `;
57
- const ItemSeparator = styled(IconDelimiter) ``;
58
- export const KoineBreadcrumbs = ({ items = [], Link, ...props }) => {
8
+ var LINK_GUTTER_X = 10;
9
+ var Root = styled.nav(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n position: relative;\n"], ["\n display: flex;\n position: relative;\n"])));
10
+ var Inner = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n font-size: 11px;\n color: var(--grey100);\n ", " {\n font-size: 12px;\n }\n ", " {\n max-width: 100%;\n overflow: hidden;\n white-space: nowrap;\n }\n"], ["\n display: flex;\n font-size: 11px;\n color: var(--grey100);\n ", " {\n font-size: 12px;\n }\n ", " {\n max-width: 100%;\n overflow: hidden;\n white-space: nowrap;\n }\n"])), min.sm, max.lg);
11
+ var Item = styled(m.div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n /* margin: 0 10px 0 0; */\n\n &:first-child {\n margin-left: -", "px;\n }\n ", " {\n &:first-child {\n margin-left: -", "px;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n /* margin: 0 10px 0 0; */\n\n &:first-child {\n margin-left: -", "px;\n }\n ", " {\n &:first-child {\n margin-left: -", "px;\n }\n }\n"])), LINK_GUTTER_X / 2, min.sm, LINK_GUTTER_X);
12
+ var itemChild = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: block;\n padding: 10px ", "px;\n\n ", " {\n padding: 10px ", "px;\n }\n"], ["\n display: block;\n padding: 10px ", "px;\n\n ", " {\n padding: 10px ", "px;\n }\n"])), LINK_GUTTER_X / 2, min.sm, LINK_GUTTER_X);
13
+ var ItemLink = styled.a(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n text-decoration: none;\n &:hover {\n text-decoration: underline;\n }\n"], ["\n ", "\n text-decoration: none;\n &:hover {\n text-decoration: underline;\n }\n"])), itemChild);
14
+ var ItemCurrent = styled.span(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), itemChild);
15
+ var ItemSeparator = styled(IconDelimiter)(templateObject_7 || (templateObject_7 = __makeTemplateObject([""], [""])));
16
+ export var KoineBreadcrumbs = function (_a) {
17
+ var _b = _a.items, items = _b === void 0 ? [] : _b, Link = _a.Link, props = __rest(_a, ["items", "Link"]);
59
18
  if (!items.length) {
60
19
  return null;
61
20
  }
62
- return (_jsx(Root, { ...props, children: _jsx(Inner, { children: items.map((item, idx) => (_jsxs(Item, { initial: { opacity: 0, x: 20 }, animate: {
21
+ return (_jsx(Root, __assign({}, props, { children: _jsx(Inner, { children: items.map(function (item, idx) { return (_jsxs(Item, __assign({ initial: { opacity: 0, x: 20 }, animate: {
63
22
  opacity: 1,
64
23
  x: 0,
65
24
  transition: { delay: idx * 0.2 },
66
- }, children: [item.url && (_jsx(ItemLink, { as: Link, href: item.url, children: titleCase(item.title) })), !item.url && _jsx(ItemCurrent, { children: titleCase(item.title) }), idx < items.length - 1 && _jsx(ItemSeparator, {})] }, idx))) }) }));
25
+ } }, { children: [item.url && (_jsx(ItemLink, __assign({ as: Link, href: item.url }, { children: titleCase(item.title) }))), !item.url && _jsx(ItemCurrent, { children: titleCase(item.title) }), idx < items.length - 1 && _jsx(ItemSeparator, {})] }), idx)); }) }) })));
67
26
  };
27
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
package/Buttons/Button.js CHANGED
@@ -1,79 +1,14 @@
1
+ import { __makeTemplateObject } from "tslib";
1
2
  import styled, { css } from "styled-components";
2
3
  import { stateFocus } from "../styles/styled";
3
4
  /**
4
5
  * Prevent 300ms delay with `touch-action` performance optimization,
5
6
  * @see https://twitter.com/argyleink/status/1405881231695302659
6
7
  */
7
- export const btnStyleUndo = css `
8
- appearance: none;
9
- -webkit-appearance: none;
10
- -webkit-touch-callout: none;
11
- user-select: none;
12
- touch-action: manipulation;
13
- outline: 0px;
14
- color: var(--bodyColor);
15
- `;
16
- export const btnStyleReset = css `
17
- display: inline-flex;
18
- align-items: center;
19
- justify-content: center;
20
- background: transparent;
21
- border-width: 1px;
22
- border-style: solid;
23
- border-color: transparent;
24
- cursor: pointer;
25
- ${btnStyleUndo}
26
-
27
- &[disabled] {
28
- cursor: default;
29
- opacity: 0.7;
30
- }
31
- `;
32
- export const btnStyleBase = css `
33
- ${btnStyleReset}
34
-
35
- min-width: ${(p) => (p.$noGutter ? "0" : "150px")};
36
- padding: ${(p) => (p.$noGutter ? "0" : "10px 30px")};
37
- border-radius: 0;
38
- text-align: center;
39
- text-transform: uppercase;
40
- font-weight: 600;
41
- ${(p) => p.$block && `width: 100%; display: flex;`}
42
-
43
- &:focus,
44
- &:active,
45
- &:visited {
46
- ${stateFocus}
47
- }
48
-
49
- /* This targets icons within a button */
50
- & svg {
51
- margin: 0 1em 0 0;
52
- font-size: 1.25em;
53
- }
54
- `;
55
- export const btnStyleContained = css `
56
- color: white;
57
- background: var(--accent200);
58
- border-color: var(--accent200);
59
-
60
- &:hover:not([disabled]) {
61
- background: var(--accent300);
62
- border-color: var(--accent300);
63
- }
64
- `;
65
- export const btnStyleOutlined = css `
66
- color: var(--accent200);
67
- border-color: var(--accent200);
68
-
69
- &:hover:not([disabled]) {
70
- background: var(--accent300);
71
- border-color: var(--accent300);
72
- color: white;
73
- }
74
- `;
75
- export const KoineButton = styled.button `
76
- ${btnStyleBase}
77
- ${(p) => p.$variant === "outlined" && btnStyleOutlined}
78
- ${(p) => p.$variant === "contained" && btnStyleContained}
79
- `;
8
+ export var btnStyleUndo = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n appearance: none;\n -webkit-appearance: none;\n -webkit-touch-callout: none;\n user-select: none;\n touch-action: manipulation;\n outline: 0px;\n color: var(--bodyColor);\n"], ["\n appearance: none;\n -webkit-appearance: none;\n -webkit-touch-callout: none;\n user-select: none;\n touch-action: manipulation;\n outline: 0px;\n color: var(--bodyColor);\n"])));
9
+ export var btnStyleReset = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border-width: 1px;\n border-style: solid;\n border-color: transparent;\n cursor: pointer;\n ", "\n\n &[disabled] {\n cursor: default;\n opacity: 0.7;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border-width: 1px;\n border-style: solid;\n border-color: transparent;\n cursor: pointer;\n ", "\n\n &[disabled] {\n cursor: default;\n opacity: 0.7;\n }\n"])), btnStyleUndo);
10
+ export var btnStyleBase = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n\n min-width: ", ";\n padding: ", ";\n border-radius: 0;\n text-align: center;\n text-transform: uppercase;\n font-weight: 600;\n ", "\n\n &:focus,\n &:active,\n &:visited {\n ", "\n }\n\n /* This targets icons within a button */\n & svg {\n margin: 0 1em 0 0;\n font-size: 1.25em;\n }\n"], ["\n ", "\n\n min-width: ", ";\n padding: ", ";\n border-radius: 0;\n text-align: center;\n text-transform: uppercase;\n font-weight: 600;\n ", "\n\n &:focus,\n &:active,\n &:visited {\n ", "\n }\n\n /* This targets icons within a button */\n & svg {\n margin: 0 1em 0 0;\n font-size: 1.25em;\n }\n"])), btnStyleReset, function (p) { return (p.$noGutter ? "0" : "150px"); }, function (p) { return (p.$noGutter ? "0" : "10px 30px"); }, function (p) { return p.$block && "width: 100%; display: flex;"; }, stateFocus);
11
+ export var btnStyleContained = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: white;\n background: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n }\n"], ["\n color: white;\n background: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n }\n"])));
12
+ export var btnStyleOutlined = css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n color: white;\n }\n"], ["\n color: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n color: white;\n }\n"])));
13
+ export var KoineButton = styled.button(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n"])), btnStyleBase, function (p) { return p.$variant === "outlined" && btnStyleOutlined; }, function (p) { return p.$variant === "contained" && btnStyleContained; });
14
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -1,49 +1,28 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
1
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { memo } from "react";
3
4
  import styled from "styled-components";
4
- const Root = styled.span `
5
- ${(p) => p.$icon ? `display: flex;` : `display: inline-block; text-align: left;`}
6
- min-width: 0;
7
-
8
- & svg {
9
- font-size: 2em !important;
10
- margin: 0 0.33em 0 0 !important;
11
- }
12
- `;
13
- const ButtonCompositeIcon = styled.svg `
14
- float: left;
15
- `;
16
- const BesidesIcon = styled.span `
17
- text-align: left;
18
- line-height: 1.2;
19
- `;
20
- const Main = styled.span `
21
- display: block;
22
- font-size: 0.9em;
23
-
24
- &:last-child {
25
- margin-top: ${(p) => (p.$reverse && !p.$icon ? "0.5em" : "0")};
26
- }
27
- `;
28
- const Sub = styled.span `
29
- display: block;
30
- text-transform: none;
31
- font-size: 0.7em;
32
- font-weight: 500;
33
-
34
- ${Main} + & {
35
- margin-top: ${(p) => (p.$reverse && !p.$icon ? "0.5em" : "0")};
36
- }
37
- `;
38
- const Text = styled.span ``;
39
- const Inner = memo(({ textMain, textSub, text, $reverse, $icon, }) => (_jsxs(_Fragment, { children: [$reverse ? (_jsxs(_Fragment, { children: [textSub && (_jsx(Sub, { "$icon": $icon, "$reverse": $reverse, children: textSub })), textMain && (_jsx(Main, { "$icon": $icon, "$reverse": $reverse, children: textMain }))] })) : (_jsxs(_Fragment, { children: [textMain && (_jsx(Main, { "$icon": $icon, "$reverse": $reverse, children: textMain })), textSub && (_jsx(Sub, { "$icon": $icon, "$reverse": $reverse, children: textSub }))] })), text && _jsx(Text, { children: text })] })));
40
- export const KoineButtonComposite = ({ Icon, iconProps = {}, textMain, textSub, textReverse, text, Button = "button", ButtonLink = "a", ...props }) => {
41
- const Btn = props.href ? ButtonLink : Button;
42
- const styledProps = {
5
+ var Root = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n min-width: 0;\n\n & svg {\n font-size: 2em !important;\n margin: 0 0.33em 0 0 !important;\n }\n"], ["\n ", "\n min-width: 0;\n\n & svg {\n font-size: 2em !important;\n margin: 0 0.33em 0 0 !important;\n }\n"])), function (p) {
6
+ return p.$icon ? "display: flex;" : "display: inline-block; text-align: left;";
7
+ });
8
+ var ButtonCompositeIcon = styled.svg(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n float: left;\n"], ["\n float: left;\n"])));
9
+ var BesidesIcon = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n text-align: left;\n line-height: 1.2;\n"], ["\n text-align: left;\n line-height: 1.2;\n"])));
10
+ var Main = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: block;\n font-size: 0.9em;\n\n &:last-child {\n margin-top: ", ";\n }\n"], ["\n display: block;\n font-size: 0.9em;\n\n &:last-child {\n margin-top: ", ";\n }\n"])), function (p) { return (p.$reverse && !p.$icon ? "0.5em" : "0"); });
11
+ var Sub = styled.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: block;\n text-transform: none;\n font-size: 0.7em;\n font-weight: 500;\n\n ", " + & {\n margin-top: ", ";\n }\n"], ["\n display: block;\n text-transform: none;\n font-size: 0.7em;\n font-weight: 500;\n\n ", " + & {\n margin-top: ", ";\n }\n"])), Main, function (p) { return (p.$reverse && !p.$icon ? "0.5em" : "0"); });
12
+ var Text = styled.span(templateObject_6 || (templateObject_6 = __makeTemplateObject([""], [""])));
13
+ var Inner = memo(function (_a) {
14
+ var textMain = _a.textMain, textSub = _a.textSub, text = _a.text, $reverse = _a.$reverse, $icon = _a.$icon;
15
+ return (_jsxs(_Fragment, { children: [$reverse ? (_jsxs(_Fragment, { children: [textSub && (_jsx(Sub, __assign({ "$icon": $icon, "$reverse": $reverse }, { children: textSub }))), textMain && (_jsx(Main, __assign({ "$icon": $icon, "$reverse": $reverse }, { children: textMain })))] })) : (_jsxs(_Fragment, { children: [textMain && (_jsx(Main, __assign({ "$icon": $icon, "$reverse": $reverse }, { children: textMain }))), textSub && (_jsx(Sub, __assign({ "$icon": $icon, "$reverse": $reverse }, { children: textSub })))] })), text && _jsx(Text, { children: text })] }));
16
+ });
17
+ export var KoineButtonComposite = function (_a) {
18
+ var Icon = _a.Icon, _b = _a.iconProps, iconProps = _b === void 0 ? {} : _b, textMain = _a.textMain, textSub = _a.textSub, textReverse = _a.textReverse, text = _a.text, _c = _a.Button, Button = _c === void 0 ? "button" : _c, _d = _a.ButtonLink, ButtonLink = _d === void 0 ? "a" : _d, props = __rest(_a, ["Icon", "iconProps", "textMain", "textSub", "textReverse", "text", "Button", "ButtonLink"]);
19
+ var Btn = props.href ? ButtonLink : Button;
20
+ var styledProps = {
43
21
  $icon: !!Icon,
44
22
  $reverse: textReverse,
45
23
  $twoLines: !!(textMain && textSub && !Icon),
46
24
  };
47
- const innerProps = { textMain, textSub, text, ...styledProps };
48
- return (_jsxs(Root, { as: Btn, ...props, ...styledProps, children: [Icon && _jsx(ButtonCompositeIcon, { as: Icon, ...iconProps }), Icon ? (_jsx(BesidesIcon, { ...styledProps, children: _jsx(Inner, { ...innerProps }) })) : (_jsx(Inner, { ...innerProps }))] }));
25
+ var innerProps = __assign({ textMain: textMain, textSub: textSub, text: text }, styledProps);
26
+ return (_jsxs(Root, __assign({ as: Btn }, props, styledProps, { children: [Icon && _jsx(ButtonCompositeIcon, __assign({ as: Icon }, iconProps)), Icon ? (_jsx(BesidesIcon, __assign({}, styledProps, { children: _jsx(Inner, __assign({}, innerProps)) }))) : (_jsx(Inner, __assign({}, innerProps)))] })));
49
27
  };
28
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -1,8 +1,6 @@
1
+ import { __makeTemplateObject } from "tslib";
1
2
  import styled, { css } from "styled-components";
2
3
  import { IconButton } from "./IconButton";
3
- export const buttonFab = css `
4
- box-shadow: 3px 3px 6px -4px rgb(0, 0, 0, 0.5);
5
- `;
6
- export const IconButtonFab = styled(IconButton) `
7
- ${buttonFab}
8
- `;
4
+ export var buttonFab = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-shadow: 3px 3px 6px -4px rgb(0, 0, 0, 0.5);\n"], ["\n box-shadow: 3px 3px 6px -4px rgb(0, 0, 0, 0.5);\n"])));
5
+ export var IconButtonFab = styled(IconButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), buttonFab);
6
+ var templateObject_1, templateObject_2;
@@ -1,10 +1,11 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import styled from "styled-components";
3
4
  import { KoineButton } from "./Button";
4
- const Root = styled(KoineButton) `
5
- text-decoration: none;
6
- `;
7
- export const KoineButtonLink = ({ href, Link = "a", ...props }) => {
8
- const isRelative = href && href.startsWith("/");
9
- return isRelative ? (_jsx(Root, { href: href, ...props, as: Link })) : (_jsx(Root, { href: href, ...props, as: "a" }));
5
+ var Root = styled(KoineButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n text-decoration: none;\n"], ["\n text-decoration: none;\n"])));
6
+ export var KoineButtonLink = function (_a) {
7
+ var href = _a.href, _b = _a.Link, Link = _b === void 0 ? "a" : _b, props = __rest(_a, ["href", "Link"]);
8
+ var isRelative = href && href.startsWith("/");
9
+ return isRelative ? (_jsx(Root, __assign({ href: href }, props, { as: Link }))) : (_jsx(Root, __assign({ href: href }, props, { as: "a" })));
10
10
  };
11
+ var templateObject_1;
@@ -1,19 +1,7 @@
1
+ import { __makeTemplateObject } from "tslib";
1
2
  import styled, { css } from "styled-components";
2
3
  import { btnStyleReset, btnStyleOutlined, btnStyleContained, } from "./Button";
3
- export const iconBtnStyleReset = css `
4
- display: inline-flex;
5
- align-items: center;
6
- justify-content: center;
7
- width: 44px;
8
- height: 44px;
9
- border-radius: 100%;
10
- ${btnStyleReset}
11
- `;
12
- export const iconBtnStyleBase = css `
13
- ${iconBtnStyleReset}
14
- `;
15
- export const IconButton = styled.button `
16
- ${iconBtnStyleBase}
17
- ${(p) => p.$variant === "outlined" && btnStyleOutlined}
18
- ${(p) => p.$variant === "contained" && btnStyleContained}
19
- `;
4
+ export var iconBtnStyleReset = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n border-radius: 100%;\n ", "\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n border-radius: 100%;\n ", "\n"])), btnStyleReset);
5
+ export var iconBtnStyleBase = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), iconBtnStyleReset);
6
+ export var IconButton = styled.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n"])), iconBtnStyleBase, function (p) { return p.$variant === "outlined" && btnStyleOutlined; }, function (p) { return p.$variant === "contained" && btnStyleContained; });
7
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import { Fragment, useState } from "react";
3
4
  import { MdAdd as IconExpand } from "react-icons/md";
@@ -10,42 +11,47 @@ import { getDisplayTime } from "./utils";
10
11
  * on multiple lines, but that would mean that we loose the ability to interweave
11
12
  * single-day events among the spaces left by wider multi-days events.
12
13
  */
13
- const styleBtn = {
14
+ var styleBtn = {
14
15
  overflow: "hidden",
15
16
  whiteSpace: "nowrap",
16
17
  textOverflow: "ellipsis",
17
18
  };
18
- export const CalendarDaygridCell = ({ eventClicked, setEventClicked,
19
- // eventHovered,
20
- setEventHovered, view, maxEvents, events, calendarsMap, Cell = "div", CellOverflow = "div", CellEvent = "div", CellEventBtn = "div", CellEventTitle = "span", CellEventStart = "span", }) => {
21
- const [isExpanded, expand] = useState(false);
22
- const eventsWithoutPlaceholders = events.filter((event) => !event.placeholder);
23
- return (_jsx(Cell, { children: events.map((event, i) => {
19
+ export var CalendarDaygridCell = function (_a) {
20
+ var eventClicked = _a.eventClicked, setEventClicked = _a.setEventClicked,
21
+ // eventHovered,
22
+ setEventHovered = _a.setEventHovered, view = _a.view, maxEvents = _a.maxEvents, events = _a.events, calendarsMap = _a.calendarsMap, _b = _a.Cell, Cell = _b === void 0 ? "div" : _b, _c = _a.CellOverflow, CellOverflow = _c === void 0 ? "div" : _c, _d = _a.CellEvent, CellEvent = _d === void 0 ? "div" : _d, _e = _a.CellEventBtn, CellEventBtn = _e === void 0 ? "div" : _e, _f = _a.CellEventTitle, CellEventTitle = _f === void 0 ? "span" : _f, _g = _a.CellEventStart, CellEventStart = _g === void 0 ? "span" : _g;
23
+ var _h = useState(false), isExpanded = _h[0], expand = _h[1];
24
+ var eventsWithoutPlaceholders = events.filter(function (event) { return !event.placeholder; });
25
+ return (_jsx(Cell, { children: events.map(function (event, i) {
24
26
  if (i === maxEvents && !isExpanded) {
25
- return (_jsxs(CellOverflow, { onClick: () => expand(true), children: [_jsx(IconExpand, {}), eventsWithoutPlaceholders.length - maxEvents] }, "overflowMessage" + i));
27
+ return (_jsxs(CellOverflow, __assign({ onClick: function () { return expand(true); } }, { children: [_jsx(IconExpand, {}), eventsWithoutPlaceholders.length - maxEvents] }), "overflowMessage" + i));
26
28
  }
27
29
  if (i > maxEvents && !isExpanded)
28
30
  return null;
29
31
  if (event.placeholder) {
30
- return (_jsx(Fragment, { children: _jsx(CellEvent, { "$placeholder": true, children: _jsx(CellEventBtn, { "aria-hidden": "true", style: { visibility: "hidden" }, "$placeholder": true, children: _jsx(CellEventTitle, { children: "\u00A0" }) }) }) }, event.key));
32
+ return (_jsx(Fragment, { children: _jsx(CellEvent, __assign({ "$placeholder": true }, { children: _jsx(CellEventBtn, __assign({ "aria-hidden": "true", style: { visibility: "hidden" }, "$placeholder": true }, { children: _jsx(CellEventTitle, { children: "\u00A0" }) })) })) }, event.key));
31
33
  }
32
- const styleEvent = {
34
+ var styleEvent = {
33
35
  zIndex: event.firstOfMulti ? 1 : 0,
34
36
  position: "relative",
35
- width: event.firstOfMulti ? `${100 * event.width}%` : "100%",
37
+ width: event.firstOfMulti ? "".concat(100 * event.width, "%") : "100%",
36
38
  };
37
39
  if (!calendarsMap[event.calendar.id].on) {
38
40
  // @ts-expect-error nevermind
39
41
  styleBtn.display = "none";
40
42
  }
41
- const styledProps = {
43
+ var styledProps = {
42
44
  $view: view,
43
- $selected: eventClicked?.uid === event.uid,
45
+ $selected: (eventClicked === null || eventClicked === void 0 ? void 0 : eventClicked.uid) === event.uid,
44
46
  $past: event.isPast,
45
47
  $color: event.color,
46
48
  $isOutOfRange: event.$isOutOfRange,
47
49
  $isToday: event.$isToday,
48
50
  };
49
- return (_jsx(Fragment, { children: _jsx(CellEvent, { style: styleEvent, ...styledProps, children: _jsx(CellEventBtn, { role: "button", style: styleBtn, ...styledProps, onClick: () => setEventClicked((prev) => prev?.uid === event.uid ? null : event), onMouseEnter: () => setEventHovered(event), onMouseLeave: () => setEventHovered(null), children: event.allDay ? (_jsx(CellEventTitle, { children: event.title })) : (_jsxs(_Fragment, { children: [_jsx(CellEventStart, { children: getDisplayTime(event.start) }), _jsx(CellEventTitle, { children: event.title })] })) }) }) }, event.key));
51
+ return (_jsx(Fragment, { children: _jsx(CellEvent, __assign({ style: styleEvent }, styledProps, { children: _jsx(CellEventBtn, __assign({ role: "button", style: styleBtn }, styledProps, { onClick: function () {
52
+ return setEventClicked(function (prev) {
53
+ return (prev === null || prev === void 0 ? void 0 : prev.uid) === event.uid ? null : event;
54
+ });
55
+ }, onMouseEnter: function () { return setEventHovered(event); }, onMouseLeave: function () { return setEventHovered(null); } }, { children: event.allDay ? (_jsx(CellEventTitle, { children: event.title })) : (_jsxs(_Fragment, { children: [_jsx(CellEventStart, { children: getDisplayTime(event.start) }), _jsx(CellEventTitle, { children: event.title })] })) })) })) }, event.key));
50
56
  }) }));
51
57
  };
@@ -1,22 +1,23 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import format from "date-fns/format";
3
3
  import { useDateLocale } from "../hooks/useDateLocale";
4
- export const KoineCalendarDaygridNav = ({ range, view, todayInView, handlePrev, handleNext, handleToday, handleView, locale: localeCode, NavRoot = "nav", NavTitle = "div", NavBtns = "div", NavBtnPrev = "button", NavBtnNext = "button", NavBtnToday = "button", NavBtnViewMonth = "button", NavBtnViewWeek = "button", }) => {
5
- const [start, end] = range;
6
- const locale = useDateLocale(localeCode);
7
- const opts = { locale };
8
- let formatted = "";
4
+ export var KoineCalendarDaygridNav = function (_a) {
5
+ var range = _a.range, view = _a.view, todayInView = _a.todayInView, handlePrev = _a.handlePrev, handleNext = _a.handleNext, handleToday = _a.handleToday, handleView = _a.handleView, localeCode = _a.locale, _b = _a.NavRoot, NavRoot = _b === void 0 ? "nav" : _b, _c = _a.NavTitle, NavTitle = _c === void 0 ? "div" : _c, _d = _a.NavBtns, NavBtns = _d === void 0 ? "div" : _d, _e = _a.NavBtnPrev, NavBtnPrev = _e === void 0 ? "button" : _e, _f = _a.NavBtnNext, NavBtnNext = _f === void 0 ? "button" : _f, _g = _a.NavBtnToday, NavBtnToday = _g === void 0 ? "button" : _g, _h = _a.NavBtnViewMonth, NavBtnViewMonth = _h === void 0 ? "button" : _h, _j = _a.NavBtnViewWeek, NavBtnViewWeek = _j === void 0 ? "button" : _j;
6
+ var start = range[0], end = range[1];
7
+ var locale = useDateLocale(localeCode);
8
+ var opts = { locale: locale };
9
+ var formatted = "";
9
10
  if (view === "month") {
10
11
  formatted = format(start, "MMMM yyyy", opts);
11
12
  }
12
13
  if (view === "week") {
13
- const inSameMonth = start.getMonth() === end.getMonth();
14
+ var inSameMonth = start.getMonth() === end.getMonth();
14
15
  if (inSameMonth) {
15
- formatted = format(start, "# MMMM yyyy", opts).replace("#", `${start.getDate()}-${end.getDate()}`);
16
+ formatted = format(start, "# MMMM yyyy", opts).replace("#", "".concat(start.getDate(), "-").concat(end.getDate()));
16
17
  }
17
18
  else {
18
- formatted = `${format(start, "d MMMM", opts)} - ${format(end, "d MMMM yyyy", opts)}`;
19
+ formatted = "".concat(format(start, "d MMMM", opts), " - ").concat(format(end, "d MMMM yyyy", opts));
19
20
  }
20
21
  }
21
- return (_jsxs(NavRoot, { children: [_jsxs(NavBtns, { children: [_jsx(NavBtnPrev, { onClick: handlePrev }), _jsx(NavBtnNext, { onClick: handleNext }), _jsx(NavBtnToday, { onClick: handleToday, disabled: todayInView }), _jsx(NavBtnViewMonth, { onClick: () => handleView("month"), disabled: view === "month" }), _jsx(NavBtnViewWeek, { onClick: () => handleView("week"), disabled: view === "week" })] }), _jsx(NavTitle, { range: range, formatted: formatted })] }));
22
+ return (_jsxs(NavRoot, { children: [_jsxs(NavBtns, { children: [_jsx(NavBtnPrev, { onClick: handlePrev }), _jsx(NavBtnNext, { onClick: handleNext }), _jsx(NavBtnToday, { onClick: handleToday, disabled: todayInView }), _jsx(NavBtnViewMonth, { onClick: function () { return handleView("month"); }, disabled: view === "month" }), _jsx(NavBtnViewWeek, { onClick: function () { return handleView("week"); }, disabled: view === "week" })] }), _jsx(NavTitle, { range: range, formatted: formatted })] }));
22
23
  };
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { useEffect, useMemo, useState } from "react";
3
4
  import eachWeekOfInterval from "date-fns/eachWeekOfInterval";
@@ -6,50 +7,51 @@ import { useDateLocale } from "../hooks";
6
7
  import { processEventsInView } from "./utils";
7
8
  import { CalendarDaygridCell, } from "./CalendarDaygridCell";
8
9
  function getView(range) {
9
- const [start, end] = range;
10
- const weeks = eachWeekOfInterval({ start, end }, { weekStartsOn: 1 });
10
+ var start = range[0], end = range[1];
11
+ var weeks = eachWeekOfInterval({ start: start, end: end }, { weekStartsOn: 1 });
11
12
  return {
12
13
  month: start.getMonth(),
13
- weeks,
14
+ weeks: weeks,
14
15
  };
15
16
  }
16
- export const KoineCalendarDaygridTable = ({ locale: localeCode, handlePrev, handleNext, events, dayLabels, view, range, eventClicked, setEventClicked, eventHovered, setEventHovered, calendarsMap = {}, maxEvents = 5, Table = "table", TableHead = "thead", TableHeadCell = "th", TableBody = "tbody", TableBodyRow = "tr", TableBodyCell = "td", TableBodyCellDate = "div", Cell, CellOverflow, CellEvent, CellEventBtn, CellEventTitle, CellEventStart, }) => {
17
- const restKoine = {
18
- Cell,
19
- CellOverflow,
20
- CellEvent,
21
- CellEventBtn,
22
- CellEventTitle,
23
- CellEventStart,
17
+ export var KoineCalendarDaygridTable = function (_a) {
18
+ var localeCode = _a.locale, handlePrev = _a.handlePrev, handleNext = _a.handleNext, events = _a.events, dayLabels = _a.dayLabels, view = _a.view, range = _a.range, eventClicked = _a.eventClicked, setEventClicked = _a.setEventClicked, eventHovered = _a.eventHovered, setEventHovered = _a.setEventHovered, _b = _a.calendarsMap, calendarsMap = _b === void 0 ? {} : _b, _c = _a.maxEvents, maxEvents = _c === void 0 ? 5 : _c, _d = _a.Table, Table = _d === void 0 ? "table" : _d, _e = _a.TableHead, TableHead = _e === void 0 ? "thead" : _e, _f = _a.TableHeadCell, TableHeadCell = _f === void 0 ? "th" : _f, _g = _a.TableBody, TableBody = _g === void 0 ? "tbody" : _g, _h = _a.TableBodyRow, TableBodyRow = _h === void 0 ? "tr" : _h, _j = _a.TableBodyCell, TableBodyCell = _j === void 0 ? "td" : _j, _k = _a.TableBodyCellDate, TableBodyCellDate = _k === void 0 ? "div" : _k, Cell = _a.Cell, CellOverflow = _a.CellOverflow, CellEvent = _a.CellEvent, CellEventBtn = _a.CellEventBtn, CellEventTitle = _a.CellEventTitle, CellEventStart = _a.CellEventStart;
19
+ var restKoine = {
20
+ Cell: Cell,
21
+ CellOverflow: CellOverflow,
22
+ CellEvent: CellEvent,
23
+ CellEventBtn: CellEventBtn,
24
+ CellEventTitle: CellEventTitle,
25
+ CellEventStart: CellEventStart,
24
26
  };
25
- const [days, setDays] = useState(dayLabels || [0, 1, 2, 3, 4, 5, 6]);
26
- const [weeksEvents, setWeeksEvents] = useState([]);
27
+ var _l = useState(dayLabels || [0, 1, 2, 3, 4, 5, 6]), days = _l[0], setDays = _l[1];
28
+ var _m = useState([]), weeksEvents = _m[0], setWeeksEvents = _m[1];
27
29
  // const [days, setDays] = useState(dayLabels || [...Array(7).keys()]);
28
- const locale = useDateLocale(localeCode);
29
- const { month, weeks } = useMemo(() => getView(range), [range]);
30
- const swipeableHandlers = useSwipeable({
30
+ var locale = useDateLocale(localeCode);
31
+ var _o = useMemo(function () { return getView(range); }, [range]), month = _o.month, weeks = _o.weeks;
32
+ var swipeableHandlers = useSwipeable({
31
33
  onSwipedLeft: handleNext,
32
34
  onSwipedRight: handlePrev,
33
35
  });
34
- useEffect(() => {
36
+ useEffect(function () {
35
37
  setWeeksEvents(processEventsInView(events, view, month, weeks));
36
38
  }, [events, view, month, weeks]);
37
- useEffect(() => {
39
+ useEffect(function () {
38
40
  if (locale && locale.localize && !dayLabels) {
39
41
  setDays([1, 2, 3, 4, 5, 6, 0].map(
40
42
  // @ts-expect-error nevermind
41
- (i) => locale.localize.day(i, { width: "abbreviated" })));
43
+ function (i) { return locale.localize.day(i, { width: "abbreviated" }); }));
42
44
  }
43
45
  }, [locale, dayLabels]);
44
- return (_jsxs(Table, { ...swipeableHandlers, children: [_jsx(TableHead, { children: _jsx("tr", { children: days.map((day) => (_jsx(TableHeadCell, { scope: "column", children: day }, day))) }) }), _jsx(TableBody, { children: weeksEvents.map((week, i) => (_jsx(TableBodyRow, { ...week.props, children: week.days.map((day) => (_jsxs(TableBodyCell, { ...day.props, children: [_jsx(TableBodyCellDate, { ...day.props, children: day.label }), day.events.length > 0 && (_jsx(CalendarDaygridCell, { ...{
45
- eventClicked,
46
- setEventClicked,
47
- eventHovered,
48
- setEventHovered,
49
- view,
50
- maxEvents,
51
- events: day.events,
52
- timestamp: day.timestamp,
53
- calendarsMap,
54
- }, ...restKoine }))] }))) }))) })] }));
46
+ return (_jsxs(Table, __assign({}, swipeableHandlers, { children: [_jsx(TableHead, { children: _jsx("tr", { children: days.map(function (day) { return (_jsx(TableHeadCell, __assign({ scope: "column" }, { children: day }), day)); }) }) }), _jsx(TableBody, { children: weeksEvents.map(function (week, i) { return (_jsx(TableBodyRow, __assign({}, week.props, { children: week.days.map(function (day) { return (_jsxs(TableBodyCell, __assign({}, day.props, { children: [_jsx(TableBodyCellDate, __assign({}, day.props, { children: day.label })), day.events.length > 0 && (_jsx(CalendarDaygridCell, __assign({}, {
47
+ eventClicked: eventClicked,
48
+ setEventClicked: setEventClicked,
49
+ eventHovered: eventHovered,
50
+ setEventHovered: setEventHovered,
51
+ view: view,
52
+ maxEvents: maxEvents,
53
+ events: day.events,
54
+ timestamp: day.timestamp,
55
+ calendarsMap: calendarsMap,
56
+ }, restKoine)))] }))); }) }))); }) })] })));
55
57
  };
@@ -1,5 +1,6 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- export const KoineCalendarLegend = ({ calendarsMap = {}, toggleCalendarVisibility, LegendItem = "div", LegendItemStatus = "span", LegendItemLabel = "span", LegendItemEvents = "span", }) => {
3
+ export var KoineCalendarLegend = function (_a) {
3
4
  // const sorted = Object.entries(calendarsMap).sort((a, b) => {
4
5
  // const { name: nameA } = a[1];
5
6
  // const { name: nameB } = b[1];
@@ -7,5 +8,9 @@ export const KoineCalendarLegend = ({ calendarsMap = {}, toggleCalendarVisibilit
7
8
  // else if (nameA > nameB) return 1;
8
9
  // else return 0;
9
10
  // });
10
- return (_jsx(_Fragment, { children: Object.entries(calendarsMap).map(([id, calendar]) => (_jsxs(LegendItem, { onClick: () => toggleCalendarVisibility(id), "$color": calendar.color, "$empty": calendar.events === 0, disabled: calendar.events === 0, children: [_jsx(LegendItemStatus, { children: calendar.on ? "\u2b24" : "\u2b58" }), _jsx(LegendItemLabel, { children: calendar.name }), _jsx(LegendItemEvents, { children: calendar.events })] }, "CalendarLegend." + id))) }));
11
+ var _b = _a.calendarsMap, calendarsMap = _b === void 0 ? {} : _b, toggleCalendarVisibility = _a.toggleCalendarVisibility, _c = _a.LegendItem, LegendItem = _c === void 0 ? "div" : _c, _d = _a.LegendItemStatus, LegendItemStatus = _d === void 0 ? "span" : _d, _e = _a.LegendItemLabel, LegendItemLabel = _e === void 0 ? "span" : _e, _f = _a.LegendItemEvents, LegendItemEvents = _f === void 0 ? "span" : _f;
12
+ return (_jsx(_Fragment, { children: Object.entries(calendarsMap).map(function (_a) {
13
+ var id = _a[0], calendar = _a[1];
14
+ return (_jsxs(LegendItem, __assign({ onClick: function () { return toggleCalendarVisibility(id); }, "$color": calendar.color, "$empty": calendar.events === 0, disabled: calendar.events === 0 }, { children: [_jsx(LegendItemStatus, { children: calendar.on ? "\u2b24" : "\u2b58" }), _jsx(LegendItemLabel, { children: calendar.name }), _jsx(LegendItemEvents, { children: calendar.events })] }), "CalendarLegend." + id));
15
+ }) }));
11
16
  };