@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,12 +1,12 @@
1
+ import { __assign } from "tslib";
1
2
  import { createElement } from "react";
2
- export const extendComponent = (component, defaultProps) => {
3
+ export var extendComponent = function (component, defaultProps) {
3
4
  // FIXME: check if we need to forwardRef or not
4
- const NewComponent = (props) => createElement(component, props);
5
+ var NewComponent = function (props) {
6
+ return createElement(component, props);
7
+ };
5
8
  // const NewComponent = forwardRef<React.ComponentProps<Component>, Component>(
6
9
  // (props, ref) => createElement(component, { ...props, ref })
7
10
  // );
8
- return Object.assign(NewComponent, {
9
- ...defaultProps,
10
- defaultProps,
11
- });
11
+ return Object.assign(NewComponent, __assign(__assign({}, defaultProps), { defaultProps: defaultProps }));
12
12
  };
@@ -1,26 +1,33 @@
1
+ import { __assign } from "tslib";
1
2
  import { useCallback, useRef, useState } from "react";
2
3
  import { useMountedState } from "./useMountedState";
3
4
  /**
4
5
  * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useAsyncFn.ts)
5
6
  */
6
- export function useAsyncFn(fn, deps = [], initialState = { loading: false }) {
7
- const lastCallId = useRef(0);
8
- const isMounted = useMountedState();
9
- const [state, set] = useState(initialState);
10
- const callback = useCallback((...args) => {
11
- const callId = ++lastCallId.current;
7
+ export function useAsyncFn(fn, deps, initialState) {
8
+ if (deps === void 0) { deps = []; }
9
+ if (initialState === void 0) { initialState = { loading: false }; }
10
+ var lastCallId = useRef(0);
11
+ var isMounted = useMountedState();
12
+ var _a = useState(initialState), state = _a[0], set = _a[1];
13
+ var callback = useCallback(function () {
14
+ var args = [];
15
+ for (var _i = 0; _i < arguments.length; _i++) {
16
+ args[_i] = arguments[_i];
17
+ }
18
+ var callId = ++lastCallId.current;
12
19
  if (!state.loading) {
13
- set((prevState) => ({ ...prevState, loading: true }));
20
+ set(function (prevState) { return (__assign(__assign({}, prevState), { loading: true })); });
14
21
  }
15
- return fn(...args).then((value) => {
22
+ return fn.apply(void 0, args).then(function (value) {
16
23
  isMounted() &&
17
24
  callId === lastCallId.current &&
18
- set({ value, loading: false });
25
+ set({ value: value, loading: false });
19
26
  return value;
20
- }, (error) => {
27
+ }, function (error) {
21
28
  isMounted() &&
22
29
  callId === lastCallId.current &&
23
- set({ error, loading: false });
30
+ set({ error: error, loading: false });
24
31
  return error;
25
32
  });
26
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1,3 +1,4 @@
1
+ import { __awaiter, __generator } from "tslib";
1
2
  import { useEffect, useState } from "react";
2
3
  /**
3
4
  * Dynamically import the date-fns correct locale
@@ -5,21 +6,29 @@ import { useEffect, useState } from "react";
5
6
  * Inspired by:
6
7
  * @see https://robertmarshall.dev/blog/dynamically-import-datefns-locale-mui-datepicker-localization/
7
8
  */
8
- export function useDateLocale(locale, defaultLocale = "en") {
9
- const [data, setData] = useState();
10
- const [current, setCurrent] = useState(defaultLocale);
9
+ export function useDateLocale(locale, defaultLocale) {
10
+ var _this = this;
11
+ if (defaultLocale === void 0) { defaultLocale = "en"; }
12
+ var _a = useState(), data = _a[0], setData = _a[1];
13
+ var _b = useState(defaultLocale), current = _b[0], setCurrent = _b[1];
11
14
  // const [ready, setReady] = useState(false);
12
15
  // If the user changes the locale listen to the change and import the locale that is now required.
13
- useEffect(() => {
14
- const importLocaleFile = async () => {
15
- // This webpack option stops all of the date-fns files being imported and chunked.
16
- const localeToSet = await import(
17
- /* webpackMode: "lazy", webpackChunkName: "df-[index]", webpackExclude: /_lib/ */
18
- `date-fns/locale/${locale}/index.js`);
19
- setCurrent(locale || current);
20
- setData(localeToSet.default);
21
- // setReady(true);
22
- };
16
+ useEffect(function () {
17
+ var importLocaleFile = function () { return __awaiter(_this, void 0, void 0, function () {
18
+ var localeToSet;
19
+ return __generator(this, function (_a) {
20
+ switch (_a.label) {
21
+ case 0: return [4 /*yield*/, import(
22
+ /* webpackMode: "lazy", webpackChunkName: "df-[index]", webpackExclude: /_lib/ */
23
+ "date-fns/locale/".concat(locale, "/index.js"))];
24
+ case 1:
25
+ localeToSet = _a.sent();
26
+ setCurrent(locale || current);
27
+ setData(localeToSet.default);
28
+ return [2 /*return*/];
29
+ }
30
+ });
31
+ }); };
23
32
  // If the locale has not yet been loaded.
24
33
  if (locale !== current) {
25
34
  importLocaleFile();
@@ -2,7 +2,7 @@ import { useEffect } from "react";
2
2
  /**
3
3
  * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useEffectOnce.ts)
4
4
  */
5
- export const useEffectOnce = (effect) => {
5
+ export var useEffectOnce = function (effect) {
6
6
  // eslint-disable-next-line react-hooks/exhaustive-deps
7
7
  useEffect(effect, []);
8
8
  };
@@ -3,7 +3,7 @@ import { useRef } from "react";
3
3
  * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useFirstMountState.ts)
4
4
  */
5
5
  export function useFirstMountState() {
6
- const isFirst = useRef(true);
6
+ var isFirst = useRef(true);
7
7
  if (isFirst.current) {
8
8
  isFirst.current = false;
9
9
  return true;
package/hooks/useFocus.js CHANGED
@@ -2,9 +2,9 @@ import { useRef } from "react";
2
2
  /**
3
3
  * @see https://stackoverflow.com/a/54159564/1938970
4
4
  */
5
- export const useFocus = () => {
6
- const element = useRef(null);
7
- const setFocus = () => {
5
+ export var useFocus = function () {
6
+ var element = useRef(null);
7
+ var setFocus = function () {
8
8
  element.current && element.current.focus();
9
9
  };
10
10
  return [element, setFocus];
package/hooks/useId.js CHANGED
@@ -2,6 +2,7 @@ import { uid } from "@koine/utils";
2
2
  /**
3
3
  * FIXME: once we can move to react 18 just replace this import with `{ useId } from "react";`
4
4
  */
5
- export function useId(prefix = "uid") {
6
- return `${prefix}-${uid()}`;
5
+ export function useId(prefix) {
6
+ if (prefix === void 0) { prefix = "uid"; }
7
+ return "".concat(prefix, "-").concat(uid());
7
8
  }
@@ -3,6 +3,6 @@ import { isBrowser } from "@koine/utils";
3
3
  /**
4
4
  * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useFirstMountState.ts)
5
5
  */
6
- export const useIsomorphicLayoutEffect = isBrowser
6
+ export var useIsomorphicLayoutEffect = isBrowser
7
7
  ? useLayoutEffect
8
8
  : useEffect;
package/hooks/useMount.js CHANGED
@@ -2,8 +2,8 @@ import { useEffectOnce } from "./useEffectOnce";
2
2
  /**
3
3
  * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMount.ts)
4
4
  */
5
- export const useMount = (fn) => {
6
- useEffectOnce(() => {
5
+ export var useMount = function (fn) {
6
+ useEffectOnce(function () {
7
7
  fn();
8
8
  });
9
9
  };
@@ -3,11 +3,11 @@ import { useCallback, useEffect, useRef } from "react";
3
3
  * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMountedState.ts)
4
4
  */
5
5
  export function useMountedState() {
6
- const mountedRef = useRef(false);
7
- const get = useCallback(() => mountedRef.current, []);
8
- useEffect(() => {
6
+ var mountedRef = useRef(false);
7
+ var get = useCallback(function () { return mountedRef.current; }, []);
8
+ useEffect(function () {
9
9
  mountedRef.current = true;
10
- return () => {
10
+ return function () {
11
11
  mountedRef.current = false;
12
12
  };
13
13
  }, []);
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef } from "react";
2
2
  export function usePrevious(value) {
3
- const ref = useRef();
4
- useEffect(() => {
3
+ var ref = useRef();
4
+ useEffect(function () {
5
5
  ref.current = value;
6
6
  });
7
7
  return ref.current;
@@ -1,17 +1,19 @@
1
1
  import { useRef } from "react";
2
2
  import { isBrowser } from "@koine/utils";
3
3
  import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
4
- const zeroPosition = { x: 0, y: 0 };
5
- const getClientRect = (element) => element?.getBoundingClientRect();
6
- const getScrollPosition = (element, useWindow, boundingElement) => {
4
+ var zeroPosition = { x: 0, y: 0 };
5
+ var getClientRect = function (element) {
6
+ return element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
7
+ };
8
+ var getScrollPosition = function (element, useWindow, boundingElement) {
7
9
  if (!isBrowser) {
8
10
  return zeroPosition;
9
11
  }
10
12
  if (useWindow) {
11
13
  return { x: window.scrollX, y: window.scrollY };
12
14
  }
13
- const targetPosition = getClientRect(element?.current || document.body);
14
- const containerPosition = getClientRect(boundingElement?.current);
15
+ var targetPosition = getClientRect((element === null || element === void 0 ? void 0 : element.current) || document.body);
16
+ var containerPosition = getClientRect(boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
15
17
  if (!targetPosition) {
16
18
  return zeroPosition;
17
19
  }
@@ -29,20 +31,22 @@ const getScrollPosition = (element, useWindow, boundingElement) => {
29
31
  * - reused internal helper functions
30
32
  * - compacted object arguments in functions as plain argument list to improve compression
31
33
  */
32
- export const useScrollPosition = (effect, deps = [], element, useWindow, wait, boundingElement) => {
33
- const position = useRef(getScrollPosition(null, useWindow, boundingElement));
34
- let throttleTimeout = null;
35
- const callBack = () => {
36
- const current = getScrollPosition(element, useWindow, boundingElement);
34
+ export var useScrollPosition = function (effect, deps, element, useWindow, wait, boundingElement) {
35
+ if (deps === void 0) { deps = []; }
36
+ var position = useRef(getScrollPosition(null, useWindow, boundingElement));
37
+ var throttleTimeout = null;
38
+ var callBack = function () {
39
+ var current = getScrollPosition(element, useWindow, boundingElement);
37
40
  effect(current, position.current);
38
41
  position.current = current;
39
42
  throttleTimeout = null;
40
43
  };
41
- useIsomorphicLayoutEffect(() => {
44
+ useIsomorphicLayoutEffect(function () {
45
+ var _a;
42
46
  if (!isBrowser) {
43
47
  return undefined;
44
48
  }
45
- const handleScroll = () => {
49
+ var handleScroll = function () {
46
50
  if (wait) {
47
51
  if (throttleTimeout === null) {
48
52
  throttleTimeout = window.setTimeout(callBack, wait);
@@ -53,16 +57,17 @@ export const useScrollPosition = (effect, deps = [], element, useWindow, wait, b
53
57
  }
54
58
  };
55
59
  if (boundingElement) {
56
- boundingElement.current?.addEventListener("scroll", handleScroll, {
60
+ (_a = boundingElement.current) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll", handleScroll, {
57
61
  passive: true,
58
62
  });
59
63
  }
60
64
  else {
61
65
  window.addEventListener("scroll", handleScroll, { passive: true });
62
66
  }
63
- return () => {
67
+ return function () {
68
+ var _a;
64
69
  if (boundingElement) {
65
- boundingElement.current?.removeEventListener("scroll", handleScroll);
70
+ (_a = boundingElement.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("scroll", handleScroll);
66
71
  }
67
72
  else {
68
73
  window.removeEventListener("scroll", handleScroll);
@@ -1,13 +1,15 @@
1
1
  import { isBrowser } from "@koine/utils";
2
2
  import { useHeader } from "../Header/useHeader";
3
- export function useScrollTo(id = "", offset = 0) {
4
- const [, , headerHeight] = useHeader();
3
+ export function useScrollTo(id, offset) {
4
+ if (id === void 0) { id = ""; }
5
+ if (offset === void 0) { offset = 0; }
6
+ var _a = useHeader(), headerHeight = _a[2];
5
7
  if (!isBrowser) {
6
8
  return;
7
9
  }
8
- const headerOffset = headerHeight || 0;
9
- let element = document.getElementById(id);
10
- let top = 0;
10
+ var headerOffset = headerHeight || 0;
11
+ var element = document.getElementById(id);
12
+ var top = 0;
11
13
  if (element && element.offsetParent) {
12
14
  do {
13
15
  top += element.offsetTop;
@@ -3,9 +3,10 @@ import { useEffect, useRef } from "react";
3
3
  * @see https://stackoverflow.com/a/51082563/9122820
4
4
  */
5
5
  export function useTraceUpdate(props) {
6
- const prev = useRef(props);
7
- useEffect(() => {
8
- const changedProps = Object.entries(props).reduce((ps, [k, v]) => {
6
+ var prev = useRef(props);
7
+ useEffect(function () {
8
+ var changedProps = Object.entries(props).reduce(function (ps, _a) {
9
+ var k = _a[0], v = _a[1];
9
10
  if (prev.current[k] !== v) {
10
11
  // @ts-expect-error Does not matter here...
11
12
  ps[k] = [prev.current[k], v];
@@ -3,9 +3,9 @@ import { useFirstMountState } from "./useFirstMountState";
3
3
  /**
4
4
  * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useUpdateEffect.ts)
5
5
  */
6
- export const useUpdateEffect = (effect, deps) => {
7
- const isFirstMount = useFirstMountState();
8
- useEffect(() => {
6
+ export var useUpdateEffect = function (effect, deps) {
7
+ var isFirstMount = useFirstMountState();
8
+ useEffect(function () {
9
9
  if (!isFirstMount) {
10
10
  return effect();
11
11
  }
@@ -1,13 +1,13 @@
1
1
  import { useEffect, useState } from "react";
2
2
  export function useWindowSize() {
3
- const [size, setSize] = useState([0, 0]);
4
- useEffect(() => {
3
+ var _a = useState([0, 0]), size = _a[0], setSize = _a[1];
4
+ useEffect(function () {
5
5
  function updateSize() {
6
6
  setSize([window.innerWidth, window.innerHeight]);
7
7
  }
8
8
  window.addEventListener("resize", updateSize);
9
9
  updateSize();
10
- return () => window.removeEventListener("resize", updateSize);
10
+ return function () { return window.removeEventListener("resize", updateSize); };
11
11
  }, []);
12
12
  return size;
13
13
  }
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { LazyMotion } from "framer-motion";
3
4
  /**
@@ -32,6 +33,7 @@ import { LazyMotion } from "framer-motion";
32
33
  * </MotionProvider>
33
34
  * ```
34
35
  */
35
- export const MotionProvider = ({ features, children }) => {
36
- return _jsx(LazyMotion, { features: features, children: children });
36
+ export var MotionProvider = function (_a) {
37
+ var features = _a.features, children = _a.children;
38
+ return _jsx(LazyMotion, __assign({ features: features }, { children: children }));
37
39
  };
package/package.json CHANGED
@@ -1,25 +1,26 @@
1
1
  {
2
2
  "name": "@koine/react",
3
- "version": "1.0.11",
4
3
  "sideEffects": false,
5
4
  "main": "./node/index.js",
6
5
  "typings": "./index.d.ts",
7
6
  "dependencies": {
8
7
  "styled-components": "^5.3.5",
9
- "framer-motion": "^6.3.3",
8
+ "framer-motion": "^6.3.4",
10
9
  "react": "^16.8 || ^17 || ^18",
11
- "@mui/base": "^5.0.0-alpha.80",
10
+ "@mui/base": "^5.0.0-alpha.82",
11
+ "@koine/utils": "1.0.14",
12
12
  "react-icons": "^4.3.1",
13
13
  "date-fns": "^2.28.0",
14
14
  "react-swipeable": "^7.0.0",
15
15
  "@tiptap/react": "^2.0.0-beta.109",
16
- "@tiptap/starter-kit": "^2.0.0-beta.184",
16
+ "@tiptap/starter-kit": "^2.0.0-beta.185",
17
17
  "yup": "^0.32.11",
18
- "react-hook-form": "^7.31.1",
19
- "type-fest": "^2.12.2",
18
+ "react-hook-form": "^7.31.2",
19
+ "type-fest": "^2.13.0",
20
20
  "tslib": "^2.4.0"
21
21
  },
22
22
  "peerDependencies": {},
23
23
  "module": "./index.js",
24
- "types": "./index.d.ts"
24
+ "types": "./index.d.ts",
25
+ "version": "1.0.14"
25
26
  }
package/styles/Body.js CHANGED
@@ -1,9 +1,6 @@
1
+ import { __makeTemplateObject } from "tslib";
1
2
  import styled from "styled-components";
2
- export const BodyRoot = styled.div `
3
- display: flex;
4
- flex-direction: column;
5
- min-height: 100vh;
6
- `;
3
+ export var BodyRoot = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n"], ["\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n"])));
7
4
  /**
8
5
  * If you have background graphics to overlap you might need to add:
9
6
  *
@@ -12,6 +9,5 @@ export const BodyRoot = styled.div `
12
9
  * position: relative;
13
10
  * ```
14
11
  */
15
- export const BodyMain = styled.main `
16
- flex: 1;
17
- `;
12
+ export var BodyMain = styled.main(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n flex: 1;\n"], ["\n flex: 1;\n"])));
13
+ var templateObject_1, templateObject_2;
package/styles/Global.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __makeTemplateObject } from "tslib";
1
2
  import { createGlobalStyle } from "styled-components";
2
3
  /**
3
4
  * App global style
@@ -12,39 +13,6 @@ import { createGlobalStyle } from "styled-components";
12
13
  * - @see https://www.warrenchandler.com/2019/04/02/stop-iphones-from-zooming-in-on-form-fields/
13
14
  * - @see https://css-tricks.com/16px-or-larger-text-prevents-ios-form-zoom/
14
15
  */
15
- export const stylesGlobal = `
16
- body {
17
- margin: 0;
18
- padding: 0;
19
- overflow-x: hidden;
20
- overflow-y: scroll;
21
- }
22
-
23
- body,
24
- button,
25
- input,
26
- textarea,
27
- select,
28
- select:-webkit-autofill::first-line,
29
- input:-webkit-autofill::first-line {
30
- font-family: var(--font), -apple-system, BlinkMacSystemFont, "Segoe UI",
31
- Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
32
- sans-serif;
33
- font-size: var(--fontSize);
34
- }
35
-
36
- html {
37
- box-sizing: border-box;
38
- @media (prefers-reduced-motion: no-preference) {
39
- scroll-behavior: smooth;
40
- }
41
- }
42
-
43
- *,
44
- *:before,
45
- *:after {
46
- box-sizing: inherit;
47
- -webkit-tap-highlight-color: transparent;
48
- }
49
- `;
50
- export const StylesGlobal = createGlobalStyle `${stylesGlobal}`;
16
+ export var stylesGlobal = "\n body {\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n\n body,\n button,\n input,\n textarea,\n select,\n select:-webkit-autofill::first-line,\n input:-webkit-autofill::first-line {\n font-family: var(--font), -apple-system, BlinkMacSystemFont, \"Segoe UI\",\n Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\",\n sans-serif;\n font-size: var(--fontSize);\n }\n\n html {\n box-sizing: border-box;\n @media (prefers-reduced-motion: no-preference) {\n scroll-behavior: smooth;\n }\n }\n\n *,\n *:before,\n *:after {\n box-sizing: inherit;\n -webkit-tap-highlight-color: transparent;\n }\n";
17
+ export var StylesGlobal = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), stylesGlobal);
18
+ var templateObject_1;
package/styles/media.js CHANGED
@@ -1,18 +1,19 @@
1
+ var _a;
1
2
  import { useState, useEffect } from "react";
2
3
  import { useTheme, breakpoints } from "./theme";
3
- export const { min, max, up, down, between, only } = generateMediaQueries(breakpoints);
4
+ export var min = (_a = generateMediaQueries(breakpoints), _a.min), max = _a.max, up = _a.up, down = _a.down, between = _a.between, only = _a.only;
4
5
  export function useMedia(media) {
5
- const { breakpoints } = useTheme();
6
- const [matches, setMatches] = useState(false);
7
- const [direction = "min", breakpoint] = media.split(":");
8
- let px = breakpoints[breakpoint];
6
+ var breakpoints = useTheme().breakpoints;
7
+ var _a = useState(false), matches = _a[0], setMatches = _a[1];
8
+ var _b = media.split(":"), _c = _b[0], direction = _c === void 0 ? "min" : _c, breakpoint = _b[1];
9
+ var px = breakpoints[breakpoint];
9
10
  if (direction === "max") {
10
11
  px = px - 0.02;
11
12
  }
12
- const query = `(${direction}-width: ${px}px)`;
13
- useEffect(() => {
14
- const mq = window.matchMedia(query);
15
- const handleChange = (event) => {
13
+ var query = "(".concat(direction, "-width: ").concat(px, "px)");
14
+ useEffect(function () {
15
+ var mq = window.matchMedia(query);
16
+ var handleChange = function (event) {
16
17
  setMatches(event.matches);
17
18
  };
18
19
  setMatches(mq.matches);
@@ -22,12 +23,12 @@ export function useMedia(media) {
22
23
  // Update the state whenever the media query match state changes
23
24
  mq.addListener(handleChange);
24
25
  // Clean up on unmount and if the query changes
25
- return () => {
26
+ return function () {
26
27
  mq.removeListener(handleChange);
27
28
  };
28
29
  }
29
30
  mq.addEventListener("change", handleChange);
30
- return () => {
31
+ return function () {
31
32
  mq.removeEventListener("change", handleChange);
32
33
  };
33
34
  }, [query]);
@@ -83,13 +84,13 @@ export function useMedia(media) {
83
84
  * ```
84
85
  */
85
86
  export function generateMediaQueries(breakpoints) {
86
- const temp = Object.keys(breakpoints).map((key) => {
87
- const br = key;
87
+ var temp = Object.keys(breakpoints).map(function (key) {
88
+ var br = key;
88
89
  return [br, breakpoints[br]];
89
90
  });
90
- const sortedKeys = temp.sort((a, b) => a[1] - b[1]).map((item) => item[0]);
91
- const getNext = (breakpoint) => {
92
- const index = sortedKeys.indexOf(breakpoint);
91
+ var sortedKeys = temp.sort(function (a, b) { return a[1] - b[1]; }).map(function (item) { return item[0]; });
92
+ var getNext = function (breakpoint) {
93
+ var index = sortedKeys.indexOf(breakpoint);
93
94
  return sortedKeys[index + 1];
94
95
  };
95
96
  /**
@@ -98,53 +99,57 @@ export function generateMediaQueries(breakpoints) {
98
99
  * For ease of use this can be used both as a function `min("md")` and as an
99
100
  * object literal `min.md`.
100
101
  */ // @ts-expect-error FIXME: at some point
101
- const min = (br) => `@media (min-width: ${breakpoints[br]}px)`;
102
+ var min = function (br) {
103
+ return "@media (min-width: ".concat(breakpoints[br], "px)");
104
+ };
102
105
  /**
103
106
  * It behaves the same as `@media (max-width: ${value}px)`
104
107
  * where value is the given breakpoint value.
105
108
  * For ease of use this can be used both as a function `max("md")` and as an
106
109
  * object literal `max.md`.
107
110
  */ // @ts-expect-error FIXME: at some point
108
- const max = (br) => `@media (max-width: ${breakpoints[br] - 0.02}px)`;
109
- for (const br in breakpoints) {
110
- const _br = br;
111
- min[_br] = `@media (min-width: ${breakpoints[_br]}px)`;
112
- max[_br] = `@media (max-width: ${breakpoints[_br] - 0.02}px)`;
111
+ var max = function (br) {
112
+ return "@media (max-width: ".concat(breakpoints[br] - 0.02, "px)");
113
+ };
114
+ for (var br in breakpoints) {
115
+ var _br = br;
116
+ min[_br] = "@media (min-width: ".concat(breakpoints[_br], "px)");
117
+ max[_br] = "@media (max-width: ".concat(breakpoints[_br] - 0.02, "px)");
113
118
  }
114
119
  /**
115
120
  * It behaves the same as `min`
116
121
  * @inheritdoc {max}
117
122
  */
118
- const up = min;
123
+ var up = min;
119
124
  /**
120
125
  * It behaves similarly to `max` but you will use the "next" breakpoint,
121
126
  * specifying CSS that will apply from the given breakpoint and down.
122
127
  */
123
- const down = (br) => {
124
- const brNext = getNext(br);
128
+ var down = function (br) {
129
+ var brNext = getNext(br);
125
130
  // TODO: if br does not exists otherwise throw Error
126
- return brNext && `@media (max-width: ${breakpoints[brNext] - 0.02}px)`;
131
+ return brNext && "@media (max-width: ".concat(breakpoints[brNext] - 0.02, "px)");
127
132
  };
128
133
  /**
129
134
  * Media query between the two given breakpoints
130
135
  */
131
- const between = (br1, br2) => {
132
- return `@media (min-width: ${breakpoints[br1]}px) and (max-width: ${breakpoints[br2] - 0.02}px)`;
136
+ var between = function (br1, br2) {
137
+ return "@media (min-width: ".concat(breakpoints[br1], "px) and (max-width: ").concat(breakpoints[br2] - 0.02, "px)");
133
138
  };
134
139
  /**
135
140
  * Media query to apply from the given breakpoint until the next, just for its
136
141
  * full range
137
142
  */
138
- const only = (br) => {
139
- const brNext = getNext(br);
143
+ var only = function (br) {
144
+ var brNext = getNext(br);
140
145
  return brNext ? between(br, brNext) : min(br);
141
146
  };
142
147
  return {
143
- min,
144
- max,
145
- up,
146
- down,
147
- between,
148
- only,
148
+ min: min,
149
+ max: max,
150
+ up: up,
151
+ down: down,
152
+ between: between,
153
+ only: only,
149
154
  };
150
155
  }