@koine/react 2.0.0-beta.10 → 2.0.0-beta.12

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 (216) hide show
  1. package/package.json +11 -11
  2. package/Alert/Alert.js +0 -33
  3. package/Alert/Alert.stories.js +0 -39
  4. package/Alert/index.js +0 -6
  5. package/Animations/Reveal.js +0 -53
  6. package/Animations/Underline.js +0 -26
  7. package/Animations/index.js +0 -8
  8. package/Animations/useReveal.js +0 -83
  9. package/Autocomplete/AutocompleteDownshift.js +0 -167
  10. package/Autocomplete/AutocompleteDownshiftMultiselect.js +0 -362
  11. package/Autocomplete/AutocompleteMui.js +0 -183
  12. package/Autocomplete/AutocompleteReach.js +0 -121
  13. package/Autocomplete/components.js +0 -132
  14. package/Autocomplete/helpers.js +0 -34
  15. package/Autocomplete/index.js +0 -15
  16. package/Bg/BgColor.js +0 -64
  17. package/Bg/BgPhoto.js +0 -82
  18. package/Bg/BgSvg.js +0 -31
  19. package/Bg/index.js +0 -8
  20. package/Breadcrumbs/Breadcrumbs.js +0 -103
  21. package/Breadcrumbs/index.js +0 -6
  22. package/Buttons/Button.js +0 -106
  23. package/Buttons/ButtonComposite.js +0 -116
  24. package/Buttons/ButtonFab.js +0 -27
  25. package/Buttons/ButtonLink.js +0 -29
  26. package/Buttons/IconButton.js +0 -41
  27. package/Buttons/index.js +0 -10
  28. package/Calendar/CalendarDaygridCell.js +0 -105
  29. package/Calendar/CalendarDaygridNav.js +0 -63
  30. package/Calendar/CalendarDaygridTable.js +0 -126
  31. package/Calendar/CalendarLegend.js +0 -39
  32. package/Calendar/calendar-api-google.js +0 -110
  33. package/Calendar/index.js +0 -11
  34. package/Calendar/types.js +0 -4
  35. package/Calendar/useCalendar.js +0 -235
  36. package/Calendar/utils.js +0 -252
  37. package/Carousel/Carousel.js +0 -387
  38. package/Carousel/CarouselCss.js +0 -64
  39. package/Carousel/index.js +0 -6
  40. package/Collapsable/Collapsable.js +0 -11
  41. package/Collapsable/CollapsableReach.js +0 -251
  42. package/Collapsable/index.js +0 -7
  43. package/Debug/Debug.js +0 -34
  44. package/Debug/index.js +0 -6
  45. package/Details/Details.js +0 -117
  46. package/Details/Details.stories.js +0 -39
  47. package/Details/index.js +0 -6
  48. package/Dialog/DialogMui.js +0 -143
  49. package/Dialog/DialogMui.stories.js +0 -38
  50. package/Dialog/css/bare.js +0 -55
  51. package/Dialog/css/index.stories.js +0 -93
  52. package/Dialog/index.js +0 -11
  53. package/Dialog/m/bare.js +0 -125
  54. package/Dialog/m/basic.js +0 -50
  55. package/Dialog/m/index.js +0 -14
  56. package/Dialog/sc/bare.js +0 -83
  57. package/Dialog/sc/framer.js +0 -26
  58. package/Dialog/sc/framerMaterial.js +0 -26
  59. package/Dialog/sc/index.stories.js +0 -75
  60. package/Dialog/sc/material.js +0 -78
  61. package/Dialog/tw/bare.js +0 -55
  62. package/Dialog/tw/elegant.js +0 -54
  63. package/Dialog/tw/framer.js +0 -26
  64. package/Dialog/tw/framerMaterial.js +0 -26
  65. package/Dialog/tw/index.stories.js +0 -113
  66. package/Dialog/tw/material.js +0 -54
  67. package/Editor/Editor--tiptap.js +0 -72
  68. package/Editor/components.js +0 -59
  69. package/Editor/index.js +0 -6
  70. package/FaviconTags.js +0 -73
  71. package/Form/Form.js +0 -130
  72. package/Form/index.js +0 -6
  73. package/Form/sc/bare.js +0 -55
  74. package/Forms/Checkbox/Checkbox.js +0 -62
  75. package/Forms/Checkbox/index.js +0 -6
  76. package/Forms/Feedback/Feedback.js +0 -25
  77. package/Forms/Feedback/index.js +0 -6
  78. package/Forms/Field/Field.js +0 -75
  79. package/Forms/Field/FieldControl.js +0 -69
  80. package/Forms/Field/FieldHint.js +0 -17
  81. package/Forms/Field/index.js +0 -7
  82. package/Forms/Input/Input.js +0 -67
  83. package/Forms/Input/index.js +0 -6
  84. package/Forms/InputGroup/InputGroup.js +0 -85
  85. package/Forms/InputGroup/index.js +0 -6
  86. package/Forms/Label/Label.js +0 -46
  87. package/Forms/Label/index.js +0 -6
  88. package/Forms/Password/Password.js +0 -72
  89. package/Forms/Password/index.js +0 -6
  90. package/Forms/Radio/Radio.js +0 -68
  91. package/Forms/Radio/index.js +0 -6
  92. package/Forms/Switch/Switch.js +0 -80
  93. package/Forms/Switch/index.js +0 -6
  94. package/Forms/Textarea/Textarea.js +0 -45
  95. package/Forms/Textarea/TextareaRich.js +0 -58
  96. package/Forms/Textarea/index.js +0 -7
  97. package/Forms/Toggle/Toggle-tailwind.js +0 -99
  98. package/Forms/Toggle/Toggle.js +0 -175
  99. package/Forms/Toggle/index.js +0 -6
  100. package/Forms/Toggle/useToggle-tailwind.js +0 -202
  101. package/Forms/Toggle/useToggle.js +0 -145
  102. package/Forms/antispam.js +0 -59
  103. package/Forms/helpers.js +0 -72
  104. package/Forms/index.js +0 -19
  105. package/Forms/styles.js +0 -94
  106. package/Gauge/Gauge.js +0 -111
  107. package/Grid/Grid.js +0 -106
  108. package/Grid/index.js +0 -6
  109. package/Hamburger/Hamburger.js +0 -90
  110. package/Hamburger/index.js +0 -6
  111. package/Header/index.js +0 -6
  112. package/Header/useHeader.js +0 -54
  113. package/Hidden/Hidden.js +0 -21
  114. package/Hidden/index.js +0 -6
  115. package/Img/index.js +0 -6
  116. package/Img/sc/bare.js +0 -43
  117. package/Img/types.js +0 -6
  118. package/Link/Link.js +0 -13
  119. package/Link/LinkBlank.js +0 -52
  120. package/Link/index.js +0 -7
  121. package/Menu/Menu.js +0 -22
  122. package/Menu/MenuMui.js +0 -165
  123. package/Menu/index.js +0 -6
  124. package/MenuItem/MenuItem.js +0 -31
  125. package/MenuItem/MenuItemMui.js +0 -32
  126. package/MenuItem/index.js +0 -6
  127. package/MenuItem/useMenuItem.js +0 -96
  128. package/Meta/Meta.js +0 -26
  129. package/Meta/index.js +0 -12
  130. package/NoJs/NoJs.js +0 -28
  131. package/NoJs/index.js +0 -12
  132. package/Pagination/PaginationNav.js +0 -126
  133. package/Pagination/PaginationResults.js +0 -45
  134. package/Pagination/index.js +0 -7
  135. package/Pill/Pill.js +0 -62
  136. package/Pill/index.js +0 -6
  137. package/Progress/ProgressCircular.js +0 -62
  138. package/Progress/ProgressLinear.js +0 -53
  139. package/Progress/ProgressOverlay.js +0 -75
  140. package/Progress/index.js +0 -8
  141. package/Rating/Rating.js +0 -188
  142. package/Rating/index.js +0 -85
  143. package/Select/SelectDownshift.js +0 -47
  144. package/Select/components.js +0 -44
  145. package/Select/index.js +0 -13
  146. package/Sidebar/Sidebar.js +0 -74
  147. package/Sidebar/index.js +0 -6
  148. package/Spacing/Spacing.js +0 -55
  149. package/Spacing/index.js +0 -6
  150. package/Sticky/Sticky.js +0 -228
  151. package/Sticky/StickyCss.js +0 -20
  152. package/Sticky/index.js +0 -19
  153. package/Tabs/TabsMui.js +0 -91
  154. package/Tabs/TabsMui.stories.js +0 -38
  155. package/Tabs/index.js +0 -6
  156. package/Tabs/sc/bare.js +0 -86
  157. package/Tabs/sc/index.stories.js +0 -1
  158. package/Tabs/tw/bare.js +0 -45
  159. package/Tabs/tw/index.stories.js +0 -46
  160. package/Tabs/tw/material.js +0 -44
  161. package/Tabs/useTabs.js +0 -66
  162. package/Typography/CopyPasteVisible.js +0 -17
  163. package/Typography/Native.js +0 -90
  164. package/Typography/ReadMore.js +0 -125
  165. package/Typography/TextLoop.js +0 -108
  166. package/Typography/TypeStairs.js +0 -71
  167. package/Typography/index.js +0 -10
  168. package/css/index.js +0 -33
  169. package/helpers/classed.js +0 -66
  170. package/helpers/classed.stories.js +0 -140
  171. package/helpers/createUseMediaQueryWidth.js +0 -193
  172. package/helpers/extend-component.js +0 -32
  173. package/helpers/index.js +0 -9
  174. package/helpers/mergeRefs.js +0 -30
  175. package/hooks/index.js +0 -92
  176. package/hooks/types.js +0 -6
  177. package/hooks/useAsyncFn.js +0 -56
  178. package/hooks/useDateLocale.js +0 -51
  179. package/hooks/useFirstMountState.js +0 -28
  180. package/hooks/useFixedOffset.js +0 -67
  181. package/hooks/useFocus.js +0 -30
  182. package/hooks/useInterval.js +0 -44
  183. package/hooks/useIsomorphicLayoutEffect.js +0 -23
  184. package/hooks/useKeyUp.js +0 -40
  185. package/hooks/useMeasure.js +0 -189
  186. package/hooks/useMountedState.js +0 -31
  187. package/hooks/useNavigateAway.js +0 -69
  188. package/hooks/usePrevious.js +0 -33
  189. package/hooks/usePreviousRef.js +0 -27
  190. package/hooks/useScrollPosition.js +0 -83
  191. package/hooks/useScrollThreshold.js +0 -52
  192. package/hooks/useScrollTo.js +0 -39
  193. package/hooks/useSmoothScroll.js +0 -49
  194. package/hooks/useSpinDelay.js +0 -59
  195. package/hooks/useTraceUpdate.js +0 -39
  196. package/hooks/useUpdateEffect.js +0 -30
  197. package/hooks/useWindowSize.js +0 -43
  198. package/index.js +0 -10
  199. package/m/MotionProvider.js +0 -27
  200. package/m/index.js +0 -10
  201. package/m/lite.js +0 -12
  202. package/m/max.js +0 -12
  203. package/sc/index.js +0 -49
  204. package/scm/index.js +0 -40
  205. package/shared/index.js +0 -13
  206. package/styles/Body.js +0 -28
  207. package/styles/Global.js +0 -55
  208. package/styles/index.js +0 -142
  209. package/styles/media.js +0 -139
  210. package/styles/spacing.js +0 -70
  211. package/styles/styled.js +0 -58
  212. package/styles/theme--vanilla.js +0 -82
  213. package/styles/theme.js +0 -49
  214. package/tw/index.js +0 -33
  215. package/twm/index.js +0 -33
  216. package/types.js +0 -4
