@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,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Rating = exports.RatingRoot = exports.RatingValue = exports.RatingCount = exports.RatingDetails = exports.RatingStar = exports.RatingStarRoot = void 0;
4
- const tslib_1 = require("tslib");
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
8
- const useId_1 = require("../hooks/useId");
9
- exports.RatingStarRoot = styled_components_1.default.svg `
10
- display: inline-block;
11
- vertical-align: middle;
12
- margin-right: 1px;
13
- `;
14
- const RatingStar = ({ value, colorBg = "#FFD84C", colorStroke = "#947813", size, ...props }) => {
15
- const id = (0, useId_1.useId)();
16
- return ((0, jsx_runtime_1.jsxs)(exports.RatingStarRoot, { viewBox: "0 0 16 16", "data-value": value, width: size + "px", height: size + "px", ...props, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("linearGradient", { id: id, x1: "0", y1: "0", x2: "1", y2: "0", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0", stopColor: colorBg }), (0, jsx_runtime_1.jsx)("stop", { offset: value, stopColor: colorBg }), (0, jsx_runtime_1.jsx)("stop", { offset: value, stopColor: "rgba(255, 255, 255, 0)" })] }) }), (0, jsx_runtime_1.jsx)("path", { stroke: colorStroke, strokeWidth: "0.5", fill: `url(#${id})`, d: "M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.283.95l-3.523 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z" })] }));
17
- };
18
- exports.RatingStar = RatingStar;
19
- exports.RatingDetails = styled_components_1.default.span `
20
- padding-left: 0.5em;
21
- font-size: 12px;
22
- color: var(--grey100);
23
-
24
- &:before {
25
- content: "(";
26
- }
27
- &:after {
28
- content: ")";
29
- }
30
- `;
31
- exports.RatingCount = styled_components_1.default.span ``;
32
- exports.RatingValue = styled_components_1.default.span `
33
- display: none;
34
- `;
35
- exports.RatingRoot = styled_components_1.default.div `
36
- display: flex;
37
- align-items: center;
38
-
39
- &:hover ${exports.RatingValue} {
40
- display: inline-block;
41
- }
42
- `;
43
- const Rating = ({ value = 0, count, min = 0, max = 5, showDetails = true, colorBg, colorStroke, starSize = 16, }) => {
44
- const id = (0, useId_1.useId)();
45
- const [currentValue /* , _setCurrentValue */] = (0, react_1.useState)(value);
46
- const [stars, setStars] = (0, react_1.useState)([]);
47
- const getStars = (0, react_1.useCallback)((activeCount) => {
48
- const stars = [];
49
- for (let currentStar = min + 1; currentStar < max + 1; currentStar++) {
50
- let starValue;
51
- const roundedActiveCount = Math.floor(activeCount);
52
- // we have a rating of 3.4, when we get to the 4th star:
53
- if (roundedActiveCount === currentStar - 1) {
54
- starValue = 1 - (currentStar - activeCount);
55
- }
56
- else if (roundedActiveCount >= currentStar) {
57
- starValue = 1;
58
- }
59
- else {
60
- starValue = 0;
61
- }
62
- stars.push({ value: starValue });
63
- }
64
- return stars;
65
- }, [min, max]);
66
- (0, react_1.useEffect)(() => {
67
- setStars(getStars(currentValue));
68
- }, [currentValue, getStars]);
69
- // function updateStars(index) {
70
- // var currentActive = stars.filter((x) => x.active);
71
- // if (index !== currentActive.length) {
72
- // setStars(getStars(index));
73
- // }
74
- // }
75
- // function handleMouseOver(event) {
76
- // let index = Number(event.currentTarget.getAttribute("data-idx")) + 1;
77
- // updateStars(index);
78
- // }
79
- // function handleMouseLeave() {
80
- // setStars(getStars());
81
- // }
82
- // const handleClick = useCallback((event) => {
83
- // let index = Number(event.currentTarget.getAttribute("data-idx"));
84
- // let value = index = index + 1;
85
- // if (value !== currentValue) {
86
- // setStars(getStars(value));
87
- // setCurrentValue(value);
88
- // onChange(value);
89
- // }
90
- // }, [onChange];
91
- return ((0, jsx_runtime_1.jsxs)(exports.RatingRoot, { children: [stars.map((star, idx) => ((0, jsx_runtime_1.jsx)(exports.RatingStar, { idx: idx, dataIdx: idx, size: starSize,
92
- // onMouseOver={handleMouseOver}
93
- // onMouseLeave={handleMouseLeave}
94
- // onClick={handleClick}
95
- value: star.value, colorBg: colorBg, colorStroke: colorStroke }, id + idx))), " ", showDetails && count && ((0, jsx_runtime_1.jsxs)(exports.RatingDetails, { children: [(0, jsx_runtime_1.jsx)(exports.RatingCount, { children: count }), (0, jsx_runtime_1.jsx)(exports.RatingValue, { children: ` - ${value}` })] }))] }));
96
- };
97
- exports.Rating = Rating;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deriveRating = exports.convertRange = exports.getRatingValue = exports.getRatingWord = void 0;
4
- const tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("./Rating"), exports);
6
- const RATING_WORDS = {
7
- 0: "Worst",
8
- 1: "Bad",
9
- 2: "Mediocre",
10
- 3: "Good",
11
- 4: "Great",
12
- 4.5: "Excellent",
13
- 5: "Best",
14
- };
15
- const getRatingWord = (value, precision = 0.5) => {
16
- let buffer = 0;
17
- let word;
18
- while (buffer < value) {
19
- // @ts-expect-error can't remember
20
- word = RATING_WORDS[buffer];
21
- buffer += precision;
22
- }
23
- return word;
24
- };
25
- exports.getRatingWord = getRatingWord;
26
- const getRatingValue = (value) => {
27
- const converted = convertRange(value, [0, 5], [0, 10]);
28
- if (converted % 1 === 0) {
29
- return converted;
30
- }
31
- return converted.toFixed(1);
32
- };
33
- exports.getRatingValue = getRatingValue;
34
- /**
35
- * @see https://stackoverflow.com/a/14224813
36
- */
37
- function convertRange(value, r1, r2) {
38
- return ((value - r1[0]) * (r2[1] - r2[0])) / (r1[1] - r1[0]) + r2[0];
39
- }
40
- exports.convertRange = convertRange;
41
- const deriveRating = (title, date, minValue = 3.8, maxValue = 5, minQuantity = 9) => {
42
- const entityTime = date.getTime();
43
- const nowTime = new Date().getTime();
44
- const length = title.length;
45
- const value = Number(convertRange(length, [0, 90], [minValue, maxValue]).toFixed(2));
46
- const timeDifference = convertRange(nowTime - entityTime, [0, 10000000000000], [minQuantity, 999999]);
47
- const count = Math.round(timeDifference / length);
48
- return {
49
- value,
50
- count,
51
- };
52
- };
53
- exports.deriveRating = deriveRating;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Select = void 0;
4
- exports.Select = null;
5
- // import { useSelect } from "downshift";
6
- // export type SelectProps = {
7
- // options?: Option[];
8
- // };
9
- // export const Select = ({ options = [] }: SelectProps) => {
10
- // const {
11
- // isOpen,
12
- // selectedItem,
13
- // getToggleButtonProps,
14
- // getLabelProps,
15
- // getMenuProps,
16
- // highlightedIndex,
17
- // getItemProps,
18
- // } = useSelect({ items: options });
19
- // return (
20
- // <div>
21
- // <label {...getLabelProps()}>Choose an element:</label>
22
- // <button type="button" {...getToggleButtonProps()}>
23
- // {selectedItem || "Elements"}
24
- // </button>
25
- // <ul {...getMenuProps()}>
26
- // {isOpen &&
27
- // options.map((item, index) => (
28
- // <li
29
- // style={
30
- // highlightedIndex === index ? { backgroundColor: "#bde4ff" } : {}
31
- // }
32
- // key={`${item.value}${index}`}
33
- // {...getItemProps({ item, index })}
34
- // >
35
- // {item.label}
36
- // </li>
37
- // ))}
38
- // </ul>
39
- // </div>
40
- // );
41
- // };
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SelectArrow = exports.SelectArrowStyled = void 0;
4
- const tslib_1 = require("tslib");
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
8
- const framer_motion_1 = require("framer-motion");
9
- const bs_1 = require("react-icons/bs");
10
- exports.SelectArrowStyled = (0, styled_components_1.default)(framer_motion_1.m.span) `
11
- display: inline-flex;
12
- align-items: center;
13
- justify-content: center;
14
- width: 2em;
15
-
16
- &:not([disabled]) {
17
- cursor: pointer;
18
- }
19
- `;
20
- exports.SelectArrow = (0, react_1.forwardRef)(function SelectArrow({ isOpen, ...props }, ref) {
21
- return ((0, jsx_runtime_1.jsx)(exports.SelectArrowStyled, { animate: { rotate: isOpen ? 180 : 0 }, ref: ref, ...props, children: (0, jsx_runtime_1.jsx)(bs_1.BsBoxArrowInDown, {}) }));
22
- });
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Select = void 0;
4
- var SelectDownshift_1 = require("./SelectDownshift");
5
- Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return SelectDownshift_1.Select; } });
6
- // export type { SelectProps } from "./SelectReach";
7
- // export { Select } from "./SelectReach";
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Sidebar = void 0;
4
- const tslib_1 = require("tslib");
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
8
- const gr_1 = require("react-icons/gr");
9
- const cg_1 = require("react-icons/cg");
10
- const media_1 = require("../styles/media");
11
- const Buttons_1 = require("../Buttons");
12
- const Header_1 = require("../Header");
13
- const SidebarWrapper = styled_components_1.default.div `
14
- ${(p) => `${media_1.max.md} {
15
- z-index: 20;
16
- display: flex;
17
- flex-direction: column;
18
- position: fixed;
19
- right: 0;
20
- left: var(--gutter-half);
21
- top: ${p.$top || 0}px;
22
- bottom: 0;
23
- padding: var(--gutter-half);
24
- transform: ${p.$open ? `translateX(0)` : `translateX(100%)`};
25
- transition: transform .18s ease-in-out, box-shadow .18s ease-in-out;
26
- background: white;
27
- box-shadow: ${p.$open ? `0 0 0 100vh rgba(0, 0, 0, .3)` : `0 0 100vh rgba(0, 0, 0, 0)`};
28
- will-change: transform, box-shadow;
29
- pointer-events: ${p.$open ? "all" : "none"}
30
- }`}
31
- `;
32
- const SidebarToggle = styled_components_1.default.span `
33
- z-index: 21;
34
- position: fixed;
35
- right: var(--gutter-half);
36
- bottom: var(--gutter-half);
37
- ${media_1.min.md} {
38
- display: none;
39
- }
40
-
41
- path {
42
- stroke: currentColor;
43
- }
44
- `;
45
- const Sidebar = ({ children }) => {
46
- const [open, setOpen] = (0, react_1.useState)(false);
47
- const [, , headerHeight] = (0, Header_1.useHeader)();
48
- const handleClickToggle = (0, react_1.useCallback)(() => {
49
- setOpen((prevOpen) => !prevOpen);
50
- }, []);
51
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SidebarToggle, { onClick: handleClickToggle, children: (0, jsx_runtime_1.jsx)(Buttons_1.IconButtonFab, { "$variant": "contained", children: open ? (0, jsx_runtime_1.jsx)(cg_1.CgCloseR, {}) : (0, jsx_runtime_1.jsx)(gr_1.GrFolderOpen, {}) }) }), (0, jsx_runtime_1.jsx)(SidebarWrapper, { "$open": open, "$top": headerHeight, children: children })] }));
52
- };
53
- exports.Sidebar = Sidebar;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Sidebar"), exports);
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Spacing = void 0;
4
- const tslib_1 = require("tslib");
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
7
- const utils_1 = require("@koine/utils");
8
- const spacing_1 = require("../styles/spacing");
9
- const Root = styled_components_1.default.div `
10
- ${(p) => p.$top && spacing_1.spacingTop.call(p.theme, ...p.$top)}
11
- ${(p) => p.$bottom && spacing_1.spacingBottom.call(p.theme, ...p.$bottom)}
12
- `;
13
- const extractDirectionArgs = (raw) => {
14
- const [size, factor, property, devices] = raw.split(":");
15
- const factorArg = (0, utils_1.isUndefined)(factor) ? undefined : parseFloat(factor);
16
- const devicesArg = devices?.split(",");
17
- return [size, factorArg, property, devicesArg];
18
- };
19
- /**
20
- * Usage:
21
- *
22
- * ```jsx
23
- * <Spacing top="sm" />
24
- * <Spacing top="sm:1.5" />
25
- * <Spacing top="sm:1.5" bottom="lg" />
26
- * <Spacing vertical="sm:1.5:margin:mobile" />
27
- * <Spacing top="sm:1.5:padding:mobile" />
28
- * <Spacing top="sm:2:padding:tablet,desktop" />
29
- * ```
30
- */
31
- const Spacing = ({ top, bottom, vertical, ...props }) => {
32
- let $top;
33
- let $bottom;
34
- if (top) {
35
- $top = extractDirectionArgs(top);
36
- }
37
- if (bottom) {
38
- $bottom = extractDirectionArgs(bottom);
39
- }
40
- if (vertical) {
41
- $top = extractDirectionArgs(vertical);
42
- $bottom = $top;
43
- }
44
- if (!$top && !$bottom && !vertical) {
45
- // eslint-disable-next-line react/jsx-no-useless-fragment
46
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.children });
47
- }
48
- return (0, jsx_runtime_1.jsx)(Root, { "$top": $top, "$bottom": $bottom, ...props });
49
- };
50
- exports.Spacing = Spacing;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Spacing"), exports);
@@ -1,222 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Sticky = void 0;
4
- exports.Sticky = null;
5
- // import {
6
- // Ref,
7
- // CSSProperties,
8
- // useState,
9
- // useCallback,
10
- // useEffect,
11
- // useRef,
12
- // } from "react";
13
- // /**
14
- // * Get current coordinates `left` and `top` of specific element.
15
- // */
16
- // const offsetRelative = (element: HTMLElement) => {
17
- // var result = { l: 0, t: 0 };
18
- // do {
19
- // let offsetTop = element.offsetTop;
20
- // let offsetLeft = element.offsetLeft;
21
- // if (!isNaN(offsetTop)) result.t += offsetTop;
22
- // if (!isNaN(offsetLeft)) result.l += offsetLeft;
23
- // // @ts-expect-error just rething everyhting in this file
24
- // element =
25
- // "BODY" === element.tagName ? element.parentElement : element.offsetParent;
26
- // } while (element);
27
- // return result;
28
- // };
29
- // export type StickyElementProps = {
30
- // ref: Ref<HTMLDivElement>;
31
- // sticky?: boolean;
32
- // style: CSSProperties;
33
- // };
34
- // /**
35
- // * - `0`: "STATIC": Static position as nothing happened
36
- // * - `1`: "VIEWPORT-TOP": Sticked to the top screen edge
37
- // * - `2`: "VIEWPORT-BOTTOM": Sticked to the bottom screen edge
38
- // * - `4`: "VIEWPORT-UNBOTTOM": ? Scrolling in the middle of the element, neither sticked nor static
39
- // * - `3`: "CONTAINER-BOTTOM": ?
40
- // */
41
- // export type StickyStatus = 0 | 1 | 2 | 3;
42
- // type DimensionsBasic = [
43
- // /** containerTop */
44
- // number,
45
- // /** containerHeight */
46
- // number,
47
- // /** containerBottom */
48
- // number,
49
- // /** elementHeight */
50
- // number,
51
- // /** elementWidth */
52
- // number,
53
- // /** viewportHeight */
54
- // number,
55
- // /** maxTranslateY */
56
- // number
57
- // ];
58
- // type DimensionsOnScroll = [
59
- // /** elementLeft */
60
- // number,
61
- // /** viewportTop */
62
- // number,
63
- // /** viewportBottom */
64
- // number,
65
- // /** viewportLeft */
66
- // number,
67
- // /** topSpacing */
68
- // number,
69
- // /** bottomSpacing */
70
- // number
71
- // /** translateY */
72
- // // number,
73
- // /** lastTopSpacing */
74
- // // number,
75
- // /** lastBottomSpacing */
76
- // // number,
77
- // /** lastViewportTop */
78
- // // number,
79
- // ];
80
- // type Dimensions = DimensionsBasic & DimensionsOnScroll;
81
- // const getDimensionsBasic = (container: HTMLElement, inner: HTMLElement) => {
82
- // const containerTop = offsetRelative(container).t;
83
- // const containerHeight = container.clientHeight;
84
- // const containerBottom = containerTop + containerHeight;
85
- // const elementHeight = inner.offsetHeight;
86
- // const elementWidth = inner.offsetWidth;
87
- // const viewportHeight = window.innerHeight;
88
- // const maxTranslateY = containerHeight - elementHeight;
89
- // return [
90
- // containerTop,
91
- // containerHeight,
92
- // containerBottom,
93
- // elementHeight,
94
- // elementWidth,
95
- // viewportHeight,
96
- // maxTranslateY,
97
- // ] as DimensionsBasic;
98
- // };
99
- // const getDimensionsOnScroll = (
100
- // wrapper: HTMLElement,
101
- // container: HTMLElement,
102
- // inner: HTMLElement
103
- // ) => {
104
- // const elementLeft = offsetRelative(wrapper).l;
105
- // const viewportTop =
106
- // document.documentElement.scrollTop || document.body.scrollTop;
107
- // const viewportBottom = viewportTop + window.innerHeight;
108
- // const viewportLeft =
109
- // document.documentElement.scrollLeft || document.body.scrollLeft;
110
- // const topSpacing = 0; // TODO: make it a prop?
111
- // const bottomSpacing = 0; // TODO: make it a prop?
112
- // // const lastTopSpacing = topSpacing;
113
- // // const lastBottomSpacing = bottomSpacing;
114
- // return [
115
- // elementLeft,
116
- // viewportTop,
117
- // viewportBottom,
118
- // viewportLeft,
119
- // topSpacing,
120
- // bottomSpacing,
121
- // ] as DimensionsOnScroll;
122
- // };
123
- // // const getTranslateYonScroll = (dimensions: DimensionsOnScroll, status: StickyStatus) => {
124
- // // if (status === 1) {
125
- // // // Adjust translate Y in the case decrease top spacing value.
126
- // // if (dimensions[5] < dims.lastTopSpacing) {
127
- // // dims.translateY += dims.lastTopSpacing - dims.topSpacing;
128
- // // this._reStyle = true;
129
- // // }
130
- // // } else if (status === 2) {
131
- // // // Adjust translate Y in the case decrease bottom spacing value.
132
- // // if (dims.bottomSpacing < dims.lastBottomSpacing) {
133
- // // dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing;
134
- // // this._reStyle = true;
135
- // // }
136
- // // }
137
- // // }
138
- // export type StickyProps = {
139
- // /** @default "div" */
140
- // Wrapper?: FC<StickyElementProps>;
141
- // /** @default "div" */
142
- // Inner?: FC<StickyElementProps>;
143
- // top: number;
144
- // };
145
- // export const Sticky: FC<StickyProps> = ({
146
- // Wrapper = "div",
147
- // Inner = "div",
148
- // children,
149
- // top,
150
- // ...props
151
- // }) => {
152
- // const [sticky, setSticky] = useState(false);
153
- // const [shouldRestyle, setShouldRestyle] = useState<boolean>();
154
- // const stickyStatus = useRef<StickyStatus>(0);
155
- // const [dimensionsBasic, setDimensionsBasic] = useState<DimensionsBasic>();
156
- // const [dimensionsOnScroll, setDimensionsOnScroll] =
157
- // useState<DimensionsOnScroll>();
158
- // const [translateY, setTranslateY] = useState<number>(0);
159
- // const [styleWrapper, setStyleWrapper] = useState({});
160
- // const [styleInner, setStyleInner] = useState({});
161
- // const [innerWidth, setInnerWidth] = useState<string>();
162
- // const wrapperRef = useRef<HTMLDivElement>(null);
163
- // const innerRef = useRef<HTMLDivElement>(null);
164
- // const handleScroll = useCallback(() => {
165
- // const wrapper = wrapperRef?.current;
166
- // const container = wrapper?.parentElement || null;
167
- // const inner = innerRef?.current;
168
- // if (wrapper && inner && container) {
169
- // const dimensions = getDimensionsOnScroll(wrapper, container, inner);
170
- // setDimensionsOnScroll(dimensions);
171
- // }
172
- // }, []);
173
- // const handleResize = useCallback(() => {
174
- // const container = wrapperRef?.current?.parentElement || null;
175
- // const inner = innerRef?.current;
176
- // if (inner && container) {
177
- // setDimensionsBasic(getDimensionsBasic(container, inner));
178
- // // if (innerRef?.current) {
179
- // // setInnerWidth(window.getComputedStyle(innerRef.current).width);
180
- // // }
181
- // // setSticky(wrapperRef.current.getBoundingClientRect().top <= top);
182
- // }
183
- // }, []);
184
- // useEffect(() => {
185
- // const container = wrapperRef?.current?.parentElement || null;
186
- // const inner = innerRef?.current;
187
- // if (inner && container) {
188
- // setDimensionsBasic(getDimensionsBasic(container, inner));
189
- // }
190
- // window.addEventListener("scroll", handleScroll, { passive: true });
191
- // window.addEventListener("resize", handleResize, { passive: true });
192
- // return () => {
193
- // window.removeEventListener("scroll", () => handleScroll);
194
- // window.removeEventListener("resize", () => handleResize);
195
- // };
196
- // }, [wrapperRef, innerRef, handleScroll, handleResize]);
197
- // // useEffect(() => {
198
- // // if (sticky) {
199
- // // setStyleInner({
200
- // // position: "fixed",
201
- // // zIndex: 1,
202
- // // top,
203
- // // width: innerWidth,
204
- // // });
205
- // // } else {
206
- // // setStyleInner({});
207
- // // }
208
- // // }, [sticky, top, innerWidth]);
209
- // return (
210
- // <Wrapper
211
- // ref={wrapperRef}
212
- // sticky={Wrapper === "div" ? undefined : sticky}
213
- // style={{
214
- // position: "relative",
215
- // }}
216
- // >
217
- // <Inner ref={innerRef} style={styleInner}>
218
- // {children}
219
- // </Inner>
220
- // </Wrapper>
221
- // );
222
- // };
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StickyCss = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const StickyCss = ({ top, ...props }) => {
6
- return (0, jsx_runtime_1.jsx)("div", { style: { position: "sticky", top: 100 }, ...props });
7
- };
8
- exports.StickyCss = StickyCss;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./StickyCss"), exports);
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KoineTabs = exports.Tab = exports.Panel = exports.Indicator = exports.List = exports.Root = void 0;
4
- const tslib_1 = require("tslib");
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const TabsUnstyled_1 = tslib_1.__importDefault(require("@mui/base/TabsUnstyled"));
8
- const TabsListUnstyled_1 = tslib_1.__importDefault(require("@mui/base/TabsListUnstyled"));
9
- const TabUnstyled_1 = tslib_1.__importStar(require("@mui/base/TabUnstyled"));
10
- const TabPanelUnstyled_1 = tslib_1.__importDefault(require("@mui/base/TabPanelUnstyled"));
11
- const helpers_1 = require("../helpers");
12
- exports.Root = TabsUnstyled_1.default;
13
- exports.List = TabsListUnstyled_1.default;
14
- // export const Tab = TabUnstyled as unknown as Props["Tab"];
15
- exports.Indicator = "span";
16
- exports.Panel = TabPanelUnstyled_1.default;
17
- exports.Tab = (0, react_1.forwardRef)(function Tab({ children, component, componentsProps, components, Indicator, ...props }, ref) {
18
- const { active, disabled, selected } = (0, TabUnstyled_1.useTab)({ ...props, ref });
19
- const indicatorProps = { active, disabled, selected };
20
- return ((0, jsx_runtime_1.jsxs)(TabUnstyled_1.default /* ref={ref} */, { ...props, children: [children, Indicator && (0, jsx_runtime_1.jsx)(Indicator, { ...indicatorProps })] }));
21
- });
22
- /**
23
- *
24
- * Main differences from [Mui Tabs](https://mui.com/material-ui/react-dialog):
25
- *
26
- * @resources
27
- * - [WAI-ARIA](https://www.w3.org/TR/wai-aria-practices/#tabpanel)
28
- * - [WAI-ARIA example](https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html)
29
- * - [[Proposal] New tags tabsection, tablist, tab, tabpanel](https://github.com/whatwg/html/issues/1809)
30
- * - [Native <tab> elements](https://github.com/w3c/html/issues/1704)
31
- * - [Let's talk about Native HTML Tabs](https://daverupert.com/2021/10/native-html-tabs/)
32
- *
33
- * @similar
34
- * - [Zertz/react-headless-tabs](https://github.com/Zertz/react-headless-tabs)
35
- *
36
- * FIXME: it actually works even without forwardRef, check if we do need it
37
- */
38
- const TabsWithRef = (0, react_1.forwardRef)(function Tabs({ Root: _Root, List: _List, Tab: _Tab, Indicator: _Indicator, Panel: _Panel, ...props }, ref) {
39
- return (0, jsx_runtime_1.jsx)(exports.Root, { ...props, ref: ref });
40
- });
41
- exports.KoineTabs = (0, helpers_1.extendComponent)(TabsWithRef, {
42
- Root: exports.Root,
43
- List: exports.List,
44
- Tab: exports.Tab,
45
- Indicator: exports.Indicator,
46
- Panel: exports.Panel,
47
- });
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./TabsMui"), exports);