@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,56 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.useDateLocale = void 0;
27
- const react_1 = require("react");
28
- /**
29
- * Dynamically import the date-fns correct locale
30
- *
31
- * Inspired by:
32
- * @see https://robertmarshall.dev/blog/dynamically-import-datefns-locale-mui-datepicker-localization/
33
- */
34
- function useDateLocale(locale, defaultLocale = "en") {
35
- const [data, setData] = (0, react_1.useState)();
36
- const [current, setCurrent] = (0, react_1.useState)(defaultLocale);
37
- // const [ready, setReady] = useState(false);
38
- // If the user changes the locale listen to the change and import the locale that is now required.
39
- (0, react_1.useEffect)(() => {
40
- const importLocaleFile = async () => {
41
- // This webpack option stops all of the date-fns files being imported and chunked.
42
- const localeToSet = await Promise.resolve().then(() => __importStar(require(
43
- /* webpackMode: "lazy", webpackChunkName: "df-[index]", webpackExclude: /_lib/ */
44
- `date-fns/locale/${locale}/index.js`)));
45
- setCurrent(locale || current);
46
- setData(localeToSet.default);
47
- // setReady(true);
48
- };
49
- // If the locale has not yet been loaded.
50
- if (locale !== current) {
51
- importLocaleFile();
52
- }
53
- }, [locale, current]);
54
- return data;
55
- }
56
- exports.useDateLocale = useDateLocale;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useEffectOnce = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useEffectOnce.ts)
7
- */
8
- const useEffectOnce = (effect) => {
9
- // eslint-disable-next-line react-hooks/exhaustive-deps
10
- (0, react_1.useEffect)(effect, []);
11
- };
12
- exports.useEffectOnce = useEffectOnce;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFirstMountState = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useFirstMountState.ts)
7
- */
8
- function useFirstMountState() {
9
- const isFirst = (0, react_1.useRef)(true);
10
- if (isFirst.current) {
11
- isFirst.current = false;
12
- return true;
13
- }
14
- return isFirst.current;
15
- }
16
- exports.useFirstMountState = useFirstMountState;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFocus = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * @see https://stackoverflow.com/a/54159564/1938970
7
- */
8
- const useFocus = () => {
9
- const element = (0, react_1.useRef)(null);
10
- const setFocus = () => {
11
- element.current && element.current.focus();
12
- };
13
- return [element, setFocus];
14
- };
15
- exports.useFocus = useFocus;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useId = void 0;
4
- const utils_1 = require("@koine/utils");
5
- /**
6
- * FIXME: once we can move to react 18 just replace this import with `{ useId } from "react";`
7
- */
8
- function useId(prefix = "uid") {
9
- return `${prefix}-${(0, utils_1.uid)()}`;
10
- }
11
- exports.useId = useId;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIsomorphicLayoutEffect = void 0;
4
- const react_1 = require("react");
5
- const utils_1 = require("@koine/utils");
6
- /**
7
- * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useFirstMountState.ts)
8
- */
9
- exports.useIsomorphicLayoutEffect = utils_1.isBrowser
10
- ? react_1.useLayoutEffect
11
- : react_1.useEffect;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useMount = void 0;
4
- const useEffectOnce_1 = require("./useEffectOnce");
5
- /**
6
- * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMount.ts)
7
- */
8
- const useMount = (fn) => {
9
- (0, useEffectOnce_1.useEffectOnce)(() => {
10
- fn();
11
- });
12
- };
13
- exports.useMount = useMount;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useMountedState = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMountedState.ts)
7
- */
8
- function useMountedState() {
9
- const mountedRef = (0, react_1.useRef)(false);
10
- const get = (0, react_1.useCallback)(() => mountedRef.current, []);
11
- (0, react_1.useEffect)(() => {
12
- mountedRef.current = true;
13
- return () => {
14
- mountedRef.current = false;
15
- };
16
- }, []);
17
- return get;
18
- }
19
- exports.useMountedState = useMountedState;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePrevious = void 0;
4
- const react_1 = require("react");
5
- function usePrevious(value) {
6
- const ref = (0, react_1.useRef)();
7
- (0, react_1.useEffect)(() => {
8
- ref.current = value;
9
- });
10
- return ref.current;
11
- }
12
- exports.usePrevious = usePrevious;
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useScrollPosition = void 0;
4
- const react_1 = require("react");
5
- const utils_1 = require("@koine/utils");
6
- const useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
7
- const zeroPosition = { x: 0, y: 0 };
8
- const getClientRect = (element) => element?.getBoundingClientRect();
9
- const getScrollPosition = (element, useWindow, boundingElement) => {
10
- if (!utils_1.isBrowser) {
11
- return zeroPosition;
12
- }
13
- if (useWindow) {
14
- return { x: window.scrollX, y: window.scrollY };
15
- }
16
- const targetPosition = getClientRect(element?.current || document.body);
17
- const containerPosition = getClientRect(boundingElement?.current);
18
- if (!targetPosition) {
19
- return zeroPosition;
20
- }
21
- return containerPosition
22
- ? {
23
- x: (containerPosition.x || 0) - (targetPosition.x || 0),
24
- y: (containerPosition.y || 0) - (targetPosition.y || 0),
25
- }
26
- : { x: targetPosition.left, y: targetPosition.top };
27
- };
28
- /**
29
- * @borrows [@n8tb1t/use-scroll-position@2.0.3](https://github.com/n8tb1t/use-scroll-position) by `n8tb1t <n8tb1t@gmail.com>`
30
- *
31
- * We've just:
32
- * - reused internal helper functions
33
- * - compacted object arguments in functions as plain argument list to improve compression
34
- */
35
- const useScrollPosition = (effect, deps = [], element, useWindow, wait, boundingElement) => {
36
- const position = (0, react_1.useRef)(getScrollPosition(null, useWindow, boundingElement));
37
- let throttleTimeout = null;
38
- const callBack = () => {
39
- const current = getScrollPosition(element, useWindow, boundingElement);
40
- effect(current, position.current);
41
- position.current = current;
42
- throttleTimeout = null;
43
- };
44
- (0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(() => {
45
- if (!utils_1.isBrowser) {
46
- return undefined;
47
- }
48
- const handleScroll = () => {
49
- if (wait) {
50
- if (throttleTimeout === null) {
51
- throttleTimeout = window.setTimeout(callBack, wait);
52
- }
53
- }
54
- else {
55
- callBack();
56
- }
57
- };
58
- if (boundingElement) {
59
- boundingElement.current?.addEventListener("scroll", handleScroll, {
60
- passive: true,
61
- });
62
- }
63
- else {
64
- window.addEventListener("scroll", handleScroll, { passive: true });
65
- }
66
- return () => {
67
- if (boundingElement) {
68
- boundingElement.current?.removeEventListener("scroll", handleScroll);
69
- }
70
- else {
71
- window.removeEventListener("scroll", handleScroll);
72
- }
73
- if (throttleTimeout) {
74
- clearTimeout(throttleTimeout);
75
- }
76
- };
77
- }, deps);
78
- };
79
- exports.useScrollPosition = useScrollPosition;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useScrollTo = void 0;
4
- const utils_1 = require("@koine/utils");
5
- const useHeader_1 = require("../Header/useHeader");
6
- function useScrollTo(id = "", offset = 0) {
7
- const [, , headerHeight] = (0, useHeader_1.useHeader)();
8
- if (!utils_1.isBrowser) {
9
- return;
10
- }
11
- const headerOffset = headerHeight || 0;
12
- let element = document.getElementById(id);
13
- let top = 0;
14
- if (element && element.offsetParent) {
15
- do {
16
- top += element.offsetTop;
17
- } while ((element = element.offsetParent));
18
- }
19
- top -= offset;
20
- top -= headerOffset;
21
- window.scroll(0, top);
22
- }
23
- exports.useScrollTo = useScrollTo;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTraceUpdate = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * @see https://stackoverflow.com/a/51082563/9122820
7
- */
8
- function useTraceUpdate(props) {
9
- const prev = (0, react_1.useRef)(props);
10
- (0, react_1.useEffect)(() => {
11
- const changedProps = Object.entries(props).reduce((ps, [k, v]) => {
12
- if (prev.current[k] !== v) {
13
- // @ts-expect-error Does not matter here...
14
- ps[k] = [prev.current[k], v];
15
- }
16
- return ps;
17
- }, {});
18
- if (Object.keys(changedProps).length > 0) {
19
- console.log("Changed props:", changedProps);
20
- }
21
- prev.current = props;
22
- });
23
- }
24
- exports.useTraceUpdate = useTraceUpdate;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useUpdateEffect = void 0;
4
- const react_1 = require("react");
5
- const useFirstMountState_1 = require("./useFirstMountState");
6
- /**
7
- * @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useUpdateEffect.ts)
8
- */
9
- const useUpdateEffect = (effect, deps) => {
10
- const isFirstMount = (0, useFirstMountState_1.useFirstMountState)();
11
- (0, react_1.useEffect)(() => {
12
- if (!isFirstMount) {
13
- return effect();
14
- }
15
- // eslint-disable-next-line react-hooks/exhaustive-deps
16
- }, deps);
17
- };
18
- exports.useUpdateEffect = useUpdateEffect;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useWindowSize = void 0;
4
- const react_1 = require("react");
5
- function useWindowSize() {
6
- const [size, setSize] = (0, react_1.useState)([0, 0]);
7
- (0, react_1.useEffect)(() => {
8
- function updateSize() {
9
- setSize([window.innerWidth, window.innerHeight]);
10
- }
11
- window.addEventListener("resize", updateSize);
12
- updateSize();
13
- return () => window.removeEventListener("resize", updateSize);
14
- }, []);
15
- return size;
16
- }
17
- exports.useWindowSize = useWindowSize;
package/node/index.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./shared"), exports);
5
- // we need to alias the star export otherwise the named exports would collide
6
- // export * as css from "./css";
7
- // export * as sc from "./sc";
8
- // export * as tw from "./tw";
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MotionProvider = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const framer_motion_1 = require("framer-motion");
6
- /**
7
- * `<LazyMotion />` provider wrapper from `framer-motion`
8
- *
9
- * @see https://www.framer.com/docs/guide-reduce-bundle-size/
10
- *
11
- * About the difference between `lite` and `max`
12
- * @see https://www.framer.com/docs/guide-reduce-bundle-size/#available-features
13
- *
14
- * @example
15
- *
16
- * `lite` version:
17
- * ```tsx
18
- * import { MotionProvider } from "@koine/react/m";
19
- *
20
- * const features = () => import("@koine/react/m/lite").then((m) => m.default);
21
- *
22
- * <MotionProvider features={features}>
23
- * <App />
24
- * </MotionProvider>
25
- * ```
26
- *
27
- * ### `max` version
28
- * ```tsx
29
- * import { MotionProvider } from "@koine/react/m";
30
- *
31
- * const features = () => import("@koine/react/m/max").then((m) => m.default);
32
- *
33
- * <MotionProvider features={features}>
34
- * <App />
35
- * </MotionProvider>
36
- * ```
37
- */
38
- const MotionProvider = ({ features, children }) => {
39
- return (0, jsx_runtime_1.jsx)(framer_motion_1.LazyMotion, { features: features, children: children });
40
- };
41
- exports.MotionProvider = MotionProvider;
package/node/m/index.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /**
3
- * @file
4
- *
5
- * In this file we only have exports related to `framer-motion`
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const tslib_1 = require("tslib");
9
- tslib_1.__exportStar(require("./MotionProvider"), exports);
package/node/m/lite.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const framer_motion_1 = require("framer-motion");
4
- exports.default = framer_motion_1.domAnimation;
package/node/m/max.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const framer_motion_1 = require("framer-motion");
4
- exports.default = framer_motion_1.domMax;
package/node/sc/index.js DELETED
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KoineForm = exports.KoineDialog = void 0;
4
- const tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("../shared"), exports);
6
- tslib_1.__exportStar(require("../Alert"), exports);
7
- tslib_1.__exportStar(require("../Animations"), exports);
8
- tslib_1.__exportStar(require("../Autocomplete"), exports);
9
- tslib_1.__exportStar(require("../Bg"), exports);
10
- tslib_1.__exportStar(require("../Breadcrumbs"), exports);
11
- tslib_1.__exportStar(require("../Buttons"), exports);
12
- tslib_1.__exportStar(require("../Carousel"), exports);
13
- tslib_1.__exportStar(require("../Collapsable"), exports);
14
- tslib_1.__exportStar(require("../Debug"), exports);
15
- var bare_1 = require("../Dialog/sc/bare");
16
- Object.defineProperty(exports, "KoineDialog", { enumerable: true, get: function () { return bare_1.KoineDialog; } });
17
- var bare_2 = require("../Form/sc/bare");
18
- Object.defineProperty(exports, "KoineForm", { enumerable: true, get: function () { return bare_2.KoineForm; } });
19
- tslib_1.__exportStar(require("../Forms"), exports);
20
- tslib_1.__exportStar(require("../Grid"), exports);
21
- tslib_1.__exportStar(require("../Hamburger"), exports);
22
- tslib_1.__exportStar(require("../Header"), exports);
23
- tslib_1.__exportStar(require("../Hidden"), exports);
24
- tslib_1.__exportStar(require("../Img"), exports);
25
- tslib_1.__exportStar(require("../Link"), exports);
26
- tslib_1.__exportStar(require("../MenuItem"), exports);
27
- tslib_1.__exportStar(require("../Pagination"), exports);
28
- tslib_1.__exportStar(require("../Pill"), exports);
29
- tslib_1.__exportStar(require("../Progress"), exports);
30
- tslib_1.__exportStar(require("../Rating"), exports);
31
- // export * from "../Select";
32
- tslib_1.__exportStar(require("../Sidebar"), exports);
33
- tslib_1.__exportStar(require("../Spacing"), exports);
34
- tslib_1.__exportStar(require("../Sticky"), exports);
35
- tslib_1.__exportStar(require("../styles"), exports);
36
- tslib_1.__exportStar(require("../Tabs"), exports);
37
- tslib_1.__exportStar(require("../Typography"), exports);
package/node/scm/index.js DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KoineDialog = void 0;
4
- const tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("../shared"), exports);
6
- tslib_1.__exportStar(require("../Alert"), exports);
7
- tslib_1.__exportStar(require("../Animations"), exports);
8
- tslib_1.__exportStar(require("../Autocomplete"), exports);
9
- tslib_1.__exportStar(require("../Bg"), exports);
10
- tslib_1.__exportStar(require("../Breadcrumbs"), exports);
11
- tslib_1.__exportStar(require("../Buttons"), exports);
12
- tslib_1.__exportStar(require("../Carousel"), exports);
13
- tslib_1.__exportStar(require("../Collapsable"), exports);
14
- tslib_1.__exportStar(require("../Debug"), exports);
15
- var framer_1 = require("../Dialog/sc/framer");
16
- Object.defineProperty(exports, "KoineDialog", { enumerable: true, get: function () { return framer_1.KoineDialog; } });
17
- // export { KoineForm, type KoineFormProps} from "../Form/sc/framer";
18
- tslib_1.__exportStar(require("../Forms"), exports);
19
- tslib_1.__exportStar(require("../Grid"), exports);
20
- tslib_1.__exportStar(require("../Hamburger"), exports);
21
- tslib_1.__exportStar(require("../Header"), exports);
22
- tslib_1.__exportStar(require("../Hidden"), exports);
23
- tslib_1.__exportStar(require("../Img"), exports);
24
- tslib_1.__exportStar(require("../Link"), exports);
25
- tslib_1.__exportStar(require("../MenuItem"), exports);
26
- tslib_1.__exportStar(require("../Pagination"), exports);
27
- tslib_1.__exportStar(require("../Pill"), exports);
28
- tslib_1.__exportStar(require("../Progress"), exports);
29
- tslib_1.__exportStar(require("../Rating"), exports);
30
- // export * from "../Select";
31
- tslib_1.__exportStar(require("../Sidebar"), exports);
32
- tslib_1.__exportStar(require("../Spacing"), exports);
33
- tslib_1.__exportStar(require("../Sticky"), exports);
34
- tslib_1.__exportStar(require("../styles"), exports);
35
- tslib_1.__exportStar(require("../Tabs"), exports);
36
- tslib_1.__exportStar(require("../Typography"), exports);
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("../Calendar"), exports);
5
- tslib_1.__exportStar(require("../Dialog"), exports);
6
- tslib_1.__exportStar(require("../Favicon"), exports);
7
- tslib_1.__exportStar(require("../helpers"), exports);
8
- tslib_1.__exportStar(require("../hooks"), exports);
9
- tslib_1.__exportStar(require("../Meta"), exports);
10
- tslib_1.__exportStar(require("../NoJs"), exports);
11
- tslib_1.__exportStar(require("../types"), exports);
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BodyMain = exports.BodyRoot = void 0;
4
- const tslib_1 = require("tslib");
5
- const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
6
- exports.BodyRoot = styled_components_1.default.div `
7
- display: flex;
8
- flex-direction: column;
9
- min-height: 100vh;
10
- `;
11
- /**
12
- * If you have background graphics to overlap you might need to add:
13
- *
14
- * ```css
15
- * z-index: 1;
16
- * position: relative;
17
- * ```
18
- */
19
- exports.BodyMain = styled_components_1.default.main `
20
- flex: 1;
21
- `;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StylesGlobal = exports.stylesGlobal = void 0;
4
- const styled_components_1 = require("styled-components");
5
- /**
6
- * App global style
7
- *
8
- * For examples of what to do here take a look at [Bootstrap's reset](https://github.com/twbs/bootstrap/blob/main/scss/_reboot.scss)
9
- * and similar.
10
- *
11
- * What we do here:
12
- * - set the base font family on all possible elements including placeholders prevent Chrome showing a standard font when using the autofill feature
13
- * - @see https://stackoverflow.com/a/60987373/1938970
14
- * - set the base font size on all possible elements to prevent weird zooming on input fields on iPhone iOS devices.
15
- * - @see https://www.warrenchandler.com/2019/04/02/stop-iphones-from-zooming-in-on-form-fields/
16
- * - @see https://css-tricks.com/16px-or-larger-text-prevents-ios-form-zoom/
17
- */
18
- exports.stylesGlobal = `
19
- body {
20
- margin: 0;
21
- padding: 0;
22
- overflow-x: hidden;
23
- overflow-y: scroll;
24
- }
25
-
26
- body,
27
- button,
28
- input,
29
- textarea,
30
- select,
31
- select:-webkit-autofill::first-line,
32
- input:-webkit-autofill::first-line {
33
- font-family: var(--font), -apple-system, BlinkMacSystemFont, "Segoe UI",
34
- Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
35
- sans-serif;
36
- font-size: var(--fontSize);
37
- }
38
-
39
- html {
40
- box-sizing: border-box;
41
- @media (prefers-reduced-motion: no-preference) {
42
- scroll-behavior: smooth;
43
- }
44
- }
45
-
46
- *,
47
- *:before,
48
- *:after {
49
- box-sizing: inherit;
50
- -webkit-tap-highlight-color: transparent;
51
- }
52
- `;
53
- exports.StylesGlobal = (0, styled_components_1.createGlobalStyle) `${exports.stylesGlobal}`;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Body"), exports);
5
- tslib_1.__exportStar(require("./Global"), exports);
6
- tslib_1.__exportStar(require("./media"), exports);
7
- tslib_1.__exportStar(require("./spacing"), exports);
8
- tslib_1.__exportStar(require("./styled"), exports);
9
- tslib_1.__exportStar(require("./theme"), exports);
10
- tslib_1.__exportStar(require("./theme--vanilla"), exports);