@@ -1,116 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "KoineButtonComposite", {
6
- enumerable: true,
7
- get: function() {
8
- return KoineButtonComposite;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _jsxruntime = require("react/jsx-runtime");
13
- const _react = require("react");
14
- const _styledcomponents = /*#__PURE__*/ _interop_require_default._(require("styled-components"));
15
- const Root = _styledcomponents.default.span`
16
- ${(p)=>p.$icon ? `display: flex;` : `display: inline-block; text-align: left;`}
17
- min-width: 0;
18
-
19
- & svg {
20
- font-size: 2em !important;
21
- margin: 0 0.33em 0 0 !important;
22
- }
23
- `;
24
- const ButtonCompositeIcon = _styledcomponents.default.svg`
25
- float: left;
26
- `;
27
- const BesidesIcon = _styledcomponents.default.span`
28
- text-align: left;
29
- line-height: 1.2;
30
- `;
31
- const Main = _styledcomponents.default.span`
32
- display: block;
33
- font-size: 0.9em;
34
-
35
- &:last-child {
36
- margin-top: ${(p)=>p.$reverse && !p.$icon ? "0.5em" : "0"};
37
- }
38
- `;
39
- const Sub = _styledcomponents.default.span`
40
- display: block;
41
- text-transform: none;
42
- font-size: 0.7em;
43
- font-weight: 500;
44
-
45
- ${Main} + & {
46
- margin-top: ${(p)=>p.$reverse && !p.$icon ? "0.5em" : "0"};
47
- }
48
- `;
49
- const Text = _styledcomponents.default.span``;
50
- const Inner = /*#__PURE__*/ (0, _react.memo)(({ textMain, textSub, text, $reverse, $icon })=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
51
- children: [
52
- $reverse ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
53
- children: [
54
- textSub && /*#__PURE__*/ (0, _jsxruntime.jsx)(Sub, {
55
- $icon: $icon,
56
- $reverse: $reverse,
57
- children: textSub
58
- }),
59
- textMain && /*#__PURE__*/ (0, _jsxruntime.jsx)(Main, {
60
- $icon: $icon,
61
- $reverse: $reverse,
62
- children: textMain
63
- })
64
- ]
65
- }) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
66
- children: [
67
- textMain && /*#__PURE__*/ (0, _jsxruntime.jsx)(Main, {
68
- $icon: $icon,
69
- $reverse: $reverse,
70
- children: textMain
71
- }),
72
- textSub && /*#__PURE__*/ (0, _jsxruntime.jsx)(Sub, {
73
- $icon: $icon,
74
- $reverse: $reverse,
75
- children: textSub
76
- })
77
- ]
78
- }),
79
- text && /*#__PURE__*/ (0, _jsxruntime.jsx)(Text, {
80
- children: text
81
- })
82
- ]
83
- }));
84
- const KoineButtonComposite = ({ Icon, iconProps = {}, textMain, textSub, textReverse, text, Button = "button", ButtonLink = "a", ...props })=>{
85
- const Btn = props.href ? ButtonLink : Button;
86
- const styledProps = {
87
- $icon: !!Icon,
88
- $reverse: textReverse,
89
- $twoLines: !!(textMain && textSub && !Icon)
90
- };
91
- const innerProps = {
92
- textMain,
93
- textSub,
94
- text,
95
- ...styledProps
96
- };
97
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(Root, {
98
- as: Btn,
99
- ...props,
100
- ...styledProps,
101
- children: [
102
- Icon && /*#__PURE__*/ (0, _jsxruntime.jsx)(ButtonCompositeIcon, {
103
- as: Icon,
104
- ...iconProps
105
- }),
106
- Icon ? /*#__PURE__*/ (0, _jsxruntime.jsx)(BesidesIcon, {
107
- ...styledProps,
108
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Inner, {
109
- ...innerProps
110
- })
111
- }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(Inner, {
112
- ...innerProps
113
- })
114
- ]
115
- });
116
- };
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- buttonFab: function() {
13
- return buttonFab;
14
- },
15
- IconButtonFab: function() {
16
- return IconButtonFab;
17
- }
18
- });
19
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
20
- const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard._(require("styled-components"));
21
- const _IconButton = require("./IconButton");
22
- const buttonFab = (0, _styledcomponents.css)`
23
- box-shadow: 3px 3px 6px -4px rgb(0, 0, 0, 0.5);
24
- `;
25
- const IconButtonFab = (0, _styledcomponents.default)(_IconButton.IconButton)`
26
- ${buttonFab}
27
- `;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "KoineButtonLink", {
6
- enumerable: true,
7
- get: function() {
8
- return KoineButtonLink;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _jsxruntime = require("react/jsx-runtime");
13
- const _styledcomponents = /*#__PURE__*/ _interop_require_default._(require("styled-components"));
14
- const _Button = require("./Button");
15
- const Root = (0, _styledcomponents.default)(_Button.KoineButton)`
16
- text-decoration: none;
17
- `;
18
- const KoineButtonLink = ({ href, Link = "a", ...props })=>{
19
- const isRelative = href && href.startsWith("/");
20
- return isRelative ? /*#__PURE__*/ (0, _jsxruntime.jsx)(Root, {
21
- href: href,
22
- ...props,
23
- as: Link
24
- }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(Root, {
25
- href: href,
26
- ...props,
27
- as: "a"
28
- });
29
- };
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- iconBtnStyleReset: function() {
13
- return iconBtnStyleReset;
14
- },
15
- iconBtnStyleBase: function() {
16
- return iconBtnStyleBase;
17
- },
18
- IconButton: function() {
19
- return IconButton;
20
- }
21
- });
22
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
23
- const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard._(require("styled-components"));
24
- const _Button = require("./Button");
25
- const iconBtnStyleReset = (0, _styledcomponents.css)`
26
- display: inline-flex;
27
- align-items: center;
28
- justify-content: center;
29
- width: 44px;
30
- height: 44px;
31
- border-radius: 100%;
32
- ${_Button.btnStyleReset}
33
- `;
34
- const iconBtnStyleBase = (0, _styledcomponents.css)`
35
- ${iconBtnStyleReset}
36
- `;
37
- const IconButton = _styledcomponents.default.button`
38
- ${iconBtnStyleBase}
39
- ${(p)=>p.$variant === "outlined" && _Button.btnStyleOutlined}
40
- ${(p)=>p.$variant === "contained" && _Button.btnStyleContained}
41
- `;
package/Buttons/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./Button"), exports);
7
- _export_star._(require("./ButtonComposite"), exports);
8
- _export_star._(require("./ButtonFab"), exports);
9
- _export_star._(require("./ButtonLink"), exports);
10
- _export_star._(require("./IconButton"), exports);
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "CalendarDaygridCell", {
6
- enumerable: true,
7
- get: function() {
8
- return CalendarDaygridCell;
9
- }
10
- });
11
- const _jsxruntime = require("react/jsx-runtime");
12
- const _react = require("react");
13
- const _md = require("react-icons/md");
14
- const _utils = require("./utils");
15
- /**
16
- * Style for button within a event cell
17
- *
18
- * Here we might differentiate week/month view where the first does not get
19
- * ellipsed btn texts, with `Start` as block element and underneath the `Title`
20
- * on multiple lines, but that would mean that we loose the ability to interweave
21
- * single-day events among the spaces left by wider multi-days events.
22
- */ const styleBtn = {
23
- overflow: "hidden",
24
- whiteSpace: "nowrap",
25
- textOverflow: "ellipsis"
26
- };
27
- const CalendarDaygridCell = ({ eventClicked, setEventClicked, // eventHovered,
28
- setEventHovered, view, maxEvents, events, calendarsMap, Cell = "div", CellOverflow = "div", CellEvent = "div", CellEventBtn = "div", CellEventTitle = "span", CellEventStart = "span" })=>{
29
- const [isExpanded, expand] = (0, _react.useState)(false);
30
- const eventsWithoutPlaceholders = events.filter((event)=>!event.placeholder);
31
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(Cell, {
32
- children: events.map((event, i)=>{
33
- if (i === maxEvents && !isExpanded) {
34
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(CellOverflow, {
35
- onClick: ()=>expand(true),
36
- children: [
37
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_md.MdAdd, {}),
38
- eventsWithoutPlaceholders.length - maxEvents
39
- ]
40
- }, "overflowMessage" + i);
41
- }
42
- if (i > maxEvents && !isExpanded) return null;
43
- if (event.placeholder) {
44
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, {
45
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEvent, {
46
- $placeholder: true,
47
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEventBtn, {
48
- "aria-hidden": "true",
49
- style: {
50
- visibility: "hidden"
51
- },
52
- $placeholder: true,
53
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEventTitle, {
54
- children: "\xa0"
55
- })
56
- })
57
- })
58
- }, event.key);
59
- }
60
- const styleEvent = {
61
- zIndex: event.firstOfMulti ? 1 : 0,
62
- position: "relative",
63
- width: event.firstOfMulti ? `${100 * event.width}%` : "100%"
64
- };
65
- if (!calendarsMap[event.calendar.id].on) {
66
- // @ts-expect-error nevermind
67
- styleBtn.display = "none";
68
- }
69
- const styledProps = {
70
- $view: view,
71
- $selected: eventClicked?.uid === event.uid,
72
- $past: event.isPast,
73
- $color: event.color,
74
- $isOutOfRange: event.$isOutOfRange,
75
- $isToday: event.$isToday
76
- };
77
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, {
78
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEvent, {
79
- style: styleEvent,
80
- ...styledProps,
81
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEventBtn, {
82
- role: "button",
83
- style: styleBtn,
84
- ...styledProps,
85
- onClick: ()=>setEventClicked((prev)=>prev?.uid === event.uid ? null : event),
86
- onMouseEnter: ()=>setEventHovered(event),
87
- onMouseLeave: ()=>setEventHovered(null),
88
- children: event.allDay ? /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEventTitle, {
89
- children: event.title
90
- }) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
91
- children: [
92
- /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEventStart, {
93
- children: (0, _utils.getDisplayTime)(event.start)
94
- }),
95
- /*#__PURE__*/ (0, _jsxruntime.jsx)(CellEventTitle, {
96
- children: event.title
97
- })
98
- ]
99
- })
100
- })
101
- })
102
- }, event.key);
103
- })
104
- });
105
- };
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "KoineCalendarDaygridNav", {
6
- enumerable: true,
7
- get: function() {
8
- return KoineCalendarDaygridNav;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _jsxruntime = require("react/jsx-runtime");
13
- const _format = /*#__PURE__*/ _interop_require_default._(require("date-fns/format"));
14
- const _useDateLocale = require("../hooks/useDateLocale");
15
- 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" })=>{
16
- const [start, end] = range;
17
- const locale = (0, _useDateLocale.useDateLocale)(localeCode);
18
- const opts = {
19
- locale
20
- };
21
- let formatted = "";
22
- if (view === "month") {
23
- formatted = (0, _format.default)(start, "MMMM yyyy", opts);
24
- }
25
- if (view === "week") {
26
- const inSameMonth = start.getMonth() === end.getMonth();
27
- if (inSameMonth) {
28
- formatted = (0, _format.default)(start, "# MMMM yyyy", opts).replace("#", `${start.getDate()}-${end.getDate()}`);
29
- } else {
30
- formatted = `${(0, _format.default)(start, "d MMMM", opts)} - ${(0, _format.default)(end, "d MMMM yyyy", opts)}`;
31
- }
32
- }
33
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(NavRoot, {
34
- children: [
35
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(NavBtns, {
36
- children: [
37
- /*#__PURE__*/ (0, _jsxruntime.jsx)(NavBtnPrev, {
38
- onClick: handlePrev
39
- }),
40
- /*#__PURE__*/ (0, _jsxruntime.jsx)(NavBtnNext, {
41
- onClick: handleNext
42
- }),
43
- /*#__PURE__*/ (0, _jsxruntime.jsx)(NavBtnToday, {
44
- onClick: handleToday,
45
- disabled: todayInView
46
- }),
47
- /*#__PURE__*/ (0, _jsxruntime.jsx)(NavBtnViewMonth, {
48
- onClick: ()=>handleView("month"),
49
- disabled: view === "month"
50
- }),
51
- /*#__PURE__*/ (0, _jsxruntime.jsx)(NavBtnViewWeek, {
52
- onClick: ()=>handleView("week"),
53
- disabled: view === "week"
54
- })
55
- ]
56
- }),
57
- /*#__PURE__*/ (0, _jsxruntime.jsx)(NavTitle, {
58
- range: range,
59
- formatted: formatted
60
- })
61
- ]
62
- });
63
- };
@@ -1,126 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "KoineCalendarDaygridTable", {
6
- enumerable: true,
7
- get: function() {
8
- return KoineCalendarDaygridTable;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _jsxruntime = require("react/jsx-runtime");
13
- const _eachWeekOfInterval = /*#__PURE__*/ _interop_require_default._(require("date-fns/eachWeekOfInterval"));
14
- const _react = require("react");
15
- const _reactswipeable = require("react-swipeable");
16
- const _hooks = require("../hooks");
17
- const _CalendarDaygridCell = require("./CalendarDaygridCell");
18
- const _utils = require("./utils");
19
- function getView(range) {
20
- const [start, end] = range;
21
- const weeks = (0, _eachWeekOfInterval.default)({
22
- start,
23
- end
24
- }, {
25
- weekStartsOn: 1
26
- });
27
- return {
28
- month: start.getMonth(),
29
- weeks
30
- };
31
- }
32
- 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 })=>{
33
- const restKoine = {
34
- Cell,
35
- CellOverflow,
36
- CellEvent,
37
- CellEventBtn,
38
- CellEventTitle,
39
- CellEventStart
40
- };
41
- const [days, setDays] = (0, _react.useState)(dayLabels || [
42
- 0,
43
- 1,
44
- 2,
45
- 3,
46
- 4,
47
- 5,
48
- 6
49
- ]);
50
- const [weeksEvents, setWeeksEvents] = (0, _react.useState)([]);
51
- // const [days, setDays] = useState(dayLabels || [...Array(7).keys()]);
52
- const locale = (0, _hooks.useDateLocale)(localeCode);
53
- const { month, weeks } = (0, _react.useMemo)(()=>getView(range), [
54
- range
55
- ]);
56
- const swipeableHandlers = (0, _reactswipeable.useSwipeable)({
57
- onSwipedLeft: handleNext,
58
- onSwipedRight: handlePrev
59
- });
60
- (0, _react.useEffect)(()=>{
61
- setWeeksEvents((0, _utils.processEventsInView)(events, view, month, weeks));
62
- }, [
63
- events,
64
- view,
65
- month,
66
- weeks
67
- ]);
68
- (0, _react.useEffect)(()=>{
69
- if (locale && locale.localize && !dayLabels) {
70
- setDays([
71
- 1,
72
- 2,
73
- 3,
74
- 4,
75
- 5,
76
- 6,
77
- 0
78
- ].map(// @ts-expect-error nevermind
79
- (i)=>locale.localize.day(i, {
80
- width: "abbreviated"
81
- })));
82
- }
83
- }, [
84
- locale,
85
- dayLabels
86
- ]);
87
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(Table, {
88
- ...swipeableHandlers,
89
- children: [
90
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TableHead, {
91
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)("tr", {
92
- children: days.map((day)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(TableHeadCell, {
93
- scope: "column",
94
- children: day
95
- }, day))
96
- })
97
- }),
98
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TableBody, {
99
- children: weeksEvents.map((week, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(TableBodyRow, {
100
- ...week.props,
101
- children: week.days.map((day)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(TableBodyCell, {
102
- ...day.props,
103
- children: [
104
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TableBodyCellDate, {
105
- ...day.props,
106
- children: day.label
107
- }),
108
- day.events.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_CalendarDaygridCell.CalendarDaygridCell, {
109
- eventClicked,
110
- setEventClicked,
111
- eventHovered,
112
- setEventHovered,
113
- view,
114
- maxEvents,
115
- events: day.events,
116
- timestamp: day.timestamp,
117
- calendarsMap,
118
- ...restKoine
119
- })
120
- ]
121
- }))
122
- }))
123
- })
124
- ]
125
- });
126
- };
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "KoineCalendarLegend", {
6
- enumerable: true,
7
- get: function() {
8
- return KoineCalendarLegend;
9
- }
10
- });
11
- const _jsxruntime = require("react/jsx-runtime");
12
- const KoineCalendarLegend = ({ calendarsMap = {}, toggleCalendarVisibility, LegendItem = "div", LegendItemStatus = "span", LegendItemLabel = "span", LegendItemEvents = "span" })=>{
13
- // const sorted = Object.entries(calendarsMap).sort((a, b) => {
14
- // const { name: nameA } = a[1];
15
- // const { name: nameB } = b[1];
16
- // if (nameA < nameB) return -1;
17
- // else if (nameA > nameB) return 1;
18
- // else return 0;
19
- // });
20
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
21
- children: Object.entries(calendarsMap).map(([id, calendar])=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(LegendItem, {
22
- onClick: ()=>toggleCalendarVisibility(id),
23
- $color: calendar.color,
24
- $empty: calendar.events === 0,
25
- disabled: calendar.events === 0,
26
- children: [
27
- /*#__PURE__*/ (0, _jsxruntime.jsx)(LegendItemStatus, {
28
- children: calendar.on ? "\u2b24" : "\u2b58"
29
- }),
30
- /*#__PURE__*/ (0, _jsxruntime.jsx)(LegendItemLabel, {
31
- children: calendar.name
32
- }),
33
- /*#__PURE__*/ (0, _jsxruntime.jsx)(LegendItemEvents, {
34
- children: calendar.events
35
- })
36
- ]
37
- }, "CalendarLegend." + id))
38
- });
39
- };
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getCalendarsEventsFromGoogle", {
6
- enumerable: true,
7
- get: function() {
8
- return getCalendarsEventsFromGoogle;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _differenceInDays = /*#__PURE__*/ _interop_require_default._(require("date-fns/differenceInDays"));
13
- const _subDays = /*#__PURE__*/ _interop_require_default._(require("date-fns/subDays"));
14
- const _arrayToLookup = /*#__PURE__*/ _interop_require_default._(require("@koine/utils/arrayToLookup"));
15
- const _isString = /*#__PURE__*/ _interop_require_default._(require("@koine/utils/isString"));
16
- const _isUndefined = /*#__PURE__*/ _interop_require_default._(require("@koine/utils/isUndefined"));
17
- const _utils = require("./utils");
18
- const baseURL = "https://www.googleapis.com/calendar/v3/calendars/";
19
- async function getCalendarsEventsFromGoogle({ calendars, ...options }) {
20
- const allEvents = {};
21
- await Promise.all(calendars.map(async (calendar)=>{
22
- const events = await getCalendarEventsFromGoogle({
23
- calendar,
24
- ...options
25
- });
26
- (0, _utils.addCalendarEvents)(events, allEvents);
27
- }));
28
- return allEvents;
29
- }
30
- async function getCalendarEventsFromGoogle({ apiKey, calendar, timeZone = "", start, end }) {
31
- const events = {};
32
- const params = new URLSearchParams({
33
- calendarId: calendar.id,
34
- timeZone,
35
- singleEvents: "true",
36
- maxAttendees: "1",
37
- maxResults: "9999",
38
- sanitizeHtml: "true",
39
- timeMin: start.toISOString(),
40
- timeMax: end.toISOString(),
41
- key: apiKey || process.env["GOOGLE_CALENDAR_API_KEY"] || ""
42
- }).toString();
43
- const url = baseURL + calendar.id + "/events?" + params;
44
- try {
45
- const response = await fetch(url, {
46
- method: "GET"
47
- });
48
- const data = await response.json();
49
- calendar.name = calendar.name || data.summary;
50
- data.items.forEach((googleEvent)=>{
51
- const event = transformCalendarEventFromGoogle(googleEvent, calendar);
52
- events[event.uid] = event;
53
- });
54
- } catch (e) {
55
- // if (onError) onError(e);
56
- }
57
- return events;
58
- }
59
- function transformCalendarEventFromGoogle(event, calendar) {
60
- const created = new Date(event.created);
61
- const link = event.htmlLink;
62
- const title = event.summary;
63
- const status = event.status;
64
- const start = new Date(event.start.date || event.start.dateTime);
65
- let end = new Date(event.end.date || event.end.dateTime);
66
- const color = calendar.color;
67
- const allDay = (0, _isUndefined.default)(event.end.dateTime) && (0, _isString.default)(event.end.date);
68
- const location = event.location || "";
69
- const description = event.description || ""; // FIXME: he.decode(event.description || '');
70
- const uid = created.getTime() + "" + start.getTime();
71
- // multi-days all day events has as end date the date after to what we actually
72
- // mean, hence we subtract one day. @see https://support.google.com/calendar/thread/10074544/google-calendar-all-day-events-are-showing-up-as-a-24-hr-event-across-time-zones?hl=en
73
- if (allDay && end > start) {
74
- end = (0, _subDays.default)(end, 1);
75
- end.setHours(23, 59, 59);
76
- }
77
- const days = getDays();
78
- const daysMap = (0, _arrayToLookup.default)(days);
79
- const multi = days.length > 1;
80
- function getDays() {
81
- const from = new Date(start);
82
- const to = new Date(end);
83
- const days = [
84
- (0, _utils.getEventTimestamp)(from)
85
- ];
86
- while((0, _differenceInDays.default)(to, from)){
87
- // console.log(title, differenceInDays(to, from))
88
- from.setDate(from.getDate() + 1);
89
- days.push((0, _utils.getEventTimestamp)(from));
90
- }
91
- return days;
92
- }
93
- return {
94
- calendar,
95
- created,
96
- link,
97
- title,
98
- status,
99
- start,
100
- end,
101
- days,
102
- daysMap,
103
- multi,
104
- color,
105
- allDay,
106
- location,
107
- description,
108
- uid
109
- };
110
- }